Replace PHP use of Xml class by Html class

Change-Id: I5d98f875566a2ad5da31c707873f3af6d984de34
This commit is contained in:
Fomafix 2021-08-31 11:18:30 +00:00 committed by Krinkle
parent 480ff35722
commit a887e226e0
2 changed files with 19 additions and 20 deletions

View file

@ -38,7 +38,6 @@ use Parser;
use RequestContext;
use SpecialPage;
use Title;
use Xml;
/**
* Core functions for the CategoryTree extension, an AJAX based gadget
@ -393,7 +392,7 @@ class CategoryTree {
}
}
$html .= Xml::closeElement( 'div' );
$html .= Html::closeElement( 'div' );
return $html;
}
@ -560,14 +559,14 @@ class CategoryTree {
$s .= wfMessage( 'pipe-separator' )->escaped();
}
$s .= Xml::openElement( 'span', [ 'class' => 'CategoryTreeItem' ] );
$s .= Html::openElement( 'span', [ 'class' => 'CategoryTreeItem' ] );
$s .= $this->linkRenderer->makeLink(
$special,
$t->getText(),
[ 'class' => 'CategoryTreeLabel' ],
[ 'target' => $t->getDBkey() ] + $this->mOptions
);
$s .= Xml::closeElement( 'span' );
$s .= Html::closeElement( 'span' );
}
return $s;
@ -637,8 +636,8 @@ class CategoryTree {
# Specifically, the CategoryTreeChildren div must be the first
# sibling with nodeName = DIV of the grandparent of the expland link.
$s .= Xml::openElement( 'div', [ 'class' => 'CategoryTreeSection' ] );
$s .= Xml::openElement( 'div', [ 'class' => 'CategoryTreeItem' ] );
$s .= Html::openElement( 'div', [ 'class' => 'CategoryTreeSection' ] );
$s .= Html::openElement( 'div', [ 'class' => 'CategoryTreeItem' ] );
$attr = [ 'class' => 'CategoryTreeBullet' ];
@ -674,7 +673,7 @@ class CategoryTree {
$bullet = '';
$attr['class'] = 'CategoryTreePageBullet';
}
$s .= Xml::tags( 'span', $attr, $bullet ) . ' ';
$s .= Html::rawElement( 'span', $attr, $bullet ) . ' ';
$s .= $link;
@ -682,8 +681,8 @@ class CategoryTree {
$s .= self::createCountString( RequestContext::getMain(), $cat, $count );
}
$s .= Xml::closeElement( 'div' );
$s .= Xml::openElement(
$s .= Html::closeElement( 'div' );
$s .= Html::openElement(
'div',
[
'class' => 'CategoryTreeChildren',
@ -694,7 +693,7 @@ class CategoryTree {
if ( $ns == NS_CATEGORY && $children > 0 ) {
$children = $this->renderChildren( $title, $children );
if ( $children == '' ) {
$s .= Xml::openElement( 'i', [ 'class' => 'CategoryTreeNotice' ] );
$s .= Html::openElement( 'i', [ 'class' => 'CategoryTreeNotice' ] );
if ( $mode == CategoryTreeMode::CATEGORIES ) {
$s .= wfMessage( 'categorytree-no-subcategories' )->escaped();
} elseif ( $mode == CategoryTreeMode::PAGES ) {
@ -704,13 +703,13 @@ class CategoryTree {
} else {
$s .= wfMessage( 'categorytree-nothing-found' )->escaped();
}
$s .= Xml::closeElement( 'i' );
$s .= Html::closeElement( 'i' );
} else {
$s .= $children;
}
}
$s .= Xml::closeElement( 'div' ) . Xml::closeElement( 'div' );
$s .= Html::closeElement( 'div' ) . Html::closeElement( 'div' );
return $s;
}
@ -761,7 +760,7 @@ class CategoryTree {
# Only $5 is actually used in the default message.
# Other arguments can be used in a customized message.
$s .= Xml::tags(
$s .= Html::rawElement(
'span',
$attr,
$context->msg( 'categorytree-member-num' )

View file

@ -24,11 +24,11 @@
namespace MediaWiki\Extension\CategoryTree;
use Html;
use HTMLForm;
use SearchEngineFactory;
use SpecialPage;
use Title;
use Xml;
/**
* Special page for the CategoryTree extension, an AJAX based gadget
@ -114,7 +114,7 @@ class CategoryTreePage extends SpecialPage {
$title = CategoryTree::makeTitle( $this->target );
if ( $title && $title->getArticleID() ) {
$output->addHTML( Xml::openElement( 'div', [ 'class' => 'CategoryTreeParents' ] ) );
$output->addHTML( Html::openElement( 'div', [ 'class' => 'CategoryTreeParents' ] ) );
$output->addHTML( $this->msg( 'categorytree-parents' )->parse() );
$output->addHTML( $this->msg( 'colon-separator' )->escaped() );
@ -126,22 +126,22 @@ class CategoryTreePage extends SpecialPage {
$output->addHTML( $parents );
}
$output->addHTML( Xml::closeElement( 'div' ) );
$output->addHTML( Html::closeElement( 'div' ) );
$output->addHTML( Xml::openElement( 'div', [
$output->addHTML( Html::openElement( 'div', [
'class' => 'CategoryTreeResult CategoryTreeTag',
'data-ct-mode' => $this->tree->getOption( 'mode' ),
'data-ct-options' => $this->tree->getOptionsAsJsStructure(),
] ) );
$output->addHTML( $this->tree->renderNode( $title, 1 ) );
$output->addHTML( Xml::closeElement( 'div' ) );
$output->addHTML( Html::closeElement( 'div' ) );
} else {
$output->addHTML( Xml::openElement( 'div', [ 'class' => 'CategoryTreeNotice' ] ) );
$output->addHTML( Html::openElement( 'div', [ 'class' => 'CategoryTreeNotice' ] ) );
$output->addHTML( $this->msg( 'categorytree-not-found' )
->plaintextParams( $this->target )
->parse()
);
$output->addHTML( Xml::closeElement( 'div' ) );
$output->addHTML( Html::closeElement( 'div' ) );
}
}
}