Skip to content

Commit f17acee

Browse files
committed
Release new version 1.8.9
* This Maintenance update has 2 code tweaks for compatibility with themes and plugins that load images via the wp_kses_post sanitizer as WooCommerce does since version 3.4.0 with widgets and on Cart page. * Tweak - Append lazy attributes to attribute list of allowed post tags list so that lazy load can run on frontend when that content is output via wp_kses_post * Tweak - Add noscript tag to allowed post tags list to resolve duplicate image if that image is output via wp_kses_post * Tweak - Test for compatibility with WooCommerce version 3.4.1
1 parent 3049019 commit f17acee

File tree

4 files changed

+50
-3
lines changed

4 files changed

+50
-3
lines changed

a3-lazy-load.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
/*
33
Plugin Name: a3 Lazy Load
44
Description: Speed up your site and enhance frontend user's visual experience in PC's, Tablets and mobile with a3 Lazy Load.
5-
Version: 1.8.8
5+
Version: 1.8.9
66
Author: a3rev Software
77
Author URI: https://a3rev.com/
88
Requires at least: 4.0
99
Tested up to: 4.9.6
1010
Text Domain: a3-lazy-load
1111
Domain Path: /languages
12+
WC requires at least: 2.0.0
13+
WC tested up to: 3.4.1
1214
License: GPLv2 or later
1315
Copyright © 2011 a3 Revolution Software Development team
1416
a3 Revolution Software Development team
@@ -30,7 +32,7 @@
3032
define('A3_LAZY_LOAD_IMAGES_URL', A3_LAZY_LOAD_URL . '/assets/images');
3133

3234
define( 'A3_LAZY_LOAD_KEY', 'a3_lazy_load' );
33-
define( 'A3_LAZY_VERSION', '1.8.8' );
35+
define( 'A3_LAZY_VERSION', '1.8.9' );
3436

3537
/**
3638
* Load Localisation files.

admin/a3-lazy-load-admin.php

+1
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@ function a3_lazy_load_upgrade_plugin() {
6464

6565
update_option('a3_lazy_load_version', A3_LAZY_VERSION );
6666
}
67+
6768
?>

classes/class-a3-lazy-load.php

+35
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ function __construct() {
110110
add_action( 'dynamic_sidebar_after', array( $this, 'sidebar_after_filter_videos' ), 1000 );
111111
}
112112
}
113+
114+
// Add lazy attributes to all allowed post tags list
115+
add_filter( 'wp_kses_allowed_html', array( $this, 'add_lazy_attributes' ), 10, 2 );
113116
}
114117

115118
static function _instance() {
@@ -223,6 +226,38 @@ static function has_mobilepress() {
223226
return false;
224227
}
225228

229+
static function add_lazy_attributes( $allowedposttags, $context ) {
230+
231+
if ( 'post' === $context && ! empty( $allowedposttags ) ) {
232+
233+
$lazy_attributes = array(
234+
'data-lazy-type' => true,
235+
'data-src' => true,
236+
'data-srcset' => true,
237+
'data-poster' => true,
238+
);
239+
240+
foreach ( $allowedposttags as $tag => $attributes ) {
241+
if ( true === $attributes ) {
242+
$attributes = array();
243+
}
244+
245+
if ( is_array( $attributes ) ) {
246+
// Add lazy attributes to post tag
247+
$allowedposttags[$tag] = array_merge( $attributes, $lazy_attributes );
248+
}
249+
}
250+
251+
// Add noscript tag to allowed post tags list
252+
if ( ! isset( $allowedposttags['noscript'] ) ) {
253+
$allowedposttags['noscript'] = array();
254+
}
255+
256+
}
257+
258+
return $allowedposttags;
259+
}
260+
226261
static function filter_html( $content, $include_noscript = null ) {
227262
if ( is_admin() ) {
228263
return $content;

readme.txt

+10-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: a3rev, a3rev Software, nguyencongtuan
33
Tags: a3 lazy load, Lazy Loading , image lazy load, lazyload
44
Requires at least: 4.5
55
Tested up to: 4.9.6
6-
Stable tag: 1.8.8
6+
Stable tag: 1.8.9
77
License: GPLv3
88
License URI: http://www.gnu.org/licenses/gpl-3.0.html
99

@@ -194,6 +194,12 @@ Filter tags to add to class name of theme to exclude lazy load on images or vide
194194

195195
== Changelog ==
196196

197+
= 1.8.9 - 2018/06/04 =
198+
* This Maintenance update has 2 code tweaks for compatibility with themes and plugins that load images via the wp_kses_post sanitizer as WooCommerce does since version 3.4.0 with widgets and on Cart page.
199+
* Tweak - Append lazy attributes to attribute list of allowed post tags list so that lazy load can run on frontend when that content is output via wp_kses_post
200+
* Tweak - Add noscript tag to allowed post tags list to resolve duplicate image if that image is output via wp_kses_post
201+
* Tweak - Test for compatibility with WooCommerce version 3.4.1
202+
197203
= 1.8.8 - 2018/05/26 =
198204
* This maintenance update is for compatibility with WordPress 4.9.6 and the new GDPR compliance requirements for users in the EU
199205
* Tweak - Test for compatibility with WordPress 4.9.6
@@ -381,6 +387,9 @@ Filter tags to add to class name of theme to exclude lazy load on images or vide
381387

382388
== Upgrade Notice ==
383389

390+
= 1.8.9 =
391+
Maintenance update. This upgrade has 2 code tweaks for compatibility with themes and plugins that load images via the wp_kses_post sanitizer as WooCommerce does since version 3.4.0 with widgets and on Cart page.
392+
384393
= 1.8.8 =
385394
Maintenance Update. Compatibility WordPress 4.9.6 and the new GDPR compliance requirements for users in the EU
386395

0 commit comments

Comments
 (0)