diff --git a/composer.lock b/composer.lock index 2cdf944..e7e5257 100644 --- a/composer.lock +++ b/composer.lock @@ -273,16 +273,16 @@ }, { "name": "wp-media/rocket-lazyload-common", - "version": "v2.3.5", + "version": "v2.4", "source": { "type": "git", "url": "https://github.com/wp-media/rocket-lazyload-common.git", - "reference": "0c84f5721fc473bc53157cdf33c54df6e15aba79" + "reference": "fcebb3db1687ce4f88854c6fbc67a36e8ae9e2bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-media/rocket-lazyload-common/zipball/0c84f5721fc473bc53157cdf33c54df6e15aba79", - "reference": "0c84f5721fc473bc53157cdf33c54df6e15aba79", + "url": "https://api.github.com/repos/wp-media/rocket-lazyload-common/zipball/fcebb3db1687ce4f88854c6fbc67a36e8ae9e2bf", + "reference": "fcebb3db1687ce4f88854c6fbc67a36e8ae9e2bf", "shasum": "" }, "require": { @@ -317,7 +317,7 @@ } ], "description": "Common Code between WP Rocket and Lazyload by WP Rocket", - "time": "2019-05-01T14:57:17+00:00" + "time": "2019-07-08T16:41:10+00:00" } ], "packages-dev": [ @@ -711,16 +711,16 @@ }, { "name": "phpcompatibility/php-compatibility", - "version": "9.1.1", + "version": "9.2.0", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", - "reference": "2b63c5d284ab8857f7b1d5c240ddb507a6b2293c" + "reference": "3db1bf1e28123fd574a4ae2e9a84072826d51b5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/2b63c5d284ab8857f7b1d5c240ddb507a6b2293c", - "reference": "2b63c5d284ab8857f7b1d5c240ddb507a6b2293c", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/3db1bf1e28123fd574a4ae2e9a84072826d51b5e", + "reference": "3db1bf1e28123fd574a4ae2e9a84072826d51b5e", "shasum": "" }, "require": { @@ -734,7 +734,7 @@ "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, "type": "phpcodesniffer-standard", @@ -765,7 +765,7 @@ "phpcs", "standards" ], - "time": "2018-12-30T23:16:27+00:00" + "time": "2019-06-27T19:58:56+00:00" }, { "name": "phpcompatibility/phpcompatibility-paragonie", @@ -1021,16 +1021,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.8.0", + "version": "1.8.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" + "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76", + "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76", "shasum": "" }, "require": { @@ -1051,8 +1051,8 @@ } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "Prophecy\\": "src/Prophecy" } }, "notification-url": "https://packagist.org/downloads/", @@ -1080,7 +1080,7 @@ "spy", "stub" ], - "time": "2018-08-05T17:53:17+00:00" + "time": "2019-06-13T12:50:23+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2097,16 +2097,16 @@ }, { "name": "symfony/yaml", - "version": "v4.2.8", + "version": "v4.3.2", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "6712daf03ee25b53abb14e7e8e0ede1a770efdb1" + "reference": "c60ecf5ba842324433b46f58dc7afc4487dbab99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/6712daf03ee25b53abb14e7e8e0ede1a770efdb1", - "reference": "6712daf03ee25b53abb14e7e8e0ede1a770efdb1", + "url": "https://api.github.com/repos/symfony/yaml/zipball/c60ecf5ba842324433b46f58dc7afc4487dbab99", + "reference": "c60ecf5ba842324433b46f58dc7afc4487dbab99", "shasum": "" }, "require": { @@ -2125,7 +2125,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -2152,7 +2152,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-03-30T15:58:42+00:00" + "time": "2019-04-06T14:04:46+00:00" }, { "name": "webmozart/assert", @@ -2207,16 +2207,16 @@ }, { "name": "wp-coding-standards/wpcs", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", - "url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git", - "reference": "8c7a2e7682de9ef5955251874b639deda51ef470" + "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", + "reference": "bd9c33152115e6741e3510ff7189605b35167908" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/8c7a2e7682de9ef5955251874b639deda51ef470", - "reference": "8c7a2e7682de9ef5955251874b639deda51ef470", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/bd9c33152115e6741e3510ff7189605b35167908", + "reference": "bd9c33152115e6741e3510ff7189605b35167908", "shasum": "" }, "require": { @@ -2248,7 +2248,7 @@ "standards", "wordpress" ], - "time": "2019-04-08T10:53:57+00:00" + "time": "2019-05-21T02:50:00+00:00" } ], "aliases": [], diff --git a/readme.txt b/readme.txt index b1228a4..cf654f6 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: lazyload, lazy load, images, iframes, thumbnail, thumbnails, smiley, smili Requires at least: 4.7 Tested up to: 5.2 Requires PHP: 5.6 -Stable tag: 2.2.2 +Stable tag: 2.2.3 Lazy Load your images and iframes, replace Youtube videos by a preview thumbnail. @@ -85,6 +85,14 @@ You can also apply it manually. The element you want to apply lazyload on must h The element must have the class `rocket-lazyload`, and a `data-bg` attribute, which value is the CSS url for the image. == Changelog == += 2.2.3 = +* Enhancement: Improve compatibility for the picture element +* Enhancement: Apply lazyload on background images set on section, span and li elements +* Enhancement: also pass $width and $height values to the rocket_lazyload_placeholder filter +* Bugfix: Use 0 instead of 1 for the default placeholder dimensions to improve compatibility +* Bugfix: Improve infinite scroll support +* Bugfix: Exclude Enfold avia-background-fixed background images and data-large_image from lazyload + = 2.2.2 = * Bugfix: Auto-exclude data-height-percentage attribute to prevent display issues * Bugfix: Correctly handle responsive videos using fitVids again diff --git a/rocket-lazy-load.php b/rocket-lazy-load.php index e136f06..43f9080 100644 --- a/rocket-lazy-load.php +++ b/rocket-lazy-load.php @@ -3,7 +3,7 @@ * Plugin Name: Lazy Load by WP Rocket * Plugin URI: http://wordpress.org/plugins/rocket-lazy-load/ * Description: The tiny Lazy Load script for WordPress without jQuery or others libraries. - * Version: 2.2.2 + * Version: 2.2.3 * Author: WP Rocket * Author URI: https://wp-rocket.me * Text Domain: rocket-lazy-load @@ -29,7 +29,7 @@ defined('ABSPATH') || die('Cheatin\' uh?'); -define('ROCKET_LL_VERSION', '2.2.2'); +define('ROCKET_LL_VERSION', '2.2.3'); define('ROCKET_LL_WP_VERSION', '4.7'); define('ROCKET_LL_PHP_VERSION', '5.6'); define('ROCKET_LL_BASENAME', plugin_basename(__FILE__)); diff --git a/src/Subscriber/LazyloadSubscriber.php b/src/Subscriber/LazyloadSubscriber.php index de027e2..7985911 100644 --- a/src/Subscriber/LazyloadSubscriber.php +++ b/src/Subscriber/LazyloadSubscriber.php @@ -136,20 +136,23 @@ public function insertLazyloadScript() */ $polyfill = apply_filters('rocket_lazyload_polyfill', false); - $args = [ - 'base_url' => ROCKET_LL_FRONT_JS_URL, + $script_args = [ + 'base_url' => ROCKET_LL_FRONT_JS_URL, + 'version' => '11.0.6', + 'polyfill' => $polyfill, + ]; + + $inline_args = [ 'threshold' => $threshold, - 'version' => '11.0.6', - 'polyfill' => $polyfill, ]; if ($this->option_array->get('images')) { - $args['elements']['image'] = 'img[data-lazy-src]'; - $args['elements']['background_image'] = '.rocket-lazyload'; + $inline_args['elements']['image'] = 'img[data-lazy-src]'; + $inline_args['elements']['background_image'] = '.rocket-lazyload'; } if ($this->option_array->get('iframes')) { - $args['elements']['iframe'] = 'iframe[data-lazy-src]'; + $inline_args['elements']['iframe'] = 'iframe[data-lazy-src]'; } /** @@ -158,11 +161,12 @@ public function insertLazyloadScript() * @since 2.0 * @author Remy Perona * - * @param array $args Arguments used for the lazyload script options. + * @param array $inline_args Arguments used for the lazyload script options. */ - $args = apply_filters('rocket_lazyload_script_args', $args); + $inline_args = apply_filters('rocket_lazyload_script_args', $inline_args); - $this->assets->insertLazyloadScript($args); + echo ''; + $this->assets->insertLazyloadScript($script_args); } /**