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 ) {
107 $output->addHTML( Xml::openElement(
'div', [
'class' =>
'CategoryTreeParents' ] ) );
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() );
116 $output->addHTML( $parents );
119 $output->addHTML( Xml::closeElement(
'div' ) );
121 $output->addHTML( Xml::openElement(
'div', [
'class' =>
'CategoryTreeResult' ] ) );
122 $output->addHTML( $this->tree->renderNode(
$title, 1 ) );
123 $output->addHTML( Xml::closeElement(
'div' ) );
125 $output->addHTML( Xml::openElement(
'div', [
'class' =>
'CategoryTreeNotice' ] ) );
126 $output->addHTML( $this->
msg(
'categorytree-not-found', $this->target )->parse() );
127 $output->addHTML( Xml::closeElement(
'div' ) );
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();