MediaWiki REL1_31
|
Core functions for the CategoryTree extension, an AJAX based gadget to display the category structure of a wiki. More...
Public Member Functions | |
__construct ( $options) | |
getOption ( $name) | |
getOptionsAsCacheKey ( $depth=null) | |
getOptionsAsJsStructure ( $depth=null) | |
getTag ( $parser, $category, $hideroot=false, $attr=[], $depth=1, $allowMissing=false) | |
Custom tag implementation. | |
renderChildren ( $title, $depth=1) | |
Returns a string with an HTML representation of the children of the given category. | |
renderNode ( $title, $children=0) | |
Returns a string with a HTML represenation of the given page. | |
renderNodeInfo ( $title, $cat, $children=0) | |
Returns a string with a HTML represenation of the given page. | |
renderParents ( $title) | |
Returns a string with an HTML representation of the parents of the given category. | |
Static Public Member Functions | |
static | capDepth ( $mode, $depth) |
Internal function to cap depth. | |
static | createCountString (IContextSource $context, $cat, $countMode) |
Create a string which format the page, subcat and file counts of a category. | |
static | decodeBoolean ( $value) |
Helper function to convert a string to a boolean value. | |
static | decodeHidePrefix ( $value) |
static | decodeMode ( $mode) |
static | makeTitle ( $title) |
Creates a Title object from a user provided (and thus unsafe) string. | |
static | setHeaders ( $outputPage) |
Add ResourceLoader modules to the OutputPage object. | |
Public Attributes | |
$mOptions = [] | |
Static Protected Member Functions | |
static | encodeOptions ( $options, $enc) |
Private Member Functions | |
getOptionsAsUrlParameters () | |
isInverse () | |
Static Private Member Functions | |
static | decodeNamespaces ( $nn) |
Core functions for the CategoryTree extension, an AJAX based gadget to display the category structure of a wiki.
Definition at line 29 of file CategoryTree.php.
CategoryTree::__construct | ( | $options | ) |
array | $options |
Definition at line 35 of file CategoryTree.php.
References $options, CategoryTreeMode\ALL, CategoryTreeMode\CATEGORIES, decodeBoolean(), decodeHidePrefix(), decodeMode(), decodeNamespaces(), NS_CATEGORY, NS_FILE, CategoryTreeMode\PAGES, and CategoryTreeMode\PARENTS.
|
static |
Internal function to cap depth.
string | $mode | |
int | $depth |
Definition at line 802 of file CategoryTree.php.
References wfDebug().
Referenced by ApiCategoryTree\execute(), and CategoryTreeHooks\parserHook().
|
static |
Create a string which format the page, subcat and file counts of a category.
IContextSource | $context | |
Category | null | $cat | |
int | $countMode |
Definition at line 722 of file CategoryTree.php.
References $context, $s, and $wgContLang.
Referenced by CategoryTreeHooks\onSpecialTrackingCategoriesGenerateCatLink(), and renderNodeInfo().
|
static |
Helper function to convert a string to a boolean value.
Perhaps make this a global function in MediaWiki proper
mixed | $value |
Definition at line 174 of file CategoryTree.php.
References $value.
Referenced by __construct(), and CategoryTreeHooks\parserHook().
|
static |
mixed | $value |
Definition at line 209 of file CategoryTree.php.
References $value, CategoryTreeHidePrefix\ALWAYS, CategoryTreeHidePrefix\AUTO, CategoryTreeHidePrefix\CATEGORIES, and CategoryTreeHidePrefix\NEVER.
Referenced by __construct().
|
static |
mixed | $mode |
Definition at line 137 of file CategoryTree.php.
References CategoryTreeMode\ALL, CategoryTreeMode\CATEGORIES, CategoryTreeMode\PAGES, and CategoryTreeMode\PARENTS.
Referenced by __construct(), and CategoryTreeHooks\initialize().
|
staticprivate |
mixed | $nn |
Definition at line 91 of file CategoryTree.php.
References $namespaces, $wgContLang, NS_MAIN, and order.
Referenced by __construct().
|
staticprotected |
array | $options | |
string | $enc |
Exception |
Definition at line 264 of file CategoryTree.php.
References $opt, and $options.
Referenced by getOptionsAsJsStructure().
CategoryTree::getOption | ( | $name | ) |
string | $name |
Definition at line 76 of file CategoryTree.php.
References $name.
Referenced by isInverse(), renderChildren(), and renderNodeInfo().
CategoryTree::getOptionsAsCacheKey | ( | $depth = null | ) |
CategoryTree::getOptionsAsJsStructure | ( | $depth = null | ) |
int | null | $depth |
Definition at line 300 of file CategoryTree.php.
References $mOptions, $opt, $s, and encodeOptions().
Referenced by getTag().
|
private |
Definition at line 315 of file CategoryTree.php.
CategoryTree::getTag | ( | $parser, | |
$category, | |||
$hideroot = false, | |||
$attr = [], | |||
$depth = 1, | |||
$allowMissing = false ) |
Custom tag implementation.
This is called by CategoryTreeHooks::parserHook, which is used to load CategoryTreeFunctions.php on demand.
Parser | $parser | |
string | $category | |
bool | $hideroot | |
array | $attr | |
int | $depth | |
bool | $allowMissing |
Definition at line 330 of file CategoryTree.php.
References $html, $parser, getOptionsAsJsStructure(), makeTitle(), plain, renderChildren(), renderNode(), and wfMessage().
|
private |
Definition at line 83 of file CategoryTree.php.
References getOption(), and CategoryTreeMode\PARENTS.
Referenced by renderChildren().
|
static |
Creates a Title object from a user provided (and thus unsafe) string.
string | $title |
Definition at line 777 of file CategoryTree.php.
References $t, and NS_CATEGORY.
Referenced by CategoryTreePage\execute(), ApiCategoryTree\execute(), ApiCategoryTree\getConditionalRequestData(), and getTag().
CategoryTree::renderChildren | ( | $title, | |
$depth = 1 ) |
Returns a string with an HTML representation of the children of the given category.
Title | $title | |
int | $depth |
Definition at line 395 of file CategoryTree.php.
References $dbr, $namespaces, $options, $res, $s, $t, $tables, CategoryTreeMode\ALL, DB_REPLICA, getOption(), isInverse(), NS_CATEGORY, CategoryTreeMode\PAGES, renderNodeInfo(), and wfGetDB().
Referenced by getTag(), and renderNodeInfo().
CategoryTree::renderNode | ( | $title, | |
$children = 0 ) |
Returns a string with a HTML represenation of the given page.
Title | $title | |
int | $children |
Definition at line 545 of file CategoryTree.php.
References NS_CATEGORY, and renderNodeInfo().
Referenced by getTag().
CategoryTree::renderNodeInfo | ( | $title, | |
$cat, | |||
$children = 0 ) |
Returns a string with a HTML represenation of the given page.
$info must be an associative array, containing at least a Title object under the 'title' key.
Definition at line 567 of file CategoryTree.php.
References $s, CategoryTreeHidePrefix\ALWAYS, CategoryTreeHidePrefix\AUTO, CategoryTreeHidePrefix\CATEGORIES, CategoryTreeMode\CATEGORIES, createCountString(), RequestContext\getMain(), getOption(), NS_CATEGORY, CategoryTreeMode\PAGES, CategoryTreeMode\PARENTS, plain, renderChildren(), and wfMessage().
Referenced by renderChildren(), and renderNode().
CategoryTree::renderParents | ( | $title | ) |
Returns a string with an HTML representation of the parents of the given category.
Title | $title |
Definition at line 494 of file CategoryTree.php.
References $dbr, $res, $s, $t, DB_REPLICA, NS_CATEGORY, wfGetDB(), and wfMessage().
|
static |
Add ResourceLoader modules to the OutputPage object.
OutputPage | $outputPage |
Definition at line 252 of file CategoryTree.php.
Referenced by CategoryTreeHooks\addHeaders(), CategoryTreePage\execute(), CategoryTreeCategoryViewer\getCategoryTree(), CategoryTreeHooks\parserHook(), and CategoryTreeHooks\parserOutput().
CategoryTree::$mOptions = [] |
Definition at line 30 of file CategoryTree.php.
Referenced by getOptionsAsJsStructure().