Imagify Image Optimizer - Version 1.9.4

Version Description

  • 2019/07/10 =
  • Improvement: if a webp image is larger than its non-webp version, it is now possible to not keep it. This can be done by using the filter imagify_keep_large_webp.
  • Improvement: compatibility with Pressable.
  • Improvement: renamed a php class to prevent some hosts to wrongly flag it as "suspicious" and trigger a fatal error.
  • Improvement: better compatibility with WP Real Media Library plugin.
  • Fix: rewrite rules for webp could not work on some servers.
  • Fix: when using <picture> tags for webp, some attributes could disappear if they were written on multiple lines.
  • Fix: the bulk method would not work in the NextGen Gallery list.
  • Fix: php notice Trying to get property "namespace" for a non object.
Download this release

Release Info

Developer wp_media
Plugin Icon 128x128 Imagify Image Optimizer
Version 1.9.4
Comparing to
See all releases

Code changes from version 1.9.3.1 to 1.9.4

Files changed (38) hide show
  1. assets/js/library.js +1 -1
  2. assets/js/library.min.js +1 -1
  3. classes/Bulk/CustomFolders.php +2 -2
  4. classes/Bulk/WP.php +2 -2
  5. classes/Context/CustomFolders.php +1 -1
  6. classes/Context/Noop.php +1 -1
  7. classes/Context/WP.php +1 -1
  8. classes/Imagifybeat/Actions.php +1 -1
  9. classes/Imagifybeat/Core.php +1 -1
  10. classes/Optimization/File.php +2 -2
  11. classes/Optimization/Process/AbstractProcess.php +144 -24
  12. classes/Stats/OptimizedMediaWithoutWebp.php +1 -1
  13. classes/Traits/{FakeSingletonTrait.php → InstanceGetterTrait.php} +6 -5
  14. classes/Webp/Display.php +1 -1
  15. classes/Webp/Picture/Display.php +2 -2
  16. classes/Webp/RewriteRules/Apache.php +2 -2
  17. classes/Webp/RewriteRules/Display.php +1 -1
  18. imagify.php +2 -2
  19. inc/3rd-party/3rd-party.php +1 -0
  20. inc/3rd-party/amazon-s3-and-cloudfront/classes/Main.php +1 -1
  21. inc/3rd-party/enable-media-replace/classes/Main.php +1 -1
  22. inc/3rd-party/formidable-pro/classes/Main.php +1 -1
  23. inc/3rd-party/hosting/pressable.php +24 -0
  24. inc/3rd-party/nextgen-gallery/classes/Bulk/NGG.php +2 -2
  25. inc/3rd-party/nextgen-gallery/classes/Context/NGG.php +1 -1
  26. inc/3rd-party/nextgen-gallery/classes/DynamicThumbnails.php +1 -1
  27. inc/3rd-party/nextgen-gallery/classes/Main.php +1 -1
  28. inc/3rd-party/regenerate-thumbnails/classes/Main.php +8 -2
  29. inc/3rd-party/wp-real-media-library.php +20 -7
  30. inc/3rd-party/wp-rocket/classes/Main.php +1 -1
  31. inc/classes/class-imagify-admin-ajax-post.php +1 -1
  32. inc/classes/class-imagify-plugin.php +2 -0
  33. package.json +1 -1
  34. readme.txt +11 -1
  35. vendor/autoload.php +1 -1
  36. vendor/composer/autoload_classmap.php +1 -1
  37. vendor/composer/autoload_real.php +4 -4
  38. vendor/composer/autoload_static.php +5 -5
assets/js/library.js CHANGED
@@ -43,7 +43,7 @@
43
 
44
  ids.forEach( function( id, index ) {
45
  setTimeout( function() {
46
- $( '.imagify-data-actions-container[data-id="' + id + '"][data-context="wp"] .button-imagify-' + action ).first().trigger( 'click' );
47
  }, index * 300 );
48
  } );
49
  } );
43
 
44
  ids.forEach( function( id, index ) {
45
  setTimeout( function() {
46
+ $( 'table .imagify-data-actions-container[data-id="' + id + '"] .button-imagify-' + action ).first().trigger( 'click' );
47
  }, index * 300 );
48
  } );
49
  } );
assets/js/library.min.js CHANGED
@@ -1 +1 @@
1
- !function(a,b,c,d){var e;e='<option value="imagify-bulk|optimize">'+imagifyLibrary.labels.bulkActionsOptimize+"</option>",a(".button-imagify-optimize-missing-sizes").length&&(e+='<option value="imagify-bulk|optimize_missing_sizes">'+imagifyLibrary.labels.bulkActionsOptimizeMissingSizes+"</option>"),(imagifyLibrary.backupOption||a(".attachment-has-backup").length)&&(e+='<option value="imagify-bulk|restore">'+imagifyLibrary.labels.bulkActionsRestore+"</option>"),a('.bulkactions select[name="action"] option:last-child').before(e),a('.bulkactions select[name="action2"] option:last-child').before(e),a("#bulkaction option:last-child").after(e),a("#doaction").add("#doaction2").add('#bulkaction + [name="showThickbox"]').on("click",function(b){var c,d,e=a(this).prev("select").val().split("|");"imagify-bulk"===e[0]&&(b.preventDefault(),c=e[1],d=a('input[name^="media"]:checked, input[name^="doaction"]:checked').map(function(){return this.value}).get(),d.forEach(function(b,d){setTimeout(function(){a('.imagify-data-actions-container[data-id="'+b+'"][data-context="wp"] .button-imagify-'+c).first().trigger("click")},300*d)}))})}(jQuery,document,window);
1
+ !function(a,b,c,d){var e;e='<option value="imagify-bulk|optimize">'+imagifyLibrary.labels.bulkActionsOptimize+"</option>",a(".button-imagify-optimize-missing-sizes").length&&(e+='<option value="imagify-bulk|optimize_missing_sizes">'+imagifyLibrary.labels.bulkActionsOptimizeMissingSizes+"</option>"),(imagifyLibrary.backupOption||a(".attachment-has-backup").length)&&(e+='<option value="imagify-bulk|restore">'+imagifyLibrary.labels.bulkActionsRestore+"</option>"),a('.bulkactions select[name="action"] option:last-child').before(e),a('.bulkactions select[name="action2"] option:last-child').before(e),a("#bulkaction option:last-child").after(e),a("#doaction").add("#doaction2").add('#bulkaction + [name="showThickbox"]').on("click",function(b){var c,d,e=a(this).prev("select").val().split("|");"imagify-bulk"===e[0]&&(b.preventDefault(),c=e[1],d=a('input[name^="media"]:checked, input[name^="doaction"]:checked').map(function(){return this.value}).get(),d.forEach(function(b,d){setTimeout(function(){a('table .imagify-data-actions-container[data-id="'+b+'"] .button-imagify-'+c).first().trigger("click")},300*d)}))})}(jQuery,document,window);
classes/Bulk/CustomFolders.php CHANGED
@@ -104,7 +104,7 @@ class CustomFolders extends AbstractBulk {
104
  AND fi.status = 'success'
105
  AND ( fi.data NOT LIKE %s OR fi.data IS NULL )
106
  ORDER BY fi.file_id DESC",
107
- '%' . $wpdb->esc_like( '"full' . $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
108
  ) );
