a3 Lazy Load - Version 1.1.0

Version Description

Major version release. Added support for WordPress Embeds - Youtube, Vimeo, HTML5 video and iframe content from all sources.

Download this release

Release Info

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

Code changes from version 1.0.2 to 1.1.0

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.2
6
  Author: a3 Revolution
7
  Author URI: http://www.a3rev.com/
8
  Requires at least: 3.8
@@ -17,7 +17,7 @@ License: GPLv2 or later
17
  */
18
  ?>
19
  <?php
20
- define('A3_LAZY_VERSION', '1.0.1');
21
  define('A3_LAZY_LOAD_FILE_PATH', dirname(__FILE__));
22
  define('A3_LAZY_LOAD_DIR_NAME', basename(A3_LAZY_LOAD_FILE_PATH));
23
  define('A3_LAZY_LOAD_FOLDER', dirname(plugin_basename(__FILE__)));
@@ -44,15 +44,25 @@ include( 'classes/class-a3-lazy-load-filter.php' );
44
  include( 'admin/a3-lazy-load-admin.php' );
45
 
46
  // Defined this function for check Lazy Load is enabled that 3rd party plugins or theme can use to check
47
- $a3_lazy_load_global_settings = get_option( 'a3_lazy_load_global_settings', array( 'a3l_apply_to_loadimages' => 1 ) );
48
- if ( 1 == $a3_lazy_load_global_settings['a3l_apply_to_loadimages'] ) {
49
  function a3_lazy_load_enable() {
50
  return true;
51
  }
52
  }
 
 
 
 
 
 
 
 
 
 
53
 
54
  /**
55
  * Call when the plugin is activated
56
  */
57
  register_activation_hook(__FILE__, 'a3_lazy_load_activated');
58
- ?>
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.1.0
6
  Author: a3 Revolution
7
  Author URI: http://www.a3rev.com/
8
  Requires at least: 3.8
17
  */
18
  ?>
19
  <?php
20
+ define('A3_LAZY_VERSION', '1.1.0');
21
  define('A3_LAZY_LOAD_FILE_PATH', dirname(__FILE__));
22
  define('A3_LAZY_LOAD_DIR_NAME', basename(A3_LAZY_LOAD_FILE_PATH));
23
  define('A3_LAZY_LOAD_FOLDER', dirname(plugin_basename(__FILE__)));
44
  include( 'admin/a3-lazy-load-admin.php' );
45
 
46
  // Defined this function for check Lazy Load is enabled that 3rd party plugins or theme can use to check
47
+ $a3_lazy_load_global_settings = get_option( 'a3_lazy_load_global_settings', array( 'a3l_apply_lazyloadxt' => 1, 'a3l_apply_to_images' => 1, 'a3l_apply_to_videos' => 1 ) );
48
+ if ( 1 == $a3_lazy_load_global_settings['a3l_apply_lazyloadxt'] && !is_admin() && ( 1 == $a3_lazy_load_global_settings['a3l_apply_to_images'] || 1 == $a3_lazy_load_global_settings['a3l_apply_to_videos'] ) ) {
49
  function a3_lazy_load_enable() {
50
  return true;
51
  }
52
  }
53
+ if ( 1 == $a3_lazy_load_global_settings['a3l_apply_lazyloadxt'] && !is_admin() && 1 == $a3_lazy_load_global_settings['a3l_apply_to_images'] ) {
54
+ function a3_lazy_load_image_enable() {
55
+ return true;
56
+ }
57
+ }
58
+ if ( 1 == $a3_lazy_load_global_settings['a3l_apply_lazyloadxt'] && !is_admin() && 1 == $a3_lazy_load_global_settings['a3l_apply_to_videos'] ) {
59
+ function a3_lazy_load_video_enable() {
60
+ return true;
61
+ }
62
+ }
63
 
64
  /**
65
  * Call when the plugin is activated
66
  */
67
  register_activation_hook(__FILE__, 'a3_lazy_load_activated');
68
+ ?>
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.2');
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.2');
29
  }
30
 
31
  global $a3_lazy_load_admin_init;
@@ -42,4 +42,15 @@ add_filter( 'plugin_row_meta', array( 'A3_Lazy_Load_Hook_Filter', 'plugin_extra_
42
 
43
  // Add admin sidebar menu css
44
  add_action( 'admin_enqueue_scripts', array( 'A3_Lazy_Load_Hook_Filter', 'admin_sidebar_menu_css' ) );
 
 
 
 
 
 
 
 
 
 
 
45
  ?>
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.1.0');
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
+ a3_lazy_load_upgrade_plugin();
29
  }
30
 
31
  global $a3_lazy_load_admin_init;
42
 
43
  // Add admin sidebar menu css
44
  add_action( 'admin_enqueue_scripts', array( 'A3_Lazy_Load_Hook_Filter', 'admin_sidebar_menu_css' ) );
45
+
46
+ // Check upgrade functions
47
+ function a3_lazy_load_upgrade_plugin() {
48
+
49
+ if (version_compare(get_option('a3_lazy_load_version'), '1.1.0') === -1) {
50
+ include( A3_LAZY_LOAD_DIR. '/includes/updates/a3-lazy-load-update-1.1.0.php' );
51
+ update_option('a3_lazy_load_version', '1.1.0');
52
+ }
53
+
54
+ update_option('a3_lazy_load_version', '1.1.0');
55
+ }
56
  ?>
admin/settings/template-settings/global-settings.php CHANGED
@@ -89,6 +89,12 @@ class A3_Lazy_Load_Global_Settings extends A3_Lazy_Load_Admin_UI
89
 
90
  add_action( $this->plugin_name . '_get_all_settings' , array( $this, 'get_settings' ) );
91
 
 
 
 
 
 
 
92
  }
93
 
94
  /*-----------------------------------------------------------------------------------*/
@@ -181,11 +187,10 @@ class A3_Lazy_Load_Global_Settings extends A3_Lazy_Load_Admin_UI
181
  array(
182
  'type' => 'heading',
183
  ),
184
-
185
  array(
186
  'name' => __( 'Enable Lazy Load', 'a3_lazy_load' ),
187
- 'id' => 'a3l_apply_to_loadimages',
188
- 'class' => 'a3l_apply_to_loadimages',
189
  'type' => 'onoff_checkbox',
190
  'default' => true,
191
  'checked_value' => true,
@@ -195,16 +200,20 @@ class A3_Lazy_Load_Global_Settings extends A3_Lazy_Load_Admin_UI
195
  ),
196
 
197
  array(
198
- 'name' => __( 'Apply For Objects', 'a3_lazy_load' ),
199
  'type' => 'heading',
200
- 'class' => 'a3l_apply_to_loadimages_container'
201
  ),
202
 
203
  array(
204
- 'name' => __( 'The Content', 'a3_lazy_load' ),
205
- 'id' => 'a3l_apply_to_content',
 
 
 
 
 
206
  'type' => 'onoff_checkbox',
207
- 'default' => false,
208
  'checked_value' => true,
209
  'unchecked_value' => false,
210
  'checked_label' => __( 'ON', 'a3_lazy_load' ),
@@ -212,40 +221,139 @@ class A3_Lazy_Load_Global_Settings extends A3_Lazy_Load_Admin_UI
212
  ),
213
 
214
  array(
215
- 'name' => __( 'Widgets', 'a3_lazy_load' ),
216
- 'id' => 'a3l_apply_to_textwidget',
 
 
 
 
 
217
  'type' => 'onoff_checkbox',
218
- 'default' => false,
 
 
 
 
 
 
 
 
 
 
219
  'checked_value' => true,
220
  'unchecked_value' => false,
221
  'checked_label' => __( 'ON', 'a3_lazy_load' ),
222
  'unchecked_label' => __( 'OFF', 'a3_lazy_load' ),
223
  ),
224
-
225
  array(
226
  'name' => __( 'Post Thumbnails', 'a3_lazy_load' ),
227
- 'id' => 'a3l_apply_to_postthumbnails',
228
  'type' => 'onoff_checkbox',
229
- 'default' => false,
230
  'checked_value' => true,
231
  'unchecked_value' => false,
232
  'checked_label' => __( 'ON', 'a3_lazy_load' ),
233
  'unchecked_label' => __( 'OFF', 'a3_lazy_load' ),
234
  ),
235
-
236
  array(
237
  'name' => __( 'Gravatars', 'a3_lazy_load' ),
238
- 'id' => 'a3l_apply_to_gravatars',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  'type' => 'onoff_checkbox',
240
- 'default' => false,
241
  'checked_value' => true,
242
  'unchecked_value' => false,
243
  'checked_label' => __( 'ON', 'a3_lazy_load' ),
244
  'unchecked_label' => __( 'OFF', 'a3_lazy_load' ),
245
  ),
246
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  array(
248
  'name' => __( 'Theme Loader Function', 'a3_lazy_load' ),
 
249
  'id' => 'a3l_theme_loader',
250
  'type' => 'switcher_checkbox',
251
  'default' => 'wp_footer',
@@ -256,13 +364,10 @@ class A3_Lazy_Load_Global_Settings extends A3_Lazy_Load_Admin_UI
256
  ),
257
 
258
  array(
259
- 'name' => __( 'Skip Images Classes', 'a3_lazy_load' ),
260
- 'id' => 'a3l_skip_image_with_class',
261
- 'desc' => __('Comma separated. Example: "no-lazy, lazy-ignore, image-235"', 'a3_lazy_load'),
262
- 'type' => 'text',
263
- 'default' => ""
264
- ),
265
-
266
  array(
267
  'name' => __( 'Disable On WPTouch', 'a3_lazy_load' ),
268
  'desc' => __("Disables a3 Lazy Load when the WPTouch mobile theme is used", 'a3_lazy_load'),
@@ -274,7 +379,6 @@ class A3_Lazy_Load_Global_Settings extends A3_Lazy_Load_Admin_UI
274
  'checked_label' => __( 'ON', 'a3_lazy_load' ),
275
  'unchecked_label' => __( 'OFF', 'a3_lazy_load' ),
276
  ),
277
-
278
  array(
279
  'name' => __( 'Disable On MobilePress', 'a3_lazy_load' ),
280
  'desc' => __("Disables a3 Lazy Load when the MobilePress mobile theme is used", 'a3_lazy_load'),
@@ -290,51 +394,93 @@ class A3_Lazy_Load_Global_Settings extends A3_Lazy_Load_Admin_UI
290
  array(
291
  'name' => __( 'Effect & Style', 'a3_lazy_load' ),
292
  'id' => "a3l_settings_style",
293
- 'class' => 'a3l_apply_to_loadimages_container',
294
  'type' => 'heading',
295
  ),
296
-
297
  array(
298
- 'name' => __( 'Effect', 'a3_lazy_load' ),
299
  'id' => 'a3l_effect',
300
  'type' => 'switcher_checkbox',
301
- 'default' => 'fadein',
302
  'checked_value' => 'fadein',
303
  'unchecked_value' => 'spinner',
304
- 'checked_label' => __( 'FADEIN', 'a3_lazy_load' ),
305
  'unchecked_label' => __( 'SPINNER', 'a3_lazy_load' ),
306
  ),
307
-
308
  array(
309
- 'name' => __( 'Background Blank Image Colour', 'a3_lazy_load' ),
310
  'id' => 'a3l_effect_background',
311
  'type' => 'color',
312
  'default' => '#ffffff'
313
  ),
314
 
 
 
 
 
 
315
  ));
316
  }
317
 
 
 
 
 
 
 
 
318
  public function include_script() {
319
  ?>
320
  <script>
321
  (function($) {
322
  $(document).ready(function() {
323
 
324
- if ( $("input.a3l_apply_to_loadimages:checked").val() == '1') {
325
- $(".a3l_apply_to_loadimages_container").css( {'visibility': 'visible', 'height' : 'auto', 'overflow' : 'inherit'} );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  } else {
327
- $(".a3l_apply_to_loadimages_container").css( {'visibility': 'hidden', 'height' : '0px', 'overflow' : 'hidden'} );
328
  }
329
 
330
- $(document).on( "a3rev-ui-onoff_checkbox-switch", '.a3l_apply_to_loadimages', function( event, value, status ) {
331
- $(".a3l_apply_to_loadimages_container").hide().css( {'visibility': 'visible', 'height' : 'auto', 'overflow' : 'inherit'} );
332
  if ( status == 'true' ) {
333
- $(".a3l_apply_to_loadimages_container").slideDown();
334
  } else {
335
- $(".a3l_apply_to_loadimages_container").slideUp();
336
  }
337
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
  });
339
  })(jQuery);
340
  </script>
89
 
90
  add_action( $this->plugin_name . '_get_all_settings' , array( $this, 'get_settings' ) );
91
 
92
+ add_action( $this->plugin_name . '_settings_a3l_container_start_before', array( $this, 'a3l_container_start' ) );
93
+ add_action( $this->plugin_name . '_settings_a3l_container_end_after', array( $this, 'a3l_container_end' ) );
94
+
95
+ //add_action( $this->plugin_name . '_settings_a3l_videos_start_before', array( $this, 'a3l_videos_start' ) );
96
+ //add_action( $this->plugin_name . '_settings_a3l_videos_end_after', array( $this, 'a3l_videos_end' ) );
97
+
98
  }
99
 
100
  /*-----------------------------------------------------------------------------------*/
187
  array(
188
  'type' => 'heading',
189
  ),
 
190
  array(
191
  'name' => __( 'Enable Lazy Load', 'a3_lazy_load' ),
192
+ 'id' => 'a3l_apply_lazyloadxt',
193
+ 'class' => 'a3l_apply_to_load',
194
  'type' => 'onoff_checkbox',
195
  'default' => true,
196
  'checked_value' => true,
200
  ),
201
 
202
  array(
 
203
  'type' => 'heading',
204
+ 'id' => 'a3l_container_start'
205
  ),
206
 
207
  array(
208
+ 'name' => __( 'Lazy Load Images', 'a3_lazy_load' ),
209
+ 'type' => 'heading',
210
+ 'class' => 'a3l_apply_to_load_container a3l_apply_to_images_container'
211
+ ),
212
+ array(
213
+ 'name' => __( 'Enable Lazy Load for Images', 'a3_lazy_load' ),
214
+ 'id' => 'a3l_apply_to_images',
215
  'type' => 'onoff_checkbox',
216
+ 'default' => true,
217
  'checked_value' => true,
218
  'unchecked_value' => false,
219
  'checked_label' => __( 'ON', 'a3_lazy_load' ),
221
  ),
222
 
223
  array(
224
+ 'type' => 'heading',
225
+ 'id' => 'a3l_images_start',
226
+ 'class' => 'a3l_apply_to_load_container a3l_apply_to_load_images_container'
227
+ ),
228
+ array(
229
+ 'name' => __( 'Images in Content', 'a3_lazy_load' ),
230
+ 'id' => 'a3l_apply_image_to_content',
231
  'type' => 'onoff_checkbox',
232
+ 'default' => true,
233
+ 'checked_value' => true,
234
+ 'unchecked_value' => false,
235
+ 'checked_label' => __( 'ON', 'a3_lazy_load' ),
236
+ 'unchecked_label' => __( 'OFF', 'a3_lazy_load' ),
237
+ ),
238
+ array(
239
+ 'name' => __( 'Images in Widgets', 'a3_lazy_load' ),
240
+ 'id' => 'a3l_apply_image_to_textwidget',
241
+ 'type' => 'onoff_checkbox',
242
+ 'default' => true,
243
  'checked_value' => true,
244
  'unchecked_value' => false,
245
  'checked_label' => __( 'ON', 'a3_lazy_load' ),
246
  'unchecked_label' => __( 'OFF', 'a3_lazy_load' ),
247
  ),
 
248
  array(
249
  'name' => __( 'Post Thumbnails', 'a3_lazy_load' ),
250
+ 'id' => 'a3l_apply_image_to_postthumbnails',
251
  'type' => 'onoff_checkbox',
252
+ 'default' => true,
253
  'checked_value' => true,
254
  'unchecked_value' => false,
255
  'checked_label' => __( 'ON', 'a3_lazy_load' ),
256
  'unchecked_label' => __( 'OFF', 'a3_lazy_load' ),
257
  ),
 
258
  array(
259
  'name' => __( 'Gravatars', 'a3_lazy_load' ),
260
+ 'id' => 'a3l_apply_image_to_gravatars',
261
+ 'type' => 'onoff_checkbox',
262
+ 'default' => true,
263
+ 'checked_value' => true,
264
+ 'unchecked_value' => false,
265
+ 'checked_label' => __( 'ON', 'a3_lazy_load' ),
266
+ 'unchecked_label' => __( 'OFF', 'a3_lazy_load' ),
267
+ ),
268
+ array(
269
+ 'name' => __( 'Skip Images Classes', 'a3_lazy_load' ),
270
+ 'id' => 'a3l_skip_image_with_class',
271
+ 'desc' => __('Comma separated. Example: "no-lazy, lazy-ignore, image-235"', 'a3_lazy_load'),
272
+ 'type' => 'text',
273
+ 'default' => ""
274
+ ),
275
+ array(
276
+ 'name' => __( 'Noscript Support', 'a3_lazy_load' ),
277
+ 'id' => 'a3l_image_include_noscript',
278
+ 'desc' => __( 'Turn ON to activate Noscript tag as a fallback to show images for users who have JavaScript disabled in their browser.', 'a3_lazy_load' ),
279
  'type' => 'onoff_checkbox',
280
+ 'default' => true,
281
  'checked_value' => true,
282
  'unchecked_value' => false,
283
  'checked_label' => __( 'ON', 'a3_lazy_load' ),
284
  'unchecked_label' => __( 'OFF', 'a3_lazy_load' ),
285
  ),
286
 
287
+
288
+ array(
289
+ 'name' => __( 'Lazy Load Videos and iframes', 'a3_lazy_load' ),
290
+ 'type' => 'heading',
291
+ 'class' => 'a3l_apply_to_load_container a3l_apply_to_videos_container'
292
+ ),
293
+ array(
294
+ 'name' => __( 'Video and iframes', 'a3_lazy_load' ),
295
+ 'desc' => sprintf( __( 'Turn ON to activate Lazy Load for <a href="%s" target="_blank">WordPress Embeds</a>, <a href="%s" target="_blank">HTML5 Video</a> and content loaded by iframe from all sources. Note: WordPress Shortcode is not supported.', 'a3_lazy_load' ), 'http://codex.wordpress.org/Embeds/', 'http://www.w3schools.com/html/html5_video.asp' ),
296
+ 'id' => 'a3l_apply_to_videos',
297
+ 'type' => 'onoff_checkbox',
298
+ 'default' => true,
299
+ 'checked_value' => true,
300
+ 'unchecked_value' => false,
301
+ 'checked_label' => __( 'ON', 'a3_lazy_load' ),
302
+ 'unchecked_label' => __( 'OFF', 'a3_lazy_load' ),
303
+ ),
304
+
305
+ array(
306
+ 'type' => 'heading',
307
+ 'id' => 'a3l_videos_start',
308
+ 'class' => 'a3l_apply_to_load_container a3l_apply_to_load_videos_container'
309
+ ),
310
+ array(
311
+ 'name' => __( 'In Content', 'a3_lazy_load' ),
312
+ 'id' => 'a3l_apply_video_to_content',
313
+ 'type' => 'onoff_checkbox',
314
+ 'default' => true,
315
+ 'checked_value' => true,
316
+ 'unchecked_value' => false,
317
+ 'checked_label' => __( 'ON', 'a3_lazy_load' ),
318
+ 'unchecked_label' => __( 'OFF', 'a3_lazy_load' ),
319
+ ),
320
+ array(
321
+ 'name' => __( 'In Widgets', 'a3_lazy_load' ),
322
+ 'id' => 'a3l_apply_video_to_textwidget',
323
+ 'type' => 'onoff_checkbox',
324
+ 'default' => true,
325
+ 'checked_value' => true,
326
+ 'unchecked_value' => false,
327
+ 'checked_label' => __( 'ON', 'a3_lazy_load' ),
328
+ 'unchecked_label' => __( 'OFF', 'a3_lazy_load' ),
329
+ ),
330
+ array(
331
+ 'name' => __( 'Skip Videos Classes', 'a3_lazy_load' ),
332
+ 'id' => 'a3l_skip_video_with_class',
333
+ 'desc' => __('Comma separated. Example: "no-lazy, lazy-ignore, video-235"', 'a3_lazy_load'),
334
+ 'type' => 'text',
335
+ 'default' => ""
336
+ ),
337
+ array(
338
+ 'name' => __( 'Noscript Support', 'a3_lazy_load' ),
339
+ 'id' => 'a3l_video_include_noscript',
340
+ 'desc' => __( 'Turn ON to activate Noscript tag as a fallback to show WordPress Embeds, HTML 5 Video and iframe loaded content for users who have JavaScript disabled in their browser.', 'a3_lazy_load' ),
341
+ 'type' => 'onoff_checkbox',
342
+ 'default' => true,
343
+ 'checked_value' => true,
344
+ 'unchecked_value' => false,
345
+ 'checked_label' => __( 'ON', 'a3_lazy_load' ),
346
+ 'unchecked_label' => __( 'OFF', 'a3_lazy_load' ),
347
+ ),
348
+
349
+ array(
350
+ 'name' => __( 'Script Load Optimization', 'a3_lazy_load' ),
351
+ 'type' => 'heading',
352
+ 'class' => 'a3l_apply_to_load_container a3l_apply_to_script_container'
353
+ ),
354
  array(
355
  'name' => __( 'Theme Loader Function', 'a3_lazy_load' ),
356
+ 'desc' => __( 'Your theme must have the wp_footer() function if you select FOOTER load.', 'a3_lazy_load' ),
357
  'id' => 'a3l_theme_loader',
358
  'type' => 'switcher_checkbox',
359
  'default' => 'wp_footer',
364
  ),
365
 
366
  array(
367
+ 'name' => __( 'WordPress Mobile Template Plugins', 'a3_lazy_load' ),
368
+ 'type' => 'heading',
369
+ 'class' => 'a3l_apply_to_load_container'
370
+ ),
 
 
 
371
  array(
372
  'name' => __( 'Disable On WPTouch', 'a3_lazy_load' ),
373
  'desc' => __("Disables a3 Lazy Load when the WPTouch mobile theme is used", 'a3_lazy_load'),
379
  'checked_label' => __( 'ON', 'a3_lazy_load' ),
380
  'unchecked_label' => __( 'OFF', 'a3_lazy_load' ),
381
  ),
 
382
  array(
383
  'name' => __( 'Disable On MobilePress', 'a3_lazy_load' ),
384
  'desc' => __("Disables a3 Lazy Load when the MobilePress mobile theme is used", 'a3_lazy_load'),
394
  array(
395
  'name' => __( 'Effect & Style', 'a3_lazy_load' ),
396
  'id' => "a3l_settings_style",
397
+ 'class' => 'a3l_apply_to_load_container a3l_apply_to_effect_container',
398
  'type' => 'heading',
399
  ),
 
400
  array(
401
+ 'name' => __( 'Loading Effect', 'a3_lazy_load' ),
402
  'id' => 'a3l_effect',
403
  'type' => 'switcher_checkbox',
404
+ 'default' => 'spinner',
405
  'checked_value' => 'fadein',
406
  'unchecked_value' => 'spinner',
407
+ 'checked_label' => __( 'FADE IN', 'a3_lazy_load' ),
408
  'unchecked_label' => __( 'SPINNER', 'a3_lazy_load' ),
409
  ),
 
410
  array(
411
+ 'name' => __( 'Loading Background Colour', 'a3_lazy_load' ),
412
  'id' => 'a3l_effect_background',
413
  'type' => 'color',
414
  'default' => '#ffffff'
415
  ),
416
 
417
+ array(
418
+ 'type' => 'heading',
419
+ 'id' => 'a3l_container_end'
420
+ ),
421
+
422
  ));
423
  }
