You are here

function theme_video_filter_flash in Video Filter 6.2

Same name and namespace in other branches
  1. 5.2 video_filter.module \theme_video_filter_flash()
  2. 6.3 video_filter.module \theme_video_filter_flash()
  3. 7.3 video_filter.module \theme_video_filter_flash()

Function that outputs the <object> element.

1 theme call to theme_video_filter_flash()
video_filter_flash in ./video_filter.module
Wrapper that calls the theme function.

File

./video_filter.module, line 242

Code

function theme_video_filter_flash($video, $params = array()) {
  $output = '';

  // Create classes
  $classes = array(
    'video-filter',
    'video-' . $video['codec']['codec_name'],
  );

  // Adds alignment
  if (isset($video['align'])) {
    $classes[] = 'video-' . $video['align'];
  }

  // First match is the URL, we don't want that as a class.
  unset($video['codec']['matches'][0]);
  foreach ($video['codec']['matches'] as $match) {
    $classes[] = 'vf-' . strtolower(preg_replace('/[^a-zA-Z0-9]/', '', $match));
  }
  $output .= '<object class="' . implode(' ', $classes) . '" type="application/x-shockwave-flash" ';
  $output .= 'width="' . $video['width'] . '" height="' . $video['height'] . '" data="' . $video['source'] . '">' . "\n";
  $defaults = array(
    'movie' => $video['source'],
    'wmode' => 'transparent',
    'allowFullScreen' => 'true',
  );
  $params = array_merge($defaults, is_array($params) && count($params) ? $params : array());
  foreach ($params as $name => $value) {
    $output .= '  <param name="' . $name . '" value="' . $value . '" />' . "\n";
  }
  $output .= '</object>' . "\n";
  return $output;
}