MediaWiki  1.28.0
ResourceLoaderContext Class Reference

Object passed around to modules which contains information about the state of a specific loader request. More...

Inheritance diagram for ResourceLoaderContext:

Public Member Functions

 __construct (ResourceLoader $resourceLoader, WebRequest $request)
 
 getDebug ()
 
 getDirection ()
 
 getFormat ()
 
 getHash ()
 All factors that uniquely identify this request, except 'modules'. More...
 
 getImage ()
 
 getImageObj ()
 If this is a request for an image, get the ResourceLoaderImage object. More...
 
 getLanguage ()
 
 getLogger ()
 
 getModules ()
 
 getOnly ()
 
 getRaw ()
 
 getRequest ()
 
 getResourceLoader ()
 
 getSkin ()
 
 getUser ()
 
 getUserObj ()
 Get the possibly-cached User object for the specified username. More...
 
 getVariant ()
 
 getVersion ()
 
 msg ()
 Get a Message object with context set. More...
 
 shouldIncludeMessages ()
 
 shouldIncludeScripts ()
 
 shouldIncludeStyles ()
 

Static Public Member Functions

static expandModuleNames ($modules)
 Expand a string of the form jquery.foo,bar|jquery.ui.baz,quux to an array of module names like [ 'jquery.foo', 'jquery.bar', 'jquery.ui.baz', 'jquery.ui.quux' ]. More...
 
static newDummyContext ()
 Return a dummy ResourceLoaderContext object suitable for passing into things that don't "really" need a context. More...
 

Protected Attributes

 $debug
 
 $direction
 
 $format
 
 $hash
 
 $image
 
 $imageObj
 
 $language
 
 $logger
 
 $modules
 
 $only
 
 $raw
 
 $request
 
 $resourceLoader
 
 $skin
 
 $user
 
 $userObj
 
 $variant
 
 $version
 

Detailed Description

Object passed around to modules which contains information about the state of a specific loader request.

Definition at line 31 of file ResourceLoaderContext.php.

Constructor & Destructor Documentation

ResourceLoaderContext::__construct ( ResourceLoader  $resourceLoader,
WebRequest  $request 
)

Member Function Documentation

static ResourceLoaderContext::expandModuleNames (   $modules)
static

Expand a string of the form jquery.foo,bar|jquery.ui.baz,quux to an array of module names like [ 'jquery.foo', 'jquery.bar', 'jquery.ui.baz', 'jquery.ui.quux' ].

Parameters
string$modulesPacked module name list
Returns
array Array of module names

Definition at line 106 of file ResourceLoaderContext.php.

References $modules, $retval, and as.

Referenced by ResourceLoaderTest\testExpandModuleNames().

ResourceLoaderContext::getDirection ( )
Returns
string

Definition at line 195 of file ResourceLoaderContext.php.

References $direction, Language\factory(), getLanguage(), and getRequest().

Referenced by ResourceLoaderImage\getPath().

ResourceLoaderContext::getFormat ( )
Returns
string|null

Definition at line 304 of file ResourceLoaderContext.php.

References $format.

Referenced by getHash(), ResourceLoaderImage\getImageData(), and ResourceLoaderImage\sendResponseHeaders().

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.

Returns
string

Definition at line 375 of file ResourceLoaderContext.php.

References $hash, getDebug(), getFormat(), getImage(), getLanguage(), getOnly(), getRaw(), getSkin(), getUser(), getVariant(), and getVersion().

Referenced by ResourceLoaderStartUpModule\getAllModuleHashes(), ResourceLoaderModule\getModuleContent(), ResourceLoaderModule\getVersionHash(), and ResourceFileCache\newFromContext().

ResourceLoaderContext::getImage ( )
Returns
string|null

Definition at line 290 of file ResourceLoaderContext.php.

References $image.

Referenced by getHash(), and ResourceFileCache\newFromContext().

ResourceLoaderContext::getImageObj ( )

If this is a request for an image, get the ResourceLoaderImage object.

Since
1.25
Returns
ResourceLoaderImage|bool false if a valid object cannot be created

Definition at line 314 of file ResourceLoaderContext.php.

References $image, $imageObj, $modules, getModules(), and getResourceLoader().

Referenced by ResourceLoader\makeModuleResponse(), ResourceLoader\respond(), and ResourceLoader\sendResponseHeaders().

ResourceLoaderContext::getLogger ( )
Since
1.27
Returns
\Psr\Log\LoggerInterface

Definition at line 163 of file ResourceLoaderContext.php.

References $logger.

