You are here

function swftools_get_media_url in SWF Tools 6

Same name and namespace in other branches
  1. 5 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
9 calls to swftools_get_media_url()
flowplayer_swftools_flashvars in flowplayer/flowplayer.module
Implementation of swftools_flashvars hook. Return an array of flashvars.
imagerotator_swftools_flashvars in imagerotator/imagerotator.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.

... See full list

File

./swftools.module, line 653

Code

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

  // We do nothing with a remote media file.
  if ($media_url) {
    return $media_url . '/' . $path;
  }
  if (variable_get('swftools_check_media', TRUE) && $is_file) {
    if (file_exists($path)) {
      return file_create_url($path);
    }
    else {
      drupal_set_message(t('Could not display the flash because %path does not appear to exist.', array(
        '%path' => $path,
      )), 'error');
      return FALSE;
    }
  }
  else {
    return file_create_url($path);
  }
}