X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialExpandTemplates.php;h=73ca76bb9738a3165f972470ece077e38d1504ad;hb=e77e1bcbf7ab008b071a15230654f4ca9a912df8;hp=560d75a6b1d3588a89501e4859f7376aedce80f7;hpb=82524dc4da650c8017767a2648ed92dde98b8cae;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialExpandTemplates.php b/includes/specials/SpecialExpandTemplates.php index 560d75a6b1..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,9 +55,8 @@ class SpecialExpandTemplates extends SpecialPage { * @param string|null $subpage */ function execute( $subpage ) { - global $wgParser; - $this->setHeaders(); + $this->addHelpLink( 'Help:ExpandTemplates' ); $request = $this->getRequest(); $titleStr = $request->getText( 'wpContextTitle' ); @@ -76,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(); @@ -87,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 ); @@ -114,8 +116,10 @@ class SpecialExpandTemplates extends SpecialPage { } $config = $this->getConfig(); - if ( $config->get( 'UseTidy' ) && $options->getTidy() ) { + if ( MWTidy::isEnabled() && $options->getTidy() ) { $tmp = MWTidy::tidy( $tmp ); + } else { + wfDeprecated( 'disabling tidy', '1.33' ); } $out->addHTML( $tmp ); @@ -151,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 = [ @@ -163,7 +166,6 @@ class SpecialExpandTemplates extends SpecialPage { 'size' => 60, 'default' => $title, 'autofocus' => true, - 'cssclass' => 'mw-ui-input-inline', ], 'input' => [ 'type' => 'textarea', @@ -172,6 +174,7 @@ class SpecialExpandTemplates extends SpecialPage { 'rows' => 10, 'default' => $input, 'id' => 'input', + 'useeditfont' => true, ], 'removecomments' => [ 'type' => 'check', @@ -226,7 +229,11 @@ class SpecialExpandTemplates extends SpecialPage { $output, 10, 10, - [ 'id' => 'output', 'readonly' => 'readonly' ] + [ + 'id' => 'output', + 'readonly' => 'readonly', + 'class' => 'mw-editfont-' . $this->getUser()->getOption( 'editfont' ) + ] ); return $out; @@ -240,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 ); } /**