Commit graph

42 commits

Author SHA1 Message Date
Arlo Breault 96c60d44ca Add resource for thumb magnify links
Bug: T329413
Depends-On: Id46d1b2ab1af3baebff13e10f1485f3cfd9a4b37
Change-Id: Idec1b8dc1c742ca6ea3b24f3b14738c2d1f5b01d
2023-05-25 16:09:06 +00:00
Arlo Breault b2113e0154 Add back description links when !$wgParserEnableLegacyMediaDOM
The approach taken here is the same as in core for magnify links on
thumbs in Id46d1b2ab1af3baebff13e10f1485f3cfd9a4b37

The gist is that resource attributes are added on the mw-file-element so
that the necessary url is present in the html.  A class is also added to
the wrapper element that designates where the link should be positioned.
Finally, a script adds the link which styles in appropriately.

Bug: T329364
Depends-On: Id46d1b2ab1af3baebff13e10f1485f3cfd9a4b37
Change-Id: I20130fd39135dfd5074590ee9c2b6e01693384e4
2023-05-22 15:22:42 +00:00
Arlo Breault 6d83c5bc21 Fix adding titles when caption isn't visible
This was added in Ic0169d3914c5ce442b063f4bbbb6493966dbb302 and it
looks wrong on a few levels: the format isn't captured, and only
mw:File is emitted now.

Change-Id: I5aff7b53348696c485ef5683f6aab7aaafac4973
2023-04-27 13:34:16 +00:00
Umherirrender 4b479f6427 Replace deprecated ConfigFactory::getDefaultInstance
Bug: T325966
Change-Id: I2bbaa9d1a65e4f33cb9d919237d8664e3f74a51e
2022-12-27 21:10:16 +01:00
Bartosz Dziewoński c8c8b9c735 Avoid Phan PhanUndeclaredMethod false positives
The insertBefore() and appendChild() methods return their first
argument, but Phan only knows that they return a DOMNode, even though
we passed in a DOMElement. Rearrange slightly to avoid this pattern.

Change-Id: I04c58458e1ba0d728374ead756afb6facf970766
2022-11-25 18:37:02 +00:00
Bartosz Dziewoński 2cc6549898 Use Parsoid's HTML5-compliant helpers for HTML transformations
Previously XML parsing and serialization was used, causing `<br>`
to be disallowed and `<br />` to turn into `<br></br>`.

Also update some uses of XPath to use querySelector() helper.

Bug: T113791
Change-Id: Ic2069015b4cbb5d05a72eb383052319048111623
2022-11-25 17:05:24 +00:00
Reedy 76a921145e Switch to HookHandlers
Bug: T271015
Change-Id: I3a0b766dd9f64494a842f1bb1e64f6a51b146692
2022-08-26 19:13:13 +00:00
Arlo Breault 75f95fbc1e Place tooltips if caption isn't visible
Matches Parsoid commit Icbc36b6e9aa1b9f4f27c23f4833c626a725cc154

Bug: T297443
Bug: T108380
Depends-On: I30eba0fb226971ddeda4eb240929e89ef7e5f45f
Change-Id: Ic0169d3914c5ce442b063f4bbbb6493966dbb302
2022-05-16 19:22:03 -04:00
Reedy e0ef563437 Correct namespacing to match best practices
Bug: T303105
Change-Id: Ie72eb7c2dfcf9a7d5f95e9130d3631f2aa7d542e
2022-03-05 15:10:40 +00:00
jenkins-bot 5d8fc50038 Merge "Account for strtok boolean return type" 2022-02-26 04:47:48 +00:00
Arlo Breault 375570b616 Account for strtok boolean return type
This has been around for 16 years (since 284a684c) but throws when
strict_types are enforced.

Ternary is fine here since "0" doesn't seem like a legitimate type.

Bug: T302093
Change-Id: I1d2087ba28496e26c2718387cd735541698351f0
2022-02-25 18:53:47 -05:00
Reedy bf2da4d9d3 Replace usages of Wikimedia\(suppress|restore)Warnings()
Change-Id: Ic092d27608f5a309617498789dab36d1c7088dfa
2022-02-24 21:20:40 +00:00
Arlo Breault 124cff0cb2 Handle link= file option
This only crashed the legacy output.

Bug: T294467
Change-Id: I4c44c0d04a0726c88d4ec9a7efbfd5e0a49d4437
2021-11-24 18:00:23 -05:00
Arlo Breault ee3e717a52 Force block imagemaps when !$enableLegacyMediaDOM
Matches the implementation in Idb576004a58f0949b824a46d26dab7d715268ca4

Bug: T290044
Change-Id: I3971471dd4f56d9df9246dc571a4c42cfe424867
2021-09-08 20:08:13 -04:00
Arlo Breault 66cc306cbe Update ImageMap for new media structure
Bug: T272186
Change-Id: I5544b7274316248773f191eb7ecd08088473fcd9
2021-08-12 19:00:19 -04:00
libraryupgrader f66f1a81d5 build: Updating mediawiki/mediawiki-phan-config to 0.10.5
Change-Id: Icabfa063e34d2d09de7bf8b3154682ac1c4682f0
2020-12-10 15:11:24 +00:00
libraryupgrader 70257f4768 build: Updating mediawiki/mediawiki-phan-config to 0.10.4
Change-Id: I08d86d940369267b661e05628578ce81802773f4
2020-11-20 13:15:43 +00:00
jenkins-bot 37d7e591a0 Merge "Modernize ImageMap implementation a bit" 2020-07-03 03:13:48 +00:00
libraryupgrader f775561eba build: Updating mediawiki/mediawiki-phan-config to 0.10.2
Additional changes:
* Removed phan-taint-check-plugin from extra, now inherited from mediawiki-phan-config.

Change-Id: I48df539047c1a2a481969ebd3736d73a52fbdbe6
2020-06-02 19:34:16 +00:00
jenkins-bot 30883c721d Merge "Remove unused $id property" 2020-05-22 07:00:11 +00:00
Thiemo Kreuz 826f5f6ffb Modernize ImageMap implementation a bit
Notable:
* Use strict === for string comparisons.
* Use ?? instead of isset(), where it makes sense.
* Avoid expensive recursiveTagParse() with empty strings.
* Add strict Parser type hint. Note this would have failed anyway
  because the code below just assumes this is a Parser.
* Use the actual $lineNum from the loop instead of manually counting.
  Note the loop is 0-based, while $lineNum is meant to be 1-based.
  Therefor the ++.

Change-Id: I907b6c9ce3eef404dc7f048c14c4707dd1d0d98a
2020-05-20 08:48:52 +02:00
Thiemo Kreuz da2838adfc Remove unused $id property
Unused since Ia906b46 (March 2019, not linked to a Phabricator
ticket).

Change-Id: Ie57b9da09a840eacac3eff2f7794fa9e352f28da
2020-05-20 08:32:04 +02:00
DannyS712 c765a86777 Fix PSR12.Properties.ConstantVisibility.NotFound
Bug: T253169
Change-Id: I44a288dc7f754af13991f949cfc180c19da782ec
2020-05-19 23:21:15 +00:00
Reedy 9e45ad3f6f Namespace extension
Change-Id: Ifbbb52819789bf5ad3e35dd56f6e1f48f1d85aba
2020-04-19 01:18:57 +00:00
Arlo Breault edb47bb2d4 Fix imagemap_invalid_coord message
Looks like this was introduced in 28bb0b5

Change-Id: Ic51accc74006fe64df80bb2ff58e4fd7b0274936
2020-04-06 12:29:06 -04:00
C. Scott Ananian 6b4e6becb5 Use Parser::getTitle(), not @internal $parser->mTitle field
Change-Id: I45b9f4a22e89ee7729ecf51f2cd452556f629205
2020-03-30 13:14:12 -04:00
Umherirrender 313fba8175 Use MediaWikiServices::getBadFileLookup
This required MediaWiki 1.34 (already set in extension.json)

Change-Id: I6a7e51fed5718c33de67a530ce032f8725e0bfcc
2020-03-14 21:14:32 +01:00
Umherirrender c6a8e7fefe Use MediaWikiServices::getRepoGroup
This required MediaWiki 1.34

Change-Id: I4c0887e2d9fc8882805292d7ea5dbc0a68ce34a8
2020-03-14 14:36:27 +01:00
libraryupgrader a2b3060bce build: Updating composer dependencies
* jakub-onderka/php-console-highlighter: 0.3.2 → 0.4.0
* mediawiki/minus-x: 0.3.2 → 1.0.0
* mediawiki/mediawiki-phan-config: 0.9.0 → 0.9.2

Change-Id: I8141f11390205d00a11b819de03e796e08cc8f88
2020-02-19 19:21:15 +00:00
libraryupgrader 4fb2612a0c build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
Additional changes:
* Also sorted "composer fix" command to run phpcbf last.

Change-Id: Ibf8a07b82fd03c38f1a07eef445c751c8a7a273b
2020-01-14 05:57:36 +00:00
libraryupgrader bbe82f0371 build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Additional changes:
* Added .eslintcache to .gitignore.

Change-Id: I9e04f1ed8c96fcd92d8232f39b169ae3d0dff029
2019-12-27 19:03:37 +00:00
Max Semenik f5427d519d Stop passing objects by reference
Bug: T193950
Change-Id: Iefb9848806d5e73fdebe0e31d16b362e101347a1
2019-11-14 23:42:52 -08:00
Ed Sanders 28bb0b502f Rewrite tokenizeCoords to use a while loop, and use it for 'poly'
This provides consistent token validation for
'poly', 'rect' & 'circle'.

Change-Id: I2f558b57dbd93b3bf8ed1762d10ba94772f48a15
2019-10-11 21:00:23 +00:00
Ed Sanders b024fddb4d Make mapName deterministic so it can be tested
Change-Id: Ia906b46fbe8d84ae1482f8efaeb609d08c53bfa8
2019-08-30 17:43:37 +01:00
Alex Ezell 9f962fbad1 Allow negative coordinates in poly image maps
Previous attempts to clean this up followed similar logic to the
circle and rect types of imagemaps. However, in reality, we have
many image maps in our content that have negative values for poly
coordinates. While this isn't logical, breaking them so loudly
in the page isn't desirable.

This change then removes the check for positive value and passes
along the negative coordinate.

Bug: T217087
Change-Id: I0ee84f059dacde79a7e4fb0a172ac6937360d864
2019-04-11 09:23:14 -04:00
Ed Sanders fb20685b48 Use is_numeric instead of ctype_digit for 'poly' validation
Duplicates the logic from tokenizeCoords which is used by
'rect' & 'circle'.

Bug: T217087
Change-Id: I7c59bb9ea410bae8800922356829bca669d2e69c
2019-03-31 00:21:43 +00:00
Alex Ezell 70a6b723c7 Warn user about invalid coordinates
If a user provides a non-numeric coordinate in an image map, it
results in an unhandled exception. This change detects the incorrect
coordinate and warns the user with an error message.

This also cleans up a type casting that was old fashioned.

Bug: T217087
Change-Id: Ic1254dd0fe41d0499f71140466277fb58d1d194c
2019-03-22 15:20:22 -04:00
Umherirrender c0eb4fdb18 Declare local vars set on first run of foreach
PhanUndeclaredVariable is reported, because the vars are not declared
outside of the loop and only conditional inside the loop.
The condition is run on first loop, so it is always run and the old code
works.
Declare the vars to make them visible before the loop

Change-Id: Ic33170fcb0e5b7e02b7269c83f27120989a6ca10
2019-03-11 20:15:07 +01:00
zoranzoki21 b0b5b63fd9 Move images in resources directory
Change-Id: Id76a292e75c1ef82410439235b6d25eb0cff4284
2019-03-02 22:06:50 +01:00
Reedy f0355fab4c Update MediaWiki namespaced AtEase global functions
Change-Id: Ic1342ad266084bd1ad6ae89e31020afef825870d
2019-02-13 05:29:51 +00:00
Umherirrender b9f43bd8f1 Add method scope visibility
Change-Id: I5ac480fe2af502645d539e0e05b6872d3854168a
2018-10-31 23:37:19 +01:00
Kunal Mehta 3297749b56 Move classes into includes/
Change-Id: I390b0e09406e61c19e2e3eb9a115327cf013ad3a
2018-02-24 13:10:38 -08:00
Renamed from ImageMap_body.php (Browse further)