You are here

function swftools_get_media_url in SWF Tools 5

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

Resolved a path to a full url. The path must be relative to the webroot. We check for the existence if a file is the follow is true:

  • swftools_media_url is empty, and hence the local server is assumed.
  • $is_file is TRUE. (You can set this to FALSE if you know the check will fail, like a dynamic playlist.)
  • swftools_check_media is TRUE
8 calls to swftools_get_media_url()
flowplayer_swftools_flashvars in flowplayer/flowplayer.module
Implementation of swftools_flashvars hook. Return an array of flashvars.
swf in ./swftools.module
Return output, which might be embed markup, or pre-flash markup that includes the appropriate jQuery added to the <head>
swftools_flowplayer_mediaplayer_playlist in flowplayer/flowplayer.module
swftools_prepare_playlist_data in ./swftools.module
This function is a work in progress.
swftools_wijering4_mediaplayer_playlist in wijering4/wijering4.module

... See full list

File

./swftools.module, line 667

Code

function swftools_get_media_url($path, $is_file = TRUE) {
  $media_url = variable_get('swftools_media_url', '');

  // We do nothing with a remote media file.
  if ($media_url) {
    return $media_url . '/' . $path;
  }

  // Should SWF Tools check if the file exists?
  if (variable_get('swftools_check_media', TRUE) && $is_file) {
    if (file_exists($path)) {
      return file_create_url($path);
    }
    else {
      drupal_set_message("Could not display the flash because \"{$path}\" does not appear to exist.", 'error');
      return FALSE;
    }
  }
  else {
    return file_create_url($path);
  }
}