MediaWiki REL1_31
|
Public Member Functions | |
__construct ( $options=[]) | |
enableModuleContentVersion () | |
Whether to generate version hash based on module content. | |
getDependencies (ResourceLoaderContext $context=null) | |
Get a list of modules this module depends on. | |
getGroup () | |
Get the group this module is in. | |
getMessages () | |
Get the messages needed for this module. | |
getScript (ResourceLoaderContext $context) | |
Get all JS for this module for a given language and skin. | |
getSkipFunction () | |
Get the skip function. | |
getSource () | |
Get the origin of this module. | |
getStyles (ResourceLoaderContext $context) | |
Get all CSS for this module for a given skin. | |
getType () | |
Get the module's load type. | |
isKnownEmpty (ResourceLoaderContext $context) | |
Check whether this module is known to be empty. | |
isRaw () | |
Whether this module's JS expects to work without the client-side ResourceLoader module. | |
shouldEmbedModule (ResourceLoaderContext $context) | |
Check whether this module should be embeded rather than linked. | |
Public Member Functions inherited from ResourceLoaderModule | |
getConfig () | |
getDefinitionSummary (ResourceLoaderContext $context) | |
Get the definition summary for this module. | |
getFlip ( $context) | |
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. | |
getModuleContent (ResourceLoaderContext $context) | |
Get an array of this module's resources. | |
getName () | |
Get this module's name. | |
getOrigin () | |
Get this module's origin. | |
getScriptURLsForDebug (ResourceLoaderContext $context) | |
Get the URL or URLs to load for this module's JS in debug mode. | |
getStyleURLsForDebug (ResourceLoaderContext $context) | |
Get the URL or URLs to load for this module's CSS in debug mode. | |
getTargets () | |
Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile']. | |
getTemplates () | |
Takes named templates by the module and returns an array mapping. | |
getVersionHash (ResourceLoaderContext $context) | |
Get a string identifying the current version of this module in a given context. | |
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. | |
supportsURLLoading () | |
Whether this module supports URL loading. | |
Protected Attributes | |
$dependencies = [] | |
$group = null | |
$isKnownEmpty = false | |
$isRaw = false | |
$messages = [] | |
$script = '' | |
$shouldEmbed = null | |
$skipFunction = null | |
$source = 'local' | |
$styles = '' | |
$targets = [ 'phpunit' ] | |
$type = ResourceLoaderModule::LOAD_GENERAL | |
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 = [] | |
Additional Inherited Members | |
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. | |
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' |
Protected Member Functions inherited from ResourceLoaderModule | |
buildContent (ResourceLoaderContext $context) | |
Bundle all resources attached to this module into an array. | |
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. | |
getLessVars (ResourceLoaderContext $context) | |
Get module-specific LESS variables, if any. | |
getLogger () | |
getMessageBlob (ResourceLoaderContext $context) | |
Get the hash of the message blob. | |
getPreloadLinks (ResourceLoaderContext $context) | |
Get a list of resources that web browsers may preload. | |
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 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. | |
Definition at line 84 of file ResourceLoaderTestCase.php.
ResourceLoaderTestModule::__construct | ( | $options = [] | ) |
Definition at line 98 of file ResourceLoaderTestCase.php.
ResourceLoaderTestModule::enableModuleContentVersion | ( | ) |
Whether to generate version hash based on module content.
If a module requires database or file system access to build the module content, consider disabling this in favour of manually tracking relevant aspects in getDefinitionSummary(). See getVersionHash() for how this is used.
Reimplemented from ResourceLoaderModule.
Definition at line 147 of file ResourceLoaderTestCase.php.
ResourceLoaderTestModule::getDependencies | ( | ResourceLoaderContext | $context = null | ) |
Get a list of modules this module depends on.
Dependency information is taken into account when loading a module on the client side.
Note: It is expected that $context will be made non-optional in the near future.
ResourceLoaderContext | $context |
Reimplemented from ResourceLoaderModule.
Definition at line 116 of file ResourceLoaderTestCase.php.
References $dependencies.
ResourceLoaderTestModule::getGroup | ( | ) |
Get the group this module is in.
Reimplemented from ResourceLoaderModule.
Definition at line 120 of file ResourceLoaderTestCase.php.
References $group.
ResourceLoaderTestModule::getMessages | ( | ) |
Get the messages needed for this module.
To get a JSON blob with messages, use MessageBlobStore::get()
Reimplemented from ResourceLoaderModule.
Definition at line 112 of file ResourceLoaderTestCase.php.
References $messages.
ResourceLoaderTestModule::getScript | ( | ResourceLoaderContext | $context | ) |
Get all JS for this module for a given language and skin.
Includes all relevant JS except loader scripts.
ResourceLoaderContext | $context |
Reimplemented from ResourceLoaderModule.
Definition at line 104 of file ResourceLoaderTestCase.php.
References ResourceLoaderModule\validateScriptFile().
ResourceLoaderTestModule::getSkipFunction | ( | ) |
Get the skip function.
Modules that provide fallback functionality can provide a "skip function". This function, if provided, will be passed along to the module registry on the client. When this module is loaded (either directly or as a dependency of another module), then this function is executed first. If the function returns true, the module will instantly be considered "ready" without requesting the associated module resources.
The value returned here must be valid javascript for execution in a private function. It must not contain the "function () {" and "}" wrapper though.
Reimplemented from ResourceLoaderModule.
Definition at line 132 of file ResourceLoaderTestCase.php.
References $skipFunction.
ResourceLoaderTestModule::getSource | ( | ) |
Get the origin of this module.
Should only be overridden for foreign modules.
Reimplemented from ResourceLoaderModule.
Definition at line 124 of file ResourceLoaderTestCase.php.
References $source.
ResourceLoaderTestModule::getStyles | ( | ResourceLoaderContext | $context | ) |
Get all CSS for this module for a given skin.
ResourceLoaderContext | $context |
Reimplemented from ResourceLoaderModule.
Definition at line 108 of file ResourceLoaderTestCase.php.
References $styles.
ResourceLoaderTestModule::getType | ( | ) |
Get the module's load type.
Reimplemented from ResourceLoaderModule.
Definition at line 128 of file ResourceLoaderTestCase.php.
References $type.
ResourceLoaderTestModule::isKnownEmpty | ( | ResourceLoaderContext | $context | ) |
Check whether this module is known to be empty.
If a child class has an easy and cheap way to determine that this module is definitely going to be empty, it should override this method to return true in that case. Callers may optimize the request for this module away if this function returns true.
ResourceLoaderContext | $context |
Reimplemented from ResourceLoaderModule.
Definition at line 139 of file ResourceLoaderTestCase.php.
References $isKnownEmpty.
ResourceLoaderTestModule::isRaw | ( | ) |
Whether this module's JS expects to work without the client-side ResourceLoader module.
Returning true from this function will prevent mw.loader.state() call from being appended to the bottom of the script.
Reimplemented from ResourceLoaderModule.
Definition at line 136 of file ResourceLoaderTestCase.php.
References $isRaw.
ResourceLoaderTestModule::shouldEmbedModule | ( | ResourceLoaderContext | $context | ) |
Check whether this module should be embeded rather than linked.
Modules returning true here will be embedded rather than loaded by ResourceLoaderClientHtml.
ResourceLoaderContext | $context |
Reimplemented from ResourceLoaderModule.
Definition at line 143 of file ResourceLoaderTestCase.php.
References $context.
|
protected |
Definition at line 86 of file ResourceLoaderTestCase.php.
Referenced by getDependencies().
|
protected |
Definition at line 87 of file ResourceLoaderTestCase.php.
Referenced by getGroup().
|
protected |
Definition at line 93 of file ResourceLoaderTestCase.php.
Referenced by isKnownEmpty().
|
protected |
Definition at line 92 of file ResourceLoaderTestCase.php.
Referenced by isRaw().
|
protected |
Definition at line 85 of file ResourceLoaderTestCase.php.
Referenced by getMessages().
|
protected |
Definition at line 89 of file ResourceLoaderTestCase.php.
|
protected |
Definition at line 96 of file ResourceLoaderTestCase.php.
|
protected |
Definition at line 91 of file ResourceLoaderTestCase.php.
Referenced by getSkipFunction().
|
protected |
Definition at line 88 of file ResourceLoaderTestCase.php.
Referenced by getSource().
|
protected |
Definition at line 90 of file ResourceLoaderTestCase.php.
Referenced by getStyles().
|
protected |
Definition at line 95 of file ResourceLoaderTestCase.php.
|
protected |
Definition at line 94 of file ResourceLoaderTestCase.php.
Referenced by getType().