Referenced by ResourceLoaderStartUpModule\getModuleRegistrations().

ResourceLoaderContext::getModules ( )
ResourceLoaderContext::getRaw ( )
Returns
bool

Definition at line 283 of file ResourceLoaderContext.php.

References $raw.

Referenced by getHash(), ResourceLoaderClientHtml\makeLoad(), and ResourceLoader\makeModuleResponse().

ResourceLoaderContext::getUser ( )
Returns
string|null

Definition at line 216 of file ResourceLoaderContext.php.

References $user.

Referenced by getHash(), and getUserObj().

ResourceLoaderContext::getUserObj ( )
ResourceLoaderContext::getVariant ( )
Returns
string|null

Definition at line 297 of file ResourceLoaderContext.php.

References $variant.

Referenced by getHash(), and ResourceLoaderImage\getImageData().

ResourceLoaderContext::msg ( )

Get a Message object with context set.

See wfMessage for parameters.

Since
1.27
Parameters
mixed...
Returns
Message

Definition at line 227 of file ResourceLoaderContext.php.

References getLanguage(), and Title\newFromText().

static ResourceLoaderContext::newDummyContext ( )
static

Return a dummy ResourceLoaderContext object suitable for passing into things that don't "really" need a context.

Returns
ResourceLoaderContext

Definition at line 138 of file ResourceLoaderContext.php.

References ConfigFactory\getDefaultInstance().

Referenced by ResourceLoaderFileModule\readStyleFiles(), ResourceLoaderContextTest\testDummy(), and ResourceLoaderWikiModuleTest\testGetPages().

ResourceLoaderContext::shouldIncludeMessages ( )
Returns
bool

Definition at line 360 of file ResourceLoaderContext.php.

References getOnly().

ResourceLoaderContext::shouldIncludeScripts ( )
ResourceLoaderContext::shouldIncludeStyles ( )
Returns
bool

Definition at line 353 of file ResourceLoaderContext.php.

References getOnly().

Referenced by ResourceLoaderModule\buildContent().

Member Data Documentation

ResourceLoaderContext::$debug
protected

Definition at line 39 of file ResourceLoaderContext.php.

Referenced by getDebug().

ResourceLoaderContext::$direction
protected

Definition at line 51 of file ResourceLoaderContext.php.

Referenced by getDirection().

ResourceLoaderContext::$format
protected

Definition at line 49 of file ResourceLoaderContext.php.

Referenced by getFormat().

ResourceLoaderContext::$hash
protected

Definition at line 52 of file ResourceLoaderContext.php.

Referenced by getHash().

ResourceLoaderContext::$image
protected

Definition at line 47 of file ResourceLoaderContext.php.

Referenced by getImage(), and getImageObj().

ResourceLoaderContext::$imageObj
protected

Definition at line 54 of file ResourceLoaderContext.php.

Referenced by getImageObj().

ResourceLoaderContext::$language
protected

Definition at line 38 of file ResourceLoaderContext.php.

Referenced by getLanguage().

ResourceLoaderContext::$logger
protected

Definition at line 34 of file ResourceLoaderContext.php.

Referenced by getLogger().

ResourceLoaderContext::$modules
protected

Definition at line 43 of file ResourceLoaderContext.php.

Referenced by __construct(), expandModuleNames(), getImageObj(), and getModules().

ResourceLoaderContext::$only
protected

Definition at line 44 of file ResourceLoaderContext.php.

Referenced by getOnly().

ResourceLoaderContext::$raw
protected

Definition at line 46 of file ResourceLoaderContext.php.

Referenced by getRaw().

ResourceLoaderContext::$request
protected

Definition at line 33 of file ResourceLoaderContext.php.

Referenced by __construct(), and getRequest().

ResourceLoaderContext::$resourceLoader
protected

Definition at line 32 of file ResourceLoaderContext.php.

Referenced by __construct(), and getResourceLoader().

ResourceLoaderContext::$skin
protected

Definition at line 37 of file ResourceLoaderContext.php.

Referenced by getSkin().

ResourceLoaderContext::$user
protected

Definition at line 40 of file ResourceLoaderContext.php.

Referenced by getUser().

ResourceLoaderContext::$userObj
protected

Definition at line 53 of file ResourceLoaderContext.php.

Referenced by getUserObj().

ResourceLoaderContext::$variant
protected

Definition at line 48 of file ResourceLoaderContext.php.

Referenced by getVariant().

ResourceLoaderContext::$version
protected

Definition at line 45 of file ResourceLoaderContext.php.

Referenced by getVersion().


The documentation for this class was generated from the following file: