r60737 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60736‎ | r60737 | r60738 >
Date:17:04, 6 January 2010
Author:ashley
Status:deferred
Tags:
Comment:
SocialProfile: some cleanup to UserProfilePage.php
Modified paths:
  • /trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php
@@ -127,13 +127,17 @@
128128 $stats = new UserStats( $user_id, $user_name );
129129 $stats_data = $stats->getUserStats();
130130
131 - $total_value = $stats_data['edits'] . $stats_data['votes'] . $stats_data['comments'] . $stats_data['recruits'] . $stats_data['poll_votes'] . $stats_data['picture_game_votes'] . $stats_data['quiz_points'];
 131+ $total_value = $stats_data['edits'] . $stats_data['votes'] .
 132+ $stats_data['comments'] . $stats_data['recruits'] .
 133+ $stats_data['poll_votes'] .
 134+ $stats_data['picture_game_votes'] .
 135+ $stats_data['quiz_points'];
132136
133137 if ( $total_value != 0 ) {
134138 $output .= '<div class="user-section-heading">
135 - <div class="user-section-title">
136 - ' . wfMsg( 'user-stats-title' ) . '
137 - </div>
 139+ <div class="user-section-title">'
 140+ . wfMsg( 'user-stats-title' ) .
 141+ '</div>
138142 <div class="user-section-actions">
139143 <div class="action-right">
140144 </div>
@@ -151,8 +155,9 @@
152156 $this->getUserStatsRow( wfMsgExt( 'user-stats-poll-votes', 'parsemag', $stats_data['poll_votes'] ), $stats_data['poll_votes'] ) .
153157 $this->getUserStatsRow( wfMsgExt( 'user-stats-picture-game-votes', 'parsemag', $stats_data['picture_game_votes'] ), $stats_data['picture_game_votes'] ) .
154158 $this->getUserStatsRow( wfMsgExt( 'user-stats-quiz-points', 'parsemag', $stats_data['quiz_points'] ), $stats_data['quiz_points'] );
155 - if ( $stats_data['currency'] != '10,000' )
 159+ if ( $stats_data['currency'] != '10,000' ) {
156160 $output .= $this->getUserStatsRow( wfMsgExt( 'user-stats-pick-points', 'parsemag', $stats_data['currency'] ), $stats_data['currency'] );
 161+ }
157162 $output .= '</div>';
158163 }
159164
@@ -219,24 +224,31 @@
220225 $location .= $profile_data['location_country'];
221226 }
222227
223 - if ( $location == ', ' ) $location = '';
 228+ if ( $location == ', ' ) {
 229+ $location = '';
 230+ }
224231
225232 $hometown = $profile_data['hometown_city'] . ', ' . $profile_data['hometown_state'];
226233 if ( $profile_data['hometown_country'] != 'United States' ) {
227234 $hometown = '';
228235 $hometown .= $profile_data['hometown_country'];
229236 }
230 - if ( $hometown == ', ' ) $hometown = '';
 237+ if ( $hometown == ', ' ) {
 238+ $hometown = '';
 239+ }
231240
232 - $joined_data = $profile_data['real_name'] . $location . $hometown . $profile_data['birthday'] . $profile_data['occupation'] . $profile_data['websites'] . $profile_data['places_lived'] . $profile_data['schools'] . $profile_data['about'];
 241+ $joined_data = $profile_data['real_name'] . $location . $hometown .
 242+ $profile_data['birthday'] . $profile_data['occupation'] .
 243+ $profile_data['websites'] . $profile_data['places_lived'] .
 244+ $profile_data['schools'] . $profile_data['about'];
