MediaWiki  master
MediaWiki\Preferences\DefaultPreferencesFactory Class Reference

This is the default implementation of PreferencesFactory. More...

Inheritance diagram for MediaWiki\Preferences\DefaultPreferencesFactory:
Collaboration diagram for MediaWiki\Preferences\DefaultPreferencesFactory:

Public Member Functions

 __construct ( $options, Language $contLang, AuthManager $authManager, LinkRenderer $linkRenderer, NamespaceInfo $nsInfo=null)
 Do not call this directly. More...
 
 getForm (User $user, IContextSource $context, $formClass=PreferencesFormOOUI::class, array $remove=[])
 
 getFormDescriptor (User $user, IContextSource $context)
 
 getSaveBlacklist ()
 

Static Public Attributes

static array $constructorOptions
 TODO Make this a const when we drop HHVM support (T192166) More...
 

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, HTMLForm $form, array $formDescriptor)
 Handle the form submission if everything validated properly. More...
 
 searchPreferences (&$defaultPreferences)
 
 skinPreferences (User $user, IContextSource $context, &$defaultPreferences)
 
 submitForm (array $formData, HTMLForm $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
 

Private Member Functions

 loadPreferenceValues (User $user, IContextSource $context, &$defaultPreferences)
 Loads existing values for a given array of preferences. More...
 

Detailed Description

This is the default implementation of PreferencesFactory.

Definition at line 62 of file DefaultPreferencesFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Preferences\DefaultPreferencesFactory::__construct (   $options,
Language  $contLang,
AuthManager  $authManager,
LinkRenderer  $linkRenderer,
NamespaceInfo  $nsInfo = null 
)

Member Function Documentation

◆ applyFilters()

MediaWiki\Preferences\DefaultPreferencesFactory::applyFilters ( array &  $preferences,
array  $formDescriptor,
  $verb 
)
protected

Applies filters to preferences either before or after form usage.

Parameters
array&$preferences
array$formDescriptor
string$verbName of the filter method to call, either 'filterFromForm' or 'filterForForm'

Definition at line 1663 of file DefaultPreferencesFactory.php.

References $filter, and as.

Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\loadPreferenceValues(), and MediaWiki\Preferences\DefaultPreferencesFactory\saveFormData().

◆ cleanSignature()

MediaWiki\Preferences\DefaultPreferencesFactory::cleanSignature (   $signature,
  $alldata,
HTMLForm  $form 
)
protected
Parameters
string$signature
array$alldata
HTMLForm$form
Returns
string

Definition at line 1467 of file DefaultPreferencesFactory.php.

References $parser, Parser\cleanSigInSig(), and MediaWiki\MediaWikiServices\getInstance().

Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences().

◆ datetimePreferences()

MediaWiki\Preferences\DefaultPreferencesFactory::datetimePreferences (   $user,
IContextSource  $context,
$defaultPreferences 
)
protected

◆ editingPreferences()

MediaWiki\Preferences\DefaultPreferencesFactory::editingPreferences ( User  $user,
MessageLocalizer  $l10n,
$defaultPreferences 
)
protected
Parameters
User$user
MessageLocalizer$l10n
array&$defaultPreferences

Definition at line 923 of file DefaultPreferencesFactory.php.

References User\isAllowed(), MessageLocalizer\msg(), and options().

Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor().

◆ filesPreferences()

MediaWiki\Preferences\DefaultPreferencesFactory::filesPreferences ( IContextSource  $context,
$defaultPreferences 
)
protected

◆ generateSkinOptions()

MediaWiki\Preferences\DefaultPreferencesFactory::generateSkinOptions ( User  $user,
IContextSource  $context 
)
protected

◆ getDateOptions()

MediaWiki\Preferences\DefaultPreferencesFactory::getDateOptions ( IContextSource  $context)
protected

◆ getForm()

MediaWiki\Preferences\DefaultPreferencesFactory::getForm ( User  $user,
IContextSource  $context,
  $formClass = PreferencesFormOOUI::class,
array  $remove = [] 
)

◆ getFormDescriptor()

◆ getImageSizes()

MediaWiki\Preferences\DefaultPreferencesFactory::getImageSizes ( MessageLocalizer  $l10n)
protected

◆ getOptionFromUser()

MediaWiki\Preferences\DefaultPreferencesFactory::getOptionFromUser (   $name,
  $info,
array  $userOptions 
)
protected

Pull option from a user account.

Handles stuff like array-type preferences.

Parameters
string$name
array$info
array$userOptions
Returns
array|string

Definition at line 250 of file DefaultPreferencesFactory.php.

References $name, $rows, $value, as, class, HTMLFormField\flattenOptions(), and null.

Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\loadPreferenceValues().

◆ getSaveBlacklist()

MediaWiki\Preferences\DefaultPreferencesFactory::getSaveBlacklist ( )

◆ getThumbSizes()

MediaWiki\Preferences\DefaultPreferencesFactory::getThumbSizes ( MessageLocalizer  $l10n)
protected

◆ getTimeZoneList()

MediaWiki\Preferences\DefaultPreferencesFactory::getTimeZoneList ( Language  $language)
protected

Get a list of all time zones.

Parameters
Language$languageLanguage used for the localized names
Returns
array A list of all time zones. The system name of the time zone is used as key and the value is an array which contains localized name, the timecorrection value used for preferences and the region
Since
1.26

Definition at line 1724 of file DefaultPreferencesFactory.php.

References $value, as, and wfMessage().

Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getTimezoneOptions().

◆ getTimezoneOptions()

MediaWiki\Preferences\DefaultPreferencesFactory::getTimezoneOptions ( IContextSource  $context)
protected

◆ loadPreferenceValues()

MediaWiki\Preferences\DefaultPreferencesFactory::loadPreferenceValues ( User  $user,
IContextSource  $context,
$defaultPreferences 
)
private

◆ profilePreferences()

◆ rcPreferences()

MediaWiki\Preferences\DefaultPreferencesFactory::rcPreferences ( User  $user,
MessageLocalizer  $l10n,
$defaultPreferences 
)
protected

◆ renderingPreferences()

MediaWiki\Preferences\DefaultPreferencesFactory::renderingPreferences ( User  $user,
MessageLocalizer  $l10n,
$defaultPreferences 
)
protected
Parameters
User$user
MessageLocalizer$l10n
array&$defaultPreferences

Definition at line 849 of file DefaultPreferencesFactory.php.

References $value, as, User\isAllowed(), MessageLocalizer\msg(), and options().

Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor().

◆ saveFormData()

MediaWiki\Preferences\DefaultPreferencesFactory::saveFormData (   $formData,
HTMLForm  $form,
array  $formDescriptor 
)
protected

Handle the form submission if everything validated properly.

Parameters
array$formData
HTMLForm$form
array[]$formDescriptor
Returns
bool|Status|string

Definition at line 1589 of file DefaultPreferencesFactory.php.

References $user, $value, MediaWiki\Preferences\DefaultPreferencesFactory\applyFilters(), as, ContextSource\getContext(), MediaWiki\Preferences\DefaultPreferencesFactory\getSaveBlacklist(), StatusValue\newFatal(), null, options(), and Hooks\run().

Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\submitForm().

◆ searchPreferences()

MediaWiki\Preferences\DefaultPreferencesFactory::searchPreferences ( $defaultPreferences)
protected
Parameters
array&$defaultPreferences

Definition at line 1264 of file DefaultPreferencesFactory.php.

References as.

Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor().

◆ skinPreferences()

MediaWiki\Preferences\DefaultPreferencesFactory::skinPreferences ( User  $user,
IContextSource  $context,
$defaultPreferences 
)
protected

◆ submitForm()

MediaWiki\Preferences\DefaultPreferencesFactory::submitForm ( array  $formData,
HTMLForm  $form,
array  $formDescriptor 
)
protected

◆ validateSignature()

MediaWiki\Preferences\DefaultPreferencesFactory::validateSignature (   $signature,
  $alldata,
HTMLForm  $form 
)
protected
Parameters
string$signature
array$alldata
HTMLForm$form
Returns
bool|string

Definition at line 1442 of file DefaultPreferencesFactory.php.

References Xml\element(), MediaWiki\MediaWikiServices\getInstance(), ContextSource\msg(), and options().

Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences().

◆ watchlistPreferences()

MediaWiki\Preferences\DefaultPreferencesFactory::watchlistPreferences ( User  $user,
IContextSource  $context,
$defaultPreferences 
)
protected

Member Data Documentation

◆ $authManager

AuthManager MediaWiki\Preferences\DefaultPreferencesFactory::$authManager
protected

◆ $constructorOptions

array MediaWiki\Preferences\DefaultPreferencesFactory::$constructorOptions
static
Initial value:
= [
'AllowUserCss',
'AllowUserCssPrefs',
'AllowUserJs',
'DefaultSkin',
'DisableLangConversion',
'EmailAuthentication',
'EmailConfirmToEdit',
'EnableEmail',
'EnableUserEmail',
'EnableUserEmailBlacklist',
'EnotifMinorEdits',
'EnotifRevealEditorAddress',
'EnotifUserTalk',
'EnotifWatchlist',
'HiddenPrefs',
'ImageLimits',
'LanguageCode',
'LocalTZoffset',
'MaxSigChars',
'RCMaxAge',
'RCShowWatchingUsers',
'RCWatchCategoryMembership',
'SecureLogin',
'ThumbLimits',
]

TODO Make this a const when we drop HHVM support (T192166)

Since
1.34

Definition at line 86 of file DefaultPreferencesFactory.php.

◆ $contLang

Language MediaWiki\Preferences\DefaultPreferencesFactory::$contLang
protected

The wiki's content language.

Definition at line 69 of file DefaultPreferencesFactory.php.

Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\__construct().

◆ $linkRenderer

LinkRenderer MediaWiki\Preferences\DefaultPreferencesFactory::$linkRenderer
protected

◆ $nsInfo

NamespaceInfo MediaWiki\Preferences\DefaultPreferencesFactory::$nsInfo
protected

◆ $options

ServiceOptions MediaWiki\Preferences\DefaultPreferencesFactory::$options
protected

The documentation for this class was generated from the following file: