[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/ -> Preferences.php (summary)

Form to edit user preferences. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 1607 lines (50 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 2 classes

Preferences:: (27 methods):
  getSaveBlacklist()
  getPreferences()
  loadPreferenceValues()
  getOptionFromUser()
  profilePreferences()
  skinPreferences()
  filesPreferences()
  datetimePreferences()
  renderingPreferences()
  editingPreferences()
  rcPreferences()
  watchlistPreferences()
  searchPreferences()
  miscPreferences()
  generateSkinOptions()
  getDateOptions()
  getImageSizes()
  getThumbSizes()
  validateSignature()
  cleanSignature()
  getFormObject()
  getTimezoneOptions()
  filterIntval()
  filterTimezoneInput()
  tryFormSubmit()
  tryUISubmit()
  trySetUserEmail()

PreferencesForm:: (8 methods):
  setModifiedUser()
  getModifiedUser()
  getExtraSuccessRedirectParameters()
  wrapForm()
  getButtons()
  filterDataForSubmit()
  getBody()
  getLegend()


Class: Preferences  - X-Ref

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.
getSaveBlacklist()   X-Ref

return: array

getPreferences( $user, IContextSource $context )   X-Ref

param: User $user
param: IContextSource $context
return: array|null

loadPreferenceValues( $user, $context, &$defaultPreferences )   X-Ref
Loads existing values for a given array of preferences

param: User $user
param: IContextSource $context
param: array $defaultPreferences Array to load values for
return: array|null

getOptionFromUser( $name, $info, $user )   X-Ref
Pull option from a user account. Handles stuff like array-type preferences.

param: string $name
param: array $info
param: User $user
return: array|string

profilePreferences( $user, IContextSource $context, &$defaultPreferences )   X-Ref

param: User $user
param: IContextSource $context
param: array $defaultPreferences
return: void

skinPreferences( $user, IContextSource $context, &$defaultPreferences )   X-Ref

param: User $user
param: IContextSource $context
param: array $defaultPreferences
return: void

filesPreferences( $user, IContextSource $context, &$defaultPreferences )   X-Ref

param: User $user
param: IContextSource $context
param: array $defaultPreferences

datetimePreferences( $user, IContextSource $context, &$defaultPreferences )   X-Ref

param: User $user
param: IContextSource $context
param: array $defaultPreferences
return: void

renderingPreferences( $user, IContextSource $context, &$defaultPreferences )   X-Ref

param: User $user
param: IContextSource $context
param: array $defaultPreferences

editingPreferences( $user, IContextSource $context, &$defaultPreferences )   X-Ref

param: User $user
param: IContextSource $context
param: array $defaultPreferences

rcPreferences( $user, IContextSource $context, &$defaultPreferences )   X-Ref

param: User $user
param: IContextSource $context
param: array $defaultPreferences

watchlistPreferences( $user, IContextSource $context, &$defaultPreferences )   X-Ref

param: User $user
param: IContextSource $context
param: array $defaultPreferences

searchPreferences( $user, IContextSource $context, &$defaultPreferences )   X-Ref

param: User $user
param: IContextSource $context
param: array $defaultPreferences

miscPreferences( $user, IContextSource $context, &$defaultPreferences )   X-Ref
Dummy, kept for backwards-compatibility.


generateSkinOptions( $user, IContextSource $context )   X-Ref

param: User $user The User object
param: IContextSource $context
return: array Text/links to display as key; $skinkey as value

getDateOptions( IContextSource $context )   X-Ref

param: IContextSource $context
return: array

getImageSizes( IContextSource $context )   X-Ref

param: IContextSource $context
return: array

getThumbSizes( IContextSource $context )   X-Ref

param: IContextSource $context
return: array

validateSignature( $signature, $alldata, $form )   X-Ref

param: string $signature
param: array $alldata
param: HTMLForm $form
return: bool|string

cleanSignature( $signature, $alldata, $form )   X-Ref

param: string $signature
param: array $alldata
param: HTMLForm $form
return: string

getFormObject($user,IContextSource $context,$formClass = 'PreferencesForm',array $remove = array()   X-Ref

param: User $user
param: IContextSource $context
param: string $formClass
param: array $remove Array of items to remove
return: HtmlForm

getTimezoneOptions( IContextSource $context )   X-Ref

param: IContextSource $context
return: array

filterIntval( $value, $alldata )   X-Ref

param: string $value
param: array $alldata
return: int

filterTimezoneInput( $tz, $alldata )   X-Ref

param: string $tz
param: array $alldata
return: string

tryFormSubmit( $formData, $form )   X-Ref
Handle the form submission if everything validated properly

param: array $formData
param: PreferencesForm $form
return: bool|Status|string

tryUISubmit( $formData, $form )   X-Ref

param: array $formData
param: PreferencesForm $form
return: Status

trySetUserEmail( User $user, $newaddr )   X-Ref
Try to set a user's email address.
This does *not* try to validate the address.
Caller is responsible for checking $wgAuth and 'editmyprivateinfo'
right.

param: User $user
param: string $newaddr New email address
return: array (true on success or Status on failure, info string)

Class: PreferencesForm  - X-Ref

setModifiedUser( $user )   X-Ref

param: User $user

getModifiedUser()   X-Ref

return: User

getExtraSuccessRedirectParameters()   X-Ref
Get extra parameters for the query string when redirecting after
successful save.

return: array()

wrapForm( $html )   X-Ref

param: string $html
return: string

getButtons()   X-Ref

return: string

filterDataForSubmit( $data )   X-Ref
Separate multi-option preferences into multiple preferences, since we
have to store them separately

param: array $data
return: array

getBody()   X-Ref
Get the whole body of the form.

return: string

getLegend( $key )   X-Ref
Get the "<legend>" for a given section key. Normally this is the
prefs-$key message but we'll allow extensions to override it.

param: string $key
return: string



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1