本文整理汇总了PHP中FormOptions::getAllValues方法的典型用法代码示例。如果您正苦于以下问题:PHP FormOptions::getAllValues方法的具体用法?PHP FormOptions::getAllValues怎么用?PHP FormOptions::getAllValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormOptions
的用法示例。
在下文中一共展示了FormOptions::getAllValues方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Show a form for filtering namespace and username
*
* @param $par String
* @return String
*/
public function execute($par)
{
$out = $this->getOutput();
$this->setHeaders();
$this->outputHeader();
$this->showNavigation = !$this->including();
// Maybe changed in setup
$this->setup($par);
if (!$this->including()) {
// Settings
$this->form();
$feedType = $this->opts->getValue('feed');
if ($feedType) {
$this->feed($feedType);
return;
}
$allValues = $this->opts->getAllValues();
unset($allValues['feed']);
$out->setFeedAppendQuery(wfArrayToCgi($allValues));
}
$pager = new NewPagesPager($this, $this->opts);
$pager->mLimit = $this->opts->getValue('limit');
$pager->mOffset = $this->opts->getValue('offset');
if ($pager->getNumRows()) {
$navigation = '';
if ($this->showNavigation) {
$navigation = $pager->getNavigationBar();
}
$out->addHTML($navigation . $pager->getBody() . $navigation);
} else {
$out->addWikiMsg('specialpage-empty');
}
}
示例2: execute
/**
* Generates feed's content
*
* @param ChannelFeed $feed ChannelFeed subclass object (generally the one returned
* by getFeedObject())
* @param ResultWrapper $rows ResultWrapper object with rows in recentchanges table
* @param int $lastmod Timestamp of the last item in the recentchanges table (only
* used for the cache key)
* @param FormOptions $opts As in SpecialRecentChanges::getDefaultOptions()
* @return null|bool True or null
*/
public function execute($feed, $rows, $lastmod, $opts)
{
global $wgLang, $wgRenderHashAppend;
if (!FeedUtils::checkFeedOutput($this->format)) {
return null;
}
$optionsHash = md5(serialize($opts->getAllValues())) . $wgRenderHashAppend;
$timekey = wfMemcKey($this->type, $this->format, $wgLang->getCode(), $optionsHash, 'timestamp');
$key = wfMemcKey($this->type, $this->format, $wgLang->getCode(), $optionsHash);
FeedUtils::checkPurge($timekey, $key);
/**
* Bumping around loading up diffs can be pretty slow, so where
* possible we want to cache the feed output so the next visitor
* gets it quick too.
*/
$cachedFeed = $this->loadFromCache($lastmod, $timekey, $key);
if (is_string($cachedFeed)) {
wfDebug("RC: Outputting cached feed\n");
$feed->httpHeaders();
echo $cachedFeed;
} else {
wfDebug("RC: rendering new feed and caching it\n");
ob_start();
self::generateFeed($rows, $feed);
$cachedFeed = ob_get_contents();
ob_end_flush();
$this->saveToCache($cachedFeed, $timekey, $key);
}
return true;
}
示例3: setSyndicated
protected function setSyndicated()
{
$out = $this->getOutput();
$out->setSyndicated(true);
$out->setFeedAppendQuery(wfArrayToCGI($this->opts->getAllValues()));
}
示例4: image
/**
* Returns an \<img> tag for graph.
* @param $opts FormOptions
* @return \string Html.
*/
protected function image( FormOptions $opts ) {
$title = $this->getTitle();
$cgiparams = wfArrayToCgi( array( 'graphit' => true ), $opts->getAllValues() );
$href = $title->getLocalUrl( $cgiparams );
return Xml::element( 'img',
array(
'src' => $href,
'width' => $opts['width'],
'height' => $opts['height'],
)
);
}
示例5: 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);
//.........这里部分代码省略.........