* Fixed a peer development oversight introduced in revision 1.564 by rob
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Sun, 8 Jan 2006 05:29:58 +0000 (05:29 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Sun, 8 Jan 2006 05:29:58 +0000 (05:29 +0000)
  - 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

index 483ccef..c64fbf3 100644 (file)
@@ -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;
        }
        
        /**