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/Modules/QuickView/QuickView.php +101 -4 2.1.63.1.3 View file →
@@ -1,5 +1,10 @@
1 1 <?php
2 +/**
3 + * Quick View Module Class.
4 + *
5 + * @package RadiusTheme\SB
6 + */
2 7
3 8 namespace RadiusTheme\SB\Modules\QuickView;
4 9
5 10 // Do not allow directly accessing this file.
@@ -6,22 +11,114 @@
6 11 if ( ! defined( 'ABSPATH' ) ) {
7 12 exit( 'This script cannot be accessed directly.' );
8 13 }
9 14
10 -use RadiusTheme\SB\Modules\Compare\CompareInstaller;
15 +use RadiusTheme\SB\Helpers\Fns;
11 16 use RadiusTheme\SB\Traits\SingletonTrait;
12 17
18 +/**
19 + * Quick View Module Class.
20 + */
13 21 final class QuickView {
22 + /**
23 + * @var array
24 + */
25 + private $cache = [];
14 26
15 27 /**
16 28 * @var array
17 29 */
18 30 public $settings = [];
19 -
31 + /**
32 + * @var array|mixed
33 + */
34 + private array $options;
35 + /**
36 + * Options
37 + */
20 38 use SingletonTrait;
21 39
22 - function __construct() {
40 + /**
41 + * Class constructor.
42 + *
43 + * @return void
44 + */
45 + private function __construct() {
23 46 QuickViewFrontEnd::instance();
47 + $this->options = Fns::get_options( 'modules', 'quick_view' );
48 + add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_public_scripts' ], 99 );
49 + do_action( 'rtsb/module/quick_view/loaded' );
50 + }
24 51
25 - do_action( 'rtsb/module/quick_view/loaded' );
52 + /**
53 + * @return void
54 + */
55 + public function enqueue_public_scripts() {
56 + $cache_key = 'quick_view_style_cache';
57 + $width = ! empty( $this->options['modal_width'] ) ? $this->options['modal_width'] : '950';
58 + $handle = Fns::optimized_handle( 'rtsb-public' );
59 +
60 + wp_localize_script(
61 + $handle,
62 + 'QvModalParams',
63 + [
64 + 'modal_width' => absint( $width ),
65 + ]
66 + );
67 +
68 + if ( isset( $this->cache[ $cache_key ] ) && ! empty( $this->cache[ $cache_key ] ) ) {
69 + wp_add_inline_style( Fns::optimized_handle( 'rtsb-frontend' ), $this->cache[ $cache_key ] );
70 + return;
71 + }
72 +
73 + $height = $this->options['modal_height'] ?? false;
74 + $wrapper_padding = $this->options['modal_wrapper_padding'] ?? '0';
75 + $bg_color = $this->options['modal_bg_color'] ?? false;
76 + $box_shadow = $this->options['modal_box_shadow_color'] ?? false;
77 + $overly_color = $this->options['modal_overly_color'] ?? false;
78 +
79 + ob_start();
80 +
81 + if ( $height ) { ?>
82 + .rtsb-ui-modal .rtsb-modal-content{
83 + height: <?php echo esc_attr( $height ); ?>;
84 + }
85 + <?php
86 + }
87 +
88 + if ( '' !== $wrapper_padding ) {
89 + ?>
90 + .rtsb-ui-modal .rtsb-modal-wrapper.quick-view-modal .rtsb-modal-content .rtsb-modal-body{
91 + padding: <?php echo esc_attr( $wrapper_padding ); ?>;
92 + }
93 + <?php
94 + }
95 + if ( $bg_color ) {
96 + ?>
97 + .rtsb-ui-modal .rtsb-modal-wrapper .rtsb-modal-content{
98 + background-color: <?php echo esc_attr( $bg_color ); ?>;
99 + }
100 + <?php
101 + }
102 + if ( $box_shadow ) {
103 + ?>
104 + .rtsb-ui-modal .rtsb-modal-content{
105 + box-shadow: 0 0 10px <?php echo esc_attr( $box_shadow ); ?>;
106 + }
107 + <?php
108 + }
109 +
110 + if ( $overly_color ) {
111 + ?>
112 + .rtsb-ui-modal .rtsb-mask-wrapper{
113 + background-color: <?php echo esc_attr( $overly_color ); ?>;
114 + }
115 + <?php
116 + }
117 +
118 + $dynamic_css = ob_get_clean();
119 + $this->cache[ $cache_key ] = $dynamic_css;
120 + if ( ! empty( $dynamic_css ) ) {
121 + wp_add_inline_style( Fns::optimized_handle( 'rtsb-frontend' ), $dynamic_css );
122 + }
26 123 }
27 124 }