r91488 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91487‎ | r91488 | r91489 >
Date:20:47, 5 July 2011
Author:ashley
Status:deferred
Tags:
Comment:
SocialProfile: improve FanBoxes support. To-do: would be nice to move this code to the FanBoxes extension because that's where it belongs to, not here
Modified paths:
  • /trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php
@@ -1324,7 +1324,6 @@
13251325
13261326 $output = '';
13271327 $f = new UserFanBoxes( $user_name );
1328 - $user_safe = ( $user_name );
13291328
13301329 // Try cache
13311330 /*
@@ -1349,15 +1348,15 @@
13501349
13511350 if ( $fanboxes ) {
13521351 $output .= '<div class="user-section-heading">
1353 - <div class="user-section-title">'
1354 - . wfMsg( 'user-fanbox-title' ) .
 1352+ <div class="user-section-title">' .
 1353+ wfMsg( 'user-fanbox-title' ) .
13551354 '</div>
13561355 <div class="user-section-actions">
13571356 <div class="action-right">';
13581357 // If there are more than ten fanboxes, display a "View all" link
13591358 // instead of listing them all on the profile page
13601359 if ( $fanbox_count > 10 ) {
1361 - $output .= '<a href="' . $fanbox_link->escapeFullURL( 'user=' . $user_safe ) . '" rel="nofollow">' .
 1360+ $output .= '<a href="' . $fanbox_link->escapeFullURL( 'user=' . $user_name ) . '" rel="nofollow">' .
13621361 wfMsg( 'user-view-all' ) . '</a>';
13631362 }
13641363 $output .= '</div>
@@ -1385,7 +1384,13 @@
13861385 $fantag_image_width = 45;
13871386 $fantag_image_height = 53;
13881387 $fantag_image = wfFindFile( $fanbox['fantag_image_name'] );
1389 - $fantag_image_url = $fantag_image->createThumb( $fantag_image_width, $fantag_image_height );
 1388+ $fantag_image_url = '';
 1389+ if ( is_object( $fantag_image ) ) {
 1390+ $fantag_image_url = $fantag_image->createThumb(
 1391+ $fantag_image_width,
 1392+ $fantag_image_height
 1393+ );
 1394+ }
13901395 $fantag_image_tag = '<img alt="" src="' . $fantag_image_url . '" />';
13911396 }
13921397
@@ -1393,11 +1398,15 @@
13941399 $fantag_leftside = $fantag_image_tag;
13951400 } else {
13961401 $fantag_leftside = $fanbox['fantag_left_text'];
1397 - $fantag_leftside = $tagParser->parse( $fantag_leftside, $wgTitle, $wgOut->parserOptions(), false );
 1402+ $fantag_leftside = $tagParser->parse(
 1403+ $fantag_leftside, $wgTitle,
 1404+ $wgOut->parserOptions(), false
 1405+ );
13981406 $fantag_leftside = $fantag_leftside->getText();
13991407 }
14001408
14011409 $leftfontsize = '10px';
 1410+ $rightfontsize = '11px';
14021411 if ( $fanbox['fantag_left_textsize'] == 'mediumfont' ) {
14031412 $leftfontsize = '11px';
14041413 }
@@ -1417,7 +1426,9 @@
14181427 // Get permalink
14191428 $fantag_title = Title::makeTitle( NS_FANTAG, $fanbox['fantag_title'] );
14201429 $right_text = $fanbox['fantag_right_text'];
1421 - $right_text = $tagParser->parse( $right_text, $wgTitle, $wgOut->parserOptions(), false );
 1430+ $right_text = $tagParser->parse(
 1431+ $right_text, $wgTitle, $wgOut->parserOptions(), false
 1432+ );
14221433 $right_text = $right_text->getText();
14231434
14241435 // Output fanboxes
@@ -1425,7 +1436,7 @@
14261437 <div class=\"individual-fanbox\" id=\"individualFanbox" . $fanbox['fantag_id'] . "\">
14271438 <div class=\"show-message-container-profile\" id=\"show-message-container" . $fanbox['fantag_id'] . "\">
14281439 <a class=\"perma\" style=\"font-size:8px; color:" . $fanbox['fantag_right_textcolor'] . "\" href=\"" . $fantag_title->escapeFullURL() . "\" title=\"{$fanbox['fantag_title']}\">" . wfMsg( 'fanbox-perma' ) . "</a>
1429 - <table class=\"fanBoxTableProfile\" onclick=\"javascript:openFanBoxPopup('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}')\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
 1440+ <table class=\"fanBoxTableProfile\" onclick=\"javascript:FanBoxes.openFanBoxPopup('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}')\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
14301441 <tr>
14311442 <td id=\"fanBoxLeftSideOutputProfile\" style=\"color:" . $fanbox['fantag_left_textcolor'] . "; font-size:$leftfontsize\" bgcolor=\"" . $fanbox['fantag_left_bgcolor'] . "\">" . $fantag_leftside . "</td>
14321443 <td id=\"fanBoxRightSideOutputProfile\" style=\"color:" . $fanbox['fantag_right_textcolor'] . "; font-size:$rightfontsize\" bgcolor=\"" . $fanbox['fantag_right_bgcolor'] . "\">" . $right_text . "</td>
@@ -1443,8 +1454,8 @@
14441455 </tr>
14451456 <tr>
14461457 <td align=\"center\">
1447 - <input type=\"button\" value=\"" . wfMsg( 'fanbox-add' ) . "\" size=\"10\" onclick=\"closeFanboxAdd('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}'); showAddRemoveMessageUserPage(1, {$fanbox['fantag_id']}, 'show-addremove-message-half')\" />
1448 - <input type=\"button\" value=\"" . wfMsg( 'cancel' ) . "\" size=\"10\" onclick=\"closeFanboxAdd('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}')\" />
 1458+ <input type=\"button\" value=\"" . wfMsg( 'fanbox-add' ) . "\" size=\"10\" onclick=\"FanBoxes.closeFanboxAdd('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}'); FanBoxes.showAddRemoveMessageUserPage(1, {$fanbox['fantag_id']}, 'show-addremove-message-half')\" />
 1459+ <input type=\"button\" value=\"" . wfMsg( 'cancel' ) . "\" size=\"10\" onclick=\"FanBoxes.closeFanboxAdd('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}')\" />
14491460 </td>
14501461 </tr>
14511462 </table>
@@ -1457,8 +1468,8 @@
14581469 </tr>
14591470 <tr>
14601471 <td align=\"center\">
1461 - <input type=\"button\" value=\"" . wfMsg( 'fanbox-remove' ) . "\" size=\"10\" onclick=\"closeFanboxAdd('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}'); showAddRemoveMessageUserPage(2, {$fanbox['fantag_id']}, 'show-addremove-message-half')\" />
1462 - <input type=\"button\" value=\"" . wfMsg( 'cancel' ) . "\" size=\"10\" onclick=\"closeFanboxAdd('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}')\" />
 1472+ <input type=\"button\" value=\"" . wfMsg( 'fanbox-remove' ) . "\" size=\"10\" onclick=\"FanBoxes.closeFanboxAdd('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}'); FanBoxes.showAddRemoveMessageUserPage(2, {$fanbox['fantag_id']}, 'show-addremove-message-half')\" />
 1473+ <input type=\"button\" value=\"" . wfMsg( 'cancel' ) . "\" size=\"10\" onclick=\"FanBoxes.closeFanboxAdd('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}')\" />
14631474 </td>
14641475 </tr>
14651476 </table>
@@ -1478,7 +1489,7 @@
14791490 </tr>
14801491 <tr>
14811492 <td align=\"center\">
1482 - <input type=\"button\" value=\"" . wfMsg( 'cancel' ) . "\" size=\"10\" onclick=\"closeFanboxAdd('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}')\" />
 1493+ <input type=\"button\" value=\"" . wfMsg( 'cancel' ) . "\" size=\"10\" onclick=\"FanBoxes.closeFanboxAdd('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}')\" />
14831494 </td>
14841495 </tr>
14851496 </table>

Status & tagging log