From aece69bc8946bd3373e68ad511da7e75829b37a4 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Fri, 21 Aug 2009 20:39:35 +0000 Subject: [PATCH] Switch from Xml:: to Html:: in a few places These should all theoretically be covered by the parser tests. All tests pass, the only change needed was to account for less overescaping in Html::expandAttributes(). There's no reason to escape <>' in "-quoted attributes, unless I'm mistaken and have just added some XSS. --- includes/Linker.php | 6 +++--- includes/parser/DateFormatter.php | 2 +- maintenance/parserTests.txt | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/Linker.php b/includes/Linker.php index dea1c48ba1..f833fcd01c 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -206,7 +206,7 @@ class Linker { $ret = null; if( wfRunHooks( 'LinkEnd', array( $this, $target, $options, &$text, &$attribs, &$ret ) ) ) { - $ret = Xml::openElement( 'a', $attribs ) . $text . Xml::closeElement( 'a' ); + $ret = Html::rawElement( 'a', $attribs, $text ); } wfProfileOut( __METHOD__ ); @@ -382,7 +382,7 @@ class Linker { wfDebug("Hook LinkerMakeExternalImage changed the output of external image with url {$url} and alt text {$alt} to {$img}\n", true); return $img; } - return Xml::element( 'img', + return Html::element( 'img', array( 'src' => $url, 'alt' => $alt ) ); @@ -753,7 +753,7 @@ class Linker { return $link; } if ( $attribs ) { - $attribsText .= Xml::expandAttributes( $attribs ); + $attribsText .= Html::expandAttributes( $attribs ); } return ''.$text.''; } diff --git a/includes/parser/DateFormatter.php b/includes/parser/DateFormatter.php index 087fdda468..602bcff370 100644 --- a/includes/parser/DateFormatter.php +++ b/includes/parser/DateFormatter.php @@ -268,7 +268,7 @@ class DateFormatter $isoDate = implode( '-', $isoBits );; // Output is not strictly HTML (it's wikitext), but is whitelisted. - $text = Xml::tags( 'span', + $text = Html::rawElement( 'span', array( 'class' => 'mw-formatted-date', 'title' => $isoDate ), $text ); return $text; diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index ef48c0f563..6afcef53a8 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -1467,7 +1467,7 @@ Link containing "<#" and ">#" as hex sequences !! input [[%3c%23]][[%3e%23]] !! result -

[[%3c%23]]># +

[[%3c%23]]>#

!! end @@ -3502,7 +3502,7 @@ Link to category !! input [[:Category:MediaWiki User's Guide]] !! result -

Category:MediaWiki User's Guide +

Category:MediaWiki User's Guide

!! end @@ -3513,7 +3513,7 @@ cat !! input [[Category:MediaWiki User's Guide]] !! result -MediaWiki User's Guide +MediaWiki User's Guide !! end !! test @@ -6820,7 +6820,7 @@ language=sr cat !! input [[:Category:МедиаWики Усер'с Гуиде]] !! result -MediaWiki User's Guide +MediaWiki User's Guide !! end -- 2.20.1