From fae0e13116f78a82961d75ba2a09e9ee84f24d4e Mon Sep 17 00:00:00 2001 From: Rob Church Date: Fri, 22 Dec 2006 02:36:06 +0000 Subject: [PATCH] (bug 8247) Minor tweaks to includes/CoreParserFunctions.php and parser test for ANCHORENCODE colon function --- includes/CoreParserFunctions.php | 6 +----- maintenance/parserTests.txt | 10 ++++++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/includes/CoreParserFunctions.php b/includes/CoreParserFunctions.php index 74a187b96e..80280cf272 100644 --- a/includes/CoreParserFunctions.php +++ b/includes/CoreParserFunctions.php @@ -65,7 +65,6 @@ class CoreParserFunctions { static function fullurle( $parser, $s = '', $arg = null ) { return self::urlFunction( 'escapeFullURL', $s, $arg ); } static function urlFunction( $func, $s = '', $arg = null ) { - $found = false; $title = Title::newFromText( $s ); # Due to order of execution of a lot of bits, the values might be encoded # before arriving here; if that's true, then the title can't be created @@ -79,9 +78,6 @@ class CoreParserFunctions { } else { $text = $title->$func(); } - $found = true; - } - if ( $found ) { return $text; } else { return array( 'found' => false ); @@ -172,7 +168,7 @@ class CoreParserFunctions { } static function anchorencode( $parser, $text ) { - return str_replace( '%', '.', str_replace('+', '_', urlencode( $text ) ) ); + return strtr( urlencode( $text ) , array( '%' => '.' , '+' => '_' ) ); } static function special( $parser, $text ) { diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 923f466c08..b009807176 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -6135,6 +6135,16 @@ Pages in namespace (Magic word disabled currently) !! end +!! test +anchorencode +!! input +{{anchorencode:foo bar©#%n}} +!! result +

foo_bar.C2.A9.23.25n +

+!! end + + !! test Bug 8293: Use of center tag ruins paragraph formatting !! input -- 2.20.1