Don't force edit encoding when LanguageEo.php is loaded; defer until $wgContLang...
[lhc/web/wiklou.git] / includes / MagicWord.php
index 0508f96..143666a 100644 (file)
@@ -45,6 +45,10 @@ define('MAG_PAGENAMEE', 31);
 define('MAG_NAMESPACE', 32);
 define('MAG_TOC', 33);
 define('MAG_GRAMMAR', 34);
+define('MAG_NOTITLECONVERT', 35);
+define('MAG_NOCONTENTCONVERT', 36);
+define('MAG_CURRENTWEEK', 37);
+define('MAG_CURRENTDOW', 38);
 
 $wgVariableIDs = array(
        MAG_CURRENTMONTH,
@@ -59,7 +63,9 @@ $wgVariableIDs = array(
        MAG_SERVER,
        MAG_PAGENAME,
        MAG_PAGENAMEE,
-       MAG_NAMESPACE
+       MAG_NAMESPACE,
+       MAG_CURRENTWEEK,
+       MAG_CURRENTDOW
 );
 
 /**
@@ -116,9 +122,9 @@ class MagicWord {
        
        # Initialises this object with an ID
        function load( $id ) {
-               global $wgLang;         
+               global $wgContLang;             
                $this->mId = $id;
-               $wgLang->getMagic( $this );
+               $wgContLang->getMagic( $this );
        }
        
        /**
@@ -193,10 +199,10 @@ class MagicWord {
                $matchcount = preg_match( $this->getVariableStartToEndRegex(), $text, $matches );
                if ( $matchcount == 0 ) {
                        return NULL;
-               } elseif ( count($matches) == 1 ) {
+               } elseif ( count($matches) == 2 ) {
                        return $matches[0];
                } else {
-                       return $matches[1];
+                       return $matches[2];
                }
        }