Commit graph

282 commits

Author SHA1 Message Date
umherirrender
4634b57243 Replace deprecated Title::escapeCanonicalURL call
Change-Id: Icd3e2304d6188babe2d887aa32fc0c398352b7b6
2014-06-27 17:12:37 +02:00
Siebrand Mazeland
dfc7416fbe Various documentation updates for includes/parser/
Change-Id: I16dd3a792cc83f8c80b3652d42c055730f6d177a
2014-05-11 18:18:26 +02:00
Siebrand Mazeland
2527cca6de Fix most CodeSniffer issues in includes/parser/
Remaining are the classes containing underscores and possibly a few other
issues that will be addressed soonish.

Change-Id: Icf56374c71afc134420ebbcfecf12dcb29dc9564
2014-05-11 08:44:52 +00:00
umherirrender
7f9fd63901 Fixed some @params documentation (includes/parser)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I49f8f48b521878de7abd9cc40efdeff6cf9a37e0
2014-04-22 01:38:39 +02:00
Thiemo Mättig
2aa67db39d Fix "@param null $param" documentations
... and very few other documentation details that are closely connected
to these mistakes.

Change-Id: I5b2691948e196124c77f0cc04d0ed5a7167cac25
2014-04-09 12:33:55 +02:00
umherirrender
23fab68274 Fix spacing after @param and friends in comments
Searched for:
\@(param|return|throws|since|deprecated|access|todo|var)[ \t]{2,}

Change-Id: Icce22ba9fe0635455691ca58d9872d618151f346
2014-04-05 20:02:29 +00:00
umherirrender
2000672ac3 Fixed spacing
- Added spaces after if/foreach/catch
- Added new line before end of file
- Added or removed spaces before/after parenthesis, comma
- Added spaces around string concat

Change-Id: I0590070f1b3542108e242730e8d9a3ba9831e94f
2014-03-20 20:37:30 +00:00
tonythomas01
2f8772135b Check for CoreParserFunction::urlFunction from array to boolean
and return values accordingly to htmlspecialchars()

PHP Warning: htmlspecialchars() expects parameter 1 to be string,
array given in CoreParserFunctions.php on line 212
Checked for the return value of urlFunction in localurle() and fullurle()
function

Bug: 59881
Change-Id: I7ae092f89b9cfbbe91d1883c2182ca5907825ba4
2014-01-30 23:43:38 +05:30
umherirrender
c0d3e85b06 Add Title::hasFragment and use it
Makes checks against the fragment easier to read and all the same.
At the moment some using strval, some use type safe comparsion.

Change-Id: I27d9c3e40e6de6800f4488de167cf06e83c88ce6
2014-01-24 15:42:13 +00:00
umherirrender
d810be838d Remove outdated fixme/todo in CoreParserFunctions.php
Title::getLength is not used and documentation of parameter is there

Change-Id: I50679ff19695a3afedd556e242f27e4172a9774a
2014-01-19 11:13:44 +01:00
Jackmcbarn
b2e20f5d57 Don't always count CASCADINGSOURCES as expensive
When a page's cascading protection sources have already been loaded, don't
count CASCADINGSOURCES as expensive.

Change-Id: Ia9d25790c534414f637f85d6a3fc4f2c1c0de790
2014-01-15 16:13:13 -05:00
jenkins-bot
7c5acbe3f7 Merge "Make PROTECTIONLEVEL count as expensive" 2014-01-15 16:28:11 +00:00
Brad Jorsch
6131a214aa pageid parser function is expensive, make it so
The pageid parser function (not to be confused with the pageid magic
word) hits the database for every title passed, which meets the criteria
for being considered an expensive parser function.

To mitigate this new expensiveness, check for special namespaces,
interwiki titles, and titles in LinkCache before hitting the DB.

Also, record potentially-valid titles in pagelinks so that the page can
be properly purged if the target is created/deleted.

Change-Id: I4fbfc265543f0a64c14dc8a44e1c89cd928a1adb
2014-01-14 15:44:08 -05:00
Jackmcbarn
a87e109e67 Make PROTECTIONLEVEL count as expensive
When protection levels for a page have not previously loaded, make calls
to PROTECTIONLEVEL for that page count as expensive. Also, add new
accessors for the protection information.

Change-Id: Ic088a9f482154d5353ccf580bbe5c359371a8cdd
2014-01-13 15:01:17 -05:00
umherirrender
cf5cb9b79a Raw option of parser functions should match complete word
The MagicWord raw was not matched against the whole given string, which
result in a raw output, when this was not intented.
Fixing this by adding a new regex, which matches the string from start
to end.

Bug: 56199
Change-Id: I7781c415bd61447dd91872575877dd21f36fae9f
2014-01-12 22:25:33 +00:00
Jackmcbarn
d0610c0370 Include namespaces in {{CASCADINGSOURCES}} output
Include the namespace of pages in the output of the CASCADINGSOURCES
parser function.

Change-Id: Ie39ecfb52965c36349e601bee092590a147b5a03
2014-01-06 16:53:43 -05:00
Jackmcbarn
073c4bf16f Add CASCADINGSOURCES parser function
Add {{CASCADINGSOURCES}}, which gives a list of cascading-protected pages
that cause a given page to be protected. This is an expensive parser
function.

