mAttribs = $rc->mAttribs; $rc2->mExtra = $rc->mExtra; return $rc2; } } ; /** * Class to show various lists of changes: * - what links here * - related changes * - recent changes */ class ChangesList { # Called by history lists and recent changes # /** * Changeslist contructor * @param Skin $skin */ function __construct( &$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 */ private function preCacheMessages() { // Precache various messages if( !isset( $this->message ) ) { foreach( explode(' ', 'cur diff hist minoreditletter newpageletter last '. 'blocklink history boteditletter semicolon-separator' ) as $msg ) { $this->message[$msg] = wfMsgExt( $msg, array( 'escapenoentities' ) ); } } } /** * Returns the appropriate flags for new page, minor change and patrolling * @param bool $new * @param bool $minor * @param bool $patrolled * @param string $nothing, string to use for empty space * @param bool $bot * @return string */ protected 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 * @return string */ public 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 * @return string */ public function endRecentChangesList() { if( $this->rclistOpen ) { return "\n"; } else { return ''; } } protected 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(), '' ) ); } protected 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