* (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 ==
# 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;
* 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 );
$text = preg_replace( $substRegex, $substText, $text );
$text = preg_replace( '/~{3,5}/', '', $text );
$text = $this->replaceVariables( $text );
-
+
+ $this->clearState();
return $text;
}