From: Ævar Arnfjörð Bjarmason Date: Sun, 8 Jan 2006 05:29:58 +0000 (+0000) Subject: * Fixed a peer development oversight introduced in revision 1.564 by rob X-Git-Tag: 1.6.0~699 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=fc083890eab979478c18de0c387cbced0466ade1;p=lhc%2Fweb%2Fwiklou.git * Fixed a peer development oversight introduced in revision 1.564 by rob - Didn't use the magic word class to match subst: in the sign*A*ture, as a result {{Subst:x}} would be turned into {{subst:Subst:x}} (no /i) and {{this_is_valid_subst_in_some_locale:x}} would be turned into {{subst:this...}} --- diff --git a/includes/Parser.php b/includes/Parser.php index 483ccef251..c64fbf3c20 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -3249,12 +3249,27 @@ class Parser * @return string Text */ function cleanSig( $text ) { - $text = str_replace( '{{', '{{subst:', $text ); - $text = str_replace( '{{subst:subst:', '{{subst:', $text ); - $text = str_replace( '~~~', '', $text ); - $text = str_replace( '~~~~', '', $text ); - $text = str_replace( '~~~~~', '', $text ); - return( $text ); + $mw = MagicWord::get( MAG_SUBST ); + $substre = $mw->getBaseRegex(); + $subst = $mw->getSynonym( 0 ); + $i = $mw->getRegexCase(); + + $text = preg_replace( + "/ + \{\{ + (?! + (?: + $substre + ) + ) + /x$i", + '{{' . $subst, + $text + ); + + $text = preg_replace( '/~{3,5}/', '', $text ); + + return $text; } /**