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 +34 -74 3.4.23.1.3 View file →
@@ -6,9 +6,8 @@
6 6 */
7 7
8 8 namespace RadiusTheme\SB\Controllers;
9 9
10 -use RadiusTheme\SB\AI\AIFns;
11 10 use RadiusTheme\SB\Helpers\Fns;
12 11 use RadiusTheme\SB\Models\Settings;
13 12 use RadiusTheme\SB\Helpers\BuilderFns;
14 13 use RadiusTheme\SB\Traits\SingletonTrait;
@@ -137,18 +136,10 @@
137 136
138 137 $pro_version = defined( 'RTSBPRO_VERSION' ) ? RTSBPRO_VERSION : '0';
139 138 $addon_condition = version_compare( $pro_version, '1.9.0', '<' );
140 139
141 - $optimized = [];
142 -
143 140 if ( ! rtsb()->has_pro() && Fns::is_optimization_enabled() ) {
144 - $optimized = AssetRegistry::instance()->load_optimized_assets();
145 - }
146 -
147 - // An empty `src` means the bundle could not be built. Registering it would
148 - // produce a handle WordPress never prints, so use the unbundled assets.
149 - if ( ! empty( $optimized['src'] ) ) {
150 - $this->styles[] = $optimized;
141 + $this->styles[] = AssetRegistry::instance()->load_optimized_assets();
151 142 } else {
152 143 if ( $addon_condition ) {
153 144 $this->styles[] = [
154 145 'handle' => 'rtsb-general-addons',
@@ -214,9 +205,9 @@
214 205 ];
215 206
216 207 if ( BuilderFns::is_builder_preview() && 'elementor' == Fns::page_edit_with( get_the_ID() ) ) {
217 208 $this->scripts[] = [
218 - 'handle' => 'wc-flexslider',
209 + 'handle' => 'flexslider',
219 210 'src' => plugins_url( 'assets/js/flexslider/jquery.flexslider.js', WC_PLUGIN_FILE ),
220 211 'deps' => [ 'jquery' ],
221 212 'footer' => true,
222 213 ];
@@ -228,9 +219,9 @@
228 219 'footer' => true,
229 220 ];
230 221
231 222 $this->scripts[] = [
232 - 'handle' => 'wc-zoom',
223 + 'handle' => 'zoom',
233 224 'src' => plugins_url( 'assets/js/zoom/jquery.zoom.js', WC_PLUGIN_FILE ),
234 225 'deps' => [ 'jquery' ],
235 226 'footer' => true,
236 227 ];
@@ -235,9 +226,9 @@
235 226 'footer' => true,
236 227 ];
237 228
238 229 $this->scripts[] = [
239 - 'handle' => 'wc-photoswipe-ui-default',
230 + 'handle' => 'photoswipe-ui-default',
240 231 'src' => plugins_url( 'assets/js/photoswipe/photoswipe-ui-default.js', WC_PLUGIN_FILE ),
241 232 'deps' => [ 'jquery', 'photoswipe' ],
242 233 'footer' => true,
243 234 ];
@@ -244,9 +235,9 @@
244 235
245 236 $this->scripts[] = [
246 237 'handle' => 'wc-single-product',
247 238 'src' => plugins_url( 'assets/js/frontend/single-product.js', WC_PLUGIN_FILE ),
248 - 'deps' => [ 'jquery', 'wc-flexslider', 'photoswipe', 'wc-photoswipe-ui-default', 'wc-zoom' ],
239 + 'deps' => [ 'jquery', 'flexslider', 'photoswipe', 'photoswipe-ui-default', 'zoom' ],
249 240 'footer' => true,
250 241 ];
251 242
252 243 }
@@ -280,17 +271,10 @@
280 271 'footer' => true,
281 272 ];
282 273 }
283 274
284 - $optimized = [];
285 -
286 275 if ( ! rtsb()->has_pro() && Fns::is_optimization_enabled() ) {
287 - $optimized = AssetRegistry::instance()->load_optimized_assets( 'js' );
288 - }
289 -
290 - // See get_public_styles(): an empty `src` means the bundle build failed.
291 - if ( ! empty( $optimized['src'] ) ) {
292 - $this->scripts[] = $optimized;
276 + $this->scripts[] = AssetRegistry::instance()->load_optimized_assets( 'js' );
293 277 } else {
294 278 $this->scripts[] = [
295 279 'handle' => 'rtsb-public',
296 280 'src' => rtsb()->get_assets_uri( 'js/frontend/frontend.js' ),
@@ -350,9 +334,9 @@
350 334 * Scripts.
351 335 */
352 336 $handle = Fns::optimized_handle( 'rtsb-public' );
353 337
354 - wp_enqueue_script( 'wc-flexslider' );
338 + wp_enqueue_script( 'flexslider' );
355 339 wp_enqueue_script( 'wc-single-product' );
356 340 wp_dequeue_script( $handle );
357 341 wp_enqueue_script( 'swiper' );
358 342
@@ -385,18 +369,16 @@
385 369 * @static
386 370 * @return void
387 371 */
388 372 public static function localizeData() {
389 - $handle = Fns::optimized_handle( 'rtsb-public' );
390 - $ai_data = AIFns::activated_ai_data();
373 + $handle = Fns::optimized_handle( 'rtsb-public' );
374 +
391 375 wp_localize_script(
392 376 $handle,
393 377 'rtsbPublicParams',
394 378 [
395 379 'ajaxUrl' => esc_url( self::$ajaxurl ),
396 - 'aiActivated' => ! empty( $ai_data ),
397 380 'homeurl' => home_url(),
398 - 'shopUrl' => function_exists( 'wc_get_page_permalink' ) ? esc_url( wc_get_page_permalink( 'shop' ) ) : home_url( '/' ),
399 381 'wcCartUrl' => wc_get_cart_url(),
400 382 'addedToCartText' => esc_html__( 'Product Added', 'shopbuilder' ),
401 383 'singleCartToastrText' => esc_html__( 'Successfully Added', 'shopbuilder' ),
402 384 'singleCartBtnText' => apply_filters( 'rtsb/global/single_add_to_cart_success', esc_html__( 'Added to Cart', 'shopbuilder' ) ),
@@ -405,9 +387,8 @@
405 387 'isOptimizationEnabled' => Fns::is_optimization_enabled(),
406 388 'isLoaderEnabled' => Fns::enable_loader(),
407 389 'notice' => [
408 390 'position' => Fns::get_option( 'general', 'notification', 'notification_position', 'center-center' ),
409 - 'timeOut' => absint( Fns::get_option( 'general', 'notification', 'notification_timeOut', 5 ) ),
410 391 ],
411 392 rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
412 393 ]
413 394 );
@@ -441,46 +422,8 @@
441 422 * Scripts.
442 423 */
443 424 wp_register_script( 'rtsb-admin-app', rtsb()->get_assets_uri( 'js/backend/admin-settings.js' ), '', $this->version, true );
444 425 wp_register_script( 'rtsb-templatebuilder', rtsb()->get_assets_uri( 'js/backend/template-builder.js' ), '', $this->version, true );
445 - wp_localize_script(
446 - 'rtsb-admin-app',
447 - 'rtsbParams',
448 - [
449 - 'ajaxurl' => esc_url( self::$ajaxurl ),
450 - 'homeurl' => home_url(),
451 - 'adminLogo' => rtsb()->get_assets_uri( 'images/icon/ShopBuilder-Logo.svg' ),
452 - 'blackFriday' => rtsb()->get_assets_uri( 'images/black-friday-ribbon.svg' ),
453 - 'restApiUrl' => esc_url_raw( rest_url() ),
454 - 'rest_nonce' => wp_create_nonce( 'wp_rest' ),
455 - 'nonce' => wp_create_nonce( rtsb()->nonceText ),
456 - 'pages' => Fns::get_pages(),
457 - 'hasPro' => rtsb()->has_pro() ? 'yes' : 'no',
458 - 'validLicence' => Fns::has_valid_license() ? 'yes' : 'no',
459 - 'proVersion' => defined( 'RTSBPRO_VERSION' ) ? RTSBPRO_VERSION : '0',
460 - 'updateRates' => esc_html__( 'Update All Rates', 'shopbuilder' ),
461 - 'sections' => Settings::instance()->get_sections(),
462 - 'userRoles' => Fns::get_all_user_roles(),
463 - 'hasElementor' => defined( 'ELEMENTOR_VERSION' ),
464 - 'loadElementor' => Fns::should_load_elementor_scripts(),
465 - 'isOptimizationEnabled' => Fns::is_optimization_enabled(),
466 - ]
467 - );
468 - wp_localize_script(
469 - 'rtsb-admin-app',
470 - 'rtsbCaAbandonment',
471 - [
472 - 'mainTitle' => esc_html__( 'Abandoned Carts Follow Up', 'shopbuilder' ),
473 - 'followUpColumnTitle' => [
474 - 'UserName' => esc_html__( 'Name', 'shopbuilder' ),
475 - 'EmailTo' => esc_html__( 'Email To', 'shopbuilder' ),
476 - 'CartTotal' => esc_html__( 'Cart Total', 'shopbuilder' ),
477 - 'OrderStatus' => esc_html__( 'Order Status', 'shopbuilder' ),
478 - 'DateTime' => esc_html__( 'Date / Time', 'shopbuilder' ),
479 - 'Action' => esc_html__( 'Action', 'shopbuilder' ),
480 - ],
481 - ]
482 - );
483 426 }
484 427
485 428 /**
486 429 * Enqueues admin scripts.
@@ -540,8 +483,29 @@
540 483 */
541 484 wp_enqueue_media();
542 485 wp_enqueue_script( 'updates' );
543 486 wp_enqueue_script( 'rtsb-admin-app' );
487 + wp_localize_script(
488 + 'rtsb-admin-app',
489 + 'rtsbParams',
490 + [
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(),
506 + ]
507 + );
544 508 } else {
545 509 $current_screen = get_current_screen();
546 510
547 511 if ( 'edit-rtsb_builder' === $current_screen->id ) {
@@ -564,16 +528,12 @@
564 528 wp_localize_script(
565 529 'rtsb-templatebuilder',
566 530 'rtsbParams',
567 531 [
568 - 'ajaxurl' => esc_url( self::$ajaxurl ),
569 - 'homeurl' => home_url(),
570 - rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
571 - 'hasPro' => rtsb()->has_pro() ? 'yes' : 'no',
572 - 'singletonTypes' => apply_filters(
573 - 'rtsb/builder/singleton_types',
574 - array_keys( \RadiusTheme\SB\Helpers\BuilderFns::builder_page_types() )
575 - ),
532 + 'ajaxurl' => esc_url( self::$ajaxurl ),
533 + 'homeurl' => home_url(),
534 + rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
535 + 'hasPro' => rtsb()->has_pro() ? 'yes' : 'no',
576 536 ]
577 537 );
578 538 }
579 539 }