2004-11-25 13:47:17 +00:00
|
|
|
|
<?php
|
2010-08-14 17:42:40 +00:00
|
|
|
|
/**
|
2013-10-17 00:51:49 +00:00
|
|
|
|
* Generates a list of changes using an Enhanced system (uses javascript).
|
2010-08-14 17:42:40 +00:00
|
|
|
|
*
|
2012-05-21 19:56:04 +00:00
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
|
*
|
2010-08-14 17:42:40 +00:00
|
|
|
|
* @file
|
|
|
|
|
|
*/
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2005-09-06 18:43:45 +00:00
|
|
|
|
class EnhancedChangesList extends ChangesList {
|
2013-11-26 11:56:17 +00:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @var RCCacheEntryFactory
|
|
|
|
|
|
*/
|
|
|
|
|
|
protected $cacheEntryFactory;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @var array Array of array of RCCacheEntry
|
|
|
|
|
|
*/
|
2012-01-12 19:03:32 +00:00
|
|
|
|
protected $rc_cache;
|
|
|
|
|
|
|
2013-11-26 11:56:17 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @param IContextSource|Skin $obj
|
2014-12-24 13:49:20 +00:00
|
|
|
|
* @throws MWException
|
2013-11-26 11:56:17 +00:00
|
|
|
|
*/
|
|
|
|
|
|
public function __construct( $obj ) {
|
|
|
|
|
|
if ( $obj instanceof Skin ) {
|
|
|
|
|
|
// @todo: deprecate constructing with Skin
|
|
|
|
|
|
$context = $obj->getContext();
|
|
|
|
|
|
} else {
|
2014-07-21 12:47:42 +00:00
|
|
|
|
if ( !$obj instanceof IContextSource ) {
|
2013-11-26 11:56:17 +00:00
|
|
|
|
throw new MWException( 'EnhancedChangesList must be constructed with a '
|
|
|
|
|
|
. 'context source or skin.' );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$context = $obj;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
parent::__construct( $context );
|
|
|
|
|
|
|
|
|
|
|
|
// message is set by the parent ChangesList class
|
|
|
|
|
|
$this->cacheEntryFactory = new RCCacheEntryFactory(
|
|
|
|
|
|
$context,
|
|
|
|
|
|
$this->message
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2008-10-25 20:57:56 +00:00
|
|
|
|
/**
|
2010-01-05 21:24:23 +00:00
|
|
|
|
* Add the JavaScript file for enhanced changeslist
|
2013-11-19 12:25:54 +00:00
|
|
|
|
* @return string
|
2010-01-05 21:24:23 +00:00
|
|
|
|
*/
|
2014-03-26 14:07:44 +00:00
|
|
|
|
public function beginRecentChangesList() {
|
2008-10-25 20:57:56 +00:00
|
|
|
|
$this->rc_cache = array();
|
|
|
|
|
|
$this->rcMoveIndex = 0;
|
|
|
|
|
|
$this->rcCacheIndex = 0;
|
|
|
|
|
|
$this->lastdate = '';
|
|
|
|
|
|
$this->rclistOpen = false;
|
2013-06-13 23:47:43 +00:00
|
|
|
|
$this->getOutput()->addModuleStyles( array(
|
|
|
|
|
|
'mediawiki.special.changeslist',
|
|
|
|
|
|
'mediawiki.special.changeslist.enhanced',
|
|
|
|
|
|
) );
|
|
|
|
|
|
$this->getOutput()->addModules( array(
|
|
|
|
|
|
'jquery.makeCollapsible',
|
|
|
|
|
|
'mediawiki.icon',
|
|
|
|
|
|
) );
|
2013-11-08 11:20:58 +00:00
|
|
|
|
|
2013-11-26 22:13:51 +00:00
|
|
|
|
return '<div class="mw-changeslist">';
|
2008-10-25 20:57:56 +00:00
|
|
|
|
}
|
2013-11-08 11:20:58 +00:00
|
|
|
|
|
2005-09-06 18:14:24 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Format a line for enhanced recentchange (aka with javascript and block of lines).
|
2011-04-04 21:23:22 +00:00
|
|
|
|
*
|
2013-11-19 12:25:54 +00:00
|
|
|
|
* @param RecentChange $baseRC
|
|
|
|
|
|
* @param bool $watched
|
2011-05-20 22:03:10 +00:00
|
|
|
|
*
|
|
|
|
|
|
* @return string
|
2005-09-06 18:14:24 +00:00
|
|
|
|
*/
|
2008-04-04 05:08:25 +00:00
|
|
|
|
public function recentChangesLine( &$baseRC, $watched = false ) {
|
2005-07-01 20:36:04 +00:00
|
|
|
|
|
2013-11-08 11:20:58 +00:00
|
|
|
|
$date = $this->getLanguage()->userDate(
|
2013-11-26 10:35:24 +00:00
|
|
|
|
$baseRC->mAttribs['rc_timestamp'],
|
2013-11-08 11:20:58 +00:00
|
|
|
|
$this->getUser()
|
|
|
|
|
|
);
|
|
|
|
|
|
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$ret = '';
|
2013-11-08 11:20:58 +00:00
|
|
|
|
|
2014-04-11 10:35:42 +00:00
|
|
|
|
# If it's a new day, add the headline and flush the cache
|
2013-04-20 22:49:30 +00:00
|
|
|
|
if ( $date != $this->lastdate ) {
|
2004-11-25 13:47:17 +00:00
|
|
|
|
# Process current cache
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$ret = $this->recentChangesBlock();
|
|
|
|
|
|
$this->rc_cache = array();
|
2010-11-08 21:21:32 +00:00
|
|
|
|
$ret .= Xml::element( 'h4', null, $date ) . "\n";
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$this->lastdate = $date;
|
|
|
|
|
|
}
|
2005-07-01 20:36:04 +00:00
|
|
|
|
|
2013-11-26 11:56:17 +00:00
|
|
|
|
$cacheEntry = $this->cacheEntryFactory->newFromRecentChange( $baseRC, $watched );
|
2014-04-08 08:40:04 +00:00
|
|
|
|
$this->addCacheEntry( $cacheEntry );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2014-04-08 08:40:04 +00:00
|
|
|
|
return $ret;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Put accumulated information into the cache, for later display.
|
|
|
|
|
|
* Page moves go on their own line.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param RCCacheEntry $cacheEntry
|
|
|
|
|
|
*/
|
|
|
|
|
|
protected function addCacheEntry( RCCacheEntry $cacheEntry ) {
|
2014-04-11 10:35:42 +00:00
|
|
|
|
$cacheGroupingKey = $this->makeCacheGroupingKey( $cacheEntry );
|
|
|
|
|
|
|
|
|
|
|
|
if ( !isset( $this->rc_cache[$cacheGroupingKey] ) ) {
|
|
|
|
|
|
$this->rc_cache[$cacheGroupingKey] = array();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
array_push( $this->rc_cache[$cacheGroupingKey], $cacheEntry );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @todo use rc_source to group, if set; fallback to rc_type
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param RCCacheEntry $cacheEntry
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return string
|
|
|
|
|
|
*/
|
|
|
|
|
|
protected function makeCacheGroupingKey( RCCacheEntry $cacheEntry ) {
|
2013-11-08 11:20:58 +00:00
|
|
|
|
$title = $cacheEntry->getTitle();
|
2014-04-11 10:35:42 +00:00
|
|
|
|
$cacheGroupingKey = $title->getPrefixedDBkey();
|
2013-11-08 11:20:58 +00:00
|
|
|
|
|
2013-11-26 11:56:17 +00:00
|
|
|
|
$type = $cacheEntry->mAttribs['rc_type'];
|
|
|
|
|
|
|
2014-06-05 00:54:02 +00:00
|
|
|
|
if ( $type == RC_LOG ) {
|
2014-04-11 10:35:42 +00:00
|
|
|
|
// Group by log type
|
|
|
|
|
|
$cacheGroupingKey = SpecialPage::getTitleFor(
|
|
|
|
|
|
'Log',
|
|
|
|
|
|
$cacheEntry->mAttribs['rc_log_type']
|
|
|
|
|
|
)->getPrefixedDBkey();
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2014-04-11 10:35:42 +00:00
|
|
|
|
|
|
|
|
|
|
return $cacheGroupingKey;
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2005-09-06 22:16:41 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Enhanced RC group
|
2013-11-19 12:25:54 +00:00
|
|
|
|
* @param RCCacheEntry[] $block
|
2012-02-09 21:33:27 +00:00
|
|
|
|
* @return string
|
2005-09-06 22:16:41 +00:00
|
|
|
|
*/
|
2008-04-04 13:16:58 +00:00
|
|
|
|
protected function recentChangesBlockGroup( $block ) {
|
2009-02-20 13:00:58 +00:00
|
|
|
|
|
2010-11-08 21:21:32 +00:00
|
|
|
|
# Add the namespace and title of the block as part of the class
|
2012-05-12 03:33:04 +00:00
|
|
|
|
$classes = array( 'mw-collapsible', 'mw-collapsed', 'mw-enhanced-rc' );
|
2010-11-08 21:21:32 +00:00
|
|
|
|
if ( $block[0]->mAttribs['rc_log_type'] ) {
|
|
|
|
|
|
# Log entry
|
2012-05-12 03:33:04 +00:00
|
|
|
|
$classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-'
|
2014-01-14 06:19:21 +00:00
|
|
|
|
. $block[0]->mAttribs['rc_log_type'] );
|
2010-11-08 21:21:32 +00:00
|
|
|
|
} else {
|
2012-05-12 03:33:04 +00:00
|
|
|
|
$classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns'
|
2013-11-18 22:07:49 +00:00
|
|
|
|
. $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] );
|
2010-11-08 21:21:32 +00:00
|
|
|
|
}
|
2012-12-31 19:41:00 +00:00
|
|
|
|
$classes[] = $block[0]->watched && $block[0]->mAttribs['rc_timestamp'] >= $block[0]->watched
|
|
|
|
|
|
? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
|
2010-11-08 21:21:32 +00:00
|
|
|
|
$r = Html::openElement( 'table', array( 'class' => $classes ) ) .
|
|
|
|
|
|
Html::openElement( 'tr' );
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
|
|
|
|
|
# Collate list of users
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$userlinks = array();
|
|
|
|
|
|
# Other properties
|
2008-09-16 05:56:43 +00:00
|
|
|
|
$unpatrolled = false;
|
|
|
|
|
|
$isnew = false;
|
2012-12-01 19:51:09 +00:00
|
|
|
|
$allBots = true;
|
|
|
|
|
|
$allMinors = true;
|
2015-02-26 13:10:22 +00:00
|
|
|
|
$curId = 0;
|
2008-04-01 22:41:19 +00:00
|
|
|
|
# Some catalyst variables...
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$namehidden = true;
|
2008-12-11 21:34:15 +00:00
|
|
|
|
$allLogs = true;
|
2014-08-22 20:01:08 +00:00
|
|
|
|
$RCShowChangedSize = $this->getConfig()->get( 'RCShowChangedSize' );
|
2013-04-20 22:49:30 +00:00
|
|
|
|
foreach ( $block as $rcObj ) {
|
|
|
|
|
|
if ( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$isnew = true;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2008-03-16 18:46:09 +00:00
|
|
|
|
// If all log actions to this page were hidden, then don't
|
|
|
|
|
|
// give the name of the affected page for this block!
|
2013-04-20 22:49:30 +00:00
|
|
|
|
if ( !$this->isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$namehidden = false;
|
|
|
|
|
|
}
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$u = $rcObj->userlink;
|
2013-04-20 22:49:30 +00:00
|
|
|
|
if ( !isset( $userlinks[$u] ) ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$userlinks[$u] = 0;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2013-04-20 22:49:30 +00:00
|
|
|
|
if ( $rcObj->unpatrolled ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$unpatrolled = true;
|
|
|
|
|
|
}
|
2013-04-20 22:49:30 +00:00
|
|
|
|
if ( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
|
2008-12-11 21:34:15 +00:00
|
|
|
|
$allLogs = false;
|
2008-04-01 22:41:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
# Get the latest entry with a page_id and oldid
|
|
|
|
|
|
# since logs may not have these.
|
2013-04-20 22:49:30 +00:00
|
|
|
|
if ( !$curId && $rcObj->mAttribs['rc_cur_id'] ) {
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$curId = $rcObj->mAttribs['rc_cur_id'];
|
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2013-04-20 22:49:30 +00:00
|
|
|
|
if ( !$rcObj->mAttribs['rc_bot'] ) {
|
2012-12-01 19:51:09 +00:00
|
|
|
|
$allBots = false;
|
|
|
|
|
|
}
|
2013-04-20 22:49:30 +00:00
|
|
|
|
if ( !$rcObj->mAttribs['rc_minor'] ) {
|
2012-12-01 19:51:09 +00:00
|
|
|
|
$allMinors = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$userlinks[$u]++;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Sort the list and convert to text
|
2005-12-16 23:56:44 +00:00
|
|
|
|
krsort( $userlinks );
|
|
|
|
|
|
asort( $userlinks );
|
|
|
|
|
|
$users = array();
|
2013-04-20 22:49:30 +00:00
|
|
|
|
foreach ( $userlinks as $userlink => $count ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$text = $userlink;
|
2011-11-21 16:13:21 +00:00
|
|
|
|
$text .= $this->getLanguage()->getDirMark();
|
2013-04-20 22:49:30 +00:00
|
|
|
|
if ( $count > 1 ) {
|
2013-11-18 22:03:29 +00:00
|
|
|
|
// @todo FIXME: Hardcoded '×'. Should be a message.
|
|
|
|
|
|
$formattedCount = $this->getLanguage()->formatNum( $count ) . '×';
|
|
|
|
|
|
$text .= ' ' . $this->msg( 'parentheses' )->rawParams( $formattedCount )->escaped();
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
array_push( $users, $text );
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2012-06-05 22:58:54 +00:00
|
|
|
|
$users = ' <span class="changedby">'
|
2012-05-30 11:46:52 +00:00
|
|
|
|
. $this->msg( 'brackets' )->rawParams(
|
2012-06-05 22:58:54 +00:00
|
|
|
|
implode( $this->message['semicolon-separator'], $users )
|
2012-05-30 11:46:52 +00:00
|
|
|
|
)->escaped() . '</span>';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
2013-11-18 22:03:29 +00:00
|
|
|
|
$tl = '<span class="mw-collapsible-toggle mw-collapsible-arrow ' .
|
|
|
|
|
|
'mw-enhancedchanges-arrow mw-enhancedchanges-arrow-space"></span>';
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$r .= "<td>$tl</td>";
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
|
|
|
|
|
# Main line
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$r .= '<td class="mw-enhanced-rc">' . $this->recentChangesFlags( array(
|
2012-12-01 19:51:09 +00:00
|
|
|
|
'newpage' => $isnew, # show, when one have this flag
|
|
|
|
|
|
'minor' => $allMinors, # show only, when all have this flag
|
|
|
|
|
|
'unpatrolled' => $unpatrolled, # show, when one have this flag
|
|
|
|
|
|
'bot' => $allBots, # show only, when all have this flag
|
2010-12-27 19:07:28 +00:00
|
|
|
|
) );
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
|
|
|
|
|
# Timestamp
|
2013-02-03 20:05:24 +00:00
|
|
|
|
$r .= ' ' . $block[0]->timestamp . ' </td><td>';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
|
|
|
|
|
# Article link
|
2013-04-20 22:49:30 +00:00
|
|
|
|
if ( $namehidden ) {
|
2013-11-18 22:03:29 +00:00
|
|
|
|
$r .= ' <span class="history-deleted">' .
|
|
|
|
|
|
$this->msg( 'rev-deleted-event' )->escaped() . '</span>';
|
2013-04-20 22:49:30 +00:00
|
|
|
|
} elseif ( $allLogs ) {
|
2008-12-11 21:34:15 +00:00
|
|
|
|
$r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
|
2008-04-01 22:41:19 +00:00
|
|
|
|
} else {
|
2008-11-29 00:17:10 +00:00
|
|
|
|
$this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched );
|
2008-04-01 22:41:19 +00:00
|
|
|
|
}
|
2007-02-28 18:11:09 +00:00
|
|
|
|
|
2011-11-21 16:13:21 +00:00
|
|
|
|
$r .= $this->getLanguage()->getDirMark();
|
2006-12-13 20:08:02 +00:00
|
|
|
|
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$queryParams['curid'] = $curId;
|
2013-07-24 11:45:17 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
# Sub-entries
|
|
|
|
|
|
$lines = '';
|
|
|
|
|
|
foreach ( $block as $i => $rcObj ) {
|
|
|
|
|
|
$line = $this->getLineData( $block, $rcObj, $queryParams );
|
|
|
|
|
|
$lines .= $line;
|
|
|
|
|
|
if ( !$line ) {
|
|
|
|
|
|
// completely ignore this RC entry if we don't want to render it
|
|
|
|
|
|
unset( $block[$i] );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// Further down are some assumptions that $block is a 0-indexed array
|
|
|
|
|
|
// with (count-1) as last key. Let's make sure it is.
|
|
|
|
|
|
$block = array_values( $block );
|
|
|
|
|
|
|
2015-02-26 13:10:22 +00:00
|
|
|
|
$r .= $this->getLogText( $block, $queryParams, $allLogs, $isnew, $namehidden );
|
2012-02-28 11:56:59 +00:00
|
|
|
|
|
2012-08-30 14:42:49 +00:00
|
|
|
|
$r .= ' <span class="mw-changeslist-separator">. .</span> ';
|
2008-11-18 12:54:53 +00:00
|
|
|
|
|
2008-04-01 22:41:19 +00:00
|
|
|
|
# Character difference (does not apply if only log items)
|
2014-08-22 20:01:08 +00:00
|
|
|
|
if ( $RCShowChangedSize && !$allLogs ) {
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$last = 0;
|
2013-02-03 20:05:24 +00:00
|
|
|
|
$first = count( $block ) - 1;
|
2008-04-01 22:41:19 +00:00
|
|
|
|
# Some events (like logs) have an "empty" size, so we need to skip those...
|
2013-04-20 22:49:30 +00:00
|
|
|
|
while ( $last < $first && $block[$last]->mAttribs['rc_new_len'] === null ) {
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$last++;
|
|
|
|
|
|
}
|
2013-04-20 22:49:30 +00:00
|
|
|
|
while ( $first > $last && $block[$first]->mAttribs['rc_old_len'] === null ) {
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$first--;
|
|
|
|
|
|
}
|
|
|
|
|
|
# Get net change
|
2012-06-28 09:31:55 +00:00
|
|
|
|
$chardiff = $this->formatCharacterDifference( $block[$first], $block[$last] );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2013-04-20 22:49:30 +00:00
|
|
|
|
if ( $chardiff == '' ) {
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$r .= ' ';
|
|
|
|
|
|
} else {
|
2013-04-13 11:36:24 +00:00
|
|
|
|
$r .= ' ' . $chardiff . ' <span class="mw-changeslist-separator">. .</span> ';
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$r .= $users;
|
2015-02-26 13:10:22 +00:00
|
|
|
|
$r .= $this->numberofWatchingusers( $block[0]->numberofWatchingusers );
|
2013-11-19 19:09:00 +00:00
|
|
|
|
$r .= '</td></tr>';
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
if ( !$lines ) {
|
|
|
|
|
|
// if there are no lines to be rendered (all aborted by hook), don't render the block
|
|
|
|
|
|
return '';
|
|
|
|
|
|
}
|
2015-06-25 19:13:23 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
$r .= $lines;
|
|
|
|
|
|
$r .= "</table>\n";
|
2015-06-25 19:13:23 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
$this->rcCacheIndex++;
|
2015-07-08 14:39:05 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
return $r;
|
|
|
|
|
|
}
|
2015-06-25 19:13:23 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @param RCCacheEntry[] $block
|
|
|
|
|
|
* @param RCCacheEntry $rcObj
|
|
|
|
|
|
* @param array $queryParams
|
|
|
|
|
|
* @return string
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
* @throws FatalError
|
|
|
|
|
|
* @throws MWException
|
|
|
|
|
|
*/
|
|
|
|
|
|
protected function getLineData( array $block, RCCacheEntry $rcObj, array $queryParams = array() ) {
|
|
|
|
|
|
$RCShowChangedSize = $this->getConfig()->get( 'RCShowChangedSize' );
|
2015-06-25 19:13:23 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
# Classes to apply -- TODO implement
|
|
|
|
|
|
$classes = array();
|
|
|
|
|
|
$type = $rcObj->mAttribs['rc_type'];
|
|
|
|
|
|
$data = array();
|
2015-06-25 19:13:23 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
$trClass = $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
|
|
|
|
|
|
? ' class="mw-enhanced-watched"' : '';
|
|
|
|
|
|
$separator = ' <span class="mw-changeslist-separator">. .</span> ';
|
2008-03-16 18:46:09 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
$data['recentChangesFlags'] = array(
|
|
|
|
|
|
'newpage' => $type == RC_NEW,
|
|
|
|
|
|
'minor' => $rcObj->mAttribs['rc_minor'],
|
|
|
|
|
|
'unpatrolled' => $rcObj->unpatrolled,
|
|
|
|
|
|
'bot' => $rcObj->mAttribs['rc_bot'],
|
|
|
|
|
|
);
|
2015-07-08 14:39:05 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
$params = $queryParams;
|
2005-09-06 18:43:45 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
if ( $rcObj->mAttribs['rc_this_oldid'] != 0 ) {
|
|
|
|
|
|
$params['oldid'] = $rcObj->mAttribs['rc_this_oldid'];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Log timestamp
|
|
|
|
|
|
if ( $type == RC_LOG ) {
|
|
|
|
|
|
$link = $rcObj->timestamp;
|
|
|
|
|
|
# Revision link
|
|
|
|
|
|
} elseif ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
|
|
|
|
|
|
$link = '<span class="history-deleted">' . $rcObj->timestamp . '</span> ';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$link = Linker::linkKnown(
|
|
|
|
|
|
$rcObj->getTitle(),
|
|
|
|
|
|
$rcObj->timestamp,
|
|
|
|
|
|
array(),
|
|
|
|
|
|
$params
|
|
|
|
|
|
);
|
|
|
|
|
|
if ( $this->isDeleted( $rcObj, Revision::DELETED_TEXT ) ) {
|
|
|
|
|
|
$link = '<span class="history-deleted">' . $link . '</span> ';
|
2015-09-16 09:56:29 +00:00
|
|
|
|
}
|
2015-09-16 10:44:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
$data['timestampLink'] = $link;
|
2009-02-20 13:00:58 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
$currentAndLastLinks = '';
|
|
|
|
|
|
if ( !$type == RC_LOG || $type == RC_NEW ) {
|
|
|
|
|
|
$currentAndLastLinks .= ' ' . $this->msg( 'parentheses' )->rawParams(
|
|
|
|
|
|
$rcObj->curlink .
|
|
|
|
|
|
$this->message['pipe-separator'] .
|
|
|
|
|
|
$rcObj->lastlink
|
|
|
|
|
|
)->escaped();
|
|
|
|
|
|
}
|
|
|
|
|
|
$data['currentAndLastLinks'] = $currentAndLastLinks;
|
|
|
|
|
|
$data['separatorAfterCurrentAndLastLinks'] = $separator;
|
|
|
|
|
|
|
|
|
|
|
|
# Character diff
|
|
|
|
|
|
if ( $RCShowChangedSize ) {
|
|
|
|
|
|
$cd = $this->formatCharacterDifference( $rcObj );
|
|
|
|
|
|
if ( $cd !== '' ) {
|
|
|
|
|
|
$data['characterDiff'] = $cd;
|
|
|
|
|
|
$data['separatorAfterCharacterDiff'] = $separator;
|
2015-09-16 09:56:29 +00:00
|
|
|
|
}
|
2015-09-16 10:44:04 +00:00
|
|
|
|
}
|
2015-07-08 14:39:05 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
if ( $rcObj->mAttribs['rc_type'] == RC_LOG ) {
|
|
|
|
|
|
$data['logEntry'] = $this->insertLogEntry( $rcObj );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
# User links
|
|
|
|
|
|
$data['userLink'] = $rcObj->userlink;
|
|
|
|
|
|
$data['userTalkLink'] = $rcObj->usertalklink;
|
|
|
|
|
|
$data['comment'] = $this->insertComment( $rcObj );
|
|
|
|
|
|
}
|
2015-07-08 14:39:05 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
# Rollback
|
|
|
|
|
|
$data['rollback'] = $this->getRollback( $rcObj );
|
2015-07-08 14:39:05 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
# Tags
|
|
|
|
|
|
$data['tags'] = $this->getTags( $rcObj, $classes );
|
|
|
|
|
|
|
|
|
|
|
|
// give the hook a chance to modify the data
|
|
|
|
|
|
$success = Hooks::run( 'EnhancedChangesListModifyLineData',
|
|
|
|
|
|
array( $this, &$data, $block, $rcObj ) );
|
|
|
|
|
|
if ( !$success ) {
|
|
|
|
|
|
// skip entry if hook aborted it
|
|
|
|
|
|
return '';
|
2015-09-16 09:56:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
$line = '<tr' . $trClass . '><td></td><td class="mw-enhanced-rc">';
|
|
|
|
|
|
if ( isset( $data['recentChangesFlags'] ) ) {
|
|
|
|
|
|
$line .= $this->recentChangesFlags( $data['recentChangesFlags'] );
|
|
|
|
|
|
unset( $data['recentChangesFlags'] );
|
|
|
|
|
|
}
|
|
|
|
|
|
$line .= ' </td><td class="mw-enhanced-rc-nested">';
|
2015-09-16 09:56:29 +00:00
|
|
|
|
|
2015-09-16 10:44:04 +00:00
|
|
|
|
if ( isset( $data['timestampLink'] ) ) {
|
|
|
|
|
|
$line .= '<span class="mw-enhanced-rc-time">' . $data['timestampLink'] . '</span>';
|
|
|
|
|
|
unset( $data['timestampLink'] );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// everything else: makes it easier for extensions to add or remove data
|
|
|
|
|
|
$line .= implode( '', $data );
|
|
|
|
|
|
|
|
|
|
|
|
$line .= "</td></tr>\n";
|
|
|
|
|
|
|
|
|
|
|
|
return $line;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2015-02-26 13:10:22 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Generates amount of changes (linking to diff ) & link to history.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param array $block
|
|
|
|
|
|
* @param array $queryParams
|
|
|
|
|
|
* @param bool $allLogs
|
|
|
|
|
|
* @param bool $isnew
|
|
|
|
|
|
* @param bool $namehidden
|
|
|
|
|
|
* @return string
|
|
|
|
|
|
*/
|
|
|
|
|
|
protected function getLogText( $block, $queryParams, $allLogs, $isnew, $namehidden ) {
|
|
|
|
|
|
# Changes message
|
|
|
|
|
|
static $nchanges = array();
|
|
|
|
|
|
static $sinceLastVisitMsg = array();
|
|
|
|
|
|
|
|
|
|
|
|
$n = count( $block );
|
|
|
|
|
|
if ( !isset( $nchanges[$n] ) ) {
|
|
|
|
|
|
$nchanges[$n] = $this->msg( 'nchanges' )->numParams( $n )->escaped();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$sinceLast = 0;
|
|
|
|
|
|
$unvisitedOldid = null;
|
|
|
|
|
|
/** @var $rcObj RCCacheEntry */
|
|
|
|
|
|
foreach ( $block as $rcObj ) {
|
|
|
|
|
|
// Same logic as below inside main foreach
|
|
|
|
|
|
if ( $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched ) {
|
|
|
|
|
|
$sinceLast++;
|
|
|
|
|
|
$unvisitedOldid = $rcObj->mAttribs['rc_last_oldid'];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if ( !isset( $sinceLastVisitMsg[$sinceLast] ) ) {
|
|
|
|
|
|
$sinceLastVisitMsg[$sinceLast] =
|
|
|
|
|
|
$this->msg( 'enhancedrc-since-last-visit' )->numParams( $sinceLast )->escaped();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$currentRevision = 0;
|
|
|
|
|
|
foreach ( $block as $rcObj ) {
|
|
|
|
|
|
if ( !$currentRevision ) {
|
|
|
|
|
|
$currentRevision = $rcObj->mAttribs['rc_this_oldid'];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Total change link
|
|
|
|
|
|
$links = array();
|
|
|
|
|
|
/** @var $block0 RecentChange */
|
|
|
|
|
|
$block0 = $block[0];
|
|
|
|
|
|
$last = $block[count( $block ) - 1];
|
|
|
|
|
|
if ( !$allLogs ) {
|
|
|
|
|
|
if ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
|
|
|
|
|
|
$links['total-changes'] = $nchanges[$n];
|
|
|
|
|
|
} elseif ( $isnew ) {
|
|
|
|
|
|
$links['total-changes'] = $nchanges[$n];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$links['total-changes'] = Linker::link(
|
|
|
|
|
|
$block0->getTitle(),
|
|
|
|
|
|
$nchanges[$n],
|
|
|
|
|
|
array(),
|
|
|
|
|
|
$queryParams + array(
|
|
|
|
|
|
'diff' => $currentRevision,
|
|
|
|
|
|
'oldid' => $last->mAttribs['rc_last_oldid'],
|
|
|
|
|
|
),
|
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
|
);
|
|
|
|
|
|
if ( $sinceLast > 0 && $sinceLast < $n ) {
|
|
|
|
|
|
$links['total-changes-since-last'] = Linker::link(
|
|
|
|
|
|
$block0->getTitle(),
|
|
|
|
|
|
$sinceLastVisitMsg[$sinceLast],
|
|
|
|
|
|
array(),
|
|
|
|
|
|
$queryParams + array(
|
|
|
|
|
|
'diff' => $currentRevision,
|
|
|
|
|
|
'oldid' => $unvisitedOldid,
|
|
|
|
|
|
),
|
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# History
|
|
|
|
|
|
if ( $allLogs ) {
|
|
|
|
|
|
// don't show history link for logs
|
|
|
|
|
|
} elseif ( $namehidden || !$block0->getTitle()->exists() ) {
|
|
|
|
|
|
$links['history'] = $this->message['enhancedrc-history'];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$params = $queryParams;
|
|
|
|
|
|
$params['action'] = 'history';
|
|
|
|
|
|
|
|
|
|
|
|
$links['history'] = Linker::linkKnown(
|
|
|
|
|
|
$block0->getTitle(),
|
|
|
|
|
|
$this->message['enhancedrc-history'],
|
|
|
|
|
|
array(),
|
|
|
|
|
|
$params
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Allow others to alter, remove or add to these links
|
|
|
|
|
|
Hooks::run( 'EnhancedChangesList::getLogText',
|
|
|
|
|
|
array( $this, &$links, $block ) );
|
|
|
|
|
|
|
|
|
|
|
|
if ( !$links ) {
|
|
|
|
|
|
return '';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$logtext = implode( $this->message['pipe-separator'], $links );
|
|
|
|
|
|
$logtext = $this->msg( 'parentheses' )->rawParams( $logtext )->escaped();
|
|
|
|
|
|
return ' ' . $logtext;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Enhanced RC ungrouped line.
|
2011-04-04 21:23:22 +00:00
|
|
|
|
*
|
2013-11-19 12:25:54 +00:00
|
|
|
|
* @param RecentChange|RCCacheEntry $rcObj
|
|
|
|
|
|
* @return string A HTML formatted line (generated using $r)
|
2005-12-16 23:56:44 +00:00
|
|
|
|
*/
|
2008-04-04 13:16:58 +00:00
|
|
|
|
protected function recentChangesBlockLine( $rcObj ) {
|
2015-07-02 12:09:41 +00:00
|
|
|
|
$data = array();
|
|
|
|
|
|
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$query['curid'] = $rcObj->mAttribs['rc_cur_id'];
|
2009-02-20 13:00:58 +00:00
|
|
|
|
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$type = $rcObj->mAttribs['rc_type'];
|
|
|
|
|
|
$logType = $rcObj->mAttribs['rc_log_type'];
|
2012-05-12 03:33:04 +00:00
|
|
|
|
$classes = array( 'mw-enhanced-rc' );
|
2013-04-20 22:49:30 +00:00
|
|
|
|
if ( $logType ) {
|
2010-11-08 21:21:32 +00:00
|
|
|
|
# Log entry
|
2014-01-14 06:19:21 +00:00
|
|
|
|
$classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-' . $logType );
|
2010-11-08 21:21:32 +00:00
|
|
|
|
} else {
|
2012-05-12 03:33:04 +00:00
|
|
|
|
$classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns' .
|
2013-11-18 22:07:49 +00:00
|
|
|
|
$rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title'] );
|
2010-11-08 21:21:32 +00:00
|
|
|
|
}
|
2012-12-31 19:41:00 +00:00
|
|
|
|
$classes[] = $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
|
|
|
|
|
|
? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
|
2010-11-08 21:21:32 +00:00
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
# Flag and Timestamp
|
2015-07-08 21:57:20 +00:00
|
|
|
|
$data['recentChangesFlags'] = array(
|
2014-06-05 00:54:02 +00:00
|
|
|
|
'newpage' => $type == RC_NEW,
|
|
|
|
|
|
'minor' => $rcObj->mAttribs['rc_minor'],
|
|
|
|
|
|
'unpatrolled' => $rcObj->unpatrolled,
|
|
|
|
|
|
'bot' => $rcObj->mAttribs['rc_bot'],
|
2015-07-08 21:57:20 +00:00
|
|
|
|
);
|
2015-07-02 12:09:41 +00:00
|
|
|
|
// timestamp is not really a link here, but is called timestampLink
|
|
|
|
|
|
// for consistency with EnhancedChangesListModifyLineData
|
|
|
|
|
|
$data['timestampLink'] = $rcObj->timestamp;
|
|
|
|
|
|
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# Article or log link
|
2013-04-20 22:49:30 +00:00
|
|
|
|
if ( $logType ) {
|
2012-06-18 22:56:55 +00:00
|
|
|
|
$logPage = new LogPage( $logType );
|
|
|
|
|
|
$logTitle = SpecialPage::getTitleFor( 'Log', $logType );
|
|
|
|
|
|
$logName = $logPage->getName()->escaped();
|
2015-07-02 12:09:41 +00:00
|
|
|
|
$data['logLink'] = $this->msg( 'parentheses' )
|
2013-11-18 22:03:29 +00:00
|
|
|
|
->rawParams( Linker::linkKnown( $logTitle, $logName ) )->escaped();
|
2008-03-16 18:46:09 +00:00
|
|
|
|
} else {
|
2015-07-02 12:09:41 +00:00
|
|
|
|
$data['articleLink'] = $this->getArticleLink( $rcObj, $rcObj->unpatrolled, $rcObj->watched );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
2015-07-02 12:09:41 +00:00
|
|
|
|
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# Diff and hist links
|
2015-08-20 17:18:54 +00:00
|
|
|
|
if ( $type != RC_LOG ) {
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$query['action'] = 'history';
|
2015-08-20 17:18:54 +00:00
|
|
|
|
$data['historyLink'] = ' ' . $this->msg( 'parentheses' )
|
|
|
|
|
|
->rawParams( $rcObj->difflink . $this->message['pipe-separator'] . Linker::linkKnown(
|
|
|
|
|
|
$rcObj->getTitle(),
|
|
|
|
|
|
$this->message['hist'],
|
|
|
|
|
|
array(),
|
|
|
|
|
|
$query
|
|
|
|
|
|
) )->escaped();
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
2015-07-02 12:09:41 +00:00
|
|
|
|
$data['separatorAfterLinks'] = ' <span class="mw-changeslist-separator">. .</span> ';
|
|
|
|
|
|
|
2006-12-13 20:08:02 +00:00
|
|
|
|
# Character diff
|
2014-08-22 20:01:08 +00:00
|
|
|
|
if ( $this->getConfig()->get( 'RCShowChangedSize' ) ) {
|
2012-06-28 09:31:55 +00:00
|
|
|
|
$cd = $this->formatCharacterDifference( $rcObj );
|
|
|
|
|
|
if ( $cd !== '' ) {
|
2015-07-02 12:09:41 +00:00
|
|
|
|
$data['characterDiff'] = $cd;
|
|
|
|
|
|
$data['separatorAftercharacterDiff'] = ' <span class="mw-changeslist-separator">. .</span> ';
|
2012-06-28 09:31:55 +00:00
|
|
|
|
}
|
2006-12-13 20:08:02 +00:00
|
|
|
|
}
|
2011-09-08 09:15:59 +00:00
|
|
|
|
|
|
|
|
|
|
if ( $type == RC_LOG ) {
|
2015-07-02 12:09:41 +00:00
|
|
|
|
$data['logEntry'] = $this->insertLogEntry( $rcObj );
|
2012-06-28 09:31:55 +00:00
|
|
|
|
} else {
|
2015-07-02 12:09:41 +00:00
|
|
|
|
$data['userLink'] = $rcObj->userlink;
|
|
|
|
|
|
$data['userTalkLink'] = $rcObj->usertalklink;
|
|
|
|
|
|
$data['comment'] = $this->insertComment( $rcObj );
|
|
|
|
|
|
$data['rollback'] = $this->getRollback( $rcObj );
|
2008-04-04 03:56:48 +00:00
|
|
|
|
}
|
2011-09-08 09:15:59 +00:00
|
|
|
|
|
2009-02-18 04:39:52 +00:00
|
|
|
|
# Tags
|
2015-07-02 12:09:41 +00:00
|
|
|
|
$data['tags'] = $this->getTags( $rcObj, $classes );
|
|
|
|
|
|
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# Show how many people are watching this if enabled
|
2015-07-02 12:09:41 +00:00
|
|
|
|
$data['watchingUsers'] = $this->numberofWatchingusers( $rcObj->numberofWatchingusers );
|
2005-12-16 23:56:44 +00:00
|
|
|
|
|
2015-07-02 12:09:41 +00:00
|
|
|
|
// give the hook a chance to modify the data
|
2015-07-02 12:32:50 +00:00
|
|
|
|
$success = Hooks::run( 'EnhancedChangesListModifyBlockLineData',
|
2015-07-02 12:09:41 +00:00
|
|
|
|
array( $this, &$data, $rcObj ) );
|
2015-07-02 12:32:50 +00:00
|
|
|
|
if ( !$success ) {
|
|
|
|
|
|
// skip entry if hook aborted it
|
|
|
|
|
|
return '';
|
|
|
|
|
|
}
|
2009-02-20 13:00:58 +00:00
|
|
|
|
|
2015-07-02 12:09:41 +00:00
|
|
|
|
$line = Html::openElement( 'table', array( 'class' => $classes ) ) .
|
|
|
|
|
|
Html::openElement( 'tr' );
|
|
|
|
|
|
$line .= '<td class="mw-enhanced-rc"><span class="mw-enhancedchanges-arrow-space"></span>';
|
|
|
|
|
|
|
|
|
|
|
|
if ( isset( $data['recentChangesFlags'] ) ) {
|
|
|
|
|
|
$line .= $this->recentChangesFlags( $data['recentChangesFlags'] );
|
|
|
|
|
|
unset( $data['recentChangesFlags'] );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( isset( $data['timestampLink'] ) ) {
|
|
|
|
|
|
$line .= ' ' . $data['timestampLink'];
|
|
|
|
|
|
unset( $data['timestampLink'] );
|
|
|
|
|
|
}
|
|
|
|
|
|
$line .= ' </td><td>';
|
|
|
|
|
|
|
|
|
|
|
|
// everything else: makes it easier for extensions to add or remove data
|
|
|
|
|
|
$line .= implode( '', $data );
|
|
|
|
|
|
|
|
|
|
|
|
$line .= "</td></tr></table>\n";
|
|
|
|
|
|
|
|
|
|
|
|
return $line;
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* If enhanced RC is in use, this function takes the previously cached
|
|
|
|
|
|
* RC lines, arranges them, and outputs the HTML
|
2011-05-20 22:03:10 +00:00
|
|
|
|
*
|
|
|
|
|
|
* @return string
|
2005-12-16 23:56:44 +00:00
|
|
|
|
*/
|
2008-04-04 13:16:58 +00:00
|
|
|
|
protected function recentChangesBlock() {
|
2013-11-18 22:07:49 +00:00
|
|
|
|
if ( count( $this->rc_cache ) == 0 ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
return '';
|
|
|
|
|
|
}
|
2009-02-20 13:00:58 +00:00
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$blockOut = '';
|
2013-04-20 22:49:30 +00:00
|
|
|
|
foreach ( $this->rc_cache as $block ) {
|
|
|
|
|
|
if ( count( $block ) < 2 ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$blockOut .= $this->recentChangesBlockGroup( $block );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2009-02-20 13:00:58 +00:00
|
|
|
|
|
2013-02-03 20:05:24 +00:00
|
|
|
|
return '<div>' . $blockOut . '</div>';
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2011-05-25 15:39:47 +00:00
|
|
|
|
* Returns text for the end of RC
|
2005-12-16 23:56:44 +00:00
|
|
|
|
* If enhanced RC is in use, returns pretty much all the text
|
2012-01-12 19:03:32 +00:00
|
|
|
|
* @return string
|
2005-12-16 23:56:44 +00:00
|
|
|
|
*/
|
2008-04-04 05:08:25 +00:00
|
|
|
|
public function endRecentChangesList() {
|
2013-11-26 22:13:51 +00:00
|
|
|
|
return $this->recentChangesBlock() . '</div>';
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|