Image optimization & Lazy Load by Optimole - Version 3.4.3

Version Description

Download this release

Release Info

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

Code changes from version 3.4.2 to 3.4.3

CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  ##### [Version 3.4.2](https://github.com/Codeinwp/optimole-wp/compare/v3.4.1...v3.4.2) (2022-05-25)
2
 
3
  Fix edge cases for auto allowing domain on site migration.
1
+ ##### [Version 3.4.3](https://github.com/Codeinwp/optimole-wp/compare/v3.4.2...v3.4.3) (2022-05-30)
2
+
3
+ * Enhance Thrive compatibility when users are offloading the images to Optimole cloud.
4
+
5
  ##### [Version 3.4.2](https://github.com/Codeinwp/optimole-wp/compare/v3.4.1...v3.4.2) (2022-05-25)
6
 
7
  Fix edge cases for auto allowing domain on site migration.
inc/compatibilities/thrive.php CHANGED
@@ -33,6 +33,31 @@ class Optml_thrive extends Optml_compatibility {
33
  return $all_watchers;
34
  }
35
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
37
  }
38
 
33
  return $all_watchers;
34
  }
35
  );
36
+ if ( Optml_Main::instance()->admin->settings->get( 'offload_media' ) === 'enabled' ) {
37
+ add_action( 'optml_updated_post', [$this, 'update_trive_postmeta'], 1, 1 );
38
+ }
39
+
40
+ }
41
+ /**
42
+ * Update tve_updated_post meta with the correct status for images: offloaded/rollback.
43
+ *
44
+ * @param int $post_id The post id to be updated.
45
+ */
46
+ public function update_trive_postmeta( $post_id ) {
47
+
48
+ $post_meta = tve_get_post_meta( $post_id, 'tve_updated_post' );
49
+
50
+ $content = Optml_Media_Offload::instance()->filter_uploaded_images( ['post_content' => $post_meta ] );
51
+
52
+ tve_update_post_meta( $post_id, 'tve_updated_post', $content['post_content'] );
53
+ }
54
+ /**
55
+ * Should we early load the compatibility?
56
+ *
57
+ * @return bool Whether to load the compatibility or not.
58
+ */
59
+ public function should_load_early() {
60
+ return true;
61
  }
62
  }
63
 
inc/media_offload.php CHANGED
@@ -340,6 +340,8 @@ class Optml_Media_Offload extends Optml_App_Replacer {
340
  $size = $found_size;
341
  $strip_url = str_replace( '-' . $found_size[0] . 'x' . $found_size[1], '', $url );
342
  }
 
 
343
  $attachment_id = attachment_url_to_postid( $strip_url );
344
  }
345
 
@@ -395,6 +397,8 @@ class Optml_Media_Offload extends Optml_App_Replacer {
395
  if ( $found_size[0] !== false && $found_size[1] !== false ) {
396
  $strip_url = str_replace( '-' . $found_size[0] . 'x' . $found_size[1], '', $url );
397
  }
 
 
398
  $attachment_id = attachment_url_to_postid( $strip_url );
399
  }
400
  }
@@ -1131,6 +1135,7 @@ class Optml_Media_Offload extends Optml_App_Replacer {
1131
  if ( is_wp_error( $post_update ) || $post_update === 0 ) {
1132
  return false;
1133
  }
 
1134
  return true;
1135
  }
