MediaWiki
1.28.0
|
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=[]) |
static | getImageSizes (IContextSource $context) |
static | getOptionFromUser ($name, $info, $user) |
Pull option from a user account. More... | |
static | getPreferences ($user, IContextSource $context) |
static | getSaveBlacklist () |
static | getThumbSizes (IContextSource $context) |
static | getTimeZoneList (Language $language) |
Get a list of all time zones. More... | |
static | getTimezoneOptions (IContextSource $context) |
static | loadPreferenceValues ($user, $context, &$defaultPreferences) |
Loads existing values for a given array of preferences. More... | |
static | miscPreferences ($user, IContextSource $context, &$defaultPreferences) |
Dummy, kept for backwards-compatibility. More... | |
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) |
Handle the form submission if everything validated properly. More... | |
static | tryUISubmit ($formData, $form) |
static | validateSignature ($signature, $alldata, $form) |
static | watchlistPreferences ($user, IContextSource $context, &$defaultPreferences) |
Static Protected Attributes | |
static array | $defaultPreferences = null |
static array | $saveFilters |
Static Private Attributes | |
static array static | $saveBlacklist |
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 50 of file Preferences.php.
|
static |
string | $signature | |
array | $alldata | |
HTMLForm | $form |
Definition at line 1271 of file Preferences.php.
References $wgParser, Parser\cleanSigInSig(), and global.
|
static |
User | $user | |
IContextSource | $context | |
array | $defaultPreferences |
Definition at line 651 of file Preferences.php.
References $lang, $user, Xml\element(), HTMLFormField\flattenOptions(), IContextSource\getLanguage(), Html\hidden(), and wfTimestampNow().
|
static |
User | $user | |
IContextSource | $context | |
array | $defaultPreferences |
Definition at line 786 of file Preferences.php.
References $user, IContextSource\getConfig(), and IContextSource\msg().
|
static |
User | $user | |
IContextSource | $context | |
array | $defaultPreferences |
Definition at line 629 of file Preferences.php.
|
static |
string | $value | |
array | $alldata |
Definition at line 1375 of file Preferences.php.
References $value.
|
static |
|
static |
User | $user | The User object |
IContextSource | $context |
Definition at line 1108 of file Preferences.php.
References $ret, $user, as, Skin\getAllowedSkins(), IContextSource\getConfig(), IContextSource\getLanguage(), Linker\link(), Title\makeTitleSafe(), IContextSource\msg(), Title\newMainPage(), and NS_USER.
|
static |
IContextSource | $context |
Definition at line 1176 of file Preferences.php.
References $lang, $ret, $wgDefaultUserOptions, as, IContextSource\getLanguage(), global, IContextSource\msg(), and wfTimestampNow().
|
static |
User | $user | |
IContextSource | $context | |
string | $formClass | |
array | $remove | Array of items to remove |
Definition at line 1290 of file Preferences.php.
References $name, $user, as, getPreferences(), and IContextSource\msg().
Referenced by SpecialPreferences\execute().
|
static |
IContextSource | $context |
Definition at line 1211 of file Preferences.php.
References $ret, as, IContextSource\getConfig(), and IContextSource\msg().
|
static |
Pull option from a user account.
Handles stuff like array-type preferences.
string | $name | |
array | $info | |
User | $user |
Definition at line 166 of file Preferences.php.
References $name, $options, $user, $value, as, and HTMLFormField\flattenOptions().
|
static |
MWException |
User | $user | |
IContextSource | $context |
Definition at line 83 of file Preferences.php.
References $defaultPreferences, $user, and Hooks\run().
Referenced by ApiOptions\execute(), getFormObject(), and User\getOptionKinds().
|
static |
|
static |
IContextSource | $context |
Definition at line 1227 of file Preferences.php.
References $ret, as, IContextSource\getConfig(), and IContextSource\msg().
|
static |
Get a list of all time zones.
Definition at line 1513 of file Preferences.php.
References $value, as, and wfMessage().
|
static |
IContextSource | $context |
Definition at line 1330 of file Preferences.php.
References $timestamp, as, IContextSource\getConfig(), IContextSource\getLanguage(), MWTimestamp\getLocalInstance(), and IContextSource\msg().
|
static |
Loads existing values for a given array of preferences.
MWException |
User | $user | |
IContextSource | $context | |
array | $defaultPreferences | Array to load values for |
Definition at line 116 of file Preferences.php.
References $context, $defaultPreferences, $name, $user, as, User\getDefaultOptions(), and HTMLForm\loadInputFromParameters().
|
static |
Dummy, kept for backwards-compatibility.
Definition at line 1100 of file Preferences.php.
|
static |
User | $user | |
IContextSource | $context | |
array | $defaultPreferences |
Definition at line 209 of file Preferences.php.
References $code, $lang, $languages, LanguageConverter\$languagesWithVariants, $link, $name, $options, $t, $time, $user, $wgContLang, $wgParser, as, Language\fetchLanguageNames(), IContextSource\getConfig(), User\getGroupMember(), User\getGroupName(), IContextSource\getLanguage(), IContextSource\getOutput(), IContextSource\getRequest(), IContextSource\getTitle(), SpecialPage\getTitleFor(), IContextSource\getUser(), global, Linker\link(), Linker\linkKnown(), User\makeGroupLinkHTML(), IContextSource\msg(), ParserOptions\newFromContext(), wfBCP47(), and wfCanIPUseHTTPS().
Referenced by PreferencesTest\prefsFor().
|
static |
User | $user | |
IContextSource | $context | |
array | $defaultPreferences |
Definition at line 872 of file Preferences.php.
References $user, IContextSource\getConfig(), and IContextSource\msg().
|
static |
User | $user | |
IContextSource | $context | |
array | $defaultPreferences |
Definition at line 724 of file Preferences.php.
References $value, as, IContextSource\getConfig(), and IContextSource\msg().
|
static |
User | $user | |
IContextSource | $context | |
array | $defaultPreferences |
Definition at line 1089 of file Preferences.php.
References as, and MWNamespace\getValidNamespaces().
|
static |
User | $user | |
IContextSource | $context | |
array | $defaultPreferences |
Definition at line 580 of file Preferences.php.
References $user, IContextSource\getConfig(), IContextSource\getLanguage(), Linker\link(), Title\makeTitleSafe(), IContextSource\msg(), and NS_USER.
|
static |
Handle the form submission if everything validated properly.
array | $formData | |
PreferencesForm | $form |
Definition at line 1418 of file Preferences.php.
References $name, $user, $value, as, MediaWiki\Auth\AuthManager\callLegacyAuthPlugin(), StatusValue\newFatal(), and Hooks\run().
|
static |
array | $formData | |
PreferencesForm | $form |
Definition at line 1481 of file Preferences.php.
References $context, $res, and StatusValue\newGood().
|
static |
string | $signature | |
array | $alldata | |
HTMLForm | $form |
Definition at line 1245 of file Preferences.php.
References $wgParser, Xml\element(), false, and global.
|
static |
User | $user | |
IContextSource | $context | |
array | $defaultPreferences |
Definition at line 940 of file Preferences.php.
References $user, as, false, IContextSource\getConfig(), IContextSource\getLanguage(), SpecialPage\getTitleFor(), Linker\linkKnown(), and IContextSource\msg().
|
staticprotected |
Definition at line 52 of file Preferences.php.
Referenced by getPreferences(), and loadPreferenceValues().
|
staticprivate |
Definition at line 65 of file Preferences.php.
|
staticprotected |
Definition at line 55 of file Preferences.php.