HTMLForm entity labels are now optional and escaped
[lhc/web/wiklou.git] / includes / Preferences.php
index 56dba05..d1a2344 100644 (file)
@@ -378,7 +378,7 @@ class Preferences {
                                        ? 'prefs-help-email-required'
                                        : 'prefs-help-email';
 
-                       if( $wgEnableUserEmail ) {
+                       if ( $wgEnableUserEmail ) {
                                // additional messages when users can send email to each other
                                $helpMessages[] = 'prefs-help-email-others';
                        }
@@ -432,7 +432,7 @@ class Preferences {
                                                                SpecialPage::getTitleFor( 'Confirmemail' ),
                                                                $context->msg( 'emailconfirmlink' )->escaped()
                                                        ) . '<br />';
-                                               $emailauthenticationclass="mw-email-not-authenticated";
+                                               $emailauthenticationclass = "mw-email-not-authenticated";
                                        }
                                } else {
                                        $disableEmailPrefs = true;
@@ -546,18 +546,6 @@ class Preferences {
                                'section' => 'rendering/skin',
                        );
                }
-
-               $selectedSkin = $user->getOption( 'skin' );
-               if ( in_array( $selectedSkin, array( 'cologneblue', 'standard' ) ) ) {
-                       $settings = array_flip( $context->getLanguage()->getQuickbarSettings() );
-
-                       $defaultPreferences['quickbar'] = array(
-                               'type' => 'radio',
-                               'options' => $settings,
-                               'section' => 'rendering/skin',
-                               'label-message' => 'qbsettings',
-                       );
-               }
        }
 
        /**
@@ -686,7 +674,7 @@ class Preferences {
                        'section' => 'rendering/advancedrendering',
                        'options' => $stubThresholdOptions,
                        'size' => 20,
-                       'label' => $context->msg( 'stub-threshold' )->text(), // Raw HTML message. Yay?
+                       'label-raw' => $context->msg( 'stub-threshold' )->text(), // Raw HTML message. Yay?
                );
 
                if ( $wgAllowUserCssPrefs ) {
@@ -733,7 +721,7 @@ class Preferences {
         * @param $defaultPreferences Array
         */
        static function editingPreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               global $wgUseExternalEditor, $wgAllowUserCssPrefs;
+               global $wgAllowUserCssPrefs;
 
                ## Editing #####################################
                $defaultPreferences['cols'] = array(
@@ -806,19 +794,6 @@ class Preferences {
                        );
                }
 
-               if ( $wgUseExternalEditor ) {
-                       $defaultPreferences['externaleditor'] = array(
-                               'type' => 'toggle',
-                               'section' => 'editing/advancedediting',
-                               'label-message' => 'tog-externaleditor',
-                       );
-                       $defaultPreferences['externaldiff'] = array(
-                               'type' => 'toggle',
-                               'section' => 'editing/advancedediting',
-                               'label-message' => 'tog-externaldiff',
-                       );
-               }
-
                $defaultPreferences['forceeditsummary'] = array(
                        'type' => 'toggle',
                        'section' => 'editing/advancedediting',
@@ -830,6 +805,13 @@ class Preferences {
                        'section' => 'editing/advancedediting',
                        'label-message' => 'tog-uselivepreview',
                );
+
+               $defaultPreferences['useeditwarning'] = array(
+                       'type' => 'toggle',
+                       'section' => 'editing/advancedediting',
+                       'label-message' => 'tog-useeditwarning',
+               );
+
        }
 
        /**
@@ -1030,8 +1012,9 @@ class Preferences {
                $nsOptions = $wgContLang->getFormattedNamespaces();
                $nsOptions[0] = $context->msg( 'blanknamespace' )->text();
                foreach ( $nsOptions as $ns => $name ) {
-                       if ( $ns < 0 )
+                       if ( $ns < 0 ) {
                                unset( $nsOptions[$ns] );
+                       }
                }
 
                $defaultPreferences['searchnamespaces'] = array(
@@ -1278,6 +1261,7 @@ class Preferences {
        }
 
        /**
+        * @param $context IContextSource
         * @return array
         */
        static function getTimezoneOptions( IContextSource $context ) {
@@ -1368,7 +1352,9 @@ class Preferences {
                                        $data[0] = intval( $data[0] );
                                        $data[1] = intval( $data[1] );
                                        $minDiff = abs( $data[0] ) * 60 + $data[1];
-                                       if ( $data[0] < 0 ) $minDiff = - $minDiff;
+                                       if ( $data[0] < 0 ) {
+                                               $minDiff = - $minDiff;
+                                       }
                                } else {
                                        $minDiff = intval( $data[0] ) * 60;
                                }
@@ -1382,6 +1368,8 @@ class Preferences {
        }
 
        /**
+        * Handle the form submission if everything validated properly
+        *
         * @param $formData
         * @param $form PreferencesForm
         * @param $entryPoint string
@@ -1421,7 +1409,7 @@ class Preferences {
                # via $wgHiddenPrefs, we don't want to destroy that setting in case the preference
                # is subsequently re-enabled
                # TODO: maintenance script to actually delete these
-               foreach( $wgHiddenPrefs as $pref ) {
+               foreach ( $wgHiddenPrefs as $pref ) {
                        # If the user has not set a non-default value here, the default will be returned
                        # and subsequently discarded
                        $formData[$pref] = $user->getOption( $pref, null, true );