From 58536bfc1bc0c51bd45c2584fdb3fbd5588f3258 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Fri, 16 Jan 2015 14:20:27 -0800 Subject: [PATCH] SpecialMovepage: Improve sanity of form-generating code Mostly whitespace changes and moving stuff around to reduce messed-up indentation. Change-Id: Ia7535094a7845dcc1e1fc3e2ca815b0b2cea742d --- includes/specials/SpecialMovepage.php | 197 ++++++++++++++------------ 1 file changed, 105 insertions(+), 92 deletions(-) diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 2a7e435080..bd80beca8b 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -165,17 +165,7 @@ class MovePageForm extends UnlistedSpecialPage { $out->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() ); $movepagebtn = $this->msg( 'delete_and_move' )->text(); $submitVar = 'wpDeleteAndMove'; - $confirm = " - - - " . - Xml::checkLabel( - $this->msg( 'delete_and_move_confirm' )->text(), - 'wpConfirm', - 'wpConfirm' - ) . - " - "; + $confirm = true; $err = array(); } else { if ( $this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage() ) { @@ -310,12 +300,15 @@ class MovePageForm extends UnlistedSpecialPage { 'id' => 'movepage' ) ) . - Xml::openElement( 'fieldset' ) . - Xml::element( 'legend', null, $this->msg( 'move-page-legend' )->text() ) . - Xml::openElement( 'table', array( 'id' => 'mw-movepage-table' ) ) . - " + Xml::openElement( 'fieldset' ) . + Xml::element( 'legend', null, $this->msg( 'move-page-legend' )->text() ) . + Xml::openElement( 'table', array( 'id' => 'mw-movepage-table' ) ) + ); + + $out->addHTML( + " " . - $this->msg( 'movearticle' )->escaped() . + $this->msg( 'movearticle' )->escaped() . " {$oldTitleLink} @@ -323,32 +316,32 @@ class MovePageForm extends UnlistedSpecialPage { " . - Xml::label( $this->msg( 'newtitle' )->text(), 'wpNewTitleMain' ) . + Xml::label( $this->msg( 'newtitle' )->text(), 'wpNewTitleMain' ) . " " . - Html::namespaceSelector( - array( - 'selected' => $newTitle->getNamespace(), - 'exclude' => $immovableNamespaces - ), - array( 'name' => 'wpNewTitleNs', 'id' => 'wpNewTitleNs' ) - ) . - Xml::input( - 'wpNewTitleMain', - 60, - $wgContLang->recodeForEdit( $newTitle->getText() ), - array( - 'type' => 'text', - 'id' => 'wpNewTitleMain', - 'maxlength' => 255 - ) - ) . - Html::hidden( 'wpOldTitle', $this->oldTitle->getPrefixedText() ) . + Html::namespaceSelector( + array( + 'selected' => $newTitle->getNamespace(), + 'exclude' => $immovableNamespaces + ), + array( 'name' => 'wpNewTitleNs', 'id' => 'wpNewTitleNs' ) + ) . + Xml::input( + 'wpNewTitleMain', + 60, + $wgContLang->recodeForEdit( $newTitle->getText() ), + array( + 'type' => 'text', + 'id' => 'wpNewTitleMain', + 'maxlength' => 255 + ) + ) . + Html::hidden( 'wpOldTitle', $this->oldTitle->getPrefixedText() ) . " " . - Xml::label( $this->msg( 'movereason' )->text(), 'wpReason' ) . + Xml::label( $this->msg( 'movereason' )->text(), 'wpReason' ) . " " . Xml::input( 'wpReason', 60, $this->reason, array( @@ -365,12 +358,12 @@ class MovePageForm extends UnlistedSpecialPage { " . - Xml::checkLabel( - $this->msg( 'movetalk' )->text(), - 'wpMovetalk', - 'wpMovetalk', - $this->moveTalk - ) . + Xml::checkLabel( + $this->msg( 'movetalk' )->text(), + 'wpMovetalk', + 'wpMovetalk', + $this->moveTalk + ) . " " ); @@ -389,14 +382,14 @@ class MovePageForm extends UnlistedSpecialPage { $out->addHTML( " - " . - Xml::checkLabel( - $this->msg( 'move-leave-redirect' )->text(), - 'wpLeaveRedirect', - 'wpLeaveRedirect', - $isChecked, - $options - ) . + " . + Xml::checkLabel( + $this->msg( 'move-leave-redirect' )->text(), + 'wpLeaveRedirect', + 'wpLeaveRedirect', + $isChecked, + $options + ) . " " ); @@ -406,13 +399,13 @@ class MovePageForm extends UnlistedSpecialPage { $out->addHTML( " - " . - Xml::checkLabel( - $this->msg( 'fix-double-redirects' )->text(), - 'wpFixRedirects', - 'wpFixRedirects', - $this->fixRedirects - ) . + " . + Xml::checkLabel( + $this->msg( 'fix-double-redirects' )->text(), + 'wpFixRedirects', + 'wpFixRedirects', + $this->fixRedirects + ) . " " ); @@ -423,21 +416,23 @@ class MovePageForm extends UnlistedSpecialPage { $out->addHTML( " - " . - Xml::check( - 'wpMovesubpages', - # Don't check the box if we only have talk subpages to - # move and we aren't moving the talk page. - $this->moveSubpages && ( $this->oldTitle->hasSubpages() || $this->moveTalk ), - array( 'id' => 'wpMovesubpages' ) - ) . ' ' . - Xml::tags( 'label', array( 'for' => 'wpMovesubpages' ), - $this->msg( - ( $this->oldTitle->hasSubpages() - ? 'move-subpages' - : 'move-talk-subpages' ) - )->numParams( $maximumMovedPages )->params( $maximumMovedPages )->parse() - ) . + " . + Xml::check( + 'wpMovesubpages', + # Don't check the box if we only have talk subpages to + # move and we aren't moving the talk page. + $this->moveSubpages && ( $this->oldTitle->hasSubpages() || $this->moveTalk ), + array( 'id' => 'wpMovesubpages' ) + ) . ' ' . + Xml::tags( + 'label', + array( 'for' => 'wpMovesubpages' ), + $this->msg( + ( $this->oldTitle->hasSubpages() + ? 'move-subpages' + : 'move-talk-subpages' ) + )->numParams( $maximumMovedPages )->params( $maximumMovedPages )->parse() + ) . " " ); @@ -448,32 +443,50 @@ class MovePageForm extends UnlistedSpecialPage { # Don't allow watching if user is not logged in if ( $user->isLoggedIn() ) { $out->addHTML( " - - - " . - Xml::checkLabel( - $this->msg( 'move-watch' )->text(), - 'wpWatch', - 'watch', - $watchChecked - ) . - " - " ); + + + " . + Xml::checkLabel( + $this->msg( 'move-watch' )->text(), + 'wpWatch', + 'watch', + $watchChecked + ) . + " + " + ); + } + + if ( $confirm ) { + $out->addHTML( " + + + " . + Xml::checkLabel( + $this->msg( 'delete_and_move_confirm' )->text(), + 'wpConfirm', + 'wpConfirm' + ) . + " + " + ); } $out->addHTML( " - {$confirm} -   + " . - Xml::submitButton( $movepagebtn, array( 'name' => $submitVar ) ) . + Xml::submitButton( $movepagebtn, array( 'name' => $submitVar ) ) . " - " . - Xml::closeElement( 'table' ) . - Html::hidden( 'wpEditToken', $user->getEditToken() ) . - Xml::closeElement( 'fieldset' ) . - Xml::closeElement( 'form' ) . - "\n" + " + ); + + $out->addHTML( + Xml::closeElement( 'table' ) . + Html::hidden( 'wpEditToken', $user->getEditToken() ) . + Xml::closeElement( 'fieldset' ) . + Xml::closeElement( 'form' ) . + "\n" ); $this->showLogFragment( $this->oldTitle ); -- 2.20.1