skin =& $skin; $this->preCacheMessages(); } /** * As we use the same small set of messages in various methods and that * they are called often, we call them once and save them in $this->message */ function preCacheMessages() { // Precache various messages if( !isset( $this->message ) ) { foreach( explode(' ', 'cur diff hist minoreditletter newpageletter last blocklink' ) as $msg ) { $this->message[$msg] = wfMsg( $msg ); } } } /** * Returns the appropiate flags for new page, minor change and patrolling */ function recentChangesFlags( $new, $minor, $patrolled, $nothing = ' ' ) { $f = $new ? '' . wfMsgHtml( 'newpageletter' ) . '' : $nothing; $f .= $minor ? '' . wfMsgHtml( 'minoreditletter' ) . '' : $nothing; $f .= $patrolled ? '!' : $nothing; return $f; } /** * Returns text for the start of the tabular part of RC */ function beginRecentChangesList() { $this->rc_cache = array() ; $this->rcMoveIndex = 0; $this->rcCacheIndex = 0 ; $this->lastdate = ''; $this->rclistOpen = false; return ''; } /** * Returns text for the end of RC * If enhanced RC is in use, returns pretty much all the text */ function endRecentChangesList() { $s = $this->recentChangesBlock() ; if( $this->rclistOpen ) { $s .= "\n"; } return $s; } /** * Enhanced RC ungrouped line. * @return string a HTML formated line (generated using $r) */ function recentChangesBlockLine ( $rcObj ) { global $wgStylePath, $wgContLang ; # Get rc_xxxx variables extract( $rcObj->mAttribs ) ; $curIdEq = 'curid='.$rc_cur_id; $r = '' ; # Spacer image $r .= '' ; # Flag and Timestamp $r .= '' ; if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { $r .= '   '; } else { $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled ); } $r .= ' '.$rcObj->timestamp.' ' ; # Article link $link = $rcObj->link ; // FIXME: should be handled with a css class if ( $rcObj->watched ) $link = ''.$link.'' ; $r .= $link ; # Diff $r .= ' ('. $rcObj->difflink .'; ' ; # Hist $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ); # User/talk $r .= ') . . '.$rcObj->userlink . $rcObj->usertalklink ; # Comment if ( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) { $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() ); } if ($rcObj->numberofWatchingusers > 0) { $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rcObj->numberofWatchingusers)); } $r .= "
\n" ; return $r ; } /** * If enhanced RC is in use, this function takes the previously cached * RC lines, arranges them, and outputs the HTML */ function recentChangesBlock () { global $wgStylePath ; if ( count ( $this->rc_cache ) == 0 ) return '' ; $blockOut = ''; foreach ( $this->rc_cache AS $secureName => $block ) { if ( count ( $block ) < 2 ) { $blockOut .= $this->recentChangesBlockLine ( array_shift ( $block ) ) ; } else { $blockOut .= $this->recentChangesBlockGroup ( $block ) ; } } return '
'.$blockOut.'
' ; } function insertMove(&$s) { # Diff $s .= '(' . $this->message['diff'] . ') ('; # Hist $s .= $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), $this->message['hist'], 'action=history' ) . ') . . '; # "[[x]] moved to [[y]]" $msg = ( $rc_type == RC_MOVE ) ? '1movedto2' : '1movedto2_redir'; $s .= wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ), $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) ); } function insertDateHeader(&$s, $rc_timestamp) { global $wgLang; # Make date header if necessary $date = $wgLang->date( $rc_timestamp, true, true ); $s = ''; if ( $date != $this->lastdate ) { if ( '' != $this->lastdate ) { $s .= "\n"; } $s .= '

'.$date."

\n