233245 $edit_info_link = SpecialPage::getTitleFor( 'UpdateProfile' );
234246
235247 $output = '';
236248 if ( $joined_data ) {
237249 $output .= '<div class="user-section-heading">
238 - <div class="user-section-title">
239 - ' . wfMsg( 'user-personal-info-title' ) . '
240 - </div>
 250+ <div class="user-section-title">'
 251+ . wfMsg( 'user-personal-info-title' ) .
 252+ '</div>
241253 <div class="user-section-actions">
242254 <div class="action-right">';
243255 if ( $wgUser->getName() == $user_name ) {
@@ -260,9 +272,9 @@
261273 '</div>';
262274 } elseif ( $wgUser->getName() == $user_name ) {
263275 $output .= '<div class="user-section-heading">
264 - <div class="user-section-title">
265 - ' . wfMsg( 'user-personal-info-title' ) . '
266 - </div>
 276+ <div class="user-section-title">'
 277+ . wfMsg( 'user-personal-info-title' ) .
 278+ '</div>
267279 <div class="user-section-actions">
268280 <div class="action-right">
269281 <a href="' . $edit_info_link->escapeFullURL() . '">'
@@ -273,9 +285,9 @@
274286 </div>
275287 </div>
276288 <div class="cleared"></div>
277 - <div class="no-info-container">
278 - ' . wfMsg( 'user-no-personal-info' ) . '
279 - </div>';
 289+ <div class="no-info-container">'
 290+ . wfMsg( 'user-no-personal-info' ) .
 291+ '</div>';
280292 }
281293
282294 return $output;
@@ -294,15 +306,16 @@
295307 }
296308 $profile_data = $this->profile_data;
297309
298 - $joined_data = $profile_data['custom_1'] . $profile_data['custom_2'] . $profile_data['custom_3'] . $profile_data['custom_4'];
 310+ $joined_data = $profile_data['custom_1'] . $profile_data['custom_2'] .
 311+ $profile_data['custom_3'] . $profile_data['custom_4'];
299312 $edit_info_link = SpecialPage::getTitleFor( 'UpdateProfile' );
300313
301314 $output = '';
302315 if ( $joined_data ) {
303316 $output .= '<div class="user-section-heading">
304 - <div class="user-section-title">
305 - ' . wfMsg( 'custom-info-title' ) . '
306 - </div>
 317+ <div class="user-section-title">'
 318+ . wfMsg( 'custom-info-title' ) .
 319+ '</div>
307320 <div class="user-section-actions">
308321 <div class="action-right">';
309322 if ( $wgUser->getName() == $user_name ) {
@@ -321,22 +334,22 @@
322335 '</div>';
323336 } elseif ( $wgUser->getName() == $user_name ) {
324337 $output .= '<div class="user-section-heading">
325 - <div class="user-section-title">
326 - ' . wfMsg( 'custom-info-title' ) . '
327 - </div>
 338+ <div class="user-section-title">'
 339+ . wfMsg( 'custom-info-title' ) .
 340+ '</div>
328341 <div class="user-section-actions">
329342 <div class="action-right">
330 - <a href="' . $edit_info_link->escapeFullURL() . '/custom">
331 - ' . wfMsg( 'user-edit-this' ) . '
332 - </a>
 343+ <a href="' . $edit_info_link->escapeFullURL() . '/custom">'
 344+ . wfMsg( 'user-edit-this' ) .
 345+ '</a>
333346 </div>
334347 <div class="cleared"></div>
335348 </div>
336349 </div>
337350 <div class="cleared"></div>
338 - <div class="no-info-container">
339 - ' . wfMsg( 'custom-no-info' ) . '
340 - </div>';
 351+ <div class="no-info-container">'
 352+ . wfMsg( 'custom-no-info' ) .
 353+ '</div>';
341354 }
342355
343356 return $output;
@@ -357,16 +370,20 @@
358371 $this->profile_data = $profile->getProfile();
359372 }
360373 $profile_data = $this->profile_data;
361 - $joined_data = $profile_data['movies'] . $profile_data['tv'] . $profile_data['music'] . $profile_data['books'] . $profile_data['video_games'] . $profile_data['magazines'] . $profile_data['drinks'] . $profile_data['snacks'];
 374+ $joined_data = $profile_data['movies'] . $profile_data['tv'] .
 375+ $profile_data['music'] . $profile_data['books'] .
 376+ $profile_data['video_games'] .
 377+ $profile_data['magazines'] . $profile_data['drinks'] .
 378+ $profile_data['snacks'];
