MediaWiki REL1_30
ResourceLoaderFileModule Class Reference

ResourceLoader module based on local JavaScript/CSS files. More...

Inheritance diagram for ResourceLoaderFileModule:
Collaboration diagram for ResourceLoaderFileModule:

Public Member Functions

 __construct ( $options=[], $localBasePath=null, $remoteBasePath=null)
 Constructs a new module from an options array.
 
 enableModuleContentVersion ()
 Disable module content versioning.
 
 getAllStyleFiles ()
 Returns all style files and all skin style files used by this module.
 
 getDefinitionSummary (ResourceLoaderContext $context)
 Get the definition summary for this module.
 
 getDependencies (ResourceLoaderContext $context=null)
 Gets list of names of modules this module depends on.
 
 getFlip ( $context)
 Get whether CSS for this module should be flipped.
 
 getGroup ()
 Gets the name of the group this module should be loaded in.
 
 getMessages ()
 Gets list of message keys used by this module.
 
 getScript (ResourceLoaderContext $context)
 Gets all scripts for a given context concatenated together.
 
 getScriptURLsForDebug (ResourceLoaderContext $context)
 
 getSkipFunction ()
 Get the skip function.
 
 getStyleFiles (ResourceLoaderContext $context)
 Get a list of file paths for all styles in this module, in order of proper inclusion.
 
 getStyles (ResourceLoaderContext $context)
 Get all styles for a given context.
 
 getStyleSheetLang ( $path)
 Infer the stylesheet language from a stylesheet file path.
 
 getStyleURLsForDebug (ResourceLoaderContext $context)
 
 getTargets ()
 Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile'].
 
 getTemplates ()
 Takes named templates by the module and returns an array mapping.
 
 getType ()
 Get the module's load type.
 
 isRaw ()
 
 readStyleFiles (array $styles, $flip, $context=null)
 Gets the contents of a list of CSS files.
 
 supportsURLLoading ()
 
- Public Member Functions inherited from ResourceLoaderModule
 getConfig ()
 
 getDefinitionMtime (ResourceLoaderContext $context)
 Back-compat dummy for old subclass implementations of getModifiedTime().
 
 getHashMtime (ResourceLoaderContext $context)
 Back-compat dummy for old subclass implementations of getModifiedTime().
 
 getHeaders (ResourceLoaderContext $context)
 Get headers to send as part of a module web response.
 
 getModifiedHash (ResourceLoaderContext $context)
 Helper method for providing a version hash to getVersionHash().
 
 getModifiedTime (ResourceLoaderContext $context)
 Get this module's last modification timestamp for a given context.
 
 getName ()
 Get this module's name.
 
 getOrigin ()
 Get this module's origin.
 
 getPosition ()
 From where in the page HTML should this module be loaded?
 
 getSource ()
 Get the origin of this module.
 
 isKnownEmpty (ResourceLoaderContext $context)
 Check whether this module is known to be empty.
 
 setConfig (Config $config)
 
 setFileDependencies (ResourceLoaderContext $context, $files)
 Set in-object cache for file dependencies.
 
 setLogger (LoggerInterface $logger)
 
 setMessageBlob ( $blob, $lang)
 Set in-object cache for message blobs.
 
 setName ( $name)
 Set this module's name.
 
 shouldEmbedModule (ResourceLoaderContext $context)
 Check whether this module should be embeded rather than linked.
 

Static Public Member Functions

static extractBasePaths ( $options=[], $localBasePath=null, $remoteBasePath=null)
 Extract a pair of local and remote base paths from module definition information.
 
- Static Public Member Functions inherited from ResourceLoaderModule
static expandRelativePaths (array $filePaths)
 Expand directories relative to $IP.
 
static getRelativePaths (array $filePaths)
 Make file paths relative to MediaWiki directory.
 

Protected Member Functions

 compileLessFile ( $fileName, ResourceLoaderContext $context)
 Compile a LESS file into CSS.
 
 getAllSkinStyleFiles ()
 Gets a list of file paths for all skin style files in the module, for all available skins.
 
 getFileHashes (ResourceLoaderContext $context)
 Helper method to gather file hashes for getDefinitionSummary.
 
 getLocalPath ( $path)
 
 getRemotePath ( $path)
 
 getScriptFiles (ResourceLoaderContext $context)
 Get a list of file paths for all scripts in this module, in order of proper execution.
 
 getSkinStyleFiles ( $skinName)
 Gets a list of file paths for all skin styles in the module used by the skin.
 
 readScriptFiles (array $scripts)
 Gets the contents of a list of JavaScript files.
 
 readStyleFile ( $path, $flip, $context)
 Reads a style file.
 
 stripBom ( $input)
 Takes an input string and removes the UTF-8 BOM character if present.
 
- Protected Member Functions inherited from ResourceLoaderModule
 getDeprecationInformation ()
 Get JS representing deprecation information for the current module if available.
 
 getFileDependencies (ResourceLoaderContext $context)
 Get the files this module depends on indirectly for a given skin.
 
 getLogger ()
 
 getMessageBlob (ResourceLoaderContext $context)
 Get the hash of the message blob.
 
 saveFileDependencies (ResourceLoaderContext $context, $localFileRefs)
 Set the files this module depends on indirectly for a given skin.
 
 validateScriptFile ( $fileName, $contents)
 Validate a given script file; if valid returns the original source.
 

Static Protected Member Functions

static collateFilePathListByOption (array $list, $option, $default)
 Collates file paths by option (where provided).
 
static tryForKey (array $list, $key, $fallback=null)
 Get a list of element that match a key, optionally using a fallback key.
 
- Static Protected Member Functions inherited from ResourceLoaderModule
static javaScriptParser ()
 
static safeFileHash ( $filePath)
 Compute a non-cryptographic string hash of a file's contents.
 
static safeFilemtime ( $filePath)
 Safe version of filemtime(), which doesn't throw a PHP warning if the file doesn't exist.
 

Protected Attributes

bool $debugRaw = true
 Link to raw files in debug mode.
 
array $debugScripts = []
 List of paths to JavaScript files to include in debug mode.
 
array $dependencies = []
 List of modules this module depends on.
 
string $group
 Name of group to load this module in.
 
bool $hasGeneratedStyles = false
 Whether getStyleURLsForDebug should return raw file paths, or return load.php urls.
 
array $languageScripts = []
 List of JavaScript files to include when using a specific language.
 
string $localBasePath = ''
 Local base path, see __construct()
 
array $localFileRefs = []
 Place where readStyleFile() tracks file dependencies.
 
array $messages = []
 List of message keys used by this module.
 
array $missingLocalFileRefs = []
 Place where readStyleFile() tracks file dependencies for non-existent files.
 
bool $noflip = false
 Whether CSSJanus flipping should be skipped for this module.
 
bool $raw = false
 Whether mw.loader.state() call should be omitted.
 
string $remoteBasePath = ''
 Remote base path, see __construct()
 
array $scripts = []
 List of paths to JavaScript files to always include.
 
array $skinScripts = []
 List of JavaScript files to include when using a specific skin.
 
array $skinStyles = []
 List of paths to CSS files to include when using specific skins.
 
string $skipFunction = null
 File name containing the body of the skip function.
 
array $styles = []
 List of paths to CSS files to always include.
 
 $targets = [ 'desktop' ]
 
array $templates = []
 Saves a list of the templates named by the modules.
 
- Protected Attributes inherited from ResourceLoaderModule
Config $config
 
 $contents = []
 
array bool $deprecated = false
 
 $fileDeps = []
 
LoggerInterface $logger
 
 $msgBlobs = []
 
 $name = null
 
 $origin = self::ORIGIN_CORE_SITEWIDE
 
 $targets = [ 'desktop' ]
 
 $versionHash = []
 

Private Member Functions

 getLanguageScripts ( $lang)
 Get the set of language scripts for the given language, possibly using a fallback language.
 

