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