* Add PHP type hints where possible.
* Remove @var, @param and @return if redundant to type declaration
* Remove redundant type conversions which are now enforced by type
hints.
* Enforce that decodeBoolean returns only a bool.
Change-Id: I8da84ed4dc778dd9d84f8d9eec0a399f5ed26405
With this change the following URLs select the target Category:Foo_Bar:
* Special:CategoryTree/Category:Foo_bar
* Special:CategoryTree/Foo_bar
in the UI selector for the category.
Bug: T290070
Change-Id: I169c7c50adb5f6b279c34e44e7fdcf5b1b26c882
* Mark $mOptions as private. There is no external reference.
* CategoryTree::makeTitle don't return false. A check for false is not
needed.
* A class attribute should not start with a space.
* $title->isExternal() is equivalent to $title->getInterwiki() !== ''.
* Use $title->inNamespace( NS_CATEGORY ) instead of
$title->getNamespace() === NS_CATEGORY.
Change-Id: Iddad84ff5a18080d1216346ec2a906c955a644a4
Thanks to comments on Iaec81a2f, I realized the function of removed code.
Use the native setTitle() method to strip subpage name.
Change-Id: I4b1f48e0b705fb4aa7262454614d90dc1653a4fe
* Use ' instead of ".
* Use === instead of ==.
* Use !== instead of !=.
* Use explicit type cast.
* Combine array assignment.
* Use null coalescing operator.
Change-Id: Ic2fe4f62556df77262915b5bcbe1b11a1d907e6d
This change outputs the not found category as plain text and prevents
parser processing of the category name like '''bold''' or ''italic''.
This affects the root category of the category tree in the sidebar
like on
$wgCategoryTreeSidebarRoot = "Lista d''e Paise d''o munno"
for a situation without parser and
{{#categorytree:Lista d''e Paise d''o munno}}
or
<categorytree>Lista d''e Paise d''o munno</categorytree>
in the content for situations with parser.
A separation for with and without parser is not needed anymore.
Problem described in T18744 which was the reason for change r49471
(9700e2d5) is not reproducible.
This change also prevents that the value in the parameter `target` on
Special:CategoryTree gets interpreted as wikitext and outputs the value
with an output encoding.
Special:CategoryTree?target=B%27%27%27o%27%27%27ld%20un%3Cu%20onclick%3d%22alert(%27XSS%27)%22%3Eder%3C/u%3Eline
was rendered as
B<b>o</b>ld un<u>der</u>line
and is now rendered as
B'''o'''ld un<u onclick="alert('XSS')">der</u>line
The parser prevented already JavaScript injection, so there was no
security issue.
Change-Id: I592b23ba965c15b81a2f97686161a4d590331c87
This feature was lost in c839756b.
Before c839756b on Special:CategoryTree the mode was transfered via the
individual global JavaScript variable wgCategoryTreePageCategoryOptions.
c839756b removed the possibility to set the global JavaScript variable
to a page individual value.
Now Special:CategoryTree uses the HTML attribute to transfer the
individual options to JavaScript like at a <categorytree> tag.
Bug: T289997
Change-Id: I706c0ca89d84e3583eeee27a411f734c6969a8b7
trim() would always return a string, even with null as input
Keep the strval to make visible that this gets unsafe input
Change-Id: I6ff0ce307f6a8ac21669d6db693e5ff27767a55d
The CategoryTree::setHeaders() method adds modules to OutputPage.
It does not matter if setHeaders() gets called several times.
The previous code tried to avoid to call setHeaders() several times.
If wgCategoryTreeForceHeaders is set then the modules get loaded by the
hooks "BeforePageDisplay" or "BeforePageDisplayMobile" on every page.
In this case duplicate calls of setHeaders() are (partly) avoided by
not calling setHeaders() on other hooks.
This change removes this micro optimization and loads the modules
unconditionally if a category tree is added on a hook.
shouldForceHeaders() is now inlined.
Change-Id: Ic9219575a714886b4edd446efde2a330dff4dee6
* Add @inheritDoc to functions that are inheritance.
* Move comments to a single line.
Remove the phpcs rule exceptions:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment
Change-Id: I742ee19f0a3d2d62e08b6f2e35cd9a6b3940cd22
Register all hooks unconditionally in extension.json, and then in the
hook
itself, check whether they should be doing anything.
Change-Id: I5f0019fc444371a24a11a25ca2d980c0a9ab5a61
The following sniffs now pass and were enabled:
* MediaWiki.Commenting.LicenseComment.InvalidLicenseTag
Change-Id: I13c4825186d8ba101feb2a2d28ee8dc9bc7306dd