MediaWiki REL1_31
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 (Config $config, Language $contLang, AuthManager $authManager, LinkRenderer $linkRenderer)
 
 getForm (User $user, IContextSource $context, $formClass=PreferencesForm::class, array $remove=[])
 
 getFormDescriptor (User $user, IContextSource $context)
 
 getSaveBlacklist ()
 @inheritDoc
 
 legacySaveFormData ( $formData, PreferencesForm $form)
 DO NOT USE.
 
 legacySubmitForm (array $formData, PreferencesForm $form)
 DO NOT USE.
 

Protected Member Functions

 cleanSignature ( $signature, $alldata, HTMLForm $form)
 
 datetimePreferences ( $user, IContextSource $context, &$defaultPreferences)
 
 editingPreferences (User $user, MessageLocalizer $l10n, &$defaultPreferences)
 
 filesPreferences (IContextSource $context, &$defaultPreferences)
 
 filterTimezoneInput ( $tz, array $alldata)
 
 generateSkinOptions (User $user, IContextSource $context)
 
 getDateOptions (IContextSource $context)
 
 getImageSizes (MessageLocalizer $l10n)
 
 getOptionFromUser ( $name, $info, User $user)
 Pull option from a user account.
 
 getSaveFilters ()
 
 getThumbSizes (MessageLocalizer $l10n)
 
 getTimeZoneList (Language $language)
 Get a list of all time zones.
 
 getTimezoneOptions (IContextSource $context)
 
 profilePreferences (User $user, IContextSource $context, &$defaultPreferences, $canIPUseHTTPS)
 
 rcPreferences (User $user, MessageLocalizer $l10n, &$defaultPreferences)
 
 renderingPreferences (MessageLocalizer $l10n, &$defaultPreferences)
 
 saveFormData ( $formData, PreferencesForm $form)
 Handle the form submission if everything validated properly.
 
 searchPreferences (&$defaultPreferences)
 
 skinPreferences (User $user, IContextSource $context, &$defaultPreferences)
 
 submitForm (array $formData, PreferencesForm $form)
 Save the form data and reload the page.
 
 validateSignature ( $signature, $alldata, HTMLForm $form)
 
 watchlistPreferences (User $user, IContextSource $context, &$defaultPreferences)
 

Protected Attributes

AuthManager $authManager
 
Config $config
 
Language $contLang
 The wiki's content language, equivalent to $wgContLang.
 
LinkRenderer $linkRenderer
 

Private Member Functions

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

Detailed Description

This is the default implementation of PreferencesFactory.

Definition at line 61 of file DefaultPreferencesFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Preferences\DefaultPreferencesFactory::__construct ( Config $config,
Language $contLang,
AuthManager $authManager,
LinkRenderer $linkRenderer )

Member Function Documentation

◆ cleanSignature()

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

Definition at line 1397 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 885 of file DefaultPreferencesFactory.php.

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

◆ filesPreferences()

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

◆ filterTimezoneInput()

MediaWiki\Preferences\DefaultPreferencesFactory::filterTimezoneInput ( $tz,
array $alldata )
protected
Parameters
string$tz
array$alldata
Returns
string

Definition at line 1503 of file DefaultPreferencesFactory.php.

References $e.

◆ generateSkinOptions()

MediaWiki\Preferences\DefaultPreferencesFactory::generateSkinOptions ( User $user,
IContextSource $context )
protected
Parameters
User$userThe User object
IContextSource$context
Returns
array Text/links to display as key; $skinkey as value

Definition at line 1224 of file DefaultPreferencesFactory.php.

References $context, $ret, and Skin\getAllowedSkins().

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

◆ getDateOptions()

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

◆ getForm()

MediaWiki\Preferences\DefaultPreferencesFactory::getForm ( User $user,
IContextSource $context,
$formClass = PreferencesForm::class,
array $remove = [] )
Parameters
User$user
IContextSource$context
string$formClass
array$removeArray of items to remove
Returns
PreferencesForm|HTMLForm

Implements MediaWiki\Preferences\PreferencesFactory.

Definition at line 1416 of file DefaultPreferencesFactory.php.

References $context, MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor(), and MediaWiki\Preferences\DefaultPreferencesFactory\submitForm().

◆ getFormDescriptor()

◆ getImageSizes()

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

Definition at line 1337 of file DefaultPreferencesFactory.php.

