From: Gabriel Wicke Date: Sat, 5 Jun 2004 10:34:32 +0000 (+0000) Subject: section anchor cleanup, unurlencode : X-Git-Tag: 1.5.0alpha1~3026 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=c410b3f316335e6d23ae2b629c707c7df7c2318d;p=lhc%2Fweb%2Fwiklou.git section anchor cleanup, unurlencode : --- diff --git a/includes/EditPage.php b/includes/EditPage.php index a4fbb5b5c5..06910ecee2 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -211,8 +211,12 @@ class EditPage { # strip out HTML $headline = preg_replace( "/<.*?" . ">/","",$headline ); $headline = trim( $headline ); - $sectionanchor = '#'.preg_replace("/[ \\?&\\/<>\\(\\)\\[\\]=,+']+/", '_', urlencode( $headline ) ); - $sectionanchor = str_replace('%','.',$sectionanchor); + $sectionanchor = '#'.urlencode( str_replace(' ', '_', $headline ) ); + $replacearray = array( + '%3A' => ':', + '%' => '.' + ); + $sectionanchor = str_replace(array_keys($replacearray),array_values($replacearray),$sectionanchor); } } diff --git a/includes/Parser.php b/includes/Parser.php index 16ec4c6455..a15690b18d 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1745,8 +1745,12 @@ class Parser # strip out HTML $canonized_headline = preg_replace( "/<.*?" . ">/","",$canonized_headline ); $tocline = trim( $canonized_headline ); - $canonized_headline = preg_replace("/[ \\?&\\/<>\\(\\)\\[\\]=,+']+/", '_', urlencode( do_html_entity_decode( $tocline, ENT_COMPAT, $wgInputEncoding ) ) ); - $canonized_headline = str_replace('%','.',$canonized_headline); + $canonized_headline = urlencode( do_html_entity_decode( str_replace(' ', '_', $tocline), ENT_COMPAT, $wgInputEncoding ) ); + $replacearray = array( + '%3A' => ':', + '%' => '.' + ); + $canonized_headline = str_replace(array_keys($replacearray),array_values($replacearray),$canonized_headline); $refer[$headlineCount] = $canonized_headline; # count how many in assoc. array so we can track dupes in anchors