MediaWiki
1.30.2
|
Public Member Functions | |
__construct ( $options=[]) | |
enableModuleContentVersion () | |
getDependencies (ResourceLoaderContext $context=null) | |
Get a list of modules this module depends on. More... | |
getGroup () | |
Get the group this module is in. More... | |
getMessages () | |
Get the messages needed for this module. More... | |
getPosition () | |
From where in the page HTML should this module be loaded? More... | |
getScript (ResourceLoaderContext $context) | |
Get all JS for this module for a given language and skin. More... | |
getSkipFunction () | |
Get the skip function. More... | |
getSource () | |
Get the origin of this module. More... | |
getStyles (ResourceLoaderContext $context) | |
Get all CSS for this module for a given skin. More... | |
getType () | |
Get the module's load type. More... | |
isKnownEmpty (ResourceLoaderContext $context) | |
Check whether this module is known to be empty. More... | |
isRaw () | |
Whether this module's JS expects to work without the client-side ResourceLoader module. More... | |
shouldEmbedModule (ResourceLoaderContext $context) | |
Check whether this module should be embeded rather than linked. More... | |
Public Member Functions inherited from ResourceLoaderModule | |
getConfig () | |
getDefinitionMtime (ResourceLoaderContext $context) | |
Back-compat dummy for old subclass implementations of getModifiedTime(). More... | |
getDefinitionSummary (ResourceLoaderContext $context) | |
Get a list of resources that web browsers may preload. More... | |
getFlip ( $context) | |
getHashMtime (ResourceLoaderContext $context) | |
Back-compat dummy for old subclass implementations of getModifiedTime(). More... | |
getHeaders (ResourceLoaderContext $context) | |
Get headers to send as part of a module web response. More... | |
getModifiedHash (ResourceLoaderContext $context) | |
Helper method for providing a version hash to getVersionHash(). More... | |
getModifiedTime (ResourceLoaderContext $context) | |
Get this module's last modification timestamp for a given context. More... | |
getName () | |
Get this module's name. More... | |
getOrigin () | |
Get this module's origin. More... | |
getScriptURLsForDebug (ResourceLoaderContext $context) | |
Get the URL or URLs to load for this module's JS in debug mode. More... | |
getStyleURLsForDebug (ResourceLoaderContext $context) | |
Get the URL or URLs to load for this module's CSS in debug mode. More... | |
getTargets () | |
Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile']. More... | |
getTemplates () | |
Takes named templates by the module and returns an array mapping. More... | |
setConfig (Config $config) | |
setFileDependencies (ResourceLoaderContext $context, $files) | |
Set in-object cache for file dependencies. More... | |
setLogger (LoggerInterface $logger) | |
setMessageBlob ( $blob, $lang) | |
Set in-object cache for message blobs. More... | |
setName ( $name) | |
Set this module's name. More... | |
supportsURLLoading () | |
Whether this module supports URL loading. More... | |
Protected Attributes | |
$dependencies = [] | |
$group = null | |
$isKnownEmpty = false | |
$isRaw = false | |
$messages = [] | |
$position = 'bottom' | |
$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. More... | |
static | getRelativePaths (array $filePaths) |
Make file paths relative to MediaWiki directory. More... | |
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 | |
getDeprecationInformation () | |
Get JS representing deprecation information for the current module if available. More... | |
getFileDependencies (ResourceLoaderContext $context) | |
Get the files this module depends on indirectly for a given skin. More... | |
getLogger () | |
getMessageBlob (ResourceLoaderContext $context) | |
Get the hash of the message blob. More... | |
saveFileDependencies (ResourceLoaderContext $context, $localFileRefs) | |
Set the files this module depends on indirectly for a given skin. More... | |
validateScriptFile ( $fileName, $contents) | |
Validate a given script file; if valid returns the original source. More... | |
Static Protected Member Functions inherited from ResourceLoaderModule | |
static | javaScriptParser () |
static | safeFileHash ( $filePath) |
Compute a non-cryptographic string hash of a file's contents. More... | |
static | safeFilemtime ( $filePath) |
Safe version of filemtime(), which doesn't throw a PHP warning if the file doesn't exist. More... | |
Definition at line 85 of file ResourceLoaderTestCase.php.
ResourceLoaderTestModule::__construct | ( | $options = [] | ) |
Definition at line 100 of file ResourceLoaderTestCase.php.
ResourceLoaderTestModule::enableModuleContentVersion | ( | ) |
Definition at line 152 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 118 of file ResourceLoaderTestCase.php.
References $dependencies.
ResourceLoaderTestModule::getGroup | ( | ) |
Get the group this module is in.
Reimplemented from ResourceLoaderModule.
Definition at line 122 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 114 of file ResourceLoaderTestCase.php.
References $messages.
ResourceLoaderTestModule::getPosition | ( | ) |
From where in the page HTML should this module be loaded?
<head>
. Reimplemented from ResourceLoaderModule.
Definition at line 129 of file ResourceLoaderTestCase.php.
References $position.
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 106 of file ResourceLoaderTestCase.php.
References script(), and 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 137 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 126 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 110 of file ResourceLoaderTestCase.php.
References $styles.
ResourceLoaderTestModule::getType | ( | ) |
Get the module's load type.
Reimplemented from ResourceLoaderModule.
Definition at line 133 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 144 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 141 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 148 of file ResourceLoaderTestCase.php.
References $context.
|
protected |
Definition at line 87 of file ResourceLoaderTestCase.php.
Referenced by getDependencies().
|
protected |
Definition at line 88 of file ResourceLoaderTestCase.php.
Referenced by getGroup().
|
protected |
Definition at line 95 of file ResourceLoaderTestCase.php.
Referenced by isKnownEmpty().
|
protected |
Definition at line 94 of file ResourceLoaderTestCase.php.
Referenced by isRaw().
|
protected |
Definition at line 86 of file ResourceLoaderTestCase.php.
Referenced by getMessages().
|
protected |
Definition at line 90 of file ResourceLoaderTestCase.php.
Referenced by getPosition().
|
protected |
Definition at line 91 of file ResourceLoaderTestCase.php.
|
protected |
Definition at line 98 of file ResourceLoaderTestCase.php.
|
protected |
Definition at line 93 of file ResourceLoaderTestCase.php.
Referenced by getSkipFunction().
|
protected |
Definition at line 89 of file ResourceLoaderTestCase.php.
Referenced by getSource().
|
protected |
Definition at line 92 of file ResourceLoaderTestCase.php.
Referenced by getStyles().
|
protected |
Definition at line 97 of file ResourceLoaderTestCase.php.
|
protected |
Definition at line 96 of file ResourceLoaderTestCase.php.
Referenced by getType().