1136
  /**
340
  $size = $found_size;
341
  $strip_url = str_replace( '-' . $found_size[0] . 'x' . $found_size[1], '', $url );
342
  }
343
+ $strip_url = $this->add_schema( $strip_url );
344
+
345
  $attachment_id = attachment_url_to_postid( $strip_url );
346
  }
347
 
397
  if ( $found_size[0] !== false && $found_size[1] !== false ) {
398
  $strip_url = str_replace( '-' . $found_size[0] . 'x' . $found_size[1], '', $url );
399
  }
400
+ $strip_url = $this->add_schema( $strip_url );
401
+
402
  $attachment_id = attachment_url_to_postid( $strip_url );
403
  }
404
  }
1135
  if ( is_wp_error( $post_update ) || $post_update === 0 ) {
1136
  return false;
1137
  }
1138
+ do_action( 'optml_updated_post', $post_id );
1139
  return true;
1140
  }
1141
  /**
inc/traits/normalizer.php CHANGED
@@ -246,4 +246,18 @@ trait Optml_Normalizer {
246
  'position' => $gravity,
247
  ];
248
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  }
246
  'position' => $gravity,
247
  ];
248
  }
249
+ /**
250
+ * If missing, add schema to urls.
251
+ *
252
+ * @param string $url Url to check.
253
+ *
254
+ * @return string
255
+ */
256
+ public function add_schema( $url ) {
257
+ $schema_url = $url;
258
+ if ( str_starts_with( $schema_url, '//' ) ) {
259
+ $schema_url = is_ssl() ? 'https:' : 'http:' . $schema_url;
260
+ }
261
+ return $schema_url;
262
+ }
263
  }
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: 3.4.2
6
  * Author: Optimole
7
  * Author URI: https://optimole.com
8
  * License: GPL-2.0+
@@ -74,7 +74,7 @@ function optml() {
74
  }
75
  define( 'OPTML_URL', plugin_dir_url( __FILE__ ) );
76
  define( 'OPTML_PATH', plugin_dir_path( __FILE__ ) );
77
- define( 'OPTML_VERSION', '3.4.2' );
78
  define( 'OPTML_NAMESPACE', 'optml' );
79
  define( 'OPTML_BASEFILE', __FILE__ );
80
  // 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: 3.4.3
6
  * Author: Optimole
7
  * Author URI: https://optimole.com
8
  * License: GPL-2.0+
74
  }
75
  define( 'OPTML_URL', plugin_dir_url( __FILE__ ) );
76
  define( 'OPTML_PATH', plugin_dir_path( __FILE__ ) );
77
+ define( 'OPTML_VERSION', '3.4.3' );
78
  define( 'OPTML_NAMESPACE', 'optml' );
79
  define( 'OPTML_BASEFILE', __FILE__ );
80
  // 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, free cdn
4
  Requires at least: 4.7
5
- Tested up to: 5.9
6
  Requires PHP: 5.4
7
  License: GPLv3
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
@@ -95,9 +95,16 @@ Premium users will be able to optimize images starting with more than 25k monthl
95
 
96
  == Changelog ==
97
 
 
 
 
 
 
 
 
98
  ##### [Version 3.4.2](https://github.com/Codeinwp/optimole-wp/compare/v3.4.1...v3.4.2) (2022-05-25)
99
 
100
- Fix edge cases for auto allowing domain on site migration.
101
 
102
 
103
 
2
  Contributors: optimole
3
  Tags: image optimization, convert webp, responsive images, lazy load, images, optimization, performance, photos, free cdn
4
  Requires at least: 4.7
5
+ Tested up to: 6.0
6
  Requires PHP: 5.4
7
  License: GPLv3
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
95
 
96
  == Changelog ==
97
 
98
+ ##### [Version 3.4.3](https://github.com/Codeinwp/optimole-wp/compare/v3.4.2...v3.4.3) (2022-05-30)
99
+
100
+ * Enhance Thrive compatibility when users are offloading the images to Optimole cloud.
101
+
102
+
103
+
104
+
105
  ##### [Version 3.4.2](https://github.com/Codeinwp/optimole-wp/compare/v3.4.1...v3.4.2) (2022-05-25)
106
 
107
+ * Fix edge cases for auto allowing domain on site migration.
108
 
109
 
110
 
vendor/autoload.php CHANGED
@@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
9
 
10
  require_once __DIR__ . '/composer/autoload_real.php';
