Index: trunk/extensions/SocialProfile/UserActivity/UserActivityClass.php |
— | — | @@ -568,6 +568,8 @@ |
569 | 569 | * table and set them in the appropriate class member variables. |
570 | 570 | */ |
571 | 571 | private function setRelationships() { |
| 572 | + global $wgLang; |
| 573 | + |
572 | 574 | $dbr = wfGetDB( DB_SLAVE ); |
573 | 575 | |
574 | 576 | $where = array(); |
— | — | @@ -617,10 +619,7 @@ |
618 | 620 | $r_type = 'foe'; |
619 | 621 | } |
620 | 622 | |
621 | | - $user_name_short = substr( $row->r_user_name, 0, 25 ); |
622 | | - if ( $row->r_user_name != $user_name_short ) { |
623 | | - $user_name_short .= wfMsg( 'ellipsis' ); |
624 | | - } |
| 623 | + $user_name_short = $wgLang->truncate( $row->r_user_name, 25 ); |
625 | 624 | |
626 | 625 | $this->items_grouped[$r_type][$row->r_user_name_relation]['users'][$row->r_user_name][] = array( |
627 | 626 | 'id' => $row->r_id, |
— | — | @@ -748,6 +747,8 @@ |
749 | 748 | * member variables. |
750 | 749 | */ |
751 | 750 | private function setSystemMessages() { |
| 751 | + global $wgLang; |
| 752 | + |
752 | 753 | $dbr = wfGetDB( DB_SLAVE ); |
753 | 754 | |
754 | 755 | $where = array(); |
— | — | @@ -791,10 +792,8 @@ |
792 | 793 | |
793 | 794 | foreach ( $res as $row ) { |
794 | 795 | $user_title = Title::makeTitle( NS_USER, $row->um_user_name ); |
795 | | - $user_name_short = substr( $row->um_user_name, 0, 15 ); |
796 | | - if ( $row->um_user_name != $user_name_short ) { |
797 | | - $user_name_short .= wfMsg( 'ellipsis' ); |
798 | | - } |
| 796 | + $user_name_short = $wgLang->truncate( $row->um_user_name, 15 ); |
| 797 | + |
799 | 798 | $this->activityLines[] = array( |
800 | 799 | 'type' => 'system_message', |
801 | 800 | 'timestamp' => $row->item_date, |
— | — | @@ -929,6 +928,8 @@ |
930 | 929 | * @param $has_page Boolean: true by default |
931 | 930 | */ |
932 | 931 | function simplifyPageActivity( $type, $has_page = true ) { |
| 932 | + global $wgLang; |
| 933 | + |
933 | 934 | if ( !isset( $this->items_grouped[$type] ) || !is_array( $this->items_grouped[$type] ) ) { |
934 | 935 | return ''; |
935 | 936 | } |
— | — | @@ -1026,10 +1027,7 @@ |
1027 | 1028 | } |
1028 | 1029 | |
1029 | 1030 | $user_title = Title::makeTitle( NS_USER, $user_name ); |
1030 | | - $user_name_short = substr( $user_name, 0, 15 ); |
1031 | | - if ( $user_name != $user_name_short ) { |
1032 | | - $user_name_short .= wfMsg( 'ellipsis' ); |
1033 | | - } |
| 1031 | + $user_name_short = $wgLang->truncate( $user_name, 15 ); |
1034 | 1032 | |
1035 | 1033 | $users .= " <b><a href=\"{$user_title->escapeFullURL()}\">{$user_name_short}</a></b>"; |
1036 | 1034 | } |
— | — | @@ -1090,6 +1088,7 @@ |
1091 | 1089 | * @return String: "fixed" comment |
1092 | 1090 | */ |
1093 | 1091 | function fixItemComment( $comment ) { |
| 1092 | + global $wgLang; |
1094 | 1093 | if ( !$comment ) { |
1095 | 1094 | return ''; |
1096 | 1095 | } else { |
— | — | @@ -1098,10 +1097,7 @@ |
1099 | 1098 | $comment = str_replace( '&', '%26', $comment ); |
1100 | 1099 | $comment = str_replace( '%26quot;', '"', $comment ); |
1101 | 1100 | } |
1102 | | - $preview = substr( $comment, 0, 75 ); |
1103 | | - if ( $preview != $comment ) { |
1104 | | - $preview .= wfMsg( 'ellipsis' ); |
1105 | | - } |
| 1101 | + $preview = $wgLang->truncate( $comment, 75 ); |
1106 | 1102 | return stripslashes( $preview ); |
1107 | 1103 | } |
1108 | 1104 | |
Index: trunk/extensions/SocialProfile/UserStats/TopFansByStat.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | * @param $par Mixed: parameter passed to the page or null |
17 | 17 | */ |
18 | 18 | public function execute( $par ) { |
19 | | - global $wgRequest, $wgUser, $wgOut, $wgMemc, $wgUploadPath, $wgScriptPath; |
| 19 | + global $wgRequest, $wgLang, $wgOut, $wgMemc, $wgUploadPath, $wgScriptPath; |
20 | 20 | global $wgUserStatsTrackWeekly, $wgUserStatsTrackMonthly; |
21 | 21 | |
22 | 22 | // Load CSS |
— | — | @@ -118,11 +118,7 @@ |
119 | 119 | $out .= '<div class="top-users">'; |
120 | 120 | |
121 | 121 | foreach ( $user_list as $user ) { |
122 | | - if ( $user['user_name'] == substr( $user['user_name'], 0, 22 ) ) { |
123 | | - $user_name = $user['user_name']; |
124 | | - } else { |
125 | | - $user_name = substr( $user['user_name'], 0, 22 ) . wfMsg( 'ellipsis' ); |
126 | | - } |
| 122 | + $user_name = $wgLang->truncate( $user['user_name'], 22 ); |
127 | 123 | $user_title = Title::makeTitle( NS_USER, $user['user_name'] ); |
128 | 124 | $avatar = new wAvatar( $user['user_id'], 'm' ); |
129 | 125 | $commentIcon = $avatar->getAvatarImage(); |