--- /wwwRoot/Code Library/drupal/modules/swfobject_api/swfobject_api.module 2008-03-20 19:57:22.000000000 -0400 +++ /wwwRoot/www.star883.com/blog/modules/swfobject_api/swfobject_api.module 2008-06-04 11:57:10.000000000 -0400 @@ -129,17 +129,33 @@ function theme_swfobject_api($url, $para // add the parameters if ($params) { $script[] = 'var params = {'; + $length=count($params); + $i=1; foreach ($params as $key => $value) { - $script [] = " $key: '$value',"; + if($i<$length){ + $script [] = " $key: '$value',"; + } + else{ + $script [] = " $key: '$value'"; + } + $i++; } $script[] ='};'; } // add the flashvars if ($vars) { - $script[] = 'var flashvars = {'; + $script[] = 'var flashvars = {'; + $length=count($vars); + $i=1; foreach ($vars as $key => $value) { - $script[] = " $key: '$value',"; + if($i<$length){ + $script[] = " $key: '$value',"; + } + else{ + $script[] = " $key: '$value'"; + } + $i++; } $script[] = "};"; } @@ -150,8 +166,16 @@ function theme_swfobject_api($url, $para // add the attributes if ($attributes) { $script[] = 'var attributes = {'; + $length=count($attributes); + $i=1; foreach ($attributes as $key => $value) { - $script[] = " $key: '$value',"; + if($i<$length){ + $script[] = " $key: '$value',"; + } + else{ + $script[] = " $key: '$value'"; + } + $i++; } $script[] = "};"; } @@ -159,31 +183,42 @@ function theme_swfobject_api($url, $para $script[] = "var attributes = {};"; } - // Express install redirect URL: as per the SWFObject docs, this should - // actually be xiRedirectUrl; variable name changed for simplicity. - if (! $params['express_redirect']) { - $params['express_redirect'] = variable_get('swfoa_express', true) ? drupal_get_path('module', 'swfobject_api') .'/expressinstall.swf' : 'false'; - } + // Express install redirect URL: as per the SWFObject docs, this should + // actually be xiRedirectUrl; variable name changed for simplicity. + if (! $params['express_redirect']) { + $params['express_redirect'] = variable_get('swfoa_express', true) ? drupal_get_path('module', 'swfobject_api') .'/expressinstall.swf' : 'false'; + } - // Set the minimum version of flash expected - if (! $params['version']) { - $params['version'] = variable_get('swfoa_version', 9) ? variable_get('swfoa_express', "9.0.0") : 'false'; - } + // Set the minimum version of flash expected + if (! $params['version']) { + $params['version'] = variable_get('swfoa_version', 9) ? variable_get('swfoa_express', "9.0.0") : 'false'; + } - // register the swfojbect - $script[] = " swfobject.embedSWF('$url', '$div_id', '". $params['width'] ."', '". $params['height'] ."', '". $params['version'] ."', '". $params['express_redirect'] ."', flashvars, params, attributes );"; - - // close the document ready - $script[] = "});"; - - // output the js - drupal_add_js(implode("\n", $script), 'inline' ); - - // increment the id count - $id_count ++; - - // create the html output - $html = "