Commit graph

221 commits

Author SHA1 Message Date
Umherirrender
b5cddfb27b Remove empty lines at begin of function, if, foreach, switch
Organize phpcs.xml a bit

Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
2017-07-01 11:34:16 +00:00
James D. Forrester
9635dda73a includes: Replace implicit Bugzilla bug numbers with Phab ones
It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345"
except where it doesn't, so let's just standardise on the real numbers.

Change-Id: I6f59febaf8fc96e80f8cfc11f4356283f461142a
2017-02-21 18:13:24 +00:00
Niklas Laxström
c9d638d6c7 CoreParserFunctions: Use Title::inNamespace instead of manual comparison
Change-Id: I60c02bc68ef0d48b1dc66ba0961275feec5789fb
2016-12-21 10:55:14 +01:00
Nikerabbit
63bb3852a5 Parser functions now format numbers according to page language (2nd attempt)
Bug: T62604
Change-Id: I1c60d828891b82a8122e7030d843018fccaf72e4
2016-12-19 10:17:11 +01:00
addshore
7dd1600e9c Get GenderCache from MediaWikiServices
Change-Id: I752a65d93ec49ea6c44306eb18a6641ef86f7b5c
2016-11-22 23:14:43 +00:00
Legoktm
962b945538 Revert "Parser functions now format numbers according to page language"
This reverts commit 4290f686c0.

Bug: T149840
Change-Id: I7e2dfe14813b510a1a974ae0007390bb2879f804
2016-11-02 20:23:18 +00:00
Niklas Laxström
4290f686c0 Parser functions now format numbers according to page language
Also fixed incorrect return value documentation.

Bug: T62604
Change-Id: I1e16f20ca79436afe17eba711981b2ae43fed9e1
2016-10-25 19:13:25 +03:00
Legoktm
3172dfe21e Revert "Move wfEscapeWikiText() to Parser::escapeWikitext()"
Apparently it is possible for Parser::mParserOptions 
to not be set in some cases. I'll try again later.

This reverts commit bda74bff6e.

Bug: T146433
Change-Id: Idb6d1b20995d5f86b712abb386ab987356c4f560
2016-09-23 00:29:21 +00:00
Kunal Mehta
bda74bff6e Move wfEscapeWikiText() to Parser::escapeWikitext()
wfEscapeWikiText() used $wgEnableMagicLinks, but that could result in an
inconsistency when something modifies the magic link related
ParserOptions.

In general, most uses of wfEscapeWikiText() are in parser functions or
when message parsing, so the Parser is a logical place for it.

A future patch will make it easy to use Parser::escapeWikitext() in
message parameters.

Change-Id: I0fd4d5c135541971b1384a20328f1302b03d715f
2016-09-13 22:34:24 -07:00
jenkins-bot
089612544d Merge "Show ParserOutput warning instead of on the actual page output for ignored display titles" 2016-06-02 21:23:04 +00:00
jenkins-bot
408e9de28c Merge "Add pages with ignored restricted {{DISPLAYTITLE}}s to a tracking category" 2016-05-22 21:17:10 +00:00
Bartosz Dziewoński
06b9d0af42 CoreParserFunctions: Return 0 from {{PAGESIZE:}} when length is unknown
Revision::getSize() might return null when the revision.rev_len field
is null. That should never happen normally (the field should get
backfilled as part of the update process), but we've also had a bug
where rev_len was not being recorded for empty pages (see T135414 for
details). It's saner to return a number here rather than empty string,
and 0 should actually be correct for all pages affected by that issue.

Bug: T20998
Change-Id: Ie12f0be24f00aaf8b90b25c4921a97df3b789369
2016-05-22 18:39:11 +00:00
Glaisher
bacd87e494 Show ParserOutput warning instead of on the actual page output for ignored display titles
Ignored restricted DISPLAYTITLE warning isn't really relevant for the casual reader
so don't show it in the page output. Instead show it above the edit box.

