function theme_mp3player in MP3 Player 6
Same name and namespace in other branches
- 6.2 mp3player.module \theme_mp3player()
- 7.2 mp3player.module \theme_mp3player()
Setup theme function for the MP3 Player.
1 theme call to theme_mp3player()
- theme_filefieldmp3player_formatter_mp3player in filefieldmp3player/
filefieldmp3player.module - Formatter theme function for file fields presented as a Flash MP3 Player.
File
- ./
mp3player.module, line 1140 - mp3player main module file.
Code
function theme_mp3player($player = 'Default', $file = NULL, $title = NULL, $artist = NULL, $description = NULL) {
// Add JS
drupal_add_js(variable_get('mp3player_library_path', drupal_get_path('module', 'mp3player') . '/mp3player') . '/audio-player.js', 'module', 'footer');
drupal_add_js(drupal_get_path('module', 'mp3player') . '/mp3player.js', 'module', 'footer');
//If cache isn't set, set it.
if (cache_get('mp3player_default') == '') {
mp3player_rebuild_cache();
}
$js_audio_settings = cache_get('mp3player_default');
drupal_add_js($js_audio_settings->data, 'inline', 'footer');
// Setup player
static $mp3_player_id;
$mp3_player_id++;
$extras = NULL;
if ($title != NULL) {
$extras .= ', titles: "' . addslashes($title) . '"';
}
if ($artist != NULL) {
$extras .= ', artists: "' . addslashes($artist) . '"';
}
//Get Player Settings
if ($player != 'Default') {
$js_audio_settings = cache_get('mp3player_player_' . $player);
$extras .= ', ' . $js_audio_settings->data;
}
if ($description != NULL) {
$description = '<p class="mp3player_description">' . $description . '</p>';
}
if (module_exists('simplecdn')) {
$file = simplecdn_rewrite_url($file, 'mp3player');
}
if (variable_get('mp3player_encode', 'no') == 'yes') {
$audio_url = mp3player_encodeSource($file);
}
else {
$audio_url = $file;
}
$extras = str_replace('"', "", $extras);
$extras = str_replace(":", "=", $extras);
$extras = str_replace(" ", "", $extras);
$extras = str_replace(",", "&", $extras);
return '<p id="mp3player_' . $mp3_player_id . '" class="mp3player" data="soundFile=' . $audio_url . $extras . '">' . t("You may need: <a href='http://get.adobe.com/flashplayer/'>Adobe Flash Player</a>.") . '</p>' . $description;
}