<?php
class xpwiki_plugin_chat extends xpwiki_plugin {
	function plugin_chat_init () {



	}
	//
	// $Id: chat.inc.php,v 1.0 2005/10/01 11:33:03 nao-pon Exp $
	//
	
	function plugin_chat_convert()
	{
		// ajaxchat.htm があるディレクトリのURL
		// modules/pukiwiki/ からの相対パスでも可
		// 末尾に / が必要。
		
		$url = "./private/ajchat/";
		
		// ↑↑ 必ず環境に合わせて指定してください。
		
		
	//	global $pgid,$vars;
		$_pgid = $this->root->pgid;
		if (!$_pgid) $_pgid = $this->func->get_pgid_by_name($this->root->vars["page"]);
		
		$stay = "";
		$height = "350";
		foreach(func_get_args() as $cmd)
		{
			if (substr(strtolower($cmd),0,9) == "staypos:r"){$stay = "&amp;staypos=r";}
			if (preg_match("/height:([\d]+)(px)?/i",$cmd,$arg))
			{
				$height = max(min($arg[1],500),150);
			}
		}
		
		return ($_pgid)? '<iframe src="'.$url.'ajaxchat.htm?id=100'.$_pgid.$stay.'" width="100%" height="'.$height.'" style="border:none;" frameborder="0" border="0" allowtransparency="true" scrolling="no"></iframe>' : 'システムエラーのためチャット窓が表示できません。';
	}
}
?>