aboutsummaryrefslogtreecommitdiffstats
path: root/includes/media/SVG.php
Commit message (Collapse)AuthorAgeFilesLines
* media: Rename files to match the name of the class they defineTimo Tijhof2018-04-281-593/+0
| | | | | | | | This will make jumping from file to file much easier in text editors when file name lookups will autocomplete naturally when looking for a class by name. Change-Id: I4b2e55a2e72674b619d5a592866c8a019a2b0224
* Update suppressWarning()/restoreWarning() callsReedy2018-02-101-4/+4
| | | | | Bug: T182273 Change-Id: I9e1b628fe5949ca54258424c2e45b2fb6d491d0f
* Remove unuseful debug messagesNiklas Laxström2017-12-041-2/+0
| | | | | | | | I spotted one of these in my debug log. Without context it is not useful nor informative. Given it can actually come from three places, it is useless. Change-Id: Ic293d8944e9a1a8152c5a5e0b695c5ddc07ee6aa
* Treat langtags in SVG switch case-insensitivelyCormac Parle2017-11-101-9/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See https://tools.ietf.org/html/bcp47#section-2.1.1 Also implement matching of systemLanguage attribs as specified in the SVG spec Note that librsvg that we use for rendering pngs of svg files has a bug, and matches languages in the following way instead of what is implemented in SVG::getMatchedLanguage() public function getMatchedLanguage( $userPreferredLanguage, array $svgLanguages ) { foreach ( $svgLanguages as $svgLang ) { if ($svgLang == $userPreferredLanguage) { return $svgLang; } $dashPosition = strpos( $userPreferredLanguage, '-' ); if ( $dashPosition !== false ) { if ( strtolower( substr( $svgLang, 0, $dashPosition ) ) == strtolower( substr( $userPreferredLanguage, 0, $dashPosition ) ) ) { return $svgLang; } } return null; } Bug: T154132 Change-Id: Ibff66a0844f0cecfae0260c6a7d20aeedc2849a2
* Add missing & to @param documentation to match functon callUmherirrender2017-08-111-1/+1
| | | | Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
* Merge "Added a separate error message for mkdir failures"jenkins-bot2017-08-091-1/+11
|\
| * Added a separate error message for mkdir failuresLee Bousfield2017-06-131-1/+11
| | | | | | | | | | Bug: T125595 Change-Id: Id2daaad45c594d6f6265120039ca30742472987e
* | Fix MediaTransformError message handlingBrad Jorsch2016-11-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | Give access to the raw Message instead of only to the HTML or text in the RequestContext language. Pass Message objects instead of strings from calling ->text() as the parameters of Messages so if the outer Message's language is changed things get parsed sensibly. Change-Id: Ibd6c1217b6fed839c888b66e02900f8e21ed3e6b
* | Use namespaced ScopedCallbackKunal Mehta2016-10-171-0/+1
| | | | | | | | | | | | The un-namespaced \ScopedCallback is deprecated. Change-Id: Ie014d5a775ead66335a24acac9d339915884d1a4
* | Migrate callers to new MWFileProps::getPropsFromPath() methodAaron Schulz2016-09-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | * FSFile should not be responsible for handling this much logic. * Make more MediaHandler classes aware of the fact that an object other than File might be passed in. Use the FSFile instead of a useless empty stdClass object. * Also added more fields to FSFile::placeholderProps to make it more complete. Change-Id: I9fe764b2a7261af507c6555e6a57273cf7d00d36
* | Many more function case mismatchesReedy2016-03-191-1/+1
| | | | | | | | Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
* | Add missing 'public' keywords to some MediaHandler methodsRicordisamoa2016-02-241-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | * getParamMap * validateParam * makeParamString * parseParamString * canRender * mustRender * isMultiPage Change-Id: I0c00a61abf9be400dca5407370ca2c232d57ae17
* | Convert all array() syntax to []Kunal Mehta2016-02-171-28/+28
|/ | | | | | | | | | 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
* Ignore some ScopedCallback IDE warningsAaron Schulz2015-07-151-0/+1
| | | | Change-Id: Iefe24ee5dae90d70c2acaaae9dc5d44c1758d53a
* Use mediawiki/at-ease library for suppressing warningsKunal Mehta2015-06-111-4/+4
| | | | | | | | | | | | | | | wfSuppressWarnings() and wfRestoreWarnings() were split out into a separate library. All usages in core were replaced with the new functions, and the wf* global functions are marked as deprecated. Additionally, some uses of @ were replaced due to composer's autoloader being loaded even earlier. Ie1234f8c12693408de9b94bf6f84480a90bd4f8e adds the library to mediawiki/vendor. Bug: T100923 Change-Id: I5c35079a0a656180852be0ae6b1262d40f6534c4
* Change case of class names to match declarationsKevin Israel2015-04-291-1/+1
| | | | | | | | | | | Found by running a script that uses PHP's tokenizer extension to extract class declarations and uses, then compare them: * AllMessagesTablePager * SVGReader * XML Change-Id: I960aa05b2127722ecc5ae8b165549f9e1077d3c1
* Corrected typos in function name unpackMetaData and getMetaDataTony Thomas2015-04-131-2/+2
| | | | | Bug: T95873 Change-Id: I71dffaaed24c983ce07bc02f806294337ca086e2
* Replace mb_strtolower with strtolowerNiklas Laxström2015-03-251-1/+1
| | | | | | | | | Function mb_strtolower is not guaranteed to be present. In this case we are dealing with language codes, which are ASCII, for which there is no need to use multibyte version in the first place. Bug: T55912 Change-Id: I009bab2ff03b22142d35c8be60711266ca3683c1
* Pass context to FormatMetadata class on ImagePageumherirrender2015-01-301-1/+2
| | | | | | | | This avoids on image page: ContextSource::getContext (FormatMetadata): called and $context is null. Using RequestContext::getMain() for sanity Change-Id: I92774e1a88f03d44967d1797c6c2b8a31c1b10fc
* Updated some try-catch statements: MWException -> ExceptionAaron Schulz2015-01-091-1/+1
| | | | Change-Id: I76601a86e30f4984e3b1a8c8ec5ef5a0f652433a
* Removed remaining profile callsAaron Schulz2015-01-081-2/+0
| | | | Change-Id: I31c81c78715048004fc8fca0f27d09c1fa71c118
* Add missing @param to function docsumherirrender2014-08-141-0/+3
| | | | Change-Id: Ib7ac94d05a04490f25dfd40b46b27973cbab582c
* Fixed spacingumherirrender2014-08-041-1/+1
| | | | | | | | | - Removed spaces around array index - Changed else if to elseif - Added space after foreach/if/function - include_once is not a function Change-Id: I7745ae791d1b7e60cfebec6d268513a9cc071bdd
* Merge "Have SvgHandler create a directory for its RSVG input files"jenkins-bot2014-07-291-1/+34
|\
| * Have SvgHandler create a directory for its RSVG input filesAaron Schulz2014-07-141-1/+34
| | | | | | | | | | | | | | * This avoids needing to patch rsvg on 14.04 bug: 67402 Change-Id: I81ac0c6c62003ed5a8e33694751484498e6e7277
* | Cleanup some docs (includes/[m-r])umherirrender2014-07-241-1/+1
|/ | | | | | | | | | - Swap "$variable type" to "type $variable" - Added missing types - Fixed spacing inside docs - Makes beginning of @param/@return/@var/@throws in capital - Changed some types to match the more common spelling Change-Id: I8ebfbcea0e2ae2670553822acedde49c1aa7e98d
* Fix misnamed SVGHandler::canAnimateThumb()Brian Wolff2014-06-101-1/+1
| | | | | | | | | | | | Caused the animation warning to not be present on image description pages Also add unit tests. Since I'm adding an animated svg file for this unit test, also add a metadata extraction test for animated svgs, since we're missing one. Change-Id: Id03e1a0e1c151d3c575a695a42c54b709187d10a follow-up: 876128f8c9f0ce6a8424336f
* Fixed some @params documentation (includes/*)umherirrender2014-04-201-2/+2
| | | | | | | | | Swapped some "$var type" to "type $var" or added missing types before the $var. Changed some other types to match the more common spelling. Makes beginning of some text in captial. Also added some missing @param. Change-Id: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
* Make SVG language selector "use default lang" actually workBrian Wolff2013-12-171-1/+1
| | | | | | | Also have ImagePage check that the given language is actually valid, before trying to transform with that language. Change-Id: I62b8035b70f5cb3388f4c2a844f3bc1c7c92d01e
* Make visibleMetadataField protectedSiebrand Mazeland2013-12-141-1/+1
| | | | | | Related patch sets: * https://gerrit.wikimedia.org/r/#/c/99429/ Extension PagedTiffHandler Change-Id: I0441fdf1ce1e06688f16c62e1993bb05911b45bc
* Fixed spacingumherirrender2013-12-081-1/+1
| | | | | | | - Added space after foreach - Added/Removed spaces inside arrays Change-Id: Ia8775824fa33976b1a4dab43e07f1bff0c57479c
* Merge "Add UI to discover translated SVG files."jenkins-bot2013-12-061-1/+38
|\
| * Add UI to discover translated SVG files.Brian Wolff2013-12-061-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we support rendering SVGs in multiple languages, but there is no mechanism for users to discover what languages a file is available in. Show this information on the image page. At the moment, if unspecified we always default the language to english (I believe to avoid mass cache splitting, especially if most languages wouldn't have a translation of the file in their language). This code was written in such a way so that this assumption should be changable in the future if we so desire. Long term, Jarry has a super cool svg translation extension which would take over some of this. However I still believe we should have an interface for this in core, since we do support the different language renderings in core. Change-Id: I84506436514e09d71200aa2db3932aa001b55c71
* | Fix SvgHandler::getScriptParams to not give warnings.Brian Wolff2013-12-061-4/+6
|/ | | | Change-Id: I664e4667bdcff89c1c5ee01a11b723a36212a57f
* Update documentation for media related classesSiebrand Mazeland2013-12-061-21/+25
| | | | Change-Id: I7a9c8d59f88c68dc3835cb8a18f22a77cd7890fc
* generalize BitmapHandler::logErrorForExternalProcessAntoine Musso2013-12-061-3/+1
| | | | | | | | | | | | | | | | | | BitmapHandler::logErrorForExternalProcess is a wrapper around wfDebugLog( 'thumbnail' ). It got copy pasted from some other class at one point. This patch move the method up to general class MediaHandler and makes other child class uses it. The method will thus be available to extensions such as TimedMediaHandler. The reason I am doing that is that trim($err) generates a copy of $err which causes a memory allocation fatal error whenever $err is larger than the remaining memory allocatable. The patch will let us fix the bug by only altering one part of the code. bug: 57985 Change-Id: I5657f07d6e2cca05d53f2a5c30ec23622c171343
* Update formatting for media related classesSiebrand Mazeland2013-12-051-2/+17
| | | | Change-Id: Iaa81af5b65a650222fa65bf8c368e4f1ec3ce9c0
* Add an interface for getting "standard" file metadata.Brian Wolff2013-10-291-11/+39
| | | | | | | | | | | | | | Currently file metadata is handler dependant. However they usually end up extracting the same type of data (author, date, etc) plus one or two handler specific things. This adds a handler independent interface for getting metadata that is likely to be common for all types of file (At the moment, this is the exif/iptc/xmp information) This commit used to also contain stuff adding parser functions, which is now split to its own commit. This commit is needed by a bunch of other commits, in particular I0d957891e0. Change-Id: I43d9252f69dc5b8ba0b848cf40aa1b97329c85ae
* Add way of including all stderr output when executing commandBrian Wolff2013-09-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This adds an option to wfShellExec (and convenience function wfShellExecWithStderr), to make sure all stderr is duplicated to stdout. The previous method of doing this was to include 2>&1 on the command line. However this did not redirect errors from limit.sh (For example cgroups not set up, or if a command reached the file size limit set by ulimit). Not sure if this is the best approach, but it seems to work well, and compared to most other approaches I considered, actually gets the ulimit errors redirected too. Currently some files fail to render with no error whatsoever, hopefully this patch will make what went wrong more obvious. Also fix a comment in wfShellExec that was incorrect (trailing \n), and make the initial value of the return value variable be 200, so if there's ever a bug in php where its not being set properly, it would be immediately obvious what is happening. Bug: 53824 Change-Id: I833aeb3ab9da726ecb97331369ea187daad7e795
* Do not show empty metadata section on svgsumherirrender2013-08-241-1/+3
| | | | | | | | The SvgHandler does not output all metadata, that means the returned array can be empty. In this case return false to indicate that the metadata section should not be added on the image description page. Change-Id: I989154dbaaaafb2e924838c990e30a9ffe6842a9
* Fix spacing and break some linesumherirrender2013-08-241-5/+5
| | | | Change-Id: Ia57685d8858e02e399ad5c75ce64d12609d340ac
* The language used to render SVGs should be definablejarry12502013-06-051-4/+76
| | | | | | | | | | | | | | | | | | | | See bug for context. The implementation is slightly untidy because I've written it so as to avoid invalidating the existing SVG thumbs -- there will be no immediate difference (visual/performance/other) as a result of this. Tested by me in both... * [[File:Example.svg|thumb|lang=fr]] AND * http://example.org/w/index.php?title=File:Example.svg&lang=fr ...modes. Example file on https://commons.wikimedia.org/wiki/File:Gerrit_patchset_25838_test.svg Added parser tests. Bug: 32987 Change-Id: I4cadf96ecd5e169a88ad468a0478d355db980103
* docs: Remove odd colons after @todoTimo Tijhof2013-05-151-1/+1
| | | | | | | | | | Most were this way already: https://doc.wikimedia.org/mediawiki-core/master/php/html/todo.html Ran a find/replace on the odd ones. Also made them all lower case. Change-Id: I70c6a69344ddebc603e9a1c1d87e3cc4f4f4c560
* Fixed spacing around parenthesis in includesumherirrender2013-04-281-1/+1
| | | | Change-Id: Ie8adc00f4ee8ecec4554e584c18d5d2073415397
* Fixed spacing in context/installer/media/templates/upload folderumherirrender2013-04-211-2/+2
| | | | | | | Added spaces before if, foreach Added some braces for one line statements Change-Id: I9761be9fa47adc3554852a97b19792b4648466ad
* fix some spacingumherirrender2013-02-041-6/+6
| | | | Change-Id: I88e73d47a552918880514d88a876296a6cb80d88
* Store "bad metadata" placeholder metadata for SVGs.Aaron Schulz2012-11-281-12/+26
| | | | | | | | * This prevents excessive download (getLocalReference()) and metadata extraction operations to keep reloading metadata again and again. * This also avoids DB load and lock timeouts due to constants UPDATEs. Change-Id: I9d35467d3a5e23a07e880dbdf59fccda4b598faf
* Fix indentation whitespace errorsumherirrender2012-10-261-1/+1
| | | | Change-Id: Ie268bee2098c589c050e1b5b0e93fe1b3feca86f
* Update docs for return and exception infoSiebrand Mazeland2012-10-091-8/+9
| | | | | | | * Removed some inline tabs in the process. * IDE fixed some incorrect leading spaces, too. Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
* Convert core to use new ThumbnailImage() constructorjarry12502012-09-011-2/+2
| | | | | | | See change #21321 for the introduction of that new constructor and the reasoning behind it. Change-Id: I15843fab4217333077e16ae187e7c09f76d47e58