Commit graph

22 commits

Author SHA1 Message Date
Fomafix
025a5fb71a Let Html::element do the HTML encoding
This change avoids an unnecessary HTML encoding of `"` to `"` and
`>` to `>`.

Change-Id: Ieb135edacb84982908d9462bae3c287f54761f1f
2019-11-19 06:59:55 +01:00
daniel
54c70c3551 Deprecate Content::getNativeData, add TextContent::getText
getNativeData() is under-specified - callers can do nothing with the
value returned by getNativeData without knowing the concrete Content
class. And if they know the concrete class, they can and should use
a specialized getter instead, anyway.

Basically, getNativeData is overly generic, an example of polymorphism
done poorly. Let's fix it now.

Bug: T155582
Change-Id: Id2c61dcd38ab30416a25746e3680edb8791ae8e8
2019-01-16 11:57:50 -08:00
Kunal Mehta
674e486cb5 Recognize CSS/JS redirects with non-ASCII targets
The regex in JavaScriptContent and CssContent was trying to pass
urlencoded stuff to Title::newFromText(), which would fail. Make sure we
urldecode it first.

Bug: T208264
Change-Id: I189c4c308da2875839ad8c1061332500f0e6d244
2018-10-31 23:09:50 -07:00
Aryeh Gregor
4bdae1c9d2 Convert remaining MagicWord:: calls to MagicWordFactory
Bug: T200247
Depends-On: Ie061fe90f9b9eca0cbf7e8199d9ca325c464867a
Change-Id: I49c507f3875e46a8e15fd2c28d61c17188aabffc
2018-08-01 10:47:43 +03:00
James D. Forrester
326d655fc9 Drop 'comma' value for wgArticleCountMethod
We have three methods for page counting currently supported for wikitext
non-redirect pages; 'any' counts any page that exists, 'link' counts any
page that has any outbound links, and 'comma' which searches for any ','
in the text having loaded it. This last option is much slower than these
other two, and is only used on a very small number of installations. Now
by dropping support for this method we can simplify this code and so run
it more often. Note that non-wikitext pages already did not support this
count method.

Installations with this setting set to 'comma', or any other string will
now work as if it was configured with 'any'.

Bug: T188472
Change-Id: I965927edcd2485ec4b49b2d80fdf216dbf19520b
2018-03-01 16:37:23 -08:00
Umherirrender
255d76f2a1 build: Updating mediawiki/mediawiki-codesniffer to 15.0.0
Clean up use of @codingStandardsIgnore
- @codingStandardsIgnoreFile -> phpcs:ignoreFile
- @codingStandardsIgnoreLine -> phpcs:ignore
- @codingStandardsIgnoreStart -> phpcs:disable
- @codingStandardsIgnoreEnd -> phpcs:enable

For phpcs:disable always the necessary sniffs are provided.
Some start/end pairs are changed to line ignore

Change-Id: I92ef235849bcc349c69e53504e664a155dd162c8
2018-01-01 14:10:16 +01:00
Kunal Mehta
4de7b0a542 Add @covers tags to ContentHandler tests
Change-Id: I4d0994e91f63a0921343f34ef81a82463b4ab969
2017-12-27 17:48:56 +00:00
Florian
b91cbed2ed Remove Title::newFromRedirectRecurse()
Bug: T122754
Change-Id: I8b957eff7f355493ef6850f7a83dcb619ab6be78
2016-04-03 13:31:57 +01:00
Florian
876ae95e63 Remove Title::newFromRedirectArray
Bug: T122754
Change-Id: I2cdeb98c81d4b98ea986bd2f7b23cd93c62c5930
2016-04-02 13:28:37 +00:00
Reedy
83fb19cb13 Swap the rest of array() -> []
Change-Id: I76a7259ed952a0673a1941f08b39b545211fba07
2016-03-30 22:04: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
saper
8fa1555c78 JavaScriptContentTest: $wgScript != $wgScriptPath
Set $wgScript, $wgScriptPath and $wgResourceBasePath
to avoid failures when running on a wiki with
a non-standard $wgScriptPath.

Reported-on:

https://lists.wikimedia.org/pipermail/wikitech-l/2015-October/083675.html

Change-Id: I8acbcca5449060ff5604bf275f690b53343e706e
2015-10-26 23:05:15 +01:00
Amir E. Aharoni
e77af93e83 Add @codingStandardsIgnoreStart to 5 files under tests/phpunit/includes
To pass phpcs.

Bug: T102614
Change-Id: I4c7d60d26112c7ba67b66f1923ce945e96175d15
2015-10-03 12:30:29 +00:00
Amir E. Aharoni
c369defa97 Add @codingStandardsIgnoreStart to pass phpcs in 2 files in tests/phpunit/includes
Change-Id: I7f551dafcf437cc23aa9aed24f9e4d385816a0a0
2015-10-01 18:45:28 +00:00
Reedy
8e8368ca65 Re-enable MediaWiki.WhiteSpace.SpaceyParenthesis.SingleSpaceBeforeCloseParenthesis
Change-Id: I8482f5dd9d79e4946e862b0ac03bd027d62e8646
2015-09-26 17:38:35 +01:00
Kunal Mehta
ad9f14d662 Support redirects in JavaScriptContent
When a JavaScript page is moved, a "redirect" in the form of
mw.loader.load(...) will be left behind, so any other
JavaScript loading the page that way will still work, albeit
with an extra HTTP request.

This also implements Content::getRedirectTarget(), so redirects
are marked properly in the database, and users viewing them
are redirected properly. A magic "/* #REDIRECT */" comment
must be in front of the mw.loader.load call. This is done so
that pages which currently are just one mw.loader.load call
aren't turned into redirects.

Bug: 71200
Bug: 33973
Change-Id: I10fdff087a901da56fad64531f0e382f90ebcf37
2015-07-20 15:36:49 +00:00
Siebrand Mazeland
1742e9448c Pass phpcs-strict on some test files (6/11)
Change-Id: I5f4bc0df8183cf338ff45cacfc7279c2cd38ee04
2014-04-24 18:26:19 +00:00
addshore
2df1b0f0be Add @covers tags for /content files
Change-Id: Ied40e5afb1027f7d8ff46ffbf722ff6558eed880
2013-10-18 12:53:29 +02:00
Timo Tijhof
4bd5471ca3 docs: Remove odd colons after @todo
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
2013-05-15 06:23:40 +00:00
Siebrand Mazeland
791d0b2a98 Update code formatting
Change-Id: I16a9b42651f1cfb1a70dffbb67b7b83dfeb90d03
2013-04-26 14:21:20 +00:00
Siebrand Mazeland
9f77245218 Update formatting
4 of n.

Change-Id: I23e2409ce9eff14c3434154d236de83c93a92440
2013-02-14 14:10:38 +01:00
Platonides
9a81302781 Rename JavascriptContentTest to JavaScriptContentTest
Better match the original class name.

Change-Id: Ic85d486d55c2bc58189e5d5b411d296e872fc577
2012-12-06 23:13:10 +01:00
Renamed from tests/phpunit/includes/content/JavascriptContentTest.php (Browse further)