PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.6.1
ShopBuilder – WooCommerce Builder For Elementor v2.6.1
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 +109 -176 3.4.02.6.1 View file →
@@ -1,17 +1,11 @@
1 1 <?php
2 -/**
3 - * Assets Controller Class
4 - *
5 - * @package RadiusTheme\SB
6 - */
7 2
8 3 namespace RadiusTheme\SB\Controllers;
9 4
10 -use RadiusTheme\SB\AI\AIFns;
5 +use RadiusTheme\SB\Helpers\BuilderFns;
11 6 use RadiusTheme\SB\Helpers\Fns;
12 7 use RadiusTheme\SB\Models\Settings;
13 -use RadiusTheme\SB\Helpers\BuilderFns;
14 8 use RadiusTheme\SB\Traits\SingletonTrait;
15 9
16 10 // Do not allow directly accessing this file.
17 11 if ( ! defined( 'ABSPATH' ) ) {
@@ -17,11 +11,8 @@
17 11 if ( ! defined( 'ABSPATH' ) ) {
18 12 exit( 'This script cannot be accessed directly.' );
19 13 }
20 14
21 -/**
22 - * Assets Controller Class
23 - */
24 15 class AssetsController {
25 16
26 17 use SingletonTrait;
27 18
@@ -53,27 +44,19 @@
53 44 */
54 45 private $scripts = [];
55 46
56 47 /**
57 - * Cached bundled assets.
58 - *
59 - * @var array|null
60 - */
61 - private $cached_bundled_assets = null;
62 -
63 - /**
64 48 * Class Constructor
65 49 */
66 50 public function __construct() {
67 51 $this->version = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? time() : RTSB_VERSION;
68 52
69 - // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
70 53 if ( in_array( 'sitepress-multilingual-cms/sitepress.php', get_option( 'active_plugins' ) ) ) {
71 54 self::$ajaxurl = admin_url( 'admin-ajax.php?lang=' . ICL_LANGUAGE_CODE );
72 55 } else {
73 56 self::$ajaxurl = admin_url( 'admin-ajax.php' );
74 57 }
75 - add_filter( 'rtsb/optimizer/scripts/deps', [ $this, 'extend_shared_dependencies' ], 99 );
58 +
76 59 /**
77 60 * Admin scripts.
78 61 */
79 62 add_action( 'admin_enqueue_scripts', [ $this, 'register_backend_assets' ], 1 );
@@ -81,28 +64,16 @@
81 64
82 65 /**
83 66 * Public scripts.
84 67 */
85 - add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_public_scripts' ], 25 );
68 + add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_public_scripts' ], 15 );
86 69 /**
87 70 * General scripts.
88 71 */
89 72 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_general_public_scripts' ], 30 );
90 73 }
74 +
91 75 /**
92 - * Shared dependencies.
93 - *
94 - * @param array $deps Dependencies.
95 - *
96 - * @return array
97 - */
98 - public function extend_shared_dependencies( $deps ) {
99 - if ( Fns::is_elementor_widget_active( 'products_slider' ) ) {
100 - $deps[] = 'swiper';
101 - }
102 - return array_unique( $deps );
103 - }
104 - /**
105 76 * Get all frontend scripts.
106 77 *
107 78 * @return void
108 79 */
@@ -116,9 +87,8 @@
116 87 * @return object
117 88 */
118 89 private function get_public_styles() {
119 90 $rtl_suffix = is_rtl() ? '-rtl' : '';
120 - $rtl_dir = is_rtl() ? trailingslashit( 'rtl' ) : trailingslashit( 'css' );
121 91
122 92 $this->styles[] = [
123 93 'handle' => 'rtsb-odometer',
124 94 'src' => rtsb()->get_assets_uri( 'vendor/odometer/css/odometer.min.css' ),
@@ -137,22 +107,26 @@
137 107
138 108 $pro_version = defined( 'RTSBPRO_VERSION' ) ? RTSBPRO_VERSION : '0';
139 109 $addon_condition = version_compare( $pro_version, '1.9.0', '<' );
140 110
141 - if ( ! rtsb()->has_pro() && Fns::is_optimization_enabled() ) {
142 - $this->styles[] = AssetRegistry::instance()->load_optimized_assets();
143 - } else {
144 - if ( $addon_condition ) {
145 - $this->styles[] = [
146 - 'handle' => 'rtsb-general-addons',
147 - 'src' => rtsb()->get_assets_uri( $rtl_dir . 'frontend/general-addons' . $rtl_suffix . '.css' ),
148 - ];
149 - }
111 + if ( $addon_condition ) {
150 112 $this->styles[] = [
151 - 'handle' => 'rtsb-frontend',
152 - 'src' => rtsb()->get_assets_uri( $rtl_dir . 'frontend/frontend' . $rtl_suffix . '.css' ),
113 + 'handle' => 'rtsb-general-addons',
114 + 'src' => rtsb()->get_assets_uri( 'css/frontend/general-addons' . $rtl_suffix . '.css' ),
153 115 ];
154 116 }
117 + $this->styles[] = [
118 + 'handle' => 'rtsb-frontend',
119 + 'src' => rtsb()->get_assets_uri( 'css/frontend/frontend' . $rtl_suffix . '.css' ),
120 + ];
121 +
122 + /*
123 + $this->styles[] = [
124 + 'handle' => 'swiper',
125 + 'src' => rtsb()->get_assets_uri( 'vendor/swiper/css/swiper-bundle.min.css' ),
126 + ];
127 + */
128 +
155 129 if ( BuilderFns::is_builder_preview() && 'elementor' == Fns::page_edit_with( get_the_ID() ) ) {
156 130 $this->styles[] = [
157 131 'handle' => 'photoswipe',
158 132 'src' => plugins_url( 'assets/css/photoswipe/photoswipe.min.css', WC_PLUGIN_FILE ),
@@ -178,11 +152,30 @@
178 152 *
179 153 * @return object
180 154 */
181 155 private function get_public_scripts() {
156 +
157 + $default_swiper_path = rtsb()->get_assets_uri( 'vendor/swiper/js/swiper-bundle.min.js' );
158 +
159 + if ( defined( 'ELEMENTOR_ASSETS_PATH' ) ) {
160 + $is_swiper8_enable = get_option( 'elementor_experiment-e_swiper_latest' );
161 +
162 + if ( 'active' === $is_swiper8_enable || 'default' === $is_swiper8_enable ) {
163 + $el_swiper_path = 'lib/swiper/v8/swiper.min.js';
164 + } else {
165 + $el_swiper_path = 'lib/swiper/swiper.min.js';
166 + }
167 +
168 + $elementor_swiper_path = ELEMENTOR_ASSETS_PATH . $el_swiper_path;
169 +
170 + if ( file_exists( $elementor_swiper_path ) ) {
171 + $default_swiper_path = ELEMENTOR_ASSETS_URL . $el_swiper_path;
172 + }
173 + }
174 +
182 175 $this->scripts[] = [
183 176 'handle' => 'swiper',
184 - 'src' => esc_url( $this->get_swiper_url() ),
177 + 'src' => esc_url( $default_swiper_path ),
185 178 'deps' => [ 'jquery' ],
186 179 'footer' => true,
187 180 ];
188 181 $this->scripts[] = [
@@ -198,8 +191,15 @@
198 191 'footer' => true,
199 192 ];
200 193
201 194 $this->scripts[] = [
195 + 'handle' => 'rtsb-imagesloaded',
196 + 'src' => rtsb()->get_assets_uri( 'vendor/isotope/imagesloaded.pkgd.min.js' ),
197 + 'deps' => [ 'jquery' ],
198 + 'footer' => true,
199 + ];
200 +
201 + $this->scripts[] = [
202 202 'handle' => 'rtsb-tipsy',
203 203 'src' => rtsb()->get_assets_uri( 'vendor/tipsy/tipsy.min.js' ),
204 204 'deps' => [ 'jquery' ],
205 205 'footer' => true,
@@ -206,9 +206,9 @@
206 206 ];
207 207
208 208 if ( BuilderFns::is_builder_preview() && 'elementor' == Fns::page_edit_with( get_the_ID() ) ) {
209 209 $this->scripts[] = [
210 - 'handle' => 'wc-flexslider',
210 + 'handle' => 'flexslider',
211 211 'src' => plugins_url( 'assets/js/flexslider/jquery.flexslider.js', WC_PLUGIN_FILE ),
212 212 'deps' => [ 'jquery' ],
213 213 'footer' => true,
214 214 ];
@@ -220,9 +220,9 @@
220 220 'footer' => true,
221 221 ];
222 222
223 223 $this->scripts[] = [
224 - 'handle' => 'wc-zoom',
224 + 'handle' => 'zoom',
225 225 'src' => plugins_url( 'assets/js/zoom/jquery.zoom.js', WC_PLUGIN_FILE ),
226 226 'deps' => [ 'jquery' ],
227 227 'footer' => true,
228 228 ];
@@ -227,9 +227,9 @@
227 227 'footer' => true,
228 228 ];
229 229
230 230 $this->scripts[] = [
231 - 'handle' => 'wc-photoswipe-ui-default',
231 + 'handle' => 'photoswipe-ui-default',
232 232 'src' => plugins_url( 'assets/js/photoswipe/photoswipe-ui-default.js', WC_PLUGIN_FILE ),
233 233 'deps' => [ 'jquery', 'photoswipe' ],
234 234 'footer' => true,
235 235 ];
@@ -236,9 +236,9 @@
236 236
237 237 $this->scripts[] = [
238 238 'handle' => 'wc-single-product',
239 239 'src' => plugins_url( 'assets/js/frontend/single-product.js', WC_PLUGIN_FILE ),
240 - 'deps' => [ 'jquery', 'wc-flexslider', 'photoswipe', 'wc-photoswipe-ui-default', 'wc-zoom' ],
240 + 'deps' => [ 'jquery', 'flexslider', 'photoswipe', 'photoswipe-ui-default', 'zoom' ],
241 241 'footer' => true,
242 242 ];
243 243
244 244 }
@@ -272,18 +272,14 @@
272 272 'footer' => true,
273 273 ];
274 274 }
275 275
276 - if ( ! rtsb()->has_pro() && Fns::is_optimization_enabled() ) {
277 - $this->scripts[] = AssetRegistry::instance()->load_optimized_assets( 'js' );
278 - } else {
279 - $this->scripts[] = [
280 - 'handle' => 'rtsb-public',
281 - 'src' => rtsb()->get_assets_uri( 'js/frontend/frontend.js' ),
282 - 'deps' => [ 'jquery', 'imagesloaded', 'swiper' ],
283 - 'footer' => true,
284 - ];
285 - }
276 + $this->scripts[] = [
277 + 'handle' => 'rtsb-public',
278 + 'src' => rtsb()->get_assets_uri( 'js/frontend/frontend.js' ),
279 + 'deps' => [ 'jquery', 'rtsb-imagesloaded', 'swiper' ],
280 + 'footer' => true,
281 + ];
286 282
287 283 return $this;
288 284 }
289 285
@@ -293,10 +289,8 @@
293 289 * @return void
294 290 */
295 291 public function register_public_scripts() {
296 292 $this->get_public_assets();
297 - $this->styles = array_filter( $this->styles );
298 - $this->scripts = array_filter( $this->scripts );
299 293
300 294 // Register public styles.
301 295 foreach ( $this->styles as $style ) {
302 296 wp_register_style( $style['handle'], $style['src'], '', $this->version );
@@ -317,9 +311,9 @@
317 311 /**
318 312 * Register scripts.
319 313 */
320 314 $this->register_public_scripts();
321 -
315 + // wp_enqueue_style( 'swiper' );
322 316 /**
323 317 * Enqueue scripts.
324 318 */
325 319 if ( BuilderFns::is_builder_preview() && 'elementor' === Fns::page_edit_with( get_the_ID() ) ) {
@@ -333,32 +327,28 @@
333 327
334 328 /**
335 329 * Scripts.
336 330 */
337 - $handle = Fns::optimized_handle( 'rtsb-public' );
338 -
339 - wp_enqueue_script( 'wc-flexslider' );
331 + wp_enqueue_script( 'flexslider' );
340 332 wp_enqueue_script( 'wc-single-product' );
341 - wp_dequeue_script( $handle );
333 + wp_dequeue_script( 'rtsb-public' );
342 334 wp_enqueue_script( 'swiper' );
335 + wp_enqueue_script( 'rtsb-public' );
336 + }
343 337
344 - if ( Fns::is_optimization_enabled() ) {
345 - Fns::enqueue_optimized_assets();
346 - } else {
347 - wp_enqueue_script( $handle );
348 - }
349 - }
338 + /**
339 + * Styles.
340 + */
341 + wp_enqueue_style( 'rtsb-fonts' );
342 + wp_enqueue_style( 'rtsb-frontend' );
350 343
344 + /**
345 + * Scripts.
346 + */
347 + wp_enqueue_script( 'rtsb-imagesloaded' );
351 348 wp_enqueue_script( 'rtsb-tipsy' );
349 + wp_enqueue_script( 'rtsb-public' );
352 350
353 - if ( Fns::is_optimization_enabled() ) {
354 - Fns::enqueue_optimized_assets();
355 - } else {
356 - wp_enqueue_style( 'rtsb-fonts' );
357 - wp_enqueue_style( 'rtsb-frontend' );
358 - wp_enqueue_script( 'rtsb-public' );
359 - }
360 -
361 351 /**
362 352 * Localize script.
363 353 */
364 354 self::localizeData();
@@ -370,31 +360,24 @@
370 360 * @static
371 361 * @return void
372 362 */
373 363 public static function localizeData() {
374 - $handle = Fns::optimized_handle( 'rtsb-public' );
375 - $ai_data = AIFns::activated_ai_data();
376 364 wp_localize_script(
377 - $handle,
365 + 'rtsb-public',
378 366 'rtsbPublicParams',
379 367 [
380 - 'ajaxUrl' => esc_url( self::$ajaxurl ),
381 - 'aiActivated' => ! empty( $ai_data ),
382 - 'homeurl' => home_url(),
383 - 'shopUrl' => function_exists( 'wc_get_page_permalink' ) ? esc_url( wc_get_page_permalink( 'shop' ) ) : home_url( '/' ),
384 - 'wcCartUrl' => wc_get_cart_url(),
385 - 'addedToCartText' => esc_html__( 'Product Added', 'shopbuilder' ),
386 - 'singleCartToastrText' => esc_html__( 'Successfully Added', 'shopbuilder' ),
387 - 'singleCartBtnText' => apply_filters( 'rtsb/global/single_add_to_cart_success', esc_html__( 'Added to Cart', 'shopbuilder' ) ),
388 - 'browseCartText' => esc_html__( 'Browse Cart', 'shopbuilder' ),
389 - 'noProductsText' => apply_filters( 'rtsb/global/no_products_text', esc_html__( 'No more products to load', 'shopbuilder' ) ),
390 - 'isOptimizationEnabled' => Fns::is_optimization_enabled(),
391 - 'isLoaderEnabled' => Fns::enable_loader(),
392 - 'notice' => [
368 + 'ajaxUrl' => esc_url( self::$ajaxurl ),
369 + 'homeurl' => home_url(),
370 + 'wcCartUrl' => wc_get_cart_url(),
371 + 'addedToCartText' => esc_html__( 'Product Added', 'shopbuilder' ),
372 + 'singleCartToastrText' => esc_html__( 'Successfully Added', 'shopbuilder' ),
373 + 'singleCartBtnText' => apply_filters( 'rtsb/global/single_add_to_cart_success', esc_html__( 'Added to Cart', 'shopbuilder' ) ),
374 + 'browseCartText' => esc_html__( 'Browse Cart', 'shopbuilder' ),
375 + 'noProductsText' => apply_filters( 'rtsb/global/no_products_text', esc_html__( 'No more products to load', 'shopbuilder' ) ),
376 + 'notice' => [
393 377 'position' => Fns::get_option( 'general', 'notification', 'notification_position', 'center-center' ),
394 - 'timeOut' => absint( Fns::get_option( 'general', 'notification', 'notification_timeOut', 5 ) ),
395 378 ],
396 - rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
379 + rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
397 380 ]
398 381 );
399 382 }
400 383
@@ -426,60 +409,23 @@
426 409 * Scripts.
427 410 */
428 411 wp_register_script( 'rtsb-admin-app', rtsb()->get_assets_uri( 'js/backend/admin-settings.js' ), '', $this->version, true );
429 412 wp_register_script( 'rtsb-templatebuilder', rtsb()->get_assets_uri( 'js/backend/template-builder.js' ), '', $this->version, true );
430 - wp_localize_script(
431 - 'rtsb-admin-app',
432 - 'rtsbParams',
433 - [
434 - 'ajaxurl' => esc_url( self::$ajaxurl ),
435 - 'homeurl' => home_url(),
436 - 'adminLogo' => rtsb()->get_assets_uri( 'images/icon/ShopBuilder-Logo.svg' ),
437 - 'blackFriday' => rtsb()->get_assets_uri( 'images/black-friday-ribbon.svg' ),
438 - 'restApiUrl' => esc_url_raw( rest_url() ),
439 - 'rest_nonce' => wp_create_nonce( 'wp_rest' ),
440 - 'nonce' => wp_create_nonce( rtsb()->nonceText ),
441 - 'pages' => Fns::get_pages(),
442 - 'hasPro' => rtsb()->has_pro() ? 'yes' : 'no',
443 - 'validLicence' => Fns::has_valid_license() ? 'yes' : 'no',
444 - 'proVersion' => defined( 'RTSBPRO_VERSION' ) ? RTSBPRO_VERSION : '0',
445 - 'updateRates' => esc_html__( 'Update All Rates', 'shopbuilder' ),
446 - 'sections' => Settings::instance()->get_sections(),
447 - 'userRoles' => Fns::get_all_user_roles(),
448 - 'hasElementor' => defined( 'ELEMENTOR_VERSION' ),
449 - 'loadElementor' => Fns::should_load_elementor_scripts(),
450 - 'isOptimizationEnabled' => Fns::is_optimization_enabled(),
451 - ]
452 - );
453 - wp_localize_script(
454 - 'rtsb-admin-app',
455 - 'rtsbCaAbandonment',
456 - [
457 - 'mainTitle' => esc_html__( 'Abandoned Carts Follow Up', 'shopbuilder' ),
458 - 'followUpColumnTitle' => [
459 - 'UserName' => esc_html__( 'Name', 'shopbuilder' ),
460 - 'EmailTo' => esc_html__( 'Email To', 'shopbuilder' ),
461 - 'CartTotal' => esc_html__( 'Cart Total', 'shopbuilder' ),
462 - 'OrderStatus' => esc_html__( 'Order Status', 'shopbuilder' ),
463 - 'DateTime' => esc_html__( 'Date / Time', 'shopbuilder' ),
464 - 'Action' => esc_html__( 'Action', 'shopbuilder' ),
465 - ],
466 - ]
467 - );
468 413 }
469 414
470 415 /**
471 416 * Enqueues admin scripts.
472 417 *
418 + * @param string $hook Hooks.
419 + *
473 420 * @return void
474 421 */
475 - public function enqueue_backend_scripts() {
422 + public function enqueue_backend_scripts( $hook ) {
476 423 ob_start(); ?>
477 424 #adminmenu .toplevel_page_rtsb .wp-menu-image img {
478 425 width: auto;
479 426 height: 22px;
480 427 padding: 4px 0;
481 - box-sizing: content-box;
482 428 }
483 429 .post-type-rtsb_builder li#wp-admin-bar-WPML_ALS_all,
484 430 .post-type-rtsb_builder li.language_all{
485 431 display: none;
@@ -488,8 +434,9 @@
488 434 <?php
489 435 $admin_global_style = ob_get_clean();
490 436 // Speed Optimization.
491 437 wp_add_inline_style( 'admin-menu', $admin_global_style );
438 + // wp_enqueue_style( 'rtsb-admin-global' );
492 439
493 440 global $pagenow;
494 441
495 442 $whitelisted_pages = [ 'rtsb-settings', 'rtsb-get-help', 'rtsb-themes' ];
@@ -511,9 +458,8 @@
511 458 wp_dequeue_script( 'elementor-web-cli' );
512 459 wp_dequeue_script( 'elementor-import-export-admin' );
513 460 wp_dequeue_script( 'elementor-app-loader' );
514 461 wp_dequeue_script( 'elementor-admin-modules' );
515 - wp_dequeue_script( 'elementor-ai-media-library' );
516 462 wp_dequeue_script( 'elementor-admin' );
517 463
518 464 wp_dequeue_style( 'elementor-admin-top-bar' );
519 465 wp_dequeue_style( 'elementor-admin' );
@@ -522,11 +468,28 @@
522 468
523 469 /**
524 470 * Scripts.
525 471 */
526 - wp_enqueue_media();
527 472 wp_enqueue_script( 'updates' );
528 473 wp_enqueue_script( 'rtsb-admin-app' );
474 + wp_localize_script(
475 + 'rtsb-admin-app',
476 + 'rtsbParams',
477 + [
478 + 'ajaxurl' => esc_url( self::$ajaxurl ),
479 + 'homeurl' => home_url(),
480 + 'adminLogo' => rtsb()->get_assets_uri( 'images/icon/ShopBuilder-Logo.svg' ),
481 + 'restApiUrl' => esc_url_raw( rest_url() ),
482 + 'rest_nonce' => wp_create_nonce( 'wp_rest' ),
483 + 'nonce' => wp_create_nonce( rtsb()->nonceText ),
484 + 'pages' => Fns::get_pages(),
485 + 'hasPro' => rtsb()->has_pro() ? 'yes' : 'no',
486 + 'updateRates' => esc_html__( 'Update All Rates', 'shopbuilder' ),
487 + 'sections' => Settings::instance()->get_sections(),
488 + 'userRoles' => Fns::get_all_user_roles(),
489 + 'hasElementor' => defined( 'ELEMENTOR_VERSION' ),
490 + ]
491 + );
529 492 } else {
530 493 $current_screen = get_current_screen();
531 494
532 495 if ( 'edit-rtsb_builder' === $current_screen->id ) {
@@ -549,16 +512,12 @@
549 512 wp_localize_script(
550 513 'rtsb-templatebuilder',
551 514 'rtsbParams',
552 515 [
553 - 'ajaxurl' => esc_url( self::$ajaxurl ),
554 - 'homeurl' => home_url(),
555 - rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
556 - 'hasPro' => rtsb()->has_pro() ? 'yes' : 'no',
557 - 'singletonTypes' => apply_filters(
558 - 'rtsb/builder/singleton_types',
559 - array_keys( \RadiusTheme\SB\Helpers\BuilderFns::builder_page_types() )
560 - ),
516 + 'ajaxurl' => esc_url( self::$ajaxurl ),
517 + 'homeurl' => home_url(),
518 + rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
519 + 'hasPro' => rtsb()->has_pro() ? 'yes' : 'no',
561 520 ]
562 521 );
563 522 }
564 523 }
@@ -578,9 +537,8 @@
578 537
579 538 if ( ! empty( $notification_color ) ) {
580 539 $dynamic_css .= ".rtsb-shopbuilder-plugin #toast-container .toast-success{color:{$notification_color}}";
581 540 $dynamic_css .= ".rtsb-shopbuilder-plugin #toast-container .toast-success:before{background-color:{$notification_color}}";
582 - $dynamic_css .= ".rtsb-shopbuilder-plugin #toast-container .toast-close-button{color:{$notification_color}}";
583 541 }
584 542
585 543 if ( ! empty( $notification_bgcolor ) ) {
586 544 $dynamic_css .= ".rtsb-shopbuilder-plugin #toast-container .toast-success{background-color:{$notification_bgcolor}}";
@@ -590,33 +548,8 @@
590 548 $dynamic_css .= ".rtsb-shopbuilder-plugin #toast-container .toast-success a{color:{$notification_button_color}}";
591 549 }
592 550
593 551 if ( ! empty( $dynamic_css ) ) {
594 - wp_add_inline_style( Fns::optimized_handle( 'rtsb-frontend' ), $dynamic_css );
552 + wp_add_inline_style( 'rtsb-frontend', $dynamic_css );
595 553 }
596 - }
597 -
598 - /**
599 - * Get the appropriate Swiper JS file URL.
600 - *
601 - * @return string
602 - */
603 - private function get_swiper_url() {
604 - $default_swiper_url = rtsb()->get_assets_uri( 'vendor/swiper/js/swiper-bundle.min.js' );
605 -
606 - if ( defined( 'ELEMENTOR_ASSETS_PATH' ) && defined( 'ELEMENTOR_ASSETS_URL' ) ) {
607 - $experiment = get_option( 'elementor_experiment-e_swiper_latest' );
608 -
609 - $el_relative_path = ( 'active' === $experiment || 'default' === $experiment )
610 - ? 'lib/swiper/v8/swiper.min.js'
611 - : 'lib/swiper/swiper.min.js';
612 -
613 - $el_full_path = ELEMENTOR_ASSETS_PATH . $el_relative_path;
614 -
615 - if ( file_exists( $el_full_path ) ) {
616 - return ELEMENTOR_ASSETS_URL . $el_relative_path;
617 - }
618 - }
619 -
620 - return $default_swiper_url;
621 554 }
622 555 }