Index: trunk/extensions/IMStatus/IMStatus.php |
— | — | @@ -1,9 +1,7 @@ |
2 | 2 | <?php |
3 | | - |
4 | 3 | // Check to make sure we're actually in MediaWiki. |
5 | 4 | if (!defined('MEDIAWIKI')) die('This file is part of MediaWiki. It is not a valid entry point.'); |
6 | 5 | |
7 | | - |
8 | 6 | /********************************************************************* |
9 | 7 | * IM Status - A MediaWiki extension which add tags for status buttons |
10 | 8 | * for various IM programs (AIM, Google Talk, ICQ, Skype, Xfire, Yahoo) |
— | — | @@ -13,19 +11,19 @@ |
14 | 12 | * it under the terms of the GNU General Public License as published by |
15 | 13 | * the Free Software Foundation, either version 3 of the License, or |
16 | 14 | * (at your option) any later version. |
17 | | -* |
| 15 | +* |
18 | 16 | * This program is distributed in the hope that it will be useful, |
19 | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | 19 | * GNU General Public License for more details. |
22 | | -* |
| 20 | +* |
23 | 21 | * You should have received a copy of the GNU General Public License |
24 | 22 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
25 | 23 | *********************************************************************/ |
26 | 24 | |
27 | 25 | /********************* |
28 | 26 | * Special thanks to: |
29 | | -* - Jeffrey Phillips Freeman for his AIM extension (http://www.mediawiki.org/wiki/Extension:AIM), |
| 27 | +* - Jeffrey Phillips Freeman for his AIM extension (http://www.mediawiki.org/wiki/Extension:AIM), |
30 | 28 | * licensed in the Public domain and on which I based this extention. |
31 | 29 | * - Guy Taylor ("TheBigGuy"), who did a lot of work on various IM extensions (ICQ, Skype, also some work on AIM), |
32 | 30 | * which helped me to find out some style and action options... it's a pity I had to rewrite these codes from the AIM one |
— | — | @@ -41,11 +39,11 @@ |
42 | 40 | |
43 | 41 | $wgExtensionCredits['parserhook'][] = array( |
44 | 42 | 'name' => 'IM Status', |
45 | | - 'version' => '1.2', |
46 | | - 'author' => 'PatheticCockroach and various MediaWiki contributors', |
47 | | - 'url' => 'http://www.patheticcockroach.com/mpam4/index.php?p=78', |
| 43 | + 'version' => '1.3', |
| 44 | + 'author' => array( 'PatheticCockroach', 'various MediaWiki contributors' ), |
| 45 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:IM_Status', |
48 | 46 | 'description' => 'Adds tags to show various IM online status (AIM, Google Talk, ICQ, MSN/Live Messenger, Skype, Xfire, Yahoo)', |
49 | | - 'descriptionmsg' => 'imstatus_desc' |
| 47 | + 'descriptionmsg' => 'imstatus-desc' |
50 | 48 | ); |
51 | 49 | |
52 | 50 | //*********** MANDATORY parameters - start |
— | — | @@ -55,7 +53,7 @@ |
56 | 54 | //*********** MANDATORY parameters - end |
57 | 55 | |
58 | 56 | //Tag creation |
59 | | -$wgExtensionFunctions[] = "wfIMStatusPCR"; |
| 57 | +$wgExtensionFunctions[] = "wfIMStatusPCR"; |
60 | 58 | function wfIMStatusPCR() |
61 | 59 | { |
62 | 60 | global $wgParser; |
— | — | @@ -66,7 +64,6 @@ |
67 | 65 | $wgParser->setHook( "skype", "RenderSkype" ); |
68 | 66 | $wgParser->setHook( "xfire", "RenderXfire" ); |
69 | 67 | $wgParser->setHook( "yahoo", "RenderYahoo" ); |
70 | | - wfLoadExtensionMessages('IMStatus'); |
71 | 68 | } |
72 | 69 | |
73 | 70 | //NB: a nice list of styles and actions: http://cubicpath.syncleus.com/wiki/index.php/Cubicpath:Add-ons |
— | — | @@ -80,9 +77,9 @@ |
81 | 78 | $style_default = "presence"; |
82 | 79 | // the variables are: <aim style="$argv['style']">$input</aim> |
83 | 80 | // to get help as a user, use <aim help/> |
84 | | - |
| 81 | + |
85 | 82 | // sanitize input |
86 | | - $input = htmlspecialchars($input,ENT_QUOTES); |
| 83 | + $input = htmlspecialchars($input,ENT_QUOTES); |
87 | 84 | // get custom parameters |
88 | 85 | if( isset( $argv['style'] ) ) |
89 | 86 | { |
— | — | @@ -90,10 +87,12 @@ |
91 | 88 | if( !in_array( $style, array("presence", "api") ) ) $style = $style_default; |
92 | 89 | } |
93 | 90 | else $style = $style_default; |
94 | | - |
| 91 | + |
95 | 92 | // prepares output |
96 | 93 | if(isset($argv['help'])) |
97 | 94 | { |
| 95 | + wfLoadExtensionMessages('IMStatus'); |
| 96 | + |
98 | 97 | $output = '<div><span style="color:blue;">'. wfMsg("imstatus_syntax") .': <aim style="[style]">['. wfMsg("imstatus_your_name", "AIM") .']</aim></span>'; |
99 | 98 | $output .= '<ul><li>style: '. wfMsg("imstatus_style") .'. '. wfMsg("imstatus_possible_val") .': "presence" '. wfMsg("imstatus_or") .' "api". '. wfMsg("imstatus_default") .': '.$style_default.'.'; |
100 | 99 | $output .= '<ul><li>'. wfMsg("imstatus_aim_presence", ""presence"") .'</li>'; |
— | — | @@ -110,20 +109,19 @@ |
111 | 110 | $output = '<script type="text/javascript" src="http://o.aolcdn.com/aim/web-aim/aimapi.js"></script>'; |
112 | 111 | $output .= '<div id="AIMBuddyListContainer" wim_key="'.$wgAimKey_api.'"></div>'; |
113 | 112 | $output .= '<a href="nojavascript.html" onclick="AIM.widgets.IMMe.launch(\''.$input.'\'); return false;">'; |
114 | | - $output .= '<img src="http://api.oscar.aol.com/presence/icon?k='.$wgAimKey_presence.'&t='.$input.'" border="0"/>Send me an IM</a>'; |
| 113 | + $output .= '<img src="http://api.oscar.aol.com/presence/icon?k='.$wgAimKey_presence.'&t='.$input.'" border="0"/>Send me an IM</a>'; |
115 | 114 | break; |
116 | | - |
| 115 | + |
117 | 116 | default: |
118 | 117 | case "presence": |
119 | 118 | $output = '<a href="aim:GoIM?screenname='.$input.'"><img src="http://api.oscar.aol.com/presence/icon?k='.$wgAimKey_presence.'&t='.$input.'" border="0"/></a>'; |
120 | 119 | break; |
121 | 120 | } |
122 | | - } |
| 121 | + } |
123 | 122 | // sends output |
124 | 123 | return $output; |
125 | 124 | } |
126 | 125 | |
127 | | - |
128 | 126 | /********************************************** |
129 | 127 | * the function that reacts to "<gtalk>" |
130 | 128 | **********************************************/ |
— | — | @@ -138,10 +136,10 @@ |
139 | 137 | $height_max = 60; |
140 | 138 | // the varibles are: <gtalk width="$argv['width']" height="$argv['height']">$input</aim> |
141 | 139 | // to get help as a user, use <gtalk help/> |
142 | | - |
| 140 | + |
143 | 141 | // sanitize input |
144 | | - $input = htmlspecialchars($input,ENT_QUOTES); |
145 | | - |
| 142 | + $input = htmlspecialchars($input,ENT_QUOTES); |
| 143 | + |
146 | 144 | // get custom parameters |
147 | 145 | if(isset($argv['width'])) |
148 | 146 | { |
— | — | @@ -149,7 +147,7 @@ |
150 | 148 | if($width>$width_max || $width<$width_min) $width = $width_default; |
151 | 149 | } |
152 | 150 | else $width = $width_default; |
153 | | - |
| 151 | + |
154 | 152 | if(isset($argv['height'])) |
155 | 153 | { |
156 | 154 | $height = intval($argv['height']); |
— | — | @@ -160,21 +158,22 @@ |
161 | 159 | // prepares output |
162 | 160 | if(isset($argv['help'])) |
163 | 161 | { |
| 162 | + wfLoadExtensionMessages('IMStatus'); |
| 163 | + |
164 | 164 | $output = '<div><span style="color:blue;">'. wfMsg("imstatus_syntax") .': <gtalk width="[width]" height="[height]">['. wfMsg("imstatus_gtalk_code") .']</gtalk></span>'; |
165 | 165 | $output .= '<ul><li>width: '. wfMsg("imstatus_gtalk_width") .' '. wfMsg("imstatus_default") .':'.$width_default.'; '. wfMsg("imstatus_min") .':'.$width_min.'; '. wfMsg("imstatus_max") .':'.$width_max.'.</li>'; |
166 | 166 | $output .='<li>height: '. wfMsg("imstatus_gtalk_height") .' '. wfMsg("imstatus_default") .':'.$height_default.'; '. wfMsg("imstatus_min") .':'.$height_min.'; '. wfMsg("imstatus_max") .':'.$height_max.'.</li>'; |
167 | 167 | $output .= '<li>'. wfMsg("imstatus_gtalk_get_code", '<a href="http://www.google.com/talk/service/badge/New">Google Talk chatback badge</a>') .'</li></ul>'; |
168 | 168 | $output .= '<span style="color:green;">'. wfMsg("imstatus_example") .': <gtalk width="200" height="60">55gsrf9c1avkt0pub15rkiv9vs</gtalk></span></div>'; |
169 | | - } |
170 | | - else $output = '<iframe src="http://www.google.com/talk/service/badge/Show?tk='.$input.'&w='.$width.'&h='.$height.'" frameborder="0" allowtransparency="true" width="'.$width.'" height="'.$height.'"></iframe>'; |
| 169 | + } |
| 170 | + else $output = '<iframe src="http://www.google.com/talk/service/badge/Show?tk='.$input.'&w='.$width.'&h='.$height.'" frameborder="0" allowtransparency="true" width="'.$width.'" height="'.$height.'"></iframe>'; |
171 | 171 | // sends output |
172 | 172 | return $output; |
173 | 173 | } |
174 | 174 | |
175 | | - |
176 | 175 | /********************************************** |
177 | 176 | * the function that reacts to "<icq>" |
178 | | - ***********************************************/ |
| 177 | + ***********************************************/ |
179 | 178 | function RenderICQ( $input, $argv ) |
180 | 179 | { |
181 | 180 | // set your defaults for the style and action (0 to 26) (add) - NB: action is useless ATM (only one option...) |
— | — | @@ -203,10 +202,12 @@ |
204 | 203 | // prepares outupt |
205 | 204 | if(isset($argv['help'])) |
206 | 205 | { |
| 206 | + wfLoadExtensionMessages('IMStatus'); |
| 207 | + |
207 | 208 | $output = '<div><span style="color:blue;">'. wfMsg("imstatus_syntax") .': <icq style="[style]">['. wfMsg("imstatus_icq_id") .']</icq></span>'; |
208 | 209 | $output .= '<ul><li>style: '. wfMsg("imstatus_icq_style") .' '. wfMsg("imstatus_default") .': '.$style_default.'.</li></ul>'; |
209 | 210 | $output .= '<span style="color:green;">'. wfMsg("imstatus_example") .': <icq style="2">984231</icq></span></div>'; |
210 | | - } |
| 211 | + } |
211 | 212 | else $output = '<a href="http://www.icq.com/people/about_me.php?uin='.$input.'&action='.$action.'"><img src="http://status.icq.com/online.gif?icq='.$input.'&img='.$style.'" alt="ICQ status"/></a>'; |
212 | 213 | // sends output |
213 | 214 | return $output; |
— | — | @@ -222,9 +223,9 @@ |
223 | 224 | $style_default = "icon"; |
224 | 225 | // the variables are: <livemessenger style="$argv['style']">$input</livemessenger> |
225 | 226 | // to get help as a user, use <livemessenger help/> |
226 | | - |
| 227 | + |
227 | 228 | // sanitize input |
228 | | - $input = htmlspecialchars($input,ENT_QUOTES); |
| 229 | + $input = htmlspecialchars($input,ENT_QUOTES); |
229 | 230 | // get custom parameters |
230 | 231 | if(isset($argv['style'])) |
231 | 232 | { |
— | — | @@ -232,10 +233,12 @@ |
233 | 234 | if(!in_array($style,array("button","icon","window"))) $style = $style_default; |
234 | 235 | } |
235 | 236 | else $style = $style_default; |
236 | | - |
| 237 | + |
237 | 238 | // prepares output |
238 | 239 | if(isset($argv['help'])) |
239 | 240 | { |
| 241 | + wfLoadExtensionMessages('IMStatus'); |
| 242 | + |
240 | 243 | $output = '<div><span style="color:blue;">'. wfMsg("imstatus_syntax") .': <livemessenger style="[style]">['. wfMsg("imstatus_live_code") .']</livemessenger></span>'; |
241 | 244 | $output .= '<ul><li>style: "button", "icon" '. wfMsg("imstatus_or") .' "window". '. wfMsg("imstatus_default") .': '.$style_default.'.</li>'; |
242 | 245 | $output .= '<li>'. wfMsg("imstatus_live_get_code", "http://settings.messenger.live.com/applications/CreateHtml.aspx", "invitee=", "@apps.messenger") .'</li></ul>'; |
— | — | @@ -255,14 +258,14 @@ |
256 | 259 | $output .= 'msgr:foreColor="#424542" msgr:conversationUrl="http://settings.messenger.live.com/Conversation/IMMe.aspx?invitee='.$input.'@apps.messenger.live.com&mkt=en-US"></div>'; |
257 | 260 | $output .= '<script type="text/javascript" src="http://messenger.services.live.com/users/'.$input.'@apps.messenger.live.com/presence?mkt=en-US&cb=Microsoft_Live_Messenger_PresenceButton_onPresence"></script>'; |
258 | 261 | break; |
259 | | - |
| 262 | + |
260 | 263 | case "icon": |
261 | 264 | default: |
262 | 265 | $output = '<a target="_blank" href="http://settings.messenger.live.com/Conversation/IMMe.aspx?invitee='.$input.'@apps.messenger.live.com&mkt=en-US">'; |
263 | 266 | $output .= '<img style="border-style: none;" src="http://messenger.services.live.com/users/'.$input.'@apps.messenger.live.com/presenceimage?mkt=en-US" width="16" height="16"/></a>'; |
264 | 267 | break; |
265 | 268 | } |
266 | | - } |
| 269 | + } |
267 | 270 | // sends output |
268 | 271 | return $output; |
269 | 272 | } |
— | — | @@ -270,15 +273,15 @@ |
271 | 274 | |
272 | 275 | /********************************************** |
273 | 276 | * the function that reacts to "<skype>" |
274 | | - ***********************************************/ |
| 277 | + ***********************************************/ |
275 | 278 | function RenderSkype( $input, $argv ) |
276 | | -{ |
| 279 | +{ |
277 | 280 | // set your defaults for the style and action (add, call, chat, sendfile, userinfo orvoicemail) (same + ballon, bigclassic smallclassic, smallicon or mediumicon) - options crawled from http://www.skype.com/share/buttons/ |
278 | 281 | $style_default = "smallclassic"; |
279 | 282 | $action_default = "chat"; |
280 | 283 | // the varibles are: <skype style="$argv['style']" action="$argv['action']">$input</skpye> |
281 | 284 | // to get help as a user, use <skype help/> |
282 | | - |
| 285 | + |
283 | 286 | // sanitize input |
284 | 287 | $input = htmlspecialchars($input,ENT_QUOTES); |
285 | 288 | // get custom parameters |
— | — | @@ -291,7 +294,7 @@ |
292 | 295 | } |
293 | 296 | } |
294 | 297 | else $style = $style_default; |
295 | | - |
| 298 | + |
296 | 299 | // if style is an action style, action should match it! |
297 | 300 | if(in_array($style, array("add","chat","call","sendfile","userinfo","voicemail"))) $action = $style; |
298 | 301 | else if(isset($argv['action'])) |
— | — | @@ -300,7 +303,7 @@ |
301 | 304 | if (!in_array($action, array("add","chat","call","sendfile","userinfo","voicemail"))) $action = $action_default; |
302 | 305 | } |
303 | 306 | else $action = $action_default; |
304 | | - |
| 307 | + |
305 | 308 | // creates image code |
306 | 309 | switch($style) |
307 | 310 | { |
— | — | @@ -315,7 +318,7 @@ |
316 | 319 | case "call": |
317 | 320 | $image = '<img src="http://download.skype.com/share/skypebuttons/buttons/call_blue_transparent_70x23.png" style="border: none;" width="70" height="23" alt="Skype Me"/>'; |
318 | 321 | break; |
319 | | - |
| 322 | + |
320 | 323 | case "sendfile": |
321 | 324 | $image = '<img src="http://download.skype.com/share/skypebuttons/buttons/sendfile_blue_transparent_98x23.png" style="border: none;" width="98" height="23" alt="Send me a file"/>'; |
322 | 325 | break; |
— | — | @@ -339,27 +342,29 @@ |
340 | 343 | case "smallclassic": |
341 | 344 | $image = '<img src="http://mystatus.skype.com/smallclassic/'.$input.'" style="border: none;" width="114" height="20" alt="My status"/>'; |
342 | 345 | break; |
343 | | - |
| 346 | + |
344 | 347 | case "smallicon": |
345 | 348 | $image = '<img src="http://mystatus.skype.com/smallicon/'.$input.'" style="border: none;" width="16" height="16" alt="My status"/>'; |
346 | 349 | break; |
347 | | - |
| 350 | + |
348 | 351 | case "mediumicon": |
349 | 352 | default: |
350 | 353 | $image = '<img src="http://mystatus.skype.com/mediumicon/'.$input.'" style="border: none;" width="26" height="26" alt="My status"/>'; |
351 | 354 | break; |
352 | 355 | } |
353 | | - |
| 356 | + |
354 | 357 | // prepares outupt |
355 | 358 | if(isset($argv['help'])) |
356 | 359 | { |
| 360 | + wfLoadExtensionMessages('IMStatus'); |
| 361 | + |
357 | 362 | $output = '<div><span style="color:blue;">'. wfMsg("imstatus_syntax") .': <skype style="[style]" action="[action]">['. wfMsg("imstatus_your_name", "Skype") .']</skype></span>'; |
358 | 363 | $output .= '<ul><li>style: '. wfMsg("imstatus_style") .'. '. wfMsg("imstatus_default") .': '.$style_default.'. '. wfMsg("imstatus_possible_val") .': "add","chat","call","sendfile","userinfo","voicemail","balloon","bigclassic","smallclassic","smallicon","mediumicon".</li>'; |
359 | 364 | $output .= '<li>action: '. wfMsg("imstatus_action") .'. '. wfMsg("imstatus_default") .': '.$action_default.'. '. wfMsg("imstatus_possible_val") .': "add","chat","call","sendfile","userinfo","voicemail".</li></ul>'; |
360 | 365 | $output .= wfMsg("imstatus_details_saa", '<a href="http://www.skype.com/share/buttons/wizard.html">Skype button wizard</a>'). '<br/>'; |
361 | 366 | $output .= wfMsg("imstatus_skype_nbstyle") .'<br/>'; |
362 | 367 | $output .= '<span style="color:green;">'. wfMsg("imstatus_example") .': <skype style="mediumicon" action="chat">PatheticCockroach</skype></span></div>'; |
363 | | - } |
| 368 | + } |
364 | 369 | else |
365 | 370 | { |
366 | 371 | $output = '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>'; |
— | — | @@ -381,9 +386,9 @@ |
382 | 387 | $action_default = "add"; |
383 | 388 | // the variables are: <xfire size="$argv['size']" style="$argv['style']" action="$argv['action']">$input</xfire> |
384 | 389 | // to get help as a user, use <xfire help/> |
385 | | - |
| 390 | + |
386 | 391 | // sanitize input |
387 | | - $input = htmlspecialchars($input,ENT_QUOTES); |
| 392 | + $input = htmlspecialchars($input,ENT_QUOTES); |
388 | 393 | // get custom parameters |
389 | 394 | if(isset($argv['size'])) |
390 | 395 | { |
— | — | @@ -398,7 +403,7 @@ |
399 | 404 | if (!in_array($style, array("bg","sh","co","sf","os","wow"))) $style = $style_default; |
400 | 405 | } |
401 | 406 | else $style = $style_default; |
402 | | - |
| 407 | + |
403 | 408 | if(isset($argv['action'])) |
404 | 409 | { |
405 | 410 | $action = $argv['action']; |
— | — | @@ -413,14 +418,14 @@ |
414 | 419 | $alt_txt = "View my Xfire profile"; |
415 | 420 | $link_url = "http://profile.xfire.com/".$input; |
416 | 421 | break; |
417 | | - |
| 422 | + |
418 | 423 | case "add": |
419 | 424 | default: |
420 | 425 | $alt_txt = "Add me to Xfire"; |
421 | 426 | $link_url = "xfire:add_friend?user=".$input; |
422 | 427 | break; |
423 | 428 | } |
424 | | - |
| 429 | + |
425 | 430 | // set size and style of the image |
426 | 431 | switch($size) |
427 | 432 | { |
— | — | @@ -436,41 +441,43 @@ |
437 | 442 | case 3: |
438 | 443 | $image = '<img src="http://miniprofile.xfire.com/bg/'.$style.'/type/3/'.$input.'.png" style="border: none;" width="149" height="29" alt="'.$alt_txt.'"/>'; |
439 | 444 | break; |
440 | | - |
| 445 | + |
441 | 446 | case 4: |
442 | 447 | default: |
443 | 448 | $image = '<img src="http://miniprofile.xfire.com/bg/'.$style.'/type/4/'.$input.'.png" style="border: none;" width="16" height="16" alt="'.$alt_txt.'"/>'; |
444 | 449 | break; |
445 | 450 | } |
446 | | - |
| 451 | + |
447 | 452 | // prepares outupt |
448 | 453 | if(isset($argv['help'])) |
449 | 454 | { |
| 455 | + wfLoadExtensionMessages('IMStatus'); |
| 456 | + |
450 | 457 | $output = '<div><span style="color:blue;">'. wfMsg("imstatus_syntax") .': <xfire size="[size]" style="[style]" action="[action]">['. wfMsg("imstatus_your_name", "Xfire") .']</xfire></span>'; |
451 | 458 | $output .= '<ul><li>size: '. wfMsg("imstatus_xfire_size", "0", "4") .' '. wfMsg("imstatus_default") .': '.$size_default.'.</li>'; |
452 | 459 | $output .= '<li>style: '. wfMsg("imstatus_style") .'. '. wfMsg("imstatus_default") .': '.$style_default.'. '. wfMsg("imstatus_possible_val") .': "bg","sh","co","sf","os","wow".</li>'; |
453 | 460 | $output .= '<li>action: '. wfMsg("imstatus_action") .'. '. wfMsg("imstatus_default") .': '.$action_default.'. '. wfMsg("imstatus_possible_val") .': "add","profile".</li></ul>'; |
454 | 461 | $output .= wfMsg("imstatus_details_saa", '<a href="http://www.xfire.com/miniprofile/">Xfire - Miniprofile Instructions</a>') .'<br/>'; |
455 | 462 | $output .= '<span style="color:green;">'. wfMsg("imstatus_example") .': <xfire size="3" style="bg" action="add">PatheticCockroach</xfire></span></div>'; |
456 | | - } |
457 | | - else $output = '<a href="'.$link_url.'">'.$image.'</a>'; |
| 463 | + } |
| 464 | + else $output = '<a href="'.$link_url.'">'.$image.'</a>'; |
458 | 465 | // sends output |
459 | 466 | return $output; |
460 | 467 | } |
461 | 468 | |
462 | | - |
| 469 | + |
463 | 470 | /********************************************** |
464 | 471 | * the function that reacts to "<yahoo>" |
465 | | - ***********************************************/ |
| 472 | + ***********************************************/ |
466 | 473 | function RenderYahoo( $input, $argv ) |
467 | | -{ |
| 474 | +{ |
468 | 475 | // set your defaults for the action and style (addfriend, call or sendim) (0, 1, 2, 3 and 4) - options crawled from http://geocities.yahoo.com/v/ao/pre.html |
469 | 476 | $style_default = 2; |
470 | 477 | $action_default = "sendim"; // DO NOT enter an invalid value, since this value may be used as is in the final output -> TODO: use a switch to sanitize this one |
471 | 478 | // the variables are: <yahoo style="$argv['style']" action="$argv['action']">$input</yahoo> |
472 | 479 | |
473 | 480 | // sanitize input |
474 | | - $input = htmlspecialchars($input,ENT_QUOTES); |
| 481 | + $input = htmlspecialchars($input,ENT_QUOTES); |
475 | 482 | // get custom parameters |
476 | 483 | if(isset($argv['style'])) |
477 | 484 | { |
— | — | @@ -495,7 +502,7 @@ |
496 | 503 | case "call": |
497 | 504 | $alt_txt = "Call me"; |
498 | 505 | break; |
499 | | - |
| 506 | + |
500 | 507 | case "sendim": |
501 | 508 | default: |
502 | 509 | $alt_txt = "Send me an IM"; |
— | — | @@ -504,26 +511,26 @@ |
505 | 512 | // set image style |
506 | 513 | switch( $style ) |
507 | 514 | { |
508 | | - case 0: |
| 515 | + case 0: |
509 | 516 | $image = '<img src="http://opi.yahoo.com/online?u='.$input.'&m=g&t=0" style="border: none; width: 12px; height: 12px;" alt="'.$alt_txt.'" />'; |
510 | 517 | break; |
511 | 518 | |
512 | | - case 1: |
| 519 | + case 1: |
513 | 520 | $image = '<img src="http://opi.yahoo.com/online?u='.$input.'&m=g&t=1" style="border: none; width: 64px; height: 16px;" alt="'.$alt_txt.'" />'; |
514 | 521 | break; |
515 | 522 | |
516 | | - case 2: |
| 523 | + case 2: |
517 | 524 | $image = '<img src="http://opi.yahoo.com/online?u='.$input.'&m=g&t=2" style="border: none; width: 125px; height: 25px;" alt="'.$alt_txt.'" />'; |
518 | 525 | break; |
519 | 526 | |
520 | | - case 3: |
| 527 | + case 3: |
521 | 528 | $image = '<img src="http://opi.yahoo.com/online?u='.$input.'&m=g&t=3" style="border: none; width: 86px; height: 16px;" alt="'.$alt_txt.'" />'; |
522 | 529 | break; |
523 | 530 | |
524 | 531 | case 4: |
525 | 532 | $image = '<img src="http://opi.yahoo.com/online?u='.$input.'&m=g&t=4" style="border: none; width: 12px; height: 12px;" alt="'.$alt_txt.'" />'; |
526 | 533 | break; |
527 | | - |
| 534 | + |
528 | 535 | case 5: |
529 | 536 | default: |
530 | 537 | $image = '<img src="http://opi.yahoo.com/online?u='.$input.'&m=g&t=5" style="border: none; width: 12px; height: 12px;" alt="'.$alt_txt.'" />'; |
— | — | @@ -533,16 +540,15 @@ |
534 | 541 | // prepares outupt |
535 | 542 | if(isset($argv['help'])) |
536 | 543 | { |
| 544 | + wfLoadExtensionMessages('IMStatus'); |
| 545 | + |
537 | 546 | $output = '<div><span style="color:blue;">'. wfMsg("imstatus_syntax") .': <yahoo style="[style]" action="[action]">['. wfMsg("imstatus_your_name", "Yahoo") .']</xfire></span>'; |
538 | 547 | $output .= '<ul><li>style: '. wfMsg("imstatus_yahoo_style", "0", "2", "3", "4") .' '. wfMsg("imstatus_default") .': '.$style_default.'.</li>'; |
539 | 548 | $output .= '<li>action: '. wfMsg("imstatus_action") .'. '. wfMsg("imstatus_default") .': '.$action_default.'. '. wfMsg("imstatus_possible_val") .': "addfriend","call","sendim".</li></ul>'; |
540 | 549 | $output .= wfMsg("imstatus_details_saa", '<a href="http://geocities.yahoo.com/v/ao/pre.html">Yahoo! Presence</a>') .'<br/>'; |
541 | 550 | $output .= '<span style="color:green;">'. wfMsg("imstatus_example") .': <yahoo style="2" action="sendim">PatheticCockroach</yahoo></span></div>'; |
542 | | - } |
| 551 | + } |
543 | 552 | else $output = '<a href="ymsgr:'.$action.'?'.$input.'">'.$image.'</a>'; |
544 | 553 | // sends output |
545 | 554 | return $output; |
546 | 555 | } |
547 | | - |
548 | | - |
549 | | -?> |
\ No newline at end of file |
Index: trunk/extensions/IMStatus/about.txt |
— | — | @@ -17,8 +17,6 @@ |
18 | 18 | 2. Put IMStatus.php in your extensions folder (or in a subdirectory of it, as you want) |
19 | 19 | 3. Add the following code at the end of LocalSettings.php: |
20 | 20 | require_once( $IP."/extensions/IM/IMStatus.php"); |
21 | | -4. (optional) For additional locales, grab the latest revision of IMStatus.i18n.php on: |
22 | | - http://www.mediawiki.org/wiki/Extension:IM_Status/IMStatus.i18n.php |
23 | 21 | |
24 | 22 | Usage: |
25 | 23 | Once installed, the extension adds the following tags: |
Index: trunk/extensions/IMStatus/IMStatus.i18n.php |
— | — | @@ -4,11 +4,11 @@ |
5 | 5 | * |
6 | 6 | * @ingroup Extensions |
7 | 7 | */ |
8 | | - |
| 8 | + |
9 | 9 | $messages = array(); |
10 | | - |
| 10 | + |
11 | 11 | $messages['en'] = array( |
12 | | - 'imstatus_desc' => 'Adds tags to show various IM online status (AIM, Google Talk, ICQ, MSN/Live Messenger, Skype, Xfire, Yahoo)', |
| 12 | + 'imstatus-desc' => 'Adds tags to show various IM online status (AIM, Google Talk, ICQ, MSN/Live Messenger, Skype, Xfire, Yahoo)', |
13 | 13 | 'imstatus_syntax' => 'Syntax', |
14 | 14 | 'imstatus_default' => 'Default', |
15 | 15 | 'imstatus_example' => 'Example', |
— | — | @@ -20,30 +20,32 @@ |
21 | 21 | 'imstatus_action' => 'action when the button is clicked', |
22 | 22 | 'imstatus_details_saa' => 'For more details about all the styles and actions, see $1.', |
23 | 23 | 'imstatus_your_name' => 'your $1 name', |
24 | | - |
25 | | - 'imstatus_aim_presence' => '$1 shows your status with a link that will launch AIM (provided the user has it installed) to send you an IM.', |
| 24 | + |
| 25 | + 'imstatus_aim_presence' => '$1 shows your status with a link that will launch AIM to send you an IM, provided the user has it installed.', |
26 | 26 | 'imstatus_aim_api' => '$1 shows your status with a link that will launch a <b>browser</b>, javascript version of AIM to send you an IM.', |
27 | | - |
| 27 | + |
28 | 28 | 'imstatus_gtalk_code' => 'your google talk code', |
29 | 29 | 'imstatus_gtalk_get_code' => 'your google talk code: get it at $1.', |
30 | | - 'imstatus_gtalk_height' => 'height of the box, in pixel.', |
31 | | - 'imstatus_gtalk_width' => 'width of the box, in pixel.', |
32 | | - |
33 | | - 'imstatus_icq_id' => 'your ICQ id', |
| 30 | + 'imstatus_gtalk_height' => 'height of the box, in pixels.', |
| 31 | + 'imstatus_gtalk_width' => 'width of the box, in pixels.', |
| 32 | + |
| 33 | + 'imstatus_icq_id' => 'your ICQ ID', |
34 | 34 | 'imstatus_icq_style' => 'a number ranging from 0 to 26 (yes, there are 27 available styles...).', |
35 | | - |
| 35 | + |
36 | 36 | 'imstatus_live_code' => 'your Live Messenger website id', |
37 | | - 'imstatus_live_get_code' => 'your Live Messenger website id: <strong>this is not your e-mail address</strong>, you need to generate one in |
38 | | -<a href="$1">your live messenger options</a>. The id you need to provide is the numbers and letters between "$2" and "$3".', |
39 | | - |
40 | | - 'imstatus_skype_nbstyle' => 'NB: if you choose a style which is also an action, your action choice will be overridden by the action matching your chosen style.', |
41 | | - |
| 37 | + 'imstatus_live_get_code' => 'your Live Messenger website id: <strong>this is not your e-mail address</strong>, you need to generate one in |
| 38 | +<a href="$1">your live messenger options</a>. |
| 39 | +The id you need to provide is the numbers and letters between "$2" and "$3".', |
| 40 | + |
| 41 | + 'imstatus_skype_nbstyle' => 'Note: If you choose a style which is also an action, your action choice will be overridden by the action matching your chosen style.', |
| 42 | + |
42 | 43 | 'imstatus_xfire_size' => 'the button size, from $1 (biggest) to $2 (smallest).', |
43 | | - |
| 44 | + |
44 | 45 | 'imstatus_yahoo_style' => 'the button style, from $1 (smallest) to $2 (biggest), $3 and $4 are for voicemail.', |
45 | 46 | ); |
| 47 | + |
46 | 48 | $messages['de'] = array( |
47 | | - 'imstatus_desc' => 'F�gt Tags hinzu um den Online-Status verschiedener Instant-Messenger anzuzeigen (AIM, Google Talk, ICQ, MSN/Live Messenger, Skype, Xfire, Yahoo)', |
| 49 | + 'imstatus-desc' => 'F�gt Tags hinzu um den Online-Status verschiedener Instant-Messenger anzuzeigen (AIM, Google Talk, ICQ, MSN/Live Messenger, Skype, Xfire, Yahoo)', |
48 | 50 | 'imstatus_syntax' => 'Syntax', |
49 | 51 | 'imstatus_default' => 'Standard', |
50 | 52 | 'imstatus_example' => 'Beispiel', |
— | — | @@ -55,25 +57,24 @@ |
56 | 58 | 'imstatus_action' => 'Aktion beim klicken des Buttons', |
57 | 59 | 'imstatus_details_saa' => 'F�r mehr Details zu den Stilen und Aktionen, siehe $1.', |
58 | 60 | 'imstatus_your_name' => 'dein $1 Name', |
59 | | - |
| 61 | + |
60 | 62 | 'imstatus_aim_presence' => '$1 zeigt deinen Status mit einem Link der AIM startet (wenn er es installiert hat) um dir eine Nachricht zu senden.', |
61 | 63 | 'imstatus_aim_api' => '$1 zeigt deinen Status mit einem Link der eine <b>Browser</b>, JavaScript Version von AIM startet um die eine nachricht zu senden.', |
62 | | - |
| 64 | + |
63 | 65 | 'imstatus_gtalk_code' => 'dein Google-Talk Code', |
64 | 66 | 'imstatus_gtalk_get_code' => 'dein Google-Talk Code kriegst du bei $1.', |
65 | 67 | 'imstatus_gtalk_height' => 'H�he der Box in Pixel.', |
66 | 68 | 'imstatus_gtalk_width' => 'Breite der Box in Pixel.', |
67 | | - |
| 69 | + |
68 | 70 | 'imstatus_icq_id' => 'deine ICQ-UIN', |
69 | 71 | 'imstatus_icq_style' => 'eine Zahl zwischen 0 und 26 (ja, es gibt 27 verschiedene Styles...).', |
70 | | - |
| 72 | + |
71 | 73 | 'imstatus_live_code' => 'deine Live Messenger Website Id', |
72 | 74 | 'imstatus_live_get_code' => 'deine Live Messenger Website Id: <strong>das ist nicht deine E-Mail-Adresse</strong>, du musst die eine in <a href="$1">deinen Live Messenger Optionen</a> generieren. Die Id die du ben�tigst sind die Zahlen und Buchstaben zwischen "$2" und "$3".', |
73 | | - |
| 75 | + |
74 | 76 | 'imstatus_skype_nbstyle' => 'NB: wenn du einen Style aussuchst der auch eine Aktion beinhaltet wird deine Aktions-Auswahl durch die Aktions des Styles ersetzt.', |
75 | | - |
| 77 | + |
76 | 78 | 'imstatus_xfire_size' => 'die Gr��e des Buttons, von $1 (gr��te) bis $2 (kleinste).', |
77 | | - |
| 79 | + |
78 | 80 | 'imstatus_yahoo_style' => 'der Stil des Buttons, von $1 (kleinste) bis $2 (gr��te), $3 und $4 sind f�r Voicemail.', |
79 | 81 | ); |
80 | | -?> |
\ No newline at end of file |