EWWW Image Optimizer - Version 4.2.3

Version Description

  • added: skip resizing for images with noresize in the filename
  • added: notice about plugins that remove query strings when ExactDN is active
  • changed: cache busting for ExactDN uses theme directory modified time with fallback to EWWW IO version
  • fixed: exactdn test verification attempts to access WP_Error as an array
Download this release

Release Info

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

Code changes from version 4.2.2 to 4.2.3

changelog.txt CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  = 4.2.2 =
2
  * added: view pages with ExactDN or the entire plugin disabled via GET paramaters: ewwwio_disable and exactdn_disable
3
  * changed: moved to v2 quota endpoint for API
1
+ = 4.2.3 =
2
+ * added: skip resizing for images with noresize in the filename
3
+ * added: notice about plugins that remove query strings when ExactDN is active
4
+ * changed: cache busting for ExactDN uses theme directory modified time with fallback to EWWW IO version
5
+ * fixed: exactdn test verification attempts to access WP_Error as an array
6
+
7
  = 4.2.2 =
8
  * added: view pages with ExactDN or the entire plugin disabled via GET paramaters: ewwwio_disable and exactdn_disable
9
  * changed: moved to v2 quota endpoint for API
classes/class-exactdn.php CHANGED
@@ -142,8 +142,8 @@ class ExactDN {
142
 
143
  // Get all the script/css urls and rewrite them (if enabled).
144
  if ( ewww_image_optimizer_get_option( 'exactdn_all_the_things' ) ) {
145
- add_filter( 'style_loader_src', array( $this, 'parse_enqueue' ) );
146
- add_filter( 'script_loader_src', array( $this, 'parse_enqueue' ) );
147
  }
148
 
149
  // Configure Autoptimize with our CDN domain.
@@ -296,9 +296,6 @@ class ExactDN {
296
  $error_message = $test_result->get_error_message();
297
  ewwwio_debug_message( "exactdn verification request failed: $error_message" );
298
  $this->set_exactdn_option( 'suspended', 1 );
299
- if ( ! empty( $test_result['response']['code'] ) ) {
300
- ewwwio_debug_message( 'exactdn response code: ' . $test_result['response']['code'] );
301
- }
302
  return false;
303
  } elseif ( ! empty( $test_result['body'] ) && strlen( $test_result['body'] ) > 300 ) {
304
  if ( 200 === $test_result['response']['code'] &&
@@ -1776,12 +1773,16 @@ class ExactDN {
1776
 
1777
  // If a resource doesn't have a version string, we add one to help with cache-busting.
1778
  if ( empty( $parsed_url['query'] ) ) {
 
 
 
 
1779
  /**
1780
  * Allows a custom version string for resources that are missing one.
1781
  *
1782
  * @param string EWWW IO version.
1783
  */
1784
- $parsed_url['query'] = apply_filters( 'exactdn_version_string', EWWW_IMAGE_OPTIMIZER_VERSION );
1785
  }
1786
 
1787
  $exactdn_url = '//' . $this->exactdn_domain . '/' . ltrim( $parsed_url['path'], '/' ) . '?' . $parsed_url['query'];
142
 
143
  // Get all the script/css urls and rewrite them (if enabled).
144
  if ( ewww_image_optimizer_get_option( 'exactdn_all_the_things' ) ) {
145
+ add_filter( 'style_loader_src', array( $this, 'parse_enqueue' ), 20 );
146
+ add_filter( 'script_loader_src', array( $this, 'parse_enqueue' ), 20 );
147
  }
148
 
149
  // Configure Autoptimize with our CDN domain.
296
  $error_message = $test_result->get_error_message();
297
  ewwwio_debug_message( "exactdn verification request failed: $error_message" );
298
  $this->set_exactdn_option( 'suspended', 1 );
 
 
 
299
  return false;
300
  } elseif ( ! empty( $test_result['body'] ) && strlen( $test_result['body'] ) > 300 ) {
301
  if ( 200 === $test_result['response']['code'] &&
1773
 
1774
  // If a resource doesn't have a version string, we add one to help with cache-busting.
1775
  if ( empty( $parsed_url['query'] ) ) {
1776
+ $modified = ewww_image_optimizer_function_exists( 'filemtime' ) ? filemtime( get_template_directory() ) : '';
1777
+ if ( empty( $modified ) ) {
1778
+ $modified = (int) EWWW_IMAGE_OPTIMIZER_VERSION;
1779
+ }
1780
  /**
1781
  * Allows a custom version string for resources that are missing one.
1782
  *
1783
  * @param string EWWW IO version.
1784
  */
1785
+ $parsed_url['query'] = apply_filters( 'exactdn_version_string', "m=$modified" );
1786
  }
1787
 
1788
  $exactdn_url = '//' . $this->exactdn_domain . '/' . ltrim( $parsed_url['path'], '/' ) . '?' . $parsed_url['query'];
common.php CHANGED
@@ -29,13 +29,12 @@
29
  // TODO: can svg/use tags be exluded from all the things?
30
  // TODO: match Adaptive Images functionality with ExactDN.
31
  // TODO: handle relative urls with ExactDN.
32
- // TODO: escape html responses in the debugging output, particular in the async test.
33
- // TODO: check all instances of json_encode for safety.
34
  if ( ! defined( 'ABSPATH' ) ) {
35
  exit;
36
  }
37
 
38
- define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '422.0' );
39
 
40
  // Initialize a couple globals.
41
  $ewww_debug = '';
@@ -95,6 +94,8 @@ if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_noauto' ) ) {
95
  // Processes a MediaPress image via the metadata after upload.
96
  add_filter( 'mpp_generate_metadata', 'ewww_image_optimizer_resize_from_meta_data', 15, 2 );
97
  }
 
 
98
  // Makes sure the optimizer never optimizes it's own testing images.
99
  add_filter( 'ewww_image_optimizer_bypass', 'ewww_image_optimizer_ignore_self', 10, 2 );
100
  // Adds a column to the media library list view to display optimization results.
@@ -4947,6 +4948,20 @@ function ewww_image_optimizer_autorotate( $file ) {
4947
  ewww_image_optimizer_cloud_autorotate( $file, $type );
4948
  }
4949
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4950
  /**
4951
  * Resizes Media Library uploads based on the maximum dimensions specified by the user.
4952
  *
@@ -7638,6 +7653,9 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
7638
  global $exactdn;
7639
  if ( $exactdn->get_exactdn_domain() && $exactdn->verify_domain( $exactdn->get_exactdn_domain() ) ) {
7640
  $status_output .= '<span style="color: green">' . esc_html__( 'Verified', 'ewww-image-optimizer' ) . ' </span>';
 
 
 
7641
  } elseif ( $exactdn->get_exactdn_domain() && $exactdn->get_exactdn_option( 'verified' ) ) {
7642
  $status_output .= '<span style="color: orange">' . esc_html__( 'Temporarily disabled.', 'ewww-image-optimizer' ) . ' </span>';
7643
  $collapsible = false;
@@ -7649,6 +7667,9 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
7649
  $status_output .= '<span style="color: red"><a href="https://ewww.io/manage-sites/" target="_blank">' . esc_html__( 'Not Verified', 'ewww-image-optimizer' ) . '</a></span>';
7650
  $collapsible = false;
7651
  }
 
 
 
7652
  $status_output .= '</p>';
7653
  } elseif ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) {
7654
  $status_output .= '<p><b>ExactDN:</b> ' . esc_html__( 'Inactive, enable automatic resizing in the Resize Settings', 'ewww-image-optimizer' ) . '</p>';
29
  // TODO: can svg/use tags be exluded from all the things?
30
  // TODO: match Adaptive Images functionality with ExactDN.
31
  // TODO: handle relative urls with ExactDN.
32
+ // TODO: can we fix minify/combine for WP Rocket and WPFC when ExactDN is active?
 
33
  if ( ! defined( 'ABSPATH' ) ) {
34
  exit;
35
  }
36
 
37
+ define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '423.0' );
38
 
39
  // Initialize a couple globals.
40
  $ewww_debug = '';
94
  // Processes a MediaPress image via the metadata after upload.
95
  add_filter( 'mpp_generate_metadata', 'ewww_image_optimizer_resize_from_meta_data', 15, 2 );
96
  }
97
+ // Skips resizing for images with 'noresize' in the filename.
98
+ add_filter( 'ewww_image_optimizer_resize_dimensions', 'ewww_image_optimizer_noresize', 10, 2 );
99
  // Makes sure the optimizer never optimizes it's own testing images.
100
  add_filter( 'ewww_image_optimizer_bypass', 'ewww_image_optimizer_ignore_self', 10, 2 );
101
  // Adds a column to the media library list view to display optimization results.
4948
  ewww_image_optimizer_cloud_autorotate( $file, $type );
4949
  }
4950
 
4951
+ /**
4952
+ * Skips resizing for any image with 'noresize' in the filename.
4953
+ *
4954
+ * @param array $dimensions The configured dimensions for resizing.
4955
+ * @param string $filename The filename of the uploaded image.
4956
+ * @return array The new dimensions for resizing.
4957
+ */
4958
+ function ewww_image_optimizer_noresize( $dimensions, $filename ) {
4959
+ if ( strpos( $filename, 'noresize' ) !== false ) {
4960
+ return array( 0, 0 );
4961
+ }
4962
+ return $dimensions;
4963
+ }
4964
+
4965
  /**
4966
  * Resizes Media Library uploads based on the maximum dimensions specified by the user.
4967
  *
7653
  global $exactdn;
7654
  if ( $exactdn->get_exactdn_domain() && $exactdn->verify_domain( $exactdn->get_exactdn_domain() ) ) {
7655
  $status_output .= '<span style="color: green">' . esc_html__( 'Verified', 'ewww-image-optimizer' ) . ' </span>';
7656
+ if ( defined( 'WP_ROCKET_VERSION' ) ) {
7657
+ $status_output .= '<br><i>' . esc_html__( 'If you use the File Optimization options within WP Rocket, you should also enter your ExactDN CNAME in the WP Rocket CDN settings (reserved for CSS and Javascript):', 'ewww-image-optimizer' ) . ' ' . $exactdn->get_exactdn_domain() . '</i>';
7658
+ }
7659
  } elseif ( $exactdn->get_exactdn_domain() && $exactdn->get_exactdn_option( 'verified' ) ) {
7660
  $status_output .= '<span style="color: orange">' . esc_html__( 'Temporarily disabled.', 'ewww-image-optimizer' ) . ' </span>';
7661
  $collapsible = false;
7667
  $status_output .= '<span style="color: red"><a href="https://ewww.io/manage-sites/" target="_blank">' . esc_html__( 'Not Verified', 'ewww-image-optimizer' ) . '</a></span>';
7668
  $collapsible = false;
7669
  }
7670
+ if ( function_exists( 'remove_query_strings_link' ) || function_exists( 'rmqrst_loader_src' ) || function_exists( 'qsr_remove_query_strings_1' ) ) {
7671
+ $status_output .= '<br><i>' . esc_html__( 'Plugins that remove query strings are unnecessary with ExactDN. You may remove them at your convenience.', 'ewww-image-optimizer' ) . '</i>';
7672
+ }
7673
  $status_output .= '</p>';
7674
  } elseif ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) {
7675
  $status_output .= '<p><b>ExactDN:</b> ' . esc_html__( 'Inactive, enable automatic resizing in the Resize Settings', 'ewww-image-optimizer' ) . '</p>';
ewww-image-optimizer.php CHANGED
@@ -14,7 +14,7 @@ Plugin URI: https://wordpress.org/plugins/ewww-image-optimizer/
14
  Description: Reduce file sizes for images within WordPress including NextGEN Gallery and GRAND FlAGallery. Uses jpegtran, optipng/pngout, and gifsicle.
15
  Author: Shane Bishop
16
  Text Domain: ewww-image-optimizer
17
- Version: 4.2.2
18
  Author URI: https://ewww.io/
19
  License: GPLv3
20
  */
14
  Description: Reduce file sizes for images within WordPress including NextGEN Gallery and GRAND FlAGallery. Uses jpegtran, optipng/pngout, and gifsicle.
15
  Author: Shane Bishop
16
  Text Domain: ewww-image-optimizer
17
+ Version: 4.2.3
18
  Author URI: https://ewww.io/
19
  License: GPLv3
20
  */
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: image, compress, optimize, optimization, lossless, lossy, seo, tinyjpg, ti
5
  Requires at least: 4.6
6
  Tested up to: 4.9
7
  Requires PHP: 5.4
8
- Stable tag: 4.2.2
9
  License: GPLv3
10
 
11
  Speed up your website and improve your visitors' experience by automatically compressing and resizing images and PDFs. Boost SEO and improve sales.
@@ -177,6 +177,12 @@ http://developer.yahoo.com/performance/rules.html#opt_images
177
  * Feature requests can be submitted via https://ewww.io/contact-us/ and commented on here: https://trello.com/b/Fp81dWof/ewww-image-optimizer
178
  * If you would like to help translate this plugin in your language, get started here: https://translate.wordpress.org/projects/wp-plugins/ewww-image-optimizer/
179
 
 
 
 
 
 
 
180
  = 4.2.2 =
181
  * added: view pages with ExactDN or the entire plugin disabled via GET paramaters: ewwwio_disable and exactdn_disable
182
  * changed: moved to v2 quota endpoint for API
@@ -217,45 +223,6 @@ http://developer.yahoo.com/performance/rules.html#opt_images
217
  * fixed: single-site override option displayed when plugin activated per-site
218
  * removed: PHP 5.3 no longer supported
219
 
220
- = 4.1.3 =
221
- * fixed: infinite loop when removing invalid API key
222
- * fixed: img elements with incorrect attachment ID being replaced with wrong image src
223
- * fixed: ExactDN CSS and JS parsing incompatible with Autoptimize
224
-
225
- = 4.1.2 =
226
- * added: detect WP Fastest Cache WebP rewrite rules
227
- * added: notice if WebP conversion enabled but mod_rewrite or mod_headers is missing
228
- * added: better debugging when background/async mode is blocked
229
- * changed: CSS/JS files are filtered pre-emptively by ExactDN to avoid quirks with emoji scripts
230
- * fixed: warning during wp_cron for undefined constant
231
- * fixed: invalid or expired keys would still attempt optimization
232
- * fixed: WebP files are orphaned when using Media File Renamer
233
- * deprecated: PHP 5.3 will no longer be supported in 4.2
234
- * deprecated: PHP 5.4 support will be removed by July 2018
235
- * deprecated: PHP 5.5 support will be removed by October 2018
236
-
237
- = 4.1.1 =
238
- * added: reduce ExactDN load time by suppressing db queries with EXACTDN_PREVENT_DB_QUERIES
239
- * added: $fullsize indicator added to pre/post optimization hooks, props Schweinepriester
240
- * fixed: missing www preventing rewrites for ExactDN
241
- * fixed: Alt WebP compatibility with Tatsu page builder
242
- * fixed: relative path support not working properly for Pantheon users
243
- * fixed: missing directories prevent optimization of S3 files
244
-
245
- = 4.1.0 =
246
- * SECURITY: gifsicle and optipng have been updated to address security flaws
247
- * added: full compatibility with Image Watermark plugin
248
- * added: dummy images for Essential Grid and Layer Slider whitelisted with ExactDN
249
- * added: compatibility with Visual Composer and Essential Grid async/AJAX loaders
250
- * added: compatibility with Media File Renamer
251
- * changed: ExactDN rewrites all wp-content and wp-includes urls by default
252
- * changed: mime-type detection function does not rely on fileinfo extension anymore
253
- * changed: Solaris/SunOS binary builds use OpenIndiana 2017.10, let me know if they break
254
- * fixed: wp-emoji script not rewritten by EXACTDN_ALL_THE_THINGS
255
- * fixed: resize detection script throws error when admin bar is hidden
256
- * fixed: warnings when WP Offload S3 set to delete local files, props ianmjones
257
- * updated: pngquant version 2.11.7
258
-
259
  = Earlier versions =
260
  Please refer to the separate changelog.txt file.
261
 
5
  Requires at least: 4.6
6
  Tested up to: 4.9
7
  Requires PHP: 5.4
8
+ Stable tag: 4.2.3
9
  License: GPLv3
10
 
11
  Speed up your website and improve your visitors' experience by automatically compressing and resizing images and PDFs. Boost SEO and improve sales.
177
  * Feature requests can be submitted via https://ewww.io/contact-us/ and commented on here: https://trello.com/b/Fp81dWof/ewww-image-optimizer
178
  * If you would like to help translate this plugin in your language, get started here: https://translate.wordpress.org/projects/wp-plugins/ewww-image-optimizer/
179
 
180
+ = 4.2.3 =
181
+ * added: skip resizing for images with noresize in the filename
182
+ * added: notice about plugins that remove query strings when ExactDN is active
183
+ * changed: cache busting for ExactDN uses theme directory modified time with fallback to EWWW IO version
184
+ * fixed: exactdn test verification attempts to access WP_Error as an array
185
+
186
  = 4.2.2 =
187
  * added: view pages with ExactDN or the entire plugin disabled via GET paramaters: ewwwio_disable and exactdn_disable
188
  * changed: moved to v2 quota endpoint for API
223
  * fixed: single-site override option displayed when plugin activated per-site
224
  * removed: PHP 5.3 no longer supported
225
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  = Earlier versions =
227
  Please refer to the separate changelog.txt file.
228