Many more function case mismatches
[lhc/web/wiklou.git] / includes / specials / SpecialUserrights.php
index 205b67e..740f2f7 100644 (file)
@@ -119,7 +119,7 @@ class UserrightsPage extends SpecialPage {
                }
 
                $fetchedStatus = $this->fetchUser( $this->mTarget );
-               if ( $fetchedStatus->isOk() ) {
+               if ( $fetchedStatus->isOK() ) {
                        $this->mFetchedUser = $fetchedStatus->value;
                        if ( $this->mFetchedUser instanceof User ) {
                                // Set the 'relevant user' in the skin, so it displays links like Contributions,
@@ -142,14 +142,14 @@ class UserrightsPage extends SpecialPage {
 
                        // @todo FIXME: There may be intermediate groups we can mention.
                        $msg = $user->isAnon() ? 'userrights-nologin' : 'userrights-notallowed';
-                       throw new PermissionsError( null, array( array( $msg ) ) );
+                       throw new PermissionsError( null, [ [ $msg ] ] );
                }
 
                // show a successbox, if the user rights was saved successfully
                if ( $request->getCheck( 'success' ) && $this->mFetchedUser !== null ) {
                        $out->wrapWikiMsg(
                                "<div class=\"successbox\">\n$1\n</div>",
-                               array( 'savedrights', $this->mFetchedUser->getName() )
+                               [ 'savedrights', $this->mFetchedUser->getName() ]
                        );
                }
 
@@ -208,7 +208,7 @@ class UserrightsPage extends SpecialPage {
        }
 
        function getSuccessURL() {
-               return $this->getPageTitle( $this->mTarget )->getFullURL( array( 'success' => 1 ) );
+               return $this->getPageTitle( $this->mTarget )->getFullURL( [ 'success' => 1 ] );
        }
 
        /**
@@ -222,8 +222,8 @@ class UserrightsPage extends SpecialPage {
         */
        function saveUserGroups( $username, $reason, $user ) {
                $allgroups = $this->getAllGroups();
-               $addgroup = array();
-               $removegroup = array();
+               $addgroup = [];
+               $removegroup = [];
 
                // This could possibly create a highly unlikely race condition if permissions are changed between
                //  when the form is loaded and when the form is saved. Ignoring it for the moment.
@@ -256,8 +256,8 @@ class UserrightsPage extends SpecialPage {
                $isself = $user->getName() == $this->getUser()->getName();
                $groups = $user->getGroups();
                $changeable = $this->changeableGroups();
-               $addable = array_merge( $changeable['add'], $isself ? $changeable['add-self'] : array() );
-               $removable = array_merge( $changeable['remove'], $isself ? $changeable['remove-self'] : array() );
+               $addable = array_merge( $changeable['add'], $isself ? $changeable['add-self'] : [] );
+               $removable = array_merge( $changeable['remove'], $isself ? $changeable['remove-self'] : [] );
 
                $remove = array_unique(
                        array_intersect( (array)$remove, $removable, $groups ) );
@@ -292,19 +292,19 @@ class UserrightsPage extends SpecialPage {
                $user->invalidateCache();
 
                // update groups in external authentication database
-               Hooks::run( 'UserGroupsChanged', array( $user, $add, $remove, $this->getUser(), $reason ) );
+               Hooks::run( 'UserGroupsChanged', [ $user, $add, $remove, $this->getUser(), $reason ] );
                $wgAuth->updateExternalDBGroups( $user, $add, $remove );
 
                wfDebug( 'oldGroups: ' . print_r( $oldGroups, true ) . "\n" );
                wfDebug( 'newGroups: ' . print_r( $newGroups, true ) . "\n" );
                // Deprecated in favor of UserGroupsChanged hook
-               Hooks::run( 'UserRights', array( &$user, $add, $remove ), '1.26' );
+               Hooks::run( 'UserRights', [ &$user, $add, $remove ], '1.26' );
 
                if ( $newGroups != $oldGroups ) {
                        $this->addLogEntry( $user, $oldGroups, $newGroups, $reason );
                }
 
-               return array( $add, $remove );
+               return [ $add, $remove ];
        }
 
        /**
@@ -319,10 +319,10 @@ class UserrightsPage extends SpecialPage {
                $logEntry->setPerformer( $this->getUser() );
                $logEntry->setTarget( $user->getUserPage() );
                $logEntry->setComment( $reason );
-               $logEntry->setParameters( array(
+               $logEntry->setParameters( [
                        '4::oldgroups' => $oldGroups,
                        '5::newgroups' => $newGroups,
-               ) );
+               ] );
                $logid = $logEntry->insert();
                $logEntry->publish( $logid );
        }
@@ -451,12 +451,12 @@ class UserrightsPage extends SpecialPage {
                $this->getOutput()->addHTML(
                        Html::openElement(
                                'form',
-                               array(
+                               [
                                        'method' => 'get',
                                        'action' => wfScript(),
                                        'name' => 'uluser',
                                        'id' => 'mw-userrights-form1'
-                               )
+                               ]
                        ) .
                        Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ) .
                        Xml::fieldset( $this->msg( 'userrights-lookup-user' )->text() ) .
@@ -466,11 +466,11 @@ class UserrightsPage extends SpecialPage {
                                'username',
                                30,
                                str_replace( '_', ' ', $this->mTarget ),
-                               array(
+                               [
                                        'class' => 'mw-autocomplete-user', // used by mediawiki.userSuggest
-                               ) + (
+                               ] + (
                                        // Set autofocus on blank input and error input
-                                       $this->mFetchedUser === null ? array( 'autofocus' => '' ) : array()
+                                       $this->mFetchedUser === null ? [ 'autofocus' => '' ] : []
                                )
                        ) . ' ' .
                        Xml::submitButton(
@@ -496,15 +496,15 @@ class UserrightsPage extends SpecialPage {
                list( $addable, $removable, $addself, $removeself ) = array_values( $this->changeableGroups() );
 
                $removable = array_intersect(
-                       array_merge( $this->isself ? $removeself : array(), $removable ),
+                       array_merge( $this->isself ? $removeself : [], $removable ),
                        $groups
                ); // Can't remove groups the user doesn't have
                $addable = array_diff(
-                       array_merge( $this->isself ? $addself : array(), $addable ),
+                       array_merge( $this->isself ? $addself : [], $addable ),
                        $groups
                ); // Can't add groups the user does have
 
-               return array( $addable, $removable );
+               return [ $addable, $removable ];
        }
 
        /**
@@ -514,15 +514,15 @@ class UserrightsPage extends SpecialPage {
         * @param array $groups Array of groups the user is in
         */
        protected function showEditUserGroupsForm( $user, $groups ) {
-               $list = array();
-               $membersList = array();
+               $list = [];
+               $membersList = [];
                foreach ( $groups as $group ) {
                        $list[] = self::buildGroupLink( $group );
                        $membersList[] = self::buildGroupMemberLink( $group );
                }
 
-               $autoList = array();
-               $autoMembersList = array();
+               $autoList = [];
+               $autoMembersList = [];
                if ( $user instanceof User ) {
                        foreach ( Autopromote::getAutopromoteGroups( $user ) as $group ) {
                                $autoList[] = self::buildGroupLink( $group );
@@ -571,12 +571,12 @@ class UserrightsPage extends SpecialPage {
                $this->getOutput()->addHTML(
                        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 ) ) .
@@ -587,7 +587,7 @@ class UserrightsPage extends SpecialPage {
                        Xml::openElement( 'fieldset' ) .
                        Xml::element(
                                'legend',
-                               array(),
+                               [],
                                $this->msg( 'userrights-editusergroup', $user->getName() )->text()
                        ) .
                        $this->msg( 'editinguser' )->params( wfEscapeWikiText( $user->getName() ) )
@@ -595,21 +595,21 @@ class UserrightsPage extends SpecialPage {
                        $this->msg( 'userrights-groups-help', $user->getName() )->parse() .
                        $grouplist .
                        $this->groupCheckboxes( $groups, $user ) .
-                       Xml::openElement( 'table', array( 'id' => 'mw-userrights-table-outer' ) ) .
+                       Xml::openElement( 'table', [ 'id' => 'mw-userrights-table-outer' ] ) .
                                "<tr>
                                        <td class='mw-label'>" .
                                                Xml::label( $this->msg( 'userrights-reason' )->text(), 'wpReason' ) .
                                        "</td>
                                        <td class='mw-input'>" .
                                                Xml::input( 'user-reason', 60, $this->getRequest()->getVal( 'user-reason', false ),
-                                                       array( 'id' => 'wpReason', 'maxlength' => 255 ) ) .
+                                                       [ 'id' => 'wpReason', 'maxlength' => 255 ] ) .
                                        "</td>
                                </tr>
                                <tr>
                                        <td></td>
                                        <td class='mw-submit'>" .
                                                Xml::submitButton( $this->msg( 'saveusergroups', $user->getName() )->text(),
-                                                       array( 'name' => 'saveusergroups' ) +
+                                                       [ 'name' => 'saveusergroups' ] +
                                                                Linker::tooltipAndAccesskeyAttribs( 'userrights-set' )
                                                ) .
                                        "</td>
@@ -627,7 +627,7 @@ class UserrightsPage extends SpecialPage {
         * @return string
         */
        private static function buildGroupLink( $group ) {
-               return User::makeGroupLinkHtml( $group, User::getGroupName( $group ) );
+               return User::makeGroupLinkHTML( $group, User::getGroupName( $group ) );
        }
 
        /**
@@ -637,7 +637,7 @@ class UserrightsPage extends SpecialPage {
         * @return string
         */
        private static function buildGroupMemberLink( $group ) {
-               return User::makeGroupLinkHtml( $group, User::getGroupMember( $group ) );
+               return User::makeGroupLinkHTML( $group, User::getGroupMember( $group ) );
        }
 
        /**
@@ -662,7 +662,7 @@ class UserrightsPage extends SpecialPage {
 
                // Put all column info into an associative array so that extensions can
                // more easily manage it.
-               $columns = array( 'unchangeable' => array(), 'changeable' => array() );
+               $columns = [ 'unchangeable' => [], 'changeable' => [] ];
 
                foreach ( $allgroups as $group ) {
                        $set = in_array( $group, $usergroups );
@@ -675,11 +675,11 @@ class UserrightsPage extends SpecialPage {
                                ( $set && !$this->canAdd( $group ) ) ||
                                ( !$set && !$this->canRemove( $group ) ) );
 
-                       $checkbox = array(
+                       $checkbox = [
                                'set' => $set,
                                'disabled' => $disabled,
                                'irreversible' => $irreversible
-                       );
+                       ];
 
                        if ( $disabled ) {
                                $columns['unchangeable'][$group] = $checkbox;
@@ -689,10 +689,10 @@ class UserrightsPage extends SpecialPage {
                }
 
                // Build the HTML table
-               $ret .= Xml::openElement( 'table', array( 'class' => 'mw-userrights-groups' ) ) .
+               $ret .= Xml::openElement( 'table', [ 'class' => 'mw-userrights-groups' ] ) .
                        "<tr>\n";
                foreach ( $columns as $name => $column ) {
-                       if ( $column === array() ) {
+                       if ( $column === [] ) {
                                continue;
                        }
                        // Messages: userrights-changeable-col, userrights-unchangeable-col
@@ -705,12 +705,12 @@ class UserrightsPage extends SpecialPage {
 
                $ret .= "</tr>\n<tr>\n";
                foreach ( $columns as $column ) {
-                       if ( $column === array() ) {
+                       if ( $column === [] ) {
                                continue;
                        }
                        $ret .= "\t<td style='vertical-align:top;'>\n";
                        foreach ( $column as $group => $checkbox ) {
-                               $attr = $checkbox['disabled'] ? array( 'disabled' => 'disabled' ) : array();
+                               $attr = $checkbox['disabled'] ? [ 'disabled' => 'disabled' ] : [];
 
                                $member = User::getGroupMember( $group, $user->getName() );
                                if ( $checkbox['irreversible'] ) {
@@ -721,7 +721,7 @@ class UserrightsPage extends SpecialPage {
                                $checkboxHtml = Xml::checkLabel( $text, "wpGroup-" . $group,
                                        "wpGroup-" . $group, $checkbox['set'], $attr );
                                $ret .= "\t\t" . ( $checkbox['disabled']
-                                       ? Xml::tags( 'span', array( 'class' => 'mw-userrights-disabled' ), $checkboxHtml )
+                                       ? Xml::tags( 'span', [ 'class' => 'mw-userrights-disabled' ], $checkboxHtml )
                                        : $checkboxHtml
                                ) . "<br />\n";
                        }
@@ -797,7 +797,7 @@ class UserrightsPage extends SpecialPage {
                $user = User::newFromName( $search );
                if ( !$user ) {
                        // No prefix suggestion for invalid user
-                       return array();
+                       return [];
                }
                // Autocomplete subpage as user list - public to allow caching
                return UserNamePrefixSearch::search( 'public', $search, $limit, $offset );