* @ingroup SpecialPage
*/
+use MediaWiki\MediaWikiServices;
+
/**
* A special page that expands submitted templates, parser functions,
* and variables, allowing easier debugging of these.
* @param string|null $subpage
*/
function execute( $subpage ) {
- global $wgParser;
-
$this->setHeaders();
$this->addHelpLink( 'Help:ExpandTemplates' );
$options->setTidy( true );
$options->setMaxIncludeSize( self::MAX_INCLUDE_SIZE );
+ $parser = MediaWikiServices::getInstance()->getParser();
if ( $this->generateXML ) {
- $wgParser->startExternalParse( $title, $options, Parser::OT_PREPROCESS );
- $dom = $wgParser->preprocessToDom( $input );
+ $parser->startExternalParse( $title, $options, Parser::OT_PREPROCESS );
+ $dom = $parser->preprocessToDom( $input );
if ( method_exists( $dom, 'saveXML' ) ) {
$xml = $dom->saveXML();
}
}
- $output = $wgParser->preprocess( $input, $title, $options );
+ $output = $parser->preprocess( $input, $title, $options );
} else {
$this->removeComments = $request->getBool( 'wpRemoveComments', true );
$this->removeNowiki = $request->getBool( 'wpRemoveNowiki', false );
*
* @param string $title Value for context title field
* @param string $input Value for input textbox
- * @return string
*/
private function makeForm( $title, $input ) {
$fields = [
* @return ParserOutput
*/
private function generateHtml( Title $title, $text ) {
- global $wgParser;
-
$popts = ParserOptions::newFromContext( $this->getContext() );
$popts->setTargetLanguage( $title->getPageLanguage() );
- return $wgParser->parse( $text, $title, $popts );
+ return MediaWikiServices::getInstance()->getParser()->parse( $text, $title, $popts );
}
/**