MediaWiki REL1_33
ResourceLoaderUserTokensModule.php
Go to the documentation of this file.
1<?php
28
30
31 protected $targets = [ 'desktop', 'mobile' ];
32
40 $user = $context->getUserObj();
41
42 return [
43 'editToken' => $user->getEditToken(),
44 'patrolToken' => $user->getEditToken( 'patrol' ),
45 'watchToken' => $user->getEditToken( 'watch' ),
46 'csrfToken' => $user->getEditToken(),
47 ];
48 }
49
55 // Use FILTER_NOMIN annotation to prevent needless minification and caching (T84960).
56 return ResourceLoader::FILTER_NOMIN . Xml::encodeJsCall(
57 'mw.user.tokens.set',
58 [ $this->contextUserTokens( $context ) ],
59 ResourceLoader::inDebugMode()
60 );
61 }
62
66 public function supportsURLLoading() {
67 return false;
68 }
69
73 public function getGroup() {
74 return 'private';
75 }
76}
Object passed around to modules which contains information about the state of a specific loader reque...
Abstraction for ResourceLoader modules, with name registration and maxage functionality.
contextUserTokens(ResourceLoaderContext $context)
Fetch the tokens for the current user.
getScript(ResourceLoaderContext $context)
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:2848