Commit graph

114 commits

Author SHA1 Message Date
Brion Vibber
cf9cd9dad3 Reverting r30413 for now.
'parentpagename' seems to duplicate 'basepagename'; why?
2008-02-04 19:53:21 +00:00
Misza13
b002ea6e2c Adding {{ROOTPAGENAME}} (and {{ROOTPAGENAMEE}}) variables for accessing the page's root name (i.e. everything up to the first "/").
Also adding {{PARENTPAGENAME}} as an alias for {{BASEPAGENAME}}.
2008-02-02 00:56:41 +00:00
Victor Vasiliev
df51a7691c Add profiling to MagicWord.php
30000 GET!
2008-01-20 18:46:50 +00:00
Domas Mituzas
74ea08c85b set OutputPage::mContainsOldMagic only for specific listed magic words
For now the suggested times are ignored and base 3600 is used for all dynamic ones
This makes templates more friendly parser-cache wise.
2008-01-09 20:47:46 +00:00
Nick Jenkins
786e93fb37 Static code analysis housekeeping time... things that could be double-checked are marked with "[Note: some-comment]" :
if-if-else without curly braces [api/ApiQuerySiteinfo.php] --> adding
Unused global declaration:  $wgGroupPermissions --> removing 
Unused global declaration:  $wgEmailConfirmToEdit (line 301) --> removing 
Variable $id appears only once (line 1021)  --> removing 
Variable $m was used before it was defined (line 805) --> defining.
Variable $retval was used before it was defined (line 2346) --> renaming to $result
Variable $rcid appears only once (line 244 of RecentChange.php)  --> using this instead of $change [Note: was left over from r24607 refactoring, revert if wrong please]
Unused global declaration:  $wgCommandLineMode (line 11) --> removing
Variable $k appears only once (line 132 of ImagePage.php) --> removing.
Variable $info appears only once (line 311 of ImagePage.php)  --> removing.
Unused global declaration:  $wgTitle (line 569 of ImagePage.php) -> removing.
Variable $handlerParams was used before it was defined (line 616 of Linker.php) --> resolved by Raymond in r24966
Variable $match was used before it was defined (line 1031 of Linker.php) --> defining.
Unused global declaration:  $wgEnotifWatchlist (line 253 of UserMailer.php) --> removing 
Unused global declaration:  $wgShowUpdatedMarker (line 253 of UserMailer.php) --> removing 
Variable $img appears only once (line 446 of SpecialUpload.php) --> added definition, defined as null, flagged with @todo  [Note: should $img be defined in this context, or is it intended to be null? And should the return value after the hook be checked in some way?]
Unused global declaration:  $wgEnableAPI (line 739 of SpecialUpload.php) --> removing.
Unused global declaration:  $wgNamespaceProtection (line 1030 of OutputPage.php) --> removing.
Unused global declaration:  $wgContLang (line 18 of SpecialWatchlist.php) --> removing.
Unused global declaration:  $wgRawHtml (line 269 of SpecialMovepage.php) --> removing.
The value of variable $page was never used (line 331 of SpecialUndelete.php) --> removing line, as $page gets redefined a few lines down.
Variable $synIndex appears only once (line 521 of MagicWord.php) --> commenting out.
Variable $case appears only once (line 539 of MagicWord.php) --> removing from foreach index key usage.
Variable $wgUser appears only once (line 1039 of Title.php) --> adding line to declare as a global, would be null otherwise.
Variable $m was used before it was defined (line 285 of Title.php) --> defining.
Variable $id appears only once (line 1150 of Title.php) --> removing from foreach index key usage.
Variable $subpage appears only once (line 1297 of Title.php) --> commenting out.
Variable $restrictions appears only once (line 1399 of Title.php) --> commenting out.
Variable $mime appears only once (line 210 of filerepo/OldLocalFile.php) --> removing.
Variable $deprefixedName appears only once (line 213 of filerepo/LocalFile.php) --> removing.
Variable $m appears only once (line 541 of filerepo/LocalFile.php) --> removing.
Variable $where appears only once (line 1245 of filerepo/LocalFile.php) --> removing.
Variable $info appears only once (line 1427 of filerepo/LocalFile.php) --> removing.
Variable $rel appears only once (line 138 of filerepo/RepoGroup.php) --> commenting out.
Variable $zone appears only once (line 138 of filerepo/RepoGroup.php) --> commenting out.
Variable $nbytes appears only once (line 208 of media/Generic.php) --> added a return line that uses $nbytes. [Note: I'm assuming that this was the intent]
Variable $offset appears only once (line 201 of SpecialListusers.php) --> removing.
Variable $limit appears only once (line 201 of SpecialListusers.php) --> removing.
Variable $groupTarget appears only once (line 203 of SpecialListusers.php) --> removing.
Unused global declaration:  $wgLang (line 74 of SpecialWantedpages.php) --> removing.
Variable $block appears only once (line 244 of SpecialProtectedpages.php) --> removing.
Variable $offset appears only once (line 281 of SpecialProtectedpages.php) --> removing.
Variable $limit appears only once (line 281 of SpecialProtectedpages.php) --> removing.
Unused global declaration:  $wgLang (line 30 of FileDeleteForm.php) --> removing.
Unused global declaration:  $wgServer (line 30 of FileDeleteForm.php) --> removing.
2007-08-21 03:57:54 +00:00
Tim Starling
164bb322f2 Basic integrated audio/video support, with Ogg implementation.
* JavaScript video player based loosely on Greg Maxwell's player
* Image page text snippet customisation
* Abstraction of transform parameters in the parser. Introduced Linker::makeImageLink2().
* Made canRender(), mustRender() depend on file, not just on handler. Moved width=0, height=0 checking to ImageHandler::canRender(), since audio streams have width=height=0 but should be rendered.

Also:
* Automatic upgrade for oldimage rows on image page view, allows media handler selection based on oi_*_mime
* oi_*_mime unconditionally referenced, REQUIRES SCHEMA UPGRADE
* Don't destroy file info for missing files on upgrade
* Simple, centralised extension message file handling
* Made MessageCache::loadAllMessages non-static, optimised for repeated-call case due to abuse in User.php
* Support for lightweight parser output hooks, with callback whitelist for security
* Moved Linker::formatSize() to Language, to join the new formatTimePeriod() and formatBitrate()
* Introduced MagicWordArray, regex capture trick requires that magic word IDs DO NOT CONTAIN HYPHENS.
2007-08-15 10:50:09 +00:00
Rob Church
153487bc6b (bug 6965) Cannot include "Template:R" with {{R}} (magic word conflict) 2007-07-10 14:57:00 +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
Brion Vibber
5dd20241ab Reverting r21560 as discussed; there are severe problems with relying on a user-language variable, which is why it has not been added. 2007-04-27 15:12:22 +00:00
Daniel Kinzler
ee4ddd5ded introducing magic word {{USERLANG}}; This should fix a lot of problems for multilingual wikis. 2007-04-25 12:42:18 +00:00
Ivan Lanin
73bb06d1a0 Introduce magic word {{NUMBEROFEDITS}} 2007-04-17 09:23:31 +00:00
Antoine Musso
c771fc9c96 Use Doxygen @addtogroup instead of phpdoc @package && @subpackage 2007-01-20 15:09:52 +00:00
Antoine Musso
b144fcb85d Rename constructors to __constructor 2007-01-20 13:34:31 +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
Nick Jenkins
ae8554c45b Completing code housekeeping stuff for rest of includes/ directory: removing unused local vars, removing unused globals, replacing extract() where simple to do, declaring output arrays before calling preg_match(), and so forth. 2006-11-29 11:43:58 +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
Niklas Laxström
78034ed0d1 * (bug 7459) Magic word variables are always case sensitive 2006-10-08 13:00:42 +00:00
Brion Vibber
bf63ffaa2c Committed a bunch of live hacks from Wikimedia servers
A few left, but these don't look too evil
2006-10-02 17:04:13 +00:00
Jimmy Collins
57aa38cc61 * (bug 6092) Introduce magic words {{REVISIONDAY}}, {{REVISIONDAY2}, {{REVISIONMONTH}},
{{REVISIONYEAR}} and {{REVISIONTIMESTAMP}}
2006-09-26 17:20:36 +00:00
Rotem Liss
51e44c9f4c (bug 366) Time-Variables like CURRENTTIME and CURRENTDAY should use time zones
Actually, creating new magic words, replacing CURRENT with LOCAL in their names, which use the local time zone, per discussion: http://mail.wikimedia.org/pipermail/mediawiki-l/2006-August/014542.html . The behavior of the current magic words is not changed.
2006-08-23 16:45:49 +00:00
Tim Starling
4f4120b5e4 Added {{CURRENTHOUR}} 2006-08-14 22:43:50 +00:00
Tim Starling
8831c8e13d MagicWord initialisation deferred. 2006-07-14 16:36: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
Antoine Musso
fd076f7b78 Fix #6526: Undefined offset notice in MagicWord.php on bad input
Filter first, check after.
2006-07-11 13:42:34 +00:00
Antoine Musso
fd912a148b A lot more of static issues when using E_STRICT from the commandline. 2006-07-10 15:41:30 +00:00
Antoine Musso
b875dcf1d3 comments end at column 80 2006-07-05 18:25:39 +00:00
Tim Starling
2113a11b0b Revert addToArray() change, add isCaseSensitive() 2006-07-03 08:57:29 +00:00
Tim Starling
3b628d1173 Made MagicWord::addToArray() support case-insensitive arrays 2006-07-03 03:29:32 +00:00
Tim Starling
e1c587ba06 getSynonyms() 2006-07-02 17:47:24 +00:00
Niklas Laxström
165955b292 * Added formatnum magic word 2006-06-29 13:37:06 +00:00
Rob Church
907125da5c Introduce {{NUMBEROFADMINS}} magic word 2006-06-16 13:58:42 +00:00
Magnus Manske
7f2155fa9e Bug 6031 (feature request for __NOGALLERY__ on category pages) fixed 2006-06-13 11:37:09 +00:00
Rob Church
6a5d22374a (bug 5932) Introduce {{PAGESINNAMESPACE}} magic word 2006-06-12 12:38:41 +00:00
Antoine Musso
5a5cc201b1 having some fun with doxygen error log 2006-06-10 18:28:50 +00:00
Rob Church
9b5ddbb646 (bug 5945) Introduce {{CONTENTLANGUAGE}} magic word 2006-06-08 13:30:35 +00:00
Tim Starling
02547dac72 Removed most exit() calls from the MediaWiki core, by replacing them with either a throw or by classic error checking. OutputPage::fatalError() and similar functions are deprecated, use either OutputPage::showFatalError() to return control or throw new FatalError() to relinquish it. Backwards compatibility of all interfaces has been maintained, thus extensions should continue to work and can be ported at a later date. 2006-06-07 06:40:24 +00:00
Rob Church
38f609789b (bug 3926) Introduce {{#language:}} magic word 2006-05-31 01:41:36 +00:00
Rob Church
d38df9ce99 (bug 6099) Introduce {{DIRECTIONMARK}} magic word (with {{DIRMARK}} as an alias) 2006-05-28 21:30:43 +00:00
Rob Church
b95074f87c Add {{CURRENTTIMESTAMP}} magic word 2006-05-24 15:55:01 +00:00
Brion Vibber
54005e7a9d * Reordered wiki table handling and __TOC__ extraction in the parser to better handle some overlapping tag cases.
* Only the first __TOC__ is now turned into a TOC.

The table change doesn't disrupt either the parser tests or the en.wikipedia main page. Hopefully it won't break other real content...
2006-05-23 07:19:01 +00:00
Rob Church
e7f5589bfe (bug 839) Add URLENCODE magic word 2006-05-17 15:36:05 +00:00
Rob Church
310e59e559 (bug 5845) Introduce BASEPAGENAME and BASEPAGENAMEE magic words 2006-05-14 03:51:36 +00:00
Rob Church
1cea04c788 * Introduce NUMBEROFPAGES magic word
* (bug 5833) Introduce CURRENTVERSION magic word
2006-05-13 17:30:42 +00:00
Antoine Musso
7ebdb6de89 Revert to r14165 . Did too many changes, didnt even run parserTests (i am bad) 2006-05-11 22:40:38 +00:00
Antoine Musso
acb150a105 a round of static statements 2006-05-11 19:39:50 +00:00
Antoine Musso
bc14eb8045 Replacing var keyword with private / public as we now require PHP5. 2006-05-11 19:10:41 +00:00
Rob Church
cc001cf787 (bug 4876) Add __NEWSECTIONLINK__ magic word to force the "new section" link/tab to show up on specific pages on demand 2006-05-01 20:35:08 +00:00
Rob Church
35670dacb9 Add "raw suffix" magic word for some magic words, e.g. {{NUMBEROFUSERS|R}} will produce a count minus formatting 2006-04-30 18:02:03 +00:00
Rob Church
b99de7897e (bug 5741) Introduce {{NUMBEROFUSERS}} magic word 2006-04-29 01:58:39 +00:00
Rob Church
3e64af3615 Add TALKSPACE, SUBJECTSPACE, TALKPAGENAME, SUBJECTPAGENAME (and encoded forms for all) magic words 2006-04-12 15:38:17 +00:00