http://www.mediawiki.org/wiki/Special:Code/MediaWiki/92621
Revision: 92621 Author: ashley Date: 2011-07-20 10:49:46 +0000 (Wed, 20 Jul 2011) Log Message: ----------- SocialProfile: since we already have a wAvatar object available, use its getAvatarURL() method to build the <img> tag instead of hacky DIY solutions Modified Paths: -------------- trunk/extensions/SocialProfile/UserRelationship/SpecialAddRelationship.php trunk/extensions/SocialProfile/UserRelationship/SpecialRemoveRelationship.php Modified: trunk/extensions/SocialProfile/UserRelationship/SpecialAddRelationship.php =================================================================== --- trunk/extensions/SocialProfile/UserRelationship/SpecialAddRelationship.php 2011-07-20 10:45:25 UTC (rev 92620) +++ trunk/extensions/SocialProfile/UserRelationship/SpecialAddRelationship.php 2011-07-20 10:49:46 UTC (rev 92621) @@ -27,7 +27,7 @@ * @param $params Mixed: parameter(s) passed to the page or null */ public function execute( $params ) { - global $wgUser, $wgOut, $wgRequest, $wgUploadPath, $wgUserRelationshipScripts; + global $wgUser, $wgOut, $wgRequest, $wgUserRelationshipScripts; // Can't use $this->setHeaders(); here because then it'll set the page // title to <removerelationship> and we don't want that, we'll be @@ -105,14 +105,12 @@ } $avatar = new wAvatar( $this->user_id_to, 'l' ); - $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . - $avatar->getAvatarImage() . '" alt="" border="0" />'; $out = ''; $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); $out .= "<div class=\"relationship-action\"> - {$avatar_img} + {$avatar->getAvatarURL()} " . $error . " <div class=\"relationship-buttons\"> <input type=\"button\" class=\"site-button\" value=\"" . wfMsg( 'ur-main-page' ) . "\" size=\"20\" onclick=\"window.location='index.php?title=" . wfMsgForContent( 'mainpage' ) . "'\"/> @@ -132,13 +130,11 @@ } $avatar = new wAvatar( $this->user_id_to, 'l' ); - $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . - $avatar->getAvatarImage() . '" alt="" border="0" />'; $out = ''; $wgOut->setPageTitle( wfMsg( 'ur-add-error-message-pending-request-title' ) ); $out .= "<div class=\"relationship-action\"> - {$avatar_img} + {$avatar->getAvatarURL()} " . $error . " <div class=\"relationship-buttons\"> <input type=\"button\" class=\"site-button\" value=\"" . wfMsg( 'ur-main-page' ) . "\" size=\"20\" onclick=\"window.location='index.php?title=" . wfMsgForContent( 'mainpage' ) . "'\"/> @@ -179,8 +175,6 @@ $rel = $rel->addRelationshipRequest( $this->user_name_to, $this->relationship_type, $wgRequest->getVal( 'message' ) ); $avatar = new wAvatar( $this->user_id_to, 'l' ); - $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . - $avatar->getAvatarImage() . '" alt="" border="0" />'; $out = ''; @@ -193,7 +187,7 @@ } $out .= "<div class=\"relationship-action\"> - {$avatar_img} + {$avatar->getAvatarURL()} " . $sent . " <div class=\"relationship-buttons\"> <input type=\"button\" class=\"site-button\" value=\"" . wfMsg( 'ur-main-page' ) . "\" size=\"20\" onclick=\"window.location='index.php?title=" . wfMsgForContent( 'mainpage' ) . "'\"/> @@ -215,7 +209,7 @@ * @return $form Mixed: HTML code for the form */ function displayForm() { - global $wgOut, $wgUploadPath; + global $wgOut; if ( $this->relationship_type == 1 ) { $wgOut->setPageTitle( wfMsg( 'ur-add-title-friend', $this->user_name_to ) ); @@ -228,12 +222,10 @@ } $avatar = new wAvatar( $this->user_id_to, 'l' ); - $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . - $avatar->getAvatarImage() . '" alt="" border="0" />'; $form = "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" name=\"form1\"> <div class=\"relationship-action\"> - {$avatar_img} + {$avatar->getAvatarURL()} " . $add . '<div class="cleared"></div> </div> Modified: trunk/extensions/SocialProfile/UserRelationship/SpecialRemoveRelationship.php =================================================================== --- trunk/extensions/SocialProfile/UserRelationship/SpecialRemoveRelationship.php 2011-07-20 10:45:25 UTC (rev 92620) +++ trunk/extensions/SocialProfile/UserRelationship/SpecialRemoveRelationship.php 2011-07-20 10:49:46 UTC (rev 92621) @@ -26,7 +26,7 @@ * @param $params Mixed: parameter(s) passed to the page or null */ public function execute( $params ) { - global $wgUser, $wgOut, $wgRequest, $wgUploadPath, $wgUserRelationshipScripts; + global $wgUser, $wgOut, $wgRequest, $wgUserRelationshipScripts; // Can't use $this->setHeaders(); here because then it'll set the page // title to <removerelationship> and we don't want that, we'll be @@ -65,8 +65,8 @@ $out = ''; if ( $wgUser->getID() == $this->user_id_to ) { $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); - $out .= '<div class="relationship-error-message">' - . wfMsg( 'ur-remove-error-message-remove-yourself' ) . + $out .= '<div class="relationship-error-message">' . + wfMsg( 'ur-remove-error-message-remove-yourself' ) . '</div> <div> <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title=' . wfMsgForContent( 'mainpage' ) . '"\' />'; @@ -129,12 +129,11 @@ $this->relationship_type ); $avatar = new wAvatar( $this->user_id_to, 'l' ); - $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . - $avatar->getAvatarImage() . '" alt="" border="" />'; $wgOut->setPageTitle( $confirmTitle ); + $out .= "<div class=\"relationship-action\"> - {$avatar_img}" . + {$avatar->getAvatarURL()}" . $confirmMsg . "<div class=\"relationship-buttons\"> <input type=\"button\" class=\"site-button\" value=\"" . wfMsg( 'ur-main-page' ) . "\" size=\"20\" onclick=\"window.location='index.php?title=" . wfMsgForContent( 'mainpage' ) . "'\"/> @@ -157,11 +156,9 @@ * @return $form Mixed: HTML code for the form */ function displayForm() { - global $wgOut, $wgUploadPath; + global $wgOut; $avatar = new wAvatar( $this->user_id_to, 'l' ); - $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . - $avatar->getAvatarImage() . '" alt="avatar" />'; if ( $this->relationship_type == 1 ) { $title = wfMsg( 'ur-remove-relationship-title-friend', $this->user_name_to ); @@ -174,7 +171,7 @@ $form = "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" name=\"form1\"> <div class=\"relationship-action\"> - {$avatar_img}" . + {$avatar->getAvatarURL()}" . $remove . '<div class="relationship-buttons"> <input type="hidden" name="user" value="' . addslashes( $this->user_name_to ) . '" /> _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs