. * */ if ( ! defined( 'ABSPATH' ) ) { exit; } class AudioIgniter { /** * AudioIgniter version. * * @var string * @since 1.0.0 * @since 1.7.0 Changed from static to non-static. */ public $version = null; /** * Instance of this class. * * @var AudioIgniter * @since 1.0.0 */ protected static $instance = null; /** * Sanitizer instance. * * @var AudioIgniter_Sanitizer * @since 1.0.0 */ public $sanitizer = null; /** * The URL directory path (with trailing slash) of the main plugin file. * * @var string * @since 1.0.0 */ protected static $plugin_url = ''; /** * The filesystem directory path (with trailing slash) of the main plugin file. * * @var string * @since 1.0.0 */ protected static $plugin_path = ''; /** * Playlist post type name. * * @var string * @since 1.0.0 */ public $post_type = 'ai_playlist'; /** * AudioIgniter Instance. * * Instantiates or reuses an instance of AudioIgniter. * * @since 1.0.0 * @static * @see AudioIgniter() * @return AudioIgniter - Single instance. */ public static function instance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * AudioIgniter constructor. Intentionally left empty so that instances can be created without * re-loading of resources (e.g. scripts/styles), or re-registering hooks. * http://wordpress.stackexchange.com/questions/70055/best-way-to-initiate-a-class-in-a-wp-plugin * https://gist.github.com/toscho/3804204 * * @since 1.0.0 */ public function __construct() {} /** * Kickstarts plugin loading. * * @since 1.0.0 */ public function plugin_setup() { if ( is_null( $this->version ) ) { if ( ! function_exists( 'get_plugin_data' ) ) { include_once ABSPATH . 'wp-admin/includes/plugin.php'; } $plugin_data = get_plugin_data( __FILE__ ); $this->version = $plugin_data['Version']; } self::$plugin_url = plugin_dir_url( __FILE__ ); self::$plugin_path = plugin_dir_path( __FILE__ ); load_plugin_textdomain( 'audioigniter', false, dirname( self::plugin_basename() ) . '/languages' ); include_once( 'class-audioigniter-sanitizer.php' ); $this->sanitizer = new AudioIgniter_Sanitizer(); // Initialization needed in every request. $this->init(); // Initialization needed in admin requests. $this->admin_init(); // Initialization needed in frontend requests. $this->frontend_init(); do_action( 'audioigniter_loaded' ); } /** * Registers actions that need to be run on both admin and frontend * * @since 1.0.0 */ protected function init() { add_action( 'init', array( $this, 'register_post_types' ) ); add_action( 'init', array( $this, 'register_scripts' ) ); add_action( 'init', array( $this, 'register_playlist_endpoint' ) ); add_action( 'init', array( $this, 'register_image_sizes' ) ); add_action( 'init', array( $this, 'register_shortcodes' ) ); add_action( 'widgets_init', array( $this, 'register_widgets' ) ); do_action( 'audioigniter_init' ); } /** * Registers actions that need to be run on admin only. * * @since 1.0.0 */ protected function admin_init() { if ( ! is_admin() ) { return; } add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) ); add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); add_action( 'save_post', array( $this, 'save_post' ) ); do_action( 'audioigniter_admin_init' ); } /** * Registers actions that need to be run on frontend only. * * @since 1.0.0 */ protected function frontend_init() { if ( is_admin() ) { return; } add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); add_action( 'template_redirect', array( $this, 'handle_playlist_endpoint' ) ); do_action( 'audioigniter_frontend_init' ); } /** * Register (but not enqueue) all scripts and styles to be used throughout the plugin. * * @since 1.0.0 */ public function register_scripts() { wp_register_style( 'audioigniter', $this->plugin_url() . 'player/build/style.css', array(), $this->version ); wp_register_style( 'audioigniter-admin', $this->plugin_url() . 'assets/css/admin-styles.css', array(), $this->version ); wp_register_script( 'audioigniter', $this->plugin_url() . 'player/build/app.js', array(), $this->version, true ); wp_register_script( 'audioigniter-admin', $this->plugin_url() . 'assets/js/audioigniter.js', array(), $this->version, true ); wp_localize_script( 'audioigniter', 'aiStrings', apply_filters( 'audioigniter_aiStrings', array( /* translators: %s is the track's title. */ 'play_title' => esc_html__( 'Play %s', 'audioigniter' ), /* translators: %s is the track's title. */ 'pause_title' => esc_html__( 'Pause %s', 'audioigniter' ), 'previous' => esc_html__( 'Previous track', 'audioigniter' ), 'next' => esc_html__( 'Next track', 'audioigniter' ), 'toggle_list_repeat' => esc_html__( 'Toggle track listing repeat', 'audioigniter' ), 'toggle_track_repeat' => esc_html__( 'Toggle track repeat' ), 'toggle_list_visible' => esc_html__( 'Toggle track listing visibility', 'audioigniter' ), 'buy_track' => esc_html__( 'Buy this track', 'audioigniter' ), 'download_track' => esc_html__( 'Download this track', 'audioigniter' ), 'volume_up' => esc_html__( 'Volume Up', 'audioigniter' ), 'volume_down' => esc_html__( 'Volume Down', 'audioigniter' ), 'open_track_lyrics' => esc_html__( 'Open track lyrics', 'audioigniter' ), 'set_playback_rate' => esc_html__( 'Set playback rate', 'audioigniter' ), 'skip_forward' => esc_html__( 'Skip forward', 'audioigniter' ), 'skip_backward' => esc_html__( 'Skip backward', 'audioigniter' ), 'shuffle' => esc_html__( 'Shuffle', 'audioigniter' ), ) ) ); wp_localize_script( 'audioigniter-admin', 'ai_scripts', array( 'messages' => array( 'confirm_clear_tracks' => esc_html__( 'Do you really want to remove all tracks? (This will not delete your audio files).', 'audioigniter' ), 'media_title_upload' => esc_html__( 'Select or upload audio media', 'audioigniter' ), 'media_title_upload_cover' => esc_html__( 'Select a cover image', 'audioigniter' ), ), ) ); } /** * Enqueues frontend scripts and styles. * * @since 1.0.0 */ public function enqueue_scripts() { wp_enqueue_style( 'audioigniter' ); wp_enqueue_script( 'audioigniter' ); } /** * Enqueues admin scripts and styles. * * @since 1.0.0 */ public function enqueue_admin_scripts( $hook ) { $screen = get_current_screen(); if ( 'post' === $screen->base && $screen->post_type === $this->post_type ) { wp_enqueue_media(); wp_enqueue_style( 'audioigniter-admin' ); wp_enqueue_script( 'audioigniter-admin' ); } } /** * Post types registration. * * @since 1.0.0 */ public function register_post_types() { $labels = array( 'name' => esc_html_x( 'Playlists', 'post type general name', 'audioigniter' ), 'singular_name' => esc_html_x( 'Playlist', 'post type singular name', 'audioigniter' ), 'menu_name' => esc_html_x( 'Playlists', 'admin menu', 'audioigniter' ), 'name_admin_bar' => esc_html_x( 'Playlist', 'add new on admin bar', 'audioigniter' ), 'add_new' => esc_html__( 'Add New Playlist', 'audioigniter' ), 'add_new_item' => esc_html__( 'Add New Playlist', 'audioigniter' ), 'edit_item' => esc_html__( 'Edit Playlist', 'audioigniter' ), 'new_item' => esc_html__( 'New Playlist', 'audioigniter' ), 'view_item' => esc_html__( 'View Playlist', 'audioigniter' ), 'search_items' => esc_html__( 'Search Playlists', 'audioigniter' ), 'not_found' => esc_html__( 'No playlists found', 'audioigniter' ), 'not_found_in_trash' => esc_html__( 'No playlists found in the trash', 'audioigniter' ), ); $args = array( 'labels' => $labels, 'singular_label' => esc_html_x( 'Playlist', 'post type singular name', 'audioigniter' ), 'public' => false, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'has_archive' => false, 'supports' => array( 'title' ), 'menu_icon' => 'dashicons-controls-volumeon', ); register_post_type( $this->post_type, $args ); } /** * Registers metaboxes for the ai_playlist post type. * * @since 1.0.0 */ public function add_meta_boxes() { add_meta_box( 'ai-meta-box-tracks', esc_html__( 'Tracks', 'audioigniter' ), array( $this, 'metabox_tracks' ), $this->post_type, 'normal', 'high' ); add_meta_box( 'ai-meta-box-settings', esc_html__( 'Settings', 'audioigniter' ), array( $this, 'metabox_settings' ), $this->post_type, 'normal', 'high' ); add_meta_box( 'ai-meta-box-shortcode', esc_html__( 'Shortcode', 'audioigniter' ), array( $this, 'metabox_shortcode' ), $this->post_type, 'normal', 'high' ); } /** * Echoes the Tracks metabox markup. * * @since 1.0.0 * * @param WP_Post $object * @param array $box */ public function metabox_tracks( $object, $box ) { $tracks = $this->get_post_meta( $object->ID, '_audioigniter_tracks', array() ); wp_nonce_field( basename( __FILE__ ), $object->post_type . '_nonce' ); ?> metabox_tracks_header(); ?>
metabox_tracks_field_controls( 'top' ); ?>
metabox_tracks_repeatable_track_field( $track ); } } else { $this->metabox_tracks_repeatable_track_field(); } ?>
metabox_tracks_field_controls( 'bottom' ); ?>
metabox_tracks_footer(); ?>
get_post_meta( $object->ID, '_audioigniter_player_type', 'full' ); $numbers = $this->get_post_meta( $object->ID, '_audioigniter_show_numbers', 1 ); $numbers_reverse = $this->get_post_meta( $object->ID, '_audioigniter_show_numbers_reverse', 0 ); $thumb = $this->get_post_meta( $object->ID, '_audioigniter_show_covers', 1 ); $active_thumb = $this->get_post_meta( $object->ID, '_audioigniter_show_active_cover', 1 ); $artist = $this->get_post_meta( $object->ID, '_audioigniter_show_artist', 1 ); $buy_links = $this->get_post_meta( $object->ID, '_audioigniter_show_buy_links', 1 ); $buy_links_new_target = $this->get_post_meta( $object->ID, '_audioigniter_buy_links_new_target', 1 ); $cycle_tracks = $this->get_post_meta( $object->ID, '_audioigniter_cycle_tracks', 0 ); $track_listing = $this->get_post_meta( $object->ID, '_audioigniter_show_track_listing', 1 ); $track_listing_allow_toggle = $this->get_post_meta( $object->ID, '_audioigniter_allow_track_listing_toggle', 1 ); $track_listing_allow_loop = $this->get_post_meta( $object->ID, '_audioigniter_allow_track_listing_loop', 1 ); $credit = $this->get_post_meta( $object->ID, '_audioigniter_show_credit', 0 ); $limit_tracklisting_height = $this->get_post_meta( $object->ID, '_audioigniter_limit_tracklisting_height', 1 ); $tracklisting_height = $this->get_post_meta( $object->ID, '_audioigniter_tracklisting_height', 185 ); $volume = $this->get_post_meta( $object->ID, '_audioigniter_volume', 100 ); $max_width = $this->get_post_meta( $object->ID, '_audioigniter_max_width' ); wp_nonce_field( basename( __FILE__ ), $object->post_type . '_nonce' ); ?>

/>
/>
/>

/>

/>
/>
/>
/>
/>
/>

/>
/>
/>

ID ) ); ?>" />
array( 'label' => __( 'Full Player', 'audioigniter' ), 'no-support' => array(), 'info' => '', ), 'simple' => array( 'label' => __( 'Simple Player', 'audioigniter' ), 'no-support' => array( 'show_track_listing', 'show_covers', 'show_active_cover', 'limit_tracklisting_height', 'tracklisting_height', 'allow_track_listing_loop', 'allow_track_listing_toggle', 'skip_amount', 'initial_track', ), 'info' => '', ), ); return apply_filters( 'audioigniter_player_types', $player_types ); } public function save_post( $post_id ) { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return false; } if ( isset( $_POST['post_view'] ) && 'list' === $_POST['post_view'] ) { return false; } if ( ! isset( $_POST['post_type'] ) || $_POST['post_type'] !== $this->post_type ) { return false; } if ( ! isset( $_POST[ $this->post_type . '_nonce' ] ) || ! wp_verify_nonce( $_POST[ $this->post_type . '_nonce' ], basename( __FILE__ ) ) ) { return false; } $post_type_obj = get_post_type_object( $this->post_type ); if ( ! current_user_can( $post_type_obj->cap->edit_post, $post_id ) ) { return false; } update_post_meta( $post_id, '_audioigniter_tracks', $this->sanitizer->metabox_playlist( $_POST['ai_playlist_tracks'], $post_id ) ); update_post_meta( $post_id, '_audioigniter_show_numbers', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_numbers'] ) ); update_post_meta( $post_id, '_audioigniter_show_numbers_reverse', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_numbers_reverse'] ) ); update_post_meta( $post_id, '_audioigniter_show_covers', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_covers'] ) ); update_post_meta( $post_id, '_audioigniter_show_active_cover', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_active_cover'] ) ); update_post_meta( $post_id, '_audioigniter_show_artist', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_artist'] ) ); update_post_meta( $post_id, '_audioigniter_show_buy_links', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_buy_links'] ) ); update_post_meta( $post_id, '_audioigniter_buy_links_new_target', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_buy_links_new_target'] ) ); update_post_meta( $post_id, '_audioigniter_cycle_tracks', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_cycle_tracks'] ) ); update_post_meta( $post_id, '_audioigniter_show_track_listing', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_track_listing'] ) ); update_post_meta( $post_id, '_audioigniter_allow_track_listing_toggle', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_allow_track_listing_toggle'] ) ); update_post_meta( $post_id, '_audioigniter_allow_track_listing_loop', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_allow_track_listing_loop'] ) ); update_post_meta( $post_id, '_audioigniter_player_type', $this->sanitizer->player_type( $_POST['_audioigniter_player_type'] ) ); update_post_meta( $post_id, '_audioigniter_show_credit', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_credit'] ) ); update_post_meta( $post_id, '_audioigniter_limit_tracklisting_height', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_limit_tracklisting_height'] ) ); update_post_meta( $post_id, '_audioigniter_tracklisting_height', intval( $_POST['_audioigniter_tracklisting_height'] ) ); update_post_meta( $post_id, '_audioigniter_volume', intval( $_POST['_audioigniter_volume'] ) ); update_post_meta( $post_id, '_audioigniter_max_width', $this->sanitizer->intval_or_empty( $_POST['_audioigniter_max_width'] ) ); /** * @since 1.4.0 */ do_action( 'audioigniter_save_post', $post_id ); } public static function get_default_track_values() { return apply_filters( 'audioigniter_default_track_values', array( 'cover_id' => '', 'title' => '', 'artist' => '', 'track_url' => '', 'buy_link' => '', 'download_url' => '', ) ); } public function register_image_sizes() { add_image_size( 'audioigniter_cover', 560, 560, true ); } public function register_widgets() { $widgets = apply_filters( 'audioigniter_register_widgets', array() ); foreach ( $widgets as $class => $file ) { require_once( $file ); register_widget( $class ); } } public function register_shortcodes() { add_shortcode( 'ai_playlist', array( $this, 'shortcode_ai_playlist' ) ); } /** * Checks whether passed post object or ID is an AudioIgniter playlist. * * @version 1.4.0 * @since 1.4.0 * * @param int|WP_Post $post Post ID or post object. * * @return bool */ public function is_playlist( $post ) { $post = get_post( $post ); if ( is_wp_error( $post ) || empty( $post ) || is_null( $post ) || $post->post_type !== $this->post_type ) { return false; } return true; } /** * Returns a data attributes array for the given playlist. * * @version 1.4.0 * @since 1.4.0 * * @param int $post_id Post ID. * * @return array */ public function get_playlist_data_attributes_array( $post_id ) { $post_id = intval( $post_id ); if ( ! $this->is_playlist( $post_id ) ) { return array(); } $attrs = array( 'data-player-type' => $this->get_post_meta( $post_id, '_audioigniter_player_type', 'full' ), 'data-tracks-url' => add_query_arg( array( 'audioigniter_playlist_id' => $post_id ), home_url( '/' ) ), 'data-display-track-no' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_numbers', 1 ) ), 'data-reverse-track-order' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_numbers_reverse', 0 ) ), 'data-display-tracklist-covers' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_covers', 1 ) ), 'data-display-active-cover' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_active_cover', 1 ) ), 'data-display-artist-names' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_artist', 1 ) ), 'data-display-buy-buttons' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_buy_links', 1 ) ), 'data-buy-buttons-target' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_buy_links_new_target', 1 ) ), 'data-cycle-tracks' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_cycle_tracks', 0 ) ), 'data-display-credits' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_credit', 1 ) ), 'data-display-tracklist' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_track_listing', 1 ) ), 'data-allow-tracklist-toggle' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_allow_track_listing_toggle', 1 ) ), 'data-allow-tracklist-loop' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_allow_track_listing_loop', 1 ) ), 'data-limit-tracklist-height' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_limit_tracklisting_height', 1 ) ), 'data-volume' => intval( $this->get_post_meta( $post_id, '_audioigniter_volume', 100 ) ), 'data-tracklist-height' => intval( $this->get_post_meta( $post_id, '_audioigniter_tracklisting_height', 185 ) ), 'data-max-width' => $this->get_post_meta( $post_id, '_audioigniter_max_width' ), ); return apply_filters( 'audioigniter_get_playlist_data_attributes_array', $attrs, $post_id ); } /** * Returns the output of the [ai_playlist] shortcode. * * @version 1.4.0 * @since 1.0.0 * * @param array $atts The shortcode attributes. * @param string $content Content, when used with a shortcode closing tag. * @param string $tag The shortcode name used to reach this function. * * @return string */ public function shortcode_ai_playlist( $atts, $content, $tag ) { $atts = shortcode_atts( array( 'id' => '', 'class' => '', ), $atts, $tag ); $id = intval( $atts['id'] ); $class_name = $atts['class']; if ( ! $this->is_playlist( $id ) ) { return ''; } $post = get_post( $id ); $params = apply_filters( 'audioigniter_shortcode_data_attributes_array', $this->get_playlist_data_attributes_array( $id ), $id, $post ); $params = array_filter( $params, array( $this->sanitizer, 'array_filter_empty_null' ) ); $params = $this->sanitizer->html_data_attributes_array( $params ); // Returning a truthy value from the filter, will short-circuit execution of the shortcode. if ( false !== apply_filters( 'audioigniter_shortcode_shortcircuit', false, $id, $post, $params ) ) { return ''; } $data = ''; foreach ( $params as $attribute => $value ) { $data .= sprintf( '%s="%s" ', sanitize_key( $attribute ), esc_attr( $value ) ); } $player_classes = array_merge( array( 'audioigniter-root', ), explode( ' ', $class_name ) ); $output = sprintf( '
', esc_attr( $id ), esc_attr( implode( ' ', $player_classes ) ), $data ); return $output; } public function convert_bool_string( $value ) { if ( $value ) { return 'true'; } return 'false'; } public function register_playlist_endpoint() { add_rewrite_tag( '%audioigniter_playlist_id%', '([0-9]+)' ); add_rewrite_rule( '^audioigniter/playlist/([0-9]+)/?', 'index.php?audioigniter_playlist_id=$matches[1]', 'bottom' ); } public function handle_playlist_endpoint() { global $wp_query; $playlist_id = $wp_query->get( 'audioigniter_playlist_id' ); if ( empty( $playlist_id ) ) { return; } $playlist_id = intval( $playlist_id ); $post = get_post( $playlist_id ); if ( empty( $post ) || $post->post_type !== $this->post_type ) { wp_send_json_error( __( "ID doesn't match a playlist", 'audioigniter' ) ); } $response = array(); $tracks = $this->get_post_meta( $playlist_id, '_audioigniter_tracks', array() ); if ( empty( $tracks ) ) { $tracks = array(); } foreach ( $tracks as $track ) { $track = wp_parse_args( $track, self::get_default_track_values() ); $track_response = array(); $track_response['title'] = $track['title']; $track_response['subtitle'] = $track['artist']; $track_response['audio'] = $track['track_url']; $track_response['buyUrl'] = $track['buy_link']; $track_response['downloadUrl'] = $track['download_url']; $track_response['downloadFilename'] = $this->get_filename_from_url( $track['download_url'] ); if ( ! $track_response['downloadFilename'] ) { $track_response['downloadFilename'] = $track_response['downloadUrl']; } $cover_url = wp_get_attachment_image_src( intval( $track['cover_id'] ), 'audioigniter_cover' ); if ( ! empty( $cover_url[0] ) ) { $cover_url = $cover_url[0]; } else { $cover_url = ''; } $track_response['cover'] = $cover_url; $track_response = apply_filters( 'audioigniter_playlist_endpoint_track', $track_response, $track, $playlist_id, $post ); $response[] = $track_response; } wp_send_json( $response ); } function get_filename_from_url( $url ) { $struct = wp_parse_url( $url ); if ( ! empty( $struct['path'] ) ) { return basename( $struct['path'] ); } return ''; } public function get_all_playlists( $orderby = 'date', $order = 'DESC' ) { $q = new WP_Query( array( 'post_type' => $this->post_type, 'posts_per_page' => - 1, 'orderby' => $orderby, 'order' => $order, ) ); return $q->posts; } public function get_post_meta( $post_id, $key, $default = '' ) { $keys = get_post_custom_keys( $post_id ); $value = $default; if ( is_array( $keys ) && in_array( $key, $keys, true ) ) { $value = get_post_meta( $post_id, $key, true ); } return $value; } public function plugin_activated() { if ( ! current_user_can( 'activate_plugins' ) ) { return; } $this->register_post_types(); do_action( 'audioigniter_activated' ); flush_rewrite_rules(); } public function plugin_deactivated() { if ( ! current_user_can( 'activate_plugins' ) ) { return; } unregister_post_type( $this->post_type ); do_action( 'audioigniter_deactivated' ); flush_rewrite_rules(); } public static function plugin_basename() { return plugin_basename( __FILE__ ); } public function plugin_url() { return self::$plugin_url; } public function plugin_path() { return self::$plugin_path; } } /** * Main instance of AudioIgniter. * * Returns the working instance of AudioIgniter. No need for globals. * * @since 1.0.0 * @return AudioIgniter */ function AudioIgniter() { return AudioIgniter::instance(); } add_action( 'plugins_loaded', array( AudioIgniter(), 'plugin_setup' ) ); register_activation_hook( __FILE__, array( AudioIgniter(), 'plugin_activated' ) ); register_deactivation_hook( __FILE__, array( AudioIgniter(), 'plugin_deactivated' ) );