MediaWiki  1.33.0
CategoryTreeHooks Class Reference

Hooks for the CategoryTree extension, an AJAX based gadget to display the category structure of a wiki. More...

Static Public Member Functions

static addHeaders (OutputPage $out)
 BeforePageDisplay and BeforePageDisplayMobile hooks. More...
 
static articleFromTitle (Title $title, Article &$article=null)
 ArticleFromTitle hook, override category page handling. More...
 
static getDataForJs ()
 Get exported data for the "ext.categoryTree" ResourceLoader module. More...
 
static initialize ()
 Adjusts config once MediaWiki is fully initialised TODO: Don't do this, lazy initialize the config. More...
 
static onSkinBuildSidebar (Skin $skin, array &$sidebar)
 Hook implementation for injecting a category tree into the sidebar. More...
 
static onSpecialTrackingCategoriesGenerateCatLink (SpecialPage $specialPage, Title $catTitle, &$html)
 Hook handler for the SpecialTrackingCategories::generateCatLink hook @suppress PhanUndeclaredProperty SpecialPage->categoryTreeCategories. More...
 
static onSpecialTrackingCategoriesPreprocess (SpecialPage $specialPage, array $trackingCategories)
 Hook handler for the SpecialTrackingCategories::preprocess hook @suppress PhanUndeclaredProperty SpecialPage->categoryTreeCategories. More...
 
static outputPageMakeCategoryLinks (OutputPage &$out, array $categories, array &$links)
 OutputPageMakeCategoryLinks hook, override category links. More...
 
