Lazy Load by WP Rocket - Version 1.2.1

Version Description

  • 22 aug. 2017
  • Fix missing lazyload script
  • Don't lazyload for images in REST API requests
Download this release

Release Info

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

Code changes from version 1.2 to 1.2.1

Files changed (2) hide show
  1. readme.txt +7 -2
  2. rocket-lazy-load.php +7 -7
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Rocket Lazy Load ===
2
- Contributors: Contributors: geekpress, tabrisrp, creativejuiz, 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.8.1
6
- Stable tag: 1.2
7
 
8
  The tiny Lazy Load script for WordPress without jQuery or others libraries.
9
 
@@ -45,6 +45,11 @@ function deactivate_rocket_lazyload_on_single() {
45
  Simply add a 'data-no-lazy="1"' property in you IMG tag.
46
 
47
  == Changelog ==
 
 
 
 
 
48
  = 1.2 =
49
  * 22 aug. 2017
50
  * Update lazyload script to latest version
1
  === Rocket Lazy Load ===
2
+ Contributors: creativejuiz, tabrisrp, 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.8.1
6
+ Stable tag: 1.2.1
7
 
8
  The tiny Lazy Load script for WordPress without jQuery or others libraries.
9
 
45
  Simply add a 'data-no-lazy="1"' property in you IMG tag.
46
 
47
  == Changelog ==
48
+ = 1.2.1 =
49
+ * 22 aug. 2017
50
+ * Fix missing lazyload script
51
+ * Don't lazyload for images in REST API requests
52
+
53
  = 1.2 =
54
  * 22 aug. 2017
55
  * Update lazyload script to latest version
rocket-lazy-load.php CHANGED
@@ -5,7 +5,7 @@ defined( 'ABSPATH' ) || 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.2
9
  * Author: WP Media
10
  * Author URI: https://wp-rocket.me
11
  * Text Domain: rocket-lazy-load
@@ -118,14 +118,14 @@ add_action( 'wp_footer', 'rocket_lazyload_script', 9 );
118
  * @author Remy Perona
119
  */
120
  function rocket_lazyload_enqueue() {
121
- if ( ( ! get_rocket_option( 'lazyload' ) && ! get_rocket_option( 'lazyload_iframes' ) ) || ( ! apply_filters( 'do_rocket_lazyload', true ) && ! apply_filters( 'do_rocket_lazyload_iframes', true ) ) ) {
122
  return;
123
  }
124
 
125
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
126
- $lazyload_url = get_rocket_cdn_url( WP_ROCKET_FRONT_JS_URL . 'lazyload-' . WP_ROCKET_LAZYLOAD_JS_VERSION . $suffix . '.js', array( 'all', 'css_and_js', 'js' ) );
127
 
128
- wp_enqueue_script( 'rocket-lazyload', $lazyload_url, null, null, true );
129
  }
130
  add_action( 'wp_enqueue_scripts', 'rocket_lazyload_enqueue', PHP_INT_MAX );
131
 
@@ -159,8 +159,8 @@ add_filter( 'script_loader_tag', 'rocket_lazyload_async_script', 10, 2 );
159
  * @return string Updated HTML code
160
  */
161
  function rocket_lazyload_images( $html ) {
162
- // Don't LazyLoad if the thumbnail is in admin, a feed or a post preview.
163
- if ( ! rocket_lazyload_get_option( 'images' ) || is_admin() || is_feed() || is_preview() || empty( $html ) || ( defined( 'DONOTLAZYLOAD' ) && DONOTLAZYLOAD ) || wp_script_is( 'twentytwenty-twentytwenty', 'enqueued' ) ) {
164
  return $html;
165
  }
166
 
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.2.1
9
  * Author: WP Media
10
  * Author URI: https://wp-rocket.me
11
  * Text Domain: rocket-lazy-load
118
  * @author Remy Perona
119
  */
120
  function rocket_lazyload_enqueue() {
121
+ if ( ! rocket_lazyload_get_option( 'images' ) && ! rocket_lazyload_get_option( 'iframes' ) || ! apply_filters( 'do_rocket_lazyload', true ) ) {
122
  return;
123
  }
124
 
125
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
126
+ $ll_url = ROCKET_LL_FRONT_JS_URL . 'lazyload-' . ROCKET_LL_JS_VERSION . $suffix . '.js';
127
 
128
+ wp_enqueue_script( 'rocket-lazyload', $ll_url, null, null, true );
129
  }
130
  add_action( 'wp_enqueue_scripts', 'rocket_lazyload_enqueue', PHP_INT_MAX );
131
 
159
  * @return string Updated HTML code
160
  */
161
  function rocket_lazyload_images( $html ) {
162
+ // Don't LazyLoad if the thumbnail is in admin, a feed, REST API or a post preview.
163
+ if ( ! rocket_lazyload_get_option( 'images' ) || is_admin() || is_feed() || is_preview() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || empty( $html ) || ( defined( 'DONOTLAZYLOAD' ) && DONOTLAZYLOAD ) || wp_script_is( 'twentytwenty-twentytwenty', 'enqueued' ) ) {
164
  return $html;
165
  }
166