MediaWiki
1.30.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 | $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 49 of file Preferences.php.
|
static |
string | $signature | |
array | $alldata | |
HTMLForm | $form |
Definition at line 1331 of file Preferences.php.
|
static |
User | $user | |
IContextSource | $context | |
array | &$defaultPreferences |
Definition at line 690 of file Preferences.php.
References $context, $defaultPreferences, $e, $lang, $user, captcha-old\count, Xml\element(), HTMLFormField\flattenOptions(), getDateOptions(), getTimezoneOptions(), Html\hidden(), and wfTimestampNow().
Referenced by getPreferences().
|
static |
User | $user | |
IContextSource | $context | |
array | &$defaultPreferences |
Definition at line 828 of file Preferences.php.
References $context, $defaultPreferences, and $user.
Referenced by getPreferences().
|
static |
User | $user | |
IContextSource | $context | |
array | &$defaultPreferences |
Definition at line 668 of file Preferences.php.
References $context, $defaultPreferences, getImageSizes(), and getThumbSizes().
Referenced by getPreferences().
|
static |
string | $value | |
array | $alldata |
Definition at line 1435 of file Preferences.php.
References $value.
|
static |
string | $tz | |
array | $alldata |
Definition at line 1444 of file Preferences.php.
References $e, and captcha-old\count.
|
static |
User | $user | The User object |
IContextSource | $context |
Definition at line 1166 of file Preferences.php.
References $context, $linkRenderer, $ret, $user, as, Skin\getAllowedSkins(), Title\makeTitleSafe(), Title\newMainPage(), and NS_USER.
Referenced by skinPreferences().
|
static |
IContextSource | $context |
Definition at line 1236 of file Preferences.php.
References $context, $lang, $ret, $wgDefaultUserOptions, as, global, and wfTimestampNow().
Referenced by datetimePreferences().
|
static |
User | $user | |
IContextSource | $context | |
string | $formClass | |
array | $remove | Array of items to remove |
Definition at line 1350 of file Preferences.php.
References $context, $name, $user, as, captcha-old\count, and getPreferences().
Referenced by SpecialPreferences\getFormObject().
|
static |
IContextSource | $context |
Definition at line 1270 of file Preferences.php.
References $context, $ret, and as.
Referenced by filesPreferences().
|
static |
Pull option from a user account.
Handles stuff like array-type preferences.
string | $name | |
array | $info | |
User | $user |
Definition at line 163 of file Preferences.php.
References $name, $options, $rows, $user, $value, as, and HTMLFormField\flattenOptions().
Referenced by loadPreferenceValues().
|
static |
MWException |
User | $user | |
IContextSource | $context |
Definition at line 80 of file Preferences.php.
References $context, $defaultPreferences, $user, datetimePreferences(), editingPreferences(), filesPreferences(), loadPreferenceValues(), miscPreferences(), profilePreferences(), rcPreferences(), renderingPreferences(), Hooks\run(), searchPreferences(), skinPreferences(), and watchlistPreferences().
Referenced by ApiOptions\execute(), getFormObject(), and User\getOptionKinds().
|
static |
Definition at line 70 of file Preferences.php.
References $saveBlacklist.
Referenced by User\getOptionKinds().
|
static |
IContextSource | $context |
Definition at line 1287 of file Preferences.php.
References $context, $ret, and as.
Referenced by filesPreferences().
|
static |
Get a list of all time zones.
Definition at line 1596 of file Preferences.php.
References $value, as, captcha-old\count, and wfMessage().
Referenced by getTimezoneOptions().
|
static |
IContextSource | $context |
Definition at line 1390 of file Preferences.php.
References $context, $opt, as, MWTimestamp\getLocalInstance(), and getTimeZoneList().
Referenced by datetimePreferences().
|
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 113 of file Preferences.php.
References $context, $defaultPreferences, $name, $user, as, User\getDefaultOptions(), getOptionFromUser(), and HTMLForm\loadInputFromParameters().
Referenced by getPreferences().
|
static |
Dummy, kept for backwards-compatibility.
User | $user | |
IContextSource | $context | |
array | &$defaultPreferences |
Definition at line 1158 of file Preferences.php.
Referenced by getPreferences().
|
static |
User | $user | |
IContextSource | $context | |
array | &$defaultPreferences |
Definition at line 206 of file Preferences.php.
References $code, $context, $defaultPreferences, $lang, $languages, $link, $linkRenderer, $name, $options, $t, $time, $user, $wgContLang, $wgParser, as, captcha-old\count, CentralIdLookup\factory(), Language\fetchLanguageNames(), UserGroupMembership\getExpiry(), UserGroupMembership\getLink(), MediaWiki\getTitle(), SpecialPage\getTitleFor(), global, ParserOptions\newFromContext(), text, wfBCP47(), and wfCanIPUseHTTPS().
Referenced by getPreferences(), and PreferencesTest\prefsFor().
|
static |
User | $user | |
IContextSource | $context | |
array | &$defaultPreferences |
Definition at line 901 of file Preferences.php.
References $context, $defaultPreferences, and $user.
Referenced by getPreferences().
|
static |
User | $user | |
IContextSource | $context | |
array | &$defaultPreferences |
Definition at line 766 of file Preferences.php.
References $context, $defaultPreferences, $value, and as.
Referenced by getPreferences().
|
static |
User | $user | |
IContextSource | $context | |
array | &$defaultPreferences |
Definition at line 1144 of file Preferences.php.
References $defaultPreferences, as, and MWNamespace\getValidNamespaces().
Referenced by getPreferences().
|
static |
User | $user | |
IContextSource | $context | |
array | &$defaultPreferences |
Definition at line 619 of file Preferences.php.
References $context, $defaultPreferences, $linkRenderer, $user, generateSkinOptions(), Title\makeTitleSafe(), and NS_USER.
Referenced by getPreferences().
|
static |
Handle the form submission if everything validated properly.
array | $formData | |
PreferencesForm | $form |
Definition at line 1496 of file Preferences.php.
References $name, $user, $value, as, MediaWiki\Auth\AuthManager\callLegacyAuthPlugin(), StatusValue\newFatal(), and Hooks\run().
Referenced by PreferencesTest\testPreferencesFormPreSaveHookHasCorrectData(), and tryUISubmit().
|
static |
array | $formData | |
PreferencesForm | $form |
Definition at line 1564 of file Preferences.php.
References $context, $res, StatusValue\newGood(), and tryFormSubmit().
|
static |
string | $signature | |
array | $alldata | |
HTMLForm | $form |
Definition at line 1305 of file Preferences.php.
References $wgParser, Xml\element(), false, and global.
|
static |
User | $user | |
IContextSource | $context | |
array | &$defaultPreferences |
Definition at line 989 of file Preferences.php.
References $context, $defaultPreferences, $linkRenderer, $user, as, false, and SpecialPage\getTitleFor().
Referenced by getPreferences().
|
staticprotected |
Definition at line 51 of file Preferences.php.
Referenced by datetimePreferences(), editingPreferences(), filesPreferences(), getPreferences(), loadPreferenceValues(), profilePreferences(), rcPreferences(), renderingPreferences(), searchPreferences(), skinPreferences(), and watchlistPreferences().
|
staticprivate |
Definition at line 62 of file Preferences.php.
Referenced by getSaveBlacklist().
|
staticprotected |
Definition at line 54 of file Preferences.php.