Introducing $wgFeed variable. Allows tuning sydication feeds off, when desired.
[lhc/web/wiklou.git] / includes / ChangesList.php
1 <?php
2
3 /**
4 * @todo document
5 */
6 class RCCacheEntry extends RecentChange
7 {
8 var $secureName, $link;
9 var $curlink , $difflink, $lastlink , $usertalklink , $versionlink ;
10 var $userlink, $timestamp, $watched;
11
12 static function newFromParent( $rc ) {
13 $rc2 = new RCCacheEntry;
14 $rc2->mAttribs = $rc->mAttribs;
15 $rc2->mExtra = $rc->mExtra;
16 return $rc2;
17 }
18 } ;
19
20 /**
21 * Class to show various lists of changes:
22 * - what links here
23 * - related changes
24 * - recent changes
25 */
26 class ChangesList {
27 # Called by history lists and recent changes
28 #
29
30 /** @todo document */
31 function __construct( &$skin ) {
32 $this->skin =& $skin;
33 $this->preCacheMessages();
34 }
35
36 /**
37 * Fetch an appropriate changes list class for the specified user
38 * Some users might want to use an enhanced list format, for instance
39 *
40 * @param $user User to fetch the list class for
41 * @return ChangesList derivative
42 */
43 public static function newFromUser( &$user ) {
44 $sk = $user->getSkin();
45 $list = NULL;
46 if( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) {
47 return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk );
48 } else {
49 return $list;
50 }
51 }
52
53 /**
54 * As we use the same small set of messages in various methods and that
55 * they are called often, we call them once and save them in $this->message
56 */
57 function preCacheMessages() {
58 // Precache various messages
59 if( !isset( $this->message ) ) {
60 foreach( explode(' ', 'cur diff hist minoreditletter newpageletter last '.
61 'blocklink history boteditletter semicolon-separator' ) as $msg ) {
62 $this->message[$msg] = wfMsgExt( $msg, array( 'escape') );
63 }
64 }
65 }
66
67
68 /**
69 * Returns the appropriate flags for new page, minor change and patrolling
70 */
71 function recentChangesFlags( $new, $minor, $patrolled, $nothing = '&nbsp;', $bot = false ) {
72 $f = $new ? '<span class="newpage">' . $this->message['newpageletter'] . '</span>'
73 : $nothing;
74 $f .= $minor ? '<span class="minor">' . $this->message['minoreditletter'] . '</span>'
75 : $nothing;
76 $f .= $bot ? '<span class="bot">' . $this->message['boteditletter'] . '</span>' : $nothing;
77 $f .= $patrolled ? '<span class="unpatrolled">!</span>' : $nothing;
78 return $f;
79 }
80
81 /**
82 * Returns text for the start of the tabular part of RC
83 */
84 function beginRecentChangesList() {
85 $this->rc_cache = array();
86 $this->rcMoveIndex = 0;
87 $this->rcCacheIndex = 0;
88 $this->lastdate = '';
89 $this->rclistOpen = false;
90 return '';
91 }
92
93 /**
94 * Returns text for the end of RC
95 */
96 function endRecentChangesList() {
97 if( $this->rclistOpen ) {
98 return "</ul>\n";
99 } else {
100 return '';
101 }
102 }
103
104
105 function insertMove( &$s, $rc ) {
106 # Diff
107 $s .= '(' . $this->message['diff'] . ') (';
108 # Hist
109 $s .= $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), $this->message['hist'], 'action=history' ) .
110 ') . . ';
111
112 # "[[x]] moved to [[y]]"
113 $msg = ( $rc->mAttribs['rc_type'] == RC_MOVE ) ? '1movedto2' : '1movedto2_redir';
114 $s .= wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
115 $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
116 }
117
118 function insertDateHeader(&$s, $rc_timestamp) {
119 global $wgLang;
120
121 # Make date header if necessary
122 $date = $wgLang->date( $rc_timestamp, true, true );
123 $s = '';
124 if( $date != $this->lastdate ) {
125 if( '' != $this->lastdate ) {
126 $s .= "</ul>\n";
127 }
128 $s .= '<h4>'.$date."</h4>\n<ul class=\"special\">";
129 $this->lastdate = $date;
130 $this->rclistOpen = true;
131 }
132 }
133
134 function insertLog(&$s, $title, $logtype) {
135 $logname = LogPage::logName( $logtype );
136 $s .= '(' . $this->skin->makeKnownLinkObj($title, $logname ) . ')';
137 }
138
139
140 function insertDiffHist(&$s, &$rc, $unpatrolled) {
141 # Diff link
142 if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
143 $diffLink = $this->message['diff'];
144 } else {
145 $rcidparam = $unpatrolled
146 ? array( 'rcid' => $rc->mAttribs['rc_id'] )
147 : array();
148 $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'],
149 wfArrayToCGI( array(
150 'curid' => $rc->mAttribs['rc_cur_id'],
151 'diff' => $rc->mAttribs['rc_this_oldid'],
152 'oldid' => $rc->mAttribs['rc_last_oldid'] ),
153 $rcidparam ),
154 '', '', ' tabindex="'.$rc->counter.'"');
155 }
156 $s .= '('.$diffLink.') (';
157
158 # History link
159 $s .= $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['hist'],
160 wfArrayToCGI( array(
161 'curid' => $rc->mAttribs['rc_cur_id'],
162 'action' => 'history' ) ) );
163 $s .= ') . . ';
164 }
165
166 function insertArticleLink(&$s, &$rc, $unpatrolled, $watched) {
167 # Article link
168 # If it's a new article, there is no diff link, but if it hasn't been
169 # patrolled yet, we need to give users a way to do so
170 $params = ( $unpatrolled && $rc->mAttribs['rc_type'] == RC_NEW )
171 ? 'rcid='.$rc->mAttribs['rc_id']
172 : '';
173 $articlelink = ' '. $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
174 if( $watched )
175 $articlelink = "<strong class=\"mw-watched\">{$articlelink}</strong>";
176 global $wgContLang;
177 $articlelink .= $wgContLang->getDirMark();
178
179 wfRunHooks('ChangesListInsertArticleLink',
180 array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched));
181
182 $s .= ' '.$articlelink;
183 }
184
185 function insertTimestamp(&$s, $rc) {
186 global $wgLang;
187 # Timestamp
188 $s .= $this->message['semicolon-separator'] . ' ' . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
189 }
190
191 /** Insert links to user page, user talk page and eventually a blocking link */
192 function insertUserRelatedLinks(&$s, &$rc) {
193 $s .= $this->skin->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
194 $s .= $this->skin->userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
195 }
196
197 /** insert a formatted comment */
198 function insertComment(&$s, &$rc) {
199 # Add comment
200 if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
201 $s .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
202 }
203 }
204
205 /**
206 * Check whether to enable recent changes patrol features
207 * @return bool
208 */
209 function usePatrol() {
210 global $wgUseRCPatrol, $wgUser;
211 return( $wgUseRCPatrol && ($wgUser->isAllowed('patrol') || $wgUser->isAllowed('patrolmarks')) );
212 }
213
214 /**
215 * Returns the string which indicates the number of watching users
216 */
217 function numberofWatchingusers( $count ) {
218 global $wgLang;
219 static $cache = array();
220 if ( $count > 0 ) {
221 if ( !isset( $cache[$count] ) ) {
222 $cache[$count] = wfMsgExt('number_of_watching_users_RCview',
223 array('parsemag', 'escape'), $wgLang->formatNum($count));
224 }
225 return $cache[$count];
226 } else {
227 return '';
228 }
229 }
230 }
231
232
233 /**
234 * Generate a list of changes using the good old system (no javascript)
235 */
236 class OldChangesList extends ChangesList {
237 /**
238 * Format a line using the old system (aka without any javascript).
239 */
240 function recentChangesLine( &$rc, $watched = false ) {
241 global $wgContLang, $wgRCShowChangedSize;
242
243 $fname = 'ChangesList::recentChangesLineOld';
244 wfProfileIn( $fname );
245
246 # Extract DB fields into local scope
247 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
248 extract( $rc->mAttribs );
249
250 # Should patrol-related stuff be shown?
251 $unpatrolled = $this->usePatrol() && $rc_patrolled == 0;
252
253 $this->insertDateHeader($s,$rc_timestamp);
254
255 $s .= '<li>';
256
257 // moved pages
258 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
259 $this->insertMove( $s, $rc );
260 // log entries
261 } elseif ( $rc_namespace == NS_SPECIAL ) {
262 list( $specialName, $specialSubpage ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
263 if ( $specialName == 'Log' ) {
264 $this->insertLog( $s, $rc->getTitle(), $specialSubpage );
265 } else {
266 wfDebug( "Unexpected special page in recentchanges\n" );
267 }
268 // all other stuff
269 } else {
270 wfProfileIn($fname.'-page');
271
272 $this->insertDiffHist($s, $rc, $unpatrolled);
273
274 # M, N, b and ! (minor, new, bot and unpatrolled)
275 $s .= ' ' . $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '', $rc_bot );
276 $this->insertArticleLink($s, $rc, $unpatrolled, $watched);
277
278 wfProfileOut($fname.'-page');
279 }
280
281 wfProfileIn( $fname.'-rest' );
282
283 $this->insertTimestamp($s,$rc);
284
285 if( $wgRCShowChangedSize ) {
286 $s .= ( $rc->getCharacterDifference() == '' ? '' : $rc->getCharacterDifference() . ' . . ' );
287 }
288
289 $this->insertUserRelatedLinks($s,$rc);
290 $this->insertComment($s, $rc);
291
292 $s .= rtrim(' ' . $this->numberofWatchingusers($rc->numberofWatchingusers));
293
294 $s .= "</li>\n";
295
296 wfProfileOut( $fname.'-rest' );
297
298 wfProfileOut( $fname );
299 return $s;
300 }
301 }
302
303
304 /**
305 * Generate a list of changes using an Enhanced system (use javascript).
306 */
307 class EnhancedChangesList extends ChangesList {
308 /**
309 * Format a line for enhanced recentchange (aka with javascript and block of lines).
310 */
311 function recentChangesLine( &$baseRC, $watched = false ) {
312 global $wgLang, $wgContLang;
313
314 # Create a specialised object
315 $rc = RCCacheEntry::newFromParent( $baseRC );
316
317 # Extract fields from DB into the function scope (rc_xxxx variables)
318 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
319 extract( $rc->mAttribs );
320 $curIdEq = 'curid=' . $rc_cur_id;
321
322 # If it's a new day, add the headline and flush the cache
323 $date = $wgLang->date( $rc_timestamp, true);
324 $ret = '';
325 if( $date != $this->lastdate ) {
326 # Process current cache
327 $ret = $this->recentChangesBlock();
328 $this->rc_cache = array();
329 $ret .= "<h4>{$date}</h4>\n";
330 $this->lastdate = $date;
331 }
332
333 # Should patrol-related stuff be shown?
334 if( $this->usePatrol() ) {
335 $rc->unpatrolled = !$rc_patrolled;
336 } else {
337 $rc->unpatrolled = false;
338 }
339
340 # Make article link
341 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
342 $msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
343 $clink = wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
344 $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
345 } elseif( $rc_namespace == NS_SPECIAL ) {
346 list( $specialName, $logtype ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
347 if ( $specialName == 'Log' ) {
348 # Log updates, etc
349 $logname = LogPage::logName( $logtype );
350 $clink = '(' . $this->skin->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
351 } else {
352 wfDebug( "Unexpected special page in recentchanges\n" );
353 $clink = '';
354 }
355 } elseif( $rc->unpatrolled && $rc_type == RC_NEW ) {
356 # Unpatrolled new page, give rc_id in query
357 $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
358 } else {
359 $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '' );
360 }
361
362 $time = $wgContLang->time( $rc_timestamp, true, true );
363 $rc->watched = $watched;
364 $rc->link = $clink;
365 $rc->timestamp = $time;
366 $rc->numberofWatchingusers = $baseRC->numberofWatchingusers;
367
368 # Make "cur" and "diff" links
369 if( $rc->unpatrolled ) {
370 $rcIdQuery = "&rcid={$rc_id}";
371 } else {
372 $rcIdQuery = '';
373 }
374 $querycur = $curIdEq."&diff=0&oldid=$rc_this_oldid";
375 $querydiff = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid$rcIdQuery";
376 $aprops = ' tabindex="'.$baseRC->counter.'"';
377 $curLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['cur'], $querycur, '' ,'', $aprops );
378 if( $rc_type == RC_NEW || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
379 if( $rc_type != RC_NEW ) {
380 $curLink = $this->message['cur'];
381 }
382 $diffLink = $this->message['diff'];
383 } else {
384 $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'], $querydiff, '' ,'', $aprops );
385 }
386
387 # Make "last" link
388 if( $rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
389 $lastLink = $this->message['last'];
390 } else {
391 $lastLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['last'],
392 $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
393 }
394
395 $rc->userlink = $this->skin->userLink( $rc_user, $rc_user_text );
396
397 $rc->lastlink = $lastLink;
398 $rc->curlink = $curLink;
399 $rc->difflink = $diffLink;
400
401 $rc->usertalklink = $this->skin->userToolLinks( $rc_user, $rc_user_text );
402
403 # Put accumulated information into the cache, for later display
404 # Page moves go on their own line
405 $title = $rc->getTitle();
406 $secureName = $title->getPrefixedDBkey();
407 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
408 # Use an @ character to prevent collision with page names
409 $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array($rc);
410 } else {
411 if( !isset ( $this->rc_cache[$secureName] ) ) {
412 $this->rc_cache[$secureName] = array();
413 }
414 array_push( $this->rc_cache[$secureName], $rc );
415 }
416 return $ret;
417 }
418
419 /**
420 * Enhanced RC group
421 */
422 function recentChangesBlockGroup( $block ) {
423 global $wgLang, $wgContLang, $wgRCShowChangedSize;
424 $r = '';
425
426 # Collate list of users
427 $isnew = false;
428 $unpatrolled = false;
429 $userlinks = array();
430 foreach( $block as $rcObj ) {
431 $oldid = $rcObj->mAttribs['rc_last_oldid'];
432 if( $rcObj->mAttribs['rc_new'] ) {
433 $isnew = true;
434 }
435 $u = $rcObj->userlink;
436 if( !isset( $userlinks[$u] ) ) {
437 $userlinks[$u] = 0;
438 }
439 if( $rcObj->unpatrolled ) {
440 $unpatrolled = true;
441 }
442 $bot = $rcObj->mAttribs['rc_bot'];
443 $userlinks[$u]++;
444 }
445
446 # Sort the list and convert to text
447 krsort( $userlinks );
448 asort( $userlinks );
449 $users = array();
450 foreach( $userlinks as $userlink => $count) {
451 $text = $userlink;
452 $text .= $wgContLang->getDirMark();
453 if( $count > 1 ) {
454 $text .= ' ('.$count.'&times;)';
455 }
456 array_push( $users, $text );
457 }
458
459 $users = ' <span class="changedby">[' . implode( $this->message['semicolon-separator'] . ' ', $users ) . ']</span>';
460
461 # Arrow
462 $rci = 'RCI'.$this->rcCacheIndex;
463 $rcl = 'RCL'.$this->rcCacheIndex;
464 $rcm = 'RCM'.$this->rcCacheIndex;
465 $toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')";
466 $tl = '<span id="'.$rcm.'"><a href="'.$toggleLink.'">' . $this->sideArrow() . '</a></span>';
467 $tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'">' . $this->downArrow() . '</a></span>';
468 $r .= $tl;
469
470 # Main line
471 $r .= '<tt>';
472 $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, '&nbsp;', $bot );
473
474 # Timestamp
475 $r .= ' '.$block[0]->timestamp.' </tt>';
476
477 # Article link
478 $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
479 $r .= $wgContLang->getDirMark();
480
481 $curIdEq = 'curid=' . $block[0]->mAttribs['rc_cur_id'];
482 $currentRevision = $block[0]->mAttribs['rc_this_oldid'];
483 if( $block[0]->mAttribs['rc_type'] != RC_LOG ) {
484 # Changes
485
486 $n = count($block);
487 static $nchanges = array();
488 if ( !isset( $nchanges[$n] ) ) {
489 $nchanges[$n] = wfMsgExt( 'nchanges', array( 'parsemag', 'escape'),
490 $wgLang->formatNum( $n ) );
491 }
492
493 $r .= ' (';
494
495 if( $isnew ) {
496 $r .= $nchanges[$n];
497 } else {
498 $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
499 $nchanges[$n], $curIdEq."&diff=$currentRevision&oldid=$oldid" );
500 }
501
502 $r .= ') . . ';
503
504 if( $wgRCShowChangedSize ) {
505 # Character difference
506 $chardiff = $rcObj->getCharacterDifference( $block[ count( $block ) - 1 ]->mAttribs['rc_old_len'],
507 $block[0]->mAttribs['rc_new_len'] );
508 if( $chardiff == '' ) {
509 $r .= ' (';
510 } else {
511 $r .= ' ' . $chardiff. ' . . ';
512 }
513 }
514
515 # History
516 $r .= '(' . $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
517 $this->message['history'], $curIdEq.'&action=history' );
518 $r .= ')';
519 }
520
521 $r .= $users;
522
523 $r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers);
524 $r .= "<br />\n";
525
526 # Sub-entries
527 $r .= '<div id="'.$rci.'" style="display:none">';
528 foreach( $block as $rcObj ) {
529 # Get rc_xxxx variables
530 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
531 extract( $rcObj->mAttribs );
532
533 $r .= $this->spacerArrow();
534 $r .= '<tt>&nbsp; &nbsp; &nbsp; &nbsp;';
535 $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
536 $r .= '&nbsp;</tt>';
537
538 $o = '';
539 if( $rc_this_oldid != 0 ) {
540 $o = 'oldid='.$rc_this_oldid;
541 }
542 if( $rc_type == RC_LOG ) {
543 $link = $rcObj->timestamp;
544 } else {
545 $link = $this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o );
546 }
547 $link = '<tt>'.$link.'</tt>';
548
549 $r .= $link;
550 $r .= ' (';
551 $r .= $rcObj->curlink;
552 $r .= $this->message['semicolon-separator'] . ' ';
553 $r .= $rcObj->lastlink;
554 $r .= ') . . ';
555
556 # Character diff
557 if( $wgRCShowChangedSize ) {
558 $r .= ( $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ' ) ;
559 }
560
561 $r .= $rcObj->userlink;
562 $r .= $rcObj->usertalklink;
563 $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
564 $r .= "<br />\n";
565 }
566 $r .= "</div>\n";
567
568 $this->rcCacheIndex++;
569 return $r;
570 }
571
572 function maybeWatchedLink( $link, $watched=false ) {
573 if( $watched ) {
574 // FIXME: css style might be more appropriate
575 return '<strong class="mw-watched">' . $link . '</strong>';
576 } else {
577 return $link;
578 }
579 }
580
581 /**
582 * Generate HTML for an arrow or placeholder graphic
583 * @param string $dir one of '', 'd', 'l', 'r'
584 * @param string $alt text
585 * @return string HTML <img> tag
586 * @access private
587 */
588 function arrow( $dir, $alt='' ) {
589 global $wgStylePath;
590 $encUrl = htmlspecialchars( $wgStylePath . '/common/images/Arr_' . $dir . '.png' );
591 $encAlt = htmlspecialchars( $alt );
592 return "<img src=\"$encUrl\" width=\"12\" height=\"12\" alt=\"$encAlt\" />";
593 }
594
595 /**
596 * Generate HTML for a right- or left-facing arrow,
597 * depending on language direction.
598 * @return string HTML <img> tag
599 * @access private
600 */
601 function sideArrow() {
602 global $wgContLang;
603 $dir = $wgContLang->isRTL() ? 'l' : 'r';
604 return $this->arrow( $dir, '+' );
605 }
606
607 /**
608 * Generate HTML for a down-facing arrow
609 * depending on language direction.
610 * @return string HTML <img> tag
611 * @access private
612 */
613 function downArrow() {
614 return $this->arrow( 'd', '-' );
615 }
616
617 /**
618 * Generate HTML for a spacer image
619 * @return string HTML <img> tag
620 * @access private
621 */
622 function spacerArrow() {
623 return $this->arrow( '', ' ' );
624 }
625
626 /**
627 * Enhanced RC ungrouped line.
628 * @return string a HTML formated line (generated using $r)
629 */
630 function recentChangesBlockLine( $rcObj ) {
631 global $wgContLang, $wgRCShowChangedSize;
632
633 # Get rc_xxxx variables
634 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
635 extract( $rcObj->mAttribs );
636 $curIdEq = 'curid='.$rc_cur_id;
637
638 $r = '';
639
640 # Spacer image
641 $r .= $this->spacerArrow();
642
643 # Flag and Timestamp
644 $r .= '<tt>';
645
646 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
647 $r .= '&nbsp;&nbsp;&nbsp;';
648 } else {
649 $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
650 }
651 $r .= ' '.$rcObj->timestamp.' </tt>';
652
653 # Article link
654 $r .= $this->maybeWatchedLink( $rcObj->link, $rcObj->watched );
655
656 # Diff
657 $r .= ' ('. $rcObj->difflink . $this->message['semicolon-separator'] . ' ';
658
659 # Hist
660 $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ') . . ';
661
662 # Character diff
663 if( $wgRCShowChangedSize ) {
664 $r .= ( $rcObj->getCharacterDifference() == '' ? '' : '&nbsp;' . $rcObj->getCharacterDifference() . ' . . ' ) ;
665 }
666
667 # User/talk
668 $r .= $rcObj->userlink . $rcObj->usertalklink;
669
670 # Comment
671 if( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
672 $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
673 }
674
675 $r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
676
677 $r .= "<br />\n";
678 return $r;
679 }
680
681 /**
682 * If enhanced RC is in use, this function takes the previously cached
683 * RC lines, arranges them, and outputs the HTML
684 */
685 function recentChangesBlock() {
686 if( count ( $this->rc_cache ) == 0 ) {
687 return '';
688 }
689 $blockOut = '';
690 foreach( $this->rc_cache as $block ) {
691 if( count( $block ) < 2 ) {
692 $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
693 } else {
694 $blockOut .= $this->recentChangesBlockGroup( $block );
695 }
696 }
697
698 return '<div>'.$blockOut.'</div>';
699 }
700
701 /**
702 * Returns text for the end of RC
703 * If enhanced RC is in use, returns pretty much all the text
704 */
705 function endRecentChangesList() {
706 return $this->recentChangesBlock() . parent::endRecentChangesList();
707 }
708
709 }