| @@ -20,9 +20,8 @@ | ||
| 20 | 20 | use Elementor\Group_Control_Box_Shadow; |
| 21 | 21 | use Elementor\Group_Control_Text_Shadow; |
| 22 | 22 | use Elementor\Group_Control_Text_Stroke; |
| 23 | 23 | use RadiusTheme\SB\Elementor\Helper\ControlSelectors; |
| 24 | -use RadiusTheme\SB\Helpers\Fns; | |
| 25 | 24 | |
| 26 | 25 | |
| 27 | 26 | // Do not allow directly accessing this file. |
| 28 | 27 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -299,14 +298,14 @@ | ||
| 299 | 298 | if ( isset( $value['mode'] ) && 'responsive' === $value['mode'] ) { |
| 300 | 299 | unset( $value['mode'] ); |
| 301 | 300 | $repeater->add_responsive_control( $rf_id, $value ); |
| 302 | 301 | } 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 { | |
| 302 | + $type = $value['type']; | |
| 303 | + $value['name'] = $rf_id; | |
| 304 | + unset( $value['mode'] ); | |
| 305 | + unset( $value['type'] ); | |
| 306 | + $repeater->add_group_control( $type, $value ); | |
| 307 | + } else { | |
| 309 | 308 | $repeater->add_control( $rf_id, $value ); |
| 310 | 309 | } |
| 311 | 310 | } |
| 312 | 311 | |
| @@ -339,103 +338,14 @@ | ||
| 339 | 338 | return BuilderFns::is_builder_preview() || $this->is_edit_mode(); |
| 340 | 339 | } |
| 341 | 340 | |
| 342 | 341 | /** |
| 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 | 342 | * Elementor Edit mode need some extra js for isotop reinitialize |
| 433 | 343 | * |
| 434 | 344 | * @return void |
| 435 | 345 | */ |
| 436 | 346 | public function editor_slider_script() { |
| 437 | - if ( ! empty( \Elementor\Plugin::$instance->editor ) && \Elementor\Plugin::$instance->editor->is_edit_mode() ) { | |
| 347 | + if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) { | |
| 438 | 348 | $selector = $this->get_unique_selector() . ' .rtsb-carousel-slider'; |
| 439 | 349 | ?> |
| 440 | 350 | <script> |
| 441 | 351 | jQuery('<?php echo esc_attr( $selector ); ?>').rtsb_slider(); |
| @@ -462,8 +372,9 @@ | ||
| 462 | 372 | var cartButton = cartWrpper.find( |
| 463 | 373 | '.product_type_grouped, .add_to_cart_button, .single_add_to_cart_button ' |
| 464 | 374 | ); |
| 465 | 375 | if (cartIcon) { |
| 376 | + //console.log( cartButton.find('svg') ) | |
| 466 | 377 | cartButton.find('i').remove(); |
| 467 | 378 | cartButton.find('svg').remove(); |
| 468 | 379 | cartButton.find('img').remove(); |
| 469 | 380 | cartButton.prepend(cartIcon); |
| @@ -485,9 +396,8 @@ | ||
| 485 | 396 | return; |
| 486 | 397 | } |
| 487 | 398 | $ajaxurl = admin_url( 'admin-ajax.php' ); |
| 488 | 399 | |
| 489 | - // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict | |
| 490 | 400 | if ( in_array( 'sitepress-multilingual-cms/sitepress.php', get_option( 'active_plugins' ) ) ) { |
| 491 | 401 | $ajaxurl = admin_url( 'admin-ajax.php?lang=' . ICL_LANGUAGE_CODE ); |
| 492 | 402 | } |
| 493 | 403 | ?> |
| @@ -494,31 +404,16 @@ | ||
| 494 | 404 | <script> |
| 495 | 405 | var rtsb = { |
| 496 | 406 | ajaxurl: '<?php echo esc_url( $ajaxurl ); ?>', |
| 497 | 407 | 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() ); ?>' | |
| 408 | + is_pro: '<?php echo esc_attr( rtsb()->has_pro() ? 'true' : 'false' ); ?>' | |
| 500 | 409 | }; |
| 501 | 410 | |
| 502 | - if (!rtsb.isOptimizationEnabled) { | |
| 503 | - rtsbElFrontend(); | |
| 411 | + rtsbElFrontend(); | |
| 504 | 412 | |
| 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 | - | |
| 413 | + setTimeout(function() { | |
| 414 | + rtsbProductPageInit(); | |
| 415 | + }, 1000); | |
| 521 | 416 | <?php if ( rtsb()->has_pro() ) { ?> |
| 522 | 417 | var isMasonry = jQuery('.rtsb-elementor-container .rtsb-masonry'); |
| 523 | 418 | |
| 524 | 419 | if(isMasonry.length > 0) { |
| @@ -524,29 +419,15 @@ | ||
| 524 | 419 | if(isMasonry.length > 0) { |
| 525 | 420 | isMasonry.masonry(); |
| 526 | 421 | } |
| 527 | 422 | |
| 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 } ?> | |
| 423 | + if (typeof rtsbFilters === 'function') { | |
| 424 | + rtsbFilters(); | |
| 425 | + } | |
| 534 | 426 | |
| 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 | - } | |
| 427 | + setTimeout( function (){ | |
| 428 | + window.rtsbCountdownApply(); | |
| 429 | + }, 1000 ); | |
| 549 | 430 | <?php } ?> |
| 550 | 431 | </script> |
| 551 | 432 | |
| 552 | 433 | <?php |
| @@ -832,11 +713,9 @@ | ||
| 832 | 713 | } |
| 833 | 714 | /** |
| 834 | 715 | * Archive Custom Layout Widget Rendering. |
| 835 | 716 | * |
| 836 | - * @param array $classes class list. | |
| 837 | - * | |
| 838 | - * @return array | |
| 717 | + * @return void | |
| 839 | 718 | */ |
| 840 | 719 | public function countdown_campaign_parent_class( $classes ) { |
| 841 | 720 | $settings = $this->get_settings_for_display(); |
| 842 | 721 | $layout = $settings['countdown_layout'] ?? 'horizontal'; |
| @@ -852,9 +731,9 @@ | ||
| 852 | 731 | ]; |
| 853 | 732 | $classes = array_filter( |
| 854 | 733 | $classes, |
| 855 | 734 | function ( $item ) use ( $remove ) { |
| 856 | - return ! in_array( $item, $remove ); // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict | |
| 735 | + return ! in_array( $item, $remove ); | |
| 857 | 736 | } |
| 858 | 737 | ); |
| 859 | 738 | $new_class = 'rtsb-countdown-' . esc_attr( $countdown_preset ); |
| 860 | 739 | $new_class .= ' rtsb-countdown-' . esc_attr( $layout ); |