Merge "Use htmlspecialchars() not htmlentities in xml export for validity"
[lhc/web/wiklou.git] / includes / changes / ChangesList.php
index eb9febe..bf275b3 100644 (file)
@@ -58,8 +58,6 @@ class ChangesList extends ContextSource {
        protected $filterGroups;
 
        /**
-        * Changeslist constructor
-        *
         * @param Skin|IContextSource $obj
         * @param array $filterGroups Array of ChangesListFilterGroup objects (currently optional)
         */
@@ -291,7 +289,10 @@ class ChangesList extends ContextSource {
                $this->rcCacheIndex = 0;
                $this->lastdate = '';
                $this->rclistOpen = false;
-               $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' );
+               $this->getOutput()->addModuleStyles( [
+                       'mediawiki.interface.helpers.styles',
+                       'mediawiki.special.changeslist'
+               ] );
 
                return '<div class="mw-changeslist">';
        }
@@ -351,12 +352,13 @@ class ChangesList extends ContextSource {
                } else {
                        $formattedSizeClass = 'mw-plusminus-neg';
                }
+               $formattedSizeClass .= ' mw-diff-bytes';
 
                $formattedTotalSize = $context->msg( 'rc-change-size-new' )->numParams( $new )->text();
 
                return Html::element( $tag,
                        [ 'dir' => 'ltr', 'class' => $formattedSizeClass, 'title' => $formattedTotalSize ],
-                       $context->msg( 'parentheses', $formattedSize )->plain() ) . $lang->getDirMark();
+                       $formattedSize ) . $lang->getDirMark();
        }
 
        /**
@@ -453,11 +455,9 @@ class ChangesList extends ContextSource {
                        );
                }
                if ( $rc->mAttribs['rc_type'] == RC_CATEGORIZE ) {
-                       $diffhist = $diffLink . $this->message['pipe-separator'] . $this->message['hist'];
+                       $histLink = $this->message['hist'];
                } else {
-                       $diffhist = $diffLink . $this->message['pipe-separator'];
-                       # History link
-                       $diffhist .= $this->linkRenderer->makeKnownLink(
+                       $histLink = $this->linkRenderer->makeKnownLink(
                                $rc->getTitle(),
                                new HtmlArmor( $this->message['hist'] ),
                                [ 'class' => 'mw-changeslist-history' ],
@@ -468,20 +468,11 @@ class ChangesList extends ContextSource {
                        );
                }
 
-               // @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
-               $s .= $this->msg( 'parentheses' )->rawParams( $diffhist )->escaped() .
-                       ' <span class="mw-changeslist-separator">. .</span> ';
-       }
-
-       /**
-        * @param string &$s Article link will be appended to this string, in place.
-        * @param RecentChange $rc
-        * @param bool $unpatrolled
-        * @param bool $watched
-        * @deprecated since 1.27, use getArticleLink instead.
-        */
-       public function insertArticleLink( &$s, RecentChange $rc, $unpatrolled, $watched ) {
-               $s .= $this->getArticleLink( $rc, $unpatrolled, $watched );
+               $s .= Html::rawElement( 'div', [ 'class' => 'mw-changeslist-links' ],
+                               Html::rawElement( 'span', [], $diffLink ) .
+                               Html::rawElement( 'span', [], $histLink )
+                       ) .
+                       ' <span class="mw-changeslist-separator"></span> ';
        }
 
        /**
@@ -531,10 +522,10 @@ class ChangesList extends ContextSource {
        public function getTimestamp( $rc ) {
                // @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
                return $this->message['semicolon-separator'] . '<span class="mw-changeslist-date">' .
-                       $this->getLanguage()->userTime(
+                       htmlspecialchars( $this->getLanguage()->userTime(
                                $rc->mAttribs['rc_timestamp'],
                                $this->getUser()
-                       ) . '</span> <span class="mw-changeslist-separator">. .</span> ';
+                       ) ) . '</span> <span class="mw-changeslist-separator"></span> ';
        }
 
        /**
@@ -560,7 +551,13 @@ class ChangesList extends ContextSource {
                } else {
                        $s .= $this->getLanguage()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'],
                                $rc->mAttribs['rc_user_text'] );
-                       $s .= Linker::userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
+                       $s .= Linker::userToolLinks(
+                               $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'],
+                               false, 0, null,
+                               // The text content of tools is not wrapped with parenthesises or "piped".
+                               // This will be handled in CSS (T205581).
+                               false
+                       );
                }
        }