References $ret.

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

◆ getOptionFromUser()

MediaWiki\Preferences\DefaultPreferencesFactory::getOptionFromUser ( $name,
$info,
User $user )
protected

Pull option from a user account.

Handles stuff like array-type preferences.

Parameters
string$name
array$info
User$user
Returns
array|string

Definition at line 208 of file DefaultPreferencesFactory.php.

References $name, $options, $rows, $value, and HTMLFormField\flattenOptions().

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

◆ getSaveBlacklist()

MediaWiki\Preferences\DefaultPreferencesFactory::getSaveBlacklist ( )

◆ getSaveFilters()

MediaWiki\Preferences\DefaultPreferencesFactory::getSaveFilters ( )
protected
Returns
callable[]

Definition at line 98 of file DefaultPreferencesFactory.php.

References $value.

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

◆ getThumbSizes()

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

Definition at line 1354 of file DefaultPreferencesFactory.php.

References $ret.

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

◆ 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 1691 of file DefaultPreferencesFactory.php.

References $value, and wfMessage().

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

◆ getTimezoneOptions()

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

◆ legacySaveFormData()

MediaWiki\Preferences\DefaultPreferencesFactory::legacySaveFormData ( $formData,
PreferencesForm $form )

DO NOT USE.

Temporary function to punch hole for the Preferences class.

Deprecated
since 1.31, its inception
Parameters
array$formData
PreferencesForm$form
Returns
bool|Status|string

Definition at line 1635 of file DefaultPreferencesFactory.php.

References MediaWiki\Preferences\DefaultPreferencesFactory\saveFormData().

◆ legacySubmitForm()

MediaWiki\Preferences\DefaultPreferencesFactory::legacySubmitForm ( array $formData,
PreferencesForm $form )

DO NOT USE.

Temporary function to punch hole for the Preferences class.

Deprecated
since 1.31, its inception
Parameters
array$formData
PreferencesForm$form
Returns
Status

Definition at line 1679 of file DefaultPreferencesFactory.php.

References MediaWiki\Preferences\DefaultPreferencesFactory\submitForm().

◆ loadPreferenceValues()

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

Loads existing values for a given array of preferences.

Exceptions
MWException
Parameters
User$user
IContextSource$context
array&$defaultPreferencesArray to load values for
Returns
array|null

Definition at line 156 of file DefaultPreferencesFactory.php.

References $context, $name, User\getDefaultOptions(), MediaWiki\Preferences\DefaultPreferencesFactory\getOptionFromUser(), and MediaWiki\Preferences\DefaultPreferencesFactory\getSaveBlacklist().

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

◆ profilePreferences()

MediaWiki\Preferences\DefaultPreferencesFactory::profilePreferences ( User $user,
IContextSource $context,
& $defaultPreferences,
$canIPUseHTTPS )
protected

◆ rcPreferences()

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

Definition at line 957 of file DefaultPreferencesFactory.php.

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

◆ renderingPreferences()

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

Definition at line 823 of file DefaultPreferencesFactory.php.

References $value.

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

◆ saveFormData()

MediaWiki\Preferences\DefaultPreferencesFactory::saveFormData ( $formData,
PreferencesForm $form )
protected

◆ searchPreferences()

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

Definition at line 1211 of file DefaultPreferencesFactory.php.

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

◆ skinPreferences()

MediaWiki\Preferences\DefaultPreferencesFactory::skinPreferences ( User $user,
IContextSource $context,
& $defaultPreferences )
protected
Parameters
User$user
IContextSource$context
array&$defaultPreferences
Returns
void

Definition at line 678 of file DefaultPreferencesFactory.php.

References $context, and MediaWiki\Preferences\DefaultPreferencesFactory\generateSkinOptions().

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

◆ submitForm()

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

◆ validateSignature()

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

Definition at line 1372 of file DefaultPreferencesFactory.php.

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

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

◆ $config

Config MediaWiki\Preferences\DefaultPreferencesFactory::$config
protected

◆ $contLang

Language MediaWiki\Preferences\DefaultPreferencesFactory::$contLang
protected

The wiki's content language, equivalent to $wgContLang.

Definition at line 68 of file DefaultPreferencesFactory.php.

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

◆ $linkRenderer

LinkRenderer MediaWiki\Preferences\DefaultPreferencesFactory::$linkRenderer
protected

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