Revert unintended changes from r86302
authorSam Reed <reedy@users.mediawiki.org>
Mon, 18 Apr 2011 12:00:20 +0000 (12:00 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Mon, 18 Apr 2011 12:00:20 +0000 (12:00 +0000)
includes/GlobalFunctions.php
includes/MessageCache.php
includes/OutputPage.php

index 2f83b07..0c88816 100644 (file)
@@ -716,12 +716,10 @@ function wfMsgHtml( $key ) {
  * @return string
  */
 function wfMsgWikiHtml( $key ) {
-       global $wgMessageCache;
+       global $wgOut;
        $args = func_get_args();
        array_shift( $args );
-       return wfMsgReplaceArgs(
-               $wgMessageCache->parse( wfMsgGetKey( $key, true ), null, /* can't be set to false */ true ),
-               $args );
+       return wfMsgReplaceArgs( $wgOut->parse( wfMsgGetKey( $key, true ), /* can't be set to false */ true ), $args );
 }
 
 /**
@@ -743,7 +741,7 @@ function wfMsgWikiHtml( $key ) {
  * Behavior for conflicting options (e.g., parse+parseinline) is undefined.
  */
 function wfMsgExt( $key, $options ) {
-       global $wgMessageCache;
+       global $wgOut;
 
        $args = func_get_args();
        array_shift( $args );
@@ -783,9 +781,9 @@ function wfMsgExt( $key, $options ) {
        }
 
        if( in_array( 'parse', $options, true ) ) {
-               $string = $wgMessageCache->parse( $string, null, true, !$forContent, $langCodeObj );
+               $string = $wgOut->parse( $string, true, !$forContent, $langCodeObj );
        } elseif ( in_array( 'parseinline', $options, true ) ) {
-               $string = $wgMessageCache->parse( $string, null, true, !$forContent, $langCodeObj );
+               $string = $wgOut->parse( $string, true, !$forContent, $langCodeObj );
                $m = array();
                if( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $string, $m ) ) {
                        $string = $m[1];
index c5d6ac0..d907a78 100644 (file)
@@ -102,8 +102,6 @@ class MessageCache {
 
        /**
         * ParserOptions is lazy initialised.
-        *
-        * @return ParserOptions
         */
        function getParserOptions() {
                if ( !$this->mParserOptions ) {
@@ -222,8 +220,6 @@ class MessageCache {
 
        /**
         * Set the cache to $cache, if it is valid. Otherwise set the cache to false.
-        *
-        * @return bool
         */
        function setCache( $cache, $code ) {
                if ( isset( $cache['VERSION'] ) && $cache['VERSION'] == MSG_CACHE_VERSION ) {
@@ -738,21 +734,6 @@ class MessageCache {
                        return $message;
                }
 
-               $parser = $this->getParser();
-               if ( $parser ) {
-                       $popts = $this->getParserOptions();
-                       $popts->setInterfaceMessage( $interface );
-                       $popts->setTargetLanguage( $language );
-                       $popts->setUserLang( $language );
-                       $message = $parser->transformMsg( $message, $popts, $title );
-               }
-               return $message;
-       }
-
-       /**
-        * @return Parser
-        */
-       function getParser() {
                global $wgParser, $wgParserConf;
                if ( !$this->mParser && isset( $wgParser ) ) {
                        # Do some initialisation so that we don't have to do it twice
@@ -765,28 +746,16 @@ class MessageCache {
                        } else {
                                $this->mParser = clone $wgParser;
                        }
+                       #wfDebug( __METHOD__ . ": following contents triggered transform: $message\n" );
                }
-               return $this->mParser;
-       }
-
-       /**
-        * @param $text string
-        * @param $title
-        * @param $linestart bool
-        * @return ParserOutput
-        */
-       public function parse( $text, $title = null, $linestart = true, $interface = false, $language = null  ) {
-               $parser = $this->getParser();
-               $popts = $this->getParserOptions();
-
-               if ( $interface ) {
-                       $popts->setInterfaceMessage( true );
-               }
-               if ( $language !== null ) {
+               if ( $this->mParser ) {
+                       $popts = $this->getParserOptions();
+                       $popts->setInterfaceMessage( $interface );
                        $popts->setTargetLanguage( $language );
+                       $popts->setUserLang( $language );
+                       $message = $this->mParser->transformMsg( $message, $popts, $title );
                }
-
-               return $parser->parse( $text, $title, $popts, $linestart );
+               return $message;
        }
 
        function disable() {
index 67a634d..120d55a 100644 (file)
@@ -792,7 +792,7 @@ class OutputPage {
         * @param $t Title object
         */
        public function setTitle( $t ) {
-               $this->getContext()->setTitle( $t );
+               $this->getContext()->setTitle($t);
        }
 
        /**