Skype extension: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
TheBigGuy (talk | contribs)
mNo edit summary
TheBigGuy (talk | contribs)
mNo edit summary
Line 3: Line 3:
|type = Parser extension
|type = Parser extension
|maturity = Release
|maturity = Release
|mediawiki = 1.5.5
|mediawiki = 1.5. X
|version = 1.0
|version = 1.1
|update = 11-05-2006
|update = 11-05-2006
|description = Render Skype Button showing users online status
|description = Render Skype Button showing users online status
Line 11: Line 11:
=Skype Button=
=Skype Button=
The Skype Button rendered inside MediaWiki using the simple syntax of<br/>
The Skype Button rendered inside MediaWiki using the simple syntax of<br/>
:"<code><nowiki><skype>user_name</skype></nowiki></code>"
:"<code><nowiki><skype style="style">user_name</skype></nowiki></code>"
<br />
<br />
'''Skype Privacy''': To enable your status to be shown online please select<br />
'''Skype Privacy''': To enable your status to be shown online please select<br />
Tools->Options->Privacy there is a button called "Allow my status to be shown on the web". Enable it
Tools->Options->Privacy there is a button called "Allow my status to be shown on the web". Enable it
<br />
<pre>
<?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;
}
?>
</pre>
== Installation ==
# Copy the code into a file (e.g. skype.php)
# Save the file in the ''extensions'' directory of your mediawiki folder
# Add the line <code>include('extensions/skype.php');</code> to the '''end''' of your LocalSettings.php file
Now you can use the extension with ''<skype>Skype-Username</skype>'' in the wiki

==Beta==
{{extension
|name = Skype Button
|type = Parser extension
|maturity = Beta
|mediawiki = 1.6.5
|version = 1.1
|update = 11-05-2006
|description = Render Skype Buttons showing users online status
}}
Allow the "balloon" or "Classic" design to be used using:
:"<code><nowiki><skype style="style_name">Skype-Username</skype></nowiki></code>"
<br />
<br />
see [[Talk:Skype_extension]] for more information on the beta
<br />
<br />
<pre>
<pre>
Line 115: Line 68:
return $output;
return $output;
}
}
?>
</pre>
== Installation ==
# Copy the code into a file (e.g. skype.php)
# Save the file in the ''extensions'' directory of your mediawiki folder
# Add the line <code>include('extensions/skype.php');</code> to the '''end''' of your LocalSettings.php file
Now you can use the extension with ''<skype>Skype-Username</skype>'' in the wiki

==Beta==
{{extension
|name = Skype Button
|type = Parser extension
|maturity = Beta
|mediawiki = 1.6. X
|version = 2.0
|update = 20-06-2006
|description = Render Skype Buttons showing users online status
}}
Allow the "call", "add" or "chat" actions to be used using:
:"<code><nowiki><skype style="style_name" action="action">Skype-Username</skype></nowiki></code>"
<br />
<br />
see [[Talk:Skype_extension]] for more information on the beta
<br />
<pre>
<?php

// MediaWiki Skype Extension Ver 2.0 (http://meta.wikimedia.org/wiki/Skype_extension)

// 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 or smallclassic)

$style_default = "bigclassic" ;
$action_default = "chat" ;
// the varibles are: <skype style="$argv['style']" action="$argv['action']">$input</skpye>

// 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( !($style == "add" OR $style == "chat" OR $style == "call" OR $style == "balloon" OR $style == "bigclassic" OR $style == "smallclassic") ){
$style = $style_default ;
}
} else {
$style = $style_default ;
}
if( isset( $argv['action'] ) ){
$action = $argv['action'] ;
if( !($action == "add" OR $action == "chat" OR $action == "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;

}
// start the rendering the html outupt

$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.'?'.$action.'">'.$image.'</a>';
$output .= '<!-- end of skype button -->';

// send the output to MediaWiki
return $output;
}
?>
?>
</pre>
</pre>

Revision as of 18:15, 20 June 2006

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

Skype Button

The Skype Button rendered inside MediaWiki using the simple syntax of

"<skype style="style">user_name</skype>"


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

<?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;
 }
?>

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 "call", "add" or "chat" actions to be used using:

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



see Talk:Skype_extension for more information on the beta

<?php

// MediaWiki Skype Extension Ver 2.0 (http://meta.wikimedia.org/wiki/Skype_extension)

// 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 or smallclassic)

	$style_default = "bigclassic" ;
	$action_default = "chat" ;
    
// the varibles are: <skype style="$argv['style']" action="$argv['action']">$input</skpye>

// 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( !($style == "add" OR $style == "chat" OR $style == "call" OR $style == "balloon" OR $style == "bigclassic" OR $style == "smallclassic") ){
			$style = $style_default ;
		}
	} else {
		$style = $style_default ;
	}
     
	if( isset( $argv['action'] ) ){
		$action = $argv['action'] ;
		if( !($action == "add" OR $action == "chat" OR $action == "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;

     }
     
// start the rendering the html outupt

     $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.'?'.$action.'">'.$image.'</a>';
     $output .= '<!-- end of skype button -->';

// send the output to MediaWiki
     return $output;
}
?>

User Submitted Variation

Template:Extension Allow user to define button action and associated button style. Valid actions are 'call','chat', and 'add'.

"<skype action="specified_action">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['action'] ) ){
          $skype_action = "call" ;
     } else {
          $skype_action = $argv['action'] ;
     }

     switch( $skype_action ){

          case "call":    
               $skype_width = 70 ;
               $skype_height = 23 ;
	       $skype_style="call_blue_transparent_70x23.png";
          break;

          case "add":
               $skype_width = 118 ;
               $skype_height = 23 ;
	       $skype_style="add_blue_transparent_118x23.png";
          break;

          case "chat":
               $skype_width = 97 ;
               $skype_height = 23 ;
	       $skype_style="chat_blue_transparent_97x23.png";
          break;

          default:
               $skype_action = "call" ;
               $skype_width = 70 ;
               $skype_height = 23 ;
	       $skype_style="call_blue_transparent_70x23.png";

     }


     $output = '<!-- Skype buttons 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.'?'.$skype_action.'">';
     $output .= '<img src="http://download.skype.com/share/skypebuttons/buttons/'.$skype_style.'" ' ;
     $output .= 'style="border: none; width: '.$skype_width.'px; height: '.$skype_height.'px;" alt="Skype me" 

/></a>';
     $output .= '<!-- end of skype button -->';

     return $output;
 }
?>