Lazy Load by WP Rocket - Version 1.0.2

Version Description

  • 28 dec. 2014
  • Improvement: Add rocket_lazyload_html filter to manage the output that will be printed.
Download this release

Release Info

Developer wp_media
Plugin Icon 128x128 Lazy Load by WP Rocket
Version 1.0.2
Comparing to
See all releases

Code changes from version 1.0.1.1 to 1.0.2

Files changed (2) hide show
  1. readme.txt +6 -2
  2. rocket-lazy-load.php +13 -2
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: juliobox, geekpress, wp_media
3
  Tags: lazyload, lazy load, images, thumbnail, thumbnails, smiley, smilies, avatar, gravatar
4
  Requires at least: 3.0
5
- Tested up to: 4.0
6
- Stable tag: 1.0.1.1
7
 
8
  The tiny Lazy Load script for WordPress without jQuery or others libraries.
9
 
@@ -44,6 +44,10 @@ Simply add a 'data-no-lazy="1"' property in you IMG tag.
44
 
45
  == Changelog ==
46
 
 
 
 
 
47
  = 1.0.1.1 =
48
  * 25 jul. 2014
49
  * Fix stupid error with new regex in 1.0.1
2
  Contributors: juliobox, geekpress, wp_media
3
  Tags: lazyload, lazy load, images, thumbnail, thumbnails, smiley, smilies, avatar, gravatar
4
  Requires at least: 3.0
5
+ Tested up to: 4.1
6
+ Stable tag: 1.0.2
7
 
8
  The tiny Lazy Load script for WordPress without jQuery or others libraries.
9
 
44
 
45
  == Changelog ==
46
 
47
+ = 1.0.2 =
48
+ * 28 dec. 2014
49
+ * Improvement: Add « rocket_lazyload_html » filter to manage the output that will be printed.
50
+
51
  = 1.0.1.1 =
52
  * 25 jul. 2014
53
  * Fix stupid error with new regex in 1.0.1
rocket-lazy-load.php CHANGED
@@ -5,7 +5,7 @@ defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
5
  Plugin Name: Rocket Lazy Load
6
  Plugin URI: http://wordpress.org/plugins/rocket-lazy-load/
7
  Description: The tiny Lazy Load script for WordPress without jQuery or others libraries.
8
- Version: 1.0.1.1
9
  Author: WP Media
10
  Author URI: http://wp-rocket.me
11
 
@@ -76,8 +76,19 @@ function rocket_lazyload_images( $html ) {
76
  */
77
  function __rocket_lazyload_replace_callback( $matches ) {
78
  if ( strpos( $matches[1] . $matches[3], 'data-no-lazy=' ) === false && strpos( $matches[1] . $matches[3], 'data-lazy-original=' ) === false ) {
79
- return sprintf( '<img%1$s src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-lazy-original=%2$s%3$s><noscript><img%1$s src=%2$s%3$s></noscript>',
80
  $matches[1], $matches[2], $matches[3] );
 
 
 
 
 
 
 
 
 
 
 
81
  } else {
82
  return $matches[0];
83
  }
5
  Plugin Name: Rocket Lazy Load
6
  Plugin URI: http://wordpress.org/plugins/rocket-lazy-load/
7
  Description: The tiny Lazy Load script for WordPress without jQuery or others libraries.
8
+ Version: 1.0.2
9
  Author: WP Media
10
  Author URI: http://wp-rocket.me
11
 
76
  */
77
  function __rocket_lazyload_replace_callback( $matches ) {
78
  if ( strpos( $matches[1] . $matches[3], 'data-no-lazy=' ) === false && strpos( $matches[1] . $matches[3], 'data-lazy-original=' ) === false ) {
79
+ $html = sprintf( '<img%1$s src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-lazy-original=%2$s%3$s><noscript><img%1$s src=%2$s%3$s></noscript>',
80
  $matches[1], $matches[2], $matches[3] );
81
+
82
+ /**
83
+ * Filter the LazyLoad HTML output
84
+ *
85
+ * @since 1.0.2
86
+ *
87
+ * @param array $html Output that will be printed
88
+ */
89
+ $html = apply_filters( 'rocket_lazyload_html', $html, true );
90
+
91
+ return $html;
92
  } else {
93
  return $matches[0];
94
  }