38 parent::__construct(
'CategoryTree' );
46 global $wgCategoryTreeDefaultOptions;
49 return $this->tree->getOption( $name );
51 return $wgCategoryTreeDefaultOptions[
$name];
60 global $wgCategoryTreeDefaultOptions, $wgCategoryTreeSpecialPageOptions;
67 $this->target =
$request->getVal(
'target' );
68 if ( $this->target ===
null ) {
69 $rootcategory = $this->
msg(
'rootcategory' );
70 if ( $rootcategory->exists() ) {
71 $this->target = $rootcategory->text();
76 $this->target = trim( $this->target );
80 # grab all known options from the request. Normalization is done by the CategoryTree class
81 foreach ( $wgCategoryTreeDefaultOptions as $option => $default ) {
82 if ( isset( $wgCategoryTreeSpecialPageOptions[$option] ) ) {
83 $default = $wgCategoryTreeSpecialPageOptions[$option];
92 $output->addWikiMsg(
'categorytree-header' );
96 if ( $this->target !==
'' && $this->target !==
null ) {
103 if ( $title && $title->getArticleID() ) {
104 $output->addHTML( Xml::openElement(
'div', [
'class' =>
'CategoryTreeParents' ] ) );
105 $output->addHTML( $this->
msg(
'categorytree-parents' )->parse() );
106 $output->addHTML( $this->
msg(
'colon-separator' )->escaped() );
108 $parents = $this->tree->renderParents( $title );
110 if ( $parents ==
'' ) {
111 $output->addHTML( $this->
msg(
'categorytree-no-parent-categories' )->parse() );
116 $output->addHTML( Xml::closeElement(
'div' ) );
118 $output->addHTML( Xml::openElement(
'div', [
'class' =>
'CategoryTreeResult' ] ) );
119 $output->addHTML( $this->tree->renderNode( $title, 1 ) );
120 $output->addHTML( Xml::closeElement(
'div' ) );
122 $output->addHTML( Xml::openElement(
'div', [
'class' =>
'CategoryTreeNotice' ] ) );
123 $output->addHTML( $this->
msg(
'categorytree-not-found', $this->target )->parse() );
124 $output->addHTML( Xml::closeElement(
'div' ) );
137 $modeDefault =
'categories';
139 $modeDefault =
'pages';
141 $modeDefault =
'all';
148 'label-message' =>
'categorytree-category',
155 'label-message' =>
'categorytree-mode-label',
156 'options-messages' => [
157 'categorytree-mode-categories' =>
'categories',
158 'categorytree-mode-pages' =>
'pages',
159 'categorytree-mode-all' =>
'all',
161 'default' => $modeDefault,
166 'type' =>
'namespaceselect',
167 'name' =>
'namespaces',
168 'label-message' =>
'namespace',
174 ->addHiddenFields( [
'title' => $this->
getPageTitle()->getPrefixedDbKey() ] )
175 ->setWrapperLegendMsg(
'categorytree-legend' )
176 ->setSubmitTextMsg(
'categorytree-go' )
179 ->displayForm(
false );
191 $title = Title::newFromText( $search,
NS_CATEGORY );
192 if ( $title && $title->getNamespace() !==
NS_CATEGORY ) {
194 $title = Title::makeTitleSafe(
NS_CATEGORY, $search );
202 $result = $prefixSearcher->
search( $title->getPrefixedText(), $limit, [
NS_CATEGORY ], $offset );
204 return array_map(
function (
Title $t ) {
206 return $t->getText();
static shouldForceHeaders()
Special page for the CategoryTree extension, an AJAX based gadget to display the category structure o...
execute( $par)
Main execution function.
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
executeInputForm()
Input form for entering a category.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Core functions for the CategoryTree extension, an AJAX based gadget to display the category structure...
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.
search( $search, $limit, $namespaces=[], $offset=0)
Do a prefix search of titles and return a list of matching page names.
Parent class for all special pages.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key)
Wrapper around wfMessage that sets the current context.
getRequest()
Get the WebRequest being used for this instance.
getPageTitle( $subpage=false)
Get a self-referential title object.
Performs prefix search, returning Title objects.
Represents a title within MediaWiki.
namespace being checked & $result
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
namespace and then decline to actually register it & $namespaces
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead & $formDescriptor
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 & $options
Allows to change the fields on the form that will be generated $name
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place $output