Merge "setSquidMaxage() globally if we can purge it, instead of in actions."
[lhc/web/wiklou.git] / includes / MagicWord.php
index b1baafc..f838ad0 100644 (file)
@@ -1,8 +1,23 @@
 <?php
 /**
- * File for magic words
+ * File for magic words.
  *
- * See docs/magicword.txt
+ * See docs/magicword.txt.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
  *
  * @file
  * @ingroup Parser
 
 /**
  * This class encapsulates "magic words" such as #redirect, __NOTOC__, etc.
- * Usage:
- *     if (MagicWord::get( 'redirect' )->match( $text ) )
+ *
+ * @par Usage:
+ * @code
+ *     if (MagicWord::get( 'redirect' )->match( $text ) ) {
+ *       // some code
+ *     }
+ * @endcode
  *
  * Possible future improvements:
  *   * Simultaneous searching for a number of magic words
  * To add magic words in an extension, use $magicWords in a file listed in
  * $wgExtensionMessagesFiles[].
  * 
- * Example:
- *
+ * @par Example:
+ * @code
  * $magicWords = array();
  *
  * $magicWords['en'] = array(
  *     'magicwordkey' => array( 0, 'case_insensitive_magic_word' ),
  *     'magicwordkey2' => array( 1, 'CASE_sensitive_magic_word2' ),
  * );
+ * @endcode
  *
  * For magic words which are also Parser variables, add a MagicWordwgVariableIDs
  * hook. Use string keys.
@@ -89,6 +110,7 @@ class MagicWord {
                'fullpagenamee',
                'namespace',
                'namespacee',
+               'namespacenumber',
                'currentweek',
                'currentdow',
                'localweek',
@@ -284,8 +306,8 @@ class MagicWord {
                $wgContLang->getMagic( $this );
                if ( !$this->mSynonyms ) {
                        $this->mSynonyms = array( 'dkjsagfjsgashfajsh' );
-                       #throw new MWException( "Error: invalid magic word '$id'" );
-                       wfDebugLog( 'exception', "Error: invalid magic word '$id'\n" );
+                       throw new MWException( "Error: invalid magic word '$id'" );
+                       #wfDebugLog( 'exception', "Error: invalid magic word '$id'\n" );
                }
                wfProfileOut( __METHOD__ );
        }
@@ -807,7 +829,7 @@ class MagicWordArray {
         *
         * @param $text string
         *
-        * @return string|false
+        * @return string|bool False on failure
         */
        public function matchStartToEnd( $text ) {
                $hash = $this->getHash();
@@ -855,7 +877,7 @@ class MagicWordArray {
         *
         * @param $text string
         *
-        * @return int|false
+        * @return int|bool False on failure
         */
        public function matchStartAndRemove( &$text ) {
                $regexes = $this->getRegexStart();