From: Brion Vibber Date: Mon, 28 Jan 2008 20:27:15 +0000 (+0000) Subject: Cleanup for r30216: X-Git-Tag: 1.31.0-rc.0~49744 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=1b72addea74babc4a67e822ee3a2776eb5c46ecf;p=lhc%2Fweb%2Fwiklou.git Cleanup for r30216: * Don't triple-escape HTML in drop-down lists :) * Don't include empty attributes for missing optional parameters * Use content language, not UI language, for loading predefined reasons --- diff --git a/includes/Article.php b/includes/Article.php index 009bdcfd99..5840afa636 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2097,7 +2097,8 @@ class Article { $watch = Xml::checkLabel( wfMsg( 'watchthis' ), 'wpWatch', 'wpWatch', $wgUser->getBoolOption( 'watchdeletion' ) || $this->mTitle->userIsWatching(), array( 'tabindex' => '2' ) ); $deletereasonother = Xml::label( wfMsg( 'deleteotherreason' ), 'wpReason' ); - $reasonDropDown = Xml::listDropDown( 'wpDeleteReasonList', wfMsgHtml( 'deletereason-dropdown' ), + $reasonDropDown = Xml::listDropDown( 'wpDeleteReasonList', + wfMsgForContent( 'deletereason-dropdown' ), wfMsgForContent( 'deletereasonotherlist' ), '', 'wpReasonDropDown', 1 ); $wgOut->addHTML( " diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php index 5f0b74c641..7c97d46cb8 100644 --- a/includes/FileDeleteForm.php +++ b/includes/FileDeleteForm.php @@ -114,7 +114,8 @@ class FileDeleteForm { $deletereasonother = Xml::label( wfMsg( 'filedelete-otherreason' ), 'wpReason' ); $delcom = Xml::label( wfMsg( 'filedelete-comment' ), 'wpDeleteReasonList' ); - $reasonDropDown = Xml::listDropDown( 'wpDeleteReasonList', wfMsgHtml( 'filedelete-reason-dropdown' ), + $reasonDropDown = Xml::listDropDown( 'wpDeleteReasonList', + wfMsgForContent( 'filedelete-reason-dropdown' ), wfMsgForContent( 'filedelete-reason-otherlist' ), '', 'wpReasonDropDown', 1 ); $form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getAction() ) ); diff --git a/includes/SpecialBlockip.php b/includes/SpecialBlockip.php index 6b26a358bf..b9d21fc4dd 100644 --- a/includes/SpecialBlockip.php +++ b/includes/SpecialBlockip.php @@ -110,7 +110,8 @@ class IPBlockForm { $blockExpiryFormOptions .= ""; } - $reasonDropDown = Xml::listDropDown( 'wpBlockReasonList', wfMsgHtml( 'ipbreason-dropdown' ), + $reasonDropDown = Xml::listDropDown( 'wpBlockReasonList', + wfMsgForContent( 'ipbreason-dropdown' ), wfMsgForContent( 'ipbreasonotherlist' ), '', 'wpBlockDropDown', 4 ); $token = $wgUser->editToken(); diff --git a/includes/Xml.php b/includes/Xml.php index 2262df86c2..6689a4a4d1 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -346,7 +346,7 @@ class Xml { $options = self::option( $other, 'other', $selected === 'other' ); foreach ( explode( "\n", $list ) as $option) { - $value = trim( htmlspecialchars($option) ); + $value = trim( $option ); if ( $value == '' ) { continue; } elseif ( substr( $value, 0, 1) == '*' && substr( $value, 1, 1) != '*' ) { @@ -368,8 +368,18 @@ class Xml { } if( $optgroup ) $options .= self::closeElement('optgroup'); - return Xml::openElement( 'select', array( 'id' => $name, 'name' => $name, - 'class' => $class, 'tabindex' => $tabindex ) ) + $attribs = array(); + if( $name ) { + $attribs['id'] = $name; + $attribs['name'] = $name; + } + if( $class ) { + $attribs['class'] = $class; + } + if( $tabindex ) { + $attribs['tabindex'] = $tabindex; + } + return Xml::openElement( 'select', $attribs ) . "\n" . $options . "\n"