MediaWiki REL1_40
|
Context object that contains information about the state of a specific ResourceLoader web request. More...
Inherits MessageLocalizer.
Inherited by MediaWiki\ResourceLoader\DerivativeContext.
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_MAIN = 2 |
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 105 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 146 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 494 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 191 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 416 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 324 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 233 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 365 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 443 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 351 of file Context.php.
MediaWiki\ResourceLoader\Context::getImageObj | ( | ) |
If this is a request for an image, get the Image object.
Definition at line 375 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 214 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 206 of file Context.php.
MediaWiki\ResourceLoader\Context::getModules | ( | ) |
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 210 of file Context.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\respond().
MediaWiki\ResourceLoader\Context::getOnly | ( | ) |
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 331 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 344 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 469 of file Context.php.
MediaWiki\ResourceLoader\Context::getRequest | ( | ) |
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 196 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 181 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 247 of file Context.php.
Referenced by MediaWiki\ResourceLoader\FileModule\compileLessString(), MediaWiki\ResourceLoader\SiteStylesModule\getPages(), MediaWiki\ResourceLoader\UserModule\getPages(), MediaWiki\ResourceLoader\UserStylesModule\getPages(), MediaWiki\ResourceLoader\CodexModule\getStyleFiles(), 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 254 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 287 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 309 of file Context.php.
References getUser(), and User\newFromName().
Referenced by MediaWiki\ResourceLoader\UserOptionsModule\getScript().
MediaWiki\ResourceLoader\Context::getVariant | ( | ) |
Definition at line 358 of file Context.php.
Referenced by MediaWiki\ResourceLoader\Image\getImageData().
MediaWiki\ResourceLoader\Context::getVersion | ( | ) |
Reimplemented in MediaWiki\ResourceLoader\DerivativeContext.
Definition at line 340 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 267 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 169 of file Context.php.
MediaWiki\ResourceLoader\Context::shouldIncludeMessages | ( | ) |
Definition at line 428 of file Context.php.
MediaWiki\ResourceLoader\Context::shouldIncludeScripts | ( | ) |
Definition at line 420 of file Context.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\makeModuleResponse(), and MediaWiki\ResourceLoader\ResourceLoader\respond().
MediaWiki\ResourceLoader\Context::shouldIncludeStyles | ( | ) |
Definition at line 424 of file Context.php.
|
protected |
Definition at line 70 of file Context.php.
|
protected |
Definition at line 91 of file Context.php.
|
protected |
Definition at line 88 of file Context.php.
|
protected |
Definition at line 93 of file Context.php.
|
protected |
Definition at line 84 of file Context.php.
|
protected |
Definition at line 99 of file Context.php.
|
protected |
Definition at line 68 of file Context.php.
|
protected |
Definition at line 62 of file Context.php.
|
protected |
Definition at line 76 of file Context.php.
Referenced by MediaWiki\ResourceLoader\Context\__construct().
|
protected |
Definition at line 78 of file Context.php.
|
protected |
Definition at line 82 of file Context.php.
|
protected |
Definition at line 60 of file Context.php.
Referenced by MediaWiki\ResourceLoader\Context\__construct().
|
protected |
Definition at line 58 of file Context.php.
Referenced by MediaWiki\ResourceLoader\Context\__construct().
|
protected |
Definition at line 66 of file Context.php.
|
protected |
Definition at line 72 of file Context.php.
|
protected |
Definition at line 97 of file Context.php.
|
protected |
Definition at line 95 of file Context.php.
|
protected |
Definition at line 86 of file Context.php.
|
protected |
Definition at line 80 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_MAIN = 2 |
Definition at line 55 of file Context.php.
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().