MediaWiki REL1_31
Preferences.php
Go to the documentation of this file.
1<?php
24
31
37 protected static function getDefaultPreferencesFactory() {
39 $authManager = AuthManager::singleton();
40 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
41 $config = MediaWikiServices::getInstance()->getMainConfig();
42 $preferencesFactory = new DefaultPreferencesFactory(
43 $config, $wgContLang, $authManager, $linkRenderer
44 );
45 return $preferencesFactory;
46 }
47
51 public static function getSaveBlacklist() {
52 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
53 }
54
61 public static function getPreferences( $user, IContextSource $context ) {
62 $preferencesFactory = self::getDefaultPreferencesFactory();
63 return $preferencesFactory->getFormDescriptor( $user, $context );
64 }
65
74 public static function loadPreferenceValues( $user, $context, &$defaultPreferences ) {
75 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
76 }
77
86 public static function getOptionFromUser( $name, $info, $user ) {
87 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
88 }
89
96 public static function profilePreferences(
97 $user, IContextSource $context, &$defaultPreferences
98 ) {
99 wfDeprecated( __METHOD__, '1.31' );
100 $defaultPreferences = self::getPreferences( $user, $context );
101 }
102
109 public static function skinPreferences( $user, IContextSource $context, &$defaultPreferences ) {
110 wfDeprecated( __METHOD__, '1.31' );
111 $defaultPreferences = self::getPreferences( $user, $context );
112 }
113
119 public static function filesPreferences(
120 $user, IContextSource $context, &$defaultPreferences
121 ) {
122 wfDeprecated( __METHOD__, '1.31' );
123 $defaultPreferences = self::getPreferences( $user, $context );
124 }
125
132 public static function datetimePreferences(
133 $user, IContextSource $context, &$defaultPreferences
134 ) {
135 wfDeprecated( __METHOD__, '1.31' );
136 $defaultPreferences = self::getPreferences( $user, $context );
137 }
138
144 public static function renderingPreferences(
145 $user, IContextSource $context, &$defaultPreferences
146 ) {
147 wfDeprecated( __METHOD__, '1.31' );
148 $defaultPreferences = self::getPreferences( $user, $context );
149 }
150
156 public static function editingPreferences(
157 $user, IContextSource $context, &$defaultPreferences
158 ) {
159 wfDeprecated( __METHOD__, '1.31' );
160 $defaultPreferences = self::getPreferences( $user, $context );
161 }
162
168 public static function rcPreferences( $user, IContextSource $context, &$defaultPreferences ) {
169 wfDeprecated( __METHOD__, '1.31' );
170 $defaultPreferences = self::getPreferences( $user, $context );
171 }
172
178 public static function watchlistPreferences(
179 $user, IContextSource $context, &$defaultPreferences
180 ) {
181 wfDeprecated( __METHOD__, '1.31' );
182 $defaultPreferences = self::getPreferences( $user, $context );
183 }
184
190 public static function searchPreferences(
191 $user, IContextSource $context, &$defaultPreferences
192 ) {
193 wfDeprecated( __METHOD__, '1.31' );
194 $defaultPreferences = self::getPreferences( $user, $context );
195 }
196
203 public static function miscPreferences( $user, IContextSource $context, &$defaultPreferences ) {
204 }
205
211 public static function generateSkinOptions( $user, IContextSource $context ) {
212 wfDeprecated( __METHOD__, '1.31' );
214 }
215
221 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
222 }
223
228 public static function getImageSizes( IContextSource $context ) {
229 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
230 }
231
236 public static function getThumbSizes( IContextSource $context ) {
237 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
238 }
239
246 public static function validateSignature( $signature, $alldata, $form ) {
247 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
248 }
249
256 public static function cleanSignature( $signature, $alldata, $form ) {
257 throw new Exception( __METHOD__ . '() is deprecated and does nothing now' );
258 }
259
267 public static function getFormObject(
268 $user,
270 $formClass = PreferencesForm::class,
271 array $remove = []
272 ) {
273 $preferencesFactory = self::getDefaultPreferencesFactory();
274 return $preferencesFactory->getForm( $user, $context, $formClass, $remove );
275 }
276
281 public static function getTimezoneOptions( IContextSource $context ) {
282 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
283 }
284
290 public static function filterIntval( $value, $alldata ) {
291 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
292 }
293
299 public static function filterTimezoneInput( $tz, $alldata ) {
300 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
301 }
302
312 public static function tryFormSubmit( $formData, $form ) {
313 $preferencesFactory = self::getDefaultPreferencesFactory();
314 return $preferencesFactory->legacySaveFormData( $formData, $form );
315 }
316
322 public static function tryUISubmit( $formData, $form ) {
323 $preferencesFactory = self::getDefaultPreferencesFactory();
324 return $preferencesFactory->legacySubmitForm( $formData, $form );
325 }
326
335 public static function getTimeZoneList( Language $language ) {
336 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
337 }
338}
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Internationalisation code.
Definition Language.php:35
This serves as the entry point to the authentication system.
MediaWikiServices is the service locator for the application scope of MediaWiki.
This is the default implementation of PreferencesFactory.
This class has been replaced by the PreferencesFactory service.
static getDefaultPreferencesFactory()
A shim to maintain backwards-compatibility of this class, basically replicating the default behaviour...
static getOptionFromUser( $name, $info, $user)
Pull option from a user account.
static searchPreferences( $user, IContextSource $context, &$defaultPreferences)
static rcPreferences( $user, IContextSource $context, &$defaultPreferences)
static filterIntval( $value, $alldata)
static generateSkinOptions( $user, IContextSource $context)
static loadPreferenceValues( $user, $context, &$defaultPreferences)
Loads existing values for a given array of preferences.
static getSaveBlacklist()
static tryUISubmit( $formData, $form)
static filesPreferences( $user, IContextSource $context, &$defaultPreferences)
static getImageSizes(IContextSource $context)
static getPreferences( $user, IContextSource $context)
static getTimeZoneList(Language $language)
Get a list of all time zones.
static watchlistPreferences( $user, IContextSource $context, &$defaultPreferences)
static datetimePreferences( $user, IContextSource $context, &$defaultPreferences)
static tryFormSubmit( $formData, $form)
Handle the form submission if everything validated properly.
static getDateOptions(IContextSource $context)
static miscPreferences( $user, IContextSource $context, &$defaultPreferences)
Dummy, kept for backwards-compatibility.
static profilePreferences( $user, IContextSource $context, &$defaultPreferences)
static getFormObject( $user, IContextSource $context, $formClass=PreferencesForm::class, array $remove=[])
static cleanSignature( $signature, $alldata, $form)
static renderingPreferences( $user, IContextSource $context, &$defaultPreferences)
static getTimezoneOptions(IContextSource $context)
static skinPreferences( $user, IContextSource $context, &$defaultPreferences)
static getThumbSizes(IContextSource $context)
static filterTimezoneInput( $tz, $alldata)
static validateSignature( $signature, $alldata, $form)
static editingPreferences( $user, IContextSource $context, &$defaultPreferences)
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
Definition design.txt:57
when a variable name is used in a it is silently declared as a new local masking the global
Definition design.txt:95
the array() calling protocol came about after MediaWiki 1.4rc1.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
Definition hooks.txt:2811
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form before processing starts Return false to skip default processing and return $ret $linkRenderer
Definition hooks.txt:2056
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
Definition hooks.txt:247
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition injection.txt:37
Interface for objects which can provide a MediaWiki context on request.