Additional Inherited Members

- Public Attributes inherited from ResourceLoaderModule
const LOAD_GENERAL = 'general'
 
const LOAD_STYLES = 'styles'
 
const ORIGIN_ALL = 10
 
const ORIGIN_CORE_INDIVIDUAL = 2
 
const ORIGIN_CORE_SITEWIDE = 1
 
const ORIGIN_USER_INDIVIDUAL = 4
 
const ORIGIN_USER_SITEWIDE = 3
 
const TYPE_COMBINED = 'combined'
 
const TYPE_SCRIPTS = 'scripts'
 
const TYPE_STYLES = 'styles'
 

Detailed Description

ResourceLoader module based on local JavaScript/CSS files.

Definition at line 28 of file ResourceLoaderFileModule.php.

Constructor & Destructor Documentation

◆ __construct()

ResourceLoaderFileModule::__construct ( $options = [],
$localBasePath = null,
$remoteBasePath = null )

Constructs a new module from an options array.

Parameters
array$optionsList of options; if not given or empty, an empty module will be constructed
string$localBasePathBase path to prepend to all local paths in $options. Defaults to $IP
string$remoteBasePathBase path to prepend to all remote paths in $options. Defaults to $wgResourceBasePath

Below is a description for the $options array:

Exceptions
InvalidArgumentException
Construction options:
[
// Base path to prepend to all local paths in $options. Defaults to $IP
'localBasePath' => [base path],
// Base path to prepend to all remote paths in $options. Defaults to $wgResourceBasePath
'remoteBasePath' => [base path],
// Equivalent of remoteBasePath, but relative to $wgExtensionAssetsPath
'remoteExtPath' => [base path],
// Equivalent of remoteBasePath, but relative to $wgStylePath
'remoteSkinPath' => [base path],
// Scripts to always include
'scripts' => [file path string or array of file path strings],
// Scripts to include in specific language contexts
'languageScripts' => [
[language code] => [file path string or array of file path strings],
],
// Scripts to include in specific skin contexts
'skinScripts' => [
[skin name] => [file path string or array of file path strings],
],
// Scripts to include in debug contexts
'debugScripts' => [file path string or array of file path strings],
// Modules which must be loaded before this module
'dependencies' => [module name string or array of module name strings],
'templates' => [
[template alias with file.ext] => [file path to a template file],
],
// Styles to always load
'styles' => [file path string or array of file path strings],
// Styles to include in specific skin contexts
'skinStyles' => [
[skin name] => [file path string or array of file path strings],
],
// Messages to always load
'messages' => [array of message key strings],
// Group which this module should be loaded together with
'group' => [group name string],
// Function that, if it returns true, makes the loader skip this module.
// The file must contain valid JavaScript for execution in a private function.
// The file must not contain the "function () {" and "}" wrapper though.
'skipFunction' => [file path]
]
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of either verbatim or with modifications and or translated into another language(Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying
no text was provided for refs named< code > blankwithnoreference</code ></span ></li ></ol ></div > !end !test with< references/> in group !wikitext Wikipedia rocks< ref > Proceeds of vol XXI</ref > Wikipedia rocks< ref group=note > Proceeds of vol XXI</ref >< references/>< references group=note/> ! html< p > Wikipedia rocks< sup id="cite_ref-1" class="reference">< a href="#cite_note-1"> &Wikipedia rocks< sup id="cite_ref-2" class="reference">< a href="#cite_note-2"> &</p >< div class="mw-references-wrap">< ol class="references">< li id="cite_note-1">< span class="mw-cite-backlink">< a href="#cite_ref-1"> ↑</a ></span >< span class="reference-text"> Proceeds of vol XXI</span ></li ></ol ></div >< div class="mw-references-wrap">< ol class="references">< li id="cite_note-2">< span class="mw-cite-backlink">< a href="#cite_ref-2"> ↑</a ></span >< span class="reference-text"> Proceeds of vol XXI</span ></li ></ol ></div > !end !test with< references/> in group
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a skin(according to that user 's preference)
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at name
Definition design.txt:12
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database key
Definition design.txt:26
it sets a lot of them automatically from query strings
Definition design.txt:93
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
Definition hooks.txt:181
and how to run hooks for an and one after Each event has a preferably in CamelCase For ArticleDelete hook A clump of code and data that should be run when an event happens This can be either a function and a chunk of or an object and a method hook function The function part of a third party developers and local administrators to define code that will be run at certain points in the mainline code
Definition hooks.txt:28
We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going and make changes or fix bugs In we can take all the code that deals with the little used title reversing we can concentrate it all in an extension file
Definition hooks.txt:106

Reimplemented in CiteCSSFileModule.

Definition at line 211 of file ResourceLoaderFileModule.php.

References $options, $value, array(), list, and string.

Member Function Documentation

◆ collateFilePathListByOption()

static ResourceLoaderFileModule::collateFilePathListByOption ( array $list,
$option,
$default )
staticprotected

Collates file paths by option (where provided).

Parameters
array$listList of file paths in any combination of index/path or path/options pairs
string$optionOption name
mixed$defaultDefault value if the option isn't set
Returns
array List of file paths, collated by $option

Definition at line 636 of file ResourceLoaderFileModule.php.

References $value.

◆ compileLessFile()

ResourceLoaderFileModule::compileLessFile ( $fileName,
ResourceLoaderContext $context )
protected

Compile a LESS file into CSS.

Keeps track of all used files and adds them to localFileRefs.

Since
1.22
1.27 Added $context paramter.
Exceptions
ExceptionIf less.php encounters a parse error
Parameters
string$fileNameFile path of LESS source
ResourceLoaderContext$contextContext in which to generate script
Returns
string CSS source

Definition at line 958 of file ResourceLoaderFileModule.php.

References $cache, $context, $css, $vars, CACHE_ANYTHING, FileContentsHasher\getFileContentsHash(), and serialize().

Referenced by readStyleFile().

◆ enableModuleContentVersion()

ResourceLoaderFileModule::enableModuleContentVersion ( )

Disable module content versioning.

This class uses getDefinitionSummary() instead, to avoid filesystem overhead involved with building the full module content inside a startup request.

Returns
bool

Reimplemented in ResourceLoaderSyntaxHighlightVisualEditorModule, ResourceLoaderJqueryMsgModule, and ResourceLoaderMediaWikiUtilModule.

Definition at line 487 of file ResourceLoaderFileModule.php.

◆ extractBasePaths()

static ResourceLoaderFileModule::extractBasePaths ( $options = [],
$localBasePath = null,
$remoteBasePath = null )
static

Extract a pair of local and remote base paths from module definition information.

Implementation note: the amount of global state used in this function is staggering.

Parameters
array$optionsModule definition
string$localBasePathPath to use if not provided in module definition. Defaults to $IP
string$remoteBasePathPath to use if not provided in module definition. Defaults to $wgResourceBasePath
Returns
array Array( localBasePath, remoteBasePath )

Definition at line 310 of file ResourceLoaderFileModule.php.

References $IP, $options, $wgExtensionAssetsPath, $wgResourceBasePath, $wgStylePath, and string.

◆ getAllSkinStyleFiles()

ResourceLoaderFileModule::getAllSkinStyleFiles ( )
protected

Gets a list of file paths for all skin style files in the module, for all available skins.

Returns
array A list of file paths collated by media type

Definition at line 758 of file ResourceLoaderFileModule.php.

References Skin\getSkinNames(), and getSkinStyleFiles().

Referenced by getAllStyleFiles().

◆ getAllStyleFiles()

ResourceLoaderFileModule::getAllStyleFiles ( )

Returns all style files and all skin style files used by this module.

Returns
array

Definition at line 778 of file ResourceLoaderFileModule.php.

References $result, getAllSkinStyleFiles(), and getLocalPath().

◆ getDefinitionSummary()

ResourceLoaderFileModule::getDefinitionSummary ( ResourceLoaderContext $context)

Get the definition summary for this module.

Parameters
ResourceLoaderContext$context
Returns
array

Reimplemented from ResourceLoaderModule.

Reimplemented in ResourceLoaderSkinModule.

Definition at line 551 of file ResourceLoaderFileModule.php.

References $context, $options, getFileHashes(), and ResourceLoaderModule\getMessageBlob().

◆ getDependencies()

ResourceLoaderFileModule::getDependencies ( ResourceLoaderContext $context = null)

Gets list of names of modules this module depends on.

Parameters
ResourceLoaderContext | null$context
Returns
array List of module names

Reimplemented from ResourceLoaderModule.

Reimplemented in ResourceLoaderForeignApiModule.

Definition at line 447 of file ResourceLoaderFileModule.php.

◆ getFileHashes()

ResourceLoaderFileModule::getFileHashes ( ResourceLoaderContext $context)
protected

Helper method to gather file hashes for getDefinitionSummary.

This function is context-sensitive, only computing hashes of files relevant to the given language, skin, etc.

See also
ResourceLoaderModule::getFileDependencies
Parameters
ResourceLoaderContext$context
Returns
array

Definition at line 501 of file ResourceLoaderFileModule.php.

References $context, ResourceLoaderModule\getFileDependencies(), getLanguageScripts(), and scripts.

Referenced by getDefinitionSummary().

◆ getFlip()

ResourceLoaderFileModule::getFlip ( $context)

Get whether CSS for this module should be flipped.

Parameters
ResourceLoaderContext$context
Returns
bool

Reimplemented from ResourceLoaderModule.

Definition at line 911 of file ResourceLoaderFileModule.php.

References $context.

Referenced by getStyles().

◆ getGroup()

ResourceLoaderFileModule::getGroup ( )

Gets the name of the group this module should be loaded in.

Returns
string Group name

Reimplemented from ResourceLoaderModule.

Definition at line 438 of file ResourceLoaderFileModule.php.

◆ getLanguageScripts()

ResourceLoaderFileModule::getLanguageScripts ( $lang)
private

Get the set of language scripts for the given language, possibly using a fallback language.

Parameters
string$lang
Returns
array

Definition at line 704 of file ResourceLoaderFileModule.php.

References $lang.

Referenced by getFileHashes(), and getScriptFiles().

◆ getLocalPath()

ResourceLoaderFileModule::getLocalPath ( $path)
protected

◆ getMessages()

ResourceLoaderFileModule::getMessages ( )

Gets list of message keys used by this module.

Returns
array List of message keys

Reimplemented from ResourceLoaderModule.

Definition at line 429 of file ResourceLoaderFileModule.php.

References $messages.

◆ getRemotePath()

ResourceLoaderFileModule::getRemotePath ( $path)
protected
Parameters
string | ResourceLoaderFilePath$path
Returns
string

Definition at line 608 of file ResourceLoaderFileModule.php.

Referenced by getScriptURLsForDebug(), getStyleURLsForDebug(), and readStyleFile().

◆ getScript()

ResourceLoaderFileModule::getScript ( ResourceLoaderContext $context)

Gets all scripts for a given context concatenated together.

Parameters
ResourceLoaderContext$contextContext in which to generate script
Returns
string JavaScript code for $context

Reimplemented from ResourceLoaderModule.

Reimplemented in ResourceLoaderSyntaxHighlightVisualEditorModule, ResourceLoaderJqueryMsgModule, ResourceLoaderMediaWikiUtilModule, and ResourceLoaderRawFileModule.

Definition at line 354 of file ResourceLoaderFileModule.php.

References $context, ResourceLoaderModule\getDeprecationInformation(), getScriptFiles(), and readScriptFiles().

◆ getScriptFiles()

ResourceLoaderFileModule::getScriptFiles ( ResourceLoaderContext $context)
protected

Get a list of file paths for all scripts in this module, in order of proper execution.

Parameters
ResourceLoaderContext$context
Returns
array List of file paths

Definition at line 684 of file ResourceLoaderFileModule.php.

References $context, getLanguageScripts(), and scripts.

Referenced by getScript(), and getScriptURLsForDebug().

◆ getScriptURLsForDebug()

ResourceLoaderFileModule::getScriptURLsForDebug ( ResourceLoaderContext $context)

◆ getSkinStyleFiles()

ResourceLoaderFileModule::getSkinStyleFiles ( $skinName)
protected

Gets a list of file paths for all skin styles in the module used by the skin.

Parameters
string$skinNameThe name of the skin
Returns
array A list of file paths collated by media type

Definition at line 744 of file ResourceLoaderFileModule.php.

Referenced by getAllSkinStyleFiles().

◆ getSkipFunction()

ResourceLoaderFileModule::getSkipFunction ( )

Get the skip function.

Returns
null|string
Exceptions
MWException

Reimplemented from ResourceLoaderModule.

Definition at line 456 of file ResourceLoaderFileModule.php.

References ResourceLoaderModule\$contents, ResourceLoaderModule\getConfig(), getLocalPath(), stripBom(), and ResourceLoaderModule\validateScriptFile().

◆ getStyleFiles()

ResourceLoaderFileModule::getStyleFiles ( ResourceLoaderContext $context)

Get a list of file paths for all styles in this module, in order of proper inclusion.

Parameters
ResourceLoaderContext$context
Returns
array List of file paths

Definition at line 726 of file ResourceLoaderFileModule.php.

References $context.

Referenced by getStyles(), and getStyleURLsForDebug().

◆ getStyles()

ResourceLoaderFileModule::getStyles ( ResourceLoaderContext $context)

Get all styles for a given context.

Parameters
ResourceLoaderContext$context
Returns
array CSS code for $context as an associative array mapping media type to CSS text.

Reimplemented from ResourceLoaderModule.

Reimplemented in ResourceLoaderSkinModule.

Definition at line 387 of file ResourceLoaderFileModule.php.

References $context, getFlip(), getStyleFiles(), readStyleFiles(), and ResourceLoaderModule\saveFileDependencies().

◆ getStyleSheetLang()

ResourceLoaderFileModule::getStyleSheetLang ( $path)

Infer the stylesheet language from a stylesheet file path.

Since
1.22
Parameters
string$path
Returns
string The stylesheet language name

Definition at line 623 of file ResourceLoaderFileModule.php.

Referenced by readStyleFile().

◆ getStyleURLsForDebug()

ResourceLoaderFileModule::getStyleURLsForDebug ( ResourceLoaderContext $context)

◆ getTargets()

ResourceLoaderFileModule::getTargets ( )

Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile'].

Returns
array Array of strings

Reimplemented from ResourceLoaderModule.

Definition at line 920 of file ResourceLoaderFileModule.php.

◆ getTemplates()

ResourceLoaderFileModule::getTemplates ( )

Takes named templates by the module and returns an array mapping.

Returns
array Templates mapping template alias to content
Exceptions
MWException

Reimplemented from ResourceLoaderModule.

Definition at line 1004 of file ResourceLoaderFileModule.php.

References getLocalPath(), stripBom(), and wfDebugLog().

◆ getType()

ResourceLoaderFileModule::getType ( )

Get the module's load type.

Since
1.28
Returns
string

Reimplemented from ResourceLoaderModule.

Definition at line 930 of file ResourceLoaderFileModule.php.

References scripts.

◆ isRaw()

ResourceLoaderFileModule::isRaw ( )
Returns
bool

Reimplemented from ResourceLoaderModule.

Definition at line 475 of file ResourceLoaderFileModule.php.

◆ readScriptFiles()

ResourceLoaderFileModule::readScriptFiles ( array $scripts)
protected

Gets the contents of a list of JavaScript files.

Parameters
array$scriptsList of file paths to scripts to read, remap and concetenate
Exceptions
MWException
Returns
string Concatenated and remapped JavaScript data from $scripts

Definition at line 802 of file ResourceLoaderFileModule.php.

References ResourceLoaderModule\$contents, ResourceLoaderModule\getConfig(), getLocalPath(), stripBom(), and ResourceLoaderModule\validateScriptFile().

Referenced by getScript().

◆ readStyleFile()

ResourceLoaderFileModule::readStyleFile ( $path,
$flip,
$context )
protected

Reads a style file.

This method can be used as a callback for array_map()

Parameters
string$pathFile path of style file to read
bool$flip
ResourceLoaderContext$context
Returns
string CSS data in script file
Exceptions
MWExceptionIf the file doesn't exist

Definition at line 871 of file ResourceLoaderFileModule.php.

References $context, compileLessFile(), getLocalPath(), getRemotePath(), getStyleSheetLang(), stripBom(), and wfDebugLog().

Referenced by readStyleFiles().

◆ readStyleFiles()

ResourceLoaderFileModule::readStyleFiles ( array $styles,
$flip,
$context = null )

Gets the contents of a list of CSS files.

Parameters
array$stylesList of media type/list of file paths pairs, to read, remap and concetenate
bool$flip
ResourceLoaderContext$context
Exceptions
MWException
Returns
array List of concatenated and remapped CSS data from $styles, keyed by media type
Since
1.27 Calling this method without a ResourceLoaderContext instance is deprecated.

Definition at line 839 of file ResourceLoaderFileModule.php.

References $context, readStyleFile(), and wfDeprecated().

Referenced by getStyles().

◆ stripBom()

ResourceLoaderFileModule::stripBom ( $input)
protected

Takes an input string and removes the UTF-8 BOM character if present.

We need to remove these after reading a file, because we concatenate our files and the BOM character is not valid in the middle of a string. We already assume UTF-8 everywhere, so this should be safe.

Parameters
string$input
Returns
string Input minus the intial BOM char

Definition at line 1035 of file ResourceLoaderFileModule.php.

References $input.

Referenced by getSkipFunction(), getTemplates(), readScriptFiles(), and readStyleFile().

◆ supportsURLLoading()

ResourceLoaderFileModule::supportsURLLoading ( )
Returns
bool

Reimplemented from ResourceLoaderModule.

Reimplemented in ResourceLoaderMediaWikiUtilModule.

Definition at line 377 of file ResourceLoaderFileModule.php.

◆ tryForKey()

static ResourceLoaderFileModule::tryForKey ( array $list,
$key,
$fallback = null )
staticprotected

Get a list of element that match a key, optionally using a fallback key.

Parameters
array$listList of lists to select from
string$keyKey to look for in $map
string$fallbackKey to look for in $list if $key doesn't exist
Returns
array List of elements from $map which matched $key or $fallback, or an empty list in case of no match

Definition at line 666 of file ResourceLoaderFileModule.php.

References $fallback.

Member Data Documentation

◆ $debugRaw

bool ResourceLoaderFileModule::$debugRaw = true
protected

Link to raw files in debug mode.

Definition at line 121 of file ResourceLoaderFileModule.php.

◆ $debugScripts

array ResourceLoaderFileModule::$debugScripts = []
protected

List of paths to JavaScript files to include in debug mode.

Usage:
[ [skin-name] => [ [file-path], [file-path], ... ], ... ]

Definition at line 74 of file ResourceLoaderFileModule.php.

◆ $dependencies

array ResourceLoaderFileModule::$dependencies = []
protected

List of modules this module depends on.

Usage:
[ [file-path], [file-path], ... ]

Definition at line 101 of file ResourceLoaderFileModule.php.

Referenced by ResourceLoaderForeignApiModule\getDependencies().

◆ $group

string ResourceLoaderFileModule::$group
protected

Name of group to load this module in.

Definition at line 118 of file ResourceLoaderFileModule.php.

◆ $hasGeneratedStyles

bool ResourceLoaderFileModule::$hasGeneratedStyles = false
protected

Whether getStyleURLsForDebug should return raw file paths, or return load.php urls.

Definition at line 135 of file ResourceLoaderFileModule.php.

◆ $languageScripts

array ResourceLoaderFileModule::$languageScripts = []
protected

List of JavaScript files to include when using a specific language.

Usage:
[ [language-code] => [ [file-path], [file-path], ... ], ... ]

Definition at line 56 of file ResourceLoaderFileModule.php.

◆ $localBasePath

string ResourceLoaderFileModule::$localBasePath = ''
protected

Local base path, see __construct()

Definition at line 32 of file ResourceLoaderFileModule.php.

Referenced by CiteCSSFileModule\__construct().

◆ $localFileRefs

array ResourceLoaderFileModule::$localFileRefs = []
protected

Place where readStyleFile() tracks file dependencies.

Usage:
[ [file-path], [file-path], ... ]

Definition at line 144 of file ResourceLoaderFileModule.php.

◆ $messages

array ResourceLoaderFileModule::$messages = []
protected

List of message keys used by this module.

Usage:
[ [message-key], [message-key], ... ]

Definition at line 115 of file ResourceLoaderFileModule.php.

◆ $missingLocalFileRefs

array ResourceLoaderFileModule::$missingLocalFileRefs = []
protected

Place where readStyleFile() tracks file dependencies for non-existent files.

Used in tests to detect missing dependencies.

Definition at line 150 of file ResourceLoaderFileModule.php.

◆ $noflip

bool ResourceLoaderFileModule::$noflip = false
protected

Whether CSSJanus flipping should be skipped for this module.

Definition at line 129 of file ResourceLoaderFileModule.php.

◆ $raw

bool ResourceLoaderFileModule::$raw = false
protected

Whether mw.loader.state() call should be omitted.

Definition at line 124 of file ResourceLoaderFileModule.php.

◆ $remoteBasePath

string ResourceLoaderFileModule::$remoteBasePath = ''
protected

Remote base path, see __construct()

Definition at line 35 of file ResourceLoaderFileModule.php.

Referenced by CiteCSSFileModule\__construct().

◆ $scripts

array ResourceLoaderFileModule::$scripts = []
protected

List of paths to JavaScript files to always include.

Usage:
[ [file-path], [file-path], ... ]

Definition at line 47 of file ResourceLoaderFileModule.php.

Referenced by ResourceLoaderSyntaxHighlightVisualEditorModule\getScript().

◆ $skinScripts

array ResourceLoaderFileModule::$skinScripts = []
protected

List of JavaScript files to include when using a specific skin.

Usage:
[ [skin-name] => [ [file-path], [file-path], ... ], ... ]

Definition at line 65 of file ResourceLoaderFileModule.php.

Referenced by ResourceLoaderOOUIFileModule\__construct().

◆ $skinStyles

array ResourceLoaderFileModule::$skinStyles = []
protected

List of paths to CSS files to include when using specific skins.

Usage:
[ [file-path], [file-path], ... ]

Definition at line 92 of file ResourceLoaderFileModule.php.

Referenced by ResourceLoaderOOUIFileModule\__construct().

◆ $skipFunction

string ResourceLoaderFileModule::$skipFunction = null
protected

File name containing the body of the skip function.

Definition at line 106 of file ResourceLoaderFileModule.php.

◆ $styles

array ResourceLoaderFileModule::$styles = []
protected

List of paths to CSS files to always include.

Usage:
[ [file-path], [file-path], ... ]

Definition at line 83 of file ResourceLoaderFileModule.php.

Referenced by ResourceLoaderSkinModule\getStyles(), and ResourceLoaderSkinModule\normalizeStyles().

◆ $targets

ResourceLoaderFileModule::$targets = [ 'desktop' ]
protected

Definition at line 126 of file ResourceLoaderFileModule.php.

◆ $templates

array ResourceLoaderFileModule::$templates = []
protected

Saves a list of the templates named by the modules.

Definition at line 38 of file ResourceLoaderFileModule.php.


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