From: Siebrand Mazeland Date: Sat, 22 Mar 2014 23:15:34 +0000 (+0100) Subject: Fix CodeSniffer errors and warnings in includes/specials (1) X-Git-Tag: 1.31.0-rc.0~16490^2~1 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=2563d6bcbcf237ef108ea611ae26000d4fe8c8fe;p=lhc%2Fweb%2Fwiklou.git Fix CodeSniffer errors and warnings in includes/specials (1) Change-Id: Iafbd82756b00b1ddd5e38a6603037845238c08fd --- diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index ec7bfa476d..e71d2ad438 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -27,7 +27,6 @@ * @ingroup SpecialPage */ class LoginForm extends SpecialPage { - const SUCCESS = 0; const NO_NAME = 1; const ILLEGAL = 2; @@ -107,10 +106,13 @@ class LoginForm extends SpecialPage { $this->mAction = $request->getVal( 'action' ); $this->mRemember = $request->getCheck( 'wpRemember' ); $this->mFromHTTP = $request->getBool( 'fromhttp', false ); - $this->mStickHTTPS = ( !$this->mFromHTTP && $request->getProtocol() === 'https' ) || $request->getBool( 'wpForceHttps', false ); + $this->mStickHTTPS = ( !$this->mFromHTTP && $request->getProtocol() === 'https' ) + || $request->getBool( 'wpForceHttps', false ); $this->mLanguage = $request->getText( 'uselang' ); $this->mSkipCookieCheck = $request->getCheck( 'wpSkipCookieCheck' ); - $this->mToken = ( $this->mType == 'signup' ) ? $request->getVal( 'wpCreateaccountToken' ) : $request->getVal( 'wpLoginToken' ); + $this->mToken = $this->mType == 'signup' + ? $request->getVal( 'wpCreateaccountToken' ) + : $request->getVal( 'wpLoginToken' ); $this->mReturnTo = $request->getVal( 'returnto', '' ); $this->mReturnToQuery = $request->getVal( 'returntoquery', '' ); @@ -404,7 +406,12 @@ class LoginForm extends SpecialPage { } # Include checks that will include GlobalBlocking (Bug 38333) - $permErrors = $this->getPageTitle()->getUserPermissionsErrors( 'createaccount', $currentUser, true ); + $permErrors = $this->getPageTitle()->getUserPermissionsErrors( + 'createaccount', + $currentUser, + true + ); + if ( count( $permErrors ) ) { throw new PermissionsError( 'createaccount', $permErrors ); } @@ -414,8 +421,9 @@ class LoginForm extends SpecialPage { return Status::newFatal( 'sorbs_create_account_reason' ); } - // Normalize the name so that silly things don't cause "invalid username" errors. - // User::newFromName does some rather strict checking, rejecting e.g. leading/trailing/multiple spaces. + // Normalize the name so that silly things don't cause "invalid username" + // errors. User::newFromName does some rather strict checking, rejecting + // e.g. leading/trailing/multiple spaces. $title = Title::makeTitleSafe( NS_USER, $this->mUsername ); if ( !is_object( $title ) ) { return Status::newFatal( 'noname' ); @@ -487,7 +495,8 @@ class LoginForm extends SpecialPage { // Hook point to check for exempt from account creation throttle if ( !wfRunHooks( 'ExemptFromAccountCreationThrottle', array( $ip ) ) ) { - wfDebug( "LoginForm::exemptFromAccountCreationThrottle: a hook allowed account creation w/o throttle\n" ); + wfDebug( "LoginForm::exemptFromAccountCreationThrottle: a hook " . + "allowed account creation w/o throttle\n" ); } else { if ( ( $wgAccountCreationThrottle && $currentUser->isPingLimitable() ) ) { $key = wfMemcKey( 'acctcreate', 'ip', $ip ); @@ -795,7 +804,7 @@ class LoginForm extends SpecialPage { function processLogin() { global $wgMemc, $wgLang, $wgSecureLogin, $wgPasswordAttemptThrottle, - $wgInvalidPasswordReset; + $wgInvalidPasswordReset; switch ( $this->authenticateUserData() ) { case self::SUCCESS: @@ -939,7 +948,9 @@ class LoginForm extends SpecialPage { * @param string $emailText message name of email text * @return Status object */ - function mailPasswordInternal( $u, $throttle = true, $emailTitle = 'passwordremindertitle', $emailText = 'passwordremindertext' ) { + function mailPasswordInternal( $u, $throttle = true, $emailTitle = 'passwordremindertitle', + $emailText = 'passwordremindertext' + ) { global $wgNewPasswordExpiry; if ( $u->getEmail() == '' ) { diff --git a/includes/specials/SpecialUserlogout.php b/includes/specials/SpecialUserlogout.php index d957e875ce..d65ac85279 100644 --- a/includes/specials/SpecialUserlogout.php +++ b/includes/specials/SpecialUserlogout.php @@ -27,7 +27,6 @@ * @ingroup SpecialPage */ class SpecialUserlogout extends UnlistedSpecialPage { - function __construct() { parent::__construct( 'Userlogout' ); } diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index e0878f1667..2a54ad7db9 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -159,7 +159,9 @@ class UserrightsPage extends SpecialPage { $targetUser->clearInstanceCache(); // bug 38989 } - if ( $request->getVal( 'conflictcheck-originalgroups' ) !== implode( ',', $targetUser->getGroups() ) ) { + if ( $request->getVal( 'conflictcheck-originalgroups' ) + !== implode( ',', $targetUser->getGroups() ) + ) { $out->addWikiMsg( 'userrights-conflict' ); } else { $this->saveUserGroups( @@ -413,10 +415,25 @@ class UserrightsPage extends SpecialPage { function switchForm() { global $wgScript; $this->getOutput()->addHTML( - Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'name' => 'uluser', 'id' => 'mw-userrights-form1' ) ) . + Html::openElement( + 'form', + array( + 'method' => 'get', + 'action' => $wgScript, + 'name' => 'uluser', + 'id' => 'mw-userrights-form1' + ) + ) . Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ) . Xml::fieldset( $this->msg( 'userrights-lookup-user' )->text() ) . - Xml::inputLabel( $this->msg( 'userrights-user-editname' )->text(), 'user', 'username', 30, str_replace( '_', ' ', $this->mTarget ), array( 'autofocus' => true ) ) . ' ' . + Xml::inputLabel( + $this->msg( 'userrights-user-editname' )->text(), + 'user', + 'username', + 30, + str_replace( '_', ' ', $this->mTarget ), + array( 'autofocus' => true ) + ) . ' ' . Xml::submitButton( $this->msg( 'editusergroup' )->text() ) . Html::closeElement( 'fieldset' ) . Html::closeElement( 'form' ) . "\n" @@ -485,9 +502,11 @@ class UserrightsPage extends SpecialPage { $grouplist = $this->msg( 'userrights-groupsmember', $count, $user->getName() )->parse(); $grouplist = '

' . $grouplist . ' ' . $displayedList . "

\n"; } + $count = count( $autoList ); if ( $count > 0 ) { - $autogrouplistintro = $this->msg( 'userrights-groupsmember-auto', $count, $user->getName() )->parse(); + $autogrouplistintro = $this->msg( 'userrights-groupsmember-auto', $count, $user->getName() ) + ->parse(); $grouplist .= '

' . $autogrouplistintro . ' ' . $displayedAutolist . "

\n"; } @@ -499,13 +518,29 @@ class UserrightsPage extends SpecialPage { ); $this->getOutput()->addHTML( - Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getPageTitle()->getLocalURL(), 'name' => 'editGroup', 'id' => 'mw-userrights-form2' ) ) . + Xml::openElement( + 'form', + array( + 'method' => 'post', + 'action' => $this->getPageTitle()->getLocalURL(), + 'name' => 'editGroup', + 'id' => 'mw-userrights-form2' + ) + ) . Html::hidden( 'user', $this->mTarget ) . Html::hidden( 'wpEditToken', $this->getUser()->getEditToken( $this->mTarget ) ) . - Html::hidden( 'conflictcheck-originalgroups', implode( ',', $user->getGroups() ) ) . // Conflict detection + Html::hidden( + 'conflictcheck-originalgroups', + implode( ',', $user->getGroups() ) + ) . // Conflict detection Xml::openElement( 'fieldset' ) . - Xml::element( 'legend', array(), $this->msg( 'userrights-editusergroup', $user->getName() )->text() ) . - $this->msg( 'editinguser' )->params( wfEscapeWikiText( $user->getName() ) )->rawParams( $userToolLinks )->parse() . + Xml::element( + 'legend', + array(), + $this->msg( 'userrights-editusergroup', $user->getName() )->text() + ) . + $this->msg( 'editinguser' )->params( wfEscapeWikiText( $user->getName() ) ) + ->rawParams( $userToolLinks )->parse() . $this->msg( 'userrights-groups-help', $user->getName() )->parse() . $grouplist . Xml::tags( 'p', null, $this->groupCheckboxes( $groups, $user ) ) . @@ -523,7 +558,9 @@ class UserrightsPage extends SpecialPage { " . Xml::submitButton( $this->msg( 'saveusergroups' )->text(), - array( 'name' => 'saveusergroups' ) + Linker::tooltipAndAccesskeyAttribs( 'userrights-set' ) ) . + array( 'name' => 'saveusergroups' ) + + Linker::tooltipAndAccesskeyAttribs( 'userrights-set' ) + ) . " " . Xml::closeElement( 'table' ) . "\n" . @@ -608,8 +645,13 @@ class UserrightsPage extends SpecialPage { continue; } // Messages: userrights-changeable-col, userrights-unchangeable-col - $ret .= Xml::element( 'th', null, $this->msg( 'userrights-' . $name . '-col', count( $column ) )->text() ); + $ret .= Xml::element( + 'th', + null, + $this->msg( 'userrights-' . $name . '-col', count( $column ) )->text() + ); } + $ret .= "\n\n"; foreach ( $columns as $column ) { if ( $column === array() ) { @@ -647,7 +689,10 @@ class UserrightsPage extends SpecialPage { // $this->changeableGroups()['remove'] doesn't work, of course. Thanks, PHP. $groups = $this->changeableGroups(); - return in_array( $group, $groups['remove'] ) || ( $this->isself && in_array( $group, $groups['remove-self'] ) ); + return in_array( + $group, + $groups['remove'] ) || ( $this->isself && in_array( $group, $groups['remove-self'] ) + ); } /** @@ -657,13 +702,21 @@ class UserrightsPage extends SpecialPage { private function canAdd( $group ) { $groups = $this->changeableGroups(); - return in_array( $group, $groups['add'] ) || ( $this->isself && in_array( $group, $groups['add-self'] ) ); + return in_array( + $group, + $groups['add'] ) || ( $this->isself && in_array( $group, $groups['add-self'] ) + ); } /** * Returns $this->getUser()->changeableGroups() * - * @return Array array( 'add' => array( addablegroups ), 'remove' => array( removablegroups ), 'add-self' => array( addablegroups to self ), 'remove-self' => array( removable groups from self ) ) + * @return array array( + * 'add' => array( addablegroups ), + * 'remove' => array( removablegroups ), + * 'add-self' => array( addablegroups to self ), + * 'remove-self' => array( removable groups from self ) + * ) */ function changeableGroups() { return $this->getUser()->changeableGroups(); diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 98b30b7e47..c8add014a6 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -29,7 +29,6 @@ * @ingroup SpecialPage */ class SpecialVersion extends SpecialPage { - protected $firstExtOpened = false; protected static $extensionTypes = false; @@ -142,7 +141,11 @@ class SpecialVersion extends SpecialPage { * @return string */ private static function getMediaWikiCredits() { - $ret = Xml::element( 'h2', array( 'id' => 'mw-version-license' ), wfMessage( 'version-license' )->text() ); + $ret = Xml::element( + 'h2', + array( 'id' => 'mw-version-license' ), + wfMessage( 'version-license' )->text() + ); // This text is always left-to-right. $ret .= '