MediaWiki REL1_34
|
Context object that contains information about the state of a specific ResourceLoader web request. More...
Public Member Functions | |
__construct (ResourceLoader $resourceLoader, WebRequest $request) | |
encodeJson ( $data) | |
Wrapper around json_encode that avoids needless escapes, and pretty-prints in debug mode. | |
getConfig () | |
getContentOverrideCallback () | |
Return the replaced-content mapping callback. | |
getDebug () | |
getDirection () | |
getFormat () | |
getHash () | |
All factors that uniquely identify this request, except 'modules'. | |
getImage () | |
getImageObj () | |
If this is a request for an image, get the ResourceLoaderImage object. | |
getLanguage () | |
getLogger () | |
getModules () | |
getOnly () | |
getRaw () | |
getReqBase () | |
Get the request base parameters, omitting any defaults. | |
getRequest () | |
getResourceLoader () | |
getSkin () | |
getUser () | |
getUserObj () | |
Get the possibly-cached User object for the specified username. | |
getVariant () | |
getVersion () | |
msg ( $key,... $params) | |
Get a Message object with context set. | |
shouldIncludeMessages () | |
shouldIncludeScripts () | |
shouldIncludeStyles () | |
Static Public Member Functions | |
static | newDummyContext () |
Return a dummy ResourceLoaderContext object suitable for passing into things that don't "really" need a context. | |
Public Attributes | |
const | DEFAULT_LANG = 'qqx' |
const | DEFAULT_SKIN = 'fallback' |
Protected Attributes | |
$debug | |
$direction | |
$format | |
$hash | |
$image | |
ResourceLoaderImage false | $imageObj |
$language | |
$logger | |
$modules | |
$only | |
$raw | |
$request | |
$resourceLoader | |
$skin | |
$user | |
$userObj | |
$variant | |
$version | |
Context object that contains information about the state of a specific ResourceLoader web request.
Passed around to ResourceLoaderModule methods.
Definition at line 33 of file ResourceLoaderContext.php.
ResourceLoaderContext::__construct | ( | ResourceLoader | $resourceLoader, |
WebRequest | $request | ||
) |
ResourceLoader | $resourceLoader | |
WebRequest | $request |
Definition at line 66 of file ResourceLoaderContext.php.
References $modules, $request, $resourceLoader, and DEFAULT_SKIN.
ResourceLoaderContext::encodeJson | ( | $data | ) |
Wrapper around json_encode that avoids needless escapes, and pretty-prints in debug mode.
Definition at line 433 of file ResourceLoaderContext.php.
References getDebug().
Referenced by ResourceLoaderClientHtml\makeLoad().
ResourceLoaderContext::getConfig | ( | ) |
Definition at line 134 of file ResourceLoaderContext.php.
References getResourceLoader(), and wfDeprecated().
ResourceLoaderContext::getContentOverrideCallback | ( | ) |
Return the replaced-content mapping callback.
When editing a page that's used to generate the scripts or styles of a ResourceLoaderWikiModule, a preview should use the to-be-saved version of the page rather than the current version in the database. A context supporting such previews should return a callback to return these mappings here.
Content|null func( Title $t )
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 349 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderClientHtml\makeContext().
ResourceLoaderContext::getDebug | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 254 of file ResourceLoaderContext.php.
References $debug.
Referenced by encodeJson(), getHash(), getReqBase(), and ResourceLoaderClientHtml\makeLoad().
ResourceLoaderContext::getDirection | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 185 of file ResourceLoaderContext.php.
References $direction, getLanguage(), and getRequest().
ResourceLoaderContext::getFormat | ( | ) |
Definition at line 298 of file ResourceLoaderContext.php.
References $format.
Referenced by getHash().
ResourceLoaderContext::getHash | ( | ) |
All factors that uniquely identify this request, except 'modules'.
The list of modules is excluded here for legacy reasons as most callers already split up handling of individual modules. Including it here would massively fragment the cache and decrease its usefulness.
E.g. Used by RequestFileCache to form a cache key for storing the reponse output.
Definition at line 385 of file ResourceLoaderContext.php.
References $hash, getDebug(), getFormat(), getImage(), getLanguage(), getOnly(), getRaw(), getSkin(), getUser(), getVariant(), and getVersion().
ResourceLoaderContext::getImage | ( | ) |
Definition at line 284 of file ResourceLoaderContext.php.
References $image.
Referenced by getHash().
ResourceLoaderContext::getImageObj | ( | ) |
If this is a request for an image, get the ResourceLoaderImage object.
Definition at line 308 of file ResourceLoaderContext.php.
References $image, $imageObj, $modules, ResourceLoaderImage\getModule(), getModules(), and getResourceLoader().
ResourceLoaderContext::getLanguage | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 166 of file ResourceLoaderContext.php.
References $lang, $language, DEFAULT_LANG, and getRequest().
Referenced by getDirection(), ResourceLoaderFileModule\getFileHashes(), getHash(), ResourceLoaderModule\getMessageBlob(), getReqBase(), ResourceLoaderFileModule\getScriptFiles(), and msg().
ResourceLoaderContext::getLogger | ( | ) |
Definition at line 152 of file ResourceLoaderContext.php.
References $logger.
ResourceLoaderContext::getModules | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 159 of file ResourceLoaderContext.php.
References $modules.
Referenced by getImageObj().
ResourceLoaderContext::getOnly | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 261 of file ResourceLoaderContext.php.
References $only.
Referenced by getHash(), shouldIncludeMessages(), shouldIncludeScripts(), and shouldIncludeStyles().
ResourceLoaderContext::getRaw | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 277 of file ResourceLoaderContext.php.
References $raw.
Referenced by getHash(), and ResourceLoaderClientHtml\makeLoad().
ResourceLoaderContext::getReqBase | ( | ) |
Get the request base parameters, omitting any defaults.
Definition at line 411 of file ResourceLoaderContext.php.
References getDebug(), getLanguage(), and getSkin().
ResourceLoaderContext::getRequest | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 142 of file ResourceLoaderContext.php.
References $request.
Referenced by getDirection(), getLanguage(), and ResourceLoaderClientHtml\makeContext().
ResourceLoaderContext::getResourceLoader | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 124 of file ResourceLoaderContext.php.
References $resourceLoader.
Referenced by ResourceLoaderClientHtml\__construct(), getConfig(), getImageObj(), ResourceLoaderClientHtml\makeContext(), and ResourceLoaderClientHtml\makeLoad().
ResourceLoaderContext::getSkin | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 201 of file ResourceLoaderContext.php.
References $skin.
Referenced by getHash(), and getReqBase().
ResourceLoaderContext::getUser | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 208 of file ResourceLoaderContext.php.
References $user.
Referenced by getHash(), and getUserObj().
ResourceLoaderContext::getUserObj | ( | ) |
Get the possibly-cached User object for the specified username.
Definition at line 236 of file ResourceLoaderContext.php.
References $userObj, getUser(), and User\newFromName().
ResourceLoaderContext::getVariant | ( | ) |
Definition at line 291 of file ResourceLoaderContext.php.
References $variant.
Referenced by getHash().
ResourceLoaderContext::getVersion | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 270 of file ResourceLoaderContext.php.
References $version.
Referenced by getHash().
ResourceLoaderContext::msg | ( | $key, | |
$params | |||
) |
Get a Message object with context set.
See wfMessage for parameters.
string | string[] | MessageSpecifier | $key | Message key, or array of keys, or a MessageSpecifier. |
mixed | ...$params |
Implements MessageLocalizer.
Definition at line 221 of file ResourceLoaderContext.php.
References getLanguage(), and wfMessage().
|
static |
Return a dummy ResourceLoaderContext object suitable for passing into things that don't "really" need a context.
Use cases:
Definition at line 109 of file ResourceLoaderContext.php.
ResourceLoaderContext::shouldIncludeMessages | ( | ) |
ResourceLoaderContext::shouldIncludeScripts | ( | ) |
ResourceLoaderContext::shouldIncludeStyles | ( | ) |
|
protected |
Definition at line 44 of file ResourceLoaderContext.php.
Referenced by getDebug().
|
protected |
Definition at line 56 of file ResourceLoaderContext.php.
Referenced by getDirection().
|
protected |
Definition at line 54 of file ResourceLoaderContext.php.
Referenced by getFormat().
|
protected |
Definition at line 57 of file ResourceLoaderContext.php.
Referenced by getHash().
|
protected |
Definition at line 52 of file ResourceLoaderContext.php.
Referenced by getImage(), and getImageObj().
|
protected |
Definition at line 60 of file ResourceLoaderContext.php.
Referenced by getImageObj().
|
protected |
Definition at line 43 of file ResourceLoaderContext.php.
Referenced by getLanguage().
|
protected |
Definition at line 39 of file ResourceLoaderContext.php.
Referenced by getLogger().
|
protected |
Definition at line 48 of file ResourceLoaderContext.php.
Referenced by __construct(), getImageObj(), and getModules().
|
protected |
Definition at line 49 of file ResourceLoaderContext.php.
Referenced by getOnly().
|
protected |
Definition at line 51 of file ResourceLoaderContext.php.
Referenced by getRaw().
|
protected |
Definition at line 38 of file ResourceLoaderContext.php.
Referenced by __construct(), and getRequest().
|
protected |
Definition at line 37 of file ResourceLoaderContext.php.
Referenced by __construct(), and getResourceLoader().
|
protected |
Definition at line 42 of file ResourceLoaderContext.php.
Referenced by getSkin().
|
protected |
Definition at line 45 of file ResourceLoaderContext.php.
Referenced by getUser().
|
protected |
Definition at line 58 of file ResourceLoaderContext.php.
Referenced by getUserObj().
|
protected |
Definition at line 53 of file ResourceLoaderContext.php.
Referenced by getVariant().
|
protected |
Definition at line 50 of file ResourceLoaderContext.php.
Referenced by getVersion().
const ResourceLoaderContext::DEFAULT_LANG = 'qqx' |
Definition at line 34 of file ResourceLoaderContext.php.
Referenced by getLanguage().
const ResourceLoaderContext::DEFAULT_SKIN = 'fallback' |
Definition at line 35 of file ResourceLoaderContext.php.
Referenced by __construct().