362379 $edit_info_link = SpecialPage::getTitleFor( 'UpdateProfile' );
363380
364381 $output = '';
365382 if ( $joined_data ) {
366383
367384 $output .= '<div class="user-section-heading">
368 - <div class="user-section-title">
369 - ' . wfMsg( 'other-info-title' ) . '
370 - </div>
 385+ <div class="user-section-title">'
 386+ . wfMsg( 'other-info-title' ) .
 387+ '</div>
371388 <div class="user-section-actions">
372389 <div class="action-right">';
373390 if ( $wgUser->getName() == $user_name ) {
@@ -390,9 +407,9 @@
391408
392409 } elseif ( $wgUser->getName() == $user_name ) {
393410 $output .= '<div class="user-section-heading">
394 - <div class="user-section-title">
395 - ' . wfMsg( 'other-info-title' ) . '
396 - </div>
 411+ <div class="user-section-title">'
 412+ . wfMsg( 'other-info-title' ) .
 413+ '</div>
397414 <div class="user-section-actions">
398415 <div class="action-right">
399416 <a href="' . $edit_info_link->escapeFullURL() . '/personal">' . wfMsg( 'user-edit-this' ) . '</a>
@@ -401,9 +418,9 @@
402419 </div>
403420 </div>
404421 <div class="cleared"></div>
405 - <div class="no-info-container">
406 - ' . wfMsg( 'other-no-info' ) . '
407 - </div>';
 422+ <div class="no-info-container">'
 423+ . wfMsg( 'other-no-info' ) .
 424+ '</div>';
408425 }
409426 return $output;
410427 }
@@ -644,13 +661,17 @@
645662
646663 // Chop down username that gets displayed
647664 $user_name = mb_substr( $friend['user_name'], 0, 9 );
648 - if ( $user_name != $friend['user_name'] ) $user_name .= '..';
 665+ if ( $user_name != $friend['user_name'] ) {
 666+ $user_name .= '..';
 667+ }
649668
650669 $output .= "<a href=\"" . $user->escapeFullURL() . "\" title=\"{$friend["user_name"]}\" rel=\"nofollow\">
651670 {$avatar_img}<br />
652671 {$user_name}
653672 </a>";
654 - if ( $x == count( $friends ) || $x != 1 && $x % $per_row == 0 ) $output .= '<div class="cleared"></div>';
 673+ if ( $x == count( $friends ) || $x != 1 && $x % $per_row == 0 ) {
 674+ $output .= '<div class="cleared"></div>';
 675+ }
