a3 Lazy Load - Version 1.0.2

Version Description

Upgrade now for an a3 Portfolio plugin compatibility code tweak and a new Dev parameter and exclude class.

Download this release

Release Info

Developer a3rev
Plugin Icon 128x128 a3 Lazy Load
Version 1.0.2
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.2

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.0.1
6
  Author: a3 Revolution
7
  Author URI: http://www.a3rev.com/
8
  Requires at least: 3.8
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.0.2
6
  Author: a3 Revolution
7
  Author URI: http://www.a3rev.com/
8
  Requires at least: 3.8
admin/a3-lazy-load-admin.php CHANGED
@@ -2,7 +2,7 @@
2
  update_option('a3rev_lazy_load_plugin', 'a3_lazy_load');
3
 
4
  function a3_lazy_load_activated(){
5
- update_option('a3_lazy_load_version', '1.0.1');
6
 
7
  // Set Settings Default from Admin Init
8
  global $a3_lazy_load_admin_init;
@@ -25,7 +25,7 @@ function a3_lazy_load_init() {
25
 
26
  load_plugin_textdomain( 'a3_lazy_load', false, A3_LAZY_LOAD_FOLDER.'/languages' );
27
 
28
- update_option('a3_lazy_load_version', '1.0.1');
29
  }
30
 
31
  global $a3_lazy_load_admin_init;
2
  update_option('a3rev_lazy_load_plugin', 'a3_lazy_load');
3
 
4
  function a3_lazy_load_activated(){
5
+ update_option('a3_lazy_load_version', '1.0.2');
6
 
7
  // Set Settings Default from Admin Init
8
  global $a3_lazy_load_admin_init;
25
 
26
  load_plugin_textdomain( 'a3_lazy_load', false, A3_LAZY_LOAD_FOLDER.'/languages' );
27
 
28
+ update_option('a3_lazy_load_version', '1.0.2');
29
  }
30
 
31
  global $a3_lazy_load_admin_init;
classes/class-a3-lazy-load.php CHANGED
@@ -37,15 +37,20 @@ class A3_Lazy_Load
37
  return;
38
  }
39
 
40
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
41
 
42
- add_filter( 'a3_lazy_load_html', array( $this, 'filter' ), 10, 1 );
43
- add_filter( 'a3_lazy_load_images', array( $this, 'filter' ), 10, 1 );
44
 
45
  $skip_classes = apply_filters( 'a3_lazy_load_skip_classes', $a3_lazy_load_global_settings['a3l_skip_image_with_class'] );
46
  if ( strlen( trim( $skip_classes ) ) ) {
47
  $this->_skip_classes = array_map( 'trim', explode( ',', $skip_classes ) );
48
  }
 
 
 
 
 
49
 
50
  $this->_placeholder_url = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
51
 
@@ -98,6 +103,7 @@ class A3_Lazy_Load
98
  }
99
 
100
  do_action('before_a3_lazy_load_xt_script');
 
101
  wp_enqueue_script( 'jquery-lazyloadxt', apply_filters( 'a3_lazy_load_main_script', A3_LAZY_LOAD_JS_URL.'/jquery.lazyloadxt'.$suffix.'.js' ), array( 'jquery' ), self::version, $in_footer );
102
  do_action('after_a3_lazy_load_xt_script');
103
  }
@@ -161,7 +167,7 @@ class A3_Lazy_Load
161
  return $attr;
162
  }
163
 
164
- static function filter( $content ) {
165
  if( is_admin() ){
166
  return $content;
167
  }
@@ -178,7 +184,7 @@ class A3_Lazy_Load
178
 
179
  $content = apply_filters( 'a3_lazy_load_images_before', $content );
180
 
181
- $content = $A3_Lazy_Load->_filter_images( $content );
182
 
183
  $content = apply_filters( 'a3_lazy_load_images_after', $content );
184
 
@@ -203,7 +209,7 @@ class A3_Lazy_Load
203
  return $content;
204
  }
205
 
206
- protected function _filter_images( $content ) {
207
 
208
  $matches = array();
209
  preg_match_all( '/<img[\s\r\n]+.*?>/is', $content, $matches );
@@ -233,7 +239,9 @@ class A3_Lazy_Load
233
  $replaceHTML = preg_replace( '/<img/is', '<img class="lazy lazy-hidden"', $replaceHTML );
234
  }
235
 
236
- $replaceHTML .= '<noscript>' . $imgHTML . '</noscript>';
 
 
237
 
238
  array_push( $search, $imgHTML );
239
  array_push( $replace, $replaceHTML );
@@ -279,4 +287,4 @@ class A3_Lazy_Load
279
  }
280
 
281
  add_action( 'wp', create_function('', 'if ( ! is_feed() ) { A3_Lazy_Load::_instance(); }'), 10, 0 );
282
- ?>
37
  return;
38
  }
39
 
40
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 11 );
41
 
42
+ add_filter( 'a3_lazy_load_html', array( $this, 'filter' ), 10, 2 );
43
+ add_filter( 'a3_lazy_load_images', array( $this, 'filter' ), 10, 2 );
44
 
45
  $skip_classes = apply_filters( 'a3_lazy_load_skip_classes', $a3_lazy_load_global_settings['a3l_skip_image_with_class'] );
46
  if ( strlen( trim( $skip_classes ) ) ) {
47
  $this->_skip_classes = array_map( 'trim', explode( ',', $skip_classes ) );
48
  }
49
+ if ( is_array( $this->_skip_classes ) ) {
50
+ $this->_skip_classes = array_merge( array('a3-notlazy'), $this->_skip_classes );
51
+ } else {
52
+ $this->_skip_classes = array('a3-notlazy');
53
+ }
54
 
55
  $this->_placeholder_url = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
56
 
103
  }
104
 
105
  do_action('before_a3_lazy_load_xt_script');
106
+ wp_deregister_script( 'jquery-lazyloadxt' );
107
  wp_enqueue_script( 'jquery-lazyloadxt', apply_filters( 'a3_lazy_load_main_script', A3_LAZY_LOAD_JS_URL.'/jquery.lazyloadxt'.$suffix.'.js' ), array( 'jquery' ), self::version, $in_footer );
108
  do_action('after_a3_lazy_load_xt_script');
109
  }
167
  return $attr;
168
  }
169
 
170
+ static function filter( $content, $noscript = true ) {
171
  if( is_admin() ){
172
  return $content;
173
  }
184
 
185
  $content = apply_filters( 'a3_lazy_load_images_before', $content );
186
 
187
+ $content = $A3_Lazy_Load->_filter_images( $content, $noscript );
188
 
189
  $content = apply_filters( 'a3_lazy_load_images_after', $content );
190
 
209
  return $content;
210
  }
211
 
212
+ protected function _filter_images( $content, $noscript ) {
213
 
214
  $matches = array();
215
  preg_match_all( '/<img[\s\r\n]+.*?>/is', $content, $matches );
239
  $replaceHTML = preg_replace( '/<img/is', '<img class="lazy lazy-hidden"', $replaceHTML );
240
  }
241
 
242
+ if( $noscript ){
243
+ $replaceHTML .= '<noscript>' . $imgHTML . '</noscript>';
244
+ }
245
 
246
  array_push( $search, $imgHTML );
247
  array_push( $replace, $replaceHTML );
287
  }
288
 
289
  add_action( 'wp', create_function('', 'if ( ! is_feed() ) { A3_Lazy_Load::_instance(); }'), 10, 0 );
290
+ ?>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: a3rev, A3 Revolution Software Development team
4
  Tags: a3 lazy load, Lazy Loading , image lazy load, lazyload
5
  Requires at least: 4.0
6
  Tested up to: 4.1.0
7
- Stable tag: 1.0.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -116,6 +116,11 @@ Automatic installation is the easiest option as WordPress handles the file trans
116
 
117
  == Changelog ==
118
 
 
 
 
 
 
119
  = 1.0.1 - 2014/12/23 =
120
  * Tweak - Applied lazy load for 'wp_get_attachment_image_attributes' filter tag for WordPress default [gallery] shortcode
121
  * Tweak - Added link to a3 Lazy Load wordpress.org support forum on plugins description that show on plugins menu
@@ -129,5 +134,8 @@ Automatic installation is the easiest option as WordPress handles the file trans
129
 
130
  == Update Notice ==
131
 
 
 
 
132
  = 1.0.1 =
133
  Upgrade your plugin now for apply lazy load to shortcodes fix plus plus a new developer function and class.
4
  Tags: a3 lazy load, Lazy Loading , image lazy load, lazyload
5
  Requires at least: 4.0
6
  Tested up to: 4.1.0
7
+ Stable tag: 1.0.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
116
 
117
  == Changelog ==
118
 
119
+ = 1.0.2 - 2015/01/20 =
120
+ * Tweak - Include wp_deregister_script( 'jquery-lazyloadxt' ) before wp_enqueue_script( 'jquery-lazyloadxt' ) for compatibility with a3 Portfolio plugin which supports video slides
121
+ * Dev - Add new parameter $noscript boolen type for 'a3_lazy_load_html' and 'a3_lazy_load_images' filters to exclude or include noscript from content return of 3rd party plugins.
122
+ * Dev - Added default exclude class 'a3-notlazy' so developers can easily apply it to images that they don't want Lazy Load to apply to.
123
+
124
  = 1.0.1 - 2014/12/23 =
125
  * Tweak - Applied lazy load for 'wp_get_attachment_image_attributes' filter tag for WordPress default [gallery] shortcode
126
  * Tweak - Added link to a3 Lazy Load wordpress.org support forum on plugins description that show on plugins menu
134
 
135
  == Update Notice ==
136
 
137
+ = 1.0.2 =
138
+ Upgrade now for an a3 Portfolio plugin compatibility code tweak and a new Dev parameter and exclude class.
139
+
140
  = 1.0.1 =
141
  Upgrade your plugin now for apply lazy load to shortcodes fix plus plus a new developer function and class.