Remove $wgCopyrightIcon
[lhc/web/wiklou.git] / includes / Preferences.php
index 327d19a..66a8152 100644 (file)
@@ -50,20 +50,20 @@ class Preferences {
        protected static $defaultPreferences = null;
 
        /** @var array */
-       protected static $saveFilters = array(
-               'timecorrection' => array( 'Preferences', 'filterTimezoneInput' ),
-               'cols' => array( 'Preferences', 'filterIntval' ),
-               'rows' => array( 'Preferences', 'filterIntval' ),
-               'rclimit' => array( 'Preferences', 'filterIntval' ),
-               'wllimit' => array( 'Preferences', 'filterIntval' ),
-               'searchlimit' => array( 'Preferences', 'filterIntval' ),
-       );
+       protected static $saveFilters = [
+               'timecorrection' => [ 'Preferences', 'filterTimezoneInput' ],
+               'cols' => [ 'Preferences', 'filterIntval' ],
+               'rows' => [ 'Preferences', 'filterIntval' ],
+               'rclimit' => [ 'Preferences', 'filterIntval' ],
+               'wllimit' => [ 'Preferences', 'filterIntval' ],
+               'searchlimit' => [ 'Preferences', 'filterIntval' ],
+       ];
 
        // Stuff that shouldn't be saved as a preference.
-       private static $saveBlacklist = array(
+       private static $saveBlacklist = [
                'realname',
                'emailaddress',
-       );
+       ];
 
        /**
         * @return array
@@ -83,7 +83,7 @@ class Preferences {
                        return self::$defaultPreferences;
                }
 
-               $defaultPreferences = array();
+               $defaultPreferences = [];
 
                self::profilePreferences( $user, $context, $defaultPreferences );
                self::skinPreferences( $user, $context, $defaultPreferences );
@@ -96,7 +96,7 @@ class Preferences {
                self::searchPreferences( $user, $context, $defaultPreferences );
                self::miscPreferences( $user, $context, $defaultPreferences );
 
-               Hooks::run( 'GetPreferences', array( $user, &$defaultPreferences ) );
+               Hooks::run( 'GetPreferences', [ $user, &$defaultPreferences ] );
 
                self::loadPreferenceValues( $user, $context, $defaultPreferences );
                self::$defaultPreferences = $defaultPreferences;
@@ -120,7 +120,7 @@ class Preferences {
                }
 
                # # Make sure that form fields have their parent set. See bug 41337.
-               $dummyForm = new HTMLForm( array(), $context );
+               $dummyForm = new HTMLForm( [], $context );
 
                $disable = !$user->isAllowed( 'editmyoptions' );
 
@@ -169,7 +169,7 @@ class Preferences {
                                ( isset( $info['class'] ) && $info['class'] == 'HTMLMultiSelectField' ) ) {
                        $options = HTMLFormField::flattenOptions( $info['options'] );
                        $prefix = isset( $info['prefix'] ) ? $info['prefix'] : $name;
-                       $val = array();
+                       $val = [];
 
                        foreach ( $options as $value ) {
                                if ( $user->getOption( "$prefix$value" ) ) {
@@ -184,7 +184,7 @@ class Preferences {
                        $columns = HTMLFormField::flattenOptions( $info['columns'] );
                        $rows = HTMLFormField::flattenOptions( $info['rows'] );
                        $prefix = isset( $info['prefix'] ) ? $info['prefix'] : $name;
-                       $val = array();
+                       $val = [];
 
                        foreach ( $columns as $column ) {
                                foreach ( $rows as $row ) {
@@ -213,16 +213,16 @@ class Preferences {
 
                # # User info #####################################
                // Information panel
-               $defaultPreferences['username'] = array(
+               $defaultPreferences['username'] = [
                        'type' => 'info',
-                       'label-message' => array( 'username', $userName ),
+                       'label-message' => [ 'username', $userName ],
                        'default' => $userName,
                        'section' => 'personal/info',
-               );
+               ];
 
                # Get groups to which the user belongs
                $userEffectiveGroups = $user->getEffectiveGroups();
-               $userGroups = $userMembers = array();
+               $userGroups = $userMembers = [];
                foreach ( $userEffectiveGroups as $ueg ) {
                        if ( $ueg == '*' ) {
                                // Skip the default * group, seems useless here
@@ -239,7 +239,7 @@ class Preferences {
 
                $lang = $context->getLanguage();
 
-               $defaultPreferences['usergroups'] = array(
+               $defaultPreferences['usergroups'] = [
                        'type' => 'info',
                        'label' => $context->msg( 'prefs-memberingroups' )->numParams(
                                count( $userGroups ) )->params( $userName )->parse(),
@@ -248,23 +248,23 @@ class Preferences {
                                ->escaped(),
                        'raw' => true,
                        'section' => 'personal/info',
-               );
+               ];
 
                $editCount = Linker::link( SpecialPage::getTitleFor( "Contributions", $userName ),
                        $lang->formatNum( $user->getEditCount() ) );
 
-               $defaultPreferences['editcount'] = array(
+               $defaultPreferences['editcount'] = [
                        'type' => 'info',
                        'raw' => true,
                        'label-message' => 'prefs-edits',
                        'default' => $editCount,
                        'section' => 'personal/info',
-               );
+               ];
 
                if ( $user->getRegistration() ) {
                        $displayUser = $context->getUser();
                        $userRegistration = $user->getRegistration();
-                       $defaultPreferences['registrationdate'] = array(
+                       $defaultPreferences['registrationdate'] = [
                                'type' => 'info',
                                'label-message' => 'prefs-registration',
                                'default' => $context->msg(
@@ -274,43 +274,43 @@ class Preferences {
                                        $lang->userTime( $userRegistration, $displayUser )
                                )->parse(),
                                'section' => 'personal/info',
-                       );
+                       ];
                }
 
                $canViewPrivateInfo = $user->isAllowed( 'viewmyprivateinfo' );
                $canEditPrivateInfo = $user->isAllowed( 'editmyprivateinfo' );
 
                // Actually changeable stuff
-               $defaultPreferences['realname'] = array(
+               $defaultPreferences['realname'] = [
                        // (not really "private", but still shouldn't be edited without permission)
                        'type' => $canEditPrivateInfo && $wgAuth->allowPropChange( 'realname' ) ? 'text' : 'info',
                        'default' => $user->getRealName(),
                        'section' => 'personal/info',
                        'label-message' => 'yourrealname',
                        'help-message' => 'prefs-help-realname',
-               );
+               ];
 
                if ( $canEditPrivateInfo && $wgAuth->allowPasswordChange() ) {
                        $link = Linker::link( SpecialPage::getTitleFor( 'ChangePassword' ),
-                               $context->msg( 'prefs-resetpass' )->escaped(), array(),
-                               array( 'returnto' => SpecialPage::getTitleFor( 'Preferences' )->getPrefixedText() ) );
+                               $context->msg( 'prefs-resetpass' )->escaped(), [],
+                               [ 'returnto' => SpecialPage::getTitleFor( 'Preferences' )->getPrefixedText() ] );
 
-                       $defaultPreferences['password'] = array(
+                       $defaultPreferences['password'] = [
                                'type' => 'info',
                                'raw' => true,
                                'default' => $link,
                                'label-message' => 'yourpassword',
                                'section' => 'personal/info',
-                       );
+                       ];
                }
                // Only show prefershttps if secure login is turned on
                if ( $config->get( 'SecureLogin' ) && wfCanIPUseHTTPS( $context->getRequest()->getIP() ) ) {
-                       $defaultPreferences['prefershttps'] = array(
+                       $defaultPreferences['prefershttps'] = [
                                'type' => 'toggle',
                                'label-message' => 'tog-prefershttps',
                                'help-message' => 'prefs-help-prefershttps',
                                'section' => 'personal/info'
-                       );
+                       ];
                }
 
                // Language
@@ -321,31 +321,31 @@ class Preferences {
                }
                ksort( $languages );
 
-               $options = array();
+               $options = [];
                foreach ( $languages as $code => $name ) {
                        $display = wfBCP47( $code ) . ' - ' . $name;
                        $options[$display] = $code;
                }
-               $defaultPreferences['language'] = array(
+               $defaultPreferences['language'] = [
                        'type' => 'select',
                        'section' => 'personal/i18n',
                        'options' => $options,
                        'label-message' => 'yourlanguage',
-               );
+               ];
 
-               $defaultPreferences['gender'] = array(
+               $defaultPreferences['gender'] = [
                        'type' => 'radio',
                        'section' => 'personal/i18n',
-                       'options' => array(
+                       'options' => [
                                $context->msg( 'parentheses' )
                                        ->params( $context->msg( 'gender-unknown' )->plain() )
                                        ->escaped() => 'unknown',
                                $context->msg( 'gender-female' )->escaped() => 'female',
                                $context->msg( 'gender-male' )->escaped() => 'male',
-                       ),
+                       ],
                        'label-message' => 'yourgender',
                        'help-message' => 'prefs-help-gender',
-               );
+               ];
 
                // see if there are multiple language variants to choose from
                if ( !$config->get( 'DisableLangConversion' ) ) {
@@ -357,29 +357,29 @@ class Preferences {
                                                continue;
                                        }
 
-                                       $variantArray = array();
+                                       $variantArray = [];
                                        foreach ( $variants as $v ) {
                                                $v = str_replace( '_', '-', strtolower( $v ) );
                                                $variantArray[$v] = $lang->getVariantname( $v, false );
                                        }
 
-                                       $options = array();
+                                       $options = [];
                                        foreach ( $variantArray as $code => $name ) {
                                                $display = wfBCP47( $code ) . ' - ' . $name;
                                                $options[$display] = $code;
                                        }
 
-                                       $defaultPreferences['variant'] = array(
+                                       $defaultPreferences['variant'] = [
                                                'label-message' => 'yourvariant',
                                                'type' => 'select',
                                                'options' => $options,
                                                'section' => 'personal/i18n',
                                                'help-message' => 'prefs-help-variant',
-                                       );
+                                       ];
                                } else {
-                                       $defaultPreferences["variant-$langCode"] = array(
+                                       $defaultPreferences["variant-$langCode"] = [
                                                'type' => 'api',
-                                       );
+                                       ];
                                }
                        }
                }
@@ -389,11 +389,11 @@ class Preferences {
                $toggles = $wgContLang->getExtraUserToggles();
 
                foreach ( $toggles as $toggle ) {
-                       $defaultPreferences[$toggle] = array(
+                       $defaultPreferences[$toggle] = [
                                'type' => 'toggle',
                                'section' => 'personal/i18n',
                                'label-message' => "tog-$toggle",
-                       );
+                       ];
                }
 
                // show a preview of the old signature first
@@ -404,28 +404,28 @@ class Preferences {
                        ParserOptions::newFromContext( $context )
                );
                $oldsigHTML = $context->getOutput()->parseInline( $oldsigWikiText, true, true );
-               $defaultPreferences['oldsig'] = array(
+               $defaultPreferences['oldsig'] = [
                        'type' => 'info',
                        'raw' => true,
                        'label-message' => 'tog-oldsig',
                        'default' => $oldsigHTML,
                        'section' => 'personal/signature',
-               );
-               $defaultPreferences['nickname'] = array(
+               ];
+               $defaultPreferences['nickname'] = [
                        'type' => $wgAuth->allowPropChange( 'nickname' ) ? 'text' : 'info',
                        'maxlength' => $config->get( 'MaxSigChars' ),
                        'label-message' => 'yournick',
-                       'validation-callback' => array( 'Preferences', 'validateSignature' ),
+                       'validation-callback' => [ 'Preferences', 'validateSignature' ],
                        'section' => 'personal/signature',
-                       'filter-callback' => array( 'Preferences', 'cleanSignature' ),
-               );
-               $defaultPreferences['fancysig'] = array(
+                       'filter-callback' => [ 'Preferences', 'cleanSignature' ],
+               ];
+               $defaultPreferences['fancysig'] = [
                        'type' => 'toggle',
                        'label-message' => 'tog-fancysig',
                        // show general help about signature at the bottom of the section
                        'help-message' => 'prefs-help-signature',
                        'section' => 'personal/signature'
-               );
+               ];
 
                # # Email stuff
 
@@ -445,8 +445,8 @@ class Preferences {
                                        $link = Linker::link(
                                                SpecialPage::getTitleFor( 'ChangeEmail' ),
                                                $context->msg( $user->getEmail() ? 'prefs-changeemail' : 'prefs-setemail' )->escaped(),
-                                               array(),
-                                               array( 'returnto' => SpecialPage::getTitleFor( 'Preferences' )->getPrefixedText() ) );
+                                               [],
+                                               [ 'returnto' => SpecialPage::getTitleFor( 'Preferences' )->getPrefixedText() ] );
 
                                        $emailAddress .= $emailAddress == '' ? $link : (
                                                $context->msg( 'word-separator' )->escaped()
@@ -454,7 +454,7 @@ class Preferences {
                                        );
                                }
 
-                               $defaultPreferences['emailaddress'] = array(
+                               $defaultPreferences['emailaddress'] = [
                                        'type' => 'info',
                                        'raw' => true,
                                        'default' => $emailAddress,
@@ -462,7 +462,7 @@ class Preferences {
                                        'section' => 'personal/email',
                                        'help-messages' => $helpMessages,
                                        # 'cssclass' chosen below
-                               );
+                               ];
                        }
 
                        $disableEmailPrefs = false;
@@ -499,7 +499,7 @@ class Preferences {
                                }
 
                                if ( $canViewPrivateInfo ) {
-                                       $defaultPreferences['emailauthentication'] = array(
+                                       $defaultPreferences['emailauthentication'] = [
                                                'type' => 'info',
                                                'raw' => true,
                                                'section' => 'personal/email',
@@ -507,57 +507,57 @@ class Preferences {
                                                'default' => $emailauthenticated,
                                                # Apply the same CSS class used on the input to the message:
                                                'cssclass' => $emailauthenticationclass,
-                                       );
+                                       ];
                                }
                        }
 
                        if ( $config->get( 'EnableUserEmail' ) && $user->isAllowed( 'sendemail' ) ) {
-                               $defaultPreferences['disablemail'] = array(
+                               $defaultPreferences['disablemail'] = [
                                        'type' => 'toggle',
                                        'invert' => true,
                                        'section' => 'personal/email',
                                        'label-message' => 'allowemail',
                                        'disabled' => $disableEmailPrefs,
-                               );
-                               $defaultPreferences['ccmeonemails'] = array(
+                               ];
+                               $defaultPreferences['ccmeonemails'] = [
                                        'type' => 'toggle',
                                        'section' => 'personal/email',
                                        'label-message' => 'tog-ccmeonemails',
                                        'disabled' => $disableEmailPrefs,
-                               );
+                               ];
                        }
 
                        if ( $config->get( 'EnotifWatchlist' ) ) {
-                               $defaultPreferences['enotifwatchlistpages'] = array(
+                               $defaultPreferences['enotifwatchlistpages'] = [
                                        'type' => 'toggle',
                                        'section' => 'personal/email',
                                        'label-message' => 'tog-enotifwatchlistpages',
                                        'disabled' => $disableEmailPrefs,
-                               );
+                               ];
                        }
                        if ( $config->get( 'EnotifUserTalk' ) ) {
-                               $defaultPreferences['enotifusertalkpages'] = array(
+                               $defaultPreferences['enotifusertalkpages'] = [
                                        'type' => 'toggle',
                                        'section' => 'personal/email',
                                        'label-message' => 'tog-enotifusertalkpages',
                                        'disabled' => $disableEmailPrefs,
-                               );
+                               ];
                        }
                        if ( $config->get( 'EnotifUserTalk' ) || $config->get( 'EnotifWatchlist' ) ) {
-                               $defaultPreferences['enotifminoredits'] = array(
+                               $defaultPreferences['enotifminoredits'] = [
                                        'type' => 'toggle',
                                        'section' => 'personal/email',
                                        'label-message' => 'tog-enotifminoredits',
                                        'disabled' => $disableEmailPrefs,
-                               );
+                               ];
 
                                if ( $config->get( 'EnotifRevealEditorAddress' ) ) {
-                                       $defaultPreferences['enotifrevealaddr'] = array(
+                                       $defaultPreferences['enotifrevealaddr'] = [
                                                'type' => 'toggle',
                                                'section' => 'personal/email',
                                                'label-message' => 'tog-enotifrevealaddr',
                                                'disabled' => $disableEmailPrefs,
-                                       );
+                                       ];
                                }
                        }
                }
@@ -575,12 +575,12 @@ class Preferences {
                // Skin selector, if there is at least one valid skin
                $skinOptions = self::generateSkinOptions( $user, $context );
                if ( $skinOptions ) {
-                       $defaultPreferences['skin'] = array(
+                       $defaultPreferences['skin'] = [
                                'type' => 'radio',
                                'options' => $skinOptions,
                                'label' => ' ',
                                'section' => 'rendering/skin',
-                       );
+                       ];
                }
 
                $config = $context->getConfig();
@@ -590,7 +590,7 @@ class Preferences {
                # This code is basically copied from generateSkinOptions().  It'd
                # be nice to somehow merge this back in there to avoid redundancy.
                if ( $allowUserCss || $allowUserJs ) {
-                       $linkTools = array();
+                       $linkTools = [];
                        $userName = $user->getName();
 
                        if ( $allowUserCss ) {
@@ -603,13 +603,13 @@ class Preferences {
                                $linkTools[] = Linker::link( $jsPage, $context->msg( 'prefs-custom-js' )->escaped() );
                        }
 
-                       $defaultPreferences['commoncssjs'] = array(
+                       $defaultPreferences['commoncssjs'] = [
                                'type' => 'info',
                                'raw' => true,
                                'default' => $context->getLanguage()->pipeList( $linkTools ),
                                'label-message' => 'prefs-common-css-js',
                                'section' => 'rendering/skin',
-                       );
+                       ];
                }
        }
 
@@ -620,18 +620,18 @@ class Preferences {
         */
        static function filesPreferences( $user, IContextSource $context, &$defaultPreferences ) {
                # # Files #####################################
-               $defaultPreferences['imagesize'] = array(
+               $defaultPreferences['imagesize'] = [
                        'type' => 'select',
                        'options' => self::getImageSizes( $context ),
                        'label-message' => 'imagemaxsize',
                        'section' => 'rendering/files',
-               );
-               $defaultPreferences['thumbsize'] = array(
+               ];
+               $defaultPreferences['thumbsize'] = [
                        'type' => 'select',
                        'options' => self::getThumbSizes( $context ),
                        'label-message' => 'thumbsize',
                        'section' => 'rendering/files',
-               );
+               ];
        }
 
        /**
@@ -644,38 +644,38 @@ class Preferences {
                # # Date and time #####################################
                $dateOptions = self::getDateOptions( $context );
                if ( $dateOptions ) {
-                       $defaultPreferences['date'] = array(
+                       $defaultPreferences['date'] = [
                                'type' => 'radio',
                                'options' => $dateOptions,
                                'label' => ' ',
                                'section' => 'rendering/dateformat',
-                       );
+                       ];
                }
 
                // Info
                $now = wfTimestampNow();
                $lang = $context->getLanguage();
-               $nowlocal = Xml::element( 'span', array( 'id' => 'wpLocalTime' ),
+               $nowlocal = Xml::element( 'span', [ 'id' => 'wpLocalTime' ],
                        $lang->userTime( $now, $user ) );
                $nowserver = $lang->userTime( $now, $user,
-                               array( 'format' => false, 'timecorrection' => false ) ) .
+                               [ 'format' => false, 'timecorrection' => false ] ) .
                        Html::hidden( 'wpServerTime', (int)substr( $now, 8, 2 ) * 60 + (int)substr( $now, 10, 2 ) );
 
-               $defaultPreferences['nowserver'] = array(
+               $defaultPreferences['nowserver'] = [
                        'type' => 'info',
                        'raw' => 1,
                        'label-message' => 'servertime',
                        'default' => $nowserver,
                        'section' => 'rendering/timeoffset',
-               );
+               ];
 
-               $defaultPreferences['nowlocal'] = array(
+               $defaultPreferences['nowlocal'] = [
                        'type' => 'info',
                        'raw' => 1,
                        'label-message' => 'localtime',
                        'default' => $nowlocal,
                        'section' => 'rendering/timeoffset',
-               );
+               ];
 
                // Grab existing pref.
                $tzOffset = $user->getOption( 'timecorrection' );
@@ -698,14 +698,14 @@ class Preferences {
                        }
                }
 
-               $defaultPreferences['timecorrection'] = array(
+               $defaultPreferences['timecorrection'] = [
                        'class' => 'HTMLSelectOrOtherField',
                        'label-message' => 'timezonelegend',
                        'options' => $tzOptions,
                        'default' => $tzSetting,
                        'size' => 20,
                        'section' => 'rendering/timeoffset',
-               );
+               ];
        }
 
        /**
@@ -715,38 +715,38 @@ class Preferences {
         */
        static function renderingPreferences( $user, IContextSource $context, &$defaultPreferences ) {
                # # Diffs ####################################
-               $defaultPreferences['diffonly'] = array(
+               $defaultPreferences['diffonly'] = [
                        'type' => 'toggle',
                        'section' => 'rendering/diffs',
                        'label-message' => 'tog-diffonly',
-               );
-               $defaultPreferences['norollbackdiff'] = array(
+               ];
+               $defaultPreferences['norollbackdiff'] = [
                        'type' => 'toggle',
                        'section' => 'rendering/diffs',
                        'label-message' => 'tog-norollbackdiff',
-               );
+               ];
 
                # # Page Rendering ##############################
                if ( $context->getConfig()->get( 'AllowUserCssPrefs' ) ) {
-                       $defaultPreferences['underline'] = array(
+                       $defaultPreferences['underline'] = [
                                'type' => 'select',
-                               'options' => array(
+                               'options' => [
                                        $context->msg( 'underline-never' )->text() => 0,
                                        $context->msg( 'underline-always' )->text() => 1,
                                        $context->msg( 'underline-default' )->text() => 2,
-                               ),
+                               ],
                                'label-message' => 'tog-underline',
                                'section' => 'rendering/advancedrendering',
-                       );
+                       ];
                }
 
-               $stubThresholdValues = array( 50, 100, 500, 1000, 2000, 5000, 10000 );
-               $stubThresholdOptions = array( $context->msg( 'stub-threshold-disabled' )->text() => 0 );
+               $stubThresholdValues = [ 50, 100, 500, 1000, 2000, 5000, 10000 ];
+               $stubThresholdOptions = [ $context->msg( 'stub-threshold-disabled' )->text() => 0 ];
                foreach ( $stubThresholdValues as $value ) {
                        $stubThresholdOptions[$context->msg( 'size-bytes', $value )->text()] = $value;
                }
 
-               $defaultPreferences['stubthreshold'] = array(
+               $defaultPreferences['stubthreshold'] = [
                        'type' => 'select',
                        'section' => 'rendering/advancedrendering',
                        'options' => $stubThresholdOptions,
@@ -755,19 +755,19 @@ class Preferences {
                                '<a href="#" class="stub">' .
                                $context->msg( 'stub-threshold-sample-link' )->parse() .
                                '</a>' )->parse(),
-               );
+               ];
 
-               $defaultPreferences['showhiddencats'] = array(
+               $defaultPreferences['showhiddencats'] = [
                        'type' => 'toggle',
                        'section' => 'rendering/advancedrendering',
                        'label-message' => 'tog-showhiddencats'
-               );
+               ];
 
-               $defaultPreferences['numberheadings'] = array(
+               $defaultPreferences['numberheadings'] = [
                        'type' => 'toggle',
                        'section' => 'rendering/advancedrendering',
                        'label-message' => 'tog-numberheadings',
-               );
+               ];
        }
 
        /**
@@ -777,82 +777,82 @@ class Preferences {
         */
        static function editingPreferences( $user, IContextSource $context, &$defaultPreferences ) {
                # # Editing #####################################
-               $defaultPreferences['editsectiononrightclick'] = array(
+               $defaultPreferences['editsectiononrightclick'] = [
                        'type' => 'toggle',
                        'section' => 'editing/advancedediting',
                        'label-message' => 'tog-editsectiononrightclick',
-               );
-               $defaultPreferences['editondblclick'] = array(
+               ];
+               $defaultPreferences['editondblclick'] = [
                        'type' => 'toggle',
                        'section' => 'editing/advancedediting',
                        'label-message' => 'tog-editondblclick',
-               );
+               ];
 
                if ( $context->getConfig()->get( 'AllowUserCssPrefs' ) ) {
-                       $defaultPreferences['editfont'] = array(
+                       $defaultPreferences['editfont'] = [
                                'type' => 'select',
                                'section' => 'editing/editor',
                                'label-message' => 'editfont-style',
-                               'options' => array(
+                               'options' => [
                                        $context->msg( 'editfont-default' )->text() => 'default',
                                        $context->msg( 'editfont-monospace' )->text() => 'monospace',
                                        $context->msg( 'editfont-sansserif' )->text() => 'sans-serif',
                                        $context->msg( 'editfont-serif' )->text() => 'serif',
-                               )
-                       );
+                               ]
+                       ];
                }
-               $defaultPreferences['cols'] = array(
+               $defaultPreferences['cols'] = [
                        'type' => 'int',
                        'label-message' => 'columns',
                        'section' => 'editing/editor',
                        'min' => 4,
                        'max' => 1000,
-               );
-               $defaultPreferences['rows'] = array(
+               ];
+               $defaultPreferences['rows'] = [
                        'type' => 'int',
                        'label-message' => 'rows',
                        'section' => 'editing/editor',
                        'min' => 4,
                        'max' => 1000,
-               );
+               ];
                if ( $user->isAllowed( 'minoredit' ) ) {
-                       $defaultPreferences['minordefault'] = array(
+                       $defaultPreferences['minordefault'] = [
                                'type' => 'toggle',
                                'section' => 'editing/editor',
                                'label-message' => 'tog-minordefault',
-                       );
+                       ];
                }
-               $defaultPreferences['forceeditsummary'] = array(
+               $defaultPreferences['forceeditsummary'] = [
                        'type' => 'toggle',
                        'section' => 'editing/editor',
                        'label-message' => 'tog-forceeditsummary',
-               );
-               $defaultPreferences['useeditwarning'] = array(
+               ];
+               $defaultPreferences['useeditwarning'] = [
                        'type' => 'toggle',
                        'section' => 'editing/editor',
                        'label-message' => 'tog-useeditwarning',
-               );
-               $defaultPreferences['showtoolbar'] = array(
+               ];
+               $defaultPreferences['showtoolbar'] = [
                        'type' => 'toggle',
                        'section' => 'editing/editor',
                        'label-message' => 'tog-showtoolbar',
-               );
+               ];
 
-               $defaultPreferences['previewonfirst'] = array(
+               $defaultPreferences['previewonfirst'] = [
                        'type' => 'toggle',
                        'section' => 'editing/preview',
                        'label-message' => 'tog-previewonfirst',
-               );
-               $defaultPreferences['previewontop'] = array(
+               ];
+               $defaultPreferences['previewontop'] = [
                        'type' => 'toggle',
                        'section' => 'editing/preview',
                        'label-message' => 'tog-previewontop',
-               );
-               $defaultPreferences['uselivepreview'] = array(
+               ];
+               $defaultPreferences['uselivepreview'] = [
                        'type' => 'toggle',
                        'section' => 'editing/preview',
                        'label-message' => 'tog-uselivepreview',
-               );
+               ];
 
        }
 
@@ -865,7 +865,7 @@ class Preferences {
                $config = $context->getConfig();
                $rcMaxAge = $config->get( 'RCMaxAge' );
                # # RecentChanges #####################################
-               $defaultPreferences['rcdays'] = array(
+               $defaultPreferences['rcdays'] = [
                        'type' => 'float',
                        'label-message' => 'recentchangesdays',
                        'section' => 'rc/displayrc',
@@ -873,54 +873,54 @@ class Preferences {
                        'max' => ceil( $rcMaxAge / ( 3600 * 24 ) ),
                        'help' => $context->msg( 'recentchangesdays-max' )->numParams(
                                ceil( $rcMaxAge / ( 3600 * 24 ) ) )->escaped()
-               );
-               $defaultPreferences['rclimit'] = array(
+               ];
+               $defaultPreferences['rclimit'] = [
                        'type' => 'int',
                        'label-message' => 'recentchangescount',
                        'help-message' => 'prefs-help-recentchangescount',
                        'section' => 'rc/displayrc',
-               );
-               $defaultPreferences['usenewrc'] = array(
+               ];
+               $defaultPreferences['usenewrc'] = [
                        'type' => 'toggle',
                        'label-message' => 'tog-usenewrc',
                        'section' => 'rc/advancedrc',
-               );
-               $defaultPreferences['hideminor'] = array(
+               ];
+               $defaultPreferences['hideminor'] = [
                        'type' => 'toggle',
                        'label-message' => 'tog-hideminor',
                        'section' => 'rc/advancedrc',
-               );
+               ];
 
                if ( $config->get( 'RCWatchCategoryMembership' ) ) {
-                       $defaultPreferences['hidecategorization'] = array(
+                       $defaultPreferences['hidecategorization'] = [
                                'type' => 'toggle',
                                'label-message' => 'tog-hidecategorization',
                                'section' => 'rc/advancedrc',
-                       );
+                       ];
                }
 
                if ( $user->useRCPatrol() ) {
-                       $defaultPreferences['hidepatrolled'] = array(
+                       $defaultPreferences['hidepatrolled'] = [
                                'type' => 'toggle',
                                'section' => 'rc/advancedrc',
                                'label-message' => 'tog-hidepatrolled',
-                       );
+                       ];
                }
 
                if ( $user->useNPPatrol() ) {
-                       $defaultPreferences['newpageshidepatrolled'] = array(
+                       $defaultPreferences['newpageshidepatrolled'] = [
                                'type' => 'toggle',
                                'section' => 'rc/advancedrc',
                                'label-message' => 'tog-newpageshidepatrolled',
-                       );
+                       ];
                }
 
                if ( $config->get( 'RCShowWatchingUsers' ) ) {
-                       $defaultPreferences['shownumberswatching'] = array(
+                       $defaultPreferences['shownumberswatching'] = [
                                'type' => 'toggle',
                                'section' => 'rc/advancedrc',
                                'label-message' => 'tog-shownumberswatching',
-                       );
+                       ];
                }
        }
 
@@ -935,12 +935,12 @@ class Preferences {
 
                # # Watchlist #####################################
                if ( $user->isAllowed( 'editmywatchlist' ) ) {
-                       $editWatchlistLinks = array();
-                       $editWatchlistModes = array(
-                               'edit' => array( 'EditWatchlist', false ),
-                               'raw' => array( 'EditWatchlist', 'raw' ),
-                               'clear' => array( 'EditWatchlist', 'clear' ),
-                       );
+                       $editWatchlistLinks = [];
+                       $editWatchlistModes = [
+                               'edit' => [ 'EditWatchlist', false ],
+                               'raw' => [ 'EditWatchlist', 'raw' ],
+                               'clear' => [ 'EditWatchlist', 'clear' ],
+                       ];
                        foreach ( $editWatchlistModes as $editWatchlistMode => $mode ) {
                                // Messages: prefs-editwatchlist-edit, prefs-editwatchlist-raw, prefs-editwatchlist-clear
                                $editWatchlistLinks[] = Linker::linkKnown(
@@ -949,16 +949,16 @@ class Preferences {
                                );
                        }
 
-                       $defaultPreferences['editwatchlist'] = array(
+                       $defaultPreferences['editwatchlist'] = [
                                'type' => 'info',
                                'raw' => true,
                                'default' => $context->getLanguage()->pipeList( $editWatchlistLinks ),
                                'label-message' => 'prefs-editwatchlist-label',
                                'section' => 'watchlist/editwatchlist',
-                       );
+                       ];
                }
 
-               $defaultPreferences['watchlistdays'] = array(
+               $defaultPreferences['watchlistdays'] = [
                        'type' => 'float',
                        'min' => 0,
                        'max' => $watchlistdaysMax,
@@ -966,72 +966,72 @@ class Preferences {
                        'help' => $context->msg( 'prefs-watchlist-days-max' )->numParams(
                                $watchlistdaysMax )->escaped(),
                        'label-message' => 'prefs-watchlist-days',
-               );
-               $defaultPreferences['wllimit'] = array(
+               ];
+               $defaultPreferences['wllimit'] = [
                        'type' => 'int',
                        'min' => 0,
                        'max' => 1000,
                        'label-message' => 'prefs-watchlist-edits',
                        'help' => $context->msg( 'prefs-watchlist-edits-max' )->escaped(),
                        'section' => 'watchlist/displaywatchlist',
-               );
-               $defaultPreferences['extendwatchlist'] = array(
+               ];
+               $defaultPreferences['extendwatchlist'] = [
                        'type' => 'toggle',
                        'section' => 'watchlist/advancedwatchlist',
                        'label-message' => 'tog-extendwatchlist',
-               );
-               $defaultPreferences['watchlisthideminor'] = array(
+               ];
+               $defaultPreferences['watchlisthideminor'] = [
                        'type' => 'toggle',
                        'section' => 'watchlist/advancedwatchlist',
                        'label-message' => 'tog-watchlisthideminor',
-               );
-               $defaultPreferences['watchlisthidebots'] = array(
+               ];
+               $defaultPreferences['watchlisthidebots'] = [
                        'type' => 'toggle',
                        'section' => 'watchlist/advancedwatchlist',
                        'label-message' => 'tog-watchlisthidebots',
-               );
-               $defaultPreferences['watchlisthideown'] = array(
+               ];
+               $defaultPreferences['watchlisthideown'] = [
                        'type' => 'toggle',
                        'section' => 'watchlist/advancedwatchlist',
                        'label-message' => 'tog-watchlisthideown',
-               );
-               $defaultPreferences['watchlisthideanons'] = array(
+               ];
+               $defaultPreferences['watchlisthideanons'] = [
                        'type' => 'toggle',
                        'section' => 'watchlist/advancedwatchlist',
                        'label-message' => 'tog-watchlisthideanons',
-               );
-               $defaultPreferences['watchlisthideliu'] = array(
+               ];
+               $defaultPreferences['watchlisthideliu'] = [
                        'type' => 'toggle',
                        'section' => 'watchlist/advancedwatchlist',
                        'label-message' => 'tog-watchlisthideliu',
-               );
-               $defaultPreferences['watchlistreloadautomatically'] = array(
+               ];
+               $defaultPreferences['watchlistreloadautomatically'] = [
                        'type' => 'toggle',
                        'section' => 'watchlist/advancedwatchlist',
                        'label-message' => 'tog-watchlistreloadautomatically',
-               );
+               ];
 
                if ( $config->get( 'RCWatchCategoryMembership' ) ) {
-                       $defaultPreferences['watchlisthidecategorization'] = array(
+                       $defaultPreferences['watchlisthidecategorization'] = [
                                'type' => 'toggle',
                                'section' => 'watchlist/advancedwatchlist',
                                'label-message' => 'tog-watchlisthidecategorization',
-                       );
+                       ];
                }
 
                if ( $user->useRCPatrol() ) {
-                       $defaultPreferences['watchlisthidepatrolled'] = array(
+                       $defaultPreferences['watchlisthidepatrolled'] = [
                                'type' => 'toggle',
                                'section' => 'watchlist/advancedwatchlist',
                                'label-message' => 'tog-watchlisthidepatrolled',
-                       );
+                       ];
                }
 
-               $watchTypes = array(
+               $watchTypes = [
                        'edit' => 'watchdefault',
                        'move' => 'watchmoves',
                        'delete' => 'watchdeletion'
-               );
+               ];
 
                // Kinda hacky
                if ( $user->isAllowed( 'createpage' ) || $user->isAllowed( 'createtalk' ) ) {
@@ -1047,25 +1047,25 @@ class Preferences {
                                // Messages:
                                // tog-watchdefault, tog-watchmoves, tog-watchdeletion, tog-watchcreations
                                // tog-watchrollback
-                               $defaultPreferences[$pref] = array(
+                               $defaultPreferences[$pref] = [
                                        'type' => 'toggle',
                                        'section' => 'watchlist/advancedwatchlist',
                                        'label-message' => "tog-$pref",
-                               );
+                               ];
                        }
                }
 
                if ( $config->get( 'EnableAPI' ) ) {
-                       $defaultPreferences['watchlisttoken'] = array(
+                       $defaultPreferences['watchlisttoken'] = [
                                'type' => 'api',
-                       );
-                       $defaultPreferences['watchlisttoken-info'] = array(
+                       ];
+                       $defaultPreferences['watchlisttoken-info'] = [
                                'type' => 'info',
                                'section' => 'watchlist/tokenwatchlist',
                                'label-message' => 'prefs-watchlist-token',
                                'default' => $user->getTokenFromOption( 'watchlisttoken' ),
                                'help-message' => 'prefs-help-watchlist-token2',
-                       );
+                       ];
                }
        }
 
@@ -1076,9 +1076,9 @@ class Preferences {
         */
        static function searchPreferences( $user, IContextSource $context, &$defaultPreferences ) {
                foreach ( MWNamespace::getValidNamespaces() as $n ) {
-                       $defaultPreferences['searchNs' . $n] = array(
+                       $defaultPreferences['searchNs' . $n] = [
                                'type' => 'api',
-                       );
+                       ];
                }
        }
 
@@ -1094,7 +1094,7 @@ class Preferences {
         * @return array Text/links to display as key; $skinkey as value
         */
        static function generateSkinOptions( $user, IContextSource $context ) {
-               $ret = array();
+               $ret = [];
 
                $mptitle = Title::newMainPage();
                $previewtext = $context->msg( 'skin-preview' )->escaped();
@@ -1119,7 +1119,7 @@ class Preferences {
 
                $foundDefault = false;
                foreach ( $validSkinNames as $skinkey => $sn ) {
-                       $linkTools = array();
+                       $linkTools = [];
 
                        # Mark the default skin
                        if ( strcasecmp( $skinkey, $defaultSkin ) === 0 ) {
@@ -1128,7 +1128,7 @@ class Preferences {
                        }
 
                        # Create preview link
-                       $mplink = htmlspecialchars( $mptitle->getLocalURL( array( 'useskin' => $skinkey ) ) );
+                       $mplink = htmlspecialchars( $mptitle->getLocalURL( [ 'useskin' => $skinkey ] ) );
                        $linkTools[] = "<a target='_blank' href=\"$mplink\">$previewtext</a>";
 
                        # Create links to user CSS/JS pages
@@ -1151,7 +1151,7 @@ class Preferences {
                if ( !$foundDefault ) {
                        // If the default skin is not available, things are going to break horribly because the
                        // default value for skin selector will not be a valid value. Let's just not show it then.
-                       return array();
+                       return [];
                }
 
                return $ret;
@@ -1165,7 +1165,7 @@ class Preferences {
                $lang = $context->getLanguage();
                $dateopts = $lang->getDatePreferences();
 
-               $ret = array();
+               $ret = [];
 
                if ( $dateopts ) {
                        if ( !in_array( 'default', $dateopts ) ) {
@@ -1197,7 +1197,7 @@ class Preferences {
         * @return array
         */
        static function getImageSizes( IContextSource $context ) {
-               $ret = array();
+               $ret = [];
                $pixels = $context->msg( 'unit-pixel' )->text();
 
                foreach ( $context->getConfig()->get( 'ImageLimits' ) as $index => $limits ) {
@@ -1213,7 +1213,7 @@ class Preferences {
         * @return array
         */
        static function getThumbSizes( IContextSource $context ) {
-               $ret = array();
+               $ret = [];
                $pixels = $context->msg( 'unit-pixel' )->text();
 
                foreach ( $context->getConfig()->get( 'ThumbLimits' ) as $index => $size ) {
@@ -1234,7 +1234,7 @@ class Preferences {
                global $wgParser;
                $maxSigChars = $form->getConfig()->get( 'MaxSigChars' );
                if ( mb_strlen( $signature ) > $maxSigChars ) {
-                       return Xml::element( 'span', array( 'class' => 'error' ),
+                       return Xml::element( 'span', [ 'class' => 'error' ],
                                $form->msg( 'badsiglength' )->numParams( $maxSigChars )->text() );
                } elseif ( isset( $alldata['fancysig'] ) &&
                                $alldata['fancysig'] &&
@@ -1242,7 +1242,7 @@ class Preferences {
                ) {
                        return Xml::element(
                                'span',
-                               array( 'class' => 'error' ),
+                               [ 'class' => 'error' ],
                                $form->msg( 'badsig' )->text()
                        );
                } else {
@@ -1273,13 +1273,13 @@ class Preferences {
         * @param IContextSource $context
         * @param string $formClass
         * @param array $remove Array of items to remove
-        * @return HtmlForm
+        * @return PreferencesForm|HtmlForm
         */
        static function getFormObject(
                $user,
                IContextSource $context,
                $formClass = 'PreferencesForm',
-               array $remove = array()
+               array $remove = []
        ) {
                $formDescriptor = Preferences::getPreferences( $user, $context );
                if ( count( $remove ) ) {
@@ -1301,11 +1301,12 @@ class Preferences {
 
                $htmlForm->setModifiedUser( $user );
                $htmlForm->setId( 'mw-prefs-form' );
+               $htmlForm->setAutocomplete( 'off' );
                $htmlForm->setSubmitText( $context->msg( 'saveprefs' )->text() );
                # Used message keys: 'accesskey-preferences-save', 'tooltip-preferences-save'
                $htmlForm->setSubmitTooltip( 'preferences-save' );
                $htmlForm->setSubmitID( 'prefsubmit' );
-               $htmlForm->setSubmitCallback( array( 'Preferences', 'tryFormSubmit' ) );
+               $htmlForm->setSubmitCallback( [ 'Preferences', 'tryFormSubmit' ] );
 
                return $htmlForm;
        }
@@ -1315,7 +1316,7 @@ class Preferences {
         * @return array
         */
        static function getTimezoneOptions( IContextSource $context ) {
-               $opt = array();
+               $opt = [];
 
                $localTZoffset = $context->getConfig()->get( 'LocalTZoffset' );
                $timeZoneList = self::getTimeZoneList( $context->getLanguage() );
@@ -1347,7 +1348,7 @@ class Preferences {
                foreach ( $timeZoneList as $timeZoneInfo ) {
                        $region = $timeZoneInfo['region'];
                        if ( !isset( $opt[$region] ) ) {
-                               $opt[$region] = array();
+                               $opt[$region] = [];
                        }
                        $opt[$region][$timeZoneInfo['name']] = $timeZoneInfo['timecorrection'];
                }
@@ -1452,7 +1453,7 @@ class Preferences {
                                $user->setOption( $key, $value );
                        }
 
-                       Hooks::run( 'PreferencesFormPreSave', array( $formData, $form, $user, &$result ) );
+                       Hooks::run( 'PreferencesFormPreSave', [ $formData, $form, $user, &$result ] );
                }
 
                $wgAuth->updateExternalDB( $user );
@@ -1470,7 +1471,7 @@ class Preferences {
                $res = self::tryFormSubmit( $formData, $form );
 
                if ( $res ) {
-                       $urlOptions = array( 'success' => 1 );
+                       $urlOptions = [];
 
                        if ( $res === 'eauth' ) {
                                $urlOptions['eauth'] = 1;
@@ -1480,7 +1481,11 @@ class Preferences {
 
                        $url = $form->getTitle()->getFullURL( $urlOptions );
 
-                       $form->getContext()->getOutput()->redirect( $url );
+                       $context = $form->getContext();
+                       // Set session data for the success message
+                       $context->getRequest()->setSessionData( 'specialPreferencesSaveSuccess', 1 );
+
+                       $context->getOutput()->redirect( $url );
                }
 
                return Status::newGood();
@@ -1497,11 +1502,11 @@ class Preferences {
        public static function getTimeZoneList( Language $language ) {
                $identifiers = DateTimeZone::listIdentifiers();
                if ( $identifiers === false ) {
-                       return array();
+                       return [];
                }
                sort( $identifiers );
 
-               $tzRegions = array(
+               $tzRegions = [
                        'Africa' => wfMessage( 'timezoneregion-africa' )->inLanguage( $language )->text(),
                        'America' => wfMessage( 'timezoneregion-america' )->inLanguage( $language )->text(),
                        'Antarctica' => wfMessage( 'timezoneregion-antarctica' )->inLanguage( $language )->text(),
@@ -1512,10 +1517,10 @@ class Preferences {
                        'Europe' => wfMessage( 'timezoneregion-europe' )->inLanguage( $language )->text(),
                        'Indian' => wfMessage( 'timezoneregion-indian' )->inLanguage( $language )->text(),
                        'Pacific' => wfMessage( 'timezoneregion-pacific' )->inLanguage( $language )->text(),
-               );
+               ];
                asort( $tzRegions );
 
-               $timeZoneList = array();
+               $timeZoneList = [];
 
                $now = new DateTime();
 
@@ -1538,11 +1543,11 @@ class Preferences {
                        $display = str_replace( '_', ' ', $parts[0] . '/' . $parts[1] );
                        $value = "ZoneInfo|$minDiff|$identifier";
 
-                       $timeZoneList[$identifier] = array(
+                       $timeZoneList[$identifier] = [
                                'name' => $display,
                                'timecorrection' => $value,
                                'region' => $parts[0],
-                       );
+                       ];
                }
 
                return $timeZoneList;
@@ -1581,7 +1586,7 @@ class PreferencesForm extends HTMLForm {
         * @return array()
         */
        public function getExtraSuccessRedirectParameters() {
-               return array();
+               return [];
        }
 
        /**
@@ -1589,7 +1594,7 @@ class PreferencesForm extends HTMLForm {
         * @return string
         */
        function wrapForm( $html ) {
-               $html = Xml::tags( 'div', array( 'id' => 'preferences' ), $html );
+               $html = Xml::tags( 'div', [ 'id' => 'preferences' ], $html );
 
                return parent::wrapForm( $html );
        }
@@ -1599,7 +1604,7 @@ class PreferencesForm extends HTMLForm {
         */
        function getButtons() {
 
-               $attrs = array( 'id' => 'mw-prefs-restoreprefs' );
+               $attrs = [ 'id' => 'mw-prefs-restoreprefs' ];
 
                if ( !$this->getModifiedUser()->isAllowedAny( 'editmyprivateinfo', 'editmyoptions' ) ) {
                        return '';
@@ -1611,9 +1616,9 @@ class PreferencesForm extends HTMLForm {
                        $t = SpecialPage::getTitleFor( 'Preferences', 'reset' );
 
                        $html .= "\n" . Linker::link( $t, $this->msg( 'restoreprefs' )->escaped(),
-                               Html::buttonAttributes( $attrs, array( 'mw-ui-quiet' ) ) );
+                               Html::buttonAttributes( $attrs, [ 'mw-ui-quiet' ] ) );
 
-                       $html = Xml::tags( 'div', array( 'class' => 'mw-prefs-buttons' ), $html );
+                       $html = Xml::tags( 'div', [ 'class' => 'mw-prefs-buttons' ], $html );
                }
 
                return $html;
@@ -1656,7 +1661,7 @@ class PreferencesForm extends HTMLForm {
         */
        function getLegend( $key ) {
                $legend = parent::getLegend( $key );
-               Hooks::run( 'PreferencesGetLegend', array( $this, $key, &$legend ) );
+               Hooks::run( 'PreferencesGetLegend', [ $this, $key, &$legend ] );
                return $legend;
        }