Go to the documentation of this file.
76 $this->modules =
$modules ? ResourceLoader::expandModuleNames(
$modules ) : [];
79 $this->user =
$request->getRawVal(
'user' );
80 $this->debug =
$request->getRawVal(
'debug' ) ===
'true';
81 $this->only =
$request->getRawVal(
'only' );
82 $this->version =
$request->getRawVal(
'version' );
83 $this->raw =
$request->getFuzzyBool(
'raw' );
86 $this->image =
$request->getRawVal(
'image' );
87 $this->variant =
$request->getRawVal(
'variant' );
88 $this->format =
$request->getRawVal(
'format' );
90 $this->skin =
$request->getRawVal(
'skin' );
92 if ( !$this->skin || !isset( $skinnames[$this->skin] ) ) {
115 return new self(
new ResourceLoader(
116 MediaWikiServices::getInstance()->getMainConfig(),
117 LoggerFactory::getInstance(
'resourceloader' )
167 if ( $this->language ===
null ) {
177 $this->language =
$lang;
186 if ( $this->direction ===
null ) {
221 public function msg( $key, ...$params ) {
237 if ( $this->userObj ===
null ) {
244 $this->userObj =
new User;
309 if ( $this->imageObj ===
null ) {
310 $this->imageObj =
false;
312 if ( !$this->image ) {
326 $image = $module->getImage( $this->image, $this );
357 return $this->
getOnly() ===
null || $this->
getOnly() ===
'scripts';
364 return $this->
getOnly() ===
null || $this->
getOnly() ===
'styles';
371 return $this->
getOnly() ===
null;
386 if ( !isset( $this->hash ) ) {
387 $this->hash = implode(
'|', [
413 if ( $this->
getLanguage() !== self::DEFAULT_LANG ) {
416 if ( $this->
getSkin() !== self::DEFAULT_SKIN ) {
417 $reqBase[
'skin'] = $this->
getSkin();
420 $reqBase[
'debug'] =
'true';
443 $jsonFlags = JSON_UNESCAPED_SLASHES |
444 JSON_UNESCAPED_UNICODE |
448 $jsonFlags |= JSON_PRETTY_PRINT;
450 return json_encode( $data, $jsonFlags );
Context object that contains information about the state of a specific ResourceLoader web request.
getReqBase()
Get the request base parameters, omitting any defaults.
WebRequest clone which takes values from a provided array.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
static newDummyContext()
Return a dummy ResourceLoaderContext object suitable for passing into things that don't "really" need...
if(!isset( $args[0])) $lang
getContentOverrideCallback()
Return the replaced-content mapping callback.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Interface for localizing messages in MediaWiki.
static getSkinNames()
Fetch the set of available skins.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
msg( $key,... $params)
Get a Message object with context set.
Class encapsulating an image used in a ResourceLoaderImageModule.
static isValidBuiltInCode( $code)
Returns true if a language code is of a valid form for the purposes of internal customisation of Medi...
__construct(ResourceLoader $resourceLoader, WebRequest $request)
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
ResourceLoaderImage false $imageObj
static factory( $code)
Get a cached or new language object for a given language code.
getHash()
All factors that uniquely identify this request, except 'modules'.
getImageObj()
If this is a request for an image, get the ResourceLoaderImage object.
getUserObj()
Get the possibly-cached User object for the specified username.
Module for generated and embedded images.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
encodeJson( $data)
Wrapper around json_encode that avoids needless escapes, and pretty-prints in debug mode.