Image optimization & Lazy Load by Optimole - Version 2.3.1

Version Description

Download this release

Release Info

Developer optimole
Plugin Icon 128x128 Image optimization & Lazy Load by Optimole
Version 2.3.1
Comparing to
See all releases

Code changes from version 2.3.0 to 2.3.1

CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
#### [Version 2.3.0](https://github.com/Codeinwp/optimole-wp/compare/v2.2.9...v2.3.0) (2020-04-06)
2
3
#### Features
1
+ ##### [Version 2.3.1](https://github.com/Codeinwp/optimole-wp/compare/v2.3.0...v2.3.1) (2020-04-21)
2
+
3
+ ### Bug Fixes
4
+ - improve AMP compatibility, solve the issue when we were loading non-AMP resources on AMP context, props [@westonruter](https://github.com/westonruter)
5
+ - improve lazy-loading on non-Latin image filenames
6
+
7
#### [Version 2.3.0](https://github.com/Codeinwp/optimole-wp/compare/v2.2.9...v2.3.0) (2020-04-06)
8
9
#### Features
inc/admin.php CHANGED
@@ -38,7 +38,7 @@ class Optml_Admin {
38
if ( ! is_admin() && $this->settings->is_connected() && ! wp_next_scheduled( 'optml_daily_sync' ) ) {
39
wp_schedule_event( time() + 10, 'daily', 'optml_daily_sync', array() );
40
}
41
- add_action( 'optml_replacer_setup', array( $this, 'register_public_actions' ), 999999 );
42
43
}
44
@@ -146,7 +146,6 @@ class Optml_Admin {
146
*/
147
public function adds_body_classes( $classes ) {
148
$classes[] = 'optimole-no-script';
149
-
150
return $classes;
151
}
152
@@ -331,6 +330,7 @@ class Optml_Admin {
331
* Enqueue frontend scripts.
332
*/
333
public function frontend_scripts() {
334
$bg_css = $this->get_background_lazy_css();
335
336
wp_register_style( 'optm_lazyload_noscript_style', false );
38
if ( ! is_admin() && $this->settings->is_connected() && ! wp_next_scheduled( 'optml_daily_sync' ) ) {
39
wp_schedule_event( time() + 10, 'daily', 'optml_daily_sync', array() );
40
}
41
+ add_action( 'optml_after_setup', array( $this, 'register_public_actions' ), 999999 );
42
43
}
44
146
*/
147
public function adds_body_classes( $classes ) {
148
$classes[] = 'optimole-no-script';
149
return $classes;
150
}
151
330
* Enqueue frontend scripts.
331
*/
332
public function frontend_scripts() {
333
+
334
$bg_css = $this->get_background_lazy_css();
335
336
wp_register_style( 'optm_lazyload_noscript_style', false );
inc/manager.php CHANGED
@@ -231,6 +231,7 @@ final class Optml_Manager {
231
),
232
defined( 'OPTML_SITE_MIRROR' ) ? PHP_INT_MAX : PHP_INT_MIN
233
);
234
add_action( 'rest_api_init', array( $this, 'process_template_redirect_content' ), PHP_INT_MIN );
235
236
add_action( 'get_post_metadata', array( $this, 'replace_meta' ), PHP_INT_MAX, 4 );
@@ -240,6 +241,12 @@ final class Optml_Manager {
240
}
241
}
242
243
/**
244
* Replace urls in post meta values.
245
*
@@ -353,7 +360,7 @@ final class Optml_Manager {
353
$header_start = $matches[0][1];
354
$header_end = $header_start + strlen( $matches[0][0] );
355
}
356
- $regex = '/(?:<a[^>]+?href=["|\'](?P<link_url>[^\s]+?)["|\'][^>]*?>\s*)?(?P<img_tag>(?:<noscript\s*>\s*)?<img[^>]*?\s?(?:' . implode( '|', array_merge( [ 'src' ], Optml_Tag_Replacer::possible_src_attributes() ) ) . ')=["\'\\\\]*?(?P<img_url>[' . Optml_Config::$chars . ']{10,}).*?>(?:\s*<\/noscript\s*>)?){1}(?:\s*<\/a>)?/ism';
357
358
if ( preg_match_all( $regex, $content, $images, PREG_OFFSET_CAPTURE ) ) {
359
231
),
232
defined( 'OPTML_SITE_MIRROR' ) ? PHP_INT_MAX : PHP_INT_MIN
233
);
234
+ add_action( 'template_redirect', array( $this, 'register_after_setup' ) );
235
add_action( 'rest_api_init', array( $this, 'process_template_redirect_content' ), PHP_INT_MIN );
236
237
add_action( 'get_post_metadata', array( $this, 'replace_meta' ), PHP_INT_MAX, 4 );
241
}
242
}
243
244
+ /**
245
+ * Run after Optimole is fully setup.
246
+ */
247
+ public function register_after_setup() {
248
+ do_action( 'optml_after_setup' );
249
+ }
250
/**
251
* Replace urls in post meta values.
252
*
360
$header_start = $matches[0][1];
361
$header_end = $header_start + strlen( $matches[0][0] );
362
}
363
+ $regex = '/(?:<a[^>]+?href=["|\'](?P<link_url>[^\s]+?)["|\'][^>]*?>\s*)?(?P<img_tag>(?:<noscript\s*>\s*)?<img[^>]*?\s?(?:' . implode( '|', array_merge( [ 'src' ], Optml_Tag_Replacer::possible_src_attributes() ) ) . ')=["\'\\\\]*?(?P<img_url>[' . Optml_Config::$chars . ']{10,}).*?>(?:\s*<\/noscript\s*>)?){1}(?:\s*<\/a>)?/ismu';
364
365
if ( preg_match_all( $regex, $content, $images, PREG_OFFSET_CAPTURE ) ) {
366
optimole-wp.php CHANGED
@@ -2,7 +2,7 @@
2
/**
3
* Plugin Name: Image optimization service by Optimole
4
* Description: Complete handling of your website images.
5
- * Version: 2.3.0
6
* Author: Optimole
7
* Author URI: https://optimole.com
8
* License: GPL-2.0+
@@ -75,7 +75,7 @@ function optml() {
75
define( 'OPTML_URL', plugin_dir_url( __FILE__ ) );
76
define( 'OPTML_JS_CDN', 'd5jmkjjpb7yfg.cloudfront.net' );
77
define( 'OPTML_PATH', plugin_dir_path( __FILE__ ) );
78
- define( 'OPTML_VERSION', '2.3.0' );
79
define( 'OPTML_NAMESPACE', 'optml' );
80
define( 'OPTML_BASEFILE', __FILE__ );
81
// Fallback for old PHP versions when this constant is not defined.
2
/**
3
* Plugin Name: Image optimization service by Optimole
4
* Description: Complete handling of your website images.
5
+ * Version: 2.3.1
6
* Author: Optimole
7
* Author URI: https://optimole.com
8
* License: GPL-2.0+
75
define( 'OPTML_URL', plugin_dir_url( __FILE__ ) );
76
define( 'OPTML_JS_CDN', 'd5jmkjjpb7yfg.cloudfront.net' );
77
define( 'OPTML_PATH', plugin_dir_path( __FILE__ ) );
78
+ define( 'OPTML_VERSION', '2.3.1' );
79
define( 'OPTML_NAMESPACE', 'optml' );
80
define( 'OPTML_BASEFILE', __FILE__ );
81
// Fallback for old PHP versions when this constant is not defined.
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
Contributors: optimole
3
Tags: image optimization, convert webp, responsive images, lazy load, images, optimization, performance, photos
4
Requires at least: 4.7
5
- Tested up to: 5.3
6
Requires PHP: 5.4
7
License: GPLv3
8
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
@@ -89,6 +89,15 @@ Premium users will be able to optimize images for more than 25k monthly active u
89
90
== Changelog ==
91
92
#### [Version 2.3.0](https://github.com/Codeinwp/optimole-wp/compare/v2.2.9...v2.3.0) (2020-04-06)
93
94
#### Features
2
Contributors: optimole
3
Tags: image optimization, convert webp, responsive images, lazy load, images, optimization, performance, photos
4
Requires at least: 4.7
5
+ Tested up to: 5.4
6
Requires PHP: 5.4
7
License: GPLv3
8
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
89
90
== Changelog ==
91
92
+ ##### [Version 2.3.1](https://github.com/Codeinwp/optimole-wp/compare/v2.3.0...v2.3.1) (2020-04-21)
93
+
94
+ ### Bug Fixes
95
+ - improve AMP compatibility, solve the issue when we were loading non-AMP resources on AMP context, props [@westonruter](https://github.com/westonruter)
96
+ - improve lazy-loading on non-Latin image filenames
97
+
98
+
99
+
100
+
101
#### [Version 2.3.0](https://github.com/Codeinwp/optimole-wp/compare/v2.2.9...v2.3.0) (2020-04-06)
102
103
#### Features
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
5
require_once __DIR__ . '/composer/autoload_real.php';
6
7
- return ComposerAutoloaderInitb2dce06b92df0985866f749519b47221::getLoader();
4
5
require_once __DIR__ . '/composer/autoload_real.php';
6
7
+ return ComposerAutoloaderInit93e0e600a7919bc3e7af33820abd3346::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
3
// autoload_real.php @generated by Composer
4
5
- class ComposerAutoloaderInitb2dce06b92df0985866f749519b47221
6
{
7
private static $loader;
8
@@ -22,15 +22,15 @@ class ComposerAutoloaderInitb2dce06b92df0985866f749519b47221
22
return self::$loader;
23
}
24
25
- spl_autoload_register(array('ComposerAutoloaderInitb2dce06b92df0985866f749519b47221', 'loadClassLoader'), true, true);
26
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInitb2dce06b92df0985866f749519b47221', 'loadClassLoader'));
28
29
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
if ($useStaticLoader) {
31
require_once __DIR__ . '/autoload_static.php';
32
33
- call_user_func(\Composer\Autoload\ComposerStaticInitb2dce06b92df0985866f749519b47221::getInitializer($loader));
34
} else {
35
$map = require __DIR__ . '/autoload_namespaces.php';
36
foreach ($map as $namespace => $path) {
@@ -51,19 +51,19 @@ class ComposerAutoloaderInitb2dce06b92df0985866f749519b47221
51
$loader->register(true);
52
53
if ($useStaticLoader) {
54
- $includeFiles = Composer\Autoload\ComposerStaticInitb2dce06b92df0985866f749519b47221::$files;
55
} else {
56
$includeFiles = require __DIR__ . '/autoload_files.php';
57
}
58
foreach ($includeFiles as $fileIdentifier => $file) {
59
- composerRequireb2dce06b92df0985866f749519b47221($fileIdentifier, $file);
60
}
61
62
return $loader;
63
}
64
}
65
66
- function composerRequireb2dce06b92df0985866f749519b47221($fileIdentifier, $file)
67
{
68
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
require $file;
2
3
// autoload_real.php @generated by Composer
4
5
+ class ComposerAutoloaderInit93e0e600a7919bc3e7af33820abd3346
6
{
7
private static $loader;
8
22
return self::$loader;
23
}
24
25
+ spl_autoload_register(array('ComposerAutoloaderInit93e0e600a7919bc3e7af33820abd3346', 'loadClassLoader'), true, true);
26
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit93e0e600a7919bc3e7af33820abd3346', 'loadClassLoader'));
28
29
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
if ($useStaticLoader) {
31
require_once __DIR__ . '/autoload_static.php';
32
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit93e0e600a7919bc3e7af33820abd3346::getInitializer($loader));
34
} else {
35
$map = require __DIR__ . '/autoload_namespaces.php';
36
foreach ($map as $namespace => $path) {
51
$loader->register(true);
52
53
if ($useStaticLoader) {
54
+ $includeFiles = Composer\Autoload\ComposerStaticInit93e0e600a7919bc3e7af33820abd3346::$files;
55
} else {
56
$includeFiles = require __DIR__ . '/autoload_files.php';
57
}
58
foreach ($includeFiles as $fileIdentifier => $file) {
59
+ composerRequire93e0e600a7919bc3e7af33820abd3346($fileIdentifier, $file);
60
}
61
62
return $loader;
63
}
64
}
65
66
+ function composerRequire93e0e600a7919bc3e7af33820abd3346($fileIdentifier, $file)
67
{
68
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
5
namespace Composer\Autoload;
6
7
- class ComposerStaticInitb2dce06b92df0985866f749519b47221
8
{
9
public static $files = array (
10
'9fef4034ed73e26a337d9856ea126f7f' => __DIR__ . '/..' . '/codeinwp/themeisle-sdk/load.php',
4
5
namespace Composer\Autoload;
6
7
+ class ComposerStaticInit93e0e600a7919bc3e7af33820abd3346
8
{
9
public static $files = array (
10
'9fef4034ed73e26a337d9856ea126f7f' => __DIR__ . '/..' . '/codeinwp/themeisle-sdk/load.php',