PluginProbe
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization / 2.5.5
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization v2.5.5
4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 2.5.5 2.5.6 2.5.7 3.0.0 3.0.1 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.11.0 3.11.1 3.11.2 3.11.3 3.12.0 3.12.1 All 134 releases
optimole-wp / inc / compatibilities / yith_quick_view.php

yith_quick_view.php in Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization 2.5.5, at inc/compatibilities/yith_quick_view.php

58 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Class Optml_shortcode_ultimate.
5 *
6 * @reason We need to turn on the image replacement on quick view ajax response, even if the user is logged in.
7 */
8 class Optml_yith_quick_view extends Optml_compatibility {
9
10 /**
11 * Optml_yith_quick_view constructor.
12 */
13 public function __construct() {
14 add_filter( 'optml_force_replacement_on', [ $this, 'force_replacement' ] );
15 }
16
17 /**
18 * Allow image replacement even if we are logged in.
19 *
20 * @param bool $status Old status.
21 *
22 * @return bool Replacement status.
23 */
24 public function force_replacement( $status ) {
25 if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] === 'yith_load_product_quick_view' ) {
26 return true;
27 }
28
29 return false;
30 }
31
32 /**
33 * Should we load the integration logic.
34 *
35 * @return bool Should we load.
36 */
37 function should_load() {
38 include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
39
40 return ( is_plugin_active( 'yith-woocommerce-quick-view/init.php' ) );
41 }
42
43 /**
44 * Register integration details.
45 */
46 public function register() {
47 add_action(
48 'wp_ajax_yith_load_product_quick_view',
49 [
50 Optml_Main::instance()->manager,
51 'process_template_redirect_content',
52 ],
53 PHP_INT_MIN
54 );
55 }
56
57 }
58