Commit graph

25 commits

Author SHA1 Message Date
Jakub Vrana
41699386a9 Use correct letter case
Found by PHPStan.

Change-Id: Iaff53951e1e49b9bb99f7bf9da5a228765ead7f3
2018-12-01 10:28:18 +01:00
Ed Sanders
8477d4a6f5 Define which languages explicitly fallback to 'en'
In the message store, all messages fall through to English,
but only a few languages should actually explicitly fallback
to English (English variants and dialects).

These new explicit fallbacks are used by ResourceLoaderImageModule,
and this change doesn't affect the message fall through system.

Bug: T203350
Change-Id: I6b68a17f4d69341bccdae748727b5133a600d8bc
2018-09-19 15:55:38 -07:00
jdlrobson
8faba225fe ResourceLoaderImage module definitions can define a defaultColor
Bug: T197909
Change-Id: I0745e112d11026ed59d8daca990b313305cd094a
2018-06-27 20:36:47 +00:00
Ed Sanders
b964607dce Use fallback languages in ResourceLoaderImage
Bug: T191120
Change-Id: Ic72aead466c12d344bac359654e6dcc7f0e5c8cb
2018-04-01 20:41:01 +01:00
Timo Tijhof
98b148d247 resourceloader: Minor documentation and coding style improvements
Based on current non-voting codesniffer warnings.

Change-Id: I34cbc31eda3eaa519a71fe2c04122859f2f15914
2017-06-30 17:31:56 -07:00
Roan Kattouw
c03f57bc11 ResourceLoaderImage: Correctly ignore 'deprecated' key
It turns out that 'resources/lib/oojs-ui/themes/mediawiki/Moved since v0.20.1, use from the 'interactions' pack instead.'
is not usually an existing file, and doesn't have the extension '.svg'.
Not sure why this didn't break earlier.

Bonus: Add module name to exceptions to make these errors easier
to track down.

Bonus #2: Use the post-expansion, not pre-expansion, definition everywhere
to avoid confusion when debugging.

Change-Id: I0325d4dab5658fd29c3c33fd3e762834b53d1b5d
2017-03-29 14:44:22 -04:00
Bartosz Dziewoński
37c5a5a1ae ResourceLoaderImage: Point to the right skin when generating URL
Previously, in skins using non-default OOUI theme (for example,
in MonoBook skin which uses Apex theme), when using a browser that
we don't serve SVG images to (for example, Internet Explorer 8),
the user would see the default theme's icons. This is noticeable
e.g. with the search box's icon on Special:Search.

Change-Id: I5a563c59efb267d8080161271513c0cc7d90d610
2017-03-17 03:30:23 +01:00
Amir Sarabadani
efa0d7af44 Clean up array() syntax in docs, part III
Also fixing some typos here and there

Change-Id: I29c29acf87f84ba9993ba75ebf2ad8091d981574
2016-08-13 05:40:40 +04:30
Timo Tijhof
b381dc161e resourceloader: Remove wfExpandUrl() from ResourceLoaderImage
Follows-up b5e69c4ef which did the same for already for ResourceLoader.php.

There's no need to expand the hostname into these urls. If load.php
is on the same domain (e.g. set to '/w/load.php') then this can be
resolved by the browser normally.

If load.php is on a custom domain, the stylesheet would be served
from there instead of from the wiki domain. However in that case
the hostname would already be part of $script value ($wgLoadScript).

Bug: T125292
Change-Id: I7242445335d69d7ae290da5f321a59edd537d819
2016-04-02 00:25:11 +01:00
Reedy
b5656b6953 Many more function case mismatches
Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
2016-03-19 00:20:58 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Bartosz Dziewoński
6c50ba80c3 ResourceLoaderImage: Use DomDocument::loadXml rather than DomDocument::load
Some users are reporting that DomDocument::load can't read the files
on their setups, while they can be read with file_get_contents. So use
that and pass the string to DomDocument::loadXml. The advantage of
DomDocument::load is supposed to be in handling large files, and the
icons here are supposed to be small.

Bug: T107198
Change-Id: I8e4dc4642f9d0c5f01ec5e4061e83bf09d0a4900
2016-01-31 22:26:37 +00:00
Siebrand Mazeland
d5392ece3c Fix 3 PHPCS warnings in ResourceLoaderImage.php
Change-Id: I2cadf8441ac28473e3c4d0bb122e74e3f6c031ed
2015-09-28 14:04:45 +02:00
paladox
dca469bb87 Fix phpcs warnings
Bug: T102614
Change-Id: Iecea365f83bbb0c336b58f1cfdebfc9b1112087e
2015-06-18 20:13:37 +00:00
umherirrender
d8821f2b0b Fixed spacing
- Removed space after casts
- Removed spaces in array index
- Added spaces around string concat
- Added space after words: switch, foreach
- else if -> elseif
- Removed parentheses around require_once, because it is not a function
- Added newline at end of file
- Removed double spaces
- Added spaces around operations
- Removed repeated newlines

