PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.5.2
ShopBuilder – WooCommerce Builder For Elementor v2.5.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 +17 -164 3.4.1 → 2.5.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' ) ) {
@@ -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,14 +296,8 @@
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 300 } else {
309 301 $repeater->add_control( $rf_id, $value );
310 302 }
311 303 }
@@ -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();
@@ -462,8 +365,9 @@
462 365 var cartButton = cartWrpper.find(
463 366 '.product_type_grouped, .add_to_cart_button, .single_add_to_cart_button '
464 367 );
465 368 if (cartIcon) {
369 + //console.log( cartButton.find('svg') )
466 370 cartButton.find('i').remove();
467 371 cartButton.find('svg').remove();
468 372 cartButton.find('img').remove();
469 373 cartButton.prepend(cartIcon);
@@ -485,9 +389,8 @@
485 389 return;
486 390 }
487 391 $ajaxurl = admin_url( 'admin-ajax.php' );
488 392
489 - // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
490 393 if ( in_array( 'sitepress-multilingual-cms/sitepress.php', get_option( 'active_plugins' ) ) ) {
491 394 $ajaxurl = admin_url( 'admin-ajax.php?lang=' . ICL_LANGUAGE_CODE );
492 395 }
493 396 ?>
@@ -494,31 +397,16 @@
494 397 <script>
495 398 var rtsb = {
496 399 ajaxurl: '<?php echo esc_url( $ajaxurl ); ?>',
497 400 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() ); ?>'
401 + is_pro: '<?php echo esc_attr( rtsb()->has_pro() ? 'true' : 'false' ); ?>'
500 402 };
501 403
502 - if (!rtsb.isOptimizationEnabled) {
503 - rtsbElFrontend();
404 + rtsbElFrontend();
504 405
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 -
406 + setTimeout(function() {
407 + rtsbProductPageInit();
408 + }, 1000);
521 409 <?php if ( rtsb()->has_pro() ) { ?>
522 410 var isMasonry = jQuery('.rtsb-elementor-container .rtsb-masonry');
523 411
524 412 if(isMasonry.length > 0) {
@@ -524,29 +412,14 @@
524 412 if(isMasonry.length > 0) {
525 413 isMasonry.masonry();
526 414 }
527 415
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 - }
416 + if (typeof rtsbFilters === 'function') {
417 + rtsbFilters();
548 418 }
419 + setTimeout( function (){
420 + window.rtsbCountdownApply();
421 + }, 1000 );
549 422 <?php } ?>
550 423 </script>
551 424
552 425 <?php
@@ -792,16 +665,13 @@
792 665
793 666 case 'text-stroke':
794 667 $type = Group_Control_Text_Stroke::get_type();
795 668 break;
796 -
797 - case 'css-filter':
798 - $type = Group_Control_Css_Filter::get_type();
799 - break;
800 669 default:
801 670 $type = constant( 'Elementor\Controls_Manager::' . strtoupper( $type ) );
802 671
803 672 }
673 +
804 674 return $type;
805 675 }
806 676
807 677 /**
@@ -832,11 +702,9 @@
832 702 }
833 703 /**
834 704 * Archive Custom Layout Widget Rendering.
835 705 *
836 - * @param array $classes class list.
837 - *
838 - * @return array
706 + * @return void
839 707 */
840 708 public function countdown_campaign_parent_class( $classes ) {
841 709 $settings = $this->get_settings_for_display();
842 710 $layout = $settings['countdown_layout'] ?? 'horizontal';
@@ -852,9 +720,9 @@
852 720 ];
853 721 $classes = array_filter(
854 722 $classes,
855 723 function ( $item ) use ( $remove ) {
856 - return ! in_array( $item, $remove ); // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
724 + return ! in_array( $item, $remove );
857 725 }
858 726 );
859 727 $new_class = 'rtsb-countdown-' . esc_attr( $countdown_preset );
860 728 $new_class .= ' rtsb-countdown-' . esc_attr( $layout );
@@ -885,9 +753,9 @@
885 753
886 754 /**
887 755 * Elementor controls marge all settings
888 756 *
889 - * @return void
757 + * @return array
890 758 */
891 759 protected function apply_hooks_before_render() {
892 760 if ( $this->is_edit_mode() ) {
893 761 add_filter( 'wp_calculate_image_srcset_meta', '__return_null' );
@@ -903,21 +771,6 @@
903 771 protected function has_checkout_restriction() {
904 772 $checkout = WC()->checkout();
905 773
906 774 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 775 }
923 776 }