Commit graph

89 commits

Author SHA1 Message Date
Siebrand Mazeland 31a1820e70 * new style magic words support for ParserFunctions
* add localisation support for ParserFunctions magic in Translate
* bump version
2009-08-12 13:08:25 +00:00
Tim Starling 5d97108615 * Disabled string functions by default with a configuration variable. Outlined my case for doing so.
* Defer loading the bulk of the code until a parser function is actually called. Necessary due to the recent large increase in code size. 
* Fixed the total disregard for parser state and object-oriented data flow in ExtParserFunctions::loadRegex().
2009-06-05 09:53:05 +00:00
Robert Rohde 7840d735cf (Bug 19078) Restore #pos default behavior unintentionally changed in r50997 2009-06-05 00:06:06 +00:00
Katie Filbert 6d969b56e7 fix spelling in code comments for r50997 2009-06-01 00:51:49 +00:00
Siebrand Mazeland 7da7e7d2ef Follow up to r51082 from CR. Message is supposed to be in the content language. 2009-05-28 20:05:10 +00:00
Siebrand Mazeland 78253a7e4e Support PLURAL for pfunc_string_too_long. Is that escape really needed - it's a number? 2009-05-27 18:44:30 +00:00
Robert Rohde a697525576 (Bug 6455) Add string function support to ParserFunctions 2009-05-26 00:43:34 +00:00
Tim Starling 645e6149a8 * Fix for PHP 5.3: use the timezone parameter to DateTime::__construct() instead of applying setTimeZone() afterwards. This avoids an exception being thrown when the timezone is not set in php.ini.
* Tweaked formatting
2009-05-12 06:56:04 +00:00
Shinjiman e5eeec681f * (bug 18242) Show the Subversion revision number per extensions in Special:Version (currently applied on some extensions to get the entries file) 2009-04-26 05:22:33 +00:00
Philip Tzou 680d39e1e6 Allowed to find variant link when use #ifexist. 2009-04-25 03:46:10 +00:00
Alexandre Emsenhuber 58c7808057 Update url in extension's credits 2008-12-30 14:55:45 +00:00
Andrew Garrett d39259e0fa Revert "Follow up on r43982. Reduce dirname(__FILE__) calls in core and extensions."
Uses $dir in extension files, and assumes that it remains unchanged in require_once( 'maintenance/commandLine.inc' ).
In fact, it is likely that '$dir' will be set when setting up command-line, as some extensions will use the same var.

Recommended fix: Use $CentralAuth_dir, $EmailPage_dir, etc.
2008-11-30 03:15:22 +00:00
Siebrand Mazeland ec013e2112 Follow up on r43982. Reduce dirname(__FILE__) calls in core and extensions. 2008-11-26 23:17:15 +00:00
Brion Vibber 8a8fcf7466 * (bug 11686) Make #time work with pre-1970 dates
Uses DateTime class in PHP 5.2+ to support dates outside the 1970-2038 range. On earlier versions will still fall back to strtotime with the old 32-bit Unix timestamp range limitations.
Patch by rememberthedot -- https://bugzilla.wikimedia.org/attachment.cgi?id=5416