11
 
12
- return ComposerAutoloaderInitcf4a2a666522611d131c0747aeb43392::getLoader();
9
 
10
  require_once __DIR__ . '/composer/autoload_real.php';
11
 
12
+ return ComposerAutoloaderInit53d2919c424cd6f0a10cc367726074d1::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitcf4a2a666522611d131c0747aeb43392
6
  {
7
  private static $loader;
8
 
@@ -22,18 +22,18 @@ class ComposerAutoloaderInitcf4a2a666522611d131c0747aeb43392
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInitcf4a2a666522611d131c0747aeb43392', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
- spl_autoload_unregister(array('ComposerAutoloaderInitcf4a2a666522611d131c0747aeb43392', 'loadClassLoader'));
28
 
29
  require __DIR__ . '/autoload_static.php';
30
- call_user_func(\Composer\Autoload\ComposerStaticInitcf4a2a666522611d131c0747aeb43392::getInitializer($loader));
31
 
32
  $loader->register(true);
33
 
34
- $includeFiles = \Composer\Autoload\ComposerStaticInitcf4a2a666522611d131c0747aeb43392::$files;
35
  foreach ($includeFiles as $fileIdentifier => $file) {
36
- composerRequirecf4a2a666522611d131c0747aeb43392($fileIdentifier, $file);
37
  }
38
 
39
  return $loader;
@@ -45,7 +45,7 @@ class ComposerAutoloaderInitcf4a2a666522611d131c0747aeb43392
45
  * @param string $file
46
  * @return void
47
  */
48
- function composerRequirecf4a2a666522611d131c0747aeb43392($fileIdentifier, $file)
49
  {
50
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
51
  $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit53d2919c424cd6f0a10cc367726074d1
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit53d2919c424cd6f0a10cc367726074d1', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit53d2919c424cd6f0a10cc367726074d1', 'loadClassLoader'));
28
 
29
  require __DIR__ . '/autoload_static.php';
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit53d2919c424cd6f0a10cc367726074d1::getInitializer($loader));
31
 
32
  $loader->register(true);
33
 
34
+ $includeFiles = \Composer\Autoload\ComposerStaticInit53d2919c424cd6f0a10cc367726074d1::$files;
35
  foreach ($includeFiles as $fileIdentifier => $file) {
36
+ composerRequire53d2919c424cd6f0a10cc367726074d1($fileIdentifier, $file);
37
  }
38
 
39
  return $loader;
45
  * @param string $file
46
  * @return void
47
  */
48
+ function composerRequire53d2919c424cd6f0a10cc367726074d1($fileIdentifier, $file)
49
  {
50
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
51
  $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitcf4a2a666522611d131c0747aeb43392
8
  {
9
  public static $files = array (
10
  '9fef4034ed73e26a337d9856ea126f7f' => __DIR__ . '/..' . '/codeinwp/themeisle-sdk/load.php',
@@ -17,7 +17,7 @@ class ComposerStaticInitcf4a2a666522611d131c0747aeb43392
17
  public static function getInitializer(ClassLoader $loader)
18
  {
19
  return \Closure::bind(function () use ($loader) {
20
- $loader->classMap = ComposerStaticInitcf4a2a666522611d131c0747aeb43392::$classMap;
21
 
22
  }, null, ClassLoader::class);
23
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit53d2919c424cd6f0a10cc367726074d1
8
  {
9
  public static $files = array (
10
  '9fef4034ed73e26a337d9856ea126f7f' => __DIR__ . '/..' . '/codeinwp/themeisle-sdk/load.php',
17
  public static function getInitializer(ClassLoader $loader)
18
  {
19
  return \Closure::bind(function () use ($loader) {
20
+ $loader->classMap = ComposerStaticInit53d2919c424cd6f0a10cc367726074d1::$classMap;
21
 
22
  }, null, ClassLoader::class);
23
  }