Index: trunk/extensions/Awesomeness/Awesomeness.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Initialization file for the Awesomeness extension. |
6 | | - * |
| 6 | + * |
7 | 7 | * Documentation: http://www.mediawiki.org/wiki/Extension:Awesomeness |
8 | 8 | * Support http://www.mediawiki.org/wiki/Extension_talk:Awesomeness |
9 | 9 | * Source code: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Awesomeness |
— | — | @@ -49,13 +49,13 @@ |
50 | 50 | */ |
51 | 51 | if ( array_key_exists( 'QUERY_STRING', $_SERVER ) ) { |
52 | 52 | $O_o = false; |
53 | | - |
| 53 | + |
54 | 54 | if ( strtolower( $_SERVER['QUERY_STRING'] ) == 'isthiswikiawesome' ) { |
55 | 55 | $O_o = 'Hell yeah!'; |
56 | | - } else if ( preg_match( '/^[0o°xt][-_\.][0o°xt]$/i', $_SERVER['QUERY_STRING'] ) ) { |
| 56 | + } elseif ( preg_match( '/^[0o°xt][-_\.][0o°xt]$/i', $_SERVER['QUERY_STRING'] ) ) { |
57 | 57 | $O_o = strrev( $_SERVER['QUERY_STRING'] ); |
58 | 58 | } |
59 | | - |
| 59 | + |
60 | 60 | if ( $O_o ) { |
61 | 61 | header( 'Content-Type: text/plain' ); |
62 | 62 | die( $O_o ); |
Index: trunk/extensions/ContactPage/SpecialContact.php |
— | — | @@ -110,7 +110,7 @@ |
111 | 111 | |
112 | 112 | $this->wasPosted = $wgRequest->wasPosted(); |
113 | 113 | $this->formType = $wgRequest->getText( 'formtype', $par ); |
114 | | - |
| 114 | + |
115 | 115 | # Check for type in [[Special:Contact/type]]: change pagetext and prefill form fields |
116 | 116 | if ( $this->formType != '' ) { |
117 | 117 | $message = 'contactpage-pagetext-' . $this->formType; |
— | — | @@ -136,7 +136,7 @@ |
137 | 137 | } else { |
138 | 138 | $this->text = $wgRequest->getText( 'wpText' ); |
139 | 139 | } |
140 | | - } else { |
| 140 | + } else { |
141 | 141 | $this->formularText = wfMsgExt( 'contactpage-pagetext', 'parse' ); |
142 | 142 | $this->text = $wgRequest->getText( 'wpText' ); |
143 | 143 | $this->subject = $wgRequest->getText( 'wpSubject' ); |
— | — | @@ -274,7 +274,7 @@ |
275 | 275 | '</td> |
276 | 276 | </tr>'; |
277 | 277 | } |
278 | | - |
| 278 | + |
279 | 279 | $ccme = $this->wasPosted ? $this->cc_me : $wgUser->getBoolOption( 'ccmeonemails' ); |
280 | 280 | $form .= '<tr> |
281 | 281 | <td></td> |
— | — | @@ -380,7 +380,7 @@ |
381 | 381 | } else { |
382 | 382 | $subject = wfMsgForContent( 'contactpage-subject-and-sender', $subject, $this->fromaddress ); |
383 | 383 | } |
384 | | - } else if ( $includeIP ) { |
| 384 | + } elseif ( $includeIP ) { |
385 | 385 | $subject = wfMsgForContent( 'contactpage-subject-and-sender', $subject, $senderIP ); |
386 | 386 | } |
387 | 387 | |
Index: trunk/extensions/Call/Call_body.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | class Call extends SpecialPage { |
33 | 33 | function __construct() { |
34 | 34 | parent::__construct( "Call" ); |
35 | | - |
| 35 | + |
36 | 36 | } |
37 | 37 | |
38 | 38 | |
— | — | @@ -63,7 +63,7 @@ |
64 | 64 | } |
65 | 65 | if ( $argKey == 'title' ) { |
66 | 66 | $argTitle = $n; |
67 | | - } else if ( $argTitle >= 0 ) { |
| 67 | + } elseif ( $argTitle >= 0 ) { |
68 | 68 | if ( preg_match( '/(UserName|UserID|_session|Token)$/', $argKey ) ) { |
69 | 69 | break; |
70 | 70 | } |
— | — | @@ -144,7 +144,7 @@ |
145 | 145 | $template = preg_replace( '/\|.*/', '', $wikitext ); |
146 | 146 | if ( strpos( ':', $template ) === false ) { |
147 | 147 | $template = 'Template:' . $template; |
148 | | - } else if ( $template[0] == ':' ) { |
| 148 | + } elseif ( $template[0] == ':' ) { |
149 | 149 | $template = substr( $template, 1 ); |
150 | 150 | } |
151 | 151 | $title = Title::newFromText( $template ); |
— | — | @@ -159,7 +159,7 @@ |
160 | 160 | if ( $wikitext == '' || $wikitext == 'Special:Call' ) { |
161 | 161 | // Called without parameters: dump explanation |
162 | 162 | $wgOut->addHTML( wfMsg( 'call-text' ) ); |
163 | | - } else if ( $debug ) { |
| 163 | + } elseif ( $debug ) { |
164 | 164 | // Called with DebuG target: dump parameter list |
165 | 165 | $wgOut->addHTML( "<pre>\n{{" . $wikitext . "}}\n</pre>" ); |
166 | 166 | if ( $saveAsPage != '' ) { |
— | — | @@ -233,18 +233,18 @@ |
234 | 234 | $n = -1; |
235 | 235 | $tpl = $field[0]; |
236 | 236 | $field[0] = 'ID'; |
237 | | - } else if ( strpos( $line, '|' ) == 0 ) { |
| 237 | + } elseif ( strpos( $line, '|' ) == 0 ) { |
238 | 238 | $n++; |
239 | 239 | $field[$n] = substr( $line, 1 ); |
240 | 240 | } |
241 | | - } else if ( strpos( $line, '|-' ) !== false ) { |
| 241 | + } elseif ( strpos( $line, '|-' ) !== false ) { |
242 | 242 | $n = -1; |
243 | | - } else if ( strpos( $line, '|}' ) !== false ) { |
| 243 | + } elseif ( strpos( $line, '|}' ) !== false ) { |
244 | 244 | $text[] = '}}'; |
245 | 245 | break; |
246 | | - } else if ( $line == '' ) { |
| 246 | + } elseif ( $line == '' ) { |
247 | 247 | $text[] = ''; |
248 | | - } else if ( $line[0] == '|' ) { |
| 248 | + } elseif ( $line[0] == '|' ) { |
249 | 249 | $n++; |
250 | 250 | if ( $n == 0 ) { |
251 | 251 | if ( $head ) { |
Index: trunk/extensions/Configure/settings/WebExtension.php |
— | — | @@ -177,7 +177,7 @@ |
178 | 178 | /** |
179 | 179 | * Prettify boolean settings to be correctly displayed |
180 | 180 | * |
181 | | - * @return String |
| 181 | + * @return String |
182 | 182 | */ |
183 | 183 | public static function prettifyForDisplay( $val ) { |
184 | 184 | if ( is_bool( $val ) ) |
— | — | @@ -277,7 +277,7 @@ |
278 | 278 | $actual = $conf[$setting]; |
279 | 279 | else |
280 | 280 | $actual = $GLOBALS[$setting]; |
281 | | - |
| 281 | + |
282 | 282 | if ( $actual !== $value ) { |
283 | 283 | $ret[] = array( $setting, $value, $actual ); |
284 | 284 | } |
— | — | @@ -333,7 +333,7 @@ |
334 | 334 | public function isActivated() { |
335 | 335 | if( $this->mTempActivated !== null ) { |
336 | 336 | return $this->mTempActivated; |
337 | | - } else if( $this->useVariable() ) { |
| 337 | + } elseif( $this->useVariable() ) { |
338 | 338 | return isset( $GLOBALS[$this->getVariable()] ) && $GLOBALS[$this->getVariable()]; |
339 | 339 | } else { |
340 | 340 | global $wgConf; |
Index: trunk/extensions/Configure/specials/ConfigurationPage.php |
— | — | @@ -396,7 +396,7 @@ |
397 | 397 | if( !$data['userwiki'] || !$data['username'] ) { |
398 | 398 | $userLink = ''; |
399 | 399 | $username = ''; |
400 | | - } else if ( $data['userwiki'] == wfWikiId() ) { |
| 400 | + } elseif ( $data['userwiki'] == wfWikiId() ) { |
401 | 401 | $userLink = $skin->link( Title::makeTitle( NS_USER, $data['username'] ), htmlspecialchars( $data['username'] ) ); |
402 | 402 | $username = $data['username']; |
403 | 403 | } elseif ( $wiki = WikiMap::getWiki( $data['userwiki'] ) ) { |
— | — | @@ -595,7 +595,7 @@ |
596 | 596 | } |
597 | 597 | if ( $val ) |
598 | 598 | $settings[$name][$group][$right] = true; |
599 | | - } else if ( $wgRequest->getCheck( $id ) ) { |
| 599 | + } elseif ( $wgRequest->getCheck( $id ) ) { |
600 | 600 | $settings[$name][$group][] = $right; |
601 | 601 | } |
602 | 602 | } |
— | — | @@ -1378,7 +1378,7 @@ |
1379 | 1379 | } |
1380 | 1380 | |
1381 | 1381 | $row .= Html::openElement( 'table', array( 'class' => 'configure-table-promotion' ) ); |
1382 | | - |
| 1382 | + |
1383 | 1383 | $row .= Html::rawElement( 'tr', array(), Html::element( 'th', array(), wfMsg( 'configure-condition-name' ) ) . |
1384 | 1384 | Html::element( 'th', array(), wfMsg( 'configure-condition-requirement' ) ) )."\n"; |
1385 | 1385 | foreach ( $conds as $condName => $condType ) { |
— | — | @@ -1431,7 +1431,7 @@ |
1432 | 1432 | */ |
1433 | 1433 | public static function buildGroupSettingRow( $conf, $type, $all, $allowed, $group, $levs ){ |
1434 | 1434 | $attr = ( !$allowed ) ? array( 'disabled' => 'disabled' ) : array(); |
1435 | | - |
| 1435 | + |
1436 | 1436 | $row = Html::openElement( 'div', array( 'class' => 'configure-biglist '.$type.'-element' ) ) . Html::openElement( 'ul' ); |
1437 | 1437 | foreach ( $all as $right ) { |
1438 | 1438 | if ( $type == 'group-bool' ) |
Index: trunk/extensions/Configure/handler/HandlerFiles.php |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | if ( $wgConfigureFilesPath === null ) { |
19 | 19 | global $IP; |
20 | 20 | $wgConfigureFilesPath = "$IP/serialized/"; |
21 | | - } else if ( substr( $wgConfigureFilesPath, -1 ) != '/' && substr( $wgConfigureFilesPath, -1 ) != '\\' ) { |
| 21 | + } elseif ( substr( $wgConfigureFilesPath, -1 ) != '/' && substr( $wgConfigureFilesPath, -1 ) != '\\' ) { |
22 | 22 | $wgConfigureFilesPath .= '/'; |
23 | 23 | } |
24 | 24 | $this->mDir = $wgConfigureFilesPath; |
Index: trunk/extensions/Configure/Configure.diff.php |
— | — | @@ -217,25 +217,25 @@ |
218 | 218 | function getSettingAsArray( $setting, $name, $type ) { |
219 | 219 | if ( $setting === null ) { |
220 | 220 | $val = array(); |
221 | | - } else if ( $type == 'array' ) { |
| 221 | + } elseif ( $type == 'array' ) { |
222 | 222 | if( !is_array( $setting ) ) |
223 | 223 | return array(); |
224 | 224 | $arrType = $this->getArrayType( $name ); |
225 | 225 | if ( $arrType == 'simple' || $arrType == 'ns-simple' ) { |
226 | 226 | $val = array_values( $setting ); |
227 | | - } else if ( $arrType == 'assoc' ) { |
| 227 | + } elseif ( $arrType == 'assoc' ) { |
228 | 228 | $arrVal = array(); |
229 | 229 | foreach ( $setting as $key => $value ) { |
230 | 230 | $arrVal[] = "$key: $value"; |
231 | 231 | } |
232 | 232 | $val = $arrVal; |
233 | | - } else if ( $arrType == 'simple-dual' ) { |
| 233 | + } elseif ( $arrType == 'simple-dual' ) { |
234 | 234 | $arrVal = array(); |
235 | 235 | foreach ( $setting as $key => $value ) { |
236 | 236 | $arrVal[] = implode( ',', $value ); |
237 | 237 | } |
238 | 238 | $val = $arrVal; |
239 | | - } else if ( $arrType == 'ns-bool' || $arrType == 'ns-text' || $arrType == 'ns-array' ) { |
| 239 | + } elseif ( $arrType == 'ns-bool' || $arrType == 'ns-text' || $arrType == 'ns-array' ) { |
240 | 240 | $arrVal = array(); |
241 | 241 | foreach ( $setting as $key => $value ) { |
242 | 242 | if ( $arrType == 'ns-bool' ) |
— | — | @@ -245,13 +245,13 @@ |
246 | 246 | $arrVal[] = "$key: $value"; |
247 | 247 | } |
248 | 248 | $val = $arrVal; |
249 | | - } else if ( $arrType == 'group-array' ) { |
| 249 | + } elseif ( $arrType == 'group-array' ) { |
250 | 250 | $arrVal = array(); |
251 | 251 | foreach ( $setting as $key => $value ) { |
252 | 252 | $arrVal[] = "$key: " . implode( ',', $value ); |
253 | 253 | } |
254 | 254 | $val = $arrVal; |
255 | | - } else if ( $arrType == 'group-bool' ) { |
| 255 | + } elseif ( $arrType == 'group-bool' ) { |
256 | 256 | $arrVal = array(); |
257 | 257 | ksort($setting); |
258 | 258 | foreach ( $setting as $key1 => $value1 ) { |
— | — | @@ -262,7 +262,7 @@ |
263 | 263 | } |
264 | 264 | } |
265 | 265 | $val = $arrVal; |
266 | | - } else if ( $arrType == 'rate-limits' ) { |
| 266 | + } elseif ( $arrType == 'rate-limits' ) { |
267 | 267 | $val = array(); |
268 | 268 | ## Just walk the tree and print out the data. |
269 | 269 | foreach( $setting as $action => $limits ) { |
— | — | @@ -276,7 +276,7 @@ |
277 | 277 | } |
278 | 278 | } |
279 | 279 | } |
280 | | - } else if ( $arrType == 'promotion-conds' ) { |
| 280 | + } elseif ( $arrType == 'promotion-conds' ) { |
281 | 281 | ## For each group, print out the full conditions. |
282 | 282 | $val = array(); |
283 | 283 | |
— | — | @@ -324,7 +324,7 @@ |
325 | 325 | } else { |
326 | 326 | $val = explode( "\n", var_export( $setting, 1 ) ); |
327 | 327 | } |
328 | | - } else if ( $type == 'bool' ) { |
| 328 | + } elseif ( $type == 'bool' ) { |
329 | 329 | $val = array( $setting ? 'true' : 'false' ); |
330 | 330 | } else { |
331 | 331 | $val = explode( "\n", (string)$setting ); |
Index: trunk/extensions/ConfirmEdit/recaptchalib.php |
— | — | @@ -237,7 +237,7 @@ |
238 | 238 | |
239 | 239 | if (strlen ($arr[0]) <= 4) { |
240 | 240 | $arr[0] = substr ($arr[0], 0, 1); |
241 | | - } else if (strlen ($arr[0]) <= 6) { |
| 241 | + } elseif (strlen ($arr[0]) <= 6) { |
242 | 242 | $arr[0] = substr ($arr[0], 0, 3); |
243 | 243 | } else { |
244 | 244 | $arr[0] = substr ($arr[0], 0, 4); |
Index: trunk/extensions/ArticleFeedback/SpecialArticleFeedback.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | 4 | * SpecialPage for ArticleFeedback extension |
5 | | - * |
| 5 | + * |
6 | 6 | * @file |
7 | 7 | * @ingroup Extensions |
8 | 8 | */ |
— | — | @@ -22,19 +22,19 @@ |
23 | 23 | if ( $wgArticleFeedbackDashboard ) { |
24 | 24 | // fetch the highest and lowest rated articles |
25 | 25 | $highs_lows = $this->getDailyHighsAndLows(); |
26 | | - |
| 26 | + |
27 | 27 | // determine the highest rated articles |
28 | 28 | $highs = $this->getDailyHighs( $highs_lows ); |
29 | | - |
| 29 | + |
30 | 30 | // .. and the lowest rated articles |
31 | 31 | $lows = $this->getDailyLows( $highs_lows ); |
32 | | - |
| 32 | + |
33 | 33 | // provide some messaging above high/low tables |
34 | 34 | $wgOut->addWikiMsg( 'articleFeedback-copy-above-highlow-tables', $wgArticleFeedbackDashboardTalkPage ); |
35 | | - |
| 35 | + |
36 | 36 | //render daily highs table |
37 | 37 | $this->renderDailyHighsAndLows( $highs, wfMsg( 'articleFeedback-table-caption-dailyhighs', $wgLang->date( time() ))); |
38 | | - |
| 38 | + |
39 | 39 | //render daily lows table |
40 | 40 | $this->renderDailyHighsAndLows( $lows, wfMsg( 'articleFeedback-table-caption-dailylows', $wgLang->date( time() ))); |
41 | 41 | |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | This functionality does not exist yet. |
44 | 44 | $this->renderWeeklyMostChanged();*/ |
45 | 45 | $this->renderProblems(); |
46 | | - |
| 46 | + |
47 | 47 | $wgOut->addWikiMsg( 'articlefeedback-dashboard-bottom' ); |
48 | 48 | } else { |
49 | 49 | $wgOut->addWikiText( 'This page has been disabled.' ); |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | |
55 | 55 | /** |
56 | 56 | * Returns an HTML table containing data from a given two dimensional array. |
57 | | - * |
| 57 | + * |
58 | 58 | * @param $headings Array: List of rows, each a list of column data (values will be escaped) |
59 | 59 | * @param $rows Array: List of rows, each a list of either calss/column data pairs (values will |
60 | 60 | * be escaped), or arrays containing attr, text and html fields, used to set attributes, text or |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | } |
91 | 91 | if ( isset( $column['text'] ) ) { |
92 | 92 | $table .= Html::element( 'td', $attr, $column['text'] ); |
93 | | - } else if ( isset( $column['html'] ) ) { |
| 93 | + } elseif ( isset( $column['html'] ) ) { |
94 | 94 | $table .= Html::rawElement( 'td', $attr, $column['html'] ); |
95 | 95 | } else { |
96 | 96 | $table .= Html::element( 'td', $attr ); |
— | — | @@ -107,12 +107,12 @@ |
108 | 108 | |
109 | 109 | /** |
110 | 110 | * Renders daily highs and lows |
111 | | - * |
| 111 | + * |
112 | 112 | * @return String: HTML table of daily highs and lows |
113 | 113 | */ |
114 | 114 | protected function renderDailyHighsAndLows( $pages, $caption ) { |
115 | 115 | global $wgOut, $wgUser; |
116 | | - |
| 116 | + |
117 | 117 | // Pre-fill page ID cache |
118 | 118 | $ids = array(); |
119 | 119 | foreach ( $pages as $page ) { |
— | — | @@ -145,7 +145,7 @@ |
146 | 146 | $rows[] = $row; |
147 | 147 | } |
148 | 148 | } |
149 | | - |
| 149 | + |
150 | 150 | $this->renderTable( |
151 | 151 | $caption, |
152 | 152 | array_merge( |
— | — | @@ -160,7 +160,7 @@ |
161 | 161 | |
162 | 162 | /** |
163 | 163 | * Renders weekly most changed |
164 | | - * |
| 164 | + * |
165 | 165 | * @return String: HTML table of weekly most changed |
166 | 166 | */ |
167 | 167 | protected function renderWeeklyMostChanged() { |
— | — | @@ -194,22 +194,22 @@ |
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Renders problem articles table |
198 | | - * |
| 198 | + * |
199 | 199 | * @return String: HTML table of recent lows |
200 | 200 | */ |
201 | 201 | protected function renderProblems() { |
202 | 202 | global $wgOut, $wgUser, $wgArticleFeedbackRatings; |
203 | 203 | |
204 | | - |
| 204 | + |
205 | 205 | $problems = $this->getProblems(); |
206 | | - |
| 206 | + |
207 | 207 | // Pre-fill page ID cache |
208 | 208 | $ids = array(); |
209 | 209 | foreach ( $problems as $page ) { |
210 | 210 | $ids[] = $page['page']; |
211 | 211 | } |
212 | 212 | self::populateTitleCache( $ids ); |
213 | | - |
| 213 | + |
214 | 214 | $rows = array(); |
215 | 215 | foreach ( $problems as $page ) { |
216 | 216 | $row = array(); |
— | — | @@ -266,12 +266,12 @@ |
267 | 267 | __METHOD__, |
268 | 268 | array( "ORDER BY" => "afs_ts DESC", "LIMIT" => 1 ) |
269 | 269 | ); |
270 | | - |
| 270 | + |
271 | 271 | // if we have no results, just return |
272 | 272 | if ( !$row || !$row->afs_ts ) { |
273 | 273 | return array(); |
274 | 274 | } |
275 | | - |
| 275 | + |
276 | 276 | // select ratings with that ts |
277 | 277 | $result = $dbr->select( |
278 | 278 | 'article_feedback_stats', |
— | — | @@ -280,7 +280,7 @@ |
281 | 281 | 'afs_orderable_data', |
282 | 282 | 'afs_data' |
283 | 283 | ), |
284 | | - array( |
| 284 | + array( |
285 | 285 | 'afs_ts' => $row->afs_ts, |
286 | 286 | 'afs_stats_type_id' => $typeID |
287 | 287 | ), |
— | — | @@ -290,17 +290,17 @@ |
291 | 291 | $problems = $this->buildProblems( $result ); |
292 | 292 | $wgMemc->set( $key, $problems, 86400 ); |
293 | 293 | } |
294 | | - |
| 294 | + |
295 | 295 | return $problems; |
296 | 296 | } |
297 | | - |
| 297 | + |
298 | 298 | /** |
299 | 299 | * Gets a list of articles which were rated exceptionally high or low. |
300 | | - * |
| 300 | + * |
301 | 301 | * - Based on average of all rating categories |
302 | 302 | * - Gets 50 highest rated and 50 lowest rated |
303 | 303 | * - Only consider articles with 10+ ratings in the last 24 hours |
304 | | - * |
| 304 | + * |
305 | 305 | * This data should be updated daily, ideally though a scheduled batch job |
306 | 306 | */ |
307 | 307 | protected function getDailyHighsAndLows() { |
— | — | @@ -321,12 +321,12 @@ |
322 | 322 | __METHOD__, |
323 | 323 | array( "ORDER BY" => "afs_ts DESC", "LIMIT" => 1 ) |
324 | 324 | ); |
325 | | - |
| 325 | + |
326 | 326 | // if we have no results, just return |
327 | 327 | if ( !$row || !$row->afs_ts ) { |
328 | 328 | return array(); |
329 | 329 | } |
330 | | - |
| 330 | + |
331 | 331 | // select ratings with that ts |
332 | 332 | $result = $dbr->select( |
333 | 333 | 'article_feedback_stats', |
— | — | @@ -335,7 +335,7 @@ |
336 | 336 | 'afs_orderable_data', |
337 | 337 | 'afs_data' |
338 | 338 | ), |
339 | | - array( |
| 339 | + array( |
340 | 340 | 'afs_ts' => $row->afs_ts, |
341 | 341 | 'afs_stats_type_id' => $typeID, |
342 | 342 | ), |
— | — | @@ -345,20 +345,20 @@ |
346 | 346 | $highs_lows = $this->buildHighsAndLows( $result ); |
347 | 347 | $wgMemc->set( $key, $highs_lows, 86400 ); |
348 | 348 | } |
349 | | - |
| 349 | + |
350 | 350 | return $highs_lows; |
351 | 351 | } |
352 | 352 | |
353 | 353 | /** |
354 | 354 | * Determine the 'highest' rated articles |
355 | | - * |
| 355 | + * |
356 | 356 | * Divides the number of ratings in half to determine the range of |
357 | 357 | * articles to consider 'highest'. In the event of an odd number |
358 | 358 | * of articles, (determined by checking for modulus of # of ratings / 2), |
359 | 359 | * round up, giving preference to the 'highs' so |
360 | | - * everyone feels warm and fuzzy about having more 'highs', as |
| 360 | + * everyone feels warm and fuzzy about having more 'highs', as |
361 | 361 | * it were... |
362 | | - * |
| 362 | + * |
363 | 363 | * @param array Pre-orderd from lowest to highest |
364 | 364 | * @return array Containing the... highest rated article data |
365 | 365 | */ |
— | — | @@ -371,14 +371,14 @@ |
372 | 372 | } |
373 | 373 | return array_slice( $highs_lows, -$num_highs, $num_highs ); |
374 | 374 | } |
375 | | - |
| 375 | + |
376 | 376 | /** |
377 | 377 | * Determine the 'lowest' rated articles |
378 | 378 | * |
379 | 379 | * @see getDailyHighs() However, if we are dealing with an odd number of |
380 | 380 | * ratings, round up and then subtract 1 since we are giving preference |
381 | 381 | * to the 'highs' when dealing with an odd number of ratings. We do this |
382 | | - * rather than rely on PHP's rounding 'modes' for compaitibility with |
| 382 | + * rather than rely on PHP's rounding 'modes' for compaitibility with |
383 | 383 | * PHP < 5.3 |
384 | 384 | * @param array Pre-orderd from lowest to highest |
385 | 385 | * @return array Containing the... lowest rated article data |
— | — | @@ -392,7 +392,7 @@ |
393 | 393 | } |
394 | 394 | return array_slice( $highs_lows, 0, $num_lows ); |
395 | 395 | } |
396 | | - |
| 396 | + |
397 | 397 | /** |
398 | 398 | * Build data store of highs/lows for use when rendering table |
399 | 399 | * @param object Database result or array of rows |
— | — | @@ -412,7 +412,7 @@ |
413 | 413 | } |
414 | 414 | return $highs_lows; |
415 | 415 | } |
416 | | - |
| 416 | + |
417 | 417 | /** |
418 | 418 | * Build data store of problems for use when rendering table |
419 | 419 | * @param object Database result or array of rows |
— | — | @@ -432,7 +432,7 @@ |
433 | 433 | } |
434 | 434 | return $problems; |
435 | 435 | } |
436 | | - |
| 436 | + |
437 | 437 | /** |
438 | 438 | * Get the stats type id for a given stat type |
439 | 439 | * @param string $stats_type |
— | — | @@ -444,7 +444,7 @@ |
445 | 445 | if ( $cache ) { |
446 | 446 | return $cache; |
447 | 447 | } |
448 | | - |
| 448 | + |
449 | 449 | $dbr = wfGetDB( DB_SLAVE ); |
450 | 450 | $row = $dbr->selectRow( |
451 | 451 | 'article_feedback_stats_types', |
— | — | @@ -456,14 +456,14 @@ |
457 | 457 | $wgMemc->set( $key, $row->afst_id ); |
458 | 458 | return $row->afst_id; |
459 | 459 | } |
460 | | - |
| 460 | + |
461 | 461 | /** |
462 | 462 | * Gets a list of articles which have quickly changing ratings. |
463 | | - * |
| 463 | + * |
464 | 464 | * - Based on any rating category |
465 | 465 | * - Gets 50 most improved and 50 most worsened |
466 | 466 | * - Only consider articles with 100+ ratings in the last 7 days |
467 | | - * |
| 467 | + * |
468 | 468 | * This data should be updated daily, ideally though a scheduled batch job |
469 | 469 | */ |
470 | 470 | protected function getWeeklyMostChanged() { |
— | — | @@ -499,7 +499,7 @@ |
500 | 500 | |
501 | 501 | protected static function formatNumber( $number ) { |
502 | 502 | global $wgLang; |
503 | | - |
| 503 | + |
504 | 504 | return $wgLang->formatNum( number_format( $number, 2 ) ); |
505 | 505 | } |
506 | 506 | |
— | — | @@ -521,7 +521,7 @@ |
522 | 522 | } |
523 | 523 | return self::$categories; |
524 | 524 | } |
525 | | - |
| 525 | + |
526 | 526 | protected static function getTitleFromID( $id ) { |
527 | 527 | // There's no caching in Title::newFromId() so we hack our own around it |
528 | 528 | if ( !isset( self::$titleCache[$id] ) ) { |
— | — | @@ -529,7 +529,7 @@ |
530 | 530 | } |
531 | 531 | return self::$titleCache[$id]; |
532 | 532 | } |
533 | | - |
| 533 | + |
534 | 534 | protected static function populateTitleCache( $ids ) { |
535 | 535 | $toQuery = array_diff( $ids, array_keys( self::$titleCache ) ); |
536 | 536 | $titles = Title::newFromIds( $toQuery ); |
Index: trunk/extensions/Citation/Citation.php |
— | — | @@ -39,9 +39,9 @@ |
40 | 40 | $ret .= $x ; |
41 | 41 | } |
42 | 42 | $ret = "<hr /><ol>" . $ret . "</ol>" ; |
43 | | - |
| 43 | + |
44 | 44 | $text .= $ret ; |
45 | | - |
| 45 | + |
46 | 46 | return true; |
47 | 47 | } |
48 | 48 | |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | $wgCitationCache = array(); |
52 | 52 | $wgCitationCounter = 1 ; |
53 | 53 | $wgCitationRunning = false; |
54 | | - |
| 54 | + |
55 | 55 | return true; |
56 | 56 | } |
57 | 57 | |
— | — | @@ -63,24 +63,24 @@ |
64 | 64 | $res2 = array() ; |
65 | 65 | $href = "" ; |
66 | 66 | $a = explode( "||" , $text ) ; |
67 | | - |
| 67 | + |
68 | 68 | foreach ( $a AS $line ) { |
69 | 69 | $data = explode( "=" , $line , 2 ) ; |
70 | 70 | while ( count( $data ) < 2 ) $data[] = "" ; |
71 | 71 | $key = urlencode( trim( strtolower( array_shift( $data ) ) ) ) ; |
72 | 72 | $value = array_shift( $data ) ; |
73 | | - |
| 73 | + |
74 | 74 | // Parsed now : "$key" = "$value" |
75 | | - if ( substr( $value , 0 , 3 ) == "{{{" ) { } // Unset variable, ignore |
76 | | - else if ( $key == "attheend" ) $attheend = true ; |
77 | | - else if ( $key == "href" ) $href = $value ; |
78 | | - else if ( $value != "" ) { |
| 75 | + if ( substr( $value , 0 , 3 ) == "{{{" ) { } // Unset variable, ignore |
| 76 | + elseif ( $key == "attheend" ) $attheend = true ; |
| 77 | + elseif ( $key == "href" ) $href = $value ; |
| 78 | + elseif ( $value != "" ) { |
79 | 79 | $x = array( "key" => $key , "value" => $value ) ; |
80 | 80 | $res[] = $x ; |
81 | 81 | $res2[$key] = $value ; |
82 | 82 | } |
83 | 83 | } |
84 | | - |
| 84 | + |
85 | 85 | // Creating output string |
86 | 86 | foreach ( $res AS $item ) { |
87 | 87 | $key = $item["key"] ; |
— | — | @@ -94,7 +94,7 @@ |
95 | 95 | } |
96 | 96 | |
97 | 97 | if ( $href != "" ) $ret .= " [{$href}]" ; |
98 | | - |
| 98 | + |
99 | 99 | // Adding to footer list or showing inline |
100 | 100 | $localParser = new Parser ; |
101 | 101 | $wgCitationRunning = true ; |
Index: trunk/extensions/ContributionReporting/ContributionStatistics_body.php |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | class SpecialContributionStatistics extends SpecialPage { |
12 | 12 | |
13 | 13 | /* Members */ |
14 | | - |
| 14 | + |
15 | 15 | private $mStartDate; |
16 | 16 | private $mEndDate; |
17 | 17 | private $mMode; |
— | — | @@ -21,17 +21,17 @@ |
22 | 22 | // Initialize special page |
23 | 23 | parent::__construct( 'ContributionStatistics' ); |
24 | 24 | } |
25 | | - |
| 25 | + |
26 | 26 | public function execute( $sub ) { |
27 | 27 | global $egContributionStatisticsViewDays; |
28 | | - |
| 28 | + |
29 | 29 | $this->evalDateRange(); |
30 | | - |
| 30 | + |
31 | 31 | // Handle sub-pages |
32 | 32 | if( $sub !== '' ) { |
33 | 33 | // Split parameters up |
34 | 34 | $params = explode( '/', trim( $sub, '/' ) ); |
35 | | - |
| 35 | + |
36 | 36 | // Handle ranges |
37 | 37 | if ( $params[0] == 'range' && isset( $params[1] ) ) { |
38 | 38 | $valid = false; |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | if ( count( $range ) >= 2 ) { |
41 | 41 | // From start to end |
42 | 42 | $valid = $this->evalDateRange( $range[0], $range[1] ); |
43 | | - } else if ( count( $range ) == 1 ) { |
| 43 | + } elseif ( count( $range ) == 1 ) { |
44 | 44 | // From start to end of current fiscal year |
45 | 45 | $valid = $this->evalDateRange( $range[0] ); |
46 | 46 | } |
— | — | @@ -49,41 +49,41 @@ |
50 | 50 | } |
51 | 51 | } |
52 | 52 | } |
53 | | - |
| 53 | + |
54 | 54 | // Begin output |
55 | 55 | $this->setHeaders(); |
56 | | - |
| 56 | + |
57 | 57 | // Show daily totals if the range includes today |
58 | 58 | if( $this->mEndDate > time() && $this->mStartDate < time() ) { |
59 | 59 | $this->showDailyTotals( $egContributionStatisticsViewDays ); |
60 | 60 | } |
61 | | - |
| 61 | + |
62 | 62 | // Show daily totals |
63 | 63 | $this->showMonthlyTotals( ); |
64 | | - |
| 64 | + |
65 | 65 | // Show currency totals |
66 | 66 | $this->showCurrencyTotals(); |
67 | | - |
| 67 | + |
68 | 68 | // Show contribution breakdown |
69 | 69 | $this->showContributionBreakdown(); |
70 | 70 | } |
71 | | - |
| 71 | + |
72 | 72 | /* Display Functions */ |
73 | | - |
| 73 | + |
74 | 74 | public function showDailyTotals( $days ) { |
75 | 75 | global $wgOut, $wgLang; |
76 | | - |
| 76 | + |
77 | 77 | $days = $this->getDailyTotals( $days ); |
78 | 78 | $total = $this->getTotalContributions(); |
79 | | - |
| 79 | + |
80 | 80 | $htmlOut = Xml::element( 'h3', null, |
81 | 81 | wfMsgExt( 'contribstats-daily-totals', array( 'parsemag' ), $wgLang->formatNum( count( $days ) ) ) |
82 | 82 | ); |
83 | | - |
| 83 | + |
84 | 84 | $htmlOut .= Xml::openElement( 'table', |
85 | | - array( |
| 85 | + array( |
86 | 86 | 'border' => 0, |
87 | | - 'cellpadding' => 5, |
| 87 | + 'cellpadding' => 5, |
88 | 88 | 'width' => '100%' |
89 | 89 | ) |
90 | 90 | ); |
— | — | @@ -94,7 +94,7 @@ |
95 | 95 | /*$htmlOut .= Xml::element( 'th', array( 'align' => 'right' ), wfMsg( 'contribstats-med' ) );*/ |
96 | 96 | $htmlOut .= Xml::element( 'th', array( 'align' => 'right' ), wfMsg( 'contribstats-max' ) ); |
97 | 97 | $htmlOut .= Xml::element( 'th', array( 'align' => 'right' ), wfMsg( 'contribstats-total-ytd' ) ); |
98 | | - |
| 98 | + |
99 | 99 | // Days |
100 | 100 | foreach ( $days as $data ) { |
101 | 101 | $htmlOut .= Xml::tags( 'tr', null, |
— | — | @@ -108,16 +108,16 @@ |
109 | 109 | ); |
110 | 110 | $total -= $data[2]; |
111 | 111 | } |
112 | | - |
| 112 | + |
113 | 113 | $htmlOut .= Xml::closeElement( 'table' ); |
114 | | - |
| 114 | + |
115 | 115 | // Output HTML |
116 | 116 | $wgOut->addHTML( $htmlOut ); |
117 | 117 | } |
118 | | - |
| 118 | + |
119 | 119 | public function showMonthlyTotals() { |
120 | 120 | global $wgOut, $wgLang; |
121 | | - |
| 121 | + |
122 | 122 | $months = $this->getMonthlyTotals(); |
123 | 123 | $total = $this->getTotalContributions(); |
124 | 124 | |
— | — | @@ -127,11 +127,11 @@ |
128 | 128 | $msg = wfMsgExt( 'contribstats-monthly-totals', array( 'parsemag' ), $wgLang->formatNum( count( $months ) ) ); |
129 | 129 | } |
130 | 130 | $htmlOut = Xml::element( 'h3', null, $msg ); |
131 | | - |
| 131 | + |
132 | 132 | $htmlOut .= Xml::openElement( 'table', |
133 | | - array( |
| 133 | + array( |
134 | 134 | 'border' => 0, |
135 | | - 'cellpadding' => 5, |
| 135 | + 'cellpadding' => 5, |
136 | 136 | 'width' => '100%' |
137 | 137 | ) |
138 | 138 | ); |
— | — | @@ -142,7 +142,7 @@ |
143 | 143 | /*$htmlOut .= Xml::element( 'th', array( 'align' => 'right' ), wfMsg( 'contribstats-med' ) );*/ |
144 | 144 | $htmlOut .= Xml::element( 'th', array( 'align' => 'right' ), wfMsg( 'contribstats-max' ) ); |
145 | 145 | $htmlOut .= Xml::element( 'th', array( 'align' => 'right' ), wfMsg( 'contribstats-total-ytd' ) ); |
146 | | - |
| 146 | + |
147 | 147 | // Months |
148 | 148 | foreach ( $months as $data ) { |
149 | 149 | $htmlOut .= Xml::tags( 'tr', null, |
— | — | @@ -156,16 +156,16 @@ |
157 | 157 | ); |
158 | 158 | $total -= $data[2]; |
159 | 159 | } |
160 | | - |
| 160 | + |
161 | 161 | $htmlOut .= Xml::closeElement( 'table' ); |
162 | | - |
| 162 | + |
163 | 163 | // Output HTML |
164 | 164 | $wgOut->addHTML( $htmlOut ); |
165 | 165 | } |
166 | | - |
| 166 | + |
167 | 167 | public function showCurrencyTotals() { |
168 | 168 | global $wgOut, $wgLang; |
169 | | - |
| 169 | + |
170 | 170 | if ( $this->mMode == 'range' ) { |
171 | 171 | $msg = wfMsg( 'contribstats-currency-range-totals', |
172 | 172 | $wgLang->date( wfTimestamp( TS_MW, $this->mStartDate ) ), |
— | — | @@ -175,11 +175,11 @@ |
176 | 176 | $msg = wfMsg( 'contribstats-currency-totals', $this->getCurrentFiscalYear() ); |
177 | 177 | } |
178 | 178 | $htmlOut = Xml::element( 'h3', null, $msg ); |
179 | | - |
| 179 | + |
180 | 180 | $htmlOut .= Xml::openElement( 'table', |
181 | | - array( |
| 181 | + array( |
182 | 182 | 'border' => 0, |
183 | | - 'cellpadding' => 5, |
| 183 | + 'cellpadding' => 5, |
184 | 184 | 'width' => '100%' |
185 | 185 | ) |
186 | 186 | ); |
— | — | @@ -189,7 +189,7 @@ |
190 | 190 | $htmlOut .= Xml::element( 'th', array( 'align' => 'right' ), wfMsg( 'contribstats-avg' ) ); |
191 | 191 | /*$htmlOut .= Xml::element( 'th', array( 'align' => 'right' ), wfMsg( 'contribstats-med' ) );*/ |
192 | 192 | $htmlOut .= Xml::element( 'th', array( 'align' => 'right' ), wfMsg( 'contribstats-max' ) ); |
193 | | - |
| 193 | + |
194 | 194 | // Days |
195 | 195 | foreach ( $this->getCurrencyTotals() as $data ) { |
196 | 196 | $htmlOut .= Xml::tags( 'tr', null, |
— | — | @@ -201,13 +201,13 @@ |
202 | 202 | Xml::element( 'td', array( 'align' => 'right' ), $wgLang->formatNum( number_format( $data[4], 2 ) ) ) |
203 | 203 | ); |
204 | 204 | } |
205 | | - |
| 205 | + |
206 | 206 | $htmlOut .= Xml::closeElement( 'table' ); |
207 | | - |
| 207 | + |
208 | 208 | // Output HTML |
209 | 209 | $wgOut->addHTML( $htmlOut ); |
210 | 210 | } |
211 | | - |
| 211 | + |
212 | 212 | public function showContributionBreakdown() { |
213 | 213 | global $wgOut, $wgLang; |
214 | 214 | |
— | — | @@ -220,11 +220,11 @@ |
221 | 221 | $msg = wfMsg( 'contribstats-contribution-breakdown', $this->getCurrentFiscalYear() ); |
222 | 222 | } |
223 | 223 | $htmlOut = Xml::element( 'h3', null, $msg ); |
224 | | - |
| 224 | + |
225 | 225 | $htmlOut .= Xml::openElement( 'table', |
226 | | - array( |
| 226 | + array( |
227 | 227 | 'border' => 0, |
228 | | - 'cellpadding' => 5, |
| 228 | + 'cellpadding' => 5, |
229 | 229 | 'width' => '100%' |
230 | 230 | ) |
231 | 231 | ); |
— | — | @@ -232,10 +232,10 @@ |
233 | 233 | $htmlOut .= Xml::element( 'th', array( 'align' => 'right' ), wfMsg( 'contribstats-contributions' ) ); |
234 | 234 | $htmlOut .= Xml::element( 'th', array( 'align' => 'right' ), wfMsg( 'contribstats-percentage-ytd' ) ); |
235 | 235 | $htmlOut .= Xml::element( 'th', array( 'align' => 'right' ), wfMsg( 'contribstats-avg' ) ); |
236 | | - |
| 236 | + |
237 | 237 | $numContributions = $this->getNumContributions(); |
238 | 238 | $factor = $numContributions > 0 ? 100.0 / $numContributions : 0; |
239 | | - |
| 239 | + |
240 | 240 | $list = array( |
241 | 241 | wfMsg( 'contribstats-value-exactly', $wgLang->formatNum( 35 ) ) => array( 35 ), |
242 | 242 | wfMsg( 'contribstats-value-exactly', $wgLang->formatNum( 75 ) ) => array( 75 ), |
— | — | @@ -254,25 +254,25 @@ |
255 | 255 | Xml::element( 'td', array( 'align' => 'left' ), $label ) . |
256 | 256 | Xml::element( 'td', array( 'align' => 'right' ), |
257 | 257 | $wgLang->formatNum( $data[0] ) ) . |
258 | | - Xml::element( 'td', array( 'align' => 'right' ), |
| 258 | + Xml::element( 'td', array( 'align' => 'right' ), |
259 | 259 | wfMsg( 'percent', $wgLang->formatNum( round( $data[0] * $factor, 2 ) ) ) ) . |
260 | 260 | Xml::element( 'td', array( 'align' => 'right' ), |
261 | 261 | isset( $range[1] ) ? $wgLang->formatNum( round( $data[1], 2 ) ) : '-' ) |
262 | 262 | ); |
263 | 263 | } |
264 | | - |
| 264 | + |
265 | 265 | $htmlOut .= Xml::closeElement( 'table' ); |
266 | | - |
| 266 | + |
267 | 267 | // Output HTML |
268 | 268 | $wgOut->addHTML( $htmlOut ); |
269 | 269 | } |
270 | | - |
| 270 | + |
271 | 271 | /* Query Functions */ |
272 | | - |
| 272 | + |
273 | 273 | public function getDailyTotals( $limit = 30 ) { |
274 | 274 | // Get connection |
275 | 275 | $dbr = efContributionReportingConnection(); |
276 | | - |
| 276 | + |
277 | 277 | // Select sums and dates of contributions grouped by day |
278 | 278 | $res = $dbr->select( 'public_reporting', |
279 | 279 | array( |
— | — | @@ -290,7 +290,7 @@ |
291 | 291 | 'GROUP BY' => "FROM_UNIXTIME(received, '%Y-%m-%d')" |
292 | 292 | ) |
293 | 293 | ); |
294 | | - |
| 294 | + |
295 | 295 | // Build day/value array |
296 | 296 | $totals = array(); |
297 | 297 | foreach ( $res as $row ) { |
— | — | @@ -311,15 +311,15 @@ |
312 | 312 | */ |
313 | 313 | $totals[] = $row; |
314 | 314 | } |
315 | | - |
| 315 | + |
316 | 316 | // Return results |
317 | 317 | return $totals; |
318 | 318 | } |
319 | | - |
| 319 | + |
320 | 320 | public function getMonthlyTotals() { |
321 | 321 | // Get connection |
322 | 322 | $dbr = efContributionReportingConnection(); |
323 | | - |
| 323 | + |
324 | 324 | // Select sums and dates of contributions grouped by day |
325 | 325 | $res = $dbr->select( 'public_reporting', |
326 | 326 | array( |
— | — | @@ -336,7 +336,7 @@ |
337 | 337 | 'GROUP BY' => "FROM_UNIXTIME(received, '%Y-%m')" |
338 | 338 | ) |
339 | 339 | ); |
340 | | - |
| 340 | + |
341 | 341 | // Build day/value array |
342 | 342 | $totals = array(); |
343 | 343 | foreach ( $res as $row ) { |
— | — | @@ -355,15 +355,15 @@ |
356 | 356 | $row[] = $median; |
357 | 357 | $totals[] = $row; |
358 | 358 | } |
359 | | - |
| 359 | + |
360 | 360 | // Return results |
361 | 361 | return $totals; |
362 | 362 | } |
363 | | - |
| 363 | + |
364 | 364 | public function getCurrencyTotals() { |
365 | 365 | // Get connection |
366 | 366 | $dbr = efContributionReportingConnection(); |
367 | | - |
| 367 | + |
368 | 368 | // Select sums and dates of contributions grouped by day |
369 | 369 | $res = $dbr->select( 'public_reporting', |
370 | 370 | array( |
— | — | @@ -380,7 +380,7 @@ |
381 | 381 | 'GROUP BY' => 'original_currency' |
382 | 382 | ) |
383 | 383 | ); |
384 | | - |
| 384 | + |
385 | 385 | $totals = array(); |
386 | 386 | foreach ( $res as $row ) { |
387 | 387 | $median = $dbr->selectField( 'public_reporting', |
— | — | @@ -401,25 +401,25 @@ |
402 | 402 | $row[] = $median; |
403 | 403 | $totals[$row[0]] = $row; |
404 | 404 | } |
405 | | - |
| 405 | + |
406 | 406 | if ( isset( $totals[null] ) ) { |
407 | 407 | // Merge null and USD |
408 | 408 | $totals['USD'][1] += $totals[null][1]; |
409 | 409 | $totals['USD'][2] += $totals[null][2]; |
410 | | - $totals['USD'][3] = ( $totals[null][3] == 0 ) ? $totals['USD'][3] : ( $totals['USD'][3] + $totals[null][3] ) / 2; |
| 410 | + $totals['USD'][3] = ( $totals[null][3] == 0 ) ? $totals['USD'][3] : ( $totals['USD'][3] + $totals[null][3] ) / 2; |
411 | 411 | $totals['USD'][4] = max( $totals['USD'][4], $totals[null][4] ); |
412 | 412 | /* $totals['USD'][5] = min( $totals['USD'][5], $totals[null][5] ); */ |
413 | 413 | unset( $totals[null] ); |
414 | 414 | } |
415 | | - |
| 415 | + |
416 | 416 | // Return results |
417 | 417 | return $totals; |
418 | 418 | } |
419 | | - |
| 419 | + |
420 | 420 | public function getNumContributionsWithin( $min, $max ) { |
421 | 421 | // Get connection |
422 | 422 | $dbr = efContributionReportingConnection(); |
423 | | - |
| 423 | + |
424 | 424 | // Return average contribution amount |
425 | 425 | $sizes = array( |
426 | 426 | 'converted_amount >= ' . $dbr->addQuotes( $min ), |
— | — | @@ -434,14 +434,14 @@ |
435 | 435 | array_merge( $sizes, $dates ), |
436 | 436 | __METHOD__ |
437 | 437 | ); |
438 | | - |
| 438 | + |
439 | 439 | return $dbr->fetchRow( $res ); |
440 | 440 | } |
441 | | - |
| 441 | + |
442 | 442 | public function getNumContributionsOf( $value ) { |
443 | 443 | // Get connection |
444 | 444 | $dbr = efContributionReportingConnection(); |
445 | | - |
| 445 | + |
446 | 446 | // Return average contribution amount |
447 | 447 | $res = $dbr->select( 'public_reporting', |
448 | 448 | array( |
— | — | @@ -453,14 +453,14 @@ |
454 | 454 | ) + $this->dateConds( $dbr ), |
455 | 455 | __METHOD__ |
456 | 456 | ); |
457 | | - |
| 457 | + |
458 | 458 | return $dbr->fetchRow( $res ); |
459 | 459 | } |
460 | | - |
| 460 | + |
461 | 461 | public function getNumContributions() { |
462 | 462 | // Get connection |
463 | 463 | $dbr = efContributionReportingConnection(); |
464 | | - |
| 464 | + |
465 | 465 | // Return average contribution amount |
466 | 466 | return $dbr->selectField( 'public_reporting', |
467 | 467 | array( |
— | — | @@ -470,11 +470,11 @@ |
471 | 471 | __METHOD__ |
472 | 472 | ); |
473 | 473 | } |
474 | | - |
| 474 | + |
475 | 475 | public function getTotalContributions() { |
476 | 476 | // Get connection |
477 | 477 | $dbr = efContributionReportingConnection(); |
478 | | - |
| 478 | + |
479 | 479 | // Return average contribution amount |
480 | 480 | return $dbr->selectField( 'public_reporting', |
481 | 481 | array( |
— | — | @@ -484,7 +484,7 @@ |
485 | 485 | __METHOD__ |
486 | 486 | ); |
487 | 487 | } |
488 | | - |
| 488 | + |
489 | 489 | protected function dateConds( $dbr ) { |
490 | 490 | return |
491 | 491 | array( |
— | — | @@ -492,32 +492,32 @@ |
493 | 493 | 'received < ' . $dbr->addQuotes( wfTimestamp( TS_UNIX, $this->mEndDate ) ) |
494 | 494 | ); |
495 | 495 | } |
496 | | - |
| 496 | + |
497 | 497 | public function getCurrentFiscalYear() { |
498 | 498 | global $egContributionStatisticsFiscalYearCutOff; |
499 | | - |
| 499 | + |
500 | 500 | $year = date( 'Y' ); |
501 | | - |
| 501 | + |
502 | 502 | // If the cuttoff date is ahead of us in the current calendar year |
503 | 503 | if ( time() < strtotime( $egContributionStatisticsFiscalYearCutOff ) ) { |
504 | 504 | // Use last year |
505 | 505 | $year = date( 'Y' ) - 1; |
506 | 506 | } |
507 | | - |
| 507 | + |
508 | 508 | return $year; |
509 | 509 | } |
510 | | - |
| 510 | + |
511 | 511 | public function evalDateRange( $startDate = null, $endDate = null ) { |
512 | 512 | global $egContributionStatisticsFiscalYearCutOff; |
513 | | - |
| 513 | + |
514 | 514 | if ( $startDate !== null || $endDate !== null ) { |
515 | 515 | $this->mMode = 'range'; |
516 | 516 | } else { |
517 | 517 | $this->mMode = false; |
518 | 518 | } |
519 | | - |
| 519 | + |
520 | 520 | $year = $this->getCurrentFiscalYear(); |
521 | | - |
| 521 | + |
522 | 522 | // If there was no start date override |
523 | 523 | if ( $startDate === null ) { |
524 | 524 | // Use the fiscal year cutoff date |
— | — | @@ -525,7 +525,7 @@ |
526 | 526 | } else { |
527 | 527 | $this->mStartDate = strtotime( $startDate ); |
528 | 528 | } |
529 | | - |
| 529 | + |
530 | 530 | // If there was no end date override |
531 | 531 | if ( $endDate === null ) { |
532 | 532 | // Use the fiscal year cutoff date |
— | — | @@ -533,7 +533,7 @@ |
534 | 534 | } else { |
535 | 535 | $this->mEndDate = strtotime( $endDate ); |
536 | 536 | } |
537 | | - |
| 537 | + |
538 | 538 | // Catch invalid dates |
539 | 539 | return !( $this->mStartDate === false || $this->mEndDate === false ); |
540 | 540 | } |
Index: trunk/extensions/CentralAuth/specials/SpecialGlobalGroupPermissions.php |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | |
61 | 61 | if ( $subpage != '' && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
62 | 62 | $this->doSubmit( $subpage ); |
63 | | - } else if ( $subpage != '' ) { |
| 63 | + } elseif ( $subpage != '' ) { |
64 | 64 | $this->buildGroupView( $subpage ); |
65 | 65 | } else { |
66 | 66 | $this->buildMainView(); |
— | — | @@ -189,7 +189,7 @@ |
190 | 190 | $desc = $wgOut->parseInline( User::getRightDescription( $right ) ) . ' ' . |
191 | 191 | Xml::element( 'tt', null, wfMsg( 'parentheses', $right ) ); |
192 | 192 | |
193 | | - $checkbox = Xml::check( "wpRightAssigned-$right", $checked, |
| 193 | + $checkbox = Xml::check( "wpRightAssigned-$right", $checked, |
194 | 194 | array_merge( $attribs, array( 'id' => "wpRightAssigned-$right" ) ) ); |
195 | 195 | $label = Xml::tags( 'label', array( 'for' => "wpRightAssigned-$right" ), |
196 | 196 | $desc ); |
— | — | @@ -249,7 +249,7 @@ |
250 | 250 | |
251 | 251 | if ( !$alreadyAssigned && $wgRequest->getCheck( "wpRightAssigned-$right" ) ) { |
252 | 252 | $addRights[] = $right; |
253 | | - } else if ( $alreadyAssigned && !$wgRequest->getCheck( "wpRightAssigned-$right" ) ) { |
| 253 | + } elseif ( $alreadyAssigned && !$wgRequest->getCheck( "wpRightAssigned-$right" ) ) { |
254 | 254 | $removeRights[] = $right; |
255 | 255 | } # Otherwise, do nothing. |
256 | 256 | } |
Index: trunk/extensions/CentralAuth/specials/SpecialWikiSets.php |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | |
59 | 59 | if ( ( $subpage || $newPage ) && $this->mCanEdit && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
60 | 60 | $this->doSubmit( $subpage ); |
61 | | - } else if ( ( $subpage || $newPage ) && is_numeric( $subpage ) ) { |
| 61 | + } elseif ( ( $subpage || $newPage ) && is_numeric( $subpage ) ) { |
62 | 62 | $this->buildSetView( $subpage ); |
63 | 63 | } else { |
64 | 64 | $this->buildMainView(); |
Index: trunk/extensions/ContributionTracking/ContributionTracking_body.php |
— | — | @@ -31,20 +31,20 @@ |
32 | 32 | require_once( 'countryCodes.inc' ); |
33 | 33 | global $wgRequest, $wgOut, $wgContributionTrackingPayPalIPN, $wgContributionTrackingReturnToURLDefault, |
34 | 34 | $wgContributionTrackingPayPalRecurringIPN, $wgContributionTrackingPayPalBusiness; |
35 | | - |
| 35 | + |
36 | 36 | if ( !preg_match( '/^[a-z-]+$/', $language ) ) { |
37 | 37 | $language = 'en'; |
38 | 38 | } |
39 | 39 | $this->lang = Language::factory( $language ); |
40 | | - |
| 40 | + |
41 | 41 | $this->setHeaders(); |
42 | | - |
| 42 | + |
43 | 43 | $gateway = $wgRequest->getText( 'gateway' ); |
44 | 44 | if( !in_array( $gateway, array( 'paypal', 'moneybookers' ) ) ) { |
45 | 45 | $wgOut->showErrorPage( 'contrib-tracking-error', 'contrib-tracking-error-text' ); |
46 | 46 | return; |
47 | 47 | } |
48 | | - |
| 48 | + |
49 | 49 | $db = contributionTrackingConnection(); |
50 | 50 | |
51 | 51 | $ts = $db->timestamp(); |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | if($owa_ref != null && !is_numeric($owa_ref)){ |
55 | 55 | $owa_ref = $this->get_owa_ref_id($owa_ref); |
56 | 56 | } |
57 | | - |
| 57 | + |
58 | 58 | // Translate the shipping country from a code to a country name |
59 | 59 | $country = ''; |
60 | 60 | $code = $wgRequest->getText('country2'); |
— | — | @@ -76,20 +76,20 @@ |
77 | 77 | 'owa_ref' => $owa_ref, |
78 | 78 | 'ts' => $ts, |
79 | 79 | ); |
80 | | - |
| 80 | + |
81 | 81 | // Make all empty strings NULL |
82 | 82 | foreach ($tracked_contribution as $key => $value) { |
83 | 83 | if ($value === '') { |
84 | 84 | $tracked_contribution[$key] = null; |
85 | 85 | } |
86 | 86 | } |
87 | | - |
| 87 | + |
88 | 88 | // Store the contribution data |
89 | 89 | if ( !$wgRequest->getVal( 'contribution_tracking_id', 0 )) { |
90 | 90 | $db->insert( 'contribution_tracking', $tracked_contribution ); |
91 | 91 | } |
92 | 92 | $contribution_tracking_id = $wgRequest->getVal( 'contribution_tracking_id', $db->insertId()); |
93 | | - |
| 93 | + |
94 | 94 | $returnText = $wgRequest->getText( 'returnto', "Donate-thanks/$language" ); |
95 | 95 | $returnTitle = Title::newFromText( $returnText ); |
96 | 96 | if( $returnTitle ) { |
— | — | @@ -97,13 +97,13 @@ |
98 | 98 | } else { |
99 | 99 | $returnto = $wgContributionTrackingReturnToURLDefault . "/$language"; |
100 | 100 | } |
101 | | - |
| 101 | + |
102 | 102 | // Set the action and tracking ID fields |
103 | 103 | $repost = array(); |
104 | 104 | $action = 'http://wikimediafoundation.org/'; |
105 | 105 | $amount_field_name = 'amount'; // the amount fieldname may be different depending on the service |
106 | 106 | if ( $gateway == 'paypal' ) { |
107 | | - |
| 107 | + |
108 | 108 | $action = 'https://www.paypal.com/cgi-bin/webscr'; |
109 | 109 | |
110 | 110 | // Premiums |
— | — | @@ -114,25 +114,25 @@ |
115 | 115 | $repost['os1'] = $wgRequest->getText( 'premium_language' ); |
116 | 116 | $repost['no_shipping'] = 2; |
117 | 117 | } |
118 | | - |
| 118 | + |
119 | 119 | // PayPal |
120 | 120 | $repost['business'] = $wgContributionTrackingPayPalBusiness; |
121 | 121 | $repost['item_number'] = 'DONATE'; |
122 | 122 | $repost['no_note'] = '0'; |
123 | 123 | $repost['return'] = $returnto; |
124 | 124 | $repost['currency_code'] = $wgRequest->getText( 'currency_code', 'USD' ); |
125 | | - |
| 125 | + |
126 | 126 | // additional fields to pass to PayPal from single-step credit card form |
127 | 127 | $repost[ 'first_name' ] = $wgRequest->getText( 'fname', null ); |
128 | 128 | $repost[ 'last_name' ] = $wgRequest->getText( 'lname', null ); |
129 | 129 | $repost[ 'email' ] = $wgRequest->getText( 'email', null ); |
130 | | - |
| 130 | + |
131 | 131 | // if this is a recurring donation, we have add'l fields to send to paypal |
132 | 132 | if ( $wgRequest->getText( 'recurring_paypal' ) == 'true' ) { |
133 | 133 | $repost[ 't3' ] = "M"; // The unit of measurement for for p3 (M = month) |
134 | 134 | $repost[ 'p3' ] = '1'; // Billing cycle duration |
135 | 135 | $repost[ 'srt' ] = '12'; // # of billing cycles |
136 | | - $repost[ 'src' ] = '1'; // Make this 'recurring' |
| 136 | + $repost[ 'src' ] = '1'; // Make this 'recurring' |
137 | 137 | $repost[ 'sra' ] = '1'; // Turn on re-attempt on failure |
138 | 138 | $repost[ 'cmd' ] = '_xclick-subscriptions'; |
139 | 139 | $amount_field_name = 'a3'; |
— | — | @@ -144,7 +144,7 @@ |
145 | 145 | $repost['item_name'] = $this->msg( 'contrib-tracking-item-name-onetime' ); |
146 | 146 | } |
147 | 147 | } |
148 | | - else if ( $gateway == 'moneybookers' ) { |
| 148 | + elseif ( $gateway == 'moneybookers' ) { |
149 | 149 | $action = 'https://www.moneybookers.com/app/payment.pl'; |
150 | 150 | |
151 | 151 | // Tracking |
— | — | @@ -160,28 +160,28 @@ |
161 | 161 | } else { |
162 | 162 | throw new MWException( "This shouldn't happen, we validated the gateway earlier." ); |
163 | 163 | } |
164 | | - |
| 164 | + |
165 | 165 | // Normalized amount |
166 | 166 | $repost[ $amount_field_name ] = $wgRequest->getVal( 'amount' ); |
167 | 167 | if ( $wgRequest->getVal( 'amountGiven' ) ) { |
168 | 168 | $repost[ $amount_field_name ] = $wgRequest->getVal( 'amountGiven' ); |
169 | 169 | } |
170 | | - |
| 170 | + |
171 | 171 | // Tracking |
172 | 172 | $repost['custom'] = $contribution_tracking_id; |
173 | | - |
| 173 | + |
174 | 174 | $wgOut->addWikiText( "{{2009/Donate-banner/$language}}" ); |
175 | 175 | $wgOut->addHTML( $this->msgWiki( 'contrib-tracking-submitting' ) ); |
176 | | - |
| 176 | + |
177 | 177 | // Output the repost form |
178 | 178 | $output = '<form method="post" name="contributiontracking" action="' . $action . '">'; |
179 | 179 | |
180 | 180 | foreach ( $repost as $key => $value ) { |
181 | 181 | $output .= '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($value) . '" />'; |
182 | 182 | } |
183 | | - |
| 183 | + |
184 | 184 | $output .= $this->msgWiki( 'contrib-tracking-redirect' ); |
185 | | - |
| 185 | + |
186 | 186 | // Offer a button to post the form if the user has no Javascript support |
187 | 187 | $output .= '<noscript>'; |
188 | 188 | $output .= $this->msgWiki( 'contrib-tracking-continue' ); |
Index: trunk/extensions/ArticleComments/ArticleComments.php |
— | — | @@ -251,7 +251,7 @@ |
252 | 252 | if ( $parser === $wgParser ) { # Needed since r82645. Workaround the 'Invalid marker' problem by giving a new parser to wfMsgExt(). |
253 | 253 | $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) ); |
254 | 254 | } |
255 | | - |
| 255 | + |
256 | 256 | # Merge in global defaults if specified |
257 | 257 | $tmp = $wgArticleCommentDefaults; |
258 | 258 | foreach ( $params as $k => $v ) { |
— | — | @@ -309,7 +309,7 @@ |
310 | 310 | 'ptu.getElementsByTagName("a")[0].innerHTML;};' . "\n" . |
311 | 311 | 'if (window.addEventListener) window.addEventListener' . |
312 | 312 | '("load",prefillUserName,false);' . "\n" . |
313 | | - 'else if (window.attachEvent) window.attachEvent' . |
| 313 | + 'elseif (window.attachEvent) window.attachEvent' . |
314 | 314 | '("onload",prefillUserName);' . "\n"; |
315 | 315 | |
316 | 316 | # Prefill comment text if it has been specified by a system message |
— | — | @@ -329,7 +329,7 @@ |
330 | 330 | 'c.value="";}}' . "\n" . |
331 | 331 | 'if (comment.addEventListener) comment.addEventListener' . |
332 | 332 | '("focus",clearCommentOnFirstFocus,false);' . "\n" . |
333 | | - 'else if (comment.attachEvent) comment.attachEvent' . |
| 333 | + 'elseif (comment.attachEvent) comment.attachEvent' . |
334 | 334 | '("onfocus",clearCommentOnFirstFocus);' . "\n"; |
335 | 335 | } |
336 | 336 | |
Index: trunk/extensions/Collection/Collection.hooks.php |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | static function buildNavUrls( $skin, &$navUrls ) { |
43 | 43 | global $wgUser; |
44 | 44 | global $wgCollectionPortletForLoggedInUsersOnly; |
45 | | - |
| 45 | + |
46 | 46 | if ( !$wgCollectionPortletForLoggedInUsersOnly || $wgUser->isLoggedIn() ) { |
47 | 47 | if ( isset( $navUrls['print'] ) ) { |
48 | 48 | // We move this guy out to our own box |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | if ( is_null( $title ) || !$title->exists() ) { |
67 | 67 | return; |
68 | 68 | } |
69 | | - |
| 69 | + |
70 | 70 | $namespace = $title->getNamespace(); |
71 | 71 | |
72 | 72 | if ( !in_array( $namespace, $wgCollectionArticleNamespaces ) |
— | — | @@ -159,7 +159,7 @@ |
160 | 160 | Xml::element( 'a', $attribs, wfMsg( 'printableversion' ) ) ); |
161 | 161 | } |
162 | 162 | } |
163 | | - |
| 163 | + |
164 | 164 | $out .= Xml::closeElement( 'ul' ); |
165 | 165 | |
166 | 166 | return $out; |
— | — | @@ -195,7 +195,7 @@ |
196 | 196 | $cmd = $wgRequest->getVal( 'bookcmd', '' ); |
197 | 197 | if ( $cmd == 'suggest' ) { |
198 | 198 | $siteNotice .= self::renderBookCreatorBox( $title, $skin, 'suggest' ); |
199 | | - } else if ( $cmd == '' ) { |
| 199 | + } elseif ( $cmd == '' ) { |
200 | 200 | $siteNotice .= self::renderBookCreatorBox( $title, $skin, 'showbook' ); |
201 | 201 | } |
202 | 202 | return true; |
— | — | @@ -231,7 +231,7 @@ |
232 | 232 | } |
233 | 233 | |
234 | 234 | $wgOut->addModules( 'ext.collection.bookcreator' ); |
235 | | - |
| 235 | + |
236 | 236 | $addRemoveState = $mode; |
237 | 237 | |
238 | 238 | $html = Xml::element( 'div', |
— | — | @@ -485,7 +485,7 @@ |
486 | 486 | } |
487 | 487 | return true; |
488 | 488 | } |
489 | | - |
| 489 | + |
490 | 490 | /** |
491 | 491 | * ResourceLoaderGetConfigVars hook |
492 | 492 | */ |
Index: trunk/extensions/Collection/Collection.body.php |
— | — | @@ -78,7 +78,7 @@ |
79 | 79 | } |
80 | 80 | if ( $wgRequest->getVal( 'disable' ) ) { |
81 | 81 | CollectionSession::disable(); |
82 | | - } else if ( !$wgRequest->getVal( 'continue' ) ) { |
| 82 | + } elseif ( !$wgRequest->getVal( 'continue' ) ) { |
83 | 83 | $this->renderStopBookCreatorPage( $title ); |
84 | 84 | return; |
85 | 85 | } |
— | — | @@ -278,13 +278,13 @@ |
279 | 279 | |
280 | 280 | if ( $wgRequest->getVal( 'resetbans' ) ) { |
281 | 281 | CollectionSuggest::run( 'resetbans' ); |
282 | | - } else if ( isset( $add ) ) { |
| 282 | + } elseif ( isset( $add ) ) { |
283 | 283 | CollectionSuggest::run( 'add', $add ); |
284 | | - } else if ( isset( $ban ) ) { |
| 284 | + } elseif ( isset( $ban ) ) { |
285 | 285 | CollectionSuggest::run( 'ban', $ban ); |
286 | | - } else if ( isset( $remove ) ) { |
| 286 | + } elseif ( isset( $remove ) ) { |
287 | 287 | CollectionSuggest::run( 'remove', $remove ); |
288 | | - } else if ( isset( $addselected ) ) { |
| 288 | + } elseif ( isset( $addselected ) ) { |
289 | 289 | $articleList = $wgRequest->getArray( 'articleList' ); |
290 | 290 | if ( !is_null( $articleList ) ) { |
291 | 291 | CollectionSuggest::run( 'addAll', $articleList ); |
— | — | @@ -323,8 +323,8 @@ |
324 | 324 | $coll = CollectionSession::getCollection(); |
325 | 325 | $dialogtxt = wfMsg( 'coll-load_local_book' ); |
326 | 326 | |
327 | | - $wgOut->addScript( |
328 | | - "<script type=\"$wgJsMimeType\">\n" . |
| 327 | + $wgOut->addScript( |
| 328 | + "<script type=\"$wgJsMimeType\">\n" . |
329 | 329 | "var collection_dialogtxt = " . Xml::encodeJsVar( $dialogtxt ) . ";\n" . |
330 | 330 | "</script>" ); |
331 | 331 | |
— | — | @@ -1231,7 +1231,7 @@ |
1232 | 1232 | return array( 'error' => $errorMessage ); |
1233 | 1233 | } |
1234 | 1234 | } |
1235 | | - |
| 1235 | + |
1236 | 1236 | if ( !$response ) { |
1237 | 1237 | $wgOut->showErrorPage( |
1238 | 1238 | 'coll-post_failed_title', |
— | — | @@ -1240,10 +1240,10 @@ |
1241 | 1241 | ); |
1242 | 1242 | return false; |
1243 | 1243 | } |
1244 | | - |
| 1244 | + |
1245 | 1245 | $json = new Services_JSON( SERVICES_JSON_LOOSE_TYPE ); |
1246 | 1246 | $json_response = $json->decode( $response ); |
1247 | | - |
| 1247 | + |
1248 | 1248 | if ( !$json_response ) { |
1249 | 1249 | $wgOut->showErrorPage( |
1250 | 1250 | 'coll-mwserve_failed_title', |
— | — | @@ -1252,7 +1252,7 @@ |
1253 | 1253 | ); |
1254 | 1254 | return false; |
1255 | 1255 | } |
1256 | | - |
| 1256 | + |
1257 | 1257 | if ( isset( $json_response['error'] ) && $json_response['error'] ) { |
1258 | 1258 | $wgOut->showErrorPage( |
1259 | 1259 | 'coll-mwserve_failed_title', |
— | — | @@ -1261,7 +1261,7 @@ |
1262 | 1262 | ); |
1263 | 1263 | return false; |
1264 | 1264 | } |
1265 | | - |
| 1265 | + |
1266 | 1266 | return $json_response; |
1267 | 1267 | } |
1268 | 1268 | |
Index: trunk/extensions/cldr/rebuild.php |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | } else { |
43 | 43 | $codePart[$i] = ''; |
44 | 44 | } |
45 | | - } |
| 45 | + } |
46 | 46 | // ISO 15924 alpha-4 script code |
47 | 47 | if (strlen($codePart[1]) == 4 ) { |
48 | 48 | $codePart[1] = ucfirst( $codePart[1] ); |
— | — | @@ -188,17 +188,17 @@ |
189 | 189 | $realCode = $code; |
190 | 190 | if ( !strcmp( $code, 'kk' ) ) |
191 | 191 | $realCode = 'kk-cyrl'; |
192 | | - else if ( !strcmp( $code, 'ku' ) ) |
| 192 | + elseif ( !strcmp( $code, 'ku' ) ) |
193 | 193 | $realCode = 'ku-arab'; |
194 | | - else if ( !strcmp( $code, 'sr' ) ) |
| 194 | + elseif ( !strcmp( $code, 'sr' ) ) |
195 | 195 | $realCode = 'sr-ec'; |
196 | | - else if ( !strcmp( $code, 'tg' ) ) |
| 196 | + elseif ( !strcmp( $code, 'tg' ) ) |
197 | 197 | $realCode = 'tg-cyrl'; |
198 | | - else if ( !strcmp( $code, 'zh' ) ) |
| 198 | + elseif ( !strcmp( $code, 'zh' ) ) |
199 | 199 | $realCode = 'zh-hans'; |
200 | | - else if ( !strcmp( $code, 'pt' ) ) |
| 200 | + elseif ( !strcmp( $code, 'pt' ) ) |
201 | 201 | $realCode = 'pt-br'; |
202 | | - else if ( !strcmp( $code, 'pt-pt' ) ) |
| 202 | + elseif ( !strcmp( $code, 'pt-pt' ) ) |
203 | 203 | $realCode = 'pt'; |
204 | 204 | return $realCode; |
205 | 205 | } |
Index: trunk/extensions/CodeReview/ui/CodeRevisionAuthorLink.php |
— | — | @@ -81,7 +81,7 @@ |
82 | 82 | '</div>' |
83 | 83 | ); |
84 | 84 | // Unlink an author to a wiki users |
85 | | - } else if ( $wgRequest->getVal( 'unlink' ) ) { |
| 85 | + } elseif ( $wgRequest->getVal( 'unlink' ) ) { |
86 | 86 | if ( !$this->mUser ) { |
87 | 87 | $wgOut->addHTML( wfMsg( 'code-author-orphan' ) ); |
88 | 88 | return; |
Index: trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php |
— | — | @@ -123,12 +123,12 @@ |
124 | 124 | $wgUser->getName(), $this->mRev->getIdStringUnique(), $this->mRev->getOldStatus(), |
125 | 125 | $this->mRev->getStatus(), $url, $this->text, $this->mRev->getMessage() |
126 | 126 | ); |
127 | | - } else if ( $statusChanged ) { |
| 127 | + } elseif ( $statusChanged ) { |
128 | 128 | $this->mRev->emailNotifyUsersOfChanges( 'codereview-email-subj3', 'codereview-email-body3', |
129 | 129 | $wgUser->getName(), $this->mRev->getIdStringUnique(), $this->mRev->getOldStatus(), |
130 | 130 | $this->mRev->getStatus(), $url, $this->mRev->getMessage() |
131 | 131 | ); |
132 | | - } else if ( $commentAdded ) { |
| 132 | + } elseif ( $commentAdded ) { |
133 | 133 | $this->mRev->emailNotifyUsersOfChanges( 'codereview-email-subj', 'codereview-email-body', |
134 | 134 | $wgUser->getName(), $url, $this->mRev->getIdStringUnique(), $this->text, |
135 | 135 | $this->mRev->getMessage() |
Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php |
— | — | @@ -514,7 +514,7 @@ |
515 | 515 | );" ); |
516 | 516 | return wfMsg( 'code-load-diff' ); |
517 | 517 | } |
518 | | - |
| 518 | + |
519 | 519 | /** |
520 | 520 | * Format the sign-offs table |
521 | 521 | * @param $signOffs array |
— | — | @@ -652,7 +652,7 @@ |
653 | 653 | $line .= wfMsgHtml( 'code-status-' . $change->removed ); |
654 | 654 | $line .= $change->added ? " " : ""; // spacing |
655 | 655 | // Tag changes |
656 | | - } else if ( $change->attrib == 'tags' ) { |
| 656 | + } elseif ( $change->attrib == 'tags' ) { |
657 | 657 | $line .= htmlspecialchars( $change->removed ); |
658 | 658 | $line .= $change->added ? " " : ""; // spacing |
659 | 659 | } |
— | — | @@ -850,7 +850,7 @@ |
851 | 851 | ) ) . |
852 | 852 | ' ' . Xml::label( wfMsg( "code-signoff-flag-$flag" ), "wpSignoffFlags-$flag" ) . ' '; |
853 | 853 | } |
854 | | - return "<tr class='mw-codereview-signoffbuttons'><td colspan='4'>$strikeButton " . |
| 854 | + return "<tr class='mw-codereview-signoffbuttons'><td colspan='4'>$strikeButton " . |
855 | 855 | "<div class='mw-codereview-signoffchecks'>$signoffText $checks $signoffButton</div></td></tr>"; |
856 | 856 | } |
857 | 857 | |
Index: trunk/extensions/CodeReview/ui/CodeReleaseNotes.php |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | if ( preg_match( '/(^|\n) ?\*/', $summary ) ) { |
101 | 101 | $blurbs = explode( '*', $summary ); |
102 | 102 | # Double newlines separate importance generally |
103 | | - } else if ( strpos( $summary, "\n\n" ) !== false ) { |
| 103 | + } elseif ( strpos( $summary, "\n\n" ) !== false ) { |
104 | 104 | $blurbs = explode( "\n\n", $summary ); |
105 | 105 | } else { |
106 | 106 | return trim( $summary ); |
— | — | @@ -121,7 +121,7 @@ |
122 | 122 | if ( $header && $first && count( $summary ) == 0 ) { |
123 | 123 | $summary[] = $this->shortenSummary( $blurb, true ); |
124 | 124 | # Is this bit important? Does it mention a revision? |
125 | | - } else if ( $this->isRelevant( $blurb ) || preg_match( '/\br(\d+)\b/', $blurb ) ) { |
| 125 | + } elseif ( $this->isRelevant( $blurb ) || preg_match( '/\br(\d+)\b/', $blurb ) ) { |
126 | 126 | $bit = $this->shortenSummary( $blurb, false ); |
127 | 127 | if ( $bit ) $summary[] = $bit; |
128 | 128 | } |
Index: trunk/extensions/CommunityVoice/Modules/Ratings.php |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | ) { |
12 | 12 | if ( floor( $rating ) > $star ) { |
13 | 13 | return 6; |
14 | | - } else if ( floor( $rating ) < $star ) { |
| 14 | + } elseif ( floor( $rating ) < $star ) { |
15 | 15 | return 0; |
16 | 16 | } else { |
17 | 17 | return round( ( 6 / 10 ) * ( ( $rating - floor( $rating ) ) * 10 ) ); |
Index: trunk/extensions/DataCenter/UI/Widgets/History.php |
— | — | @@ -193,7 +193,7 @@ |
194 | 194 | $label = DataCenterUI::message( |
195 | 195 | 'field', strtr( $field, '_', '-' ) |
196 | 196 | ); |
197 | | - } else if ( $group == 'meta' ) { |
| 197 | + } elseif ( $group == 'meta' ) { |
198 | 198 | $metaField = DataCenterDB::getMetaField( $field ); |
199 | 199 | $label = $metaField->get( 'name' ); |
200 | 200 | } |
Index: trunk/extensions/DataCenter/UI/Widgets/Table.php |
— | — | @@ -153,7 +153,7 @@ |
154 | 154 | // Glues values together |
155 | 155 | $value = implode( $options['glue'], $values ); |
156 | 156 | // Alternatively checks if a field was specified |
157 | | - } else if ( $options['field'] ) { |
| 157 | + } elseif ( $options['field'] ) { |
158 | 158 | // Uses specified field |
159 | 159 | $value = DataCenterUI::format( |
160 | 160 | $row->get( $options['field'] ), $options['format'] |
Index: trunk/extensions/ArrayExtension/ArrayExtension.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Initialization file for the ArrayExtension extension. |
6 | | - * |
| 6 | + * |
7 | 7 | * Documentation: http://www.mediawiki.org/wiki/Extension:ArrayExtension |
8 | 8 | * Support http://www.mediawiki.org/wiki/Extension_talk:ArrayExtension |
9 | 9 | * Source code: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/ArrayExtension |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | |
103 | 103 | if ( !$this->is_non_empty( $value ) ) { |
104 | 104 | $this->mArrayExtension[$arrayid] = array(); |
105 | | - } else if ( !$this->is_non_empty( $delimiter ) ) { |
| 105 | + } elseif ( !$this->is_non_empty( $delimiter ) ) { |
106 | 106 | $this->mArrayExtension[$arrayid] = array( $value ); |
107 | 107 | } else { |
108 | 108 | if ( !$this->isValidRegEx( $delimiter ) ) { |
— | — | @@ -124,9 +124,9 @@ |
125 | 125 | if ( trim( $value ) == '' ) { |
126 | 126 | unset( $this->mArrayExtension[$arrayid][$key] ); |
127 | 127 | } |
128 | | - } |
| 128 | + } |
129 | 129 | } |
130 | | - |
| 130 | + |
131 | 131 | // make it unique if option is set |
132 | 132 | if ( array_key_exists( 'unique', $ary_option ) ) { |
133 | 133 | $this->arrayunique( $parser, $arrayid ); |
— | — | @@ -139,7 +139,7 @@ |
140 | 140 | if ( strcmp( 'list', $this->get_array_value( $ary_option, 'print' ) ) === 0 ) { |
141 | 141 | return $this->arrayprint( $parser, $arrayid ); |
142 | 142 | } |
143 | | - else if ( strcmp( 'full', $this->get_array_value( $ary_option, 'print' ) ) === 0 ) { |
| 143 | + elseif ( strcmp( 'full', $this->get_array_value( $ary_option, 'print' ) ) === 0 ) { |
144 | 144 | return $this->arrayprint( $parser, $arrayid, $delimiter2, $search, $subject, $frame ); |
145 | 145 | } |
146 | 146 | } |
Index: trunk/extensions/ContactPageFundraiser/SpecialContact.php |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | $form['url'] = $wgRequest->getVal('url'); |
53 | 53 | $form['country'] = $wgRequest->getVal('country'); |
54 | 54 | $form['citytown'] = $wgRequest->getVal('city-town'); |
55 | | - $form['provstat'] = $wgRequest->getVal('prov-state'); |
| 55 | + $form['provstat'] = $wgRequest->getVal('prov-state'); |
56 | 56 | $form['story'] = $wgRequest->getVal('story'); |
57 | 57 | $form['followup'] = $wgRequest->getVal('follow-up'); |
58 | 58 | |
— | — | @@ -81,7 +81,7 @@ |
82 | 82 | if ( "success" == $action ) { |
83 | 83 | wfDebug( "$fname: success.\n" ); |
84 | 84 | $f->showSuccess( ); |
85 | | - } else if ( "submit" == $action && $wgRequest->wasPosted() && $f->hasAllInfo() ) { |
| 85 | + } elseif ( "submit" == $action && $wgRequest->wasPosted() && $f->hasAllInfo() ) { |
86 | 86 | $token = $wgRequest->getVal( 'wpEditToken' ); |
87 | 87 | |
88 | 88 | if( $wgUser->isAnon() ) { |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | wfDebug( "$fname: bad token (".($wgUser->isAnon()?'anon':'user')."): $token\n" ); |
98 | 98 | $wgOut->addWikiText( wfMsg( 'sessionfailure' ) ); |
99 | 99 | $f->showForm(); |
100 | | - } else if ( !$f->passCaptcha() ) { |
| 100 | + } elseif ( !$f->passCaptcha() ) { |
101 | 101 | wfDebug( "$fname: captcha failed" ); |
102 | 102 | $wgOut->addWikiText( wfMsg( 'contactpage-captcha-failed' ) ); //TODO: provide a message for this! |
103 | 103 | $f->showForm(); |
— | — | @@ -147,7 +147,7 @@ |
148 | 148 | $captcha->action = 'contact'; |
149 | 149 | } |
150 | 150 | } |
151 | | - |
| 151 | + |
152 | 152 | function setText( $text ) { |
153 | 153 | $this->text = $text; |
154 | 154 | } |
— | — | @@ -255,7 +255,7 @@ |
256 | 256 | |
257 | 257 | function getCaptcha() { |
258 | 258 | global $wgCaptcha; |
259 | | - if ( !$this->useCaptcha() ) return ""; |
| 259 | + if ( !$this->useCaptcha() ) return ""; |
260 | 260 | |
261 | 261 | wfSetupSession(); #NOTE: make sure we have a session. May be required for captchas to work. |
262 | 262 | |
— | — | @@ -290,7 +290,7 @@ |
291 | 291 | if ( !$this->fromaddress ) { |
292 | 292 | $from = new MailAddress( $csender, $cname ); |
293 | 293 | } |
294 | | - else if ( $wgUserEmailUseReplyTo ) { |
| 294 | + elseif ( $wgUserEmailUseReplyTo ) { |
295 | 295 | $from = new MailAddress( $csender, $cname ); |
296 | 296 | $replyto = new MailAddress( $this->fromaddress, $this->fromname ); |
297 | 297 | } |
— | — | @@ -307,7 +307,7 @@ |
308 | 308 | if ( $this->fromname !== "" ) { |
309 | 309 | $subject = wfMsgForContent( "contactpage-subject-and-sender", $subject, $this->fromname ); |
310 | 310 | } |
311 | | - else if ( $this->fromaddress !== "" ) { |
| 311 | + elseif ( $this->fromaddress !== "" ) { |
312 | 312 | $subject = wfMsgForContent( "contactpage-subject-and-sender", $subject, $this->fromaddress ); |
313 | 313 | } |
314 | 314 | |
Index: trunk/extensions/DataTransclusion/WebDataTransclusionSource.php |
— | — | @@ -22,9 +22,9 @@ |
23 | 23 | * WebDataTransclusionSource accepts some additional options |
24 | 24 | * |
25 | 25 | * * $spec['url']: base URL for building urls for retrieving individual records. |
26 | | - * If the URL contains placeholders of the form {xxx}, these get replaced |
| 26 | + * If the URL contains placeholders of the form {xxx}, these get replaced |
27 | 27 | * by the respective key or option values. |
28 | | - * Otherwise, the key/value pair and options get appended to the URL as a |
| 28 | + * Otherwise, the key/value pair and options get appended to the URL as a |
29 | 29 | * regular URL parameter (preceeded by ? or &, as appropriate). For more |
30 | 30 | * complex rules for building the url, override getRecordURL(). REQUIRED. |
31 | 31 | * * $spec['dataFormat']: Serialization format returned from the web service. |
— | — | @@ -33,12 +33,12 @@ |
34 | 34 | * 'xml' is supported, but requires a transformer that can handle an XML DOM |
35 | 35 | * as input. To support more formats, override decodeData(). Default is 'php'. |
36 | 36 | * * $spec['dataPath']: "path" to the actual data in the structure returned from the |
37 | | - * HTTP request. This is only used if no transformer is set. The syntax of the |
38 | | - * path is the one defined for the dataPath parameter for the FlattenRecord |
| 37 | + * HTTP request. This is only used if no transformer is set. The syntax of the |
| 38 | + * path is the one defined for the dataPath parameter for the FlattenRecord |
39 | 39 | * transformer. REQUIRED if no transformer is defined. |
40 | 40 | * * $spec['errorPath']: "path" to error messages in the structure returned from the |
41 | | - * HTTP request. This is only used if no transformer is set. The syntax of the |
42 | | - * path is the one defined for the dataPath parameter for the FlattenRecord |
| 41 | + * HTTP request. This is only used if no transformer is set. The syntax of the |
| 42 | + * path is the one defined for the dataPath parameter for the FlattenRecord |
43 | 43 | * transformer. REQUIRED if no transformer is defined. |
44 | 44 | * * $spec['httpOptions']: array of options to pass to Http::get. For details, see Http::request. |
45 | 45 | * * $spec['timeout']: seconds before the request times out. If not given, |
— | — | @@ -78,28 +78,28 @@ |
79 | 79 | } |
80 | 80 | |
81 | 81 | public function fetchRawRecord( $field, $value, $options = null ) { |
82 | | - $raw = $this->loadRecordData( $field, $value, $options ); |
| 82 | + $raw = $this->loadRecordData( $field, $value, $options ); |
83 | 83 | if ( !$raw ) { |
84 | 84 | wfDebugLog( 'DataTransclusion', "failed to fetch data for $field=$value\n" ); |
85 | | - return false; |
| 85 | + return false; |
86 | 86 | } |
87 | 87 | |
88 | | - $data = $this->decodeData( $raw, $this->dataFormat ); |
| 88 | + $data = $this->decodeData( $raw, $this->dataFormat ); |
89 | 89 | if ( !$data ) { |
90 | 90 | wfDebugLog( 'DataTransclusion', "failed to decode data for $field=$value as {$this->dataFormat}\n" ); |
91 | | - return false; |
| 91 | + return false; |
92 | 92 | } |
93 | 93 | |
94 | | - $err = $this->extractError( $data ); |
| 94 | + $err = $this->extractError( $data ); |
95 | 95 | if ( $err ) { |
96 | 96 | wfDebugLog( 'DataTransclusion', "error message when fetching $field=$value: $err\n" ); |
97 | | - return false; |
| 97 | + return false; |
98 | 98 | } |
99 | 99 | |
100 | | - $rec = $this->extractRecord( $data ); |
| 100 | + $rec = $this->extractRecord( $data ); |
101 | 101 | if ( !$rec ) { |
102 | 102 | wfDebugLog( 'DataTransclusion', "no record found in data for $field=$value\n" ); |
103 | | - return false; |
| 103 | + return false; |
104 | 104 | } |
105 | 105 | |
106 | 106 | wfDebugLog( 'DataTransclusion', "loaded record for $field=$value from URL\n" ); |
— | — | @@ -113,7 +113,7 @@ |
114 | 114 | |
115 | 115 | if ( $options ) { |
116 | 116 | $args = array_merge( $options, $args ); |
117 | | - } |
| 117 | + } |
118 | 118 | |
119 | 119 | foreach ( $args as $k => $v ) { |
120 | 120 | $u = str_replace( '{'.$k.'}', urlencode( $v ), $u, $n ); |
— | — | @@ -149,7 +149,7 @@ |
150 | 150 | if ( preg_match( '!^https?://!', $u ) ) { |
151 | 151 | $raw = Http::get( $u, $this->timeout, $this->httpOptions ); |
152 | 152 | } else { |
153 | | - $raw = file_get_contents( $u ); |
| 153 | + $raw = file_get_contents( $u ); |
154 | 154 | } |
155 | 155 | |
156 | 156 | if ( $raw ) { |
— | — | @@ -167,13 +167,13 @@ |
168 | 168 | } |
169 | 169 | |
170 | 170 | if ( $format == 'json' || $format == 'js' ) { |
171 | | - return DataTransclusionSource::decodeJson( $raw ); |
172 | | - } else if ( $format == 'wddx' ) { |
173 | | - return DataTransclusionSource::decodeWddx( $raw ); |
174 | | - } else if ( $format == 'xml' ) { |
175 | | - return DataTransclusionSource::parseXml( $raw ); |
176 | | - } else if ( $format == 'php' || $format == 'pser' ) { |
177 | | - return DataTransclusionSource::decodeSerialized( $raw ); |
| 171 | + return DataTransclusionSource::decodeJson( $raw ); |
| 172 | + } elseif ( $format == 'wddx' ) { |
| 173 | + return DataTransclusionSource::decodeWddx( $raw ); |
| 174 | + } elseif ( $format == 'xml' ) { |
| 175 | + return DataTransclusionSource::parseXml( $raw ); |
| 176 | + } elseif ( $format == 'php' || $format == 'pser' ) { |
| 177 | + return DataTransclusionSource::decodeSerialized( $raw ); |
178 | 178 | } |
179 | 179 | |
180 | 180 | return false; |
Index: trunk/extensions/DataTransclusion/DataTransclusionSource.php |
— | — | @@ -38,11 +38,11 @@ |
39 | 39 | * may allow different hints for each field. The following hints are known per |
40 | 40 | * default: |
41 | 41 | * * $spec['fieldInfo'][$field]['type']: specifies the data types for the field: |
42 | | - * 'int' for integers, 'float' or 'decimal' for decimals, or 'string' for |
| 42 | + * 'int' for integers, 'float' or 'decimal' for decimals, or 'string' for |
43 | 43 | * string fields. Serialization types 'json', 'wddx' and 'php' are also |
44 | 44 | * supported. Defaults to 'string'. |
45 | 45 | * * $spec['fieldInfo'][$field]['normalization']: normalization to be applied for |
46 | | - * this field, when used as a query key. This may be a callable, or an object |
| 46 | + * this field, when used as a query key. This may be a callable, or an object |
47 | 47 | * that supports the function normalize(), or a regular expression for patterns |
48 | 48 | * to be removed from the value. |
49 | 49 | * * $spec['cacheDuration']: the number of seconds a result from this source |
— | — | @@ -61,10 +61,10 @@ |
62 | 62 | * class forces $spec['sourceInfo']['source-name'] = $spec['name']. |
63 | 63 | * * $spec['transformer']: a record transformer specification. This may be an |
64 | 64 | * instance of RecordTransformer, or an associative array specifying a |
65 | | - * record transformer which can then be created using |
66 | | - * RecordTransformer::newRecordTransformer. In that case, |
| 65 | + * record transformer which can then be created using |
| 66 | + * RecordTransformer::newRecordTransformer. In that case, |
67 | 67 | * $spec['transformer']['class'] must be the class name of the desired |
68 | | - * RecordTransformer implementation. Other entries in that array are |
| 68 | + * RecordTransformer implementation. Other entries in that array are |
69 | 69 | * specific to the individual transformers. |
70 | 70 | * |
71 | 71 | * Options used by DataTransclusionHandler but ignored by DataTransclusionSource: |
— | — | @@ -108,14 +108,14 @@ |
109 | 109 | |
110 | 110 | if ( isset( $spec[ 'fieldNames' ] ) ) { |
111 | 111 | $this->fieldNames = self::splitList( $spec[ 'fieldNames' ] ); |
112 | | - } else if ( isset( $spec[ 'fieldInfo' ] ) ) { |
| 112 | + } elseif ( isset( $spec[ 'fieldInfo' ] ) ) { |
113 | 113 | $this->fieldNames = array_keys( $spec[ 'fieldInfo' ] ); |
114 | 114 | } else { |
115 | 115 | $this->fieldNames = $this->keyFields; |
116 | 116 | |
117 | 117 | if ( !empty( $this->fieldInfo ) ) { |
118 | 118 | $this->fieldNames = array_merge( $this->fieldNames, array_keys( $this->fieldInfo ) ); |
119 | | - } |
| 119 | + } |
120 | 120 | |
121 | 121 | $this->fieldNames = array_unique( $this->fieldNames ); |
122 | 122 | } |
— | — | @@ -149,7 +149,7 @@ |
150 | 150 | |
151 | 151 | public function normalize( $key, $value, $norm = null ) { |
152 | 152 | if ( $norm ); |
153 | | - else if ( isset( $this->fieldInfo[ $key ]['normalization'] ) ) { |
| 153 | + elseif ( isset( $this->fieldInfo[ $key ]['normalization'] ) ) { |
154 | 154 | $norm = trim( $this->fieldInfo[ $key ]['normalization'] ); |
155 | 155 | } else { |
156 | 156 | return $value; |
— | — | @@ -157,9 +157,9 @@ |
158 | 158 | |
159 | 159 | if ( is_object( $norm ) ) { |
160 | 160 | return $norm->normalize( $value ); |
161 | | - } else if ( is_callable( $norm ) || preg_match( '/^(\w[\w\d]*::)?(\w[\w\d]*)$/', $norm ) ) { |
| 161 | + } elseif ( is_callable( $norm ) || preg_match( '/^(\w[\w\d]*::)?(\w[\w\d]*)$/', $norm ) ) { |
162 | 162 | return call_user_func( $norm, $value ); |
163 | | - } else if ( is_array( $norm ) ) { |
| 163 | + } elseif ( is_array( $norm ) ) { |
164 | 164 | return preg_replace( $norm[0], $norm[1], $value ); |
165 | 165 | } else { |
166 | 166 | return preg_replace( $norm, '', $value ); |
— | — | @@ -168,24 +168,24 @@ |
169 | 169 | |
170 | 170 | public function convert( $key, $value, $format = null ) { |
171 | 171 | if ( $format ); |
172 | | - else if ( isset( $this->fieldInfo[ $key ]['type'] ) ) { |
| 172 | + elseif ( isset( $this->fieldInfo[ $key ]['type'] ) ) { |
173 | 173 | $format = strtolower( trim( $this->fieldInfo[ $key ]['type'] ) ); |
174 | 174 | } else { |
175 | 175 | return (string)$value; |
176 | 176 | } |
177 | | - |
| 177 | + |
178 | 178 | if ( $format == 'int' ) { |
179 | 179 | return (int)$value; |
180 | | - } else if ( $format == 'decimal' || $format == 'float' ) { |
| 180 | + } elseif ( $format == 'decimal' || $format == 'float' ) { |
181 | 181 | return (float)$value; |
182 | | - } else if ( $format == 'json' || $format == 'js' ) { |
183 | | - return DataTransclusionSource::decodeJson( $value ); |
184 | | - } else if ( $format == 'wddx' ) { |
185 | | - return DataTransclusionSource::decodeWddx( $value ); |
186 | | - } else if ( $format == 'xml' ) { |
| 182 | + } elseif ( $format == 'json' || $format == 'js' ) { |
| 183 | + return DataTransclusionSource::decodeJson( $value ); |
| 184 | + } elseif ( $format == 'wddx' ) { |
| 185 | + return DataTransclusionSource::decodeWddx( $value ); |
| 186 | + } elseif ( $format == 'xml' ) { |
187 | 187 | return DataTransclusionSource::parseXml( $value ); #WARNING: returns DOM |
188 | | - } else if ( $format == 'php' || $format == 'pser' ) { |
189 | | - return DataTransclusionSource::decodeSerialized( $value ); |
| 188 | + } elseif ( $format == 'php' || $format == 'pser' ) { |
| 189 | + return DataTransclusionSource::decodeSerialized( $value ); |
190 | 190 | } else { |
191 | 191 | return (string)$value; |
192 | 192 | } |
— | — | @@ -220,7 +220,7 @@ |
221 | 221 | |
222 | 222 | public function fetchRecord( $field, $value, $options = null ) { |
223 | 223 | $value = $this->normalize( $field, $value ); |
224 | | - $value = $this->convert( $field, $value ); |
| 224 | + $value = $this->convert( $field, $value ); |
225 | 225 | |
226 | 226 | $rec = $this->fetchRawRecord( $field, $value, $options ); |
227 | 227 | |
— | — | @@ -232,16 +232,16 @@ |
233 | 233 | } |
234 | 234 | |
235 | 235 | public static function decodeSerialized( $raw ) { |
236 | | - return unserialize( $raw ); |
| 236 | + return unserialize( $raw ); |
237 | 237 | } |
238 | 238 | |
239 | 239 | public static function decodeJson( $raw ) { |
240 | 240 | $raw = preg_replace( '/^\s*(var\s)?\w([\w\d]*)\s+=\s*|\s*;\s*$/sim', '', $raw); |
241 | | - return FormatJson::decode( $raw, true ); |
| 241 | + return FormatJson::decode( $raw, true ); |
242 | 242 | } |
243 | 243 | |
244 | 244 | public static function decodeWddx( $raw ) { |
245 | | - return wddx_unserialize( $raw ); |
| 245 | + return wddx_unserialize( $raw ); |
246 | 246 | } |
247 | 247 | |
248 | 248 | public static function parseXml( $raw ) { |
— | — | @@ -249,7 +249,7 @@ |
250 | 250 | $dom->loadXML( $raw ); |
251 | 251 | |
252 | 252 | #NOTE: returns a DOM, RecordTransformer must be aware! |
253 | | - return $dom->documentElement; |
| 253 | + return $dom->documentElement; |
254 | 254 | } |
255 | 255 | } |
256 | 256 | |
— | — | @@ -302,30 +302,30 @@ |
303 | 303 | |
304 | 304 | public function fetchRecord( $field, $value, $options = null ) { |
305 | 305 | global $wgDBname, $wgUser; |
306 | | - |
| 306 | + |
307 | 307 | $k = "$field=$value"; |
308 | 308 | if ( $options ) { |
309 | 309 | $k .= "&" . sha1( var_export( $options, false ) ); |
310 | 310 | } |
311 | 311 | |
312 | 312 | $cacheKey = "$wgDBname:DataTransclusion(" . $this->getName() . ":$k)"; |
313 | | - |
| 313 | + |
314 | 314 | $rec = $this->cache->get( $cacheKey ); |
315 | | - |
| 315 | + |
316 | 316 | if ( !$rec ) { |
317 | 317 | wfDebugLog( 'DataTransclusion', "fetching fresh record for $field=$value\n" ); |
318 | 318 | $rec = $this->source->fetchRecord( $field, $value, $options ); |
319 | | - |
| 319 | + |
320 | 320 | if ( $rec ) { // XXX: also cache negatives?? |
321 | 321 | $duration = $this->getCacheDuration(); |
322 | | - |
| 322 | + |
323 | 323 | wfDebugLog( 'DataTransclusion', "caching record for $field=$value for $duration sec\n" ); |
324 | | - $this->cache->set( $cacheKey, $rec, $duration ) ; |
| 324 | + $this->cache->set( $cacheKey, $rec, $duration ) ; |
325 | 325 | } |
326 | 326 | } else { |
327 | 327 | wfDebugLog( 'DataTransclusion', "using cached record for $field=$value\n" ); |
328 | 328 | } |
329 | | - |
| 329 | + |
330 | 330 | return $rec; |
331 | 331 | } |
332 | 332 | } |
Index: trunk/extensions/DataTransclusion/MAB2RecordTransformer.php |
— | — | @@ -63,7 +63,7 @@ |
64 | 64 | * No configuration options are needed. |
65 | 65 | */ |
66 | 66 | class MAB2RecordTransformer extends RecordTransformer { |
67 | | - |
| 67 | + |
68 | 68 | /** |
69 | 69 | * Initializes the RecordTransformer from the given parameter array. |
70 | 70 | * @param $spec associative array of options. See class-level documentation for details. |
— | — | @@ -113,14 +113,14 @@ |
114 | 114 | |
115 | 115 | foreach ($r as $f => $values) { |
116 | 116 | if ( count($values) == 0 ) unset( $r[ $f ] ); |
117 | | - else if ( count($values) == 1 ) $r[ $f ] = MAB2RecordTransformer::mangleValue( $values[0] ); |
| 117 | + elseif ( count($values) == 1 ) $r[ $f ] = MAB2RecordTransformer::mangleValue( $values[0] ); |
118 | 118 | else { |
119 | 119 | $values = array_unique( $values ); |
120 | 120 | $values = array_map( array('MAB2RecordTransformer', 'mangleValue'), $values ); |
121 | 121 | $r[ $f ] = join(', ', $values); |
122 | 122 | } |
123 | 123 | } |
124 | | - |
| 124 | + |
125 | 125 | return $r; |
126 | 126 | } |
127 | 127 | |
— | — | @@ -134,9 +134,9 @@ |
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
138 | | - * Extracts any error message from the $data from the data source. This is done |
| 138 | + * Extracts any error message from the $data from the data source. This is done |
139 | 139 | * by calling resolvePath() on the $spec['errorPath'] provided to the constructor. |
140 | | - * |
| 140 | + * |
141 | 141 | * @param $rec a structured data response, as received from the data source |
142 | 142 | */ |
143 | 143 | public function extractError( $data ) { |
— | — | @@ -154,9 +154,9 @@ |
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
158 | | - * Extracts the actual data record from the $data from the data source. This is done |
| 158 | + * Extracts the actual data record from the $data from the data source. This is done |
159 | 159 | * by calling resolvePath() on the $spec['dataPath'] provided to the constructor. |
160 | | - * |
| 160 | + * |
161 | 161 | * @param $rec a structured data response, as received from the data source |
162 | 162 | */ |
163 | 163 | public function extractRecord( $data ) { |
Index: trunk/extensions/DataTransclusion/DataTransclusionHandler.php |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | if ( empty( $argv['source'] ) ) { |
101 | 101 | if ( empty( $argv[1] ) ) { |
102 | 102 | wfDebugLog( 'DataTransclusion', "no source specified\n" ); |
103 | | - return DataTransclusionHandler::errorMessage( 'datatransclusion-missing-source', $asHTML ); |
| 103 | + return DataTransclusionHandler::errorMessage( 'datatransclusion-missing-source', $asHTML ); |
104 | 104 | } else { |
105 | 105 | $sourceName = $argv[1]; |
106 | 106 | } |
— | — | @@ -110,20 +110,20 @@ |
111 | 111 | $source = DataTransclusionHandler::getDataSource( $sourceName ); |
112 | 112 | if ( empty( $source ) ) { |
113 | 113 | wfDebugLog( 'DataTransclusion', "unknown source: $sourceName\n" ); |
114 | | - return DataTransclusionHandler::errorMessage( 'datatransclusion-unknown-source', $asHTML, $sourceName ); |
| 114 | + return DataTransclusionHandler::errorMessage( 'datatransclusion-unknown-source', $asHTML, $sourceName ); |
115 | 115 | } |
116 | 116 | |
117 | 117 | // find out how to render the record |
118 | 118 | if ( !empty( $argv['template'] ) ) { |
119 | 119 | $template = $argv['template']; |
120 | | - } else if ( $template === null || $template === false ) { |
| 120 | + } elseif ( $template === null || $template === false ) { |
121 | 121 | if ( empty( $argv[0] ) ) { |
122 | 122 | wfDebugLog( 'DataTransclusion', "missing 'template' argument\n" ); |
123 | | - return DataTransclusionHandler::errorMessage( 'datatransclusion-missing-argument-template', $asHTML ); |
| 123 | + return DataTransclusionHandler::errorMessage( 'datatransclusion-missing-argument-template', $asHTML ); |
124 | 124 | } else { |
125 | 125 | $template = $argv[0]; |
126 | 126 | } |
127 | | - } |
| 127 | + } |
128 | 128 | |
129 | 129 | // find key |
130 | 130 | $by = false; |
— | — | @@ -140,8 +140,8 @@ |
141 | 141 | if ( !$by ) { |
142 | 142 | global $wgContLang; |
143 | 143 | wfDebugLog( 'DataTransclusion', "no key specified\n" ); |
144 | | - return DataTransclusionHandler::errorMessage( 'datatransclusion-missing-key', $asHTML, $sourceName, |
145 | | - $wgContLang->commaList( $keyFields ), count( $keyFields ) ); |
| 144 | + return DataTransclusionHandler::errorMessage( 'datatransclusion-missing-key', $asHTML, $sourceName, |
| 145 | + $wgContLang->commaList( $keyFields ), count( $keyFields ) ); |
146 | 146 | } |
147 | 147 | |
148 | 148 | // collect options |
— | — | @@ -159,17 +159,17 @@ |
160 | 160 | $record = $source->fetchRecord( $by, $key, $options ); |
161 | 161 | if ( empty( $record ) ) { |
162 | 162 | wfDebugLog( 'DataTransclusion', "no record found matching $by=$key in $sourceName\n" ); |
163 | | - return DataTransclusionHandler::errorMessage( 'datatransclusion-record-not-found', $asHTML, $sourceName, $by, $key ); |
| 163 | + return DataTransclusionHandler::errorMessage( 'datatransclusion-record-not-found', $asHTML, $sourceName, $by, $key ); |
164 | 164 | } |
165 | 165 | |
166 | 166 | // render the record into wiki text |
167 | 167 | if ( $template === "#dump" ) { |
168 | | - $t = null; |
| 168 | + $t = null; |
169 | 169 | } else { |
170 | 170 | $t = Title::newFromText( $template, NS_TEMPLATE ); |
171 | 171 | if ( empty( $t ) ) { |
172 | 172 | wfDebugLog( 'DataTransclusion', "illegal template name: $template\n" ); |
173 | | - return DataTransclusionHandler::errorMessage( 'datatransclusion-bad-template-name', $asHTML, $template ); |
| 173 | + return DataTransclusionHandler::errorMessage( 'datatransclusion-bad-template-name', $asHTML, $template ); |
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
— | — | @@ -180,7 +180,7 @@ |
181 | 181 | |
182 | 182 | if ( $text === false ) { |
183 | 183 | wfDebugLog( 'DataTransclusion', "template not found: $template\n" ); |
184 | | - return DataTransclusionHandler::errorMessage( 'datatransclusion-unknown-template', $asHTML, $template ); |
| 184 | + return DataTransclusionHandler::errorMessage( 'datatransclusion-unknown-template', $asHTML, $template ); |
185 | 185 | } |
186 | 186 | |
187 | 187 | // set parser output expiry |
— | — | @@ -191,9 +191,9 @@ |
192 | 192 | |
193 | 193 | if ( $asHTML && $parser ) { // render into HTML if desired |
194 | 194 | $html = $parser->recursiveTagParse( $text ); |
195 | | - return $html; |
| 195 | + return $html; |
196 | 196 | } else { |
197 | | - return $text; |
| 197 | + return $text; |
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
— | — | @@ -217,9 +217,9 @@ |
218 | 218 | $this->templateText .= "| $k || {{{{$k}}}}\n"; |
219 | 219 | } |
220 | 220 | $this->templateText .= "|}\n"; |
221 | | - } |
| 221 | + } |
222 | 222 | |
223 | | - if ( $this->templateText ) { |
| 223 | + if ( $this->templateText ) { |
224 | 224 | // explicit template content set. Used for testing and debugging. |
225 | 225 | if ( is_string( $this->templateText ) ) { |
226 | 226 | $text = $this->templateText; |
— | — | @@ -236,7 +236,7 @@ |
237 | 237 | $article = new Article( $this->template ); |
238 | 238 | |
239 | 239 | if ( !$article->exists() ) { |
240 | | - return false; |
| 240 | + return false; |
241 | 241 | } |
242 | 242 | |
243 | 243 | $text = $article->getContent(); |
— | — | @@ -244,7 +244,7 @@ |
245 | 245 | //NOTE: would need extra work to record template inclusion to be recorded in the ParserOutput and consequently in the database. |
246 | 246 | */ |
247 | 247 | |
248 | | - // NOTE: braceSubstitution caches pre-parsed templates. Much nicer. |
| 248 | + // NOTE: braceSubstitution caches pre-parsed templates. Much nicer. |
249 | 249 | // TODO: but how to check if the template exists? calling $article->exists() every time is slow. |
250 | 250 | // once we test for that agin, re-enable the test case for the datatransclusion-unknown-template failure mode |
251 | 251 | $frame = $this->parser->getPreprocessor()->newFrame( ); |
— | — | @@ -268,9 +268,9 @@ |
269 | 269 | function normalizeRecord( $record, $args ) { |
270 | 270 | $rec = array(); |
271 | 271 | |
272 | | - // add source meta info, so we can render links back to the source, |
| 272 | + // add source meta info, so we can render links back to the source, |
273 | 273 | // provide license info, etc |
274 | | - $info = $this->source->getSourceInfo(); |
| 274 | + $info = $this->source->getSourceInfo(); |
275 | 275 | foreach ( $info as $f => $v ) { |
276 | 276 | if ( is_array( $v ) || is_object( $v ) || is_resource( $v ) ) { |
277 | 277 | continue; |
— | — | @@ -299,7 +299,7 @@ |
300 | 300 | $v = ''; |
301 | 301 | } |
302 | 302 | |
303 | | - $rec[ $f ] = $this->sanitizeValue( $v ); |
| 303 | + $rec[ $f ] = $this->sanitizeValue( $v ); |
304 | 304 | } |
305 | 305 | |
306 | 306 | return $rec; |
— | — | @@ -378,7 +378,7 @@ |
379 | 379 | if ( !is_object( $source ) ) { |
380 | 380 | throw new MWException( "\$wgDataTransclusionSources['$name'] must be an array or an object." ); |
381 | 381 | } |
382 | | - |
| 382 | + |
383 | 383 | return $source; |
384 | 384 | } |
385 | 385 | |
Index: trunk/extensions/DataTransclusion/ImportMAB2.php |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | $sql = "CREATE TABLE IF NOT EXISTS " . $this->index_table . " ( "; |
57 | 57 | $sql .= " field VARCHAR(255) NOT NULL, "; #FIXME: varchar vs varbinary! |
58 | 58 | $sql .= " value VARCHAR(255) NOT NULL, "; #FIXME: varchar vs varbinary! |
59 | | - $sql .= " data_id INT(12) NOT NULL, "; |
| 59 | + $sql .= " data_id INT(12) NOT NULL, "; |
60 | 60 | $sql .= " PRIMARY KEY (field, value, data_id) "; #NOTE: we don't require (field,value) to be unique! |
61 | 61 | $sql .= ") "; |
62 | 62 | $db->query( $sql, __METHOD__ ); |
— | — | @@ -122,7 +122,7 @@ |
123 | 123 | if ( $this->hasOption('create') ) { |
124 | 124 | $this->output( "creating tables if neccessary.\n" ); |
125 | 125 | $this->createTables( $this->blob_table, $this->index_table ); |
126 | | - } |
| 126 | + } |
127 | 127 | |
128 | 128 | if ( $this->hasOption('truncate') ) { |
129 | 129 | $this->output( "truncating tables.\n" ); |
— | — | @@ -179,7 +179,7 @@ |
180 | 180 | if ( is_dir( $dir . $file ) && $recursive ) { |
181 | 181 | $this->importDir( $dir . $file, $recursive, $limit ); |
182 | 182 | continue; |
183 | | - } else if ( !is_file( $dir . $file ) ) { |
| 183 | + } elseif ( !is_file( $dir . $file ) ) { |
184 | 184 | $this->output( "not a file: $dir/$file\n" ); |
185 | 185 | continue; |
186 | 186 | } |
— | — | @@ -188,7 +188,7 @@ |
189 | 189 | |
190 | 190 | if ( !$ok ) { |
191 | 191 | $this->output( "error processing $file\n" ); |
192 | | - } |
| 192 | + } |
193 | 193 | |
194 | 194 | if ( $limit > 0 ) { |
195 | 195 | $limit -= 1; |
— | — | @@ -245,7 +245,7 @@ |
246 | 246 | $insert = array(); |
247 | 247 | foreach ( $ids as $field => $values ) { |
248 | 248 | foreach ( $values as $v ) { |
249 | | - $insert[] = array( |
| 249 | + $insert[] = array( |
250 | 250 | 'field' => $field, |
251 | 251 | 'value' => $v, |
252 | 252 | 'data_id' => $id ); |
— | — | @@ -283,7 +283,7 @@ |
284 | 284 | |
285 | 285 | if ( $this->debug ) { |
286 | 286 | print "== $file =======================\n"; |
287 | | - } else if ( $this->multiRecord ) { |
| 287 | + } elseif ( $this->multiRecord ) { |
288 | 288 | $this->output( "reading records from $file\n" ); |
289 | 289 | } |
290 | 290 | |
Index: trunk/extensions/DataTransclusion/tests/DataTransclusionTest.php |
— | — | @@ -4,24 +4,24 @@ |
5 | 5 | echo( "This file cannot be run from the web.\n" ); |
6 | 6 | die( 1 ); |
7 | 7 | } |
8 | | - |
| 8 | + |
9 | 9 | if ( getenv( 'MW_INSTALL_PATH' ) ) { |
10 | 10 | $IP = getenv( 'MW_INSTALL_PATH' ); |
11 | 11 | } else { |
12 | 12 | $dir = dirname( __FILE__ ); |
13 | | - |
| 13 | + |
14 | 14 | if ( file_exists( "$dir/../../LocalSettings.php" ) ) $IP = "$dir/../.."; |
15 | | - else if ( file_exists( "$dir/../../../LocalSettings.php" ) ) $IP = "$dir/../../.."; |
16 | | - else if ( file_exists( "$dir/../../phase3/LocalSettings.php" ) ) $IP = "$dir/../../phase3"; |
17 | | - else if ( file_exists( "$dir/../../../phase3/LocalSettings.php" ) ) $IP = "$dir/../../../phase3"; |
| 15 | + elseif ( file_exists( "$dir/../../../LocalSettings.php" ) ) $IP = "$dir/../../.."; |
| 16 | + elseif ( file_exists( "$dir/../../phase3/LocalSettings.php" ) ) $IP = "$dir/../../phase3"; |
| 17 | + elseif ( file_exists( "$dir/../../../phase3/LocalSettings.php" ) ) $IP = "$dir/../../../phase3"; |
18 | 18 | else $IP = $dir; |
19 | 19 | } |
20 | | - |
| 20 | + |
21 | 21 | require_once( "$IP/maintenance/commandLine.inc" ); |
22 | | - |
| 22 | + |
23 | 23 | // requires PHPUnit 3.4 |
24 | 24 | require_once 'PHPUnit/Framework.php'; |
25 | | - |
| 25 | + |
26 | 26 | error_reporting( E_ALL ); |
27 | 27 | } |
28 | 28 | |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | return Parser::statelessFetchTemplate( $title, $parser ); |
48 | 48 | } |
49 | 49 | } |
50 | | - |
| 50 | + |
51 | 51 | static function setUpBeforeClass() { |
52 | 52 | global $wgTitle, $wgParser; |
53 | 53 | $wgTitle = Title::newFromText( "Test" ); |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | $wgParser->clearState(); |
62 | 62 | $wgParser->setTitle( $wgTitle ); |
63 | 63 | } |
64 | | - |
| 64 | + |
65 | 65 | function testErrorMessage() { |
66 | 66 | $m = DataTransclusionHandler::errorMessage( 'datatransclusion-test-wikitext', false ); |
67 | 67 | $this->assertEquals( '<span class="error datatransclusion-test-wikitext">some <span class="test">html</span> and \'\'markup\'\'.</span>', $m ); |
— | — | @@ -130,12 +130,12 @@ |
131 | 131 | |
132 | 132 | $src = DataTransclusionHandler::getDataSource( 'FOO' ); |
133 | 133 | $this->assertTrue( $src instanceof FakeDataTransclusionSource ); |
134 | | - |
| 134 | + |
135 | 135 | $rec = $src->fetchRecord( 'id', 3 ); |
136 | 136 | $this->assertEquals( 3, $rec['id'] ); |
137 | 137 | $this->assertEquals( 'foo', $rec['name'] ); |
138 | 138 | $this->assertEquals( 'test 1', $rec['info'] ); |
139 | | - |
| 139 | + |
140 | 140 | $rec = $src->fetchRecord( 'name', 'bar' ); |
141 | 141 | $this->assertEquals( 5, $rec['id'] ); |
142 | 142 | $this->assertEquals( 'bar', $rec['name'] ); |
— | — | @@ -150,12 +150,12 @@ |
151 | 151 | $src = DataTransclusionHandler::getDataSource( 'BAR' ); |
152 | 152 | $this->assertTrue( $src instanceof FakeDataTransclusionSource ); |
153 | 153 | $this->assertEquals( 'BAR', $src->getName() ); |
154 | | - |
| 154 | + |
155 | 155 | $rec = $src->fetchRecord( 'id', 3 ); |
156 | 156 | $this->assertEquals( 3, $rec['id'] ); |
157 | 157 | $this->assertEquals( 'foo', $rec['name'] ); |
158 | 158 | $this->assertEquals( 'test 1', $rec['info'] ); |
159 | | - |
| 159 | + |
160 | 160 | $rec = $src->fetchRecord( 'name', 'bar' ); |
161 | 161 | $this->assertEquals( 5, $rec['id'] ); |
162 | 162 | $this->assertEquals( 'bar', $rec['name'] ); |
— | — | @@ -177,7 +177,7 @@ |
178 | 178 | 'fieldNames' => 'id,name,info', |
179 | 179 | 'defaultKey' => 'id' |
180 | 180 | ); |
181 | | - |
| 181 | + |
182 | 182 | $wgDataTransclusionSources[ 'FOO' ] = $spec; |
183 | 183 | |
184 | 184 | # failure mode: no source given |
— | — | @@ -219,11 +219,11 @@ |
220 | 220 | # success: render record |
221 | 221 | $res = DataTransclusionHandler::handleRecordTransclusion( "Test", array( 'source' => 'FOO', 'id' => 3 ), $wgParser, false, "'''{{{id}}}'''|{{{name}}}|{{{info}}}" ); |
222 | 222 | $this->assertEquals( '\'\'\'3\'\'\'|foo|test&X', $res ); |
223 | | - |
| 223 | + |
224 | 224 | # success: render record (find by name) |
225 | 225 | $res = DataTransclusionHandler::handleRecordTransclusion( "Test", array( 'source' => 'FOO', 'name' => 'foo'), $wgParser, false, "'''{{{id}}}'''|{{{name}}}|{{{info}}}" ); |
226 | 226 | $this->assertEquals( '\'\'\'3\'\'\'|foo|test&X', $res ); |
227 | | - |
| 227 | + |
228 | 228 | # success: render record (as HTML) |
229 | 229 | $res = DataTransclusionHandler::handleRecordTransclusion( "Test", array( 'source' => 'FOO', 'id' => 3 ), $wgParser, true, "'''{{{id}}}'''|{{{name}}}|{{{info}}}" ); |
230 | 230 | $this->assertEquals( $res, '<b>3</b>|foo|test&X' ); // FIXME: & should have been escaped to & here, no? why not? |
— | — | @@ -240,7 +240,7 @@ |
241 | 241 | 'fieldNames' => 'id,name,info,url,evil', |
242 | 242 | 'defaultKey' => 'id', |
243 | 243 | ); |
244 | | - |
| 244 | + |
245 | 245 | $wgDataTransclusionSources[ 'FOO' ] = $spec; |
246 | 246 | |
247 | 247 | global $wgParser; |
— | — | @@ -254,7 +254,7 @@ |
255 | 255 | $html = $wgParser->getOutput()->getText(); |
256 | 256 | $this->assertEquals( '<p>xx FOO:<b>3</b>|foo|Hallo|<test>&[[X]]'|<a href="http://test.org/" class="external text" rel="nofollow">link</a>|[javascript:alert("evil") click me] xx'."\n".'</p>', $html ); // XXX: should be more lenient wrt whitespace |
257 | 257 | $templates = $wgParser->getOutput()->getTemplates(); |
258 | | - $this->assertTrue( isset( $templates[ NS_TEMPLATE ]['Test'] ) ); |
| 258 | + $this->assertTrue( isset( $templates[ NS_TEMPLATE ]['Test'] ) ); |
259 | 259 | } |
260 | 260 | |
261 | 261 | function testHandleRecordTag() { |
— | — | @@ -268,7 +268,7 @@ |
269 | 269 | 'fieldNames' => 'id,name,info,url,evil', |
270 | 270 | 'defaultKey' => 'id' |
271 | 271 | ); |
272 | | - |
| 272 | + |
273 | 273 | $wgDataTransclusionSources[ 'FOO' ] = $spec; |
274 | 274 | |
275 | 275 | global $wgParser; |
— | — | @@ -279,10 +279,10 @@ |
280 | 280 | $text = 'xx <record source="FOO" id=3 extra="Hallo">Test</record> xx'; |
281 | 281 | $wgParser->parse( $text, $title, $options ); |
282 | 282 | |
283 | | - $html = $wgParser->getOutput()->getText(); |
| 283 | + $html = $wgParser->getOutput()->getText(); |
284 | 284 | $this->assertEquals( '<p>xx FOO:<b>3</b>|foo|Hallo|<test>&[[X]]'|<a href="http://test.org/" class="external text" rel="nofollow">link</a>|[javascript:alert("evil") click me] xx'."\n".'</p>', $html ); // XXX: should be more lenient wrt whitespace |
285 | 285 | $templates = $wgParser->getOutput()->getTemplates(); |
286 | | - $this->assertTrue( isset( $templates[ NS_TEMPLATE ]['Test'] ) ); |
| 286 | + $this->assertTrue( isset( $templates[ NS_TEMPLATE ]['Test'] ) ); |
287 | 287 | } |
288 | 288 | |
289 | 289 | function testNormalizeRecord() { |
— | — | @@ -340,7 +340,7 @@ |
341 | 341 | 'cacheDuration' => 2, |
342 | 342 | 'cache' => new HashBagOStuff(), |
343 | 343 | ); |
344 | | - |
| 344 | + |
345 | 345 | $wgDataTransclusionSources[ 'FOO' ] = $spec; |
346 | 346 | |
347 | 347 | $src = DataTransclusionHandler::getDataSource( 'FOO' ); |
— | — | @@ -379,7 +379,7 @@ |
380 | 380 | |
381 | 381 | $source = new DBDataTransclusionSource( $spec ); |
382 | 382 | $sql = $source->getQuery( 'name', 'foo"' ); |
383 | | - |
| 383 | + |
384 | 384 | $this->assertTrue( preg_match( '/^SELECT \* FROM foo/', $sql ) === 1 ); |
385 | 385 | $this->assertTrue( preg_match( '/GROUP BY id$/', $sql ) === 1 ); |
386 | 386 | $this->assertTrue( preg_match( "/WHERE \\( *name *= *'foo\\\\\"' *\\)/", $sql ) === 1 ); |
— | — | @@ -417,10 +417,10 @@ |
418 | 418 | $u = $source->getRecordURL( 'name', 'foo&bar', array( 'x' => '42', 'y' => 57 ) ); |
419 | 419 | $this->assertEquals( 'http://acme.com/foo%26bar?x=42&y=57', $u ); |
420 | 420 | |
421 | | - $rec = array( |
422 | | - "name" => array( 'type' => 'string', 'value' => "foo" ), |
423 | | - "id" => 3, |
424 | | - "info" => array( 'type' => 'string', 'value' => "test X" ), |
| 421 | + $rec = array( |
| 422 | + "name" => array( 'type' => 'string', 'value' => "foo" ), |
| 423 | + "id" => 3, |
| 424 | + "info" => array( 'type' => 'string', 'value' => "test X" ), |
425 | 425 | ); |
426 | 426 | |
427 | 427 | $data = array( 'response' => array( |
— | — | @@ -496,11 +496,11 @@ |
497 | 497 | |
498 | 498 | if ( !defined('MW_PHPUNIT_TEST') ) { |
499 | 499 | $wgShowExceptionDetails = true; |
500 | | - |
| 500 | + |
501 | 501 | DataTransclusionTest::setUpBeforeClass(); |
502 | 502 | $t = new DataTransclusionTest(); |
503 | 503 | $t->setUp(); |
504 | | - |
| 504 | + |
505 | 505 | $t->testErrorMessage(); |
506 | 506 | $t->testSanitizeValue(); |
507 | 507 | $t->testNormalizeRecord(); |
— | — | @@ -514,6 +514,6 @@ |
515 | 515 | $t->testDBDataTransclusionSource(); |
516 | 516 | $t->testWebDataTransclusionSource(); |
517 | 517 | $t->testXmlDataTransclusionSource(); |
518 | | - |
| 518 | + |
519 | 519 | echo "OK.\n"; |
520 | 520 | } |
Index: trunk/extensions/DataTransclusion/tests/fetchWebData.php |
— | — | @@ -10,9 +10,9 @@ |
11 | 11 | $dir = dirname( __FILE__ ); |
12 | 12 | |
13 | 13 | if ( file_exists( "$dir/../../LocalSettings.php" ) ) $IP = "$dir/../.."; |
14 | | - else if ( file_exists( "$dir/../../../LocalSettings.php" ) ) $IP = "$dir/../../.."; |
15 | | - else if ( file_exists( "$dir/../../phase3/LocalSettings.php" ) ) $IP = "$dir/../../phase3"; |
16 | | - else if ( file_exists( "$dir/../../../phase3/LocalSettings.php" ) ) $IP = "$dir/../../../phase3"; |
| 14 | + elseif ( file_exists( "$dir/../../../LocalSettings.php" ) ) $IP = "$dir/../../.."; |
| 15 | + elseif ( file_exists( "$dir/../../phase3/LocalSettings.php" ) ) $IP = "$dir/../../phase3"; |
| 16 | + elseif ( file_exists( "$dir/../../../phase3/LocalSettings.php" ) ) $IP = "$dir/../../../phase3"; |
17 | 17 | else $IP = $dir; |
18 | 18 | } |
19 | 19 | |
Index: trunk/extensions/DataTransclusion/tests/fetchRecord.php |
— | — | @@ -10,9 +10,9 @@ |
11 | 11 | $dir = dirname( __FILE__ ); |
12 | 12 | |
13 | 13 | if ( file_exists( "$dir/../../LocalSettings.php" ) ) $IP = "$dir/../.."; |
14 | | - else if ( file_exists( "$dir/../../../LocalSettings.php" ) ) $IP = "$dir/../../.."; |
15 | | - else if ( file_exists( "$dir/../../phase3/LocalSettings.php" ) ) $IP = "$dir/../../phase3"; |
16 | | - else if ( file_exists( "$dir/../../../phase3/LocalSettings.php" ) ) $IP = "$dir/../../../phase3"; |
| 14 | + elseif ( file_exists( "$dir/../../../LocalSettings.php" ) ) $IP = "$dir/../../.."; |
| 15 | + elseif ( file_exists( "$dir/../../phase3/LocalSettings.php" ) ) $IP = "$dir/../../phase3"; |
| 16 | + elseif ( file_exists( "$dir/../../../phase3/LocalSettings.php" ) ) $IP = "$dir/../../../phase3"; |
17 | 17 | else $IP = $dir; |
18 | 18 | } |
19 | 19 | |
Index: trunk/extensions/APC/SpecialAPC.php |
— | — | @@ -259,7 +259,7 @@ |
260 | 260 | list( , $ver ) = explode( ' ', $v, 2 ); |
261 | 261 | if ( $i < 0 && version_compare( $apcversion, $ver, '>=' ) ) { |
262 | 262 | break; |
263 | | - } else if ( !$i-- ) { |
| 263 | + } elseif ( !$i-- ) { |
264 | 264 | break; |
265 | 265 | } |
266 | 266 | $data = current( $match[2] ); |
Index: trunk/extensions/Crosswiki/Block/CrosswikiBlock.page.php |
— | — | @@ -26,8 +26,8 @@ |
27 | 27 | global $wgOut, $wgUser, $wgRequest; |
28 | 28 | |
29 | 29 | # Add messages |
30 | | - |
31 | 30 | |
| 31 | + |
32 | 32 | $this->setHeaders(); |
33 | 33 | |
34 | 34 | if ( !$wgUser->isAllowed( 'crosswikiblock' ) ) { |
— | — | @@ -53,12 +53,12 @@ |
54 | 54 | ); |
55 | 55 | if ( !$blockAddress ) { |
56 | 56 | $this->showForm( wfMsgWikiHtml( 'crosswikiblock-nousername' ) ); |
57 | | - } else if ( $this->checkUser( $blockAddress, true ) ) { |
58 | | - } else if ( !( $expiry = $this->convertExpiry( $expiryStr ) ) ) { |
| 57 | + } elseif ( $this->checkUser( $blockAddress, true ) ) { |
| 58 | + } elseif ( !( $expiry = $this->convertExpiry( $expiryStr ) ) ) { |
59 | 59 | $this->showForm( wfMsgWikiHtml( 'crosswikiblock-noexpiry', htmlspecialchars( $expiryStr ) ) ); |
60 | | - } else if ( !$reason ) { |
| 60 | + } elseif ( !$reason ) { |
61 | 61 | $this->showForm( wfMsgWikiHtml( 'crosswikiblock-noreason', htmlspecialchars( $reason ) ) ); |
62 | | - } else if ( !$wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
| 62 | + } elseif ( !$wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
63 | 63 | $this->showForm( wfMsgWikiHtml( 'crosswikiblock-notoken' ) ); |
64 | 64 | } else { |
65 | 65 | CrosswikiBlock::normalizeOptions( $this->mUsername, $options ); |
Index: trunk/extensions/CategoryTree/CategoryTreeFunctions.php |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | if ( sizeof( $this->mOptions['namespaces'] ) === 1 |
50 | 50 | && $this->mOptions['namespaces'][0] == NS_CATEGORY ) { |
51 | 51 | $this->mOptions['mode'] = CT_MODE_CATEGORIES; |
52 | | - } else if ( !in_array( NS_IMAGE, $this->mOptions['namespaces'] ) ) { |
| 52 | + } elseif ( !in_array( NS_IMAGE, $this->mOptions['namespaces'] ) ) { |
53 | 53 | $this->mOptions['mode'] = CT_MODE_PAGES; |
54 | 54 | } else { |
55 | 55 | $this->mOptions['mode'] = CT_MODE_ALL; |
— | — | @@ -110,10 +110,10 @@ |
111 | 111 | if ( is_numeric( $mode ) ) return (int)$mode; |
112 | 112 | |
113 | 113 | if ( $mode == 'all' ) $mode = CT_MODE_ALL; |
114 | | - else if ( $mode == 'pages' ) $mode = CT_MODE_PAGES; |
115 | | - else if ( $mode == 'categories' || $mode == 'sub' ) $mode = CT_MODE_CATEGORIES; |
116 | | - else if ( $mode == 'parents' || $mode == 'super' || $mode == 'inverse' ) $mode = CT_MODE_PARENTS; |
117 | | - else if ( $mode == 'default' ) $mode = $wgCategoryTreeDefaultOptions['mode']; |
| 114 | + elseif ( $mode == 'pages' ) $mode = CT_MODE_PAGES; |
| 115 | + elseif ( $mode == 'categories' || $mode == 'sub' ) $mode = CT_MODE_CATEGORIES; |
| 116 | + elseif ( $mode == 'parents' || $mode == 'super' || $mode == 'inverse' ) $mode = CT_MODE_PARENTS; |
| 117 | + elseif ( $mode == 'default' ) $mode = $wgCategoryTreeDefaultOptions['mode']; |
118 | 118 | |
119 | 119 | return (int)$mode; |
120 | 120 | } |
— | — | @@ -131,8 +131,8 @@ |
132 | 132 | if ( is_numeric( $value ) ) return ( (int)$value > 0 ); |
133 | 133 | |
134 | 134 | if ( $value == 'yes' || $value == 'y' || $value == 'true' || $value == 't' || $value == 'on' ) return true; |
135 | | - else if ( $value == 'no' || $value == 'n' || $value == 'false' || $value == 'f' || $value == 'off' ) return false; |
136 | | - else if ( $value == 'null' || $value == 'default' || $value == 'none' || $value == 'x' ) return null; |
| 135 | + elseif ( $value == 'no' || $value == 'n' || $value == 'false' || $value == 'f' || $value == 'off' ) return false; |
| 136 | + elseif ( $value == 'null' || $value == 'default' || $value == 'none' || $value == 'x' ) return null; |
137 | 137 | else return false; |
138 | 138 | } |
139 | 139 | |
— | — | @@ -147,12 +147,12 @@ |
148 | 148 | $value = trim( strtolower( $value ) ); |
149 | 149 | |
150 | 150 | if ( $value == 'yes' || $value == 'y' || $value == 'true' || $value == 't' || $value == 'on' ) return CT_HIDEPREFIX_ALWAYS; |
151 | | - else if ( $value == 'no' || $value == 'n' || $value == 'false' || $value == 'f' || $value == 'off' ) return CT_HIDEPREFIX_NEVER; |
152 | | - // else if ( $value == 'null' || $value == 'default' || $value == 'none' || $value == 'x' ) return $wgCategoryTreeDefaultOptions['hideprefix']; |
153 | | - else if ( $value == 'always' ) return CT_HIDEPREFIX_ALWAYS; |
154 | | - else if ( $value == 'never' ) return CT_HIDEPREFIX_NEVER; |
155 | | - else if ( $value == 'auto' ) return CT_HIDEPREFIX_AUTO; |
156 | | - else if ( $value == 'categories' || $value == 'category' || $value == 'smart' ) return CT_HIDEPREFIX_CATEGORIES; |
| 151 | + elseif ( $value == 'no' || $value == 'n' || $value == 'false' || $value == 'f' || $value == 'off' ) return CT_HIDEPREFIX_NEVER; |
| 152 | + // elseif ( $value == 'null' || $value == 'default' || $value == 'none' || $value == 'x' ) return $wgCategoryTreeDefaultOptions['hideprefix']; |
| 153 | + elseif ( $value == 'always' ) return CT_HIDEPREFIX_ALWAYS; |
| 154 | + elseif ( $value == 'never' ) return CT_HIDEPREFIX_NEVER; |
| 155 | + elseif ( $value == 'auto' ) return CT_HIDEPREFIX_AUTO; |
| 156 | + elseif ( $value == 'categories' || $value == 'category' || $value == 'smart' ) return CT_HIDEPREFIX_CATEGORIES; |
157 | 157 | else return $wgCategoryTreeDefaultOptions['hideprefix']; |
158 | 158 | } |
159 | 159 | |
— | — | @@ -331,7 +331,7 @@ |
332 | 332 | if ( $html == '' ) { |
333 | 333 | # HACK: Safari doesn't like empty responses. |
334 | 334 | # see Bug 7219 and http://bugzilla.opendarwin.org/show_bug.cgi?id=10716 |
335 | | - $html = ' '; |
| 335 | + $html = ' '; |
336 | 336 | } |
337 | 337 | |
338 | 338 | $response->addText( $html ); |
— | — | @@ -385,7 +385,7 @@ |
386 | 386 | else { |
387 | 387 | if ( !$hideroot ) { |
388 | 388 | $html .= $this->renderNode( $title, $depth, $wgCategoryTreeDynamicTag ); |
389 | | - } else if ( !$wgCategoryTreeDynamicTag ) { |
| 389 | + } elseif ( !$wgCategoryTreeDynamicTag ) { |
390 | 390 | $html .= $this->renderChildren( $title, $depth ); |
391 | 391 | } else { |
392 | 392 | $uniq += 1; |
— | — | @@ -590,9 +590,9 @@ |
591 | 591 | |
592 | 592 | if ( $hideprefix == CT_HIDEPREFIX_ALWAYS ) { |
593 | 593 | $hideprefix = true; |
594 | | - } else if ( $hideprefix == CT_HIDEPREFIX_AUTO ) { |
| 594 | + } elseif ( $hideprefix == CT_HIDEPREFIX_AUTO ) { |
595 | 595 | $hideprefix = ( $mode == CT_MODE_CATEGORIES ); |
596 | | - } else if ( $hideprefix == CT_HIDEPREFIX_CATEGORIES ) { |
| 596 | + } elseif ( $hideprefix == CT_HIDEPREFIX_CATEGORIES ) { |
597 | 597 | $hideprefix = ( $ns == NS_CATEGORY ); |
598 | 598 | } else { |
599 | 599 | $hideprefix = true; |
— | — | @@ -651,7 +651,7 @@ |
652 | 652 | if ( $cat ) { |
653 | 653 | if ( $mode == CT_MODE_CATEGORIES ) { |
654 | 654 | $count = $subcatCount; |
655 | | - } else if ( $mode == CT_MODE_PAGES ) { |
| 655 | + } elseif ( $mode == CT_MODE_PAGES ) { |
656 | 656 | $count = $pageCount - $fileCount; |
657 | 657 | } else { |
658 | 658 | $count = $pageCount; |
— | — | @@ -724,9 +724,9 @@ |
725 | 725 | $s .= Xml::openElement( 'i', array( 'class' => 'CategoryTreeNotice' ) ); |
726 | 726 | if ( $mode == CT_MODE_CATEGORIES ) { |
727 | 727 | $s .= wfMsgExt( 'categorytree-no-subcategories', 'parsemag' ); |
728 | | - } else if ( $mode == CT_MODE_PAGES ) { |
| 728 | + } elseif ( $mode == CT_MODE_PAGES ) { |
729 | 729 | $s .= wfMsgExt( 'categorytree-no-pages', 'parsemag' ); |
730 | | - } else if ( $mode == CT_MODE_PARENTS ) { |
| 730 | + } elseif ( $mode == CT_MODE_PARENTS ) { |
731 | 731 | $s .= wfMsgExt( 'categorytree-no-parent-categories', 'parsemag' ); |
732 | 732 | } else { |
733 | 733 | $s .= wfMsgExt( 'categorytree-nothing-found', 'parsemag' ); |
Index: trunk/extensions/ClientSide/ClientSide.php |
— | — | @@ -235,7 +235,7 @@ |
236 | 236 | foreach( $functions as $name => $arguments ) { |
237 | 237 | if ( is_int( $name ) ) { |
238 | 238 | $jsFunctions[] = sprintf( '%s()', $arguments ); |
239 | | - } else if ( is_array( $arguments ) ) { |
| 239 | + } elseif ( is_array( $arguments ) ) { |
240 | 240 | $jsFunctions[] = sprintf( |
241 | 241 | '%s(%s)', $name, implode( ',', $arguments ) |
242 | 242 | ); |
— | — | @@ -378,7 +378,7 @@ |
379 | 379 | return sprintf( |
380 | 380 | 'function(%s){%s}', implode( ',', $arguments ), $body |
381 | 381 | ); |
382 | | - } else if ( $arguments !== null ) { |
| 382 | + } elseif ( $arguments !== null ) { |
383 | 383 | return sprintf( 'function(%s){%s}', $arguments, $body ); |
384 | 384 | } else { |
385 | 385 | return sprintf( 'function(){%s}', $body ); |
Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | 'rlike' => 'rlike', |
54 | 54 | 'irlike' => 'irlike', |
55 | 55 | 'cond ? iftrue : iffalse' => 'tern', |
56 | | - 'if cond then iftrue else iffalse end' => 'cond', |
| 56 | + 'if cond then iftrue elseiffalse end' => 'cond', |
57 | 57 | ), |
58 | 58 | 'funcs' => array( |
59 | 59 | 'length(string)' => 'length', |
Index: trunk/extensions/ConfirmAccount/UserCredentials_body.php |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | |
27 | 27 | if ( $this->file ) { |
28 | 28 | $this->showFile( $this->file ); |
29 | | - } else if ( $this->target ) { |
| 29 | + } elseif ( $this->target ) { |
30 | 30 | $this->showForm(); |
31 | 31 | $this->showCredentials(); |
32 | 32 | } else { |
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | /* |
4 | 4 | (c) Aaron Schulz 2007, GPL |
5 | | - |
| 5 | + |
6 | 6 | This program is free software; you can redistribute it and/or modify |
7 | 7 | it under the terms of the GNU General Public License as published by |
8 | 8 | the Free Software Foundation; either version 2 of the License, or |
— | — | @@ -163,7 +163,7 @@ |
164 | 164 | if ( isset( $personal_urls['anonlogin'] ) ) { |
165 | 165 | $personal_urls['anonlogin']['text'] = wfMsg('nav-login-createaccount'); |
166 | 166 | } elseif ( isset($personal_urls['login'] ) ) { |
167 | | - $personal_urls['login']['text'] = wfMsg('nav-login-createaccount'); |
| 167 | + $personal_urls['login']['text'] = wfMsg('nav-login-createaccount'); |
168 | 168 | } |
169 | 169 | return true; |
170 | 170 | } |
— | — | @@ -257,7 +257,7 @@ |
258 | 258 | $wgExtNewFields[] = array( 'account_requests', 'acr_areas', "$base/archives/patch-acr_areas.sql" ); |
259 | 259 | |
260 | 260 | $wgExtNewIndexes[] = array( 'account_requests', 'acr_email', "$base/archives/patch-email-index.sql" ); |
261 | | - } else if ( $wgDBtype == 'postgres' ) { |
| 261 | + } elseif ( $wgDBtype == 'postgres' ) { |
262 | 262 | $wgExtNewTables[] = array( 'account_requests', "$base/ConfirmAccount.pg.sql" ); |
263 | 263 | |
264 | 264 | $wgExtPGNewFields[] = array( 'account_requests', 'acr_held', "TIMESTAMPTZ" ); |
— | — | @@ -284,7 +284,7 @@ |
285 | 285 | $updater->addExtensionUpdate( array( 'addField', 'account_requests', 'acr_areas', "$base/archives/patch-acr_areas.sql", true ) ); |
286 | 286 | |
287 | 287 | $updater->addExtensionUpdate( array( 'addIndex', 'account_requests', 'acr_email', "$base/archives/patch-email-index.sql", true ) ); |
288 | | - } else if ( $updater->getDB()->getType() == 'postgres' ) { |
| 288 | + } elseif ( $updater->getDB()->getType() == 'postgres' ) { |
289 | 289 | $updater->addExtensionUpdate( array( 'addTable', 'account_requests', "$base/ConfirmAccount.pg.sql", true ) ); |
290 | 290 | |
291 | 291 | $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_held', "TIMESTAMPTZ" ) ); |
Index: trunk/extensions/ConfirmAccount/RequestAccount_body.php |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | $wgOut->readOnlyPage(); |
26 | 26 | return; |
27 | 27 | } |
28 | | - |
| 28 | + |
29 | 29 | $this->setHeaders(); |
30 | 30 | |
31 | 31 | $this->mRealName = trim( $wgRequest->getText( 'wpRealName' ) ); |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | if ( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
71 | 71 | $this->mPrevAttachment = $this->mPrevAttachment ? $this->mPrevAttachment : $this->mSrcName; |
72 | 72 | $this->doSubmit(); |
73 | | - } else if ( $action == 'confirmemail' ) { |
| 73 | + } elseif ( $action == 'confirmemail' ) { |
74 | 74 | $this->confirmEmailToken( $emailCode ); |
75 | 75 | } else { |
76 | 76 | $this->showForm(); |
— | — | @@ -492,7 +492,7 @@ |
493 | 493 | global $wgOut; |
494 | 494 | $wgOut->addHTML( wfMsgExt( 'acct_request_throttle_hit', 'parsemag', $limit ) ); |
495 | 495 | } |
496 | | - |
| 496 | + |
497 | 497 | /** |
498 | 498 | * (a) Try to confirm an email address via a token |
499 | 499 | * (b) Notify $wgConfirmAccountContact on success |
Index: trunk/extensions/ConfirmAccount/ConfirmAccount_body.php |
— | — | @@ -137,11 +137,11 @@ |
138 | 138 | |
139 | 139 | if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
140 | 140 | $this->doSubmit(); |
141 | | - } else if( $this->file ) { |
| 141 | + } elseif( $this->file ) { |
142 | 142 | $this->showFile( $this->file ); |
143 | | - } else if( $this->acrID ) { |
| 143 | + } elseif( $this->acrID ) { |
144 | 144 | $this->showForm(); |
145 | | - } else if( $this->queueType != -1 ) { |
| 145 | + } elseif( $this->queueType != -1 ) { |
146 | 146 | $this->showList(); |
147 | 147 | } else { |
148 | 148 | $this->showQueues(); |
— | — | @@ -224,7 +224,7 @@ |
225 | 225 | } else { |
226 | 226 | $wgOut->addHTML( "<p><i> $reason </i></p>" ); |
227 | 227 | } |
228 | | - } else if( $row->acr_held ) { |
| 228 | + } elseif( $row->acr_held ) { |
229 | 229 | $datim = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->acr_held), true ); |
230 | 230 | $date = $wgLang->date( wfTimestamp(TS_MW, $row->acr_held), true ); |
231 | 231 | $time = $wgLang->time( wfTimestamp(TS_MW, $row->acr_held), true ); |
— | — | @@ -455,7 +455,7 @@ |
456 | 456 | $wgMemc->delete( $key ); |
457 | 457 | |
458 | 458 | $this->showSuccess( $this->submitType ); |
459 | | - } else if( $this->submitType === 'accept' ) { |
| 459 | + } elseif( $this->submitType === 'accept' ) { |
460 | 460 | global $wgAuth, $wgConfirmAccountSaveInfo, $wgAllowAccountRequestFiles; |
461 | 461 | |
462 | 462 | # Now create user and check if the name is valid |
— | — | @@ -682,7 +682,7 @@ |
683 | 683 | } |
684 | 684 | # Finally, done!!! |
685 | 685 | $this->showSuccess( $this->submitType, $user->getName(), array( $error ) ); |
686 | | - } else if( $this->submitType === 'hold' ) { |
| 686 | + } elseif( $this->submitType === 'hold' ) { |
687 | 687 | global $wgUser; |
688 | 688 | |
689 | 689 | # Make proxy user to email a message |
— | — | @@ -694,7 +694,7 @@ |
695 | 695 | $error = wfMsg( 'confirmaccount-canthold' ); |
696 | 696 | $this->showForm( $error ); |
697 | 697 | return false; |
698 | | - } else if( !$this->reason ) { |
| 698 | + } elseif( !$this->reason ) { |
699 | 699 | $error = wfMsg( 'confirmaccount-needreason' ); |
700 | 700 | $this->showForm( $error ); |
701 | 701 | return false; |
— | — | @@ -809,7 +809,7 @@ |
810 | 810 | $wgOut->setPagetitle( wfMsgHtml('actioncomplete') ); |
811 | 811 | if( $this->submitType == 'accept' ) { |
812 | 812 | $wgOut->addWikiMsg( 'confirmaccount-acc', $name ); |
813 | | - } else if( $this->submitType == 'reject' || $this->submitType == 'spam' ) { |
| 813 | + } elseif( $this->submitType == 'reject' || $this->submitType == 'spam' ) { |
814 | 814 | $wgOut->addWikiMsg( 'confirmaccount-rej' ); |
815 | 815 | } else { |
816 | 816 | $wgOut->redirect( $titleObj->getFullUrl() ); |
— | — | @@ -835,7 +835,7 @@ |
836 | 836 | if( $pager->getNumRows() ) { |
837 | 837 | if( $this->showStale ) { |
838 | 838 | $wgOut->addHTML( wfMsgExt('confirmaccount-list3', array('parse') ) ); |
839 | | - } else if( $this->showRejects ) { |
| 839 | + } elseif( $this->showRejects ) { |
840 | 840 | $wgOut->addHTML( wfMsgExt('confirmaccount-list2', array('parse') ) ); |
841 | 841 | } else { |
842 | 842 | $wgOut->addHTML( wfMsgExt('confirmaccount-list', array('parse') ) ); |
— | — | @@ -846,9 +846,9 @@ |
847 | 847 | } else { |
848 | 848 | if( $this->showRejects ) { |
849 | 849 | $wgOut->addHTML( wfMsgExt('confirmaccount-none-r', array('parse')) ); |
850 | | - } else if( $this->showStale ) { |
| 850 | + } elseif( $this->showStale ) { |
851 | 851 | $wgOut->addHTML( wfMsgExt('confirmaccount-none-e', array('parse')) ); |
852 | | - } else if( $this->showHeld ) { |
| 852 | + } elseif( $this->showHeld ) { |
853 | 853 | $wgOut->addHTML( wfMsgExt('confirmaccount-none-h', array('parse')) ); |
854 | 854 | } else { |
855 | 855 | $wgOut->addHTML( wfMsgExt('confirmaccount-none-o', array('parse')) ); |
— | — | @@ -928,7 +928,7 @@ |
929 | 929 | $date = $wgLang->date( wfTimestamp(TS_MW, $row->acr_rejected), true ); |
930 | 930 | $time = $wgLang->time( wfTimestamp(TS_MW, $row->acr_rejected), true ); |
931 | 931 | $r .= ' <b>'.wfMsgExt( 'confirmaccount-reject', array('parseinline'), $row->user_name, $datim, $date, $time ).'</b>'; |
932 | | - } else if( $row->acr_held && !$row->acr_rejected ) { |
| 932 | + } elseif( $row->acr_held && !$row->acr_rejected ) { |
933 | 933 | $datim = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->acr_held), true ); |
934 | 934 | $date = $wgLang->date( wfTimestamp(TS_MW, $row->acr_held), true ); |
935 | 935 | $time = $wgLang->time( wfTimestamp(TS_MW, $row->acr_held), true ); |
— | — | @@ -1034,7 +1034,7 @@ |
1035 | 1035 | # Stale requests have a user ID of zero |
1036 | 1036 | if( $this->stale ) { |
1037 | 1037 | $conds[] = 'acr_user = 0'; |
1038 | | - } else if( $this->rejects ) { |
| 1038 | + } elseif( $this->rejects ) { |
1039 | 1039 | $conds[] = 'acr_user != 0'; |
1040 | 1040 | $tables[] = 'user'; |
1041 | 1041 | $conds[] = 'acr_user = user_id'; |