| @@ -1,10 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * Quick View Module Class. | |
| 4 | - * | |
| 5 | - * @package RadiusTheme\SB | |
| 6 | - */ | |
| 7 | 2 | |
| 8 | 3 | namespace RadiusTheme\SB\Modules\QuickView; |
| 9 | 4 | |
| 10 | 5 | // Do not allow directly accessing this file. |
| @@ -14,11 +9,8 @@ | ||
| 14 | 9 | |
| 15 | 10 | use RadiusTheme\SB\Helpers\Fns; |
| 16 | 11 | use RadiusTheme\SB\Traits\SingletonTrait; |
| 17 | 12 | |
| 18 | -/** | |
| 19 | - * Quick View Module Class. | |
| 20 | - */ | |
| 21 | 13 | final class QuickView { |
| 22 | 14 | /** |
| 23 | 15 | * @var array |
| 24 | 16 | */ |
| @@ -36,13 +28,8 @@ | ||
| 36 | 28 | * Options |
| 37 | 29 | */ |
| 38 | 30 | use SingletonTrait; |
| 39 | 31 | |
| 40 | - /** | |
| 41 | - * Class constructor. | |
| 42 | - * | |
| 43 | - * @return void | |
| 44 | - */ | |
| 45 | 32 | private function __construct() { |
| 46 | 33 | QuickViewFrontEnd::instance(); |
| 47 | 34 | $this->options = Fns::get_options( 'modules', 'quick_view' ); |
| 48 | 35 | add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_public_scripts' ], 99 ); |
| @@ -54,12 +41,10 @@ | ||
| 54 | 41 | */ |
| 55 | 42 | public function enqueue_public_scripts() { |
| 56 | 43 | $cache_key = 'quick_view_style_cache'; |
| 57 | 44 | $width = ! empty( $this->options['modal_width'] ) ? $this->options['modal_width'] : '950'; |
| 58 | - $handle = Fns::optimized_handle( 'rtsb-public' ); | |
| 59 | - | |
| 60 | 45 | wp_localize_script( |
| 61 | - $handle, | |
| 46 | + 'rtsb-public', | |
| 62 | 47 | 'QvModalParams', |
| 63 | 48 | [ |
| 64 | 49 | 'modal_width' => absint( $width ), |
| 65 | 50 | ] |
| @@ -65,13 +50,13 @@ | ||
| 65 | 50 | ] |
| 66 | 51 | ); |
| 67 | 52 | |
| 68 | 53 | 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 ] ); | |
| 54 | + wp_add_inline_style( 'rtsb-frontend', $this->cache[ $cache_key ] ); | |
| 70 | 55 | return; |
| 71 | 56 | } |
| 72 | 57 | |
| 73 | - $height = ! empty( $this->options['modal_height'] ) ? absint( $this->options['modal_height'] ) : false; | |
| 58 | + $height = $this->options['modal_height'] ?? false; | |
| 74 | 59 | $wrapper_padding = $this->options['modal_wrapper_padding'] ?? '0'; |
| 75 | 60 | $bg_color = $this->options['modal_bg_color'] ?? false; |
| 76 | 61 | $box_shadow = $this->options['modal_box_shadow_color'] ?? false; |
| 77 | 62 | $overly_color = $this->options['modal_overly_color'] ?? false; |
| @@ -79,9 +64,9 @@ | ||
| 79 | 64 | ob_start(); |
| 80 | 65 | |
| 81 | 66 | if ( $height ) { ?> |
| 82 | 67 | .rtsb-ui-modal .rtsb-modal-content{ |
| 83 | - height: <?php echo absint( $height ); ?>px; | |
| 68 | + height: <?php echo esc_attr( $height ); ?>; | |
| 84 | 69 | } |
| 85 | 70 | <?php |
| 86 | 71 | } |
| 87 | 72 | |
| @@ -117,8 +102,8 @@ | ||
| 117 | 102 | |
| 118 | 103 | $dynamic_css = ob_get_clean(); |
| 119 | 104 | $this->cache[ $cache_key ] = $dynamic_css; |
| 120 | 105 | if ( ! empty( $dynamic_css ) ) { |
| 121 | - wp_add_inline_style( Fns::optimized_handle( 'rtsb-frontend' ), $dynamic_css ); | |
| 106 | + wp_add_inline_style( 'rtsb-frontend', $dynamic_css ); | |
| 122 | 107 | } |
| 123 | 108 | } |
| 124 | 109 | } |