mAttribs = $rc->mAttribs; $rc2->mExtra = $rc->mExtra; return $rc2; } } ; /** * @package MediaWiki */ class ChangesList { # Called by history lists and recent changes # /** @todo document */ function ChangesList( &$skin ) { $this->skin =& $skin; $this->preCacheMessages(); } /** * Fetch an appropriate changes list class for the specified user * Some users might want to use an enhanced list format, for instance * * @param $user User to fetch the list class for * @return ChangesList derivative */ public static function newFromUser( &$user ) { $sk =& $user->getSkin(); $list = NULL; if( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) { return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk ); } else { return $list; } } /** * 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 changes history boteditletter' ) as $msg ) { $this->message[$msg] = wfMsgExt( $msg, array( 'escape') ); } } } /** * Returns the appropriate flags for new page, minor change and patrolling */ function recentChangesFlags( $new, $minor, $patrolled, $nothing = ' ', $bot = false ) { $f = $new ? '' . $this->message['newpageletter'] . '' : $nothing; $f .= $minor ? '' . $this->message['minoreditletter'] . '' : $nothing; $f .= $bot ? '' . $this->message['boteditletter'] . '' : $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 */ function endRecentChangesList() { if( $this->rclistOpen ) { return "\n"; } else { return ''; } } function insertMove( &$s, $rc ) { # Diff $s .= '(' . $this->message['diff'] . ') ('; # Hist $s .= $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), $this->message['hist'], 'action=history' ) . ') . . '; # "[[x]] moved to [[y]]" $msg = ( $rc->mAttribs['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