static parserFunction (Parser $parser,... $params)
 Entry point for the {{#categorytree}} tag parser function. More...
 
static parserHook ( $cat, array $argv, Parser $parser=null, $allowMissing=false)
 Entry point for the <categorytree> tag parser hook. More...
 
static parserOutput (OutputPage $outputPage, ParserOutput $parserOutput)
 Hook callback that injects messages and things into the <head> tag, if needed in the current page. More...
 
static setHooks (Parser $parser)
 
static shouldForceHeaders ()
 

Detailed Description

Hooks for the CategoryTree extension, an AJAX based gadget to display the category structure of a wiki.

Definition at line 29 of file CategoryTreeHooks.php.

Member Function Documentation

◆ addHeaders()

static CategoryTreeHooks::addHeaders ( OutputPage  $out)
static

BeforePageDisplay and BeforePageDisplayMobile hooks.

These hooks are used when $wgCategoryTreeForceHeaders is set. Otherwise similar to CategoryTreeHooks::parserOutput.

Parameters
OutputPage$out

Definition at line 201 of file CategoryTreeHooks.php.

References $out, and CategoryTree\setHeaders().

◆ articleFromTitle()

static CategoryTreeHooks::articleFromTitle ( Title  $title,
Article $article = null 
)
static

ArticleFromTitle hook, override category page handling.

Parameters
Title$title
Article | null&$articleArticle (object) that will be returned

Definition at line 214 of file CategoryTreeHooks.php.

References $article, $title, and NS_CATEGORY.

◆ getDataForJs()

static CategoryTreeHooks::getDataForJs ( )
static

Get exported data for the "ext.categoryTree" ResourceLoader module.

Definition at line 253 of file CategoryTreeHooks.php.

◆ initialize()

static CategoryTreeHooks::initialize ( )
static

Adjusts config once MediaWiki is fully initialised TODO: Don't do this, lazy initialize the config.

Definition at line 44 of file CategoryTreeHooks.php.

References $wgRequest, and CategoryTree\decodeMode().

◆ onSkinBuildSidebar()

static CategoryTreeHooks::onSkinBuildSidebar ( Skin  $skin,
array $sidebar 
)
static

Hook implementation for injecting a category tree into the sidebar.

Only does anything if $wgCategoryTreeSidebarRoot is set to a category name.

Parameters
Skin$skin
array&$sidebar

Definition at line 124 of file CategoryTreeHooks.php.

References $html, $skin, parserHook(), and CategoryTree\setHeaders().

◆ onSpecialTrackingCategoriesGenerateCatLink()

static CategoryTreeHooks::onSpecialTrackingCategoriesGenerateCatLink ( SpecialPage  $specialPage,
Title  $catTitle,
$html 
)
static

Hook handler for the SpecialTrackingCategories::generateCatLink hook @suppress PhanUndeclaredProperty SpecialPage->categoryTreeCategories.

Parameters
SpecialPage$specialPageSpecialTrackingCategories object
Title$catTitleTitle object of the linked category
string&$htmlResult html

Definition at line 302 of file CategoryTreeHooks.php.

References $html, CategoryTree\createCountString(), and SpecialPage\getContext().

◆ onSpecialTrackingCategoriesPreprocess()

static CategoryTreeHooks::onSpecialTrackingCategoriesPreprocess ( SpecialPage  $specialPage,
array  $trackingCategories 
)
static

Hook handler for the SpecialTrackingCategories::preprocess hook @suppress PhanUndeclaredProperty SpecialPage->categoryTreeCategories.

Parameters
SpecialPage$specialPageSpecialTrackingCategories object
array$trackingCategories[ 'msg' => Title, 'cats' => Title[] ]

Definition at line 270 of file CategoryTreeHooks.php.

References $data, $dbr, $res, as, DB_REPLICA, Category\newFromRow(), and wfGetDB().

◆ outputPageMakeCategoryLinks()

static CategoryTreeHooks::outputPageMakeCategoryLinks ( OutputPage &  $out,
array  $categories,
array $links 
)
static

OutputPageMakeCategoryLinks hook, override category links.

Parameters
OutputPage&$out
array$categories
array&$links
Returns
bool

Definition at line 227 of file CategoryTreeHooks.php.

References $out, $type, as, parserHook(), and CategoryTree\setHeaders().

◆ parserFunction()

static CategoryTreeHooks::parserFunction ( Parser  $parser,
  $params 
)
static

Entry point for the {{#categorytree}} tag parser function.

This is a wrapper around CategoryTreeHooks::parserHook

Parameters
Parser$parser
string...$params
Returns
array|string

Definition at line 90 of file CategoryTreeHooks.php.

References $html, $params, $parser, as, parserHook(), and true.

◆ parserHook()

static CategoryTreeHooks::parserHook (   $cat,
array  $argv,
Parser  $parser = null,
  $allowMissing = false 
)
static

Entry point for the <categorytree> tag parser hook.

This loads CategoryTreeFunctions.php and calls CategoryTree::getTag() @suppress PhanUndeclaredProperty ParserOutput->mCategoryTreeTag

Parameters
string$cat
array$argv
Parser | null$parser
bool$allowMissing
Returns
bool|string

Definition at line 148 of file CategoryTreeHooks.php.

References $parser, CategoryTree\capDepth(), and CategoryTree\decodeBoolean().

Referenced by onSkinBuildSidebar(), outputPageMakeCategoryLinks(), and parserFunction().

◆ parserOutput()

static CategoryTreeHooks::parserOutput ( OutputPage  $outputPage,
ParserOutput  $parserOutput 
)
static

Hook callback that injects messages and things into the <head> tag, if needed in the current page.

Does nothing if $parserOutput->mCategoryTreeTag is not set @suppress PhanUndeclaredProperty ParserOutput->mCategoryTreeTag

Parameters
OutputPage$outputPage
ParserOutput$parserOutput

Definition at line 185 of file CategoryTreeHooks.php.

References CategoryTree\setHeaders().

◆ setHooks()

static CategoryTreeHooks::setHooks ( Parser  $parser)
static
Parameters
Parser$parser

Definition at line 74 of file CategoryTreeHooks.php.

References $parser.

◆ shouldForceHeaders()

static CategoryTreeHooks::shouldForceHeaders ( )
static

The documentation for this class was generated from the following file: