You are here

function swftools_swftools_embed in SWF Tools 5

Same name and namespace in other branches
  1. 6 swftools.module \swftools_swftools_embed()
  2. 6.2 swftools.module \swftools_swftools_embed()

Implementation of swftools_embed hook Returns the markup for the page.

File

./swftools.module, line 418

Code

function swftools_swftools_embed($action = 'add_js', $methods = FALSE, $vars = FALSE, $preview = 'NA') {
  if ($action == 'add_js') {

    // No javascript stuff for this embed method to do.
    return;
  }
  $P = $vars->params;

  // For legibility.
  $width_attr = $P['width'] ? ' width="' . $P['width'] . '"' : '';
  $height_attr = $P['height'] ? ' height="' . $P['height'] . '"' : '';
  $loop = _swftools_tf($P['loop']);
  $menu = _swftools_tf($P['menu']);
  $play = _swftools_tf($P['play']);
  $fullscreen = _swftools_tf($P['allowfullscreen']);
  $id = $vars->othervars['id'] ? ' id="' . $vars->othervars['id'] . '"' : '';
  $name = $vars->othervars['id'] ? ' name="' . $vars->othervars['id'] . '"' : '';
  $swliveconnect = $P['swliveconnect'] ? ' swliveconnect="' . $P['swliveconnect'] . '"' : '';
  $html = '<div class="swftools"><object' . $width_attr . $height_attr . $id . ' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' . $vars->params['version'] . ',0,0,0">' . "\n";
  $html .= '<param name="allowScriptAccess" value="sameDomain" />' . "\n";
  $html .= '<param name="movie"   value="' . $P['src'] . '" />' . "\n";
  $html .= '<param name="wmode"   value="' . $P['wmode'] . '" />' . "\n";
  $html .= '<param name="bgcolor" value="' . $P['bgcolor'] . '" />' . "\n";
  $html .= '<param name="scale"   value="' . $P['scale'] . '" />' . "\n";
  $html .= '<param name="quality" value="' . $P['quality'] . '" />' . "\n";
  $html .= '<param name="align"   value="' . $P['align'] . '" />' . "\n";
  $html .= '<param name="allowFullScreen"   value="' . $P['allowfullscreen'] . '" />' . "\n";
  $html .= '<param name="base"              value="' . $P['base'] . '" />' . "\n";
  $html .= '<param name="play"              value="' . $play . '" />' . "\n";
  $html .= '<param name="menu"              value="' . $menu . '" />' . "\n";
  $html .= '<param name="loop"              value="' . $loop . '" />' . "\n";
  $html .= $P['flashvars'] ? '<param name="FlashVars"  value="' . $P['flashvars'] . '" />' . "\n" : '';
  $html .= '<embed' . $width_attr . $height_attr . $name . $swliveconnect . ' src="' . $P['src'] . '"' . ' wmode="' . $P['wmode'] . '"' . ' bgcolor="' . $P['bgcolor'] . '"' . ' scale="' . $P['scale'] . '"' . ' quality="' . $P['quality'] . '"' . ' loop="' . $loop . '"' . ' menu="' . $menu . '"' . ' play="' . $play . '"' . ' name="' . $P['name'] . '"' . ' base="' . $P['base'] . '"' . ' allowFullScreen="' . $P['allowfullscreen'] . '"' . ($P['salign'] ? ' salign="' . $P['salign'] . '"' : '') . ($P['flashvars'] ? ' FlashVars="' . $P['flashvars'] . '"' : '') . ' allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"' . ' />' . "\n";
  $html .= '</object></div>' . "\n";
  return $html;
}