* Cleanup for r37375. Split duplicated code into function and really fix it
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Mon, 14 Jul 2008 19:10:47 +0000 (19:10 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Mon, 14 Jul 2008 19:10:47 +0000 (19:10 +0000)
includes/Linker.php
includes/PageHistory.php
includes/specials/SpecialMergeHistory.php
includes/specials/SpecialProtectedpages.php
includes/specials/SpecialRevisiondelete.php
includes/specials/SpecialUndelete.php

index 7af49ad..7dfb60d 100644 (file)
@@ -1211,6 +1211,17 @@ class Linker {
                return $block;
        }
 
+       public function formatRevisionSize( $size ) {
+               if ( $size == 0 ) {
+                       $stxt = wfMsgExt( 'historyempty', 'parsemag' );
+               } else {
+                       $stxt = wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $size ) );
+                       $stxt = "($stxt)";
+               }
+               $stxt = htmlspecialchars( $stxt );
+               return "<span class=\"history-size\">$stxt</span>";
+       }
+
        /** @todo document */
        function tocIndent() {
                return "\n<ul>";
index 0819441..6d8a7c2 100644 (file)
@@ -245,14 +245,7 @@ class PageHistory {
                }
 
                if ( !is_null( $size = $rev->getSize() ) && $rev->userCan( Revision::DELETED_TEXT ) ) {
-                       if ( $size == 0 ) {
-                               $stxt = wfMsg( 'historyempty' );
-                       } else {
-                               $stxt = wfMsg( 'nbytes', $wgLang->formatNum( $size ) );
-                               $stxt = "($stxt)";
-                       }
-                       $stxt = htmlspecialchars( $stxt );
-                       $s .= " <span class=\"history-size\">$stxt</span>";
+                       $s .= ' ' . $this->mSkin->formatRevisionSize( $size );
                }
 
                $s .= $this->mSkin->revComment( $rev, false, true );
index 12b3d1f..0460c20 100644 (file)
@@ -247,13 +247,7 @@ class MergehistoryForm {
                $userLink = $this->sk->revUserTools( $rev );
 
                if(!is_null($size = $row->rev_len)) {
-                       if($size == 0) {
-                               $stxt = wfMsg('historyempty');
-                       } else {
-                               $stxt = wfMsg('nbytes', $wgLang->formatNum( $size ) );
-                               $stxt = "($stxt)";
-                       }
-                       $stxt = htmlspecialchars( $stxt );
+                       $stxt = $this->sk->formatRevisionSize( $size );
                }
                $comment = $this->sk->revComment( $rev );
 
index 6524324..3025c05 100644 (file)
@@ -89,14 +89,7 @@ class ProtectedPagesForm {
                }
 
                if (!is_null($size = $row->page_len)) {
-                       if ($size == 0) {
-                               $stxt = wfMsg('historyempty');
-                       } else {
-                               $stxt = wfMsg('nbytes', $wgLang->formatNum( $size ) );
-                               $stxt = "($stxt)";
-                       }
-                       $stxt = htmlspecialchars( $stxt );
-                       $stxt = $wgContLang->getDirMark() . ' ' . $stxt;
+                       $stxt = $wgContLang->getDirMark() . ' ' . $skin->formatRevisionSize( $size );
                }
 
                # Show a link to the change protection form for allowed users otherwise a link to the protection log
index 9d2dcaa..e94fc22 100644 (file)
@@ -595,7 +595,7 @@ class RevisionDeleteForm {
                $data = wfMsg( 'widthheight',
                                        $wgLang->formatNum( $file->getWidth() ),
                                        $wgLang->formatNum( $file->getHeight() ) ) .
-                       ' (' . wfMsg( 'nbytes', $wgLang->formatNum( $file->getSize() ) ) . ')';
+                       ' (' . wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $file->getSize() ) ) . ')';
                $data = htmlspecialchars( $data );
 
                return "<li>$pageLink ".$this->fileUserTools( $file )." $data ".$this->fileComment( $file )."$del</li>";
@@ -622,7 +622,7 @@ class RevisionDeleteForm {
                $data = wfMsg( 'widthheight',
                                        $wgLang->formatNum( $file->getWidth() ),
                                        $wgLang->formatNum( $file->getHeight() ) ) .
-                       ' (' . wfMsg( 'nbytes', $wgLang->formatNum( $file->getSize() ) ) . ')';
+                       ' (' . wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $file->getSize() ) ) . ')';
                $data = htmlspecialchars( $data );
 
                return "<li> $pageLink ".$this->fileUserTools( $file )." $data ".$this->fileComment( $file )."$del</li>";
index 805f451..fbbf89d 100644 (file)
@@ -1086,12 +1086,7 @@ class UndeleteForm {
                $userLink = $sk->revUserTools( $rev );
 
                if(!is_null($size = $row->ar_len)) {
-                       if($size == 0) {
-                               $stxt = wfMsg('historyempty');
-                       } else {
-                               $stxt = '(' . wfMsg('nbytes', $wgLang->formatNum( $size ) ) . ')';
-                       }
-                       $stxt = htmlspecialchars( $stxt );
+                       $stxt = $sk->formatRevisionSize( $size );
                }
                $comment = $sk->revComment( $rev );
                $revdlink = '';