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/Abstracts/ElementorWidgetBase.php +108 -34 2.0.23.1.3 View file →
@@ -6,8 +6,9 @@
6 6 */
7 7
8 8 namespace RadiusTheme\SB\Abstracts;
9 9
10 +use Elementor\Group_Control_Css_Filter;
10 11 use Elementor\Plugin;
11 12 use Elementor\Repeater;
12 13 use Elementor\Widget_Base;
13 14 use Elementor\Controls_Manager;
@@ -19,8 +20,9 @@
19 20 use Elementor\Group_Control_Box_Shadow;
20 21 use Elementor\Group_Control_Text_Shadow;
21 22 use Elementor\Group_Control_Text_Stroke;
22 23 use RadiusTheme\SB\Elementor\Helper\ControlSelectors;
24 +use RadiusTheme\SB\Helpers\Fns;
23 25
24 26
25 27 // Do not allow directly accessing this file.
26 28 if ( ! defined( 'ABSPATH' ) ) {
@@ -99,9 +101,9 @@
99 101 * @param array $data default data.
100 102 * @param array $args default arg.
101 103 */
102 104 public function __construct( $data = [], $args = null ) {
103 - $this->apply_hooks_before_render();
105 + $this->apply_hooks_before_render();
104 106 parent::__construct( $data, $args );
105 107 $this->rtsb_category = 'rtsb-shopbuilder';
106 108 $this->rtsb_icon = 'rtsb-el-custom rtsb-element icon-' . $this->rtsb_base;
107 109 $this->el_prefix = 'rtsb_el_';
@@ -186,9 +188,9 @@
186 188 *
187 189 * @return array
188 190 */
189 191 public function promo_content() {
190 - if ( rtsb()->has_pro() ) {
192 + if ( rtsb()->has_pro() || $this->widget_exceptions() ) {
191 193 return [];
192 194 }
193 195
194 196 $promo_fields = [];
@@ -296,11 +298,17 @@
296 298 }
297 299 if ( isset( $value['mode'] ) && 'responsive' === $value['mode'] ) {
298 300 unset( $value['mode'] );
299 301 $repeater->add_responsive_control( $rf_id, $value );
300 - } else{
301 - $repeater->add_control( $rf_id, $value );
302 - }
302 + } elseif ( isset( $value['mode'] ) && 'group' === $value['mode'] ) {
303 + $type = $value['type'];
304 + $value['name'] = $rf_id;
305 + unset( $value['mode'] );
306 + unset( $value['type'] );
307 + $repeater->add_group_control( $type, $value );
308 + } else {
309 + $repeater->add_control( $rf_id, $value );
310 + }
303 311 }
304 312
305 313 $field['fields'] = $repeater->get_controls();
306 314
@@ -358,22 +366,21 @@
358 366 ?>
359 367 <script type="text/javascript">
360 368 // Product Archive Catelog
361 369 (function ($) {
362 - setTimeout( function (){
363 - var cartWrpper = $('body').find('<?php echo esc_attr( $selector ); ?>');
364 - var cartIcon = cartWrpper.attr('data-cart-icon');
365 - var cartButton = cartWrpper.find(
366 - '.product_type_grouped, .add_to_cart_button, .single_add_to_cart_button '
367 - );
368 - if (cartIcon) {
369 - console.log( cartButton.find('svg') )
370 - cartButton.find('i').remove();
371 - cartButton.find('svg').remove();
372 - cartButton.find('img').remove();
373 - cartButton.prepend(cartIcon);
374 - }
375 - }, 2000);
370 + setTimeout( function (){
371 + var cartWrpper = $('body').find('<?php echo esc_attr( $selector ); ?>');
372 + var cartIcon = cartWrpper.attr('data-cart-icon');
373 + var cartButton = cartWrpper.find(
374 + '.product_type_grouped, .add_to_cart_button, .single_add_to_cart_button '
375 + );
376 + if (cartIcon) {
377 + cartButton.find('i').remove();
378 + cartButton.find('svg').remove();
379 + cartButton.find('img').remove();
380 + cartButton.prepend(cartIcon);
381 + }
382 + }, 2000);
376 383 })(jQuery);
377 384 </script>
378 385 <?php
379 386 }
@@ -388,8 +395,10 @@
388 395 if ( ! $this->is_edit_mode() ) {
389 396 return;
390 397 }
391 398 $ajaxurl = admin_url( 'admin-ajax.php' );
399 +
400 + // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
392 401 if ( in_array( 'sitepress-multilingual-cms/sitepress.php', get_option( 'active_plugins' ) ) ) {
393 402 $ajaxurl = admin_url( 'admin-ajax.php?lang=' . ICL_LANGUAGE_CODE );
394 403 }
395 404 ?>
@@ -396,21 +405,55 @@
396 405 <script>
397 406 var rtsb = {
398 407 ajaxurl: '<?php echo esc_url( $ajaxurl ); ?>',
399 408 nonce: '<?php echo esc_attr( wp_create_nonce( rtsb()->nonceId ) ); ?>',
400 - is_pro: '<?php echo esc_attr( rtsb()->has_pro() ? 'true' : 'false' ); ?>'
409 + is_pro: '<?php echo esc_attr( rtsb()->has_pro() ? 'true' : 'false' ); ?>',
410 + isOptimizationEnabled: '<?php echo esc_attr( Fns::is_optimization_enabled() ); ?>'
401 411 };
402 412
403 - rtsbElFrontend();
413 + if (!rtsb.isOptimizationEnabled) {
414 + rtsbElFrontend();
404 415
405 - setTimeout(function() {
406 - rtsbProductPageInit();
407 - }, 1000);
416 + setTimeout(function() {
417 + rtsbProductPageInit();
418 + }, 1000);
419 + } else {
420 + if (typeof elementorFrontend !== 'undefined') {
421 + window.waitForRTSB((RTSB) => {
422 + RTSB.modules.get('elementorInit')?.refresh();
423 + RTSB.modules.get('singleProductTabs')?.refresh();
424 + RTSB.modules.get('reviewFormStar')?.refresh();
425 + RTSB.modules.get('addCartIcon')?.refresh();
426 + RTSB.modules.get('productImage')?.refresh();
427 + RTSB.modules.get('CartQuantityHandler')?.refresh();
428 + });
429 + }
430 + }
431 +
408 432 <?php if ( rtsb()->has_pro() ) { ?>
409 - rtsbFilters();
410 - setTimeout( function (){
411 - window.rtsbCountdownApply();
412 - }, 1000 );
433 + var isMasonry = jQuery('.rtsb-elementor-container .rtsb-masonry');
434 +
435 + if(isMasonry.length > 0) {
436 + isMasonry.masonry();
437 + }
438 +
439 + if (!'<?php echo esc_attr( Fns::is_optimization_enabled() ); ?>') {
440 + if (typeof rtsbFilters === 'function') {
441 + rtsbFilters();
442 + }
443 +
444 + setTimeout( function (){
445 + window.rtsbCountdownApply();
446 + }, 1000 );
447 + } else {
448 + if (typeof elementorFrontend !== 'undefined') {
449 + window.waitForRTSB((RTSB) => {
450 + RTSB.modules.get('countdownPro')?.refresh();
451 + RTSB.modules.get('elementorInitPro')?.refresh();
452 + RTSB.modules.get('ajaxProductFiltersPro')?.refresh();
453 + });
454 + }
455 + }
413 456 <?php } ?>
414 457 </script>
415 458
416 459 <?php
@@ -656,13 +699,16 @@
656 699
657 700 case 'text-stroke':
658 701 $type = Group_Control_Text_Stroke::get_type();
659 702 break;
703 +
704 + case 'css-filter':
705 + $type = Group_Control_Css_Filter::get_type();
706 + break;
660 707 default:
661 708 $type = constant( 'Elementor\Controls_Manager::' . strtoupper( $type ) );
662 709
663 710 }
664 -
665 711 return $type;
666 712 }
667 713
668 714 /**
@@ -693,9 +739,11 @@
693 739 }
694 740 /**
695 741 * Archive Custom Layout Widget Rendering.
696 742 *
697 - * @return void
743 + * @param array $classes class list.
744 + *
745 + * @return array
698 746 */
699 747 public function countdown_campaign_parent_class( $classes ) {
700 748 $settings = $this->get_settings_for_display();
701 749 $layout = $settings['countdown_layout'] ?? 'horizontal';
@@ -711,9 +759,9 @@
711 759 ];
712 760 $classes = array_filter(
713 761 $classes,
714 762 function ( $item ) use ( $remove ) {
715 - return ! in_array( $item, $remove );
763 + return ! in_array( $item, $remove ); // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
716 764 }
717 765 );
718 766 $new_class = 'rtsb-countdown-' . esc_attr( $countdown_preset );
719 767 $new_class .= ' rtsb-countdown-' . esc_attr( $layout );
@@ -744,13 +792,39 @@
744 792
745 793 /**
746 794 * Elementor controls marge all settings
747 795 *
748 - * @return array
796 + * @return void
749 797 */
750 798 protected function apply_hooks_before_render() {
751 - if( $this->is_edit_mode() ){
799 + if ( $this->is_edit_mode() ) {
752 800 add_filter( 'wp_calculate_image_srcset_meta', '__return_null' );
753 801 }
754 - }
802 + }
755 803
804 + /**
805 + * If checkout registration is disabled and not logged in,
806 + * the user cannot check out.
807 + *
808 + * @return bool
809 + */
810 + protected function has_checkout_restriction() {
811 + $checkout = WC()->checkout();
812 +
813 + return ! $checkout->is_registration_enabled() && $checkout->is_registration_required() && ! is_user_logged_in();
814 + }
815 +
816 + /**
817 + * Widget Exceptions.
818 + *
819 + * @return bool
820 + */
821 + private function widget_exceptions() {
822 + $exceptions = [
823 + 'rtsb-product-filters',
824 + 'rtsb-wishlist',
825 + 'rtsb-product-breadcrumbs',
826 + ];
827 +
828 + return in_array( $this->rtsb_base, $exceptions, true );
829 + }
756 830 }