BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
CategoryTree.php File Reference

Functions

 efCategoryTree ()
 
 efCategoryTreeSetHooks ($parser)
 
 efCategoryTreeCapDepth ($mode, $depth)
 
 efCategoryTreeParserFunction ($parser)
 
 efCategoryTreeSkinTemplateOutputPageBeforeExec ($skin, $tpl)
 
 efCategoryTreeParserHook ($cat, $argv, $parser=null, $allowMissing=false)
 
 efCategoryTreeParserOutput ($outputPage, $parserOutput)
 
 efCategoryTreeAddHeaders (OutputPage $out, Skin $skin)
 
 efCategoryTreeArticleFromTitle ($title, &$article)
 
 efCategoryTreeOutputPageMakeCategoryLinks ($out, &$categories, &$links)
 
 efCategoryTreeSkinJoinCategoryLinks ($skin, &$links, &$result)
 
 efCategoryTreeGetConfigVars (&$vars)
 

Variables

const CT_MODE_CATEGORIES (!defined( 'MEDIAWIKI')) 0
 
const CT_MODE_PAGES 10
 
const CT_MODE_ALL 20
 
const CT_MODE_PARENTS 100
 
const CT_HIDEPREFIX_NEVER 0
 
const CT_HIDEPREFIX_ALWAYS 10
 
const CT_HIDEPREFIX_CATEGORIES 20
 
const CT_HIDEPREFIX_AUTO 30
 
 $wgConfigRegistry ['categorytree'] = 'GlobalVarConfig::newInstance'
 
 $wgCategoryTreeMaxChildren = 200
 
 $wgCategoryTreeAllowTag = true
 
 $wgCategoryTreeDisableCache = 6*60*60
 
 $wgCategoryTreeHTTPCache = false
 
 $wgCategoryTreeMaxDepth = array( CT_MODE_PAGES => 1, CT_MODE_ALL => 1, CT_MODE_CATEGORIES => 2 )
 
 $wgCategoryTreeForceHeaders = false
 
 $wgCategoryTreeSidebarRoot = null
 
 $wgCategoryTreeHijackPageCategories = false
 
 $wgCategoryTreeUseCategoryTable = true
 
 $wgCategoryTreeOmitNamespace = CT_HIDEPREFIX_CATEGORIES
 
 $wgCategoryTreeDefaultMode = CT_MODE_CATEGORIES
 
 $wgCategoryTreeDefaultOptions = array()
 
 $wgCategoryTreeDefaultOptions ['mode'] = null
 
 $wgCategoryTreeDefaultOptions ['hideprefix'] = null
 
 $wgCategoryTreeDefaultOptions ['showcount'] = false
 
 $wgCategoryTreeDefaultOptions ['namespaces'] = false
 
 $wgCategoryTreeCategoryPageMode = CT_MODE_CATEGORIES
 
 $wgCategoryTreeCategoryPageOptions = array()
 
 $wgCategoryTreeCategoryPageOptions ['mode'] = NULL
 
 $wgCategoryTreeCategoryPageOptions ['showcount'] = true
 
 $wgCategoryTreeSpecialPageOptions = array()
 
 $wgCategoryTreeSpecialPageOptions ['showcount'] = true
 
 $wgCategoryTreeSidebarOptions = array()
 
 $wgCategoryTreeSidebarOptions ['mode'] = CT_MODE_CATEGORIES
 
 $wgCategoryTreeSidebarOptions ['hideprefix'] = CT_HIDEPREFIX_CATEGORIES
 
 $wgCategoryTreeSidebarOptions ['showcount'] = false
 
 $wgCategoryTreeSidebarOptions ['hideroot'] = true
 
 $wgCategoryTreeSidebarOptions ['namespaces'] = false
 
 $wgCategoryTreeSidebarOptions ['depth'] = 1
 
 $wgCategoryTreePageCategoryOptions = array()
 
 $wgCategoryTreePageCategoryOptions ['mode'] = CT_MODE_PARENTS
 
 $wgCategoryTreePageCategoryOptions ['hideprefix'] = CT_HIDEPREFIX_CATEGORIES
 
 $wgCategoryTreePageCategoryOptions ['showcount'] = false
 
 $wgCategoryTreePageCategoryOptions ['hideroot'] = false
 
 $wgCategoryTreePageCategoryOptions ['namespaces'] = false
 
 $wgCategoryTreePageCategoryOptions ['depth'] = 0
 
 $wgExtensionMessagesFiles ['CategoryTreeAlias'] = __DIR__ . '/CategoryTree.alias.php'
 
 $wgExtensionFunctions [] = 'efCategoryTree'
 
 $wgExtensionCredits ['specialpage'][]
 
 $wgMessagesDirs ['CategoryTree'] = __DIR__ . '/i18n'
 
 $wgExtensionMessagesFiles ['CategoryTree'] = __DIR__ . '/CategoryTree.i18n.php'
 
 $wgExtensionMessagesFiles ['CategoryTreeMagic'] = __DIR__ . '/CategoryTree.i18n.magic.php'
 
 $wgAutoloadClasses ['CategoryTreePage'] = __DIR__ . '/CategoryTreePage.php'
 
 $wgAutoloadClasses ['CategoryTree'] = __DIR__ . '/CategoryTreeFunctions.php'
 
 $wgAutoloadClasses ['CategoryTreeCategoryPage'] = __DIR__ . '/CategoryPageSubclass.php'
 
 $wgAutoloadClasses ['CategoryTreeCategoryViewer'] = __DIR__ . '/CategoryPageSubclass.php'
 
 $wgAutoloadClasses ['ApiCategoryTree'] = __DIR__ . '/ApiCategoryTree.php'
 
 $wgSpecialPages ['CategoryTree'] = 'CategoryTreePage'
 
 $wgHooks ['ArticleFromTitle'][] = 'efCategoryTreeArticleFromTitle'
 
 $wgAPIModules ['categorytree'] = 'ApiCategoryTree'
 
 $commonModuleInfo
 
 $wgResourceModules ['ext.categoryTree']
 
 $wgResourceModules ['ext.categoryTree.css']
 

