PluginProbe ʕ •ᴥ•ʔ
Spider Elements – Premium Elementor Widgets & Addons Library / trunk
Spider Elements – Premium Elementor Widgets & Addons Library vtrunk
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 4 months ago
Assets.php
156 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' ], true );
45
46 if ( isset( $features_opt['spel_smooth_animation'] ) && 'on' === $features_opt['spel_smooth_animation'] ) {
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'] ) && 'on' === $features_opt['spel_heading_highlighted'] ) {
78 wp_enqueue_style( 'spel-extension' );
79 }
80 if ( isset( $features_opt['spel_badge'] ) && 'on' === $features_opt['spel_badge'] ) {
81 wp_enqueue_style( 'spel-extension' );
82 }
83 }
84
85 wp_register_style('spel-dark-mode', SPEL_CSS . '/dark-mode.css', [], SPEL_VERSION);
86 wp_register_style('spel-extension', SPEL_CSS . '/extension.css', [], SPEL_VERSION);
87 wp_register_style('font-awesome', SPEL_VEND . '/font-awesome/css/all.css', [], '6.4.0');
88 wp_register_style('slick-theme', SPEL_VEND . '/slick/slick-theme.css', [], SPEL_VERSION);
89 wp_register_style('slick', SPEL_VEND . '/slick/slick.css', [], SPEL_VERSION);
90 wp_register_style('swiper', SPEL_VEND . '/swiper/swiper.min.css', [], '7.2.0');
91 wp_register_style( 'videojs', SPEL_VEND . '/video/videojs.min.css', [], SPEL_VERSION);
92 wp_register_style('video-theaterMode', SPEL_VEND . '/video/videojs.theaterMode.css', [], SPEL_VERSION);
93 wp_register_style('elegant-icon', SPEL_VEND . '/elegant-icon/style.css', [], SPEL_VERSION);
94 wp_register_style('fancybox', SPEL_VEND . '/fancybox/fancybox.min.css', [], SPEL_VERSION);
95
96 if ( is_rtl() ) {
97 wp_register_style( 'spel-main', SPEL_CSS . '/rtl.css', [], SPEL_VERSION );
98 } else {
99 wp_register_style('spel-main', SPEL_CSS . '/main.css', [], SPEL_VERSION);
100 }
101
102 }
103
104 /**
105 * Register Widget Scripts
106 *
107 * Register custom scripts required to run Spider Elements.
108 *
109 * @access public
110 */
111 function register_widget_scripts(): void
112 {
113
114 wp_register_script('slick', SPEL_VEND . '/slick/slick.min.js', ['jquery'], SPEL_VERSION, ['strategy' => 'defer'] );
115 wp_register_script('swiper', SPEL_VEND . '/swiper/swiper.min.js', ['jquery'], '7.2.0', ['strategy' => 'defer'] );
116 wp_register_script('text-type', SPEL_VEND . '/text-type/text-type.js', ['jquery'], SPEL_VERSION, ['strategy' => 'defer'] );
117 wp_register_script('counterup', SPEL_VEND . '/counterup/counterup.min.js', ['jquery'], '1.0', ['strategy' => 'defer'] );
118 wp_register_script('waypoint', SPEL_VEND . '/counterup/waypoints.min.js', ['jquery'], '4.0.1', ['strategy' => 'defer'] );
119 wp_register_script('wow', SPEL_VEND . '/wow/wow.min.js', ['jquery'], '1.1.3', ['strategy' => 'defer'] );
120 wp_register_script('artplayer', SPEL_VEND . '/video/artplayer.js', ['jquery'], '3.5.26', ['strategy' => 'defer'] );
121 wp_register_script('video-nuevo', SPEL_VEND . '/video/nuevo.min.js', ['jquery'], '7.6.0', ['strategy' => 'defer'] );
122 wp_register_script('video', SPEL_VEND . '/video/video.min.js', ['jquery'], '7.6.0', ['strategy' => 'defer'] );
123 wp_register_script('scroll-parallax', SPEL_VEND . '/scroll-parallax/parallax-scroll.js', ['jquery'], SPEL_VERSION, ['strategy' => 'defer'] );
124 wp_register_script('fancybox', SPEL_VEND . '/fancybox/fancybox.min.js', ['jquery'], '3.5.7', ['strategy' => 'defer'] );
125 wp_register_script('before-after', SPEL_VEND . '/before-after/before-after.min.js', ['jquery'], '1.0.0', ['strategy' => 'defer'] );
126
127 }
128
129
130 /**
131 * Register Widget Styles
132 *
133 * Register custom styles required to run Spider Elements.
134 *
135 * @access public
136 */
137 function register_editor_scripts(): void
138 {
139 wp_register_script('spel-el-widgets', SPEL_JS . '/elementor-widgets.js', ['jquery', 'elementor-frontend'], SPEL_VERSION, ['strategy' => 'defer'] );
140 }
141
142 /**
143 * Register Widget Styles
144 *
145 * Register custom styles required to run Spider Elements.
146 *
147 * @access public
148 */
149 public function elementor_editor_scripts(): void
150 {
151 wp_enqueue_style( 'spel-elementor-editor', SPEL_CSS . '/elementor-editor.css', [], SPEL_VERSION );
152 }
153
154 }
155
156