109
 
110
  $wpdb->flush();
@@ -165,7 +165,7 @@ class CustomFolders extends AbstractBulk {
165
  AND fi.status = 'success'
166
  AND ( fi.data NOT LIKE %s OR fi.data IS NULL )
167
  ORDER BY fi.file_id DESC",
168
- '%' . $wpdb->esc_like( '"full' . $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
169
  ) );
170
  }
171
 
104
  AND fi.status = 'success'
105
  AND ( fi.data NOT LIKE %s OR fi.data IS NULL )
106
  ORDER BY fi.file_id DESC",
107
+ '%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
108
  ) );
109
 
110
  $wpdb->flush();
165
  AND fi.status = 'success'
166
  AND ( fi.data NOT LIKE %s OR fi.data IS NULL )
167
  ORDER BY fi.file_id DESC",
168
+ '%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
169
  ) );
170
  }
171
 
classes/Bulk/WP.php CHANGED
@@ -210,7 +210,7 @@ class WP extends AbstractBulk {
210
  $nodata_where
211
  ORDER BY p.ID DESC
212
  LIMIT 0, %d",
213
- '%' . $wpdb->esc_like( '"full' . $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%',
214
  imagify_get_unoptimized_attachment_limit()
215
  ) );
216
 
@@ -302,7 +302,7 @@ class WP extends AbstractBulk {
302
  AND p.post_type = 'attachment'
303
  AND p.post_status IN ( $statuses )
304
  $nodata_where",
305
- '%' . $wpdb->esc_like( '"full' . $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
306
  ) );
307
  }
308
 
210
  $nodata_where
211
  ORDER BY p.ID DESC
212
  LIMIT 0, %d",
213
+ '%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%',
214
  imagify_get_unoptimized_attachment_limit()
215
  ) );
216
 
302
  AND p.post_type = 'attachment'
303
  AND p.post_status IN ( $statuses )
304
  $nodata_where",
305
+ '%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
306
  ) );
307
  }
308
 
classes/Context/CustomFolders.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
10
  * @author Grégory Viguier
11
  */
