* (bug 11452) wfMsgExt uses sometimes wrong language object for parsing magic words...
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Mon, 22 Oct 2007 19:33:46 +0000 (19:33 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Mon, 22 Oct 2007 19:33:46 +0000 (19:33 +0000)
RELEASE-NOTES
includes/GlobalFunctions.php
includes/MessageCache.php

index 89b4acc..89aa47e 100644 (file)
@@ -110,7 +110,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   only
 * Initial-lowercase prefix checks in namespaceDupes.php now actually work.
 * Fix regression in LinkBatch.php breaking PHP 5.0
-
+* (bug 11452) wfMsgExt uses sometimes wrong language object for parsing magic
+  words when called with options ''parsemag'' or ''content''. 
 
 === API changes in 1.12 ===
 
index 52b07d4..312d190 100644 (file)
@@ -574,9 +574,9 @@ function wfMsgExt( $key, $options ) {
        }
 
        if( in_array('parse', $options) ) {
-               $string = $wgOut->parse( $string, true, true );
+               $string = $wgOut->parse( $string, true, !$forContent );
        } elseif ( in_array('parseinline', $options) ) {
-               $string = $wgOut->parse( $string, true, true );
+               $string = $wgOut->parse( $string, true, !$forContent );
                $m = array();
                if( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $string, $m ) ) {
                        $string = $m[1];
@@ -584,7 +584,7 @@ function wfMsgExt( $key, $options ) {
        } elseif ( in_array('parsemag', $options) ) {
                global $wgMessageCache;
                if ( isset( $wgMessageCache ) ) {
-                       $string = $wgMessageCache->transform( $string );
+                       $string = $wgMessageCache->transform( $string, !$forContent );
                }
        }
 
index 17ed899..d133885 100644 (file)
@@ -576,7 +576,7 @@ class MessageCache {
                return $message;
        }
 
-       function transform( $message ) {
+       function transform( $message, $interface = false ) {
                global $wgParser;
                if ( !$this->mParser && isset( $wgParser ) ) {
                        # Do some initialisation so that we don't have to do it twice
@@ -586,7 +586,10 @@ class MessageCache {
                }
                if ( !$this->mDisableTransform && $this->mParser ) {
                        if( strpos( $message, '{{' ) !== false ) {
-                               $message = $this->mParser->transformMsg( $message, $this->getParserOptions() );
+                               $popts = $this->getParserOptions();
+                               if ( $interface ) { $popts->setInterfaceMessage(true); }
+                               $message = $this->mParser->transformMsg( $message, $popts );
+                               if ( $interface ) { $popts->setInterfaceMessage(false); }
                        }
                }
                return $message;