MediaWiki
1.34.0
|
This is the default implementation of PreferencesFactory. More...
Public Member Functions | |
__construct (ServiceOptions $options, Language $contLang, AuthManager $authManager, LinkRenderer $linkRenderer, NamespaceInfo $nsInfo, PermissionManager $permissionManager) | |
Do not call this directly. More... | |
getForm (User $user, IContextSource $context, $formClass=PreferencesFormOOUI::class, array $remove=[]) | |
getFormDescriptor (User $user, IContextSource $context) | |
getSaveBlacklist () | |
Get the names of preferences that should never be saved (such as 'realname' and 'emailaddress').
| |
Protected Member Functions | |
applyFilters (array &$preferences, array $formDescriptor, $verb) | |
Applies filters to preferences either before or after form usage. More... | |
cleanSignature ( $signature, $alldata, HTMLForm $form) | |
datetimePreferences ( $user, IContextSource $context, &$defaultPreferences) | |
editingPreferences (User $user, MessageLocalizer $l10n, &$defaultPreferences) | |
filesPreferences (IContextSource $context, &$defaultPreferences) | |
generateSkinOptions (User $user, IContextSource $context) | |
getDateOptions (IContextSource $context) | |
getImageSizes (MessageLocalizer $l10n) | |
getOptionFromUser ( $name, $info, array $userOptions) | |
Pull option from a user account. More... | |
getThumbSizes (MessageLocalizer $l10n) | |
getTimeZoneList (Language $language) | |
Get a list of all time zones. More... | |
getTimezoneOptions (IContextSource $context) | |
profilePreferences (User $user, IContextSource $context, &$defaultPreferences, $canIPUseHTTPS) | |
rcPreferences (User $user, MessageLocalizer $l10n, &$defaultPreferences) | |
renderingPreferences (User $user, MessageLocalizer $l10n, &$defaultPreferences) | |
saveFormData ( $formData, PreferencesFormOOUI $form, array $formDescriptor) | |
Handle the form submission if everything validated properly. More... | |
searchPreferences (&$defaultPreferences) | |
skinPreferences (User $user, IContextSource $context, &$defaultPreferences) | |
submitForm (array $formData, PreferencesFormOOUI $form, array $formDescriptor) | |
Save the form data and reload the page. More... | |
validateSignature ( $signature, $alldata, HTMLForm $form) | |
watchlistPreferences (User $user, IContextSource $context, &$defaultPreferences) | |
Protected Attributes | |
AuthManager | $authManager |
Language | $contLang |
The wiki's content language. More... | |
LinkRenderer | $linkRenderer |
NamespaceInfo | $nsInfo |
ServiceOptions | $options |
PermissionManager | $permissionManager |
Private Member Functions | |
loadPreferenceValues (User $user, IContextSource $context, &$defaultPreferences) | |
Loads existing values for a given array of preferences. More... | |
This is the default implementation of PreferencesFactory.
Definition at line 62 of file DefaultPreferencesFactory.php.
MediaWiki\Preferences\DefaultPreferencesFactory::__construct | ( | ServiceOptions | $options, |
Language | $contLang, | ||
AuthManager | $authManager, | ||
LinkRenderer | $linkRenderer, | ||
NamespaceInfo | $nsInfo, | ||
PermissionManager | $permissionManager | ||
) |
Do not call this directly.
Get it from MediaWikiServices.
ServiceOptions | $options | |
Language | $contLang | |
AuthManager | $authManager | |
LinkRenderer | $linkRenderer | |
NamespaceInfo | $nsInfo | |
PermissionManager | $permissionManager |
Definition at line 125 of file DefaultPreferencesFactory.php.
References MediaWiki\Preferences\DefaultPreferencesFactory\$authManager, MediaWiki\Preferences\DefaultPreferencesFactory\$contLang, MediaWiki\Preferences\DefaultPreferencesFactory\$linkRenderer, MediaWiki\Preferences\DefaultPreferencesFactory\$nsInfo, MediaWiki\Preferences\DefaultPreferencesFactory\$options, MediaWiki\Preferences\DefaultPreferencesFactory\$permissionManager, and MediaWiki\Config\ServiceOptions\assertRequiredOptions().
|
protected |
Applies filters to preferences either before or after form usage.
array | &$preferences | |
array | $formDescriptor | |
string | $verb | Name of the filter method to call, either 'filterFromForm' or 'filterForForm' |
Definition at line 1680 of file DefaultPreferencesFactory.php.
References $filter.
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\loadPreferenceValues(), and MediaWiki\Preferences\DefaultPreferencesFactory\saveFormData().
|
protected |
string | $signature | |
array | $alldata | |
HTMLForm | $form |
Definition at line 1479 of file DefaultPreferencesFactory.php.
References MediaWiki\MediaWikiServices\getInstance().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences().
|
protected |
User | $user | |
IContextSource | $context | |
array | &$defaultPreferences |
Definition at line 782 of file DefaultPreferencesFactory.php.
References MediaWiki\$context, $lang, Xml\element(), HTMLFormField\flattenOptions(), MediaWiki\Preferences\DefaultPreferencesFactory\getDateOptions(), IContextSource\getLanguage(), MediaWiki\Preferences\DefaultPreferencesFactory\getTimezoneOptions(), and wfTimestampNow().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor().
|
protected |
User | $user | |
MessageLocalizer | $l10n | |
array | &$defaultPreferences |
Definition at line 935 of file DefaultPreferencesFactory.php.
References MessageLocalizer\msg().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor().
|
protected |
IContextSource | $context | |
array | &$defaultPreferences |
Definition at line 760 of file DefaultPreferencesFactory.php.
References MediaWiki\Preferences\DefaultPreferencesFactory\getImageSizes(), and MediaWiki\Preferences\DefaultPreferencesFactory\getThumbSizes().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor().
|
protected |
User | $user | The User object |
IContextSource | $context |
Definition at line 1289 of file DefaultPreferencesFactory.php.
References MediaWiki\$context, Skin\getAllowedSkins(), IContextSource\getLanguage(), User\getName(), User\getOption(), IContextSource\getRequest(), Skin\getSkinNames(), Title\makeTitleSafe(), MessageLocalizer\msg(), Title\newMainPage(), and NS_USER.
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\skinPreferences().
|
protected |
IContextSource | $context |
Definition at line 1385 of file DefaultPreferencesFactory.php.
References MediaWiki\$context, $lang, $wgDefaultUserOptions, IContextSource\getLanguage(), MessageLocalizer\msg(), and wfTimestampNow().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\datetimePreferences().
MediaWiki\Preferences\DefaultPreferencesFactory::getForm | ( | User | $user, |
IContextSource | $context, | ||
$formClass = PreferencesFormOOUI::class , |
|||
array | $remove = [] |
||
) |
User | $user | |
IContextSource | $context | |
string | $formClass | |
array | $remove | Array of items to remove |
Implements MediaWiki\Preferences\PreferencesFactory.
Definition at line 1498 of file DefaultPreferencesFactory.php.
References MediaWiki\$context, MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor(), IContextSource\getOutput(), IContextSource\getRequest(), IContextSource\getTitle(), MessageLocalizer\msg(), and MediaWiki\Preferences\DefaultPreferencesFactory\submitForm().
MediaWiki\Preferences\DefaultPreferencesFactory::getFormDescriptor | ( | User | $user, |
IContextSource | $context | ||
) |
MWException |
User | $user | |
IContextSource | $context |
Implements MediaWiki\Preferences\PreferencesFactory.
Definition at line 160 of file DefaultPreferencesFactory.php.
References MediaWiki\$context, MediaWiki\Preferences\DefaultPreferencesFactory\datetimePreferences(), MediaWiki\Preferences\DefaultPreferencesFactory\editingPreferences(), MediaWiki\Preferences\DefaultPreferencesFactory\filesPreferences(), IContextSource\getLanguage(), IContextSource\getRequest(), IContextSource\getSkin(), MediaWiki\Preferences\DefaultPreferencesFactory\loadPreferenceValues(), MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences(), MediaWiki\Preferences\DefaultPreferencesFactory\rcPreferences(), MediaWiki\Preferences\DefaultPreferencesFactory\renderingPreferences(), Hooks\run(), MediaWiki\Preferences\DefaultPreferencesFactory\searchPreferences(), MediaWiki\Preferences\DefaultPreferencesFactory\skinPreferences(), MediaWiki\Preferences\DefaultPreferencesFactory\watchlistPreferences(), and wfCanIPUseHTTPS().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getForm().
|
protected |
MessageLocalizer | $l10n |
Definition at line 1419 of file DefaultPreferencesFactory.php.
References MessageLocalizer\msg().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\filesPreferences().
|
protected |
Pull option from a user account.
Handles stuff like array-type preferences.
string | $name | |
array | $info | |
array | $userOptions |
Definition at line 249 of file DefaultPreferencesFactory.php.
References MediaWiki\Preferences\DefaultPreferencesFactory\$options, and HTMLFormField\flattenOptions().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\loadPreferenceValues().
MediaWiki\Preferences\DefaultPreferencesFactory::getSaveBlacklist | ( | ) |
Get the names of preferences that should never be saved (such as 'realname' and 'emailaddress').
Implements MediaWiki\Preferences\PreferencesFactory.
Definition at line 147 of file DefaultPreferencesFactory.php.
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\loadPreferenceValues(), and MediaWiki\Preferences\DefaultPreferencesFactory\saveFormData().
|
protected |
MessageLocalizer | $l10n |
Definition at line 1436 of file DefaultPreferencesFactory.php.
References MessageLocalizer\msg().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\filesPreferences().
|
protected |
Get a list of all time zones.
Definition at line 1745 of file DefaultPreferencesFactory.php.
References wfMessage().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getTimezoneOptions().
|
protected |
IContextSource | $context |
Definition at line 1557 of file DefaultPreferencesFactory.php.
References MediaWiki\$context, IContextSource\getLanguage(), MWTimestamp\getLocalInstance(), MediaWiki\Preferences\DefaultPreferencesFactory\getTimeZoneList(), and MessageLocalizer\msg().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\datetimePreferences().
|
private |
Loads existing values for a given array of preferences.
MWException |
User | $user | |
IContextSource | $context | |
array | &$defaultPreferences | Array to load values for |
Definition at line 194 of file DefaultPreferencesFactory.php.
References MediaWiki\$context, MediaWiki\Preferences\DefaultPreferencesFactory\applyFilters(), User\getDefaultOptions(), MediaWiki\Preferences\DefaultPreferencesFactory\getOptionFromUser(), User\getOptions(), MediaWiki\Preferences\DefaultPreferencesFactory\getSaveBlacklist(), and HTMLForm\loadInputFromParameters().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor().
|
protected |
User | $user | |
IContextSource | $context | |
array | &$defaultPreferences | |
bool | $canIPUseHTTPS | Whether the user's IP is likely to be able to access the wiki via HTTPS. |
Definition at line 295 of file DefaultPreferencesFactory.php.
References MediaWiki\$context, $lang, $languages, MediaWiki\Preferences\DefaultPreferencesFactory\$options, $t, LanguageCode\bcp47(), MediaWiki\Preferences\DefaultPreferencesFactory\cleanSignature(), Language\fetchLanguageNames(), User\getEditCount(), User\getEffectiveGroups(), User\getEmail(), User\getEmailAuthenticationTimestamp(), UserGroupMembership\getExpiry(), User\getGroupMemberships(), MediaWiki\MediaWikiServices\getInstance(), IContextSource\getLanguage(), UserGroupMembership\getLink(), User\getName(), IContextSource\getOutput(), User\getRealName(), User\getRegistration(), IContextSource\getTitle(), SpecialPage\getTitleFor(), IContextSource\getUser(), MessageLocalizer\msg(), ParserOptions\newFromContext(), and MediaWiki\Preferences\DefaultPreferencesFactory\validateSignature().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor().
|
protected |
User | $user | |
MessageLocalizer | $l10n | |
array | &$defaultPreferences |
Definition at line 1002 of file DefaultPreferencesFactory.php.
References MessageLocalizer\msg(), User\useNPPatrol(), and User\useRCPatrol().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor().
|
protected |
User | $user | |
MessageLocalizer | $l10n | |
array | &$defaultPreferences |
Definition at line 861 of file DefaultPreferencesFactory.php.
References MessageLocalizer\msg().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor().
|
protected |
Handle the form submission if everything validated properly.
array | $formData | |
PreferencesFormOOUI | $form | |
array[] | $formDescriptor |
Definition at line 1605 of file DefaultPreferencesFactory.php.
References MediaWiki\Preferences\DefaultPreferencesFactory\applyFilters(), ContextSource\getContext(), PreferencesFormOOUI\getModifiedUser(), MediaWiki\Preferences\DefaultPreferencesFactory\getSaveBlacklist(), StatusValue\newFatal(), and Hooks\run().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\submitForm().
|
protected |
array | &$defaultPreferences |
Definition at line 1276 of file DefaultPreferencesFactory.php.
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor().
|
protected |
User | $user | |
IContextSource | $context | |
array | &$defaultPreferences |
Definition at line 712 of file DefaultPreferencesFactory.php.
References MediaWiki\$context, MediaWiki\Preferences\DefaultPreferencesFactory\generateSkinOptions(), IContextSource\getLanguage(), User\getName(), Title\makeTitleSafe(), MessageLocalizer\msg(), and NS_USER.
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor().
|
protected |
Save the form data and reload the page.
array | $formData | |
PreferencesFormOOUI | $form | |
array | $formDescriptor |
Definition at line 1709 of file DefaultPreferencesFactory.php.
References MediaWiki\$context, $res, ContextSource\getContext(), PreferencesFormOOUI\getExtraSuccessRedirectParameters(), IContextSource\getOutput(), IContextSource\getRequest(), HTMLForm\getTitle(), StatusValue\newGood(), and MediaWiki\Preferences\DefaultPreferencesFactory\saveFormData().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getForm().
|
protected |
string | $signature | |
array | $alldata | |
HTMLForm | $form |
Definition at line 1454 of file DefaultPreferencesFactory.php.
References Xml\element(), MediaWiki\MediaWikiServices\getInstance(), and ContextSource\msg().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences().
|
protected |
User | $user | |
IContextSource | $context | |
array | &$defaultPreferences |
Definition at line 1101 of file DefaultPreferencesFactory.php.
References MediaWiki\$action, MediaWiki\$context, MediaWiki\Preferences\DefaultPreferencesFactory\$options, SpecialWatchlist\checkStructuredFilterUiEnabled(), SpecialPage\getTitleFor(), MessageLocalizer\msg(), and User\useRCPatrol().
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor().
|
protected |
Definition at line 72 of file DefaultPreferencesFactory.php.
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\__construct().
|
protected |
The wiki's content language.
Definition at line 69 of file DefaultPreferencesFactory.php.
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\__construct().
|
protected |
Definition at line 75 of file DefaultPreferencesFactory.php.
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\__construct().
|
protected |
Definition at line 78 of file DefaultPreferencesFactory.php.
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\__construct().
|
protected |
Definition at line 66 of file DefaultPreferencesFactory.php.
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\__construct(), MediaWiki\Preferences\DefaultPreferencesFactory\getOptionFromUser(), MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences(), and MediaWiki\Preferences\DefaultPreferencesFactory\watchlistPreferences().
|
protected |
Definition at line 81 of file DefaultPreferencesFactory.php.
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\__construct().