if ( self::$defaultPreferences )
return self::$defaultPreferences;
- global $wgRCMaxAge;
-
$defaultPreferences = array();
self::profilePreferences( $user, $defaultPreferences );
}
## Prod in defaults from the user
- global $wgDefaultUserOptions;
foreach ( $defaultPreferences as $name => &$info ) {
$prefFromUser = self::getOptionFromUser( $name, $info, $user );
$field = HTMLForm::loadInputFromParameters( $info ); // For validation
'section' => 'personal/info',
);
}
-
- $defaultPreferences['rememberpassword'] = array(
- 'type' => 'toggle',
- 'label-message' => 'tog-rememberpassword',
- 'section' => 'personal/info',
- );
+ global $wgCookieExpiration;
+ if ( $wgCookieExpiration > 0 ) {
+ $defaultPreferences['rememberpassword'] = array(
+ 'type' => 'toggle',
+ 'label' => wfMsgExt(
+ 'tog-rememberpassword',
+ array( 'parsemag' ),
+ $wgLang->formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) )
+ ),
+ 'section' => 'personal/info',
+ );
+ }
// Language
- global $wgContLanguageCode;
- $languages = array_reverse( Language::getLanguageNames( false ) );
- if ( !array_key_exists( $wgContLanguageCode, $languages ) ) {
- $languages[$wgContLanguageCode] = $wgContLanguageCode;
+ global $wgLanguageCode;
+ $languages = Language::getLanguageNames( false );
+ if ( !array_key_exists( $wgLanguageCode, $languages ) ) {
+ $languages[$wgLanguageCode] = $wgLanguageCode;
}
ksort( $languages );
$defaultPreferences['skin'] = array(
'type' => 'radio',
'options' => self::generateSkinOptions( $user ),
- 'label' => ' ',
+ 'label' => ' ',
'section' => 'rendering/skin',
);
$selectedSkin = $user->getOption( 'skin' );
if ( in_array( $selectedSkin, array( 'cologneblue', 'standard' ) ) ) {
- global $wgLang;
-
$settings = array_flip( $wgLang->getQuickbarSettings() );
$defaultPreferences['quickbar'] = array(
$defaultPreferences['math'] = array(
'type' => 'radio',
'options' => array_flip( array_map( 'wfMsgHtml', $wgLang->getMathNames() ) ),
- 'label' => ' ',
+ 'label' => ' ',
'section' => 'rendering/math',
);
}
$defaultPreferences['date'] = array(
'type' => 'radio',
'options' => $dateOptions,
- 'label' => ' ',
+ 'label' => ' ',
'section' => 'datetime/dateformat',
);
}
);
}
- $stubThresholdValues = array( 0, 50, 100, 500, 1000, 2000, 5000, 10000 );
- $stubThresholdOptions = array();
+ $stubThresholdValues = array( 50, 100, 500, 1000, 2000, 5000, 10000 );
+ $stubThresholdOptions = array( wfMsg( 'stub-threshold-disabled' ) => 0 );
foreach ( $stubThresholdValues as $value ) {
$stubThresholdOptions[wfMsg( 'size-bytes', $value )] = $value;
}
'section' => 'editing/advancedediting',
'label-message' => 'tog-showtoolbar',
);
- $defaultPreferences['minordefault'] = array(
- 'type' => 'toggle',
- 'section' => 'editing/advancedediting',
- 'label-message' => 'tog-minordefault',
- );
if ( $wgUseExternalEditor ) {
$defaultPreferences['externaleditor'] = array(
$defaultPreferences['rcdays'] = array(
'type' => 'float',
'label-message' => 'recentchangesdays',
- 'section' => 'rc/display',
+ 'section' => 'rc/displayrc',
'min' => 1,
'max' => ceil( $wgRCMaxAge / ( 3600 * 24 ) ),
'help' => wfMsgExt(
'type' => 'int',
'label-message' => 'recentchangescount',
'help-message' => 'prefs-help-recentchangescount',
- 'section' => 'rc/display',
+ 'section' => 'rc/displayrc',
);
$defaultPreferences['usenewrc'] = array(
'type' => 'toggle',
'type' => 'float',
'min' => 0,
'max' => 7,
- 'section' => 'watchlist/display',
+ 'section' => 'watchlist/displaywatchlist',
'help' => wfMsgHtml( 'prefs-watchlist-days-max' ),
'label-message' => 'prefs-watchlist-days',
);
'max' => 1000,
'label-message' => 'prefs-watchlist-edits',
'help' => wfMsgHtml( 'prefs-watchlist-edits-max' ),
- 'section' => 'watchlist/display',
+ 'section' => 'watchlist/displaywatchlist',
);
$defaultPreferences['extendwatchlist'] = array(
'type' => 'toggle',
'label-message' => 'tog-watchlisthideliu',
);
+ if ( $wgUseRCPatrol ) {
+ $defaultPreferences['watchlisthidepatrolled'] = array(
+ 'type' => 'toggle',
+ 'section' => 'watchlist/advancedwatchlist',
+ 'label-message' => 'tog-watchlisthidepatrolled',
+ );
+ }
+
if ( $wgEnableAPI ) {
# Some random gibberish as a proposed default
$hash = sha1( mt_rand() . microtime( true ) );
);
}
- if ( $wgUseRCPatrol ) {
- $defaultPreferences['watchlisthidepatrolled'] = array(
- 'type' => 'toggle',
- 'section' => 'watchlist/advancedwatchlist',
- 'label-message' => 'tog-watchlisthidepatrolled',
- );
- }
-
$watchTypes = array(
'edit' => 'watchdefault',
'move' => 'watchmoves',
$defaultPreferences['searchlimit'] = array(
'type' => 'int',
'label-message' => 'resultsperpage',
- 'section' => 'searchoptions/display',
+ 'section' => 'searchoptions/displaysearchoptions',
'min' => 0,
);
$defaultPreferences['contextlines'] = array(
'type' => 'int',
'label-message' => 'contextlines',
- 'section' => 'searchoptions/display',
+ 'section' => 'searchoptions/displaysearchoptions',
'min' => 0,
);
$defaultPreferences['contextchars'] = array(
'type' => 'int',
'label-message' => 'contextchars',
- 'section' => 'searchoptions/display',
+ 'section' => 'searchoptions/displaysearchoptions',
'min' => 0,
);
$defaultPreferences['disablesuggest'] = array(
'type' => 'toggle',
'label-message' => 'mwsuggest-disable',
- 'section' => 'searchoptions/display',
+ 'section' => 'searchoptions/displaysearchoptions',
+ );
+ }
+
+ global $wgVectorUseSimpleSearch;
+ if ( $wgVectorUseSimpleSearch ) {
+ $defaultPreferences['vector-simplesearch'] = array(
+ 'type' => 'toggle',
+ 'label-message' => 'vector-simplesearch-preference',
+ 'section' => 'searchoptions/displaysearchoptions'
);
}
}
/**
- * @param object $user The user object
- * @return array Text/links to display as key; $skinkey as value
+ * @param $user The User object
+ * @return Array: text/links to display as key; $skinkey as value
*/
static function generateSkinOptions( $user ) {
global $wgDefaultSkin, $wgLang, $wgAllowUserCss, $wgAllowUserJs;
$wgDefaultUserOptions['date'] = 'default';
}
- $idCnt = 0;
$epoch = wfTimestampNow();
foreach ( $dateopts as $key ) {
if ( $key == 'default' ) {
return true;
}
- static function getFormObject( $user ) {
+ static function getFormObject( $user, $formClass = 'PreferencesForm' ) {
$formDescriptor = Preferences::getPreferences( $user );
- $htmlForm = new PreferencesForm( $formDescriptor, 'prefs' );
+ $htmlForm = new $formClass( $formDescriptor, 'prefs' );
$htmlForm->setSubmitText( wfMsg( 'saveprefs' ) );
# Used message keys: 'accesskey-preferences-save', 'tooltip-preferences-save'