424
 
425
+ public function a3l_container_start() {
426
+ echo '<div class="a3l_container">';
427
+ }
428
+ public function a3l_container_end() {
429
+ echo '</div>';
430
+ }
431
+
432
  public function include_script() {
433
  ?>
434
  <script>
435
  (function($) {
436
  $(document).ready(function() {
437
 
438
+ if ( $("input.a3l_apply_to_load").is(":checked") ) {
439
+ $(".a3l_container").css( {'visibility': 'visible', 'height' : 'auto', 'overflow' : 'inherit'} );
440
+ } else {
441
+ $(".a3l_container").css( {'visibility': 'hidden', 'height' : '0px', 'overflow' : 'hidden'} );
442
+ }
443
+
444
+ $(document).on( "a3rev-ui-onoff_checkbox-switch", '.a3l_apply_to_load', function( event, value, status ) {
445
+ $(".a3l_container").hide().css( {'visibility': 'visible', 'height' : 'auto', 'overflow' : 'inherit'} );
446
+ if ( status == 'true' ) {
447
+ $(".a3l_container").slideDown();
448
+ } else {
449
+ $(".a3l_container").slideUp();
450
+ }
451
+ });
452
+
453
+ if ( $("input#a3_lazy_load_global_settings_a3l_apply_to_images:checked").val() == '1') {
454
+ $("#a3l_images_start").css( {'visibility': 'visible', 'height' : 'auto', 'overflow' : 'inherit'} );
455
  } else {
456
+ $("#a3l_images_start").css( {'visibility': 'hidden', 'height' : '0px', 'overflow' : 'hidden'} );
457
  }
458
 
459
+ $(document).on( "a3rev-ui-onoff_checkbox-switch", '#a3_lazy_load_global_settings_a3l_apply_to_images', function( event, value, status ) {
460
+ $("#a3l_images_start").hide().css( {'visibility': 'visible', 'height' : 'auto', 'overflow' : 'inherit'} );
461
  if ( status == 'true' ) {
462
+ $("#a3l_images_start").slideDown();
463
  } else {
464
+ $("#a3l_images_start").slideUp();
465
  }
466
  });
467
+
468
+ if ( $("input#a3_lazy_load_global_settings_a3l_apply_to_videos:checked").val() == '1' ) {
469
+ $("#a3l_videos_start").css( {'visibility': 'visible', 'height' : 'auto', 'overflow' : 'inherit'} );
470
+ } else {
471
+ $("#a3l_videos_start").css( {'visibility': 'hidden', 'height' : '0px', 'overflow' : 'hidden'} );
472
+ }
473
+
474
+ $(document).on( "a3rev-ui-onoff_checkbox-switch", '#a3_lazy_load_global_settings_a3l_apply_to_videos', function( event, value, status ) {
475
+ $("#a3l_videos_start").hide().css( {'visibility': 'visible', 'height' : 'auto', 'overflow' : 'inherit'} );
476
+ if ( status == 'true' ) {
477
+ $("#a3l_videos_start").slideDown();
478
+ } else {
479
+ $("#a3l_videos_start").slideUp();
480
+ }
481
+ });
482
+
483
+
484
  });
485
  })(jQuery);
486
  </script>
assets/banner-772x250.png CHANGED
Binary file
assets/css/jquery.lazyloadxt.spinner.css CHANGED
@@ -1,7 +1,6 @@
1
- body .thumbnail_container .thumbnail img.lazy-hidden{}
2
  .lazy-hidden,.entry img.lazy-hidden, img.thumbnail.lazy-hidden {
3
  background-color: #ffffff;
4
  background-image: url('loading.gif');
5
  background-repeat: no-repeat;
6
  background-position: 50% 50%;
7
- }
 
1
  .lazy-hidden,.entry img.lazy-hidden, img.thumbnail.lazy-hidden {
2
  background-color: #ffffff;
3
  background-image: url('loading.gif');
4
  background-repeat: no-repeat;
5
  background-position: 50% 50%;
6
+ }
assets/js/jquery.lazyloadxt.js CHANGED
@@ -311,4 +311,32 @@
311
  }
312
  });
313
 
314
- })(window.jQuery || window.Zepto || window.$, window, document);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  }
312
  });
313
 
