Commit graph

46 commits

Author SHA1 Message Date
Aryeh Gregor
5c753e7728 (bug 12698) Create PAGESIZE parser function, to return the size of a page. Quite possibly this is getting out of hand; in that case, revert. Patch based on one by CBM/carl-m. 2008-04-18 15:01:04 +00:00
Aryeh Gregor
eebef8104f Re-eliminate the fatal error I reintroduced in my last commit 2008-04-18 14:42:24 +00:00
Aryeh Gregor
82a87bd33c * Add Parser::incrementExpensiveFunctionCount() and use it in CoreParserFunctions::getcategorycount(); refactor slightly so that formatRaw is called even for 0 (do any languages format that differently? maybe if they use non-Arabic numerals?). From bug 12698, by CBM.
* Add a cache so that calling getcategorycount for the same category many times won't stupidly repeat the same query over and over.  Currently an early return avoids incrementing the expensive function count in this case, so technically this makes things *slower*, not faster, but that can be tweaked if anyone cares.
2008-04-18 14:34:38 +00:00
Aryeh Gregor
6b89e9e50b Comments, code simplification 2008-04-18 14:19:00 +00:00
Aryeh Gregor
81130fd860 Fix fatal error on calling PAGESINCATEGORY with invalid category name; Category::newFromName does not always return an object! 2008-04-18 14:04:46 +00:00
Siebrand Mazeland
79d5225c0e * remove end of line whitespace
* remove empty lines at end of file
* remove "?>" where still present
2008-04-14 07:45:50 +00:00
Brion Vibber
3725c751a0 * (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
deb2045611 * (bug 12294) Namespace class renamed to MWNamespace for PHP 5.3 compatibility
* PHP 5.3 compatibility fix for wfRunHooks() called with no parameters

An autoloaded 'Namespace' class alias is retained for compatibility with
extensions which haven't updated to the new class name... however they too
will break on PHP 5.3. Yay!
2008-03-21 23:13:34 +00:00
Brion Vibber
bfeba0a181 Fix raw vs non-raw number formatting for {{PAGESINNS:}}
Cleanup some freaky code that does unnecessary call_user_func :)
2008-03-18 22:34:10 +00:00
Niklas Laxström
0570fdb1db * Magic word formatnum can now take raw suffix to undo formatting 2008-03-15 10:39:56 +00:00
Tim Starling
269a91037b * Added __HIDDENCAT__ feature, to hide categories from the box at the bottom of the member pages depending on special text on the category page.
* Added page_props backend, generic parser-driven page properties which, when changed, invalidate the cache of backlinked pages on any links table. Could be used to add overlays to images depending on their deletion status, or to add icons to articles based on category membership. 
* Refactored double-underscore handling in the parser. 
* Moved CoreParserFunctions registration to CoreParserFunctions.
2008-02-20 08:53:12 +00:00
Tim Starling
b211aaf8f0 Fixed #tag support for PPNode 2008-01-26 05:40:51 +00:00
Tim Starling
f748d710ee * Make lc and uc parser functions skip strip markers
* Made ==foo==<!----> create a valid section edit link
* Changed header processing heuristics -- now double-equals signs are generally respected as header starts, and will break template invocations, and single equals signs are respected as header syntax but might not generate a section edit link.
2008-01-24 09:07:47 +00:00
Tim Starling
6bfc746e83 * Eliminated message mode (OT_MSG), using OT_PREPROCESS instead. As proposed on wikitech-l.
* Fixed #tag behaviour in preprocess()
* Fixed #tag quote stripping regex
* Made MessageCache::getMessage() never transform its result, that is now left up to the caller. 
* A few other minor changes
2008-01-19 09:03:45 +00:00
Tim Starling
c9fc1249f1 #tag changes as per #wikimedia-tech committee 2008-01-16 07:46:27 +00:00
Tim Starling
6067e1ea8b Added {{#tag:}}: generic adaptor from parser function syntax to XML-style extension tag. Allows any extension tag (including nowiki and pre) to be called with input given by a template expansion. Inspired by [[Extension:TagParser]]. 2008-01-09 07:13:54 +00:00
Aryeh Gregor
b5dc7f412a * Also localize Special:Contributions in 'signature-anon', as with User: in 'signature'
* Whitespace, comments
2007-11-23 17:49:08 +00:00
Niklas Laxström
6d97bfde47 * Reworked convertPlural so that it accepts variable number of arguments nicely
* Should also fix bug 11991
2007-11-18 20:15:49 +00:00
Brion Vibber
ef1545f14a * Add {{filepath:}} parser function to get full path to an uploaded file, complementing {{fullurl:}} for pages.
Giving this a |nowiki option to wrap the returned path in <nowiki>s for non-linked standalone use.
Added File::getFullURL() function for cleaner calls; using full path to ensure consistency here.
2007-09-14 15:29:52 +00:00
Aryeh Gregor
d2ae2bd802 PHP typing strikes again! Padding parser functions now work with strings like '0' that evaluate to false. 2007-07-11 05:40:05 +00:00
Aryeh Gregor
977b6fcf22 (bug 10413) DISPLAYTITLE doesn't escape HTML entities, causing the displayed title to a) be wrong and b) not normalize to the actual title. No RELEASE-NOTES because this feature was only added this release anyway. Patch based on one by WebBoy. 2007-07-10 01:32:30 +00:00
Aryeh Gregor
a15c419b3d Remove ?>'s from files. They're pointless, and just asking for people to mess with the files and add trailing whitespace. (Yes, I looked over every one and reverted those that were bogus. Slash-enter a million times in less worked well enough, although it was a bit mind-numbing.) 2007-06-29 01:19:14 +00:00
Rob Church
2fb1477f84 DISPLAYTITLE: Fix comparison, damn fragments...check titles are equal and that there isn't a fragment in the desired title 2007-06-25 20:30:25 +00:00
Rob Church
19be1d25ac Fix up DISPLAYTITLE and enable per default:
* Clean up the mess in ParserOutput
* Reject (ignore) custom titles which don't normalise to the same as the current page -- THIS IS IMPORTANT OTHERWISE LINKING GOES TO POT (and not the good kind of pot)
[WARNING: Touches parser version. Old caches will be expired. You might wish to undo this and add some temporarily backwards-compatibility for a few days.]
2007-06-25 15:51:09 +00:00
Nick Jenkins
f9619da3f0 Yet more doc tweaks:
* Add @addtogroup tags to various classes, to try and group conceptually-related classes together.
* Add brief descriptions to various Special pages, thanks to Phil Boswell.
* Moving some docs to be right above the classes they represent, so that they are picked up.
2007-04-20 08:55:14 +00:00
Ivan Lanin
73bb06d1a0 Introduce magic word {{NUMBEROFEDITS}} 2007-04-17 09:23:31 +00:00
Rob Church
e6df1dee1d (bug 8914) Don't transform colons in {{anchorencode:}} 2007-03-29 18:57:54 +00:00
Antoine Musso
a2fac63c78 kill whitespaces 2007-01-13 12:58:33 +00:00
Rob Church
71c7757111 (bug 5908) Allow overriding the default category sort key for all items on a page using {{DEFAULTSORT}} 2006-12-29 10:39:35 +00:00
Niklas Laxström
c3b2f94cb9 * {{PLURAL:}} now handles formatted numbers correctly 2006-12-23 18:58:44 +00:00
Rob Church
fae0e13116 (bug 8247) Minor tweaks to includes/CoreParserFunctions.php and parser test for ANCHORENCODE colon function 2006-12-22 02:36:06 +00:00
Nick Jenkins
74ea267553 Prevent the following strict-standards warnings - i.e. when running with error_logging(E_ALL | E_STRICT); - which seems to disable the yucky "@" operator, as well as maxing out the pedantry of warnings. Nothing major found, just nice to be as explicit and as forward-compatible as possible.
* Strict Standards: Undefined index: switch in includes/Parser.php on line 3849
* Strict Standards: Undefined index: ref in includes/Parser.php on line 3818
* Strict Standards: Non-static method OutputPage::setEncodings() should not be called statically in index.php on line 11
* Strict Standards: Only variables should be assigned by reference in includes/Skin.php on line 888
* Strict Standards: Non-static method Title::newFromURL() should not be called statically in includes/SpecialContributions.php on line 178
* Strict Standards: Only variables should be assigned by reference in includes/GlobalFunctions.php on line 2054
* Strict Standards: Undefined index:  contributions-summary in languages/Language.php on line 764
* Strict Standards: Undefined index:  trackbackhtml in skins/MonoBook.php on line 86
* Strict Standards: Undefined index:  blockip in skins/MonoBook.php on line 204
* Strict Standards: Undefined index:  tagline in skins/MonoBook.php on line 261
* Strict Standards: Undefined index: uselang in includes/SkinTemplate.php on line 1159
* Strict Standards: Non-static method CoreParserFunctions::plural() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Undefined offset:  0 in includes/SkinTemplate.php on line 196
* Strict Standards: Undefined index:  USE INDEX in includes/Database.php on line 1015
* Strict Standards: Undefined index:  image_tests in includes/Parser.php on line 3488
* Strict Standards: Undefined offset:  0 in includes/Parser.php on line 3507
* Strict Standards: Non-static method ChangesList::newFromUser() should not be called statically in includes/SpecialWatchlist.php on line 361
* Strict Standards: Non-static method RecentChange::newFromCurRow() should not be called statically in includes/SpecialWatchlist.php on line 367
* Strict Standards: is_a(): Deprecated. Please use the instanceof operator in includes/Exception.php on line 168
* Strict Standards: Non-static method LogPage::logName() should not be called statically in includes/SpecialContributions.php on line 325
* Strict Standards: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush. in maintenance/commandLine.inc on line 191
* Strict Standards: Undefined index:  meatball in languages/Language.php on line 234
* Strict Standards: rmdir(/tmp/mwParser-2108164586-images/thumb): Directory not empty in maintenance/parserTests.inc on line 605
* Cleaning out some new temp files left over by parserTests (there were one or two straggler dirs/files that would persist after the test run ended, due to new tests being added over time)
* Strict Standards: Non-static method CoreParserFunctions::special() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Declaration of ListUsersPage::preprocessResults() should be compatible with that of QueryPage::preprocessResults() in includes/SpecialListusers.php on line 38
* Strict Standards: Only variables should be passed by reference in includes/SpecialBlockip.php on line 175
* Strict Standards: Skin::include_once(skins/Standard.deps.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in includes/Skin.php on line 121
* Strict Standards: Declaration of ApiMain::getResult() should be compatible with that of ApiBase::getResult() in includes/api/ApiMain.php on line 35
* Strict Standards: is_a(): Deprecated. Please use the instanceof operator in includes/WikiError.php on line 63
* Strict Standards: Non-static method WikiError::isError() should not be called statically in includes/SpecialImport.php on line 64
* Strict Standards: Non-static method ImportStreamSource::newFromInterwiki() should not be called statically in includes/SpecialImport.php on line 58<b
* Strict Standards: Only variables should be assigned by reference in includes/SpecialUndelete.php on line 501
* Strict Standards: Non-static method Image::newFromName() should not be called statically in thumb.php on line 56
* Strict Standards: Non-static method CoreParserFunctions::numberoffiles() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Non-static method CoreParserFunctions::statisticsFunction() should not be called statically in includes/CoreParserFunctions.php on line 139
* Strict Standards: Non-static method CoreParserFunctions::isRaw() should not be called statically in includes/CoreParserFunctions.php on line 128
* Strict Standards: Non-static method CoreParserFunctions::grammar() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Undefined offset:  1 in includes/SpecialMIMEsearch.php on line 130
* Strict Standards: Undefined index:  recentchangeslinked in skins/MonoBook.php on line 184
* Strict Standards: Declaration of DumpNotalkFilter::pass() should be compatible with that of DumpFilter::pass() in includes/Export.php on line 612
* Strict Standards: Declaration of DumpNamespaceFilter::pass() should be compatible with that of DumpFilter::pass() in includes/Export.php on line 665
* Strict Standards: Non-static method ImportStreamSource::newFromUpload() should not be called statically in includes/SpecialImport.php on line 46
* Strict Standards: Undefined offset:  5 in includes/Sanitizer.php on line 396
* Strict Standards: Undefined index:  wikidbUserName in includes/SpecialUserlogin.php on line 562
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryBase.php on line 95
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryBase.php on line 116
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryWatchlist.php on line 128
* Strict Standards: Undefined property:  stdClass::$rc_id in includes/api/ApiQueryBase.php on line 131
* Strict Standards: Undefined property:  stdClass::$rc_last_oldid in includes/api/ApiQueryBase.php on line 164
* Strict Standards: Undefined property:  stdClass::$rc_moved_to_ns in includes/api/ApiQueryBase.php on line 285
* Strict Standards: Undefined property:  stdClass::$rc_patrolled in includes/api/ApiQueryBase.php on line 176
* Strict Standards: Undefined index:  comment in includes/api/ApiFeedWatchlist.php on line 85
* Strict Standards: Undefined offset:  0 in includes/Skin.php on line 302
* Strict Standards: Non-static method User::SetupSession() should not be called statically in includes/SpecialUserlogin.php on line 15

... There are certain to be other things too, so this is not intended to be comprehensive, rather the above just stops most of the notifications I observed.
2006-11-29 05:45:03 +00:00
Tim Starling
2f12a58d93 * Introduced StringUtils.php, populated it with some generic string functions, both new and collected from various other files.
* Removed some backtracking regexes with an O(N^2) worst case, replaced with StringUtils::delimiterReplace(). There is a beneficial functional difference: /*/ is no longer considered to be a complete CSS comment.
* Changed the parser strip state from an array to an object. This should hopefully avoid the PHP bugs with array references. StripState uses the new ReplacementArray to do the replacements, thereby supporting FSS. 
* Removed DatabaseFunctions.php from the default startup sequence. Moved wfGetDB() to GlobalFunctions.php.
* Introduced the SiteStats class, with a collection of cached site stats accessor functions.
* Removed all global functions from Parser.php, they don't belong there.
* Made LanguageConverter use the new ReplacementArray class instead of managing its own FSS objects.
2006-11-21 09:53:45 +00:00
Brion Vibber
e0b7262afc Revert r17367 "(bug 7723) Add ic: parser function, with alias tc:, which capitalises the first letter of each word."
Feature creep with no apparent usefulness; would produce obviously incorrect results for mixed-case or all-caps words.
2006-11-03 08:36:28 +00:00
Andrew Garrett
dc223c593f * (bug 7723) Add ic: parser function, with alias tc:, which capitalises the first letter of each word. 2006-11-03 05:25:10 +00:00
Tim Starling
ac28d6f10a Added {{#special:}} parser function, to give the local default title for special pages 2006-10-31 13:25:47 +00:00
Tim Starling
efdd9ae981 Made {{INT:}} a core parser function instead of a special case. The syntax and behaviour is largely unchanged. 2006-09-30 04:53:36 +00:00
Jimmy Collins
ae0e481579 (bug 7059) 'anchorencode' colon function needs one more replace '+' -> '_' 2006-09-27 18:24:08 +00:00
Rob Church
df1e411f4b * (bug 7059) Introduce "anchorencode" colon function 2006-08-30 07:51:44 +00:00
Rob Church
67bca85656 (bug 7158) Regression in padding function behaviour, blah blah, I hate users, blah blah 2006-08-29 03:24:33 +00:00
Rob Church
8cd80c8d4c PADLEFT/PADRIGHT:
* Enforce a reasonable maximum length to cover most uses while preventing some dickhead from doing a 500 thousand character expansion
* Use the first padding character only for similar reasons
* (bug 7081) More input validation and checking
2006-08-21 11:07:58 +00:00
Rob Church
a64ab02471 (bug 7080) PHP notices on bad input to padleft/padright 2006-08-21 03:25:32 +00:00
Rob Church
73ee792c4d * (bug 7044) Introduce "padleft" and "padright" colon functions 2006-08-18 17:30:35 +00:00
Tim Starling
cdbbe0ad4a Got rid of the MagicWord indexing constants (MAG_xxx), replaced them by string indexing, like messages. The associated change to the extensions, i.e. removing the MagicWordMagicWords hook and using string instead of integer indices, is in fact compatible with MW 1.6 and 1.7, which tells you something about the utility of the hook function. 2006-07-14 15:39:23 +00:00
Tim Starling
cd1e5bab85 fixed raw suffix 2006-07-03 13:55:52 +00:00
Tim Starling
514122332d Got rid of about 20 regex calls in braceSubstitution() relating to function-like constructs, replaced them with a hashtable lookup styled after the parser function extension interface. The function bodies were moved to CoreParserFunctions.php. Disabled PAGESINNAMESPACE by default, yet another O(N) count of page table rows. 2006-07-03 11:07:00 +00:00