Commit graph

24 commits

Author SHA1 Message Date
Reedy 7a40a6aa3f Update use of css-sanitizer classes for PHP 8.0 compat
Bug: T268862
Change-Id: I13ad3abe70b693886a79ab37c64f34e0113e9071
2021-01-08 21:28:30 +00:00
DannyS712 324dcb3d06 Remove use of Parser::fetchCurrentRevisionOfTitle
Bug: T249384
Change-Id: Ice32a365ef7b85b46cb5a78d6d07a35a21727173
2020-06-03 03:27:35 +00:00
peter-ovchyn 08ce0c613e Remove onParserAfterTidy hood as tidy is dead
Bug: T244055
Change-Id: I7afa31c6a542bfafbd50a55a1e79058074bf4906
2020-02-21 21:59:16 +02:00
libraryupgrader ad916d481c build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
Additional changes:
* Also sorted "composer fix" command to run phpcbf last.

Change-Id: I51df4fe88464b3c166dca3e845958c9b5ea3819f
2020-01-14 12:48:19 +00:00
Umherirrender 2b2fb16fac Fix doc for TemplateStylesHooks->wrappers
It is a array of "Token arrays" or false

Change-Id: I62f4cd76af20eee67a7a4b9449538cddc80f26bd
2019-12-09 19:42:00 +01:00
Umherirrender 3aa0554cd5 Use correct default value for Status::getWikiText
Change-Id: Ib1cca93b5e0e88a837fe8548b251e6af7b5cdec2
2019-12-09 15:40:27 +01:00
Max Semenik c830032d9d Stop passing objects by reference
Bug: T193950
Change-Id: Ic93138c9cf5f120d36692c323c5d509abbc625d5
2019-11-14 21:37:54 -08:00
Umherirrender 6bfed64796 build: Updating mediawiki/mediawiki-phan-config to 0.8.0
Bug: T235049
Change-Id: Ic3e3b4a3b617fc3e82f20f1e2eeab4c7a72686d3
2019-11-06 20:24:26 +01:00
jenkins-bot fce3c1d142 Merge "Avoid using $wgContLang" 2019-05-17 12:09:43 +00:00
Umherirrender 679b3046ba Add phan
Change-Id: Ie1dec630c5f69c617020699049081a494f75b8bd
2019-05-01 16:06:46 +02:00
Max Semenik 7a6d9949e4 Avoid using $wgContLang
Change-Id: I98a60c71f08b8bf210cbcbc6a6e1b0d50c4138db
2019-04-13 18:49:39 +00:00
Umherirrender a2187ec403 Use php null coalesce operator ??
Change-Id: I6d3b2a1bf1510d37bdd36c1b59be3fe54fd8e43a
2019-03-11 22:04:27 +01:00
MGChecker f121c39613 Allow extensions to register additional namespaces in extension.json
Extensions can register additional namespaces by setting the
"TemplateStylesNamespaces" attribte in their extension.json. This change is
analogous to Ia5d34cb78fa6af.

There isn't really a simpler way to do this here, as the config setting uses
namespaces as keys, while the attribute is using them as values. Furthermore,
keys with falsey values are ignored in the config setting, and attributes can't
use the same setting architecture, as array_merge_recursive doesn't maintain
numeric keys.

Bug: T200914
Depends-On: I9e62a02ed2044c847e9ab2dcdfab094001f88986
Change-Id: I2fa9b822ee39bcc5f95a293c8c4aad4d53ede30a
2019-01-12 11:40:58 -08:00
Brad Jorsch f7bf5a4e23 Add "wrapper" attribute to <templatestyles/>
The wrapper attribute may contain an extra CSS simple selector to
include when prefixing. For example, including a template as
<templatestyles src="..." wrapper="div.my-template"/> would transform

 .foo .bar { color:red; }

into

 .mw-parser-output div.my-template .foo .bar{color:red}

This can allow particular templates to opt in to the "styles are scoped
to the template itself" model that was desired by some when
TemplateStyles was being designed; the driving use case in the linked
task is doing so for the benefit of side-by-side comparisons of the
current and sandboxed versions of a template.

Bug: T200441
Change-Id: If49d4c5be31feca95abd21452238fd10ab1916b1
2018-10-17 14:17:59 -04:00
Gergő Tisza 17756c44b2
Hoist selectors for html and body element
Bug: T197617
Depends-On: Iac00198495cf08dec034f45100937df0f6cb1590
Change-Id: I5dd85d12eb77c70c1632974561c4cad8636fad1d
2018-08-24 22:16:17 +02:00
Umherirrender d9b730de44 Add phan-taint-check-plugin
Change-Id: Id410e41889bc6e4920c15c56d507c2f59601ec88
2018-08-19 19:14:00 -07:00
Umherirrender c2083e7455 Avoid variable reuse under same name
It makes the code easier to read when using different variable names

Change-Id: Ia65e8b7ebdc0692e8dac29c605c13092cef9b0ad
2018-08-11 00:16:25 +02:00
Brad Jorsch 435e06e2f5 Replace deprecated ContentHandler::makeParserOptions()
Having a different ParserOptions for each content model isn't feasible
in an MCR world. And the only thing using this was Wikibase, which has
been fixed to do what it needs in a different way.

Bug: T194263
Change-Id: Ia95f3e2c1ea944366ff9a478c3c86f8565023394
Depends-On: I01373b29ee25fa9346c6b0317155be4ccdc8c515
2018-07-11 12:34:25 -04:00
Brad Jorsch d1734fbeb2 Add tracking categories for errors
Two tracking categories are added:
* A category to track stylesheets with errors. While it's usually not
  possible to save a stylesheet with errors, it can happen if a
  server-side change makes formerly-valid CSS become invalid.
* A category to track pages displaying errors from incorrect use of
  the <templatestyles/> tag.

Bug: T195676
Change-Id: I123679d4bffe36cb28aca1688c052470027ea2a8
2018-05-29 14:36:03 -04:00
Kunal Mehta 37fc1df457 Use SPDX 3.0 license identifier
SPDX released version 3 of their license list (<https://spdx.org/licenses/>),
which changed the FSF licenses to explicitly end in -only or -or-later
instead of relying on an easy to miss + symbol.

Bug: T183858
Change-Id: Ic9accb2eb34bc32d455f48dfe81a91d23a2d5f5e
2018-03-03 23:27:16 +00:00
Fomafix c1c8bed584 Add ENT_NOQUOTES to htmlspecialchars
There is no need to encode double quotes in HTML content.

Change-Id: If30adcf9196ecbfdfd1a9e21fa7b1c0bcd0e51d2
2018-02-11 17:22:27 +01:00
Brad Jorsch 164b8861d8 Deduplicate embedded style rules
Use the facility added in core change I055abdf4d to deduplicate the
embedded style rules.

Bug: T168333
Change-Id: I98c6d5ca4b474de8826b19355f15a5230aef5650
Depends-On: I055abdf4d73ec65771eaa4fe0999ec907c831568
2018-02-11 05:50:55 +00:00
Brad Jorsch f99d171c80 Fix coverage
* Fix test for TemplateStylesFontFaceAtRuleSanitizer so it's actually run
* Hack up a broken Sanitizer to test a code path in
  TemplateStylesContent::sanitize() that handles such things.
* Ignore an InvalidArgumentException in TemplateStylesContent::processError()
  that's not worth checking. User input can't hit that, only logic bugs.
* Ignore TemplateStylesHooks::getConfig(), it's tested but gets called
  before PHPUnit starts counting.
* Test TemplateStylesHooksTest::onCodeEditorGetPageLanguage()
* Test $wgTemplateStylesDisable
* Test a back-compat code path in TemplateStylesHooks::handleTag().

Change-Id: I7078e5a353a624aa53fe72de7990b93a77b44cf6
2018-02-05 22:36:58 -05:00
Kunal Mehta 9a1a06b77d Move PHP classes into includes/ directory
Change-Id: Ibc03a6c298ec3bf3bbfa435033095546db6fc5f0
2018-02-05 18:18:01 -08:00