655676 $x++;
656677 }
657678 $output .= '</div>';
@@ -686,9 +707,9 @@
687708
688709 if ( $activity ) {
689710 $output .= '<div class="user-section-heading">
690 - <div class="user-section-title">
691 - ' . wfMsg( 'user-recent-activity-title' ) . '
692 - </div>
 711+ <div class="user-section-title">'
 712+ . wfMsg( 'user-recent-activity-title' ) .
 713+ '</div>
693714 <div class="user-section-actions">
694715 <div class="action-right">
695716 </div>
@@ -711,12 +732,14 @@
712733 $user_title = Title::makeTitle( NS_USER, $item['username'] );
713734 $user_title_2 = Title::makeTitle( NS_USER, $item['comment'] );
714735
715 - if ( $user_title_2 )
 736+ if ( $user_title_2 ) {
716737 $user_link_2 = '<a href="' . $user_title_2->escapeFullURL() . '" rel="nofollow">' . $item['comment'] . '</a>';
 738+ }
717739
718740 $comment_url = '';
719 - if ( $item['type'] == 'comment' )
 741+ if ( $item['type'] == 'comment' ) {
720742 $comment_url = "#comment-{$item["id"]}";
 743+ }
721744
722745 $page_link = '<b><a href="' . $title->escapeFullURL() . "{$comment_url}\">" . $title->getPrefixedText() . '</a></b> ';
723746 $b = new UserBoard(); // Easier than porting the time-related functions here
@@ -792,14 +815,6 @@
793816 \"{$item["namespace"]}\"
794817 </div>";
795818 break;
796 - /*case 'network_update':
797 - $page_link = '' . $item['network'] . '</a> ';
798 - $network_image = SportsTeams::getLogo( $item['sport_id'], $item['team_id'], 's' );
799 - $item_html .= wfMsg( 'user-recent-activity-network-update' ) . '
800 - <div class="item">
801 - <a href="' . SportsTeams::getNetworkURL( $item['sport_id'], $item['team_id'] ) . "\" rel=\"nofollow\">{$network_image} \"{$item["comment"]}\"</a>
802 - </div>";
803 - break;*/
804819 }
805820
806821 $item_html .= '</div>';
@@ -874,13 +889,6 @@
875890 }
876891 }
877892
878 - /*$by_type = '';
879 - if( isset( $items_html_type['network_update'] ) && is_array( $items_html_type['network_update'] ) ) {
880 - foreach( $items_html_type['network_update'] as $item ){
881 - $by_type .= $item;
882 - }
883 - }*/
884 -
885893 }
886894
887895 return $output;
@@ -921,16 +929,15 @@
922930 $per_row = 4;
923931
924932 if ( $gifts ) {
925 -
926933 $output .= '<div class="user-section-heading">
927934 <div class="user-section-title">
928935 ' . wfMsg( 'user-gifts-title' ) . '
929936 </div>
930937 <div class="user-section-actions">
931938 <div class="action-right">';
932 - if ( $gift_count > 4 ) {
933 - $output .= '<a href="' . $gift_link->escapeFullURL( 'user=' . $user_safe ) . '" rel="nofollow">' . wfMsg( 'user-view-all' ) . '</a>';
934 - }
 939+ if ( $gift_count > 4 ) {
 940+ $output .= '<a href="' . $gift_link->escapeFullURL( 'user=' . $user_safe ) . '" rel="nofollow">' . wfMsg( 'user-view-all' ) . '</a>';
 941+ }
935942 $output .= '</div>
936943 <div class="action-left">';
937944 if ( $gift_count > 4 ) {
@@ -948,7 +955,6 @@
949956 $x = 1;
950957
951958 foreach ( $gifts as $gift ) {
952 -
953959 if ( $gift['status'] == 1 && $user_name == $wgUser->getName() ) {
954960 $g->clearUserGiftStatus( $gift['id'] );
955961 $wgMemc->delete( $key );
@@ -1008,14 +1014,14 @@
10091015 $x = 1;
10101016
10111017 $output .= '<div class="user-section-heading">
1012 - <div class="user-section-title">
1013 - ' . wfMsg( 'user-awards-title' ) . '
1014 - </div>
 1018+ <div class="user-section-title">'
 1019+ . wfMsg( 'user-awards-title' ) .
 1020+ '</div>
10151021 <div class="user-section-actions">
10161022 <div class="action-right">';
1017 - if ( $system_gift_count > 4 ) {
1018 - $output .= '<a href="' . $system_gift_link->escapeFullURL( 'user=' . $user_name ) . '" rel="nofollow">' . wfMsg( 'user-view-all' ) . '</a>';
1019 - }
 1023+ if ( $system_gift_count > 4 ) {
 1024+ $output .= '<a href="' . $system_gift_link->escapeFullURL( 'user=' . $user_name ) . '" rel="nofollow">' . wfMsg( 'user-view-all' ) . '</a>';
 1025+ }
10201026 $output .= '</div>
10211027 <div class="action-left">';
10221028 if ( $system_gift_count > 4 ) {
@@ -1031,7 +1037,6 @@
10321038 <div class="user-gift-container">';
10331039
10341040 foreach ( $system_gifts as $gift ) {
1035 -
10361041 if ( $gift['status'] == 1 && $user_name == $wgUser->getName() ) {
10371042 $sg->clearUserGiftStatus( $gift['id'] );
10381043 $wgMemc->delete( $sg_key );
@@ -1091,9 +1096,9 @@
10921097 }
10931098
10941099 $output .= '<div class="user-section-heading">
1095 - <div class="user-section-title">
1096 - ' . wfMsg( 'user-board-title' ) . '
1097 - </div>
 1100+ <div class="user-section-title">'
 1101+ . wfMsg( 'user-board-title' ) .
 1102+ '</div>
10981103 <div class="user-section-actions">
10991104 <div class="action-right">';
11001105 if ( $wgUser->getName() == $user_name ) {
@@ -1138,9 +1143,9 @@
11391144 </div>';
11401145 } else {
11411146 $login_link = SpecialPage::getTitleFor( 'Userlogin' );
1142 - $output .= '<div class="user-page-message-form">
1143 - ' . wfMsg( 'user-board-login-message', $login_link->escapeFullURL() ) . '
1144 - </div>';
 1147+ $output .= '<div class="user-page-message-form">'
 1148+ . wfMsg( 'user-board-login-message', $login_link->escapeFullURL() ) .
 1149+ '</div>';
11451150 }
11461151 }
11471152 $output .= '<div id="user-page-board">';
@@ -1192,11 +1197,10 @@
11931198 $per_row = 1;
11941199
11951200 if ( $fanboxes ) {
1196 -
11971201 $output .= '<div class="user-section-heading">
1198 - <div class="user-section-title">
1199 - ' . wfMsg( 'user-fanbox-title' ) . '
1200 - </div>
 1202+ <div class="user-section-title">'
 1203+ . wfMsg( 'user-fanbox-title' ) .
 1204+ '</div>
12011205 <div class="user-section-actions">
12021206 <div class="action-right">';
12031207 if ( $fanbox_count > 10 ) {

Status & tagging log