* u2b.inc.php Copyright © 2006, Katsumi Saito * @version version 0.3 * @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ if (!defined('USTREAM_DEFAULT_MENU_HEIGHT')) { define('USTREAM_DEFAULT_MENU_HEIGHT', 26); } if (!defined('USTREAM_DEFAULT_WIDTH')) { define('USTREAM_DEFAULT_WIDTH', 480); } if (!defined('USTREAM_DEFAULT_HEIGHT')) { define('USTREAM_DEFAULT_HEIGHT', 360+USTREAM_DEFAULT_MENU_HEIGHT); } if (!defined('USTREAM_DEFAULT_ALIGN')) { define('USTREAM_DEFAULT_ALIGN', 'center'); } if (!defined('USTREAM_DEFAULT_AUTOPLAY')) { define('USTREAM_DEFAULT_AUTOPLAY', 'false'); } function plugin_ust_inline() { $args = func_get_args(); return call_user_func_array('plugin_ust_convert', $args); } function plugin_ust_convert() { $width = USTREAM_DEFAULT_WIDTH; $height = USTREAM_DEFAULT_HEIGHT; $align = USTREAM_DEFAULT_ALIGN; $autoplay = USTREAM_DEFAULT_AUTOPLAY; $argv = func_get_args(); $argc = func_num_args(); foreach($argv as $arg) { $val = split('=', $arg); $val[1] = (empty($val[1])) ? htmlspecialchars($val[0]) : htmlspecialchars($val[1]); switch ($val[0]) { case 'clearl': return '
'; case 'clearr': return '
'; case 'clear' : return '
'; case 'width': case 'w': $width = $val[1]; break; case 'height': case 'h': $height = $val[1]; break; case 'align': case 'right': case 'left': case 'center': $align = $val[1]; break; case 'r': $align = 'right'; break; case 'l': $align = 'left'; break; case 'c': $align = 'center'; break; case 'icon': $width = 160; $height = 120+USTREAM_DEFAULT_MENU_HEIGHT/2; break; case 'small': case 's': $width = 320; $height = 240+USTREAM_DEFAULT_MENU_HEIGHT; break; case 'normal': $width = USTREAM_DEFAULT_WIDTH; $height = USTREAM_DEFAULT_HEIGHT; break; case 'large': $width = 640; $height = 480+USTREAM_DEFAULT_MENU_HEIGHT; break; case 'autoplay': $autoplay = 'true'; break; case 'noautoplay': $autoplay = 'false'; break; case 'id': default: if (!empty($val[1])) { $id = $val[1]; } break; } } if (empty($id)) return '#ust: ID parameter must be set.'; $command = "getCustomEmbedTag"; $option = "params=autoplay:$autoplay;mute:false;height:$height;width:$width"; $ustream_api = 'http://api.ustream.tv/php/channel/' . $id . '/' . $command . '?' . $option; $response = file_get_contents($ustream_api); $data = unserialize($response); $ust_embed = $data['results']; // Japanese mode (need refactoring if changed api) //$ust_embed = preg_replace('/