Bug: T135949
Change-Id: I009dd865bec7b6e3a7492c49db97074483f93ee4
2016-05-22 22:45:56 +05:00
Glaisher
8af59afa0d Add pages with ignored restricted {{DISPLAYTITLE}}s to a tracking category
Added to "Pages with ignored display titles" category
(message key: "restricted-displaytitle-ignored")

Follow up to I6ae6d5d0e567ba9c86e46c32240ee51a2ca5d8d1

Bug: T135949
Change-Id: I9e0f8b1e3d39a62c13191bea6734fb136e976e0c
2016-05-22 17:19:46 +00:00
Jackmcbarn
b34d4e2cf3 Warn when a restricted displaytitle is ignored
If a page contains a call to DISPLAYTITLE that is ignored because of
$wgRestrictDisplayTitle, output a warning.

Bug: 26546
Change-Id: I6ae6d5d0e567ba9c86e46c32240ee51a2ca5d8d1
2016-05-08 03:01:22 +00:00
Reedy
b5656b6953 Many more function case mismatches
Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
2016-03-19 00:20:58 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Jackmcbarn
bcb6429372 Fix protectionexpiry using the wrong page
Change-Id: I0d8cfd68a735fbcdd32a000ef47e6922a816968e
2016-01-14 12:10:33 -05:00
cenarium
a042808b91 Add magic word for protection expiry
This adds a magic word to get the protection expiry for a page for a
given action.
Usage is {{PROTECTIONEXPIRY:action}}.

Bug: T19354
Change-Id: Ia1a20e313781789480dc082bdc7f585c4f0e28df
2015-12-07 10:02:12 +00:00
Vivek Ghaisas
c54766586a Fix issues identified by SpaceBeforeSingleLineComment sniff
Change-Id: I048ccb1fa260e4b7152ca5f09b053defdd72d8f9
2015-09-26 23:06:52 +00:00
Amir E. Aharoni
bd30ccd795 Make lines shorter to pass phpcs in some files under includes/parser
This doesn't fix all the files under includes/parser -
some of them deserve their own patches.

Bug: T102614
Change-Id: I2fcbc19ee337e1b7db4635b5e5f324c651b4d144
2015-09-26 18:19:11 +00:00
umherirrender
87c1ca1ac1 Escape return of {{int:}} if message not exists
This avoids returning possible html tags like <var> for {{int:var}}.

Bug: T44914
Change-Id: Ibcba9129d88510e6a84282c774ebe2dbfa548462
2015-07-24 22:02:54 +02:00
Arlo Breault
baddcab658 T105242: U is for urlencode
* Urlencode and extension tags don't play nice. The current behaviour
   is pretty broken. For example,

      {{urlencode:<pre id="one">two</pre>}}

   outputs

       <pre id="one">two</pre>

   which isn't exactly urlencoded.

 * Just drop the unexpanded content; anything more seems unsafe. There's
   precedent for this already in anchorencode.

 * Noticed in the infobox caption for enwiki/%22F%22_Is_for_Fugitive

Change-Id: I0ec5d2fdeb71f762036464f65029afd029e8b4a1
2015-07-08 15:28:21 -07:00
David Chan
f5c88ef8e5 Add {{bidi:}} syntax for directionality-safe arguments
In parallel with jquery.i18n version:
https://github.com/wikimedia/jquery.i18n/pull/76

Bug: T104472
Change-Id: I25afa50ab1e0521bd0b3779cbd16b6c190d72722
2015-07-01 11:06:45 -07:00
Max Semenik
08762b02de Minor cleanups
* Declare undeclared variables
* Kill unused variables
* Fix comments including PHPDoc

Change-Id: I60015f6b6740aa9088bda3745f4dc4e65e29fcb1
2015-04-02 16:22:42 +00:00
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.

Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.

Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
2015-01-07 11:14:24 -08:00
Jackmcbarn
c05b4c9bc4 Re-emit unknown tags from #tag
When #tag is given a tag that it doesn't recognize, re-emit it as a
regular tag instead of giving an error. This allows for it to be used with
transparent tags and HTML tags.

