<?php
-
/**
* PrefixSearch - Handles searching prefixes of titles and finding any page
* names that match. Used largely by the OpenSearch implementation.
*/
protected static function specialSearch( $search, $limit ) {
global $wgContLang;
+
$searchKey = $wgContLang->caseFold( $search );
// Unlike SpecialPage itself, we want the canonical forms of both
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
+ if( !array_key_exists( $page, SpecialPage::$mList ) ) {# bug 20885
continue;
+ }
foreach( $aliases as $alias ) {
$keys[$wgContLang->caseFold( $alias )] = $alias;
$srchres = array();
foreach( $keys as $pageKey => $page ) {
if( $searchKey === '' || strpos( $pageKey, $searchKey ) === 0 ) {
- $srchres[] = Title::makeTitle( NS_SPECIAL, $page )->getPrefixedText();
+ $srchres[] = SpecialPage::getTitleFor( $page )->getPrefixedText();
}
+
if( count( $srchres ) >= $limit ) {
break;
}
}
+
return $srchres;
}