EnhancedChangesList: Load style module via addModuleStyles()
[lhc/web/wiklou.git] / includes / changes / EnhancedChangesList.php
index ada02ce..51a26ba 100644 (file)
@@ -77,12 +77,12 @@ class EnhancedChangesList extends ChangesList {
                $this->lastdate = '';
                $this->rclistOpen = false;
                $this->getOutput()->addModuleStyles( [
+                       'mediawiki.icon',
                        'mediawiki.special.changeslist',
                        'mediawiki.special.changeslist.enhanced',
                ] );
                $this->getOutput()->addModules( [
                        'jquery.makeCollapsible',
-                       'mediawiki.icon',
                ] );
 
                return '<div class="mw-changeslist">';
@@ -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
         */
@@ -409,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 = '<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
                        );
@@ -472,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'] ) ) {
@@ -642,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 ) {
@@ -704,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 ) ) {