MediaWiki
REL1_19
|
We're now using the HTMLForm object with some customisation to generate the Preferences form. More...
Static Public Member Functions | |
static | cleanSignature ($signature, $alldata, $form) |
static | datetimePreferences ($user, IContextSource $context, &$defaultPreferences) |
static | editingPreferences ($user, IContextSource $context, &$defaultPreferences) |
static | filesPreferences ($user, IContextSource $context, &$defaultPreferences) |
static | filterIntval ($value, $alldata) |
static | filterTimezoneInput ($tz, $alldata) |
static | generateSkinOptions ($user, IContextSource $context) |
static | getDateOptions (IContextSource $context) |
static | getFormObject ($user, IContextSource $context, $formClass= 'PreferencesForm', array $remove=array()) |
static | getImageSizes (IContextSource $context) |
static | getOptionFromUser ($name, $info, $user) |
Pull option from a user account. | |
static | getPreferences ($user, IContextSource $context) |
static | getThumbSizes (IContextSource $context) |
static | getTimezoneOptions (IContextSource $context) |
static | loadOldSearchNs ($user) |
static | miscPreferences ($user, IContextSource $context, &$defaultPreferences) |
static | profilePreferences ($user, IContextSource $context, &$defaultPreferences) |
static | rcPreferences ($user, IContextSource $context, &$defaultPreferences) |
static | renderingPreferences ($user, IContextSource $context, &$defaultPreferences) |
static | searchPreferences ($user, IContextSource $context, &$defaultPreferences) |
static | skinPreferences ($user, IContextSource $context, &$defaultPreferences) |
static | tryFormSubmit ($formData, $form, $entryPoint= 'internal') |
static | trySetUserEmail (User $user, $newaddr) |
Try to set a user's email address. | |
static | tryUISubmit ($formData, $form) |
static | validateSignature ($signature, $alldata, $form) |
static | watchlistPreferences ($user, IContextSource $context, &$defaultPreferences) |
Static Public Attributes | |
static | $defaultPreferences = null |
static | $saveFilters |
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.
Definition at line 28 of file Preferences.php.
static Preferences::cleanSignature | ( | $ | signature, |
$ | alldata, | ||
$ | form | ||
) | [static] |
$signature | string |
$alldata | array |
$form | HTMLForm |
Definition at line 1197 of file Preferences.php.
References $wgParser, and Parser\cleanSigInSig().
static Preferences::datetimePreferences | ( | $ | user, |
IContextSource $ | context, | ||
&$ | defaultPreferences | ||
) | [static] |
$user | User |
$context | IContextSource |
$defaultPreferences |
Definition at line 539 of file Preferences.php.
References $defaultPreferences, $user, Xml\element(), HTMLFormField\flattenOptions(), getDateOptions(), IContextSource\getLanguage(), getTimezoneOptions(), Html\hidden(), and wfTimestampNow().
Referenced by getPreferences().
static Preferences::editingPreferences | ( | $ | user, |
IContextSource $ | context, | ||
&$ | defaultPreferences | ||
) | [static] |
$user | User |
$context | IContextSource |
$defaultPreferences | Array |
Definition at line 689 of file Preferences.php.
References $defaultPreferences, $user, $wgAllowUserCssPrefs, $wgUseExternalEditor, and IContextSource\msg().
Referenced by getPreferences().
static Preferences::filesPreferences | ( | $ | user, |
IContextSource $ | context, | ||
&$ | defaultPreferences | ||
) | [static] |
$user | User |
$context | IContextSource |
$defaultPreferences | Array |
Definition at line 517 of file Preferences.php.
References $defaultPreferences.
Referenced by getPreferences().
static Preferences::filterIntval | ( | $ | value, |
$ | alldata | ||
) | [static] |
static Preferences::filterTimezoneInput | ( | $ | tz, |
$ | alldata | ||
) | [static] |
static Preferences::generateSkinOptions | ( | $ | user, |
IContextSource $ | context | ||
) | [static] |
$user | User The User object |
$context | IContextSource |
Definition at line 1049 of file Preferences.php.
References $user, $wgAllowUserCss, $wgAllowUserJs, $wgDefaultSkin, IContextSource\getLanguage(), Skin\getUsableSkins(), Linker\link(), Title\makeTitleSafe(), IContextSource\msg(), and Title\newMainPage().
static Preferences::getDateOptions | ( | IContextSource $ | context | ) | [static] |
$context | IContextSource |
Definition at line 1104 of file Preferences.php.
References $wgDefaultUserOptions, IContextSource\getLanguage(), IContextSource\msg(), and wfTimestampNow().
Referenced by datetimePreferences().
static Preferences::getFormObject | ( | $ | user, |
IContextSource $ | context, | ||
$ | formClass = 'PreferencesForm' , |
||
array $ | remove = array() |
||
) | [static] |
$user | User |
$context | IContextSource |
$formClass | string |
$remove | Array: array of items to remove |
Definition at line 1216 of file Preferences.php.
References $user, getPreferences(), and IContextSource\msg().
Referenced by SpecialPreferences\execute().
static Preferences::getImageSizes | ( | IContextSource $ | context | ) | [static] |
$context | IContextSource |
Definition at line 1139 of file Preferences.php.
References $wgImageLimits, and IContextSource\msg().
static Preferences::getOptionFromUser | ( | $ | name, |
$ | info, | ||
$ | user | ||
) | [static] |
Pull option from a user account.
Handles stuff like array-type preferences.
$name | |
$info | |
$user | User |
Definition at line 109 of file Preferences.php.
References $options, $user, and HTMLFormField\flattenOptions().
Referenced by getPreferences().
static Preferences::getPreferences | ( | $ | user, |
IContextSource $ | context | ||
) | [static] |
MWException |
$user | User |
$context | IContextSource |
Definition at line 45 of file Preferences.php.
References $defaultPreferences, $user, $wgHiddenPrefs, datetimePreferences(), editingPreferences(), filesPreferences(), User\getDefaultOptions(), getOptionFromUser(), HTMLForm\loadInputFromParameters(), miscPreferences(), profilePreferences(), rcPreferences(), renderingPreferences(), searchPreferences(), skinPreferences(), watchlistPreferences(), and wfRunHooks().
Referenced by getFormObject().
static Preferences::getThumbSizes | ( | IContextSource $ | context | ) | [static] |
$context | IContextSource |
Definition at line 1157 of file Preferences.php.
References $size, $wgThumbLimits, and IContextSource\msg().
static Preferences::getTimezoneOptions | ( | IContextSource $ | context | ) | [static] |
Definition at line 1249 of file Preferences.php.
References $wgLocaltimezone, $wgLocalTZoffset, and IContextSource\msg().
Referenced by datetimePreferences().
static Preferences::loadOldSearchNs | ( | $ | user | ) | [static] |
$user | User |
Definition at line 1478 of file Preferences.php.
References $user, SearchEngine\searchableNamespaces(), and wfDeprecated().
static Preferences::miscPreferences | ( | $ | user, |
IContextSource $ | context, | ||
&$ | defaultPreferences | ||
) | [static] |
$user | User |
$context | IContextSource |
$defaultPreferences | Array |
Definition at line 1017 of file Preferences.php.
References $defaultPreferences, and $wgContLang.
Referenced by getPreferences().
static Preferences::profilePreferences | ( | $ | user, |
IContextSource $ | context, | ||
&$ | defaultPreferences | ||
) | [static] |
$user | User |
$context | IContextSource |
$defaultPreferences |
Definition at line 135 of file Preferences.php.
References $defaultPreferences, $languages, $options, $t, $user, $wgAuth, $wgContLang, $wgCookieExpiration, $wgDisableLangConversion, $wgDisableTitleConversion, $wgEmailAuthentication, $wgEmailConfirmToEdit, $wgEnableEmail, $wgEnableUserEmail, $wgEnotifRevealEditorAddress, $wgEnotifUserTalk, $wgEnotifWatchlist, $wgLanguageCode, $wgMaxSigChars, $wgParser, User\getGroupMember(), User\getGroupName(), IContextSource\getLanguage(), Language\getLanguageNames(), IContextSource\getOutput(), IContextSource\getTitle(), SpecialPage\getTitleFor(), IContextSource\getUser(), Linker\link(), Linker\linkKnown(), User\makeGroupLinkHTML(), IContextSource\msg(), ParserOptions\newFromContext(), and wfBCP47().
Referenced by getPreferences().
static Preferences::rcPreferences | ( | $ | user, |
IContextSource $ | context, | ||
&$ | defaultPreferences | ||
) | [static] |
$user | User |
$context | IContextSource |
$defaultPreferences | Array |
Definition at line 795 of file Preferences.php.
References $defaultPreferences, $user, $wgRCMaxAge, $wgRCShowWatchingUsers, and IContextSource\msg().
Referenced by getPreferences().
static Preferences::renderingPreferences | ( | $ | user, |
IContextSource $ | context, | ||
&$ | defaultPreferences | ||
) | [static] |
$user | User |
$context | IContextSource |
$defaultPreferences | Array |
Definition at line 611 of file Preferences.php.
References $defaultPreferences, $wgAllowUserCssPrefs, and IContextSource\msg().
Referenced by getPreferences().
static Preferences::searchPreferences | ( | $ | user, |
IContextSource $ | context, | ||
&$ | defaultPreferences | ||
) | [static] |
$user | User |
$context | IContextSource |
$defaultPreferences | Array |
Definition at line 953 of file Preferences.php.
References $defaultPreferences, $wgContLang, $wgEnableMWSuggest, $wgVectorUseSimpleSearch, and IContextSource\msg().
Referenced by getPreferences().
static Preferences::skinPreferences | ( | $ | user, |
IContextSource $ | context, | ||
&$ | defaultPreferences | ||
) | [static] |
$user | User |
$context | IContextSource |
$defaultPreferences |
Definition at line 463 of file Preferences.php.
References $defaultPreferences, $user, $wgAllowUserCss, $wgAllowUserJs, IContextSource\getLanguage(), Linker\link(), Title\makeTitleSafe(), and IContextSource\msg().
Referenced by getPreferences().
static Preferences::tryFormSubmit | ( | $ | formData, |
$ | form, | ||
$ | entryPoint = 'internal' |
||
) | [static] |
$formData | |
$form | PreferencesForm |
$entryPoint | string |
Definition at line 1356 of file Preferences.php.
References $result, $user, and $wgHiddenPrefs.
Referenced by tryUISubmit().
static Preferences::trySetUserEmail | ( | User $ | user, |
$ | newaddr | ||
) | [static] |
Try to set a user's email address.
This does *not* try to validate the address. Caller is responsible for checking $wgAuth.
$user | User |
$newaddr | string New email address |
Definition at line 1442 of file Preferences.php.
References $result, $wgEmailAuthentication, $wgEnableEmail, User\getEmail(), User\sendConfirmationMail(), User\setEmail(), and wfRunHooks().
Referenced by SpecialChangeEmail\attemptChange().
static Preferences::tryUISubmit | ( | $ | formData, |
$ | form | ||
) | [static] |
$formData | |
$form | PreferencesForm |
Definition at line 1414 of file Preferences.php.
References $res, $url, Status\newGood(), and tryFormSubmit().
static Preferences::validateSignature | ( | $ | signature, |
$ | alldata, | ||
$ | form | ||
) | [static] |
$signature | string |
$alldata | array |
$form | HTMLForm |
Definition at line 1177 of file Preferences.php.
References $wgMaxSigChars, $wgParser, and Xml\element().
static Preferences::watchlistPreferences | ( | $ | user, |
IContextSource $ | context, | ||
&$ | defaultPreferences | ||
) | [static] |
$user | User |
$context | IContextSource |
$defaultPreferences |
Definition at line 852 of file Preferences.php.
References $defaultPreferences, $user, $wgEnableAPI, $wgRCMaxAge, $wgUseRCPatrol, and IContextSource\msg().
Referenced by getPreferences().
Preferences::$defaultPreferences = null [static] |
Definition at line 29 of file Preferences.php.
Referenced by datetimePreferences(), editingPreferences(), filesPreferences(), getPreferences(), miscPreferences(), profilePreferences(), rcPreferences(), renderingPreferences(), searchPreferences(), skinPreferences(), and watchlistPreferences().
Preferences::$saveFilters [static] |
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' ), )
Definition at line 30 of file Preferences.php.