summaryrefslogtreecommitdiff
path: root/includes/api/ApiExpandTemplates.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiExpandTemplates.php')
-rw-r--r--includes/api/ApiExpandTemplates.php39
1 files changed, 20 insertions, 19 deletions
diff --git a/includes/api/ApiExpandTemplates.php b/includes/api/ApiExpandTemplates.php
index d0c00db7..6f2df1b8 100644
--- a/includes/api/ApiExpandTemplates.php
+++ b/includes/api/ApiExpandTemplates.php
@@ -1,11 +1,10 @@
<?php
-
-/*
- * Created on Oct 05, 2007
- *
+/**
* API for MediaWiki 1.8+
*
- * Copyright (C) 2007 Yuri Astrakhan <Firstname><Lastname>@gmail.com
+ * Created on Oct 05, 2007
+ *
+ * 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
@@ -19,13 +18,15 @@
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
*/
if ( !defined( 'MEDIAWIKI' ) ) {
// Eclipse helper - will be ignored in production
- require_once ( "ApiBase.php" );
+ require_once( "ApiBase.php" );
}
/**
@@ -38,7 +39,7 @@ if ( !defined( 'MEDIAWIKI' ) ) {
class ApiExpandTemplates extends ApiBase {
public function __construct( $main, $action ) {
- parent :: __construct( $main, $action );
+ parent::__construct( $main, $action );
}
public function execute() {
@@ -49,18 +50,18 @@ class ApiExpandTemplates extends ApiBase {
$params = $this->extractRequestParams();
// Create title for parser
- $title_obj = Title :: newFromText( $params['title'] );
- if ( !$title_obj )
- $title_obj = Title :: newFromText( "API" ); // default
+ $title_obj = Title::newFromText( $params['title'] );
+ if ( !$title_obj ) {
+ $title_obj = Title::newFromText( 'API' ); // default
+ }
$result = $this->getResult();
// Parse text
global $wgParser;
$options = new ParserOptions();
-
- if ( $params['generatexml'] )
- {
+
+ if ( $params['generatexml'] ) {
$wgParser->startExternalParse( $title_obj, $options, OT_PREPROCESS );
$dom = $wgParser->preprocessToDom( $params['text'] );
if ( is_callable( array( $dom, 'saveXML' ) ) ) {
@@ -81,9 +82,9 @@ class ApiExpandTemplates extends ApiBase {
}
public function getAllowedParams() {
- return array (
+ return array(
'title' => array(
- ApiBase :: PARAM_DFLT => 'API',
+ ApiBase::PARAM_DFLT => 'API',
),
'text' => null,
'generatexml' => false,
@@ -91,7 +92,7 @@ class ApiExpandTemplates extends ApiBase {
}
public function getParamDescription() {
- return array (
+ return array(
'text' => 'Wikitext to convert',
'title' => 'Title of page',
'generatexml' => 'Generate XML parse tree',
@@ -103,12 +104,12 @@ class ApiExpandTemplates extends ApiBase {
}
protected function getExamples() {
- return array (
+ return array(
'api.php?action=expandtemplates&text={{Project:Sandbox}}'
);
}
public function getVersion() {
- return __CLASS__ . ': $Id: ApiExpandTemplates.php 69932 2010-07-26 08:03:21Z tstarling $';
+ return __CLASS__ . ': $Id: ApiExpandTemplates.php 70647 2010-08-07 19:59:42Z ialex $';
}
}