mirror of
https://github.com/e107inc/e107.git
synced 2025-04-15 01:56:34 +02:00
Changed bbcode to use parse_str() compatible parameters...cleaned up code a bit.
This commit is contained in:
parent
845604ad96
commit
13121a24d6
@ -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($movie_path);
|
||||
$movie_path = $tp->toAttribute($code_text);
|
||||
|
||||
$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 ? '%' : '';
|
||||
$height_type = strpos($parm_array[1], '%') !== FALSE ? '%' : '';
|
||||
$text = "
|
||||
<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]);
|
||||
$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(isset($parm_array[2]))
|
||||
{
|
||||
if(strpos($value, ':'))
|
||||
parse_str($parm_array[2], $extraParms);
|
||||
foreach($extraParms as $_parm => $_val)
|
||||
{
|
||||
$extra_parm_array[$n] = explode(':', $value);
|
||||
$n ++;
|
||||
if($_parm && $_val) {
|
||||
$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>";
|
||||
|
||||
return $text;
|
||||
return $text;
|
||||
|
Loading…
x
Reference in New Issue
Block a user