Merge "Localisation updates from https://translatewiki.net."
[lhc/web/wiklou.git] / includes / Preferences.php
index 33d9333..493626a 100644 (file)
@@ -71,8 +71,8 @@ class Preferences {
 
        /**
         * @throws MWException
-        * @param $user User
-        * @param $context IContextSource
+        * @param User $user
+        * @param IContextSource $context
         * @return array|null
         */
        static function getPreferences( $user, IContextSource $context ) {
@@ -84,8 +84,8 @@ class Preferences {
 
                self::profilePreferences( $user, $context, $defaultPreferences );
                self::skinPreferences( $user, $context, $defaultPreferences );
-               self::filesPreferences( $user, $context, $defaultPreferences );
                self::datetimePreferences( $user, $context, $defaultPreferences );
+               self::filesPreferences( $user, $context, $defaultPreferences );
                self::renderingPreferences( $user, $context, $defaultPreferences );
                self::editingPreferences( $user, $context, $defaultPreferences );
                self::rcPreferences( $user, $context, $defaultPreferences );
@@ -143,10 +143,10 @@ class Preferences {
        /**
         * Pull option from a user account. Handles stuff like array-type preferences.
         *
-        * @param $name
-        * @param $info
-        * @param $user User
-        * @return array|String
+        * @param string $name
+        * @param array $info
+        * @param User $user
+        * @return array|string
         */
        static function getOptionFromUser( $name, $info, $user ) {
                $val = $user->getOption( $name );
@@ -186,9 +186,9 @@ class Preferences {
        }
 
        /**
-        * @param $user User
-        * @param $context IContextSource
-        * @param $defaultPreferences
+        * @param User $user
+        * @param IContextSource $context
+        * @param array $defaultPreferences
         * @return void
         */
        static function profilePreferences( $user, IContextSource $context, &$defaultPreferences ) {
@@ -301,14 +301,6 @@ class Preferences {
                                'section' => 'personal/info',
                        );
                }
-               if ( $wgCookieExpiration > 0 ) {
-                       $defaultPreferences['rememberpassword'] = array(
-                               'type' => 'toggle',
-                               'label' => $context->msg( 'tog-rememberpassword' )->numParams(
-                                       ceil( $wgCookieExpiration / ( 3600 * 24 ) ) )->text(),
-                               'section' => 'personal/info',
-                       );
-               }
                // Only show prefershttps if secure login is turned on
                if ( $wgSecureLogin && wfCanIPUseHTTPS( $context->getRequest()->getIP() ) ) {
                        $defaultPreferences['prefershttps'] = array(
@@ -570,9 +562,9 @@ class Preferences {
        }
 
        /**
-        * @param $user User
-        * @param $context IContextSource
-        * @param $defaultPreferences
+        * @param User $user
+        * @param IContextSource $context
+        * @param array $defaultPreferences
         * @return void
         */
        static function skinPreferences( $user, IContextSource $context, &$defaultPreferences ) {
@@ -614,9 +606,9 @@ class Preferences {
        }
 
        /**
-        * @param $user User
-        * @param $context IContextSource
-        * @param $defaultPreferences Array
+        * @param User $user
+        * @param IContextSource $context
+        * @param array $defaultPreferences
         */
        static function filesPreferences( $user, IContextSource $context, &$defaultPreferences ) {
                ## Files #####################################
@@ -635,9 +627,9 @@ class Preferences {
        }
 
        /**
-        * @param $user User
-        * @param $context IContextSource
-        * @param $defaultPreferences
+        * @param User $user
+        * @param IContextSource $context
+        * @param array $defaultPreferences
         * @return void
         */
        static function datetimePreferences( $user, IContextSource $context, &$defaultPreferences ) {
@@ -648,7 +640,7 @@ class Preferences {
                                'type' => 'radio',
                                'options' => $dateOptions,
                                'label' => ' ',
-                               'section' => 'datetime/dateformat',
+                               'section' => 'rendering/dateformat',
                        );
                }
 
@@ -665,7 +657,7 @@ class Preferences {
                        'raw' => 1,
                        'label-message' => 'servertime',
                        'default' => $nowserver,
-                       'section' => 'datetime/timeoffset',
+                       'section' => 'rendering/timeoffset',
                );
 
                $defaultPreferences['nowlocal'] = array(
@@ -673,7 +665,7 @@ class Preferences {
                        'raw' => 1,
                        'label-message' => 'localtime',
                        'default' => $nowlocal,
-                       'section' => 'datetime/timeoffset',
+                       'section' => 'rendering/timeoffset',
                );
 
                // Grab existing pref.
@@ -703,14 +695,14 @@ class Preferences {
                        'options' => $tzOptions,
                        'default' => $tzSetting,
                        'size' => 20,
-                       'section' => 'datetime/timeoffset',
+                       'section' => 'rendering/timeoffset',
                );
        }
 
        /**
-        * @param $user User
-        * @param $context IContextSource
-        * @param $defaultPreferences Array
+        * @param User $user
+        * @param IContextSource $context
+        * @param array $defaultPreferences
         */
        static function renderingPreferences( $user, IContextSource $context, &$defaultPreferences ) {
                ## Diffs ####################################
@@ -768,9 +760,9 @@ class Preferences {
        }
 
        /**
-        * @param $user User
-        * @param $context IContextSource
-        * @param $defaultPreferences Array
+        * @param User $user
+        * @param IContextSource $context
+        * @param array $defaultPreferences
         */
        static function editingPreferences( $user, IContextSource $context, &$defaultPreferences ) {
                global $wgAllowUserCssPrefs;
@@ -856,9 +848,9 @@ class Preferences {
        }
 
        /**
-        * @param $user User
-        * @param $context IContextSource
-        * @param $defaultPreferences Array
+        * @param User $user
+        * @param IContextSource $context
+        * @param array $defaultPreferences
         */
        static function rcPreferences( $user, IContextSource $context, &$defaultPreferences ) {
                global $wgRCMaxAge, $wgRCShowWatchingUsers;
@@ -913,9 +905,9 @@ class Preferences {
        }
 
        /**
-        * @param $user User
-        * @param $context IContextSource
-        * @param $defaultPreferences
+        * @param User $user
+        * @param IContextSource $context
+        * @param array $defaultPreferences
         */
        static function watchlistPreferences( $user, IContextSource $context, &$defaultPreferences ) {
                global $wgUseRCPatrol, $wgEnableAPI, $wgRCMaxAge;
@@ -1017,9 +1009,9 @@ class Preferences {
        }
 
        /**
-        * @param $user User
-        * @param $context IContextSource
-        * @param $defaultPreferences Array
+        * @param User $user
+        * @param IContextSource $context
+        * @param array $defaultPreferences
         */
        static function searchPreferences( $user, IContextSource $context, &$defaultPreferences ) {
                global $wgContLang;
@@ -1054,9 +1046,9 @@ class Preferences {
        }
 
        /**
-        * @param $user User The User object
-        * @param $context IContextSource
-        * @return Array: text/links to display as key; $skinkey as value
+        * @param User $user The User object
+        * @param IContextSource $context
+        * @return array Text/links to display as key; $skinkey as value
         */
        static function generateSkinOptions( $user, IContextSource $context ) {
                global $wgDefaultSkin, $wgAllowUserCss, $wgAllowUserJs;
@@ -1065,9 +1057,8 @@ class Preferences {
                $mptitle = Title::newMainPage();
                $previewtext = $context->msg( 'skin-preview' )->text();
 
-               # Only show members of Skin::getSkinNames() rather than
-               # $skinNames (skins is all skin names from Language.php)
-               $validSkinNames = Skin::getUsableSkins();
+               # Only show skins that aren't disabled in $wgSkipSkins
+               $validSkinNames = Skin::getAllowedSkins();
 
                # Sort by UI skin name. First though need to update validSkinNames as sometimes
                # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
@@ -1113,7 +1104,7 @@ class Preferences {
        }
 
        /**
-        * @param $context IContextSource
+        * @param IContextSource $context
         * @return array
         */
        static function getDateOptions( IContextSource $context ) {
@@ -1148,7 +1139,7 @@ class Preferences {
        }
 
        /**
-        * @param $context IContextSource
+        * @param IContextSource $context
         * @return array
         */
        static function getImageSizes( IContextSource $context ) {
@@ -1166,7 +1157,7 @@ class Preferences {
        }
 
        /**
-        * @param $context IContextSource
+        * @param IContextSource $context
         * @return array
         */
        static function getThumbSizes( IContextSource $context ) {
@@ -1184,9 +1175,9 @@ class Preferences {
        }
 
        /**
-        * @param $signature string
-        * @param $alldata array
-        * @param $form HTMLForm
+        * @param string $signature
+        * @param array $alldata
+        * @param HTMLForm $form
         * @return bool|string
         */
        static function validateSignature( $signature, $alldata, $form ) {
@@ -1209,9 +1200,9 @@ class Preferences {
        }
 
        /**
-        * @param $signature string
-        * @param $alldata array
-        * @param $form HTMLForm
+        * @param string $signature
+        * @param array $alldata
+        * @param HTMLForm $form
         * @return string
         */
        static function cleanSignature( $signature, $alldata, $form ) {
@@ -1227,10 +1218,10 @@ class Preferences {
        }
 
        /**
-        * @param $user User
-        * @param $context IContextSource
-        * @param $formClass string
-        * @param array $remove array of items to remove
+        * @param User $user
+        * @param IContextSource $context
+        * @param string $formClass
+        * @param array $remove Array of items to remove
         * @return HtmlForm
         */
        static function getFormObject(
@@ -1269,7 +1260,7 @@ class Preferences {
        }
 
        /**
-        * @param $context IContextSource
+        * @param IContextSource $context
         * @return array
         */
        static function getTimezoneOptions( IContextSource $context ) {
@@ -1343,8 +1334,8 @@ class Preferences {
        }
 
        /**
-        * @param $value
-        * @param $alldata
+        * @param string $value
+        * @param array $alldata
         * @return int
         */
        static function filterIntval( $value, $alldata ) {
@@ -1352,8 +1343,8 @@ class Preferences {
        }
 
        /**
-        * @param $tz
-        * @param $alldata
+        * @param string $tz
+        * @param array $alldata
         * @return string
         */
        static function filterTimezoneInput( $tz, $alldata ) {
@@ -1386,8 +1377,8 @@ class Preferences {
        /**
         * Handle the form submission if everything validated properly
         *
-        * @param $formData
-        * @param $form PreferencesForm
+        * @param array $formData
+        * @param PreferencesForm $form
         * @return bool|Status|string
         */
        static function tryFormSubmit( $formData, $form ) {
@@ -1446,8 +1437,8 @@ class Preferences {
        }
 
        /**
-        * @param $formData
-        * @param $form PreferencesForm
+        * @param array $formData
+        * @param PreferencesForm $form
         * @return Status
         */
        public static function tryUISubmit( $formData, $form ) {
@@ -1476,10 +1467,10 @@ class Preferences {
         * Caller is responsible for checking $wgAuth and 'editmyprivateinfo'
         * right.
         *
-        * @deprecated in 1.20; use User::setEmailWithConfirmation() instead.
-        * @param $user User
+        * @deprecated since 1.20; use User::setEmailWithConfirmation() instead.
+        * @param User $user
         * @param string $newaddr New email address
-        * @return Array (true on success or Status on failure, info string)
+        * @return array (true on success or Status on failure, info string)
         */
        public static function trySetUserEmail( User $user, $newaddr ) {
                wfDeprecated( __METHOD__, '1.20' );
@@ -1493,8 +1484,8 @@ class Preferences {
        }
 
        /**
-        * @deprecated in 1.19
-        * @param $user User
+        * @deprecated since 1.19
+        * @param User $user
         * @return array
         */
        public static function loadOldSearchNs( $user ) {
@@ -1522,7 +1513,7 @@ class PreferencesForm extends HTMLForm {
        private $modifiedUser;
 
        /**
-        * @param $user User
+        * @param User $user
         */
        public function setModifiedUser( $user ) {
                $this->modifiedUser = $user;
@@ -1550,8 +1541,8 @@ class PreferencesForm extends HTMLForm {
        }
 
        /**
-        * @param $html string
-        * @return String
+        * @param string $html
+        * @return string
         */
        function wrapForm( $html ) {
                $html = Xml::tags( 'div', array( 'id' => 'preferences' ), $html );
@@ -1560,7 +1551,7 @@ class PreferencesForm extends HTMLForm {
        }
 
        /**
-        * @return String
+        * @return string
         */
        function getButtons() {
                if ( !$this->getModifiedUser()->isAllowedAny( 'editmyprivateinfo', 'editmyoptions' ) ) {
@@ -1583,7 +1574,7 @@ class PreferencesForm extends HTMLForm {
        /**
         * Separate multi-option preferences into multiple preferences, since we
         * have to store them separately
-        * @param $data array
+        * @param array $data
         * @return array
         */
        function filterDataForSubmit( $data ) {
@@ -1612,7 +1603,7 @@ class PreferencesForm extends HTMLForm {
        /**
         * Get the "<legend>" for a given section key. Normally this is the
         * prefs-$key message but we'll allow extensions to override it.
-        * @param $key string
+        * @param string $key
         * @return string
         */
        function getLegend( $key ) {