r93740 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93739‎ | r93740 | r93741 >
Date:13:47, 2 August 2011
Author:siebrand
Status:resolved (Comments)
Tags:
Comment:
Change some uses of Xml class to Html class.
Modified paths:
  • /trunk/extensions/CentralNotice/special/SpecialNoticeTemplate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/special/SpecialNoticeTemplate.php
@@ -47,7 +47,7 @@
4848 CentralNotice::printHeader();
4949
5050 // Begin Banners tab content
51 - $wgOut->addHTML( Xml::openElement( 'div', array( 'id' => 'preferences' ) ) );
 51+ $wgOut->addHTML( Html::openElement( 'div', array( 'id' => 'preferences' ) ) );
5252
5353 $method = $wgRequest->getVal( 'wpMethod' );
5454
@@ -121,14 +121,14 @@
122122 if ( $sub == 'view' && $wgRequest->getVal( 'wpUserLanguage' ) == 'all' ) {
123123 $template = $wgRequest->getVal( 'template' );
124124 $this->showViewAvailable( $template );
125 - $wgOut->addHTML( Xml::closeElement( 'div' ) );
 125+ $wgOut->addHTML( Html::closeElement( 'div' ) );
126126 return;
127127 }
128128
129129 // Handle viewing a specific banner
130130 if ( $sub == 'view' && $wgRequest->getText( 'template' ) != '' ) {
131131 $this->showView();
132 - $wgOut->addHTML( Xml::closeElement( 'div' ) );
 132+ $wgOut->addHTML( Html::closeElement( 'div' ) );
133133 return;
134134 }
135135
@@ -136,7 +136,7 @@
137137 // Handle showing "Add a banner" interface
138138 if ( $sub == 'add' ) {
139139 $this->showAdd();
140 - $wgOut->addHTML( Xml::closeElement( 'div' ) );
 140+ $wgOut->addHTML( Html::closeElement( 'div' ) );
141141 return;
142142 }
143143
@@ -166,7 +166,7 @@
167167 $this->showList();
168168
169169 // End Banners tab content
170 - $wgOut->addHTML( Xml::closeElement( 'div' ) );
 170+ $wgOut->addHTML( Html::closeElement( 'div' ) );
