Index: trunk/phase3/includes/specials/SpecialWatchlist.php |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | global $wgFeedClasses; |
50 | 50 | $apiParams = array( 'action' => 'feedwatchlist', 'allrev' => 'allrev', |
51 | 51 | 'wlowner' => $wgUser->getName(), 'wltoken' => $wlToken ); |
52 | | - $feedTemplate = wfScript('api').'?'; |
| 52 | + $feedTemplate = wfScript('api') . '?'; |
53 | 53 | |
54 | 54 | foreach( $wgFeedClasses as $format => $class ) { |
55 | 55 | $theseParams = $apiParams + array( 'feedformat' => $format ); |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | $wgOut->addFeedLink( $format, $url ); |
58 | 58 | } |
59 | 59 | |
60 | | - $skin = $wgUser->getSkin(); |
| 60 | + $skin = $this->getSkin(); |
61 | 61 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
62 | 62 | |
63 | 63 | # Anons don't get a watchlist |
— | — | @@ -74,11 +74,11 @@ |
75 | 75 | |
76 | 76 | $wgOut->setPageTitle( wfMsg( 'watchlist' ) ); |
77 | 77 | |
78 | | - $sub = wfMsgExt( |
| 78 | + $sub = wfMsgExt( |
79 | 79 | 'watchlistfor2', |
80 | 80 | array( 'parseinline', 'replaceafter' ), |
81 | 81 | $wgUser->getName(), |
82 | | - SpecialEditWatchlist::buildTools( $wgUser->getSkin() ) |
| 82 | + SpecialEditWatchlist::buildTools( $skin ) |
83 | 83 | ); |
84 | 84 | $wgOut->setSubtitle( $sub ); |
85 | 85 | |
— | — | @@ -144,10 +144,11 @@ |
145 | 145 | $invert = $wgRequest->getIntOrNull( 'invert' ); |
146 | 146 | if( !is_null( $nameSpace ) ) { |
147 | 147 | $nameSpace = intval( $nameSpace ); |
148 | | - if( $invert && $nameSpace !== 'all' ) |
| 148 | + if( $invert && $nameSpace !== 'all' ) { |
149 | 149 | $nameSpaceClause = "rc_namespace != $nameSpace"; |
150 | | - else |
| 150 | + } else { |
151 | 151 | $nameSpaceClause = "rc_namespace = $nameSpace"; |
| 152 | + } |
152 | 153 | } else { |
153 | 154 | $nameSpace = ''; |
154 | 155 | $nameSpaceClause = ''; |
— | — | @@ -160,11 +161,11 @@ |
161 | 162 | array( 'wl_user' => $uid ), __METHOD__ ); |
162 | 163 | // Adjust for page X, talk:page X, which are both stored separately, |
163 | 164 | // but treated together |
164 | | - $nitems = floor($watchlistCount / 2); |
| 165 | + $nitems = floor( $watchlistCount / 2 ); |
165 | 166 | |
166 | | - if( is_null($days) || !is_numeric($days) ) { |
| 167 | + if( is_null( $days ) || !is_numeric( $days ) ) { |
167 | 168 | $big = 1000; /* The magical big */ |
168 | | - if($nitems > $big) { |
| 169 | + if( $nitems > $big ) { |
169 | 170 | # Set default cutoff shorter |
170 | 171 | $days = $defaults['days'] = (12.0 / 24.0); # 12 hours... |
171 | 172 | } else { |
— | — | @@ -230,19 +231,21 @@ |
231 | 232 | } |
232 | 233 | |
233 | 234 | # Toggle watchlist content (all recent edits or just the latest) |
234 | | - if( $wgUser->getOption( 'extendwatchlist' )) { |
| 235 | + if( $wgUser->getOption( 'extendwatchlist' ) ) { |
235 | 236 | $limitWatchlist = intval( $wgUser->getOption( 'wllimit' ) ); |
236 | 237 | $usePage = false; |
237 | 238 | } else { |
238 | | - # Top log Ids for a page are not stored |
| 239 | + # Top log Ids for a page are not stored |
239 | 240 | $conds[] = 'rc_this_oldid=page_latest OR rc_type=' . RC_LOG; |
240 | 241 | $limitWatchlist = 0; |
241 | 242 | $usePage = true; |
242 | 243 | } |
243 | 244 | |
244 | 245 | # Show a message about slave lag, if applicable |
245 | | - if( ( $lag = $dbr->getLag() ) > 0 ) |
| 246 | + $lag = $dbr->getLag(); |
| 247 | + if( $lag > 0 ) { |
246 | 248 | $wgOut->showLagWarning( $lag ); |
| 249 | + } |
247 | 250 | |
248 | 251 | # Create output form |
249 | 252 | $form = Xml::fieldset( wfMsg( 'watchlist-options' ), false, array( 'id' => 'mw-watchlist-options' ) ); |
— | — | @@ -281,8 +284,9 @@ |
282 | 285 | if ( $usePage || $rollbacker ) { |
283 | 286 | $tables[] = 'page'; |
284 | 287 | $join_conds['page'] = array('LEFT JOIN','rc_cur_id=page_id'); |
285 | | - if ($rollbacker) |
| 288 | + if ($rollbacker) { |
286 | 289 | $fields[] = 'page_latest'; |
| 290 | + } |
287 | 291 | } |
288 | 292 | |
289 | 293 | ChangeTags::modifyDisplayQuery( $tables, $fields, $conds, $join_conds, $options, '' ); |
— | — | @@ -335,16 +339,21 @@ |
336 | 340 | $form .= Xml::checkLabel( wfMsg('invert'), 'invert', 'nsinvert', $invert ) . ' '; |
337 | 341 | $form .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . '</p>'; |
338 | 342 | $form .= Html::hidden( 'days', $days ); |
339 | | - if( $hideMinor ) |
| 343 | + if( $hideMinor ) { |
340 | 344 | $form .= Html::hidden( 'hideMinor', 1 ); |
341 | | - if( $hideBots ) |
| 345 | + } |
| 346 | + if( $hideBots ) { |
342 | 347 | $form .= Html::hidden( 'hideBots', 1 ); |
343 | | - if( $hideAnons ) |
| 348 | + } |
| 349 | + if( $hideAnons ) { |
344 | 350 | $form .= Html::hidden( 'hideAnons', 1 ); |
345 | | - if( $hideLiu ) |
| 351 | + } |
| 352 | + if( $hideLiu ) { |
346 | 353 | $form .= Html::hidden( 'hideLiu', 1 ); |
347 | | - if( $hideOwn ) |
| 354 | + } |
| 355 | + if( $hideOwn ) { |
348 | 356 | $form .= Html::hidden( 'hideOwn', 1 ); |
| 357 | + } |
349 | 358 | $form .= Xml::closeElement( 'form' ); |
350 | 359 | $form .= Xml::closeElement( 'fieldset' ); |
351 | 360 | $wgOut->addHTML( $form ); |
— | — | @@ -420,7 +429,6 @@ |
421 | 430 | return wfMsgHtml( $message, $skin->linkKnown( $title, $label, array(), $options ) ); |
422 | 431 | } |
423 | 432 | |
424 | | - |
425 | 433 | public static function hoursLink( $h, $page, $options = array() ) { |
426 | 434 | global $wgUser, $wgLang, $wgContLang; |
427 | 435 | |
— | — | @@ -428,14 +436,12 @@ |
429 | 437 | $title = Title::newFromText( $wgContLang->specialPage( $page ) ); |
430 | 438 | $options['days'] = ($h / 24.0); |
431 | 439 | |
432 | | - $s = $sk->linkKnown( |
| 440 | + return $sk->linkKnown( |
433 | 441 | $title, |
434 | 442 | $wgLang->formatNum( $h ), |
435 | 443 | array(), |
436 | 444 | $options |
437 | 445 | ); |
438 | | - |
439 | | - return $s; |
440 | 446 | } |
441 | 447 | |
442 | 448 | public static function daysLink( $d, $page, $options = array() ) { |
— | — | @@ -446,14 +452,12 @@ |
447 | 453 | $options['days'] = $d; |
448 | 454 | $message = ($d ? $wgLang->formatNum( $d ) : wfMsgHtml( 'watchlistall2' ) ); |
449 | 455 | |
450 | | - $s = $sk->linkKnown( |
| 456 | + return $sk->linkKnown( |
451 | 457 | $title, |
452 | 458 | $message, |
453 | 459 | array(), |
454 | 460 | $options |
455 | 461 | ); |
456 | | - |
457 | | - return $s; |
458 | 462 | } |
459 | 463 | |
460 | 464 | /** |
— | — | @@ -496,8 +500,9 @@ |
497 | 501 | $count = $row->count; |
498 | 502 | |
499 | 503 | # Halve to remove talk pages if needed |
500 | | - if( !$talk ) |
| 504 | + if( !$talk ) { |
501 | 505 | $count = floor( $count / 2 ); |
| 506 | + } |
502 | 507 | |
503 | 508 | return( $count ); |
504 | 509 | } |