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


PHP FormOptions::setValue方法代码示例

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


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

示例1: execute

 public function execute($parameters)
 {
     global $wgOut, $wgUser;
     $this->setHeaders();
     $this->setup();
     if (!function_exists('apc_cache_info')) {
         $wgOut->addWikiMsg('viewapc-apc-not-available');
         return;
     }
     if ($this->opts->getValue('image')) {
         $wgOut->disable();
         header('Content-type: image/png');
         echo APCImages::generateImage($this->opts->getValue('image'));
         return;
     }
     if ($this->opts->getValue('mode') !== self::MODE_STATS) {
         if (!$wgUser->isAllowed('apc')) {
             $wgOut->permissionRequired('apc');
             return;
         }
     }
     // clear cache
     if ($this->opts->getValue('clearcache')) {
         $this->opts->setValue('clearcache', '');
         // TODO: reset
         if (!$wgUser->isAllowed('apc')) {
             $wgOut->permissionRequired('apc');
             return;
         }
         $usermode = $this->opts->getValue('mode') === self::MODE_USER_CACHE;
         $mode = $usermode ? 'user' : 'opcode';
         apc_clear_cache($mode);
         if ($usermode) {
             $wgOut->addWikiMsg('viewapc-filecache-cleared');
         } else {
             $wgOut->addWikiMsg('viewapc-usercache-cleared');
         }
     }
     $delete = $this->opts->getValue('delete');
     if ($delete) {
         $this->opts->setValue('delete', '');
         // TODO: reset
         if (!$wgUser->isAllowed('apc')) {
             $wgOut->permissionRequired('apc');
             return;
         }
         $result = apc_delete($delete);
         if ($result) {
             $wgOut->addWikiMsg('viewapc-delete-ok', $delete);
         } else {
             $wgOut->addWikiMsg('viewapc-delete-failed', $delete);
         }
     }
     $wgOut->addModuleStyles('ext.apc');
     $this->getLogo();
     $this->mainMenu();
     $this->doPage();
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:58,代码来源:SpecialAPC.php

示例2: parseParams

 private function parseParams(FormOptions $opts, $par)
 {
     global $wgLogTypes;
     # Get parameters
     $parms = explode('/', $par = $par !== null ? $par : '');
     $symsForAll = array('*', 'all');
     if ($parms[0] != '' && (in_array($par, $wgLogTypes) || in_array($par, $symsForAll))) {
         $opts->setValue('type', $par);
     } elseif (count($parms) == 2) {
         $opts->setValue('type', $parms[0]);
         $opts->setValue('user', $parms[1]);
     } elseif ($par != '') {
         $opts->setValue('user', $par);
     }
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:15,代码来源:SpecialLog.php

示例3: 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

示例4: 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

示例5: 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

示例6: parseParams

 protected function parseParams($par)
 {
     global $wgLang;
     $bits = preg_split('/\\s*,\\s*/', trim($par));
     foreach ($bits as $bit) {
         if ('shownav' == $bit) {
             $this->showNavigation = true;
         }
         if ('hideliu' === $bit) {
             $this->opts->setValue('hideliu', true);
         }
         if ('hidepatrolled' == $bit) {
             $this->opts->setValue('hidepatrolled', true);
         }
         if ('hidebots' == $bit) {
             $this->opts->setValue('hidebots', true);
         }
         if ('showredirs' == $bit) {
             $this->opts->setValue('hideredirs', false);
         }
         if (is_numeric($bit)) {
             $this->opts->setValue('limit', intval($bit));
         }
         $m = array();
         if (preg_match('/^limit=(\\d+)$/', $bit, $m)) {
             $this->opts->setValue('limit', intval($m[1]));
         }
         // PG offsets not just digits!
         if (preg_match('/^offset=([^=]+)$/', $bit, $m)) {
             $this->opts->setValue('offset', intval($m[1]));
         }
         if (preg_match('/^username=(.*)$/', $bit, $m)) {
             $this->opts->setValue('username', $m[1]);
         }
         if (preg_match('/^namespace=(.*)$/', $bit, $m)) {
             $ns = $wgLang->getNsIndex($m[1]);
             if ($ns !== false) {
                 $this->opts->setValue('namespace', $ns);
             }
         }
     }
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:42,代码来源:SpecialNewpages.php

示例7: 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

示例8: 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

示例9: 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

示例10: parseParams

 private function parseParams(FormOptions $opts, $par)
 {
     # Get parameters
     $par = $par !== null ? $par : '';
     $parms = explode('/', $par);
     $symsForAll = ['*', 'all'];
     if ($parms[0] != '' && (in_array($par, $this->getConfig()->get('LogTypes')) || in_array($par, $symsForAll))) {
         $opts->setValue('type', $par);
     } elseif (count($parms) == 2) {
         $opts->setValue('type', $parms[0]);
         $opts->setValue('user', $parms[1]);
     } elseif ($par != '') {
         $opts->setValue('user', $par);
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:15,代码来源:SpecialLog.php

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