r7516 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r7515‎ | r7516 | r7517 >
Date:06:04, 22 February 2005
Author:vibber
Status:old
Tags:
Comment:
War on cruft: commentBlock() usage, use a styled <span> for comments instead of mix of <em> and <i>
Remove some unused functions in contribs
Modified paths:
  • /trunk/phase3/includes/ChangesList.php (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/PageHistory.php (modified) (history)
  • /trunk/phase3/includes/SpecialContributions.php (modified) (history)
  • /trunk/phase3/includes/SpecialIpblocklist.php (modified) (history)
  • /trunk/phase3/includes/SpecialLog.php (modified) (history)
  • /trunk/phase3/includes/SpecialNewpages.php (modified) (history)
  • /trunk/phase3/includes/SpecialUndelete.php (modified) (history)
  • /trunk/phase3/includes/SpecialUnusedimages.php (modified) (history)
  • /trunk/phase3/skins/common/common.css (modified) (history)
  • /trunk/phase3/skins/monobook/main.css (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/monobook/main.css
@@ -1077,4 +1077,8 @@
10781078 div.gallerytext {
10791079 font-size: 94%;
10801080 padding: 2px 4px;
1081 -}
\ No newline at end of file
 1081+}
 1082+
 1083+span.comment {
 1084+ font-style: italic;
 1085+}
Index: trunk/phase3/skins/common/common.css
@@ -291,3 +291,6 @@
292292 padding: 2px 4px;
293293 }
294294
 295+span.comment {
 296+ font-style: italic;
 297+}
Index: trunk/phase3/includes/Linker.php
@@ -780,11 +780,11 @@
781781 * @access public
782782 */
783783 function commentBlock( $comment, $title = NULL ) {
784 - if( $comment == '' ) {
 784+ if( $comment == '' || $comment == '*' ) {
785785 return '';
786786 } else {
787787 $formatted = $this->formatComment( $comment, $title );
788 - return " <em>($formatted)</em>";
 788+ return " <span class='comment'>($formatted)</span>";
789789 }
790790 }
791791
Index: trunk/phase3/includes/SpecialContributions.php
@@ -201,9 +201,7 @@
202202 }
203203 $histlink='('.$sk->makeKnownLinkObj( $page, $messages['hist'], 'action=history' ) . ')';
204204
205 - if( $comment ) {
206 - $comment = '<em>(' . $sk->formatComment( $comment, $page ) . ')</em> ';
207 - }
 205+ $comment = $sk->commentBlock( $comment, $page );
