PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / trunk
ShopBuilder – WooCommerce Builder For Elementor vtrunk
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 2.3.0 All 62 releases
shopbuilder / app / Modules / QuickView / QuickView.php

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

125 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Quick View Module Class.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Modules\QuickView;
9
10 // Do not allow directly accessing this file.
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit( 'This script cannot be accessed directly.' );
13 }
14
15 use RadiusTheme\SB\Helpers\Fns;
16 use RadiusTheme\SB\Traits\SingletonTrait;
17
18 /**
19 * Quick View Module Class.
20 */
21 final class QuickView {
22 /**
23 * @var array
24 */
25 private $cache = [];
26
27 /**
28 * @var array
29 */
30 public $settings = [];
31 /**
32 * @var array|mixed
33 */
34 private array $options;
35 /**
36 * Options
37 */
38 use SingletonTrait;
39
40 /**
41 * Class constructor.
42 *
43 * @return void
44 */
45 private function __construct() {
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 }
51
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 = ! empty( $this->options['modal_height'] ) ? absint( $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 absint( $height ); ?>px;
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 }
123 }
124 }
125