MediaWiki REL1_39
|
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 Image object. | |
getLanguage () | |
getLogger () | |
getModules () | |
getOnly () | |
getRaw () | |
getReqBase () | |
Get the request base parameters, omitting any defaults. | |
getRequest () | |
getResourceLoader () | |
getSkin () | |
getUser () | |
getUserIdentity () | |
Get the possibly-cached UserIdentity object for the specified username. | |
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 Context 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 |
string null | $direction |
string null | $format |
string null | $hash |
string null | $image |
Image false | $imageObj |
string | $language |
LoggerInterface | $logger |
string[] | $modules |
string null | $only |
bool | $raw |
WebRequest | $request |
ResourceLoader | $resourceLoader |
string | $skin |
string null | $user |
UserIdentity null false | $userIdentity = false |
User null | $userObj |
string null | $variant |
string null | $version |
Context object that contains information about the state of a specific ResourceLoader web request.
Passed around to Module methods.
Definition at line 46 of file Context.php.
MediaWiki\ResourceLoader\Context::__construct | ( | ResourceLoader | $resourceLoader, |
WebRequest | $request ) |
ResourceLoader | $resourceLoader | |
WebRequest | $request |
Definition at line 104 of file Context.php.
References MediaWiki\ResourceLoader\Context\$modules, MediaWiki\ResourceLoader\Context\$request, MediaWiki\ResourceLoader\Context\$resourceLoader, MediaWiki\ResourceLoader\Context\debugFromString(), MediaWiki\ResourceLoader\Context\DEFAULT_SKIN, MediaWiki\ResourceLoader\ResourceLoader\expandModuleNames(), WebRequest\getFuzzyBool(), MediaWiki\MediaWikiServices\getInstance(), MediaWiki\ResourceLoader\ResourceLoader\getLogger(), and WebRequest\getRawVal().
|
static |
string | null | $debug |
Definition at line 145 of file Context.php.
References MediaWiki\ResourceLoader\Context\DEBUG_LEGACY.
Referenced by MediaWiki\ResourceLoader\Context\__construct().
MediaWiki\ResourceLoader\Context::encodeJson | ( | $data | ) |
Wrapper around json_encode that avoids needless escapes, and pretty-prints in debug mode.
mixed | $data |
Definition at line 493 of file Context.php.
Referenced by MediaWiki\ResourceLoader\Module\getDeprecationInformation(), MediaWiki\ResourceLoader\LanguageDataModule\getScript(), MediaWiki\ResourceLoader\UserOptionsModule\getScript(), MediaWiki\ResourceLoader\ClientHtml\makeLoad(), MediaWiki\ResourceLoader\ResourceLoader\makeModuleResponse(), and MediaWiki\ResourceLoader\ResourceLoader\respond().
MediaWiki\ResourceLoader\Context::getConfig | ( | ) |
Definition at line 190 of file Context.php.
References wfDeprecated().
MediaWiki\ResourceLoader\Context::getContentOverrideCallback | ( | ) |
Return the replaced-content mapping callback.
When editing a page that's used to generate the scripts or styles of a WikiModule, 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 MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 415 of file Context.php.
Referenced by MediaWiki\ResourceLoader\WikiModule\getContentObj(), MediaWiki\ResourceLoader\WikiModule\getTitleInfo(), and MediaWiki\ResourceLoader\WikiModule\shouldEmbedModule().
MediaWiki\ResourceLoader\Context::getDebug | ( | ) |
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 323 of file Context.php.
Referenced by MediaWiki\ResourceLoader\Module\buildContent(), MediaWiki\ResourceLoader\FileModule\getPackageFiles(), MediaWiki\ResourceLoader\Module\getVersionHash(), MediaWiki\ResourceLoader\ClientHtml\makeLoad(), MediaWiki\ResourceLoader\ResourceLoader\makeModuleResponse(), MediaWiki\ResourceLoader\ResourceLoader\respond(), MediaWiki\ResourceLoader\ResourceLoader\tryRespondFromFileCache(), and MediaWiki\ResourceLoader\ResourceLoader\tryRespondNotModified().
MediaWiki\ResourceLoader\Context::getDirection | ( | ) |
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 232 of file Context.php.
Referenced by MediaWiki\ResourceLoader\FileModule\getFlip(), MediaWiki\ResourceLoader\Module\getFlip(), MediaWiki\ResourceLoader\Image\getPath(), and MediaWiki\ResourceLoader\CodexModule\getStyleFiles().
MediaWiki\ResourceLoader\Context::getFormat | ( | ) |
Definition at line 364 of file Context.php.
Referenced by MediaWiki\ResourceLoader\Image\getImageData().
MediaWiki\ResourceLoader\Context::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 response output.
Definition at line 442 of file Context.php.
References getUser().
Referenced by MediaWiki\ResourceLoader\Module\getModuleContent(), MediaWiki\ResourceLoader\FileModule\getPackageFiles(), and MediaWiki\ResourceLoader\Module\getVersionHash().
MediaWiki\ResourceLoader\Context::getImage | ( | ) |
Definition at line 350 of file Context.php.
MediaWiki\ResourceLoader\Context::getImageObj | ( | ) |
If this is a request for an image, get the Image object.
Definition at line 374 of file Context.php.
References $modules.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\makeModuleResponse(), and MediaWiki\ResourceLoader\ResourceLoader\respond().
MediaWiki\ResourceLoader\Context::getLanguage | ( | ) |
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 213 of file Context.php.
References $lang.
Referenced by MediaWiki\ResourceLoader\Module\getMessageBlob(), MediaWiki\ResourceLoader\Image\getPath(), MediaWiki\ResourceLoader\LanguageDataModule\getScript(), MediaWiki\ResourceLoader\SkinModule\getStyles(), MediaWiki\ResourceLoader\Image\getUrl(), MediaWiki\ResourceLoader\Module\getVary(), and MediaWiki\ResourceLoader\ResourceLoader\preloadModuleInfo().
MediaWiki\ResourceLoader\Context::getLogger | ( | ) |
Definition at line 205 of file Context.php.
MediaWiki\ResourceLoader\Context::getModules | ( | ) |
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 209 of file Context.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\respond().
MediaWiki\ResourceLoader\Context::getOnly | ( | ) |
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 330 of file Context.php.
Referenced by MediaWiki\ResourceLoader\Module\buildContent(), and MediaWiki\ResourceLoader\ResourceLoader\makeModuleResponse().
MediaWiki\ResourceLoader\Context::getRaw | ( | ) |
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 343 of file Context.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\makeModuleResponse().
MediaWiki\ResourceLoader\Context::getReqBase | ( | ) |
Get the request base parameters, omitting any defaults.
Definition at line 468 of file Context.php.
MediaWiki\ResourceLoader\Context::getRequest | ( | ) |
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 195 of file Context.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\respond(), and MediaWiki\ResourceLoader\ResourceLoader\tryRespondNotModified().
MediaWiki\ResourceLoader\Context::getResourceLoader | ( | ) |
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 180 of file Context.php.
Referenced by MediaWiki\ResourceLoader\ClientHtml\__construct(), MediaWiki\ResourceLoader\FileModule\compileLessString(), MediaWiki\ResourceLoader\Image\getImageData(), MediaWiki\ResourceLoader\Module\getMessageBlob(), MediaWiki\ResourceLoader\FileModule\getScriptURLsForDebug(), MediaWiki\ResourceLoader\Module\getScriptURLsForDebug(), MediaWiki\ResourceLoader\Module\getStyleURLsForDebug(), MediaWiki\ResourceLoader\Image\getUrl(), MediaWiki\ResourceLoader\ClientHtml\makeLoad(), and MediaWiki\ResourceLoader\WikiModule\preloadTitleInfo().
MediaWiki\ResourceLoader\Context::getSkin | ( | ) |
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 246 of file Context.php.
Referenced by MediaWiki\ResourceLoader\FileModule\compileLessString(), MediaWiki\ResourceLoader\SiteModule\getPages(), MediaWiki\ResourceLoader\SiteStylesModule\getPages(), MediaWiki\ResourceLoader\UserModule\getPages(), MediaWiki\ResourceLoader\UserStylesModule\getPages(), MediaWiki\ResourceLoader\FileModule\getStyleFiles(), MediaWiki\ResourceLoader\Image\getUrl(), and MediaWiki\ResourceLoader\Module\getVary().
MediaWiki\ResourceLoader\Context::getUser | ( | ) |
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 253 of file Context.php.
MediaWiki\ResourceLoader\Context::getUserIdentity | ( | ) |
Get the possibly-cached UserIdentity object for the specified username.
This will be null on most requests, except for load.php requests that have a 'user' parameter set.
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 286 of file Context.php.
References getUser().
Referenced by MediaWiki\ResourceLoader\UserModule\getPages(), and MediaWiki\ResourceLoader\UserStylesModule\getPages().
MediaWiki\ResourceLoader\Context::getUserObj | ( | ) |
Get the possibly-cached User object for the specified username.
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 308 of file Context.php.
References getUser(), and User\newFromName().
Referenced by MediaWiki\ResourceLoader\UserOptionsModule\getScript().
MediaWiki\ResourceLoader\Context::getVariant | ( | ) |
Definition at line 357 of file Context.php.
Referenced by MediaWiki\ResourceLoader\Image\getImageData().
MediaWiki\ResourceLoader\Context::getVersion | ( | ) |
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 339 of file Context.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\tryRespondFromFileCache().
MediaWiki\ResourceLoader\Context::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 266 of file Context.php.
|
static |
Return a dummy Context object suitable for passing into things that don't "really" need a context.
Use cases:
Definition at line 168 of file Context.php.
MediaWiki\ResourceLoader\Context::shouldIncludeMessages | ( | ) |
Definition at line 427 of file Context.php.
MediaWiki\ResourceLoader\Context::shouldIncludeScripts | ( | ) |
Definition at line 419 of file Context.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\makeModuleResponse(), and MediaWiki\ResourceLoader\ResourceLoader\respond().
MediaWiki\ResourceLoader\Context::shouldIncludeStyles | ( | ) |
Definition at line 423 of file Context.php.
|
protected |
Definition at line 69 of file Context.php.
|
protected |
Definition at line 90 of file Context.php.
|
protected |
Definition at line 87 of file Context.php.
|
protected |
Definition at line 92 of file Context.php.
|
protected |
Definition at line 83 of file Context.php.
|
protected |
Definition at line 98 of file Context.php.
|
protected |
Definition at line 67 of file Context.php.
|
protected |
Definition at line 61 of file Context.php.
|
protected |
Definition at line 75 of file Context.php.
Referenced by MediaWiki\ResourceLoader\Context\__construct().
|
protected |
Definition at line 77 of file Context.php.
|
protected |
Definition at line 81 of file Context.php.
|
protected |
Definition at line 59 of file Context.php.
Referenced by MediaWiki\ResourceLoader\Context\__construct().
|
protected |
Definition at line 57 of file Context.php.
Referenced by MediaWiki\ResourceLoader\Context\__construct().
|
protected |
Definition at line 65 of file Context.php.
|
protected |
Definition at line 71 of file Context.php.
|
protected |
Definition at line 96 of file Context.php.
|
protected |
Definition at line 94 of file Context.php.
|
protected |
Definition at line 85 of file Context.php.
|
protected |
Definition at line 79 of file Context.php.
const MediaWiki\ResourceLoader\Context::DEBUG_LEGACY = 1 |
Definition at line 53 of file Context.php.
Referenced by MediaWiki\ResourceLoader\Context\debugFromString().
const MediaWiki\ResourceLoader\Context::DEBUG_OFF = 0 |
Definition at line 51 of file Context.php.
const MediaWiki\ResourceLoader\Context::DEFAULT_LANG = 'qqx' |
Definition at line 47 of file Context.php.
const MediaWiki\ResourceLoader\Context::DEFAULT_SKIN = 'fallback' |
Definition at line 48 of file Context.php.
Referenced by MediaWiki\ResourceLoader\Context\__construct().