HEX
Server: Apache
System: Linux web2213.uni5.net 5.4.282-1.el8.elrepo.x86_64 #1 SMP Mon Aug 19 18:33:22 EDT 2024 x86_64
User: clinicamaciel (596848)
PHP: 7.3.33
Disabled: apache_child_terminate,c99_buff_prepare,c99_sess_put,dl,eval,exec,leak,link,myshellexec,openlog,passthru,pclose,pcntl_exec,php_check_syntax,php_strip_whitespace,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,symlink,system,socket_listen,socket_create_listen,putenv
Upload Files
File: /home/clinicamaciel/www/wp-content/plugins/magee-shortcodes/shortcodes/class-audio.php
<?php
if( !class_exists('Magee_Audio') ):
class Magee_Audio {
    
	
	public static $args;
	private $id;
    
	/**
	 * Initiate the shortcode
	 */
    public function __construct() {
	 
	    add_shortcode( 'ms_audio', array( $this,'render' ) );
	
	}
	/**
	 * Render the shortcode
	 * @param  array $args     Shortcode paramters
	 * @param  string $content Content between shortcode
	 * @return string          HTML output
	 */
     function render( $args, $content = '') {
	     
		 $defaults =  Magee_Core::set_shortcode_defaults(
		     
			 array(
			     'id'                    =>'',
				 'class'                 =>'',
				 'mute'                  =>'',
				 'mp3'                   =>'',
				 'ogg'                   =>'',
				 'wav'                   =>'',
				 'autoplay'              =>'',
				 'loop'                  =>'',    
				 'controls'              =>'', 
				 'style'                 =>'dark',
			 ),$args
	     );
	     
		 extract( $defaults );
		 self::$args = $defaults;
		 $addclass = uniqid('audiocontrols-');
		 $class .= ' '.$addclass;
		 if( $mute =='yes'):
		 $mute = 'mute';
		 else:
		 $mute = '';
		 endif;
		 if( $autoplay == 'yes'):
		 $autoplay = 'autoplay';
		 else:
		 $autoplay = '';
		 endif;
		 if( $loop == 'yes'):
		 $loop = 'loop';
		 else:
		 $loop = '';
		 endif;
		 if( $controls == 'yes'):
		 $controls = '';
		 else:
		 $controls = 'controls';
		 endif;
		 $html = '<audio preload="auto" class="ms-audio '.esc_attr($class).'" data-style="'.$style.'" data-controls="'.$controls.'"  id="'.esc_attr($id).'" data-mute="'.$mute.'" data-loop="'.$loop.'" data-autoplay="'.$autoplay.'" >';
		 if( !empty($mp3)){
		 $html .= '<source src="'.esc_url($mp3).'" type="audio/mpeg">';
		 }
		 if( !empty($ogg)){
		 $html .= '<source src="'.esc_url($ogg).'" type="audio/ogg">' ;
		 }
		 if( !empty($wav)){
		 $html .= '<source src="'.esc_url($ogg).'" type="audio/wav">' ;
		 }
		 $html .= 'Your browser does not support the audio element.' ;
		 $html .='</audio>'	 ;
		 $html .= "<script>
		jQuery(function($){
			if(jQuery('#magee-sc-form-preview').length>0){
				jQuery('#magee-sc-form-preview').ready(function(){
					jQuery('#magee-sc-form-preview').contents().find('.ms-audio').audioPlayer({
					classPrefix: 'audioplayer',
					strPlay: 'Play',
					strPause: 'Pause',
					strVolume: 'Volume',
					strControls : '".$controls."',
					strStyle : '".$style."',
				});
		        });
			}
		 });</script>";
		 return $html;
	 } 	 
}		 
new Magee_Audio();	
endif;