PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.1.9
ShopBuilder – WooCommerce Builder For Elementor v2.1.9
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.1.9, at app/Modules/QuickView/QuickView.php

112 lines 2.6 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\Modules\Compare\CompareInstaller;
12 use RadiusTheme\SB\Traits\SingletonTrait;
13 use RadiusTheme\SBPRO\Modules\Badges\BadgesFns;
14
15 final class QuickView {
16 /**
17 * @var array
18 */
19 private $cache = [];
20
21 /**
22 * @var array
23 */
24 public $settings = [];
25 /**
26 * @var array|mixed
27 */
28 private array $options;
29 /**
30 * Options
31 */
32 use SingletonTrait;
33
34 private function __construct() {
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 }
40
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 }
110 }
111 }
112