aboutsummaryrefslogtreecommitdiffstats
path: root/includes/content/JavaScriptContent.php
Commit message (Collapse)AuthorAgeFilesLines
* phan: Disable null_casts_as_any_type settingUmherirrender2022-03-211-0/+1
| | | | | | | | | | | Make phan stricter about null types by setting null_casts_as_any_type to false (the default in mediawiki-phan-config) Remaining false positive issues are suppressed. The suppression and the setting change can only be done together Bug: T242536 Bug: T301991 Change-Id: I0f295382b96fb3be8037a01c10487d9d591e7e01
* Fix various documentation related to null types (part II)Umherirrender2022-03-081-1/+0
| | | | | | | | | The functions returning null or the class property is set explict null. Some function should not accept null or return null. Found by phan strict checks Change-Id: Ie50f23249282cdb18caa332f562a3945a58d86ff
* Move Content::getParserOutput & AbstractContent::fillParserOutput to ↵Roman Stolar2021-09-291-10/+0
| | | | | | | | | | ContentHandler Update/Create override classes of ContentHandler. Soft-deprecate and remove method from Content and classes that override them. Bug: T287158 Change-Id: Idfcfbfe1a196cd69a04ca357281d08bb3d097ce2
* build: Update mediawiki/mediawiki-phan-config to 0.11.0Umherirrender2021-09-071-0/+1
| | | | | | | Addition and remove of suppression needs to be done with the version update. Change-Id: I3288b3cefa744b507eadebb67b8ab08c86517c1c
* Move Content::preSaveTransform to ContentHandlerPetr Pchelko2021-07-291-28/+0
| | | | | | | | | | | | | | | | | | | Create ContentTransformer to access ContentHandler::preSaveTransform through the service. Prepare object to hold a data that required for ContentHandler::preSaveTranform params. This will require making a semi-backwards-incompatible change no matter what, we don't really have a great way of hard-deprecating overriding methods. However, with the ContentHandler calling Content and Content calling ContentHandler, and with the ProxyContent trick to stop infinite recursion, it doesn't matter whether callers use Content or ContentHandler. This will allow us to naturally convert all callers. But won't really allow hard-deprecation. Bug: T287156 Change-Id: If6a2025868ceca3a3b6f11baec39695e47292e40
* Avoid using User::getBoolOption()ZabeMath2021-03-271-1/+1
| | | | | | | User::getBoolOption() is deprecated and should be replaced with UserOptionsLookup::getBoolOption() Bug: T277600 Change-Id: Ife3c721237258d50852bbf764def74657cc70428
* content: Add hidden preference to disable PST on CSS/JS contentC. Scott Ananian2020-08-121-2/+7
| | | | | | | | | | | | Test Plan: * Logged-in, preview a change adding {{subst:CURRENTYEAR}} to User:You/common.css, User:You/common.js and Main_Page. * Observe that it expands to 2020 in all cases. * Run `(new mw.Api).saveOption('pst-cssjs', '0')` * Try again. Observe that the first two are now left unchanged. Bug: T236828 Change-Id: Ic13e2ff3b90f0c3587cdb1e97fffcd96be650e0e
* Make use of the preg_match() return value, if possibleThiemo Kreuz2020-07-141-2/+1
| | | | | | | | | | | | | | | | | | | | | | | Instead of checking if the resulting $matches array is complete, we can safely assume it is, as long as the preg_match() call returned a non-false value. Note that some of these used empty() before and are actually bogus because of this! empty() considers the string "0" to be empty. In case of a ==0== headline that's an actual bug. I'm also removing the `= []` initialization before the preg_match. I understand why it was added: to make it a little more obvious that the variable is guaranteed to be initialized. But: * This is guaranteed by the preg_match anyway. * Neither initializing it with null or an empty array makes much sense because the code below assumes so much more, e.g. that specific elements exist, and are arrays. Again, these guarantees are all given by the preg_match. I find the additional initialization more distracting than helpful. Change-Id: I22b192b59038d9fa51a7e6f04d8d76634ae3de73
* Replace "@stable for calling" by "@stable to call"daniel2020-07-131-1/+1
| | | | | | | | | | | For compliance with the new version of the table interface policy (T255803). This patch was created by an automated search & replace operation on the includes/ directory. Bug: T257789 Change-Id: If560596f5e1e0a3da91afc36e656e7c27f040968
* Annotate newable classesdaniel2020-07-071-0/+2
| | | | | | | | This annotates classes that can safely be instantiated by extensions, per the Stable Interface Policy. Bug: T247862 Change-Id: Ia280f559874fc0750265ddeb7f831e65fd7d7d6a
* Let Html::element do the HTML encodingFomafix2019-11-191-6/+4
| | | | | | | This change avoids an unnecessary HTML encoding of `"` to `"` and `>` to `>`. Change-Id: Ieb135edacb84982908d9462bae3c287f54761f1f
* Remove all $wgParser use from coreAryeh Gregor2019-04-171-2/+4
| | | | | | Bug: T160811 Change-Id: I0556c04d33386d0339e02e2bf7a1ee74d97c2abd
* Deprecate Content::getNativeData, add TextContent::getTextdaniel2019-01-161-3/+3
| | | | | | | | | | | | | 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
* Recognize CSS/JS redirects with non-ASCII targetsKunal Mehta2018-10-311-1/+1
| | | | | | | | | 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
* Phabricator: Use Tddddd instead of Bug ddddd in commentsFomafix2018-10-041-1/+1
| | | | Change-Id: Ic9fe03cab270bd6be738af346164ad5d31a0d780
* Support redirects in JavaScriptContentKunal Mehta2015-07-201-0/+47
| | | | | | | | | | | | | | | | | | 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
* Fix subclassing of CssContent and JavaScriptContentKunal Mehta2014-09-131-2/+3
| | | | | | | We need to be able to set a different content model via the constructor, so make it an optional parameter. Change-Id: I8b31084e0cfbcca1b3785176eac492d837e0cb0f
* Make it easier to subclass Content and ContentHandler subclassesKunal Mehta2014-08-161-1/+1
| | | | | | | | | | | | Currently the names of associated Content classes are hardcoded, meaning that any extension that wishes to subclass these implementations must also re-implement that function, usually copying it exactly with just the class name changed. Using "static" avoids that issue. For ContentHandlers, I added a TextContentHandler::getContentClass, which should be used when creating new Content objects. Change-Id: I70f1a3291aec3460120ec20121a23f4cb68e04d1
* Content: Deprecate and stop using getHighlightHtml()Bartosz Dziewoński2014-05-091-1/+1
| | | | | | | | | | | | | | | That function was clearly a bad idea, everyone should just use getHtml() instead. It was supposed to allow extensions to extend the content formatting process, but actually doesn't. A better hook-based solution follows in separate commit I979e2438. Split off from original I979e2438 and rebased with minor changes (updated documentation comments, etc.). Co-Authored-By: daniel <daniel.kinzler@wikimedia.de> Co-Authored-By: Bartosz Dziewoński <matma.rex@gmail.com> Change-Id: I76412f9d28bb145fb5975f59e538f6560e50472f
* Added and updated Doxygen comments in content handler and diff namespacesThiemo Mättig2014-03-061-1/+10
| | | | | | | | | | | | | | | | | | | | | | | Reasons for touching this are: * "@param type $var" were mixed in a lot of places. Both works but the MediaWiki coding conventions suggest that specific order. * Things like String and Bool aren't objects and shouldn't be uppercase. * Tried to fill missing types in "@param $var". * Tried to fill missing descriptions in "@return type" when I could. * Removed duplicate descriptions if a @see is sufficend. * Removed useless descriptions ("isUsefull returns true if usefull"). * Removed useless @return void. * Replaces mixed[] with array (does have the exact same meaning). * Tried to find better replacements for "varargs", phpDocumentor suggest $var,... * Order should be @since, @param, @throws, @return, @see. This is the order Doxygen renders this. There is always more to do but I think this is already much better than before. Please feel free to put more change sets on top of mine or request more changes by adding comments. Change-Id: I05262ce06caabf79f68772302524ac91bbead1c6
* Revert "Introducing ContentGetParserOutput hook."Ori.livneh2013-06-101-1/+1
| | | | | | | | | | This change removed getHtml(), but not the call to it from fillParserOutput. It has a few other issues that I'll flag in-line after deploying the revert. This reverts commit fda090a7e7f85f146ec84798fda45232ab67613e Bug: 49398 Change-Id: Idcef8d4cedc7c03f72bc1743e0f89cc5ed4ad7a7
* Introducing ContentGetParserOutput hook.daniel2013-06-041-1/+1
| | | | | | | | | This hooks allows extensions to override the normal model-specific rendering of page content. A typical use would be to provide syntax highlighting for pages that contain scripts. In that sense, ContentGetParserOutput is a generalization of the old ShowRawCssJs hook. Change-Id: Ibfb2cbefea44eeee9f2a027f47e7721bf177ba0f
* 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
* Remove spaces between parentheses in function callsumherirrender2013-03-171-2/+2
| | | | Change-Id: If8ec665a01b566fa5189dfcc810b2d9a17f371e1
* fix some spacingumherirrender2013-03-071-1/+0
| | | | | | | | Added/removed spaces around logical/arithmetic operator Reduced multiple empty lines to one empty line Removed wrong tabs before comments at end of line Removed too many spaces in assigments Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
* Improve documentation of content handler stuffAlexandre Emsenhuber2012-12-201-2/+9
| | | | | | | | - Split file and class documentation - Add some missing file/class descriptions - Add missing @ingroup Content Change-Id: I7f7e3056570ca13a92f36a408c9b961c938f09a1
* Added docu headers to content(handler) filesjeroendedauw2012-10-161-0/+20
| | | | Change-Id: I9981698a5e4d79db89892ce3f3e007dd5aee5fd1
* set mediawiki version numberdaniel2012-10-051-1/+1
| | | | Change-Id: I3479776bd3bb25c4d75d07e62ede2ad989025c5b
* Split Content.php into one file per class.daniel2012-09-241-0/+40
Change-Id: Ib49d9ec729613dcc43d38d46cb133ff9df459d79