Index: trunk/phase3/includes/api/ApiExpandTemplates.php |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -/* |
| 4 | +/** |
5 | 5 | * Created on Oct 05, 2007 |
6 | 6 | * |
7 | 7 | * API for MediaWiki 1.8+ |
8 | 8 | * |
9 | | - * Copyright (C) 2007 Yuri Astrakhan <Firstname><Lastname>@gmail.com |
| 9 | + * Copyright © 2007 Yuri Astrakhan <Firstname><Lastname>@gmail.com |
10 | 10 | * |
11 | 11 | * This program is free software; you can redistribute it and/or modify |
12 | 12 | * it under the terms of the GNU General Public License as published by |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | |
27 | 27 | if ( !defined( 'MEDIAWIKI' ) ) { |
28 | 28 | // Eclipse helper - will be ignored in production |
29 | | - require_once ( "ApiBase.php" ); |
| 29 | + require_once( "ApiBase.php" ); |
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
— | — | @@ -38,7 +38,7 @@ |
39 | 39 | class ApiExpandTemplates extends ApiBase { |
40 | 40 | |
41 | 41 | public function __construct( $main, $action ) { |
42 | | - parent :: __construct( $main, $action ); |
| 42 | + parent::__construct( $main, $action ); |
43 | 43 | } |
44 | 44 | |
45 | 45 | public function execute() { |
— | — | @@ -46,18 +46,18 @@ |
47 | 47 | $params = $this->extractRequestParams(); |
48 | 48 | |
49 | 49 | // Create title for parser |
50 | | - $title_obj = Title :: newFromText( $params['title'] ); |
51 | | - if ( !$title_obj ) |
52 | | - $title_obj = Title :: newFromText( "API" ); // default |
| 50 | + $title_obj = Title::newFromText( $params['title'] ); |
| 51 | + if ( !$title_obj ) { |
| 52 | + $title_obj = Title::newFromText( 'API' ); // default |
| 53 | + } |
53 | 54 | |
54 | 55 | $result = $this->getResult(); |
55 | 56 | |
56 | 57 | // Parse text |
57 | 58 | global $wgParser; |
58 | 59 | $options = new ParserOptions(); |
59 | | - |
60 | | - if ( $params['generatexml'] ) |
61 | | - { |
| 60 | + |
| 61 | + if ( $params['generatexml'] ) { |
62 | 62 | $wgParser->startExternalParse( $title_obj, $options, OT_PREPROCESS ); |
63 | 63 | $dom = $wgParser->preprocessToDom( $params['text'] ); |
64 | 64 | if ( is_callable( array( $dom, 'saveXML' ) ) ) { |
— | — | @@ -78,9 +78,9 @@ |
79 | 79 | } |
80 | 80 | |
81 | 81 | public function getAllowedParams() { |
82 | | - return array ( |
| 82 | + return array( |
83 | 83 | 'title' => array( |
84 | | - ApiBase :: PARAM_DFLT => 'API', |
| 84 | + ApiBase::PARAM_DFLT => 'API', |
85 | 85 | ), |
86 | 86 | 'text' => null, |
87 | 87 | 'generatexml' => false, |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | } |
90 | 90 | |
91 | 91 | public function getParamDescription() { |
92 | | - return array ( |
| 92 | + return array( |
93 | 93 | 'text' => 'Wikitext to convert', |
94 | 94 | 'title' => 'Title of page', |
95 | 95 | 'generatexml' => 'Generate XML parse tree', |
— | — | @@ -100,7 +100,7 @@ |
101 | 101 | } |
102 | 102 | |
103 | 103 | protected function getExamples() { |
104 | | - return array ( |
| 104 | + return array( |
105 | 105 | 'api.php?action=expandtemplates&text={{Project:Sandbox}}' |
106 | 106 | ); |
107 | 107 | } |