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 (ServiceOptions $options, Language $contLang, AuthManager $authManager, LinkRenderer $linkRenderer, NamespaceInfo $nsInfo, PermissionManager $permissionManager, ILanguageConverter $languageConverter, LanguageNameUtils $languageNameUtils, HookContainer $hookContainer, UserOptionsLookup $userOptionsLookup, LanguageConverterFactory $languageConverterFactory=null, Parser $parser=null, SkinFactory $skinFactory=null, UserGroupManager $userGroupManager=null, SignatureValidatorFactory $signatureValidatorFactory=null, Config $config=null)
 
 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').
Returns
string[]
More...
 

Static Public Member Functions

static simplifyFormDescriptor (array $descriptor)
 Simplify form descriptor for validation or something similar. More...
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

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 $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)
 
 profilePreferences (User $user, IContextSource $context, &$defaultPreferences)
 
 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 ( $context, &$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...
 
LanguageNameUtils $languageNameUtils
 
LinkRenderer $linkRenderer
 
NamespaceInfo $nsInfo
 
ServiceOptions $options
 
PermissionManager $permissionManager
 

Detailed Description

This is the default implementation of PreferencesFactory.

Definition at line 69 of file DefaultPreferencesFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Preferences\DefaultPreferencesFactory::__construct ( ServiceOptions  $options,
Language  $contLang,
AuthManager  $authManager,
LinkRenderer  $linkRenderer,
NamespaceInfo  $nsInfo,
PermissionManager  $permissionManager,
ILanguageConverter  $languageConverter,
LanguageNameUtils  $languageNameUtils,
HookContainer  $hookContainer,
UserOptionsLookup  $userOptionsLookup,
LanguageConverterFactory  $languageConverterFactory = null,
Parser  $parser = null,
SkinFactory  $skinFactory = null,
UserGroupManager  $userGroupManager = null,
SignatureValidatorFactory  $signatureValidatorFactory = null,
Config  $config = null 
)
Parameters
ServiceOptions$options
Language$contLang
AuthManager$authManager
LinkRenderer$linkRenderer
NamespaceInfo$nsInfo
PermissionManager$permissionManager
ILanguageConverter$languageConverter
LanguageNameUtils$languageNameUtils
HookContainer$hookContainer
UserOptionsLookup$userOptionsLookupShould be an instance of UserOptionsManager
LanguageConverterFactory | null$languageConverterFactory
Parser | null$parser
SkinFactory | null$skinFactory
UserGroupManager | null$userGroupManager
SignatureValidatorFactory | null$signatureValidatorFactory
Config | null$config

Definition at line 172 of file DefaultPreferencesFactory.php.

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

Referenced by 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 1801 of file DefaultPreferencesFactory.php.

References Parser\cleanSigInSig().

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

◆ datetimePreferences()

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

◆ editingPreferences()

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

◆ filesPreferences()

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

◆ generateSkinOptions()

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

References MediaWiki\Preferences\DefaultPreferencesFactory\$options, and HTMLFormField\flattenOptions().

◆ getSaveBlacklist()

MediaWiki\Preferences\DefaultPreferencesFactory::getSaveBlacklist ( )

Get the names of preferences that should never be saved (such as 'realname' and 'emailaddress').

Returns
string[]

Implements MediaWiki\Preferences\PreferencesFactory.

Definition at line 230 of file DefaultPreferencesFactory.php.

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

◆ getThumbSizes()

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

◆ profilePreferences()

MediaWiki\Preferences\DefaultPreferencesFactory::profilePreferences ( User  $user,
IContextSource  $context,
$defaultPreferences 
)
protected
Todo:
Inject user Language instead of using context.
Parameters
User$user
IContextSource$context
array&$defaultPreferences
Returns
void

Definition at line 415 of file DefaultPreferencesFactory.php.

References $lang, LanguageConverter\$languagesWithVariants, MediaWiki\Preferences\DefaultPreferencesFactory\$options, $t, MediaWiki\MainConfigNames\AllowRequiringEmailForResets, MediaWiki\Languages\LanguageNameUtils\AUTONYMS, LanguageCode\bcp47(), MediaWiki\Preferences\DefaultPreferencesFactory\cleanSignature(), Html\element(), MediaWiki\MainConfigNames\EmailAuthentication, MediaWiki\MainConfigNames\EmailConfirmToEdit, MediaWiki\MainConfigNames\EnableEmail, MediaWiki\MainConfigNames\EnableUserEmail, MediaWiki\MainConfigNames\EnableUserEmailMuteList, MediaWiki\MainConfigNames\EnotifMinorEdits, MediaWiki\MainConfigNames\EnotifRevealEditorAddress, MediaWiki\MainConfigNames\EnotifUserTalk, MediaWiki\MainConfigNames\EnotifWatchlist, MediaWiki\MainConfigNames\ForceHTTPS, User\getEditCount(), User\getEmail(), User\getEmailAuthenticationTimestamp(), UserGroupMembership\getExpiry(), IContextSource\getLanguage(), UserGroupMembership\getLink(), User\getName(), IContextSource\getOutput(), User\getRealName(), User\getRegistration(), IContextSource\getRequest(), IContextSource\getTitle(), SpecialPage\getTitleFor(), User\getTitleKey(), IContextSource\getUser(), User\isAllowed(), MediaWiki\MainConfigNames\LanguageCode, MediaWiki\MainConfigNames\MaxSigChars, MessageLocalizer\msg(), ParserOptions\newFromContext(), Message\numParam(), MediaWiki\MainConfigNames\ScriptPath, MediaWiki\MainConfigNames\SecureLogin, MediaWiki\MainConfigNames\SignatureValidation, Parser\stripOuterParagraph(), MediaWiki\Languages\LanguageNameUtils\SUPPORTED, and MediaWiki\Preferences\DefaultPreferencesFactory\validateSignature().

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

◆ rcPreferences()

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

◆ renderingPreferences()

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

◆ saveFormData()

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

◆ searchPreferences()

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

◆ simplifyFormDescriptor()

static MediaWiki\Preferences\DefaultPreferencesFactory::simplifyFormDescriptor ( array  $descriptor)
static

Simplify form descriptor for validation or something similar.

Parameters
array$descriptorHTML form descriptor.
Returns
array

Definition at line 274 of file DefaultPreferencesFactory.php.

◆ skinPreferences()

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

◆ submitForm()

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

◆ validateSignature()

MediaWiki\Preferences\DefaultPreferencesFactory::validateSignature (   $signature,
  $alldata,
HTMLForm  $form 
)
protected

◆ watchlistPreferences()

Member Data Documentation

◆ $authManager

AuthManager MediaWiki\Preferences\DefaultPreferencesFactory::$authManager
protected

Definition at line 82 of file DefaultPreferencesFactory.php.

◆ $contLang

Language MediaWiki\Preferences\DefaultPreferencesFactory::$contLang
protected

The wiki's content language.

Definition at line 76 of file DefaultPreferencesFactory.php.

◆ $languageNameUtils

LanguageNameUtils MediaWiki\Preferences\DefaultPreferencesFactory::$languageNameUtils
protected

Definition at line 79 of file DefaultPreferencesFactory.php.

◆ $linkRenderer

LinkRenderer MediaWiki\Preferences\DefaultPreferencesFactory::$linkRenderer
protected

Definition at line 85 of file DefaultPreferencesFactory.php.

◆ $nsInfo

NamespaceInfo MediaWiki\Preferences\DefaultPreferencesFactory::$nsInfo
protected

Definition at line 88 of file DefaultPreferencesFactory.php.

◆ $options

◆ $permissionManager

PermissionManager MediaWiki\Preferences\DefaultPreferencesFactory::$permissionManager
protected

Definition at line 91 of file DefaultPreferencesFactory.php.

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Preferences\DefaultPreferencesFactory::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const HiddenPrefs
Name constant for the HiddenPrefs setting, for use with Config::get()
const ForceHTTPS
Name constant for the ForceHTTPS setting, for use with Config::get()
const EnotifWatchlist
Name constant for the EnotifWatchlist setting, for use with Config::get()
const MaxSigChars
Name constant for the MaxSigChars setting, for use with Config::get()
const RCMaxAge
Name constant for the RCMaxAge setting, for use with Config::get()
const DefaultSkin
Name constant for the DefaultSkin setting, for use with Config::get()
const EnableUserEmailMuteList
Name constant for the EnableUserEmailMuteList setting, for use with Config::get()
const EnotifRevealEditorAddress
Name constant for the EnotifRevealEditorAddress setting, for use with Config::get()
const EnableUserEmail
Name constant for the EnableUserEmail setting, for use with Config::get()
const EmailConfirmToEdit
Name constant for the EmailConfirmToEdit setting, for use with Config::get()
const EnableEmail
Name constant for the EnableEmail setting, for use with Config::get()
const LocalTZoffset
Name constant for the LocalTZoffset setting, for use with Config::get()
const RCShowWatchingUsers
Name constant for the RCShowWatchingUsers setting, for use with Config::get()
const EnotifUserTalk
Name constant for the EnotifUserTalk setting, for use with Config::get()
const AllowUserJs
Name constant for the AllowUserJs setting, for use with Config::get()
const ImageLimits
Name constant for the ImageLimits setting, for use with Config::get()
const SearchMatchRedirectPreference
Name constant for the SearchMatchRedirectPreference setting, for use with Config::get()
const EnotifMinorEdits
Name constant for the EnotifMinorEdits setting, for use with Config::get()
const ScriptPath
Name constant for the ScriptPath setting, for use with Config::get()
const AllowUserCss
Name constant for the AllowUserCss setting, for use with Config::get()
const AllowRequiringEmailForResets
Name constant for the AllowRequiringEmailForResets setting, for use with Config::get()
const ThumbLimits
Name constant for the ThumbLimits setting, for use with Config::get()
const SecureLogin
Name constant for the SecureLogin setting, for use with Config::get()
const LanguageCode
Name constant for the LanguageCode setting, for use with Config::get()
const SignatureValidation
Name constant for the SignatureValidation setting, for use with Config::get()
const AllowUserCssPrefs
Name constant for the AllowUserCssPrefs setting, for use with Config::get()
const RCWatchCategoryMembership
Name constant for the RCWatchCategoryMembership setting, for use with Config::get()
const EmailAuthentication
Name constant for the EmailAuthentication setting, for use with Config::get()
Access: internal
For use by ServiceWiring

Definition at line 123 of file DefaultPreferencesFactory.php.


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