scribunto_engine ) || !$parser->scribunto_engine ) { $parser->scribunto_engine = self::newDefaultEngine( array( 'parser' => $parser ) ); } return $parser->scribunto_engine; } /** * Remove the current engine instance from the parser */ public static function resetParserEngine( $parser ) { $parser->scribunto_engine = null; } } /** * An exception class which represents an error in the script. This does not * normally abort the request, instead it is caught and shown to the user. */ class ScribuntoException extends MWException { var $messageName, $params; function __construct( $messageName, $params = array() ) { if ( isset( $params['args'] ) ) { $args = $params['args']; } else { $args = array(); } if ( isset( $params['module'] ) && isset( $params['line'] ) ) { $codelocation = wfMsg( 'scribunto-codelocation', $params['module'], $params['line'] ); } else { $codelocation = '[UNKNOWN]'; // should never happen } array_unshift( $args, $codelocation ); $msg = wfMsgExt( $messageName, array(), $args ); parent::__construct( $msg ); $this->messageName = $messageName; $this->params = $params; } public function getMessageName() { return $this->messageName; } }