From df1e411f4b7099a16014223363dc3f57e6f40844 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Wed, 30 Aug 2006 07:51:44 +0000 Subject: [PATCH] * (bug 7059) Introduce "anchorencode" colon function --- RELEASE-NOTES | 1 + includes/CoreParserFunctions.php | 4 ++++ includes/Parser.php | 1 + languages/MessagesEn.php | 1 + 4 files changed, 7 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 378c35db80..ef7da1e778 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -162,6 +162,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 366) Add local-system-timezone equivalents for date/time variables * (bug 7109) Fix Atom feed version number in header links * (bug 7075) List registered parser function hooks on Special:Version +* (bug 7059) Introduce "anchorencode" colon function == Languages updated == diff --git a/includes/CoreParserFunctions.php b/includes/CoreParserFunctions.php index dacb1b5f47..8759e70d11 100644 --- a/includes/CoreParserFunctions.php +++ b/includes/CoreParserFunctions.php @@ -163,6 +163,10 @@ class CoreParserFunctions { return self::pad( $string, $length, $char ); } + function anchorencode( $parser, $text ) { + return str_replace( '%', '.', urlencode( $text ) ); + } + } ?> diff --git a/includes/Parser.php b/includes/Parser.php index 98178de359..fedbeab1b6 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -160,6 +160,7 @@ class Parser $this->setFunctionHook( 'language', array( 'CoreParserFunctions', 'language' ), SFH_NO_HASH ); $this->setFunctionHook( 'padleft', array( 'CoreParserFunctions', 'padleft' ), SFH_NO_HASH ); $this->setFunctionHook( 'padright', array( 'CoreParserFunctions', 'padright' ), SFH_NO_HASH ); + $this->setFunctionHook( 'anchorencode', array( 'CoreParserFunctions', 'anchorencode' ), SFH_NO_HASH ); if ( $wgAllowDisplayTitle ) { $this->setFunctionHook( 'displaytitle', array( 'CoreParserFunctions', 'displaytitle' ), SFH_NO_HASH ); diff --git a/languages/MessagesEn.php b/languages/MessagesEn.php index 27266be0f2..93f17c4f6c 100644 --- a/languages/MessagesEn.php +++ b/languages/MessagesEn.php @@ -283,6 +283,7 @@ $magicWords = array( 'newsectionlink' => array( 1, '__NEWSECTIONLINK__' ), 'currentversion' => array( 1, 'CURRENTVERSION' ), 'urlencode' => array( 0, 'URLENCODE:' ), + 'anchorencode' => array( 0, 'ANCHORENCODE' ), 'currenttimestamp' => array( 1, 'CURRENTTIMESTAMP' ), 'localtimestamp' => array( 1, 'LOCALTIMESTAMP' ), 'directionmark' => array( 1, 'DIRECTIONMARK', 'DIRMARK' ), -- 2.20.1