From ad957a706dc0c34f1a540703c066b621a455a571 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Fri, 9 May 2014 21:33:58 +0200 Subject: [PATCH] Pass phpcs-strict on includes/specials/ (1/3) Change-Id: Ib4522f22551ed5501e1ab7767b8f481fe6cd72d2 --- includes/specials/SpecialActiveusers.php | 24 ++++++++++++++------ includes/specials/SpecialBlock.php | 16 +++++++++---- includes/specials/SpecialBlockList.php | 17 ++++++++++---- includes/specials/SpecialBooksources.php | 21 +++++++++++++---- includes/specials/SpecialBrokenRedirects.php | 4 ++-- includes/specials/SpecialCachedPage.php | 10 +++++--- includes/specials/SpecialChangeEmail.php | 11 ++++++--- includes/specials/SpecialChangePassword.php | 5 ++-- includes/specials/SpecialContributions.php | 3 ++- includes/specials/SpecialCreateAccount.php | 7 +++++- 10 files changed, 86 insertions(+), 32 deletions(-) diff --git a/includes/specials/SpecialActiveusers.php b/includes/specials/SpecialActiveusers.php index d963677220..c42c089c80 100644 --- a/includes/specials/SpecialActiveusers.php +++ b/includes/specials/SpecialActiveusers.php @@ -31,7 +31,6 @@ * @ingroup SpecialPage */ class ActiveUsersPager extends UsersPager { - /** * @var FormOptions */ @@ -194,20 +193,31 @@ class ActiveUsersPager extends UsersPager { $self = $this->getTitle(); $limit = $this->mLimit ? Html::hidden( 'limit', $this->mLimit ) : ''; - $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); # Form tag + # Form tag + $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); $out .= Xml::fieldset( $this->msg( 'activeusers' )->text() ) . "\n"; $out .= Html::hidden( 'title', $self->getPrefixedDBkey() ) . $limit . "\n"; + # Username field $out .= Xml::inputLabel( $this->msg( 'activeusers-from' )->text(), - 'username', 'offset', 20, $this->requestedUser, array( 'tabindex' => 1 ) ) . '
';# Username field + 'username', 'offset', 20, $this->requestedUser, array( 'tabindex' => 1 ) ) . '
'; $out .= Xml::checkLabel( $this->msg( 'activeusers-hidebots' )->text(), 'hidebots', 'hidebots', $this->opts->getValue( 'hidebots' ), array( 'tabindex' => 2 ) ); - $out .= Xml::checkLabel( $this->msg( 'activeusers-hidesysops' )->text(), - 'hidesysops', 'hidesysops', $this->opts->getValue( 'hidesysops' ), array( 'tabindex' => 3 ) ) . '
'; - - $out .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text(), array( 'tabindex' => 4 ) ) . "\n";# Submit button and form bottom + $out .= Xml::checkLabel( + $this->msg( 'activeusers-hidesysops' )->text(), + 'hidesysops', + 'hidesysops', + $this->opts->getValue( 'hidesysops' ), + array( 'tabindex' => 3 ) + ) . '
'; + + # Submit button and form bottom + $out .= Xml::submitButton( + $this->msg( 'allpagessubmit' )->text(), + array( 'tabindex' => 4 ) + ) . "\n"; $out .= Xml::closeElement( 'fieldset' ); $out .= Xml::closeElement( 'form' ); diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index 716bf80297..007850b28a 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -84,7 +84,8 @@ class SpecialBlock extends FormSpecialPage { $this->getSkin()->setRelevantUser( $this->target ); } - list( $this->previousTarget, /*...*/ ) = Block::parseTarget( $request->getVal( 'wpPreviousTarget' ) ); + list( $this->previousTarget, /*...*/ ) = + Block::parseTarget( $request->getVal( 'wpPreviousTarget' ) ); $this->requestedHideUser = $request->getBool( 'wpHideUser' ); } @@ -361,7 +362,10 @@ class SpecialBlock extends FormSpecialPage { # Link to unblock the specified user, or to a blank unblock form if ( $this->target instanceof User ) { - $message = $this->msg( 'ipb-unblock-addr', wfEscapeWikiText( $this->target->getName() ) )->parse(); + $message = $this->msg( + 'ipb-unblock-addr', + wfEscapeWikiText( $this->target->getName() ) + )->parse(); $list = SpecialPage::getTitleFor( 'Unblock', $this->target->getName() ); } else { $message = $this->msg( 'ipb-unblock' )->parse(); @@ -451,7 +455,7 @@ class SpecialBlock extends FormSpecialPage { /** * Determine the target of the block, and the type of target - * TODO: should be in Block.php? + * @todo Should be in Block.php? * @param string $par subpage parameter passed to setup, or data value from * the HTMLForm * @param WebRequest $request Optionally try and get data from a request too @@ -765,7 +769,11 @@ class SpecialBlock extends FormSpecialPage { # Can't watch a rangeblock if ( $type != Block::TYPE_RANGE && $data['Watch'] ) { - WatchAction::doWatch( Title::makeTitle( NS_USER, $target ), $performer, WatchedItem::IGNORE_USER_RIGHTS ); + WatchAction::doWatch( + Title::makeTitle( NS_USER, $target ), + $performer, + WatchedItem::IGNORE_USER_RIGHTS + ); } # Block constructor sanitizes certain block options on insert diff --git a/includes/specials/SpecialBlockList.php b/includes/specials/SpecialBlockList.php index 4c9a682b84..9170e3eb7a 100644 --- a/includes/specials/SpecialBlockList.php +++ b/includes/specials/SpecialBlockList.php @@ -27,8 +27,9 @@ * @ingroup SpecialPage */ class SpecialBlockList extends SpecialPage { + protected $target; - protected $target, $options; + protected $options; function __construct() { parent::__construct( 'BlockList' ); @@ -203,7 +204,11 @@ class SpecialBlockList extends SpecialPage { foreach ( $otherBlockLink as $link ) { $list .= Html::rawElement( 'li', array(), $link ) . "\n"; } - $out->addHTML( Html::rawElement( 'ul', array( 'class' => 'mw-ipblocklist-otherblocks' ), $list ) . "\n" ); + $out->addHTML( Html::rawElement( + 'ul', + array( 'class' => 'mw-ipblocklist-otherblocks' ), + $list + ) . "\n" ); } } @@ -471,11 +476,15 @@ class HTMLBlockedUsersItemSelect extends HTMLSelectField { } // Let folks pick an explicit limit not from our list, as long as it's a real numbr. - if ( !in_array( $value, $this->mParams['options'] ) && $value == intval( $value ) && $value > 0 ) { + if ( !in_array( $value, $this->mParams['options'] ) + && $value == intval( $value ) + && $value > 0 + ) { // This adds the explicitly requested limit value to the drop-down, // then makes sure it's sorted correctly so when we output the list // later, the custom option doesn't just show up last. - $this->mParams['options'][$this->mParent->getLanguage()->formatNum( $value )] = intval( $value ); + $this->mParams['options'][$this->mParent->getLanguage()->formatNum( $value )] = + intval( $value ); asort( $this->mParams['options'] ); } diff --git a/includes/specials/SpecialBooksources.php b/includes/specials/SpecialBooksources.php index 79636b1eb9..581619fcdc 100644 --- a/includes/specials/SpecialBooksources.php +++ b/includes/specials/SpecialBooksources.php @@ -30,7 +30,6 @@ * @ingroup SpecialPage */ class SpecialBookSources extends SpecialPage { - /** * ISBN passed to the page, if any */ @@ -55,7 +54,10 @@ class SpecialBookSources extends SpecialPage { $this->getOutput()->addHTML( $this->makeForm() ); if ( strlen( $this->isbn ) > 0 ) { if ( !self::isValidISBN( $this->isbn ) ) { - $this->getOutput()->wrapWikiMsg( "
\n$1\n
", 'booksources-invalid-isbn' ); + $this->getOutput()->wrapWikiMsg( + "
\n$1\n
", + 'booksources-invalid-isbn' + ); } $this->showList(); } @@ -118,10 +120,21 @@ class SpecialBookSources extends SpecialPage { global $wgScript; $form = Html::openElement( 'fieldset' ) . "\n"; - $form .= Html::element( 'legend', array(), $this->msg( 'booksources-search-legend' )->text() ) . "\n"; + $form .= Html::element( + 'legend', + array(), + $this->msg( 'booksources-search-legend' )->text() + ) . "\n"; $form .= Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) . "\n"; $form .= Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ) . "\n"; - $form .= '

' . Xml::inputLabel( $this->msg( 'booksources-isbn' )->text(), 'isbn', 'isbn', 20, $this->isbn, array( 'autofocus' => true ) ); + $form .= '

' . Xml::inputLabel( + $this->msg( 'booksources-isbn' )->text(), + 'isbn', + 'isbn', + 20, + $this->isbn, + array( 'autofocus' => true ) + ); $form .= ' ' . Xml::submitButton( $this->msg( 'booksources-go' )->text() ) . "

\n"; $form .= Html::closeElement( 'form' ) . "\n"; $form .= Html::closeElement( 'fieldset' ) . "\n"; diff --git a/includes/specials/SpecialBrokenRedirects.php b/includes/specials/SpecialBrokenRedirects.php index b2ddc2209c..1bbdbeab93 100644 --- a/includes/specials/SpecialBrokenRedirects.php +++ b/includes/specials/SpecialBrokenRedirects.php @@ -28,7 +28,6 @@ * @ingroup SpecialPage */ class BrokenRedirectsPage extends QueryPage { - function __construct( $name = 'BrokenRedirects' ) { parent::__construct( $name ); } @@ -148,7 +147,8 @@ class BrokenRedirectsPage extends QueryPage { ); } - $out .= $this->msg( 'parentheses' )->rawParams( $this->getLanguage()->pipeList( $links ) )->escaped(); + $out .= $this->msg( 'parentheses' )->rawParams( $this->getLanguage() + ->pipeList( $links ) )->escaped(); $out .= " {$arr} {$to}"; return $out; diff --git a/includes/specials/SpecialCachedPage.php b/includes/specials/SpecialCachedPage.php index 7763166ac6..cb9b07cde4 100644 --- a/includes/specials/SpecialCachedPage.php +++ b/includes/specials/SpecialCachedPage.php @@ -38,7 +38,6 @@ * @since 1.20 */ abstract class SpecialCachedPage extends SpecialPage implements ICacheHelper { - /** * CacheHelper object to which we forward the non-SpecialPage specific caching work. * Initialized in startCache. @@ -142,7 +141,11 @@ abstract class SpecialCachedPage extends SpecialPage implements ICacheHelper { * @param string|null $key */ public function addCachedHTML( $computeFunction, $args = array(), $key = null ) { - $this->getOutput()->addHTML( $this->cacheHelper->getCachedValue( $computeFunction, $args, $key ) ); + $this->getOutput()->addHTML( $this->cacheHelper->getCachedValue( + $computeFunction, + $args, + $key + ) ); } /** @@ -158,7 +161,8 @@ abstract class SpecialCachedPage extends SpecialPage implements ICacheHelper { } /** - * Sets the time to live for the cache, in seconds or a unix timestamp indicating the point of expiry. + * Sets the time to live for the cache, in seconds or a unix timestamp + * indicating the point of expiry. * * @since 1.20 * diff --git a/includes/specials/SpecialChangeEmail.php b/includes/specials/SpecialChangeEmail.php index 07a2a86277..c57e33b4bc 100644 --- a/includes/specials/SpecialChangeEmail.php +++ b/includes/specials/SpecialChangeEmail.php @@ -27,7 +27,6 @@ * @ingroup SpecialPage */ class SpecialChangeEmail extends UnlistedSpecialPage { - /** * Users password * @var string @@ -233,13 +232,19 @@ class SpecialChangeEmail extends UnlistedSpecialPage { $throttleCount = LoginForm::incLoginThrottle( $user->getName() ); if ( $throttleCount === true ) { $lang = $this->getLanguage(); - $this->error( array( 'changeemail-throttled', $lang->formatDuration( $wgPasswordAttemptThrottle['seconds'] ) ) ); + $this->error( array( + 'changeemail-throttled', + $lang->formatDuration( $wgPasswordAttemptThrottle['seconds'] ) + ) ); return false; } global $wgRequirePasswordforEmailChange; - if ( $wgRequirePasswordforEmailChange && !$user->checkTemporaryPassword( $pass ) && !$user->checkPassword( $pass ) ) { + if ( $wgRequirePasswordforEmailChange + && !$user->checkTemporaryPassword( $pass ) + && !$user->checkPassword( $pass ) + ) { $this->error( 'wrongpassword' ); return false; diff --git a/includes/specials/SpecialChangePassword.php b/includes/specials/SpecialChangePassword.php index 8afbf4b770..f4ce8823be 100644 --- a/includes/specials/SpecialChangePassword.php +++ b/includes/specials/SpecialChangePassword.php @@ -27,8 +27,8 @@ * @ingroup SpecialPage */ class SpecialChangePassword extends FormSpecialPage { - - protected $mUserName, $mDomain; + protected $mUserName; + protected $mDomain; // Optional Wikitext Message to show above the password change form protected $mPreTextMessage = null; @@ -178,7 +178,6 @@ class SpecialChangePassword extends FormSpecialPage { return false; } - if ( $request->getCheck( 'wpCancel' ) ) { $titleObj = Title::newFromText( $request->getVal( 'returnto' ) ); if ( !$titleObj instanceof Title ) { diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 6a4467c127..0571d0de68 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -1055,7 +1055,8 @@ class ContribsPager extends ReverseChronologicalPager { # Show user names for /newbies as there may be different users. # Note that we already excluded rows with hidden user names. if ( $this->contribs == 'newbie' ) { - $userlink = ' . . ' . $lang->getDirMark() . Linker::userLink( $rev->getUser(), $rev->getUserText() ); + $userlink = ' . . ' . $lang->getDirMark() + . Linker::userLink( $rev->getUser(), $rev->getUserText() ); $userlink .= ' ' . $this->msg( 'parentheses' )->rawParams( Linker::userTalkLink( $rev->getUser(), $rev->getUserText() ) )->escaped() . ' '; } else { diff --git a/includes/specials/SpecialCreateAccount.php b/includes/specials/SpecialCreateAccount.php index d781e6dc70..448637efaf 100644 --- a/includes/specials/SpecialCreateAccount.php +++ b/includes/specials/SpecialCreateAccount.php @@ -29,7 +29,12 @@ */ class SpecialCreateAccount extends SpecialRedirectToSpecial { function __construct() { - parent::__construct( 'CreateAccount', 'Userlogin', 'signup', array( 'returnto', 'returntoquery', 'uselang' ) ); + parent::__construct( + 'CreateAccount', + 'Userlogin', + 'signup', + array( 'returnto', 'returntoquery', 'uselang' ) + ); } // No reason to hide this link on Special:Specialpages -- 2.20.1