Index: trunk/phase3/includes/api/ApiFormatWddx.php |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -/* |
| 4 | +/** |
5 | 5 | * Created on Oct 22, 2006 |
6 | 6 | * |
7 | 7 | * API for MediaWiki 1.8+ |
8 | 8 | * |
9 | | - * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com |
| 9 | + * Copyright © 2006 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 ( 'ApiFormatBase.php' ); |
| 29 | + require_once( 'ApiFormatBase.php' ); |
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | class ApiFormatWddx extends ApiFormatBase { |
36 | 36 | |
37 | 37 | public function __construct( $main, $format ) { |
38 | | - parent :: __construct( $main, $format ); |
| 38 | + parent::__construct( $main, $format ); |
39 | 39 | } |
40 | 40 | |
41 | 41 | public function getMimeType() { |
— | — | @@ -53,8 +53,8 @@ |
54 | 54 | } else { |
55 | 55 | // Don't do newlines and indentation if we weren't asked |
56 | 56 | // for pretty output |
57 | | - $nl = ( $this->getIsHtml() ? "" : "\n" ); |
58 | | - $indstr = " "; |
| 57 | + $nl = ( $this->getIsHtml() ? '' : "\n" ); |
| 58 | + $indstr = ' '; |
59 | 59 | $this->printText( "<?xml version=\"1.0\"?>$nl" ); |
60 | 60 | $this->printText( "<wddxPacket version=\"1.0\">$nl" ); |
61 | 61 | $this->printText( "$indstr<header/>$nl" ); |
— | — | @@ -69,11 +69,11 @@ |
70 | 70 | * Recursively go through the object and output its data in WDDX format. |
71 | 71 | */ |
72 | 72 | function slowWddxPrinter( $elemValue, $indent = 0 ) { |
73 | | - $indstr = ( $this->getIsHtml() ? "" : str_repeat( ' ', $indent ) ); |
74 | | - $indstr2 = ( $this->getIsHtml() ? "" : str_repeat( ' ', $indent + 2 ) ); |
75 | | - $nl = ( $this->getIsHtml() ? "" : "\n" ); |
| 73 | + $indstr = ( $this->getIsHtml() ? '' : str_repeat( ' ', $indent ) ); |
| 74 | + $indstr2 = ( $this->getIsHtml() ? '' : str_repeat( ' ', $indent + 2 ) ); |
| 75 | + $nl = ( $this->getIsHtml() ? '' : "\n" ); |
76 | 76 | switch ( gettype( $elemValue ) ) { |
77 | | - case 'array' : |
| 77 | + case 'array': |
78 | 78 | // Check whether we've got an associative array (<struct>) |
79 | 79 | // or a regular array (<array>) |
80 | 80 | $cnt = count( $elemValue ); |
— | — | @@ -81,8 +81,9 @@ |
82 | 82 | // Regular array |
83 | 83 | $this->printText( $indstr . Xml::element( 'array', array( |
84 | 84 | 'length' => $cnt ), null ) . $nl ); |
85 | | - foreach ( $elemValue as $subElemValue ) |
| 85 | + foreach ( $elemValue as $subElemValue ) { |
86 | 86 | $this->slowWddxPrinter( $subElemValue, $indent + 2 ); |
| 87 | + } |
87 | 88 | $this->printText( "$indstr</array>$nl" ); |
88 | 89 | } else { |
89 | 90 | // Associative array (<struct>) |
— | — | @@ -97,20 +98,20 @@ |
98 | 99 | $this->printText( "$indstr</struct>$nl" ); |
99 | 100 | } |
100 | 101 | break; |
101 | | - case 'integer' : |
102 | | - case 'double' : |
| 102 | + case 'integer': |
| 103 | + case 'double': |
103 | 104 | $this->printText( $indstr . Xml::element( 'number', null, $elemValue ) . $nl ); |
104 | 105 | break; |
105 | | - case 'string' : |
| 106 | + case 'string': |
106 | 107 | $this->printText( $indstr . Xml::element( 'string', null, $elemValue ) . $nl ); |
107 | 108 | break; |
108 | | - default : |
109 | | - ApiBase :: dieDebug( __METHOD__, 'Unknown type ' . gettype( $elemValue ) ); |
| 109 | + default: |
| 110 | + ApiBase::dieDebug( __METHOD__, 'Unknown type ' . gettype( $elemValue ) ); |
110 | 111 | } |
111 | 112 | } |
112 | 113 | |
113 | 114 | public function getDescription() { |
114 | | - return 'Output data in WDDX format' . parent :: getDescription(); |
| 115 | + return 'Output data in WDDX format' . parent::getDescription(); |
115 | 116 | } |
116 | 117 | |
117 | 118 | public function getVersion() { |
Index: trunk/phase3/includes/api/ApiFormatPhp.php |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -/* |
| 4 | +/** |
5 | 5 | * Created on Oct 22, 2006 |
6 | 6 | * |
7 | 7 | * API for MediaWiki 1.8+ |
8 | 8 | * |
9 | | - * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com |
| 9 | + * Copyright © 2006 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 ( 'ApiFormatBase.php' ); |
| 29 | + require_once( 'ApiFormatBase.php' ); |
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | class ApiFormatPhp extends ApiFormatBase { |
36 | 36 | |
37 | 37 | public function __construct( $main, $format ) { |
38 | | - parent :: __construct( $main, $format ); |
| 38 | + parent::__construct( $main, $format ); |
39 | 39 | } |
40 | 40 | |
41 | 41 | public function getMimeType() { |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | } |
48 | 48 | |
49 | 49 | public function getDescription() { |
50 | | - return 'Output data in serialized PHP format' . parent :: getDescription(); |
| 50 | + return 'Output data in serialized PHP format' . parent::getDescription(); |
51 | 51 | } |
52 | 52 | |
53 | 53 | public function getVersion() { |
Index: trunk/phase3/includes/api/ApiFormatBase.php |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -/* |
| 4 | +/** |
5 | 5 | * Created on Sep 19, 2006 |
6 | 6 | * |
7 | 7 | * API for MediaWiki 1.8+ |
8 | 8 | * |
9 | | - * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com |
| 9 | + * Copyright © 2006 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 | /** |
— | — | @@ -45,13 +45,14 @@ |
46 | 46 | * @param $format string Format name |
47 | 47 | */ |
48 | 48 | public function __construct( $main, $format ) { |
49 | | - parent :: __construct( $main, $format ); |
| 49 | + parent::__construct( $main, $format ); |
50 | 50 | |
51 | 51 | $this->mIsHtml = ( substr( $format, - 2, 2 ) === 'fm' ); // ends with 'fm' |
52 | | - if ( $this->mIsHtml ) |
| 52 | + if ( $this->mIsHtml ) { |
53 | 53 | $this->mFormat = substr( $format, 0, - 2 ); // remove ending 'fm' |
54 | | - else |
| 54 | + } else { |
55 | 55 | $this->mFormat = $format; |
| 56 | + } |
56 | 57 | $this->mFormat = strtoupper( $this->mFormat ); |
57 | 58 | $this->mCleared = false; |
58 | 59 | } |
— | — | @@ -125,8 +126,9 @@ |
126 | 127 | |
127 | 128 | // Some printers (ex. Feed) do their own header settings, |
128 | 129 | // in which case $mime will be set to null |
129 | | - if ( is_null( $mime ) ) |
| 130 | + if ( is_null( $mime ) ) { |
130 | 131 | return; // skip any initialization |
| 132 | + } |
131 | 133 | |
132 | 134 | header( "Content-Type: $mime; charset=utf-8" ); |
133 | 135 | |
— | — | @@ -197,8 +199,7 @@ |
198 | 200 | // For non-HTML output, clear all errors that might have been |
199 | 201 | // displayed if display_errors=On |
200 | 202 | // Do this only once, of course |
201 | | - if ( !$this->mCleared ) |
202 | | - { |
| 203 | + if ( !$this->mCleared ) { |
203 | 204 | ob_clean(); |
204 | 205 | $this->mCleared = true; |
205 | 206 | } |
— | — | @@ -228,11 +229,11 @@ |
229 | 230 | } |
230 | 231 | |
231 | 232 | /** |
232 | | - * Prety-print various elements in HTML format, such as xml tags and |
233 | | - * URLs. This method also escapes characters like < |
234 | | - * @param $text string |
235 | | - * @return string |
236 | | - */ |
| 233 | + * Pretty-print various elements in HTML format, such as xml tags and |
| 234 | + * URLs. This method also escapes characters like < |
| 235 | + * @param $text string |
| 236 | + * @return string |
| 237 | + */ |
237 | 238 | protected function formatHTML( $text ) { |
238 | 239 | global $wgUrlProtocols; |
239 | 240 | |
— | — | @@ -254,12 +255,15 @@ |
255 | 256 | $text = preg_replace( "#\\$[^<>\n]+\\$#", '<b><i>\\0</i></b>', $text ); |
256 | 257 | } |
257 | 258 | |
258 | | - /* Temporary fix for bad links in help messages. As a special case, |
| 259 | + /** |
| 260 | + * Temporary fix for bad links in help messages. As a special case, |
259 | 261 | * XML-escaped metachars are de-escaped one level in the help message |
260 | | - * for legibility. Should be removed once we have completed a fully-html |
261 | | - * version of the help message. */ |
262 | | - if ( $this->mUnescapeAmps ) |
| 262 | + * for legibility. Should be removed once we have completed a fully-HTML |
| 263 | + * version of the help message. |
| 264 | + */ |
| 265 | + if ( $this->mUnescapeAmps ) { |
263 | 266 | $text = preg_replace( '/&(amp|quot|lt|gt);/', '&\1;', $text ); |
| 267 | + } |
264 | 268 | |
265 | 269 | return $text; |
266 | 270 | } |
— | — | @@ -284,7 +288,7 @@ |
285 | 289 | class ApiFormatFeedWrapper extends ApiFormatBase { |
286 | 290 | |
287 | 291 | public function __construct( $main ) { |
288 | | - parent :: __construct( $main, 'feed' ); |
| 292 | + parent::__construct( $main, 'feed' ); |
289 | 293 | } |
290 | 294 | |
291 | 295 | /** |
— | — | @@ -326,13 +330,14 @@ |
327 | 331 | */ |
328 | 332 | public function execute() { |
329 | 333 | $data = $this->getResultData(); |
330 | | - if ( isset ( $data['_feed'] ) && isset ( $data['_feeditems'] ) ) { |
| 334 | + if ( isset( $data['_feed'] ) && isset( $data['_feeditems'] ) ) { |
331 | 335 | $feed = $data['_feed']; |
332 | 336 | $items = $data['_feeditems']; |
333 | 337 | |
334 | 338 | $feed->outHeader(); |
335 | | - foreach ( $items as & $item ) |
| 339 | + foreach ( $items as & $item ) { |
336 | 340 | $feed->outItem( $item ); |
| 341 | + } |
337 | 342 | $feed->outFooter(); |
338 | 343 | } else { |
339 | 344 | // Error has occured, print something useful |
Index: trunk/phase3/includes/api/ApiFormatTxt.php |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -/* |
| 4 | +/** |
5 | 5 | * Created on Oct 22, 2006 |
6 | 6 | * |
7 | 7 | * API for MediaWiki 1.8+ |
8 | 8 | * |
9 | | - * Copyright (C) 2008 Roan Kattouw <Firstname>.<Lastname>@home.nl |
| 9 | + * Copyright © 2008 Roan Kattouw <Firstname>.<Lastname>@home.nl |
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 ( 'ApiFormatBase.php' ); |
| 29 | + require_once( 'ApiFormatBase.php' ); |
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | class ApiFormatTxt extends ApiFormatBase { |
36 | 36 | |
37 | 37 | public function __construct( $main, $format ) { |
38 | | - parent :: __construct( $main, $format ); |
| 38 | + parent::__construct( $main, $format ); |
39 | 39 | } |
40 | 40 | |
41 | 41 | public function getMimeType() { |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | } |
51 | 51 | |
52 | 52 | public function getDescription() { |
53 | | - return 'Output data in PHP\'s print_r() format' . parent :: getDescription(); |
| 53 | + return 'Output data in PHP\'s print_r() format' . parent::getDescription(); |
54 | 54 | } |
55 | 55 | |
56 | 56 | public function getVersion() { |
Index: trunk/phase3/includes/api/ApiFormatRaw.php |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -/* |
| 4 | +/** |
5 | 5 | * Created on Feb 2, 2009 |
6 | 6 | * |
7 | 7 | * API for MediaWiki 1.8+ |
8 | 8 | * |
9 | | - * Copyright (C) 2009 Roan Kattouw <Firstname>.<Lastname>@home.nl |
| 9 | + * Copyright © 2009 Roan Kattouw <Firstname>.<Lastname>@home.nl |
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 ( 'ApiFormatBase.php' ); |
| 29 | + require_once( 'ApiFormatBase.php' ); |
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
— | — | @@ -40,32 +40,34 @@ |
41 | 41 | * @param $errorFallback Formatter object to fall back on for errors |
42 | 42 | */ |
43 | 43 | public function __construct( $main, $errorFallback ) { |
44 | | - parent :: __construct( $main, 'raw' ); |
| 44 | + parent::__construct( $main, 'raw' ); |
45 | 45 | $this->mErrorFallback = $errorFallback; |
46 | 46 | } |
47 | 47 | |
48 | 48 | public function getMimeType() { |
49 | 49 | $data = $this->getResultData(); |
50 | 50 | |
51 | | - if ( isset( $data['error'] ) ) |
| 51 | + if ( isset( $data['error'] ) ) { |
52 | 52 | return $this->mErrorFallback->getMimeType(); |
| 53 | + } |
53 | 54 | |
54 | | - if ( !isset( $data['mime'] ) ) |
55 | | - ApiBase::dieDebug( __METHOD__, "No MIME type set for raw formatter" ); |
56 | | - |
| 55 | + if ( !isset( $data['mime'] ) ) { |
| 56 | + ApiBase::dieDebug( __METHOD__, 'No MIME type set for raw formatter' ); |
| 57 | + } |
| 58 | + |
57 | 59 | return $data['mime']; |
58 | 60 | } |
59 | 61 | |
60 | 62 | public function execute() { |
61 | 63 | $data = $this->getResultData(); |
62 | | - if ( isset( $data['error'] ) ) |
63 | | - { |
| 64 | + if ( isset( $data['error'] ) ) { |
64 | 65 | $this->mErrorFallback->execute(); |
65 | 66 | return; |
66 | 67 | } |
67 | | - |
68 | | - if ( !isset( $data['text'] ) ) |
69 | | - ApiBase::dieDebug( __METHOD__, "No text given for raw formatter" ); |
| 68 | + |
| 69 | + if ( !isset( $data['text'] ) ) { |
| 70 | + ApiBase::dieDebug( __METHOD__, 'No text given for raw formatter' ); |
| 71 | + } |
70 | 72 | $this->printText( $data['text'] ); |
71 | 73 | } |
72 | 74 | |
Index: trunk/phase3/includes/api/ApiFormatDbg.php |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -/* |
| 4 | +/** |
5 | 5 | * Created on Oct 22, 2006 |
6 | 6 | * |
7 | 7 | * API for MediaWiki 1.8+ |
8 | 8 | * |
9 | | - * Copyright (C) 2008 Roan Kattouw <Firstname>.<Lastname>@home.nl |
| 9 | + * Copyright © 2008 Roan Kattouw <Firstname>.<Lastname>@home.nl |
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 ( 'ApiFormatBase.php' ); |
| 29 | + require_once( 'ApiFormatBase.php' ); |
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | class ApiFormatDbg extends ApiFormatBase { |
36 | 36 | |
37 | 37 | public function __construct( $main, $format ) { |
38 | | - parent :: __construct( $main, $format ); |
| 38 | + parent::__construct( $main, $format ); |
39 | 39 | } |
40 | 40 | |
41 | 41 | public function getMimeType() { |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | } |
51 | 51 | |
52 | 52 | public function getDescription() { |
53 | | - return 'Output data in PHP\'s var_export() format' . parent :: getDescription(); |
| 53 | + return 'Output data in PHP\'s var_export() format' . parent::getDescription(); |
54 | 54 | } |
55 | 55 | |
56 | 56 | public function getVersion() { |
Index: trunk/phase3/includes/api/ApiFormatJson.php |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -/* |
| 4 | +/** |
5 | 5 | * Created on Sep 19, 2006 |
6 | 6 | * |
7 | 7 | * API for MediaWiki 1.8+ |
8 | 8 | * |
9 | | - * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com |
| 9 | + * Copyright © 2006 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 ( 'ApiFormatBase.php' ); |
| 29 | + require_once( 'ApiFormatBase.php' ); |
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | private $mIsRaw; |
38 | 38 | |
39 | 39 | public function __construct( $main, $format ) { |
40 | | - parent :: __construct( $main, $format ); |
| 40 | + parent::__construct( $main, $format ); |
41 | 41 | $this->mIsRaw = ( $format === 'rawfm' ); |
42 | 42 | } |
43 | 43 | |
— | — | @@ -59,37 +59,39 @@ |
60 | 60 | } |
61 | 61 | |
62 | 62 | public function execute() { |
63 | | - $prefix = $suffix = ""; |
| 63 | + $prefix = $suffix = ''; |
64 | 64 | |
65 | 65 | $params = $this->extractRequestParams(); |
66 | 66 | $callback = $params['callback']; |
67 | 67 | if ( !is_null( $callback ) ) { |
68 | | - $prefix = preg_replace( "/[^][.\\'\\\"_A-Za-z0-9]/", "", $callback ) . "("; |
69 | | - $suffix = ")"; |
| 68 | + $prefix = preg_replace( "/[^][.\\'\\\"_A-Za-z0-9]/", '', $callback ) . '('; |
| 69 | + $suffix = ')'; |
70 | 70 | } |
71 | 71 | $this->printText( |
72 | 72 | $prefix . |
73 | 73 | FormatJson::encode( $this->getResultData(), $this->getIsHtml() ) . |
74 | | - $suffix ); |
| 74 | + $suffix |
| 75 | + ); |
75 | 76 | } |
76 | 77 | |
77 | 78 | public function getAllowedParams() { |
78 | | - return array ( |
| 79 | + return array( |
79 | 80 | 'callback' => null, |
80 | 81 | ); |
81 | 82 | } |
82 | 83 | |
83 | 84 | public function getParamDescription() { |
84 | | - return array ( |
| 85 | + return array( |
85 | 86 | 'callback' => 'If specified, wraps the output into a given function call. For safety, all user-specific data will be restricted.', |
86 | 87 | ); |
87 | 88 | } |
88 | 89 | |
89 | 90 | public function getDescription() { |
90 | | - if ( $this->mIsRaw ) |
91 | | - return 'Output data with the debuging elements in JSON format' . parent :: getDescription(); |
92 | | - else |
93 | | - return 'Output data in JSON format' . parent :: getDescription(); |
| 91 | + if ( $this->mIsRaw ) { |
| 92 | + return 'Output data with the debuging elements in JSON format' . parent::getDescription(); |
| 93 | + } else { |
| 94 | + return 'Output data in JSON format' . parent::getDescription(); |
| 95 | + } |
94 | 96 | } |
95 | 97 | |
96 | 98 | public function getVersion() { |
Index: trunk/phase3/includes/api/ApiFeedWatchlist.php |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -/* |
| 4 | +/** |
5 | 5 | * Created on Oct 13, 2006 |
6 | 6 | * |
7 | 7 | * API for MediaWiki 1.8+ |
8 | 8 | * |
9 | | - * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com |
| 9 | + * Copyright © 2006 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 ApiFeedWatchlist 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 | /** |
— | — | @@ -53,7 +53,6 @@ |
54 | 54 | * Wrap the result as an RSS/Atom feed. |
55 | 55 | */ |
56 | 56 | public function execute() { |
57 | | - |
58 | 57 | global $wgFeedClasses, $wgFeedLimit, $wgSitename, $wgContLanguageCode; |
59 | 58 | |
60 | 59 | try { |
— | — | @@ -64,13 +63,13 @@ |
65 | 64 | |
66 | 65 | $dbr = wfGetDB( DB_SLAVE ); |
67 | 66 | // Prepare parameters for nested request |
68 | | - $fauxReqArr = array ( |
| 67 | + $fauxReqArr = array( |
69 | 68 | 'action' => 'query', |
70 | 69 | 'meta' => 'siteinfo', |
71 | 70 | 'siprop' => 'general', |
72 | 71 | 'list' => 'watchlist', |
73 | 72 | 'wlprop' => 'title|user|comment|timestamp', |
74 | | - 'wldir' => 'older', // reverse order - from newest to oldest |
| 73 | + 'wldir' => 'older', // reverse order - from newest to oldest |
75 | 74 | 'wlend' => $dbr->timestamp( $endTime ), // stop at this time |
76 | 75 | 'wllimit' => ( 50 > $wgFeedLimit ) ? $wgFeedLimit : 50 |
77 | 76 | ); |
— | — | @@ -83,12 +82,12 @@ |
84 | 83 | } |
85 | 84 | |
86 | 85 | // Check for 'allrev' parameter, and if found, show all revisions to each page on wl. |
87 | | - if ( !is_null ( $params['allrev'] ) ) { |
| 86 | + if ( !is_null( $params['allrev'] ) ) { |
88 | 87 | $fauxReqArr['wlallrev'] = ''; |
89 | 88 | } |
90 | 89 | |
91 | 90 | // Create the request |
92 | | - $fauxReq = new FauxRequest ( $fauxReqArr ); |
| 91 | + $fauxReq = new FauxRequest( $fauxReqArr ); |
93 | 92 | |
94 | 93 | // Execute |
95 | 94 | $module = new ApiMain( $fauxReq ); |
— | — | @@ -103,11 +102,11 @@ |
104 | 103 | } |
105 | 104 | |
106 | 105 | $feedTitle = $wgSitename . ' - ' . wfMsgForContent( 'watchlist' ) . ' [' . $wgContLanguageCode . ']'; |
107 | | - $feedUrl = SpecialPage::getTitleFor( 'Watchlist' )->getFullUrl(); |
| 106 | + $feedUrl = SpecialPage::getTitleFor( 'Watchlist' )->getFullURL(); |
108 | 107 | |
109 | 108 | $feed = new $wgFeedClasses[$params['feedformat']] ( $feedTitle, htmlspecialchars( wfMsgForContent( 'watchlist' ) ), $feedUrl ); |
110 | 109 | |
111 | | - ApiFormatFeedWrapper :: setResult( $this->getResult(), $feed, $feedItems ); |
| 110 | + ApiFormatFeedWrapper::setResult( $this->getResult(), $feed, $feedItems ); |
112 | 111 | |
113 | 112 | } catch ( Exception $e ) { |
114 | 113 | |
— | — | @@ -115,7 +114,7 @@ |
116 | 115 | $this->getMain()->setCacheMaxAge( 0 ); |
117 | 116 | |
118 | 117 | $feedTitle = $wgSitename . ' - Error - ' . wfMsgForContent( 'watchlist' ) . ' [' . $wgContLanguageCode . ']'; |
119 | | - $feedUrl = SpecialPage::getTitleFor( 'Watchlist' )->getFullUrl(); |
| 118 | + $feedUrl = SpecialPage::getTitleFor( 'Watchlist' )->getFullURL(); |
120 | 119 | |
121 | 120 | $feedFormat = isset( $params['feedformat'] ) ? $params['feedformat'] : 'rss'; |
122 | 121 | $feed = new $wgFeedClasses[$feedFormat] ( $feedTitle, htmlspecialchars( wfMsgForContent( 'watchlist' ) ), $feedUrl ); |
— | — | @@ -128,15 +127,15 @@ |
129 | 128 | } |
130 | 129 | |
131 | 130 | $errorText = $e->getMessage(); |
132 | | - $feedItems[] = new FeedItem( "Error ($errorCode)", $errorText, "", "", "" ); |
133 | | - ApiFormatFeedWrapper :: setResult( $this->getResult(), $feed, $feedItems ); |
| 131 | + $feedItems[] = new FeedItem( "Error ($errorCode)", $errorText, '', '', '' ); |
| 132 | + ApiFormatFeedWrapper::setResult( $this->getResult(), $feed, $feedItems ); |
134 | 133 | } |
135 | 134 | } |
136 | 135 | |
137 | 136 | private function createFeedItem( $info ) { |
138 | 137 | $titleStr = $info['title']; |
139 | | - $title = Title :: newFromText( $titleStr ); |
140 | | - $titleUrl = $title->getFullUrl(); |
| 138 | + $title = Title::newFromText( $titleStr ); |
| 139 | + $titleUrl = $title->getFullURL(); |
141 | 140 | $comment = isset( $info['comment'] ) ? $info['comment'] : null; |
142 | 141 | $timestamp = $info['timestamp']; |
143 | 142 | $user = $info['user']; |
— | — | @@ -150,28 +149,28 @@ |
151 | 150 | global $wgFeedClasses; |
152 | 151 | $feedFormatNames = array_keys( $wgFeedClasses ); |
153 | 152 | return array ( |
154 | | - 'feedformat' => array ( |
155 | | - ApiBase :: PARAM_DFLT => 'rss', |
156 | | - ApiBase :: PARAM_TYPE => $feedFormatNames |
| 153 | + 'feedformat' => array( |
| 154 | + ApiBase::PARAM_DFLT => 'rss', |
| 155 | + ApiBase::PARAM_TYPE => $feedFormatNames |
157 | 156 | ), |
158 | | - 'hours' => array ( |
159 | | - ApiBase :: PARAM_DFLT => 24, |
160 | | - ApiBase :: PARAM_TYPE => 'integer', |
161 | | - ApiBase :: PARAM_MIN => 1, |
162 | | - ApiBase :: PARAM_MAX => 72, |
| 157 | + 'hours' => array( |
| 158 | + ApiBase::PARAM_DFLT => 24, |
| 159 | + ApiBase::PARAM_TYPE => 'integer', |
| 160 | + ApiBase::PARAM_MIN => 1, |
| 161 | + ApiBase::PARAM_MAX => 72, |
163 | 162 | ), |
164 | 163 | 'allrev' => null, |
165 | | - 'wlowner' => array ( |
166 | | - ApiBase :: PARAM_TYPE => 'user' |
| 164 | + 'wlowner' => array( |
| 165 | + ApiBase::PARAM_TYPE => 'user' |
167 | 166 | ), |
168 | | - 'wltoken' => array ( |
169 | | - ApiBase :: PARAM_TYPE => 'string' |
| 167 | + 'wltoken' => array( |
| 168 | + ApiBase::PARAM_TYPE => 'string' |
170 | 169 | ) |
171 | 170 | ); |
172 | 171 | } |
173 | 172 | |
174 | 173 | public function getParamDescription() { |
175 | | - return array ( |
| 174 | + return array( |
176 | 175 | 'feedformat' => 'The format of the feed', |
177 | 176 | 'hours' => 'List pages modified within this many hours from now', |
178 | 177 | 'allrev' => 'Include multiple revisions of the same page within given timeframe.', |
— | — | @@ -185,7 +184,7 @@ |
186 | 185 | } |
187 | 186 | |
188 | 187 | protected function getExamples() { |
189 | | - return array ( |
| 188 | + return array( |
190 | 189 | 'api.php?action=feedwatchlist' |
191 | 190 | ); |
192 | 191 | } |