171171 }
172172
173173 /**
@@ -182,15 +182,15 @@
183183 $htmlOut = '';
184184
185185 // Begin Manage Banners fieldset
186 - $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) );
 186+ $htmlOut .= Html::openElement( 'fieldset', array( 'class' => 'prefsection' ) );
187187
188188 if ( !$pager->getNumRows() ) {
189 - $htmlOut .= Xml::element( 'p', null, wfMsg( 'centralnotice-no-templates' ) );
 189+ $htmlOut .= Html::element( 'p', null, wfMsg( 'centralnotice-no-templates' ) );
190190 } else {
191191 if ( $this->editable ) {
192 - $htmlOut .= Xml::openElement( 'form', array( 'method' => 'post' ) );
 192+ $htmlOut .= Html::openElement( 'form', array( 'method' => 'post' ) );
193193 }
194 - $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-manage-templates' ) );
 194+ $htmlOut .= Html::element( 'h2', null, wfMsg( 'centralnotice-manage-templates' ) );
195195
196196 // Show paginated list of banners
197197 $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ),
@@ -200,18 +200,18 @@
201201 $pager->getNavigationBar() );
202202
203203 if ( $this->editable ) {
204 - $htmlOut .= Xml::closeElement( 'form' );
 204+ $htmlOut .= Html::closeElement( 'form' );
205205 }
206206 }
207207
208208 if ( $this->editable ) {
209 - $htmlOut .= Xml::element( 'p' );
 209+ $htmlOut .= Html::element( 'p' );
210210 $newPage = $this->getTitle( 'add' );
211211 $htmlOut .= $sk->makeLinkObj( $newPage, wfMsgHtml( 'centralnotice-add-template' ) );
212212 }
213213
214214 // End Manage Banners fieldset
215 - $htmlOut .= Xml::closeElement( 'fieldset' );
 215+ $htmlOut .= Html::closeElement( 'fieldset' );
216216
217217 $wgOut->addHTML( $htmlOut );
218218 }
@@ -226,10 +226,10 @@
227227
228228 // Build HTML
229229 $htmlOut = '';
230 - $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) );
231 - $htmlOut .= Xml::openElement( 'form',
 230+ $htmlOut .= Html::openElement( 'fieldset', array( 'class' => 'prefsection' ) );
 231+ $htmlOut .= Html::openElement( 'form',
232232 array( 'method' => 'post', 'onsubmit' => 'return validateBannerForm(this)' ) );
233 - $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-add-template' ) );
 233+ $htmlOut .= Html::element( 'h2', null, wfMsg( 'centralnotice-add-template' ) );
234234 $htmlOut .= Html::hidden( 'wpMethod', 'addTemplate' );
235235
236236 // If there was an error, we'll need to restore the state of the form
@@ -257,22 +257,22 @@
258258 );
259259
260260 // Display settings
261 - $htmlOut .= Xml::openElement( 'p', null );
 261+ $htmlOut .= Html::openElement( 'p', null );
262262 $htmlOut .= wfMsg( 'centralnotice-banner-display' );
263263 $htmlOut .= Xml::check( 'displayAnon', $displayAnon, array( 'id' => 'displayAnon' ) );
264264 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-anonymous' ), 'displayAnon' );
265265 $htmlOut .= Xml::check( 'displayAccount', $displayAccount,
266266 array( 'id' => 'displayAccount' ) );
267267 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-logged-in' ), 'displayAccount' );
268 - $htmlOut .= Xml::closeElement( 'p' );
 268+ $htmlOut .= Html::closeElement( 'p' );
269269
270270 // Fundraising settings
271271 if ( $wgNoticeEnableFundraising ) {
272 - $htmlOut .= Xml::openElement( 'p', null );
 272+ $htmlOut .= Html::openElement( 'p', null );
273273 $htmlOut .= Xml::check( 'fundraising', $fundraising, array( 'id' => 'fundraising' ) );
274274 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-fundraising' ), 'fundraising' );
275 - $htmlOut .= Xml::closeElement( 'p' );
276 - $htmlOut .= Xml::openElement( 'div',
 275+ $htmlOut .= Html::closeElement( 'p' );
 276+ $htmlOut .= Html::openElement( 'div',
277277 array( 'id' => 'fundraisingInterface', 'style' => 'display: none;' ) );
278278 $htmlOut .= Xml::tags( 'p', array(), wfMsg( 'centralnotice-banner-fundraising-help' ) );
279279 $htmlOut .= Xml::tags( 'p', array(),
@@ -282,7 +282,7 @@
283283 array( 'maxlength' => 255 )
284284 )
285285 );
286 - $htmlOut .= Xml::closeElement( 'div' );
 286+ $htmlOut .= Html::closeElement( 'div' );
287287 }
288288
289289 // Begin banner body section
@@ -297,8 +297,8 @@
298298 wfMsg( 'centralnotice-insert', $wgLang->commaList( $buttons ) )
299299 );
300300
301 - $htmlOut .= Xml::textarea( 'templateBody', $body, 60, 20 );
302 - $htmlOut .= Xml::closeElement( 'fieldset' );
 301+ $htmlOut .= Html::textarea( 'templateBody', $body, 60, 20 );
 302+ $htmlOut .= Html::closeElement( 'fieldset' );
303303 $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() );
304304
305305 // Submit button
@@ -307,8 +307,8 @@
308308 Xml::submitButton( wfMsg( 'centralnotice-save-banner' ) )
309309 );
310310
311 - $htmlOut .= Xml::closeElement( 'form' );
312 - $htmlOut .= Xml::closeElement( 'fieldset' );
 311+ $htmlOut .= Html::closeElement( 'form' );
 312+ $htmlOut .= Html::closeElement( 'fieldset' );
313313
314314 // Output HTML
315315 $wgOut->addHTML( $htmlOut );
@@ -348,9 +348,9 @@
349349 $htmlOut = '';
350350
351351 // Begin View Banner fieldset
352 - $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) );
 352+ $htmlOut .= Html::openElement( 'fieldset', array( 'class' => 'prefsection' ) );
353353
354 - $htmlOut .= Xml::element( 'h2', null,
 354+ $htmlOut .= Html::element( 'h2', null,
355355 wfMsg( 'centralnotice-banner-heading', $currentTemplate ) );
356356
357357 // Show preview of banner
@@ -387,14 +387,14 @@
388388 // If there are any message fields in the banner, display translation tools.
389389 if ( count( $fields[0] ) > 0 ) {
390390 if ( $this->editable ) {
391 - $htmlOut .= Xml::openElement( 'form', array( 'method' => 'post' ) );
 391+ $htmlOut .= Html::openElement( 'form', array( 'method' => 'post' ) );
392392 }
393393 $htmlOut .= Xml::fieldset(
394394 wfMsg( 'centralnotice-translate-heading', $currentTemplate ),
395395 false,
396396 array( 'id' => 'mw-centralnotice-translations-for' )
397397 );
398 - $htmlOut .= Xml::openElement( 'table',
 398+ $htmlOut .= Html::openElement( 'table',
399399 array (
400400 'cellpadding' => 9,
401401 'width' => '100%'
@@ -402,14 +402,14 @@
403403 );
404404
405405 // Table headers
406 - $htmlOut .= Xml::element( 'th', array( 'width' => '15%' ),
 406+ $htmlOut .= Html::element( 'th', array( 'width' => '15%' ),
407407 wfMsg( 'centralnotice-message' ) );
408 - $htmlOut .= Xml::element( 'th', array( 'width' => '5%' ),
 408+ $htmlOut .= Html::element( 'th', array( 'width' => '5%' ),
409409 wfMsg ( 'centralnotice-number-uses' ) );
410 - $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ),
 410+ $htmlOut .= Html::element( 'th', array( 'width' => '40%' ),
411411 wfMsg ( 'centralnotice-english' ) );
412412 $languages = Language::getLanguageNames();
413 - $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ),
 413+ $htmlOut .= Html::element( 'th', array( 'width' => '40%' ),
414414 $languages[$wpUserLang] );
415415
416416 // Remove duplicate message fields
@@ -427,14 +427,14 @@
428428 : "Centralnotice-{$currentTemplate}-{$field}/{$wpUserLang}";
429429
430430 // English value
431 - $htmlOut .= Xml::openElement( 'tr' );
 431+ $htmlOut .= Html::openElement( 'tr' );
432432
433433 $title = Title::newFromText( "MediaWiki:{$message}" );
434434 $htmlOut .= Xml::tags( 'td', null,
435435 $sk->makeLinkObj( $title, htmlspecialchars( $field ) )
436436 );
437437
438 - $htmlOut .= Xml::element( 'td', null, $count );
 438+ $htmlOut .= Html::element( 'td', null, $count );
439439
440440 // English text
441441 $englishText = wfMsg( 'centralnotice-message-not-set' );
@@ -450,7 +450,7 @@
451451 $englishTextExists = true;
452452 }
453453 $htmlOut .= Xml::tags( 'td', null,
454 - Xml::element( 'span',
 454+ Html::element( 'span',
455455 array(
456456 'style' => 'font-style:italic;' .
457457 ( !$englishTextExists ? 'color:silver' : '' )
@@ -478,9 +478,9 @@
479479 ( !$foreignTextExists ? 'color:red' : '' ) ) )
480480 )
481481 );
482 - $htmlOut .= Xml::closeElement( 'tr' );
 482+ $htmlOut .= Html::closeElement( 'tr' );
483483 }
484 - $htmlOut .= Xml::closeElement( 'table' );
 484+ $htmlOut .= Html::closeElement( 'table' );
485485
486486 if ( $this->editable ) {
487487 $htmlOut .= Html::hidden( 'wpUserLanguage', $wpUserLang );
@@ -494,19 +494,19 @@
495495 );
496496 }
497497
498 - $htmlOut .= Xml::closeElement( 'fieldset' );
 498+ $htmlOut .= Html::closeElement( 'fieldset' );
499499
500500 if ( $this->editable ) {
501 - $htmlOut .= Xml::closeElement( 'form' );
 501+ $htmlOut .= Html::closeElement( 'form' );
502502 }
503503
504504 // Show language selection form
505505 $actionTitle = $this->getTitleFor( 'NoticeTemplate', 'view' );
506506 $actionUrl = $actionTitle->getLocalURL();
507 - $htmlOut .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $actionUrl ) );
 507+ $htmlOut .= Html::openElement( 'form', array( 'method' => 'get', 'action' => $actionUrl ) );
508508 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-change-lang' ) );
509509 $htmlOut .= Html::hidden( 'template', $currentTemplate );
510 - $htmlOut .= Xml::openElement( 'table', array ( 'cellpadding' => 9 ) );
 510+ $htmlOut .= Html::openElement( 'table', array ( 'cellpadding' => 9 ) );
511511 list( $lsLabel, $lsSelect ) = Xml::languageSelector( $wpUserLang );
512512
513513 $newPage = $this->getTitle( 'view' );
@@ -527,14 +527,14 @@
528528 "template=$currentTemplate&wpUserLanguage=all" )
529529 )
530530 );
531 - $htmlOut .= Xml::closeElement( 'table' );
532 - $htmlOut .= Xml::closeElement( 'fieldset' );
533 - $htmlOut .= Xml::closeElement( 'form' );
 531+ $htmlOut .= Html::closeElement( 'table' );
 532+ $htmlOut .= Html::closeElement( 'fieldset' );
 533+ $htmlOut .= Html::closeElement( 'form' );
534534 }
535535
536536 // Show edit form
537537 if ( $this->editable ) {
538 - $htmlOut .= Xml::openElement( 'form',
 538+ $htmlOut .= Html::openElement( 'form',
539539 array(
540540 'method' => 'post',
541541 'onsubmit' => 'return validateBannerForm(this)'
@@ -560,7 +560,7 @@
561561
562562 // Show banner settings
563563 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-settings' ) );
564 - $htmlOut .= Xml::openElement( 'p', null );
 564+ $htmlOut .= Html::openElement( 'p', null );
565565 $htmlOut .= wfMsg( 'centralnotice-banner-display' );
566566 $htmlOut .= Xml::check( 'displayAnon', $displayAnon,
567567 wfArrayMerge( $disabled, array( 'id' => 'displayAnon' ) ) );
@@ -568,20 +568,20 @@
569569 $htmlOut .= Xml::check( 'displayAccount', $displayAccount,
570570 wfArrayMerge( $disabled, array( 'id' => 'displayAccount' ) ) );
571571 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-logged-in' ), 'displayAccount' );
572 - $htmlOut .= Xml::closeElement( 'p' );
 572+ $htmlOut .= Html::closeElement( 'p' );
573573
574574 // Fundraising settings
575575 if ( $wgNoticeEnableFundraising ) {
576 - $htmlOut .= Xml::openElement( 'p', null );
 576+ $htmlOut .= Html::openElement( 'p', null );
577577 $htmlOut .= Xml::check( 'fundraising', $fundraising,
578578 wfArrayMerge( $disabled, array( 'id' => 'fundraising' ) ) );
579579 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-fundraising' ),
580580 'fundraising' );
581 - $htmlOut .= Xml::closeElement( 'p' );
 581+ $htmlOut .= Html::closeElement( 'p' );
582582 if ( $fundraising ) {
583 - $htmlOut .= Xml::openElement( 'div', array( 'id'=>'fundraisingInterface' ) );
 583+ $htmlOut .= Html::openElement( 'div', array( 'id'=>'fundraisingInterface' ) );
584584 } else {
585 - $htmlOut .= Xml::openElement( 'div',
 585+ $htmlOut .= Html::openElement( 'div',
586586 array( 'id'=>'fundraisingInterface', 'style'=>'display:none;' ) );
587587 }
588588 $htmlOut .= Xml::tags( 'p', array(),
@@ -593,11 +593,11 @@
594594 array( 'maxlength' => 255 )
595595 )
596596 );
597 - $htmlOut .= Xml::closeElement( 'div' );
 597+ $htmlOut .= Html::closeElement( 'div' );
598598 }
599599
600600 // Begin banner body section
601 - $htmlOut .= Xml::closeElement( 'fieldset' );
 601+ $htmlOut .= Html::closeElement( 'fieldset' );
602602 if ( $this->editable ) {
603603 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-edit-template' ) );
604604 $htmlOut .= wfMsg( 'centralnotice-edit-template-summary' );
@@ -614,7 +614,7 @@
615615 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-banner' ) );
616616 }
617617 $htmlOut .= Xml::textarea( 'templateBody', $body, 60, 20, $readonly );
618 - $htmlOut .= Xml::closeElement( 'fieldset' );
 618+ $htmlOut .= Html::closeElement( 'fieldset' );
619619 if ( $this->editable ) {
620620 // Indicate which form was submitted
621621 $htmlOut .= Html::hidden( 'mainform', 'true' );
@@ -623,12 +623,12 @@
624624 array( 'class' => 'cn-buttons' ),
625625 Xml::submitButton( wfMsg( 'centralnotice-save-banner' ) )
626626 );
627 - $htmlOut .= Xml::closeElement( 'form' );
 627+ $htmlOut .= Html::closeElement( 'form' );
628628 }
629629
630630 // Show clone form
631631 if ( $this->editable ) {
632 - $htmlOut .= Xml::openElement ( 'form',
 632+ $htmlOut .= Html::openElement ( 'form',
633633 array(
634634 'method' => 'post',
635635 'action' => $this->getTitle( 'clone' )->getLocalUrl()
@@ -636,8 +636,8 @@
637637 );
638638
639639 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-clone-notice' ) );
640 - $htmlOut .= Xml::openElement( 'table', array( 'cellpadding' => 9 ) );
641 - $htmlOut .= Xml::openElement( 'tr' );
 640+ $htmlOut .= Html::openElement( 'table', array( 'cellpadding' => 9 ) );
 641+ $htmlOut .= Html::openElement( 'tr' );
642642 $htmlOut .= Xml::inputLabel(
643643 wfMsg( 'centralnotice-clone-name' ),
644644 'newTemplate', 'newTemplate', '25' );
@@ -646,15 +646,15 @@
647647 array ( 'id' => 'clone' ) );
648648 $htmlOut .= Html::hidden( 'oldTemplate', $currentTemplate );
649649
650 - $htmlOut .= Xml::closeElement( 'tr' );
651 - $htmlOut .= Xml::closeElement( 'table' );
 650+ $htmlOut .= Html::closeElement( 'tr' );
 651+ $htmlOut .= Html::closeElement( 'table' );
652652 $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() );
653 - $htmlOut .= Xml::closeElement( 'fieldset' );
654 - $htmlOut .= Xml::closeElement( 'form' );
 653+ $htmlOut .= Html::closeElement( 'fieldset' );
 654+ $htmlOut .= Html::closeElement( 'form' );
655655 }
656656
657657 // End View Banner fieldset
658 - $htmlOut .= Xml::closeElement( 'fieldset' );
 658+ $htmlOut .= Html::closeElement( 'fieldset' );
659659
660660 // Output HTML
661661 $wgOut->addHTML( $htmlOut );
@@ -677,9 +677,9 @@
678678 $htmlOut = '';
679679
680680 // Begin View Banner fieldset
681 - $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) );
 681+ $htmlOut .= Html::openElement( 'fieldset', array( 'class' => 'prefsection' ) );
682682
683 - $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-banner-heading', $template ) );
 683+ $htmlOut .= Html::element( 'h2', null, wfMsg( 'centralnotice-banner-heading', $template ) );
684684
685685 foreach ( $langs as $lang ) {
686686 // Link and Preview all available translations
@@ -704,7 +704,7 @@
705705 }
706706
707707 // End View Banner fieldset
708 - $htmlOut .= Xml::closeElement( 'fieldset' );
 708+ $htmlOut .= Html::closeElement( 'fieldset' );
709709
710710 return $wgOut->addHtml( $htmlOut );
711711 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r94296follow-up to r93740, fixing textareakaldari22:42, 11 August 2011

Comments

#Comment by Kaldari (talk | contribs)   22:41, 11 August 2011

Actually some Html methods have a different syntax than Xml methods, for example Html::textarea(), so changing the method actually breaks the code.

#Comment by Kaldari (talk | contribs)   22:42, 11 August 2011

fixed in r94296.

Status & tagging log