Commit graph

21 commits

Author SHA1 Message Date
Kunal Mehta 1e6ff5c2fc Address PhanUndeclaredClassMethod warning
Don't use the \Database alias, use the namespaced version when calling
Database::getCacheSetOptions.

And document why the remaining issue is suppressed.

Change-Id: I80a102f2e82efedcfa999d8e714bfe049263ffeb
2018-01-03 16:34:01 +00:00
libraryupgrader 1ca3dd57be build: Updating mediawiki/mediawiki-codesniffer to 15.0.0
Change-Id: I11e6d584932dbde52fc5e5d463029270976a47df
2017-12-29 23:28:16 +00:00
Thiemo Mättig 9c8ed18938 Remove some obscure comments
A good bunch of these comments literally repeats what the code already
says.

Change-Id: I9c128f748971bf20a61a85ed57d3261d27c465f0
2017-12-29 12:21:53 -08:00
Phantom42 67ed343ecc Add phan configuration for static analysis
Bug: T179554
Change-Id: I2bfd52c08aac1aa8f34e0664e6314835f79a0324
2017-12-29 11:50:01 -08:00
Umherirrender 817c8a95bd Change typehint from DatabaseBase to IDatabase
Change-Id: I34bde9717d7799406dd9a30e8f9b610da53f374c
2017-12-22 21:28:29 +01:00
Max Semenik 351a08d1b7 Don't break when reference names contain []
Bug: T29694
Bug: T179544
Depends-On: I189bdefbc9034cf8d221a89d7158195de1c0fa6c
Change-Id: Iec3439f76ecc2a3543b30b35f8735c92b0cfb711
2017-11-15 23:23:45 +00:00
Alexander Mashin 3023f55605 T177134: Nulls passed to preg_match in Cite
Line 334 of Cite/includes/Cite.php contains two preg_match () calls. The subject lines for them are produced by Cite::refArgs () and are set to null or false when no name or follow attribute is provided in the <ref></ref> tag.

However, preg_match () is supposed to accept only strings as its subject, and the nowhere in the documentation it is said that it is nullable.

At least, in HHVM 3.12 this causes an exception.

The enclosed patch adds simple checks making sure that preg_match () is not called when $key or $follow are null or false.

Change-Id: I3e00d31d6bf216271ace7e851d88c68c4fd5ed00
2017-10-11 17:01:37 +00:00
Umherirrender 0802a73cae Improve some parameter docs
Change-Id: I7d50eaabfba309a62d1dbd16ded0cbcab3beb82f
2017-10-06 21:22:30 +02:00
C. Scott Ananian 14459c226b Use HTML5 id attributes; remove use of deprecated Sanitizer::escapeId()
When using HTML5 ids, we need to take greater care to properly escape the
id (or derived strings) before passing them back through
Parser::recursiveTagParse().

Bug: T176170
Change-Id: I89a4f8ba24b867f2d5ccdc2bf9a4312ab9b385a9
2017-09-19 15:42:41 -04:00
Max Semenik 14b17e8c32 DB_SLAVE -> DB_REPLICA
Change-Id: I3e949fcf15b44ee199830df19f6db039a704b450
2017-09-01 17:06:45 -07:00
Kunal Mehta b46b060f2f build: Updating mediawiki/mediawiki-codesniffer to 0.10.1
Change-Id: Icc6b4568557583a62a630bd1d5a889fc3cad77bc
2017-07-23 00:10:18 -07:00
Kunal Mehta 635ee1cce0 build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.Commenting.FunctionComment.WrongStyle
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Change-Id: I5a7f01d6d5d8b56583940524b251d4de1ca09f5e
2017-06-19 19:32:30 -07:00
James D. Forrester efce5f2b49 Drop the pointless "AllowCiteGroups" config setting
Bug: T161144
Change-Id: Ie1454926b8bfa108a62d088991e66b6dae9c9f10
2017-04-20 22:56:08 +00:00
James D. Forrester ddb3e9088a i18n: Don't try to spell out all the options that are allowed
Bug: T160628
Change-Id: Ibf728277c5bd4df5d3e8534848ee686239090376
2017-04-08 04:10:29 +00:00
Timo Tijhof 04c3ad0107 Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.

That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.

The template currently sets an exact column count (via the CSS3
property `column-count`).

This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.

The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.

It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.

Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.

To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.

Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.

If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.

In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.

* Deprecate cite_references_prefix/cite_references_suffix.

  This message is rarely used and opens up compatibility hazards.
  It was already removed by Parsoid, but the PHP implementation
  still had it. It's typically used to add inline styles to the
  wrapper which is more appropiately done in Common.css (or
  obsoleted as part of the skin or Cite extenion itself nowadays
  depending on what style in question).

  It was also a HTML-style message with separated open and close
  segments, which is an anti-pattern in itself.

* Declare module target explicitly and include mobile. The absence of
  this stylesheet caused subtle BiDi/RTL bugs on mobile.

Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2017-03-07 22:42:47 +00:00
Fomafix b63685468b Update PHP syntax from array(...) to [...] in comment
In 4bbd2277 only the syntax in the code is updated.

Change-Id: Ib69c913cacef0c90c4766ddbefd0a0b1b38972ee
2017-01-07 10:08:35 +01:00
Thiemo Mättig d6b1bdeff5 Make properties/methods in Cite private
Change-Id: I4be69a09125a898f7367fa08aa0c7f1a95324b3b
2016-12-15 13:01:03 +00:00
addshore 160d22bb1b Convert bugzilla number to phab link
Change-Id: I6319c49a0049352c959a0a437ef0901227e8988a
2016-09-29 15:19:16 +01:00
addshore 5f62cd5df6 Stop using deprecated wfProfile methods
Change-Id: Ibf0d4a68e09f2680284163252ea0d1ae28de2c00
2016-09-20 15:45:40 +01:00
addshore 30ce07ec0d Add access modifiers to Cite.php (body)
Change-Id: Ib1b4d1942237e8528e9b1fccb8e1524291fd57b2
2016-09-20 15:43:58 +01:00
addshore c1de73eb32 Move php files in includes directory
Change-Id: Ic6afacbf2a944954826c9d68dd292c28f1c731da
2016-09-20 15:33:10 +01:00
Renamed from Cite_body.php (Browse further)