From a197b768ddf4a554752ab0d3ea8dd18839ca5e6d Mon Sep 17 00:00:00 2001 From: Tobias Date: Sun, 2 Aug 2009 18:16:56 +0000 Subject: [PATCH] introducing new CoreParserFunction nse as an url-friendly equivalent to ns. bug 12920 --- RELEASE-NOTES | 3 ++- includes/parser/CoreParserFunctions.php | 5 +++++ languages/messages/MessagesEn.php | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 3677fcfb79..a486ff465a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -174,6 +174,8 @@ this. Was used when mwEmbed was going to be an extension. * (bug 20014) Added CSS class "mw-listgrouprights-right-name" is wrapped on the right name in Special:ListGroupRights * The description message in $wgExtensionCredits can be an array with parameters +* (bug 12920) New CoreParserFunction {{nse:...}} as an url-friendly equivalent + to {{ns:...}} === Bug fixes in 1.16 === @@ -366,7 +368,6 @@ this. Was used when mwEmbed was going to be an extension. * (bug 17395) Remote file descriptions use user language ($wgLang), not wiki language ($wgContLang) - == API changes in 1.16 == * Added uiprop=changeablegroups to meta=userinfo diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index 129fca1262..d1fe95f9f2 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -16,6 +16,7 @@ class CoreParserFunctions { $parser->setFunctionHook( 'int', array( __CLASS__, 'intFunction' ), SFH_NO_HASH ); $parser->setFunctionHook( 'ns', array( __CLASS__, 'ns' ), SFH_NO_HASH ); + $parser->setFunctionHook( 'nse', array( __CLASS__, 'nse' ), SFH_NO_HASH ); $parser->setFunctionHook( 'urlencode', array( __CLASS__, 'urlencode' ), SFH_NO_HASH ); $parser->setFunctionHook( 'lcfirst', array( __CLASS__, 'lcfirst' ), SFH_NO_HASH ); $parser->setFunctionHook( 'ucfirst', array( __CLASS__, 'ucfirst' ), SFH_NO_HASH ); @@ -118,6 +119,10 @@ class CoreParserFunctions { return array( 'found' => false ); } } + + static function nse( $parser, $part1 = '' ) { + return wfUrlencode( str_replace( ' ', '_', self::ns( $parser, $part1 ) ) ); + } static function urlencode( $parser, $s = '' ) { return urlencode( $s ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 4c92886eee..5b4f06f301 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -291,6 +291,7 @@ $magicWords = array( 'int' => array( 0, 'INT:' ), 'sitename' => array( 1, 'SITENAME' ), 'ns' => array( 0, 'NS:' ), + 'nse' => array( 0, 'NSE:' ), 'localurl' => array( 0, 'LOCALURL:' ), 'localurle' => array( 0, 'LOCALURLE:' ), 'server' => array( 0, 'SERVER' ), -- 2.20.1