X-Git-Url: http://git.cyclocoop.org/%28?a=blobdiff_plain;f=includes%2Fspecialpage%2FSpecialPage.php;h=f9682762289f3d2bf3d5da519814e3338c056f8b;hb=e9e7dcc9b68d413972128b87f00c800af5eb1e47;hp=39681879dfdb2a5331e3dd1b667d88c22761d98e;hpb=aef177cc4cdc5c658bfa2028020647a1b838fc4b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specialpage/SpecialPage.php b/includes/specialpage/SpecialPage.php index 39681879df..f968276228 100644 --- a/includes/specialpage/SpecialPage.php +++ b/includes/specialpage/SpecialPage.php @@ -131,19 +131,6 @@ class SpecialPage { return $this->mRestriction; } - /** - * Get the file which will be included by SpecialPage::execute() if your extension is - * still stuck in the past and hasn't overridden the execute() method. No modern code - * should want or need to know this. - * @return string - * @deprecated since 1.18 - */ - function getFile() { - wfDeprecated( __METHOD__, '1.18' ); - - return $this->mFile; - } - // @todo FIXME: Decide which syntax to use for this, and stick to it /** * Whether this special page is listed in Special:SpecialPages @@ -329,6 +316,40 @@ class SpecialPage { } } + /** + * Return an array of subpages beginning with $search that this special page will accept. + * + * For example, if a page supports subpages "foo", "bar" and "baz" (as in Special:PageName/foo, + * etc.): + * + * - `prefixSearchSubpages( "ba" )` should return `array( "bar", "baz" )` + * - `prefixSearchSubpages( "f" )` should return `array( "foo" )` + * - `prefixSearchSubpages( "z" )` should return `array()` + * - `prefixSearchSubpages( "" )` should return `array( foo", "bar", "baz" )` + * + * @param string $search Prefix to search for + * @param integer $limit Maximum number of results to return + * @return string[] Matching subpages + */ + public function prefixSearchSubpages( $search, $limit = 10 ) { + return array(); + } + + /** + * Helper function for implementations of prefixSearchSubpages() that + * filter the values in memory (as oppposed to making a query). + * + * @since 1.24 + * @param string $search + * @param int $limit + * @param array $subpages + * @return string[] + */ + protected static function prefixSearchArray( $search, $limit, array $subpages ) { + $escaped = preg_quote( $search, '/' ); + return array_slice( preg_grep( "/^$escaped/i", $subpages ), 0, $limit ); + } + /** * Sets headers - this should be called from the execute() method of all derived classes! */ @@ -532,19 +553,6 @@ class SpecialPage { return $this->getContext()->getSkin(); } - /** - * Shortcut to get user's language - * - * @deprecated since 1.19 Use getLanguage instead - * @return Language - * @since 1.18 - */ - public function getLang() { - wfDeprecated( __METHOD__, '1.19' ); - - return $this->getLanguage(); - } - /** * Shortcut to get user's language *