当前位置: 首页>>代码示例>>PHP>>正文


PHP FormOptions::fetchValuesFromRequest方法代码示例

本文整理汇总了PHP中FormOptions::fetchValuesFromRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP FormOptions::fetchValuesFromRequest方法的具体用法?PHP FormOptions::fetchValuesFromRequest怎么用?PHP FormOptions::fetchValuesFromRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FormOptions的用法示例。


在下文中一共展示了FormOptions::fetchValuesFromRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setupOptions

 public function setupOptions()
 {
     $this->opts = new FormOptions();
     $this->opts->add('hidebots', false, FormOptions::BOOL);
     $this->opts->add('hidesysops', false, FormOptions::BOOL);
     $this->opts->fetchValuesFromRequest($this->getRequest());
     if ($this->opts->getValue('hidebots') == 1) {
         $this->hideRights[] = 'bot';
     }
     if ($this->opts->getValue('hidesysops') == 1) {
         $this->hideGroups[] = 'sysop';
     }
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:13,代码来源:SpecialActiveusers.php

示例2: setupOptions

 public function setupOptions()
 {
     $this->opts = new FormOptions();
     $this->opts->add('hidebots', false, FormOptions::BOOL);
     $this->opts->add('hidesysops', false, FormOptions::BOOL);
     $this->opts->fetchValuesFromRequest($this->getRequest());
     $this->groups = array();
     if ($this->opts->getValue('hidebots') == 1) {
         $this->groups['bot'] = true;
     }
     if ($this->opts->getValue('hidesysops') == 1) {
         $this->groups['sysop'] = true;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:14,代码来源:SpecialActiveusers.php

示例3: setup

 protected function setup($par)
 {
     global $wgRequest, $wgUser, $wgEnableNewpagesUserFilter;
     // Options
     $opts = new FormOptions();
     $this->opts = $opts;
     // bind
     $opts->add('hideliu', false);
     $opts->add('hidepatrolled', false);
     $opts->add('hidebots', false);
     $opts->add('hideredirs', true);
     $opts->add('limit', (int) $wgUser->getOption('rclimit'));
     $opts->add('offset', '');
     $opts->add('namespace', '0');
     $opts->add('username', '');
     $opts->add('feed', '');
     // Set values
     $opts->fetchValuesFromRequest($wgRequest);
     if ($par) {
         $this->parseParams($par);
     }
     // Validate
     $opts->validateIntBounds('limit', 0, 5000);
     if (!$wgEnableNewpagesUserFilter) {
         $opts->setValue('username', '');
     }
     // Store some objects
     $this->skin = $wgUser->getSkin();
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:29,代码来源:SpecialNewpages.php

示例4: setup

 protected function setup($par)
 {
     global $wgEnableNewpagesUserFilter;
     // Options
     $opts = new FormOptions();
     $this->opts = $opts;
     // bind
     $opts->add('hideliu', false);
     $opts->add('hidepatrolled', $this->getUser()->getBoolOption('newpageshidepatrolled'));
     $opts->add('hidebots', false);
     $opts->add('hideredirs', true);
     $opts->add('limit', $this->getUser()->getIntOption('rclimit'));
     $opts->add('offset', '');
     $opts->add('namespace', '0');
     $opts->add('username', '');
     $opts->add('feed', '');
     $opts->add('tagfilter', '');
     $opts->add('invert', false);
     $this->customFilters = array();
     wfRunHooks('SpecialNewPagesFilters', array($this, &$this->customFilters));
     foreach ($this->customFilters as $key => $params) {
         $opts->add($key, $params['default']);
     }
     // Set values
     $opts->fetchValuesFromRequest($this->getRequest());
     if ($par) {
         $this->parseParams($par);
     }
     // Validate
     $opts->validateIntBounds('limit', 0, 5000);
     if (!$wgEnableNewpagesUserFilter) {
         $opts->setValue('username', '');
     }
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:34,代码来源:SpecialNewpages.php

示例5: execute

 function execute($par)
 {
     $out = $this->getOutput();
     $this->setHeaders();
     $this->outputHeader();
     $opts = new FormOptions();
     $opts->add('target', '');
     $opts->add('namespace', '', FormOptions::INTNULL);
     $opts->add('limit', 50);
     $opts->add('from', 0);
     $opts->add('back', 0);
     $opts->add('hideredirs', false);
     $opts->add('hidetrans', false);
     $opts->add('hidelinks', false);
     $opts->add('hideimages', false);
     $opts->fetchValuesFromRequest($this->getRequest());
     $opts->validateIntBounds('limit', 0, 5000);
     // Give precedence to subpage syntax
     if (isset($par)) {
         $opts->setValue('target', $par);
     }
     // Bind to member variable
     $this->opts = $opts;
     $this->target = Title::newFromURL($opts->getValue('target'));
     if (!$this->target) {
         $out->addHTML($this->whatlinkshereForm());
         return;
     }
     $this->getSkin()->setRelevantTitle($this->target);
     $this->selfTitle = $this->getTitle($this->target->getPrefixedDBkey());
     $out->setPageTitle(wfMsg('whatlinkshere-title', $this->target->getPrefixedText()));
     $out->setSubtitle(wfMsg('whatlinkshere-backlink', Linker::link($this->target, $this->target->getPrefixedText(), array(), array('redirect' => 'no'))));
     $this->showIndirectLinks(0, $this->target, $opts->getValue('limit'), $opts->getValue('from'), $opts->getValue('back'));
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:34,代码来源:SpecialWhatlinkshere.php

示例6: execute

 public function execute($par)
 {
     global $wgLogRestrictions;
     $this->setHeaders();
     $this->outputHeader();
     $opts = new FormOptions();
     $opts->add('type', '');
     $opts->add('user', '');
     $opts->add('page', '');
     $opts->add('pattern', false);
     //		$opts->add( 'year', null, FormOptions::INTNULL ); don't default to zero
     $opts->add('year', '');
     $opts->add('month', null, FormOptions::INTNULL);
     $opts->add('tagfilter', '');
     $opts->add('offset', '');
     $opts->add('dir', '');
     $opts->add('offender', '');
     // Set values
     $opts->fetchValuesFromRequest($this->getRequest());
     if ($par !== null) {
         $this->parseParams($opts, (string) $par);
     }
     # Don't let the user get stuck with a certain date
     if ($opts->getValue('offset') || $opts->getValue('dir') == 'prev') {
         $opts->setValue('year', '');
         $opts->setValue('month', '');
     }
     // If the user doesn't have the right permission to view the specific
     // log type, throw a PermissionsError
     // If the log type is invalid, just show all public logs
     $type = $opts->getValue('type');
     if (!LogPage::isLogType($type)) {
         $opts->setValue('type', '');
     } elseif (isset($wgLogRestrictions[$type]) && !$this->getUser()->isAllowed($wgLogRestrictions[$type])) {
         throw new PermissionsError($wgLogRestrictions[$type]);
     }
     # Handle type-specific inputs
     $qc = array();
     if ($opts->getValue('type') == 'suppress') {
         $offender = User::newFromName($opts->getValue('offender'), false);
         if ($offender && $offender->getId() > 0) {
             $qc = array('ls_field' => 'target_author_id', 'ls_value' => $offender->getId());
         } elseif ($offender && IP::isIPAddress($offender->getName())) {
             $qc = array('ls_field' => 'target_author_ip', 'ls_value' => $offender->getName());
         }
     }
     # Some log types are only for a 'User:' title but we might have been given
     # only the username instead of the full title 'User:username'. This part try
     # to lookup for a user by that name and eventually fix user input. See bug 1697.
     wfRunHooks('GetLogTypesOnUser', array(&$this->typeOnUser));
     if (in_array($opts->getValue('type'), $this->typeOnUser)) {
         # ok we have a type of log which expect a user title.
         $target = Title::newFromText($opts->getValue('page'));
         if ($target && $target->getNamespace() === NS_MAIN) {
             # User forgot to add 'User:', we are adding it for him
             $opts->setValue('page', Title::makeTitleSafe(NS_USER, $opts->getValue('page')));
         }
     }
     $this->show($opts, $qc);
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:60,代码来源:SpecialLog.php

示例7: execute

 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $this->addHelpLink('Help:New images');
     $opts = new FormOptions();
     $opts->add('like', '');
     $opts->add('showbots', false);
     $opts->add('hidepatrolled', false);
     $opts->add('limit', 50);
     $opts->add('offset', '');
     $opts->fetchValuesFromRequest($this->getRequest());
     if ($par !== null) {
         $opts->setValue(is_numeric($par) ? 'limit' : 'like', $par);
     }
     $opts->validateIntBounds('limit', 0, 500);
     $this->opts = $opts;
     if (!$this->including()) {
         $this->setTopText();
         $this->buildForm();
     }
     $pager = new NewFilesPager($this->getContext(), $opts);
     $out->addHTML($pager->getBody());
     if (!$this->including()) {
         $out->addHTML($pager->getNavigationBar());
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:28,代码来源:SpecialNewimages.php

示例8: execute

 public function execute($par)
 {
     // Shortcut by using $par
     if ($par) {
         $this->getOutput()->redirect($this->getTitle()->getLinkURL(array('user' => $par)));
         return;
     }
     $this->setHeaders();
     $this->outputHeader();
     // Parse options
     $opt = new \FormOptions();
     $opt->add('user', '');
     $opt->add('delete', '');
     $opt->add('reason', '');
     $opt->fetchValuesFromRequest($this->getRequest());
     // Parse user
     $user = $opt->getValue('user');
     $userObj = \User::newFromName($user);
     $userExists = $userObj && $userObj->getId() !== 0;
     // If current task is delete and user is not allowed
     $canDoAdmin = $this->getUser()->isAllowed('avataradmin');
     if ($opt->getValue('delete')) {
         if (!$canDoAdmin) {
             throw new \PermissionsError('avataradmin');
         }
         // Delete avatar if the user exists
         if ($userExists) {
             if (Avatars::deleteAvatar($userObj)) {
                 global $wgAvatarLogInRC;
                 $logEntry = new \ManualLogEntry('avatar', 'delete');
                 $logEntry->setPerformer($this->getUser());
                 $logEntry->setTarget($userObj->getUserPage());
                 $logEntry->setComment($opt->getValue('reason'));
                 $logId = $logEntry->insert();
                 $logEntry->publish($logId, $wgAvatarLogInRC ? 'rcandudp' : 'udp');
             }
         }
     }
     $this->getOutput()->addModules(array('mediawiki.userSuggest'));
     $this->showForm($user);
     if ($userExists) {
         $haveAvatar = Avatars::hasAvatar($userObj);
         if ($haveAvatar) {
             $html = \Xml::tags('img', array('src' => Avatars::getLinkFor($user, 'original') . '&nocache&ver=' . dechex(time()), 'height' => 400), '');
             $html = \Xml::tags('p', array(), $html);
             $this->getOutput()->addHTML($html);
             // Add a delete button
             if ($canDoAdmin) {
                 $this->showDeleteForm($user);
             }
         } else {
             $this->getOutput()->addWikiMsg('viewavatar-noavatar');
         }
     } else {
         if ($user) {
             $this->getOutput()->addWikiMsg('viewavatar-nouser');
         }
     }
 }
开发者ID:nbdd0121,项目名称:MW-Avatar,代码行数:59,代码来源:SpecialView.php

示例9: execute

 public function execute($par)
 {
     $this->useTransactionalTimeLimit();
     $this->checkPermissions();
     $this->checkReadOnly();
     $this->setHeaders();
     $this->outputHeader();
     $this->addHelpLink('Help:Merge history');
     $opts = new FormOptions();
     $opts->add('target', '');
     $opts->add('dest', '');
     $opts->add('target', '');
     $opts->add('mergepoint', '');
     $opts->add('reason', '');
     $opts->add('merge', false);
     $opts->fetchValuesFromRequest($this->getRequest());
     $target = $opts->getValue('target');
     $dest = $opts->getValue('dest');
     $targetObj = Title::newFromText($target);
     $destObj = Title::newFromText($dest);
     $status = Status::newGood();
     $this->mOpts = $opts;
     $this->mTargetObj = $targetObj;
     $this->mDestObj = $destObj;
     if ($opts->getValue('merge') && $targetObj && $destObj && $opts->getValue('mergepoint') !== '') {
         $this->merge();
         return;
     }
     if ($target === '' && $dest === '') {
         $this->showMergeForm();
         return;
     }
     if (!$targetObj instanceof Title) {
         $status->merge(Status::newFatal('mergehistory-invalid-source'));
     } elseif (!$targetObj->exists()) {
         $status->merge(Status::newFatal('mergehistory-no-source', wfEscapeWikiText($targetObj->getPrefixedText())));
     }
     if (!$destObj instanceof Title) {
         $status->merge(Status::newFatal('mergehistory-invalid-destination'));
     } elseif (!$destObj->exists()) {
         $status->merge(Status::newFatal('mergehistory-no-destination', wfEscapeWikiText($destObj->getPrefixedText())));
     }
     if ($targetObj && $destObj && $targetObj->equals($destObj)) {
         $status->merge(Status::newFatal('mergehistory-same-destination'));
     }
     $this->mStatus = $status;
     $this->showMergeForm();
     if ($status->isOK()) {
         $this->showHistory();
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:51,代码来源:SpecialMergeHistory.php

示例10: setup

 protected function setup($par)
 {
     global $wgRequest, $wgUser;
     // Options
     $opts = new FormOptions();
     $this->opts = $opts;
     // bind
     $opts->add('page1', '');
     $opts->add('page2', '');
     $opts->add('rev1', '');
     $opts->add('rev2', '');
     $opts->add('action', '');
     // Set values
     $opts->fetchValuesFromRequest($wgRequest);
     $title1 = Title::newFromText($opts->getValue('page1'));
     $title2 = Title::newFromText($opts->getValue('page2'));
     if ($title1 && $title1->exists() && $opts->getValue('rev1') == '') {
         $pda = new Article($title1);
         $pdi = $pda->getID();
         $pdLastRevision = Revision::loadFromPageId(wfGetDB(DB_SLAVE), $pdi);
         $opts->setValue('rev1', $pdLastRevision->getId());
     } elseif ($opts->getValue('rev1') != '') {
         $pdrev = Revision::newFromId($opts->getValue('rev1'));
         if ($pdrev) {
             $opts->setValue('page1', $pdrev->getTitle()->getPrefixedText());
         }
     }
     if ($title2 && $title2->exists() && $opts->getValue('rev2') == '') {
         $pda = new Article($title2);
         $pdi = $pda->getID();
         $pdLastRevision = Revision::loadFromPageId(wfGetDB(DB_SLAVE), $pdi);
         $opts->setValue('rev2', $pdLastRevision->getId());
     } elseif ($opts->getValue('rev2') != '') {
         $pdrev = Revision::newFromId($opts->getValue('rev2'));
         if ($pdrev) {
             $opts->setValue('page2', $pdrev->getTitle()->getPrefixedText());
         }
     }
     // Store some objects
     $this->skin = $wgUser->getSkin();
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:41,代码来源:SpecialComparePages.php

示例11: execute

 /**
  * Show the special page
  *
  * @param string $par Parameter passed to the page or null
  */
 public function execute($par)
 {
     $out = $this->getOutput();
     $this->setHeaders();
     $this->outputHeader();
     $opts = new FormOptions();
     $opts->add('username', '');
     $opts->add('hidebots', false, FormOptions::BOOL);
     $opts->add('hidesysops', false, FormOptions::BOOL);
     $opts->fetchValuesFromRequest($this->getRequest());
     if ($par !== null) {
         $opts->setValue('username', $par);
     }
     // Mention the level of cache staleness...
     $cacheText = '';
     $dbr = wfGetDB(DB_SLAVE, 'recentchanges');
     $rcMax = $dbr->selectField('recentchanges', 'MAX(rc_timestamp)', '', __METHOD__);
     if ($rcMax) {
         $cTime = $dbr->selectField('querycache_info', 'qci_timestamp', ['qci_type' => 'activeusers'], __METHOD__);
         if ($cTime) {
             $secondsOld = wfTimestamp(TS_UNIX, $rcMax) - wfTimestamp(TS_UNIX, $cTime);
         } else {
             $rcMin = $dbr->selectField('recentchanges', 'MIN(rc_timestamp)');
             $secondsOld = time() - wfTimestamp(TS_UNIX, $rcMin);
         }
         if ($secondsOld > 0) {
             $cacheTxt = '<br>' . $this->msg('cachedspecial-viewing-cached-ttl')->durationParams($secondsOld);
         }
     }
     $pager = new ActiveUsersPager($this->getContext(), $opts);
     $usersBody = $pager->getBody();
     $days = $this->getConfig()->get('ActiveUserDays');
     $formDescriptor = ['username' => ['type' => 'user', 'name' => 'username', 'label-message' => 'activeusers-from'], 'hidebots' => ['type' => 'check', 'name' => 'hidebots', 'label-message' => 'activeusers-hidebots', 'default' => false], 'hidesysops' => ['type' => 'check', 'name' => 'hidesysops', 'label-message' => 'activeusers-hidesysops', 'default' => false]];
     $htmlForm = HTMLForm::factory('ooui', $formDescriptor, $this->getContext())->setIntro($this->msg('activeusers-intro')->numParams($days) . $cacheText)->setWrapperLegendMsg('activeusers')->setSubmitTextMsg('activeusers-submit')->setMethod('get')->prepareForm()->displayForm(false);
     if ($usersBody) {
         $out->addHTML($pager->getNavigationBar() . Html::rawElement('ul', [], $usersBody) . $pager->getNavigationBar());
     } else {
         $out->addWikiMsg('activeusers-noresult');
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:45,代码来源:SpecialActiveusers.php

示例12: execute

 function execute($par)
 {
     $out = $this->getOutput();
     $this->setHeaders();
     $this->outputHeader();
     $this->addHelpLink('Help:What links here');
     $opts = new FormOptions();
     $opts->add('target', '');
     $opts->add('namespace', '', FormOptions::INTNULL);
     $opts->add('limit', $this->getConfig()->get('QueryPageDefaultLimit'));
     $opts->add('from', 0);
     $opts->add('back', 0);
     $opts->add('hideredirs', false);
     $opts->add('hidetrans', false);
     $opts->add('hidelinks', false);
     $opts->add('hideimages', false);
     $opts->add('invert', false);
     $opts->fetchValuesFromRequest($this->getRequest());
     $opts->validateIntBounds('limit', 0, 5000);
     // Give precedence to subpage syntax
     if ($par !== null) {
         $opts->setValue('target', $par);
     }
     // Bind to member variable
     $this->opts = $opts;
     $this->target = Title::newFromText($opts->getValue('target'));
     if (!$this->target) {
         if (!$this->including()) {
             $out->addHTML($this->whatlinkshereForm());
         }
         return;
     }
     $this->getSkin()->setRelevantTitle($this->target);
     $this->selfTitle = $this->getPageTitle($this->target->getPrefixedDBkey());
     $out->setPageTitle($this->msg('whatlinkshere-title', $this->target->getPrefixedText()));
     $out->addBacklinkSubtitle($this->target);
     $this->showIndirectLinks(0, $this->target, $opts->getValue('limit'), $opts->getValue('from'), $opts->getValue('back'));
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:38,代码来源:SpecialWhatlinkshere.php

示例13: execute

 public function execute($par)
 {
     global $wgRequest;
     $this->setHeaders();
     $this->outputHeader();
     $opts = new FormOptions();
     $opts->add('type', '');
     $opts->add('user', '');
     $opts->add('page', '');
     $opts->add('pattern', false);
     $opts->add('year', null, FormOptions::INTNULL);
     $opts->add('month', null, FormOptions::INTNULL);
     $opts->add('tagfilter', '');
     $opts->add('offset', '');
     $opts->add('dir', '');
     $opts->add('offender', '');
     // Set values
     $opts->fetchValuesFromRequest($wgRequest);
     if ($par) {
         $this->parseParams($opts, (string) $par);
     }
     # Don't let the user get stuck with a certain date
     if ($opts->getValue('offset') || $opts->getValue('dir') == 'prev') {
         $opts->setValue('year', '');
         $opts->setValue('month', '');
     }
     # Handle type-specific inputs
     $qc = array();
     if ($opts->getValue('type') == 'suppress') {
         $offender = User::newFromName($opts->getValue('offender'), false);
         if ($offender && $offender->getId() > 0) {
             $qc = array('ls_field' => 'target_author_id', 'ls_value' => $offender->getId());
         } elseif ($offender && IP::isIPAddress($offender->getName())) {
             $qc = array('ls_field' => 'target_author_ip', 'ls_value' => $offender->getName());
         }
     }
     $this->show($opts, $qc);
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:38,代码来源:SpecialLog.php

示例14: setup

 public function setup()
 {
     global $wgRequest;
     $opts = new FormOptions();
     // Bind to the member variable
     $this->opts = $opts;
     $opts->add('mode', self::MODE_STATS);
     $opts->add('image', APCImages::IMG_NONE);
     $opts->add('clearcache', false);
     $opts->add('limit', 20);
     $opts->add('offset', 0);
     $opts->add('display', '');
     $opts->add('delete', '');
     $opts->add('sort', 'hits');
     $opts->add('sortdir', 0);
     $opts->add('scope', 'active');
     $opts->add('searchi', '');
     // MediaWiki captures search, ARGH!
     $opts->fetchValuesFromRequest($wgRequest);
     $opts->validateIntBounds('limit', 0, 5000);
     $opts->validateIntBounds('sortdir', 0, 1);
     $this->opts->consumeValues(array('display', 'clearcache', 'image'));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:23,代码来源:SpecialAPC.php

示例15: execute

 public function execute($par)
 {
     global $wgLanguageCode;
     $this->setHeaders();
     $this->checkPermissions();
     $server = TTMServer::primary();
     if (!$server instanceof SearchableTTMServer) {
         throw new ErrorPageError('tux-sst-nosolr-title', 'tux-sst-nosolr-body');
     }
     $out = $this->getOutput();
     $out->addModuleStyles('jquery.uls.grid');
     $out->addModuleStyles('ext.translate.special.searchtranslations.styles');
     $out->addModuleStyles('ext.translate.special.translate.styles');
     $out->addModules('ext.translate.special.searchtranslations');
     $out->addModules('ext.translate.special.searchtranslations.operatorsuggest');
     TranslateUtils::addSpecialHelpLink($out, 'Help:Extension:Translate#searching');
     $this->opts = $opts = new FormOptions();
     $opts->add('query', '');
     $opts->add('sourcelanguage', $wgLanguageCode);
     $opts->add('language', '');
     $opts->add('group', '');
     $opts->add('grouppath', '');
     $opts->add('filter', '');
     $opts->add('match', '');
     $opts->add('case', '');
     $opts->add('limit', $this->limit);
     $opts->add('offset', 0);
     $opts->fetchValuesFromRequest($this->getRequest());
     $queryString = $opts->getValue('query');
     if ($queryString === '') {
         $this->showEmptySearch();
         return;
     }
     $params = $opts->getAllValues();
     $filter = $opts->getValue('filter');
     try {
         $translationSearch = new CrossLanguageTranslationSearchQuery($params, $server);
         if (in_array($filter, $translationSearch->getAvailableFilters())) {
             if ($opts->getValue('language') === '') {
                 $params['language'] = $this->getLanguage()->getCode();
                 $opts->setValue('language', $params['language']);
             }
             $documents = $translationSearch->getDocuments();
             $total = $translationSearch->getTotalHits();
             $resultset = $translationSearch->getResultSet();
         } else {
             $resultset = $server->search($queryString, $params, $this->hl);
             $documents = $server->getDocuments($resultset);
             $total = $server->getTotalHits($resultset);
         }
     } catch (TTMServerException $e) {
         error_log('Translation search server unavailable:' . $e->getMessage());
         throw new ErrorPageError('tux-sst-solr-offline-title', 'tux-sst-solr-offline-body');
     }
     // Part 1: facets
     $facets = $server->getFacets($resultset);
     $facetHtml = '';
     if (count($facets['language']) > 0) {
         if ($filter !== '') {
             $facets['language'] = array_merge($facets['language'], array($opts->getValue('language') => $total));
         }
         $facetHtml = Html::element('div', array('class' => 'row facet languages', 'data-facets' => FormatJson::encode($this->getLanguages($facets['language'])), 'data-language' => $opts->getValue('language')), $this->msg('tux-sst-facet-language'));
     }
     if (count($facets['group']) > 0) {
         $facetHtml .= Html::element('div', array('class' => 'row facet groups', 'data-facets' => FormatJson::encode($this->getGroups($facets['group'])), 'data-group' => $opts->getValue('group')), $this->msg('tux-sst-facet-group'));
     }
     // Part 2: results
     $resultsHtml = '';
     $title = Title::newFromText($queryString);
     if ($title && !in_array($filter, $translationSearch->getAvailableFilters())) {
         $handle = new MessageHandle($title);
         $code = $handle->getCode();
         $language = $opts->getValue('language');
         if ($handle->isValid() && $code !== '' && $code !== $language) {
             $groupId = $handle->getGroup()->getId();
             $helpers = new TranslationHelpers($title, $groupId);
             $document['wiki'] = wfWikiId();
             $document['localid'] = $handle->getTitleForBase()->getPrefixedText();
             $document['content'] = $helpers->getTranslation();
             $document['language'] = $handle->getCode();
             array_unshift($documents, $document);
             $total++;
         }
     }
     foreach ($documents as $document) {
         $text = $document['content'];
         $text = TranslateUtils::convertWhiteSpaceToHTML($text);
         list($pre, $post) = $this->hl;
         $text = str_replace($pre, '<strong class="tux-search-highlight">', $text);
         $text = str_replace($post, '</strong>', $text);
         $title = Title::newFromText($document['localid'] . '/' . $document['language']);
         if (!$title) {
             // Should not ever happen but who knows...
             continue;
         }
         $resultAttribs = array('class' => 'row tux-message', 'data-title' => $title->getPrefixedText(), 'data-language' => $document['language']);
         $handle = new MessageHandle($title);
         if ($handle->isValid()) {
             $groupId = $handle->getGroup()->getId();
             $helpers = new TranslationHelpers($title, $groupId);
//.........这里部分代码省略.........
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:101,代码来源:SpecialSearchTranslations.php


注:本文中的FormOptions::fetchValuesFromRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。