* over to the tryUISubmit static method of this class.
*/
class Preferences {
- static $defaultPreferences = null;
- 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' ),
+ /** @var array */
+ 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' ),
);
// Stuff that shouldn't be saved as a preference.
'section' => 'personal/info',
);
- $defaultPreferences['userid'] = array(
- 'type' => 'info',
- 'label-message' => array( 'uid', $userName ),
- 'default' => $user->getId(),
- 'section' => 'personal/info',
- );
-
# Get groups to which the user belongs
$userEffectiveGroups = $user->getEffectiveGroups();
$userGroups = $userMembers = array();
* @param array $defaultPreferences
*/
static function searchPreferences( $user, IContextSource $context, &$defaultPreferences ) {
- global $wgContLang;
-
- $defaultPreferences['searcheverything'] = array(
- 'type' => 'toggle',
- 'label-message' => 'searcheverything-enable',
- 'section' => 'searchoptions/advancedsearchoptions',
- );
-
- $nsOptions = $wgContLang->getFormattedNamespaces();
- $nsOptions[0] = $context->msg( 'blanknamespace' )->text();
- foreach ( $nsOptions as $ns => $name ) {
- if ( $ns < 0 ) {
- unset( $nsOptions[$ns] );
- }
+ foreach ( MWNamespace::getValidNamespaces() as $n ) {
+ $defaultPreferences[ 'searchNs' . $n ] = array(
+ 'type' => 'api',
+ );
}
-
- $defaultPreferences['searchnamespaces'] = array(
- 'type' => 'multiselect',
- 'label-message' => 'defaultns',
- 'options' => array_flip( $nsOptions ),
- 'section' => 'searchoptions/advancedsearchoptions',
- 'prefix' => 'searchNs',
- );
}
/**
// Fortunately, the realname field is MUCH simpler
// (not really "private", but still shouldn't be edited without permission)
- if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->isAllowed( 'editmyprivateinfo' ) && array_key_exists( 'realname', $formData ) ) {
+ if ( !in_array( 'realname', $wgHiddenPrefs )
+ && $user->isAllowed( 'editmyprivateinfo' )
+ && array_key_exists( 'realname', $formData )
+ ) {
$realName = $formData['realname'];
$user->setRealName( $realName );
}