Lazy Load by WP Rocket - Version 2.1.3

Version Description

  • Bugfix: Ignore content inside noscript tags to prevent modifying them and causing some display issues
Download this release

Release Info

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

Code changes from version 2.1.2 to 2.1.3

readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: lazyload, lazy load, images, iframes, thumbnail, thumbnails, smiley, smili
4
  Requires at least: 4.7
5
  Tested up to: 5.1
6
  Requires PHP: 5.4
7
- Stable tag: 2.1.2
8
 
9
  Lazy Load your images and iframes, replace Youtube videos by a preview thumbnail.
10
 
@@ -85,6 +85,9 @@ You can also apply it manually. The element you want to apply lazyload on must h
85
  The element must have the class `rocket-lazyload-bg`, and a `data-bg` attribute, which value is the CSS url for the image.
86
 
87
  == Changelog ==
 
 
 
88
  = 2.1.2 =
89
  * Enhancement: Update lazyload script to the latest version
90
  * Enhancement: Add a way to lazyload the Youtube thumbnail image
4
  Requires at least: 4.7
5
  Tested up to: 5.1
6
  Requires PHP: 5.4
7
+ Stable tag: 2.1.3
8
 
9
  Lazy Load your images and iframes, replace Youtube videos by a preview thumbnail.
10
 
85
  The element must have the class `rocket-lazyload-bg`, and a `data-bg` attribute, which value is the CSS url for the image.
86
 
87
  == Changelog ==
88
+ = 2.1.3 =
89
+ * Bugfix: Ignore content inside noscript tags to prevent modifying them and causing some display issues
90
+
91
  = 2.1.2 =
92
  * Enhancement: Update lazyload script to the latest version
93
  * Enhancement: Add a way to lazyload the Youtube thumbnail image
rocket-lazy-load.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Lazy Load by WP Rocket
4
  * Plugin URI: http://wordpress.org/plugins/rocket-lazy-load/
5
  * Description: The tiny Lazy Load script for WordPress without jQuery or others libraries.
6
- * Version: 2.1.2
7
  * Author: WP Rocket
8
  * Author URI: https://wp-rocket.me
9
  * Text Domain: rocket-lazy-load
@@ -29,7 +29,7 @@
29
 
30
  defined('ABSPATH') || die('Cheatin\' uh?');
31
 
32
- define('ROCKET_LL_VERSION', '2.1.2');
33
  define('ROCKET_LL_WP_VERSION', '4.7');
34
  define('ROCKET_LL_PHP_VERSION', '5.4');
35
  define('ROCKET_LL_BASENAME', plugin_basename(__FILE__));
3
  * Plugin Name: Lazy Load by WP Rocket
4
  * Plugin URI: http://wordpress.org/plugins/rocket-lazy-load/
5
  * Description: The tiny Lazy Load script for WordPress without jQuery or others libraries.
6
+ * Version: 2.1.3
7
  * Author: WP Rocket
8
  * Author URI: https://wp-rocket.me
9
  * Text Domain: rocket-lazy-load
29
 
30
  defined('ABSPATH') || die('Cheatin\' uh?');
31
 
32
+ define('ROCKET_LL_VERSION', '2.1.3');
33
  define('ROCKET_LL_WP_VERSION', '4.7');
34
  define('ROCKET_LL_PHP_VERSION', '5.4');
35
  define('ROCKET_LL_BASENAME', plugin_basename(__FILE__));
src/Subscriber/LazyloadSubscriber.php CHANGED
@@ -316,6 +316,7 @@ class LazyloadSubscriber implements SubscriberInterface
316
  public function lazyloadBuffer($html)
317
  {
318
  $buffer = $this->ignoreScripts($html);
 
319
 
320
  if ($this->option_array->get('images')) {
321
  $html = $this->image->lazyloadImages($html, $buffer);
@@ -392,4 +393,15 @@ class LazyloadSubscriber implements SubscriberInterface
392
  {
393
  return preg_replace('/<script\b(?:[^>]*)>(?:.+)?<\/script>/Umsi', '', $html);
394
  }
 
 
 
 
 
 
 
 
 
 
 
395
  }
316
  public function lazyloadBuffer($html)
317
  {
318
  $buffer = $this->ignoreScripts($html);
319
+ $buffer = $this->ignoreNoScripts($html);
320
 
321
  if ($this->option_array->get('images')) {
322
  $html = $this->image->lazyloadImages($html, $buffer);
393
  {
394
  return preg_replace('/<script\b(?:[^>]*)>(?:.+)?<\/script>/Umsi', '', $html);
395
  }
396
+
397
+ /**
398
+ * Remove noscript tags from the HTML to parse
399
+ *
400
+ * @param string $html HTML content.
401
+ * @return string
402
+ */
403
+ private function ignoreNoScripts($html)
404
+ {
405
+ return preg_replace('#<noscript>(?:.+)</noscript>#Umsi', '', $html);
406
+ }
407
  }