| @@ -1,5 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * Quick View Module Class. | |
| 4 | + * | |
| 5 | + * @package RadiusTheme\SB | |
| 6 | + */ | |
| 2 | 7 | |
| 3 | 8 | namespace RadiusTheme\SB\Modules\QuickView; |
| 4 | 9 | |
| 5 | 10 | // Do not allow directly accessing this file. |
| @@ -7,12 +12,13 @@ | ||
| 7 | 12 | exit( 'This script cannot be accessed directly.' ); |
| 8 | 13 | } |
| 9 | 14 | |
| 10 | 15 | use RadiusTheme\SB\Helpers\Fns; |
| 11 | -use RadiusTheme\SB\Modules\Compare\CompareInstaller; | |
| 12 | 16 | use RadiusTheme\SB\Traits\SingletonTrait; |
| 13 | -use RadiusTheme\SBPRO\Modules\Badges\BadgesFns; | |
| 14 | 17 | |
| 18 | +/** | |
| 19 | + * Quick View Module Class. | |
| 20 | + */ | |
| 15 | 21 | final class QuickView { |
| 16 | 22 | /** |
| 17 | 23 | * @var array |
| 18 | 24 | */ |
| @@ -30,8 +36,13 @@ | ||
| 30 | 36 | * Options |
| 31 | 37 | */ |
| 32 | 38 | use SingletonTrait; |
| 33 | 39 | |
| 40 | + /** | |
| 41 | + * Class constructor. | |
| 42 | + * | |
| 43 | + * @return void | |
| 44 | + */ | |
| 34 | 45 | private function __construct() { |
| 35 | 46 | QuickViewFrontEnd::instance(); |
| 36 | 47 | $this->options = Fns::get_options( 'modules', 'quick_view' ); |
| 37 | 48 | add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_public_scripts' ], 99 ); |
| @@ -43,10 +54,12 @@ | ||
| 43 | 54 | */ |
| 44 | 55 | public function enqueue_public_scripts() { |
| 45 | 56 | $cache_key = 'quick_view_style_cache'; |
| 46 | 57 | $width = ! empty( $this->options['modal_width'] ) ? $this->options['modal_width'] : '950'; |
| 58 | + $handle = Fns::optimized_handle( 'rtsb-public' ); | |
| 59 | + | |
| 47 | 60 | wp_localize_script( |
| 48 | - 'rtsb-public', | |
| 61 | + $handle, | |
| 49 | 62 | 'QvModalParams', |
| 50 | 63 | [ |
| 51 | 64 | 'modal_width' => absint( $width ), |
| 52 | 65 | ] |
| @@ -52,9 +65,9 @@ | ||
| 52 | 65 | ] |
| 53 | 66 | ); |
| 54 | 67 | |
| 55 | 68 | if ( isset( $this->cache[ $cache_key ] ) && ! empty( $this->cache[ $cache_key ] ) ) { |
| 56 | - wp_add_inline_style( 'rtsb-frontend', $this->cache[ $cache_key ] ); | |
| 69 | + wp_add_inline_style( Fns::optimized_handle( 'rtsb-frontend' ), $this->cache[ $cache_key ] ); | |
| 57 | 70 | return; |
| 58 | 71 | } |
| 59 | 72 | |
| 60 | 73 | $height = $this->options['modal_height'] ?? false; |
| @@ -104,8 +117,8 @@ | ||
| 104 | 117 | |
| 105 | 118 | $dynamic_css = ob_get_clean(); |
| 106 | 119 | $this->cache[ $cache_key ] = $dynamic_css; |
| 107 | 120 | if ( ! empty( $dynamic_css ) ) { |
| 108 | - wp_add_inline_style( 'rtsb-frontend', $dynamic_css ); | |
| 121 | + wp_add_inline_style( Fns::optimized_handle( 'rtsb-frontend' ), $dynamic_css ); | |
| 109 | 122 | } |
| 110 | 123 | } |
| 111 | 124 | } |