[MediaWiki-commits] [Gerrit] mediawiki...SocialProfile[master]: Avoid use of $wgLang global in UserProfilePage
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/402467 ) Change subject: Avoid use of $wgLang global in UserProfilePage .. Avoid use of $wgLang global in UserProfilePage Change-Id: I18b5d7b60e5e22830679c8b163a2b65ef783d6b8 --- M UserProfile/UserProfilePage.php 1 file changed, 16 insertions(+), 10 deletions(-) Approvals: Jack Phoenix: Looks good to me, approved jenkins-bot: Verified diff --git a/UserProfile/UserProfilePage.php b/UserProfile/UserProfilePage.php index 53a5b75..043180f 100644 --- a/UserProfile/UserProfilePage.php +++ b/UserProfile/UserProfilePage.php @@ -161,9 +161,11 @@ function getUserStatsRow( $label, $value ) { $output = ''; // Prevent E_NOTICE + $context = $this->getContext(); + $language = $context->getLanguage(); + if ( $value != 0 ) { - global $wgLang; - $formattedValue = $wgLang->formatNum( $value ); + $formattedValue = $language->formatNum( $value ); $output = " {$label} {$formattedValue} @@ -918,10 +920,11 @@ * @param $user_name String: user name */ function getProfileTop( $user_id, $user_name ) { - global $wgLang, $wgUserLevels; + global $wgUserLevels; $context = $this->getContext(); $userContext = $context->getUser(); + $language = $context->getLanguage(); $stats = new UserStats( $user_id, $user_name ); $stats_data = $stats->getUserStats(); @@ -994,7 +997,7 @@ ' . wfMessage( 'user-profile-points', - $wgLang->formatNum( $stats_data['points'] ) + $language->formatNum( $stats_data['points'] ) )->escaped() . ' @@ -1007,7 +1010,7 @@ '; if ( $this->isOwner() ) { - $output .= $wgLang->pipeList( array( + $output .= $language->pipeList( array( '' . wfMessage( 'user-edit-profile' )->escaped() . '', '' . wfMessage( 'user-upload-avatar' )->escaped() . '', '' . wfMessage( 'user-watchlist' )->escaped() . '', @@ -1015,20 +1018,20 @@ ) ); } elseif ( $userContext->isLoggedIn() ) { if ( $relationship == false ) { - $output .= $wgLang->pipeList( array( + $output .= $language->pipeList( array( '' . wfMessage( 'user-add-friend' )->escaped() . '', '' . wfMessage( 'user-add-foe' )->escaped() . '', '' ) ); } else { if ( $relationship == 1 ) { - $output .= $wgLang->pipeList( array( + $output .= $language->pipeList( array( '' . wfMessage( 'user-remove-friend' )->escaped() . '', '' ) ); } if ( $relationship == 2 ) { - $output .= $wgLang->pipeList( array( + $output .= $language->pipeList( array( '' . wfMessage( 'user-remove-foe' )->escaped() . '', '' ) ); @@ -1114,7 +1117,10 @@ * foes */ function getRelationships( $user_name, $rel_type ) { - global $wgMemc, $wgUserProfileDisplay, $wgLang; + global $wgMemc, $wgUserProfileDisplay; + + $context = $this->getContext(); + $language = $context->getLanguage(); // If not enabled in site settings, don't display if ( $rel_type == 1 ) { @@ -1186,7 +1192,7 @@ $avatar = new wAvatar( $friend['user_id'], 'ml' ); // Chop down username that gets displayed - $user_name = $wgLang->truncate(
[MediaWiki-commits] [Gerrit] mediawiki...SocialProfile[master]: Avoid use of $wgLang global in UserProfilePage
SamanthaNguyen has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/402467 ) Change subject: Avoid use of $wgLang global in UserProfilePage .. Avoid use of $wgLang global in UserProfilePage Change-Id: I18b5d7b60e5e22830679c8b163a2b65ef783d6b8 --- M UserProfile/UserProfilePage.php 1 file changed, 16 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SocialProfile refs/changes/67/402467/1 diff --git a/UserProfile/UserProfilePage.php b/UserProfile/UserProfilePage.php index 53a5b75..043180f 100644 --- a/UserProfile/UserProfilePage.php +++ b/UserProfile/UserProfilePage.php @@ -161,9 +161,11 @@ function getUserStatsRow( $label, $value ) { $output = ''; // Prevent E_NOTICE + $context = $this->getContext(); + $language = $context->getLanguage(); + if ( $value != 0 ) { - global $wgLang; - $formattedValue = $wgLang->formatNum( $value ); + $formattedValue = $language->formatNum( $value ); $output = " {$label} {$formattedValue} @@ -918,10 +920,11 @@ * @param $user_name String: user name */ function getProfileTop( $user_id, $user_name ) { - global $wgLang, $wgUserLevels; + global $wgUserLevels; $context = $this->getContext(); $userContext = $context->getUser(); + $language = $context->getLanguage(); $stats = new UserStats( $user_id, $user_name ); $stats_data = $stats->getUserStats(); @@ -994,7 +997,7 @@ ' . wfMessage( 'user-profile-points', - $wgLang->formatNum( $stats_data['points'] ) + $language->formatNum( $stats_data['points'] ) )->escaped() . ' @@ -1007,7 +1010,7 @@ '; if ( $this->isOwner() ) { - $output .= $wgLang->pipeList( array( + $output .= $language->pipeList( array( '' . wfMessage( 'user-edit-profile' )->escaped() . '', '' . wfMessage( 'user-upload-avatar' )->escaped() . '', '' . wfMessage( 'user-watchlist' )->escaped() . '', @@ -1015,20 +1018,20 @@ ) ); } elseif ( $userContext->isLoggedIn() ) { if ( $relationship == false ) { - $output .= $wgLang->pipeList( array( + $output .= $language->pipeList( array( '' . wfMessage( 'user-add-friend' )->escaped() . '', '' . wfMessage( 'user-add-foe' )->escaped() . '', '' ) ); } else { if ( $relationship == 1 ) { - $output .= $wgLang->pipeList( array( + $output .= $language->pipeList( array( '' . wfMessage( 'user-remove-friend' )->escaped() . '', '' ) ); } if ( $relationship == 2 ) { - $output .= $wgLang->pipeList( array( + $output .= $language->pipeList( array( '' . wfMessage( 'user-remove-foe' )->escaped() . '', '' ) ); @@ -1114,7 +1117,10 @@ * foes */ function getRelationships( $user_name, $rel_type ) { - global $wgMemc, $wgUserProfileDisplay, $wgLang; + global $wgMemc, $wgUserProfileDisplay; + + $context = $this->getContext(); + $language = $context->getLanguage(); // If not enabled in site settings, don't display if ( $rel_type == 1 ) { @@ -1186,7 +1192,7 @@ $avatar = new wAvatar( $friend['user_id'], 'ml' ); // Chop down username that gets displayed - $user_name