Detailed Description

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

Author
Daniel Kinzler, brightbyte.de

Function Documentation

efCategoryTree ( )

Hook it up

efCategoryTreeAddHeaders ( OutputPage  $out,
Skin  $skin 
)

BeforePageDisplay hook. This hook is set when $wgCategoryTreeForceHeaders is set. Otherwise similar to efCategoryTreeParserOutput.

Parameters
$outOutputPage
$skinSkin
Returns
bool
efCategoryTreeArticleFromTitle (   $title,
$article 
)

ArticleFromTitle hook, override category page handling

Parameters
$titleTitle
$articleArticle
Returns
bool
efCategoryTreeCapDepth (   $mode,
  $depth 
)

Internal function to cap depth

Parameters
$mode
$depth
Returns
int|mixed
efCategoryTreeGetConfigVars ( $vars)
Parameters
$vars
Returns
bool
efCategoryTreeOutputPageMakeCategoryLinks (   $out,
$categories,
$links 
)

OutputPageMakeCategoryLinks hook, override category links

Parameters
$out
$categories
$links
Returns
bool
efCategoryTreeParserFunction (   $parser)

Entry point for the {{#categorytree}} tag parser function. This is a wrapper around efCategoryTreeParserHook

Parameters
$parserParser
Returns
array|string
efCategoryTreeParserHook (   $cat,
  $argv,
  $parser = null,
  $allowMissing = false 
)

Entry point for the <categorytree> tag parser hook. This loads CategoryTreeFunctions.php and calls CategoryTree::getTag()

Parameters
$cat
$argv
$parserParser
$allowMissingbool
Returns
bool|string
efCategoryTreeParserOutput (   $outputPage,
  $parserOutput 
)

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

Parameters
$outputPageOutputPage
$parserOutputParserOutput
Returns
bool
efCategoryTreeSetHooks (   $parser)
Parameters
$parserParser
Returns
bool
efCategoryTreeSkinJoinCategoryLinks (   $skin,
$links,
$result 
)
Parameters
$skin
$links
$result
Returns
bool
efCategoryTreeSkinTemplateOutputPageBeforeExec (   $skin,
  $tpl 
)

Hook implementation for injecting a category tree into the sidebar. Registered automatically if $wgCategoryTreeSidebarRoot is set to a category name.

Parameters
$skin
$tplSkinTemplate
Returns
bool

Variable Documentation

$commonModuleInfo
Initial value:
= array(
'localBasePath' => __DIR__ . '/modules',
'remoteExtPath' => 'CategoryTree/modules',
)

Register ResourceLoader modules

$wgCategoryTreeMaxChildren = 200

Options:

$wgCategoryTreeMaxChildren - maximum number of children shown in a tree node. Default is 200 $wgCategoryTreeAllowTag - enable <categorytree> tag. Default is true. $wgCategoryTreeDisableCache - disable the parser cache for pages with a <categorytree> tag or provide max cache time in seconds. Default is 6 hours. $wgCategoryTreeUseCache - enable HTTP cache for anon users. Default is false. $wgCategoryTreeMaxDepth - maximum value for depth argument; An array that maps mode values to the maximum depth acceptable for the depth option. Per default, the "categories" mode has a max depth of 2, all other modes have a max depth of 1. $wgCategoryTreeDefaultOptions - default options for the <categorytree> tag. $wgCategoryTreeCategoryPageOptions - options to apply on category pages. $wgCategoryTreeSpecialPageOptions - options to apply on Special:CategoryTree.

$wgExtensionCredits['specialpage'][]
Initial value:
= $wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'CategoryTree',
'author' => 'Daniel Kinzler',
'url' => 'https://www.mediawiki.org/wiki/Extension:CategoryTree',
'descriptionmsg' => 'categorytree-desc',
'license-name' => 'GPL-2.0+',
)
$wgExtensionFunctions[] = 'efCategoryTree'

Register extension setup hook and credits

$wgMessagesDirs['CategoryTree'] = __DIR__ . '/i18n'

Register the special page

$wgResourceModules['ext.categoryTree']
Initial value:
= array(
'scripts' => 'ext.categoryTree.js',
'messages' => array(
'categorytree-collapse',
'categorytree-expand',
'categorytree-collapse-bullet',
'categorytree-expand-bullet',
'categorytree-load',
'categorytree-loading',
'categorytree-nothing-found',
'categorytree-no-subcategories',
'categorytree-no-parent-categories',
'categorytree-no-pages',
'categorytree-error',
'categorytree-retry',
),
$commonModuleInfo
Definition: CategoryTree.php:137
$wgResourceModules['ext.categoryTree.css']
Initial value:
= array(
'position' => 'top',
'styles' => 'ext.categoryTree.css',
$commonModuleInfo
Definition: CategoryTree.php:137
const CT_HIDEPREFIX_NEVER 0

Constants for use with the hideprefix option, defining when the namespace prefix should be hidden

const CT_MODE_CATEGORIES(!defined( 'MEDIAWIKI')) 0

Constants for use with the mode, defining what should be shown in the tree