Version Description
Maintenance Update. Refactor of Lazy Load on Widgets, Full Compatibility with the Advanced Custom Fields plugin, optimization tweaks and 3 bug fixes.
Download this release
Release Info
Developer | a3rev |
Plugin | a3 Lazy Load |
Version | 1.8.5 |
Comparing to | |
See all releases |
Code changes from version 1.8.4 to 1.8.5
- a3-lazy-load.php +5 -2
- admin/admin-ui.php +10 -4
- admin/includes/fonts_face.php +6 -3
- assets/css/loading.gif +0 -0
- assets/js/jquery.lazyloadxt.js +3 -1
- assets/js/jquery.lazyloadxt.min.js +1 -1
- classes/class-a3-lazy-load.php +47 -8
- readme.txt +101 -24
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: 1.8.
|
6 |
Author: a3rev Software
|
7 |
Author URI: https://a3rev.com/
|
8 |
Requires at least: 4.0
|
@@ -30,7 +30,7 @@ define('A3_LAZY_LOAD_CSS_URL', A3_LAZY_LOAD_URL . '/assets/css');
|
|
30 |
define('A3_LAZY_LOAD_IMAGES_URL', A3_LAZY_LOAD_URL . '/assets/images');
|
31 |
|
32 |
define( 'A3_LAZY_LOAD_KEY', 'a3_lazy_load' );
|
33 |
-
define( 'A3_LAZY_VERSION', '1.8.
|
34 |
|
35 |
/**
|
36 |
* Load Localisation files.
|
@@ -49,6 +49,9 @@ function a3_lazy_load_plugin_textdomain() {
|
|
49 |
load_plugin_textdomain( 'a3-lazy-load', false, A3_LAZY_LOAD_FOLDER.'/languages' );
|
50 |
}
|
51 |
|
|
|
|
|
|
|
52 |
include( 'admin/admin-ui.php' );
|
53 |
include( 'admin/admin-interface.php' );
|
54 |
|
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: 1.8.5
|
6 |
Author: a3rev Software
|
7 |
Author URI: https://a3rev.com/
|
8 |
Requires at least: 4.0
|
30 |
define('A3_LAZY_LOAD_IMAGES_URL', A3_LAZY_LOAD_URL . '/assets/images');
|
31 |
|
32 |
define( 'A3_LAZY_LOAD_KEY', 'a3_lazy_load' );
|
33 |
+
define( 'A3_LAZY_VERSION', '1.8.5' );
|
34 |
|
35 |
/**
|
36 |
* Load Localisation files.
|
49 |
load_plugin_textdomain( 'a3-lazy-load', false, A3_LAZY_LOAD_FOLDER.'/languages' );
|
50 |
}
|
51 |
|
52 |
+
// Disable for load new google font faces
|
53 |
+
add_filter( A3_LAZY_LOAD_KEY . '_new_google_fonts_enable', '__return_false' );
|
54 |
+
|
55 |
include( 'admin/admin-ui.php' );
|
56 |
include( 'admin/admin-interface.php' );
|
57 |
|
admin/admin-ui.php
CHANGED
@@ -31,12 +31,12 @@ class A3_Lazy_Load_Admin_UI
|
|
31 |
* You must change to correct plugin name that you are working
|
32 |
*/
|
33 |
|
34 |
-
public $framework_version = '2.0.
|
35 |
public $plugin_name = A3_LAZY_LOAD_KEY;
|
36 |
public $plugin_path = A3_LAZY_LOAD_NAME;
|
37 |
-
public $google_api_key_option =
|
38 |
-
public $toggle_box_open_option =
|
39 |
-
public $version_transient =
|
40 |
public $is_free_plugin = true;
|
41 |
|
42 |
public $support_url = 'https://wordpress.org/support/plugin/a3-lazy-load/';
|
@@ -70,6 +70,12 @@ class A3_Lazy_Load_Admin_UI
|
|
70 |
*/
|
71 |
public $admin_pages = array( 'a3-lazy-load', 'a3-lazy-load-add' );
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
/*-----------------------------------------------------------------------------------*/
|
75 |
/* admin_plugin_url() */
|
31 |
* You must change to correct plugin name that you are working
|
32 |
*/
|
33 |
|
34 |
+
public $framework_version = '2.0.3';
|
35 |
public $plugin_name = A3_LAZY_LOAD_KEY;
|
36 |
public $plugin_path = A3_LAZY_LOAD_NAME;
|
37 |
+
public $google_api_key_option = '';
|
38 |
+
public $toggle_box_open_option = '';
|
39 |
+
public $version_transient = '';
|
40 |
public $is_free_plugin = true;
|
41 |
|
42 |
public $support_url = 'https://wordpress.org/support/plugin/a3-lazy-load/';
|
70 |
*/
|
71 |
public $admin_pages = array( 'a3-lazy-load', 'a3-lazy-load-add' );
|
72 |
|
73 |
+
public function __construct() {
|
74 |
+
$this->google_api_key_option = A3_LAZY_LOAD_KEY . '_google_api_key';
|
75 |
+
$this->toggle_box_open_option = A3_LAZY_LOAD_KEY . '_toggle_box_open';
|
76 |
+
$this->version_transient = A3_LAZY_LOAD_KEY . '_licinfo';
|
77 |
+
}
|
78 |
+
|
79 |
|
80 |
/*-----------------------------------------------------------------------------------*/
|
81 |
/* admin_plugin_url() */
|
admin/includes/fonts_face.php
CHANGED
@@ -389,9 +389,12 @@ class A3_Lazy_Load_Fonts_Face extends A3_Lazy_Load_Admin_UI
|
|
389 |
}
|
390 |
}
|
391 |
|
392 |
-
$this->
|
393 |
-
|
394 |
-
|
|
|
|
|
|
|
395 |
|
396 |
if ( ! is_array( $google_fonts ) || count( $google_fonts ) < 1 ) {
|
397 |
$google_fonts = apply_filters( $this->plugin_name . '_google_fonts', $this->google_fonts );
|
389 |
}
|
390 |
}
|
391 |
|
392 |
+
if ( apply_filters( $this->plugin_name . '_new_google_fonts_enable', true ) ) {
|
393 |
+
$this->is_valid_google_api_key();
|
394 |
+
$google_fonts = get_option( $this->plugin_name . '_google_font_list', array() );
|
395 |
+
} else {
|
396 |
+
$google_fonts = array();
|
397 |
+
}
|
398 |
|
399 |
if ( ! is_array( $google_fonts ) || count( $google_fonts ) < 1 ) {
|
400 |
$google_fonts = apply_filters( $this->plugin_name . '_google_fonts', $this->google_fonts );
|
assets/css/loading.gif
CHANGED
Binary file
|
assets/js/jquery.lazyloadxt.js
CHANGED
@@ -331,7 +331,9 @@
|
|
331 |
$child.attr('src', isFuncSrcAttr ? srcAttr($child) : $child.attr(srcAttr));
|
332 |
});
|
333 |
// reload video
|
334 |
-
this.
|
|
|
|
|
335 |
$(this).removeClass('lazy-hidden');
|
336 |
});
|
337 |
|
331 |
$child.attr('src', isFuncSrcAttr ? srcAttr($child) : $child.attr(srcAttr));
|
332 |
});
|
333 |
// reload video
|
334 |
+
if ( typeof $(this).attr('preload') !== 'undefined' && 'none' != $(this).attr('preload') ) {
|
335 |
+
this.load();
|
336 |
+
}
|
337 |
$(this).removeClass('lazy-hidden');
|
338 |
});
|
339 |
|
assets/js/jquery.lazyloadxt.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(e,t,n,r){function w(e,t){return e[t]===r?l[t]:e[t]}function E(){var e=t.pageYOffset;return e===r?a.scrollTop:e}function S(e,t){var n=l["on"+e];if(n){if(p(n)){n.call(t[0])}else{if(n.addClass){t.addClass(n.addClass)}if(n.removeClass){t.removeClass(n.removeClass)}}}t.trigger("lazy"+e,[t]);C()}function x(t){S(t.type,e(this).off(o,x))}function T(n){if(!g.length){return}n=n||l.forceLoad;y=Infinity;var r=E(),s=t.innerHeight||a.clientHeight,u=t.innerWidth||a.clientWidth,f,c;for(f=0,c=g.length;f<c;f++){var h=g[f],d=h[0],v=h[i],b=false,w=n,T;if(!m(a,d)){b=true}else if(n||!v.visibleOnly||d.offsetWidth||d.offsetHeight){if(!w){var N=d.getBoundingClientRect(),C=v.edgeX,k=v.edgeY;T=N.top+r-k-s;w=T<=r&&N.bottom>-k&&N.left<=u+C&&N.right>-C}if(w){S("show",h);var L=v.srcAttr,A=p(L)?L(h):d.getAttribute(L);if(A){h.on(o,x);d.src=A}b=true}else{if(T<y){y=T}}}if(b){g.splice(f--,1);c--}}if(!c){S("complete",e(a))}}function N(){if(b>1){b=1;T();setTimeout(N,l.throttle)}else{b=0}}function C(e){if(!g.length){return}if(e&&e.type==="scroll"&&e.currentTarget===t){if(y>=E()){return}}if(!b){setTimeout(N,0)}b=2}function k(){h.lazyLoadXT()}function L(){T(true)}var i="lazyLoadXT",s="lazied",o="load error",u="lazy-hidden",a=n.documentElement||n.body,f=t.onscroll===r||!!t.operamini||!a.getBoundingClientRect,l={autoInit:true,selector:"img[data-src]",blankImage:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",throttle:99,forceLoad:f,loadEvent:"pageshow",updateEvent:"load orientationchange resize scroll touchmove focus",forceEvent:"",oninit:{removeClass:"lazy"},onshow:{addClass:u},onload:{removeClass:u,addClass:"lazy-loaded"},onerror:{removeClass:u},checkDuplicates:true},c={srcAttr:"data-src",edgeX:0,edgeY:0,visibleOnly:true},h=e(t),p=e.isFunction,d=e.extend,v=e.data||function(t,n){return e(t).data(n)},m=e.contains||function(e,t){while(t=t.parentNode){if(t===e){return true}}return false},g=[],y=0,b=0;e[i]=d(l,c,e[i]);e.fn[i]=function(n){n=n||{};var r=w(n,"blankImage"),o=w(n,"checkDuplicates"),u=w(n,"scrollContainer"),a={},f;e(u).on("scroll",C);for(f in c){a[f]=w(n,f)}return this.each(function(u,f){if(f===t){e(l.selector).lazyLoadXT(n)}else{if(o&&v(f,s)){return}var c=e(f).data(s,1);if(r&&f.tagName==="IMG"&&!f.src){f.src=r}c[i]=d({},a);S("init",c);g.push(c)}})};e(n).ready(function(){S("start",h);h.on(l.loadEvent,k).on(l.updateEvent,C).on(l.forceEvent,L);e(n).on(l.updateEvent,C);if(l.autoInit){k()}})})(window.jQuery||window.Zepto||window.$,window,document);(function(e){var t=e.lazyLoadXT;t.selector+=",video,iframe[data-src],embed[data-src]";t.videoPoster="data-poster";e(document).on("lazyshow","video",function(n,r){var i=r.lazyLoadXT.srcAttr,s=e.isFunction(i);r.attr("poster",r.attr(t.videoPoster)).children("source,track").each(function(t,n){var r=e(n);r.attr("src",s?i(r):r.attr(i))});this.load()
|
1 |
+
(function(e,t,n,r){function w(e,t){return e[t]===r?l[t]:e[t]}function E(){var e=t.pageYOffset;return e===r?a.scrollTop:e}function S(e,t){var n=l["on"+e];if(n){if(p(n)){n.call(t[0])}else{if(n.addClass){t.addClass(n.addClass)}if(n.removeClass){t.removeClass(n.removeClass)}}}t.trigger("lazy"+e,[t]);C()}function x(t){S(t.type,e(this).off(o,x))}function T(n){if(!g.length){return}n=n||l.forceLoad;y=Infinity;var r=E(),s=t.innerHeight||a.clientHeight,u=t.innerWidth||a.clientWidth,f,c;for(f=0,c=g.length;f<c;f++){var h=g[f],d=h[0],v=h[i],b=false,w=n,T;if(!m(a,d)){b=true}else if(n||!v.visibleOnly||d.offsetWidth||d.offsetHeight){if(!w){var N=d.getBoundingClientRect(),C=v.edgeX,k=v.edgeY;T=N.top+r-k-s;w=T<=r&&N.bottom>-k&&N.left<=u+C&&N.right>-C}if(w){S("show",h);var L=v.srcAttr,A=p(L)?L(h):d.getAttribute(L);if(A){h.on(o,x);d.src=A}b=true}else{if(T<y){y=T}}}if(b){g.splice(f--,1);c--}}if(!c){S("complete",e(a))}}function N(){if(b>1){b=1;T();setTimeout(N,l.throttle)}else{b=0}}function C(e){if(!g.length){return}if(e&&e.type==="scroll"&&e.currentTarget===t){if(y>=E()){return}}if(!b){setTimeout(N,0)}b=2}function k(){h.lazyLoadXT()}function L(){T(true)}var i="lazyLoadXT",s="lazied",o="load error",u="lazy-hidden",a=n.documentElement||n.body,f=t.onscroll===r||!!t.operamini||!a.getBoundingClientRect,l={autoInit:true,selector:"img[data-src]",blankImage:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",throttle:99,forceLoad:f,loadEvent:"pageshow",updateEvent:"load orientationchange resize scroll touchmove focus",forceEvent:"",oninit:{removeClass:"lazy"},onshow:{addClass:u},onload:{removeClass:u,addClass:"lazy-loaded"},onerror:{removeClass:u},checkDuplicates:true},c={srcAttr:"data-src",edgeX:0,edgeY:0,visibleOnly:true},h=e(t),p=e.isFunction,d=e.extend,v=e.data||function(t,n){return e(t).data(n)},m=e.contains||function(e,t){while(t=t.parentNode){if(t===e){return true}}return false},g=[],y=0,b=0;e[i]=d(l,c,e[i]);e.fn[i]=function(n){n=n||{};var r=w(n,"blankImage"),o=w(n,"checkDuplicates"),u=w(n,"scrollContainer"),a={},f;e(u).on("scroll",C);for(f in c){a[f]=w(n,f)}return this.each(function(u,f){if(f===t){e(l.selector).lazyLoadXT(n)}else{if(o&&v(f,s)){return}var c=e(f).data(s,1);if(r&&f.tagName==="IMG"&&!f.src){f.src=r}c[i]=d({},a);S("init",c);g.push(c)}})};e(n).ready(function(){S("start",h);h.on(l.loadEvent,k).on(l.updateEvent,C).on(l.forceEvent,L);e(n).on(l.updateEvent,C);if(l.autoInit){k()}})})(window.jQuery||window.Zepto||window.$,window,document);(function(e){var t=e.lazyLoadXT;t.selector+=",video,iframe[data-src],embed[data-src]";t.videoPoster="data-poster";e(document).on("lazyshow","video",function(n,r){var i=r.lazyLoadXT.srcAttr,s=e.isFunction(i);r.attr("poster",r.attr(t.videoPoster)).children("source,track").each(function(t,n){var r=e(n);r.attr("src",s?i(r):r.attr(i))});if(typeof e(this).attr('preload')!=='undefined'&&'none'!=e(this).attr('preload')){this.load()}e(this).removeClass("lazy-hidden")});e(document).on("lazyshow","embed",function(t,n){e(this).removeClass("lazy-hidden")})})(window.jQuery||window.Zepto||window.$)
|
classes/class-a3-lazy-load.php
CHANGED
@@ -44,8 +44,6 @@ class A3_Lazy_Load
|
|
44 |
}
|
45 |
|
46 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 11 );
|
47 |
-
add_action( 'wp_print_scripts', array( $this, 'localize_printed_scripts' ), 5 );
|
48 |
-
add_action( 'wp_print_footer_scripts', array( $this, 'localize_printed_scripts' ), 5 );
|
49 |
|
50 |
add_filter( 'a3_lazy_load_html', array( $this, 'filter_html' ), 10, 2 );
|
51 |
|
@@ -66,13 +64,18 @@ class A3_Lazy_Load
|
|
66 |
if ( $a3_lazy_load_global_settings['a3l_apply_to_images'] == true ) {
|
67 |
add_filter( 'a3_lazy_load_images', array( $this, 'filter_images' ), 10, 2 );
|
68 |
|
69 |
-
add_filter( 'wp_get_attachment_image_attributes', array( $this, 'get_attachment_image_attributes' ), 200 );
|
70 |
|
71 |
if ( $a3_lazy_load_global_settings['a3l_apply_image_to_content'] == true ) {
|
72 |
add_filter( 'the_content', array( $this, 'filter_content_images' ), 10 );
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
if ( $a3_lazy_load_global_settings['a3l_apply_image_to_textwidget'] == true ) {
|
75 |
-
|
|
|
76 |
}
|
77 |
if ( $a3_lazy_load_global_settings['a3l_apply_image_to_postthumbnails'] == true ) {
|
78 |
add_filter( 'post_thumbnail_html', array( $this, 'filter_images' ), 200 );
|
@@ -88,9 +91,9 @@ class A3_Lazy_Load
|
|
88 |
$this->_skip_videos_classes = array_map( 'trim', explode( ',', $skip_videos_classes ) );
|
89 |
}
|
90 |
if ( is_array( $this->_skip_videos_classes ) ) {
|
91 |
-
$this->_skip_videos_classes = array_merge( array('a3-notlazy'), $this->_skip_videos_classes );
|
92 |
} else {
|
93 |
-
$this->_skip_videos_classes = array('a3-notlazy');
|
94 |
}
|
95 |
|
96 |
if ( $a3_lazy_load_global_settings['a3l_apply_to_videos'] == true ) {
|
@@ -98,9 +101,13 @@ class A3_Lazy_Load
|
|
98 |
|
99 |
if ( $a3_lazy_load_global_settings['a3l_apply_video_to_content'] == true ) {
|
100 |
add_filter( 'the_content', array( $this, 'filter_videos' ), 10 );
|
|
|
|
|
|
|
101 |
}
|
102 |
if ( $a3_lazy_load_global_settings['a3l_apply_video_to_textwidget'] == true ) {
|
103 |
-
|
|
|
104 |
}
|
105 |
}
|
106 |
}
|
@@ -151,6 +158,10 @@ class A3_Lazy_Load
|
|
151 |
|
152 |
wp_enqueue_script( 'jquery-lazyloadxt-extend' );
|
153 |
|
|
|
|
|
|
|
|
|
154 |
do_action('after_a3_lazy_load_xt_script');
|
155 |
}
|
156 |
|
@@ -267,6 +278,20 @@ class A3_Lazy_Load
|
|
267 |
return $content;
|
268 |
}
|
269 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
static function filter_content_images( $content ) {
|
271 |
$A3_Lazy_Load = A3_Lazy_Load::_instance();
|
272 |
|
@@ -386,6 +411,20 @@ class A3_Lazy_Load
|
|
386 |
return $content;
|
387 |
}
|
388 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
protected function _filter_videos( $content, $include_noscript = null ) {
|
390 |
|
391 |
if ( null === $include_noscript ) {
|
@@ -417,7 +456,7 @@ class A3_Lazy_Load
|
|
417 |
$i++;
|
418 |
// replace the src and add the data-src attribute
|
419 |
$replaceHTML = '';
|
420 |
-
$replaceHTML = preg_replace( '/iframe(.*?)src=/is', 'iframe$
|
421 |
|
422 |
// add the lazy class to the img element
|
423 |
if ( preg_match( '/class=["\']/i', $replaceHTML ) ) {
|
44 |
}
|
45 |
|
46 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 11 );
|
|
|
|
|
47 |
|
48 |
add_filter( 'a3_lazy_load_html', array( $this, 'filter_html' ), 10, 2 );
|
49 |
|
64 |
if ( $a3_lazy_load_global_settings['a3l_apply_to_images'] == true ) {
|
65 |
add_filter( 'a3_lazy_load_images', array( $this, 'filter_images' ), 10, 2 );
|
66 |
|
67 |
+
//add_filter( 'wp_get_attachment_image_attributes', array( $this, 'get_attachment_image_attributes' ), 200 );
|
68 |
|
69 |
if ( $a3_lazy_load_global_settings['a3l_apply_image_to_content'] == true ) {
|
70 |
add_filter( 'the_content', array( $this, 'filter_content_images' ), 10 );
|
71 |
+
|
72 |
+
// Compatibility with ACF plugin - Thank you ondoheer https://github.com/ondoheer
|
73 |
+
add_filter( 'acf_the_content', array( $this, 'filter_content_images' ), 10 );
|
74 |
+
|
75 |
}
|
76 |
if ( $a3_lazy_load_global_settings['a3l_apply_image_to_textwidget'] == true ) {
|
77 |
+
add_action( 'dynamic_sidebar_before', array( $this, 'sidebar_before_filter_images' ), 0 );
|
78 |
+
add_action( 'dynamic_sidebar_after', array( $this, 'sidebar_after_filter_images' ), 1000 );
|
79 |
}
|
80 |
if ( $a3_lazy_load_global_settings['a3l_apply_image_to_postthumbnails'] == true ) {
|
81 |
add_filter( 'post_thumbnail_html', array( $this, 'filter_images' ), 200 );
|
91 |
$this->_skip_videos_classes = array_map( 'trim', explode( ',', $skip_videos_classes ) );
|
92 |
}
|
93 |
if ( is_array( $this->_skip_videos_classes ) ) {
|
94 |
+
$this->_skip_videos_classes = array_merge( array('a3-notlazy', 'wp-video-shortcode'), $this->_skip_videos_classes );
|
95 |
} else {
|
96 |
+
$this->_skip_videos_classes = array('a3-notlazy','wp-video-shortcode');
|
97 |
}
|
98 |
|
99 |
if ( $a3_lazy_load_global_settings['a3l_apply_to_videos'] == true ) {
|
101 |
|
102 |
if ( $a3_lazy_load_global_settings['a3l_apply_video_to_content'] == true ) {
|
103 |
add_filter( 'the_content', array( $this, 'filter_videos' ), 10 );
|
104 |
+
|
105 |
+
// Compatibility with ACF plugin - Thank you ondoheer https://github.com/ondoheer
|
106 |
+
add_filter( 'acf_the_content', array( $this, 'filter_videos' ), 10 );
|
107 |
}
|
108 |
if ( $a3_lazy_load_global_settings['a3l_apply_video_to_textwidget'] == true ) {
|
109 |
+
add_action( 'dynamic_sidebar_before', array( $this, 'sidebar_before_filter_videos' ), 0 );
|
110 |
+
add_action( 'dynamic_sidebar_after', array( $this, 'sidebar_after_filter_videos' ), 1000 );
|
111 |
}
|
112 |
}
|
113 |
}
|
158 |
|
159 |
wp_enqueue_script( 'jquery-lazyloadxt-extend' );
|
160 |
|
161 |
+
$A3_Lazy_Load = A3_Lazy_Load::_instance();
|
162 |
+
|
163 |
+
$A3_Lazy_Load->localize_printed_scripts();
|
164 |
+
|
165 |
do_action('after_a3_lazy_load_xt_script');
|
166 |
}
|
167 |
|
278 |
return $content;
|
279 |
}
|
280 |
|
281 |
+
static function sidebar_before_filter_images() {
|
282 |
+
ob_start();
|
283 |
+
}
|
284 |
+
|
285 |
+
static function sidebar_after_filter_images() {
|
286 |
+
$content = ob_get_clean();
|
287 |
+
|
288 |
+
$A3_Lazy_Load = A3_Lazy_Load::_instance();
|
289 |
+
|
290 |
+
echo $A3_Lazy_Load->filter_images( $content );
|
291 |
+
|
292 |
+
unset( $content );
|
293 |
+
}
|
294 |
+
|
295 |
static function filter_content_images( $content ) {
|
296 |
$A3_Lazy_Load = A3_Lazy_Load::_instance();
|
297 |
|
411 |
return $content;
|
412 |
}
|
413 |
|
414 |
+
static function sidebar_before_filter_videos() {
|
415 |
+
ob_start();
|
416 |
+
}
|
417 |
+
|
418 |
+
static function sidebar_after_filter_videos() {
|
419 |
+
$content = ob_get_clean();
|
420 |
+
|
421 |
+
$A3_Lazy_Load = A3_Lazy_Load::_instance();
|
422 |
+
|
423 |
+
echo $A3_Lazy_Load->filter_videos( $content );
|
424 |
+
|
425 |
+
unset( $content );
|
426 |
+
}
|
427 |
+
|
428 |
protected function _filter_videos( $content, $include_noscript = null ) {
|
429 |
|
430 |
if ( null === $include_noscript ) {
|
456 |
$i++;
|
457 |
// replace the src and add the data-src attribute
|
458 |
$replaceHTML = '';
|
459 |
+
$replaceHTML = preg_replace( '/iframe(.*?)src=/is', 'iframe$1 data-lazy-type="iframe" data-src=', $imgHTML );
|
460 |
|
461 |
// add the lazy class to the img element
|
462 |
if ( preg_match( '/class=["\']/i', $replaceHTML ) ) {
|
readme.txt
CHANGED
@@ -3,11 +3,11 @@ Contributors: a3rev, a3rev Software, nguyencongtuan
|
|
3 |
Tags: a3 lazy load, Lazy Loading , image lazy load, lazyload
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 4.9.4
|
6 |
-
Stable tag: 1.8.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
10 |
-
Use a3 Lazy Load for images, videos, iframes. Instantly improve your sites load time and dramatically improve site
|
11 |
|
12 |
== DESCRIPTION ==
|
13 |
|
@@ -21,7 +21,7 @@ a3 Lazy Load is the most fully featured, incredibly easy to set up lazy load plu
|
|
21 |
|
22 |
Images are the number one element that slows page load and increases bandwidth use. From the a3 Lazy Load admin panel turn load images by a3 Lazy Load ON | OFF. For more flexibility when ON you can choose to ON | OFF lazy load for images in
|
23 |
|
24 |
-
* Post and
|
25 |
* Widgets (Sidebar, header and footer)
|
26 |
* Apply to post thumbnails
|
27 |
* Apply to gravatars
|
@@ -30,19 +30,21 @@ Images are the number one element that slows page load and increases bandwidth u
|
|
30 |
|
31 |
= VIDEO LAZY LOAD =
|
32 |
|
33 |
-
a3 Lazy Load supports all WordPress video Embeds including Youtube, Vimeo and HTML5 video - for a full list see the [WordPress Codex Embeds](http://codex.wordpress.org/Embeds) list. The WordPress embed method of copying and pasting the video url into posts and pages content area is fully supported.
|
|
|
|
|
34 |
|
35 |
From the a3 lazy Load admin panel turn Video Support ON | OFF. When ON you can choose to ON | OFF lazy load for videos in
|
36 |
|
37 |
-
* Post and Pages (All Content areas)
|
38 |
-
*
|
39 |
* Youtube [see demo](http://ressio.github.io/lazy-load-xt/demo/youtube-iframe.htm)
|
40 |
* Video [see demo](http://ressio.github.io/lazy-load-xt/demo/video-html5.htm)
|
41 |
* Fully Compatible with the popular [Youtube Embed Plugin](https://wordpress.org/plugins/youtube-embed/)
|
42 |
|
43 |
= iFRAME LAZY LOAD =
|
44 |
|
45 |
-
a3 Lazy Load has built in support for content that is added by iframe from any source in content and widgets
|
46 |
|
47 |
* WordPress embedded media
|
48 |
* Facebook Like boxes with profiles, Like buttons, Recommend
|
@@ -59,7 +61,11 @@ a3 Lazy Load has built in support for content that is added by iframe from any s
|
|
59 |
* Built in auto support for WordPress AMP plugin
|
60 |
* Built in support for Better AMP plugin
|
61 |
* There are no setting options for exclude /amp - Lazy Load is just never applied to the /amp endpoint
|
62 |
-
* When the url is loaded in browser without /amp Lazy Load is applied
|
|
|
|
|
|
|
|
|
63 |
|
64 |
= LAZY LOAD EFFECTS =
|
65 |
|
@@ -82,22 +88,32 @@ a3 Lazy Load gives you the option to load its script from your sites HEAD or fro
|
|
82 |
|
83 |
= EXCLUDE IMAGES & VIDEO =
|
84 |
|
85 |
-
a3 Lazy Load allows you to easily exclude any
|
86 |
|
87 |
= JAVASCIPT DISABLED FALLBACK =
|
88 |
|
89 |
a3 Lazy Load has built in Noscript fallback if user has JavaScript turned off in their browser. Developers who use underscore.js in their applications can use the Noscript parameter to exclude their plugins content from Lazy Load.
|
90 |
|
91 |
-
= PLUGIN COMPATIBILITY =
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
*
|
96 |
-
*
|
97 |
-
* Plugin
|
98 |
-
*
|
99 |
-
*
|
100 |
-
*
|
|
|
|
|
|
|
|
|
101 |
|
102 |
= MORE FEATURES =
|
103 |
|
@@ -108,9 +124,10 @@ a3 Lazy Load has built in Noscript fallback if user has JavaScript turned off in
|
|
108 |
|
109 |
= JOIN THE a3 LAZY LOAD COMMUNITY =
|
110 |
|
111 |
-
When you download a3 lazy Load, you join our community. Regardless of if you are a WordPress newbie or experienced developer if you
|
112 |
Want to add a new language to a3 Lazy Load? Great! You can contribute via [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/a3-lazy-load)
|
113 |
|
|
|
114 |
== Installation ==
|
115 |
|
116 |
= Minimum Requirements =
|
@@ -119,6 +136,47 @@ Want to add a new language to a3 Lazy Load? Great! You can contribute via [trans
|
|
119 |
* PHP version 5.6.0 or greater
|
120 |
* MySQL version 5.6 or greater OR MariaDB version 10.0 or greater
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
== SCREENSHOTS ==
|
123 |
|
124 |
1. a3 lazy Load Dashboard
|
@@ -136,6 +194,22 @@ Want to add a new language to a3 Lazy Load? Great! You can contribute via [trans
|
|
136 |
|
137 |
== Changelog ==
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
= 1.8.4 - 2018/02/13 =
|
140 |
* Maintenance Update. Under the bonnet tweaks to keep your plugin running smoothly and is the foundation for new features to be developed this year
|
141 |
* Framework - Update a3rev Plugin Framework to version 2.0.2
|
@@ -154,18 +228,18 @@ Want to add a new language to a3 Lazy Load? Great! You can contribute via [trans
|
|
154 |
* Fix - WordPress Admin Tool Bar User Avatar conflict Issue #2
|
155 |
|
156 |
= 1.8.1 - 2017/05/31 =
|
157 |
-
* Fix - Use correct object A3_Lazy_Load instead of
|
158 |
|
159 |
= 1.8.0 - 2017/05/30 =
|
160 |
-
* Feature
|
161 |
-
* Feature
|
162 |
-
* Feature
|
163 |
* Tweak - Change global $$variable to global ${$variable} for compatibility with PHP 7.0
|
164 |
* Tweak - Update a3 Revolution to a3rev Software on plugins description
|
165 |
* Tweak - Update plugin framework to latest version
|
166 |
* Tweak - Tested for full compatibility with WordPress version 4.7.5
|
167 |
* Tweak - Tested for full compatibility with PHP 7.0
|
168 |
-
* Fix
|
169 |
|
170 |
= 1.7.1 =
|
171 |
* Tweak - Register fontawesome in plugin framework with style name is 'font-awesome-styles'
|
@@ -293,6 +367,9 @@ Want to add a new language to a3 Lazy Load? Great! You can contribute via [trans
|
|
293 |
|
294 |
== Upgrade Notice ==
|
295 |
|
|
|
|
|
|
|
296 |
= 1.8.4 =
|
297 |
Maintenance Update. This version updates the Plugin Framework to v 2.0.2, adds full compatibility with a3rev dashboard and WordPress v 4.9.4
|
298 |
|
3 |
Tags: a3 lazy load, Lazy Loading , image lazy load, lazyload
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 4.9.4
|
6 |
+
Stable tag: 1.8.5
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
10 |
+
Use a3 Lazy Load for images, videos, iframes. Instantly improve your sites load time and dramatically improve site users experience.
|
11 |
|
12 |
== DESCRIPTION ==
|
13 |
|
21 |
|
22 |
Images are the number one element that slows page load and increases bandwidth use. From the a3 Lazy Load admin panel turn load images by a3 Lazy Load ON | OFF. For more flexibility when ON you can choose to ON | OFF lazy load for images in
|
23 |
|
24 |
+
* Post, Pages and Custom Post Types (All Content areas)
|
25 |
* Widgets (Sidebar, header and footer)
|
26 |
* Apply to post thumbnails
|
27 |
* Apply to gravatars
|
30 |
|
31 |
= VIDEO LAZY LOAD =
|
32 |
|
33 |
+
a3 Lazy Load supports all WordPress video Embeds including Youtube, Vimeo and HTML5 video - for a full list see the [WordPress Codex Embeds](http://codex.wordpress.org/Embeds) list. The WordPress embed method of copying and pasting the video url into posts and pages content area is fully supported.
|
34 |
+
|
35 |
+
<strong>Note</strong> - Works with Videos added by Text and HTML Widgets but not the new WordPress Video widget. That widget does not pull iframe at first load, it use JavaScript to replace html to iframe and hence a3 lazy Load can't see it to apply.
|
36 |
|
37 |
From the a3 lazy Load admin panel turn Video Support ON | OFF. When ON you can choose to ON | OFF lazy load for videos in
|
38 |
|
39 |
+
* Video embeded by URL in Post and Pages (All Content areas)
|
40 |
+
* Video in Widget types, Text Widget and HTML Wigets.
|
41 |
* Youtube [see demo](http://ressio.github.io/lazy-load-xt/demo/youtube-iframe.htm)
|
42 |
* Video [see demo](http://ressio.github.io/lazy-load-xt/demo/video-html5.htm)
|
43 |
* Fully Compatible with the popular [Youtube Embed Plugin](https://wordpress.org/plugins/youtube-embed/)
|
44 |
|
45 |
= iFRAME LAZY LOAD =
|
46 |
|
47 |
+
a3 Lazy Load has built in support for content that is added by iframe from any source in content and widgets. Examples
|
48 |
|
49 |
* WordPress embedded media
|
50 |
* Facebook Like boxes with profiles, Like buttons, Recommend
|
61 |
* Built in auto support for WordPress AMP plugin
|
62 |
* Built in support for Better AMP plugin
|
63 |
* There are no setting options for exclude /amp - Lazy Load is just never applied to the /amp endpoint
|
64 |
+
* When the url is loaded in browser without /amp Lazy Load is applied
|
65 |
+
|
66 |
+
= ADVANCED CUSTOM FIELDS =
|
67 |
+
|
68 |
+
Fully compatible with the very popular Advanced Custom Fields plugin, Free and Premium versions.
|
69 |
|
70 |
= LAZY LOAD EFFECTS =
|
71 |
|
88 |
|
89 |
= EXCLUDE IMAGES & VIDEO =
|
90 |
|
91 |
+
a3 Lazy Load allows you to easily exclude any image or video by class name from having the Lazy Load effect applied. [See FAQ's](https://wordpress.org/plugins/a3-lazy-load/#faq-header)
|
92 |
|
93 |
= JAVASCIPT DISABLED FALLBACK =
|
94 |
|
95 |
a3 Lazy Load has built in Noscript fallback if user has JavaScript turned off in their browser. Developers who use underscore.js in their applications can use the Noscript parameter to exclude their plugins content from Lazy Load.
|
96 |
|
97 |
+
= THEME & PLUGIN COMPATIBILITY =
|
98 |
+
|
99 |
+
a3 Lazy Load works with any WordPress theme that follows the WordPress Theme Codex. However, many Theme & Plugin developers will use a custom written function to add objects, example the theme has a home page with layout created by a custom function they have written. a3 Lazy Load cannot know what these functions are and so cannot apply to the objects loaded by that custom function.
|
100 |
+
|
101 |
+
If your images or objects not being Lazy Loaded in a certain section of your site, but are Lazy Loaded everywhere else you will know this is the cause. Please if this happens raise a support ticket with the developer, explaining that they just need to add a simple tag to their custom functions so that a3 Lazy Load apply to their custom function and be fully compatible. [Here is a list](https://wordpress.org/plugins/a3-lazy-load/#faq-header) of a3 lazy Load filter tags to include in your ticket to make it easy for the developer.
|
102 |
+
|
103 |
+
Don't forget when a developer does add full compatibility with a3 Lazy Load please let us know via a support ticket on this forum and we will add them to the list below.
|
104 |
|
105 |
+
These are just some of the more popular plugins that are either tested 100% compatible with a3 Lazy Load or tags has been added for 100% compatibility.
|
106 |
+
|
107 |
+
* Plugin - Advanced Custom Fields
|
108 |
+
* Plugin - WooCommerce
|
109 |
+
* Plugin - WP Offload
|
110 |
+
* Plugin - WP Super Cache and W3 Total Cache plugins
|
111 |
+
* Plugin - Youtube Embed
|
112 |
+
* Plugin - WordPress AMP
|
113 |
+
* Plugin - WPTouch. Note - Set to not apply on Mobiles if WPTouch is installed
|
114 |
+
* Plugin - MobilePress - Set to not apply on Mobiles if MobilePress is installed
|
115 |
+
* Plugins - Will not conflict with any plugin that has lazy load built in
|
116 |
+
* CDN's - Cloudfront, Cloudflare and all other known CDN architecture.
|
117 |
|
118 |
= MORE FEATURES =
|
119 |
|
124 |
|
125 |
= JOIN THE a3 LAZY LOAD COMMUNITY =
|
126 |
|
127 |
+
When you download a3 lazy Load, you join our community. Regardless of if you are a WordPress newbie or experienced developer if you are interested in contributing to a3 Lazy Load development head over to the [a3 Lazy Load GitHub Repository](https://github.com/a3rev/a3-lazy-load) to find out how you can contribute.
|
128 |
Want to add a new language to a3 Lazy Load? Great! You can contribute via [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/a3-lazy-load)
|
129 |
|
130 |
+
|
131 |
== Installation ==
|
132 |
|
133 |
= Minimum Requirements =
|
136 |
* PHP version 5.6.0 or greater
|
137 |
* MySQL version 5.6 or greater OR MariaDB version 10.0 or greater
|
138 |
|
139 |
+
== Frequently Asked Questions ==
|
140 |
+
|
141 |
+
= How do I exclude individual objects from Lazy Load? =
|
142 |
+
|
143 |
+
Use this built in class name to exclude lazy load on individual images, videos and iframes.
|
144 |
+
<code>a3-notlazy</code>
|
145 |
+
|
146 |
+
= Why are some images, videos, objects not Lazy Loaded? =
|
147 |
+
|
148 |
+
a3 Lazy Load can only be applied to objects that are added using core WordPress functions. If your theme or a plugin developer adds objects such as images or videos via a custom written function, a3 lazy Load cannot know what that custom function is and hence cannot Lazy Load the object.
|
149 |
+
|
150 |
+
So if you see object not being lazy loaded please check first if those objects are loaded by the theme or a plugin. If they are, you can be confident that they are loaded by a custom function.
|
151 |
+
|
152 |
+
If this is the case, please help yourself and other a3 lazy Load users by raising a support ticket with the developer and ask them to add an a3 Lazy Load filter tag to their function to allow a3 Lazy Load to find it and apply to the object.
|
153 |
+
|
154 |
+
Below is a list of available a3 Lazy Load filters to use and pass onto the developer.
|
155 |
+
|
156 |
+
= Filter tags to apply lazy load =
|
157 |
+
|
158 |
+
Apply lazy load for images in content.
|
159 |
+
<code>a3_lazy_load_images</code>
|
160 |
+
Example:
|
161 |
+
<code>apply_filters( 'a3_lazy_load_images', $your_content, null );</code>
|
162 |
+
|
163 |
+
Apply lazy load for videos and iframe from content.
|
164 |
+
<code>a3_lazy_load_videos</code>
|
165 |
+
Example:
|
166 |
+
<code>apply_filters( 'a3_lazy_load_videos', $your_content, null );</code>
|
167 |
+
|
168 |
+
Apply lazy load for all images, videos and iframe from content
|
169 |
+
<code>a3_lazy_load_html</code>
|
170 |
+
Example:
|
171 |
+
<code>apply_filters( 'a3_lazy_load_html', $your_content, null );</code>
|
172 |
+
|
173 |
+
= Filter Tags to Exclude by Theme Class name =
|
174 |
+
|
175 |
+
Filter tags to add to class name of theme to exclude lazy load on images or videos.
|
176 |
+
<code>a3_lazy_load_skip_images_classes</code>
|
177 |
+
<code>a3_lazy_load_skip_videos_classes</code>
|
178 |
+
|
179 |
+
|
180 |
== SCREENSHOTS ==
|
181 |
|
182 |
1. a3 lazy Load Dashboard
|
194 |
|
195 |
== Changelog ==
|
196 |
|
197 |
+
= 1.8.5 - 2018/03/23 =
|
198 |
+
* Maintenance Update. Refactor of Lazy Load on Widgets, Full Compatibility with the Advanced Custom Fields plugin, optimization tweaks and 3 bug fixes.
|
199 |
+
* Refactor - Apply lazy load to all widgets instead of Text Widget and HTML widget from WordPress
|
200 |
+
* Refactor - Remove the code that hook to tag 'wp_get_attachment_image_attributes' which was required to add support for lazy load for [gallery] shortcode. Redundant after WP version 4.6.0 and now removed.
|
201 |
+
* Tweak - Add filter to acf_the_content tag for apply lazy load on the Content from ACF plugin. Kudos to @ondoheer for creating full compatibility with ACF Free and Premium version.
|
202 |
+
* Tweak - Disable load new google fonts via API. Google fonts not used and saves 4 calls to database on each page load. Thanks to Robert Harm for reporting the issue
|
203 |
+
* Tweak - Optimized loading gif compression for even faster load. Thanks @jasom for the suggestion
|
204 |
+
* Tweak - Remove duplicate parameters from plugin scripts. Thanks to @galbaras for reporting the issue
|
205 |
+
* Tweak - Add new FAQs tab to plugins page with Add Lazy Load Tags to custom Function description and exclude Lazy Load Class name for easy reference.
|
206 |
+
* Tweak - Update plugins description
|
207 |
+
* Framework - Define filter tag for enable OR disable load new google fonts via API
|
208 |
+
* Framework - Update plugin framework to new version 2.0.3
|
209 |
+
* Fix - Turn Image in Widget OFF option which had stopped working. Thanks to @japenz and @dimitar-koev for reporting and confirming the bug
|
210 |
+
* Fix - If videos embed have preload=none do not call video load from a3 Lazy Load. Thanks to Celso Azevedo @celsoazevedo for an excellent bug report which enabled us to replicate the issue.
|
211 |
+
* Fix - Remove src with placeholder image url for iframe
|
212 |
+
|
213 |
= 1.8.4 - 2018/02/13 =
|
214 |
* Maintenance Update. Under the bonnet tweaks to keep your plugin running smoothly and is the foundation for new features to be developed this year
|
215 |
* Framework - Update a3rev Plugin Framework to version 2.0.2
|
228 |
* Fix - WordPress Admin Tool Bar User Avatar conflict Issue #2
|
229 |
|
230 |
= 1.8.1 - 2017/05/31 =
|
231 |
+
* Fix - Use correct object A3_Lazy_Load instead of 'this' as it was causing a fatal error
|
232 |
|
233 |
= 1.8.0 - 2017/05/30 =
|
234 |
+
* Feature - Updated for compatibility with Better AMP plugin
|
235 |
+
* Feature - Launched a3Lazy Load Github public Repository
|
236 |
+
* Feature - WordPress Translation activation. Add text domain declaration in file header.
|
237 |
* Tweak - Change global $$variable to global ${$variable} for compatibility with PHP 7.0
|
238 |
* Tweak - Update a3 Revolution to a3rev Software on plugins description
|
239 |
* Tweak - Update plugin framework to latest version
|
240 |
* Tweak - Tested for full compatibility with WordPress version 4.7.5
|
241 |
* Tweak - Tested for full compatibility with PHP 7.0
|
242 |
+
* Fix - Exclude images by class
|
243 |
|
244 |
= 1.7.1 =
|
245 |
* Tweak - Register fontawesome in plugin framework with style name is 'font-awesome-styles'
|
367 |
|
368 |
== Upgrade Notice ==
|
369 |
|
370 |
+
= 1.8.5 =
|
371 |
+
Maintenance Update. Refactor of Lazy Load on Widgets, Full Compatibility with the Advanced Custom Fields plugin, optimization tweaks and 3 bug fixes.
|
372 |
+
|
373 |
= 1.8.4 =
|
374 |
Maintenance Update. This version updates the Plugin Framework to v 2.0.2, adds full compatibility with a3rev dashboard and WordPress v 4.9.4
|
375 |
|