當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MessageGroups::getSharedGroups方法代碼示例

本文整理匯總了PHP中MessageGroups::getSharedGroups方法的典型用法代碼示例。如果您正苦於以下問題:PHP MessageGroups::getSharedGroups方法的具體用法?PHP MessageGroups::getSharedGroups怎麽用?PHP MessageGroups::getSharedGroups使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MessageGroups的用法示例。


在下文中一共展示了MessageGroups::getSharedGroups方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: execute

 public function execute($parameters)
 {
     $this->setHeaders();
     $user = $this->getUser();
     $request = $this->getRequest();
     $target = $request->getText('target', $parameters);
     $revision = $request->getInt('revision', 0);
     $action = $request->getVal('do');
     $out = $this->getOutput();
     TranslateUtils::addSpecialHelpLink($out, 'Help:Extension:Translate/Page_translation_example');
     // No specific page or invalid input
     $title = Title::newFromText($target);
     if (!$title) {
         if ($target !== '') {
             $out->addWikiMsg('tpt-badtitle');
         } else {
             $this->listPages();
         }
         return;
     }
     // Check permissions
     if (!$user->isAllowed('pagetranslation')) {
         throw new PermissionsError('pagetranslation');
     }
     // Check permissions
     if ($request->wasPosted() && !$user->matchEditToken($request->getText('token'))) {
         throw new PermissionsError('pagetranslation');
     }
     // We are processing some specific page
     if (!$title->exists()) {
         $out->addWikiMsg('tpt-nosuchpage', $title->getPrefixedText());
         return;
     }
     if ($action === 'discourage' || $action === 'encourage') {
         $id = TranslatablePage::getMessageGroupIdFromTitle($title);
         $current = MessageGroups::getPriority($id);
         if ($action === 'encourage') {
             $new = '';
         } else {
             $new = 'discouraged';
         }
         if ($new !== $current) {
             MessageGroups::setPriority($id, $new);
             $entry = new ManualLogEntry('pagetranslation', $action);
             $entry->setPerformer($user);
             $entry->setTarget($title);
             $logid = $entry->insert();
             $entry->publish($logid);
         }
         $this->listPages();
         $group = MessageGroups::getGroup($id);
         $parents = MessageGroups::getSharedGroups($group);
         MessageGroupStats::clearGroup($parents);
         return;
     }
     if ($action === 'unlink') {
         if (!$request->wasPosted()) {
             $this->showUnlinkConfirmation($title);
             return;
         } else {
             $page = TranslatablePage::newFromTitle($title);
             $content = ContentHandler::makeContent(self::getStrippedSourcePageText($page->getParse()), $title);
             $status = WikiPage::factory($title)->doEditContent($content, $this->msg('tpt-unlink-summary')->inContentLanguage()->text(), EDIT_FORCE_BOT | EDIT_UPDATE);
             if (!$status->isOK()) {
                 $out->wrapWikiMsg('<div class="errorbox">$1</div>', array('tpt-edit-failed', $status->getWikiText()));
                 return;
             }
             $page = TranslatablePage::newFromTitle($title);
             $this->unmarkPage($page, $user);
             $out->wrapWikiMsg('<div class="successbox">$1</div>', array('tpt-unmarked', $title->getPrefixedText()));
             $this->listPages();
             return;
         }
     }
     if ($action === 'unmark') {
         $page = TranslatablePage::newFromTitle($title);
         $this->unmarkPage($page, $user);
         $out->wrapWikiMsg('<div class="successbox">$1</div>', array('tpt-unmarked', $title->getPrefixedText()));
         $this->listPages();
         return;
     }
     if ($revision === 0) {
         // Get the latest revision
         $revision = intval($title->getLatestRevID());
     }
     $page = TranslatablePage::newFromRevision($title, $revision);
     if (!$page instanceof TranslatablePage) {
         $out->wrapWikiMsg('<div class="errorbox">$1</div>', array('tpt-notsuitable', $title->getPrefixedText(), $revision));
         return;
     }
     if ($revision !== intval($title->getLatestRevID())) {
         // We do want to notify the reviewer if the underlying page changes during review
         $target = $title->getFullUrl(array('oldid' => $revision));
         $link = "<span class='plainlinks'>[{$target} {$revision}]</span>";
         $out->wrapWikiMsg('<div class="warningbox">$1</div>', array('tpt-oldrevision', $title->getPrefixedText(), $link));
         $this->listPages();
         return;
     }
     $lastrev = $page->getMarkedTag();
     if ($lastrev !== false && $lastrev === $revision) {
//.........這裏部分代碼省略.........
開發者ID:HuijiWiki,項目名稱:mediawiki-extensions-Translate,代碼行數:101,代碼來源:SpecialPageTranslation.php


注:本文中的MessageGroups::getSharedGroups方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。