Fixed {{grammar:}} tags in namespace names
authorTim Starling <tstarling@users.mediawiki.org>
Wed, 2 Aug 2006 03:19:55 +0000 (03:19 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Wed, 2 Aug 2006 03:19:55 +0000 (03:19 +0000)
languages/Language.php

index b4de4a1..fd13539 100644 (file)
@@ -1466,11 +1466,9 @@ class Language {
                        # Allowing full message-style parsing would make simple requests 
                        # such as action=raw much more expensive than they need to be. 
                        # This will hopefully cover most cases.
-                       if ( preg_match( '/{{grammar:(.*?)\|(.*?)}}/i', $talk, $m ) ) {
-                               $talk = str_replace( ' ', '_', 
-                                       $this->convertGrammar( trim( $m[2] ), trim( $m[1] ) )
-                               );
-                       }
+                       $talk = preg_replace_callback( '/{{grammar:(.*?)\|(.*?)}}/', 
+                               array( &$this, 'replaceGrammarInNamespace' ), $talk );
+                       $talk = str_replace( ' ', '_', $talk );
                        $this->namespaceNames[NS_PROJECT_TALK] = $talk;
                }
                
@@ -1503,6 +1501,10 @@ class Language {
                wfProfileOut( __METHOD__ );
        }
 
+       function replaceGrammarInNamespace( $m ) {
+               return $this->convertGrammar( trim( $m[2] ), trim( $m[1] ) );
+       }
+
        static function getCaseMaps() {
                static $wikiUpperChars, $wikiLowerChars;
                global $IP;