PluginProbe ʕ •ᴥ•ʔ
TinyPNG – JPEG, PNG & WebP image compression / 3.8.0
TinyPNG – JPEG, PNG & WebP image compression v3.8.0
3.8.0 3.7.0 3.6.14 trunk 1.0.0 1.1.0 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.4.0 1.5.0 1.6.0 1.7.0 1.7.1 1.7.2 2.0.0 2.0.1 2.0.2 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.0.0 3.0.1 3.1.0 3.2.0 3.2.1 3.3 3.4 3.4.1 3.4.2 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.5.2 3.6.0 3.6.1 3.6.10 3.6.11 3.6.12 3.6.13 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9
tiny-compress-images / src / compatibility / woocommerce / class-tiny-woocommerce.php
tiny-compress-images / src / compatibility / woocommerce Last commit date
class-tiny-woocommerce.php 7 months ago
class-tiny-woocommerce.php
59 lines
1 <?php
2 /*
3 * Tiny Compress Images - WordPress plugin.
4 * Copyright (C) 2015-2018 Tinify B.V.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc., 51
18 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21 /**
22 * Handles WooCommerce compatibility
23 *
24 * @since 3.6.9
25 */
26 class Tiny_WooCommerce {
27
28 public function __construct() {
29 if ( ! class_exists( 'WooCommerce' ) ) {
30 return;
31 }
32
33 $this->add_hooks();
34 }
35
36 private function add_hooks() {
37 add_filter( 'tiny_replace_with_picture', array( $this, 'skip_on_product_pages' ), 10, 1 );
38 }
39
40 /**
41 * We are skipping single product pages for now.
42 * Variation images in the product gallery are injected through JavaScript but might never
43 * display because the sourceset takes priority over the root img. The replacement is on the image and not
44 * on the srcset.
45 *
46 * @since 3.6.9
47 *
48 * @param bool $should_replace Whether to replace images with picture elements.
49 * @return bool False on product pages, otherwise unchanged.
50 */
51 public function skip_on_product_pages( $should_replace ) {
52 if ( is_product() ) {
53 return false;
54 }
55
56 return $should_replace;
57 }
58 }
59