You are here

function wijering4_swftools_flashvars in SWF Tools 6.2

Same name and namespace in other branches
  1. 5 wijering4/wijering4.module \wijering4_swftools_flashvars()
  2. 6 wijering4/wijering4.module \wijering4_swftools_flashvars()

Implementation of swftools_flashvars hook. Return an array of flashvars.

File

wijering4/wijering4.module, line 161

Code

function wijering4_swftools_flashvars($action, &$methods, &$vars) {

  // Pad out the user parameters (like those passed through swf(), with our
  // configured defaults, allowing the user parameters to dominate.
  $saved_settings = _wijering4_flashvars($methods->player['name']);
  $saved = array();
  foreach ($saved_settings as $category => $settings) {
    $saved = array_merge($saved, $settings);
  }
  $flashvars = array_merge($saved, $vars->flashvars);
  if (isset($flashvars['image']) && !valid_url($flashvars['image'], TRUE)) {
    $flashvars['image'] = swftools_get_media_url(swftools_get_media_path() . $flashvars['image']);
  }
  if ($vars->params['width']) {
    $flashvars['width'] = $vars->params['width'];
  }
  if ($vars->params['height']) {
    $flashvars['height'] = $vars->params['height'];
  }

  // Is this file to be streamed? Check for the stream variable being set
  if (isset($vars->othervars['stream'])) {

    // Extract path info from the $file_url variable describing the file
    $info = pathinfo($vars->othervars['file_url']);

    // Set the streamer flashvar
    $vars->flashvars['streamer'] = $vars->othervars['stream'];

    // Replace the current (non streamed) file url with the stream filename
    $vars->othervars['file_url'] = $info['basename'];
  }

  // Return an array of flash variables
  return $flashvars;
}