PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.3.17
UiCore Elements – Free widgets and templates for Elementor v1.3.17
1.3.17 1.3.16 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 All 41 releases
← All changes | includes/class-assets.php +72 -30 1.2.21.3.17 View file →
@@ -1,19 +1,23 @@
1 1 <?php
2 +
2 3 namespace UiCoreElements;
4 +
3 5 use Elementor\Plugin;
4 6
5 7 /**
6 8 * Scripts and Styles Class
7 9 */
8 -class Assets {
10 +class Assets
11 +{
9 12
10 - function __construct() {
11 - if ( is_admin() ) {
12 - add_action( 'admin_enqueue_scripts', [ $this, 'register' ], 5 );
13 - add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'enqueue' ], 5 );
13 + function __construct()
14 + {
15 + if (is_admin()) {
16 + add_action('admin_enqueue_scripts', [$this, 'register'], 5);
17 + add_action('elementor/editor/after_enqueue_scripts', [$this, 'enqueue'], 5);
14 18 } else {
15 - add_action( 'wp_enqueue_scripts', [ $this, 'register' ], 5 );
19 + add_action('wp_enqueue_scripts', [$this, 'register'], 5);
16 20 }
17 21 }
18 22
19 23 /**
@@ -20,11 +24,12 @@
20 24 * Register our app scripts and styles
21 25 *
22 26 * @return void
23 27 */
24 - public function register() {
25 - $this->register_scripts( $this->get_scripts() );
26 - $this->register_styles( $this->get_styles() );
28 + public function register()
29 + {
30 + $this->register_scripts($this->get_scripts());
31 + $this->register_styles($this->get_styles());
27 32 }
28 33
29 34 /**
30 35 * Enqueue our app scripts directly in the Elementor editor
@@ -30,11 +35,12 @@
30 35 * Enqueue our app scripts directly in the Elementor editor
31 36 *
32 37 * @return void
33 38 */
34 - public function enqueue() {
35 - if ( Plugin::instance()->editor->is_edit_mode() ) {
36 - wp_enqueue_script('ui-nested-elements', UICORE_ELEMENTS_ASSETS . '/js/components/nested-elements.js', [], UICORE_ELEMENTS_VERSION, true);
39 + public function enqueue()
40 + {
41 + if (Plugin::instance()->editor->is_edit_mode()) {
42 + wp_enqueue_script('ui-nested-elements', UICORE_ELEMENTS_ASSETS . '/js/components/nested-elements.js', ['nested-elements', 'elementor-editor', 'elementor-common'], UICORE_ELEMENTS_VERSION, true);
37 43 }
38 44 }
39 45
40 46 /**
@@ -43,15 +49,16 @@
43 49 * @param array $scripts
44 50 *
45 51 * @return void
46 52 */
47 - private function register_scripts( $scripts ) {
48 - foreach ( $scripts as $handle => $script ) {
49 - $deps = isset( $script['deps'] ) ? $script['deps'] : false;
50 - $in_footer = isset( $script['in_footer'] ) ? $script['in_footer'] : false;
51 - $version = isset( $script['version'] ) ? $script['version'] : UICORE_ELEMENTS_VERSION;
53 + private function register_scripts($scripts)
54 + {
55 + foreach ($scripts as $handle => $script) {
56 + $deps = isset($script['deps']) ? $script['deps'] : false;
57 + $in_footer = isset($script['in_footer']) ? $script['in_footer'] : false;
58 + $version = isset($script['version']) ? $script['version'] : UICORE_ELEMENTS_VERSION;
52 59
53 - wp_register_script( $handle, $script['src'], $deps, $version, $in_footer );
60 + wp_register_script($handle, $script['src'], $deps, $version, $in_footer);
54 61 }
55 62 }
56 63
57 64 /**
@@ -60,13 +67,14 @@
60 67 * @param array $styles
61 68 *
62 69 * @return void
63 70 */
64 - public function register_styles( $styles ) {
65 - foreach ( $styles as $handle => $style ) {
66 - $deps = isset( $style['deps'] ) ? $style['deps'] : false;
71 + public function register_styles($styles)
72 + {
73 + foreach ($styles as $handle => $style) {
74 + $deps = isset($style['deps']) ? $style['deps'] : false;
67 75
68 - wp_register_style( $handle, $style['src'], $deps, UICORE_ELEMENTS_VERSION );
76 + wp_register_style($handle, $style['src'], $deps, UICORE_ELEMENTS_VERSION);
69 77 }
70 78 }
71 79
72 80 /**
@@ -73,10 +81,11 @@
73 81 * Get all registered scripts
74 82 *
75 83 * @return array
76 84 */
77 - public function get_scripts() {
78 - $prefix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
85 + public function get_scripts()
86 + {
87 + $prefix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
79 88
80 89 $scripts = [
81 90 // Libs that extend current scripts
82 91 'ui-e-countup' => [
@@ -91,9 +100,9 @@
91 100 ],
92 101 // TODO: update swiper version when loop bug is fixed (last checked on 11.2.6)
93 102 'ui-e-swiper' => [
94 103 'src' => UICORE_ELEMENTS_ASSETS . '/js/lib/swiper.js',
95 - 'version' => '11.2.1',
104 + 'version' => '11.2.1-ui',
96 105 'in_footer' => true
97 106 ],
98 107 'ui-e-special-effects' => [
99 108 'src' => UICORE_ELEMENTS_ASSETS . '/js/lib/carousel-effects/special-effects.js',
@@ -159,9 +168,10 @@
159 168 'ui-e-testimonial' => [
160 169 'src' => UICORE_ELEMENTS_ASSETS . '/js/components/global-testimonial.js',
161 170 'version' => UICORE_ELEMENTS_VERSION,
162 171 'in_footer' => true
163 - ]
172 + ],
173 +
164 174 ];
165 175
166 176 return $scripts;
167 177 }
@@ -170,9 +180,10 @@
170 180 * Get registered styles
171 181 *
172 182 * @return array
173 183 */
174 - public function get_styles() {
184 + public function get_styles()
185 + {
175 186
176 187 // Singular files widgets may enqueue
177 188 $styles = [
178 189 // Animation related
@@ -186,9 +197,9 @@
186 197 // Layout related
187 198 'ui-e-grid' => [
188 199 'src' => UICORE_ELEMENTS_ASSETS . '/css/components/grid.css'
189 200 ],
190 - 'ui-e-legacy-grid' =>[
201 + 'ui-e-legacy-grid' => [
191 202 'src' => UICORE_ELEMENTS_ASSETS . '/css/components/legacy-grid.css'
192 203 ],
193 204 'ui-e-carousel' => [
194 205 'src' => UICORE_ELEMENTS_ASSETS . '/css/components/carousel.css',
@@ -203,11 +214,42 @@
203 214 'src' => UICORE_ELEMENTS_ASSETS . '/css/components/filters.css'
204 215 ],
205 216 'ui-e-counter-motion' => [
206 217 'src' => UICORE_ELEMENTS_ASSETS . '/css/components/counter-motion.css'
207 - ]
218 + ],
219 +
220 + // Advanced Menu
221 + 'ui-e-advanced-menu-editor' => [
222 + 'src' => UICORE_ELEMENTS_ASSETS . '/css/components/advanced-menu/editor.css'
223 + ],
224 + 'ui-e-advanced-menu-fullscreen-layout' => [
225 + 'src' => UICORE_ELEMENTS_ASSETS . '/css/components/advanced-menu/fullscreen-layout.css'
226 + ],
227 + 'ui-e-advanced-menu-website-blur' => [
228 + 'src' => UICORE_ELEMENTS_ASSETS . '/css/components/advanced-menu/website-blur.css'
229 + ],
230 + 'ui-e-advanced-menu-canvas-dropdown-expand' => [
231 + 'src' => UICORE_ELEMENTS_ASSETS . '/css/components/advanced-menu/canvas-expand.css'
232 + ],
233 + 'ui-e-advanced-menu-canvas-dropdown-slide' => [
234 + 'src' => UICORE_ELEMENTS_ASSETS . '/css/components/advanced-menu/canvas-slide.css'
235 + ],
236 + 'ui-e-advanced-menu-hover-underline' => [
237 + 'src' => UICORE_ELEMENTS_ASSETS . '/css/components/advanced-menu/hover-underline.css'
238 + ],
239 + 'ui-e-advanced-menu-hover-button' => [
240 + 'src' => UICORE_ELEMENTS_ASSETS . '/css/components/advanced-menu/hover-button.css'
241 + ],
242 + 'ui-e-advanced-menu-hover-magnet' => [
243 + 'src' => UICORE_ELEMENTS_ASSETS . '/css/components/advanced-menu/hover-magnet.css'
244 + ],
245 + 'ui-e-advanced-menu-hover-focus' => [
246 + 'src' => UICORE_ELEMENTS_ASSETS . '/css/components/advanced-menu/hover-focus.css'
247 + ],
248 + 'ui-e-advanced-menu-hover-text_flip' => [
249 + 'src' => UICORE_ELEMENTS_ASSETS . '/css/components/advanced-menu/hover-text-flip.css'
250 + ],
208 251 ];
209 252
210 253 return $styles;
211 254 }
212 -
213 255 }