當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。