Change-Id: I0e9556d53d9a78bc02848c775cb667294726cea1
2014-01-04 12:08:45 -05:00
Siebrand Mazeland
c9f5a5006f Replace usage of deprecated Title::escapeLocalURL()
Change-Id: I1d630ffe5e900a97e169bf3fdab55d0687a67d3b
2013-12-29 16:22:05 +01:00
Skizzerz
e035a14604 Fix error introduced in Change Ieae80c63e391cfb1af61841a6badd51b87d00cfe
The {{NAMESPACE}} magic word is broken by the above commit, since it uses
the function name "mwnamespace" in order to not conflict with the PHP 5.3
namespace keyword.

Change-Id: I807c9b89c101db289c0ec47593c18b0d1dc2260b
2013-12-27 17:55:31 -06:00
Chad Horohoe
0d7de23b3b Break some long lines
Change-Id: I8c3919c04a3fc468191750af51b8be3f952f464e
2013-12-27 16:01:17 -05:00
Chad Horohoe
8ca3b9dc0d Reduce insane amount of code duplication and long lines
Change-Id: Ieae80c63e391cfb1af61841a6badd51b87d00cfe
2013-12-27 15:57:50 -05:00
Siebrand Mazeland
8d0106d585 Remove last remainig use in core of Title::escapeFullURL()
This was deprecated in MediaWiki 1.19.

Change-Id: I21a46a35e449b81d5999420add91d7664fcf5f1d
2013-12-27 15:01:26 +01:00
umherirrender
2b980a226f The static declaration must come after the visibility declartion
Change-Id: I7f4646a5eb3acc7209b243c82a5a496daf82cf8f
2013-11-23 14:42:32 +01:00
umherirrender
1523621054 Add expensive parser functions {{REVISION*:}}
The magic words REVISIONID, REVISIONUSER and REVISIONTIMESTAMP (with
friends) now exists as parser function to fetch revision information
from another page specified as param to the parser function.

Invalid title or non-existing title will return an empty string.
Requesting revision deleted information will always return an empty
string, because this is for public audience and goes into the parser
cache.

The parser function will register a template link to get updated with
refresh jobs on edit of the remote page. This is the same way, than
the parser function pagesize is working.

When the given param is equal to the current title of the parser, the
parser function will yield the previous versions on preview and on
substitution, that includes empty strings when used on page creation,
but using the values from the current version for page view, including
viewing old revisions.

Bug: 6092
Change-Id: Ib15a4e54c65192ec3caef71fd5dcb93fb6fc444e
2013-10-29 22:02:59 +01:00
Tim Starling
d1bc243f65 Remove all instances of the word "iff"
It's elitist mathematical jargon. In all cases dealt with here, it adds
no additional meaning compared to "if", beyond what was already obvious
from context. Thus, its only purpose is to smugly demonstrate that the
author attended their second-year mathematics classes, at the expense of
causing confusion for everyone who doesn't have such a background.

If you really think you need to convey extra information beyond what
"if" gives you, the English language contains plenty of devices for doing
so, without resorting to neologisms.

Change-Id: Iae21095d02ec2935c10e94f532235c2671c115b1
2013-10-23 10:56:54 -07:00
umherirrender
35065c9db5 Added {{REVISIONSIZE}} variable to get the current size of a revision.
This avoids giving the own page name to {{PAGESIZE:}} and allows
PAGESIZE on subst: to give the size before save.

Viewing a oldid page will give the corresponding size to that revision.
(Like REVISIONUSER or REVISIONTIMESTAMP)

This partially reverts Idfac13de37d05317f65e4131534543e66cf74873
because there is no need to let PAGESIZE handle extra, when the given
title is the own page.

Change-Id: If9e608d54904c21ac6b095e91ff6e0a15da0fb4c
2013-09-21 03:49:35 +01:00
jenkins-bot
59404fb12e Merge "Call $wgContLang->findVariantLink() in {{PAGESINCATEGORY: }}" 2013-09-05 07:41:39 +00:00
Liangent
970cc1e8e6 Call $wgContLang->findVariantLink() in {{PAGESINCATEGORY: }}
Corrects inconsistent return value for number of pages in a
category when language variants are in use.

Change-Id: I27668ba348c45bc34b264f8771e91e58a9920552
2013-09-05 07:35:23 +00:00
Liangent
0e57adabc3 Disable language conversion for echoed sortkeys in defaultsort errors.
Change-Id: I24ac06687df126b59a3eddeb4ed00b2ca0ee22e9
2013-07-04 20:25:06 +00:00
jenkins-bot
67a63d8de7 Merge "Parse duplicate-defaultsort error message" 2013-07-04 18:56:10 +00:00
Alex Monk
f7e1570030 Parse duplicate-defaultsort error message
Bug: 49611
Change-Id: I2fd6c74597ba423378c3f08e76248c2b241098dd
2013-07-01 15:57:25 +01:00
MatmaRex
d1b64093ef displaytitle: Pass-by-reference fix for PHP 5.4
PHP 5.4 includes some pass-by-reference changes which apparently make
the '&' sigil necessary here.

