PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.1.3
ShopBuilder – WooCommerce Builder For Elementor v3.1.3
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
← All changes | app/Controllers/AssetsController.php +192 -90 2.1.143.1.3 View file →
@@ -1,11 +1,16 @@
1 1 <?php
2 +/**
3 + * Assets Controller Class
4 + *
5 + * @package RadiusTheme\SB
6 + */
2 7
3 8 namespace RadiusTheme\SB\Controllers;
4 9
5 -use RadiusTheme\SB\Helpers\BuilderFns;
6 10 use RadiusTheme\SB\Helpers\Fns;
7 11 use RadiusTheme\SB\Models\Settings;
12 +use RadiusTheme\SB\Helpers\BuilderFns;
8 13 use RadiusTheme\SB\Traits\SingletonTrait;
9 14
10 15 // Do not allow directly accessing this file.
11 16 if ( ! defined( 'ABSPATH' ) ) {
@@ -11,8 +16,11 @@
11 16 if ( ! defined( 'ABSPATH' ) ) {
12 17 exit( 'This script cannot be accessed directly.' );
13 18 }
14 19
20 +/**
21 + * Assets Controller Class
22 + */
15 23 class AssetsController {
16 24
17 25 use SingletonTrait;
18 26
@@ -44,19 +52,27 @@
44 52 */
45 53 private $scripts = [];
46 54
47 55 /**
56 + * Cached bundled assets.
57 + *
58 + * @var array|null
59 + */
60 + private $cached_bundled_assets = null;
61 +
62 + /**
48 63 * Class Constructor
49 64 */
50 65 public function __construct() {
51 66 $this->version = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? time() : RTSB_VERSION;
52 67
68 + // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
53 69 if ( in_array( 'sitepress-multilingual-cms/sitepress.php', get_option( 'active_plugins' ) ) ) {
54 70 self::$ajaxurl = admin_url( 'admin-ajax.php?lang=' . ICL_LANGUAGE_CODE );
55 71 } else {
56 72 self::$ajaxurl = admin_url( 'admin-ajax.php' );
57 73 }
58 -
74 + add_filter( 'rtsb/optimizer/scripts/deps', [ $this, 'extend_shared_dependencies' ], 99 );
59 75 /**
60 76 * Admin scripts.
61 77 */
62 78 add_action( 'admin_enqueue_scripts', [ $this, 'register_backend_assets' ], 1 );
@@ -64,16 +80,28 @@
64 80
65 81 /**
66 82 * Public scripts.
67 83 */
68 - add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_public_scripts' ], 15 );
84 + add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_public_scripts' ], 25 );
69 85 /**
70 86 * General scripts.
71 87 */
72 88 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_general_public_scripts' ], 30 );
73 89 }
74 -
75 90 /**
91 + * Shared dependencies.
92 + *
93 + * @param array $deps Dependencies.
94 + *
95 + * @return array
96 + */
97 + public function extend_shared_dependencies( $deps ) {
98 + if ( Fns::is_elementor_widget_active( 'products_slider' ) ) {
99 + $deps[] = 'swiper';
100 + }
101 + return array_unique( $deps );
102 + }
103 + /**
76 104 * Get all frontend scripts.
77 105 *
78 106 * @return void
79 107 */
@@ -86,14 +114,20 @@
86 114 *
87 115 * @return object
88 116 */
89 117 private function get_public_styles() {
90 - $rtl_suffix = is_rtl() ? '-rtl' : '';
118 + $rtl_suffix = is_rtl() ? '-rtl' : '';
119 + $rtl_dir = is_rtl() ? trailingslashit( 'rtl' ) : trailingslashit( 'css' );
120 +
91 121 $this->styles[] = [
122 + 'handle' => 'rtsb-odometer',
123 + 'src' => rtsb()->get_assets_uri( 'vendor/odometer/css/odometer.min.css' ),
124 + ];
125 +
126 + $this->styles[] = [
92 127 'handle' => 'rtsb-fonts',
93 128 'src' => rtsb()->get_assets_uri( 'css/frontend/rtsb-fonts.css' ),
94 129 ];
95 -
96 130 if ( rtsb()->has_pro() ) {
97 131 $this->styles[] = [
98 132 'handle' => 'rtsb-noui-slider',
99 133 'src' => rtsbpro()->get_assets_uri( 'vendors/nouislider/nouislider.min.css' ),
@@ -99,18 +133,25 @@
99 133 'src' => rtsbpro()->get_assets_uri( 'vendors/nouislider/nouislider.min.css' ),
100 134 ];
101 135 }
102 136
103 - $this->styles[] = [
104 - 'handle' => 'rtsb-frontend',
105 - 'src' => rtsb()->get_assets_uri( 'css/frontend/frontend' . $rtl_suffix . '.css' ),
106 - ];
137 + $pro_version = defined( 'RTSBPRO_VERSION' ) ? RTSBPRO_VERSION : '0';
138 + $addon_condition = version_compare( $pro_version, '1.9.0', '<' );
107 139
108 - $this->styles[] = [
109 - 'handle' => 'swiper',
110 - 'src' => rtsb()->get_assets_uri( 'vendor/swiper/css/swiper-bundle.min.css' ),
111 - ];
112 -
140 + if ( ! rtsb()->has_pro() && Fns::is_optimization_enabled() ) {
141 + $this->styles[] = AssetRegistry::instance()->load_optimized_assets();
142 + } else {
143 + if ( $addon_condition ) {
144 + $this->styles[] = [
145 + 'handle' => 'rtsb-general-addons',
146 + 'src' => rtsb()->get_assets_uri( $rtl_dir . 'frontend/general-addons' . $rtl_suffix . '.css' ),
147 + ];
148 + }
149 + $this->styles[] = [
150 + 'handle' => 'rtsb-frontend',
151 + 'src' => rtsb()->get_assets_uri( $rtl_dir . 'frontend/frontend' . $rtl_suffix . '.css' ),
152 + ];
153 + }
113 154 if ( BuilderFns::is_builder_preview() && 'elementor' == Fns::page_edit_with( get_the_ID() ) ) {
114 155 $this->styles[] = [
115 156 'handle' => 'photoswipe',
116 157 'src' => plugins_url( 'assets/css/photoswipe/photoswipe.min.css', WC_PLUGIN_FILE ),
@@ -136,40 +177,26 @@
136 177 *
137 178 * @return object
138 179 */
139 180 private function get_public_scripts() {
140 -
141 - $default_swiper_path = rtsb()->get_assets_uri( 'vendor/swiper/js/swiper-bundle.min.js' );
142 -
143 - if ( defined( 'ELEMENTOR_ASSETS_PATH' ) ) {
144 - $is_swiper8_enable = get_option( 'elementor_experiment-e_swiper_latest' );
145 -
146 - if ( 'active' === $is_swiper8_enable || 'default' === $is_swiper8_enable ) {
147 - $el_swiper_path = 'lib/swiper/v8/swiper.min.js';
148 - } else {
149 - $el_swiper_path = 'lib/swiper/swiper.min.js';
150 - }
151 -
152 - $elementor_swiper_path = ELEMENTOR_ASSETS_PATH . $el_swiper_path;
153 -
154 - if ( file_exists( $elementor_swiper_path ) ) {
155 - $default_swiper_path = ELEMENTOR_ASSETS_URL . $el_swiper_path;
156 - }
157 - }
158 -
159 181 $this->scripts[] = [
160 182 'handle' => 'swiper',
161 - 'src' => esc_url( $default_swiper_path ),
183 + 'src' => esc_url( $this->get_swiper_url() ),
162 184 'deps' => [ 'jquery' ],
163 185 'footer' => true,
164 186 ];
165 -
166 187 $this->scripts[] = [
167 - 'handle' => 'rtsb-imagesloaded',
168 - 'src' => rtsb()->get_assets_uri( 'vendor/isotope/imagesloaded.pkgd.min.js' ),
188 + 'handle' => 'rtsb-waypoints',
189 + 'src' => rtsb()->get_assets_uri( 'vendor/waypoints/js/jquery.waypoints.min.js' ),
169 190 'deps' => [ 'jquery' ],
170 191 'footer' => true,
171 192 ];
193 + $this->scripts[] = [
194 + 'handle' => 'rtsb-odometer',
195 + 'src' => rtsb()->get_assets_uri( 'vendor/odometer/js/odometer.min.js' ),
196 + 'deps' => [ 'jquery' ],
197 + 'footer' => true,
198 + ];
172 199
173 200 $this->scripts[] = [
174 201 'handle' => 'rtsb-tipsy',
175 202 'src' => rtsb()->get_assets_uri( 'vendor/tipsy/tipsy.min.js' ),
@@ -228,16 +255,34 @@
228 255 'src' => rtsbpro()->get_assets_uri( 'vendors/sticky-sidebar/sticky-sidebar.min.js' ),
229 256 'deps' => [ 'jquery' ],
230 257 'footer' => true,
231 258 ];
259 +
260 + $this->scripts[] = [
261 + 'handle' => 'rtsb-popper',
262 + 'src' => rtsbpro()->get_assets_uri( 'vendors/tippy/popper.min.js' ),
263 + 'deps' => [ 'jquery' ],
264 + 'footer' => true,
265 + ];
266 +
267 + $this->scripts[] = [
268 + 'handle' => 'rtsb-tippy',
269 + 'src' => rtsbpro()->get_assets_uri( 'vendors/tippy/tippy.min.js' ),
270 + 'deps' => [ 'jquery', 'rtsb-popper' ],
271 + 'footer' => true,
272 + ];
232 273 }
233 274
234 - $this->scripts[] = [
235 - 'handle' => 'rtsb-public',
236 - 'src' => rtsb()->get_assets_uri( 'js/frontend/frontend.js' ),
237 - 'deps' => [ 'jquery', 'rtsb-imagesloaded', 'swiper' ],
238 - 'footer' => true,
239 - ];
275 + if ( ! rtsb()->has_pro() && Fns::is_optimization_enabled() ) {
276 + $this->scripts[] = AssetRegistry::instance()->load_optimized_assets( 'js' );
277 + } else {
278 + $this->scripts[] = [
279 + 'handle' => 'rtsb-public',
280 + 'src' => rtsb()->get_assets_uri( 'js/frontend/frontend.js' ),
281 + 'deps' => [ 'jquery', 'imagesloaded', 'swiper' ],
282 + 'footer' => true,
283 + ];
284 + }
240 285
241 286 return $this;
242 287 }
243 288
@@ -247,8 +292,10 @@
247 292 * @return void
248 293 */
249 294 public function register_public_scripts() {
250 295 $this->get_public_assets();
296 + $this->styles = array_filter( $this->styles );
297 + $this->scripts = array_filter( $this->scripts );
251 298
252 299 // Register public styles.
253 300 foreach ( $this->styles as $style ) {
254 301 wp_register_style( $style['handle'], $style['src'], '', $this->version );
@@ -269,8 +316,9 @@
269 316 /**
270 317 * Register scripts.
271 318 */
272 319 $this->register_public_scripts();
320 +
273 321 /**
274 322 * Enqueue scripts.
275 323 */
276 324 if ( BuilderFns::is_builder_preview() && 'elementor' === Fns::page_edit_with( get_the_ID() ) ) {
@@ -276,9 +324,8 @@
276 324 if ( BuilderFns::is_builder_preview() && 'elementor' === Fns::page_edit_with( get_the_ID() ) ) {
277 325 /**
278 326 * Styles.
279 327 */
280 - wp_enqueue_style( 'swiper' );
281 328 wp_enqueue_style( 'photoswipe' );
282 329 wp_enqueue_style( 'photoswipe-default-skin' );
283 330 wp_enqueue_style( 'elementor-editor-style-fix' );
284 331 wp_enqueue_style( 'woocommerce-general' );
@@ -285,27 +332,31 @@
285 332
286 333 /**
287 334 * Scripts.
288 335 */
336 + $handle = Fns::optimized_handle( 'rtsb-public' );
337 +
289 338 wp_enqueue_script( 'flexslider' );
290 339 wp_enqueue_script( 'wc-single-product' );
291 - wp_dequeue_script( 'rtsb-public' );
340 + wp_dequeue_script( $handle );
292 341 wp_enqueue_script( 'swiper' );
293 - wp_enqueue_script( 'rtsb-public' );
342 +
343 + if ( Fns::is_optimization_enabled() ) {
344 + Fns::enqueue_optimized_assets();
345 + } else {
346 + wp_enqueue_script( $handle );
347 + }
294 348 }
295 349
296 - /**
297 - * Styles.
298 - */
299 - wp_enqueue_style( 'rtsb-fonts' );
300 - wp_enqueue_style( 'rtsb-frontend' );
350 + wp_enqueue_script( 'rtsb-tipsy' );
301 351
302 - /**
303 - * Scripts.
304 - */
305 - wp_enqueue_script( 'rtsb-imagesloaded' );
306 - wp_enqueue_script( 'rtsb-tipsy' );
307 - wp_enqueue_script( 'rtsb-public' );
352 + if ( Fns::is_optimization_enabled() ) {
353 + Fns::enqueue_optimized_assets();
354 + } else {
355 + wp_enqueue_style( 'rtsb-fonts' );
356 + wp_enqueue_style( 'rtsb-frontend' );
357 + wp_enqueue_script( 'rtsb-public' );
358 + }
308 359
309 360 /**
310 361 * Localize script.
311 362 */
@@ -318,24 +369,28 @@
318 369 * @static
319 370 * @return void
320 371 */
321 372 public static function localizeData() {
373 + $handle = Fns::optimized_handle( 'rtsb-public' );
374 +
322 375 wp_localize_script(
323 - 'rtsb-public',
376 + $handle,
324 377 'rtsbPublicParams',
325 378 [
326 - 'ajaxUrl' => esc_url( self::$ajaxurl ),
327 - 'homeurl' => home_url(),
328 - 'wcCartUrl' => wc_get_cart_url(),
329 - 'addedToCartText' => esc_html__( 'Product Added', 'shopbuilder' ),
330 - 'singleCartToastrText' => esc_html__( 'Successfully Added', 'shopbuilder' ),
331 - 'singleCartBtnText' => apply_filters( 'rtsb/global/single_add_to_cart_success', esc_html__( 'Added to Cart', 'shopbuilder' ) ),
332 - 'browseCartText' => esc_html__( 'Browse Cart', 'shopbuilder' ),
333 - 'noProductsText' => apply_filters( 'rtsb/global/no_products_text', esc_html__( 'No more products to load', 'shopbuilder' ) ),
334 - 'notice' => [
379 + 'ajaxUrl' => esc_url( self::$ajaxurl ),
380 + 'homeurl' => home_url(),
381 + 'wcCartUrl' => wc_get_cart_url(),
382 + 'addedToCartText' => esc_html__( 'Product Added', 'shopbuilder' ),
383 + 'singleCartToastrText' => esc_html__( 'Successfully Added', 'shopbuilder' ),
384 + 'singleCartBtnText' => apply_filters( 'rtsb/global/single_add_to_cart_success', esc_html__( 'Added to Cart', 'shopbuilder' ) ),
385 + 'browseCartText' => esc_html__( 'Browse Cart', 'shopbuilder' ),
386 + 'noProductsText' => apply_filters( 'rtsb/global/no_products_text', esc_html__( 'No more products to load', 'shopbuilder' ) ),
387 + 'isOptimizationEnabled' => Fns::is_optimization_enabled(),
388 + 'isLoaderEnabled' => Fns::enable_loader(),
389 + 'notice' => [
335 390 'position' => Fns::get_option( 'general', 'notification', 'notification_position', 'center-center' ),
336 391 ],
337 - rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
392 + rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
338 393 ]
339 394 );
340 395 }
341 396
@@ -349,9 +404,19 @@
349 404 * Styles.
350 405 */
351 406 wp_register_style( 'rtsb-admin-app', rtsb()->get_assets_uri( 'css/backend/admin-settings.css' ), '', $this->version );
352 407 wp_register_style( 'rtsb-fonts', rtsb()->get_assets_uri( 'css/frontend/rtsb-fonts.css' ), '', $this->version );
353 - // wp_register_style( 'rtsb-admin-global', rtsb()->get_assets_uri( 'css/backend/admin-global.css' ), '', $this->version );
408 +
409 + $current_screen = get_current_screen();
410 +
411 + if ( 'edit-rtsb_builder' === $current_screen->id ) {
412 + if ( ! function_exists( 'woocommerce_get_asset_url' ) ) {
413 + include_once WC_ABSPATH . 'includes/wc-template-functions.php';
414 + }
415 +
416 + wp_deregister_style( 'select2' );
417 + wp_register_style( 'select2', plugins_url( 'assets/css/select2.css', WC_PLUGIN_FILE ) ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
418 + }
354 419 wp_register_style( 'rtsb-templatebuilder', rtsb()->get_assets_uri( 'css/backend/template-builder.css' ), '', $this->version );
355 420
356 421 /**
357 422 * Scripts.
@@ -362,18 +427,17 @@
362 427
363 428 /**
364 429 * Enqueues admin scripts.
365 430 *
366 - * @param string $hook Hooks.
367 - *
368 431 * @return void
369 432 */
370 - public function enqueue_backend_scripts( $hook ) {
433 + public function enqueue_backend_scripts() {
371 434 ob_start(); ?>
372 435 #adminmenu .toplevel_page_rtsb .wp-menu-image img {
373 436 width: auto;
374 437 height: 22px;
375 438 padding: 4px 0;
439 + box-sizing: content-box;
376 440 }
377 441 .post-type-rtsb_builder li#wp-admin-bar-WPML_ALS_all,
378 442 .post-type-rtsb_builder li.language_all{
379 443 display: none;
@@ -382,12 +446,22 @@
382 446 <?php
383 447 $admin_global_style = ob_get_clean();
384 448 // Speed Optimization.
385 449 wp_add_inline_style( 'admin-menu', $admin_global_style );
386 - // wp_enqueue_style( 'rtsb-admin-global' );
387 450
388 451 global $pagenow;
389 452
453 + $whitelisted_pages = [ 'rtsb-settings', 'rtsb-get-help', 'rtsb-themes' ];
454 + $current_page = ! empty( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
455 +
456 + if ( 'admin.php' === $pagenow && ! empty( $_GET['page'] ) && in_array( $current_page, $whitelisted_pages, true ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
457 + /**
458 + * Styles.
459 + */
460 + wp_enqueue_style( 'rtsb-admin-app' );
461 + wp_enqueue_style( 'rtsb-fonts' );
462 + }
463 +
390 464 if ( 'admin.php' === $pagenow && ! empty( $_GET['page'] ) && 'rtsb-settings' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
391 465 // Elementor Console Error Fixed For "rtsb-settings" Page.
392 466 wp_dequeue_script( 'elementor-admin-top-bar' );
393 467 wp_dequeue_script( 'elementor-common' );
@@ -395,8 +469,9 @@
395 469 wp_dequeue_script( 'elementor-web-cli' );
396 470 wp_dequeue_script( 'elementor-import-export-admin' );
397 471 wp_dequeue_script( 'elementor-app-loader' );
398 472 wp_dequeue_script( 'elementor-admin-modules' );
473 + wp_dequeue_script( 'elementor-ai-media-library' );
399 474 wp_dequeue_script( 'elementor-admin' );
400 475
401 476 wp_dequeue_style( 'elementor-admin-top-bar' );
402 477 wp_dequeue_style( 'elementor-admin' );
@@ -403,16 +478,11 @@
403 478 wp_dequeue_style( 'e-theme-ui-light' );
404 479 wp_dequeue_style( 'elementor-common' );
405 480
406 481 /**
407 - * Styles.
408 - */
409 - wp_enqueue_style( 'rtsb-admin-app' );
410 - wp_enqueue_style( 'rtsb-fonts' );
411 -
412 - /**
413 482 * Scripts.
414 483 */
484 + wp_enqueue_media();
415 485 wp_enqueue_script( 'updates' );
416 486 wp_enqueue_script( 'rtsb-admin-app' );
417 487 wp_localize_script(
418 488 'rtsb-admin-app',
@@ -417,17 +487,23 @@
417 487 wp_localize_script(
418 488 'rtsb-admin-app',
419 489 'rtsbParams',
420 490 [
421 - 'ajaxurl' => esc_url( self::$ajaxurl ),
422 - 'homeurl' => home_url(),
423 - 'adminLogo' => rtsb()->get_assets_uri( 'images/icon/ShopBuilder-Logo.svg' ),
424 - 'restApiUrl' => esc_url_raw( rest_url() ),
425 - 'rest_nonce' => wp_create_nonce( 'wp_rest' ),
426 - 'nonce' => wp_create_nonce( rtsb()->nonceText ),
427 - 'sections' => Settings::instance()->get_sections(),
428 - 'pages' => Fns::get_pages(),
429 - 'hasPro' => rtsb()->has_pro() ? 'yes' : 'no',
491 + 'ajaxurl' => esc_url( self::$ajaxurl ),
492 + 'homeurl' => home_url(),
493 + 'adminLogo' => rtsb()->get_assets_uri( 'images/icon/ShopBuilder-Logo.svg' ),
494 + 'restApiUrl' => esc_url_raw( rest_url() ),
495 + 'rest_nonce' => wp_create_nonce( 'wp_rest' ),
496 + 'nonce' => wp_create_nonce( rtsb()->nonceText ),
497 + 'pages' => Fns::get_pages(),
498 + 'hasPro' => rtsb()->has_pro() ? 'yes' : 'no',
499 + 'proVersion' => defined( 'RTSBPRO_VERSION' ) ? RTSBPRO_VERSION : '0',
500 + 'updateRates' => esc_html__( 'Update All Rates', 'shopbuilder' ),
501 + 'sections' => Settings::instance()->get_sections(),
502 + 'userRoles' => Fns::get_all_user_roles(),
503 + 'hasElementor' => defined( 'ELEMENTOR_VERSION' ),
504 + 'loadElementor' => Fns::should_load_elementor_scripts(),
505 + 'isOptimizationEnabled' => Fns::is_optimization_enabled(),
430 506 ]
431 507 );
432 508 } else {
433 509 $current_screen = get_current_screen();
@@ -477,8 +553,9 @@
477 553
478 554 if ( ! empty( $notification_color ) ) {
479 555 $dynamic_css .= ".rtsb-shopbuilder-plugin #toast-container .toast-success{color:{$notification_color}}";
480 556 $dynamic_css .= ".rtsb-shopbuilder-plugin #toast-container .toast-success:before{background-color:{$notification_color}}";
557 + $dynamic_css .= ".rtsb-shopbuilder-plugin #toast-container .toast-close-button{color:{$notification_color}}";
481 558 }
482 559
483 560 if ( ! empty( $notification_bgcolor ) ) {
484 561 $dynamic_css .= ".rtsb-shopbuilder-plugin #toast-container .toast-success{background-color:{$notification_bgcolor}}";
@@ -488,8 +565,33 @@
488 565 $dynamic_css .= ".rtsb-shopbuilder-plugin #toast-container .toast-success a{color:{$notification_button_color}}";
489 566 }
490 567
491 568 if ( ! empty( $dynamic_css ) ) {
492 - wp_add_inline_style( 'rtsb-frontend', $dynamic_css );
569 + wp_add_inline_style( Fns::optimized_handle( 'rtsb-frontend' ), $dynamic_css );
493 570 }
571 + }
572 +
573 + /**
574 + * Get the appropriate Swiper JS file URL.
575 + *
576 + * @return string
577 + */
578 + private function get_swiper_url() {
579 + $default_swiper_url = rtsb()->get_assets_uri( 'vendor/swiper/js/swiper-bundle.min.js' );
580 +
581 + if ( defined( 'ELEMENTOR_ASSETS_PATH' ) && defined( 'ELEMENTOR_ASSETS_URL' ) ) {
582 + $experiment = get_option( 'elementor_experiment-e_swiper_latest' );
583 +
584 + $el_relative_path = ( 'active' === $experiment || 'default' === $experiment )
585 + ? 'lib/swiper/v8/swiper.min.js'
586 + : 'lib/swiper/swiper.min.js';
587 +
588 + $el_full_path = ELEMENTOR_ASSETS_PATH . $el_relative_path;
589 +
590 + if ( file_exists( $el_full_path ) ) {
591 + return ELEMENTOR_ASSETS_URL . $el_relative_path;
592 + }
593 + }
594 +
595 + return $default_swiper_url;
494 596 }
495 597 }