<?php
// PukiWiki - Yet another WikiWikiWeb clone.
// $Id: svgb.inc.php,v 1.0 2012/12/16 00:00:00 acompass.net a羅針盤 Exp $
// 
// svg plugin - Create SVG Tag. Beta Version.
// License: GPL v2 or (at your option) any later version
// Usage :  #svgp(width,height,option) {{ statement }}
//          following parameters are set in svg tag.
//          width     : svg area width
//          height    : svg area height
//          option    : svg attribute. set Event.
//
//          statement : svg statement. include script.

function plugin_svgb_convert()
{
	$arg_num = func_num_args();
	$args = func_get_args();
	// Initialize
	$temp = '';
	$html = '';

	// Option Check
	if ( $arg_num < 3 || 4 < $arg_num) {
		$html = 'svgb incorrect qty of option [' . $arg_num . ']';
		return $html;
	}

	$temp = '<?xml version="1.0" standalone="no"?>';
	$temp = $temp . '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ';
	$temp = $temp . '"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">';
	$temp = $temp . '<svg xmlns="http://www.w3.org/2000/svg" version="1.1"';
	$temp = $temp . ' width="' . $args[0] . '" height="'. $args[1] . '"';

	if ( $arg_num === 4 ) {
		$html = $temp . ' '. $args[2] . '>' . $args[3] . '</svg>';
	} else {
		$html = $temp . '>' . $args[2] . '</svg>';
	}

	return $html;
}

?>
