mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 05:07:27 +02:00
Changed bbcode to use parse_str() compatible parameters...cleaned up code a bit.
This commit is contained in:
@@ -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¶m_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}' />
|
||||||
$width_value = preg_replace('[^0-9]','',$parm_array[0]);
|
|
||||||
$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, ':'))
|
|
||||||
{
|
|
||||||
$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='quality' value='high' />
|
||||||
<param name='allowscriptaccess' value='samedomain' />";
|
<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>";
|
|
||||||
|
|
||||||
|
if(isset($parm_array[2]))
|
||||||
|
{
|
||||||
|
parse_str($parm_array[2], $extraParms);
|
||||||
|
foreach($extraParms as $_parm => $_val)
|
||||||
|
{
|
||||||
|
if($_parm && $_val) {
|
||||||
|
$text .= "\t<param name='{$_parm}' value='{$_val}' />\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "</object>";
|
||||||
return $text;
|
return $text;
|
Reference in New Issue
Block a user