Version Description
This maintenance release adds support for the Lazy Load exclusion attribute 'data-skip-lazy'
Download this release
Release Info
Developer | a3rev |
Plugin | a3 Lazy Load |
Version | 2.2.1 |
Comparing to | |
See all releases |
Code changes from version 2.2.0 to 2.2.1
- a3-lazy-load.php +2 -2
- classes/class-a3-lazy-load-excludes.php +10 -0
- classes/class-a3-lazy-load.php +7 -5
- readme.txt +19 -3
a3-lazy-load.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: a3 Lazy Load
|
4 |
Description: Speed up your site and enhance frontend user's visual experience in PC's, Tablets and mobile with a3 Lazy Load.
|
5 |
-
Version: 2.2.
|
6 |
Author: a3rev Software
|
7 |
Author URI: https://a3rev.com/
|
8 |
Requires at least: 4.9
|
@@ -33,7 +33,7 @@ define('A3_LAZY_LOAD_IMAGES_URL', A3_LAZY_LOAD_URL . '/assets/images');
|
|
33 |
|
34 |
define( 'A3_LAZY_LOAD_KEY', 'a3_lazy_load' );
|
35 |
define( 'A3_LAZY_LOAD_PREFIX', 'a3_lazy_load_' );
|
36 |
-
define( 'A3_LAZY_VERSION', '2.2.
|
37 |
define( 'A3_LAZY_LOAD_G_FONTS', false );
|
38 |
|
39 |
use \A3Rev\LazyLoad\FrameWork;
|
2 |
/*
|
3 |
Plugin Name: a3 Lazy Load
|
4 |
Description: Speed up your site and enhance frontend user's visual experience in PC's, Tablets and mobile with a3 Lazy Load.
|
5 |
+
Version: 2.2.1
|
6 |
Author: a3rev Software
|
7 |
Author URI: https://a3rev.com/
|
8 |
Requires at least: 4.9
|
33 |
|
34 |
define( 'A3_LAZY_LOAD_KEY', 'a3_lazy_load' );
|
35 |
define( 'A3_LAZY_LOAD_PREFIX', 'a3_lazy_load_' );
|
36 |
+
define( 'A3_LAZY_VERSION', '2.2.1' );
|
37 |
define( 'A3_LAZY_LOAD_G_FONTS', false );
|
38 |
|
39 |
use \A3Rev\LazyLoad\FrameWork;
|
classes/class-a3-lazy-load-excludes.php
CHANGED
@@ -162,4 +162,14 @@ class Excludes
|
|
162 |
|
163 |
return false;
|
164 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
}
|
162 |
|
163 |
return false;
|
164 |
}
|
165 |
+
|
166 |
+
public function has_skip_lazy_attribute( $html ) {
|
167 |
+
$has_skip_lazy = false;
|
168 |
+
|
169 |
+
if ( stristr( $html, ' data-skip-lazy ' ) !== false || stristr( $html, ' data-skip-lazy=' ) !== false || stristr( $html, ' data-skip-lazy/>' ) !== false || stristr( $html, ' data-skip-lazy>' ) !== false ) {
|
170 |
+
$has_skip_lazy = true;
|
171 |
+
}
|
172 |
+
|
173 |
+
return $has_skip_lazy;
|
174 |
+
}
|
175 |
}
|
classes/class-a3-lazy-load.php
CHANGED
@@ -382,6 +382,7 @@ class LazyLoad
|
|
382 |
}
|
383 |
|
384 |
protected function _filter_images( $content, $include_noscript = null ) {
|
|
|
385 |
|
386 |
if ( null === $include_noscript ) {
|
387 |
global $a3_lazy_load_global_settings;
|
@@ -405,7 +406,7 @@ class LazyLoad
|
|
405 |
foreach ( $matches[0] as $imgHTML ) {
|
406 |
|
407 |
// don't to the replacement if a skip class is provided and the image has the class, or if the image is a data-uri
|
408 |
-
if ( ! ( is_array( $this->_skip_images_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/src=['\"]data:image/is", $imgHTML ) && ! preg_match( "/src=.*lazy_placeholder.gif['\"]/s", $imgHTML ) ) {
|
409 |
$i++;
|
410 |
// replace the src and add the data-src attribute
|
411 |
$replaceHTML = '';
|
@@ -449,7 +450,7 @@ class LazyLoad
|
|
449 |
foreach ( $matches[0] as $imgHTML ) {
|
450 |
|
451 |
// don't to the replacement if a skip class is provided and the image has the class, or if the image is a data-uri
|
452 |
-
if ( ! ( is_array( $this->_skip_images_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/ data-srcset=['\"]/is", $imgHTML )
|
453 |
$i++;
|
454 |
// replace the srcset and add the data-srcset attribute
|
455 |
$replaceHTML = '';
|
@@ -525,6 +526,7 @@ class LazyLoad
|
|
525 |
}
|
526 |
|
527 |
protected function _filter_videos( $content, $include_noscript = null ) {
|
|
|
528 |
|
529 |
if ( null === $include_noscript ) {
|
530 |
global $a3_lazy_load_global_settings;
|
@@ -551,7 +553,7 @@ class LazyLoad
|
|
551 |
}
|
552 |
|
553 |
// don't to the replacement if a skip class is provided and the image has the class, or if the image is a data-uri
|
554 |
-
if ( ! ( is_array( $this->_skip_videos_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/ data-src=['\"]/is", $imgHTML ) ) {
|
555 |
$i++;
|
556 |
// replace the src and add the data-src attribute
|
557 |
$replaceHTML = '';
|
@@ -594,7 +596,7 @@ class LazyLoad
|
|
594 |
foreach ( $matches[0] as $imgHTML ) {
|
595 |
|
596 |
// don't to the replacement if a skip class is provided and the image has the class, or if the image is a data-uri
|
597 |
-
if ( ! ( is_array( $this->_skip_videos_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/ data-src=['\"]/is", $imgHTML ) ) {
|
598 |
$i++;
|
599 |
// replace the src and add the data-src attribute
|
600 |
|
@@ -642,7 +644,7 @@ class LazyLoad
|
|
642 |
foreach ( $matches[0] as $imgHTML ) {
|
643 |
|
644 |
// don't to the replacement if a skip class is provided and the image has the class, or if the image is a data-uri
|
645 |
-
if ( ! ( is_array( $this->_skip_videos_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/ data-src=['\"]/is", $imgHTML ) ) {
|
646 |
$i++;
|
647 |
// replace the src and add the data-src attribute
|
648 |
$replaceHTML = '';
|
382 |
}
|
383 |
|
384 |
protected function _filter_images( $content, $include_noscript = null ) {
|
385 |
+
global $a3_lazy_load_excludes;
|
386 |
|
387 |
if ( null === $include_noscript ) {
|
388 |
global $a3_lazy_load_global_settings;
|
406 |
foreach ( $matches[0] as $imgHTML ) {
|
407 |
|
408 |
// don't to the replacement if a skip class is provided and the image has the class, or if the image is a data-uri
|
409 |
+
if ( ! ( is_array( $this->_skip_images_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/src=['\"]data:image/is", $imgHTML ) && ! preg_match( "/src=.*lazy_placeholder.gif['\"]/s", $imgHTML ) && ! $a3_lazy_load_excludes->has_skip_lazy_attribute( $imgHTML ) ) {
|
410 |
$i++;
|
411 |
// replace the src and add the data-src attribute
|
412 |
$replaceHTML = '';
|
450 |
foreach ( $matches[0] as $imgHTML ) {
|
451 |
|
452 |
// don't to the replacement if a skip class is provided and the image has the class, or if the image is a data-uri
|
453 |
+
if ( ! ( is_array( $this->_skip_images_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/ data-srcset=['\"]/is", $imgHTML ) && ! $a3_lazy_load_excludes->has_skip_lazy_attribute( $imgHTML ) ) {
|
454 |
$i++;
|
455 |
// replace the srcset and add the data-srcset attribute
|
456 |
$replaceHTML = '';
|
526 |
}
|
527 |
|
528 |
protected function _filter_videos( $content, $include_noscript = null ) {
|
529 |
+
global $a3_lazy_load_excludes;
|
530 |
|
531 |
if ( null === $include_noscript ) {
|
532 |
global $a3_lazy_load_global_settings;
|
553 |
}
|
554 |
|
555 |
// don't to the replacement if a skip class is provided and the image has the class, or if the image is a data-uri
|
556 |
+
if ( ! ( is_array( $this->_skip_videos_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/ data-src=['\"]/is", $imgHTML ) && ! $a3_lazy_load_excludes->has_skip_lazy_attribute( $imgHTML ) ) {
|
557 |
$i++;
|
558 |
// replace the src and add the data-src attribute
|
559 |
$replaceHTML = '';
|
596 |
foreach ( $matches[0] as $imgHTML ) {
|
597 |
|
598 |
// don't to the replacement if a skip class is provided and the image has the class, or if the image is a data-uri
|
599 |
+
if ( ! ( is_array( $this->_skip_videos_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/ data-src=['\"]/is", $imgHTML ) && ! $a3_lazy_load_excludes->has_skip_lazy_attribute( $imgHTML ) ) {
|
600 |
$i++;
|
601 |
// replace the src and add the data-src attribute
|
602 |
|
644 |
foreach ( $matches[0] as $imgHTML ) {
|
645 |
|
646 |
// don't to the replacement if a skip class is provided and the image has the class, or if the image is a data-uri
|
647 |
+
if ( ! ( is_array( $this->_skip_videos_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/ data-src=['\"]/is", $imgHTML ) && ! $a3_lazy_load_excludes->has_skip_lazy_attribute( $imgHTML ) ) {
|
648 |
$i++;
|
649 |
// replace the src and add the data-src attribute
|
650 |
$replaceHTML = '';
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: a3rev, a3rev Software, nguyencongtuan
|
|
3 |
Tags: a3 lazy load, Lazy Loading , image lazy load, lazyload
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.3.2
|
6 |
-
Stable tag: 2.2.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -151,8 +151,15 @@ Want to add a new language to a3 Lazy Load? Great! You can contribute via [trans
|
|
151 |
|
152 |
= How do I exclude individual objects from Lazy Load? =
|
153 |
|
154 |
-
Images, Videos / iframes can be excluded from Lazy Load
|
155 |
-
<code><img class="skip-lazy"> , <video class="skip-lazy"></code>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
|
157 |
= Why are some images, videos, objects not Lazy Loaded? =
|
158 |
|
@@ -205,6 +212,12 @@ Filter tags to add to class name of theme to exclude lazy load on images or vide
|
|
205 |
|
206 |
== Changelog ==
|
207 |
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
= 2.2.0 - 2020/01/13 =
|
209 |
* This feature release completes the full refactor (frontend and backend) of the plugins PHP to Composer plus introduces new standardized skip-lazy exclusion class with backward compatibility support for a3-notlazy class
|
210 |
* Feature - Plugin Framework fully refactored to Composer for cleaner code and faster PHP code
|
@@ -463,6 +476,9 @@ Filter tags to add to class name of theme to exclude lazy load on images or vide
|
|
463 |
|
464 |
== Upgrade Notice ==
|
465 |
|
|
|
|
|
|
|
466 |
= 2.2.0 =
|
467 |
This feature release completes the full refactor (frontend and backend) of the plugins PHP to Composer plus introduces new standardized skip-lazy exclusion class with backward compatibility support for a3-notlazy class
|
468 |
|
3 |
Tags: a3 lazy load, Lazy Loading , image lazy load, lazyload
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.3.2
|
6 |
+
Stable tag: 2.2.1
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
151 |
|
152 |
= How do I exclude individual objects from Lazy Load? =
|
153 |
|
154 |
+
Images, Videos / iframes can be excluded from Lazy Load by existing classnames or if none exist exclusions can be done manually via exclusion <code>skip-lazy</code> classname or <code>data-skip-lazy</code> attribute. Examples
|
155 |
+
Exclude by classname <code><img class="skip-lazy"> , <video class="skip-lazy"></code>
|
156 |
+
Exclude by attribute <code><img data-skip-lazy> , <video data-skip-lazy></code>
|
157 |
+
|
158 |
+
<strong>the text changes for the Images option box</strong>
|
159 |
+
Images can be excluded from Lazy Load by entering existing image classnames below or if the image has no classname by adding the exclusion <code>skip-lazy</code> classname or <code>data-skip-lazy</code> attribute to the image. Examples, by class <code><img class="skip-lazy"></code> , by attribute <code><img data-skip-lazy></code>
|
160 |
+
|
161 |
+
<strong>the Videos</strong>
|
162 |
+
Videos and iFrames can be excluded from Lazy Load either by entering existing classnames below or if it has has no classname by adding the exclusion <code>skip-lazy</code> classname or <code>data-skip-lazy</code> attribute to the video / iframe. Examples, by class <code><video class="skip-lazy"></code>, by attribute <code><video data-skip-lazy></code>
|
163 |
|
164 |
= Why are some images, videos, objects not Lazy Loaded? =
|
165 |
|
212 |
|
213 |
== Changelog ==
|
214 |
|
215 |
+
= 2.2.1 - 2020/01/16 =
|
216 |
+
* This maintenance release adds support for the Lazy Load exclusion attribute 'data-skip-lazy'
|
217 |
+
* Tweak - Add support for lazy load exclusion by attribute 'data-skip-lazy'
|
218 |
+
* Tweak - Update the plugins readme description about support for exclusion attribute
|
219 |
+
* Tweak - Update plugins admin Image and Video options boxes with help text about exclusion by attribute
|
220 |
+
|
221 |
= 2.2.0 - 2020/01/13 =
|
222 |
* This feature release completes the full refactor (frontend and backend) of the plugins PHP to Composer plus introduces new standardized skip-lazy exclusion class with backward compatibility support for a3-notlazy class
|
223 |
* Feature - Plugin Framework fully refactored to Composer for cleaner code and faster PHP code
|
476 |
|
477 |
== Upgrade Notice ==
|
478 |
|
479 |
+
= 2.2.1 =
|
480 |
+
This maintenance release adds support for the Lazy Load exclusion attribute 'data-skip-lazy'
|
481 |
+
|
482 |
= 2.2.0 =
|
483 |
This feature release completes the full refactor (frontend and backend) of the plugins PHP to Composer plus introduces new standardized skip-lazy exclusion class with backward compatibility support for a3-notlazy class
|
484 |
|