PluginProbe
AudioIgniter Music Player / 1.4.0
AudioIgniter Music Player v1.4.0
2.0.4 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.3.0 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.9.0 2.0.0 2.0.1 2.0.2 All 26 releases
audioigniter / audioigniter.php

audioigniter.php in AudioIgniter Music Player 1.4.0, at audioigniter.php

1,264 lines 40.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: AudioIgniter
4 * Plugin URI: https://www.cssigniter.com/ignite/plugins/audioigniter/
5 * Description: AudioIgniter lets you create music playlists and embed them in your WordPress posts, pages or custom post types and serve your audio content in style!
6 * Author: The CSSIgniter Team
7 * Author URI: https://www.cssigniter.com
8 * Version: 1.4.0
9 * Text Domain: audioigniter
10 * Domain Path: languages
11 *
12 * AudioIgniter is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 2 of the License, or
15 * any later version.
16 *
17 * AudioIgniter Downloads is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with AudioIgniter. If not, see <http://www.gnu.org/licenses/>.
24 *
25 */
26
27 if ( ! defined( 'ABSPATH' ) ) {
28 exit;
29 }
30
31
32 class AudioIgniter {
33
34 /**
35 * AudioIgniter version.
36 *
37 * @var string
38 * @since 1.0.0
39 */
40 public static $version = '1.4.0';
41
42 /**
43 * Instance of this class.
44 *
45 * @var AudioIgniter
46 * @since 1.0.0
47 */
48 protected static $instance = null;
49
50 /**
51 * Sanitizer instance.
52 *
53 * @var AudioIgniter_Sanitizer
54 * @since 1.0.0
55 */
56 public $sanitizer = null;
57
58 /**
59 * The URL directory path (with trailing slash) of the main plugin file.
60 *
61 * @var string
62 * @since 1.0.0
63 */
64 protected static $plugin_url = '';
65
66 /**
67 * The filesystem directory path (with trailing slash) of the main plugin file.
68 *
69 * @var string
70 * @since 1.0.0
71 */
72 protected static $plugin_path = '';
73
74
75 /**
76 * Playlist post type name.
77 *
78 * @var string
79 * @since 1.0.0
80 */
81 public $post_type = 'ai_playlist';
82
83
84
85 /**
86 * AudioIgniter Instance.
87 *
88 * Instantiates or reuses an instance of AudioIgniter.
89 *
90 * @since 1.0.0
91 * @static
92 * @see AudioIgniter()
93 * @return AudioIgniter - Single instance.
94 */
95 public static function instance() {
96 if ( is_null( self::$instance ) ) {
97 self::$instance = new self();
98 }
99 return self::$instance;
100 }
101
102
103 /**
104 * AudioIgniter constructor. Intentionally left empty so that instances can be created without
105 * re-loading of resources (e.g. scripts/styles), or re-registering hooks.
106 * http://wordpress.stackexchange.com/questions/70055/best-way-to-initiate-a-class-in-a-wp-plugin
107 * https://gist.github.com/toscho/3804204
108 *
109 * @since 1.0.0
110 */
111 public function __construct() {}
112
113 /**
114 * Kickstarts plugin loading.
115 *
116 * @since 1.0.0
117 */
118 public function plugin_setup() {
119 self::$plugin_url = plugin_dir_url( __FILE__ );
120 self::$plugin_path = plugin_dir_path( __FILE__ );
121
122 load_plugin_textdomain( 'audioigniter', false, dirname( self::plugin_basename() ) . '/languages' );
123
124 include_once( 'class-audioigniter-sanitizer.php' );
125 $this->sanitizer = new AudioIgniter_Sanitizer();
126
127 // Initialization needed in every request.
128 $this->init();
129
130 // Initialization needed in admin requests.
131 $this->admin_init();
132
133 // Initialization needed in frontend requests.
134 $this->frontend_init();
135
136 do_action( 'audioigniter_loaded' );
137 }
138
139 /**
140 * Registers actions that need to be run on both admin and frontend
141 *
142 * @since 1.0.0
143 */
144 protected function init() {
145 add_action( 'init', array( $this, 'register_post_types' ) );
146 add_action( 'init', array( $this, 'register_scripts' ) );
147 add_action( 'init', array( $this, 'register_playlist_endpoint' ) );
148 add_action( 'init', array( $this, 'register_image_sizes' ) );
149 add_action( 'init', array( $this, 'register_shortcodes' ) );
150 add_action( 'widgets_init', array( $this, 'register_widgets' ) );
151
152 do_action( 'audioigniter_init' );
153 }
154
155
156 /**
157 * Registers actions that need to be run on admin only.
158 *
159 * @since 1.0.0
160 */
161 protected function admin_init() {
162 if ( ! is_admin() ) {
163 return;
164 }
165
166 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
167 add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
168 add_action( 'save_post', array( $this, 'save_post' ) );
169
170 do_action( 'audioigniter_admin_init' );
171 }
172
173 /**
174 * Registers actions that need to be run on frontend only.
175 *
176 * @since 1.0.0
177 */
178 protected function frontend_init() {
179 if ( is_admin() ) {
180 return;
181 }
182
183 add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
184 add_action( 'template_redirect', array( $this, 'handle_playlist_endpoint' ) );
185
186 do_action( 'audioigniter_frontend_init' );
187 }
188
189 /**
190 * Register (but not enqueue) all scripts and styles to be used throughout the plugin.
191 *
192 * @since 1.0.0
193 */
194 public function register_scripts() {
195 wp_register_style( 'audioigniter', $this->plugin_url() . 'player/build/style.css', array(), self::$version );
196 wp_register_style( 'audioigniter-admin', $this->plugin_url() . 'assets/css/admin-styles.css', array(), self::$version );
197
198 wp_register_script( 'audioigniter', $this->plugin_url() . 'player/build/app.js', array(), self::$version, true );
199 wp_register_script( 'audioigniter-admin', $this->plugin_url() . 'assets/js/audioigniter.js', array(), self::$version, true );
200
201 wp_localize_script( 'audioigniter-admin', 'ai_scripts', array(
202 'messages' => array(
203 'confirm_clear_tracks' => esc_html__( 'Do you really want to remove all tracks? (This will not delete your audio files).', 'audioigniter' ),
204 'media_title_upload' => esc_html__( 'Select or upload audio media', 'audioigniter' ),
205 'media_title_upload_cover' => esc_html__( 'Select a cover image', 'audioigniter' ),
206 ),
207 ) );
208 }
209
210 /**
211 * Enqueues frontend scripts and styles.
212 *
213 * @since 1.0.0
214 */
215 public function enqueue_scripts() {
216 wp_enqueue_style( 'audioigniter' );
217 wp_enqueue_script( 'audioigniter' );
218 }
219
220 /**
221 * Enqueues admin scripts and styles.
222 *
223 * @since 1.0.0
224 */
225 public function enqueue_admin_scripts( $hook ) {
226 $screen = get_current_screen();
227
228 if ( 'post' === $screen->base && $screen->post_type === $this->post_type ) {
229 wp_enqueue_media();
230 wp_enqueue_style( 'audioigniter-admin' );
231 wp_enqueue_script( 'audioigniter-admin' );
232 }
233 }
234
235 /**
236 * Post types registration.
237 *
238 * @since 1.0.0
239 */
240 public function register_post_types() {
241 $labels = array(
242 'name' => esc_html_x( 'Playlists', 'post type general name', 'audioigniter' ),
243 'singular_name' => esc_html_x( 'Playlist', 'post type singular name', 'audioigniter' ),
244 'menu_name' => esc_html_x( 'Playlists', 'admin menu', 'audioigniter' ),
245 'name_admin_bar' => esc_html_x( 'Playlist', 'add new on admin bar', 'audioigniter' ),
246 'add_new' => esc_html__( 'Add New Playlist', 'audioigniter' ),
247 'add_new_item' => esc_html__( 'Add New Playlist', 'audioigniter' ),
248 'edit_item' => esc_html__( 'Edit Playlist', 'audioigniter' ),
249 'new_item' => esc_html__( 'New Playlist', 'audioigniter' ),
250 'view_item' => esc_html__( 'View Playlist', 'audioigniter' ),
251 'search_items' => esc_html__( 'Search Playlists', 'audioigniter' ),
252 'not_found' => esc_html__( 'No playlists found', 'audioigniter' ),
253 'not_found_in_trash' => esc_html__( 'No playlists found in the trash', 'audioigniter' ),
254 );
255
256 $args = array(
257 'labels' => $labels,
258 'singular_label' => esc_html_x( 'Playlist', 'post type singular name', 'audioigniter' ),
259 'public' => false,
260 'show_ui' => true,
261 'capability_type' => 'post',
262 'hierarchical' => false,
263 'has_archive' => false,
264 'supports' => array( 'title' ),
265 'menu_icon' => 'dashicons-controls-volumeon',
266 );
267
268 register_post_type( $this->post_type, $args );
269 }
270
271
272 /**
273 * Registers metaboxes for the ai_playlist post type.
274 *
275 * @since 1.0.0
276 */
277 public function add_meta_boxes() {
278 add_meta_box( 'ai-meta-box-tracks', esc_html__( 'Tracks', 'audioigniter' ), array( $this, 'metabox_tracks' ), $this->post_type, 'normal', 'high' );
279 add_meta_box( 'ai-meta-box-settings', esc_html__( 'Settings', 'audioigniter' ), array( $this, 'metabox_settings' ), $this->post_type, 'normal', 'high' );
280 add_meta_box( 'ai-meta-box-shortcode', esc_html__( 'Shortcode', 'audioigniter' ), array( $this, 'metabox_shortcode' ), $this->post_type, 'normal', 'high' );
281 }
282
283 /**
284 * Echoes the Tracks metabox markup.
285 *
286 * @since 1.0.0
287 *
288 * @param WP_Post $object
289 * @param array $box
290 */
291 public function metabox_tracks( $object, $box ) {
292 $tracks = $this->get_post_meta( $object->ID, '_audioigniter_tracks', array() );
293
294 wp_nonce_field( basename( __FILE__ ), $object->post_type . '_nonce' );
295 ?>
296
297 <?php $this->metabox_tracks_header(); ?>
298
299 <div class="ai-container">
300 <?php $this->metabox_tracks_field_controls(); ?>
301
302 <?php $container_classes = apply_filters( 'audioigniter_metabox_tracks_container_classes', array( 'ai-fields-container' ) ); ?>
303
304 <div class="<?php echo esc_attr( implode( ' ', $container_classes ) ); ?>">
305 <?php
306 if ( ! empty( $tracks ) ) {
307 foreach ( $tracks as $track ) {
308 $this->metabox_tracks_repeatable_track_field( $track );
309 }
310 } else {
311 $this->metabox_tracks_repeatable_track_field();
312 }
313 ?>
314 </div>
315
316 <?php $this->metabox_tracks_field_controls(); ?>
317 </div>
318
319 <?php $this->metabox_tracks_footer(); ?>
320
321 <input type="hidden" name="ai_nonce" id="ai_nonce" value="<?php echo esc_attr( wp_create_nonce( self::plugin_basename() ) ); ?>"/>
322 <?php
323 }
324
325
326 /**
327 * Echoes the Tracks metabox header.
328 *
329 * @since 1.0.0
330 */
331 protected function metabox_tracks_header() {
332 ?>
333 <div class="ai-header ai-brand-module">
334 <div class="ai-row">
335 <div class="ai-col-left">
336 <a href="https://www.cssigniter.com/ignite/plugins/audioigniter?utm_source=dashboard&utm_medium=link&utm_content=audioigniter&utm_campaign=logo" target="_blank" class="ai-logo">
337 <img
338 src="<?php echo esc_url( $this->plugin_url() . 'assets/images/logo.svg' ); ?>"
339 alt="<?php esc_attr_e( 'AudioIgniter Logo', 'audioigniter' ); ?>"
340 >
341 </a>
342 </div>
343
344 <?php if ( apply_filters( 'audioigniter_metabox_tracks_show_upgrade_button', true ) ) : ?>
345 <div class="ai-col-right">
346 <div class="ai-brand-module-actions">
347 <a href="https://www.cssigniter.com/ignite/plugins/audioigniter?utm_source=dashboard&utm_medium=link&utm_content=audioigniter&utm_campaign=upgrade-pro" class="ai-btn ai-btn-green" target="_blank">
348 <?php esc_html_e( 'Upgrade to Pro', 'audioigniter' ); ?>
349 </a>
350 </div>
351 </div>
352 <?php endif; ?>
353 </div>
354 </div>
355 <?php
356 }
357
358 /**
359 * Echoes the Tracks metabox footer.
360 *
361 * @since 1.0.0
362 */
363 protected function metabox_tracks_footer() {
364 ?>
365 <div class="ai-footer ai-brand-module">
366 <div class="ai-row">
367 <div class="ai-col-left">
368 <ul class="ai-list-inline">
369 <?php
370 $links = apply_filters( 'audioigniter_metabox_tracks_footer_links', array(
371 'support' => array(
372 'title' => __( 'Support', 'audioigniter' ),
373 'url' => 'https://wordpress.org/support/plugin/audioigniter',
374 ),
375 'documentation' => array(
376 'title' => __( 'Documentation', 'audioigniter' ),
377 'url' => 'https://www.cssigniter.com/docs/audioigniter/',
378 ),
379 'rate_plugin' => array(
380 'title' => __( 'Rate this plugin', 'audioigniter' ),
381 'url' => 'https://wordpress.org/support/view/plugin-reviews/audioigniter',
382 ),
383 ) );
384
385 foreach ( $links as $link ) {
386 if ( empty( $link['url'] ) || empty( $link['title'] ) ) {
387 continue;
388 }
389
390 echo sprintf( '<li><a href="%s" target="_blank">%s</a></li>',
391 esc_url( $link['url'] ),
392 esc_html( $link['title'] )
393 );
394 }
395 ?>
396 </ul>
397 </div>
398
399 <div class="ai-col-right">
400 <?php
401 $url = 'https://www.cssigniter.com/ignite/plugins/audioigniter?utm_source=dashboard&utm_medium=link&utm_content=audioigniter&utm_campaign=footer-link';
402 /* translators: %s is a URL. */
403 $copy = sprintf( __( 'Thank you for creating with <a href="%s" target="_blank">AudioIgniter</a>', 'audioigniter' ),
404 esc_url( $url )
405 );
406 ?>
407 <div class="ai-brand-module-actions">
408 <p class="ai-note"><?php echo wp_kses( $copy, array( 'a' => array( 'href' => true, 'target' => true ) ) ); ?></p>
409 </div>
410 </div>
411 </div>
412 </div>
413 <?php
414 }
415
416 protected function metabox_tracks_repeatable_track_field( $track = array() ) {
417 $track = wp_parse_args( $track, self::get_default_track_values() );
418
419 $cover_id = $track['cover_id'];
420 $title = $track['title'];
421 $artist = $track['artist'];
422 $track_url = $track['track_url'];
423 $buy_link = $track['buy_link'];
424 $download_url = $track['download_url'];
425
426 $cover_url = wp_get_attachment_image_src( intval( $cover_id ), 'thumbnail' );
427 if ( ! empty( $cover_url[0] ) ) {
428 $cover_url = $cover_url[0];
429 $cover_data = wp_prepare_attachment_for_js( intval( $cover_id ) );
430 } else {
431 $cover_url = '';
432 $cover_data = '';
433 }
434
435 $uid = uniqid();
436
437 $field_classes = apply_filters( 'audioigniter_metabox_track_classes', array( 'ai-field-repeatable' ), $track_url );
438 ?>
439 <div class="<?php echo esc_attr( implode( ' ', $field_classes ) ); ?>" data-uid="<?php echo esc_attr( $uid ); ?>">
440 <div class="ai-field-head">
441
442 <?php do_action( 'audioigniter_metabox_tracks_repeatable_track_field_before_title' ); ?>
443
444 <span class="ai-field-title"><?php echo wp_kses( $title, array() ); ?></span>
445
446 <button type="button" class="ai-field-toggle button-link">
447 <span class="screen-reader-text">
448 <?php esc_html_e( 'Toggle track visibility', 'audioigniter' ); ?>
449 </span>
450 <span class="toggle-indicator"></span>
451 </button>
452 </div>
453
454 <div class="ai-field-container">
455 <div class="ai-field-cover">
456 <a href="#" class="ai-field-upload-cover <?php echo ! empty( $cover_url ) ? 'ai-has-cover' : ''; ?>">
457 <span class="ai-remove-cover">
458 <span class="screen-reader-text">
459 <?php esc_html_e( 'Remove Cover Image', 'audioigniter' ); ?>
460 </span>
461 <span class="dashicons dashicons-no-alt"></span>
462 </span>
463
464 <?php if ( ! empty( $cover_url ) ) : ?>
465 <img src="<?php echo esc_url( $cover_url ); ?>" alt="<?php echo esc_attr( $cover_data['alt'] ); ?>">
466 <?php else : ?>
467 <img src="#" alt="">
468 <?php endif; ?>
469
470 <div class="ai-field-cover-placeholder">
471 <span class="ai-cover-prompt">
472 <?php esc_html_e( 'Upload Cover', 'audioigniter' ); ?>
473 </span>
474 </div>
475 </a>
476
477 <input
478 type="hidden"
479 id="ai_playlist_tracks-<?php echo esc_attr( $uid ); ?>-cover_id"
480 name="ai_playlist_tracks[<?php echo esc_attr( $uid ); ?>][cover_id]"
481 value="<?php echo esc_attr( $cover_id ); ?>"
482 />
483 </div>
484
485 <div class="ai-field-split">
486 <div class="ai-form-field">
487 <label
488 for="ai_playlist_tracks-<?php echo esc_attr( $uid ); ?>-title"
489 class="screen-reader-text">
490 <?php esc_html_e( 'Title', 'audioigniter' ); ?>
491 </label>
492 <input
493 type="text"
494 id="ai_playlist_tracks-<?php echo esc_attr( $uid ); ?>-title"
495 class="ai-track-title"
496 name="ai_playlist_tracks[<?php echo esc_attr( $uid ); ?>][title]"
497 placeholder="<?php esc_attr_e( 'Title', 'audioigniter' ); ?>"
498 value="<?php echo esc_attr( $title ); ?>"
499 />
500 </div>
501 <div class="ai-form-field">
502 <label
503 for="ai_playlist_tracks-<?php echo esc_attr( $uid ); ?>-artist"
504 class="screen-reader-text">
505 <?php esc_html_e( 'Artist', 'audioigniter' ); ?>
506 </label>
507 <input
508 type="text"
509 id="ai_playlist_tracks-<?php echo esc_attr( $uid ); ?>-artist"
510 class="ai-track-artist"
511 name="ai_playlist_tracks[<?php echo esc_attr( $uid ); ?>][artist]"
512 placeholder="<?php esc_attr_e( 'Artist', 'audioigniter' ); ?>"
513 value="<?php echo esc_attr( $artist ); ?>"
514 />
515 </div>
516
517 <div class="ai-form-field">
518 <label
519 for="ai_playlist_tracks-<?php echo esc_attr( $uid ); ?>-buy_link"
520 class="screen-reader-text">
521 <?php esc_html_e( 'Buy link', 'audioigniter' ); ?>
522 </label>
523 <input
524 type="text"
525 id="ai_playlist_tracks-<?php echo esc_attr( $uid ); ?>-buy_link"
526 class="ai-track-buy-link"
527 name="ai_playlist_tracks[<?php echo esc_attr( $uid ); ?>][buy_link]"
528 placeholder="<?php esc_attr_e( 'Buy link', 'audioigniter' ); ?>"
529 value="<?php echo esc_url( $buy_link ); ?>"
530 />
531 </div>
532 </div>
533
534 <div class="ai-field-split">
535 <div class="ai-form-field">
536 <label
537 for="ai_playlist_tracks-<?php echo esc_attr( $uid ); ?>-track_url"
538 class="screen-reader-text">
539 <?php esc_html_e( 'Audio file or radio stream', 'audioigniter' ); ?>
540 </label>
541
542 <div class="ai-form-field-addon">
543 <input
544 type="text"
545 id="ai_playlist_tracks-<?php echo esc_attr( $uid ); ?>-track_url"
546 class="ai-track-url"
547 name="ai_playlist_tracks[<?php echo esc_attr( $uid ); ?>][track_url]"
548 placeholder="<?php esc_attr_e( 'Audio file or radio stream', 'audioigniter' ); ?>"
549 value="<?php echo esc_url( $track_url ); ?>"
550 />
551 <button type="button" class="button ai-upload">
552 <?php esc_html_e( 'Upload', 'audioigniter' ); ?>
553 </button>
554
555 <?php do_action( 'audioigniter_metabox_tracks_repeatable_track_field_after_track_upload_button' ); ?>
556 </div>
557 </div>
558
559 <div class="ai-form-field">
560 <label
561 for="ai_playlist_tracks-<?php echo esc_attr( $uid ); ?>-download_url"
562 class="screen-reader-text">
563 <?php esc_html_e( 'Download URL', 'audioigniter' ); ?>
564 </label>
565 <input
566 type="text"
567 id="ai_playlist_tracks-<?php echo esc_attr( $uid ); ?>-download_url"
568 class="ai-track-download-url"
569 name="ai_playlist_tracks[<?php echo esc_attr( $uid ); ?>][download_url]"
570 placeholder="<?php esc_attr_e( 'Download URL', 'audioigniter' ); ?>"
571 value="<?php echo esc_url( $download_url ); ?>"
572 />
573 </div>
574
575 <button type="button" class="button ai-remove-field">
576 <span class="dashicons dashicons-dismiss"></span>
577 <?php esc_html_e( 'Remove Track', 'audioigniter' ); ?>
578 </button>
579 </div>
580
581 </div>
582 </div>
583 <?php
584 }
585
586 protected function metabox_tracks_field_controls() {
587 ?>
588 <div class="ai-field-controls-wrap">
589 <div class="ai-field-controls">
590 <button type="button" class="button ai-add-field">
591 <span class="dashicons dashicons-plus-alt"></span>
592 <?php esc_html_e( 'Add Track', 'audioigniter' ); ?>
593 </button>
594
595 <?php do_action( 'audioigniter_metabox_tracks_field_controls' ); ?>
596
597 <button type="button" class="button ai-remove-all-fields">
598 <span class="dashicons dashicons-dismiss"></span>
599 <?php esc_html_e( 'Clear Playlist', 'audioigniter' ); ?>
600 </button>
601 </div>
602
603 <div class="ai-field-controls-visibility">
604 <a href="#" class="ai-fields-expand-all">
605 <?php esc_html_e( 'Expand All', 'audioigniter' ); ?>
606 </a>
607 <a href="#" class="ai-fields-collapse-all">
608 <?php esc_html_e( 'Collapse All', 'audioigniter' ); ?>
609 </a>
610 </div>
611 </div>
612 <?php
613 }
614
615 /**
616 * Echoes the Settings metabox markup.
617 *
618 * @version 1.4.0
619 * @since 1.0.0
620 *
621 * @param WP_Post $object
622 * @param array $box
623 */
624 function metabox_settings( $object, $box ) {
625 $type = $this->get_post_meta( $object->ID, '_audioigniter_player_type', 'full' );
626 $numbers = $this->get_post_meta( $object->ID, '_audioigniter_show_numbers', 1 );
627 $numbers_reverse = $this->get_post_meta( $object->ID, '_audioigniter_show_numbers_reverse', 0 );
628 $thumb = $this->get_post_meta( $object->ID, '_audioigniter_show_covers', 1 );
629 $active_thumb = $this->get_post_meta( $object->ID, '_audioigniter_show_active_cover', 1 );
630 $artist = $this->get_post_meta( $object->ID, '_audioigniter_show_artist', 1 );
631 $buy_links = $this->get_post_meta( $object->ID, '_audioigniter_show_buy_links', 1 );
632 $buy_links_new_target = $this->get_post_meta( $object->ID, '_audioigniter_buy_links_new_target', 1 );
633 $cycle_tracks = $this->get_post_meta( $object->ID, '_audioigniter_cycle_tracks', 0 );
634 $track_listing = $this->get_post_meta( $object->ID, '_audioigniter_show_track_listing', 1 );
635 $credit = $this->get_post_meta( $object->ID, '_audioigniter_show_credit', 0 );
636 $limit_tracklisting_height = $this->get_post_meta( $object->ID, '_audioigniter_limit_tracklisting_height', 1 );
637 $tracklisting_height = $this->get_post_meta( $object->ID, '_audioigniter_tracklisting_height', 185 );
638 $volume = $this->get_post_meta( $object->ID, '_audioigniter_volume', 100 );
639 $max_width = $this->get_post_meta( $object->ID, '_audioigniter_max_width' );
640
641 wp_nonce_field( basename( __FILE__ ), $object->post_type . '_nonce' );
642 ?>
643 <div class="ai-module ai-module-settings">
644 <div class="ai-form-field">
645 <div class="ai-player-type-message ai-info-box"></div>
646 <label for="_audioigniter_player_type">
647 <?php esc_html_e( 'Player Type', 'audioigniter' ); ?>
648 </label>
649
650 <select
651 class="widefat ai-form-select-player-type"
652 id="_audioigniter_player_type"
653 name="_audioigniter_player_type"
654 >
655 <?php foreach ( $this->get_player_types() as $player_key => $player_type ) : ?>
656 <option
657 value="<?php echo esc_attr( $player_key ); ?>"
658 data-no-support="<?php echo esc_attr( implode( ', ', $player_type['no-support'] ) ); ?>"
659 data-info="<?php echo esc_attr( $player_type['info'] ); ?>"
660 <?php selected( $type, $player_key ); ?>
661 >
662 <?php echo wp_kses( $player_type['label'], 'strip' ); ?>
663 </option>
664 <?php endforeach; ?>
665 </select>
666 </div>
667
668 <div class="ai-form-field">
669 <input
670 type="checkbox"
671 class="ai-checkbox"
672 id="_audioigniter_show_track_listing"
673 name="_audioigniter_show_track_listing"
674 value="1" <?php checked( $track_listing, true ); ?>
675 />
676
677 <label for="_audioigniter_show_track_listing">
678 <?php esc_html_e( 'Show track listing', 'audioigniter' ); ?>
679 </label>
680 </div>
681
682 <div class="ai-form-field">
683 <input
684 type="checkbox"
685 class="ai-checkbox"
686 id="_audioigniter_show_numbers"
687 name="_audioigniter_show_numbers"
688 value="1" <?php checked( $numbers, true ); ?>
689 />
690
691 <label for="_audioigniter_show_numbers">
692 <?php esc_html_e( 'Show track numbers in tracklist', 'audioigniter' ); ?>
693 </label>
694 </div>
695
696 <div class="ai-form-field">
697 <input
698 type="checkbox"
699 class="ai-checkbox"
700 id="_audioigniter_show_numbers_revese"
701 name="_audioigniter_show_numbers_reverse"
702 value="1" <?php checked( $numbers_reverse, true ); ?>
703 />
704
705 <label for="_audioigniter_show_numbers_revese">
706 <?php esc_html_e( 'Reverse track order', 'audioigniter' ); ?>
707 </label>
708 </div>
709
710 <div class="ai-form-field">
711 <input
712 type="checkbox"
713 class="ai-checkbox"
714 id="_audioigniter_show_covers"
715 name="_audioigniter_show_covers"
716 value="1" <?php checked( $thumb, true ); ?>
717 />
718
719 <label for="_audioigniter_show_covers">
720 <?php esc_html_e( 'Show track covers in tracklist', 'audioigniter' ); ?>
721 </label>
722 </div>
723
724 <div class="ai-form-field">
725 <input
726 type="checkbox"
727 class="ai-checkbox"
728 id="_audioigniter_show_active_cover"
729 name="_audioigniter_show_active_cover"
730 value="1" <?php checked( $active_thumb, true ); ?>
731 />
732
733 <label for="_audioigniter_show_active_cover">
734 <?php esc_html_e( "Show active track's cover", 'audioigniter' ); ?>
735 </label>
736 </div>
737
738 <div class="ai-form-field">
739 <input
740 type="checkbox"
741 class="ai-checkbox"
742 id="_audioigniter_show_artist"
743 name="_audioigniter_show_artist"
744 value="1" <?php checked( $artist, true ); ?>
745 />
746
747 <label for="_audioigniter_show_artist">
748 <?php esc_html_e( 'Show artist names', 'audioigniter' ); ?>
749 </label>
750 </div>
751
752 <div class="ai-form-field">
753 <input
754 type="checkbox"
755 class="ai-checkbox"
756 id="_audioigniter_show_buy_links"
757 name="_audioigniter_show_buy_links"
758 value="1" <?php checked( $buy_links, true ); ?>
759 />
760
761 <label for="_audioigniter_show_buy_links">
762 <?php esc_html_e( 'Show track extra buttons (buy link, download button etc)', 'audioigniter' ); ?>
763 </label>
764 </div>
765
766 <div class="ai-form-field">
767 <input
768 type="checkbox"
769 class="ai-checkbox"
770 id="_audioigniter_buy_links_new_target"
771 name="_audioigniter_buy_links_new_target"
772 value="1" <?php checked( $buy_links_new_target, true ); ?>
773 />
774
775 <label for="_audioigniter_buy_links_new_target">
776 <?php esc_html_e( 'Open buy links in new window', 'audioigniter' ); ?>
777 </label>
778 </div>
779
780 <div class="ai-form-field">
781 <input
782 type="checkbox"
783 class="ai-checkbox"
784 id="_audioigniter_cycle_tracks"
785 name="_audioigniter_cycle_tracks"
786 value="1" <?php checked( $cycle_tracks, true ); ?>
787 />
788
789 <label for="_audioigniter_cycle_tracks">
790 <?php esc_html_e( 'Repeat tracklist enabled by default', 'audioigniter' ); ?>
791 </label>
792
793 <p class="ai-field-help">
794 <?php esc_html_e( 'Note that users still have the option to turn it on or off in some player types, regardless of this option.', 'audioigniter' ); ?>
795 </p>
796 </div>
797
798 <div class="ai-form-field">
799 <input
800 type="checkbox"
801 class="ai-checkbox"
802 id="_audioigniter_show_credit"
803 name="_audioigniter_show_credit"
804 value="1" <?php checked( $credit, true ); ?>
805 />
806
807 <label for="_audioigniter_show_credit">
808 <?php esc_html_e( 'Show "Powered by AudioIgniter" link', 'audioigniter' ); ?>
809 </label>
810
811 <p class="ai-field-help">
812 <?php esc_html_e( "We've put a great deal of effort into building this plugin. If you feel like it, let others know about it by enabling this option.", 'audioigniter' ); ?>
813 </p>
814 </div>
815
816 <div class="ai-form-field">
817 <label for="_audioigniter_volume">
818 <?php esc_html_e( 'Starting volume', 'audioigniter' ); ?>
819 </label>
820
821 <input
822 type="number"
823 min="0"
824 max="100"
825 step="10"
826 id="_audioigniter_volume"
827 class="ai-track-title"
828 name="_audioigniter_volume"
829 placeholder="<?php esc_attr_e( '0-100', 'audioigniter' ); ?>"
830 value="<?php echo esc_attr( $volume ); ?>"
831 />
832
833 <p class="ai-field-help">
834 <?php esc_html_e( 'Enter a value between 0 and 100 in increments of 10', 'audioigniter' ); ?>
835 </p>
836 </div>
837
838 <div class="ai-form-field">
839 <input
840 type="checkbox"
841 class="ai-checkbox"
842 id="_audioigniter_limit_tracklisting_height"
843 name="_audioigniter_limit_tracklisting_height"
844 value="1" <?php checked( $limit_tracklisting_height, true ); ?>
845 />
846
847 <label for="_audioigniter_limit_tracklisting_height">
848 <?php esc_html_e( 'Limit track listing height', 'audioigniter' ); ?>
849 </label>
850 </div>
851
852 <div class="ai-form-field">
853 <label for="_audioigniter_tracklisting_height">
854 <?php esc_html_e( 'Track listing height', 'audioigniter' ); ?>
855 </label>
856
857 <input
858 type="number"
859 min="10"
860 step="5"
861 id="_audioigniter_tracklisting_height"
862 class="ai-track-title"
863 name="_audioigniter_tracklisting_height"
864 placeholder="<?php esc_attr_e( 'Track listing height', 'audioigniter' ); ?>"
865 value="<?php echo esc_attr( $tracklisting_height ); ?>"
866 />
867
868 <p class="ai-field-help">
869 <?php esc_html_e( 'Set a number of pixels', 'audioigniter' ); ?>
870 </p>
871 </div>
872
873 <div class="ai-form-field">
874 <label for="_audioigniter_max_width">
875 <?php esc_html_e( 'Maximum player width', 'audioigniter' ); ?>
876 </label>
877
878 <input
879 type="number"
880 id="_audioigniter_max_width"
881 class="ai-track-title"
882 name="_audioigniter_max_width"
883 placeholder="<?php esc_attr_e( 'Automatic width', 'audioigniter' ); ?>"
884 value="<?php echo esc_attr( $max_width ); ?>"
885 />
886
887 <p class="ai-field-help">
888 <?php esc_html_e( 'Set a number of pixels, or leave empty to automatically cover 100% of the available area (recommended).', 'audioigniter' ); ?>
889 </p>
890 </div>
891 </div>
892 <?php
893 }
894
895 /**
896 * Echoes the Shortcode metabox markup.
897 *
898 * @since 1.0.0
899 *
900 * @param WP_Post $object
901 * @param array $box
902 */
903 public function metabox_shortcode( $object, $box ) {
904 ?>
905 <div class="ai-module ai-module-shortcode">
906 <div class="ai-form-field">
907 <label for="ai_shortcode">
908 <?php esc_html_e( 'Grab the shortcode', 'audioigniter' ); ?>
909 </label>
910
911 <input
912 type="text"
913 class="code"
914 id="ai_shortcode"
915 name="ai_shortcode"
916 value="<?php echo esc_attr( sprintf( '[ai_playlist id="%s"]', $object->ID ) ); ?>"
917 />
918
919 </div>
920 </div>
921 <?php
922 }
923
924 /**
925 * Returns the available player types and their data.
926 *
927 * @version 1.4.0
928 * @since 1.4.0
929 *
930 * @return array
931 */
932 public function get_player_types() {
933 // Each player type has a number of settings that it might not support
934 // E.g. "Simple Player" does not support track listing visibility, covers
935 // and others. Provide every setting that's not supported based on the `name`
936 // attribute of each setting input (input, select, textarea), *without
937 // the _audioigniter_ prefix* in the `no-support` array.
938 // To allow support for every setting simply set `no-support` to an empty array.
939
940 $player_types = array(
941 'full' => array(
942 'label' => __( 'Full Player', 'audioigniter' ),
943 'no-support' => array(),
944 'info' => '',
945 ),
946 'simple' => array(
947 'label' => __( 'Simple Player', 'audioigniter' ),
948 'no-support' => array(
949 'show_track_listing',
950 'show_covers',
951 'show_active_cover',
952 'limit_tracklisting_height',
953 'tracklisting_height',
954 ),
955 'info' => '',
956 ),
957 );
958
959 return apply_filters( 'audioigniter_player_types', $player_types );
960 }
961
962 public function save_post( $post_id ) {
963 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return false; }
964 if ( isset( $_POST['post_view'] ) && 'list' === $_POST['post_view'] ) { return false; }
965 if ( ! isset( $_POST['post_type'] ) || $_POST['post_type'] !== $this->post_type ) { return false; }
966 if ( ! isset( $_POST[ $this->post_type . '_nonce' ] ) || ! wp_verify_nonce( $_POST[ $this->post_type . '_nonce' ], basename( __FILE__ ) ) ) { return false; }
967 $post_type_obj = get_post_type_object( $this->post_type );
968 if ( ! current_user_can( $post_type_obj->cap->edit_post, $post_id ) ) { return false; }
969
970 update_post_meta( $post_id, '_audioigniter_tracks', $this->sanitizer->metabox_playlist( $_POST['ai_playlist_tracks'], $post_id ) );
971
972 update_post_meta( $post_id, '_audioigniter_show_numbers', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_numbers'] ) );
973 update_post_meta( $post_id, '_audioigniter_show_numbers_reverse', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_numbers_reverse'] ) );
974 update_post_meta( $post_id, '_audioigniter_show_covers', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_covers'] ) );
975 update_post_meta( $post_id, '_audioigniter_show_active_cover', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_active_cover'] ) );
976 update_post_meta( $post_id, '_audioigniter_show_artist', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_artist'] ) );
977 update_post_meta( $post_id, '_audioigniter_show_buy_links', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_buy_links'] ) );
978 update_post_meta( $post_id, '_audioigniter_buy_links_new_target', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_buy_links_new_target'] ) );
979 update_post_meta( $post_id, '_audioigniter_cycle_tracks', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_cycle_tracks'] ) );
980 update_post_meta( $post_id, '_audioigniter_show_track_listing', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_track_listing'] ) );
981 update_post_meta( $post_id, '_audioigniter_player_type', $this->sanitizer->player_type( $_POST['_audioigniter_player_type'] ) );
982 update_post_meta( $post_id, '_audioigniter_show_credit', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_show_credit'] ) );
983 update_post_meta( $post_id, '_audioigniter_limit_tracklisting_height', $this->sanitizer->checkbox_ref( $_POST['_audioigniter_limit_tracklisting_height'] ) );
984 update_post_meta( $post_id, '_audioigniter_tracklisting_height', intval( $_POST['_audioigniter_tracklisting_height'] ) );
985 update_post_meta( $post_id, '_audioigniter_volume', intval( $_POST['_audioigniter_volume'] ) );
986 update_post_meta( $post_id, '_audioigniter_max_width', $this->sanitizer->intval_or_empty( $_POST['_audioigniter_max_width'] ) );
987
988 /**
989 * @since 1.4.0
990 */
991 do_action( 'audioigniter_save_post', $post_id );
992 }
993
994 public static function get_default_track_values() {
995 return apply_filters( 'audioigniter_default_track_values', array(
996 'cover_id' => '',
997 'title' => '',
998 'artist' => '',
999 'track_url' => '',
1000 'buy_link' => '',
1001 'download_url' => '',
1002 ) );
1003 }
1004
1005 public function register_image_sizes() {
1006 add_image_size( 'audioigniter_cover', 560, 560, true );
1007 }
1008
1009 public function register_widgets() {
1010 $widgets = apply_filters( 'audioigniter_register_widgets', array() );
1011
1012 foreach ( $widgets as $class => $file ) {
1013 require_once( $file );
1014 register_widget( $class );
1015 }
1016 }
1017
1018 public function register_shortcodes() {
1019 add_shortcode( 'ai_playlist', array( $this, 'shortcode_ai_playlist' ) );
1020 }
1021
1022 /**
1023 * Checks whether passed post object or ID is an AudioIgniter playlist.
1024 *
1025 * @version 1.4.0
1026 * @since 1.4.0
1027 *
1028 * @param int|WP_Post $post Post ID or post object.
1029 *
1030 * @return bool
1031 */
1032 public function is_playlist( $post ) {
1033 $post = get_post( $post );
1034
1035 if ( is_wp_error( $post ) || empty( $post ) || is_null( $post ) || $post->post_type !== $this->post_type ) {
1036 return false;
1037 }
1038
1039 return true;
1040 }
1041
1042 /**
1043 * Returns a data attributes array for the given playlist.
1044 *
1045 * @version 1.4.0
1046 * @since 1.4.0
1047 *
1048 * @param int $post_id Post ID.
1049 *
1050 * @return array
1051 */
1052 public function get_playlist_data_attributes_array( $post_id ) {
1053 $post_id = intval( $post_id );
1054
1055 if ( ! $this->is_playlist( $post_id ) ) {
1056 return array();
1057 }
1058
1059 $attrs = array(
1060 'data-player-type' => $this->get_post_meta( $post_id, '_audioigniter_player_type', 'full' ),
1061 'data-tracks-url' => add_query_arg( array( 'audioigniter_playlist_id' => $post_id ), home_url( '/' ) ),
1062 'data-display-track-no' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_numbers', 1 ) ),
1063 'data-reverse-track-order' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_numbers_reverse', 0 ) ),
1064 'data-display-tracklist-covers' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_covers', 1 ) ),
1065 'data-display-active-cover' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_active_cover', 1 ) ),
1066 'data-display-artist-names' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_artist', 1 ) ),
1067 'data-display-buy-buttons' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_buy_links', 1 ) ),
1068 'data-buy-buttons-target' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_buy_links_new_target', 1 ) ),
1069 'data-cycle-tracks' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_cycle_tracks', 0 ) ),
1070 'data-display-credits' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_credit', 1 ) ),
1071 'data-display-tracklist' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_show_track_listing', 1 ) ),
1072 'data-limit-tracklist-height' => $this->convert_bool_string( $this->get_post_meta( $post_id, '_audioigniter_limit_tracklisting_height', 1 ) ),
1073 'data-volume' => intval( $this->get_post_meta( $post_id, '_audioigniter_volume', 100 ) ),
1074 'data-tracklist-height' => intval( $this->get_post_meta( $post_id, '_audioigniter_tracklisting_height', 185 ) ),
1075 'data-max-width' => $this->get_post_meta( $post_id, '_audioigniter_max_width' ),
1076 );
1077
1078 return $attrs;
1079 }
1080
1081 /**
1082 * Returns the output of the [ai_playlist] shortcode.
1083 *
1084 * @version 1.4.0
1085 * @since 1.0.0
1086 *
1087 * @param array $atts The shortcode attributes.
1088 * @param string|null $content Content, when used with a shortcode closing tag.
1089 * @param string $tag The shortcode name used to reach this function.
1090 *
1091 * @return string
1092 */
1093 public function shortcode_ai_playlist( $atts, $content = null, $tag ) {
1094 $atts = shortcode_atts( array(
1095 'id' => '',
1096 ), $atts, $tag );
1097
1098 $id = intval( $atts['id'] );
1099
1100 if ( ! $this->is_playlist( $id ) ) {
1101 return '';
1102 }
1103
1104 $post = get_post( $id );
1105
1106 $params = apply_filters( 'audioigniter_shortcode_data_attributes_array', $this->get_playlist_data_attributes_array( $id ), $id, $post );
1107 $params = array_filter( $params, array( $this->sanitizer, 'array_filter_empty_null' ) );
1108 $params = $this->sanitizer->html_data_attributes_array( $params );
1109
1110 // Returning a truthy value from the filter, will short-circuit execution of the shortcode.
1111 if ( false !== apply_filters( 'audioigniter_shortcode_shortcircuit', false, $id, $post, $params ) ) {
1112 return '';
1113 }
1114
1115 $data = '';
1116 foreach ( $params as $attribute => $value ) {
1117 $data .= sprintf( '%s="%s" ', sanitize_key( $attribute ), esc_attr( $value ) );
1118 }
1119
1120 $output = sprintf( '<div id="audioigniter-%s" class="audioigniter-root" %s></div>',
1121 esc_attr( $id ),
1122 $data
1123 );
1124
1125 return $output;
1126 }
1127
1128 public function convert_bool_string( $value ) {
1129 if ( $value ) {
1130 return 'true';
1131 }
1132
1133 return 'false';
1134 }
1135
1136 public function register_playlist_endpoint() {
1137 add_rewrite_tag( '%audioigniter_playlist_id%', '([0-9]+)' );
1138 add_rewrite_rule( '^audioigniter/playlist/([0-9]+)/?', 'index.php?audioigniter_playlist_id=$matches[1]', 'bottom' );
1139 }
1140
1141 public function handle_playlist_endpoint() {
1142 global $wp_query;
1143
1144 $playlist_id = $wp_query->get( 'audioigniter_playlist_id' );
1145
1146 if ( empty( $playlist_id ) ) {
1147 return;
1148 }
1149
1150 $playlist_id = intval( $playlist_id );
1151 $post = get_post( $playlist_id );
1152
1153 if ( empty( $post ) || $post->post_type !== $this->post_type ) {
1154 wp_send_json_error( __( "ID doesn't match a playlist", 'audioigniter' ) );
1155 }
1156
1157 $response = array();
1158 $tracks = $this->get_post_meta( $playlist_id, '_audioigniter_tracks', array() );
1159
1160 foreach ( $tracks as $track ) {
1161 $track = wp_parse_args( $track, self::get_default_track_values() );
1162 $track_response = array();
1163
1164 $track_response['title'] = $track['title'];
1165 $track_response['subtitle'] = $track['artist'];
1166 $track_response['audio'] = $track['track_url'];
1167 $track_response['buyUrl'] = $track['buy_link'];
1168 $track_response['downloadUrl'] = $track['download_url'];
1169
1170 $cover_url = wp_get_attachment_image_src( intval( $track['cover_id'] ), 'audioigniter_cover' );
1171 if ( ! empty( $cover_url[0] ) ) {
1172 $cover_url = $cover_url[0];
1173 } else {
1174 $cover_url = '';
1175 }
1176
1177 $track_response['cover'] = $cover_url;
1178
1179 $track_response = apply_filters( 'audioigniter_playlist_endpoint_track', $track_response, $track, $playlist_id, $post );
1180
1181 $response[] = $track_response;
1182 }
1183
1184 wp_send_json( $response );
1185 }
1186
1187
1188 public function get_all_playlists( $orderby = 'date', $order = 'DESC' ) {
1189 $q = new WP_Query( array(
1190 'post_type' => $this->post_type,
1191 'posts_per_page' => - 1,
1192 'orderby' => $orderby,
1193 'order' => $order,
1194 ) );
1195
1196 return $q->posts;
1197 }
1198
1199 public function get_post_meta( $post_id, $key, $default = '' ) {
1200 $keys = get_post_custom_keys( $post_id );
1201
1202 $value = $default;
1203
1204 if ( is_array( $keys ) && in_array( $key, $keys, true ) ) {
1205 $value = get_post_meta( $post_id, $key, true );
1206 }
1207
1208 return $value;
1209 }
1210
1211 public function plugin_activated() {
1212 if ( ! current_user_can( 'activate_plugins' ) ) {
1213 return;
1214 }
1215
1216 $this->register_post_types();
1217
1218 do_action( 'audioigniter_activated' );
1219
1220 flush_rewrite_rules();
1221 }
1222
1223 public function plugin_deactivated() {
1224 if ( ! current_user_can( 'activate_plugins' ) ) {
1225 return;
1226 }
1227
1228 unregister_post_type( $this->post_type );
1229
1230 do_action( 'audioigniter_deactivated' );
1231
1232 flush_rewrite_rules();
1233 }
1234
1235 public static function plugin_basename() {
1236 return plugin_basename( __FILE__ );
1237 }
1238
1239 public function plugin_url() {
1240 return self::$plugin_url;
1241 }
1242
1243 public function plugin_path() {
1244 return self::$plugin_path;
1245 }
1246 }
1247
1248
1249 /**
1250 * Main instance of AudioIgniter.
1251 *
1252 * Returns the working instance of AudioIgniter. No need for globals.
1253 *
1254 * @since 1.0.0
1255 * @return AudioIgniter
1256 */
1257 function AudioIgniter() {
1258 return AudioIgniter::instance();
1259 }
1260
1261 add_action( 'plugins_loaded', array( AudioIgniter(), 'plugin_setup' ) );
1262 register_activation_hook( __FILE__, array( AudioIgniter(), 'plugin_activated' ) );
1263 register_deactivation_hook( __FILE__, array( AudioIgniter(), 'plugin_deactivated' ) );
1264