You are here

function swftools_get_action in SWF Tools 6.2

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

Identify the most likely SWF Tools action for a file, based on its extension.

Parameters

$file: The name of the file to be processed.

Return value

A string describing an SWF Tools action.

2 calls to swftools_get_action()
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_prepare_playlist_data in ./swftools.module
Take an array of filenames and prepare them to be used as a playlist

File

./swftools.module, line 640

Code

function swftools_get_action($file) {

  // Get the path information for this file
  $path_parts = pathinfo($file);

  // Select an action based on the file extension
  switch (strtolower($path_parts['extension'])) {
    case 'flv':
      return SWFTOOLS_FLV_DISPLAY;
    case 'swf':
      return SWFTOOLS_SWF_DISPLAY_DIRECT;
    case 'mp3':
      return SWFTOOLS_MP3_DISPLAY;
    case 'jpg':
    case 'gif':
    case 'png':
    case 'jpeg':
    case 'img':
      return SWFTOOLS_IMAGE_DISPLAY_LIST;
    default:

      // Assume that the configured mediaplayer will handle this file or playlist
      return SWFTOOLS_MEDIA_DISPLAY_LIST;
  }
}