Another artefact of the disable account merge
[lhc/web/wiklou.git] / includes / ChangesList.php
index f25e1da..eade6cb 100644 (file)
@@ -216,9 +216,11 @@ class ChangesList extends ContextSource {
                        $formattedSizeClass = 'mw-plusminus-neg';
                }
 
+               $formattedTotalSize = wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $new ) );
+
                return Html::element( $tag,
-                       array( 'dir' => 'ltr', 'class' => $formattedSizeClass ),
-                       "($formattedSize)" ) . $wgLang->getDirMark();
+                       array( 'dir' => 'ltr', 'class' => $formattedSizeClass, 'title' => $formattedTotalSize ),
+                       wfMessage( 'parentheses', $formattedSize )->plain() ) . $wgLang->getDirMark();
        }
 
        /**
@@ -235,7 +237,7 @@ class ChangesList extends ContextSource {
 
        public function insertDateHeader( &$s, $rc_timestamp ) {
                # Make date header if necessary
-               $date = $this->getLang()->date( $rc_timestamp, true, true );
+               $date = $this->getLanguage()->date( $rc_timestamp, true, true );
                if( $date != $this->lastdate ) {
                        if( $this->lastdate != '' ) {
                                $s .= "</ul>\n";
@@ -326,7 +328,7 @@ class ChangesList extends ContextSource {
                        $articlelink = "<strong class=\"mw-watched\">{$articlelink}</strong>";
                }
                # RTL/LTR marker
-               $articlelink .= $this->getLang()->getDirMark();
+               $articlelink .= $this->getLanguage()->getDirMark();
 
                wfRunHooks( 'ChangesListInsertArticleLink',
                        array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched) );
@@ -341,7 +343,7 @@ class ChangesList extends ContextSource {
         */
        public function insertTimestamp( &$s, $rc ) {
                $s .= $this->message['semicolon-separator'] .
-                       $this->getLang()->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
+                       $this->getLanguage()->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
        }
 
        /** Insert links to user page, user talk page and eventually a blocking link
@@ -352,7 +354,7 @@ class ChangesList extends ContextSource {
                if( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
                        $s .= ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
                } else {
-                       $s .= $this->getLang()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
+                       $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'] );
                }
        }
@@ -364,7 +366,7 @@ class ChangesList extends ContextSource {
        public function insertLogEntry( $rc ) {
                $formatter = LogFormatter::newFromRow( $rc->mAttribs );
                $formatter->setShowUserToolLinks( true );
-               $mark = $this->getLang()->getDirMark();
+               $mark = $this->getLanguage()->getDirMark();
                return $formatter->getActionText() . " $mark" . $formatter->getComment();
        }
 
@@ -399,7 +401,7 @@ class ChangesList extends ContextSource {
                if( $count > 0 ) {
                        if( !isset( $cache[$count] ) ) {
                                $cache[$count] = wfMsgExt( 'number_of_watching_users_RCview',
-                                       array('parsemag', 'escape' ), $this->getLang()->formatNum( $count ) );
+                                       array('parsemag', 'escape' ), $this->getLanguage()->formatNum( $count ) );
                        }
                        return $cache[$count];
                } else {
@@ -483,6 +485,18 @@ class ChangesList extends ContextSource {
        public function insertExtra( &$s, &$rc, &$classes ) {
                ## Empty, used for subclassers to add anything special.
        }
+
+       protected function showAsUnpatrolled( RecentChange $rc ) {
+               $unpatrolled = false;
+               if ( !$rc->mAttribs['rc_patrolled'] ) {
+                       if ( $this->getUser()->useRCPatrol() ) {
+                               $unpatrolled = true;
+                       } elseif ( $this->getUser()->useNPPatrol() && $rc->mAttribs['rc_new'] ) {
+                               $unpatrolled = true;
+                       }
+               }
+               return $unpatrolled;
+       }
 }
 
 
@@ -498,8 +512,9 @@ class OldChangesList extends ChangesList {
        public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
                global $wgRCShowChangedSize;
                wfProfileIn( __METHOD__ );
+
                # Should patrol-related stuff be shown?
-               $unpatrolled = $this->getUser()->useRCPatrol() && !$rc->mAttribs['rc_patrolled'];
+               $unpatrolled = $this->showAsUnpatrolled( $rc );
 
                $dateheader = ''; // $s now contains only <li>...</li>, for hooks' convenience.
                $this->insertDateHeader( $dateheader, $rc->mAttribs['rc_timestamp'] );
@@ -559,7 +574,7 @@ class OldChangesList extends ChangesList {
                        # User tool links
                        $this->insertUserRelatedLinks( $s, $rc );
                        # LTR/RTL direction mark
-                       $s .= $this->getLang()->getDirMark();
+                       $s .= $this->getLanguage()->getDirMark();
                        $s .= $this->insertComment( $rc );
                }
 
@@ -573,7 +588,7 @@ class OldChangesList extends ChangesList {
                # How many users watch this page
                if( $rc->numberofWatchingusers > 0 ) {
                        $s .= ' ' . wfMsgExt( 'number_of_watching_users_RCview',
-                               array( 'parsemag', 'escape' ), $this->getLang()->formatNum( $rc->numberofWatchingusers ) );
+                               array( 'parsemag', 'escape' ), $this->getLanguage()->formatNum( $rc->numberofWatchingusers ) );
                }
 
                if( $this->watchlist ) {
@@ -622,7 +637,7 @@ class EnhancedChangesList extends ChangesList {
                $curIdEq = array( 'curid' => $rc->mAttribs['rc_cur_id'] );
 
                # If it's a new day, add the headline and flush the cache
-               $date = $this->getLang()->date( $rc->mAttribs['rc_timestamp'], true );
+               $date = $this->getLanguage()->date( $rc->mAttribs['rc_timestamp'], true );
                $ret = '';
                if( $date != $this->lastdate ) {
                        # Process current cache
@@ -633,11 +648,7 @@ class EnhancedChangesList extends ChangesList {
                }
 
                # Should patrol-related stuff be shown?
-               if( $this->getUser()->useRCPatrol() ) {
-                       $rc->unpatrolled = !$rc->mAttribs['rc_patrolled'];
-               } else {
-                       $rc->unpatrolled = false;
-               }
+               $rc->unpatrolled = $this->showAsUnpatrolled( $rc );
 
                $showdifflinks = true;
                # Make article link
@@ -680,7 +691,7 @@ class EnhancedChangesList extends ChangesList {
                        $showdifflinks = false;
                }
 
-               $time = $this->getLang()->time( $rc->mAttribs['rc_timestamp'], true, true );
+               $time = $this->getLanguage()->time( $rc->mAttribs['rc_timestamp'], true, true );
                $rc->watched = $watched;
                $rc->link = $clink;
                $rc->timestamp = $time;
@@ -706,13 +717,13 @@ class EnhancedChangesList extends ChangesList {
                        if ( $type != RC_NEW ) {
                                $curLink = $this->message['cur'];
                        } else {
-                               $curUrl = htmlspecialchars( $rc->getTitle()->getLinkUrl( $querycur ) );
+                               $curUrl = htmlspecialchars( $rc->getTitle()->getLinkURL( $querycur ) );
                                $curLink = "<a href=\"$curUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['cur']}</a>";
                        }
                        $diffLink = $this->message['diff'];
                } else {
-                       $diffUrl = htmlspecialchars( $rc->getTitle()->getLinkUrl( $querydiff ) );
-                       $curUrl = htmlspecialchars( $rc->getTitle()->getLinkUrl( $querycur ) );
+                       $diffUrl = htmlspecialchars( $rc->getTitle()->getLinkURL( $querydiff ) );
+                       $curUrl = htmlspecialchars( $rc->getTitle()->getLinkURL( $querycur ) );
                        $diffLink = "<a href=\"$diffUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['diff']}</a>";
                        $curLink = "<a href=\"$curUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['cur']}</a>";
                }
@@ -829,9 +840,9 @@ class EnhancedChangesList extends ChangesList {
                $users = array();
                foreach( $userlinks as $userlink => $count) {
                        $text = $userlink;
-                       $text .= $this->getLang()->getDirMark();
+                       $text .= $this->getLanguage()->getDirMark();
                        if( $count > 1 ) {
-                               $text .= ' (' . $this->getLang()->formatNum( $count ) . '×)';
+                               $text .= ' (' . $this->getLanguage()->formatNum( $count ) . '×)';
                        }
                        array_push( $users, $text );
                }
@@ -871,14 +882,14 @@ class EnhancedChangesList extends ChangesList {
                        $this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched );
                }
 
-               $r .= $this->getLang()->getDirMark();
+               $r .= $this->getLanguage()->getDirMark();
 
                $queryParams['curid'] = $curId;
                # Changes message
                $n = count($block);
                static $nchanges = array();
                if ( !isset( $nchanges[$n] ) ) {
-                       $nchanges[$n] = wfMsgExt( 'nchanges', array( 'parsemag', 'escape' ), $this->getLang()->formatNum( $n ) );
+                       $nchanges[$n] = wfMsgExt( 'nchanges', array( 'parsemag', 'escape' ), $this->getLanguage()->formatNum( $n ) );
                }
                # Total change link
                $r .= ' ';