Extension:Skype

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
Skype Button

Release status: unknown

Implementation Tag
Description Render Skype Button showing users online status
Author(s) Guy Taylor
Last Version 2.1a (2007-01-15)
MediaWiki 1.5.x
License No license specified
Download see below
Please Upgrade to 2.1a or above from all version to prevent a XSS attack
syntax
"<skype style="style_name" action="action">Skype-Username</skype>"
available styles
add, chat, call, balloon, bigclassic, smallclassic, smallicon, mediumicon
available actions
add, chat, call
Skype Privacy
To enable your status to be shown online please select
Tools->Options->Privacy there is a button called "Allow my status to be shown on the web". Enable it

see Extension talk:Skype for help

<?php
/**
 * Skype Extension Ver 2.1a
 * @author Guy Taylor
 * @copyright © 2007 Guy Taylor
 * @link http://www.mediawiki.org/wiki/Extension:Skype
 */
 
// Extension credits that show up on Special:Version
$wgExtensionCredits['parserhook'][] = array(
        'name' => 'Skype',
        'version' => '2.1a',
        'author' => 'Guy Taylor',
        'url' => 'http://www.mediawiki.org/wiki/Extension:Skype',
        'description' => 'Render Skype Button showing users online status.'
);
 
// set up MediaWiki to react to the "<skype>" tag
$wgExtensionFunctions[] = "wfSkype";
 
function wfSkype() {
        global $wgParser;
        $wgParser->setHook( "skype", "RenderSkype" );
}
 
 
// the function that reacts to "<skype>"
 
function RenderSkype( $input, $argv ) {
 
// set your defaults for the style and action (add, call or chat) (add, call, chat, ballon, bigclassic smallclassic, smallicon or mediumicon)
 
        $style_default = "bigclassic" ;
        $action_default = "chat" ;
 
// the varibles are: <skype style="$argv['style']" action="$argv['action']">$input</skpye>
 
// escape $input to prevent XSS
        $input = htmlspecialchars($input) ;
 
// test to see if the optinal elements of the tags are set and supported. if not set them to the defaults
 
        if( isset( $argv['style'] ) ){
                $style = $argv['style'] ;
                if ( ! in_array( $style, array( 'add' , 'chat', 'call', 'balloon', 'bigclassic', 'smallclassic', 'smallicon', 'mediumicon') ) ){
                        $style = $style_default ;
                }
        } else {
                $style = $style_default ;
        }
 
        if( isset( $argv['action'] ) ){
                $action = $argv['action'] ;
                if ( ! in_array( $action, array( 'add' , 'chat', 'call') ) ){
                        $action = $action_default ;
                }
        } else {
                $action = $action_default ;
        }
 
// set the url to the image and the stype of the image
        switch( $style ){
 
                case "add":
                        $image = '<img src="http://download.skype.com/share/skypebuttons/buttons/add_blue_transparent_118x23.png" ' ;
                        $image .= ' style="border: none; width: 118px; height: 23px;" alt="My status" />' ;
                break;
 
                case "chat":
                        $image = '<img src="http://download.skype.com/share/skypebuttons/buttons/chat_blue_transparent_97x23.png" ' ;
                        $image .= ' style="border: none; width: 97px; height: 23px;" alt="My status" />' ;
                break;
 
                case "call":
                        $image = '<img src="http://download.skype.com/share/skypebuttons/buttons/call_blue_transparent_70x23.png" ' ;
                        $image .= ' style="border: none; width: 70px; height: 23px;" alt="My status" />' ;
                break;
 
                case "balloon":
                        $image = '<img src="http://mystatus.skype.com/balloon/'.$input.'" ' ;
                        $image .= ' style="border: none; width: 150px; height: 60px;" alt="My status" />' ;
                break;
 
                case "bigclassic":
                        $image = '<img src="http://mystatus.skype.com/bigclassic/'.$input.'" ' ;
                        $image .= ' style="border: none; width: 182px; height: 44px;" alt="My status" />' ;
                break;
 
                case "smallclassic":
                        $image = '<img src="http://mystatus.skype.com/smallclassic/'.$input.'"' ;
                        $image .= ' style="border: none; width: 114px; height: 20px;" alt="My status" />' ;
                break;
                case "smallicon":
                        $image = '<img src="http://mystatus.skype.com/smallicon/'.$input.'"' ;
                        $image .= ' style="border: none; width: 16px; height: 16px;" alt="My status" />' ;
                break;
                case "mediumicon":
                        $image = '<img src="http://mystatus.skype.com/mediumicon/'.$input.'"' ;
                        $image .= ' style="border: none; width: 26px; height: 26px;" alt="My status" />' ;
                break;
     }
 
// start the rendering the html outupt
 
     $output  = '<!-- Skype "My status" button http://www.skype.com/go/skypebuttons -->';
     $output .= '<!-- MediaWiki extension http://www.mediawiki.org/wiki/Extension:Skype -->';
     $output .= '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>';
     $output .= '<a href="skype:'.$input.'?'.$action.'">'.$image.'</a>';
     $output .= '<!-- end of Skype button -->';
 
// send the output to MediaWiki
     return $output;
}

[edit] Installation

  1. Copy the code into a file (e.g. skype.php)
  2. Save the file in the extensions directory of your MediaWiki folder
  3. Add the line require_once('extensions/skype.php'); to the end of your LocalSettings.php file

Now you can use the extension with <skype>Skype-Username</skype> in the wiki

[edit] Example

See an example of this add-on in action at: Cubic Path Wiki (run by the author of the AIM extension)

[edit] Related extensions

Chat Extensions
AIM | ICQ | IM Status | Jabber | Skype | Yahoo
Personal tools