Assets.php
109 lines
| 1 | <?php |
| 2 | namespace SPEL\includes\Frontend; |
| 3 | |
| 4 | // Exit if accessed directly |
| 5 | if (!defined('ABSPATH')) { |
| 6 | exit; |
| 7 | } |
| 8 | |
| 9 | /** |
| 10 | * Assets Class |
| 11 | */ |
| 12 | class Assets |
| 13 | { |
| 14 | public function __construct() |
| 15 | { |
| 16 | add_action('plugins_loaded', [$this, 'register_scripts']); |
| 17 | } |
| 18 | |
| 19 | public function register_scripts() |
| 20 | { |
| 21 | |
| 22 | // Register Widget Style's |
| 23 | add_action('elementor/frontend/after_enqueue_styles', [$this, 'register_widget_styles']); |
| 24 | |
| 25 | // Register Widget Script's |
| 26 | add_action('elementor/editor/after_enqueue_scripts', [$this, 'register_widget_scripts']); |
| 27 | add_action('elementor/frontend/after_register_scripts', [$this, 'register_widget_scripts']); |
| 28 | |
| 29 | // Register Elementor Preview Editor Script's |
| 30 | add_action('elementor/editor/after_enqueue_scripts', [$this, 'register_editor_scripts']); |
| 31 | add_action('elementor/frontend/after_enqueue_scripts', [$this, 'register_editor_scripts']); |
| 32 | |
| 33 | } |
| 34 | |
| 35 | |
| 36 | /** |
| 37 | * Register Widget Scripts |
| 38 | * |
| 39 | * Register custom style required to run Spider Elements. |
| 40 | * |
| 41 | * @access public |
| 42 | */ |
| 43 | function register_widget_styles() |
| 44 | { |
| 45 | $elements_opt = get_option( 'spel_features_settings' ); |
| 46 | |
| 47 | if ( isset($elements_opt['spel_smooth_animation']) && $elements_opt[ 'spel_smooth_animation' ] == 'on' ) { |
| 48 | wp_deregister_style('e-animations'); |
| 49 | wp_enqueue_style('e-animations', SPEL_VEND . '/animation/animate.css', [], SPEL_VERSION ); |
| 50 | } |
| 51 | |
| 52 | wp_register_style('ionicons', SPEL_VEND . '/ionicons/ionicons.min.css', [], '2.0.1'); |
| 53 | wp_register_style('slick-theme', SPEL_VEND . '/slick/slick-theme.css', [], SPEL_VERSION); |
| 54 | wp_register_style('slick', SPEL_VEND . '/slick/slick.css', [], SPEL_VERSION); |
| 55 | wp_register_style('swiper', SPEL_VEND . '/swiper/swiper-bundle.min.css', [], '7.2.0'); |
| 56 | wp_register_style('video-js', SPEL_VEND . '/video/videojs.min.css', [], SPEL_VERSION); |
| 57 | wp_register_style('video-js-theaterMode', SPEL_VEND . '/video/videojs.theaterMode.css', [], SPEL_VERSION); |
| 58 | wp_register_style('elegant-icon', SPEL_VEND . '/elegant-icon/style.css', [], SPEL_VERSION); |
| 59 | wp_register_style('fancybox', SPEL_VEND . '/fancybox/css/jquery.fancybox.min.css', [], SPEL_VERSION); |
| 60 | wp_register_style('spel-main', SPEL_CSS . '/main.css', [], SPEL_VERSION); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Register Widget Scripts |
| 65 | * |
| 66 | * Register custom scripts required to run Spider Elements. |
| 67 | * |
| 68 | * @access public |
| 69 | */ |
| 70 | function register_widget_scripts() |
| 71 | { |
| 72 | |
| 73 | wp_register_script('ionicons', 'https://unpkg.com/ionicons@latest/dist/ionicons.js', '', SPEL_VERSION, true); |
| 74 | wp_register_script('slick', SPEL_VEND . '/slick/slick.min.js', array('jquery'), SPEL_VERSION, true); |
| 75 | wp_register_script('swiper', SPEL_VEND . '/swiper/swiper-bundle.min.js', array('jquery'), SPEL_VERSION, true); |
| 76 | wp_register_script('text-type', SPEL_VEND . '/text-type/text-type.js', array('jquery'), SPEL_VERSION, true); |
| 77 | wp_register_script('counterup', SPEL_VEND . '/counterup/jquery.counterup.min.js', array('jquery'), SPEL_VERSION, true); |
| 78 | wp_register_script('waypoint', SPEL_VEND . '/waypoint/jquery.waypoints.min.js', array('jquery'), SPEL_VERSION, true); |
| 79 | wp_register_script('wow', SPEL_VEND . '/wow/wow.min.js', array('jquery'), '1.1.3', true); |
| 80 | wp_register_script('artplayer', SPEL_VEND . '/video/artplayer.js', array('jquery'), '3.5.26', true); |
| 81 | wp_register_script('video-js-nuevo', SPEL_VEND . '/video/nuevo.min.js', array('jquery'), '7.6.0', true); |
| 82 | wp_register_script('video-js', SPEL_VEND . '/video/video.min.js', array('jquery'), '7.6.0', true); |
| 83 | wp_register_script('scroll-parallax', SPEL_VEND . '/scroll-parallax/jquery.parallax-scroll.js', array('jquery'), SPEL_VERSION, true); |
| 84 | wp_register_script('fancybox', SPEL_VEND . '/fancybox/js/jquery.fancybox.min.js', array('jquery'), '3.5.7', true); |
| 85 | wp_register_script('ajax-chimp', SPEL_JS . '/ajax-chimp.js', 'jquery', SPEL_VERSION, true); |
| 86 | wp_register_script('charming', SPEL_VEND . '/diagonal/charming.min.js', array('jquery'), SPEL_VERSION, true); |
| 87 | wp_register_script('tweenmax', SPEL_VEND . '/diagonal/TweenMax.min.js', array('jquery'), '1.18.0', true); |
| 88 | wp_register_script('beforeafter', SPEL_VEND . '/before/beforeafter.jquery-1.0.0.min.js', array('jquery'), '1.0.0', true); |
| 89 | wp_register_script('spel-script', SPEL_JS . '/scripts.js', array('jquery'), SPEL_VERSION, true); |
| 90 | } |
| 91 | |
| 92 | |
| 93 | /** |
| 94 | * Register Widget Styles |
| 95 | * |
| 96 | * Register custom styles required to run Spider Elements. |
| 97 | * |
| 98 | * @access public |
| 99 | */ |
| 100 | function register_editor_scripts() |
| 101 | { |
| 102 | wp_register_script('spel-el-widgets', SPEL_JS . '/elementor-widgets.js', [ |
| 103 | 'jquery', |
| 104 | 'elementor-frontend' |
| 105 | ], SPEL_VERSION, true); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | new Assets(); |