Go to the documentation of this file.
40 parent::__construct(
'CategoryTree' );
48 global $wgCategoryTreeDefaultOptions;
51 return $this->tree->getOption( $name );
53 return $wgCategoryTreeDefaultOptions[$name];
62 global $wgCategoryTreeDefaultOptions, $wgCategoryTreeSpecialPageOptions;
70 $this->target = $request->getVal(
'target' );
71 if ( $this->target ===
null ) {
72 $rootcategory = $this->
msg(
'rootcategory' );
73 if ( $rootcategory->exists() ) {
74 $this->target = $rootcategory->text();
79 $this->target = trim( $this->target );
83 # grab all known options from the request. Normalization is done by the CategoryTree class
84 foreach ( $wgCategoryTreeDefaultOptions as $option => $default ) {
85 if ( isset( $wgCategoryTreeSpecialPageOptions[$option] ) ) {
86 $default = $wgCategoryTreeSpecialPageOptions[$option];
89 $options[$option] = $request->getVal( $option, $default );
95 $output->addWikiMsg(
'categorytree-header' );
99 if ( $this->target !==
'' && $this->target !==
null ) {
108 $output->addHTML( $this->
msg(
'categorytree-parents' )->parse() );
109 $output->addHTML( $this->
msg(
'colon-separator' )->escaped() );
111 $parents = $this->tree->renderParents(
$title );
113 if ( $parents ==
'' ) {
114 $output->addHTML( $this->
msg(
'categorytree-no-parent-categories' )->parse() );
126 $output->addHTML( $this->
msg(
'categorytree-not-found', $this->target )->parse() );
136 $namespaces = $this->
getRequest()->getVal(
'namespaces',
'' );
140 $modeDefault =
'categories';
142 $modeDefault =
'pages';
144 $modeDefault =
'all';
151 'label-message' =>
'categorytree-category',
158 'label-message' =>
'categorytree-mode-label',
159 'options-messages' => [
160 'categorytree-mode-categories' =>
'categories',
161 'categorytree-mode-pages' =>
'pages',
162 'categorytree-mode-all' =>
'all',
164 'default' => $modeDefault,
169 'type' =>
'namespaceselect',
170 'name' =>
'namespaces',
171 'label-message' =>
'namespace',
177 ->addHiddenFields( [
'title' => $this->
getPageTitle()->getPrefixedDbKey() ] )
178 ->setWrapperLegendMsg(
'categorytree-legend' )
179 ->setSubmitTextMsg(
'categorytree-go' )
182 ->displayForm(
false );
203 $searchEngine = MediaWikiServices::getInstance()->newSearchEngine();
204 $searchEngine->setLimitOffset( $limit, $offset );
207 $result = $searchEngine->defaultPrefixSearch( $search );
209 return array_map(
function (
Title $t ) {
211 return $t->getText();
getPageTitle( $subpage=false)
Get a self-referential title object.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
getOutput()
Get the OutputPage being used for this instance.
Core functions for the CategoryTree extension, an AJAX based gadget to display the category structure...
static openElement( $element, $attribs=null)
This opens an XML element.
execute( $par)
Main execution function.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
static shouldForceHeaders()
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getContext()
Gets the context this SpecialPage is executed in.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Parent class for all special pages.
getRequest()
Get the WebRequest being used for this instance.
Special page for the CategoryTree extension, an AJAX based gadget to display the category structure o...
Represents a title within MediaWiki.
static closeElement( $element)
Shortcut to close an XML element.
static makeTitle( $title)
Creates a Title object from a user provided (and thus unsafe) string.
executeInputForm()
Input form for entering a category.
static setHeaders(OutputPage $outputPage)
Add ResourceLoader modules to the OutputPage object.