You are here

function _swftools_jw5_flashvars in SWF Tools 6.3

Return the default flashvar configuration for JW Player 4.

This function is called from swftools_jw5_swftools_flashvars() which is called from swf() It will return the default flashvar configuration, just prior to any overrides passed into swf(). We start with the settings defined on admin/swf/wijering which are returned by _swftools_jw5_settings(). Then we prepare these values for output to html (eg. '1' become 'true') and we unset undefined flashvars to prevent their output.

TODO: Could we just do this when we save the settings, and then save the result, as this doesn't change until the settings are updated.

Parameters

string $profile: (optional) Name of profile to use.

Return value

array An array of flashvars as key => value pairs.

2 calls to _swftools_jw5_flashvars()
swftools_jw5_swftools_playlist_jwplayer5 in jw5/swftools_jw5.module
Implementation of hook_swftools_playlist_[player]().
swftools_jw5_swftools_preprocess_jwplayer5 in jw5/swftools_jw5.module
Implementation of hook_swftools_preprocess_[player]().

File

jw5/swftools_jw5.module, line 222
Enables SWF Tools support for LongTail Player 5.

Code

function _swftools_jw5_flashvars($profile = '') {

  // Initialise cache to handle repeated calls
  static $cache = array();

  // Store name of profile
  $_profile = $profile ? $profile : SWFTOOLS_UNDEFINED;

  // If no settings stored for this profile then fetch them
  if (!isset($cache[$_profile])) {

    // Get saved settings for this method.
    $settings = _swftools_jw5_settings($profile);

    // Flatten defaults
    swftools_array_flatten($settings);

    // Iterate over boolean settings
    foreach (array(
      'autostart',
      'shuffle',
      'fullscreen',
    ) as $key) {

      // Settings are already encoded properly on the settings page, but if we called from PHP it might be 1/0 or TRUE/FALSE
      if (isset($settings[$key])) {
        $settings[$key] = _swftools_tf($settings[$key]);
      }
    }

    // Store the result
    $cache[$_profile] = $settings;
  }

  // Return the result
  return $cache[$_profile];
}