Go to the documentation of this file.
36 global $wgCategoryTreeForceHeaders;
37 return $wgCategoryTreeForceHeaders;
46 global $wgCategoryTreeDefaultOptions, $wgCategoryTreeDefaultMode;
47 global $wgCategoryTreeCategoryPageOptions, $wgCategoryTreeCategoryPageMode;
48 global $wgCategoryTreeOmitNamespace;
50 if ( !isset( $wgCategoryTreeDefaultOptions[
'mode'] )
51 || is_null( $wgCategoryTreeDefaultOptions[
'mode'] )
53 $wgCategoryTreeDefaultOptions[
'mode'] = $wgCategoryTreeDefaultMode;
56 if ( !isset( $wgCategoryTreeDefaultOptions[
'hideprefix'] )
57 || is_null( $wgCategoryTreeDefaultOptions[
'hideprefix'] )
59 $wgCategoryTreeDefaultOptions[
'hideprefix'] = $wgCategoryTreeOmitNamespace;
62 if ( !isset( $wgCategoryTreeCategoryPageOptions[
'mode'] )
63 || is_null( $wgCategoryTreeCategoryPageOptions[
'mode'] )
66 $wgCategoryTreeCategoryPageOptions[
'mode'] = ( $mode )
75 global $wgCategoryTreeAllowTag;
76 if ( !$wgCategoryTreeAllowTag ) {
79 $parser->setHook(
'categorytree',
'CategoryTreeHooks::parserHook' );
80 $parser->setFunctionHook(
'categorytree',
'CategoryTreeHooks::parserFunction' );
101 if ( preg_match(
'/^\s*(\S.*?)\s*=\s*(.*?)\s*$/', $p, $m ) ) {
104 $v = preg_replace(
'/^"\s*(.*?)\s*"$/',
'$1', $m[2] );
115 return [
$html,
'noparse' =>
true,
'isHTML' =>
true ];
125 global $wgCategoryTreeSidebarRoot, $wgCategoryTreeSidebarOptions;
127 if ( !$wgCategoryTreeSidebarRoot ) {
133 $sidebar[
'categorytree-portlet'] =
$html;
152 $allowMissing =
false
155 # flag for use by CategoryTreeHooks::parserOutput
156 $parser->mOutput->mCategoryTreeTag =
true;
161 $attr = Sanitizer::validateTagAttributes( $argv,
'div' );
163 $hideroot = isset( $argv[
'hideroot'] )
165 $onlyroot = isset( $argv[
'onlyroot'] )
167 $depthArg = isset( $argv[
'depth'] ) ? (int)$argv[
'depth'] :
null;
174 return $ct->getTag(
$parser, $cat, $hideroot, $attr, $depth, $allowMissing );
186 if ( self::shouldForceHeaders() ) {
190 if ( !empty( $parserOutput->mCategoryTreeTag ) ) {
202 if ( !self::shouldForceHeaders() ) {
232 global $wgCategoryTreePageCategoryOptions, $wgCategoryTreeHijackPageCategories;
234 if ( !$wgCategoryTreeHijackPageCategories ) {
239 foreach ( $categories
as $category =>
$type ) {
254 global $wgCategoryTreeCategoryPageOptions;
257 $ct =
new CategoryTree( $wgCategoryTreeCategoryPageOptions );
260 'defaultCtOptions' => $ct->getOptionsAsJsStructure(),
273 $categoryDbKeys = [];
274 foreach ( $trackingCategories
as $catMsg =>
$data ) {
275 foreach (
$data[
'cats']
as $catTitle ) {
276 $categoryDbKeys[] = $catTitle->getDbKey();
280 if ( $categoryDbKeys ) {
284 [
'cat_id',
'cat_title',
'cat_pages',
'cat_subcats',
'cat_files' ],
285 [
'cat_title' => array_unique( $categoryDbKeys ) ],
288 foreach (
$res as $row ) {
292 $specialPage->categoryTreeCategories = $categories;
305 if ( !isset( $specialPage->categoryTreeCategories ) ) {
310 if ( isset( $specialPage->categoryTreeCategories[$catTitle->getDbKey()] ) ) {
311 $cat = $specialPage->categoryTreeCategories[$catTitle->getDbKey()];
static setHooks(Parser $parser)
static onSkinBuildSidebar(Skin $skin, array &$sidebar)
Hook implementation for injecting a category tree into the sidebar.
return true to allow those checks to and false if checking is done remove or add to the links of a group of changes in EnhancedChangesList Hook subscribers can return false to omit this line from recentchanges use this to change the tables headers change it to an object instance and return false override the list derivative used the name of the old file & $article
static outputPageMakeCategoryLinks(OutputPage &$out, array $categories, array &$links)
OutputPageMakeCategoryLinks hook, override category links.
static addHeaders(OutputPage $out)
BeforePageDisplay and BeforePageDisplayMobile hooks.
static parserFunction(Parser $parser,... $params)
Entry point for the {{#categorytree}} tag parser function.
static capDepth( $mode, $depth)
Internal function to cap depth @suppress PhanPluginDuplicateConditionalNullCoalescing until PHP7 is r...
static decodeMode( $mode)
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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
Core functions for the CategoryTree extension, an AJAX based gadget to display the category structure...
static initialize()
Adjusts config once MediaWiki is fully initialised TODO: Don't do this, lazy initialize the config.
static parserOutput(OutputPage $outputPage, ParserOutput $parserOutput)
Hook callback that injects messages and things into the <head> tag, if needed in the current page.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
static createCountString(IContextSource $context, Category $cat=null, $countMode)
Create a string which format the page, subcat and file counts of a category @suppress PhanParamReqAft...
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
static shouldForceHeaders()
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
namespace and then decline to actually register it file or subcat img or subcat $title
static parserHook( $cat, array $argv, Parser $parser=null, $allowMissing=false)
Entry point for the <categorytree> tag parser hook.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Hooks for the CategoryTree extension, an AJAX based gadget to display the category structure of a wik...
static onSpecialTrackingCategoriesGenerateCatLink(SpecialPage $specialPage, Title $catTitle, &$html)
Hook handler for the SpecialTrackingCategories::generateCatLink hook @suppress PhanUndeclaredProperty...
see documentation in includes Linker php for Linker::makeImageLink or false for current used if you return false $parser
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
getContext()
Gets the context this SpecialPage is executed in.
static newFromRow( $row, $title=null)
Factory function, for constructing a Category object from a result set.
Parent class for all special pages.
static onSpecialTrackingCategoriesPreprocess(SpecialPage $specialPage, array $trackingCategories)
Hook handler for the SpecialTrackingCategories::preprocess hook @suppress PhanUndeclaredProperty Spec...
static decodeBoolean( $value)
Helper function to convert a string to a boolean value.
Represents a title within MediaWiki.
static getDataForJs()
Get exported data for the "ext.categoryTree" ResourceLoader module.
static articleFromTitle(Title $title, Article &$article=null)
ArticleFromTitle hook, override category page handling.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
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 $skin
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
Class for viewing MediaWiki article and history.
if(! $wgDBerrorLogTZ) $wgRequest
The main skin class which provides methods and properties for all other skins.
static setHeaders(OutputPage $outputPage)
Add ResourceLoader modules to the OutputPage object.