Commit graph

47 commits

Author SHA1 Message Date
umherirrender
70f3afd548 Remove unneeded empty lines at begin of if/else/foreach body
An if body must not begin with an empty line

Change-Id: I62b058be337fcc85a120fcd3dadce564db59a271
2015-06-19 20:05:45 +02:00
Kunal Mehta
f6e5079a69 Use mediawiki/at-ease library for suppressing warnings
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
2015-06-11 18:49:29 +00:00
Kevin Israel
74faccfa26 Change case of class names to match declarations
Found by running tests under a version of PHP patched to report
case mismatches as E_STRICT errors.

User classes:
* MIMEsearchPage
* MostlinkedTemplatesPage
* SpecialBookSources
* UnwatchedpagesPage

Internal classes:
* DOMXPath
* stdClass
* XMLReader

Did not change:
* testautoLoadedcamlCLASS
* testautoloadedserializedclass

Change-Id: Idc8caa82cd6adb7bab44b142af2b02e15f0a89ee
2014-12-19 16:01:26 +00:00
umherirrender
8ad1c92441 Fixed some @params documentation (includes/*)
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
2014-04-20 21:16:57 +02:00
umherirrender
661c5c3f01 Fixed spacing
- Added space after foreach
- Added/Removed spaces inside arrays

Change-Id: Ia8775824fa33976b1a4dab43e07f1bff0c57479c
2013-12-08 20:31:47 +01:00
Brian Wolff
960b238618 Extract list of languages svg is translated into.
SVG files support having different renderings based on language.
We support changing the rendering language, but we offer no
discoverability of what languages are available.

Long term Jarry's TranslateSVG will hopefully be used and have
all the associated awesomeness. In the mean time, we should
probably have some indication on the image page what languages
are available for the SVG. This is step 1 (extract the language).
I expect to follow this up with a commit adding some sort of
simple selector on the image page.

As an aside, it should be noted, this only detects languages
if its in the first $wgSVGMetadataCutoff (256 kb). This is a
compromise to avoid OOM on huge SVG files.

Change-Id: I2a462270fe63eb3e3023419eddc8b06f5a617ab5
2013-12-06 19:24:22 -04:00
Siebrand Mazeland
37bc4ec3dd Update documentation for media related classes
Change-Id: I7a9c8d59f88c68dc3835cb8a18f22a77cd7890fc
2013-12-06 23:03:06 +01:00
Siebrand Mazeland
370101602c Break long lines in media related classes
Change-Id: I94653b4cde14f75180dae795d1fdaa1b073ec1d1
2013-12-05 12:33:18 +01:00
Siebrand Mazeland
c7dbaa0f58 Update formatting for media related classes
Change-Id: Iaa81af5b65a650222fa65bf8c368e4f1ec3ce9c0
2013-12-05 11:05:05 +01:00
umherirrender
db24b10ca8 Use lowercase key words
Change-Id: I57569b7082a0decc8128ecadd8ec5d1a5c327673
2013-11-23 15:56:42 +01:00
umherirrender
6f79eef473 Fixed spacing around parenthesis in includes
Change-Id: Ie8adc00f4ee8ecec4554e584c18d5d2073415397
2013-04-28 15:50:07 +00:00
umherirrender
9f14ecf829 Added space after switch/Removed spaces after unset
While at it, added/removed some other spaces in the same files

Change-Id: I84d8001aa123a008807ad5eb76f396aed7c899a4
2013-04-26 16:42:31 +02:00
umherirrender
ee31d37821 Fixed spacing in context/installer/media/templates/upload folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I9761be9fa47adc3554852a97b19792b4648466ad
2013-04-21 06:22:06 +00:00
csteipp
1ed76385c3 Disable external entities in XMLReader
Temporarily disable loading entities in XMLReader when calling read()
with libxml_disable_entity_loader(true).

bug: 46859

Change-Id: I0b2ef270f15c7b4da17edee680bf7e2410919915
2013-04-15 13:49:45 -07:00
umherirrender
15abcf71ca Added/Removed spaces around string concatenation
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !

Fixed windows newline style

Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
2013-04-13 13:36:24 +02:00
umherirrender
6c278b6d7e fix some spacing
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
  calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays

Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
2013-03-25 22:22:46 +00:00
umherirrender
926d2ee143 Remove spaces between parentheses in function calls
Change-Id: If8ec665a01b566fa5189dfcc810b2d9a17f371e1
2013-03-17 16:13:22 +01:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
570dda0455 fix some spacing
Change-Id: I88e73d47a552918880514d88a876296a6cb80d88
2013-02-04 20:09:18 +00:00
umherirrender
2e8da558ba fix some spacing
Change-Id: Id7eda67a43f9040117edd79fdbeb678f1c3a6da2
2013-01-26 22:11:09 +01:00
umherirrender
c66d868e6d Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I166a171c196f4c2c75886be12f913ffa9a4a35ad
2012-10-19 22:10:42 +02:00
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
Brian Wolff
3c286bde96 Make the width/height in the SVG metadata box be in the SVG's units
This was suggested by a user at commons. The width/height in px is really
a MediaWiki thingy needed for rendering the image, from a metadata prespective
its the original units (aka the image should be 10cm, etc) that is
the information associated with the file.

The dimensions in pixels is still specified in the long description
of the image (the subtitle directly under the image).

Note: After gerrit change Ic58efbf2 is merged, this will cause no width or height
to be displayed for svg images with cached metadata, until they
get purged. I think that's perfectly ok as the width is
available elsewhere on the page.

p.s. I added one semi-unrelated code comment in SVGMetadataExtractor.

patchset 2,3: Fix test (hopefully, how come getting an up to date
version of PHPUnit is so difficult)
patchset 4: rebase
patchset 5: fix my accidental remove of a comment

Change-Id: I312fbd1c935a0095644c3b63c4929632c6f6e387
2012-08-23 16:19:28 -03:00
Brian Wolff
9ceb38a9fb (bug 39431) Fix how SVG metadata is displayed (esp. animated status)
(Quite a few of these issues are my fault from 65c27ddeb1)
*All fields were starting as collapsed, which was not the intent of the code
*Animated field used non-existent messages, and displayed a value of "1" instead
   of something meaningful to the user. Both (A)PNG and GIF handlers put
   the animated status in the long description which feels more natural to me
   so move the animated status to the long desc (long desc = subtitle under
   the image on the description page).
*Use human readable file sizes in the long description instead of
   total number of bytes. This bring it in line with the implementation
   in the parent class.
*Correctly mark scripted SVG's as animated. Mostly a moot point
   since we do not allow animated svgs past the upload checks
   but for completeness and for people who totally
   disable all upload verification.
   (Note: This would miss event attributes (onclick, etc)
   I didn't see much point in adding that since almost
   always there will be a script tag)

Patchset 3: trailing whitespace (d'oh)
patchset 4: rebasing so jenkins is happy

Change-Id: Ic58efbf2bf1e4b14e3129e5bce9ea920d9804111
2012-08-21 17:45:53 -07:00
Antoine Musso
aab43dd495 escape tags and entity in doxygen comments
When inserting XML elements inline <such as this one>, doxygen chokes
about it not being known. Simply enclosing the tag in double quotes
prevents doxygen from emitting a warning.

Also enclosed a few invalid functions calls such as \. and double quoted
the HTML entities such as &foobar;

Change-Id: I4019637145e683c2bec3d17b2fd98b0c50a932f1
2012-07-10 17:08:32 +02:00
Alexandre Emsenhuber
31003d22ea Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I26a320bcddd4122ce423f536609d5794446d743e
2012-05-03 22:22:45 +02:00
Sam Reed
2ec09c5165 More return documentation 2012-02-09 21:35:05 +00:00
Tim Starling
535725048d (bug 31719) Revert r107359 and apply a proper solution for entity expansion in SVGs. 2012-01-02 03:15:42 +00:00
Brian Wolff
079ae7594e (bug 31719) Apply Derk-Jan Hartman's patch to make '&ns_svg;' considered a namespace for svg files. Work around issue where entities not expanded by our SVGMetadataReader.
I'm leaving the bug open, since I'm not sure if this is a proper fix, but I think its significantly better than the current situation.
2011-12-27 02:57:25 +00:00
Sam Reed
96641da58e Add, update, tweak documentation
Fix document comment blocks

Tweak some returns
2011-10-26 03:44:47 +00:00
Mark A. Hershberger
3224372562 Fix Bug #30322 “SVG metadata is read incorrectly” by applying supplied patch 2011-08-11 19:51:51 +00:00
Platonides
36edac0170 Fixup r89029. You don't include the brackets in the method name!
--ta línea y las que están debajo serán ignoradas--

M    includes/media/SVGMetadataExtractor.php
M    tests/phpunit/includes/media/SVGMetadataExtractorTest.php
2011-07-20 15:13:58 +00:00
Niklas Laxström
c09c22bb9f fu r89029 - spelling 2011-05-28 13:03:16 +00:00
Antoine Musso
827254b99f Handle old libxml when extracting SVG metadata
Mac OS X 10.5.8 comes with libxml 2.6.16, thus some methods of XMLReader
are not availabe (ex: readInnerXML()).
This patch, throw an error if the above method does not exist (only one
use in our code).

Since metadata can comes as string or an XML fragment, I have split the tests
to take care of the two usages and of the exception.
2011-05-28 09:58:43 +00:00
Brion Vibber
d13482fdbe * (bug 27465) Fix metadata extraction for SVG files using unusual namespace names
The previous fix (in r82307) only checked explicitly for a namespace given the 'svg' prefix; this fix use XML namespacing support on XMLReader to check for the actual namespace URI correctly.
Fixed up a test case (for RDF extraction) and added trimming on the whitespace.
Also added another test case file that doesn't use a namespace name on the root.
2011-05-25 23:59:43 +00:00
Brion Vibber
8ce92ec6a7 Reverting r82307 (bug 27465) as initial step to recommitting a cleaner fix. 2011-05-25 23:57:44 +00:00
Sam Reed
e514478ba5 Fix function level comments that start with /* not /** 2011-05-21 19:35:16 +00:00
Brian Wolff
e6de99be92 (bug 27508) SVGMetadataExtractor takes too much resources on huge svg's. Change it so it only looks at begining of file.
Add a new config variable $wgSVGMetadataCutoff (currently set to 256kb, chosen rather arbitrarily)
and only read that much of the svg file when finding metadata. In general:
*Most (non-crazy huge map) svgs aren't that big, so there'd be no change in general
*Almost all files have any relevent metadata (well except for when we look for animation tags) is at the begining of the file
before actual image data.
*At the end of the day, even if this does miss metadata in some files (which I really doubt it would), I'd consider that a better
situation then the current situation where it can take 10 minutes or have OOM to parse the likes of [[:File:Puerto_Rico_ecosystems_map-fr.svg]]

Also has parts of/parts are based on Hartman's patch from bugzilla in it.

Also changes how it recurses into child elements looking for animation, to do so only when neccesary. 

Trims the results of reading values, because i was getting extra leading spaces when testing this.

Last of all, add a comment to the MediaHandler class about how the first parameter of MediaHandler::getMetadata is kind of useless.
(it confused me when I was doing this)
2011-03-06 08:15:49 +00:00
Platonides
97f843e93b If the unknown element is empty, there won't be a matching END_ELEMENT. There's nothing to peek inside. 2011-03-04 22:52:20 +00:00
Derk-Jan Hartman
d9a2c4bee1 Remove unneeded commented code, that I accidently added in r82461 2011-02-27 21:06:09 +00:00
Derk-Jan Hartman
18235437a8 Close the xmlreader when we are done with it. 2011-02-19 15:42:02 +00:00
Derk-Jan Hartman
d4a6ec755a Add support for namespace prefixed elements in svg. ie. <svg:svg>
Fixes bug 27465
2011-02-16 22:45:30 +00:00
Tim Starling
44eefff24c Make SVGMetadataExtractor less noisy when it reads SVGs from Adobe Illustrator. 2011-02-08 12:25:39 +00:00
Sam Reed
e76775e06f More unused variables 2010-11-30 18:44:50 +00:00
Derk-Jan Hartman
c14f7baeda Skip comments and stuff before the <svg> element. 2010-11-04 13:42:42 +00:00
Derk-Jan Hartman
37013dc920 * The SVGMetadataExtractor now based on XmlReader
* Retrieve title and desc of SVG files
* Retrieve metadata in raw form (not displayed)
* Detect SVG animations using SVG animation elements (http://www.w3.org/TR/SVG/animate.html)
2010-11-04 00:35:29 +00:00
Derk-Jan Hartman
d6f2e8e9e6 * Moving wfGetSVGSize() and wfScaleSVGUnit() into a seperate SVGMetadataExtractor.
* SVG metadata is now stored and versioned.

Chosing not to provide fallback for these functions as they seem unused outside of SVG.php (per Google) and grep.
2010-11-01 23:57:09 +00:00