Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.12 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Notes class
  4.  *
  5.  * @author  Yithemes
  6.  * @package YITH Desktop Notifications for WooCommerce
  7.  * @version 1.0.0
  8.  */
  9.  
  10. if ( !defined( 'ABSPATH' ) ) {
  11.     exit;
  12. }
  13.  
  14. if ( !class_exists( 'YITH_WCDN_Desktop_Notifications_Notify' ) ) {
  15.     /**
  16.      * YITH_WCDN_Desktop_Notifications_Notify
  17.      *
  18.      * @since 1.0.0
  19.      */
  20.     class YITH_WCDN_Desktop_Notifications_Notify {
  21.         /**
  22.          * Single instance of the class
  23.          *
  24.          * @var \YITH_WCDN_Desktop_Notifications_Notify
  25.          * @since 1.0.0
  26.          */
  27.         protected static $instance;
  28.  
  29.  
  30.         /**
  31.          * Returns single instance of the class
  32.          *
  33.          * @return \YITH_WCDN_Desktop_Notifications_Notify
  34.          * @since 1.0.0
  35.          */
  36.         public static function get_instance() {
  37.             $self = __CLASS__ . ( class_exists( __CLASS__ . '_Premium' ) ? '_Premium' : '' );
  38.  
  39.             if ( is_null( $self::$instance ) ) {
  40.                 $self::$instance = new $self;
  41.             }
  42.  
  43.             return $self::$instance;
  44.         }
  45.  
  46.         /**
  47.          * Constructor
  48.          *
  49.          * @since  1.0.0
  50.          * @author Carlos Rodríguez <carlos.rodriguez@yourinspiration.it>
  51.          */
  52.         private function __construct()
  53.         {
  54.             add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ), 11);
  55.             add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ), 11);
  56.         }
  57.  
  58.         public function enqueue_styles_scripts(){
  59.            
  60.                 wp_enqueue_script('yith_wcdn_notify', YITH_WCDN_ASSETS_URL . 'js/wcdn-notify.js', array('jquery', 'jquery-ui-sortable'), YITH_WCDN_VERSION, false);
  61.                 $array = array(
  62.                     'ajaxurl' => admin_url('admin-ajax.php'),
  63.                     'time_check' => get_option('yith_wcdn_settings_check_new_notification') * 1000, //60000 miliseconds = 1 min
  64.                     'looping_sound' => get_option('yith_wcdn_settings_looping_sound')
  65.                 );
  66.                 wp_localize_script('yith_wcdn_notify', 'yith_wcdn', $array);
  67.         }
  68.     }
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement