32 global $wgCategoryTreeSidebarRoot, $wgCategoryTreeHijackPageCategories,
33 $wgCategoryTreeForceHeaders;
34 return $wgCategoryTreeForceHeaders || $wgCategoryTreeSidebarRoot
35 || $wgCategoryTreeHijackPageCategories;
44 global $wgCategoryTreeDefaultOptions, $wgCategoryTreeDefaultMode;
45 global $wgCategoryTreeCategoryPageOptions, $wgCategoryTreeCategoryPageMode;
46 global $wgCategoryTreeOmitNamespace;
48 if ( !isset( $wgCategoryTreeDefaultOptions[
'mode'] )
49 || is_null( $wgCategoryTreeDefaultOptions[
'mode'] )
51 $wgCategoryTreeDefaultOptions[
'mode'] = $wgCategoryTreeDefaultMode;
54 if ( !isset( $wgCategoryTreeDefaultOptions[
'hideprefix'] )
55 || is_null( $wgCategoryTreeDefaultOptions[
'hideprefix'] )
57 $wgCategoryTreeDefaultOptions[
'hideprefix'] = $wgCategoryTreeOmitNamespace;
60 if ( !isset( $wgCategoryTreeCategoryPageOptions[
'mode'] )
61 || is_null( $wgCategoryTreeCategoryPageOptions[
'mode'] )
64 $wgCategoryTreeCategoryPageOptions[
'mode'] = ( $mode )
73 global $wgCategoryTreeAllowTag;
74 if ( !$wgCategoryTreeAllowTag ) {
77 $parser->setHook(
'categorytree',
'CategoryTreeHooks::parserHook' );
78 $parser->setFunctionHook(
'categorytree',
'CategoryTreeHooks::parserFunction' );
100 if ( preg_match(
'/^\s*(\S.*?)\s*=\s*(.*?)\s*$/', $p, $m ) ) {
102 $v = preg_replace(
'/^"\s*(.*?)\s*"$/',
'$1', $m[2] );
113 return [
$html,
'noparse' =>
true,
'isHTML' =>
true ];
123 global $wgCategoryTreeSidebarRoot, $wgCategoryTreeSidebarOptions;
125 if ( !$wgCategoryTreeSidebarRoot ) {
131 $tpl->data[
'sidebar'][
'categorytree-portlet'] =
$html;
155 $attr = Sanitizer::validateTagAttributes( $argv,
'div' );
157 $hideroot = isset( $argv[
'hideroot'] )
159 $onlyroot = isset( $argv[
'onlyroot'] )
161 $depthArg = isset( $argv[
'depth'] ) ? (int)$argv[
'depth'] :
null;
168 return $ct->getTag(
$parser, $cat, $hideroot, $attr, $depth, $allowMissing );
179 if ( self::shouldForceHeaders() ) {
183 if ( !empty( $parserOutput->mCategoryTreeTag ) ) {
195 if ( !self::shouldForceHeaders() ) {
223 global $wgCategoryTreePageCategoryOptions, $wgCategoryTreeHijackPageCategories;
225 if ( !$wgCategoryTreeHijackPageCategories ) {
230 foreach ( $categories as $category =>
$type ) {
244 global $wgCategoryTreeHijackPageCategories;
245 if ( !$wgCategoryTreeHijackPageCategories ) {
249 $embed =
'<div class="CategoryTreeCategoryBarItem">';
253 $result = $embed . implode(
"{$pop} {$sep} {$embed}", $links ) . $pop;
263 global $wgCategoryTreeCategoryPageOptions;
266 $ct =
new CategoryTree( $wgCategoryTreeCategoryPageOptions );
267 $vars[
'wgCategoryTreePageCategoryOptions'] = $ct->getOptionsAsJsStructure();
277 $specialPage, $trackingCategories
279 $categoryDbKeys = [];
280 foreach ( $trackingCategories as $catMsg => $data ) {
281 foreach ( $data[
'cats'] as $catTitle ) {
282 $categoryDbKeys[] = $catTitle->getDbKey();
286 if ( $categoryDbKeys ) {
290 [
'cat_id',
'cat_title',
'cat_pages',
'cat_subcats',
'cat_files' ],
291 [
'cat_title' => array_unique( $categoryDbKeys ) ],
294 foreach (
$res as $row ) {
295 $categories[$row->cat_title] = Category::newFromRow( $row );
298 $specialPage->categoryTreeCategories = $categories;
308 $specialPage, $catTitle, &
$html
310 if ( !isset( $specialPage->categoryTreeCategories ) ) {
315 if ( isset( $specialPage->categoryTreeCategories[$catTitle->getDbKey()] ) ) {
316 $cat = $specialPage->categoryTreeCategories[$catTitle->getDbKey()];
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
if(! $wgDBerrorLogTZ) $wgRequest
Hooks for the CategoryTree extension, an AJAX based gadget to display the category structure of a wik...
static parserOutput( $outputPage, $parserOutput)
Hook callback that injects messages and things into the <head> tag, if needed in the current page.
static getConfigVars(&$vars)
static onSpecialTrackingCategoriesGenerateCatLink( $specialPage, $catTitle, &$html)
Hook handler for the SpecialTrackingCategories::generateCatLink hook.
static setHooks( $parser)
static outputPageMakeCategoryLinks(&$out, $categories, &$links)
OutputPageMakeCategoryLinks hook, override category links.
static initialize()
Adjusts config once MediaWiki is fully initialised TODO: Don't do this, lazy initialize the config.
static parserFunction( $parser)
Entry point for the {{#categorytree}} tag parser function.
static addHeaders(OutputPage $out)
BeforePageDisplay and BeforePageDisplayMobile hooks.
static articleFromTitle( $title, &$article)
ArticleFromTitle hook, override category page handling.
static skinJoinCategoryLinks( $skin, &$links, &$result)
static parserHook( $cat, $argv, $parser=null, $allowMissing=false)
Entry point for the <categorytree> tag parser hook.
static skinTemplateOutputPageBeforeExec( $skin, $tpl)
Hook implementation for injecting a category tree into the sidebar.
static onSpecialTrackingCategoriesPreprocess( $specialPage, $trackingCategories)
Hook handler for the SpecialTrackingCategories::preprocess hook.
static shouldForceHeaders()
Core functions for the CategoryTree extension, an AJAX based gadget to display the category structure...
static decodeBoolean( $value)
Helper function to convert a string to a boolean value.
static decodeMode( $mode)
static capDepth( $mode, $depth)
Internal function to cap depth.
static setHeaders( $outputPage)
Add ResourceLoader modules to the OutputPage object.
static createCountString(IContextSource $context, $cat, $countMode)
Create a string which format the page, subcat and file counts of a category.
This class should be covered by a general architecture document which does not exist as of January 20...
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
see documentation in includes Linker php for Linker::makeImageLink or false for current used if you return false $parser
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html