Example #1
0
 /**
  * Renders audio player for the blog
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function renderAudioPlayer($uri, $options = array())
 {
     // Merge the options with the default options
     $options = array_replace_recursive(self::$defaultAudioOptions, $options);
     // Generate a random uid
     $uniqid = uniqid();
     $uid = 'audio-' . EBMM::getHash($uri . $uniqid);
     // Url to the audio
     $url = $this->normalizeURI($uri);
     // Get the track if there is no track provided
     if (!$options['track']) {
         $options['track'] = basename($url);
     }
     // Set a default artist if artist isn't set
     if (!$options['artist']) {
         $options['artist'] = JText::_('COM_EASYBLOG_BLOCKS_AUDIO_ARTIST');
     }
     $template = EB::template();
     $template->set('uid', $uid);
     $template->set('showTrack', $options['showTrack']);
     $template->set('showDownload', $options['showDownload']);
     $template->set('showArtist', $options['showArtist']);
     $template->set('autoplay', $options['autoplay']);
     $template->set('loop', $options['loop']);
     $template->set('artist', $options['artist']);
     $template->set('track', $options['track']);
     $template->set('url', $url);
     $output = $template->output('site/blogs/blocks/audio');
     return $output;
 }