View source
<?php
function ufo_swftools_methods() {
$methods = array();
$methods[SWFTOOLS_EMBED_METHOD]['ufo_replace'] = array(
'name' => 'ufo_replace',
'module' => 'ufo',
'shared_file' => 'ufo/ufo.js',
'title' => t('UFO - JavaScript'),
'download' => 'http://www.bobbyvandersluis.com/ufo/',
);
return $methods;
}
function ufo_swftools_embed($action = 'add_js', $methods = FALSE, $vars = FALSE, $html_alt = '') {
static $ufo_has_run;
static $ufo_id = 0;
if (!$ufo_has_run) {
drupal_add_js(swftools_get_player_path() . '/ufo/ufo.js');
drupal_add_js(_ufo_header_js(), 'inline', 'header');
$ufo_has_run = TRUE;
if ($action == 'add_js') {
return;
}
}
static $unique_id = 0;
$unique_id++;
$html = '<div id="ufo-id-' . time() . $unique_id . '" class="swftools ufo" ' . swftools_json_params($vars->params, 'swftools') . ' ' . ">\n" . $html_alt . '</div>';
return $html;
}
function _ufo_header_js() {
$js = "\n \$(document).ready(function(){\n \$('.ufo').each(function(i){\n params = Drupal.parseJson(\$(this).attr('swftools'));\n\t\t var FO = { movie: params['src'], width: params['width'], height: params['height'],\n\t\t majorversion: params['version'], build: '0', xi: 'false',\n\t\t quality: params['quality'], wmode: params['wmode'], align: params['align'],\n salign: params['salign'], play: params['play'], loop: params['loop'],\n menu: params['menu'], base: params['base'], flashvars: params['flashvars'],\n allowfullscreen: 'true'\n\t\t };\n UFO.create(FO, this.id);\n });\n });\n ";
return $js;
}