*
* @param RecentChange &$rc
* @param bool $watched
- * @param int $linenumber (default null)
+ * @param int|null $linenumber (default null)
*
* @return string
*/
# Sub-entries
$lines = [];
+ $filterClasses = [];
foreach ( $block as $i => $rcObj ) {
$line = $this->getLineData( $block, $rcObj, $queryParams );
if ( !$line ) {
}
}
+ // Roll up filter-based CSS classes
+ $filterClasses = array_merge( $filterClasses, $this->getHTMLClassesForFilters( $rcObj ) );
+ // Add classes for change tags separately, getHTMLClassesForFilters() doesn't add them
+ $this->getTags( $rcObj, $filterClasses );
+ $filterClasses = array_unique( $filterClasses );
+
$lines[] = $line;
}
// 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 );
+ $filterClasses = array_values( $filterClasses );
if ( empty( $block ) || !$lines ) {
// if we can't show anything, don't display this block altogether
'articleLink' => $articleLink,
'charDifference' => $charDifference,
'collectedRcFlags' => $this->recentChangesFlags( $collectedRcFlags ),
+ 'filterClasses' => $filterClasses,
'languageDirMark' => $this->getLanguage()->getDirMark(),
'lines' => $lines,
'logText' => $logText,
# Log timestamp
if ( $type == RC_LOG ) {
- $link = $rcObj->timestamp;
+ $link = htmlspecialchars( $rcObj->timestamp );
# Revision link
} elseif ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
- $link = '<span class="history-deleted">' . $rcObj->timestamp . '</span> ';
+ $link = Html::element( 'span', [ 'class' => 'history-deleted' ], $rcObj->timestamp );
} else {
$link = $this->linkRenderer->makeKnownLink(
$rcObj->getTitle(),
- new HtmlArmor( $rcObj->timestamp ),
+ $rcObj->timestamp,
[],
$params
);
// skip entry if hook aborted it
return [];
}
- $attribs = wfArrayFilterByKey( $attribs, [ Sanitizer::class, 'isReservedDataAttribute' ] );
+ $attribs = array_filter( $attribs,
+ [ Sanitizer::class, 'isReservedDataAttribute' ],
+ ARRAY_FILTER_USE_KEY
+ );
$lineParams['recentChangesFlagsRaw'] = [];
if ( isset( $data['recentChangesFlags'] ) ) {
];
// timestamp is not really a link here, but is called timestampLink
// for consistency with EnhancedChangesListModifyLineData
- $data['timestampLink'] = $rcObj->timestamp;
+ $data['timestampLink'] = htmlspecialchars( $rcObj->timestamp );
# Article or log link
if ( $logType ) {
}
$attribs = $data['attribs'];
unset( $data['attribs'] );
- $attribs = wfArrayFilterByKey( $attribs, function ( $key ) {
+ $attribs = array_filter( $attribs, function ( $key ) {
return $key === 'class' || Sanitizer::isReservedDataAttribute( $key );
- } );
+ }, ARRAY_FILTER_USE_KEY );
$prefix = '';
if ( is_callable( $this->changeLinePrefixer ) ) {