Extension:AIM

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
AIM Button

Release status: stable

Implementation Tag, MyWiki
Description Embeds a button showing users online status and providing access to a popup chat window.
Author(s) Jeffrey Phillips Freeman
Last version 1.0a (2007-05-07)
MediaWiki 1.5. X
License Public domain
Download see below
Example Syncleus Technology Wiki or Cubic Path Wiki

Check usage (experimental)

Please Upgrade to 1.0a or above from all version to prevent an XSS attack


AIM extension embeds a button showing users online AIM status. When clicked, a popup AIM chat window appears.

Contents

[edit] Usage

To embed an AIM Button inside a MediaWiki article

syntax
"<aim>AIM-Username</aim>"

Use Extension talk:AIM to report issues or ask for help

[edit] Installation

  1. Copy the code into a file (e.g. aim.php)
  2. Change $wgAimKey to your AIM key (get an AIM key here).
  3. Save the file in the extensions directory of your MediaWiki folder
  4. Add the line require_once('extensions/aim.php'); to the end of your LocalSettings.php file

Now you can use the extension with <aim>AIM-Username</aim> in the wiki


[edit] Code

<?php
 
// (c) Jeffrey Phillips Freeman <freemo@gmail.com> & released to the public domain.
 
// MediaWiki AIM Extension Ver 1.0a (http://www.mediawiki.org/wiki/Extension:AIM)
 
$wgExtensionCredits['parserhook'][] = array(
        'name' => 'AIM',
        'version' => '1.0a',
        'author' => 'Jeffrey Phillips Freeman',
        'url' => 'http://www.mediawiki.org/wiki/Extension:AIM',
        'description' => 'Embeds a button showing users online AIM status'
);
 
//setup default varibles
$wgAimKey = 'AIM_KEY_HERE';
 
// set up MediaWiki to react to the "<aim>" tag
$wgExtensionFunctions[] = "wfAIM";
 
function wfAIM() {
        global $wgParser;
        $wgParser->setHook( "aim", "RenderAIM" );
}
 
 
// the function that reacts to "<aim>"
 
function RenderAIM( $input, $argv ) {
 
// set your defaults for the style and action (0 to 26) (add)
 
        $style_default = "0" ;
        $action_default = "sendim" ;
 
// the varibles are: <aim style="$argv['style']" action="$argv['action']">$input</aim>
 
// 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( !($style >= "0" AND $style <= "0") ){
                        $style = $style_default ;
                }
        } else {
                $style = $style_default ;
        }
 
        if( isset( $argv['action'] ) ){
                $action = $argv['action'] ;
                if( !($action == "sendim") ){
                        $action = $action_default ;
                }
        } else {
                $action = $action_default ;
        }
 
// set the url to the image and the stype of the image
global $wgAimKey;
$image = '<img src="http://api.oscar.aol.com/SOA/key='.$wgAimKey.'/presence/'.$input.'" border="0"/> ' ;
 
// start the rendering the html outupt
     $output  = '<!-- MediaWiki extension http:/www.mediawiki.org/wiki/Extension:AIM -->';
     $output .= '<a href="aim:GoIM?screenname='.$input.'">'.$image.'</a>';
     $output .= '<!-- end of AIM button -->';
 
// send the output to MediaWiki
     return $output;
}

[edit] Related extensions

Chat Extensions AIM · ICQ · IM Status · Jabber · Skype · Yahoo
Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox