From fc083890eab979478c18de0c387cbced0466ade1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Sun, 8 Jan 2006 05:29:58 +0000 Subject: [PATCH] * 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...}} --- includes/Parser.php | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) 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; } /** -- 2.20.1