MediaWiki REL1_37
|
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 | debugFromString (?string $debug) |
static | newDummyContext () |
Return a dummy ResourceLoaderContext object suitable for passing into things that don't "really" need a context. | |
Public Attributes | |
const | DEBUG_LEGACY = 1 |
const | DEBUG_OFF = 0 |
const | DEFAULT_LANG = 'qqx' |
const | DEFAULT_SKIN = 'fallback' |
Protected Attributes | |
int | $debug |
$direction | |
$format | |
$hash | |
$image | |
ResourceLoaderImage false | $imageObj |
$language | |
$logger | |
$modules | |
$only | |
$raw | |
$request | |
$resourceLoader | |
$skin | |
$user | |
$userObj | |
$variant | |
$version | |
Private Attributes | |
const | DEBUG_MAIN = 2 |
Context object that contains information about the state of a specific ResourceLoader web request.
Passed around to ResourceLoaderModule methods.
Definition at line 34 of file ResourceLoaderContext.php.
ResourceLoaderContext::__construct | ( | ResourceLoader | $resourceLoader, |
WebRequest | $request | ||
) |
ResourceLoader | $resourceLoader | |
WebRequest | $request |
Definition at line 74 of file ResourceLoaderContext.php.
References $modules, ResourceLoader\expandModuleNames(), WebRequest\getFuzzyBool(), ResourceLoader\getLogger(), and WebRequest\getRawVal().
|
static |
string | null | $debug |
Definition at line 115 of file ResourceLoaderContext.php.
ResourceLoaderContext::encodeJson | ( | $data | ) |
Wrapper around json_encode that avoids needless escapes, and pretty-prints in debug mode.
mixed | $data |
Definition at line 432 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 160 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 357 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderWikiModule\getContentObj(), ResourceLoaderWikiModule\getTitleInfo(), and ResourceLoaderWikiModule\shouldEmbedModule().
ResourceLoaderContext::getDebug | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 265 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 201 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderFileModule\getFlip(), ResourceLoaderModule\getFlip(), and ResourceLoaderImage\getPath().
ResourceLoaderContext::getFormat | ( | ) |
Definition at line 306 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 384 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderFileModule\expandPackageFiles(), ResourceLoaderModule\getModuleContent(), ResourceLoaderFileModule\getPackageFiles(), ResourceLoaderModule\getVersionHash(), and ResourceFileCache\newFromContext().
ResourceLoaderContext::getImage | ( | ) |
Definition at line 292 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 316 of file ResourceLoaderContext.php.
References $modules.
Referenced by ResourceLoader\makeModuleResponse(), and ResourceLoader\respond().
ResourceLoaderContext::getLanguage | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 183 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 175 of file ResourceLoaderContext.php.
ResourceLoaderContext::getModules | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 179 of file ResourceLoaderContext.php.
Referenced by ResourceFileCache\newFromContext(), and ResourceLoader\respond().
ResourceLoaderContext::getOnly | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 272 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderModule\buildContent(), ResourceLoader\makeModuleResponse(), and ResourceFileCache\newFromContext().
ResourceLoaderContext::getRaw | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 285 of file ResourceLoaderContext.php.
Referenced by ResourceLoader\makeModuleResponse().
ResourceLoaderContext::getReqBase | ( | ) |
Get the request base parameters, omitting any defaults.
Definition at line 410 of file ResourceLoaderContext.php.
ResourceLoaderContext::getRequest | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 165 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 150 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 215 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderFileModule\compileLessString(), 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 222 of file ResourceLoaderContext.php.
ResourceLoaderContext::getUserObj | ( | ) |
Get the possibly-cached User object for the specified username.
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 250 of file ResourceLoaderContext.php.
References User\newFromName().
Referenced by ResourceLoaderUserModule\getPages(), ResourceLoaderUserStylesModule\getPages(), and ResourceLoaderUserOptionsModule\getScript().
ResourceLoaderContext::getVariant | ( | ) |
Definition at line 299 of file ResourceLoaderContext.php.
Referenced by ResourceLoaderImage\getImageData().
ResourceLoaderContext::getVersion | ( | ) |
Reimplemented in DerivativeResourceLoaderContext.
Definition at line 281 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 235 of file ResourceLoaderContext.php.
Referenced by ChangesListSpecialPage\getChangeTagList().
|
static |
Return a dummy ResourceLoaderContext object suitable for passing into things that don't "really" need a context.
Use cases:
Definition at line 138 of file ResourceLoaderContext.php.
ResourceLoaderContext::shouldIncludeMessages | ( | ) |
Definition at line 369 of file ResourceLoaderContext.php.
ResourceLoaderContext::shouldIncludeScripts | ( | ) |
Definition at line 361 of file ResourceLoaderContext.php.
Referenced by ResourceLoader\makeModuleResponse(), and ResourceLoader\respond().
ResourceLoaderContext::shouldIncludeStyles | ( | ) |
Definition at line 365 of file ResourceLoaderContext.php.
|
protected |
Definition at line 52 of file ResourceLoaderContext.php.
|
protected |
Definition at line 64 of file ResourceLoaderContext.php.
|
protected |
Definition at line 62 of file ResourceLoaderContext.php.
|
protected |
Definition at line 65 of file ResourceLoaderContext.php.
|
protected |
Definition at line 60 of file ResourceLoaderContext.php.
|
protected |
Definition at line 68 of file ResourceLoaderContext.php.
|
protected |
Definition at line 50 of file ResourceLoaderContext.php.
|
protected |
Definition at line 46 of file ResourceLoaderContext.php.
|
protected |
Definition at line 56 of file ResourceLoaderContext.php.
|
protected |
Definition at line 57 of file ResourceLoaderContext.php.
|
protected |
Definition at line 59 of file ResourceLoaderContext.php.
|
protected |
Definition at line 45 of file ResourceLoaderContext.php.
|
protected |
Definition at line 44 of file ResourceLoaderContext.php.
|
protected |
Definition at line 49 of file ResourceLoaderContext.php.
|
protected |
Definition at line 53 of file ResourceLoaderContext.php.
|
protected |
Definition at line 66 of file ResourceLoaderContext.php.
|
protected |
Definition at line 61 of file ResourceLoaderContext.php.
|
protected |
Definition at line 58 of file ResourceLoaderContext.php.
const ResourceLoaderContext::DEBUG_LEGACY = 1 |
Definition at line 41 of file ResourceLoaderContext.php.
|
private |
Definition at line 42 of file ResourceLoaderContext.php.
const ResourceLoaderContext::DEBUG_OFF = 0 |
Definition at line 39 of file ResourceLoaderContext.php.
const ResourceLoaderContext::DEFAULT_LANG = 'qqx' |
Definition at line 35 of file ResourceLoaderContext.php.
const ResourceLoaderContext::DEFAULT_SKIN = 'fallback' |
Definition at line 36 of file ResourceLoaderContext.php.