X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialExpandTemplates.php;h=ceba987f8a1cac7cd4f579887f361bc390b280d6;hb=c00c34f288c13b5360e30c694d929e4c65e3a3a1;hp=9ea5e089a6829609ee7473b64885a50ff618e8f6;hpb=4aabbfdb0f81356a6da52733313caf62c623afea;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialExpandTemplates.php b/includes/specials/SpecialExpandTemplates.php index 9ea5e089a6..ceba987f8a 100644 --- a/includes/specials/SpecialExpandTemplates.php +++ b/includes/specials/SpecialExpandTemplates.php @@ -21,6 +21,8 @@ * @ingroup SpecialPage */ +use MediaWiki\MediaWikiServices; + /** * A special page that expands submitted templates, parser functions, * and variables, allowing easier debugging of these. @@ -53,8 +55,6 @@ class SpecialExpandTemplates extends SpecialPage { * @param string|null $subpage */ function execute( $subpage ) { - global $wgParser; - $this->setHeaders(); $this->addHelpLink( 'Help:ExpandTemplates' ); @@ -77,9 +77,10 @@ class SpecialExpandTemplates extends SpecialPage { $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(); @@ -88,7 +89,7 @@ class SpecialExpandTemplates extends SpecialPage { } } - $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 ); @@ -246,11 +247,9 @@ class SpecialExpandTemplates extends SpecialPage { * @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 ); } /**