From a02b99c55d29052d24ae1a024455166c1c19cf55 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Mon, 18 Apr 2011 12:00:20 +0000 Subject: [PATCH] Revert unintended changes from r86302 --- includes/GlobalFunctions.php | 12 ++++------ includes/MessageCache.php | 45 ++++++------------------------------ includes/OutputPage.php | 2 +- 3 files changed, 13 insertions(+), 46 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 2f83b07d7b..0c88816663 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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( '/^

(.*)\n?<\/p>\n?$/sU', $string, $m ) ) { $string = $m[1]; diff --git a/includes/MessageCache.php b/includes/MessageCache.php index c5d6ac0975..d907a78714 100644 --- a/includes/MessageCache.php +++ b/includes/MessageCache.php @@ -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() { diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 67a634d9c8..120d55a01a 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -792,7 +792,7 @@ class OutputPage { * @param $t Title object */ public function setTitle( $t ) { - $this->getContext()->setTitle( $t ); + $this->getContext()->setTitle($t); } /** -- 2.20.1