r55910 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55909‎ | r55910 | r55911 >
Date:01:47, 7 September 2009
Author:simetrical
Status:deferred
Tags:
Comment:
Convert HTMLForm to use more Html::*
Modified paths:
  • /trunk/phase3/includes/HTMLForm.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/HTMLForm.php
@@ -180,7 +180,7 @@
181181 }
182182
183183 function wrapForm( $html ) {
184 - return Xml::tags(
 184+ return Html::rawElement(
185185 'form',
186186 array(
187187 'action' => $this->getTitle()->getFullURL(),
@@ -194,8 +194,8 @@
195195 global $wgUser;
196196 $html = '';
197197
198 - $html .= Xml::hidden( 'wpEditToken', $wgUser->editToken() ) . "\n";
199 - $html .= Xml::hidden( 'title', $this->getTitle() ) . "\n";
 198+ $html .= Html::hidden( 'wpEditToken', $wgUser->editToken() ) . "\n";
 199+ $html .= Html::hidden( 'title', $this->getTitle() ) . "\n";
200200
201201 return $html;
202202 }
@@ -213,7 +213,7 @@
214214 $html .= Xml::submitButton( $this->getSubmitText(), $attribs ) . "\n";
215215
216216 if( $this->mShowReset ) {
217 - $html .= Xml::element(
 217+ $html .= Html::element(
218218 'input',
219219 array(
220220 'type' => 'reset',
@@ -236,7 +236,7 @@
237237 $errorstr = $errors;
238238 }
239239
240 - $errorstr = Xml::tags( 'div', array( 'class' => 'error' ), $errorstr );
 240+ $errorstr = Html::rawElement( 'div', array( 'class' => 'error' ), $errorstr );
241241
242242 global $wgOut;
243243 $wgOut->addHTML( $errorstr );
@@ -251,14 +251,14 @@
252252 $msg = $error;
253253 $error = array();
254254 }
255 - $errorstr .= Xml::tags(
 255+ $errorstr .= Html::rawElement(
256256 'li',
257257 null,
258258 wfMsgExt( $msg, array( 'parseinline' ), $error )
259259 );
260260 }
261261
262 - $errorstr = Xml::tags( 'ul', null, $errorstr );
 262+ $errorstr = Html::rawElement( 'ul', array(), $errorstr );
263263
264264 return $errorstr;
265265 }
@@ -450,20 +450,20 @@
451451 if ( $errors === true || !$wgRequest->wasPosted() ) {
452452 $errors = '';
453453 } else {
454 - $errors = Xml::tags( 'span', array( 'class' => 'error' ), $errors );
 454+ $errors = Html::rawElement( 'span', array( 'class' => 'error' ), $errors );
455455 }
456456
457457 $html = '';
458458
459 - $html .= Xml::tags( 'td', array( 'class' => 'mw-label' ),
460 - Xml::tags( 'label', array( 'for' => $this->mID ), $this->getLabel() )
 459+ $html .= Html::rawElement( 'td', array( 'class' => 'mw-label' ),
 460+ Html::rawElement( 'label', array( 'for' => $this->mID ), $this->getLabel() )
461461 );
462 - $html .= Xml::tags( 'td', array( 'class' => 'mw-input' ),
 462+ $html .= Html::rawElement( 'td', array( 'class' => 'mw-input' ),
463463 $this->getInputHTML( $value ) ."\n$errors" );
464464
465465 $fieldType = get_class( $this );
466466
467 - $html = Xml::tags( 'tr', array( 'class' => "mw-htmlform-field-$fieldType" ),
 467+ $html = Html::rawElement( 'tr', array( 'class' => "mw-htmlform-field-$fieldType" ),
468468 $html ) . "\n";
469469
470470 $helptext = null;
@@ -479,9 +479,9 @@
480480 }
481481
482482 if ( !is_null( $helptext ) ) {
483 - $row = Xml::tags( 'td', array( 'colspan' => 2, 'class' => 'htmlform-tip' ),
 483+ $row = Html::rawElement( 'td', array( 'colspan' => 2, 'class' => 'htmlform-tip' ),
484484 $helptext );
485 - $row = Xml::tags( 'tr', null, $row );
 485+ $row = Html::rawElement( 'tr', array(), $row );
486486 $html .= "$row\n";
487487 }
488488
@@ -637,7 +637,7 @@
638638 }
639639
640640 return Xml::check( $this->mName, $value, $attr ) . ' ' .
641 - Xml::tags( 'label', array( 'for' => $this->mID ), $this->mLabel );
 641+ Html::rawElement( 'label', array( 'for' => $this->mID ), $this->mLabel );
642642 }
643643
644644 function getLabel() {
@@ -743,9 +743,9 @@
744744 $tbAttribs['maxlength'] = $this->mParams['maxlength'];
745745 }
746746
747 - $textbox = Xml::input( $this->mName . '-other',
 747+ $textbox = Html::input( $this->mName . '-other',
748748 $this->getSize(),
749 - $valInSelect ? '' : $value,
 749+ $valInSelect ? 'text' : $value,
750750 $tbAttribs );
751751
752752 return "$select<br/>\n$textbox";
@@ -800,14 +800,14 @@
801801
802802 foreach( $options as $label => $info ) {
803803 if( is_array( $info ) ) {
804 - $html .= Xml::tags( 'h1', null, $label ) . "\n";
 804+ $html .= Html::rawElement( 'h1', array(), $label ) . "\n";
805805 $html .= $this->formatOptions( $info, $value );
806806 } else {
807807 $thisAttribs = array( 'id' => $this->mID . "-$info", 'value' => $info );
808808
809809 $checkbox = Xml::check( $this->mName . '[]', in_array( $info, $value ),
810810 $attribs + $thisAttribs );
811 - $checkbox .= '&nbsp;' . Xml::tags( 'label', array( 'for' => $this->mID . "-$info" ), $label );
 811+ $checkbox .= '&nbsp;' . Html::rawElement( 'label', array( 'for' => $this->mID . "-$info" ), $label );
812812
813813 $html .= $checkbox . '<br />';
814814 }
@@ -871,14 +871,14 @@
872872
873873 foreach( $options as $label => $info ) {
874874 if( is_array( $info ) ) {
875 - $html .= Xml::tags( 'h1', null, $label ) . "\n";
 875+ $html .= Html::rawElement( 'h1', array(), $label ) . "\n";
876876 $html .= $this->formatOptions( $info, $value );
877877 } else {
878878 $id = Sanitizer::escapeId( $this->mID . "-$info" );
879879 $html .= Xml::radio( $this->mName, $info, $info == $value,
880880 $attribs + array( 'id' => $id ) );
881881 $html .= '&nbsp;' .
882 - Xml::tags( 'label', array( 'for' => $id ), $label );
 882+ Html::rawElement( 'label', array( 'for' => $id ), $label );
883883
884884 $html .= "<br/>\n";
885885 }

Status & tagging log