You are here

function mediafront_get_playlist_json in MediaFront 7.2

Same name and namespace in other branches
  1. 6.2 mediafront.module \mediafront_get_playlist_json()
  2. 6 mediafront.module \mediafront_get_playlist_json()
  3. 7 mediafront.module \mediafront_get_playlist_json()

Gets a playlist in JSON format.

1 string reference to 'mediafront_get_playlist_json'
mediafront_menu in ./mediafront.module
Implements hook_menu().

File

./mediafront.module, line 259

Code

function mediafront_get_playlist_json($playlist = null, $limit = null, $start = null) {

  // Get the playlist.
  $playlist = $playlist ? check_plain($playlist) : '';
  $playlist = !empty($_GET['playlist']) ? check_plain($_GET['playlist']) : $playlist;

  // Get the limit.
  $limit = $limit ? check_plain($limit) : 10;
  $limit = !empty($_GET['max-results']) ? check_plain($_GET['max-results']) : $limit;

  // Get the start index.
  $start = $start ? check_plain($start) : 0;
  $start = !empty($_GET['start-index']) ? check_plain($_GET['start-index']) : $start;

  // Output the playlist as JSON.
  drupal_json_output(mediafront_get_playlist($playlist, $limit, $start));
}