Escape delimiter in SpecialPage::prefixSearchArray
[lhc/web/wiklou.git] / includes / specialpage / SpecialPage.php
index da51a33..f968276 100644 (file)
@@ -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
@@ -348,6 +335,21 @@ class SpecialPage {
                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!
         */
@@ -551,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
         *