Fix Parser::cleanSig() to use Parser::startExternalParse() and choose an appropriate...
authorRob Church <robchurch@users.mediawiki.org>
Sun, 30 Apr 2006 20:09:44 +0000 (20:09 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Sun, 30 Apr 2006 20:09:44 +0000 (20:09 +0000)
RELEASE-NOTES
includes/Parser.php

index 14a5cd2..ba0dd25 100644 (file)
@@ -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 ==
 
index c9c96d6..f35f8ec 100644 (file)
@@ -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;
        }