You are here

function swftools_get_player in SWF Tools 6.3

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

Returns the currently configured player for the specified action and profile.

We use a static array so that if we are generating a complex page we can quickly locate the relevant action/profile player after we've done it the first time. This saves us from repeat calls to swftools_variable_get().

Parameters

string $action: The SWF Tools action to be performed.

string $profile: (optional) The profile being used for this item.

Return value

string The name of the currently configured player for this action.

3 calls to swftools_get_player()
swf in ./swftools.module
Processes a file, or an array of files, and returns the relevant mark-up to render a Flash based player.
_swftools_admin_file_handling_options in includes/swftools.admin.inc
_swftools_status_players in includes/swftools.admin.status.inc
Generates a status report for the player modules and media defaults.

File

./swftools.module, line 612
The primary component of SWF Tools that enables comprehensive media handling.

Code

function swftools_get_player($action, $profile = '') {

  // Initialise a static array for this page call
  static $players = array();

  // We need to give the empty profile a name to place it in the array
  $_profile = $profile ? $profile : SWFTOOLS_UNDEFINED;

  // Do we already know the players for this profile?
  if (!isset($players[$_profile])) {

    // Register the players for this profile in the array
    $players[$_profile] = swftools_get_players($profile);
  }

  // Return the result
  return isset($players[$_profile][$action]) ? $players[$_profile][$action] : FALSE;
}