r12501 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r12500‎ | r12501 | r12502 >
Date:05:29, 8 January 2006
Author:avar
Status:old
Tags:
Comment:
* 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...}}
Modified paths:
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -3249,12 +3249,27 @@
32503250 * @return string Text
32513251 */
32523252 function cleanSig( $text ) {
3253 - $text = str_replace( '{{', '{{subst:', $text );
3254 - $text = str_replace( '{{subst:subst:', '{{subst:', $text );
3255 - $text = str_replace( '~~~', '', $text );
3256 - $text = str_replace( '~~~~', '', $text );
3257 - $text = str_replace( '~~~~~', '', $text );
3258 - return( $text );
 3253+ $mw = MagicWord::get( MAG_SUBST );
 3254+ $substre = $mw->getBaseRegex();
 3255+ $subst = $mw->getSynonym( 0 );
 3256+ $i = $mw->getRegexCase();
 3257+
 3258+ $text = preg_replace(
 3259+ "/
 3260+ \{\{
 3261+ (?!
 3262+ (?:
 3263+ $substre
 3264+ )
 3265+ )
 3266+ /x$i",
 3267+ '{{' . $subst,
 3268+ $text
 3269+ );
 3270+
 3271+ $text = preg_replace( '/~{3,5}/', '', $text );
 3272+
 3273+ return $text;
32593274 }
32603275
32613276 /**

Status & tagging log