X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=blobdiff_plain;f=includes%2Fchanges%2FEnhancedChangesList.php;h=28b30d8ba413425c2e6243bb59eeadac8d7005c9;hb=938d303c9e3a899d298c121c067313d2dfddef30;hp=81eccbcf036710daee4576d256e1c1f0a8a14068;hpb=e554e9522693ceedd35684fd5be59d76ed5a2c65;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/changes/EnhancedChangesList.php b/includes/changes/EnhancedChangesList.php index 81eccbcf03..28b30d8ba4 100644 --- a/includes/changes/EnhancedChangesList.php +++ b/includes/changes/EnhancedChangesList.php @@ -93,7 +93,7 @@ class EnhancedChangesList extends ChangesList { * * @param RecentChange &$rc * @param bool $watched - * @param int $linenumber (default null) + * @param int|null $linenumber (default null) * * @return string */ @@ -266,6 +266,7 @@ class EnhancedChangesList extends ChangesList { # Sub-entries $lines = []; + $filterClasses = []; foreach ( $block as $i => $rcObj ) { $line = $this->getLineData( $block, $rcObj, $queryParams ); if ( !$line ) { @@ -293,12 +294,19 @@ class EnhancedChangesList extends ChangesList { } } + // 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 @@ -339,6 +347,7 @@ class EnhancedChangesList extends ChangesList { 'articleLink' => $articleLink, 'charDifference' => $charDifference, 'collectedRcFlags' => $this->recentChangesFlags( $collectedRcFlags ), + 'filterClasses' => $filterClasses, 'languageDirMark' => $this->getLanguage()->getDirMark(), 'lines' => $lines, 'logText' => $logText, @@ -400,14 +409,14 @@ class EnhancedChangesList extends ChangesList { # 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 = '' . $rcObj->timestamp . ' '; + $link = Html::element( 'span', [ 'class' => 'history-deleted' ], $rcObj->timestamp ); } else { $link = $this->linkRenderer->makeKnownLink( $rcObj->getTitle(), - new HtmlArmor( $rcObj->timestamp ), + $rcObj->timestamp, [], $params ); @@ -463,7 +472,10 @@ class EnhancedChangesList extends ChangesList { // 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'] ) ) { @@ -633,7 +645,7 @@ class EnhancedChangesList extends ChangesList { ]; // 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 ) { @@ -695,9 +707,9 @@ class EnhancedChangesList extends ChangesList { } $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 ) ) { @@ -705,9 +717,14 @@ class EnhancedChangesList extends ChangesList { } $line = Html::openElement( 'table', $attribs ) . Html::openElement( 'tr' ); + // Highlight block + $line .= Html::rawElement( 'td', [], + $this->getHighlightsContainerDiv() + ); + $line .= Html::rawElement( 'td', [], '' ); $line .= Html::rawElement( 'td', [ 'class' => 'mw-changeslist-line-prefix' ], $prefix ); - $line .= ''; + $line .= ''; if ( isset( $data['recentChangesFlags'] ) ) { $line .= $this->recentChangesFlags( $data['recentChangesFlags'] );