68 $this->request = $request;
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' );
86 $this->image = $request->
getRawVal(
'image' );
87 $this->variant = $request->
getRawVal(
'variant' );
88 $this->format = $request->
getRawVal(
'format' );
90 $this->skin = $request->
getRawVal(
'skin' );
91 $skinnames = Skin::getSkinNames();
92 if ( !$this->skin || !isset( $skinnames[$this->skin] ) ) {
96 $this->skin = self::DEFAULT_SKIN;
116 MediaWikiServices::getInstance()->getMainConfig(),
117 LoggerFactory::getInstance(
'resourceloader' )
143 return $this->request;
153 return $this->logger;
167 if ( $this->language ===
null ) {
172 if ( !Language::isValidBuiltInCode(
$lang ) ) {
175 $lang = self::DEFAULT_LANG;
177 $this->language =
$lang;
179 return $this->language;
186 if ( $this->direction ===
null ) {
192 $this->direction = Language::factory( $this->
getLanguage() )->getDir();
195 return $this->direction;
221 public function msg( $key, ...$params ) {
227 ->title( Title::newFromText(
'Dwimmerlaik' ) );
237 if ( $this->userObj ===
null ) {
241 $this->userObj = User::newFromName( $username ) ?:
new User;
244 $this->userObj =
new User;
248 return $this->userObj;
271 return $this->version;
292 return $this->variant;
299 return $this->format;
309 if ( $this->imageObj ===
null ) {
310 $this->imageObj =
false;
312 if ( !$this->image ) {
313 return $this->imageObj;
318 return $this->imageObj;
323 return $this->imageObj;
326 $image = $module->getImage( $this->image, $this );
328 return $this->imageObj;
334 return $this->imageObj;
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 );
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
WebRequest clone which takes values from a provided array.
Context object that contains information about the state of a specific ResourceLoader web request.
getReqBase()
Get the request base parameters, omitting any defaults.
ResourceLoaderImage false $imageObj
__construct(ResourceLoader $resourceLoader, WebRequest $request)
getImageObj()
If this is a request for an image, get the ResourceLoaderImage object.
getUserObj()
Get the possibly-cached User object for the specified username.
getHash()
All factors that uniquely identify this request, except 'modules'.
encodeJson( $data)
Wrapper around json_encode that avoids needless escapes, and pretty-prints in debug mode.
msg( $key,... $params)
Get a Message object with context set.
static newDummyContext()
Return a dummy ResourceLoaderContext object suitable for passing into things that don't "really" need...
getContentOverrideCallback()
Return the replaced-content mapping callback.
Module for generated and embedded images.
Class encapsulating an image used in a ResourceLoaderImageModule.
ResourceLoader is a loading system for JavaScript and CSS resources.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
getFuzzyBool( $name, $default=false)
Fetch a boolean value from the input or return $default if not set.
getRawVal( $name, $default=null)
Fetch a scalar from the input without normalization, or return $default if it's not set.
Interface for localizing messages in MediaWiki.
if(!isset( $args[0])) $lang