From efdd9ae981f1bc0c6789c5742eef0760a40897a9 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 30 Sep 2006 04:53:36 +0000 Subject: [PATCH] Made {{INT:}} a core parser function instead of a special case. The syntax and behaviour is largely unchanged. --- RELEASE-NOTES | 2 ++ includes/CoreParserFunctions.php | 8 ++++++++ includes/Parser.php | 10 ++-------- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b56ce931ae..0f3c7dcddc 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -237,6 +237,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Try to reconnect after transitory database errors in dumpTextPass.php * (bug 6023) Fixed mismatch of 0/NULL for wl_notificationtimestamp; now notification mails are working after 'Mark all pages visited' button on Special:Watchlist is clicked +* Made {{INT:}} a core parser function instead of a special case. The syntax + and behaviour is largely unchanged. == Languages updated == diff --git a/includes/CoreParserFunctions.php b/includes/CoreParserFunctions.php index 326608e0a6..2081b3f203 100644 --- a/includes/CoreParserFunctions.php +++ b/includes/CoreParserFunctions.php @@ -5,6 +5,14 @@ */ class CoreParserFunctions { + static function intFunction( $parser, $part1 = '' /*, ... */ ) { + if ( strval( $part1 ) !== '' ) { + $args = array_slice( func_get_args(), 2 ); + return wfMsgReal( $part1, $args, true ); + } else { + return array( 'found' => false ); + } + } static function ns( $parser, $part1 = '' ) { global $wgContLang; diff --git a/includes/Parser.php b/includes/Parser.php index 7a84468d0b..733218028f 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -139,6 +139,7 @@ class Parser $this->setHook( 'pre', array( $this, 'renderPreTag' ) ); + $this->setFunctionHook( 'int', array( 'CoreParserFunctions', 'intFunction' ), SFH_NO_HASH ); $this->setFunctionHook( 'ns', array( 'CoreParserFunctions', 'ns' ), SFH_NO_HASH ); $this->setFunctionHook( 'urlencode', array( 'CoreParserFunctions', 'urlencode' ), SFH_NO_HASH ); $this->setFunctionHook( 'lcfirst', array( 'CoreParserFunctions', 'lcfirst' ), SFH_NO_HASH ); @@ -2869,7 +2870,7 @@ class Parser } } - # MSG, MSGNW, INT and RAW + # MSG, MSGNW and RAW if ( !$found ) { # Check for MSGNW: $mwMsgnw =& MagicWord::get( 'msgnw' ); @@ -2886,13 +2887,6 @@ class Parser if ( $mwRaw->matchStartAndRemove( $part1 ) ) { $forceRawInterwiki = true; } - - # Check if it is an internal message - $mwInt =& MagicWord::get( 'int' ); - if ( $mwInt->matchStartAndRemove( $part1 ) ) { - $text = $linestart . wfMsgReal( $part1, $args, true ); - $found = true; - } } wfProfileOut( __METHOD__.'-modifiers' ); -- 2.20.1