From: Rob Church Date: Sun, 30 Apr 2006 20:09:44 +0000 (+0000) Subject: Fix Parser::cleanSig() to use Parser::startExternalParse() and choose an appropriate... X-Git-Tag: 1.31.0-rc.0~57302 X-Git-Url: https://git.cyclocoop.org/?a=commitdiff_plain;h=a584743b2a61f055fa6e4f92e9e84fadc18c9a28;p=lhc%2Fweb%2Fwiklou.git Fix Parser::cleanSig() to use Parser::startExternalParse() and choose an appropriate output format given the scope of the clean --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 14a5cd27a0..ba0dd25f87 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -158,6 +158,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 5487) Escape self-closed HTML pair tags * Add "raw suffix" magic word for some magic words, e.g. {{NUMBEROFUSERS|R}} will produce a count minus formatting +* Fix Parser::cleanSig() to use Parser::startExternalParse() and choose an appropriate + output format given the scope of the clean == Compatibility == diff --git a/includes/Parser.php b/includes/Parser.php index c9c96d62b3..f35f8ec0d6 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -3557,7 +3557,7 @@ class Parser # Sig. might contain markup; validate this if( $this->validateSig( $nickname ) !== false ) { # Validated; clean up (if needed) and return it - return( $this->cleanSig( $nickname ) ); + return $this->cleanSig( $nickname, true ); } else { # Failed to validate; fall back to the default $nickname = $username; @@ -3587,9 +3587,13 @@ class Parser * 2) Substitute all transclusions * * @param string $text + * @param $parsing Whether we're cleaning (preferences save) or parsing * @return string Signature text */ - function cleanSig( $text ) { + function cleanSig( $text, $parsing = false ) { + global $wgTitle; + $this->startExternalParse( $wgTitle, new ParserOptions(), $parsing ? OT_WIKI : OT_MSG ); + $substWord = MagicWord::get( MAG_SUBST ); $substRegex = '/\{\{(?!(?:' . $substWord->getBaseRegex() . '))/x' . $substWord->getRegexCase(); $substText = '{{' . $substWord->getSynonym( 0 ); @@ -3597,7 +3601,8 @@ class Parser $text = preg_replace( $substRegex, $substText, $text ); $text = preg_replace( '/~{3,5}/', '', $text ); $text = $this->replaceVariables( $text ); - + + $this->clearState(); return $text; }