AIM Extension
天下维客,你可以修改的网络知识库
| Template:If | |
| Type: | parser |
|---|---|
| Maturity: | Stable |
| MediaWiki: | 1.5. X |
| Version: | 1.0 |
| Last Update: | 1-29-2007 |
| Description: | Render AIM Button showing users online status |
| MediaWiki extensions | |
此 AIM 按钮将显示在 MediaWiki 的页面内
- 用法
- "
<aim>AIM-Username</aim>
"
请使用 Extension Talk:AIM 反馈
<?php
// (c) Jeffrey Phillips Freeman <freemo@gmail.com> & released to the public domain.
// WikiMedia AIM Extension Ver 1.0 (http://www.mediawiki.org/w/index.php?title=Extension:AIM)
//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>
// 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://meta.wikimedia.org/w/index.php?title=AIM_extension -->';
$output .= '<a href="aim:GoIM?screenname='.$input.'">'.$image.'</a>';
$output .= '<!-- end of AIM button -->';
// send the output to MediaWiki
return $output;
}
?>
[编辑]
安装
- 拷贝上面的代码生成一个文件 (例如:aim.php)
- 修改 $wgAimKey 为你的 AIM 代码 (在这里可以申请).
- 保存文件到mediawiki扩展文件夹
- 加入
include('extensions/aim.php');到 LocalSettings.php 的文件底部
[编辑]
举例
Cubic Path Wiki (run by the author of this extension)
[编辑]


