X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fchanges%2FEnhancedChangesList.php;h=cbbbfebc850238888980ca5f3ac57bf4d32b50d8;hb=956c2430c7b8fceb289aaeacc8d6c2e0def2c56e;hp=03f63f673f5e8157927d6fe162025fc19781f1b0;hpb=178bada116bc5aa336191f4867fec5cae2258cd6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/changes/EnhancedChangesList.php b/includes/changes/EnhancedChangesList.php index 03f63f673f..55cb9edd08 100644 --- a/includes/changes/EnhancedChangesList.php +++ b/includes/changes/EnhancedChangesList.php @@ -98,20 +98,21 @@ class EnhancedChangesList extends ChangesList { * @return string */ public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) { - $date = $this->getLanguage()->userDate( $rc->mAttribs['rc_timestamp'], $this->getUser() ); + if ( $this->lastdate === '' ) { + $this->lastdate = $date; + } $ret = ''; - # If it's a new day, add the headline and flush the cache - if ( $date != $this->lastdate ) { - # Process current cache + # If it's a new day, flush the cache and update $this->lastdate + if ( $date !== $this->lastdate ) { + # Process current cache (uses $this->lastdate to generate a heading) $ret = $this->recentChangesBlock(); $this->rc_cache = []; - $ret .= Xml::element( 'h4', null, $date ) . "\n"; $this->lastdate = $date; } @@ -243,8 +244,7 @@ class EnhancedChangesList extends ChangesList { $text = $userlink; $text .= $this->getLanguage()->getDirMark(); if ( $count > 1 ) { - // @todo FIXME: Hardcoded '×'. Should be a message. - $formattedCount = $this->getLanguage()->formatNum( $count ) . '×'; + $formattedCount = $this->msg( 'ntimes' )->numParams( $count )->escaped(); $text .= ' ' . $this->msg( 'parentheses' )->rawParams( $formattedCount )->escaped(); } array_push( $users, $text ); @@ -686,7 +686,9 @@ class EnhancedChangesList extends ChangesList { } $attribs = $data['attribs']; unset( $data['attribs'] ); - $attribs = wfArrayFilterByKey( $attribs, [ Sanitizer::class, 'isReservedDataAttribute' ] ); + $attribs = wfArrayFilterByKey( $attribs, function ( $key ) { + return $key === 'class' || Sanitizer::isReservedDataAttribute( $key ); + } ); $line = Html::openElement( 'table', $attribs ) . Html::openElement( 'tr' ); $line .= ''; @@ -763,7 +765,11 @@ class EnhancedChangesList extends ChangesList { } } - return '
' . $blockOut . '
'; + if ( $blockOut === '' ) { + return ''; + } + // $this->lastdate is kept up to date by recentChangesLine() + return Xml::element( 'h4', null, $this->lastdate ) . "\n
" . $blockOut . '
'; } /**