*/
class ChangesList {
# Called by history lists and recent changes
+ public $skin;
/**
* Changeslist contructor
$sk = $user->getSkin();
$list = NULL;
if( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) {
- return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk );
+ return $user->getOption( 'usenewrc' ) ?
+ new EnhancedChangesList( $sk ) : new OldChangesList( $sk );
} else {
return $list;
}
protected function insertDateHeader( &$s, $rc_timestamp ) {
global $wgLang;
-
# Make date header if necessary
$date = $wgLang->date( $rc_timestamp, true, true );
if( $date != $this->lastdate ) {
# RTL/LTR marker
$articlelink .= $wgContLang->getDirMark();
- wfRunHooks('ChangesListInsertArticleLink',
- array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched));
+ wfRunHooks( 'ChangesListInsertArticleLink',
+ array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched) );
$s .= " $articlelink";
}
protected function insertTimestamp( &$s, $rc ) {
global $wgLang;
- # Timestamp
$s .= $this->message['semicolon-separator'] . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
}
public function recentChangesLine( &$rc, $watched = false ) {
global $wgContLang, $wgRCShowChangedSize, $wgUser;
- $fname = 'ChangesList::recentChangesLineOld';
- wfProfileIn( $fname );
+ wfProfileIn( __METHOD__ );
# Extract DB fields into local scope
// FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
}
// Regular entries
} else {
- wfProfileIn($fname.'-page');
-
$this->insertDiffHist($s, $rc, $unpatrolled);
-
# M, N, b and ! (minor, new, bot and unpatrolled)
$s .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '', $rc_bot );
$this->insertArticleLink($s, $rc, $unpatrolled, $watched);
-
- wfProfileOut($fname.'-page');
}
- wfProfileIn( $fname.'-rest' );
-
$this->insertTimestamp($s,$rc);
if( $wgRCShowChangedSize ) {
$s = "<li>$s</li>\n";
- wfProfileOut( $fname.'-rest' );
-
- wfProfileOut( $fname );
+ wfProfileOut( __METHOD__ );
return $dateheader . $s;
}
}
if( $namehidden ) {
$r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
} else {
- $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
+ $this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched );
}
$r .= $wgContLang->getDirMark();
$r .= "</td></tr></table>\n";
# Sub-entries
- $r .= '<div id="mw-rc-subentries-'.$jsid.'" class="mw-changeslist-hidden"><table cellpadding="0" cellspacing="0" border="0" style="background: none">';
+ $r .= '<div id="mw-rc-subentries-'.$jsid.'" class="mw-changeslist-hidden">';
+ $r .= '<table cellpadding="0" cellspacing="0" border="0" style="background: none">';
foreach( $block as $rcObj ) {
# Get rc_xxxx variables
// FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
} else if( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) {
$link = '<span class="history-deleted"><tt>'.$rcObj->timestamp.'</tt></span> ';
} else {
- $rcIdEq = ($rcObj->unpatrolled && $rc_type == RC_NEW) ? '&rcid='.$rcObj->mAttribs['rc_id'] : '';
-
- $link = '<tt>'.$this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o.$rcIdEq ).'</tt>';
+ $rcIdEq = ($rcObj->unpatrolled && $rc_type == RC_NEW) ?
+ '&rcid='.$rcObj->mAttribs['rc_id'] : '';
+ $link = '<tt>'.$this->skin->makeKnownLinkObj( $rcObj->getTitle(),
+ $rcObj->timestamp, $curIdEq.'&'.$o.$rcIdEq ).'</tt>';
if( $this->isDeleted($rcObj,Revision::DELETED_TEXT) )
$link = '<span class="history-deleted">'.$link.'</span> ';
}
*/
protected function recentChangesBlockLine( $rcObj ) {
global $wgContLang, $wgRCShowChangedSize;
-
# Get rc_xxxx variables
// FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
extract( $rcObj->mAttribs );
- $curIdEq = 'curid='.$rc_cur_id;
+ $curIdEq = "curid={$rc_cur_id}";
$r = '<table cellspacing="0" cellpadding="0" border="0" style="background: none"><tr>';
-
$r .= '<td valign="top" style="white-space: nowrap"><tt>' . $this->spacerArrow() . ' ';
-
# Flag and Timestamp
if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$r .= ' '; // 4 flags -> 4 spaces
$r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot );
}
$r .= ' '.$rcObj->timestamp.' </tt></td><td>';
-
# Article or log link
if( $rc_log_type ) {
$logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL );
$logname = LogPage::logName( $rc_log_type );
$r .= '(' . $this->skin->makeKnownLinkObj($logtitle, $logname ) . ')';
- } else if( !$this->userCan($rcObj,Revision::DELETED_TEXT) ) {
- $r .= '<span class="history-deleted">' . $rcObj->link . '</span>';
} else {
- $r .= $this->maybeWatchedLink( $rcObj->link, $rcObj->watched );
+ $this->insertArticleLink( $r, $rcObj, $rcObj->unpatrolled, $rcObj->watched );
}
-
# Diff and hist links
if ( $rc_type != RC_LOG ) {
$r .= ' ('. $rcObj->difflink . $this->message['semicolon-separator'];
$r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ')';
}
$r .= ' . . ';
-
# Character diff
if( $wgRCShowChangedSize ) {
$r .= ( $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ' ) ;
}
-
# User/talk
$r .= ' '.$rcObj->userlink . $rcObj->usertalklink;
-
# Log action (if any)
if( $rc_log_type ) {
if( $this->isDeleted($rcObj,LogPage::DELETED_ACTION) ) {
$this->skin, LogPage::extractParams($rc_params), true, true );
}
}
-
# Edit or log comment
if( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
// log comment
$r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
}
}
-
# Show how many people are watching this if enabled
$r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
$blockOut .= $this->recentChangesBlockGroup( $block );
}
}
-
return '<div>'.$blockOut.'</div>';
}