From e7f5589bfe0541faa5ff3e0f47003f52042a5f22 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Wed, 17 May 2006 15:36:05 +0000 Subject: [PATCH] (bug 839) Add URLENCODE magic word --- RELEASE-NOTES | 1 + includes/MagicWord.php | 2 ++ includes/Parser.php | 9 +++++++++ languages/Language.php | 1 + 4 files changed, 13 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2ba195d446..dc63efd332 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -286,6 +286,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 6001) PAGENAMEE and FULLPAGENAMEE don't work in FULLURL and LOCALURL magic words * (bug 5958) Switch Uzbek language name to use latin script +* (bug 839) Add URLENCODE magic word == Compatibility == diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 79e04a2dc3..c747b7f975 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -88,6 +88,7 @@ $magicWords = array( 'MAG_CURRENTVERSION', 'MAG_BASEPAGENAME', 'MAG_BASEPAGENAMEE', + 'MAG_URLENCODE', ); if ( ! defined( 'MEDIAWIKI_INSTALL' ) ) wfRunHooks( 'MagicWordMagicWords', array( &$magicWords ) ); @@ -138,6 +139,7 @@ $wgVariableIDs = array( MAG_CURRENTVERSION, MAG_BASEPAGENAME, MAG_BASEPAGENAMEE, + MAG_URLENCODE, ); if ( ! defined( 'MEDIAWIKI_INSTALL' ) ) wfRunHooks( 'MagicWordwgVariableIDs', array( &$wgVariableIDs ) ); diff --git a/includes/Parser.php b/includes/Parser.php index f3eb35aeeb..a3c3adf664 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -2579,6 +2579,15 @@ class Parser } } + # URLENCODE + if( !$found ) { + $urlencode =& MagicWord::get( MAG_URLENCODE ); + if( $urlencode->matchStartAndRemove( $part1 ) ) { + $text = $linestart . urlencode( $part1 ); + $found = true; + } + } + # LCFIRST, UCFIRST, LC and UC if ( !$found ) { $lcfirst =& MagicWord::get( MAG_LCFIRST ); diff --git a/languages/Language.php b/languages/Language.php index 7e0fd78ab9..c2b9c84755 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -286,6 +286,7 @@ $wgLanguageNamesEn =& $wgLanguageNames; MAG_RAWSUFFIX => array( 1, 'R' ), MAG_NEWSECTIONLINK => array( 1, '__NEWSECTIONLINK__' ), MAG_CURRENTVERSION => array( 1, 'CURRENTVERSION' ), + MAG_URLENCODE => array( 0, 'URLENCODE:' ), ); if (!$wgCachedMessageArrays) { -- 2.20.1