global $wgParser was deprecated in 1.32 and services are used
instead to get the parser object via MediaWikiServices. Making
this replacement as we're avoiding globals.
Change-Id: I967a52c481bfcc83552053a03e88acb038810828
* @return string
*/
public function parse( $text, $lineStart = false ) {
- global $wgParser;
+ $parser = MediaWikiServices::getInstance()->getParser();
try {
- $out = $wgParser->parse( $text, $this->parserTitle, $this->parserOptions, $lineStart );
+ $out = $parser->parse( $text, $this->parserTitle, $this->parserOptions, $lineStart );
$html = $out->getText( [
'enableSectionEditLinks' => false,
'unwrap' => true,
$this->request = $request;
// Add parser hooks
- global $wgParser;
- $wgParser->setHook( 'downloadlink', [ $this, 'downloadLinkHook' ] );
- $wgParser->setHook( 'doclink', [ $this, 'docLink' ] );
+ $parser = MediaWikiServices::getInstance()->getParser();
+ $parser->setHook( 'downloadlink', [ $this, 'downloadLinkHook' ] );
+ $parser->setHook( 'doclink', [ $this, 'docLink' ] );
}
/**