You are here

function mediafront_parse_params in MediaFront 7

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

Parse the JSON params.

2 calls to mediafront_parse_params()
mediafront_get_node_json in ./mediafront.module
Gets a node in JSON format
mediafront_get_playlist_json in ./mediafront.module
Gets a playlist in JSON format.

File

./mediafront.module, line 275

Code

function mediafront_parse_params($json) {

  // First trim any whitespace, and also the array brackets from the params.
  $json = trim($json, ' []');
  $params = null;
  if ($json) {

    // Trim any quoted strings and make sure it is plain text.
    $params = explode(',', $json);
    foreach ($params as $index => $param) {
      $params[$index] = trim($param, ' "');
    }
  }

  // Now return the array of parameters.
  return $params;
}