BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
Preferences Class Reference

Static Public Member Functions

static getSaveBlacklist ()
 
static getPreferences ($user, IContextSource $context)
 
static loadPreferenceValues ($user, $context, &$defaultPreferences)
 
static getOptionFromUser ($name, $info, $user)
 
static profilePreferences ($user, IContextSource $context, &$defaultPreferences)
 
static skinPreferences ($user, IContextSource $context, &$defaultPreferences)
 
static filesPreferences ($user, IContextSource $context, &$defaultPreferences)
 
static datetimePreferences ($user, IContextSource $context, &$defaultPreferences)
 
static renderingPreferences ($user, IContextSource $context, &$defaultPreferences)
 
static editingPreferences ($user, IContextSource $context, &$defaultPreferences)
 
static rcPreferences ($user, IContextSource $context, &$defaultPreferences)
 
static watchlistPreferences ($user, IContextSource $context, &$defaultPreferences)
 
static searchPreferences ($user, IContextSource $context, &$defaultPreferences)
 
static miscPreferences ($user, IContextSource $context, &$defaultPreferences)
 
static generateSkinOptions ($user, IContextSource $context)
 
static getDateOptions (IContextSource $context)
 
static getImageSizes (IContextSource $context)
 
static getThumbSizes (IContextSource $context)
 
static validateSignature ($signature, $alldata, $form)
 
static cleanSignature ($signature, $alldata, $form)
 
static getTimezoneOptions (IContextSource $context)
 
static filterIntval ($value, $alldata)
 
static filterTimezoneInput ($tz, $alldata)
 
static tryFormSubmit ($formData, $form)
 
static tryUISubmit ($formData, $form)
 
static getTimeZoneList (Language $language)
 

Static Protected Attributes

static $defaultPreferences = null
 
static $saveFilters
 

Detailed Description

We're now using the HTMLForm object with some customisation to generate the Preferences form. This object handles generic submission, CSRF protection, layout and other logic in a reusable manner. We subclass it as a PreferencesForm to make some minor customisations.

In order to generate the form, the HTMLForm object needs an array structure detailing the form fields available, and that's what this class is for. Each element of the array is a basic property-list, including the type of field, the label it is to be given in the form, callbacks for validation and 'filtering', and other pertinent information. Note that the 'default' field is named for generic forms, and does not represent the preference's default (which is stored in $wgDefaultUserOptions), but the default for the form field, which should be whatever the user has set for that preference. There is no need to override it unless you have some special storage logic (for instance, those not presently stored as options, but which are best set from the user preferences view).

Field types are implemented as subclasses of the generic HTMLFormField object, and typically implement at least getInputHTML, which generates the HTML for the input field to be placed in the table.

Once fields have been retrieved and validated, submission logic is handed over to the tryUISubmit static method of this class.

Member Function Documentation

static Preferences::cleanSignature (   $signature,
  $alldata,
  $form 
)
static
Parameters
string$signature
array$alldata
HTMLForm$form
Returns
string
static Preferences::datetimePreferences (   $user,
IContextSource  $context,
$defaultPreferences 
)
static
Parameters
User$user
IContextSource$context
array$defaultPreferences
Returns
void
static Preferences::editingPreferences (   $user,
IContextSource  $context,
$defaultPreferences 
)
static
Parameters
User$user
IContextSource$context
array$defaultPreferences
static Preferences::filesPreferences (   $user,
IContextSource  $context,
$defaultPreferences 
)
static
Parameters
User$user
IContextSource$context
array$defaultPreferences
static Preferences::filterIntval (   $value,
  $alldata 
)
static
Parameters
string$value
array$alldata
Returns
int
static Preferences::filterTimezoneInput (   $tz,
  $alldata 
)
static
Parameters
string$tz
array$alldata
Returns
string
static Preferences::generateSkinOptions (   $user,
IContextSource  $context 
)
static
Parameters
User$userThe User object
IContextSource$context
Returns
array Text/links to display as key; $skinkey as value
static Preferences::getDateOptions ( IContextSource  $context)
static
Parameters
IContextSource$context
Returns
array
static Preferences::getImageSizes ( IContextSource  $context)
static
Parameters
IContextSource$context
Returns
array
static Preferences::getOptionFromUser (   $name,
  $info,
  $user 
)
static

Pull option from a user account. Handles stuff like array-type preferences.

Parameters
string$name
array$info
User$user
Returns
array|string
static Preferences::getPreferences (   $user,
IContextSource  $context 
)
static
Exceptions
MWException
Parameters
User$user
IContextSource$context
Returns
array|null
static Preferences::getSaveBlacklist ( )
static
Returns
array
static Preferences::getThumbSizes ( IContextSource  $context)
static
Parameters
IContextSource$context
Returns
array
static Preferences::getTimeZoneList ( Language  $language)
static

Get a list of all time zones

Parameters
Language$languageLanguage used for the localized names
Returns
array A list of all time zones. The system name of the time zone is used as key and the value is an array which contains localized name, the timecorrection value used for preferences and the region
Since
1.26
static Preferences::getTimezoneOptions ( IContextSource  $context)
static
Parameters
IContextSource$context
Returns
array
static Preferences::loadPreferenceValues (   $user,
  $context,
$defaultPreferences 
)
static

Loads existing values for a given array of preferences

Exceptions
MWException
Parameters
User$user
IContextSource$context
array$defaultPreferencesArray to load values for
Returns
array|null
static Preferences::miscPreferences (   $user,
IContextSource  $context,
$defaultPreferences 
)
static

Dummy, kept for backwards-compatibility.

static Preferences::profilePreferences (   $user,
IContextSource  $context,
$defaultPreferences 
)
static
Parameters
User$user
IContextSource$context
array$defaultPreferences
Returns
void
static Preferences::rcPreferences (   $user,
IContextSource  $context,
$defaultPreferences 
)
static
Parameters
User$user
IContextSource$context
array$defaultPreferences
static Preferences::renderingPreferences (   $user,
IContextSource  $context,
$defaultPreferences 
)
static
Parameters
User$user
IContextSource$context
array$defaultPreferences
static Preferences::searchPreferences (   $user,
IContextSource  $context,
$defaultPreferences 
)
static
Parameters
User$user
IContextSource$context
array$defaultPreferences
static Preferences::skinPreferences (   $user,
IContextSource  $context,
$defaultPreferences 
)
static
Parameters
User$user
IContextSource$context
array$defaultPreferences
Returns
void
static Preferences::tryFormSubmit (   $formData,
  $form 
)
static

Handle the form submission if everything validated properly

Parameters
array$formData
PreferencesForm$form
Returns
bool|Status|string
static Preferences::tryUISubmit (   $formData,
  $form 
)
static
Parameters
array$formData
PreferencesForm$form
Returns
Status
static Preferences::validateSignature (   $signature,
  $alldata,
  $form 
)
static
Parameters
string$signature
array$alldata
HTMLForm$form
Returns
bool|string
static Preferences::watchlistPreferences (   $user,
IContextSource  $context,
$defaultPreferences 
)
static
Parameters
User$user
IContextSource$context
array$defaultPreferences

Member Data Documentation

Preferences::$saveFilters
staticprotected
Initial value:
= [
'timecorrection' => [ 'Preferences', 'filterTimezoneInput' ]

The documentation for this class was generated from the following file: