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


PHP SpecialPage::initList方法代码示例

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


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

示例1: specialSearch

 /**
  * Prefix search special-case for Special: namespace.
  */
 protected static function specialSearch($search, $limit)
 {
     global $wgContLang;
     $searchKey = $wgContLang->caseFold($search);
     // Unlike SpecialPage itself, we want the canonical forms of both
     // canonical and alias title forms...
     SpecialPage::initList();
     SpecialPage::initAliasList();
     $keys = array();
     foreach (array_keys(SpecialPage::$mList) as $page) {
         $keys[$wgContLang->caseFold($page)] = $page;
     }
     foreach ($wgContLang->getSpecialPageAliases() as $page => $aliases) {
         foreach ($aliases as $alias) {
             $keys[$wgContLang->caseFold($alias)] = $alias;
         }
     }
     ksort($keys);
     $srchres = array();
     foreach ($keys as $pageKey => $page) {
         if ($searchKey === '' || strpos($pageKey, $searchKey) === 0) {
             $srchres[] = Title::makeTitle(NS_SPECIAL, $page)->getPrefixedText();
         }
         if (count($srchres) >= $limit) {
             break;
         }
     }
     return $srchres;
 }
开发者ID:ruizrube,项目名称:spdef,代码行数:32,代码来源:PrefixSearch.php

示例2: specialSearch

 /**
  * Prefix search special-case for Special: namespace.
  *
  * @param $search String: term
  * @param $limit Integer: max number of items to return
  * @return Array
  */
 protected static function specialSearch($search, $limit)
 {
     global $wgContLang;
     # normalize searchKey, so aliases with spaces can be found - bug 25675
     $search = str_replace(' ', '_', $search);
     $searchKey = $wgContLang->caseFold($search);
     // Unlike SpecialPage itself, we want the canonical forms of both
     // canonical and alias title forms...
     SpecialPage::initList();
     SpecialPage::initAliasList();
     $keys = array();
     foreach (array_keys(SpecialPage::$mList) as $page) {
         $keys[$wgContLang->caseFold($page)] = $page;
     }
     foreach ($wgContLang->getSpecialPageAliases() as $page => $aliases) {
         if (!array_key_exists($page, SpecialPage::$mList)) {
             # bug 20885
             continue;
         }
         foreach ($aliases as $alias) {
             $keys[$wgContLang->caseFold($alias)] = $alias;
         }
     }
     ksort($keys);
     $srchres = array();
     foreach ($keys as $pageKey => $page) {
         if ($searchKey === '' || strpos($pageKey, $searchKey) === 0) {
             wfSuppressWarnings();
             // bug 27671: Don't use SpecialPage::getTitleFor() here because it
             // localizes its input leading to searches for e.g. Special:All
             // returning Spezial:MediaWiki-Systemnachrichten and returning
             // Spezial:Alle_Seiten twice when $wgLanguageCode == 'de'
             $srchres[] = Title::makeTitleSafe(NS_SPECIAL, $page)->getPrefixedText();
             wfRestoreWarnings();
         }
         if (count($srchres) >= $limit) {
             break;
         }
     }
     return $srchres;
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:48,代码来源:PrefixSearch.php


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