From 437c05eef17f612f8d6e4a2c952faa575bf9e08f Mon Sep 17 00:00:00 2001 From: Rob Church Date: Fri, 13 Jan 2006 09:47:09 +0000 Subject: [PATCH] Code cleanup in cleanSig * Remove gratuitous whitespace and eliminate needless use of one-time variables * Remove @static tag since it's not static-safe and isn't used like that any more --- includes/Parser.php | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index 8776b058f6..c9f3d219e5 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -3262,33 +3262,18 @@ class Parser /** * Clean up signature text * - * 1) Force transclusions to be substituted - * 2) Strip ~~~, ~~~~ and ~~~~~ out of signatures + * 1) Strip ~~~, ~~~~ and ~~~~~ out of signatures + * 2) Substitute all transclusions * - * @static * @param string $text - * @return string Text + * @return string Signature text */ function cleanSig( $text ) { - - $mw = MagicWord::get( MAG_SUBST ); - $substre = $mw->getBaseRegex(); - $subst = $mw->getSynonym( 0 ); - $i = $mw->getRegexCase(); - - $text = preg_replace( - "/ - \{\{ - (?! - (?: - $substre - ) - ) - /x$i", - '{{' . $subst, - $text - ); - + $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 ); -- 2.20.1