208206 $d = $wgLang->timeanddate( $ts, true );
209207
210208 if ($isminor) {
@@ -217,32 +215,6 @@
218216 }
219217
220218 /**
221 - *
222 - */
223 -function ucCountLink( $lim, $d ) {
224 - global $wgUser, $wgContLang, $wgRequest;
225 -
226 - $target = $wgRequest->getText( 'target' );
227 - $sk = $wgUser->getSkin();
228 - $s = $sk->makeKnownLink( $wgContLang->specialPage( "Contributions" ),
229 - "{$lim}", "target={$target}&days={$d}&limit={$lim}" );
230 - return $s;
231 -}
232 -
233 -/**
234 - *
235 - */
236 -function ucDaysLink( $lim, $d ) {
237 - global $wgUser, $wgContLang, $wgRequest;
238 -
239 - $target = $wgRequest->getText( 'target' );
240 - $sk = $wgUser->getSkin();
241 - $s = $sk->makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
242 - "{$d}", "target={$target}&days={$d}&limit={$lim}" );
243 - return $s;
244 -}
245 -
246 -/**
247219 * Generates a form used to restrict display of contributions
248220 * to a specific namespace
249221 *
Index: trunk/phase3/includes/ChangesList.php
@@ -105,9 +105,8 @@
106106 $r .= $rcObj->usertalklink ;
107107
108108 # Comment
109 - if ( $rc_comment != '' && $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
110 - $rc_comment=$this->skin->formatComment($rc_comment, $rcObj->getTitle());
111 - $r .= $wgContLang->emphasize( ' ('.$rc_comment.')' );
 109+ if ( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
 110+ $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
112111 }
113112
114113 if ($rcObj->numberofWatchingusers > 0) {
@@ -263,10 +262,7 @@
264263 $r .= $rcObj->lastlink ;
265264 $r .= ') . . '.$rcObj->userlink ;
266265 $r .= $rcObj->usertalklink ;
267 - if ( $rc_comment != '' ) {
268 - $rc_comment=$this->skin->formatComment($rc_comment, $rcObj->getTitle());
269 - $r .= $wgContLang->emphasize( ' ('.$rc_comment.')' ) ;
270 - }
 266+ $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
271267 $r .= "<br />\n" ;
272268 }
273269 $r .= "</div>\n" ;
@@ -443,9 +439,8 @@
444440 if($userTalkLink) $s.=' ('.$userTalkLink.')';
445441
446442 # Add comment
447 - if ( '' != $rc_comment && '*' != $rc_comment && $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
448 - $rc_comment = $this->skin->formatComment($rc_comment,$rc->getTitle());
449 - $s .= $wgContLang->emphasize(' (' . $rc_comment . ')');
 443+ if ( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
 444+ $s .= $this->skin->commentBlock( $rc_comment, $rc->getTitle() );
450445 }
451446
452447 if ($rc->numberofWatchingusers > 0) {
Index: trunk/phase3/includes/SpecialUndelete.php
@@ -413,8 +413,8 @@
414414 Title::makeTitle( NS_USER, $row->ar_user_text ),
415415 $userLink );
416416 }
417 - $comment = $sk->formatComment( $row->ar_comment );
418 - $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink (<i>$comment</i>)</li>\n" );
 417+ $comment = $sk->commentBlock( $row->ar_comment );
 418+ $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $comment</li>\n" );
419419
420420 }
421421 $revisions->free();
Index: trunk/phase3/includes/SpecialNewpages.php
@@ -61,7 +61,6 @@
6262 $ut = $result->user_text;
6363
6464 $length = wfMsg( "nbytes", $wgLang->formatNum( $result->length ) );
65 - $c = $skin->formatComment($result->comment );
6665
6766 if ( $u == 0 ) { # not by a logged-in user
6867 $ul = $ut;
@@ -83,9 +82,7 @@
8483
8584 $s = "{$d} {$link} ({$length}) . . {$ul}";
8685
87 - if ( "" != $c && "*" != $c ) {
88 - $s .= " <em>({$c})</em>";
89 - }
 86+ $s .= $skin->commentBlock( $result->comment );
9087
9188 return $s;
9289 }
Index: trunk/phase3/includes/SpecialIpblocklist.php
@@ -171,10 +171,7 @@
172172 wfMsg( "unblocklink" ) . "</a>";
173173 $wgOut->addHTML( " ({$ublink})" );
174174 }
175 - if ( "" != $block->mReason ) {
176 - $wgOut->addHTML( " <em>(" . $sk->formatComment( $block->mReason ) .
177 - ")</em>" );
178 - }
 175+ $wgOut->addHTML( $sk->commentBlock( $block->mReason ) );
179176 $wgOut->addHTML( "</li>\n" );
180177 }
181178
Index: trunk/phase3/includes/SpecialLog.php
@@ -257,11 +257,7 @@
258258 $titleLink = $this->skin->makeBrokenLinkObj( $title );
259259 }
260260 $userLink = $this->skin->makeLinkObj( $user, htmlspecialchars( $s->user_name ) );
261 - if( '' === $s->log_comment ) {
262 - $comment = '';
263 - } else {
264 - $comment = '(<em>' . $this->skin->formatComment( $s->log_comment ) . '</em>)';
265 - }
 261+ $comment = $this->skin->commentBlock( $s->log_comment );
266262 $paramArray = LogPage::extractParams( $s->log_params );
267263
268264 $action = LogPage::actionText( $s->log_type, $s->log_action, $titleLink, $paramArray );
Index: trunk/phase3/includes/PageHistory.php
@@ -194,10 +194,7 @@
195195 $s .= $isminor ? ' <span class="minor">'.$message['minoreditletter'].'</span>': '' ;
196196
197197
198 - if ( '' != $c && '*' != $c ) {
199 - $c = $this->mSkin->formatcomment( $c, $this->mTitle );
200 - $s .= " <em>($c)</em>";
201 - }
 198+ $s .= $this->mSkin->commentBlock( $c, $this->mTitle );
202199 if ($notificationtimestamp && ($ts >= $notificationtimestamp)) {
203200 $s .= wfMsg( 'updatedmarker' );
204201 }
Index: trunk/phase3/includes/SpecialUnusedimages.php
@@ -44,12 +44,10 @@
4545 # Last modified date
4646 . ' . . '.$wgLang->timeanddate($result->value)
4747 # Link to username
48 - . ' . . '.$skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text);
49 -
 48+ . ' . . '.$skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text)
5049 # If there is a description, show it
51 - if($result->img_description != '') {
52 - $return .= ' <i>(' . $skin->formatComment( $result->img_description ) . ')</i>';
53 - }
 50+ . $skin->commentBlock( $result->img_description );
 51+
5452 return $return;
5553 }
5654

Status & tagging log