Change-Id: I0ceee8a4fdaf2d3142054a108f445ff06597c31a
2014-12-18 23:06:22 -05:00
Ricordisamoa
12dec5d85d Fix some stuttering in comments and documentation
Change-Id: I9c0088b9aab37335203cad45a1d6fa8ac3f43321
2014-12-17 19:44:10 +00:00
umherirrender
91f26d50ee Use Parser::SFH_NO_HASH/SFH_OBJECT_ARGS class const
Instead of the global const
Add hint to Defines, that they should not be used.

Change-Id: I3e1dcf46fe18a97a05e3406c209815adb7e0e083
2014-11-18 21:19:22 +01:00
jenkins-bot
cf93d76c03 Merge "Remove hitcounters and associated code" 2014-10-20 21:12:54 +00:00
Chad Horohoe
90d90dad6e Remove hitcounters and associated code
The hitcounter implementation in MediaWiki is flawed
and needs removal. For proper metrics, it is suggested to use
something like Piwik or Google Analytics.

RFC: https://www.mediawiki.org/wiki/Requests_for_comment/Removing_hit_counters_from_MediaWiki_core
Change-Id: I0e5006a7e8a09c800f8fa4effa9399e8afdd7a57
2014-10-20 13:01:55 -07:00
Kevin Israel
74cba12de3 CoreParserFunctions::displaytitle(): Use Parser::killMarkers()
... instead of doing something similar to an old version of it.

Change-Id: I78db194291236208843a13b80d322d403774796c
2014-10-20 15:59:51 +00:00
Jackmcbarn
edc9f2acd9 Add parser callback to get a page's current revision
Add Parser::fetchCurrentRevisionOfTitle(). By default, this just calls
Revision::newFromTitle, but a callback can be set in ParserOptions that
will override it. Anything that runs as part of a parse should use this
wherever possible.

Bug: 70495
Change-Id: I521f1f68ad819cf0f37e63240806f10c1cceef9c
2014-09-19 11:59:58 -04:00
Aaron Schulz
1e78807f0d Tweaked cache size in getCachedRevisionObject()
Change-Id: I3b01011f21bf3218f3b5c74430b5d5f9ceaec83e
2014-09-03 23:23:43 +00:00
Aaron Schulz
b728d6920b Made getCachedRevisionObject() use MapCacheLRU
* Previously the cache size was unbounded and leaky
* Also made MapCacheLRU handle null values properly

Change-Id: Ia02258cf051e1ccf11457c758741b8c7922afe89
2014-08-22 18:12:29 +00:00
addshore
61c989cfc0 Fix phpcs issues in parser
This fixes all issues except for:
 - class names
 - line length

Change-Id: Ie91b010d5b3eec49d3b80b6e93b125a901ef43c6
2014-08-12 01:00:15 +00:00
Niklas Laxström
457d732dbf Fix bad reference in method doc
Change-Id: Ic721a869cc25792f2fb3a66803efe48d36c4939c
2014-08-04 11:43:03 +02:00
Jackmcbarn
af66fecb2d Warn when DISPLAYTITLE is used more than once
Implement the same duplicate-warning logic for DISPLAYTITLE that
DEFAULTSORT currently uses, to catch cases where a newer call overrides an
older one.

Bug: 50449
Change-Id: Ibce776d019aab07fb88fbb89afc5340300735405
2014-07-08 23:34:50 -04:00
C. Scott Ananian
fb125de072 Allow HTML5 <rtc> tag (ruby support for East Asian typography).
We currently allow <ruby>, <rt>, <rb>, and <rp> but not the W3C HTML5
<rtc> element.  Fix that.

(Note that <rb> and <rtc> are new additions to HTML5 which currently
appear in the W3C but not the WHATWG version of the HTML5 spec.
Support for these has already been merged in gecko and webkit and
the editor plans to update the WHATWG spec.)

Bug: 67042
Change-Id: I8c0e65d782b6d23057a9723b87323b28e8bf8852
2014-07-02 18:45:14 -04:00
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