From 8a8b79338a10dd15599e80851e576bfd25489725 Mon Sep 17 00:00:00 2001 From: nlstart Date: Sat, 27 Mar 2010 23:01:12 +0000 Subject: [PATCH] Improvement on BBcode flash.bb: it accepts unlimited parameters. USAGE: [flash=width,height,param_name:value] --- e107_core/bbcodes/flash.bb | 43 +++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/e107_core/bbcodes/flash.bb b/e107_core/bbcodes/flash.bb index c879f99b7..f7921758f 100644 --- a/e107_core/bbcodes/flash.bb +++ b/e107_core/bbcodes/flash.bb @@ -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); -$parm_array = explode(",",$parm); +$parm_array = explode(',',$parm); -$width_type = strpos($parm_array[0], "%") !== FALSE ? "%" : ""; -$height_type = strpos($parm_array[1], "%") !== FALSE ? "%" : ""; +$width_type = strpos($parm_array[0], '%') !== FALSE ? '%' : ''; +$height_type = strpos($parm_array[1], '%') !== FALSE ? '%' : ''; -$width_value = ereg_replace("[^0-9]","",$parm_array[0]); -$height_value = ereg_replace("[^0-9]","",$parm_array[1]); +$width_value = ereg_replace('[^0-9]','',$parm_array[0]); +$height_value = ereg_replace('[^0-9]','',$parm_array[1]); -$width_value = $width_value ? $width_value.$width_type : "50"; -$height_value = $height_value ? $height_value.$height_type : "50"; +$width_value = $width_value ? $width_value.$width_type : '50'; +$height_value = $height_value ? $height_value.$height_type : '50'; -return " - - - - "; +$n = 0; +foreach ($parm_array as &$value) +{ + if(strpos($value, ':')) + { + $extra_parm_array[$n] = explode(':', $value); + $n ++; + } +} +$text = " + + + "; +for ($i = 0; $i < $n; $i++) +{ + $text .= " "; +} +$text .= ""; + +return $text; \ No newline at end of file