Added a couple quick parser test cases to confirm the new behavior. However I am seeing some annoyances with how input time zones are handled, so we'll want to clean that up at some point. :)
2008-10-27 17:56:58 +00:00
Raimond Spekking 3141cddd5e * (bug 15730) #iferror catches more errors so any amount of other classes may precede or succede /error/.
Patch by René Kijewski
2008-10-09 11:45:20 +00:00
Tim Starling 7f9f5c56c3 In #ifexist: add the link to the parser output even if it's in the link cache already 2008-09-26 08:42:27 +00:00
Brion Vibber e42686cd0a Revert r39618 "Per discussion for bug 6455, merged functionality of StringFunctions into the ParserFunctions extension."
o_O These look like the least CPU- and memory-efficient implementations of strlen(), strpos() etc that could possibly be created...
2008-08-19 18:53:09 +00:00
Fran Rogers c17e837fa1 Per discussion for bug 6455, merged functionality of StringFunctions into the ParserFunctions extension. 2008-08-18 22:19:38 +00:00
Brion Vibber b6589d2a07 Revert r37387 "Let the {{#ifexist}} works with encoded URLs too. See testcase"
Causes regression for titles containing "+".
Proper fix here is to move the existing % decoding into Title::newFromText or Title::secureAndSplit so it's done automatically, rather than attempting to replicate it, with the potential of getting it wrong like this, every place we decide to accept titles
2008-07-09 17:46:09 +00:00
Raimond Spekking b18e373656 * Let the {{#ifexist}} works with encoded URLs too. See testcase http://test.wikipedia.org/wiki/User:Raymond/ifexist
* Update URL in extension credits
2008-07-09 13:26:53 +00:00
Ilmari Karonen f7d1604cce Make #ifexist work for special pages. 2008-05-21 22:46:03 +00:00
Raimond Spekking 070032419e * (Bug 13620) Let #iferror catch more error messages
Patch by René Kijewski
2008-04-09 19:47:44 +00:00
Brion Vibber 3f8d67255c * (6943) Added PAGESINCATEGORY: magic word
Patch by Mr.Z-man, https://bugzilla.wikimedia.org/attachment.cgi?id=4793
Moves some of the 'expensive parser function' tracking to core.
2008-04-07 22:11:31 +00:00
Brion Vibber f3f58561af * (bug 13041) Typo in getExprParser() 2008-02-26 01:25:29 +00:00
Raimond Spekking f254fe8945 * (bug 12739) Use wfMsgForContent for a category name
* Add 'descriptionmsg' for [[Special:Version]]
2008-02-05 18:52:55 +00:00
Tim Starling ca08ade9f5 Revert r30243: unnecessary. 2008-01-29 02:44:53 +00:00
Brion Vibber e9620129be Apply live hack from Wikimedia code base: throw exception on invalid frames in ifeq 2008-01-29 01:38:17 +00:00
Tim Starling b9938a57a3 Postcard from linuxland.
* Reduced stack depth by using an internal stack in expand(), and by having some common code paths (e.g. non-subst double-brace during PST) return objects which can be expanded in that internal stack instead of the PHP stack. This is friendly to xdebug but slightly slower than the original version. Also it probably helps robustness when you don't add 7 stack levels per pair of double braces.
* Profiling indicates that expand and PPD are now good targets for porting to C. Abstracted and refactored the relevant code to allow for a drop-in replacement. A factor of 2 reduction in average-case replaceVariables() time may be possible.
* Verified with preprocessorFuzzTest.php against r29950, updated to allow better PST tests.
* Made parserTests.php respect $wgParserConf
* LST and ParserFunctions need a simultaneous update with the core due to changed interfaces. DOM objects are now wrapped rather than directly exposed.
2008-01-21 16:36:08 +00:00
Tim Starling 983bb52cd8 Added ParserFirstCallInit hook. Deferred function registration in ParserFunctions until this hook is called. 2008-01-17 08:58:24 +00:00
Tim Starling 56ecadc8e5 #ifexist: If the "else" parameter is missing, use the "test" parameter instead. This allows error-free text to be passed through with abbreviated syntax. Splarka's suggestion. 2008-01-17 01:06:02 +00:00
Brion Vibber aa66e33d4d Don't register internal links for specials or interwikis on #ifexist lookup.
They all return false anyway, but this avoids bogus link table entries.
(Similar issue as ImageMap bug 12651)
2008-01-16 06:16:16 +00:00
Tim Starling a563c45005 Fix bug in last commit 2008-01-15 05:29:29 +00:00
Tim Starling 7a1cb92986 Added #iferror: Searches the input for text that looks like an error message from ParserFunctions or the core parser. 2008-01-15 04:21:17 +00:00
Siebrand Mazeland 04a88ee436 * use wfLoadExtensionMessages
* remove some unneeded blackslashes in messages (caused malformed error message)
* put Magic in separate file
* delay message loading
* add version in extension credits, remove EOL whitespace
* update Translate extension
2008-01-13 01:06:28 +00:00
Tim Starling d0053cdca8 Bug 12356: make parameters to #titleparts work like array_slice(): negative offsets, missing length runs to end, etc. Patch by darklama. 2007-12-20 13:29:59 +00:00
Siebrand Mazeland 48c773edf3 revert r28371 to r28375 2007-12-16 18:27:23 +00:00
Tim Starling e10e89e2b3 Typo 2007-12-11 09:04:46 +00:00
Siebrand Mazeland 2f82506394 * complete $wgExtensionCredits
* remove trailing whitespace
2007-12-10 21:13:52 +00:00
Tim Starling b225dd82ad Watch out for invalid titles 2007-12-10 06:11:52 +00:00
Tim Starling ba67528419 * Add a warning on preview if the #ifexist limit is exceeded
* Add all pages which exceed the #ifexist limit to [[Category:Pages with too many ifexist calls]]
2007-12-10 06:04:34 +00:00
Tim Starling f06807863c * Object versions of #ifexpr, #switch and #ifexist
* Fix for lack of StubObject in ~1.7
* Ignore HTML comments in expressions, which may now appear due to the parse order change
2007-12-09 08:11:38 +00:00
Tim Starling 603fe160be * Add #ifexist invocation count to the limit report comment
* Fix limit report inclusion criteria for new preprocessor -- make it display only for the primary text on edit and page view
2007-11-30 14:50:48 +00:00
Andrew Garrett 2328038128 Prevent the parser function #ifexist being used more than a certain amount on error pages. The maximum number of #ifexist queries can be set in $wgMaxIfExistCount, which is, by default, 100. Any more uses over here will default to the "else" text. Done to discourage templates like Template:highrfc-loop on enwiki, which willingly does something like 50 database queries for a template that is used for many users on one page. Clearly suboptimal from a performance perspective. 2007-11-29 10:42:48 +00:00
Tim Starling 3153138c23 register #switch once 2007-11-20 14:27:04 +00:00
Tim Starling 2b3cdadc84 SFH_OBJECT_ARGS versions of #if and #ifeq 2007-11-20 14:16:10 +00:00
Raimond Spekking 5944437cb1 Use <strong> not <span>, per hint of Simetrical on wikitech-l. Thanks. 2007-11-19 15:37:49 +00:00
Raimond Spekking e470229df5 * (bug 8773) Make error messages from expr.php localizable
** Move error messages to ParserFunctions.i18n.php
** Rename 'expr_...' to 'pfunc_expr_...' to be consistent with other messages which are localizable already
* Add CSS class 'error' to output of error messages
2007-11-16 08:02:24 +00:00
Roan Kattouw 05af0a8f37 (bug 7985) #ifexist parser function returns false for image pages from shared repository
Modified patch by Carl Fürstenberg (AKA AzaTht)
2007-11-13 15:33:05 +00:00
Aaron Schulz 99a596fe27 *Internationalize error messages (patch by Bertrand GRONDIN, bug 10991) 2007-08-19 16:55:22 +00:00
Rotem Liss 8ad5a5a09f Introducing a new parser function, "#timel", which is the same as "#time" but uses the local time specified by the computer or by wgLocaltimezone. It passes a local timestamp to Language::sprintfDate or the compatibility function, per its comment ("Input timestamp is assumed to be pre-normalized to the desired local time zone, if any"), but this doesn't cause problems (except for the "+0000" written when using c and r flags). 2007-08-01 18:00:45 +00:00