From 2e7cecdeb60c1b7000f57d5b64b8f423ea75e4ae Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 23 Oct 2004 07:10:37 +0000 Subject: [PATCH] Remove $wgCurParser kludge --- includes/Parser.php | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index beffc7a046..ecbf761765 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -67,7 +67,7 @@ define( 'EXT_IMAGE_REGEX', * performs brace substitution on MediaWiki messages * * Globals used: - * objects: $wgLang, $wgDateFormatter, $wgLinkCache, $wgCurParser + * objects: $wgLang, $wgDateFormatter, $wgLinkCache * * NOT $wgArticle, $wgUser or $wgTitle. Keep them away! * @@ -1739,19 +1739,16 @@ class Parser # This function is called recursively. To keep track of arguments we need a stack: array_push( $this->mArgStack, $args ); - # PHP global rebinding syntax is a bit weird, need to use the GLOBALS array - $GLOBALS['wgCurParser'] =& $this; - # Variable substitution - $text = preg_replace_callback( "/{{([$titleChars]*?)}}/", 'wfVariableSubstitution', $text ); + $text = preg_replace_callback( "/{{([$titleChars]*?)}}/", array( &$this, 'variableSubstitution' ), $text ); if ( $this->mOutputType == OT_HTML || $this->mOutputType == OT_WIKI ) { # Argument substitution - $text = preg_replace_callback( "/{{{([$titleChars]*?)}}}/", 'wfArgSubstitution', $text ); + $text = preg_replace_callback( "/{{{([$titleChars]*?)}}}/", array( &$this, 'argSubstitution' ), $text ); } # Template substitution $regex = '/(\\n|{)?{{(['.$titleChars.']*)(\\|.*?|)}}/s'; - $text = preg_replace_callback( $regex, 'wfBraceSubstitution', $text ); + $text = preg_replace_callback( $regex, array( &$this, 'braceSubstitution' ), $text ); array_pop( $this->mArgStack ); @@ -2722,7 +2719,7 @@ class Parser * @access private */ function pstPass2( $text, &$user ) { - global $wgLang, $wgContLang, $wgLocaltimezone, $wgCurParser; + global $wgLang, $wgContLang, $wgLocaltimezone; # Variable replacement # Because mOutputType is OT_WIKI, this will only process {{subst:xxx}} type tags @@ -3113,23 +3110,6 @@ function &outputReplaceMatches($matches) { return $outputReplace[$matches[1]]; } - -# Regex callbacks, used in Parser::replaceVariables -function wfBraceSubstitution( $matches ) { - global $wgCurParser; - return $wgCurParser->braceSubstitution( $matches ); -} - -function wfArgSubstitution( $matches ) { - global $wgCurParser; - return $wgCurParser->argSubstitution( $matches ); -} - -function wfVariableSubstitution( $matches ) { - global $wgCurParser; - return $wgCurParser->variableSubstitution( $matches ); -} - /** * Return the total number of articles */ -- 2.20.1