mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
Improvement on BBcode flash.bb: it accepts unlimited parameters.
USAGE: [flash=width,height,param_name:value]
This commit is contained in:
@@ -1,22 +1,37 @@
|
|||||||
// USAGE: [flash=width,height]http://www.example.com/file.swf[/flash]
|
// USAGE: [flash=width,height,param_name:value]http://www.example.com/file.swf[/flash]
|
||||||
|
|
||||||
$movie_path = (substr($code_text,0,4) == "http") ? "http://".eregi_replace("http://", "",$code_text) : $code_text;
|
$movie_path = (substr($code_text,0,4) == 'http') ? 'http://'.eregi_replace('http://', '',$code_text) : $code_text;
|
||||||
$movie_path = $tp -> toAttribute($movie_path);
|
$movie_path = $tp -> toAttribute($movie_path);
|
||||||
|
|
||||||
$parm_array = explode(",",$parm);
|
$parm_array = explode(',',$parm);
|
||||||
|
|
||||||
$width_type = strpos($parm_array[0], "%") !== FALSE ? "%" : "";
|
$width_type = strpos($parm_array[0], '%') !== FALSE ? '%' : '';
|
||||||
$height_type = strpos($parm_array[1], "%") !== FALSE ? "%" : "";
|
$height_type = strpos($parm_array[1], '%') !== FALSE ? '%' : '';
|
||||||
|
|
||||||
$width_value = ereg_replace("[^0-9]","",$parm_array[0]);
|
$width_value = ereg_replace('[^0-9]','',$parm_array[0]);
|
||||||
$height_value = ereg_replace("[^0-9]","",$parm_array[1]);
|
$height_value = ereg_replace('[^0-9]','',$parm_array[1]);
|
||||||
|
|
||||||
$width_value = $width_value ? $width_value.$width_type : "50";
|
$width_value = $width_value ? $width_value.$width_type : '50';
|
||||||
$height_value = $height_value ? $height_value.$height_type : "50";
|
$height_value = $height_value ? $height_value.$height_type : '50';
|
||||||
|
|
||||||
return "<object type='application/x-shockwave-flash' data='$movie_path' width='$width_value' height='$height_value'>
|
$n = 0;
|
||||||
<param name='movie' value='$movie_path' />
|
foreach ($parm_array as &$value)
|
||||||
<param name='quality' value='high' />
|
{
|
||||||
<param name='allowscriptaccess' value='samedomain' />
|
if(strpos($value, ':'))
|
||||||
</object>";
|
{
|
||||||
|
$extra_parm_array[$n] = explode(':', $value);
|
||||||
|
$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>";
|
||||||
|
|
||||||
|
return $text;
|
Reference in New Issue
Block a user