*
* Created on Oct 05, 2007
*
- * Copyright © 2007 Yuri Astrakhan <Firstname><Lastname>@gmail.com
+ * Copyright © 2007 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
class ApiExpandTemplates extends ApiBase {
- public function __construct( $main, $action ) {
- parent::__construct( $main, $action );
- }
-
public function execute() {
// Cache may vary on $wgUser because ParserOptions gets data from it
$this->getMain()->setCacheMode( 'anon-public-user-private' );
// Create title for parser
$title_obj = Title::newFromText( $params['title'] );
- if ( !$title_obj ) {
+ if ( !$title_obj || $title_obj->isExternal() ) {
$this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
}
$xml = $dom->__toString();
}
$xml_result = array();
- $result->setContent( $xml_result, $xml );
+ ApiResult::setContent( $xml_result, $xml );
$result->addValue( null, 'parsetree', $xml_result );
}
$retval = $wgParser->preprocess( $params['text'], $title_obj, $options );
// Return result
$retval_array = array();
- $result->setContent( $retval_array, $retval );
+ ApiResult::setContent( $retval_array, $retval );
$result->addValue( null, $this->getModuleName(), $retval_array );
}
}
public function getDescription() {
- return 'Expands all templates in wikitext';
+ return 'Expands all templates in wikitext.';
}
public function getPossibleErrors() {
public function getHelpUrls() {
return 'https://www.mediawiki.org/wiki/API:Parsing_wikitext#expandtemplates';
}
-
- public function getVersion() {
- return __CLASS__ . ': $Id$';
- }
}