Merge "Improve docs for Title::getInternalURL/getCanonicalURL"
[lhc/web/wiklou.git] / includes / Linker.php
index 7dc6541..4f0ab6a 100644 (file)
@@ -1001,7 +1001,7 @@ class Linker {
         * @return string
         */
        public static function userToolLinksRedContribs( $userId, $userText, $edits = null ) {
-               return self::userToolLinks( $userId, $userText, true, 0, $edits );
+               return self::userToolLinks( $userId, $userText, true, 0, $edits, false );
        }
 
        /**
@@ -1077,21 +1077,23 @@ class Linker {
         * @since 1.16.3
         * @param Revision $rev
         * @param bool $isPublic Show only if all users can see it
+        * @param bool $useParentheses (optional) Wrap comments in parentheses where needed
         * @return string HTML
         */
-       public static function revUserTools( $rev, $isPublic = false ) {
+       public static function revUserTools( $rev, $isPublic = false, $useParentheses = true ) {
                if ( $rev->isDeleted( Revision::DELETED_USER ) && $isPublic ) {
                        $link = wfMessage( 'rev-deleted-user' )->escaped();
                } elseif ( $rev->userCan( Revision::DELETED_USER ) ) {
                        $userId = $rev->getUser( Revision::FOR_THIS_USER );
                        $userText = $rev->getUserText( Revision::FOR_THIS_USER );
                        $link = self::userLink( $userId, $userText )
-                               . self::userToolLinks( $userId, $userText );
+                               . self::userToolLinks( $userId, $userText, false, 0, null,
+                                       $useParentheses );
                } else {
                        $link = wfMessage( 'rev-deleted-user' )->escaped();
                }
                if ( $rev->isDeleted( Revision::DELETED_USER ) ) {
-                       return ' <span class="history-deleted">' . $link . '</span>';
+                       return ' <span class="history-deleted mw-userlink">' . $link . '</span>';
                }
                return $link;
        }
@@ -1517,7 +1519,7 @@ class Linker {
                        $block = " <span class=\"comment\">" . wfMessage( 'rev-deleted-comment' )->escaped() . "</span>";
                }
                if ( $rev->isDeleted( Revision::DELETED_COMMENT ) ) {
-                       return " <span class=\"history-deleted\">$block</span>";
+                       return " <span class=\"history-deleted comment\">$block</span>";
                }
                return $block;
        }
@@ -1532,9 +1534,8 @@ class Linker {
                        $stxt = wfMessage( 'historyempty' )->escaped();
                } else {
                        $stxt = wfMessage( 'nbytes' )->numParams( $size )->escaped();
-                       $stxt = wfMessage( 'parentheses' )->rawParams( $stxt )->escaped();
                }
-               return "<span class=\"history-size\">$stxt</span>";
+               return "<span class=\"history-size mw-diff-bytes\">$stxt</span>";
        }
 
        /**
@@ -1710,12 +1711,8 @@ class Linker {
        static function splitTrail( $trail ) {
                $regex = MediaWikiServices::getInstance()->getContentLanguage()->linkTrail();
                $inside = '';
-               if ( $trail !== '' ) {
-                       $m = [];
-                       if ( preg_match( $regex, $trail, $m ) ) {
-                               $inside = $m[1];
-                               $trail = $m[2];
-                       }
+               if ( $trail !== '' && preg_match( $regex, $trail, $m ) ) {
+                       list( , $inside, $trail ) = $m;
                }
                return [ $inside, $trail ];
        }
@@ -1768,15 +1765,7 @@ class Linker {
                        $inner = $context->msg( 'brackets' )->rawParams( $inner )->escaped();
                }
 
-               /**
-                * FIXME
-                * Remove all references to DisableRollbackConfirmationFeature
-                * after release of rollback feature. See T199534
-                */
-               if ( !MediaWikiServices::getInstance()
-                               ->getMainConfig()->get( 'DisableRollbackConfirmationFeature' ) &&
-                        $context->getUser()->getBoolOption( 'showrollbackconfirmation' )
-               ) {
+               if ( $context->getUser()->getBoolOption( 'showrollbackconfirmation' ) ) {
                        $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
                        $stats->increment( 'rollbackconfirmation.event.load' );
                        $context->getOutput()->addModules( 'mediawiki.page.rollback.confirmation' );
@@ -1884,8 +1873,7 @@ class Linker {
 
                $attrs = [
                        'data-mw' => 'interface',
-                       'title' => $context->msg( 'tooltip-rollback' )->text(),
-                       'data-rollback-count' => (int)$editCount
+                       'title' => $context->msg( 'tooltip-rollback' )->text()
                ];
 
                $options = [ 'known', 'noclasses' ];