mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-15 03:35:53 +00:00
Replace deprecated wgParser (#1)
This commit is contained in:
parent
f104d7bac0
commit
1ae720077e
|
@ -14,9 +14,9 @@ class ApiPortableInfobox extends ApiBase {
|
|||
$this->addWarning( 'apiwarn-infobox-invalidargs' );
|
||||
}
|
||||
|
||||
global $wgParser;
|
||||
$wgParser->firstCallInit();
|
||||
$wgParser->startExternalParse(
|
||||
$parser = MediaWikiServices::getInstance()->getParser();
|
||||
$parser->firstCallInit();
|
||||
$parser->startExternalParse(
|
||||
Title::newFromText( $title ),
|
||||
ParserOptions::newFromContext( $this->getContext() ),
|
||||
Parser::OT_HTML,
|
||||
|
@ -25,14 +25,14 @@ class ApiPortableInfobox extends ApiBase {
|
|||
|
||||
if ( is_array( $arguments ) ) {
|
||||
foreach ( $arguments as $key => &$value ) {
|
||||
$value = $wgParser->replaceVariables( $value );
|
||||
$value = $parser->replaceVariables( $value );
|
||||
}
|
||||
}
|
||||
|
||||
$frame = $wgParser->getPreprocessor()->newCustomFrame( is_array( $arguments ) ? $arguments : [] );
|
||||
$frame = $parser->getPreprocessor()->newCustomFrame( is_array( $arguments ) ? $arguments : [] );
|
||||
|
||||
try {
|
||||
$output = PortableInfoboxParserTagController::getInstance()->render( $text, $wgParser, $frame );
|
||||
$output = PortableInfoboxParserTagController::getInstance()->render( $text, $parser, $frame );
|
||||
$this->getResult()->addValue( null, $this->getModuleName(), [ 'text' => [ '*' => $output ] ] );
|
||||
} catch ( \PortableInfobox\Parser\Nodes\UnimplementedNodeException $e ) {
|
||||
$this->dieUsage(
|
||||
|
|
Loading…
Reference in a new issue