PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.0.2
ShopBuilder – WooCommerce Builder For Elementor v2.0.2
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 +35 -202 3.4.22.0.2 View file →
@@ -6,9 +6,8 @@
6 6 */
7 7
8 8 namespace RadiusTheme\SB\Abstracts;
9 9
10 -use Elementor\Group_Control_Css_Filter;
11 10 use Elementor\Plugin;
12 11 use Elementor\Repeater;
13 12 use Elementor\Widget_Base;
14 13 use Elementor\Controls_Manager;
@@ -20,9 +19,8 @@
20 19 use Elementor\Group_Control_Box_Shadow;
21 20 use Elementor\Group_Control_Text_Shadow;
22 21 use Elementor\Group_Control_Text_Stroke;
23 22 use RadiusTheme\SB\Elementor\Helper\ControlSelectors;
24 -use RadiusTheme\SB\Helpers\Fns;
25 23
26 24
27 25 // Do not allow directly accessing this file.
28 26 if ( ! defined( 'ABSPATH' ) ) {
@@ -101,9 +99,9 @@
101 99 * @param array $data default data.
102 100 * @param array $args default arg.
103 101 */
104 102 public function __construct( $data = [], $args = null ) {
105 - $this->apply_hooks_before_render();
103 + $this->apply_hooks_before_render();
106 104 parent::__construct( $data, $args );
107 105 $this->rtsb_category = 'rtsb-shopbuilder';
108 106 $this->rtsb_icon = 'rtsb-el-custom rtsb-element icon-' . $this->rtsb_base;
109 107 $this->el_prefix = 'rtsb_el_';
@@ -188,9 +186,9 @@
188 186 *
189 187 * @return array
190 188 */
191 189 public function promo_content() {
192 - if ( rtsb()->has_pro() || $this->widget_exceptions() ) {
190 + if ( rtsb()->has_pro() ) {
193 191 return [];
194 192 }
195 193
196 194 $promo_fields = [];
@@ -298,17 +296,11 @@
298 296 }
299 297 if ( isset( $value['mode'] ) && 'responsive' === $value['mode'] ) {
300 298 unset( $value['mode'] );
301 299 $repeater->add_responsive_control( $rf_id, $value );
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 - }
300 + } else{
301 + $repeater->add_control( $rf_id, $value );
302 + }
311 303 }
312 304
313 305 $field['fields'] = $repeater->get_controls();
314 306
@@ -339,103 +331,14 @@
339 331 return BuilderFns::is_builder_preview() || $this->is_edit_mode();
340 332 }
341 333
342 334 /**
343 - * Render a shared editor-only notice.
344 - *
345 - * Any widget can surface an editor placeholder (out of stock, no active
346 - * campaign, empty result, etc.) with one consistent design. Renders only in
347 - * edit/preview mode and prints the notice CSS inline once per request.
348 - *
349 - * The notice lives in the Elementor preview iframe, which loads only frontend
350 - * styles — so the rule is printed here instead of the editor panel stylesheet,
351 - * and kept out of the compiled frontend bundle.
352 - *
353 - * @param string $message Notice text (already translated).
354 - * @param string $extra_class Optional extra class for per-widget targeting.
355 - * @param string $title Optional hover tooltip; defaults to the editor-only hint.
356 - * @return void
357 - */
358 - public function editor_notice( $message, $extra_class = '', $title = '' ) {
359 - if ( ! $this->is_edit_mode() || '' === $message ) {
360 - return;
361 - }
362 - $this->editor_notice_style();
363 - $classes = trim( 'rtsb-editor-notice ' . $extra_class );
364 - $title = '' !== $title ? $title : esc_html__( 'This notice is only visible in the Elementor editor.', 'shopbuilder' );
365 - ?>
366 - <div class="<?php echo esc_attr( $classes ); ?>" title="<?php echo esc_attr( $title ); ?>">
367 - <span class="rtsb-editor-notice__label"><?php echo esc_html__( 'Editor Notice:', 'shopbuilder' ); ?></span>
368 - <?php echo esc_html( $message ); ?>
369 - </div>
370 - <?php
371 - }
372 -
373 - /**
374 - * Print the shared editor-notice CSS inline, once per request.
375 - *
376 - * @return void
377 - */
378 - protected function editor_notice_style() {
379 - static $printed = false;
380 - if ( $printed ) {
381 - return;
382 - }
383 - $printed = true;
384 - ?>
385 - <style>
386 - .rtsb-editor-notice {
387 - position: relative;
388 - max-height: 500px;
389 - padding: 12px 16px 12px 44px;
390 - border: 1px solid #f0b849;
391 - border-left: 4px solid #f0b849;
392 - border-radius: 4px;
393 - background: #fff8e5;
394 - color: #8a6d3b;
395 - font-size: 13px;
396 - font-weight: 500;
397 - line-height: 1.5;
398 - box-shadow: 0 1px 4px rgba(138, 109, 59, 0.2);
399 - cursor: help;
400 - overflow: hidden;
401 - opacity: 1;
402 - transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease, border-width 0.3s ease;
403 - }
404 - .rtsb-editor-notice::before {
405 - content: "\26A0";
406 - position: absolute;
407 - top: 50%;
408 - left: 16px;
409 - transform: translateY(-50%);
410 - font-size: 18px;
411 - line-height: 1;
412 - }
413 - .rtsb-editor-notice__label {
414 - font-weight: 700;
415 - margin-right: 4px;
416 - }
417 - /* Fade + collapse the notice when the editor panel is hidden (preview toggle). */
418 - .elementor-editor-preview .rtsb-editor-notice {
419 - max-height: 0;
420 - margin-top: 0;
421 - padding-top: 0;
422 - padding-bottom: 0;
423 - border-top-width: 0;
424 - border-bottom-width: 0;
425 - opacity: 0;
426 - }
427 - </style>
428 - <?php
429 - }
430 -
431 - /**
432 335 * Elementor Edit mode need some extra js for isotop reinitialize
433 336 *
434 337 * @return void
435 338 */
436 339 public function editor_slider_script() {
437 - if ( ! empty( \Elementor\Plugin::$instance->editor ) && \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
340 + if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
438 341 $selector = $this->get_unique_selector() . ' .rtsb-carousel-slider';
439 342 ?>
440 343 <script>
441 344 jQuery('<?php echo esc_attr( $selector ); ?>').rtsb_slider();
@@ -455,21 +358,22 @@
455 358 ?>
456 359 <script type="text/javascript">
457 360 // Product Archive Catelog
458 361 (function ($) {
459 - setTimeout( function (){
460 - var cartWrpper = $('body').find('<?php echo esc_attr( $selector ); ?>');
461 - var cartIcon = cartWrpper.attr('data-cart-icon');
462 - var cartButton = cartWrpper.find(
463 - '.product_type_grouped, .add_to_cart_button, .single_add_to_cart_button '
464 - );
465 - if (cartIcon) {
466 - cartButton.find('i').remove();
467 - cartButton.find('svg').remove();
468 - cartButton.find('img').remove();
469 - cartButton.prepend(cartIcon);
470 - }
471 - }, 2000);
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);
472 376 })(jQuery);
473 377 </script>
474 378 <?php
475 379 }
@@ -484,10 +388,8 @@
484 388 if ( ! $this->is_edit_mode() ) {
485 389 return;
486 390 }
487 391 $ajaxurl = admin_url( 'admin-ajax.php' );
488 -
489 - // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
490 392 if ( in_array( 'sitepress-multilingual-cms/sitepress.php', get_option( 'active_plugins' ) ) ) {
491 393 $ajaxurl = admin_url( 'admin-ajax.php?lang=' . ICL_LANGUAGE_CODE );
492 394 }
493 395 ?>
@@ -494,59 +396,21 @@
494 396 <script>
495 397 var rtsb = {
496 398 ajaxurl: '<?php echo esc_url( $ajaxurl ); ?>',
497 399 nonce: '<?php echo esc_attr( wp_create_nonce( rtsb()->nonceId ) ); ?>',
498 - is_pro: '<?php echo esc_attr( rtsb()->has_pro() ? 'true' : 'false' ); ?>',
499 - isOptimizationEnabled: '<?php echo esc_attr( Fns::is_optimization_enabled() ); ?>'
400 + is_pro: '<?php echo esc_attr( rtsb()->has_pro() ? 'true' : 'false' ); ?>'
500 401 };
501 402
502 - if (!rtsb.isOptimizationEnabled) {
503 - rtsbElFrontend();
403 + rtsbElFrontend();
504 404
505 - setTimeout(function() {
506 - rtsbProductPageInit();
507 - }, 1000);
508 - } else {
509 - if (typeof elementorFrontend !== 'undefined') {
510 - window.waitForRTSB((RTSB) => {
511 - RTSB.modules.get('elementorInit')?.refresh();
512 - RTSB.modules.get('singleProductTabs')?.refresh();
513 - RTSB.modules.get('reviewFormStar')?.refresh();
514 - RTSB.modules.get('addCartIcon')?.refresh();
515 - RTSB.modules.get('productImage')?.refresh();
516 - RTSB.modules.get('CartQuantityHandler')?.refresh();
517 - });
518 - }
519 - }
520 -
405 + setTimeout(function() {
406 + rtsbProductPageInit();
407 + }, 1000);
521 408 <?php if ( rtsb()->has_pro() ) { ?>
522 - var isMasonry = jQuery('.rtsb-elementor-container .rtsb-masonry');
523 -
524 - if(isMasonry.length > 0) {
525 - isMasonry.masonry();
526 - }
527 -
528 - if (!'<?php echo esc_attr( Fns::is_optimization_enabled() ); ?>') {
529 - <?php if ( 'rtsb-ajax-product-filters' === $this->rtsb_base ) { ?>
530 - if (typeof rtsbFilters === 'function') {
531 - rtsbFilters();
532 - }
533 - <?php } ?>
534 -
535 - setTimeout( function (){
536 - window.rtsbCountdownApply();
537 - }, 1000 );
538 - } else {
539 - if (typeof elementorFrontend !== 'undefined') {
540 - window.waitForRTSB((RTSB) => {
541 - RTSB.modules.get('countdownPro')?.refresh();
542 - RTSB.modules.get('elementorInitPro')?.refresh();
543 - <?php if ( 'rtsb-ajax-product-filters' === $this->rtsb_base ) { ?>
544 - RTSB.modules.get('ajaxProductFiltersPro')?.refresh();
545 - <?php } ?>
546 - });
547 - }
548 - }
409 + rtsbFilters();
410 + setTimeout( function (){
411 + window.rtsbCountdownApply();
412 + }, 1000 );
549 413 <?php } ?>
550 414 </script>
551 415
552 416 <?php
@@ -792,16 +656,13 @@
792 656
793 657 case 'text-stroke':
794 658 $type = Group_Control_Text_Stroke::get_type();
795 659 break;
796 -
797 - case 'css-filter':
798 - $type = Group_Control_Css_Filter::get_type();
799 - break;
800 660 default:
801 661 $type = constant( 'Elementor\Controls_Manager::' . strtoupper( $type ) );
802 662
803 663 }
664 +
804 665 return $type;
805 666 }
806 667
807 668 /**
@@ -832,11 +693,9 @@
832 693 }
833 694 /**
834 695 * Archive Custom Layout Widget Rendering.
835 696 *
836 - * @param array $classes class list.
837 - *
838 - * @return array
697 + * @return void
839 698 */
840 699 public function countdown_campaign_parent_class( $classes ) {
841 700 $settings = $this->get_settings_for_display();
842 701 $layout = $settings['countdown_layout'] ?? 'horizontal';
@@ -852,9 +711,9 @@
852 711 ];
853 712 $classes = array_filter(
854 713 $classes,
855 714 function ( $item ) use ( $remove ) {
856 - return ! in_array( $item, $remove ); // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
715 + return ! in_array( $item, $remove );
857 716 }
858 717 );
859 718 $new_class = 'rtsb-countdown-' . esc_attr( $countdown_preset );
860 719 $new_class .= ' rtsb-countdown-' . esc_attr( $layout );
@@ -885,39 +744,13 @@
885 744
886 745 /**
887 746 * Elementor controls marge all settings
888 747 *
889 - * @return void
748 + * @return array
890 749 */
891 750 protected function apply_hooks_before_render() {
892 - if ( $this->is_edit_mode() ) {
751 + if( $this->is_edit_mode() ){
893 752 add_filter( 'wp_calculate_image_srcset_meta', '__return_null' );
894 753 }
895 - }
754 + }
896 755
897 - /**
898 - * If checkout registration is disabled and not logged in,
899 - * the user cannot check out.
900 - *
901 - * @return bool
902 - */
903 - protected function has_checkout_restriction() {
904 - $checkout = WC()->checkout();
905 -
906 - return ! $checkout->is_registration_enabled() && $checkout->is_registration_required() && ! is_user_logged_in();
907 - }
908 -
909 - /**
910 - * Widget Exceptions.
911 - *
912 - * @return bool
913 - */
914 - private function widget_exceptions() {
915 - $exceptions = [
916 - 'rtsb-product-filters',
917 - 'rtsb-wishlist',
918 - 'rtsb-product-breadcrumbs',
919 - ];
920 -
921 - return in_array( $this->rtsb_base, $exceptions, true );
922 - }
923 756 }