PluginProbe ʕ •ᴥ•ʔ
Gallery : FooGallery / 3.2.6
Gallery : FooGallery v3.2.6
3.3.0 3.1.31 3.1.32 3.1.34 3.1.36 3.2.0 3.2.6 trunk 1.10.3 2.0.24 2.1.34 2.2.44 2.3.3 2.4.32 3.0.6 3.1.11 3.1.12 3.1.13 3.1.20 3.1.25 3.1.26 3.1.26.1 3.1.26.2
foogallery / includes / compatibility / class-wpoptimize-compatibility.php
foogallery / includes / compatibility Last commit date
elementor 4 weeks ago class-autoptimize-compatibility.php 4 weeks ago class-elasticpress-compatibility.php 4 weeks ago class-elementor-compatibility.php 4 weeks ago class-foobox-compatibility.php 4 weeks ago class-foogallery-compatibility.php 4 weeks ago class-foovideo-compatibility.php 4 weeks ago class-jetpack-compatibility.php 4 weeks ago class-polylang-compatibility.php 4 weeks ago class-responsive-lightbox-dfactory-compatibility.php 4 weeks ago class-wpoptimize-compatibility.php 4 weeks ago class-wprocket-compatibility.php 4 weeks ago view-foovideo-offer.php 4 weeks ago
class-wpoptimize-compatibility.php
52 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 /**
8 * WP Optimize Compatibility Class
9 *
10 * @since 2.0.27
11 *
12 * @package foogallery
13 */
14
15 if ( ! class_exists( 'FooGallery_WPOptimize_Compatibility' ) ) {
16
17 /**
18 * Class FooGallery_WPOptimize_Compatibility
19 */
20 class FooGallery_WPOptimize_Compatibility {
21
22 /**
23 * FooGallery_WPOptimize_Compatibility constructor.
24 */
25 public function __construct() {
26 // Add 'no-lazy' class onto all image tags generated by FooGallery.
27 add_filter( 'foogallery_attachment_html_image_attributes', array( $this, 'add_lazy_image_attributes' ), 10, 3 );
28 }
29
30 /**
31 * Adds skip-lazy class to all img tags so that they get ignored by lazy loading plugins
32 *
33 * @param array $attr the attributes.
34 * @param array $args extra arguments.
35 * @param FooGalleryAttachment $foogallery_attachment the current attachment.
36 *
37 * @return mixed
38 */
39 public function add_lazy_image_attributes( $attr, $args, $foogallery_attachment ) {
40 if ( class_exists( 'WP_Optimize_Lazy_Load' ) ) {
41 if ( array_key_exists( 'class', $attr ) ) {
42 $attr['class'] .= ' no-lazy';
43 } else {
44 $attr['class'] = 'no-lazy';
45 }
46 }
47
48 return $attr;
49 }
50 }
51 }
52