EWWW Image Optimizer - Version 6.9.1

Version Description

  • changed: default syntax for MySQL 8.x to use faster upgrade query
  • fixed: bulk action parameter was not validated properly when selecting attachments for optimization
  • fixed: undefined function ewww_image_optimizer_get_primary_wpml_id
  • fixed: PHP notices when Easy IO filters srcset URLs
Download this release

Release Info

Developer nosilver4u
Plugin Icon 128x128 EWWW Image Optimizer
Version 6.9.1
Comparing to
See all releases

Code changes from version 6.9.0 to 6.9.1

bulk.php CHANGED
@@ -1186,7 +1186,7 @@ function ewww_image_optimizer_media_scan( $hook = '' ) {
1186
  $pending = false;
1187
  $remote_file = false;
1188
  if ( ! empty( $attachment_meta[ $selected_id ]['wpml_media_processed'] ) ) {
1189
- $wpml_id = ewww_image_optimizer_get_primary_wpml_id( $selected_id );
1190
  if ( (int) $wpml_id !== (int) $selected_id ) {
1191
  ewwwio_debug_message( "skipping WPML replica image $selected_id" );
1192
  $skipped_ids[] = $selected_id;
1186
  $pending = false;
1187
  $remote_file = false;
1188
  if ( ! empty( $attachment_meta[ $selected_id ]['wpml_media_processed'] ) ) {
1189
+ $wpml_id = ewww_image_optimizer_get_primary_translated_media_id( $selected_id );
1190
  if ( (int) $wpml_id !== (int) $selected_id ) {
1191
  ewwwio_debug_message( "skipping WPML replica image $selected_id" );
1192
  $skipped_ids[] = $selected_id;
changelog.txt CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  = 6.9.0 =
2
  * added: allow translation plugins to filter attachment IDs for retrieving Media Library results via ewwwio_primary_translated_media_id/ewwwio_translated_media_ids
3
  * changed: include upstream lazysizes unveilhooks for use by developers, props @saas786
1
+ = 6.9.1 =
2
+ * changed: default syntax for MySQL 8.x to use faster upgrade query
3
+ * fixed: bulk action parameter was not validated properly when selecting attachments for optimization
4
+ * fixed: undefined function ewww_image_optimizer_get_primary_wpml_id
5
+ * fixed: PHP notices when Easy IO filters srcset URLs
6
+
7
  = 6.9.0 =
8
  * added: allow translation plugins to filter attachment IDs for retrieving Media Library results via ewwwio_primary_translated_media_id/ewwwio_translated_media_ids
9
  * changed: include upstream lazysizes unveilhooks for use by developers, props @saas786
classes/class-exactdn.php CHANGED
@@ -2411,6 +2411,11 @@ if ( ! class_exists( 'ExactDN' ) ) {
2411
  */
2412
  $multipliers = apply_filters( 'exactdn_srcset_multipliers', array( .2, .4, .6, .8, 1, 2, 3, 1920 ) );
2413
 
 
 
 
 
 
2414
  if ( ! empty( $full_url ) ) {
2415
  $this->debug_message( "already built url via db: $full_url" );
2416
  $url = $full_url;
2411
  */
2412
  $multipliers = apply_filters( 'exactdn_srcset_multipliers', array( .2, .4, .6, .8, 1, 2, 3, 1920 ) );
2413
 
2414
+ if ( empty( $url ) || empty( $multipliers ) ) {
2415
+ // No URL, or no multipliers, bail!
2416
+ return $sources;
2417
+ }
2418
+
2419
  if ( ! empty( $full_url ) ) {
2420
  $this->debug_message( "already built url via db: $full_url" );
2421
  $url = $full_url;
common.php CHANGED
@@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
  }
15
 
16
- define( 'EWWW_IMAGE_OPTIMIZER_VERSION', 690 );
17
 
18
  // Initialize a couple globals.
19
  $eio_debug = '';
@@ -606,7 +606,7 @@ function ewwwio_json_encode( $value ) {
606
  }
607
 
608
  /**
609
- * Find out if set_time_limit() is allowed
610
  */
611
  function ewww_image_optimizer_stl_check() {
612
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
@@ -630,6 +630,7 @@ function ewww_image_optimizer_stl_check() {
630
  */
631
  function ewww_image_optimizer_function_exists( $function, $debug = false ) {
632
  if ( function_exists( 'ini_get' ) ) {
 
633
  $disabled = @ini_get( 'disable_functions' );
634
  if ( $debug ) {
635
  ewwwio_debug_message( "disable_functions: $disabled" );
@@ -1712,7 +1713,11 @@ function ewww_image_optimizer_install_table() {
1712
  $timestamp_upgrade_needed = false;
1713
  if ( ewww_image_optimizer_iterable( $tablefields ) ) {
1714
  foreach ( $tablefields as $tablefield ) {
1715
- if ( 'updated' === $tablefield->Field && false === stripos( $tablefield->Default, 'current_timestamp' ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
 
 
 
 
1716
  $timestamp_upgrade_needed = true;
1717
  ewwwio_debug_message( 'updated timestamp upgrade needed' );
1718
  }
@@ -1722,7 +1727,6 @@ function ewww_image_optimizer_install_table() {
1722
  (
1723
  false !== strpos( $mysql_version, '5.6.' ) ||
1724
  false !== strpos( $mysql_version, '5.7.' ) ||
1725
- false !== strpos( $mysql_version, '8.0.' ) ||
1726
  false !== strpos( $mysql_version, '10.1.' )
1727
  ) &&
1728
  $timestamp_upgrade_needed
@@ -1736,7 +1740,7 @@ function ewww_image_optimizer_install_table() {
1736
  set_transient( 'ewww_image_optimizer_620_upgrade_needed', true );
1737
  }
1738
  } elseif ( $timestamp_upgrade_needed ) {
1739
- $wpdb->query( "ALTER TABLE $wpdb->ewwwio_images ALTER updated SET DEFAULT CURRENT_TIMESTAMP" );
1740
  }
1741
  // Check the current collation and adjust it if necessary.
1742
  $column_collate = $wpdb->get_col_charset( $wpdb->ewwwio_images, 'path' );
@@ -5002,6 +5006,12 @@ function ewww_image_optimizer_media_rename( $old_name, $new_name ) {
5002
  */
5003
  function ewww_image_optimizer_exactdn_activate_ajax() {
5004
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
 
 
 
 
 
 
5005
  if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['ewww_wpnonce'] ), 'ewww-image-optimizer-settings' ) ) {
5006
  die( wp_json_encode( array( 'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ) ) ) );
5007
  }
@@ -5055,6 +5065,11 @@ function ewww_image_optimizer_exactdn_activate_ajax() {
5055
  */
5056
  function ewww_image_optimizer_exactdn_activate_site_ajax() {
5057
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
 
 
 
 
 
5058
  if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['ewww_wpnonce'] ), 'ewww-image-optimizer-settings' ) ) {
5059
  die( wp_json_encode( array( 'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ) ) ) );
5060
  }
@@ -5116,6 +5131,11 @@ function ewww_image_optimizer_exactdn_activate_site_ajax() {
5116
  */
5117
  function ewww_image_optimizer_exactdn_register_site_ajax() {
5118
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
 
 
 
 
 
5119
  if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['ewww_wpnonce'] ), 'ewww-image-optimizer-settings' ) ) {
5120
  die( wp_json_encode( array( 'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ) ) ) );
5121
  }
@@ -5246,6 +5266,11 @@ function ewww_image_optimizer_register_site_post() {
5246
  */
5247
  function ewww_image_optimizer_exactdn_deregister_site_ajax() {
5248
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
 
 
 
 
 
5249
  if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['ewww_wpnonce'] ), 'ewww-image-optimizer-settings' ) ) {
5250
  die( wp_json_encode( array( 'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ) ) ) );
5251
  }
@@ -5389,6 +5414,11 @@ function ewww_image_optimizer_cloud_key_sanitize( $key ) {
5389
  */
5390
  function ewww_image_optimizer_cloud_key_verify_ajax() {
5391
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
 
 
 
 
 
5392
  if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['ewww_wpnonce'] ), 'ewww-image-optimizer-settings' ) ) {
5393
  die( wp_json_encode( array( 'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ) ) ) );
5394
  }
@@ -10790,7 +10820,7 @@ function ewww_image_optimizer_dismiss_newsletter_signup() {
10790
  */
10791
  function ewww_image_optimizer_add_bulk_media_actions( $bulk_actions ) {
10792
  if ( is_array( $bulk_actions ) ) {
10793
- $bulk_actions['bulk_optimze'] = __( 'Bulk Optimize', 'ewww-image-optimizer' );
10794
  }
10795
  return $bulk_actions;
10796
  }
@@ -10805,7 +10835,7 @@ function ewww_image_optimizer_add_bulk_media_actions( $bulk_actions ) {
10805
  */
10806
  function ewww_image_optimizer_bulk_action_handler( $redirect_to, $doaction, $post_ids ) {
10807
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
10808
- if ( empty( $doaction || 'bulk_optimize' !== $doaction ) ) {
10809
  return $redirect_to;
10810
  }
10811
  // If there is no media to optimize, do nothing.
@@ -10815,16 +10845,13 @@ function ewww_image_optimizer_bulk_action_handler( $redirect_to, $doaction, $pos
10815
  check_admin_referer( 'bulk-media' );
10816
  // Prep the attachment IDs for optimization.
10817
  $ids = implode( ',', array_map( 'intval', $post_ids ) );
10818
- wp_safe_redirect(
10819
- add_query_arg(
10820
- array(
10821
- 'page' => 'ewww-image-optimizer-bulk',
10822
- 'ids' => $ids,
10823
- ),
10824
- admin_url( 'upload.php' )
10825
- )
10826
  );
10827
- ewwwio_memory( __FUNCTION__ );
10828
  }
10829
 
10830
  /**
13
  exit;
14
  }
15
 
16
+ define( 'EWWW_IMAGE_OPTIMIZER_VERSION', 691 );
17
 
18
  // Initialize a couple globals.
19
  $eio_debug = '';
606
  }
607
 
608
  /**
609
+ * Find out if set_time_limit() is allowed.
610
  */
611
  function ewww_image_optimizer_stl_check() {
612
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
630
  */
631
  function ewww_image_optimizer_function_exists( $function, $debug = false ) {
632
  if ( function_exists( 'ini_get' ) ) {
633
+ // phpcs:ignore WordPress.PHP.NoSilencedErrors
634
  $disabled = @ini_get( 'disable_functions' );
635
  if ( $debug ) {
636
  ewwwio_debug_message( "disable_functions: $disabled" );
1713
  $timestamp_upgrade_needed = false;
1714
  if ( ewww_image_optimizer_iterable( $tablefields ) ) {
1715
  foreach ( $tablefields as $tablefield ) {
1716
+ if (
1717
+ 'updated' === $tablefield->Field && // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
1718
+ false === stripos( $tablefield->Default, 'current_timestamp' ) && // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
1719
+ false === stripos( $tablefield->Default, 'now' ) // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
1720
+ ) {
1721
  $timestamp_upgrade_needed = true;
1722
  ewwwio_debug_message( 'updated timestamp upgrade needed' );
1723
  }
1727
  (
1728
  false !== strpos( $mysql_version, '5.6.' ) ||
1729
  false !== strpos( $mysql_version, '5.7.' ) ||
 
1730
  false !== strpos( $mysql_version, '10.1.' )
1731
  ) &&
1732
  $timestamp_upgrade_needed
1740
  set_transient( 'ewww_image_optimizer_620_upgrade_needed', true );
1741
  }
1742
  } elseif ( $timestamp_upgrade_needed ) {
1743
+ $wpdb->query( "ALTER TABLE $wpdb->ewwwio_images ALTER updated SET DEFAULT (CURRENT_TIMESTAMP)" );
1744
  }
1745
  // Check the current collation and adjust it if necessary.
1746
  $column_collate = $wpdb->get_col_charset( $wpdb->ewwwio_images, 'path' );
5006
  */
5007
  function ewww_image_optimizer_exactdn_activate_ajax() {
5008
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
5009
+ if ( false === current_user_can( apply_filters( 'ewww_image_optimizer_admin_permissions', '' ) ) ) {
5010
+ // Display error message if insufficient permissions.
5011
+ ewwwio_ob_clean();
5012
+ wp_die( wp_json_encode( array( 'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ) ) ) );
5013
+ }
5014
+ // Make sure we didn't accidentally get to this page without an attachment to work on.
5015
  if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['ewww_wpnonce'] ), 'ewww-image-optimizer-settings' ) ) {
5016
  die( wp_json_encode( array( 'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ) ) ) );
5017
  }
5065
  */
5066
  function ewww_image_optimizer_exactdn_activate_site_ajax() {
5067
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
5068
+ if ( false === current_user_can( apply_filters( 'ewww_image_optimizer_admin_permissions', '' ) ) ) {
5069
+ // Display error message if insufficient permissions.
5070
+ ewwwio_ob_clean();
5071
+ wp_die( wp_json_encode( array( 'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ) ) ) );
5072
+ }
5073
  if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['ewww_wpnonce'] ), 'ewww-image-optimizer-settings' ) ) {
5074
  die( wp_json_encode( array( 'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ) ) ) );
5075
  }
5131
  */
5132
  function ewww_image_optimizer_exactdn_register_site_ajax() {
5133
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
5134
+ if ( false === current_user_can( apply_filters( 'ewww_image_optimizer_admin_permissions', '' ) ) ) {
5135
+ // Display error message if insufficient permissions.
5136
+ ewwwio_ob_clean();
5137
+ wp_die( wp_json_encode( array( 'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ) ) ) );
5138
+ }
5139
  if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['ewww_wpnonce'] ), 'ewww-image-optimizer-settings' ) ) {
5140
  die( wp_json_encode( array( 'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ) ) ) );
5141
  }
5266
  */
5267
  function ewww_image_optimizer_exactdn_deregister_site_ajax() {
5268
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
5269
+ if ( false === current_user_can( apply_filters( 'ewww_image_optimizer_admin_permissions', '' ) ) ) {
5270
+ // Display error message if insufficient permissions.
5271
+ ewwwio_ob_clean();
5272
+ wp_die( wp_json_encode( array( 'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ) ) ) );
5273
+ }
5274
  if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['ewww_wpnonce'] ), 'ewww-image-optimizer-settings' ) ) {
5275
  die( wp_json_encode( array( 'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ) ) ) );
5276
  }
5414
  */
5415
  function ewww_image_optimizer_cloud_key_verify_ajax() {
5416
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
5417
+ if ( false === current_user_can( apply_filters( 'ewww_image_optimizer_admin_permissions', '' ) ) ) {
5418
+ // Display error message if insufficient permissions.
5419
+ ewwwio_ob_clean();
5420
+ wp_die( wp_json_encode( array( 'error' => esc_html__( 'Access denied.', 'ewww-image-optimizer' ) ) ) );
5421
+ }
5422
  if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['ewww_wpnonce'] ), 'ewww-image-optimizer-settings' ) ) {
5423
  die( wp_json_encode( array( 'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ) ) ) );
5424
  }
10820
  */
10821
  function ewww_image_optimizer_add_bulk_media_actions( $bulk_actions ) {
10822
  if ( is_array( $bulk_actions ) ) {
10823
+ $bulk_actions['bulk_optimize'] = __( 'Bulk Optimize', 'ewww-image-optimizer' );
10824
  }
10825
  return $bulk_actions;
10826
  }
10835
  */
10836
  function ewww_image_optimizer_bulk_action_handler( $redirect_to, $doaction, $post_ids ) {
10837
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
10838
+ if ( empty( $doaction ) || 'bulk_optimize' !== $doaction ) {
10839
  return $redirect_to;
10840
  }
10841
  // If there is no media to optimize, do nothing.
10845
  check_admin_referer( 'bulk-media' );
10846
  // Prep the attachment IDs for optimization.
10847
  $ids = implode( ',', array_map( 'intval', $post_ids ) );
10848
+ return add_query_arg(
10849
+ array(
10850
+ 'page' => 'ewww-image-optimizer-bulk',
10851
+ 'ids' => $ids,
10852
+ ),
10853
+ admin_url( 'upload.php' )
 
 
10854
  );
 
10855
  }
10856
 
10857
  /**
ewww-image-optimizer.php CHANGED
@@ -13,7 +13,7 @@ Plugin Name: EWWW Image Optimizer
13
  Plugin URI: https://wordpress.org/plugins/ewww-image-optimizer/
14
  Description: Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
15
  Author: Exactly WWW
16
- Version: 6.9.0
17
  Requires at least: 5.8
18
  Requires PHP: 7.2
19
  Author URI: https://ewww.io/
13
  Plugin URI: https://wordpress.org/plugins/ewww-image-optimizer/
14
  Description: Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
15
  Author: Exactly WWW
16
+ Version: 6.9.1
17
  Requires at least: 5.8
18
  Requires PHP: 7.2
19
  Author URI: https://ewww.io/
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: optimize, image, convert, webp, resize, compress, lazy load, optimization,
5
  Requires at least: 5.8
6
  Tested up to: 6.1
7
  Requires PHP: 7.2
8
- Stable tag: 6.9.0
9
  License: GPLv3
10
 
11
  Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
@@ -137,6 +137,12 @@ That's not a question, but since I made it up, I'll answer it. See this resource
137
  * Feature requests can be viewed and submitted on our [feedback portal](https://feedback.ewww.io/b/features)
138
  * If you would like to help translate this plugin in your language, [join the team](https://translate.wordpress.org/projects/wp-plugins/ewww-image-optimizer/)
139
 
 
 
 
 
 
 
140
  = 6.9.0 =
141
  * added: allow translation plugins to filter attachment IDs for retrieving Media Library results via ewwwio_primary_translated_media_id/ewwwio_translated_media_ids
142
  * changed: include upstream lazysizes unveilhooks for use by developers, props @saas786
5
  Requires at least: 5.8
6
  Tested up to: 6.1
7
  Requires PHP: 7.2
8
+ Stable tag: 6.9.1
9
  License: GPLv3
10
 
11
  Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
137
  * Feature requests can be viewed and submitted on our [feedback portal](https://feedback.ewww.io/b/features)
138
  * If you would like to help translate this plugin in your language, [join the team](https://translate.wordpress.org/projects/wp-plugins/ewww-image-optimizer/)
139
 
140
+ = 6.9.1 =
141
+ * changed: default syntax for MySQL 8.x to use faster upgrade query
142
+ * fixed: bulk action parameter was not validated properly when selecting attachments for optimization
143
+ * fixed: undefined function ewww_image_optimizer_get_primary_wpml_id
144
+ * fixed: PHP notices when Easy IO filters srcset URLs
145
+
146
  = 6.9.0 =
147
  * added: allow translation plugins to filter attachment IDs for retrieving Media Library results via ewwwio_primary_translated_media_id/ewwwio_translated_media_ids
148
  * changed: include upstream lazysizes unveilhooks for use by developers, props @saas786