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 +198 -88 2.1.83.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
@@ -348,9 +403,20 @@
348 403 /**
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 - // wp_register_style( 'rtsb-admin-global', rtsb()->get_assets_uri( 'css/backend/admin-global.css' ), '', $this->version );
407 + wp_register_style( 'rtsb-fonts', rtsb()->get_assets_uri( 'css/frontend/rtsb-fonts.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 + }
353 419 wp_register_style( 'rtsb-templatebuilder', rtsb()->get_assets_uri( 'css/backend/template-builder.css' ), '', $this->version );
354 420
355 421 /**
356 422 * Scripts.
@@ -361,27 +427,41 @@
361 427
362 428 /**
363 429 * Enqueues admin scripts.
364 430 *
365 - * @param string $hook Hooks.
366 - *
367 431 * @return void
368 432 */
369 - public function enqueue_backend_scripts( $hook ) {
433 + public function enqueue_backend_scripts() {
370 434 ob_start(); ?>
371 435 #adminmenu .toplevel_page_rtsb .wp-menu-image img {
372 436 width: auto;
373 437 height: 22px;
374 438 padding: 4px 0;
439 + box-sizing: content-box;
375 440 }
441 + .post-type-rtsb_builder li#wp-admin-bar-WPML_ALS_all,
442 + .post-type-rtsb_builder li.language_all{
443 + display: none;
444 + }
445 +
376 446 <?php
377 447 $admin_global_style = ob_get_clean();
378 448 // Speed Optimization.
379 449 wp_add_inline_style( 'admin-menu', $admin_global_style );
380 - // wp_enqueue_style( 'rtsb-admin-global' );
381 450
382 451 global $pagenow;
383 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 +
384 464 if ( 'admin.php' === $pagenow && ! empty( $_GET['page'] ) && 'rtsb-settings' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
385 465 // Elementor Console Error Fixed For "rtsb-settings" Page.
386 466 wp_dequeue_script( 'elementor-admin-top-bar' );
387 467 wp_dequeue_script( 'elementor-common' );
@@ -389,8 +469,9 @@
389 469 wp_dequeue_script( 'elementor-web-cli' );
390 470 wp_dequeue_script( 'elementor-import-export-admin' );
391 471 wp_dequeue_script( 'elementor-app-loader' );
392 472 wp_dequeue_script( 'elementor-admin-modules' );
473 + wp_dequeue_script( 'elementor-ai-media-library' );
393 474 wp_dequeue_script( 'elementor-admin' );
394 475
395 476 wp_dequeue_style( 'elementor-admin-top-bar' );
396 477 wp_dequeue_style( 'elementor-admin' );
@@ -397,15 +478,11 @@
397 478 wp_dequeue_style( 'e-theme-ui-light' );
398 479 wp_dequeue_style( 'elementor-common' );
399 480
400 481 /**
401 - * Styles.
402 - */
403 - wp_enqueue_style( 'rtsb-admin-app' );
404 -
405 - /**
406 482 * Scripts.
407 483 */
484 + wp_enqueue_media();
408 485 wp_enqueue_script( 'updates' );
409 486 wp_enqueue_script( 'rtsb-admin-app' );
410 487 wp_localize_script(
411 488 'rtsb-admin-app',
@@ -410,16 +487,23 @@
410 487 wp_localize_script(
411 488 'rtsb-admin-app',
412 489 'rtsbParams',
413 490 [
414 - 'ajaxurl' => esc_url( self::$ajaxurl ),
415 - 'homeurl' => home_url(),
416 - 'restApiUrl' => esc_url_raw( rest_url() ),
417 - 'rest_nonce' => wp_create_nonce( 'wp_rest' ),
418 - 'nonce' => wp_create_nonce( rtsb()->nonceText ),
419 - 'sections' => Settings::instance()->get_sections(),
420 - 'pages' => Fns::get_pages(),
421 - '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(),
422 506 ]
423 507 );
424 508 } else {
425 509 $current_screen = get_current_screen();
@@ -469,8 +553,9 @@
469 553
470 554 if ( ! empty( $notification_color ) ) {
471 555 $dynamic_css .= ".rtsb-shopbuilder-plugin #toast-container .toast-success{color:{$notification_color}}";
472 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}}";
473 558 }
474 559
475 560 if ( ! empty( $notification_bgcolor ) ) {
476 561 $dynamic_css .= ".rtsb-shopbuilder-plugin #toast-container .toast-success{background-color:{$notification_bgcolor}}";
@@ -480,8 +565,33 @@
480 565 $dynamic_css .= ".rtsb-shopbuilder-plugin #toast-container .toast-success a{color:{$notification_button_color}}";
481 566 }
482 567
483 568 if ( ! empty( $dynamic_css ) ) {
484 - wp_add_inline_style( 'rtsb-frontend', $dynamic_css );
569 + wp_add_inline_style( Fns::optimized_handle( 'rtsb-frontend' ), $dynamic_css );
485 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;
486 596 }
487 597 }