X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialExpandTemplates.php;h=ceba987f8a1cac7cd4f579887f361bc390b280d6;hb=835a1c38f00b601fbcc81a2aad8639160ccb1bc1;hp=619665bdb49fa7acf354046514fb3f6e508997b7;hpb=a5bedbfbfeff58d65e8947906b2360ab2b7ce8e5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialExpandTemplates.php b/includes/specials/SpecialExpandTemplates.php index 619665bdb4..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 ); @@ -154,7 +155,6 @@ class SpecialExpandTemplates extends SpecialPage { * * @param string $title Value for context title field * @param string $input Value for input textbox - * @return string */ private function makeForm( $title, $input ) { $fields = [ @@ -247,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 ); } /**