MediaWiki REL1_35
|
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, ResourceLoader\expandModuleNames(), WebRequest\getFuzzyBool(), ResourceLoader\getLogger(), and WebRequest\getRawVal().
ResourceLoaderContext::encodeJson | ( | $data | ) |
Wrapper around json_encode that avoids needless escapes, and pretty-prints in debug mode.
Definition at line 403 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderModule\getDeprecationInformation(), ResourceLoaderLanguageDataModule\getScript(), ResourceLoaderUserDefaultsModule\getScript(), ResourceLoaderUserOptionsModule\getScript(), ResourceLoaderClientHtml\makeLoad(), ResourceLoader\makeModuleResponse(), and ResourceLoader\respond().
ResourceLoaderContext::getConfig | ( | ) |
Definition at line 131 of file ResourceLoaderContext.php.
References 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 328 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderWikiModule\getContentObj(), ResourceLoaderWikiModule\getTitleInfo(), and ResourceLoaderWikiModule\shouldEmbedModule().
ResourceLoaderContext::getDebug | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 236 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderModule\buildContent(), ResourceLoaderFileModule\getFileHashes(), ResourceLoaderFileModule\getPackageFiles(), ResourceLoaderFileModule\getScriptFiles(), ResourceLoaderClientHtml\makeLoad(), ResourceLoader\makeModuleResponse(), ResourceLoader\respond(), ResourceLoader\tryRespondFromFileCache(), and ResourceLoader\tryRespondNotModified().
ResourceLoaderContext::getDirection | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 172 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderFileModule\getFlip(), ResourceLoaderModule\getFlip(), and ResourceLoaderImage\getPath().
ResourceLoaderContext::getFormat | ( | ) |
Definition at line 277 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderImage\getImageData().
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 355 of file ResourceLoaderContext.php.
References getUser().
Referenced by ResourceLoaderFileModule\expandPackageFiles(), ResourceLoaderModule\getModuleContent(), ResourceLoaderFileModule\getPackageFiles(), ResourceLoaderModule\getVersionHash(), and ResourceFileCache\newFromContext().
ResourceLoaderContext::getImage | ( | ) |
Definition at line 263 of file ResourceLoaderContext.php.
Referenced by ResourceFileCache\newFromContext().
ResourceLoaderContext::getImageObj | ( | ) |
If this is a request for an image, get the ResourceLoaderImage object.
Definition at line 287 of file ResourceLoaderContext.php.
References $modules.
Referenced by ResourceLoader\makeModuleResponse(), and ResourceLoader\respond().
ResourceLoaderContext::getLanguage | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 154 of file ResourceLoaderContext.php.
References $lang.
Referenced by ChangesListSpecialPage\getChangeTagList(), ChangesListSpecialPage\getChangeTagListSummary(), ResourceLoaderFileModule\getFileHashes(), ResourceLoaderModule\getMessageBlob(), ResourceLoaderImage\getPath(), ResourceLoaderLanguageDataModule\getScript(), ResourceLoaderFileModule\getScriptFiles(), ResourceLoaderImage\getUrl(), ResourceLoaderModule\getVary(), and ResourceLoader\preloadModuleInfo().
ResourceLoaderContext::getLogger | ( | ) |
Definition at line 146 of file ResourceLoaderContext.php.
ResourceLoaderContext::getModules | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 150 of file ResourceLoaderContext.php.
Referenced by ResourceLoader\makeVersionQuery(), ResourceFileCache\newFromContext(), and ResourceLoader\respond().
ResourceLoaderContext::getOnly | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 243 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderModule\buildContent(), ResourceLoader\makeModuleResponse(), and ResourceFileCache\newFromContext().
ResourceLoaderContext::getRaw | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 256 of file ResourceLoaderContext.php.
Referenced by ResourceLoader\makeModuleResponse().
ResourceLoaderContext::getReqBase | ( | ) |
Get the request base parameters, omitting any defaults.
Definition at line 381 of file ResourceLoaderContext.php.
ResourceLoaderContext::getRequest | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 136 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderUserModule\getPages(), ResourceLoaderUserStylesModule\getPages(), ResourceLoader\respond(), ResourceLoader\tryRespondNotModified(), and ResourceFileCache\useFileCache().
ResourceLoaderContext::getResourceLoader | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 121 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderClientHtml\__construct(), ResourceLoaderFileModule\compileLessString(), ResourceLoaderModule\getMessageBlob(), ResourceLoaderModule\getScriptURLsForDebug(), ResourceLoaderModule\getStyleURLsForDebug(), ResourceLoaderImage\getUrl(), ResourceLoaderClientHtml\makeLoad(), and ResourceLoaderWikiModule\preloadTitleInfo().
ResourceLoaderContext::getSkin | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 186 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderFileModule\getFileHashes(), ResourceLoaderSiteModule\getPages(), ResourceLoaderSiteStylesModule\getPages(), ResourceLoaderUserModule\getPages(), ResourceLoaderUserStylesModule\getPages(), ResourceLoaderFileModule\getScriptFiles(), ResourceLoaderFileModule\getStyleFiles(), ResourceLoaderImage\getUrl(), and ResourceLoaderModule\getVary().
ResourceLoaderContext::getUser | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 193 of file ResourceLoaderContext.php.
ResourceLoaderContext::getUserObj | ( | ) |
Get the possibly-cached User object for the specified username.
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 221 of file ResourceLoaderContext.php.
References getUser(), and User\newFromName().
Referenced by ResourceLoaderUserModule\getPages(), ResourceLoaderUserStylesModule\getPages(), and ResourceLoaderUserOptionsModule\getScript().
ResourceLoaderContext::getVariant | ( | ) |
Definition at line 270 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderImage\getImageData().
ResourceLoaderContext::getVersion | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 252 of file ResourceLoaderContext.php.
Referenced by ResourceLoader\tryRespondFromFileCache().
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 206 of file ResourceLoaderContext.php.
|
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 | ( | ) |
Definition at line 340 of file ResourceLoaderContext.php.
ResourceLoaderContext::shouldIncludeScripts | ( | ) |
Definition at line 332 of file ResourceLoaderContext.php.
Referenced by ResourceLoader\makeModuleResponse(), and ResourceLoader\respond().
ResourceLoaderContext::shouldIncludeStyles | ( | ) |
Definition at line 336 of file ResourceLoaderContext.php.
|
protected |
Definition at line 44 of file ResourceLoaderContext.php.
|
protected |
Definition at line 56 of file ResourceLoaderContext.php.
|
protected |
Definition at line 54 of file ResourceLoaderContext.php.
|
protected |
Definition at line 57 of file ResourceLoaderContext.php.
|
protected |
Definition at line 52 of file ResourceLoaderContext.php.
|
protected |
Definition at line 60 of file ResourceLoaderContext.php.
|
protected |
Definition at line 43 of file ResourceLoaderContext.php.
|
protected |
Definition at line 39 of file ResourceLoaderContext.php.
|
protected |
Definition at line 48 of file ResourceLoaderContext.php.
|
protected |
Definition at line 49 of file ResourceLoaderContext.php.
|
protected |
Definition at line 51 of file ResourceLoaderContext.php.
|
protected |
Definition at line 38 of file ResourceLoaderContext.php.
|
protected |
Definition at line 37 of file ResourceLoaderContext.php.
|
protected |
Definition at line 42 of file ResourceLoaderContext.php.
|
protected |
Definition at line 45 of file ResourceLoaderContext.php.
|
protected |
Definition at line 58 of file ResourceLoaderContext.php.
|
protected |
Definition at line 53 of file ResourceLoaderContext.php.
|
protected |
Definition at line 50 of file ResourceLoaderContext.php.
const ResourceLoaderContext::DEFAULT_LANG = 'qqx' |
Definition at line 34 of file ResourceLoaderContext.php.
const ResourceLoaderContext::DEFAULT_SKIN = 'fallback' |
Definition at line 35 of file ResourceLoaderContext.php.