Index: trunk/extensions/SocialProfile/UserWelcome/UserWelcome.php |
— | — | @@ -2,9 +2,9 @@ |
3 | 3 | /** |
4 | 4 | * UserWelcome extension |
5 | 5 | * Adds <welcomeUser/> tag to display user-specific social information |
6 | | - * Intended to use with SocialProfile extension version 1.3 or later, will fail without it |
7 | | - * or if you have an older version of SocialProfile than 1.3. |
8 | 6 | * |
| 7 | + * @file |
| 8 | + * @ingroup Extensions |
9 | 9 | * @author Wikia, Inc. |
10 | 10 | * @version 1.0 |
11 | 11 | * @link http://www.mediawiki.org/wiki/Extension:UserWelcome Documentation |
— | — | @@ -20,17 +20,17 @@ |
21 | 21 | |
22 | 22 | // Extension credits that show up on Special:Version |
23 | 23 | $wgExtensionCredits['parserhook'][] = array( |
24 | | - 'name' => 'UserWelcome', |
25 | | - 'version' => '1.0.1', |
26 | | - 'description' => 'Adds <tt><welcomeUser></tt> tag to display user-specific social info to logged-in users', |
| 24 | + 'name' => 'UserWelcome', |
| 25 | + 'version' => '1.1', |
| 26 | + 'author' => 'Wikia New York Team', |
| 27 | + 'description' => 'Adds <tt><welcomeUser></tt> tag to display user-specific social info to logged-in users', |
27 | 28 | 'description-msg' => 'userwelcome-desc', |
28 | | - 'author' => 'Wikia New York Team', |
29 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:UserWelcome', |
| 29 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:UserWelcome', |
30 | 30 | ); |
31 | 31 | |
32 | 32 | function wfWelcomeUser() { |
33 | | - global $wgParser; |
34 | | - $wgParser->setHook( 'welcomeUser', 'getWelcomeUser' ); |
| 33 | + global $wgParser; |
| 34 | + $wgParser->setHook( 'welcomeUser', 'getWelcomeUser' ); |
35 | 35 | return true; |
36 | 36 | } |
37 | 37 | |
— | — | @@ -40,159 +40,154 @@ |
41 | 41 | function getWelcomeUser( $input, $args, $parser ){ |
42 | 42 | |
43 | 43 | $parser->disableCache(); |
44 | | - $output = ""; |
45 | | - $output .= getWelcome(); |
| 44 | + $output = getWelcome(); |
46 | 45 | |
47 | 46 | return $output; |
48 | 47 | } |
49 | 48 | |
50 | 49 | function getWelcome(){ |
51 | | - global $wgUser, $IP, $wgUploadPath; |
52 | | - wfLoadExtensionMessages('UserWelcome'); |
| 50 | + global $wgUser, $wgUploadPath; |
| 51 | + wfLoadExtensionMessages( 'UserWelcome' ); |
53 | 52 | |
54 | 53 | // Get stats and user level |
55 | | - $stats = new UserStats($wgUser->getID(), $wgUser->getName()); |
| 54 | + $stats = new UserStats( $wgUser->getID(), $wgUser->getName() ); |
56 | 55 | $stats_data = $stats->getUserStats(); |
57 | | - $user_level = new UserLevel($stats_data["points"]); |
| 56 | + $user_level = new UserLevel( $stats_data['points'] ); |
58 | 57 | |
59 | 58 | // Safe links |
60 | | - $level_link = Title::makeTitle(NS_HELP, wfMsgHtml('mp-userlevels-link')); |
61 | | - $avatar_link = Title::makeTitle(NS_SPECIAL, 'UploadAvatar'); |
62 | | - $invite_link = Title::makeTitle(NS_SPECIAL, 'InviteContacts'); |
| 59 | + $level_link = Title::makeTitle( NS_HELP, wfMsgHtml( 'mp-userlevels-link' ) ); |
| 60 | + $avatar_link = Title::makeTitle( NS_SPECIAL, 'UploadAvatar' ); |
| 61 | + $invite_link = Title::makeTitle( NS_SPECIAL, 'InviteContacts' ); |
63 | 62 | |
64 | 63 | // Make an avatar |
65 | | - $avatar = new wAvatar($wgUser->getID(), "l"); |
| 64 | + $avatar = new wAvatar( $wgUser->getID(), 'l' ); |
66 | 65 | |
67 | | - $output = ""; |
68 | | - |
69 | 66 | // Profile top images/points |
70 | | - $output .= "<div class=\"mp-welcome-logged-in\"> |
71 | | - <h2>".wfMsg('mp-welcome-logged-in', $wgUser->getName())."</h2> |
72 | | - <div class=\"mp-welcome-image\"> |
73 | | - <a href=\"". $wgUser->getUserPage()->escapeFullURL(). "\" rel=\"nofollow\"><img src=\"{$wgUploadPath}/avatars/" . $avatar->getAvatarImage() . "\" alt=\"\" border=\"0\"/></a>"; |
74 | | - if( strpos($avatar->getAvatarImage(), 'default_') !== false ) { |
75 | | - $output .= "<div><a href=\"".$avatar_link->escapeFullURL()."\" rel=\"nofollow\">".wfMsg('mp-welcome-upload')."</a></div>"; |
| 67 | + $output = '<div class="mp-welcome-logged-in"> |
| 68 | + <h2>'.wfMsg( 'mp-welcome-logged-in', $wgUser->getName() ).'</h2> |
| 69 | + <div class="mp-welcome-image"> |
| 70 | + <a href="'. $wgUser->getUserPage()->escapeFullURL(). '" rel="nofollow"><img src="'.$wgUploadPath.'/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0"/></a>'; |
| 71 | + if( strpos( $avatar->getAvatarImage(), 'default_' ) !== false ) { |
| 72 | + $output .= '<div><a href="'.$avatar_link->escapeFullURL().'" rel="nofollow">'.wfMsg( 'mp-welcome-upload' ).'</a></div>'; |
76 | 73 | } else { |
77 | | - $output .= "<div><a href=\"".$avatar_link->escapeFullURL()."\" rel=\"nofollow\">".wfMsg('mp-welcome-edit')."</a></div>"; |
| 74 | + $output .= '<div><a href="'.$avatar_link->escapeFullURL().'" rel="nofollow">'.wfMsg( 'mp-welcome-edit' ).'</a></div>'; |
78 | 75 | } |
79 | | - $output .= "</div>"; |
| 76 | + $output .= '</div>'; |
80 | 77 | |
81 | 78 | global $wgUserLevels; |
82 | 79 | if( $wgUserLevels ){ |
83 | | - $output .= "<div class=\"mp-welcome-points\"> |
84 | | - <div class=\"points-and-level\"> |
85 | | - <div class=\"total-points\">".wfMsgExt( 'mp-welcome-points', array( 'parsemag' ), $stats_data["points"] )."</div> |
86 | | - <div class=\"honorific-level\"><a href=\"".$level_link->escapeFullURL()."\">({$user_level->getLevelName()})</a></div> |
| 80 | + $output .= '<div class="mp-welcome-points"> |
| 81 | + <div class="points-and-level"> |
| 82 | + <div class="total-points">'.wfMsgExt( 'mp-welcome-points', array( 'parsemag' ), $stats_data['points'] ).'</div> |
| 83 | + <div class="honorific-level"><a href="'.$level_link->escapeFullURL().'">('.$user_level->getLevelName().')</a></div> |
87 | 84 | </div> |
88 | | - <div class=\"cleared\"></div> |
89 | | - <div class=\"needed-points\"> |
90 | | - " . wfMsgExt( 'mp-welcome-needed-points', array( 'parsemag' ), $level_link->escapeFullURL(), |
91 | | - $user_level->getNextLevelName(), $user_level->getPointsNeededToAdvance() ) . " |
| 85 | + <div class="cleared"></div> |
| 86 | + <div class="needed-points"> |
| 87 | + ' . wfMsgExt( 'mp-welcome-needed-points', array( 'parsemag' ), $level_link->escapeFullURL(), |
| 88 | + $user_level->getNextLevelName(), $user_level->getPointsNeededToAdvance() ) . ' |
92 | 89 | </div> |
93 | | - </div>"; |
| 90 | + </div>'; |
94 | 91 | } |
95 | 92 | |
96 | | - $output .= "<div class=\"cleared\"></div>"; |
| 93 | + $output .= '<div class="cleared"></div>'; |
97 | 94 | $output .= getRequests(); |
98 | | - $output .= "</div>"; |
| 95 | + $output .= '</div>'; |
99 | 96 | |
100 | 97 | return $output; |
101 | 98 | } |
102 | 99 | |
103 | 100 | function getRequests(){ |
104 | | - wfLoadExtensionMessages('UserWelcome'); |
| 101 | + wfLoadExtensionMessages( 'UserWelcome' ); |
105 | 102 | |
106 | | - //get requests |
| 103 | + // Get requests |
107 | 104 | $requests = getNewMessagesLink() . getRelationshipRequestLink() . getNewGiftLink() . getNewSystemGiftLink(); |
108 | 105 | |
109 | 106 | $output = ''; |
110 | 107 | if( $requests ){ |
111 | | - |
112 | | - $output .= "<div class=\"mp-requests\"> |
113 | | - <h3>".wfMsg('mp-requests-title')."</h3> |
114 | | - <div class=\"mp-requests-message\"> |
115 | | - ".wfMsg('mp-requests-message')." |
| 108 | + $output .= '<div class="mp-requests"> |
| 109 | + <h3>'.wfMsg( 'mp-requests-title' ).'</h3> |
| 110 | + <div class="mp-requests-message"> |
| 111 | + '.wfMsg( 'mp-requests-message' )." |
116 | 112 | </div> |
117 | 113 | $requests |
118 | 114 | </div>"; |
119 | | - |
120 | 115 | } |
121 | 116 | |
122 | 117 | return $output; |
123 | 118 | } |
124 | 119 | |
125 | 120 | function getRelationshipRequestLink(){ |
126 | | - global $wgUser, $IP, $wgUploadPath; |
127 | | - wfLoadExtensionMessages('UserWelcome'); |
128 | | - require_once("$IP/extensions/SocialProfile/UserRelationship/UserRelationshipClass.php"); |
129 | | - $friend_request_count = UserRelationship::getOpenRequestCount($wgUser->getID(), 1); |
130 | | - $foe_request_count = UserRelationship::getOpenRequestCount($wgUser->getID(), 2); |
131 | | - $relationship_request_link = Title::makeTitle(NS_SPECIAL, 'ViewRelationshipRequests'); |
| 121 | + global $wgUser, $wgScriptPath; |
| 122 | + wfLoadExtensionMessages( 'UserWelcome' ); |
| 123 | + $friend_request_count = UserRelationship::getOpenRequestCount( $wgUser->getID(), 1 ); |
| 124 | + $foe_request_count = UserRelationship::getOpenRequestCount( $wgUser->getID(), 2 ); |
| 125 | + $relationship_request_link = SpecialPage::getTitleFor( 'ViewRelationshipRequests' ); |
132 | 126 | |
133 | | - $rel_title = Title::makeTitle(NS_SPECIAL, 'ViewRelationshipRequests'); |
134 | | - $output = ""; |
| 127 | + $rel_title = SpecialPage::getTitleFor( 'ViewRelationshipRequests' ); |
| 128 | + $output = ''; |
135 | 129 | |
136 | 130 | if( $friend_request_count ){ |
137 | | - $output .= "<p> |
138 | | - <img src=\"{$wgUploadPath}/common/addedFriendIcon.png\" alt=\"\" border=\"0\"/> |
139 | | - <a href=\"".$relationship_request_link->escapeFullURL()."\" rel=\"nofollow\">".wfMsgExt('mp-request-new-friend', 'parsemag', $friend_request_count)."</a> |
140 | | - </p>"; |
| 131 | + $output .= '<p> |
| 132 | + <img src="'.$wgScriptPath.'/extensions/SocialProfile/images/addedFriendIcon.png" alt="" border="0" /> |
| 133 | + <a href="'.$relationship_request_link->escapeFullURL().'" rel="nofollow">' |
| 134 | + .wfMsgExt( 'mp-request-new-friend', 'parsemag', $friend_request_count ).'</a> |
| 135 | + </p>'; |
141 | 136 | } |
142 | 137 | |
143 | 138 | if( $foe_request_count ){ |
144 | | - $output .= "<p> |
145 | | - <img src=\"{$wgUploadPath}/common/addedFoeIcon.png\" alt=\"\" border=\"0\"/> |
146 | | - <a href=\"".$relationship_request_link->escapeFullURL()."\" rel=\"nofollow\">".wfMsgExt('mp-request-new-foe', 'parsemag', $foe_request_count)."</a> |
147 | | - </p>"; |
148 | | - } |
| 139 | + $output .= '<p> |
| 140 | + <img src="'.$wgScriptPath.'/extensions/SocialProfile/images/addedFoeIcon.png" alt="" border="0" /> |
| 141 | + <a href="'.$relationship_request_link->escapeFullURL().'" rel="nofollow">' |
| 142 | + .wfMsgExt( 'mp-request-new-foe', 'parsemag', $foe_request_count ).'</a> |
| 143 | + </p>'; |
| 144 | + } |
| 145 | + |
149 | 146 | return $output; |
150 | 147 | } |
151 | 148 | |
152 | 149 | function getNewGiftLink(){ |
153 | | - global $wgUser, $IP, $wgUploadPath; |
154 | | - wfLoadExtensionMessages('UserWelcome'); |
155 | | - require_once("$IP/extensions/SocialProfile/UserGifts/UserGiftsClass.php"); |
156 | | - $gift_count = UserGifts::getNewGiftCount($wgUser->getID()); |
157 | | - $gifts_title = Title::makeTitle(NS_SPECIAL, 'ViewGifts'); |
158 | | - $output = ""; |
| 150 | + global $wgUser, $wgScriptPath; |
| 151 | + wfLoadExtensionMessages( 'UserWelcome' ); |
| 152 | + $gift_count = UserGifts::getNewGiftCount( $wgUser->getID() ); |
| 153 | + $gifts_title = SpecialPage::getTitleFor( 'ViewGifts' ); |
| 154 | + $output = ''; |
159 | 155 | if( $gift_count ){ |
160 | | - $output .= "<p> |
161 | | - <img src=\"{$wgUploadPath}/common/icon_package_get.gif\" alt=\"\" border=\"0\"/> |
162 | | - <a href=\"".$gifts_title->escapeFullURL()."\" rel=\"nofollow\">".wfMsgExt('mp-request-new-gift', 'parsemag', $gift_count)."</a> |
163 | | - </p>"; |
| 156 | + $output .= '<p> |
| 157 | + <img src="'.$wgScriptPath.'/extensions/SocialProfile/images/icon_package_get.gif" alt="" border="0" /> |
| 158 | + <a href="'.$gifts_title->escapeFullURL().'" rel="nofollow">'.wfMsgExt( 'mp-request-new-gift', 'parsemag', $gift_count ).'</a> |
| 159 | + </p>'; |
164 | 160 | } |
165 | 161 | return $output; |
166 | 162 | } |
167 | 163 | |
168 | 164 | function getNewSystemGiftLink(){ |
169 | | - global $wgUser, $IP, $wgUploadPath; |
170 | | - wfLoadExtensionMessages('UserWelcome'); |
171 | | - require_once("$IP/extensions/SocialProfile/SystemGifts/UserSystemGiftsClass.php"); |
172 | | - $gift_count = UserSystemGifts::getNewSystemGiftCount($wgUser->getID()); |
173 | | - $gifts_title = Title::makeTitle(NS_SPECIAL, 'ViewSystemGifts'); |
174 | | - $output = ""; |
| 165 | + global $wgUser, $wgScriptPath; |
| 166 | + wfLoadExtensionMessages( 'UserWelcome' ); |
| 167 | + $gift_count = UserSystemGifts::getNewSystemGiftCount( $wgUser->getID() ); |
| 168 | + $gifts_title = SpecialPage::getTitleFor( 'ViewSystemGifts' ); |
| 169 | + $output = ''; |
175 | 170 | |
176 | 171 | if( $gift_count ){ |
177 | | - $output .= "<p> |
178 | | - <img src=\"{$wgUploadPath}/common/awardIcon.png\" alt=\"\" border=\"0\"/> |
179 | | - <a href=\"".$gifts_title->escapeFullURL()."\" rel=\"nofollow\">".wfMsgExt('mp-request-new-award', 'parsemag', $gift_count)."</a> |
180 | | - </p>"; |
| 172 | + $output .= '<p> |
| 173 | + <img src="'.$wgScriptPath.'/extensions/SocialProfile/images/awardIcon.png" alt="" border="0" /> |
| 174 | + <a href="'.$gifts_title->escapeFullURL().'" rel="nofollow">'.wfMsgExt( 'mp-request-new-award', 'parsemag', $gift_count ).'</a> |
| 175 | + </p>'; |
181 | 176 | } |
182 | 177 | |
183 | 178 | return $output; |
184 | 179 | } |
185 | 180 | |
186 | 181 | function getNewMessagesLink(){ |
187 | | - global $wgUser, $wgUploadPath; |
188 | | - wfLoadExtensionMessages('UserWelcome'); |
189 | | - $new_messages = UserBoard::getNewMessageCount($wgUser->getID()); |
| 182 | + global $wgUser, $wgScriptPath; |
| 183 | + wfLoadExtensionMessages( 'UserWelcome' ); |
| 184 | + $new_messages = UserBoard::getNewMessageCount( $wgUser->getID() ); |
190 | 185 | $output = ''; |
191 | 186 | if( $new_messages ){ |
192 | | - $board_link = Title::makeTitle(NS_SPECIAL, 'UserBoard'); |
193 | | - $output .= "<p> |
194 | | - <img src=\"{$wgUploadPath}/common/emailIcon.gif\" alt=\"email icon\" border=\"\"/> |
195 | | - <a href=\"".$board_link->escapeFullURL()."\" rel=\"nofollow\">".wfMsg('mp-request-new-message')."</a> |
196 | | - </p>"; |
| 187 | + $board_link = SpecialPage::getTitleFor( 'UserBoard' ); |
| 188 | + $output .= '<p> |
| 189 | + <img src="'.$wgScriptPath.'/extensions/SocialProfile/images/emailIcon.gif" alt="email icon" border="" /> |
| 190 | + <a href="'.$board_link->escapeFullURL().'" rel="nofollow">'.wfMsg( 'mp-request-new-message' ).'</a> |
| 191 | + </p>'; |
197 | 192 | } |
198 | 193 | return $output; |
199 | 194 | } |
Index: trunk/extensions/SocialProfile/UserProfile/UserProfile.css |
— | — | @@ -10,10 +10,10 @@ |
11 | 11 | visibility: hidden; |
12 | 12 | } |
13 | 13 | |
14 | | -.clearfix {display: inline-block;} |
| 14 | +.clearfix { display: inline-block; } |
15 | 15 | |
16 | 16 | /* Hides from IE-mac \*/ |
17 | | -* html .clearfix {height: 1%;} |
| 17 | +* html .clearfix { height: 1%; } |
18 | 18 | /* End hide from IE-mac */ |
19 | 19 | |
20 | 20 | .firstHeading { |
— | — | @@ -64,7 +64,7 @@ |
65 | 65 | } |
66 | 66 | |
67 | 67 | .user-section-heading { |
68 | | - background:url('http://images.wikia.com/common/wikiany/images/title_line.gif?1') repeat-x scroll 0px 80%; |
| 68 | + background:url('../images/title_line.gif') repeat-x scroll 0px 80%; |
69 | 69 | width:100%; |
70 | 70 | line-height:22px; |
71 | 71 | margin:0px 0px 8px 0px; |
Index: trunk/extensions/SocialProfile/images/editIcon.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/SocialProfile/images/editIcon.gif |
___________________________________________________________________ |
Name: svn:mime-type |
72 | 72 | + application/octet-stream |
Index: trunk/extensions/SocialProfile/images/emailIcon.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/SocialProfile/images/emailIcon.gif |
___________________________________________________________________ |
Name: svn:mime-type |
73 | 73 | + application/octet-stream |
Index: trunk/extensions/SocialProfile/images/addedFriendIcon.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SocialProfile/images/addedFriendIcon.png |
___________________________________________________________________ |
Name: svn:mime-type |
74 | 74 | + image/png |
Index: trunk/extensions/SocialProfile/images/icon_package_get.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/SocialProfile/images/icon_package_get.gif |
___________________________________________________________________ |
Name: svn:mime-type |
75 | 75 | + application/octet-stream |
Index: trunk/extensions/SocialProfile/images/addedFoeIcon.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SocialProfile/images/addedFoeIcon.png |
___________________________________________________________________ |
Name: svn:mime-type |
76 | 76 | + image/png |
Index: trunk/extensions/SocialProfile/images/awardIcon.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SocialProfile/images/awardIcon.png |
___________________________________________________________________ |
Name: svn:mime-type |
77 | 77 | + image/png |
Index: trunk/extensions/SocialProfile/images/title_line.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/SocialProfile/images/title_line.gif |
___________________________________________________________________ |
Name: svn:mime-type |
78 | 78 | + application/octet-stream |
Index: trunk/extensions/SocialProfile/images/challengeIcon.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SocialProfile/images/challengeIcon.png |
___________________________________________________________________ |
Name: svn:mime-type |
79 | 79 | + image/png |