PluginProbe ʕ •ᴥ•ʔ
Spider Elements – Premium Elementor Widgets & Addons Library / 1.6.5
Spider Elements – Premium Elementor Widgets & Addons Library v1.6.5
trunk 1.0.0 1.1.0 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.7.0 1.8.0 1.9.0
spider-elements / includes / Frontend / Assets.php
spider-elements / includes / Frontend Last commit date
Assets.php 1 year ago
Assets.php
155 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 // Register Widget Style's
17 add_action('elementor/frontend/after_enqueue_styles', [$this, 'register_widget_styles']);
18
19 // Register Widget Script's
20 add_action('elementor/editor/after_enqueue_scripts', [$this, 'register_widget_scripts']);
21 add_action('elementor/frontend/after_register_scripts', [$this, 'register_widget_scripts']);
22
23 // Register Elementor Preview Editor Script's
24 add_action('elementor/editor/after_enqueue_scripts', [$this, 'register_editor_scripts']);
25 add_action('elementor/frontend/after_enqueue_scripts', [$this, 'register_editor_scripts']);
26
27
28 // Register Elementor Preview Editor Style's
29 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'elementor_editor_scripts' ] );
30 }
31
32
33 /**
34 * Register Widget Scripts
35 *
36 * Register custom style required to run Spider Elements.
37 *
38 * @access public
39 */
40 function register_widget_styles(): void
41 {
42 $theme = wp_get_theme();
43 $features_opt = get_option( 'spel_features_settings' );
44 $is_premium_or_theme = spel_is_premium() || in_array($theme->get('Name'), ['jobi', 'Jobi', 'jobi-child', 'Jobi Child']);
45
46 if ( isset($features_opt['spel_smooth_animation']) && $features_opt[ 'spel_smooth_animation' ] == 'on' ) {
47
48 // Define all the handlers in one string, separated by commas
49 $handlers = [
50 'e-animations',
51 'e-animation-fadeIn',
52 'e-animation-fadeInUp',
53 'e-animation-fadeInRight',
54 'e-animation-fadeInDown',
55 'e-animation-fadeInLeft',
56 'e-animation-zoomIn',
57 'e-animation-zoomInUp',
58 'e-animation-zoomInRight',
59 'e-animation-zoomInDown',
60 'e-animation-zoomInLeft',
61 'e-animation-grow',
62 ];
63
64 // Deregister all styles for the handlers
65 foreach ($handlers as $handler) {
66 wp_deregister_style($handler);
67 }
68
69 // Enqueue all handlers pointing to the same file
70 foreach ($handlers as $handler) {
71 wp_enqueue_style($handler, SPEL_VEND . '/animation/animate.css', [], SPEL_VERSION );
72 }
73
74 }
75
76 if ( $is_premium_or_theme ) {
77 if ( isset($features_opt['spel_heading_highlighted']) && $features_opt[ 'spel_heading_highlighted' ] == 'on' ) {
78 wp_enqueue_style('spel-extension');
79 }
80 if ( isset($features_opt['spel_badge']) && $features_opt[ 'spel_badge' ] == 'on' ) {
81 wp_enqueue_style('spel-extension');
82 }
83 }
84
85 wp_register_style('spel-extension', SPEL_CSS . '/extension.css', [], SPEL_VERSION);
86 wp_register_style('font-awesome', SPEL_VEND . '/font-awesome/css/all.css', [], '6.4.0');
87 wp_register_style('slick-theme', SPEL_VEND . '/slick/slick-theme.css', [], SPEL_VERSION);
88 wp_register_style('slick', SPEL_VEND . '/slick/slick.css', [], SPEL_VERSION);
89 wp_register_style('swiper', SPEL_VEND . '/swiper/swiper.min.css', [], '7.2.0');
90 wp_register_style( 'videojs', SPEL_VEND . '/video/videojs.min.css', [], SPEL_VERSION);
91 wp_register_style('video-theaterMode', SPEL_VEND . '/video/videojs.theaterMode.css', [], SPEL_VERSION);
92 wp_register_style('elegant-icon', SPEL_VEND . '/elegant-icon/style.css', [], SPEL_VERSION);
93 wp_register_style('fancybox', SPEL_VEND . '/fancybox/fancybox.min.css', [], SPEL_VERSION);
94
95 if ( is_rtl() ) {
96 wp_register_style( 'spel-main', SPEL_CSS . '/rtl.css', [], SPEL_VERSION );
97 } else {
98 wp_register_style('spel-main', SPEL_CSS . '/main.css', [], SPEL_VERSION);
99 }
100
101 }
102
103 /**
104 * Register Widget Scripts
105 *
106 * Register custom scripts required to run Spider Elements.
107 *
108 * @access public
109 */
110 function register_widget_scripts(): void
111 {
112
113 wp_register_script('slick', SPEL_VEND . '/slick/slick.min.js', ['jquery'], SPEL_VERSION, ['strategy' => 'defer'] );
114 wp_register_script('swiper', SPEL_VEND . '/swiper/swiper.min.js', ['jquery'], '7.2.0', ['strategy' => 'defer'] );
115 wp_register_script('text-type', SPEL_VEND . '/text-type/text-type.js', ['jquery'], SPEL_VERSION, ['strategy' => 'defer'] );
116 wp_register_script('counterup', SPEL_VEND . '/counterup/counterup.min.js', ['jquery'], '1.0', ['strategy' => 'defer'] );
117 wp_register_script('waypoint', SPEL_VEND . '/counterup/waypoints.min.js', ['jquery'], '4.0.1', ['strategy' => 'defer'] );
118 wp_register_script('wow', SPEL_VEND . '/wow/wow.min.js', ['jquery'], '1.1.3', ['strategy' => 'defer'] );
119 wp_register_script('artplayer', SPEL_VEND . '/video/artplayer.js', ['jquery'], '3.5.26', ['strategy' => 'defer'] );
120 wp_register_script('video-nuevo', SPEL_VEND . '/video/nuevo.min.js', ['jquery'], '7.6.0', ['strategy' => 'defer'] );
121 wp_register_script('video', SPEL_VEND . '/video/video.min.js', ['jquery'], '7.6.0', ['strategy' => 'defer'] );
122 wp_register_script('scroll-parallax', SPEL_VEND . '/scroll-parallax/parallax-scroll.js', ['jquery'], SPEL_VERSION, ['strategy' => 'defer'] );
123 wp_register_script('fancybox', SPEL_VEND . '/fancybox/fancybox.min.js', ['jquery'], '3.5.7', ['strategy' => 'defer'] );
124 wp_register_script('before-after', SPEL_VEND . '/before-after/before-after.min.js', ['jquery'], '1.0.0', ['strategy' => 'defer'] );
125
126 }
127
128
129 /**
130 * Register Widget Styles
131 *
132 * Register custom styles required to run Spider Elements.
133 *
134 * @access public
135 */
136 function register_editor_scripts(): void
137 {
138 wp_register_script('spel-el-widgets', SPEL_JS . '/elementor-widgets.js', ['jquery', 'elementor-frontend'], SPEL_VERSION, ['strategy' => 'defer'] );
139 }
140
141 /**
142 * Register Widget Styles
143 *
144 * Register custom styles required to run Spider Elements.
145 *
146 * @access public
147 */
148 public function elementor_editor_scripts(): void
149 {
150 wp_enqueue_style( 'spel-elementor-editor', SPEL_CSS . '/elementor-editor.css', [], SPEL_VERSION );
151 }
152
153 }
154
155