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