You are here

function swftools_wpaudio_swftools_playlist_wpaudio in SWF Tools 6.3

Implementation of hook_swftools_playlist_[player]().

File

wpaudio/swftools_wpaudio.module, line 320
Enables SWF Tools support for the WordPress Audio player.

Code

function swftools_wpaudio_swftools_playlist_wpaudio(&$data) {

  // Set flag to show if we found a description
  $found_titles = FALSE;

  // Initialise arrays
  $playlist = array();
  $titles = array();

  // Get file paths out of the playlist_data array and add to the playlist
  foreach ($data['othervars']['playlist_data']['playlist'] as $key => $play) {

    // Add this element to the playlist
    $playlist[] = $play['fileurl'];

    // Add title to titles array
    $titles[] = $play['title'];

    // Set flag if this title actually contained something
    if ($play['title']) {
      $found_titles = TRUE;
    }
  }

  // Convert playlist array to a string
  $playlist = implode(',', $playlist);

  // Convert titles array to a string
  $titles = implode(',', $titles);

  // Overwrite $data['othervars']['file_url'] with playlist string
  $data['othervars']['wpaudio']['soundFile'] = $playlist;

  // If we found some actual titles add these to the flashvars array
  if ($found_titles) {
    $data['flashvars']['titles'] = $titles;
  }

  // Show we are not offering xml
  return SWFTOOLS_NON_XML_PLAYLIST;
}