MediaWiki REL1_31
ResourceLoaderJqueryMsgModule.php
Go to the documentation of this file.
1<?php
27
33 $fileScript = parent::getScript( $context );
34
35 $tagData = Sanitizer::getRecognizedTagData();
36 $parserDefaults = [];
37 $parserDefaults['allowedHtmlElements'] = array_merge(
38 array_keys( $tagData['htmlpairs'] ),
39 array_diff(
40 array_keys( $tagData['htmlsingle'] ),
41 array_keys( $tagData['htmlsingleonly'] )
42 )
43 );
44
45 $mainDataScript = Xml::encodeJsCall( 'mw.jqueryMsg.setParserDefaults', [ $parserDefaults ] );
46
47 // Associative array mapping magic words (e.g. SITENAME)
48 // to their values.
49 $magicWords = [
50 'SITENAME' => $this->getConfig()->get( 'Sitename' ),
51 ];
52
53 Hooks::run( 'ResourceLoaderJqueryMsgModuleMagicWords', [ $context, &$magicWords ] );
54
55 $magicWordExtendData = [
56 'magic' => $magicWords,
57 ];
58
59 $magicWordDataScript = Xml::encodeJsCall( 'mw.jqueryMsg.setParserDefaults', [
60 $magicWordExtendData,
61 /* deep= */ true
62 ] );
63
64 return $fileScript . $mainDataScript . $magicWordDataScript;
65 }
66
72 // Bypass file module urls
74 }
75
79 public function enableModuleContentVersion() {
80 return true;
81 }
82}
Object passed around to modules which contains information about the state of a specific loader reque...
ResourceLoader module based on local JavaScript/CSS files.
ResourceLoader module for mediawiki.jqueryMsg and its generated data.
getScript(ResourceLoaderContext $context)
getScriptURLsForDebug(ResourceLoaderContext $context)
getScriptURLsForDebug(ResourceLoaderContext $context)
Get the URL or URLs to load for this module's JS in debug mode.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
Definition hooks.txt:2811
magicword txt Magic Words are some phrases used in the wikitext They are used for two that looks like templates but that don t accept any parameter *Parser functions(like {{fullurl:...}}, {{#special:...}}) $magicWords['en']
Definition magicword.txt:33