Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/229652

Change subject: Use Html::hidden() for hidden input fields
......................................................................

Use Html::hidden() for hidden input fields

This was mostly done with search-and-replace.

Change-Id: I085b8d9c2a12fdae5a7dfecfbc419314dcbb6401
---
M InputBox.classes.php
1 file changed, 19 insertions(+), 133 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/InputBox 
refs/changes/52/229652/1

diff --git a/InputBox.classes.php b/InputBox.classes.php
index 3cf0507..5ce2590 100644
--- a/InputBox.classes.php
+++ b/InputBox.classes.php
@@ -134,13 +134,7 @@
                );
 
                if ( $this->mPrefix != '' ) {
-                       $htmlOut .= Xml::element( 'input',
-                               array(
-                                       'name' => 'prefix',
-                                       'type' => 'hidden',
-                                       'value' => $this->mPrefix,
-                               )
-                       );
+                       $htmlOut .= Html::hidden( 'prefix', $this->mPrefix );
                }
 
                $htmlOut .= $this->mBR;
@@ -360,72 +354,18 @@
                        $createBoxParams['id'] = Sanitizer::escapeId( 
$this->mID );
                }
                $htmlOut .= Xml::openElement( 'form', $createBoxParams );
-               $htmlOut .= Xml::openElement( 'input',
-                       array(
-                               'type' => 'hidden',
-                               'name' => 'action',
-                               'value' => 'edit',
-                       )
-               );
-               $htmlOut .= Xml::openElement( 'input',
-                       array(
-                               'type' => 'hidden',
-                               'name' => 'preload',
-                               'value' => $this->mPreload,
-                       )
-               );
+               $htmlOut .= Html::hidden( 'action', 'edit' );
+               $htmlOut .= Html::hidden( 'preload', $this->mPreload );
                foreach ( $this->mPreloadparams as $preloadparams ) {
-                       $htmlOut .= Xml::openElement( 'input',
-                               array(
-                                       'type' => 'hidden',
-                                       'name' => 'preloadparams[]',
-                                       'value' => $preloadparams,
-                               )
-                       );
+                       $htmlOut .= Html::hidden( 'preloadparams[]', 
$preloadparams );
                }