Bug: T102609
Change-Id: Ib860222b24f8ad8e9062cd4dc42ec88dc63fb49e
2015-06-17 20:22:32 +00:00
Bartosz Dziewoński
807c08295a ResourceLoaderImageModule: Implement cache invalidation
Bug: T94733
Change-Id: I6ac2ef8d897813e560daa133b89a7932f8c1a362
2015-04-14 21:31:19 +02:00
Bartosz Dziewoński
a3e6df1690 ResourceLoaderImage: Allow shorthand syntax
array( "en,de,fr" => "foo.svg" ) now means the same as
array( "en" => "foo.svg", "de" => "foo.svg", "fr" => "foo.svg" ).

Bug: T76539
Change-Id: I0bf82e06be3c5f94b6ac88bbc0437b5229ceb284
2015-04-02 21:27:06 +02:00
Bartosz Dziewoński
d82912db51 ResourceLoaderImage: Some cleanup, typo fixes and tweaks
Change-Id: If46a15d09c3792758735dedb5e7f89984797a892
2015-03-30 19:15:41 +02:00
Bartosz Dziewoński
2d5d8b5363 ResourceLoaderImage: Throw exception if files don't exist
Change-Id: I67eb795f7fc4d35d15feb0717b1b781cbc45f78a
2015-03-30 19:15:37 +02:00
Bartosz Dziewoński
7aeadb7f68 resourceloader: Throw InvalidArgumentException for invalid constructor arguments
(But not for exceptions about missing files.)

Per Legoktm's comments on 8edbfb5feb.

Change-Id: I725f846476d2d97d3d820bc22674f7b5aab812bb
2015-03-30 19:15:36 +02:00
Bartosz Dziewoński
fca3887393 ResourceLoaderImageModule: Rename 'image' in descriptors to 'file'
Like in OOjs UI. Less confusing. No one is using this yet.

Bug: T93669
Change-Id: Ib1c9af96b46ba660b3697d272129e071da1fdf18
2015-03-29 19:38:14 +02:00
Kunal Mehta
f63bbdeb08 Fix phpcs warning and errors in includes/resourceloader
Mainly breaking long lines

Change-Id: Ide37c81d156348cfb8a010043d79eaf80f95fded
2015-03-14 18:52:45 -07:00
Chad Horohoe
231ea75c67 ResourceLoaderImage: tighten up svg handling
- Check $wgSVGConverter to see if it starts with rsvg, instead
  of just being rsvg. Other things like rsvg-secure are also ok.
- Make sure SvgHandler::rasterize() returned sanely before attempting
  to use the file it produces.
- Clean up temp SVG file if we return early
- Add some debug logging when rasterization fails

Bug: T89505
Change-Id: I9483c8c54a30e328565182b00d50dbf3b83076cd
2015-02-18 11:37:43 -08:00
Bartosz Dziewoński
844618a231 Use 'rsvg-convert' binary rather than 'rsvg' everywhere
Update $wgSVGConverters['rsvg'] to something closer to WMF production
configuration (there is a more complicated setup involving two
variants of rsvg for some reason).

Documentation is scarce, but 'rsvg-convert' appears to be the "modern"
way to call rsvg, with 'rsvg' being deprecated or not recommended.

Bug: T76476
Change-Id: I5ed877f3a5a1f1e97ae881c1d03fc977276182b6
2015-02-05 18:17:32 +00:00
Bartosz Dziewoński
aa00a3e838 ResourceLoaderImageModule for icons
ResourceLoaderImageModule needs a set of SVG files and some data in
the module definition, and produces styles for a set of CSS classes,
one for each image, optionally with differently colored variants,
generated in SVG and PNG, data-URI-embedded if possible, compatible
with all browsers, and generally slick.

The intended usage is to ship icon libraries with MediaWiki that can
be used throughout the pages with no additional code.

* ResourceLoaderImageModule implements all of the logic for data
  parsing and CSS generation.
* ResourceLoaderImage implements the logic for SVG image colorization
  (for variants) and rasterization.
* ResourceLoader and ResourceLoaderContext were extended to serve a
  new kind of load.php request that delivers a single image file. This
  is used for fallback PNG images served to browsers that don't
  understand SVG.

See change Ic6a76bfb for a demo.

Bug: T76473
Co-Authored-By: Trevor Parscal <trevorparscal@gmail.com>
Co-Authored-By: Bartosz Dziewoński <matma.rex@gmail.com>
Change-Id: Idf6ff4eb8e94f45946f15d283d34108b881fae6e
2014-12-09 20:11:07 +01:00