2016-02-05 05:31:34 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2018-04-16 06:50:28 +00:00
|
|
|
* © 2006-2008 Daniel Kinzler and others
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
2016-02-05 05:31:34 +00:00
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @ingroup Extensions
|
|
|
|
* @author Daniel Kinzler, brightbyte.de
|
|
|
|
*/
|
|
|
|
|
2021-04-07 22:35:52 +00:00
|
|
|
namespace MediaWiki\Extension\CategoryTree;
|
|
|
|
|
2023-10-03 09:30:38 +00:00
|
|
|
use MediaWiki\Config\Config;
|
2024-05-22 20:09:02 +00:00
|
|
|
use MediaWiki\Context\RequestContext;
|
2023-02-28 21:27:13 +00:00
|
|
|
use MediaWiki\Hook\CategoryViewer__doCategoryQueryHook;
|
|
|
|
use MediaWiki\Hook\CategoryViewer__generateLinkHook;
|
2021-05-22 13:43:11 +00:00
|
|
|
use MediaWiki\Hook\ParserFirstCallInitHook;
|
|
|
|
use MediaWiki\Hook\SkinBuildSidebarHook;
|
|
|
|
use MediaWiki\Hook\SpecialTrackingCategories__generateCatLinkHook;
|
|
|
|
use MediaWiki\Hook\SpecialTrackingCategories__preprocessHook;
|
2023-10-03 09:30:38 +00:00
|
|
|
use MediaWiki\Html\Html;
|
2023-10-26 20:22:10 +00:00
|
|
|
use MediaWiki\Linker\LinkRenderer;
|
2023-01-12 23:26:06 +00:00
|
|
|
use MediaWiki\Linker\LinkTarget;
|
2024-08-09 15:32:12 +00:00
|
|
|
use MediaWiki\Output\Hook\OutputPageRenderCategoryLinkHook;
|
2023-10-03 09:30:38 +00:00
|
|
|
use MediaWiki\Output\OutputPage;
|
2024-08-09 15:32:12 +00:00
|
|
|
use MediaWiki\Page\ProperPageIdentity;
|
2024-05-22 20:09:02 +00:00
|
|
|
use MediaWiki\Parser\Parser;
|
2024-10-19 21:22:14 +00:00
|
|
|
use MediaWiki\Parser\PPFrame;
|
2023-10-03 09:30:38 +00:00
|
|
|
use MediaWiki\Parser\Sanitizer;
|
2023-10-05 09:51:58 +00:00
|
|
|
use MediaWiki\ResourceLoader as RL;
|
2023-10-03 09:30:38 +00:00
|
|
|
use MediaWiki\SpecialPage\SpecialPage;
|
2023-08-16 01:54:29 +00:00
|
|
|
use MediaWiki\Title\Title;
|
2024-08-09 15:32:12 +00:00
|
|
|
use MediaWiki\Title\TitleFormatter;
|
2021-04-07 22:35:52 +00:00
|
|
|
use Skin;
|
2023-11-01 14:11:34 +00:00
|
|
|
use Wikimedia\Rdbms\IConnectionProvider;
|
2023-02-28 21:27:13 +00:00
|
|
|
use Wikimedia\Rdbms\IResultWrapper;
|
2021-04-07 22:35:52 +00:00
|
|
|
|
2018-04-16 06:50:28 +00:00
|
|
|
/**
|
|
|
|
* Hooks for the CategoryTree extension, an AJAX based gadget
|
|
|
|
* to display the category structure of a wiki
|
2021-05-22 13:43:11 +00:00
|
|
|
*
|
|
|
|
* @phpcs:disable MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
|
2018-04-16 06:50:28 +00:00
|
|
|
*/
|
2021-05-22 13:43:11 +00:00
|
|
|
class Hooks implements
|
|
|
|
SpecialTrackingCategories__preprocessHook,
|
|
|
|
SpecialTrackingCategories__generateCatLinkHook,
|
|
|
|
SkinBuildSidebarHook,
|
|
|
|
ParserFirstCallInitHook,
|
2024-08-09 15:32:12 +00:00
|
|
|
OutputPageRenderCategoryLinkHook,
|
2023-02-28 21:27:13 +00:00
|
|
|
CategoryViewer__doCategoryQueryHook,
|
|
|
|
CategoryViewer__generateLinkHook
|
2021-05-22 13:43:11 +00:00
|
|
|
{
|
2024-08-17 21:49:42 +00:00
|
|
|
private CategoryCache $categoryCache;
|
|
|
|
private Config $config;
|
2023-11-01 14:11:34 +00:00
|
|
|
private IConnectionProvider $dbProvider;
|
2024-08-17 21:49:42 +00:00
|
|
|
private LinkRenderer $linkRenderer;
|
2024-08-09 15:32:12 +00:00
|
|
|
private TitleFormatter $titleFormatter;
|
2023-11-01 14:11:34 +00:00
|
|
|
|
2023-10-26 20:22:10 +00:00
|
|
|
public function __construct(
|
|
|
|
CategoryCache $categoryCache,
|
|
|
|
Config $config,
|
2023-11-01 14:11:34 +00:00
|
|
|
IConnectionProvider $dbProvider,
|
2024-08-09 15:32:12 +00:00
|
|
|
LinkRenderer $linkRenderer,
|
|
|
|
TitleFormatter $titleFormatter
|
2023-10-26 20:22:10 +00:00
|
|
|
) {
|
2023-01-12 23:26:06 +00:00
|
|
|
$this->categoryCache = $categoryCache;
|
2021-05-22 13:43:11 +00:00
|
|
|
$this->config = $config;
|
2023-11-01 14:11:34 +00:00
|
|
|
$this->dbProvider = $dbProvider;
|
2023-10-26 20:22:10 +00:00
|
|
|
$this->linkRenderer = $linkRenderer;
|
2024-08-09 15:32:12 +00:00
|
|
|
$this->titleFormatter = $titleFormatter;
|
2021-05-22 13:43:11 +00:00
|
|
|
}
|
|
|
|
|
2016-02-05 05:31:34 +00:00
|
|
|
/**
|
2017-10-11 18:25:13 +00:00
|
|
|
* @param Parser $parser
|
2016-02-05 05:31:34 +00:00
|
|
|
*/
|
2021-05-22 13:43:11 +00:00
|
|
|
public function onParserFirstCallInit( $parser ) {
|
|
|
|
if ( !$this->config->get( 'CategoryTreeAllowTag' ) ) {
|
2018-04-16 06:41:38 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-05-22 13:43:11 +00:00
|
|
|
$parser->setHook( 'categorytree', [ $this, 'parserHook' ] );
|
|
|
|
$parser->setFunctionHook( 'categorytree', [ $this, 'parserFunction' ] );
|
2016-02-05 05:31:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Entry point for the {{#categorytree}} tag parser function.
|
2021-04-07 22:35:52 +00:00
|
|
|
* This is a wrapper around Hooks::parserHook
|
2017-10-11 18:25:13 +00:00
|
|
|
* @param Parser $parser
|
2019-03-08 21:03:38 +00:00
|
|
|
* @param string ...$params
|
2016-02-05 05:31:34 +00:00
|
|
|
* @return array|string
|
|
|
|
*/
|
2021-05-22 13:43:11 +00:00
|
|
|
public function parserFunction( Parser $parser, ...$params ) {
|
2016-02-05 05:31:34 +00:00
|
|
|
// first user-supplied parameter must be category name
|
|
|
|
if ( !$params ) {
|
2019-02-05 14:57:56 +00:00
|
|
|
// no category specified, return nothing
|
|
|
|
return '';
|
2016-02-05 05:31:34 +00:00
|
|
|
}
|
|
|
|
$cat = array_shift( $params );
|
|
|
|
|
|
|
|
// build associative arguments from flat parameter list
|
2016-10-14 16:11:52 +00:00
|
|
|
$argv = [];
|
2016-02-05 05:31:34 +00:00
|
|
|
foreach ( $params as $p ) {
|
|
|
|
if ( preg_match( '/^\s*(\S.*?)\s*=\s*(.*?)\s*$/', $p, $m ) ) {
|
|
|
|
$k = $m[1];
|
2021-04-07 22:35:52 +00:00
|
|
|
// strip any quotes enclosing the value
|
2019-02-05 14:57:56 +00:00
|
|
|
$v = preg_replace( '/^"\s*(.*?)\s*"$/', '$1', $m[2] );
|
2016-02-05 05:31:34 +00:00
|
|
|
} else {
|
|
|
|
$k = trim( $p );
|
|
|
|
$v = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
$argv[$k] = $v;
|
|
|
|
}
|
|
|
|
|
2021-04-01 17:57:54 +00:00
|
|
|
if ( $parser->getOutputType() === Parser::OT_PREPROCESS ) {
|
2021-08-31 11:18:30 +00:00
|
|
|
return Html::rawElement( 'categorytree', $argv, $cat );
|
2021-04-01 17:57:54 +00:00
|
|
|
} else {
|
|
|
|
// now handle just like a <categorytree> tag
|
2021-05-22 13:43:11 +00:00
|
|
|
$html = $this->parserHook( $cat, $argv, $parser );
|
2021-04-01 17:57:54 +00:00
|
|
|
return [ $html, 'noparse' => true, 'isHTML' => true ];
|
|
|
|
}
|
2016-02-05 05:31:34 +00:00
|
|
|
}
|
|
|
|
|
2021-06-15 18:48:48 +00:00
|
|
|
/**
|
|
|
|
* Obtain a category sidebar link based on config
|
|
|
|
* @return bool|string of link
|
|
|
|
*/
|
|
|
|
private function getCategorySidebarBox() {
|
2021-11-01 20:16:57 +00:00
|
|
|
if ( !$this->config->get( 'CategoryTreeSidebarRoot' ) ) {
|
2021-06-15 18:48:48 +00:00
|
|
|
return false;
|
|
|
|
}
|
2021-11-01 20:16:57 +00:00
|
|
|
return $this->parserHook(
|
|
|
|
$this->config->get( 'CategoryTreeSidebarRoot' ),
|
|
|
|
$this->config->get( 'CategoryTreeSidebarOptions' )
|
|
|
|
);
|
2021-06-15 18:48:48 +00:00
|
|
|
}
|
|
|
|
|
2016-02-05 05:31:34 +00:00
|
|
|
/**
|
|
|
|
* Hook implementation for injecting a category tree into the sidebar.
|
2018-04-16 06:41:38 +00:00
|
|
|
* Only does anything if $wgCategoryTreeSidebarRoot is set to a category name.
|
2017-10-11 18:25:13 +00:00
|
|
|
* @param Skin $skin
|
2019-01-02 21:54:34 +00:00
|
|
|
* @param array &$sidebar
|
2016-02-05 05:31:34 +00:00
|
|
|
*/
|
2021-05-22 13:43:11 +00:00
|
|
|
public function onSkinBuildSidebar( $skin, &$sidebar ) {
|
2021-06-15 18:48:48 +00:00
|
|
|
$html = $this->getCategorySidebarBox();
|
2016-02-05 05:31:34 +00:00
|
|
|
if ( $html ) {
|
2021-06-15 18:48:48 +00:00
|
|
|
$sidebar['categorytree-portlet'] = [];
|
2019-01-02 22:24:24 +00:00
|
|
|
CategoryTree::setHeaders( $skin->getOutput() );
|
2016-02-05 05:31:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-15 18:48:48 +00:00
|
|
|
/**
|
|
|
|
* Hook implementation for injecting a category tree link into the sidebar.
|
|
|
|
* Only does anything if $wgCategoryTreeSidebarRoot is set to a category name.
|
|
|
|
* @param Skin $skin
|
|
|
|
* @param string $portlet
|
|
|
|
* @param string &$html
|
|
|
|
*/
|
|
|
|
public function onSkinAfterPortlet( $skin, $portlet, &$html ) {
|
|
|
|
if ( $portlet === 'categorytree-portlet' ) {
|
|
|
|
$box = $this->getCategorySidebarBox();
|
|
|
|
if ( $box ) {
|
|
|
|
$html .= $box;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-05 05:31:34 +00:00
|
|
|
/**
|
|
|
|
* Entry point for the <categorytree> tag parser hook.
|
|
|
|
* This loads CategoryTreeFunctions.php and calls CategoryTree::getTag()
|
2024-11-02 09:49:14 +00:00
|
|
|
* @param string|null $cat
|
2017-10-11 18:25:13 +00:00
|
|
|
* @param array $argv
|
2018-05-26 01:01:12 +00:00
|
|
|
* @param Parser|null $parser
|
2020-05-29 17:05:25 +00:00
|
|
|
* @param PPFrame|null $frame
|
2016-02-05 05:31:34 +00:00
|
|
|
* @return bool|string
|
|
|
|
*/
|
2021-05-22 13:43:11 +00:00
|
|
|
public function parserHook(
|
2024-11-02 09:49:14 +00:00
|
|
|
?string $cat,
|
2018-12-16 09:47:07 +00:00
|
|
|
array $argv,
|
2024-10-26 12:43:17 +00:00
|
|
|
?Parser $parser = null,
|
|
|
|
?PPFrame $frame = null
|
2018-12-16 09:47:07 +00:00
|
|
|
) {
|
2016-02-05 05:31:34 +00:00
|
|
|
if ( $parser ) {
|
2021-09-01 19:19:09 +00:00
|
|
|
$parserOutput = $parser->getOutput();
|
|
|
|
$parserOutput->addModuleStyles( [ 'ext.categoryTree.styles' ] );
|
|
|
|
$parserOutput->addModules( [ 'ext.categoryTree' ] );
|
2024-08-30 16:17:38 +00:00
|
|
|
|
|
|
|
$disableCache = $this->config->get( 'CategoryTreeDisableCache' );
|
|
|
|
if ( $disableCache === true ) {
|
|
|
|
$parserOutput->updateCacheExpiry( 0 );
|
|
|
|
} elseif ( is_int( $disableCache ) ) {
|
|
|
|
$parserOutput->updateCacheExpiry( $disableCache );
|
|
|
|
}
|
2016-02-05 05:31:34 +00:00
|
|
|
}
|
|
|
|
|
2023-11-01 14:11:34 +00:00
|
|
|
$ct = new CategoryTree( $argv, $this->config, $this->dbProvider, $this->linkRenderer );
|
2016-02-05 05:31:34 +00:00
|
|
|
|
|
|
|
$attr = Sanitizer::validateTagAttributes( $argv, 'div' );
|
|
|
|
|
2017-05-30 18:21:54 +00:00
|
|
|
$hideroot = isset( $argv['hideroot'] )
|
2024-08-17 21:49:42 +00:00
|
|
|
? OptionManager::decodeBoolean( $argv['hideroot'] ) : false;
|
2017-05-30 18:21:54 +00:00
|
|
|
$onlyroot = isset( $argv['onlyroot'] )
|
2024-08-17 21:49:42 +00:00
|
|
|
? OptionManager::decodeBoolean( $argv['onlyroot'] ) : false;
|
|
|
|
$depthArg = isset( $argv['depth'] ) ? (int)$argv['depth'] : 1;
|
2016-02-05 05:31:34 +00:00
|
|
|
|
2023-10-28 19:40:51 +00:00
|
|
|
$depth = $ct->optionManager->capDepth( $depthArg );
|
2016-02-05 05:31:34 +00:00
|
|
|
if ( $onlyroot ) {
|
|
|
|
$depth = 0;
|
2021-08-31 09:18:25 +00:00
|
|
|
$message = '<span class="error">'
|
|
|
|
. wfMessage( 'categorytree-onlyroot-message' )->inContentLanguage()->parse()
|
|
|
|
. '</span>';
|
|
|
|
if ( $parser ) {
|
|
|
|
$parser->getOutput()->addWarningMsg( 'categorytree-deprecation-warning' );
|
|
|
|
$parser->addTrackingCategory( 'categorytree-deprecation-category' );
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$message = '';
|
2016-02-05 05:31:34 +00:00
|
|
|
}
|
|
|
|
|
2021-08-31 09:18:25 +00:00
|
|
|
return $message .
|
2024-11-01 11:31:12 +00:00
|
|
|
$ct->getTag( $cat ?? '', $hideroot, $attr, $depth );
|
2016-02-05 05:31:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-08-09 15:32:12 +00:00
|
|
|
* OutputPageRenderCategoryLink hook
|
2021-04-07 22:35:52 +00:00
|
|
|
* @param OutputPage $out
|
2024-08-09 15:32:12 +00:00
|
|
|
* @param ProperPageIdentity $categoryTitle
|
|
|
|
* @param string $text
|
|
|
|
* @param ?string &$link
|
|
|
|
* @return void
|
2016-02-05 05:31:34 +00:00
|
|
|
*/
|
2024-08-09 15:32:12 +00:00
|
|
|
public function onOutputPageRenderCategoryLink(
|
|
|
|
OutputPage $out,
|
|
|
|
ProperPageIdentity $categoryTitle,
|
|
|
|
string $text,
|
|
|
|
?string &$link
|
|
|
|
): void {
|
2021-11-01 20:16:57 +00:00
|
|
|
if ( !$this->config->get( 'CategoryTreeHijackPageCategories' ) ) {
|
2018-04-16 06:41:38 +00:00
|
|
|
// Not enabled, don't do anything
|
2024-08-09 15:32:12 +00:00
|
|
|
return;
|
2018-04-16 06:41:38 +00:00
|
|
|
}
|
2024-08-29 10:57:07 +00:00
|
|
|
if ( !$categoryTitle->exists() ) {
|
|
|
|
// Category doesn't exist. Let the normal LinkRenderer generate the link.
|
|
|
|
return;
|
|
|
|
}
|
2016-02-05 05:31:34 +00:00
|
|
|
|
2021-04-07 22:34:03 +00:00
|
|
|
CategoryTree::setHeaders( $out );
|
2016-02-05 05:31:34 +00:00
|
|
|
|
2024-08-09 15:32:12 +00:00
|
|
|
$options = $this->config->get( 'CategoryTreePageCategoryOptions' );
|
|
|
|
$link = $this->parserHook(
|
|
|
|
$this->titleFormatter->getPrefixedText( $categoryTitle ),
|
2024-08-29 10:57:07 +00:00
|
|
|
$options
|
2024-08-09 15:32:12 +00:00
|
|
|
);
|
2016-02-05 05:31:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-04-04 19:45:27 +00:00
|
|
|
* Get exported data for the "ext.categoryTree" ResourceLoader module.
|
|
|
|
*
|
|
|
|
* @internal For use in extension.json only.
|
2023-10-05 09:51:58 +00:00
|
|
|
* @param RL\Context $context
|
|
|
|
* @param Config $config
|
2019-04-04 19:45:27 +00:00
|
|
|
* @return array Data to be serialised as data.json
|
2016-02-05 05:31:34 +00:00
|
|
|
*/
|
2023-10-05 09:51:58 +00:00
|
|
|
public static function getDataForJs( RL\Context $context, Config $config ) {
|
2019-04-04 19:45:27 +00:00
|
|
|
// Look, this is pretty bad but CategoryTree is just whacky, it needs to be rewritten
|
2023-10-28 19:40:51 +00:00
|
|
|
$optionManager = new OptionManager( $config->get( 'CategoryTreeCategoryPageOptions' ), $config );
|
2019-04-04 19:45:27 +00:00
|
|
|
|
|
|
|
return [
|
2023-10-28 18:11:36 +00:00
|
|
|
'defaultCtOptions' => $optionManager->getOptionsAsJsStructure(),
|
2019-04-04 19:45:27 +00:00
|
|
|
];
|
2016-02-05 05:31:34 +00:00
|
|
|
}
|
2016-11-13 14:57:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Hook handler for the SpecialTrackingCategories::preprocess hook
|
|
|
|
* @param SpecialPage $specialPage SpecialTrackingCategories object
|
2023-01-12 23:26:06 +00:00
|
|
|
* @param array $trackingCategories [ 'msg' => LinkTarget, 'cats' => LinkTarget[] ]
|
|
|
|
* @phan-param array<string,array{msg:LinkTarget,cats:LinkTarget[]}> $trackingCategories
|
2016-11-13 14:57:16 +00:00
|
|
|
*/
|
2021-05-22 13:43:11 +00:00
|
|
|
public function onSpecialTrackingCategories__preprocess(
|
|
|
|
$specialPage,
|
|
|
|
$trackingCategories
|
2016-11-13 14:57:16 +00:00
|
|
|
) {
|
2023-01-12 23:26:06 +00:00
|
|
|
$categoryTargets = [];
|
|
|
|
foreach ( $trackingCategories as $data ) {
|
2016-11-13 14:57:16 +00:00
|
|
|
foreach ( $data['cats'] as $catTitle ) {
|
2023-01-12 23:26:06 +00:00
|
|
|
$categoryTargets[] = $catTitle;
|
2016-11-13 14:57:16 +00:00
|
|
|
}
|
|
|
|
}
|
2023-01-12 23:26:06 +00:00
|
|
|
$this->categoryCache->doQuery( $categoryTargets );
|
2016-11-13 14:57:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hook handler for the SpecialTrackingCategories::generateCatLink hook
|
|
|
|
* @param SpecialPage $specialPage SpecialTrackingCategories object
|
2023-01-12 23:26:06 +00:00
|
|
|
* @param LinkTarget $catTitle LinkTarget object of the linked category
|
2016-11-13 14:57:16 +00:00
|
|
|
* @param string &$html Result html
|
|
|
|
*/
|
2021-05-22 13:43:11 +00:00
|
|
|
public function onSpecialTrackingCategories__generateCatLink( $specialPage,
|
|
|
|
$catTitle, &$html
|
2016-11-13 14:57:16 +00:00
|
|
|
) {
|
2023-01-12 23:26:06 +00:00
|
|
|
$cat = $this->categoryCache->getCategory( $catTitle );
|
2016-11-13 14:57:16 +00:00
|
|
|
|
|
|
|
$html .= CategoryTree::createCountString( $specialPage->getContext(), $cat, 0 );
|
|
|
|
}
|
2023-02-28 21:27:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $type
|
|
|
|
* @param IResultWrapper $res
|
|
|
|
*/
|
|
|
|
public function onCategoryViewer__doCategoryQuery( $type, $res ) {
|
|
|
|
if ( $type === 'subcat' && $res ) {
|
|
|
|
$this->categoryCache->fillFromQuery( $res );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $type
|
|
|
|
* @param Title $title
|
|
|
|
* @param string $html
|
|
|
|
* @param string &$link
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function onCategoryViewer__generateLink( $type, $title, $html, &$link ) {
|
|
|
|
if ( $type !== 'subcat' || $link !== null ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
$request = RequestContext::getMain()->getRequest();
|
|
|
|
if ( $request->getCheck( 'notree' ) ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
$options = $this->config->get( 'CategoryTreeCategoryPageOptions' );
|
|
|
|
$mode = $request->getRawVal( 'mode' );
|
|
|
|
if ( $mode !== null ) {
|
|
|
|
$options['mode'] = $mode;
|
|
|
|
}
|
2023-11-01 14:11:34 +00:00
|
|
|
$tree = new CategoryTree( $options, $this->config, $this->dbProvider, $this->linkRenderer );
|
2023-02-28 21:27:13 +00:00
|
|
|
|
|
|
|
$cat = $this->categoryCache->getCategory( $title );
|
|
|
|
|
|
|
|
$link = $tree->renderNodeInfo( $title, $cat );
|
2024-04-08 18:41:02 +00:00
|
|
|
|
|
|
|
CategoryTree::setHeaders( RequestContext::getMain()->getOutput() );
|
2023-02-28 21:27:13 +00:00
|
|
|
return false;
|
|
|
|
}
|
2016-02-05 05:31:34 +00:00
|
|
|
}
|