Replace the dynamic property on SpecialTrackingCategories object,
this was used to store preloaded Category objects.
Dynamic properties are deprecated in php8.2
The preload and storage is now done with the service.
Adjust doc to LinkTarget (Id0cc2ca)
Bug: T324897
Change-Id: I891ad79bc357d32585ef4d9206d398c5a75222aa
(cherry picked from commit 9d98cc1ae6)
Thanks to comments on Iaec81a2f, I realized the function of removed code.
Use the native setTitle() method to strip subpage name.
Change-Id: I4b1f48e0b705fb4aa7262454614d90dc1653a4fe
Core now provides all-member count separately with type guarantee.
Also bump core requirement to >= 1.38.0
Change-Id: I2b489e690ad05462a553e424bd9495593a8d2b1b
* 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 configuration variable "CategoryTreeForceHeaders" allowed to force
the loading of the modules on every page by the hooks
"BeforePageDisplay" and "BeforePageDisplayMobile".
This is not needed anymore because the modules are now already loaded
if the category tree is used some on the other hooks.
Change-Id: I9fde894977463ecd1c4b07da449d98c39b3665ea
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
This allows better to style the buttons.
The complicated CSS selector for the direction supports a categorytree
in the user interface language like in the sidebar or on
Special:CategoryTree and in the content language like on category pages
and with <categorytree> in the content.
The CSS selector :dir( rtl ) would be a short version for this but it is
currently only supported by Firefox:
https://developer.mozilla.org/en-US/docs/Web/CSS/:dir
Bug: T288910
Change-Id: Ibfb0cb28f0086fb1b7d0997be2246bc120eea85e
The MediaWikiServices hook runs before the service container is fully initialized, so it cannot have services injected. For this reason, it needs to be separate from the handlers for other hooks.
Change-Id: I1519aea8bca2f3977fcf15ee8776a1b3319687b5
This converts the CategtoryTree extension to the new (MW1.35) hook system.
The patch was written live during a hackathon workshop.
A recording of the workshop is available at
<https://www.youtube.com/watch?v=ZOj44Rbh0tM&t>.
Re-applying after fixing: premature access to $wgRequest
Restores change: Ie52c393af378a980a2dac4ae7076fd6c016a8e0e
Reverts revert: Ieee300c7b35b7069bd7e781610c915f2ecae1bf1
NOTE: the "mode" parameter for category pages seems to be broken,
as the mode is not proeprly propoagated to dynamic requests.
This was already the case before this change, and this change
does not try to fix that issue. I was tempted to just remove
the feature entirely, but T137812 inidcates that it may be useful to
some. I will comment there to see if this should be fiexed or removed.
Bug: T282110
Bug: T271011
Change-Id: Ic3ee05e9dc382f4ada5cfeb9ff5d9a69249cc60d
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic
* MediaWiki.Usage.ExtendClassUsage.FunctionConfigUsage
Additional changes:
* Dropped .inc files from .phpcs.xml (T200956).
* Added the `wikimedia/mediawiki` profile in .eslintrc.json (T262222).
* Added the `wikimedia/jquery` profile in .eslintrc.json (T262222).
* Removed global `$`, included in the `wikimedia/jquery` profile (T262222).
* Removed global `mw`, included via `wikimedia/mediawiki` profile (T262222).
* Dropped the emtpy global definition in .eslintrc.json.
Change-Id: Ib5a3697712078a4ed22195c274eae9c82ddd7227
Special:CategoryTree shows wrong link to parent category that containing string that need percent-encoding.
Changed getPartialURL() to getDBkey() on CategoryTree.php. getPartialURL() returns a percent-encoded URL and getDBkey() returns no encoded URL.
Bug: T253621
Change-Id: Idffb8ffece88a1d726075ffee9d64e6e05ed4e52