12
  class CustomFolders extends AbstractContext {
13
- use \Imagify\Traits\FakeSingletonTrait;
14
 
15
  /**
16
  * Context "short name".
10
  * @author Grégory Viguier
11
  */
12
  class CustomFolders extends AbstractContext {
13
+ use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
  * Context "short name".
classes/Context/Noop.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
10
  * @author Grégory Viguier
11
  */
12
  class Noop implements ContextInterface {
13
- use \Imagify\Traits\FakeSingletonTrait;
14
 
15
  /**
16
  * Get the context "short name".
10
  * @author Grégory Viguier
11
  */
12
  class Noop implements ContextInterface {
13
+ use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
  * Get the context "short name".
classes/Context/WP.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
10
  * @author Grégory Viguier
11
  */
12
  class WP extends AbstractContext {
13
- use \Imagify\Traits\FakeSingletonTrait;
14
 
15
  /**
16
  * Context "short name".
10
  * @author Grégory Viguier
11
  */
12
  class WP extends AbstractContext {
13
+ use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
  * Context "short name".
classes/Imagifybeat/Actions.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
10
  * @author Grégory Viguier
11
  */
12
  class Actions {
13
- use \Imagify\Traits\FakeSingletonTrait;
14
 
15
  /**
16
  * The list of action IDs.
10
  * @author Grégory Viguier
11
  */
12
  class Actions {
13
+ use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
  * The list of action IDs.
classes/Imagifybeat/Core.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
10
  * @author Grégory Viguier
11
  */
12
  class Core {
13
- use \Imagify\Traits\FakeSingletonTrait;
14
 
15
  /**
16
  * Class init: launch hooks.
10
  * @author Grégory Viguier
11
  */
12
  class Core {
13
+ use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
  * Class init: launch hooks.
classes/Optimization/File.php CHANGED
@@ -413,7 +413,7 @@ class File {
413
  * @access public
414
  * @author Grégory Viguier
415
  *
416
- * @param array $args {
417
  * Optional. An array of arguments.
418
  *
419
  * @type bool $backup False to prevent backup. True to follow the user's setting. A backup can't be forced.
@@ -424,7 +424,7 @@ class File {
424
  * @type string $context The context.
425
  * @type int $original_size The file size, sent to the API.
426
  * }
427
- * @return array|\WP_Error Optimized image data. A \WP_Error object on error.
428
  */
429
  public function optimize( $args = [] ) {
430
  $args = array_merge( [
413
  * @access public
414
  * @author Grégory Viguier
415
  *
416
+ * @param array $args {
417
  * Optional. An array of arguments.
418
  *
419
  * @type bool $backup False to prevent backup. True to follow the user's setting. A backup can't be forced.
424
  * @type string $context The context.
425
  * @type int $original_size The file size, sent to the API.
426
  * }
427
+ * @return \sdtClass|\WP_Error Optimized image data. A \WP_Error object on error.
428
  */
429
  public function optimize( $args = [] ) {
430
  $args = array_merge( [
classes/Optimization/Process/AbstractProcess.php CHANGED
@@ -444,10 +444,10 @@ abstract class AbstractProcess implements ProcessInterface {
444
  *
445
  * @param string $size The media size.
446
  * @param int $optimization_level The optimization level (0=normal, 1=aggressive, 2=ultra).
447
- * @return array|WP_Error The optimization data. A \WP_Error instance on failure.
448
  */
449
  public function optimize_size( $size, $optimization_level = null ) {
450
- if ( ! $this->is_valid() ) {
451
  return new \WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) );
452
  }
453
 
@@ -463,7 +463,7 @@ abstract class AbstractProcess implements ProcessInterface {
463
  $webp = true;
464
  }
465
 
466
- if ( empty( $sizes[ $thumb_size ]['path'] ) ) {
467
  // This size is not in our list.
468
  return new \WP_Error(
469
  'unknown_size',
@@ -475,7 +475,7 @@ abstract class AbstractProcess implements ProcessInterface {
475
  );
476
  }
477
 
478
- if ( $this->get_data()->get_size_data( $size, 'success' ) ) {
479
  // This size is already optimized with Imagify, and must not be optimized again.
480
  if ( $webp ) {
481
  return new \WP_Error(
@@ -509,7 +509,7 @@ abstract class AbstractProcess implements ProcessInterface {
509
  // We want a webp version but the source file is already optimized by Imagify.
510
  $result = $this->create_temporary_copy( $thumb_size, $sizes );
511
 
512
- if ( ! $result ) {
513
  // Could not create a copy of the non-webp version.
514
  $response = new \WP_Error(
515
  'non_webp_copy_failed',
@@ -532,9 +532,9 @@ abstract class AbstractProcess implements ProcessInterface {
532
  $path_is_temp = true;
533
  }
534
 
535
- $file = new File( $path );
536
 
537
- if ( ! $file->is_supported( $media->get_allowed_mime_types() ) ) {
538
  // This file type is not supported.
539
  $extension = $file->get_extension();
540
 
@@ -563,7 +563,7 @@ abstract class AbstractProcess implements ProcessInterface {
563
  return $response;
564
  }
565
 
566
- if ( $webp && ! $file->is_image() ) {
567
  if ( $path_is_temp ) {
568
  $this->filesystem->delete( $path );
569
  }
@@ -600,10 +600,6 @@ abstract class AbstractProcess implements ProcessInterface {
600
  if ( ! is_wp_error( $response ) ) {
601
  if ( $is_disabled ) {
602
  // This size must not be optimized.
603
- if ( $path_is_temp ) {
604
- $this->filesystem->delete( $path );
605
- }
606
-
607
  $response = new \WP_Error(
608
  'unauthorized_size',
609
  sprintf(
@@ -613,10 +609,6 @@ abstract class AbstractProcess implements ProcessInterface {
613
  )
614
  );
615
  } elseif ( ! $this->filesystem->exists( $file->get_path() ) ) {
616
- if ( $path_is_temp ) {
617
- $this->filesystem->delete( $path );
618
- }
619
-
620
  $response = new \WP_Error(
621
  'file_not_exists',
622
  sprintf(
@@ -626,10 +618,6 @@ abstract class AbstractProcess implements ProcessInterface {
626
  )
627
  );
628
  } elseif ( ! $this->filesystem->is_writable( $file->get_path() ) ) {
629
- if ( $path_is_temp ) {
630
- $this->filesystem->delete( $path );
631
- }
632
-
633
  $response = new \WP_Error(
634
  'file_not_writable',
635
  sprintf(
@@ -653,6 +641,15 @@ abstract class AbstractProcess implements ProcessInterface {
653
  'context' => $media->get_context(),
654
  'original_size' => $response['file_size'],
655
  ] );
 
 
 
 
 
 
 
 
 
656
  }
657
  }
658
  }
@@ -678,17 +675,131 @@ abstract class AbstractProcess implements ProcessInterface {
678
  return $data;
679
  }
680
 
 
 
 
 
 
 
 
681
  // Rename the optimized file.
682
  $destination_path = str_replace( static::TMP_SUFFIX . '.', '.', $file->get_path() );
683
 
684
  $this->filesystem->move( $file->get_path(), $destination_path, true );
685
 
686
- // Delete the temporary copy.
687
- $this->filesystem->delete( $path );
688
-
689
  return $data;
690
  }
691
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
692
  /**
693
  * Restore the media files from the backup file.
694
  *
@@ -1390,7 +1501,16 @@ abstract class AbstractProcess implements ProcessInterface {
1390
  return false;
1391
  }
1392
 
1393
- return (bool) $this->get_data()->get_size_data( 'full' . static::WEBP_SUFFIX, 'success' );
 
 
 
 
 
 
 
 
 
1394
  }
1395
 
1396
 
444
  *
445
  * @param string $size The media size.
446
  * @param int $optimization_level The optimization level (0=normal, 1=aggressive, 2=ultra).
447
+ * @return \sdtClass|\WP_Error Optimized image data. A \WP_Error object on error.
448
  */
449
  public function optimize_size( $size, $optimization_level = null ) {
450
+ if ( ! $this->is_valid() ) { // Bail out.
451
  return new \WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) );
452
  }
453
 
463
  $webp = true;
464
  }
465
 
466
+ if ( empty( $sizes[ $thumb_size ]['path'] ) ) { // Bail out.
467
  // This size is not in our list.
468
  return new \WP_Error(
469
  'unknown_size',
475
  );
476
  }
477
 
478
+ if ( $this->get_data()->get_size_data( $size, 'success' ) ) { // Bail out.
479
  // This size is already optimized with Imagify, and must not be optimized again.
480
  if ( $webp ) {
481
  return new \WP_Error(
509
  // We want a webp version but the source file is already optimized by Imagify.
510
  $result = $this->create_temporary_copy( $thumb_size, $sizes );
511
 
512
+ if ( ! $result ) { // Bail out.
513
  // Could not create a copy of the non-webp version.
514
  $response = new \WP_Error(
515
  'non_webp_copy_failed',
532
  $path_is_temp = true;
533
  }
534
 
535
+ $file = new File( $path ); // Original file or temporary copy.
536
 
537
+ if ( ! $file->is_supported( $media->get_allowed_mime_types() ) ) { // Bail out.
538
  // This file type is not supported.
539
  $extension = $file->get_extension();
540
 
563
  return $response;
564
  }
565
 
566
+ if ( $webp && ! $file->is_image() ) { // Bail out.
567
  if ( $path_is_temp ) {
568
  $this->filesystem->delete( $path );
569
  }
600
  if ( ! is_wp_error( $response ) ) {
601
  if ( $is_disabled ) {
602
  // This size must not be optimized.
 
 
 
 
603
  $response = new \WP_Error(
604
  'unauthorized_size',
605
  sprintf(
609
  )
610
  );
611
  } elseif ( ! $this->filesystem->exists( $file->get_path() ) ) {
 
 
 
 
612
  $response = new \WP_Error(
613
  'file_not_exists',
614
  sprintf(
618
  )
619
  );
620
  } elseif ( ! $this->filesystem->is_writable( $file->get_path() ) ) {
 
 
 
 
621
  $response = new \WP_Error(
622
  'file_not_writable',
623
  sprintf(
641
  'context' => $media->get_context(),
642
  'original_size' => $response['file_size'],
643
  ] );
644
+
645
+ $response = $this->compare_webp_file_size( [
646
+ 'response' => $response,
647
+ 'file' => $file,
648
+ 'is_webp' => $webp,
649
+ 'non_webp_thumb_size' => $thumb_size,
650
+ 'non_webp_file_path' => $sizes[ $thumb_size ]['path'], // Don't use $path nor $file->get_path(), it may return the path to a temporary file.
651
+ 'optimization_level' => $optimization_level,
652
+ ] );
653
  }
654
  }
655
  }
675
  return $data;
676
  }
677
 
678
+ // Delete the temporary copy.
679
+ $this->filesystem->delete( $path );
680
+
681
+ if ( is_wp_error( $response ) ) {
682
+ return $data;
683
+ }
684
+
685
  // Rename the optimized file.
686
  $destination_path = str_replace( static::TMP_SUFFIX . '.', '.', $file->get_path() );
687
 
688
  $this->filesystem->move( $file->get_path(), $destination_path, true );
689
 
 
 
 
690
  return $data;
691
  }
692
 
693
+ /**
694
+ * Compare the file size of a file and its webp version: if the webp version is heavier than the non-webp file, delete it.
695
+ *
696
+ * @since 1.9.4
697
+ * @access protected
698
+ * @author Grégory Viguier
699
+ *
700
+ * @param array $args {
701
+ * A list of mandatory arguments.
702
+ *
703
+ * @type \sdtClass|\WP_Error $response Optimized image data. A \WP_Error object on error.
704
+ * @type File $file The File instance of the file currently being optimized.
705
+ * @type bool $is_webp Tell if we're requesting a webp file.
706
+ * @type string $non_webp_thumb_size Name of the corresponding non-webp thumbnail size. If we're not creating a webp file, this corresponds to the current thumbnail size.
707
+ * @type string $non_webp_file_path Path to the corresponding non-webp file. If we're not creating a webp file, this corresponds to the current file path.
708
+ * @type string $optimization_level The optimization level.
709
+ * }
710
+ * @return \sdtClass|\WP_Error Optimized image data. A \WP_Error object on error.
711
+ */
712
+ protected function compare_webp_file_size( $args ) {
713
+ static $keep_large_webp;
714
+
715
+ if ( ! isset( $keep_large_webp ) ) {
716
+ /**
717
+ * Allow to not store webp images that are larger than their non-webp version.
718
+ *
719
+ * @since 1.9.4
720
+ * @author Grégory Viguier
721
+ *
722
+ * @param bool $keep_large_webp Set to false if you prefer your visitors over your Pagespeed score. Default value is true.
723
+ */
724
+ $keep_large_webp = apply_filters( 'imagify_keep_large_webp', true );
725
+ }
726
+
727
+ if ( $keep_large_webp || is_wp_error( $args['response'] ) || ! $args['file']->is_image() ) {
728
+ return $args['response'];
729
+ }
730
+
731
+ // Optimization succeeded.
732
+ if ( $args['is_webp'] ) {
733
+ /**
734
+ * We just created a webp version:
735
+ * Check if it is lighter than the (maybe optimized) non-webp file.
736
+ */
737
+ $data = $this->get_data()->get_size_data( $args['non_webp_thumb_size'] );
738
+
739
+ if ( ! $data ) {
740
+ // We haven’t tried to optimize the non-webp size yet.
741
+ return $args['response'];
742
+ }
743
+
744
+ if ( ! empty( $data['optimized_size'] ) ) {
745
+ // The non-webp size is optimized, we know the file size.
746
+ $non_webp_file_size = $data['optimized_size'];
747
+ } else {
748
+ // The non-webp size is "already optimized" or "error": grab the file size directly from the file.
749
+ $non_webp_file_size = $this->filesystem->size( $args['non_webp_file_path'] );
750
+ }
751
+
752
+ if ( ! $non_webp_file_size || $non_webp_file_size > $args['response']->new_size ) {
753
+ // The new webp file is lighter.
754
+ return $args['response'];
755
+ }
756
+
757
+ // The new webp file is heavier than the non-webp file: delete it and return an error.
758
+ $this->filesystem->delete( $args['file']->get_path() );
759
+
760
+ return new \WP_Error(
761
+ 'webp_heavy',
762
+ sprintf(
763
+ /* translators: %s is a size name. */
764
+ __( 'The webp version of the size %s is heavier than its non-webp version.', 'imagify' ),
765
+ '<code>' . esc_html( $args['non_webp_thumb_size'] ) . '</code>'
766
+ )
767
+ );
768
+ }
769
+
770
+ /**
771
+ * We just created a non-webp version:
772
+ * Check if its webp version file is lighter than this one.
773
+ */
774
+ $webp_size = $args['non_webp_thumb_size'] . static::WEBP_SUFFIX;
775
+ $webp_file_size = $this->get_data()->get_size_data( $webp_size, 'optimized_size' );
776
+
777
+ if ( ! $webp_file_size || $webp_file_size < $args['response']->new_size ) {
778
+ // The webp file is lighter than this one.
779
+ return $args['response'];
780
+ }
781
+
782
+ // The new optimized file is lighter than the webp file: delete the webp file and store an error.
783
+ $webp_path = $args['file']->get_path_to_webp();
784
+
785
+ if ( $webp_path && $this->filesystem->is_writable( $webp_path ) ) {
786
+ $this->filesystem->delete( $webp_path );
787
+ }
788
+
789
+ $webp_response = new \WP_Error(
790
+ 'webp_heavy',
791
+ sprintf(
792
+ /* translators: %s is a size name. */
793
+ __( 'The webp version of the size %s is heavier than its non-webp version.', 'imagify' ),
794
+ '<code>' . esc_html( $args['non_webp_thumb_size'] ) . '</code>'
795
+ )
796
+ );
797
+
798
+ $this->update_size_optimization_data( $webp_response, $webp_size, $args['optimization_level'] );
799
+
800
+ return $args['response'];
801
+ }
802
+
803
  /**
804
  * Restore the media files from the backup file.
805
  *
1501
  return false;
1502
  }
1503
 
1504
+ $data = $this->get_data()->get_optimization_data();
1505
+
1506
+ if ( empty( $data['sizes'] ) ) {
1507
+ return false;
1508
+ }
1509
+
1510
+ $needle = static::WEBP_SUFFIX . '";a:4:{s:7:"success";b:1;';
1511
+ $data = maybe_serialize( $data['sizes'] );
1512
+
1513
+ return is_string( $data ) && strpos( $data, $needle );
1514
  }
1515
 
1516
 
classes/Stats/OptimizedMediaWithoutWebp.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
10
  * @author Grégory Viguier
11
  */
12
  class OptimizedMediaWithoutWebp implements StatInterface {
13
- use \Imagify\Traits\FakeSingletonTrait;
14
 
15
  /**
16
  * Name of the transient storing the cached result.
10
  * @author Grégory Viguier
11
  */
12
  class OptimizedMediaWithoutWebp implements StatInterface {
13
+ use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
  * Name of the transient storing the cached result.
classes/Traits/{FakeSingletonTrait.php → InstanceGetterTrait.php} RENAMED
@@ -9,9 +9,10 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
9
  * This is temporary, until we get a DI container.
10
  *
11
  * @since 1.9
 
12
  * @author Grégory Viguier
13
  */
14
- trait FakeSingletonTrait {
15
 
16
  /**
17
  * The "not-so-single" instance of the class.
@@ -21,7 +22,7 @@ trait FakeSingletonTrait {
21
  * @access protected
22
  * @author Grégory Viguier
23
  */
24
- protected static $_instance;
25
 
26
  /**
27
  * Get the main Instance.
@@ -33,10 +34,10 @@ trait FakeSingletonTrait {
33
  * @return object Main instance.
34
  */
35
  public static function get_instance() {
36
- if ( ! isset( static::$_instance ) ) {
37
- static::$_instance = new static();
38
  }
39
 
40
- return static::$_instance;
41
  }
42
  }
9
  * This is temporary, until we get a DI container.
10
  *
11
  * @since 1.9
12
+ * @since 1.9.4 Renamed FakeSingletonTrait into InstanceGetterTrait.
13
  * @author Grégory Viguier
14
  */
15
+ trait InstanceGetterTrait {
16
 
17
  /**
18
  * The "not-so-single" instance of the class.
22
  * @access protected
23
  * @author Grégory Viguier
24
  */
25
+ protected static $instance;
26
 
27
  /**
28
  * Get the main Instance.
34
  * @return object Main instance.
35
  */
36
  public static function get_instance() {
37
+ if ( ! isset( static::$instance ) ) {
38
+ static::$instance = new static();
39
  }
40
 
41
+ return static::$instance;
42
  }
43
  }
classes/Webp/Display.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
10
  * @author Grégory Viguier
11
  */
12
  class Display {
13
- use \Imagify\Traits\FakeSingletonTrait;
14
 
15
  /**
16
  * Server conf object.
10
  * @author Grégory Viguier
11
  */
12
  class Display {
13
+ use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
  * Server conf object.
classes/Webp/Picture/Display.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
10
  * @author Grégory Viguier
11
  */
12
  class Display {
13
- use \Imagify\Traits\FakeSingletonTrait;
14
 
15
  /**
16
  * Option value.
@@ -436,7 +436,7 @@ class Display {
436
  protected function process_image( $image ) {
437
  static $extensions;
438
 
439
- $atts_pattern = '/(?<name>[^\s"\']+)\s*=\s*(["\'])\s*(?<value>.*?)\s*\2/';
440
 
441
  if ( ! preg_match_all( $atts_pattern, $image, $tmp_attributes, PREG_SET_ORDER ) ) {
442
  // No attributes?
10
  * @author Grégory Viguier
11
  */
12
  class Display {
13
+ use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
  * Option value.
436
  protected function process_image( $image ) {
437
  static $extensions;
438
 
439
+ $atts_pattern = '/(?<name>[^\s"\']+)\s*=\s*(["\'])\s*(?<value>.*?)\s*\2/s';
440
 
441
  if ( ! preg_match_all( $atts_pattern, $image, $tmp_attributes, PREG_SET_ORDER ) ) {
442
  // No attributes?
classes/Webp/RewriteRules/Apache.php CHANGED
@@ -49,10 +49,10 @@ class Apache extends \Imagify\WriteFile\AbstractApacheDirConfFile {
49
  RewriteCond %{HTTP_ACCEPT} image/webp
50
 
51
  # Check if WebP replacement image exists.
52
- RewriteCond %{DOCUMENT_ROOT}' . $home_root . '$1.$2.webp -f
53
 
54
  # Serve WebP image instead.
55
- RewriteRule (.+)\.(' . $extensions . ')$ $1.$2.webp [T=image/webp]
56
  </IfModule>
57
 
58
  <IfModule mod_headers.c>
49
  RewriteCond %{HTTP_ACCEPT} image/webp
50
 
51
  # Check if WebP replacement image exists.
52
+ RewriteCond %{REQUEST_FILENAME}.webp -f
53
 
54
  # Serve WebP image instead.
55
+ RewriteRule (.+)\.(' . $extensions . ')$ $1.$2.webp [T=image/webp,NC]
56
  </IfModule>
57
 
58
  <IfModule mod_headers.c>
classes/Webp/RewriteRules/Display.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
10
  * @author Grégory Viguier
11
  */
12
  class Display {
13
- use \Imagify\Traits\FakeSingletonTrait;
14
 
15
  /**
16
  * Option value.
10
  * @author Grégory Viguier
11
  */
12
  class Display {
13
+ use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
  * Option value.
imagify.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Imagify
4
  * Plugin URI: https://wordpress.org/plugins/imagify/
5
  * Description: Dramaticaly reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth using Imagify, the new most advanced image optimization tool.
6
- * Version: 1.9.3.1
7
  * Requires PHP: 5.4
8
  * Author: WP Media
9
  * Author URI: https://wp-media.me/
@@ -20,7 +20,7 @@
20
  defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
21
 
22
  // Imagify defines.
23
- define( 'IMAGIFY_VERSION', '1.9.3.1' );
24
  define( 'IMAGIFY_SLUG', 'imagify' );
25
  define( 'IMAGIFY_FILE', __FILE__ );
26
  define( 'IMAGIFY_PATH', realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' );
3
  * Plugin Name: Imagify
4
  * Plugin URI: https://wordpress.org/plugins/imagify/
5
  * Description: Dramaticaly reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth using Imagify, the new most advanced image optimization tool.
6
+ * Version: 1.9.4
7
  * Requires PHP: 5.4
8
  * Author: WP Media
9
  * Author URI: https://wp-media.me/
20
  defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
21
 
22
  // Imagify defines.
23
+ define( 'IMAGIFY_VERSION', '1.9.4' );
24
  define( 'IMAGIFY_SLUG', 'imagify' );
25
  define( 'IMAGIFY_FILE', __FILE__ );
26
  define( 'IMAGIFY_PATH', realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' );
inc/3rd-party/3rd-party.php CHANGED
@@ -19,6 +19,7 @@ require IMAGIFY_PATH . 'inc/3rd-party/yoast-seo.php';
19
  * Hosting.
20
  */
21
  require IMAGIFY_PATH . 'inc/3rd-party/hosting/flywheel.php';
 
22
  require IMAGIFY_PATH . 'inc/3rd-party/hosting/siteground.php';
23
  require IMAGIFY_PATH . 'inc/3rd-party/hosting/wordpress-com.php';
24
  require IMAGIFY_PATH . 'inc/3rd-party/hosting/wpengine.php';
19
  * Hosting.
20
  */
21
  require IMAGIFY_PATH . 'inc/3rd-party/hosting/flywheel.php';
22
+ require IMAGIFY_PATH . 'inc/3rd-party/hosting/pressable.php';
23
  require IMAGIFY_PATH . 'inc/3rd-party/hosting/siteground.php';
24
  require IMAGIFY_PATH . 'inc/3rd-party/hosting/wordpress-com.php';
25
  require IMAGIFY_PATH . 'inc/3rd-party/hosting/wpengine.php';
inc/3rd-party/amazon-s3-and-cloudfront/classes/Main.php CHANGED
@@ -13,7 +13,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
13
  * @author Grégory Viguier
14
  */
15
  class Main extends \Imagify_AS3CF_Deprecated {
16
- use \Imagify\Traits\FakeSingletonTrait;
17
 
18
  /**
19
  * AS3CF settings.
13
  * @author Grégory Viguier
14
  */
15
  class Main extends \Imagify_AS3CF_Deprecated {
16
+ use \Imagify\Traits\InstanceGetterTrait;
17
 
18
  /**
19
  * AS3CF settings.
inc/3rd-party/enable-media-replace/classes/Main.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
10
  * @author Grégory Viguier
11
  */
12
  class Main extends \Imagify_Enable_Media_Replace_Deprecated {
13
- use \Imagify\Traits\FakeSingletonTrait;
14
 
15
  /**
16
  * Class version.
10
  * @author Grégory Viguier
11
  */
12
  class Main extends \Imagify_Enable_Media_Replace_Deprecated {
13
+ use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
  * Class version.
inc/3rd-party/formidable-pro/classes/Main.php CHANGED
@@ -11,7 +11,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
11
  * @author Grégory Viguier
12
  */
13
  class Main {
14
- use \Imagify\Traits\FakeSingletonTrait;
15
 
16
  /**
17
  * Class version.
11
  * @author Grégory Viguier
12
  */
13
  class Main {
14
+ use \Imagify\Traits\InstanceGetterTrait;
15
 
16
  /**
17
  * Class version.
inc/3rd-party/hosting/pressable.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
3
+
4
+ if ( defined( 'IS_PRESSABLE' ) ) :
5
+
6
+ add_filter( 'imagify_site_root', 'imagify_pressable_site_root', IMAGIFY_INT_MAX );
7
+ /**
8
+ * Filter the path to the site's root.
9
+ *
10
+ * @since 1.9.4
11
+ * @author Grégory Viguier
12
+ *
13
+ * @param string|null $root_path Path to the site's root. Default is null.
14
+ * @return string
15
+ */
16
+ function imagify_pressable_site_root( $root_path ) {
17
+ $upload_basedir = trim( wp_normalize_path( WP_CONTENT_DIR ), '/' );
18
+ $upload_basedir = explode( '/', $upload_basedir );
19
+ $upload_basedir = reset( $upload_basedir );
20
+
21
+ return '/' . $upload_basedir . '/';
22
+ }
23
+
24
+ endif;
inc/3rd-party/nextgen-gallery/classes/Bulk/NGG.php CHANGED
@@ -133,7 +133,7 @@ class NGG extends \Imagify\Bulk\AbstractBulk {
133
  data.status = 'success'
134
  AND data.data NOT LIKE %s
135
  ORDER BY ngg.pid DESC",
136
- '%' . $wpdb->esc_like( '"full' . $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
137
  ) );
138
 
139
  $wpdb->flush();
@@ -187,7 +187,7 @@ class NGG extends \Imagify\Bulk\AbstractBulk {
187
  data.status = 'success'
188
  AND data.data NOT LIKE %s
189
  ORDER BY ngg.pid DESC",
190
- '%' . $wpdb->esc_like( '"full' . $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
191
  ) );
192
  }
193
 
133
  data.status = 'success'
134
  AND data.data NOT LIKE %s
135
  ORDER BY ngg.pid DESC",
136
+ '%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
137
  ) );
138
 
139
  $wpdb->flush();
187
  data.status = 'success'
188
  AND data.data NOT LIKE %s
189
  ORDER BY ngg.pid DESC",
190
+ '%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
191
  ) );
192
  }
193
 
inc/3rd-party/nextgen-gallery/classes/Context/NGG.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
10
  * @author Grégory Viguier
11
  */
12
  class NGG extends \Imagify\Context\AbstractContext {
13
- use \Imagify\Traits\FakeSingletonTrait;
14
 
15
  /**
16
  * Context "short name".
10
  * @author Grégory Viguier
11
  */
12
  class NGG extends \Imagify\Context\AbstractContext {
13
+ use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
  * Context "short name".
inc/3rd-party/nextgen-gallery/classes/DynamicThumbnails.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
10
  * @author Grégory Viguier
11
  */
12
  class DynamicThumbnails {
13
- use \Imagify\Traits\FakeSingletonTrait;
14
 
15
  /**
16
  * The queue containing the sizes, grouped by image ID.
10
  * @author Grégory Viguier
11
  */
12
  class DynamicThumbnails {
13
+ use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
  * The queue containing the sizes, grouped by image ID.
inc/3rd-party/nextgen-gallery/classes/Main.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
10
  * @author Jonathan Buttigieg
11
  */
12
  class Main {
13
- use \Imagify\Traits\FakeSingletonTrait;
14
 
15
  /**
16
  * Class version.
10
  * @author Jonathan Buttigieg
11
  */
12
  class Main {
13
+ use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
  * Class version.
inc/3rd-party/regenerate-thumbnails/classes/Main.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
10
  * @author Grégory Viguier
11
  */
12
  class Main extends \Imagify_Regenerate_Thumbnails_Deprecated {
13
- use \Imagify\Traits\FakeSingletonTrait;
14
 
15
  /**
16
  * Class version.
@@ -285,7 +285,13 @@ class Main extends \Imagify_Regenerate_Thumbnails_Deprecated {
285
  static $route;
286
 
287
  if ( ! isset( $route ) ) {
288
- $route = '/' . trim( \RegenerateThumbnails()->rest_api->namespace, '/' ) . '/regenerate/';
 
 
 
 
 
 
289
  }
290
 
291
  return $route;
10
  * @author Grégory Viguier
11
  */
12
  class Main extends \Imagify_Regenerate_Thumbnails_Deprecated {
13
+ use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
  * Class version.
285
  static $route;
286
 
287
  if ( ! isset( $route ) ) {
288
+ $regen = \RegenerateThumbnails();
289
+
290
+ if ( ( empty( $regen->rest_api ) || ! is_object( $regen->rest_api ) ) && method_exists( $regen, 'rest_api_init' ) ) {
291
+ $regen->rest_api_init();
292
+ }
293
+
294
+ $route = '/' . trim( $regen->rest_api->namespace, '/' ) . '/regenerate/';
295
  }
296
 
297
  return $route;
inc/3rd-party/wp-real-media-library.php CHANGED
@@ -4,11 +4,11 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
4
  if ( defined( 'RML_FILE' ) ) :
5
 
6
  /**
7
- * Prevent WP Real Media Library to use its outdated version of SweetAlert where we need ours.
8
  */
9
  add_action( 'current_screen', 'imagify_wprml_init' );
10
  /**
11
- * Dequeue WP Real Media Library's version of SweetAlert when we need ours.
12
  *
13
  * @since 1.6.13
14
  * @author Grégory Viguier
@@ -21,7 +21,7 @@ if ( defined( 'RML_FILE' ) ) :
21
  }
22
  $done = true;
23
 
24
- if ( ! class_exists( 'MatthiasWeb\RealMediaLibrary\general\Backend' ) ) {
25
  return;
26
  }
27
 
@@ -46,16 +46,29 @@ if ( defined( 'RML_FILE' ) ) :
46
  }
47
 
48
  /**
49
- * Prevent WP Real Media Library to enqueue its version of SweetAlert.
50
  *
51
  * @since 1.6.13
52
  * @author Grégory Viguier
53
  */
54
  function imagify_wprml_dequeue() {
55
- $instance = call_user_func( array( 'MatthiasWeb\RealMediaLibrary\general\Backend', 'getInstance' ) );
56
 
57
- remove_action( 'admin_enqueue_scripts', array( $instance, 'admin_enqueue_scripts' ), 0 );
58
- remove_action( 'admin_footer', array( $instance, 'admin_footer' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
60
 
61
  endif;
4
  if ( defined( 'RML_FILE' ) ) :
5
 
6
  /**
7
+ * Prevent WP Real Media Library to use its outdated version of SweetAlert where we need ours, and to mess with our CSS styles.
8
  */
9
  add_action( 'current_screen', 'imagify_wprml_init' );
10
  /**
11
+ * Dequeue all WP Real Media Library's styles and scripts where we use ours.
12
  *
13
  * @since 1.6.13
14
  * @author Grégory Viguier
21
  }
22
  $done = true;
23
 
24
+ if ( ! class_exists( '\\MatthiasWeb\\RealMediaLibrary\\general\\Backend' ) ) {
25
  return;
26
  }
27
 
46
  }
47
 
48
  /**
49
+ * Prevent WP Real Media Library to enqueue its styles and scripts.
50
  *
51
  * @since 1.6.13
52
  * @author Grégory Viguier
53
  */
54
  function imagify_wprml_dequeue() {
55
+ $instance = \MatthiasWeb\RealMediaLibrary\general\Backend::getInstance();
56
 
57
+ remove_action( 'admin_enqueue_scripts', [ $instance, 'admin_enqueue_scripts' ], 0 );
58
+ remove_action( 'admin_footer', [ $instance, 'admin_footer' ] );
59
+
60
+ if ( class_exists( '\\MatthiasWeb\\RealMediaLibrary\\general\\FolderShortcode' ) ) {
61
+ $instance = \MatthiasWeb\RealMediaLibrary\general\FolderShortcode::getInstance();
62
+
63
+ remove_action( 'admin_head', [ $instance, 'admin_head' ] );
64
+ remove_action( 'admin_enqueue_scripts', [ $instance, 'admin_enqueue_scripts' ] );
65
+ }
66
+
67
+ if ( class_exists( '\\MatthiasWeb\\RealMediaLibrary\\comp\\PageBuilders' ) ) {
68
+ $instance = \MatthiasWeb\RealMediaLibrary\comp\PageBuilders::getInstance();
69
+
70
+ remove_action( 'init', [ $instance, 'init' ] );
71
+ }
72
  }
73
 
74
  endif;
inc/3rd-party/wp-rocket/classes/Main.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
10
  * @author Grégory Viguier
11
  */
12
  class Main {
13
- use \Imagify\Traits\FakeSingletonTrait;
14
 
15
  /**
16
  * Launch the hooks.
10
  * @author Grégory Viguier
11
  */
12
  class Main {
13
+ use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
  * Launch the hooks.
inc/classes/class-imagify-admin-ajax-post.php CHANGED
@@ -8,7 +8,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
8
  * @author Grégory Viguier
9
  */
10
  class Imagify_Admin_Ajax_Post extends Imagify_Admin_Ajax_Post_Deprecated {
11
- use \Imagify\Traits\FakeSingletonTrait;
12
 
13
  /**
14
  * Class version.
8
  * @author Grégory Viguier
9
  */
10
  class Imagify_Admin_Ajax_Post extends Imagify_Admin_Ajax_Post_Deprecated {
11
+ use \Imagify\Traits\InstanceGetterTrait;
12
 
13
  /**
14
  * Class version.
inc/classes/class-imagify-plugin.php CHANGED
@@ -42,6 +42,8 @@ class Imagify_Plugin {
42
  public function init() {
43
  $this->include_files();
44
 
 
 
45
  Imagify_Auto_Optimization::get_instance()->init();
46
  Imagify_Options::get_instance()->init();
47
  Imagify_Data::get_instance()->init();
42
  public function init() {
43
  $this->include_files();
44
 
45
+ class_alias( '\\Imagify\\Traits\\InstanceGetterTrait', '\\Imagify\\Traits\\FakeSingletonTrait' );
46
+
47
  Imagify_Auto_Optimization::get_instance()->init();
48
  Imagify_Options::get_instance()->init();
49
  Imagify_Data::get_instance()->init();
package.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "name": "imagify",
3
  "description": "Imagify Image Optimizer. Dramatically reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth.",
4
- "version": "1.9.3.1",
5
  "homepage": "https://wordpress.org/plugins/imagify/",
6
  "license": "GPL-2.0",
7
  "private": true,
1
  {
2
  "name": "imagify",
3
  "description": "Imagify Image Optimizer. Dramatically reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth.",
4
+ "version": "1.9.4",
5
  "homepage": "https://wordpress.org/plugins/imagify/",
6
  "license": "GPL-2.0",
7
  "private": true,
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: wp_media, GregLone
3
  Tags: compress image, images, performance, optimization, webp
4
  Requires at least: 4.0.0
5
  Tested up to: 5.2.2
6
- Stable tag: 1.9.3.1
7
 
8
  Dramatically reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth.
9
 
@@ -153,6 +153,16 @@ When the plugin is disabled, your existing images remain optimized. Backups of t
153
  4. Other Media Page
154
 
155
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
156
  = 1.9.3.1 - 2019/07/03 =
157
  * Fix: conflict with plugins using an ancient version of Composer.
158
 
3
  Tags: compress image, images, performance, optimization, webp
4
  Requires at least: 4.0.0
5
  Tested up to: 5.2.2
6
+ Stable tag: 1.9.4
7
 
8
  Dramatically reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth.
9
 
153
  4. Other Media Page
154
 
155
  == Changelog ==
156
+ = 1.9.4 - 2019/07/10 =
157
+ * Improvement: if a webp image is larger than its non-webp version, it is now possible to not keep it. This can be done by using the filter `imagify_keep_large_webp`.
158
+ * Improvement: compatibility with Pressable.
159
+ * Improvement: renamed a php class to prevent some hosts to wrongly flag it as "suspicious" and trigger a fatal error.
160
+ * Improvement: better compatibility with WP Real Media Library plugin.
161
+ * Fix: rewrite rules for webp could not work on some servers.
162
+ * Fix: when using `&lt;picture&gt;` tags for webp, some attributes could disappear if they were written on multiple lines.
163
+ * Fix: the bulk method would not work in the NextGen Gallery list.
164
+ * Fix: php notice `Trying to get property "namespace" for a non object`.
165
+
166
  = 1.9.3.1 - 2019/07/03 =
167
  * Fix: conflict with plugins using an ancient version of Composer.
168
 
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit5cd354cf53b026e5303a93ad6f0f63c4::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit227da79a48485de04a5bdc367a98073e::getLoader();
vendor/composer/autoload_classmap.php CHANGED
@@ -146,7 +146,7 @@ return array(
146
  'Imagify\\ThirdParty\\NGG\\Optimization\\Process\\NGG' => $baseDir . '/inc/3rd-party/nextgen-gallery/classes/Optimization/Process/NGG.php',
147
  'Imagify\\ThirdParty\\RegenerateThumbnails\\Main' => $baseDir . '/inc/3rd-party/regenerate-thumbnails/classes/Main.php',
148
  'Imagify\\ThirdParty\\WPRocket\\Main' => $baseDir . '/inc/3rd-party/wp-rocket/classes/Main.php',
149
- 'Imagify\\Traits\\FakeSingletonTrait' => $baseDir . '/classes/Traits/FakeSingletonTrait.php',
150
  'Imagify\\Traits\\MediaRowTrait' => $baseDir . '/classes/Traits/MediaRowTrait.php',
151
  'Imagify\\Webp\\Apache' => $baseDir . '/classes/Webp/Apache.php',
152
  'Imagify\\Webp\\Display' => $baseDir . '/classes/Webp/Display.php',
146
  'Imagify\\ThirdParty\\NGG\\Optimization\\Process\\NGG' => $baseDir . '/inc/3rd-party/nextgen-gallery/classes/Optimization/Process/NGG.php',
147
  'Imagify\\ThirdParty\\RegenerateThumbnails\\Main' => $baseDir . '/inc/3rd-party/regenerate-thumbnails/classes/Main.php',
148
  'Imagify\\ThirdParty\\WPRocket\\Main' => $baseDir . '/inc/3rd-party/wp-rocket/classes/Main.php',
149
+ 'Imagify\\Traits\\InstanceGetterTrait' => $baseDir . '/classes/Traits/InstanceGetterTrait.php',
150
  'Imagify\\Traits\\MediaRowTrait' => $baseDir . '/classes/Traits/MediaRowTrait.php',
151
  'Imagify\\Webp\\Apache' => $baseDir . '/classes/Webp/Apache.php',
152
  'Imagify\\Webp\\Display' => $baseDir . '/classes/Webp/Display.php',
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit5cd354cf53b026e5303a93ad6f0f63c4
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit5cd354cf53b026e5303a93ad6f0f63c4
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit5cd354cf53b026e5303a93ad6f0f63c4', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit5cd354cf53b026e5303a93ad6f0f63c4', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInit5cd354cf53b026e5303a93ad6f0f63c4::getInitializer($loader));
31
  } else {
32
  $classMap = require __DIR__ . '/autoload_classmap.php';
33
  if ($classMap) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit227da79a48485de04a5bdc367a98073e
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit227da79a48485de04a5bdc367a98073e', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit227da79a48485de04a5bdc367a98073e', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit227da79a48485de04a5bdc367a98073e::getInitializer($loader));
31
  } else {
32
  $classMap = require __DIR__ . '/autoload_classmap.php';
33
  if ($classMap) {
vendor/composer/autoload_static.php CHANGED
@@ -7,7 +7,7 @@ namespace Composer\Autoload;
7
  use Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader as ClassLoaderWPMediaImagifyWordPressPlugin;
8
 
9
 
10
- class ComposerStaticInit5cd354cf53b026e5303a93ad6f0f63c4
11
  {
12
  public static $prefixLengthsPsr4 = array (
13
  'I' =>
@@ -210,7 +210,7 @@ class ComposerStaticInit5cd354cf53b026e5303a93ad6f0f63c4
210
  'Imagify\\ThirdParty\\NGG\\Optimization\\Process\\NGG' => __DIR__ . '/../..' . '/inc/3rd-party/nextgen-gallery/classes/Optimization/Process/NGG.php',
211
  'Imagify\\ThirdParty\\RegenerateThumbnails\\Main' => __DIR__ . '/../..' . '/inc/3rd-party/regenerate-thumbnails/classes/Main.php',
212
  'Imagify\\ThirdParty\\WPRocket\\Main' => __DIR__ . '/../..' . '/inc/3rd-party/wp-rocket/classes/Main.php',
213
- 'Imagify\\Traits\\FakeSingletonTrait' => __DIR__ . '/../..' . '/classes/Traits/FakeSingletonTrait.php',
214
  'Imagify\\Traits\\MediaRowTrait' => __DIR__ . '/../..' . '/classes/Traits/MediaRowTrait.php',
215
  'Imagify\\Webp\\Apache' => __DIR__ . '/../..' . '/classes/Webp/Apache.php',
216
  'Imagify\\Webp\\Display' => __DIR__ . '/../..' . '/classes/Webp/Display.php',
@@ -272,9 +272,9 @@ class ComposerStaticInit5cd354cf53b026e5303a93ad6f0f63c4
272
  public static function getInitializer(ClassLoaderWPMediaImagifyWordPressPlugin $loader)
273
  {
274
  return \Closure::bind(function () use ($loader) {
275
- $loader->prefixLengthsPsr4 = ComposerStaticInit5cd354cf53b026e5303a93ad6f0f63c4::$prefixLengthsPsr4;
276
- $loader->prefixDirsPsr4 = ComposerStaticInit5cd354cf53b026e5303a93ad6f0f63c4::$prefixDirsPsr4;
277
- $loader->classMap = ComposerStaticInit5cd354cf53b026e5303a93ad6f0f63c4::$classMap;
278
 
279
  }, null, ClassLoaderWPMediaImagifyWordPressPlugin::class);
280
  }
7
  use Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader as ClassLoaderWPMediaImagifyWordPressPlugin;
8
 
9
 
10
+ class ComposerStaticInit227da79a48485de04a5bdc367a98073e
11
  {
12
  public static $prefixLengthsPsr4 = array (
13
  'I' =>
210
  'Imagify\\ThirdParty\\NGG\\Optimization\\Process\\NGG' => __DIR__ . '/../..' . '/inc/3rd-party/nextgen-gallery/classes/Optimization/Process/NGG.php',
211
  'Imagify\\ThirdParty\\RegenerateThumbnails\\Main' => __DIR__ . '/../..' . '/inc/3rd-party/regenerate-thumbnails/classes/Main.php',
212
  'Imagify\\ThirdParty\\WPRocket\\Main' => __DIR__ . '/../..' . '/inc/3rd-party/wp-rocket/classes/Main.php',
213
+ 'Imagify\\Traits\\InstanceGetterTrait' => __DIR__ . '/../..' . '/classes/Traits/InstanceGetterTrait.php',
214
  'Imagify\\Traits\\MediaRowTrait' => __DIR__ . '/../..' . '/classes/Traits/MediaRowTrait.php',
215
  'Imagify\\Webp\\Apache' => __DIR__ . '/../..' . '/classes/Webp/Apache.php',
216
  'Imagify\\Webp\\Display' => __DIR__ . '/../..' . '/classes/Webp/Display.php',
272
  public static function getInitializer(ClassLoaderWPMediaImagifyWordPressPlugin $loader)
273
  {
274
  return \Closure::bind(function () use ($loader) {
275
+ $loader->prefixLengthsPsr4 = ComposerStaticInit227da79a48485de04a5bdc367a98073e::$prefixLengthsPsr4;
276
+ $loader->prefixDirsPsr4 = ComposerStaticInit227da79a48485de04a5bdc367a98073e::$prefixDirsPsr4;
277
+ $loader->classMap = ComposerStaticInit227da79a48485de04a5bdc367a98073e::$classMap;
278
 
279
  }, null, ClassLoaderWPMediaImagifyWordPressPlugin::class);
280
  }