r37659 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r37658‎ | r37659 | r37660 >
Date:19:10, 14 July 2008
Author:nikerabbit
Status:old
Tags:
Comment:
* Cleanup for r37375. Split duplicated code into function and really fix it
Modified paths:
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/PageHistory.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialMergeHistory.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialProtectedpages.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRevisiondelete.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUndelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Linker.php
@@ -1211,6 +1211,17 @@
12121212 return $block;
12131213 }
12141214
 1215+ public function formatRevisionSize( $size ) {
 1216+ if ( $size == 0 ) {
 1217+ $stxt = wfMsgExt( 'historyempty', 'parsemag' );
 1218+ } else {
 1219+ $stxt = wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $size ) );
 1220+ $stxt = "($stxt)";
 1221+ }
 1222+ $stxt = htmlspecialchars( $stxt );
 1223+ return "<span class=\"history-size\">$stxt</span>";
 1224+ }
 1225+
12151226 /** @todo document */
12161227 function tocIndent() {
12171228 return "\n<ul>";
Index: trunk/phase3/includes/specials/SpecialUndelete.php
@@ -1086,12 +1086,7 @@
10871087 $userLink = $sk->revUserTools( $rev );
10881088
10891089 if(!is_null($size = $row->ar_len)) {
1090 - if($size == 0) {
1091 - $stxt = wfMsg('historyempty');
1092 - } else {
1093 - $stxt = '(' . wfMsg('nbytes', $wgLang->formatNum( $size ) ) . ')';
1094 - }
1095 - $stxt = htmlspecialchars( $stxt );
 1090+ $stxt = $sk->formatRevisionSize( $size );
10961091 }
10971092 $comment = $sk->revComment( $rev );
10981093 $revdlink = '';
Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php
@@ -595,7 +595,7 @@
596596 $data = wfMsg( 'widthheight',
597597 $wgLang->formatNum( $file->getWidth() ),
598598 $wgLang->formatNum( $file->getHeight() ) ) .
599 - ' (' . wfMsg( 'nbytes', $wgLang->formatNum( $file->getSize() ) ) . ')';
 599+ ' (' . wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $file->getSize() ) ) . ')';
600600 $data = htmlspecialchars( $data );
601601
602602 return "<li>$pageLink ".$this->fileUserTools( $file )." $data ".$this->fileComment( $file )."$del</li>";
@@ -622,7 +622,7 @@
623623 $data = wfMsg( 'widthheight',
624624 $wgLang->formatNum( $file->getWidth() ),
625625 $wgLang->formatNum( $file->getHeight() ) ) .
626 - ' (' . wfMsg( 'nbytes', $wgLang->formatNum( $file->getSize() ) ) . ')';
 626+ ' (' . wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $file->getSize() ) ) . ')';
627627 $data = htmlspecialchars( $data );
628628
629629 return "<li> $pageLink ".$this->fileUserTools( $file )." $data ".$this->fileComment( $file )."$del</li>";
Index: trunk/phase3/includes/specials/SpecialProtectedpages.php
@@ -89,14 +89,7 @@
9090 }
9191
9292 if (!is_null($size = $row->page_len)) {
93 - if ($size == 0) {
94 - $stxt = wfMsg('historyempty');
95 - } else {
96 - $stxt = wfMsg('nbytes', $wgLang->formatNum( $size ) );
97 - $stxt = "($stxt)";
98 - }
99 - $stxt = htmlspecialchars( $stxt );
100 - $stxt = $wgContLang->getDirMark() . ' ' . $stxt;
 93+ $stxt = $wgContLang->getDirMark() . ' ' . $skin->formatRevisionSize( $size );
10194 }
10295
10396 # Show a link to the change protection form for allowed users otherwise a link to the protection log
Index: trunk/phase3/includes/specials/SpecialMergeHistory.php
@@ -247,13 +247,7 @@
248248 $userLink = $this->sk->revUserTools( $rev );
249249
250250 if(!is_null($size = $row->rev_len)) {
251 - if($size == 0) {
252 - $stxt = wfMsg('historyempty');
253 - } else {
254 - $stxt = wfMsg('nbytes', $wgLang->formatNum( $size ) );
255 - $stxt = "($stxt)";
256 - }
257 - $stxt = htmlspecialchars( $stxt );
 251+ $stxt = $this->sk->formatRevisionSize( $size );
258252 }
259253 $comment = $this->sk->revComment( $rev );
260254
Index: trunk/phase3/includes/PageHistory.php
@@ -245,14 +245,7 @@
246246 }
247247
248248 if ( !is_null( $size = $rev->getSize() ) && $rev->userCan( Revision::DELETED_TEXT ) ) {
249 - if ( $size == 0 ) {
250 - $stxt = wfMsg( 'historyempty' );
251 - } else {
252 - $stxt = wfMsg( 'nbytes', $wgLang->formatNum( $size ) );
253 - $stxt = "($stxt)";
254 - }
255 - $stxt = htmlspecialchars( $stxt );
256 - $s .= " <span class=\"history-size\">$stxt</span>";
 249+ $s .= ' ' . $this->mSkin->formatRevisionSize( $size );
257250 }
258251
259252 $s .= $this->mSkin->revComment( $rev, false, true );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r37375* Fix some misuse of message functions...nikerabbit09:10, 9 July 2008

Status & tagging log