Spotted by Mormegil <mormegil@centrum.cz>. Followup to Ie162535b.

Change-Id: I038fa7f8e1559c95dba7b9b498fc1d1f5eb76887
2013-06-21 00:18:36 +02:00
umherirrender
efcf646a03 Do not output numberofviews, if $wgDisableCounters = true
Follow up I9975dceedeffafadf560ed71238c51b94eb8c3ad
But now for the parser function

Change-Id: I18261b884b7f3be57a42c0b10594384fab6f9c9a
2013-06-17 21:09:06 +02:00
Mormegil
7fadd2c9f3 (bug 47449) {{#special:}} should always return a usable title
{{#special:}} should always return a usable title in NS_SPECIAL,
even when given an unknown special page title. Currently, it returns
"No such special page" text for such unknown names, which is
surprising.

Bug: 47449
Change-Id: I7f184956ec9d56c849f201f1230736fcedd0fadf
2013-06-14 06:33:08 +00:00
MatmaRex
267b582e16 displaytitle: reject some CSS if $wgRestrictDisplayTitle set
$wgRestrictDisplayTitle is intended to make it possible to simply
copy-and-paste the title text even if it requires some styling like
subscript or superscript. Using a <span style="display: none;" />
broke that expectation, as the text hidden in such way becomes
completely invisible and unselectable. This patch rejects such styles.

Also disallowed 'user-select' and 'visibility', since they both
prevent the user from selecting and/or copying the text as well.

Minor changes in Sanitizer:
* checkCss() was made to pass through values which consist of nothing
  but a single comment, to allow this rejection to display some sort
  of a notification to the user.
* encodeTagAttributes() was added as a counterpart to
  decodeTagAttributes(), pulling some code out of fixTagAttributes().

Bug: 26547
Change-Id: Ie162535b6bcbebce4ee69f6dcc1957ccccc3c672
2013-05-24 15:05:37 +02:00
umherirrender
c6894adefc Fixed spacing
Added spaces around some parenthesis

Change-Id: If1e50e2a7b0046e91c0bbce8bf6641d8b2446a1d
2013-05-09 19:48:10 +02:00
Brian Wolff
2d542d3fd5 {{PAGESIZE:{{FULLPAGENAME}}}}, {{{{FULLPAGENAME}}}} not outdated
Previously, when parsing {{PAGESIZE:{{FULLPAGENAME}}}} or
{{ {{FULLPAGENAME}} }} (a self-transclusion), we used the
version currently in the db, which is outdated because
the moment we save the page there will be a new version.

This often causes confusion when testing templates that
often have examples of template use in the doc section
which would be one version out of date.

This change causes those variables to give results for
the most recent version of the page. For self-templates
that's done by reparsing the page after save. For
self page sizes this is done by taking the size
of the input to Parser::parse.

Note that {{subst:PAGESIZE:{{subst:FULLPAGENAME}}}}
will still yield previous revision like before.

bug: 39590
Change-Id: Idfac13de37d05317f65e4131534543e66cf74873
2013-04-27 20:45:32 -03:00
umherirrender
9f14ecf829 Added space after switch/Removed spaces after unset
While at it, added/removed some other spaces in the same files

Change-Id: I84d8001aa123a008807ad5eb76f396aed7c899a4
2013-04-26 16:42:31 +02:00
blotmandroid
d197fbd349 Introducing a new variable {{ROOTPAGENAME}}
Introduced a new variable ROOTPAGENAME which has similar
content like BASEPAGENAME.
ROOTPAGENAME only contains the name of the topmost page without namespace, e.g.
for "User:Name/Article/Subarticle" it should be "Name".
BASEPAGENAME would be "Name/Article" here.

Update : fixed indentation in maintenance/fuzz-tester.php

Added to RELEASE-NOTES-1.2.2

Bug: 6747
Change-Id: I71ef0a15c95c9145462f3aa7fdb3ed11dac79265
2013-04-24 02:13:25 +05:30
umherirrender
6c38a5eb72 Fixed spacing in logging/parser/profiler/rl/revdel/search folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I11bbcfa351e945b7bde10c2105d61a3cf5622205
2013-04-20 17:38:24 +02:00
Brad Jorsch
5b17f233cd CoreParserFunctions::anchorencode should return a string
CoreParserFunctions::anchorencode incorrectly returns false rather than
the empty string when passed an empty string.

A simple cast fixes it; this likely wasn't noticed before since PHP was
automatically doing the cast anyway when the return value was merged
into wikitext.

Bug: 46608
Change-Id: I97556dbc4dcc1f102f6fed499d43dada388cdc5d
2013-03-27 17:08:24 +00:00
Alexandre Emsenhuber
15833dafdf Fix case of some Title methods
Change-Id: I1a37ffb0e8cde4deac027721b0e463585b58d634
2013-03-26 10:54:15 +01:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
d63121016d fix some spacing
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
2013-03-07 17:53:21 +01:00
jenkins-bot
3fca4cbe5d Merge "(bug 35753) Allow {{FORMATNUM}} to only do digit transform" 2013-02-26 08:40:00 +00:00
Pavel Selitskas
eadd393a81 (bug 35753) Allow {{FORMATNUM}} to only do digit transform
{{formatnum:1234567.89|NOSEP}} will perform only digit transformations.

Change-Id: Ic882d5ba087665030144e85248680acece8aa901
2013-02-26 08:30:16 +00:00
umherirrender
570dda0455 fix some spacing
Change-Id: I88e73d47a552918880514d88a876296a6cb80d88
2013-02-04 20:09:18 +00:00
Alexandre Emsenhuber
782ea7acae Use better variable name in CoreParserFunctions::pagesize()
Also moved the retrieval of the revision ID near the one of the
page ID so that the call of ParserOutput::addTemplate() is much
clearer than the actual one.

Change-Id: Ie71ee76e90cc131eac25c0f339d5250d5163ce2e
2013-01-22 02:06:25 +00:00
Pavel Selitskas
0ed9be373b (Bug 17970) {{PROTECTIONLEVEL}} should be able to return the status for pages besides the one it's on
Change-Id: I4c60a5f25c739583eb087024c5e949ebcd2def72
2013-01-18 22:03:01 +03:00
Catrope
cddcb353fb Merge "Reduced some master queries via Revision::READ_NORMAL." 2012-08-28 23:53:26 +00:00
Aaron
d1ea6352e6 Reduced some master queries via Revision::READ_NORMAL.
* Also normalized 0 => false for the rev ID parameter in some places.
* Broke some long lines and shorted a variable name in Skin.php.

Change-Id: I6645315699ec7670ae22aa1dbf787d75d6e6b7ec
2012-08-27 16:20:56 -07:00
Niklas Laxström
a42bd6d4bb Validate number input for {{PLURAL}}
The new plural parser is pickier about input.

Change-Id: I1d033d30fdad61db2f661f603d9866923245137a
2012-08-27 08:55:37 +00:00
Siebrand Mazeland
4e1ccf0267 Replace deprecated wfMsg* calls with Message class calls.
Doing this in steps of roughly 100 changes per commit, so that it remains reviewable.

Change-Id: I4950fdf8be669b52446290768ece0b8df8399d5d
2012-08-20 22:52:17 +02:00
Reedy
e3f2a90bf0 Remove unused variables/function values returned
Fix trailing whitespace

Change-Id: I53abf75e142f0166032b98e4adb3dabe06643017
2012-08-08 00:47:25 +01:00
Nikerabbit
d2bac57f54 Merge "Make DateFormatter work in any language, by default in the page content language" 2012-07-27 11:02:29 +00:00
Catrope
a1815e3196 Merge "(bug 14237) Allow PAGESINCATEGORY to distinguish between 'all', 'pages', 'files' and 'subcats'" 2012-07-26 02:11:05 +00:00
umherirrender
110c9f979d (bug 14237) Allow PAGESINCATEGORY to distinguish between 'all', 'pages',
'files' and 'subcats'

Change-Id: I6dc90c6701c857256343f3c8f874dc20c6cc098a
2012-07-25 17:57:18 +02:00
umherirrender
49a4839c13 allow combined width/height param in {{filepath:}}
Using the same regex like [[File:|]]
With heigth, the width inside the thumb link can be calculated, if the
height not fit in the width.

Change-Id: If188d923d6cd25ea6a5118098f3a513ca5135d43
2012-07-25 17:31:47 +02:00
robin
e16c4c9ed8 Make DateFormatter work in any language, by default in the page content language
Add a lang parameter to DateFormatter so it can work in any language instead of only the site content language.
(The memcached key is now per language code.)
Use by default parser->getTargetLanguage() so it is parsed in the page content language by default.
Also add some documentation and remove unneeded whitespace.

If needed, a parameter to {{#dateformatter}} can now be easily added, to specify the language to format in.

Change-Id: If61854920065f7c3b4170ab89e9aa66b299f9dd8
2012-07-21 00:27:04 +02:00
Alexandre Emsenhuber
0fc8c8e14e Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I10c077f27a2077a266a64048fa137f7b1f8e226c
2012-05-01 09:05:48 +02:00
umherirrender
dfe61f64af GENDER should use the GenderCache
This reused the gender state of a user on a page. This is helpful for
special pages which shows the group name, because the each group name
used gender, which result in often use.

Change-Id: I8e816f54aaa100c3333e84e19299fd194323341d
2012-04-07 22:45:31 +02:00
umherirrender
bf2a9989b2 (bug 23006) create #speciale parser function
Also add explicit Title::getPrefixedText() in
CoreParserFunctions::special, so that method does not rely on
Title::toString.

Change-Id: I1d041b11386bff15811e19de47a662e5ed7a2b07
2012-04-06 09:14:47 +02:00
umherirrender
b5511c68c3 (bug 34355) add a variable and parser function for the namespace number
Change-Id: Ie162cfda7ddd38d4278ceee5fd23f5a4e579cb96
2012-04-03 13:25:06 -07:00
Alexandre Emsenhuber
e6812a869a * (bug 35446) Using "{{nse:}}" with an invalid namespace name no longer throws a PHP warning
Change-Id: I8e7611cdb03558af13ec5b96e02857ff5b16b571
2012-03-26 20:27:18 +02:00
Tim Starling
13b514edae Fixed a few "strip tag exposed" bugs.
* Introduced Parser::killMarkers() based on the concept from StringFunctions. Used it in cases where markerStripCallback() doesn't make sense semantically, namely grammar, padleft, padright and anchorencode. Used markerStripCallback() in other cases.
* Changed headline unstrip order as suggested by P.Copp on bug 18295
* In CPF::lc() and CPF::uc(), removed the is_callable(). This was a temporary testing hack committed by me in r30109, which allowed me to do differential testing against a copy of the parser from before that revision.
2012-03-20 04:39:09 +00:00
Robin Pepermans
b13e9ad861 fix typo in r112479 2012-03-01 17:57:15 +00:00
Robin Pepermans
44d2c73bf5 Combine getLanguageNames and getTranslatedLanguageNames into one function which is much easier and more logical to use. Does not contain any actual changes yet in what the function does.
* Reduces the overly long code in r107002, and reduces code for {{#language:}}
* Fixes the language list in Special:Translate which contained languages that gave "invalid code" when selecting
2012-02-27 11:59:24 +00:00
Sam Reed
9990b77058 Add missing wfProfileOut( __METHOD__ ); 2012-02-16 02:01:00 +00:00
Sam Reed
2ec09c5165 More return documentation 2012-02-09 21:35:05 +00:00
Tim Starling
a444986c45 * Optimise {{GENDER}} so that it doesn't need to load the user options if only one form is given. For some reason (presumably some detail of how translatewiki.net works) such {{GENDER}} invocations are extremely common.
* Updated Language::gender() documentation accordingly
2012-02-08 06:09:58 +00:00
Antoine Musso
fc6bc233be Fix doxygen docs before REL1_19 branching 2012-02-01 20:53:38 +00:00
Aaron Schulz
5a6559d8b1 Reverted r108743 per CR comment. This should at least be discussed first. 2012-01-12 19:41:18 +00:00
Sam Reed
a5c200a25b Kill "* @return void" 2012-01-12 19:12:24 +00:00
Brion Vibber
c1906d53de Provisional revert r106573, r106559: may be the wrong thing to do, and should probably come with regression tests if added. 2011-12-20 21:24:06 +00:00
Robin Pepermans
e9033cbf82 Follow-up r106559: it's better to set the preference for own MediaWiki names in Language::getTranslatedLanguageNames. More consistent and saves some code :)
Also update Babel to use that function.
2011-12-18 17:58:47 +00:00
Robin Pepermans
8cae5ee72d Make the output consistent when no second parameter is given and second parameter equals first parameter. This gives preference to names defined in MediaWiki, but when it is not in MediaWiki, it also sees whether there is one defined in the translated language names. 2011-12-18 12:17:12 +00:00
Platonides
dc38ecd003 Bug 31098: Template loop through MediaWiki: messages (int: function) not being detected.
The trick is not to replaceVariables() ourselves, but to leave that to the preprocessor,
which is then correctly detecting the loop.
2011-10-29 22:22:51 +00:00
Alexandre Emsenhuber
bd548f36e9 * Changed ParserOptions to store a Language object instead of only a string, avoids object -> string -> object conversion
* ParserOptions::getUserLang() will still return a string for compatibility, added ParserOptions::getUserLangObj() to get the object
* Added ParserOptions::newFromUserAndLang() and ParserOptions::newFromContext() to easily get a ParserOptions object when a context is available or when someone wants to force the language
* Updated OutputPage and Preferences to use newFromContext() and WikiPage to use newFromUserAndLang()
* ParserOptions::setUserLang() still accepts either a string or a Language object, but changed the calls to pass an object instead of a string
* Changed Parser::getFunctionLang() to return the Language object from ParserOptions when parsing interface messages rather than $wgLang directly and updated the documentation to say that $wgLang should not be used directly (as $wgUser, $wgTitle and $wgRequest)
2011-10-19 14:16:01 +00:00
Brian Wolff
2f2d9bd0c5 (follow-up r96767) Make {{DEFAULTSORT:..|noerror}} and noreplace i18n-izable.
Hopefully i did this right. I've never added a magic word before...
2011-09-11 20:32:58 +00:00
Brian Wolff
62eb447b9b (bug 16755) Add syntax to DEFAULTSORT - {{DEFAULTSORT:Foo|noerror}} and {{DEFAULTSORT:Bar|noreplace}}
to in both cases prevent the "A sortkey already was specified earlier in the page, yadda yadda" message and in the second case, also do not replace the sortkey
if one was already specified.
2011-09-11 02:20:20 +00:00
Roan Kattouw
fbc65f8972 Per CR on r44412 and my promise in the commit summary of r94990, stop abusing $wgInternalServer (intended for Squid URLs) for IRC/e-mail URLs and introduce $wgCanonicalServer for these purposes instead. This revision introduces two new hooks for WMF hacks, in exchange for making the core code saner.
* Introduce $wgCanonicalServer, which should typically be a fully qualified version of $wgServer but in practice can be anything that you'd like to be used in IRC/e-mail notifs
** Default value is $wgServer, expanded to http:// if protocol-relative
** This means you can easily set HTTPS as the 'default' protocol to use in IRC and e-mail notifs by setting $wgCanonicalServer to https://example.com
* Introduce Title::getCanonicalURL(). Similar to getInternalURL(), including a hook for WMF usage (which will be needed as long as secure.wikimedia.org is used)
** Also add escapeCanonicalURL(). Due to some ridiculous accident of history, the other escapeFooURL() functions don't have a $variant parameter; I decided not to follow that bad example
* Reinstate the spirit of r44406 and r44412: instead of calling getInternalURL() (or getCanonicalURL()) and regexing the title parameter out, obtain the path to index.php using $wgCanonicalServer . $wgScript and append params to that. Sadly, we need to add a hook here to support the secure server hack for WMF, but that's the price of saner code in this case
* Introduce the {{canonicalurl:}} and {{canonicalurle:}} parser functions, which work just like {{fullurl:}} and {{fullurle:}} except that they use getCanonicalURL() instead of getFullURL()
* Use {{canonicalurl:}} in the enotif_body message, fixing bug 29993 (protocol-relative URLs appear in e-mail notifications)
2011-08-19 11:23:17 +00:00
Roan Kattouw
ae7d7676fb Fix r93820: PROT_ -> PROTO_ 2011-08-03 13:11:42 +00:00
Roan Kattouw
6adb2e86a5 Some random URL protocol forcing for protocol-relative URLs 2011-08-03 12:58:21 +00:00
Mark A. Hershberger
e201e2307d w/s changes: “svn diff -x-w” is clean 2011-08-01 15:40:02 +00:00
Niklas Laxström
e7035be35f ping r91875 2011-07-11 18:05:32 +00:00
Niklas Laxström
59a5f7e292 * (bug 16699) {{#language:}} accepts second parameter to specify the language in
which the language name is wanted. Coverage depends on the cldr extension.
2011-07-11 12:23:39 +00:00
Niklas Laxström
74deda8865 Fu r90453. Updates comments 2011-06-20 10:19:52 +00:00
Niklas Laxström
9988444a9f Proposed fix for bug 29450. Don't use the current user's gender for invalid users.
Any ideas how to write tests for this?
2011-06-20 10:04:55 +00:00
Max Semenik
12565a5994 Fix type in code doc from r82433 2011-06-17 20:02:39 +00:00
Sam Reed
e514478ba5 Fix function level comments that start with /* not /** 2011-05-21 19:35:16 +00:00
Siebrand Mazeland
75c6696aa8 Use consistent notation for "@todo FIXME". Should update http://svn.wikimedia.org/doc/todo.html nicely. 2011-05-17 22:03:20 +00:00
Krinkle
3b5d666da7 Change getUrl to getFullUrl for {{filepath:Filename.jpg}} of non-thumbd local files. This way it matches the paths for thumbnails and for foreign files. (bug 28618) 2011-04-23 19:38:53 +00:00
Chad Horohoe
783d4e0862 Remove @static from all over the place. That's what the static keyword is for, this being PHP5 and all 2011-04-21 00:07:09 +00:00
Happy-melon
2c9cfd7cce Refactor the factory/i18n/list/etc static methods from SpecialPage into their own class; there's no reason we need to be parsing them in every single SpecialPage subclass. Leave all the methods as stubs in SpecialPage.php; if we required PHP 5.3 they could be replaced by a a __callStatic() magic method, but that doesn't work on PHP 5.2.
Also make a few changes to the functions available.  SpecialPageFactory::resolveAlias() now takes an optional subpage and returns array(<name>,<subpage>).  Similarly merge getPage() and getPageByAlias().  There were many examples of (extensions particularly) making dubious assumptions about the presence or absence of subpages or canonical-ness.

I didn't deprecate SpecialPage::getTitleFor() as it's got over six hundred calls.  I'm rather undecided on the best position of getPage()/executePath().  Although the latter needs cleanup anyway.
2011-04-17 11:31:11 +00:00
Sam Reed
7d98280f3e More function and variable documentation 2011-02-19 01:02:56 +00:00
Sam Reed
da3b3fbae4 More return type documentation 2011-02-08 23:18:13 +00:00
Alexandre Emsenhuber
dfd6988313 Use wfMessage() instead of wfMsgGetKey() 2011-02-04 16:52:26 +00:00
Alexandre Emsenhuber
51c6afc751 * Replaced $wgMessageCache by MessageCache::singleton(); since we only use one instance of this class (as for ParserCache, LinkCache)
* MessageCache::singleton() calls wfGetMessageCacheStorage() directly instead of using $messageMemc, just in case this would be called before that variable is set
* Per TimStarling: also removed deprecated methods in MessageCache class: addMessages() and related, [get|set|enable|disable]Transform(), loadAllMessages(), loadMessageFile() and some others. Same for the legacyData stuff in LocalisationCache that was only used by MessageCache::addMessages() and related. 
* Converted remaining extensions
2011-01-26 15:42:04 +00:00
Krinkle
0552353f1f Follow-up per r80813 CR 2011-01-23 14:34:19 +00:00
Krinkle
3cc14d4bf8 Bug 26870 - add width/height param to {{filepath:}}
* In addition to r80381
* Expanded comments in SpecialFilePath a little bit
2011-01-23 13:09:15 +00:00
Ilmari Karonen
7e5472dea3 followup r80511: make {{PAGENAMEE}} and friends also call wfEscapeWikiText() (why is the code duplicated, anyway??) 2011-01-18 20:15:50 +00:00
Alexandre Emsenhuber
510309e4ab * (bug 19006) {{REVISIONUSER}} no longer acts like {{CURRENTUSER}} in some cases
* Removed other usages of $wgUser in Parser stuff, as stated in doc
* Added mechanism to get an User object in Parser, based either on the object given in Paser::preSaveTransform() or the ParserOptions otherwise
2010-12-10 18:17:20 +00:00
Chad Horohoe
ba134fca3a Revert r73976 (Implements bug 24343 "localurl discards section id"). Per BZ feedback, this doesn't actually fix the original issue, it adds a new parser function to work around the issue. 2010-10-23 15:32:31 +00:00
Platonides
ed779ae90a Use the accessor for getting mOptions.
I'm not touching the accesses from the preprocessors since 
I don't know if the call could add a penalty.
2010-10-15 23:10:05 +00:00
Antoine Musso
c9ed45c948 Implements bug 24343 "localurl discards section id".
* parser hook 'linkurl' which use Title::getLinkUrl()
* very basic tests for the Title class
2010-09-29 19:51:48 +00:00
Ryan Kaldari
4b4a065501 fixing per comments at r70517 2010-09-29 17:25:17 +00:00
Alexandre Emsenhuber
dc50e1a4bf * Added file description headers
* Added @file where needed
2010-08-22 14:31:05 +00:00
Sam Reed
380b6725d5 Remove some unused variables
Move variable in languages/classes/LanguageKu.php into commented code (used in comment)
2010-08-13 20:58:16 +00:00
Platonides
9e96f8db77 Parser should only use content messages. 2010-08-12 13:23:28 +00:00
Platonides
e1e71bde41 Make intfunction go accross the ParserOptions.
Things like calling setUserLang( true ) to use the content language are unsupported and shouldn't be done.
2010-08-05 18:43:49 +00:00
Conrad Irwin
e3e24db382 (bug 17857) Make {{anchorencode}} work in a manner more similar to the way that
section links are created by the parser. Also useful for (bug 18431).
2010-06-20 23:43:39 +00:00
Alexandre Emsenhuber
1ec45bef2e Fixed some doxygen warnings 2010-06-09 14:57:59 +00:00
Chad Horohoe
6d993be4c5 Partial revert r67707, included half-baked patch 2010-06-09 11:54:18 +00:00
Chad Horohoe
44229b50e6 Fixed a bunch of silly instances of [^!=]==\s*(true|false) 2010-06-09 11:44:05 +00:00
Conrad Irwin
481ddf27f9 Bug 22474, urlencode now takes a parameter to change escaping style 2010-04-08 00:29:58 +00:00
Alexandre Emsenhuber
6067875881 Typo in comment 2010-03-18 11:42:26 +00:00
Alexandre Emsenhuber
70969c83ce * (bug 22772) {{#special:}} parser function now works with subpages 2010-03-16 19:47:24 +00:00
Tim Starling
f5b882aadc Moving Conrad's recent parser work out to a branch. Reverted r62434, r62416, r62150, r62111, r62085, r62081, r62080, r62077, r62076, r62069, r62049, r62035. 2010-02-19 05:19:32 +00:00
Alexandre Emsenhuber
e254b8e971 Fixed some doxygen warnings 2010-02-14 21:23:38 +00:00
Platonides
eb433b42a0 Follow up r62436 comments.
s/Title::newFromUrl/Title::newFromURL/
All these usages should be reviewed. Make it easy to grep using the canonical form.
Additionally fix the typo.
2010-02-13 23:58:30 +00:00
Alexandre Emsenhuber
f0683f8e08 Whitespaces fixes 2010-02-11 14:57:43 +00:00
Chad Horohoe
5fd1b2e4ba Cleanup r62111, don't pass by reference 2010-02-08 11:30:17 +00:00
Conrad Irwin
7a1fc37382 partial revert for r62081. Make {{PIPETRICK}} like {{PAGENAME}}, add {{PIPETRICKE}}. fix r62077 better. 2010-02-08 02:07:15 +00:00
Conrad Irwin
0443dd4c5c Fixes for r62077
{{pipetrick:}} -> {{#pipetrick:}} per IAlex
 clearer documentation per Siebrand
 parser test for new magic word.
2010-02-07 13:17:05 +00:00
Conrad Irwin
d036809f36 Bug 7264 - Magic word to give Page Title as if pipe-trick performed on it {{pipetrick:}} 2010-02-07 02:36:32 +00:00
Tobias
a197b768dd introducing new CoreParserFunction nse as an url-friendly equivalent to ns. bug 12920 2009-08-02 18:16:56 +00:00
Ryan Schmidt
12153478ef * DISPLAYTITLE fixes:
** DISPLAYTITLE now parses the single-quote items of wiki markup (bold and italic).
** Remove UNIQ markers from the output due to people putting tags in there (nowiki, ref, etc.).
** Forbid hr and br elements from being in DISPLAYTITLE as well.
2009-06-08 16:53:39 +00:00
Tim Starling
6cc78e5d4b Revert r51200, r51253, r51254, addition of {{NUMBEROFCONTRIBS:...}} parser function. See CodeReview r51200. Not very well implemented and probably a bad idea anyway. 2009-06-06 02:49:32 +00:00
Tim Starling
9cb35f8036 Reverted r49575, {{revisionid:...}} due to unresolved CR comments and the general cache-breaking insanity of the concept. 2009-06-03 17:09:50 +00:00
Tim Starling
1179421217 Reverted r48984. Fragile, doesn't work if memcached is enabled. See CodeReview. 2009-06-03 14:51:08 +00:00
Tim Starling
df41d898a7 Profiling for CPF::gender() 2009-06-03 06:28:19 +00:00
Alex Z
19a90fd8a7 On second thought, use idFromName and edits() instead, load() loads a whole bunch of stuff we don't need 2009-05-31 19:06:04 +00:00
Alex Z
12fb35058e Some followup to r51200:
* Save a query by not using User::edits()
* Mark as an expensive function (it needs at least 1 query for each use)
* Use number formatting/raw option rather than pointless wfEscapeWikiText()
2009-05-31 18:55:38 +00:00
X!
784dc5cc9a (bug 19012) Added {{NUMBEROFCONTRIBS}} variable 2009-05-30 17:27:16 +00:00
Siebrand Mazeland
8e23949bee Proper casing for getDBkey() 2009-05-24 08:29:10 +00:00
Ryan Schmidt
54f5b23182 Follow-up on r49330
* re-add $wgRestrictDisplayTitle
* revert r49610
* prevent block-level and other such tags from being used in DISPLAYTITLE (while still allowing tags such as <sup> and <sub>)
2009-04-19 23:48:50 +00:00
Roan Kattouw
30c3ce9f9a (bug 6092) Add parser function equivalents of {{REVISIONID}}, {{REVISIONTIMESTAMP}} (and friends) and {{REVISIONUSER}} magic words. These parser functions are marked as expensive and cache their results 2009-04-16 21:46:49 +00:00
Remember the dot
e4d211703c (bug 12998) Allow <sup>, <sub>, etc. in DISPLAYTITLE 2009-04-09 05:15:43 +00:00
Philip Tzou
3cf3ea5f0b Add group convertsion support for LanguageConverter. New magic word "{{GROUPCONVERT:xxx}}" enabled for this new feature. You can set related conversion rules in [[MediaWiki:Groupconversiontable-xxx]]. 2009-03-29 08:55:45 +00:00
Andrew Garrett
27ea934436 Convert formatdate to a hashed parserfunction 2009-03-25 12:27:04 +00:00
Brion Vibber
1a58e8f93e Fix up r48728 "Allow User: prefix in parameter to GENDER parser function"
Wasn't checking return value for null, or actually calling the getNamespace() method correctly.
2009-03-24 23:04:51 +00:00
Andrew Garrett
80e4139017 Allow User: prefix in parameter to GENDER parser function 2009-03-24 06:58:43 +00:00
Chad Horohoe
8f25eccecb Documenting this, because it makes no sense. 2009-03-18 21:32:58 +00:00
Andrew Garrett
72acc9b179 Tweak r48249 -- allow specification of the default format, and require the date to take up the entire argument. 2009-03-10 05:19:05 +00:00
Andrew Garrett
b9ffb5a7e9 * (bug 4582) Provide preference-based autoformatting of unlinked dates with the dateformat
parser function.
2009-03-10 01:07:47 +00:00
Alexandre Emsenhuber
d710765f6f Renamed CoreParserFunctions::namespace() to CoreParserFunctions::mwnamespace() to not break PHP 5.3, was throwing an E_PARSE: "Unexpected T_NAMESPACE" 2009-03-04 18:59:28 +00:00
Brion Vibber
ae0b528972 Revert r46628, r46639 for now "Don't allow padding parser functions to be used to truncate strings."
Doesn't seem to be a compelling reason to add this special-case restriction at this time, and there appear to be ways to work around it anyway, so let's not play the arms race. :)
2009-02-18 02:24:55 +00:00
Aaron Schulz
7a5ca259be Rename new ACTIVEUSERS word to NUMBEROFACTIVEUSERS 2009-02-17 23:05:04 +00:00
Andrew Garrett
802c88e188 Add ACTIVEUSERS magic-word, complement to NUMBEROFUSERS. 2009-02-04 22:16:35 +00:00
Alex Z
a4fafb006b (bug 8249) Followup to r46630, add parser function versions of the various PAGENAME magic words 2009-01-31 22:25:01 +00:00