Commit graph

168 commits

Author SHA1 Message Date
umherirrender
0a810a5a87 Avoid date()/gmdate() for date formatting
Added a MWTimestamp::format method to format a timestamp object in the
given pattern. This avoids date(), which needs the local time
zone corretly set on the server, which is assumed at the moment in
Setup.php

Added MWTimestamp::getInstance for gmdate() and
MWTimestamp::getLocalInstance for date() to create a MWTimestamp object
and use it as inline statement.
Also MWTimestamp::setTimezone and MWTimestamp::getTimzone was added for
timezone handling.

Change-Id: I812aa013be2f4380e0cf10dc465202756fe8347b
2013-07-08 04:14:12 +00:00
Alex Monk
d3f05c3c01 Set taborder for Special:ListFiles
Order: Items per page, name prefix (if there's no miser mode), username, and submit button

Bug: 43556
Change-Id: Ic0ce1893c3da8e127584cbc90a400d45e3d715f6
2013-07-01 02:42:15 +01:00
umherirrender
15ff79312d Fixed spacing and removed unneeded parenthesis
Added spaces after/before parenthesis
Removed unneeded parenthesis around some statements
Broke a long line

Change-Id: I7fbe129f7bbf524dd0598ece2a9708643f08453b
2013-05-17 16:12:08 +00:00
Mark Holmquist
5b5f892734 Disambiguate buildForm docs, add TODO
Xml::buildForm needs some love. I've given it a better documentation
string, but left a TODO for accessibility: We need to use labels for
input labelling, not table elements.

Change-Id: I4a9ff174e83c8ca3242c82bbe7cb0da0b8be7785
2013-05-13 10:47:45 -07:00
umherirrender
ef2f507d23 Fixed spacing in files direct in includes folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Ibb8dd102db045522d12ff939075ba7420d95ab6b
2013-04-21 06:38:49 +00:00
umherirrender
15abcf71ca Added/Removed spaces around string concatenation
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !

Fixed windows newline style

Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
2013-04-13 13:36:24 +02:00
Kevin Israel
79f80cc495 Combine JavaScript and JSON encoding logic
This will help with improving human readability of JS and JSON
objects encoded by both ResourceLoader and the API. This patch
also adds new "utf8" parameter to the JSON formatter of the API.

Changes to FormatJson class:

* Added escaping of '<', '>', and '&' by default to protect against XSS.
* Removed unnecessary escaping of '/' and added an additional option to
  unescape non-ASCII characters (those above U+007F) as well.
* Added PHP 5.3 pretty printing code (to replace Services_JSON) that
  uses a four-space indent as PHP 5.4 does.

Changes to Xml class:

* Defined Xml::encodeJsVar() in terms of FormatJson::encode()
  and added a pretty printing option. Also added a pretty printing
  option to Xml::encodeJsCall() as well.
* Deprecated Xml::escapeJsString() and QuickTemplate::jstext();
  callers have to add quotes themselves, hence the escaping of
  both double quotes and apostrophes.

Bug: 26818
Change-Id: I1987190f1ba5bf41738e7bd611209706c1f6bb5c
2013-03-27 20:22:45 -04:00
umherirrender
6c278b6d7e fix some spacing
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
  calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays

Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
2013-03-25 22:22:46 +00:00
Siebrand Mazeland
23a8968cad Add to docs that input will be HTML escaped
Change-Id: Ie90a6bc29f54361ec74cbf54551266b94ce6061f
2013-03-23 15:07:19 +01:00
Yuri Astrakhan
9506e3d812 Spellchecked /includes directory
* Ran spell-checker over code comments in /includes/
* A few spellchecking fixes for wfDebug() calls

Found one very strange (NOOP?) line in Linker.php - see "TODO: BUG?"

Change-Id: Ibb86b51073b980eda9ecce2cf0b8dd33f058adbf
2013-03-13 03:42:41 -04: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
jenkins-bot
073a675adf Merge "fix some spacing" 2013-03-07 17:13:27 +00: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
umherirrender
e43dc272bd Fix align of block comments
Change-Id: I88ea33a125a71671886b49e4ebf4c1d0a1cce572
2013-03-07 17:27:38 +01:00
umherirrender
ca31ebad3f fix some spacing
Added/removed spaces after opening/before closing parentheses

Added a space after a comma

Removed unneeded parentheses in condition

Change-Id: I306091347ccaaf11dee0cdfda3019cb0c12be51b
2013-02-09 23:03:53 +01:00
umherirrender
1044b0b8df fix some spacing
Change-Id: I8f976013f33c5818e4402604fe8610aa3f43b0c6
2013-02-04 20:18:33 +00:00
umherirrender
6fbbbd17ca fix some spacing
Change-Id: Ie7bb35871cc99237f3a655f7db22ca1f0646df5e
2013-01-27 14:21:50 +01:00
jeroendedauw
1039b7c7b6 Simplify Xml::encodeJsCall
Change-Id: Idf2838a1b32170ca6336eb4a67f16cd3335218f9
2012-12-22 01:05:22 +01:00
umherirrender
82375631c2 Fix tabs inside/between statements/text
This tabs are strange and a space there is better

Change-Id: I0885dff575ee2fcd0668d08fef3226e132c5b319
2012-10-26 18:18:59 +02:00
umherirrender
85d8ee1f87 Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I00f369641320acd7f087427ef031f3ee7efa0997
2012-10-10 20:14:40 +02:00
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
robin
7405ad3999 Use number input type for year in dateMenu
Use the HTML5 number input type for the year input field in the dateMenu (used on e.g. history pages), since a year is always a number :)
(There was once a year type proposed, but that didn't make it into HTML5)

Patchset 2: use Html::input instead of Xml::input (and change the other Xml's to self::)

Change-Id: If9ad28566abfc02a164367d7cdd6992939169c0a
2012-09-17 21:47:19 +02:00
Alex Monk
2fabea7eea Use wfMessage instead of deprecated wfMsg*
Or $this->msg in special pages.

Change-Id: I774a89d646615053c8424050e42ad95601f92543
2012-08-18 14:11:05 +02:00
robin
72ebf55665 Use Xml::languageSelector in SpecialAllmessages
Improve Xml::languageSelector: add parameters to change label message and id/name of the select tag.

Use languageSelector in SpecialAllmessages (less code duplication)

Patchset 10 July: add tests per MaxSem; add version for new parameters and change the message parameter to require a Message object per Nikerabbit

Change-Id: I7fbb29ee2dc37a2b6a5e2cfc88207a0b47b83e9b
2012-07-10 13:43:38 -04:00
Alexandre Emsenhuber
2040d1337e Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Ib46e50da4ec649a6a06cbeed00752effb79ed06e
2012-05-09 20:11:36 +02: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
e16a11ae16 Improve documentation
Fix whitespace


Fix weird conditional loading of DB_MASTER from specials/SpecialEditWatchlist.php
2012-02-21 21:15:05 +00:00
Sam Reed
43dd8dd7e9 Followup r107002
Add a TODO to do this via hook or similar
2012-02-16 02:52:11 +00:00
Sam Reed
09a78c1368 More return documentation 2012-02-09 21:36:14 +00:00
Sam Reed
0a626db6e1 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 19:29:36 +00:00
Sam Reed
85bbb0b080 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 18:01:10 +00:00
Tim Starling
8a9b79dda7 Revert r110321: introduces an XSS vulnerability because FormatJson::encode() does not prevent the termination of CDATA sections when JavaScript is embedded in HTML. 2012-02-08 00:03:16 +00:00
Krinkle
ece121efd6 [Xml::encodeJsVar] Use FormatJson::encode / native json_encode instead
* Follows-up r110320
* XmlTest.php passes
2012-01-30 19:45:38 +00:00
Krinkle
6ebbb369a6 [Xml::encodeJsVar] Change to match FormatJson::encode output
- Pure whitespace change
- In preparation to deprecate it in favor of FormatJson / json_encode
2012-01-30 19:40:20 +00:00
Antoine Musso
11c166bf92 comment / style for Html::namespaceSelector()
Xml.php:
* align array values. Easier to the eyes.

Html.php:
* Various comments
* Switched the way the HTML is forged

Ping r109990
2012-01-30 11:02:56 +00:00
Krinkle
11b0b2e7d3 [Xml/Html] new method Html::namespaceSelector
* Using params and option arrays instead of 4 random parameters like Xml::namespaceSelector did
* Right now it's passing $selectAttribs['name'] to Xml::label, this is done because that's what Xml::namespaceSelector did. However it's wrong since labels associate over ID not NAME. Will fix in the next commit, making sure unit tests stay functional first. This bug has been in Xml::namespaceSelector for a long time but usually unnoticed as people kept either defaults. Although it was easy to get wrong as the NAME was configurable but the ID was hardcoded in Xml::namespaceSelector.
* Deprecated Xml::namespaceSelector and made it cal Html::namespaceSelector

* Follows-up r109974, r109698
* XmlTest.php still runs successfully
2012-01-25 03:01:20 +00:00
Krinkle
957c3b5b68 [Unit testing] Re-order attribs to a-z to make testing more reliable
* This is in preparation for deprecating this in favor of an Html:: method soon, making sure here that tests still match afterwards
* Follows-up r109698
2012-01-25 00:52:29 +00:00
Ryan Kaldari
d539feaa20 follow-up to r106912 - NULL to null 2012-01-04 19:01:12 +00:00
Ryan Kaldari
6aa9ece18b follow-up to r106912, making change to correct branch this time 2011-12-21 22:54:22 +00:00
Happy-melon
cc311fa7dd Type hinting 2011-10-17 15:56:25 +00:00
Niklas Laxström
64c31d8f16 Small cleanups to XmlSelect 2011-10-08 11:41:10 +00:00
Sam Reed
e159eb114e Fix fail from r94473
Append to the string, don't replace it
2011-08-14 19:50:08 +00:00
Sam Reed
8a42c19f41 Made Xml::buildTable() wrap header stuff in <thead></thead> 2011-08-14 19:47:44 +00:00
Siebrand Mazeland
5dcc810e2b Update whitespace, braces. 2011-08-02 13:56:07 +00:00
Platonides
6860753996 Follow up r91072. This is indeed not needed. 2011-06-29 22:37:11 +00:00
Platonides
eadb8a3e73 Delay expansion of XmlSelect options until getting the HTML.
Setting the default after adding options now works.
Enabled testSetDefaultAfterAddingOptions().
2011-06-29 14:15:47 +00:00
Antoine Musso
5418ac98d2 Find 'all' special ns regardless of its rank in the select
This is done by looking for an <option> element with an empty string value
which denote the special case 'all'.
Also removed a comment in Xml.php asking to keep 'all' as a first element
since it is no longer needed.

Follow up r90943 (comment 18872 by Brion)
2011-06-28 19:32:25 +00:00
Antoine Musso
d4abcb5268 Disable ns selector checkboxes when 'all' namespace is selected
* based on an idea by Aaron on r90866
* comes with QUnit test
* expect the special 'all' namespace to be the first in the list
* function build on mediawiki.special form r90941
2011-06-28 06:40:49 +00:00
Antoine Musso
d86a3bc217 Xml::label now apply the 'title' attribute when provided 2011-06-23 19:57:52 +00:00
Sam Reed
8bfd19b451 Swap else if for elseif
Trimming trailing whitespace also

Doing in 3 commits (3/3), so hopefully reviewable in CR...
2011-06-17 16:05:35 +00:00