Skype extension: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
Line 62: Line 62:
<br />
<br />
<br />
<br />
see [[Talk:Skype_extension]] for more information on the beta
<br />
<br />
<br />
<pre>
<pre>

Revision as of 23:04, 16 May 2006

Hopefully a collection of Skype extensions. To start off with the Skype Button. Feel free to add, edit and talk

Skype Button

Template:Extension

The Skype Button rendered inside MediaWiki using the simple syntax of

"<skype>user_name</skype>"





<?php
  $wgExtensionFunctions[] = "wfskype";
 
 function wfSkype() {
     global $wgParser;
     $wgParser->setHook( "skype", "renderSkype" );
 }
 
 # The callback function for converting the input text to HTML output
 function renderSkype( $input, $argv ) {
     # $argv is an array containing any arguments passed to the extension like <example argument="foo" bar>..
     $output = '<!-- Skype "My status" button http://www.skype.com/go/skypebuttons -->';
     $output .= '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>';
     $output .= '<a href="skype:';
     $output .= $input ;
     $output .= '?call">';
     $output .= '<img src="http://mystatus.skype.com/bigclassic/';
     $output .= $input ;
     $output .= '" style="border: none;" width="182" height="44" alt="My status" /></a>';

     return $output;
 }
?>

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 include('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

Beta

Template:Extension Allow the "balloon" or "Classic" design to be used using:

"<skype style="style_name">Skype-Username</skype>"



see Talk:Skype_extension for more information on the beta

<?php
  $wgExtensionFunctions[] = "wfskype";
 
 function wfSkype() {
     global $wgParser;
     $wgParser->setHook( "skype", "renderSkype" );
 }
 
 # The callback function for converting the input text to HTML output
 function renderSkype( $input, $argv ) {

     if( !isset( $argv['style'] ) ){
          $skype_style = "bigclassic" ;
     } else {
          $skype_style = $argv['style'] ;
     }

     switch( $skype_style ){

          case "balloon":    
               $skype_width = 150 ;
	       $skype_height = 60 ;
          break;

          case "bigclassic":
               $skype_width = 182 ;
	       $skype_height = 44 ;
          break;

          case "smallclassic":
               $skype_width = 114 ;
	       $skype_height = 20 ;
          break;

	  default:
               $skype_style = "bigclassic" ;
               $skype_width = 182 ;
	       $skype_height = 44 ;

     }

     $output = '<!-- Skype "My status" button http://www.skype.com/go/skypebuttons -->';
     $output .= '<!-- MediaWiki extension http://meta.wikimedia.org/w/index.php?title=Skype_extension -->';
     $output .= '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>';
     $output .= '<a href="skype:'.$input.'?call">';
     $output .= '<img src="http://mystatus.skype.com/'.$skype_style.'/'.$input.'" ' ;
     $output .= 'style="border: none; width: '.$skype_width.'px; height: '.$skype_height.'px;" alt="My status" /></a>';
     $output .= '<!-- end of skype button -->';

     return $output;
 }
?>