*/
class Audio_Envelope_Public {
/**
* The ID of this plugin.
*
* @since 1.0.0
* @access private
* @var string $plugin_name The ID of this plugin.
*/
private $plugin_name;
/**
* The version of this plugin.
*
* @since 1.0.0
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Initialize the class and set its properties.
*
* @since 1.0.0
* @param string $plugin_name The name of the plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $plugin_name, $version ) {
$this->plugin_name = $plugin_name;
$this->version = $version;
}
/**
* Register the stylesheets for the public-facing side of the site.
*
* @since 1.0.0
*/
public function enqueue_styles() {
wp_enqueue_style( 'load-first', plugin_dir_url( __FILE__ ) . '/css/load_first.css', null, null, 'all');
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/audio-envelope-public.css', array( 'wp-mediaelement' ), $this->version, 'all' );
//wp_enqueue_style( 'loading-bar', plugin_dir_url( __FILE__ ) . 'js/loading-bar/loading-bar.css', array(), $this->version, 'all' );
}
/**
* Register the JavaScript for the public-facing side of the site.
*
* @since 1.0.0
*/
public function enqueue_scripts() {
// for backbone support
wp_enqueue_script( 'wp-api' );
wp_enqueue_script( 'wp-backbone' );
// wp_enqueue_script( 'jquery-ui-draggable' );
$type = 'audio';
/**
* These next 5 lines are taken from WP's media.php
*/
// wp_enqueue_style( 'wp-mediaelement' );
// wp_enqueue_script( 'wp-playlist' );
?>
version, false );
wp_enqueue_script( 'backbone-storage', plugin_dir_url( __FILE__ ) . 'js/backbone.localStorage.min.js', array(), $this->version, false );
// we are manually creating the SVG, so we no longer need to dynamically create them
//wp_enqueue_script( 'loading-bar', plugin_dir_url( __FILE__ ) . 'js/loading-bar/loading-bar.js', array(), $this->version, false );
// load player
if( defined('WP_DEBUG') && true === WP_DEBUG ) {
wp_register_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/audio-envelope.js',
array( 'jquery', 'wp-backbone', 'wp-playlist', 'checksum', 'backbone-storage' ),
$this->version,
false
);
} else {
wp_register_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . '../assets/js/frontend.js',
array( 'jquery', 'wp-backbone', 'wp-playlist', 'checksum', 'backbone-storage' ),
$this->version,
false
);
}
// Add localised variables
$localised_data = array(
'audio_selector' => get_option( 'audio_envelope_options_audio_selector' ),
);
wp_localize_script( $this->plugin_name, 'audio_envelope', $localised_data );
wp_enqueue_script( $this->plugin_name );
}
/**
* Add an HTML class to MediaElement.js container elements to aid styling.
*
* Extends the core _wpmejsSettings object to add a new feature via the
* MediaElement.js plugin API.
*/
function mejs_add_container_class() {
if ( ! wp_script_is( 'mediaelement', 'done' ) ) {
return;
}
?>
';
include_once( 'images/'.$button.'.svg' );
print ''."\n";
}
print ''."\n";
}
}