-               $htmlOut .= Xml::openElement( 'input',
-                       array(
-                               'type' => 'hidden',
-                               'name' => 'editintro',
-                               'value' => $this->mEditIntro,
-                       )
-               );
-               $htmlOut .= Xml::openElement( 'input',
-                       array(
-                               'type' => 'hidden',
-                               'name' => 'summary',
-                               'value' => $this->mSummary,
-                       )
-               );
-               $htmlOut .= Xml::openElement( 'input',
-                       array(
-                               'type' => 'hidden',
-                               'name' => 'nosummary',
-                               'value' => $this->mNosummary,
-                       )
-               );
-               $htmlOut .= Xml::openElement( 'input',
-                       array(
-                               'type' => 'hidden',
-                               'name' => 'prefix',
-                               'value' => $this->mPrefix,
-                       )
-               );
-               $htmlOut .= Xml::openElement( 'input',
-                       array(
-                               'type' => 'hidden',
-                               'name' => 'minor',
-                               'value' => $this->mMinor,
-                       )
-               );
+               $htmlOut .= Html::hidden( 'editintro', $this->mEditIntro );
+               $htmlOut .= Html::hidden( 'summary', $this->mSummary );
+               $htmlOut .= Html::hidden( 'nosummary', $this->mNosummary );
+               $htmlOut .= Html::hidden( 'prefix', $this->mPrefix );
+               $htmlOut .= Html::hidden( 'minor', $this->mMinor );
                if ( $this->mType == 'comment' ) {
-                       $htmlOut .= Xml::openElement( 'input',
-                               array(
-                                       'type' => 'hidden',
-                                       'name' => 'section',
-                                       'value' => 'new',
-                               )
-                       );
+                       $htmlOut .= Html::hidden( 'section', 'new' );
                }
                $htmlOut .= Xml::openElement( 'input',
                        array(
@@ -481,27 +421,9 @@
                        $moveBoxParams['id'] = Sanitizer::escapeId( $this->mID 
);
                }
                $htmlOut .= Xml::openElement( 'form', $moveBoxParams );
-               $htmlOut .= Xml::openElement( 'input',
-                       array(
-                               'type' => 'hidden',
-                               'name' => 'title',
-                               'value' => SpecialPage::getTitleFor( 
'Movepage', $this->mPage )->getPrefixedText(),
-                       )
-               );
-               $htmlOut .= Xml::openElement( 'input',
-                       array(
-                               'type' => 'hidden',
-                               'name' => 'wpReason',
-                               'value' => $this->mSummary,
-                       )
-               );
-               $htmlOut .= Xml::openElement( 'input',
-                       array(
-                               'type' => 'hidden',
-                               'name' => 'prefix',
-                               'value' => $this->mPrefix,
-                       )
-               );
+               $htmlOut .= Html::hidden( 'title', SpecialPage::getTitleFor( 
'Movepage', $this->mPage )->getPrefixedText() );
+               $htmlOut .= Html::hidden( 'wpReason', $this->mSummary );
+               $htmlOut .= Html::hidden( 'prefix', $this->mPrefix );
                $htmlOut .= Xml::openElement( 'input',
                        array(
                                'type' => $this->mHidden ? 'hidden' : 'text',
@@ -554,36 +476,12 @@
                        $commentFormParams['id'] = Sanitizer::escapeId( 
$this->mID );
                }
                $htmlOut .= Xml::openElement( 'form', $commentFormParams );
-               $htmlOut .= Xml::openElement( 'input',
-                       array(
-                               'type' => 'hidden',
-                               'name' => 'action',
-                               'value' => 'edit',
-                       )
-               );
-               $htmlOut .= Xml::openElement( 'input',
-                       array(
-                               'type' => 'hidden',
-                               'name' => 'preload',
-                               'value' => $this->mPreload,
-                       )
-               );
+               $htmlOut .= Html::hidden( 'action', 'edit' );
+               $htmlOut .= Html::hidden( 'preload', $this->mPreload );
                foreach ( $this->mPreloadparams as $preloadparams ) {
-                       $htmlOut .= Xml::openElement( 'input',
-                               array(
-                                       'type' => 'hidden',
-                                       'name' => 'preloadparams[]',
-                                       'value' => $preloadparams,
-                               )
-                       );
+                       $htmlOut .= Html::hidden( 'preloadparams[]', 
$preloadparams );
                }
-               $htmlOut .= Xml::openElement( 'input',
-                       array(
-                               'type' => 'hidden',
-                               'name' => 'editintro',
-                               'value' => $this->mEditIntro,
-                       )
-               );
+               $htmlOut .= Html::hidden( 'editintro', $this->mEditIntro );
                $htmlOut .= Xml::openElement( 'input',
                        array(
                                'type' => $this->mHidden ? 'hidden' : 'text',
@@ -595,20 +493,8 @@
                                'dir' => $this->mDir,
                        )
                );
-               $htmlOut .= Xml::openElement( 'input',
-                       array(
-                               'type' => 'hidden',
-                               'name' => 'section',
-                               'value' => 'new',
-                       )
-               );
-               $htmlOut .= Xml::openElement( 'input',
-                       array(
-                               'type' => 'hidden',
-                               'name' => 'title',
-                               'value' => $this->mPage
-                       )
-               );
+               $htmlOut .= Html::hidden( 'section', 'new' );
+               $htmlOut .= Html::hidden( 'title', $this->mPage );
                $htmlOut .= $this->mBR;
                $htmlOut .= Xml::openElement( 'input',
                        array(

-- 
To view, visit https://gerrit.wikimedia.org/r/229652
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I085b8d9c2a12fdae5a7dfecfbc419314dcbb6401
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/InputBox
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to