Go to the documentation of this file.
3 use Wikimedia\TestingAccessWrapper;
14 'variants' => [
'destructive' ],
24 'ltr' =>
'mno-ltr.svg',
25 'rtl' =>
'mno-rtl.svg',
27 'he' =>
'mno-ltr.svg',
33 'default' =>
'pqr-a.svg',
36 'ar,de' =>
'pqr-f.svg',
62 'class' =>
'ResourceLoaderImageModule',
63 'prefix' =>
'oo-ui-icon',
70 .oo-ui-icon-abc-invert {
76 .oo-ui-icon-def-invert {
79 .oo-ui-icon-def-destructive {
85 .oo-ui-icon-ghi-invert {
91 .oo-ui-icon-mno-invert {
97 .oo-ui-icon-pqr-invert {
103 'class' =>
'ResourceLoaderImageModule',
104 'selectorWithoutVariant' =>
'.mw-ui-icon-{name}:after, .mw-ui-icon-{name}:before',
105 'selectorWithVariant' =>
106 '.mw-ui-icon-{name}-{variant}:after, .mw-ui-icon-{name}-{variant}:before',
110 '.mw-ui-icon-abc:after, .mw-ui-icon-abc:before {
113 .mw-ui-icon-abc-invert:after, .mw-ui-icon-abc-invert:before {
116 .mw-ui-icon-def:after, .mw-ui-icon-def:before {
119 .mw-ui-icon-def-invert:after, .mw-ui-icon-def-invert:before {
122 .mw-ui-icon-def-destructive:after, .mw-ui-icon-def-destructive:before {
125 .mw-ui-icon-ghi:after, .mw-ui-icon-ghi:before {
128 .mw-ui-icon-ghi-invert:after, .mw-ui-icon-ghi-invert:before {
131 .mw-ui-icon-mno:after, .mw-ui-icon-mno:before {
134 .mw-ui-icon-mno-invert:after, .mw-ui-icon-mno-invert:before {
137 .mw-ui-icon-pqr:after, .mw-ui-icon-pqr:before {
140 .mw-ui-icon-pqr-invert:after, .mw-ui-icon-pqr-invert:before {
154 __DIR__ .
'/../../data/resourceloader'
157 $this->assertEquals( $expected, $styles[
'all'] );
165 $this->assertFalse(
$context->getImageObj(),
'Missing image parameter' );
168 'image' =>
'example',
170 $this->assertFalse(
$context->getImageObj(),
'Missing module parameter' );
173 'modules' =>
'unknown',
174 'image' =>
'example',
176 $this->assertFalse(
$context->getImageObj(),
'Not an image module' );
179 $rl->register(
'test', [
182 'images' => [
'example' =>
'example.png' ],
186 'image' =>
'unknown',
188 $this->assertFalse(
$context->getImageObj(),
'Unknown image' );
191 $rl->register(
'test', [
194 'images' => [
'example' =>
'example.png' ],
198 'image' =>
'example',
208 background-image: url(rasterized.png);
209 background-image: linear-gradient(transparent, transparent), url(
original.svg);
210 background-image: -o-linear-gradient(transparent, transparent), url(rasterized.png);
214 'data:image/svg+xml',
216 background-image: url(rasterized.png);
217 background-image: linear-gradient(transparent, transparent), url(
data:image/svg+xml);
218 background-image: -o-linear-gradient(transparent, transparent), url(rasterized.png);
234 $styles = $module->getStyleDeclarations(
240 $this->assertEquals( $expected, $styles );
244 $image = $this->getMockBuilder(
'ResourceLoaderImage' )
245 ->disableOriginalConstructor()
247 $image->method(
'getDataUri' )
248 ->will( $this->returnValue( $dataUriReturnValue ) );
251 ->will( $this->returnValueMap( [
252 [
$context,
'load.php',
null,
'original',
'original.svg' ],
253 [
$context,
'load.php',
null,
'rasterized',
'rasterized.png' ],
getImageMock(ResourceLoaderContext $context, $dataUriReturnValue)
Object passed around to modules which contains information about the state of a specific loader reque...
testGetStyles( $module, $expected)
providerGetModules ResourceLoaderImageModule::getStyles
WebRequest clone which takes values from a provided array.
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
getCssDeclarations( $primary, $fallback)
Replace with a stub to make test cases easier to write.
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 original
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
static $commonImageVariants
testGetStyleDeclarations( $dataUriReturnValue, $expected)
providerGetStyleDeclarations ResourceLoaderImageModule::getStyleDeclarations
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check $image
they could even be mouse clicks or menu items whatever suits your program You should also get your if any
testContext()
ResourceLoaderContext::getImageObj.
getResourceLoaderContext( $options=[], ResourceLoader $rl=null)
static providerGetStyleDeclarations()
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
ResourceLoader module for generated and embedded images.
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 data
static providerGetModules()