PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.5.3
ShopBuilder – WooCommerce Builder For Elementor v2.5.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
shopbuilder / app / Modules / QuickView / QuickView.php

QuickView.php in ShopBuilder – WooCommerce Builder For Elementor 2.5.3, at app/Modules/QuickView/QuickView.php

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