r92623 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92622‎ | r92623 | r92624 >
Date:11:17, 20 July 2011
Author:ashley
Status:ok
Tags:
Comment:
SocialProfile: follow-up to r92621: do the same for UserProfile. Also changed once instance of DIY truncation code to Language::truncate() and trimmed trailing whitespace
Modified paths:
  • /trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php
@@ -778,7 +778,7 @@
779779 * @param $user_name String: user name
780780 */
781781 function getProfileTop( $user_id, $user_name ) {
782 - global $wgTitle, $wgUser, $wgUploadPath, $wgLang;
 782+ global $wgTitle, $wgUser, $wgLang;
783783 global $wgUserLevels, $wgEnableUserStatus;
784784
785785 $stats = new UserStats( $user_id, $user_name );
@@ -834,10 +834,8 @@
835835 </div>';
836836 }
837837
838 - $output .= '<div id="profile-image">
839 - <img src="' . $wgUploadPath . '/avatars/' .
840 - $avatar->getAvatarImage() . '" alt="" border="0" />
841 - </div>';
 838+ $output .= '<div id="profile-image">' . $avatar->getAvatarURL() .
 839+ '</div>';
842840
843841 $output .= '<div id="profile-right">';
844842
@@ -939,7 +937,7 @@
940938 * @return String: HTML
941939 */
942940 function getProfileImage( $user_name ) {
943 - global $wgUser, $wgUploadPath;
 941+ global $wgUser;
944942
945943 $avatar = new wAvatar( $this->user_id, 'l' );
946944 $avatarTitle = SpecialPage::getTitleFor( 'UploadAvatar' );
@@ -951,14 +949,12 @@
952950 } else {
953951 $caption = 'new image';
954952 }
955 - $output .= '<a href="' . $avatarTitle->escapeFullURL() . '" rel="nofollow">
956 - <img src="' . $wgUploadPath . '/avatars/' .
957 - $avatar->getAvatarImage() . '" alt="" border="0" /><br />
 953+ $output .= '<a href="' . $avatarTitle->escapeFullURL() . '" rel="nofollow">' .
 954+ $avatar->getAvatarURL() . '<br />
958955 (' . $caption . ')
959956 </a>';
960957 } else {
961 - $output .= '<img src="' . $wgUploadPath . '/avatars/' .
962 - $avatar->getAvatarImage() . '" alt="" border="0" />';
 958+ $output .= $avatar->getAvatarURL();
963959 }
964960 $output .= '</div>';
965961
@@ -974,7 +970,7 @@
975971 * foes
976972 */
977973 function getRelationships( $user_name, $rel_type ) {
978 - global $wgMemc, $wgUser, $wgUserProfileDisplay, $wgUploadPath;
 974+ global $wgMemc, $wgUser, $wgUserProfileDisplay, $wgLang;
979975
980976 // If not enabled in site settings, don't display
981977 if ( $rel_type == 1 ) {
@@ -1044,17 +1040,12 @@
10451041 foreach ( $friends as $friend ) {
10461042 $user = Title::makeTitle( NS_USER, $friend['user_name'] );
10471043 $avatar = new wAvatar( $friend['user_id'], 'ml' );
1048 - $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' .
1049 - $avatar->getAvatarImage() . '" alt="" border="0" />';
10501044
10511045 // Chop down username that gets displayed
1052 - $user_name = mb_substr( $friend['user_name'], 0, 9 );
1053 - if ( $user_name != $friend['user_name'] ) {
1054 - $user_name .= '..';
1055 - }
 1046+ $user_name = $wgLang->truncate( $friend['user_name'], 9, '..' );
10561047
10571048 $output .= "<a href=\"" . $user->escapeFullURL() . "\" title=\"{$friend['user_name']}\" rel=\"nofollow\">
1058 - {$avatar_img}<br />
 1049+ {$avatar->getAvatarURL()}<br />
10591050 {$user_name}
10601051 </a>";
10611052
@@ -1801,18 +1792,18 @@
18021793 } else {
18031794 $buf = $user_status_array['us_status'];
18041795 }
1805 -
 1796+
18061797 // Only owners of the page can change statuses
18071798 if ( $wgUser->getId() == $userId ) {
18081799 if ( $wgUser->isBlocked() ) {
1809 - return wfMsg('userstatus-blocked');
 1800+ return wfMsg( 'userstatus-blocked' );
18101801 }
18111802
18121803 // Database operations require write mode
18131804 if ( wfReadOnly() ) {
1814 - return wfMsg('userstatus-readonly');
 1805+ return wfMsg( 'userstatus-readonly' );
18151806 }
1816 -
 1807+
18171808 return "<script>UserStatus.toShowMode('$buf','$userId');</script>";
18181809 } else {
18191810 return $buf;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92621SocialProfile: since we already have a wAvatar object available, use its getA...ashley10:49, 20 July 2011

Status & tagging log