| @@ -10,11 +10,9 @@ | ||
| 10 | 10 | defined( 'ABSPATH' ) || exit(); |
| 11 | 11 | |
| 12 | 12 | use RadiusTheme\SB\Helpers\Fns; |
| 13 | 13 | use RadiusTheme\SB\Helpers\BuilderFns; |
| 14 | -use RadiusTheme\SB\Models\GeneralList; | |
| 15 | 14 | use RadiusTheme\SB\Traits\SingletonTrait; |
| 16 | -use RadiusTheme\SBPRO\Helpers\FnsPro; | |
| 17 | 15 | |
| 18 | 16 | /** |
| 19 | 17 | * Builder Frontend. |
| 20 | 18 | */ |
| @@ -24,8 +22,9 @@ | ||
| 24 | 22 | * |
| 25 | 23 | * @var integer |
| 26 | 24 | */ |
| 27 | 25 | private $builder_page_id = 0; |
| 26 | + | |
| 28 | 27 | /** |
| 29 | 28 | * Page Edit By. |
| 30 | 29 | * |
| 31 | 30 | * @var string |
| @@ -30,12 +29,14 @@ | ||
| 30 | 29 | * |
| 31 | 30 | * @var string |
| 32 | 31 | */ |
| 33 | 32 | private $page_edit_with = ''; |
| 33 | + | |
| 34 | 34 | /** |
| 35 | 35 | * Singleton. |
| 36 | 36 | */ |
| 37 | 37 | use SingletonTrait; |
| 38 | + | |
| 38 | 39 | /** |
| 39 | 40 | * Final constructor. |
| 40 | 41 | */ |
| 41 | 42 | private function __construct() { |
| @@ -42,9 +43,8 @@ | ||
| 42 | 43 | // Template Redirect hook run after the global query. |
| 43 | 44 | add_action( 'template_redirect', [ $this, 'frontend_init' ] ); |
| 44 | 45 | add_filter( 'rtsb/builder/set/current/page/type', [ $this, 'builder_page_type' ] ); |
| 45 | 46 | add_filter( 'body_class', [ $this, 'product_page_body_class' ] ); |
| 46 | - add_filter('rtsb/multi/step/checkout/widget',[__CLASS__,'multi_step_checkout_widget_builder_hooks']); | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Builder page Body class. |
| @@ -54,9 +54,8 @@ | ||
| 54 | 54 | */ |
| 55 | 55 | public function product_page_body_class( $classes ) { |
| 56 | 56 | $classes[] = 'rtsb-shopbuilder-plugin rtsb_theme_' . rtsb()->current_theme; |
| 57 | 57 | if ( Fns::is_woocommerce() || BuilderFns::is_builder_preview() ) { |
| 58 | - $classes[] = 'woocommerce'; | |
| 59 | 58 | $classes[] = 'woocommerce-page'; |
| 60 | 59 | } |
| 61 | 60 | |
| 62 | 61 | if ( BuilderFns::is_product() ) { |
| @@ -68,8 +67,10 @@ | ||
| 68 | 67 | } |
| 69 | 68 | |
| 70 | 69 | if ( BuilderFns::is_cart() ) { |
| 71 | 70 | $classes[] = 'woocommerce-cart'; |
| 71 | + } else { | |
| 72 | + $classes[] = 'woocommerce'; | |
| 72 | 73 | } |
| 73 | 74 | |
| 74 | 75 | if ( BuilderFns::is_checkout() ) { |
| 75 | 76 | $classes[] = 'woocommerce-checkout '; |
| @@ -74,8 +75,17 @@ | ||
| 74 | 75 | if ( BuilderFns::is_checkout() ) { |
| 75 | 76 | $classes[] = 'woocommerce-checkout '; |
| 76 | 77 | } |
| 77 | 78 | |
| 79 | + if ( rtsb()->has_pro() ) { | |
| 80 | + $disable_cart = Fns::is_guest_feature_disabled( 'hide_cart_page', '' ); | |
| 81 | + $disable_checkout = Fns::is_guest_feature_disabled( 'hide_checkout_page', '' ); | |
| 82 | + | |
| 83 | + if ( $disable_cart || $disable_checkout ) { | |
| 84 | + $classes[] = 'rtsb-not-visible'; | |
| 85 | + } | |
| 86 | + } | |
| 87 | + | |
| 78 | 88 | $hide_notification = Fns::get_option( 'general', 'notification', 'hide_notification', '' ); |
| 79 | 89 | |
| 80 | 90 | if ( 'on' === $hide_notification ) { |
| 81 | 91 | $classes[] = 'rtsb-notifications-hidden'; |
| @@ -93,9 +103,9 @@ | ||
| 93 | 103 | $this->page_edit_with = Fns::page_edit_with( $this->builder_page_id ); |
| 94 | 104 | if ( $this->builder_page_id ) { |
| 95 | 105 | if ( did_action( 'elementor/loaded' ) && 'elementor' === $this->page_edit_with ) { |
| 96 | 106 | $this->elementor_frontend(); |
| 97 | - } else { | |
| 107 | + } elseif ( 'gutenberg' === $this->page_edit_with ) { | |
| 98 | 108 | $this->gutenberg_frontend(); |
| 99 | 109 | } |
| 100 | 110 | } |
| 101 | 111 | } |
| @@ -136,10 +146,10 @@ | ||
| 136 | 146 | wp_enqueue_script( 'wc-checkout' ); |
| 137 | 147 | } elseif ( BuilderFns::is_cart() ) { |
| 138 | 148 | $type = 'cart'; |
| 139 | 149 | } |
| 140 | - wp_enqueue_style( 'rtsb-frontend' ); | |
| 141 | - wp_enqueue_script( 'rtsb-public' ); | |
| 150 | + wp_enqueue_style( Fns::optimized_handle( 'rtsb-frontend' ) ); | |
| 151 | + wp_enqueue_script( Fns::optimized_handle( 'rtsb-public' ) ); | |
| 142 | 152 | |
| 143 | 153 | return apply_filters( 'rtsb/builder/set/current/page/type/external', $type ); |
| 144 | 154 | } |
| 145 | 155 | |
| @@ -184,11 +194,6 @@ | ||
| 184 | 194 | $content = apply_filters( 'the_content', $content ); |
| 185 | 195 | $output = str_replace( ']]>', ']]>', $content ); |
| 186 | 196 | } |
| 187 | 197 | echo wp_kses_post( $output ); |
| 188 | - } | |
| 189 | - | |
| 190 | - public static function multi_step_checkout_widget_builder_hooks() { | |
| 191 | - | |
| 192 | - return ! FnsPro::checkout_page_has_multi_step_widget(); | |
| 193 | 198 | } |
| 194 | 199 | } |