314
+ })(window.jQuery || window.Zepto || window.$, window, document);
315
+
316
+ (function ($) {
317
+ var options = $.lazyLoadXT;
318
+
319
+ options.selector += ',video,iframe[data-src],embed[data-src]';
320
+ options.videoPoster = 'data-poster';
321
+
322
+ $(document).on('lazyshow', 'video', function (e, $el) {
323
+ var srcAttr = $el.lazyLoadXT.srcAttr,
324
+ isFuncSrcAttr = $.isFunction(srcAttr);
325
+
326
+ $el
327
+ .attr('poster', $el.attr(options.videoPoster))
328
+ .children('source,track')
329
+ .each(function (index, el) {
330
+ var $child = $(el);
331
+ $child.attr('src', isFuncSrcAttr ? srcAttr($child) : $child.attr(srcAttr));
332
+ });
333
+ // reload video
334
+ this.load();
335
+ $(this).removeClass('lazy-hidden');
336
+ });
337
+
338
+ $(document).on('lazyshow', 'embed', function (e, $el) {
339
+ $(this).removeClass('lazy-hidden');
340
+ });
341
+
342
+ })(window.jQuery || window.Zepto || window.$);
assets/js/jquery.lazyloadxt.min.js CHANGED
@@ -1,2 +1 @@
1
- /* Lazy Load XT 1.0.6 | MIT License */
2
- !function(a,b,c,d){function e(a,b){return a[b]===d?t[b]:a[b]}function f(){var a=b.pageYOffset;return a===d?r.scrollTop:a}function g(a,b){var c=t["on"+a];c&&(w(c)?c.call(b[0]):(c.addClass&&b.addClass(c.addClass),c.removeClass&&b.removeClass(c.removeClass))),b.trigger("lazy"+a,[b]),k()}function h(b){g(b.type,a(this).off(p,h))}function i(c){if(A.length){c=c||t.forceLoad,B=1/0;var d,e,i=f(),j=b.innerHeight||r.clientHeight,k=b.innerWidth||r.clientWidth;for(d=0,e=A.length;e>d;d++){var l,m=A[d],o=m[0],q=m[n],s=!1,u=c;if(z(r,o)){if(c||!q.visibleOnly||o.offsetWidth||o.offsetHeight){if(!u){var v=o.getBoundingClientRect(),x=q.edgeX,y=q.edgeY;l=v.top+i-y-j,u=i>=l&&v.bottom>-y&&v.left<=k+x&&v.right>-x}if(u){g("show",m);var C=q.srcAttr,D=w(C)?C(m):o.getAttribute(C);D&&(m.on(p,h),o.src=D),s=!0}else B>l&&(B=l)}}else s=!0;s&&(A.splice(d--,1),e--)}e||g("complete",a(r))}}function j(){C>1?(C=1,i(),setTimeout(j,t.throttle)):C=0}function k(a){A.length&&(a&&"scroll"===a.type&&a.currentTarget===b&&B>=f()||(C||setTimeout(j,0),C=2))}function l(){v.lazyLoadXT()}function m(){i(!0)}var n="lazyLoadXT",o="lazied",p="load error",q="lazy-hidden",r=c.documentElement||c.body,s=b.onscroll===d||!!b.operamini||!r.getBoundingClientRect,t={autoInit:!0,selector:"img[data-src]",blankImage:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",throttle:99,forceLoad:s,loadEvent:"pageshow",updateEvent:"load orientationchange resize scroll touchmove focus",forceEvent:"",oninit:{removeClass:"lazy"},onshow:{addClass:q},onload:{removeClass:q,addClass:"lazy-loaded"},onerror:{removeClass:q},checkDuplicates:!0},u={srcAttr:"data-src",edgeX:0,edgeY:0,visibleOnly:!0},v=a(b),w=a.isFunction,x=a.extend,y=a.data||function(b,c){return a(b).data(c)},z=a.contains||function(a,b){for(;b=b.parentNode;)if(b===a)return!0;return!1},A=[],B=0,C=0;a[n]=x(t,u,a[n]),a.fn[n]=function(c){c=c||{};var d,f=e(c,"blankImage"),h=e(c,"checkDuplicates"),i=e(c,"scrollContainer"),j={};a(i).on("scroll",k);for(d in u)j[d]=e(c,d);return this.each(function(d,e){if(e===b)a(t.selector).lazyLoadXT(c);else{if(h&&y(e,o))return;var i=a(e).data(o,1);f&&"IMG"===e.tagName&&!e.src&&(e.src=f),i[n]=x({},j),g("init",i),A.push(i)}})},a(c).ready(function(){g("start",v),v.on(t.loadEvent,l).on(t.updateEvent,k).on(t.forceEvent,m),a(c).on(t.updateEvent,k),t.autoInit&&l()})}(window.jQuery||window.Zepto||window.$,window,document);
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();e(this).removeClass("lazy-hidden")});e(document).on("lazyshow","embed",function(t,n){e(this).removeClass("lazy-hidden")})})(window.jQuery||window.Zepto||window.$)
 
assets/screenshot-1.jpg ADDED
Binary file
assets/screenshot-1.png DELETED
Binary file
changelog.txt DELETED
@@ -1,4 +0,0 @@
1
- === Changelog ===
2
-
3
- = 1.0.0 - 2014/12/20 =
4
- * First release.
 
 
 
 
classes/class-a3-lazy-load.php CHANGED
@@ -3,7 +3,8 @@ class A3_Lazy_Load
3
  {
4
  const version = A3_LAZY_VERSION;
5
  protected $_placeholder_url;
6
- protected $_skip_classes;
 
7
  protected static $_instance;
8
 
9
  function __construct() {
@@ -15,7 +16,11 @@ class A3_Lazy_Load
15
  }
16
 
17
  // Disable when not allow from global settings
18
- if ( $a3_lazy_load_global_settings['a3l_apply_to_loadimages'] == false ) {
 
 
 
 
19
  return;
20
  }
21
 
@@ -38,33 +43,61 @@ class A3_Lazy_Load
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
 
57
- if ( $a3_lazy_load_global_settings['a3l_apply_to_content'] == true ) {
58
- add_filter( 'the_content', array( $this, 'filter_content' ), 7 );
 
 
 
 
 
 
 
 
 
 
59
  }
60
- if ( $a3_lazy_load_global_settings['a3l_apply_to_textwidget'] == true ) {
61
- add_filter( 'widget_text', array( $this, 'filter' ), 200 );
 
 
 
62
  }
63
- if ( $a3_lazy_load_global_settings['a3l_apply_to_postthumbnails'] == true ) {
64
- add_filter( 'post_thumbnail_html', array( $this, 'filter' ), 200 );
 
 
65
  }
66
- if ( $a3_lazy_load_global_settings['a3l_apply_to_gravatars'] == true ) {
67
- add_filter( 'get_avatar', array( $this, 'filter' ), 200 );
 
 
 
 
 
 
 
 
68
  }
69
  }
70
 
@@ -108,6 +141,17 @@ class A3_Lazy_Load
108
  do_action('after_a3_lazy_load_xt_script');
109
  }
110
 
 
 
 
 
 
 
 
 
 
 
 
111
  static function is_wptouch() {
112
  if ( function_exists( 'bnc_wptouch_is_mobile' ) && bnc_wptouch_is_mobile() ) {
113
  return true;
@@ -149,28 +193,41 @@ class A3_Lazy_Load
149
  return false;
150
  }
151
 
152
- static function filter_content( $content ) {
153
- $A3_Lazy_Load = A3_Lazy_Load::_instance();
154
- add_filter( 'wp_get_attachment_image_attributes', array( $A3_Lazy_Load, 'get_attachment_image_attributes' ), 200 );
 
155
 
156
- return $A3_Lazy_Load->filter( $content );
157
- }
 
 
 
 
 
 
158
 
159
- static function get_attachment_image_attributes( $attr ) {
160
  $A3_Lazy_Load = A3_Lazy_Load::_instance();
161
 
162
- $attr['data-src'] = $attr['src'];
163
- $attr['src'] = $A3_Lazy_Load->_placeholder_url;
164
- $attr['class'] = 'lazy-hidden '. $attr['class'];
165
- $attr['data-lazy-type'] = 'image';
166
 
167
- return $attr;
 
 
 
 
 
 
 
 
 
168
  }
169
 
170
- static function filter( $content, $noscript = true ) {
171
- if( is_admin() ){
172
  return $content;
173
  }
 
174
  $run_filter = true;
175
  $run_filter = apply_filters( 'a3_lazy_load_run_filter', $run_filter );
176
 
@@ -184,32 +241,38 @@ class A3_Lazy_Load
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
 
191
  return $content;
192
  }
193
 
194
- protected function _filter_images_single( $content ) {
195
- // Don't lazyload for feeds, previews, mobile
196
- if( is_feed() || is_preview() || ( function_exists( 'is_mobile' ) && is_mobile() ) )
197
- return $content;
198
 
199
- // Don't lazy-load if the content has already been run through previously
200
- if ( false !== strpos( $content, 'data-src' ) )
201
- return $content;
202
 
203
- // In case you want to change the placeholder image
204
- $placeholder_image = $this->_placeholder_url;
205
 
206
- // This is a pretty simple regex, but it works
207
- $content = preg_replace( '#<img([^>]+?)src=[\'"]?([^\'"\s>]+)[\'"]?([^>]*)>#', sprintf( '<img${1}src="%s" data-src="${2}"${3}><noscript><img${1}src="${2}"${3}></noscript>', $placeholder_image ), $content );
 
 
208
 
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 );
@@ -217,8 +280,8 @@ class A3_Lazy_Load
217
  $search = array();
218
  $replace = array();
219
 
220
- if ( is_array( $this->_skip_classes ) ) {
221
- $skip_images_preg_quoted = array_map( 'preg_quote', $this->_skip_classes );
222
  $skip_images_regex = sprintf( '/class=".*(%s).*"/s', implode( '|', $skip_images_preg_quoted ) );
223
  }
224
 
@@ -226,7 +289,7 @@ class A3_Lazy_Load
226
  foreach ( $matches[0] as $imgHTML ) {
227
 
228
  // 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
229
- if ( ! ( is_array( $this->_skip_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/src=['\"]data:image/is", $imgHTML ) ) {
230
  $i++;
231
  // replace the src and add the data-src attribute
232
  $replaceHTML = '';
@@ -239,7 +302,7 @@ class A3_Lazy_Load
239
  $replaceHTML = preg_replace( '/<img/is', '<img class="lazy lazy-hidden"', $replaceHTML );
240
  }
241
 
242
- if( $noscript ){
243
  $replaceHTML .= '<noscript>' . $imgHTML . '</noscript>';
244
  }
245
 
@@ -257,31 +320,178 @@ class A3_Lazy_Load
257
  return $content;
258
  }
259
 
260
- protected function _filter_iframes( $content ) {
261
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  $matches = array();
263
- preg_match_all( '/<iframe\s+.*?>/', $content, $matches );
264
 
265
  $search = array();
266
  $replace = array();
267
 
268
- foreach ( $matches[0] as $iframeHTML ) {
 
 
 
269
 
270
- // Don't mess with the Gravity Forms ajax iframe
271
- if ( strpos( $iframeHTML, 'gform_ajax_frame' ) ) {
 
272
  continue;
273
  }
274
 
275
- $replaceHTML = '<img src="' . $this->_placeholder_url . '" class="lazy lazy-hidden" data-lazy-type="iframe" data-src="' . base64_encode($iframeHTML) . '" alt="">';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
 
277
- $replaceHTML .= '<noscript>' . $iframeHTML . '</noscript>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
 
279
- array_push( $search, $iframeHTML );
280
- array_push( $replace, $replaceHTML );
 
281
  }
282
 
 
 
 
283
  $content = str_replace( $search, $replace, $content );
284
 
 
285
  return $content;
286
  }
287
  }
3
  {
4
  const version = A3_LAZY_VERSION;
5
  protected $_placeholder_url;
6
+ protected $_skip_images_classes;
7
+ protected $_skip_videos_classes;
8
  protected static $_instance;
9
 
10
  function __construct() {
16
  }
17
 
18
  // Disable when not allow from global settings
19
+ if ( $a3_lazy_load_global_settings['a3l_apply_lazyloadxt'] == false ) {
20
+ return;
21
+ }
22
+
23
+ if ( $a3_lazy_load_global_settings['a3l_apply_to_images'] == false && $a3_lazy_load_global_settings['a3l_apply_to_videos'] == false ) {
24
  return;
25
  }
26
 
43
  }
44
 
45
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 11 );
46
+ add_action( 'wp_print_scripts', array( $this, 'localize_printed_scripts' ), 5 );
47
+ add_action( 'wp_print_footer_scripts', array( $this, 'localize_printed_scripts' ), 5 );
48
 
49
+ add_filter( 'a3_lazy_load_html', array( $this, 'filter_html' ), 10, 2 );
 
50
 
51
+ $this->_placeholder_url = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
52
+
53
+ // Apply for Images
54
+ $skip_images_classes = apply_filters( 'a3_lazy_load_skip_images_classes', $a3_lazy_load_global_settings['a3l_skip_image_with_class'] );
55
+ if ( strlen( trim( $skip_images_classes ) ) ) {
56
+ $this->_skip_images_classes = array_map( 'trim', explode( ',', $skip_images_classes ) );
57
  }
58
+ if ( is_array( $this->_skip_images_classes ) ) {
59
+ $this->_skip_images_classes = array_merge( array('a3-notlazy'), $this->_skip_images_classes );
60
  } else {
61
+ $this->_skip_images_classes = array('a3-notlazy');
62
  }
63
 
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
+ if ( $a3_lazy_load_global_settings['a3l_apply_image_to_content'] == true ) {
68
+ add_filter( 'the_content', array( $this, 'filter_content_images' ), 10 );
69
+ }
70
+ if ( $a3_lazy_load_global_settings['a3l_apply_image_to_textwidget'] == true ) {
71
+ add_filter( 'widget_text', array( $this, 'filter_images' ), 200 );
72
+ }
73
+ if ( $a3_lazy_load_global_settings['a3l_apply_image_to_postthumbnails'] == true ) {
74
+ add_filter( 'post_thumbnail_html', array( $this, 'filter_images' ), 200 );
75
+ }
76
+ if ( $a3_lazy_load_global_settings['a3l_apply_image_to_gravatars'] == true ) {
77
+ add_filter( 'get_avatar', array( $this, 'filter_images' ), 200 );
78
+ }
79
  }
80
+
81
+ // Apply for Videos
82
+ $skip_videos_classes = apply_filters( 'a3_lazy_load_skip_videos_classes', $a3_lazy_load_global_settings['a3l_skip_video_with_class'] );
83
+ if ( strlen( trim( $skip_videos_classes ) ) ) {
84
+ $this->_skip_videos_classes = array_map( 'trim', explode( ',', $skip_videos_classes ) );
85
  }
86
+ if ( is_array( $this->_skip_videos_classes ) ) {
87
+ $this->_skip_videos_classes = array_merge( array('a3-notlazy'), $this->_skip_videos_classes );
88
+ } else {
89
+ $this->_skip_videos_classes = array('a3-notlazy');
90
  }
91
+
92
+ if ( $a3_lazy_load_global_settings['a3l_apply_to_videos'] == true ) {
93
+ add_filter( 'a3_lazy_load_videos', array( $this, 'filter_videos' ), 10, 2 );
94
+
95
+ if ( $a3_lazy_load_global_settings['a3l_apply_video_to_content'] == true ) {
96
+ add_filter( 'the_content', array( $this, 'filter_videos' ), 10 );
97
+ }
98
+ if ( $a3_lazy_load_global_settings['a3l_apply_video_to_textwidget'] == true ) {
99
+ add_filter( 'widget_text', array( $this, 'filter_videos' ), 200 );
100
+ }
101
  }
102
  }
103
 
141
  do_action('after_a3_lazy_load_xt_script');
142
  }
143
 
144
+ static function localize_printed_scripts() {
145
+ global $a3_lazy_load_global_settings;
146
+
147
+ if ( wp_script_is( 'jquery-lazyloadxt' ) ) {
148
+ wp_localize_script( 'jquery-lazyloadxt', 'a3_lazyload_params', apply_filters( 'a3_lazyload_params', array(
149
+ 'apply_images' => $a3_lazy_load_global_settings['a3l_apply_to_images'],
150
+ 'apply_videos' => $a3_lazy_load_global_settings['a3l_apply_to_videos']
151
+ ) ) );
152
+ }
153
+ }
154
+
155
  static function is_wptouch() {
156
  if ( function_exists( 'bnc_wptouch_is_mobile' ) && bnc_wptouch_is_mobile() ) {
157
  return true;
193
  return false;
194
  }
195
 
196
+ static function filter_html( $content, $include_noscript = null ) {
197
+ if ( is_admin() ) {
198
+ return $content;
199
+ }
200
 
201
+ $run_filter = true;
202
+ $run_filter = apply_filters( 'a3_lazy_load_run_filter', $run_filter );
203
+
204
+ if ( ! $run_filter ) {
205
+ return $content;
206
+ }
207
+
208
+ global $a3_lazy_load_global_settings;
209
 
 
210
  $A3_Lazy_Load = A3_Lazy_Load::_instance();
211
 
212
+ $content = apply_filters( 'a3_lazy_load_html_before', $content );
 
 
 
213
 
214
+ if ( $a3_lazy_load_global_settings['a3l_apply_to_images'] == true ) {
215
+ $content = $A3_Lazy_Load->filter_images( $content, $include_noscript );
216
+ }
217
+ if ( $a3_lazy_load_global_settings['a3l_apply_to_videos'] == true ) {
218
+ $content = $A3_Lazy_Load->filter_videos( $content, $include_noscript );
219
+ }
220
+
221
+ $content = apply_filters( 'a3_lazy_load_html_after', $content );
222
+
223
+ return $content;
224
  }
225
 
226
+ static function filter_images( $content, $include_noscript = null ) {
227
+ if ( is_admin() ) {
228
  return $content;
229
  }
230
+
231
  $run_filter = true;
232
  $run_filter = apply_filters( 'a3_lazy_load_run_filter', $run_filter );
233
 
241
 
242
  $content = apply_filters( 'a3_lazy_load_images_before', $content );
243
 
244
+ $content = $A3_Lazy_Load->_filter_images( $content, $include_noscript );
245
 
246
  $content = apply_filters( 'a3_lazy_load_images_after', $content );
247
 
248
  return $content;
249
  }
250
 
251
+ static function filter_content_images( $content ) {
252
+ $A3_Lazy_Load = A3_Lazy_Load::_instance();
253
+ add_filter( 'wp_get_attachment_image_attributes', array( $A3_Lazy_Load, 'get_attachment_image_attributes' ), 200 );
 
254
 
255
+ return $A3_Lazy_Load->filter_images( $content );
256
+ }
 
257
 
258
+ static function get_attachment_image_attributes( $attr ) {
259
+ $A3_Lazy_Load = A3_Lazy_Load::_instance();
260
 
261
+ $attr['data-src'] = $attr['src'];
262
+ $attr['src'] = $A3_Lazy_Load->_placeholder_url;
263
+ $attr['class'] = 'lazy-hidden '. $attr['class'];
264
+ $attr['data-lazy-type'] = 'image';
265
 
266
+ return $attr;
267
  }
268
 
269
+ protected function _filter_images( $content, $include_noscript = null ) {
270
+
271
+ if ( null === $include_noscript ) {
272
+ global $a3_lazy_load_global_settings;
273
+
274
+ $include_noscript = $a3_lazy_load_global_settings['a3l_image_include_noscript'];
275
+ }
276
 
277
  $matches = array();
278
  preg_match_all( '/<img[\s\r\n]+.*?>/is', $content, $matches );
280
  $search = array();
281
  $replace = array();
282
 
283
+ if ( is_array( $this->_skip_images_classes ) ) {
284
+ $skip_images_preg_quoted = array_map( 'preg_quote', $this->_skip_images_classes );
285
  $skip_images_regex = sprintf( '/class=".*(%s).*"/s', implode( '|', $skip_images_preg_quoted ) );
286
  }
287
 
289
  foreach ( $matches[0] as $imgHTML ) {
290
 
291
  // 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
292
+ if ( ! ( is_array( $this->_skip_images_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/src=['\"]data:image/is", $imgHTML ) ) {
293
  $i++;
294
  // replace the src and add the data-src attribute
295
  $replaceHTML = '';
302
  $replaceHTML = preg_replace( '/<img/is', '<img class="lazy lazy-hidden"', $replaceHTML );
303
  }
304
 
305
+ if ( $include_noscript ) {
306
  $replaceHTML .= '<noscript>' . $imgHTML . '</noscript>';
307
  }
308
 
320
  return $content;
321
  }
322
 
 
323
 
324
+ static function filter_videos( $content, $include_noscript = null ) {
325
+ if ( is_admin() ) {
326
+ return $content;
327
+ }
328
+
329
+ $run_filter = true;
330
+ $run_filter = apply_filters( 'a3_lazy_load_run_filter', $run_filter );
331
+
332
+ if ( ! $run_filter ) {
333
+ return $content;
334
+ }
335
+
336
+ global $a3_lazy_load_global_settings;
337
+
338
+ $A3_Lazy_Load = A3_Lazy_Load::_instance();
339
+
340
+ $content = apply_filters( 'a3_lazy_load_videos_before', $content );
341
+
342
+ $content = $A3_Lazy_Load->_filter_videos( $content, $include_noscript );
343
+
344
+ $content = apply_filters( 'a3_lazy_load_videos_after', $content );
345
+
346
+ return $content;
347
+ }
348
+
349
+ protected function _filter_videos( $content, $include_noscript = null ) {
350
+
351
+ if ( null === $include_noscript ) {
352
+ global $a3_lazy_load_global_settings;
353
+
354
+ $include_noscript = $a3_lazy_load_global_settings['a3l_video_include_noscript'];
355
+ }
356
+
357
+ //iFrame
358
  $matches = array();
359
+ preg_match_all( '#<iframe(.*?)></iframe>#is', $content, $matches );
360
 
361
  $search = array();
362
  $replace = array();
363
 
364
+ if ( is_array( $this->_skip_videos_classes ) ) {
365
+ $skip_images_preg_quoted = array_map( 'preg_quote', $this->_skip_videos_classes );
366
+ $skip_images_regex = sprintf( '/class=".*(%s).*"/s', implode( '|', $skip_images_preg_quoted ) );
367
+ }
368
 
369
+ $i = 0;
370
+ foreach ( $matches[0] as $imgHTML ) {
371
+ if ( strpos( $imgHTML, 'gform_ajax_frame' ) ) {
372
  continue;
373
  }
374
 
375
+ // 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
376
+ if ( ! ( is_array( $this->_skip_videos_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/data-src=['\"]/is", $imgHTML ) ) {
377
+ $i++;
378
+ // replace the src and add the data-src attribute
379
+ $replaceHTML = '';
380
+ $replaceHTML = preg_replace( '/iframe(.*?)src=/is', 'iframe$1src="' . $this->_placeholder_url . '" data-lazy-type="iframe" data-src=', $imgHTML );
381
+
382
+ // add the lazy class to the img element
383
+ if ( preg_match( '/class=["\']/i', $replaceHTML ) ) {
384
+ $replaceHTML = preg_replace( '/class=(["\'])(.*?)["\']/is', 'class=$1lazy lazy-hidden $2$1', $replaceHTML );
385
+ } else {
386
+ $replaceHTML = preg_replace( '/<iframe/is', '<iframe class="lazy lazy-hidden"', $replaceHTML );
387
+ }
388
+
389
+ if ( $include_noscript ) {
390
+ $replaceHTML .= '<noscript>' . $imgHTML . '</noscript>';
391
+ }
392
+
393
+ array_push( $search, $imgHTML );
394
+ array_push( $replace, $replaceHTML );
395
+ }
396
+ }
397
+
398
+ $search = array_unique( $search );
399
+ $replace = array_unique( $replace );
400
+
401
+ $content = str_replace( $search, $replace, $content );
402
+
403
+ //Video
404
+ $matches = array();
405
+ preg_match_all( '/<video(.+?)video>/', $content, $matches );
406
+
407
+ $search = array();
408
+ $replace = array();
409
+
410
+ if ( is_array( $this->_skip_videos_classes ) ) {
411
+ $skip_images_preg_quoted = array_map( 'preg_quote', $this->_skip_videos_classes );
412
+ $skip_images_regex = sprintf( '/class=".*(%s).*"/s', implode( '|', $skip_images_preg_quoted ) );
413
+ }
414
+
415
+ $i = 0;
416
+ foreach ( $matches[0] as $imgHTML ) {
417
+
418
+ // 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
419
+ if ( ! ( is_array( $this->_skip_videos_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/data-src=['\"]/is", $imgHTML ) ) {
420
+ $i++;
421
+ // replace the src and add the data-src attribute
422
+
423
+
424
+ $replaceHTML = '';
425
+ $replaceHTML = preg_replace( '/video(.*?)src=/is', 'video$1 data-lazy-type="video" data-src=', $imgHTML );
426
+ $replaceHTML = preg_replace( '/video(.*?)poster=/is', 'video$1poster="' . $this->_placeholder_url . '" data-lazy-type="video" data-poster=', $replaceHTML );
427
+
428
+ // add the lazy class to the img element
429
+ if ( preg_match( '/class=["\']/i', $replaceHTML ) ) {
430
+ $replaceHTML = preg_replace( '/class=(["\'])(.*?)["\']/is', 'class=$1lazy lazy-hidden $2$1', $replaceHTML );
431
+ } else {
432
+ $replaceHTML = preg_replace( '/<video/is', '<video class="lazy lazy-hidden"', $replaceHTML );
433
+ }
434
+
435
+ if ( $include_noscript ) {
436
+ $replaceHTML .= '<noscript>' . $imgHTML . '</noscript>';
437
+ }
438
+
439
+ array_push( $search, $imgHTML );
440
+ array_push( $replace, $replaceHTML );
441
+ }
442
+ }
443
+
444
+ $search = array_unique( $search );
445
+ $replace = array_unique( $replace );
446
+
447
+ $content = str_replace( $search, $replace, $content );
448
+
449
+ //return $content;
450
+
451
+ //Embed
452
+ $matches = array();
453
+ preg_match_all( '/<embed\s+.*?>/', $content, $matches );
454
+
455
+ $search = array();
456
+ $replace = array();
457
+
458
+ if ( is_array( $this->_skip_videos_classes ) ) {
459
+ $skip_images_preg_quoted = array_map( 'preg_quote', $this->_skip_videos_classes );
460
+ $skip_images_regex = sprintf( '/class=".*(%s).*"/s', implode( '|', $skip_images_preg_quoted ) );
461
+ }
462
+
463
+ $i = 0;
464
+ foreach ( $matches[0] as $imgHTML ) {
465
 
466
+ // 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
467
+ if ( ! ( is_array( $this->_skip_videos_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/data-src=['\"]/is", $imgHTML ) ) {
468
+ $i++;
469
+ // replace the src and add the data-src attribute
470
+ $replaceHTML = '';
471
+ //$replaceHTML = str_replace("src", 'data-src', $imgHTML);
472
+ $replaceHTML = preg_replace( '/embed(.*?)src=/is', 'embed$1 data-lazy-type="video" data-src=', $imgHTML );
473
+ // add the lazy class to the img element
474
+ if ( preg_match( '/class=["\']/i', $replaceHTML ) ) {
475
+ $replaceHTML = preg_replace( '/class=(["\'])(.*?)["\']/is', 'class=$1lazy lazy-hidden $2$1', $replaceHTML );
476
+ } else {
477
+ $replaceHTML = preg_replace( '/<embed/is', '<embed class="lazy lazy-hidden"', $replaceHTML );
478
+ }
479
+
480
+ if ( $include_noscript ) {
481
+ $replaceHTML .= '<noscript>' . $imgHTML . '</noscript>';
482
+ }
483
 
484
+ array_push( $search, $imgHTML );
485
+ array_push( $replace, $replaceHTML );
486
+ }
487
  }
488
 
489
+ $search = array_unique( $search );
490
+ $replace = array_unique( $replace );
491
+
492
  $content = str_replace( $search, $replace, $content );
493
 
494
+
495
  return $content;
496
  }
497
  }
includes/updates/a3-lazy-load-update-1.1.0.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ $a3l_global_settings = get_option('a3_lazy_load_global_settings', array() );
5
+ $a3l_global_settings['a3l_apply_lazyloadxt'] = $a3l_global_settings['a3l_apply_to_loadimages'];
6
+
7
+ $a3l_global_settings['a3l_apply_to_images'] = $a3l_global_settings['a3l_apply_to_loadimages'];
8
+ $a3l_global_settings['a3l_apply_image_to_content'] = $a3l_global_settings['a3l_apply_to_content'];
9
+ $a3l_global_settings['a3l_apply_image_to_textwidget'] = $a3l_global_settings['a3l_apply_to_textwidget'];
10
+ $a3l_global_settings['a3l_apply_image_to_postthumbnails'] = $a3l_global_settings['a3l_apply_to_postthumbnails'];
11
+ $a3l_global_settings['a3l_apply_image_to_gravatars'] = $a3l_global_settings['a3l_apply_to_gravatars'];
12
+ $a3l_global_settings['a3l_skip_image_with_class'] = $a3l_global_settings['a3l_skip_image_with_class'];
13
+
14
+ $a3l_global_settings['a3l_apply_to_videos'] = $a3l_global_settings['a3l_apply_to_loadimages'];
15
+ $a3l_global_settings['a3l_apply_video_to_content'] = $a3l_global_settings['a3l_apply_to_content'];
16
+ $a3l_global_settings['a3l_apply_video_to_textwidget'] = $a3l_global_settings['a3l_apply_to_textwidget'];
17
+ $a3l_global_settings['a3l_skip_video_with_class'] = $a3l_global_settings['a3l_skip_image_with_class'];
18
+
19
+ update_option('a3_lazy_load_global_settings', $a3l_global_settings);
languages/a3_lazy_load.mo CHANGED
Binary file
languages/a3_lazy_load.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: a3 Lazy Load\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2014-12-23 17:37+0700\n"
6
- "PO-Revision-Date: 2014-12-23 17:37+0700\n"
7
  "Last-Translator: Nguyen Cong Tuan <mr.nguyencongtuan@gmail.com>\n"
8
  "Language-Team: a3rev\n"
9
  "Language: en\n"
@@ -89,25 +89,37 @@ msgstr ""
89
 
90
  #: admin/admin-interface.php:1377 admin/admin-interface.php:1467
91
  #: admin/admin-interface.php:1496
92
- #: admin/settings/template-settings/global-settings.php:193
93
- #: admin/settings/template-settings/global-settings.php:210
94
- #: admin/settings/template-settings/global-settings.php:221
95
- #: admin/settings/template-settings/global-settings.php:232
96
- #: admin/settings/template-settings/global-settings.php:243
97
- #: admin/settings/template-settings/global-settings.php:274
98
- #: admin/settings/template-settings/global-settings.php:286
 
 
 
 
 
 
99
  msgid "ON"
100
  msgstr ""
101
 
102
  #: admin/admin-interface.php:1378 admin/admin-interface.php:1468
103
  #: admin/admin-interface.php:1497
104
- #: admin/settings/template-settings/global-settings.php:194
105
- #: admin/settings/template-settings/global-settings.php:211
106
- #: admin/settings/template-settings/global-settings.php:222
107
- #: admin/settings/template-settings/global-settings.php:233
108
- #: admin/settings/template-settings/global-settings.php:244
109
- #: admin/settings/template-settings/global-settings.php:275
110
- #: admin/settings/template-settings/global-settings.php:287
 
 
 
 
 
 
111
  msgid "OFF"
112
  msgstr ""
113
 
@@ -261,89 +273,157 @@ msgstr ""
261
  msgid "Previously Uploaded"
262
  msgstr ""
263
 
264
- #: admin/settings/template-settings/global-settings.php:139
265
  #: admin/tabs/template-settings/global-settings-tab.php:78
266
  msgid "Global Settings"
267
  msgstr ""
268
 
269
- #: admin/settings/template-settings/global-settings.php:186
270
  msgid "Enable Lazy Load"
271
  msgstr ""
272
 
273
- #: admin/settings/template-settings/global-settings.php:198
274
- msgid "Apply For Objects"
275
  msgstr ""
276
 
277
- #: admin/settings/template-settings/global-settings.php:204
278
- msgid "The Content"
279
  msgstr ""
280
 
281
- #: admin/settings/template-settings/global-settings.php:215
282
- msgid "Widgets"
283
  msgstr ""
284
 
285
- #: admin/settings/template-settings/global-settings.php:226
 
 
 
 
286
  msgid "Post Thumbnails"
287
  msgstr ""
288
 
289
- #: admin/settings/template-settings/global-settings.php:237
290
  msgid "Gravatars"
291
  msgstr ""
292
 
293
- #: admin/settings/template-settings/global-settings.php:248
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  msgid "Theme Loader Function"
295
  msgstr ""
296
 
297
- #: admin/settings/template-settings/global-settings.php:254
298
- msgid "HEADER"
 
299
  msgstr ""
300
 
301
- #: admin/settings/template-settings/global-settings.php:255
302
- msgid "FOOTER"
303
  msgstr ""
304
 
305
- #: admin/settings/template-settings/global-settings.php:259
306
- msgid "Skip Images Classes"
307
  msgstr ""
308
 
309
- #: admin/settings/template-settings/global-settings.php:261
310
- msgid "Comma separated. Example: \"no-lazy, lazy-ignore, image-235\""
311
  msgstr ""
312
 
313
- #: admin/settings/template-settings/global-settings.php:267
314
  msgid "Disable On WPTouch"
315
  msgstr ""
316
 
317
- #: admin/settings/template-settings/global-settings.php:268
318
  msgid "Disables a3 Lazy Load when the WPTouch mobile theme is used"
319
  msgstr ""
320
 
321
- #: admin/settings/template-settings/global-settings.php:279
322
  msgid "Disable On MobilePress"
323
  msgstr ""
324
 
325
- #: admin/settings/template-settings/global-settings.php:280
326
  msgid "Disables a3 Lazy Load when the MobilePress mobile theme is used"
327
  msgstr ""
328
 
329
- #: admin/settings/template-settings/global-settings.php:291
330
  msgid "Effect & Style"
331
  msgstr ""
332
 
333
- #: admin/settings/template-settings/global-settings.php:298
334
- msgid "Effect"
335
  msgstr ""
336
 
337
- #: admin/settings/template-settings/global-settings.php:304
338
- msgid "FADEIN"
339
  msgstr ""
340
 
341
- #: admin/settings/template-settings/global-settings.php:305
342
  msgid "SPINNER"
343
  msgstr ""
344
 
345
- #: admin/settings/template-settings/global-settings.php:309
346
- msgid "Background Blank Image Colour"
347
  msgstr ""
348
 
349
  #: classes/addons/class-a3-lazy-load-addons-page.php:23
2
  msgstr ""
3
  "Project-Id-Version: a3 Lazy Load\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2015-01-23 17:36+0700\n"
6
+ "PO-Revision-Date: 2015-01-23 17:36+0700\n"
7
  "Last-Translator: Nguyen Cong Tuan <mr.nguyencongtuan@gmail.com>\n"
8
  "Language-Team: a3rev\n"
9
  "Language: en\n"
89
 
90
  #: admin/admin-interface.php:1377 admin/admin-interface.php:1467
91
  #: admin/admin-interface.php:1496
92
+ #: admin/settings/template-settings/global-settings.php:198
93
+ #: admin/settings/template-settings/global-settings.php:219
94
+ #: admin/settings/template-settings/global-settings.php:235
95
+ #: admin/settings/template-settings/global-settings.php:245
96
+ #: admin/settings/template-settings/global-settings.php:255
97
+ #: admin/settings/template-settings/global-settings.php:265
98
+ #: admin/settings/template-settings/global-settings.php:283
99
+ #: admin/settings/template-settings/global-settings.php:301
100
+ #: admin/settings/template-settings/global-settings.php:317
101
+ #: admin/settings/template-settings/global-settings.php:327
102
+ #: admin/settings/template-settings/global-settings.php:345
103
+ #: admin/settings/template-settings/global-settings.php:379
104
+ #: admin/settings/template-settings/global-settings.php:390
105
  msgid "ON"
106
  msgstr ""
107
 
108
  #: admin/admin-interface.php:1378 admin/admin-interface.php:1468
109
  #: admin/admin-interface.php:1497
110
+ #: admin/settings/template-settings/global-settings.php:199
111
+ #: admin/settings/template-settings/global-settings.php:220
112
+ #: admin/settings/template-settings/global-settings.php:236
113
+ #: admin/settings/template-settings/global-settings.php:246
114
+ #: admin/settings/template-settings/global-settings.php:256
115
+ #: admin/settings/template-settings/global-settings.php:266
116
+ #: admin/settings/template-settings/global-settings.php:284
117
+ #: admin/settings/template-settings/global-settings.php:302
118
+ #: admin/settings/template-settings/global-settings.php:318
119
+ #: admin/settings/template-settings/global-settings.php:328
120
+ #: admin/settings/template-settings/global-settings.php:346
121
+ #: admin/settings/template-settings/global-settings.php:380
122
+ #: admin/settings/template-settings/global-settings.php:391
123
  msgid "OFF"
124
  msgstr ""
125
 
273
  msgid "Previously Uploaded"
274
  msgstr ""
275
 
276
+ #: admin/settings/template-settings/global-settings.php:145
277
  #: admin/tabs/template-settings/global-settings-tab.php:78
278
  msgid "Global Settings"
279
  msgstr ""
280
 
281
+ #: admin/settings/template-settings/global-settings.php:191
282
  msgid "Enable Lazy Load"
283
  msgstr ""
284
 
285
+ #: admin/settings/template-settings/global-settings.php:208
286
+ msgid "Lazy Load Images"
287
  msgstr ""
288
 
289
+ #: admin/settings/template-settings/global-settings.php:213
290
+ msgid "Enable Lazy Load for Images"
291
  msgstr ""
292
 
293
+ #: admin/settings/template-settings/global-settings.php:229
294
+ msgid "Images in Content"
295
  msgstr ""
296
 
297
+ #: admin/settings/template-settings/global-settings.php:239
298
+ msgid "Images in Widgets"
299
+ msgstr ""
300
+
301
+ #: admin/settings/template-settings/global-settings.php:249
302
  msgid "Post Thumbnails"
303
  msgstr ""
304
 
305
+ #: admin/settings/template-settings/global-settings.php:259
306
  msgid "Gravatars"
307
  msgstr ""
308
 
309
+ #: admin/settings/template-settings/global-settings.php:269
310
+ msgid "Skip Images Classes"
311
+ msgstr ""
312
+
313
+ #: admin/settings/template-settings/global-settings.php:271
314
+ msgid "Comma separated. Example: \"no-lazy, lazy-ignore, image-235\""
315
+ msgstr ""
316
+
317
+ #: admin/settings/template-settings/global-settings.php:276
318
+ #: admin/settings/template-settings/global-settings.php:338
319
+ msgid "Noscript Support"
320
+ msgstr ""
321
+
322
+ #: admin/settings/template-settings/global-settings.php:278
323
+ msgid ""
324
+ "Turn ON to activate Noscript tag as a fallback to show images for users who "
325
+ "have JavaScript disabled in their browser."
326
+ msgstr ""
327
+
328
+ #: admin/settings/template-settings/global-settings.php:289
329
+ msgid "Lazy Load Videos and iframes"
330
+ msgstr ""
331
+
332
+ #: admin/settings/template-settings/global-settings.php:294
333
+ msgid "Video and iframes"
334
+ msgstr ""
335
+
336
+ #: admin/settings/template-settings/global-settings.php:295
337
+ #, php-format
338
+ msgid ""
339
+ "Turn ON to activate Lazy Load for <a href=\"%s\" target=\"_blank\">WordPress "
340
+ "Embeds</a>, <a href=\"%s\" target=\"_blank\">HTML5 Video</a> and content "
341
+ "loaded by iframe from all sources. Note: WordPress Shortcode is not "
342
+ "supported."
343
+ msgstr ""
344
+
345
+ #: admin/settings/template-settings/global-settings.php:311
346
+ msgid "In Content"
347
+ msgstr ""
348
+
349
+ #: admin/settings/template-settings/global-settings.php:321
350
+ msgid "In Widgets"
351
+ msgstr ""
352
+
353
+ #: admin/settings/template-settings/global-settings.php:331
354
+ msgid "Skip Videos Classes"
355
+ msgstr ""
356
+
357
+ #: admin/settings/template-settings/global-settings.php:333
358
+ msgid "Comma separated. Example: \"no-lazy, lazy-ignore, video-235\""
359
+ msgstr ""
360
+
361
+ #: admin/settings/template-settings/global-settings.php:340
362
+ msgid ""
363
+ "Turn ON to activate Noscript tag as a fallback to show WordPress Embeds, "
364
+ "HTML 5 Video and iframe loaded content for users who have JavaScript "
365
+ "disabled in their browser."
366
+ msgstr ""
367
+
368
+ #: admin/settings/template-settings/global-settings.php:350
369
+ msgid "Script Load Optimization"
370
+ msgstr ""
371
+
372
+ #: admin/settings/template-settings/global-settings.php:355
373
  msgid "Theme Loader Function"
374
  msgstr ""
375
 
376
+ #: admin/settings/template-settings/global-settings.php:356
377
+ msgid ""
378
+ "Your theme must have the wp_footer() function if you select FOOTER load."
379
  msgstr ""
380
 
381
+ #: admin/settings/template-settings/global-settings.php:362
382
+ msgid "HEADER"
383
  msgstr ""
384
 
385
+ #: admin/settings/template-settings/global-settings.php:363
386
+ msgid "FOOTER"
387
  msgstr ""
388
 
389
+ #: admin/settings/template-settings/global-settings.php:367
390
+ msgid "WordPress Mobile Template Plugins"
391
  msgstr ""
392
 
393
+ #: admin/settings/template-settings/global-settings.php:372
394
  msgid "Disable On WPTouch"
395
  msgstr ""
396
 
397
+ #: admin/settings/template-settings/global-settings.php:373
398
  msgid "Disables a3 Lazy Load when the WPTouch mobile theme is used"
399
  msgstr ""
400
 
401
+ #: admin/settings/template-settings/global-settings.php:383
402
  msgid "Disable On MobilePress"
403
  msgstr ""
404
 
405
+ #: admin/settings/template-settings/global-settings.php:384
406
  msgid "Disables a3 Lazy Load when the MobilePress mobile theme is used"
407
  msgstr ""
408
 
409
+ #: admin/settings/template-settings/global-settings.php:395
410
  msgid "Effect & Style"
411
  msgstr ""
412
 
413
+ #: admin/settings/template-settings/global-settings.php:401
414
+ msgid "Loading Effect"
415
  msgstr ""
416
 
417
+ #: admin/settings/template-settings/global-settings.php:407
418
+ msgid "FADE IN"
419
  msgstr ""
420
 
421
+ #: admin/settings/template-settings/global-settings.php:408
422
  msgid "SPINNER"
423
  msgstr ""
424
 
425
+ #: admin/settings/template-settings/global-settings.php:411
426
+ msgid "Loading Background Colour"
427
  msgstr ""
428
 
429
  #: classes/addons/class-a3-lazy-load-addons-page.php:23
readme.txt CHANGED
@@ -4,49 +4,78 @@ 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.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
- Use a3 Lazy Load to instantly improve your sites load time while dramatically improving site visitors user experience.
12
 
13
  == Description ==
14
 
15
- Inspired by Facebook lazy Load UI - a3 lazy Load is a Mobile Oriented, easily customizable plugin that will speed up site performance, the more content heavy your site the better the plugin will perform and the more you will see the improvements in performance. a3 Lazy Load is inspired by and powered by the ressio [Lazy-Load-xt JavaScript](https://github.com/ressio/lazy-load-xt).
16
 
17
- a3 Lazy load reduces the number of http calls when a page loads by only loading elements on a page that are visible in the users browser. As the user scroll down the page the next lot of elements are loaded as they become visible in the view port.
18
 
19
- = Easy Configuration =
20
 
21
- From the admin panel use ON | OFF switches to activate or deactivate lazy load on these elements. - See Screenshot
22
 
23
- * Lazy load images
24
- * Apply to content
25
- * Apply to text widgets
 
26
  * Apply to post thumbnails
27
  * Apply to gravatars
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  = Lazy Load Effects =
30
 
31
- a3 lazy Load gives you the option to lazy load images with a FADE IN or SPINNER effect.
32
 
33
  * FADEIN [see demo](http://ressio.github.io/lazy-load-xt/demo/fadein.htm)
34
  * SPINNER [see demo](http://ressio.github.io/lazy-load-xt/demo/spinner.htm)
 
35
 
36
  = WooCommerce =
37
 
38
- a3 lazy Load is built and tested to be fully compatible with the WooCommerce plugin.
39
 
40
- = Asset Load =
41
 
42
  a3 Lazy Load gives you the option to load its script from your sites HEAD or from the FOOT.
43
 
44
  * Note that your theme must have the wp_footer() function if you select FOOTER load.
45
  * Note the plugin CSS is always loaded from the HEAD.
46
 
47
- = Exempt Images =
 
 
48
 
49
- a3 Lazy Load allows you to easily exempt any image from having the Lazy Load effect applied.
 
 
50
 
51
  = Theme Compatibility =
52
 
@@ -81,7 +110,6 @@ a3 lazy Load is tested 100% compatible with all major browsers.
81
 
82
  = More Features =
83
 
84
- * Full support for responsive images.
85
  * Full support of jQueryMobile framework
86
  * WordPress Multi site ready.
87
  * Backend support for RTL display.
@@ -109,13 +137,32 @@ Automatic installation is the easiest option as WordPress handles the file trans
109
 
110
  1. Install and activate the plugin
111
 
112
- 2. On wp-admin a3 Lazy Laod one page admin panel check the settings.
113
 
114
  3. Enjoy
115
 
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.
@@ -132,7 +179,10 @@ Automatic installation is the easiest option as WordPress handles the file trans
132
  * First working release
133
 
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.
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.1.0
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
+ Use a3 Lazy Load for images, videos, iframes. Instantly improve your sites load time and dramatically improve site user�s experience.
12
 
13
  == Description ==
14
 
15
+ a3 Lazy Load is a Mobile Oriented, simple to use plugin that will speed up site performance. The more content heavy your site the better the plugin will perform and the more you will see the improvements in performance. See [this demo](http://ressio.github.io/lazy-load-xt/demo/stresstest1000img.htm) of a page with 1,000 images (yes 1,000 images) to load.
16
 
17
+ a3 Lazy Load is inspired by and powered by the ressio [Lazy-Load-xt JavaScript](https://github.com/ressio/lazy-load-xt).
18
 
19
+ a3 Lazy Load is the most fully featured lazy load plugin for WordPress. Use the plugins admin settings to easily define what elements are lazy loaded when they become visible in the users browser. As the user scroll down the page the next lot of elements you have applied lazy Load to are only loaded as they become visible in the view port.
20
 
21
+ = Image Lazy Load =
22
 
23
+ 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
24
+
25
+ * Post and Pages (All Content areas)
26
+ * Widgets (Sidebar, header and footer)
27
  * Apply to post thumbnails
28
  * Apply to gravatars
29
 
30
+ = More than just Images =
31
+
32
+ = Video Lazy Load =
33
+
34
+ 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. Note - embed video by WordPress shortcode is not supported.
35
+
36
+ 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
37
+
38
+ * Post and Pages (All Content areas)
39
+ * Widgets (Sidebar, header and footer)
40
+
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
+
44
+ = Elements loaded by iframe =
45
+
46
+ a3 Lazy Load has built in support for content that is added by iframe from any source in content and widgets - examples
47
+
48
+ * WordPress embedded media
49
+ * Facebook Like boxes with profiles, Like buttons, Recommend
50
+ * Google+ Profile
51
+ * Google Maps
52
+
53
  = Lazy Load Effects =
54
 
55
+ a3 Lazy Load gives you the option to lazy load images with a FADE IN or SPINNER effect.
56
 
57
  * FADEIN [see demo](http://ressio.github.io/lazy-load-xt/demo/fadein.htm)
58
  * SPINNER [see demo](http://ressio.github.io/lazy-load-xt/demo/spinner.htm)
59
+ * Option to create a custom Lazy Load pre-load background colour
60
 
61
  = WooCommerce =
62
 
63
+ a3 lazy Load is built and tested to be fully compatible with the very widely used WooCommerce plugin.
64
 
65
+ = Performance Tweak =
66
 
67
  a3 Lazy Load gives you the option to load its script from your sites HEAD or from the FOOT.
68
 
69
  * Note that your theme must have the wp_footer() function if you select FOOTER load.
70
  * Note the plugin CSS is always loaded from the HEAD.
71
 
72
+ = Exclude Images and Videos =
73
+
74
+ a3 Lazy Load allows you to easily exclude any images and video by class name from having the Lazy Load effect applied.
75
 
76
+ = JavaScript Disabled Fallback =
77
+
78
+ 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.
79
 
80
  = Theme Compatibility =
81
 
110
 
111
  = More Features =
112
 
 
113
  * Full support of jQueryMobile framework
114
  * WordPress Multi site ready.
115
  * Backend support for RTL display.
137
 
138
  1. Install and activate the plugin
139
 
140
+ 2. On wp-admin a3 Lazy Load one page admin panel check the settings.
141
 
142
  3. Enjoy
143
 
144
 
145
  == Changelog ==
146
 
147
+ = 1.1.0 - 2015/01/23 =
148
+ * Feature - Added support for all WordPress video Embeds including Youtube, Vimeo and HTML5 video
149
+ * Feature - Added support for content that is added by iframe from any source in post and page content and widgets
150
+ * Feature - Added ON | OFF option for Noscript parameter for both images and video and iframes - fallback if user does not have JavaScript support turned on in browser.
151
+ * Tweak - Reworked the plugins admin panel for new feature options. Separate settings for Images and Video / iframes
152
+ * Tweak - Updated all the admin panel text and add new help text.
153
+ * Tweak - Updated the plugins WordPress description with new features.
154
+ * Tweak - Updated the plugins WordPress screenshot
155
+ * Tweak - Updated the plugins WordPress banner image.
156
+ * Dev - Updated 'a3_lazy_load_enable' function to edit their image or video attribute to enable a3 lazy load images or videos loaded by 3rd party application.
157
+ * Dev - Defined 'a3_lazy_load_image_enable' function to edit image attribute to enable a3 lazy load to apply images loaded by 3rd party applications.
158
+ * Dev - Defined 'a3_lazy_load_video_enable' function to edit image attribute so a3 lazy load script can apply to the videos, iframe.
159
+ * Dev - Include 'var a3_lazyload_params = {"apply_images":"1","apply_videos":"1"};' JavaScript variable into frontend that get the option that are set from admin panel. Plugin and Theme developers can use that variable inside own script to check when Lazy Load apply for Image and for Video instead of use 'a3_lazy_load_video_enable' and 'a3_lazy_load_video_enable' functions in PHP code
160
+ * Dev - Remove 'a3_lazy_load_skip_classes' filter tag, we will replace another filter for separate filters for image and videos
161
+ * Dev - Defined 'a3_lazy_load_skip_images_classes' filter tag. Developers can add another class css name for images that they don't want lazy load applied too.
162
+ * Dev - Defined 'a3_lazy_load_skip_videos_classes' filter tag. Developers can add another class css name for video that they don't want lazy load applied too.
163
+ * Dev - Added default exclude class 'a3-notlazy' so developers can easily apply it to videos that they don't want Lazy Load to apply to.
164
+ * Dev - Defined 'a3_lazy_load_videos' filter. Plugin and Theme developers can use this filter and parse the content with videos or iframe and the filter will return content with change on videos or iframe that a3 Lazy Load support
165
+
166
  = 1.0.2 - 2015/01/20 =
167
  * Tweak - Include wp_deregister_script( 'jquery-lazyloadxt' ) before wp_enqueue_script( 'jquery-lazyloadxt' ) for compatibility with a3 Portfolio plugin which supports video slides
168
  * 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.
179
  * First working release
180
 
181
 
182
+ == Upgrade Notice ==
183
+
184
+ = 1.1.0 =
185
+ Major version release. Added support for WordPress Embeds - Youtube, Vimeo, HTML5 video and iframe content from all sources.
186
 
187
  = 1.0.2 =
188
  Upgrade now for an a3 Portfolio plugin compatibility code tweak and a new Dev parameter and exclude class.