1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 13:17:24 +02:00

Changed bbcode to use parse_str() compatible parameters...cleaned up code a bit.

This commit is contained in:
mcfly
2010-03-29 02:52:35 +00:00
parent 845604ad96
commit 13121a24d6

View File

@@ -1,37 +1,28 @@
// USAGE: [flash=width,height,param_name:value]http://www.example.com/file.swf[/flash] // USAGE: [flash=width,height,param_name=value&param_name=value]http://www.example.com/file.swf[/flash]
$movie_path = (substr($code_text,0,4) == 'http') ? 'http://'.preg_replace('[http://]', '',$code_text) : $code_text; $movie_path = $tp->toAttribute($code_text);
$movie_path = $tp -> toAttribute($movie_path);
$parm_array = explode(',',$parm); $parm_array = explode(',', $parm);
$width = preg_replace('#[^0-9%]#', '', varsettrue($parm_array[0], 50));
$height= preg_replace('#[^0-9%]#', '', varsettrue($parm_array[1], 50));
$width_type = strpos($parm_array[0], '%') !== FALSE ? '%' : ''; $text = "
$height_type = strpos($parm_array[1], '%') !== FALSE ? '%' : ''; <object type='application/x-shockwave-flash' data='{$movie_path}' width='{$width}' height='{$height}'>
<param name='movie' value='{$movie_path}' />
<param name='quality' value='high' />
<param name='allowscriptaccess' value='samedomain' />
";
$width_value = preg_replace('[^0-9]','',$parm_array[0]); if(isset($parm_array[2]))
$height_value = preg_replace('[^0-9]','',$parm_array[1]);
$width_value = varset($width_value, '50').$width_type;
$height_value = varset($height_value, '50').$height_type;
$n = 0;
foreach ($parm_array as &$value)
{ {
if(strpos($value, ':')) parse_str($parm_array[2], $extraParms);
foreach($extraParms as $_parm => $_val)
{ {
$extra_parm_array[$n] = explode(':', $value); if($_parm && $_val) {
$n ++; $text .= "\t<param name='{$_parm}' value='{$_val}' />\n";
}
} }
} }
$text = "<object type='application/x-shockwave-flash' data='$movie_path' width='$width_value' height='$height_value'>
<param name='movie' value='$movie_path' />
<param name='quality' value='high' />
<param name='allowscriptaccess' value='samedomain' />";
for ($i = 0; $i < $n; $i++)
{
$text .= " <param name='{$extra_parm_array[$i][0]}' value='{$extra_parm_array[$i][1]}' />";
}
$text .= "</object>"; $text .= "</object>";
return $text;
return $text;