From: Aryeh Gregor Date: Fri, 2 Jan 2009 20:30:53 +0000 (+0000) Subject: Use Sanitizer::escapeId() in another place X-Git-Tag: 1.31.0-rc.0~43606 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=9bfa528584e2b26e43e205b399520e4585b71dff;p=lhc%2Fweb%2Fwiklou.git Use Sanitizer::escapeId() in another place Reduce code duplication some more, and fix section redirect after edit when $wgEnforceHtmlIds is off. --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index da32c00119..a5adc7e9b7 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4684,21 +4684,11 @@ class Parser * "== Header ==". */ public function guessSectionNameFromWikiText( $text ) { + global $wgEnforceHtmlIds; # Strip out wikitext links(they break the anchor) $text = $this->stripSectionName( $text ); - $headline = Sanitizer::decodeCharReferences( $text ); - # strip out HTML - $headline = StringUtils::delimiterReplace( '<', '>', '', $headline ); - $headline = trim( $headline ); - $sectionanchor = '#' . urlencode( str_replace( ' ', '_', $headline ) ); - $replacearray = array( - '%3A' => ':', - '%' => '.' - ); - return str_replace( - array_keys( $replacearray ), - array_values( $replacearray ), - $sectionanchor ); + return '#' . Sanitizer::escapeId( $text, + $wgEnforceHtmlIds ? array() : 'xml' ); } /**