<?php
/*
* Simple Flash SWF snippet - By Nimja.com
*
* Requirements: SWFObject - http://code.google.com/p/swfobject/
* (place "swfobject.js" and "expressInstall.swf" in /assets/flash)
*
* SWF files should be placed in /assets/flash - Subdirs can be used.
* Snippet call uses the name of the swf WITHOUT .swf, to prevent stupidity.
*
* Snippet name: Flash
* Snippet call: [[Flash? &swf=`example` &width=`400` &height=`300`]]
*
* Version history:
* 1.1 - Added DIV holder, with classname and style that contains the same width/height.
* 1.0 - Working fine.
*/
$result = 'Please set a proper filename.';
if (!empty($swf)) {
//Add JS to <head>
$swfobject = $modx->config['base_url'] . 'assets/flash/swfobject.js';
$modx->regClientStartupScript($swfobject);
//Get settings (and add .swf to filename)
$swf = $modx->config['base_url']. 'assets/flash/'.$swf.'.swf';
$width = (!empty($width)) ? $width : 200;
$height = (!empty($height)) ? $height : 200;
//Create the output.
$result = '<div class="Flash" style="width:'.$width.'px; height: '.$height.'pd;" ><object id="flashMovie" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'.$width.'" height="'.$height.'">';
$result .= '<param name="movie" value="'.$swf.'" />';
$result .= '<!--[if !IE]>-->';
$result .= '<object type="application/x-shockwave-flash" data="'.$swf.'" width="'.$width.'" height="'.$height.'">';
$result .= '<!--<![endif]-->';
$result .= '<div><h1>Obtain Flash Player</h1><p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p></div>';
$result .= '<!--[if !IE]>-->';
$result .= '</object>';
$result .= '<!--<![endif]-->';
$result .= '</object></div>';
$result .= '<script type="text/javascript">swfobject.registerObject("flashMovie", "10.0.0", "expressInstall.swf");</script>';
}
return $result;
?>
$result = '<div class="Flash"...
.Flash {
margin-top: 13px;
}