public function OSMPlayer::getParams in MediaFront 6.2
Same name and namespace in other branches
- 6 players/osmplayer/player/OSMPlayer.php \OSMPlayer::getParams()
- 7 players/osmplayer/player/OSMPlayer.php \OSMPlayer::getParams()
Get the player parameters. This will only return the parameters that are included in the playerParams array.
1 call to OSMPlayer::getParams()
- OSMPlayer::getPlayerJS in players/
osmplayer/ player/ OSMPlayer.php - Returns the javascript to add the player to the page.
File
- players/
osmplayer/ player/ OSMPlayer.php, line 429
Class
- OSMPlayer
- PHP wrapper class for the Open Standard Media (OSM) player.
Code
public function getParams() {
$params = array();
foreach ($this->settings as $param => $value) {
if (array_key_exists($param, $this->playerParams) && $this->playerParams[$param] != $value) {
switch (gettype($this->defaults[$param])) {
case 'array':
case 'object':
$params[] = $param . ':' . $this
->osm_json_encode($value);
break;
case 'string':
// Make sure we are not dealing with a JSON string here. If so, then don't include the quotes.
$params[] = substr($value, 0, 1) == '{' ? $param . ':' . $value : $param . ':"' . str_replace('"', "'", $value) . '"';
break;
case 'boolean':
$params[] = $param . ':' . ($value ? 'true' : 'false');
break;
default:
$params[] = $param . ':' . ($value ? $value : 0);
break;
}
}
}
$ids = array();
// Iterate through all of our template Ids.
foreach ($this->template
->getIds() as $id => $value) {
// Only set this if it is different from the default.
if ($this->template->defaultIds[$id] != $value) {
$ids[] = $id . ':"' . $value . '"';
}
}
// If we have some id's different from the default, then add then to our params.
if (count($ids)) {
// Now add all the Id's to the settings.
$params[] = 'ids:{' . implode(',', $ids) . '}';
}
return $params;
}