/**
  * Public method to get the singleton instance
  *
  * @return Youxi_Shortcode_Manager
  */
 public static function get()
 {
     if (!is_a(self::$instance, 'Youxi_Shortcode_Animation')) {
         self::$instance = new Youxi_Shortcode_Animation();
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
 /**
  * Hook to after_setup_theme and do the youxi_shortcode_register action
  * so external scripts can register shortcodes and categories
  */
 public function after_setup_theme()
 {
     /* Initialize animations if allowed */
     if (apply_filters('youxi_shortcode_enable_animation', false)) {
         Youxi_Shortcode_Animation::get()->init();
     }
     /* Register the shortcodes */
     do_action('youxi_shortcode_register', $this);
     /* Prepare the shortcodes */
     $this->prepare_shortcodes();
     if (is_admin()) {
         /* Hook for enqueueing admin scripts */
         add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
         /* Hook for printing shortcode serializers and deserializers */
         add_action('admin_print_footer_scripts', array($this, 'admin_print_footer_scripts'));
         /* Register TinyMCE plugin if allowed */
         if (apply_filters('youxi_shortcode_allow_tinymce', true)) {
             if (!class_exists('Youxi_Shortcode_TinyMCE_Manager')) {
                 require plugin_dir_path(__FILE__) . 'class-mce-manager.php';
             }
             $this->tinymce_manager = new Youxi_Shortcode_TinyMCE_Manager();
         }
     } else {
         /* Enqueue shortcode scripts and styles */
         add_action('wp_enqueue_scripts', array($this, 'enqueue'));
         /* Non destructive fix for broken shortcodes caused by wpautop */
         add_filter('the_content', array($this, 'shortcode_unautop'));
         /* Filter the shortcodes where unautop needs to be applied */
         add_filter('youxi_shortcode_unautop', array($this, 'filter_unautop_tags'));
     }
 }