Commit graph

74 commits

Author SHA1 Message Date
Kunal Mehta 908f029b80 build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Change-Id: Iaa65f1987144baffd480d082538547fc9cf2c15b
2017-06-25 13:48:36 +00:00
Umherirrender 04e4c1b300 Add phpcs and make pass
Change-Id: I8f985ca83223f1a2fdb4365294701f3b1d9b019b
2017-06-06 19:51:28 +00:00
Umherirrender 7447b8bac2 Break long lines
Prepare to make phpcs pass

Change-Id: I82db90da7c8108196f81491068c886c65a7fba4c
2017-06-02 20:55:29 +02:00
Siebrand a67e5b02dc Use single quotes where possible
Change-Id: I7098ed4eb64a6de1bcf41b502cffb1e0cb9d159c
2016-04-02 08:01:10 +00:00
Siebrand 31a8009442 Remove PHP4-isms in type casting
Change-Id: I0ec1ecec14623a79ad52e7ff9285849398f48d3c
2016-04-01 22:47:10 +00:00
Siebrand Mazeland fe433810c9 Use identical comparison instead of equal where possible
Change-Id: I0ded83e529fdb2dc3a34b299d75799fd1bec2f87
2016-04-01 22:46:03 +00:00
Siebrand Mazeland 7da9452d72 Explicitly declare access modifiers
All these methods and (static) class properties are used as public access
at the moment. So set them explicitly as such.

Change-Id: Ib3bab43a54ce295d4dbfcdaa95450d573699bfb2
2016-03-23 15:11:50 +00:00
Chad Horohoe 9193587357 Remove obvious function-level profiling
Change-Id: I50b125f288247458f1d193789ebf1e1191bde538
2015-02-12 12:06:09 -08:00
umherirrender 7075df5dd7 mb_strpos() expects parameter 3 to be long, string given
Adding missing intval, similar to
I0bc8d612dc52d32e2cd616325e800b95c4efa23f

Bug: T72325
Change-Id: If5600a8e6630cf4568cd2a9ab9be336a9a9e40bb
2014-12-30 18:23:43 +00:00
Kevin Israel 0b96cbad0e Use Parser::killMarkers() from core for string functions
Change-Id: I57a4373be735ec1a3c0ee3d67143be33147a32f1
2014-10-20 03:28:31 -04:00
Jackmcbarn 28072281fd Call Title::exists() instead of checking the ID
Bug: 70495
Change-Id: I8ad9eeb2145727999c553415f80b3c8d95d7573b
2014-09-15 18:39:36 -04:00
Brad Jorsch b386038c00 #switch should not match #default as a prefix
For example, "{{#switch:x|#defaultWTF? = This is crazy}}" should not
return "This is crazy".

Bug: 67871
Change-Id: Ie3f2e6b254b9f44028156268bd8d67aa3dd1cc62
2014-07-11 18:16:11 +00:00
Marcus Brinkmann 23dd608020 Fix #switch #default to match next (not last) named parameter.
Bug: 23192
Change-Id: I3a726b3aacb2a598f79c0dbebaa4f400ee2d9aa2
2014-07-11 14:02:12 -04:00
Jackmcbarn b34f264e0c Unstub $langObject
The first time we use $langObject, it's a function call with a parameter
by reference, so it needs to be unstubbed first.

Change-Id: I43cdb0a8b2728d0f69a11fd778c6a3ff03487ef3
2014-07-03 16:03:14 -04:00
Brian Wolff 3c3e0751d7 Decode html entities before comparing strings in #ifeq: and #switch
This makes foo's equal to foo's. This is particularly important
since {{PAGENAME}} and friends html encode certain characters.

This change should be communicated to users before it hits wikis.
I don't think anyone is relying on the current behaviour, but
you never know.

Bug: 35628
Change-Id: I0035ac541d22491fcf15f55f2589aaab394ed0ed
2014-06-25 16:21:58 -03:00
jenkins-bot 016d9eac4b Merge "Add a TTL to #time and #timel output" 2014-06-24 22:54:38 +00:00
Jackmcbarn 334f1f0ee3 Add a TTL to #time and #timel output
Set the appropriate TTL when using #time or #timel. Needs I412febf3 and
I3f5a80aa in core to function.

Change-Id: I2e8b8918482b0b3f4adf154af795b6bb53b99497
2014-06-01 14:16:43 -04:00
Jackmcbarn f7bd89e435 Allow calling #expr from Lua without the parser
Add mw.ext.ParserFunctions.expr, allowing #expr to be used without needing
to use frame:callParserFunction.

Change-Id: I64c78fafad7da503b141efb36da64c3e3d8501a5
2014-05-05 17:58:40 +00:00
umherirrender 0930b80e05 mb_substr() expects parameter 2 to be long, string given
Adding missing intval as suggested in bug 51834

Bug: 51834
Change-Id: I0bc8d612dc52d32e2cd616325e800b95c4efa23f
2014-01-31 17:03:50 +01:00
Liangent 2448ee79ab (bug 22808) Don't count "expensive" calls for cached titles
Bug: 22808
Change-Id: Ie4dd9fd647dc79a2b31bc44ef8b6a641b54cfb78
2013-05-29 03:27:16 +00:00
Brad Jorsch d335043d74 Don't pass negative years to Language::sprintfDate
Language::sprintfDate cannot handle negative years, so don't pass them.
Return an appropriate error instead.

Change-Id: I87ce19a32312bb7db0740b4daddb995132eef683
2013-04-19 17:59:31 -04:00
Brad Jorsch 54940c51d6 (bug 33454) Add format characters for timezone
The {{#timel:}} parser function lacks any way to output the timezone
used, and generates incorrect output for the 'c', 'r', and 'U'
formatting characters. This uses the timezone support added to core
Language::sprintfDate in Iea1f7842 to fix that.

Bug: 33454
Change-Id: I71f594132ce48140a95bd85e16183c4a1162ebef
2013-04-02 23:11:05 +00:00
Siebrand Mazeland 5dee345880 ParserFunctions extension maintenance.
* Use Message class instead of wfMsg* methods.
* Replace additional deprecated methods.
* Fixed incorrect tag in i18n file.
* Update .gitignore.

Conflicts:
	ParserFunctions.i18n.php

Change-Id: If21300c11ec628506cb56550bc91a24a5d7c45d2
2012-10-03 20:58:43 +00:00
umherirrender d7668a3581 Use Parser::incrementExpensiveFunctionCount direct for ifexist
No need to do it self and now the limit of the ParserOptions is used.

Change-Id: Id13796d0424fb3b5501a774e1ace3ea065864e49
2012-10-02 23:47:52 +00:00
umherirrender 99b150fab4 Cleanup I730624f4: Bug 40039 - Remove ConvertParser from ParserFunctions
Remove unused vars and dead entries for classes and tests

Change-Id: I0920f0294043fa1cca0ca5622fb7eae4a8c61fcb
2012-09-08 19:30:30 +02:00
Reedy 7a3619ea8d Bug 40039 - Remove ConvertParser from ParserFunctions
Change-Id: I730624f455dcd8cf0375b9147efe4abee5b203bb
2012-09-06 15:44:12 +01:00
Reedy fdd7c091bd Minor documentation additions
Change-Id: I876de41b2c81d93df34ee2a8222aff6dc8176aae
2012-07-23 20:56:17 +01:00
Mark A. Hershberger fb5864083d w/s 2012-02-06 04:37:05 +00:00
Max Semenik 2aacab3186 ParserFunctions: made {{#time}} respect parser's timestamp, just as {{CURRENTDATE}} and friends do 2011-12-19 11:18:13 +00:00
Max Semenik d605269ce8 ParserFunctions: ditch PHP pre 5.2 compatibility 2011-12-19 10:51:39 +00:00
Sam Reed 8e61fa2f32 Flesh out documentation
Remove some more < 1.12 back compat code
2011-12-19 00:54:31 +00:00
Sam Reed 1eec35dabd Fix function name typo "date_defaulttimezone_get()" to "date_default_timezone_get()" from r105459 2011-12-19 00:51:36 +00:00
Sam Reed 0b1347bdd2 SFH_OBJECT_ARGS was added pre 1.12...
Kill ancient back compat, and code where unused
2011-12-19 00:38:10 +00:00
Alexandre Emsenhuber f4d9df85d5 * Only get the LinkCache instance when really necessary
* Do not assign a variable inside a condition check
2011-12-18 19:00:53 +00:00
Brian Wolff c763bf6ce1 (bug 32351) Make #time[l] support explicitly specified timezones. Patch by Van de Bugger.
This would make something like {{#time:H:i:s| 9:30 January 1, 2012 MST}} convert the time from 9:30 mountatin standard time to whatever it is in UTC.

I made one minor change from the patch on bugzilla in changing an @ to a wfSuppressWarnings. (The @ was already in the code, it wasn't introduced by the patch).
2011-12-07 20:52:41 +00:00
Sean Colombo a76aa995fe ParserFunctions: The third param turned out to have the same issue as the second (was throwing warnings in production since empty-strings were making their way in). Followup to r103834. 2011-11-21 21:18:18 +00:00
Sean Colombo 4d02a43a53 ParserFunctions: made #sub stronger against bad params (was throwing a ton of warnings in production at Wikia). 2011-11-21 21:09:19 +00:00
Chad Horohoe e188af9e04 Swap ParserFuncs to use the timezone funcs (like r60825) rather than putenv() magic.
putenv( 'TZ=foo' ) doesn't work with the 5.4 beta ;-)
2011-09-29 18:20:10 +00:00
Tim Starling e764705f57 Revert r92572: Language::isValidBuiltInCode() only rejected the empty string since r95646, so the check is necessary in this backwards-compatible extension. Needs backport per bug 31203. 2011-09-27 22:47:20 +00:00
Ryan Kaldari b681f84927 follow up to r87308 - fix redundancy 2011-07-19 20:31:38 +00:00
Ryan Kaldari 81d74aca19 follow up to r87308 - defensive programming for bogus language codes 2011-07-19 20:29:17 +00:00
Ryan Kaldari a3dd6784c8 better language handling - abandon magic language switch in favor of using int:lang as parameter, use parser->getFunctionLang() instead of wgContLanguage in case of use in interface messages 2011-05-02 23:30:05 +00:00
Ryan Kaldari 752dd28e01 fix issues from r86927, user language and years over 9999 2011-05-02 22:21:56 +00:00
Ryan Kaldari cb39cec9d6 adding language support to #time parser function, per bug 28655 2011-04-26 00:26:12 +00:00
Ryan Kaldari f9578f4d6a fix for bug 28655 - #time interpreting years incorrectly 2011-04-24 01:10:04 +00:00
Sam Reed 956982c04a More function documentation 2011-04-15 17:44:19 +00:00
Sam Reed 64dd1d254e Made checkLength static to fix many STRICT errors 2011-04-13 14:17:43 +00:00
Paul Copperman 3350ea8f2d Make ParserFunctions work with HipHop.
* When using HipHop, is_callable() returns false for objects which have only a __call() method instead of the requested one.
* Work around this by removing the ParserFunctions_HookStub hack.
* To retain the behavior that the code of ParserFunctions_body.php is only loaded when needed, turn it into a static class.
* Defer the registering of the ParserClearState hook until a relevant function is called.
2011-04-11 17:27:51 +00:00
Aaron Schulz 022503d1b7 Follow-up changes to r84610:
* Cleaned up mImageTimeKeys format
* ImageMap: Removed redundant addImage call (makeImage handes this)
* ParserFunctions: added time/sha1 to addImage() call
* Removed excess ampersands in hooks
* Added some function doc comments
2011-04-04 01:22:08 +00:00
Happy-melon 7ec54c6cfc Follow-up r81074 CR:
* Use autoloader for ConvertParser, and ExprParser which the code was cloned from
* Fix PHP 5.1 compatibility, while there's no requirement for us to keep it, there's also no need to break it unnecessarily, and it's a really trivial fix in this case.
* Tidy whitespace
* Use ConvertDimension::getLocalisedName() for the dimensionmismatch error, as intended
2011-01-27 17:34:37 +00:00