r45980 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45979‎ | r45980 | r45981 >
Date:21:38, 21 January 2009
Author:werdna
Status:deferred
Tags:
Comment:
Code style: use arrays, instead of by-ref parameters for out-parameters.
Modified paths:
  • /branches/change-tagging/phase3/includes/ChangeTags.php (modified) (history)
  • /branches/change-tagging/phase3/includes/ChangesList.php (modified) (history)
  • /branches/change-tagging/phase3/includes/LogEventsList.php (modified) (history)
  • /branches/change-tagging/phase3/includes/PageHistory.php (modified) (history)
  • /branches/change-tagging/phase3/includes/specials/SpecialContributions.php (modified) (history)
  • /branches/change-tagging/phase3/includes/specials/SpecialNewpages.php (modified) (history)

Diff [purge]

Index: branches/change-tagging/phase3/includes/ChangeTags.php
@@ -4,9 +4,11 @@
55 die;
66
77 class ChangeTags {
8 - static function formatSummaryRow( $tags, $page, &$classes ) {
 8+ static function formatSummaryRow( $tags, $page ) {
99 if (!$tags)
10 - return '';
 10+ return array('',array());
 11+
 12+ $classes = array();
1113
1214 $tags = explode( ',', $tags );
1315 $displayTags = array();
@@ -19,7 +21,7 @@
2022 $classes[] = "mw-tag-$tag";
2123 }
2224
23 - return '(' . implode( ', ', $displayTags ) . ')';
 25+ return array( '(' . implode( ', ', $displayTags ) . ')', $classes );
2426 }
2527
2628 ## Basic utility method to add tags to a particular change, given its rc_id, rev_id and/or log_id.
Index: branches/change-tagging/phase3/includes/LogEventsList.php
@@ -360,7 +360,8 @@
361361 }
362362
363363 // Any tags...
364 - $tagDisplay = ChangeTags::formatSummaryRow( $row->ts_tags, 'logevent', &$classes );
 364+ list($tagDisplay, $newClasses) = ChangeTags::formatSummaryRow( $row->ts_tags, 'logevent' );
 365+ $classes = array_merge( $classes, $newClasses );
365366
366367 if( $revert != '' ) {
367368 $revert = '<span class="mw-logevent-actionlink">' . $revert . '</span>';
Index: branches/change-tagging/phase3/includes/ChangesList.php
@@ -386,7 +386,9 @@
387387 }
388388
389389 # Tags, if any.
390 - $s .= ' ' . ChangeTags::formatSummaryRow( $rc->mAttribs['ts_tags'], 'changeslist', &$classes);
 390+ list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $rc->mAttribs['ts_tags'], 'changeslist' );
 391+ $classes = array_merge( $classes, $newClasses );
 392+ $s .= ' ' . $tagSummary;
391393
392394 ## Classes
393395 $classes = implode( ' ', $classes );
Index: branches/change-tagging/phase3/includes/specials/SpecialNewpages.php
@@ -266,7 +266,8 @@
267267 $classes[] = 'not-patrolled';
268268
269269 # Tags, if any.
270 - $tagDisplay = ChangeTags::formatSummaryRow( $result->ts_tags, 'newpages', &$classes );
 270+ list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow( $result->ts_tags, 'newpages' );
 271+ $classes = array_merge( $classes, $newClasses );
271272
272273 $css = count($classes) ? ' class="'.implode( " ", $classes).'"' : '';
273274
Index: branches/change-tagging/phase3/includes/specials/SpecialContributions.php
@@ -530,7 +530,9 @@
531531 }
532532
533533 # Tags, if any.
534 - $ret .= ' ' . ChangeTags::formatSummaryRow( $row->ts_tags, 'contributions', &$classes );
 534+ list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $row->ts_tags, 'contributions' );
 535+ $classes = array_merge( $classes, $newClasses );
 536+ $ret .= " $tagSummary";
535537
536538 // Let extensions add data
537539 wfRunHooks( 'ContributionsLineEnding', array( &$this, &$ret, $row ) );
Index: branches/change-tagging/phase3/includes/PageHistory.php
@@ -363,7 +363,9 @@
364364 }
365365
366366 # Tags
367 - $s .= ' ' . ChangeTags::formatSummaryRow( $row->ts_tags, 'history', &$classes );
 367+ list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $row->ts_tags, 'history' );
 368+ $classes = array_merge( $classes, $newClasses );
 369+ $s .= " $tagSummary";
368370
369371 wfRunHooks( 'PageHistoryLineEnding', array( $this, &$row , &$s ) );
370372

Status & tagging log