PluginProbe
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization / trunk
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization vtrunk
4.2.14 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 All 135 releases
optimole-wp / inc / compatibilities / smart_search_woocommerce.php

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

49 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_smart_search_woocommerce.
5 *
6 * @reason Smart search by searchanise stores the content of the image urls before they are processed.
7 */
8 class Optml_smart_search_woocommerce extends Optml_compatibility {
9
10 /**
11 * Should we load the integration logic.
12 *
13 * @return bool Should we load.
14 */
15 public function should_load() {
16 include_once ABSPATH . 'wp-admin/includes/plugin.php';
17 return is_plugin_active( 'smart-search-for-woocommerce/woocommerce-searchanise.php' );
18 }
19
20 /**
21 * Register integration details.
22 */
23 public function register() {
24 add_filter( 'se_get_product_image_post', [ $this, 'filter_image_url' ], 1, 3 );
25 }
26
27 /**
28 * Process image url before is send to the server.
29 *
30 * @param string $image_url The original image url.
31 * @param int $image_id The image id .
32 * @param int $size The image size.
33 * @return string
34 */
35 public function filter_image_url( $image_url, $image_id, $size ) {
36 Optml_Url_Replacer::instance()->init();
37 return apply_filters( 'optml_content_url', $image_url );
38 }
39
40 /**
41 * Should we early load the compatibility?
42 *
43 * @return bool Whether to load the compatibility or not.
44 */
45 public function should_load_early() {
46 return true;
47 }
48 }
49