Use SWFObject API if installed
theoldfather - June 3, 2008 - 19:24
| Project: | SlideShowPro |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
Slideshow Pro module automatically uses SWFObject API module if installed. Compatible with SWFObject API 2.0 Beta 1. See this thread (http://drupal.org/node/266241) if you have problems in IE6 or IE7.
Find:
/**
* embed function
*/
function slideshowpro_embed($args) {
static $id = 0;
$id++;
// path to xml
$flash_vars = 'xmlfilepath='. url($args['path'], NULL, NULL, TRUE);
// check, wether parameters available
$flash_vars .= '¶meters=';
if (isset($args['params'])) {
$params = explode(',', $args['params']);
foreach ($params as $param) {
if ($var = explode(':', $param)) {
// if we use titles as captions, ignore showCaptionHeader
$flash_vars .= $var[0] .':'. check_plain($var[1]) .',';
}
}
}
// hide caption header if we are using titles as captions
if (variable_get('slideshowpro_title_as_caption', 0)) {
$flash_vars .= 'showCaptionHeader:False,';
}
// width and height
if (isset($args['width'])) {
$width = ' width="'.$args['width'].'" ';
}
if (isset($args['height'])) {
$height = ' height="'.$args['height'].'" ';
}
return theme('slideshowpro_embed',
'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" '. $width .' '. $height .' id="ssp-player-'.$id.'" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="FlashVars" value="'. $flash_vars .'" />
<param name="movie" value="'. base_path() . slideshowpro_path_to_ssp() .'" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed FlashVars="'. $flash_vars .'" src="'. base_path() . slideshowpro_path_to_ssp() .'" quality="high" bgcolor="#ffffff" '. $width .' '. $height .' name="ssp-player-'.$id.'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>', $id);
}Replace:
/**
* embed function
*/
function slideshowpro_embed($args) {
static $id = 0;
$id++;
// path to xml
$flash_vars = 'xmlfilepath='. url($args['path'], NULL, NULL, TRUE);
$vars['xmlfilepath']=url($args['path'], NULL, NULL, TRUE);
// check, wether parameters available
$flash_vars .= '¶meters=';
$vars['parameters']='';
if (isset($args['params'])) {
$params = explode(',', $args['params']);
foreach ($params as $param) {
if ($var = explode(':', $param)) {
// if we use titles as captions, ignore showCaptionHeader
$flash_vars .= $var[0] .':'. check_plain($var[1]) .',';
$vars['parameters'] .= $var[0] .':'. check_plain($var[1]) .',';
}
}
}
// hide caption header if we are using titles as captions
if (variable_get('slideshowpro_title_as_caption', 0)) {
$flash_vars .= 'showCaptionHeader:False,';
$vars['parameters'] .= 'showCaptionHeader:False,';
}
// width and height
if (isset($args['width'])) {
$width = ' width="'.$args['width'].'" ';
}
if (isset($args['height'])) {
$height = ' height="'.$args['height'].'" ';
}
if(module_exists('swfobject_api')){
$params = array(
'width' => $args['width'],
'height' => $args['height'],
'version' => 8,
'allowScriptAccess' => 'sameDomain',
'quality' => 'high',
'movie' => base_path() . slideshowpro_path_to_ssp(),
'wmode' => 'transparent',
'express_redirect' => true,
'no_flash' => t('')
);
return theme("swfobject_api", base_path() . slideshowpro_path_to_ssp(), $params, $vars );
}
else{
return theme('slideshowpro_embed',
'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" '. $width .' '. $height .' id="ssp-player-'.$id.'" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="FlashVars" value="'. $flash_vars .'" />
<param name="movie" value="'. base_path() . slideshowpro_path_to_ssp() .'" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="wmode" value="transparent" />
<embed FlashVars="'. $flash_vars .'" src="'. base_path() . slideshowpro_path_to_ssp() .'" wmode="transparent" quality="high" bgcolor="#ffffff" '. $width .' '. $height .' name="ssp-player-'.$id.'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>', $id);
}
}
#1
..and here is the patch file.
#2
combined patch posted http://drupal.org/node/387138