function theme_mp3player in MP3 Player 7.2
Same name and namespace in other branches
- 6.2 mp3player.module \theme_mp3player()
- 6 mp3player.module \theme_mp3player()
Setup theme function for the MP3 Player.
1 theme call to theme_mp3player()
- filefieldmp3player_field_formatter_view in filefieldmp3player/
filefieldmp3player.module - Implements hook_field_formatter_view().
File
- ./
mp3player.module, line 641 - mp3player main module file.
Code
function theme_mp3player($variables) {
global $mp3_player_id;
$mp3_player_id++;
$id = 'mp3player_' . $mp3_player_id;
$player = $variables['player'];
$file = $variables['file'];
$title = $variables['title'];
$audio_url = file_create_url($file);
if (variable_get('mp3player_encode', 'no') == 'yes') {
$audio_url = mp3player_encodeSource($file);
}
$audio_url = url($audio_url);
$options = array();
$options[] = 'soundFile: "' . $audio_url . '"';
if (isset($title)) {
$title = filter_xss($title);
$options[] = 'titles: "' . addslashes($title) . '"';
}
if (isset($artist)) {
$artist = filter_xss($artist);
$options[] = 'artists: "' . addslashes($artist) . '"';
}
$options = implode(',', $options);
// WE ONLY WANT THE SETUP ONCE PER PAGE
$setup =& drupal_static(__FUNCTION__);
if (!$setup) {
$setup = mp3player_player_settings($player);
drupal_add_js($setup, 'inline');
}
$return = array();
$return[] = '<p id="' . $id . '">';
$return[] = t("No Adobe Flash Player installed. <a href='http://get.adobe.com/flashplayer/'>Get it now.</a>");
$return[] = '</p>';
$return[] = '<div class="mp3_title">' . $title . '</div>';
$return[] = '<script type="text/javascript">AudioPlayer.embed("' . $id . '", {' . $options . '});</script>';
return implode('', $return);
}