' . t('SCM Music Player is a free and open source web music player, that brings a steady playback music experience to your drupal site. The SCM Music Player administration page allows you to configure options including skin, playlist, and other configure settings.', array('@anon' => url('admin/config/media/scm_music_player'))) . '

'; } } /** * Implements hook_menu(). */ function scm_music_player_menu() { $items['admin/config/media/scm_music_player'] = array( 'title' => 'SCM Music Player', 'description' => 'Administer SCM Music Player', 'page callback' => 'drupal_get_form', 'page arguments' => array('scm_music_player_configure'), 'access callback' => 'user_access', 'access arguments' => array('administer scm_music_player settings'), ); return $items; } /** * Implements Creates/returns a form to configure the SCM Music Player settings. */ function scm_music_player_configure() { $form = array(); $form['scm_music_player_description'] = array( '#markup' => t('Use this page to set default SCM Music Player configuration.
Important: After saving the new settings please refresh/reload the site to see the changes.
'), ); $form['scm_music_player_stream_title'] = array( '#type' => 'textfield', '#title' => t('Stream Title'), '#default_value' => variable_get('scm_music_player_stream_title'), '#size' => 100, '#maxlength' => 40, '#required' => TRUE, '#description' => t('Insert Title for the Stream URL.'), ); $form['scm_music_player_stream_url'] = array( '#type' => 'textfield', '#title' => t('Stream URL'), '#default_value' => variable_get('scm_music_player_stream_url'), '#prefix' => '', '#description' => t('Stream URL accepts MP3 link, SoundCloud track or Youtube address.'), ); $form['scm_music_player_stream_playlist_url'] = array( '#type' => 'textfield', '#title' => t('RSS Podcast / SoundCloud Sets'), '#default_value' => variable_get('scm_music_player_stream_playlist_url'), '#prefix' => '
' . t('Manual Playlist') . '' . t('RSS Podcast / SoundCloud Sets') . '
', '#suffix' => '', '#suffix' => '
', '#description' => t('RSS Podcast SoundCloud Sets URL'), ); $form['scm_music_player_fieldset'] = array( '#type' => 'fieldset', '#title' => t('SCM Music Player Configure Setting'), '#collapsible' => TRUE, '#collapsed' => FALSE, ); $form['scm_music_player_fieldset']['scm_music_player_skin'] = array( '#type' => 'select', '#title' => t('Player Skin'), '#options' => array( 'tunes' => t('Itunes'), 'aquaBlue' => t('Blue'), 'aquaGreen' => t('Green'), 'aquaPink' => t('Pink'), 'aquaOrange' => t('Orange'), 'aquaPurple' => t('Purple'), ), '#default_value' => variable_get('scm_music_player_skin'), '#description' => t('Select a skin'), '#prefix' => '', ); $form['scm_music_player_fieldset']['scm_music_player_shuffle'] = array( '#type' => 'select', '#title' => t('Shuffle Playback'), '#options' => array( 'true' => t('True'), 'false' => t('False'), ), '#default_value' => variable_get('scm_music_player_shuffle'), '#description' => t('Enable Shuffle Playback'), '#prefix' => '', ); $form['scm_music_player_fieldset']['scm_music_player_showplaylist'] = array( '#type' => 'select', '#title' => t('Show Playlist'), '#options' => array( 'false' => t('False'), 'true' => t('True'), ), '#default_value' => variable_get('scm_music_player_showplaylist'), '#description' => t('Show Playlist by Default'), '#prefix' => '', ); $form['scm_music_player_fieldset']['scm_music_player_repeat'] = array( '#type' => 'select', '#title' => t('Repeat Mode'), '#options' => array( 0 => t('Play Playlist Once'), 1 => t('Repeat Playlist'), 2 => t('Repeat Item'), ), '#default_value' => variable_get('scm_music_player_repeat'), '#description' => t('Select a Repeat Mode'), '#prefix' => '', ); $form['scm_music_player_fieldset']['scm_music_player_autoplay'] = array( '#type' => 'select', '#title' => t('Auto Play'), '#options' => array( 'true' => t('True'), 'false' => t('False'), ), '#default_value' => variable_get('scm_music_player_autoplay'), '#description' => t('Enable autoplay on page load.'), '#prefix' => '', ); $form['scm_music_player_fieldset']['scm_music_player_placement'] = array( '#type' => 'select', '#title' => t('Placement'), '#options' => array( 'bottom' => t('Bottom'), 'top' => t('Top'), ), '#default_value' => variable_get('scm_music_player_placement'), '#description' => t('Placement of Player'), '#prefix' => '
', ); $form['scm_music_player_fieldset']['scm_music_player_enabled'] = array( '#type' => 'select', '#title' => t('Enable the player'), '#required' => TRUE, '#options' => array( 'true' => t('True'), 'false' => t('False'), ), '#default_value' => variable_get('scm_music_player_enabled'), '#description' => t('Enable the player'), '#prefix' => '', '#suffix' => '', '#suffix' => '', '#suffix' => '', '#suffix' => '', '#suffix' => '', '#suffix' => '
', ); return system_settings_form($form); } /** * Create a new permission to administer scm_music_player player. * * This permission can be given to any role. */ function scm_music_player_permission() { return array( 'administer scm_music_player settings' => array( 'title' => t('Administer SCM Music Player settings'), 'description' => t('Allow users to administer SCM Music Player settings'), ), ); } /** * Implements hook_page_build(). */ function scm_music_player_page_build() { if (!path_is_admin(current_path())) { $player_enabled = variable_get('scm_music_player_enabled'); if ($player_enabled == 'true') { global $base_url; $player_skin = variable_get('scm_music_player_skin'); $autoplay = variable_get('scm_music_player_autoplay'); $shuffle = variable_get('scm_music_player_shuffle'); $repeat = variable_get('scm_music_player_repeat'); $placement = variable_get('scm_music_player_placement'); $playlist = variable_get('scm_music_player_showplaylist'); $stream_url = variable_get('scm_music_player_stream_url'); $stream_title = variable_get('scm_music_player_stream_title'); $stream_playlist_url = variable_get('scm_music_player_stream_playlist_url'); if (empty($stream_playlist_url)) { $scmplayer_data_config = "{'skin':'skins/" . $player_skin . "/skin.css','volume':50,'autoplay':" . $autoplay . ",'shuffle':" . $shuffle . ",'repeat':" . $repeat . ",'placement':'" . $placement . "','showplaylist':" . $playlist . ",'playlist':[{'title':'" . $stream_title . "','url':'" . $stream_url . "'}]}"; } elseif (!empty($stream_playlist_url)) { $scmplayer_data_config = "{'skin':'skins/" . $player_skin . "/skin.css','volume':50,'autoplay':" . $autoplay . ",'shuffle':" . $shuffle . ",'repeat':" . $repeat . ",'placement':'" . $placement . "','showplaylist':" . $playlist . ",'playlist':'" . $stream_playlist_url . "'}"; } $scm_js = array( '#tag' => 'script', '#attributes' => array( 'type' => 'text/javascript', 'data-config' => $scmplayer_data_config, 'src' => url($base_url . '/' . libraries_get_path('scm-music-player') . '/script.js', array('absolute' => TRUE) ), ), '#value' => '', '#theme' => 'html_tag', ); drupal_add_html_head($scm_js, 'scm_music_player'); } } }