Capitalization fix in memcached setting
[lhc/web/wiklou.git] / includes / MagicWord.php
index a41445b..a8fd0eb 100644 (file)
@@ -116,9 +116,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 );
        }
        
        /**
@@ -131,7 +131,7 @@ class MagicWord {
                $this->mBaseRegex = implode( '|', $escSyn );
                $case = $this->mCaseSensitive ? '' : 'i';
                $this->mRegex = "/{$this->mBaseRegex}/{$case}";
-               $this->mRegexStart = "/^{$this->mBaseRegex}/{$case}";
+               $this->mRegexStart = "/^({$this->mBaseRegex})/{$case}";
                $this->mVariableRegex = str_replace( "\\$1", "([$variableClass]*?)", $this->mRegex );
                $this->mVariableStartToEndRegex = str_replace( "\\$1", "([$variableClass]*?)", 
                        "/^({$this->mBaseRegex})$/{$case}" );
@@ -193,10 +193,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];
                }
        }