EWWW Image Optimizer - Version 6.1.9

Version Description

  • fixed: Easy IO's Include All Resources compat with Oxygen Builder and Beaver Builder
  • fixed: regex to detect SVG images in use elements caused excessive backtracking
  • fixed: WebP version of full-size image not removed when attachment deleted due to undefined variable
  • fixed: Easy IO adds invalid zoom parameter of 1920 to srcset URL
Download this release

Release Info

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

Code changes from version 6.1.8 to 6.1.9

aux-optimize.php CHANGED
@@ -205,7 +205,7 @@ function ewww_image_optimizer_aux_images_table() {
205
  }
206
  $output['table'] .= '</td>';
207
  $output['table'] .= "<td>$type</td>";
208
- $output['table'] .= "<td>$last_updated</td>";
209
  $output['table'] .= "<td>$savings<br>$size_string<br>" .
210
  '<a class="ewww-remove-image" data-id="' . (int) $optimized_image['id'] . '">' . esc_html__( 'Remove from history', 'ewww-image-optimizer' ) . '</a>' .
211
  ( $optimized_image['backup'] ? '<br><a class="ewww-restore-image" data-id="' . (int) $optimized_image['id'] . '">' . esc_html__( 'Restore original', 'ewww-image-optimizer' ) . '</a>' : '' ) .
@@ -244,6 +244,7 @@ function ewww_image_optimizer_aux_images_table() {
244
  $output['table'] .= '</td>';
245
  $output['table'] .= "<td>$type</td>";
246
  $output['table'] .= "<td>$last_updated</td>";
 
247
  // Determine filepath for webp.
248
  $webpfile = $file . '.webp';
249
  $webp_size = ewww_image_optimizer_filesize( $webpfile );
@@ -297,6 +298,7 @@ function ewww_image_optimizer_aux_images_table() {
297
  $output['table'] .= '</td>';
298
  $output['table'] .= "<td>$type</td>";
299
  $output['table'] .= "<td>$last_updated</td>";
 
300
  $output['table'] .= "<td>$savings<br>$size_string<br>" .
301
  '<a class="ewww-remove-image" data-id="' . (int) $optimized_image['id'] . '">' . esc_html__( 'Remove from history', 'ewww-image-optimizer' ) . '</a>' .
302
  '</td>';
205
  }
206
  $output['table'] .= '</td>';
207
  $output['table'] .= "<td>$type</td>";
208
+ $output['table'] .= "<td>$last_updated ({$optimized_image['updated']})</td>";
209
  $output['table'] .= "<td>$savings<br>$size_string<br>" .
210
  '<a class="ewww-remove-image" data-id="' . (int) $optimized_image['id'] . '">' . esc_html__( 'Remove from history', 'ewww-image-optimizer' ) . '</a>' .
211
  ( $optimized_image['backup'] ? '<br><a class="ewww-restore-image" data-id="' . (int) $optimized_image['id'] . '">' . esc_html__( 'Restore original', 'ewww-image-optimizer' ) . '</a>' : '' ) .
244
  $output['table'] .= '</td>';
245
  $output['table'] .= "<td>$type</td>";
246
  $output['table'] .= "<td>$last_updated</td>";
247
+ $output['table'] .= "<td>$last_updated ({$optimized_image['updated']})</td>";
248
  // Determine filepath for webp.
249
  $webpfile = $file . '.webp';
250
  $webp_size = ewww_image_optimizer_filesize( $webpfile );
298
  $output['table'] .= '</td>';
299
  $output['table'] .= "<td>$type</td>";
300
  $output['table'] .= "<td>$last_updated</td>";
301
+ $output['table'] .= "<td>$last_updated ({$optimized_image['updated']})</td>";
302
  $output['table'] .= "<td>$savings<br>$size_string<br>" .
303
  '<a class="ewww-remove-image" data-id="' . (int) $optimized_image['id'] . '">' . esc_html__( 'Remove from history', 'ewww-image-optimizer' ) . '</a>' .
304
  '</td>';
changelog.txt CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  = 6.1.8 =
2
  * fixed: Lazy Load fails to auto-scale with img-crop class for Easy IO
3
  * fixed: WebP files sometimes fail to be re-generated after Photo Engine (WP/LR) sync
1
+ = 6.1.9 =
2
+ * fixed: Easy IO's Include All Resources compat with Oxygen Builder and Beaver Builder
3
+ * fixed: regex to detect SVG images in use elements caused excessive backtracking
4
+ * fixed: WebP version of full-size image not removed when attachment deleted due to undefined variable
5
+ * fixed: Easy IO adds invalid zoom parameter of 1920 to srcset URL
6
+
7
  = 6.1.8 =
8
  * fixed: Lazy Load fails to auto-scale with img-crop class for Easy IO
9
  * fixed: WebP files sometimes fail to be re-generated after Photo Engine (WP/LR) sync
classes/class-eio-page-parser.php CHANGED
@@ -57,7 +57,7 @@ if ( ! class_exists( 'EIO_Page_Parser' ) ) {
57
  } elseif ( $src_required ) {
58
  $this->debug_message( 'using plain img pattern, src still required' );
59
  $search_pattern = '#(?P<img_tag><img[^>]*?\s+?src\s*=\s*("|\')(?P<img_url>(?!\2).+?)\2[^>]*?>)#is';
60
- $unquoted_pattern = '#(?P<img_tag><img[^>]*?\s+?src\s*=\s*(?P<img_url>[^"\'\\\\][^\s>]+)[^>]*?>)#is';
61
  }
62
  if ( preg_match_all( $search_pattern, $content, $images ) ) {
63
  $this->debug_message( 'found ' . count( $images[0] ) . ' image elements with quoted pattern' );
57
  } elseif ( $src_required ) {
58
  $this->debug_message( 'using plain img pattern, src still required' );
59
  $search_pattern = '#(?P<img_tag><img[^>]*?\s+?src\s*=\s*("|\')(?P<img_url>(?!\2).+?)\2[^>]*?>)#is';
60
+ $unquoted_pattern = '#(?P<img_tag><img[^>]*?\s+?src\s*=\s*(?P<img_url>[^"\'\\\\<>][^\s<>]+)[^>]*?>)#is';
61
  }
62
  if ( preg_match_all( $search_pattern, $content, $images ) ) {
63
  $this->debug_message( 'found ' . count( $images[0] ) . ' image elements with quoted pattern' );
classes/class-ewwwio-imagick-editor.php CHANGED
@@ -211,7 +211,7 @@ if ( class_exists( 'WP_Thumb_Image_Editor_Imagick' ) ) {
211
  * @return true|WP_Error
212
  */
213
  public function resize( $max_w, $max_h, $crop = false ) {
214
- ewwwio_debug_message( '<b>wp_image_editor_gd::' . __FUNCTION__ . '()</b>' );
215
  if ( (int) $this->size['width'] === (int) $max_w && (int) $this->size['height'] === (int) $max_h ) {
216
  return true;
217
  }
@@ -256,7 +256,7 @@ if ( class_exists( 'WP_Thumb_Image_Editor_Imagick' ) ) {
256
  * @return bool|WP_Error
257
  */
258
  protected function _resize( $dims, $crop ) {
259
- ewwwio_debug_message( '<b>wp_image_editor_gd::' . __FUNCTION__ . '()</b>' );
260
  list( $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h ) = $dims;
261
  if ( defined( 'EWWWIO_EDITOR_AGR' ) && ! EWWWIO_EDITOR_AGR ) {
262
  ewwwio_debug_message( 'AGR disabled' );
@@ -300,7 +300,7 @@ if ( class_exists( 'WP_Thumb_Image_Editor_Imagick' ) ) {
300
  }
301
  // TODO: Possibly handle crop, rotate, and flip down the road.
302
  if ( ! empty( $this->modified ) ) {
303
- ewwwio_debug_message( 'GIF already altered, leave it alone' );
304
  $return_parent = true;
305
  }
306
  if ( ! $this->file || ewww_image_optimizer_stream_wrapped( $this->file ) || 0 === strpos( $this->file, 'http' ) || 0 === strpos( $this->file, 'ftp' ) || ! ewwwio_is_file( $this->file ) ) {
211
  * @return true|WP_Error
212
  */
213
  public function resize( $max_w, $max_h, $crop = false ) {
214
+ ewwwio_debug_message( '<b>wp_image_editor_imagick::' . __FUNCTION__ . '()</b>' );
215
  if ( (int) $this->size['width'] === (int) $max_w && (int) $this->size['height'] === (int) $max_h ) {
216
  return true;
217
  }
256
  * @return bool|WP_Error
257
  */
258
  protected function _resize( $dims, $crop ) {
259
+ ewwwio_debug_message( '<b>wp_image_editor_imagick::' . __FUNCTION__ . '()</b>' );
260
  list( $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h ) = $dims;
261
  if ( defined( 'EWWWIO_EDITOR_AGR' ) && ! EWWWIO_EDITOR_AGR ) {
262
  ewwwio_debug_message( 'AGR disabled' );
300
  }
301
  // TODO: Possibly handle crop, rotate, and flip down the road.
302
  if ( ! empty( $this->modified ) ) {
303
+ ewwwio_debug_message( 'image already altered, leave it alone' );
304
  $return_parent = true;
305
  }
306
  if ( ! $this->file || ewww_image_optimizer_stream_wrapped( $this->file ) || 0 === strpos( $this->file, 'http' ) || 0 === strpos( $this->file, 'ftp' ) || ! ewwwio_is_file( $this->file ) ) {
classes/class-exactdn.php CHANGED
@@ -145,6 +145,9 @@ if ( ! class_exists( 'ExactDN' ) ) {
145
  if ( '/robots.txt' === $uri || '/sitemap.xml' === $uri ) {
146
  return;
147
  }
 
 
 
148
  /**
149
  * Allow pre-empting the parsers by page.
150
  *
@@ -1514,7 +1517,8 @@ if ( ! class_exists( 'ExactDN' ) ) {
1514
  }
1515
  if ( strpos( $content, '<use ' ) ) {
1516
  // Pre-empt rewriting of files within <use> tags, particularly to prevent security errors for SVGs.
1517
- $content = preg_replace( '#(<use.+?href=["\'])(https?:)?//(?:www\.)?' . $escaped_upload_domain . '([^"\'?>]+?)/' . $this->content_path . '/#is', '$1$2//' . $this->upload_domain . '$3/?wpcontent-bypass?/', $content );
 
1518
  }
1519
  // Pre-empt rewriting of wp-includes and wp-content if the extension is not allowed by using a temporary placeholder.
1520
  $content = preg_replace( '#(https?:)?//(?:www\.)?' . $escaped_upload_domain . '([^"\'?>]+?)?/' . $this->content_path . '/([^"\'?>]+?)\.(htm|html|php|ashx|m4v|mov|wvm|qt|webm|ogv|mp4|m4p|mpg|mpeg|mpv)#i', '$1//' . $this->upload_domain . '$2/?wpcontent-bypass?/$3.$4', $content );
@@ -2052,7 +2056,7 @@ if ( ! class_exists( 'ExactDN' ) ) {
2052
  $newwidth = intval( $base * $multiplier );
2053
  if ( 1920 === (int) $multiplier ) {
2054
  $newwidth = 1920;
2055
- if ( ! $w_descriptor ) {
2056
  continue;
2057
  }
2058
  }
@@ -2180,6 +2184,9 @@ if ( ! class_exists( 'ExactDN' ) ) {
2180
  foreach ( $multipliers as $multiplier ) {
2181
  $newwidth = intval( $width * $multiplier );
2182
  if ( 1920 === (int) $multiplier ) {
 
 
 
2183
  $newwidth = 1920;
2184
  }
2185
  if ( $newwidth < 50 ) {
@@ -2197,7 +2204,7 @@ if ( ! class_exists( 'ExactDN' ) ) {
2197
 
2198
  if ( 1 === $multiplier ) {
2199
  $args = array();
2200
- } elseif ( $zoom ) {
2201
  $args = array(
2202
  'zoom' => $multiplier,
2203
  );
@@ -2641,6 +2648,25 @@ if ( ! class_exists( 'ExactDN' ) ) {
2641
  return $args;
2642
  }
2643
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2644
  /**
2645
  * Exclude images and other resources from being processed based on user specified list.
2646
  *
145
  if ( '/robots.txt' === $uri || '/sitemap.xml' === $uri ) {
146
  return;
147
  }
148
+
149
+ add_filter( 'exactdn_skip_page', array( $this, 'skip_page' ), 10, 2 );
150
+
151
  /**
152
  * Allow pre-empting the parsers by page.
153
  *
1517
  }
1518
  if ( strpos( $content, '<use ' ) ) {
1519
  // Pre-empt rewriting of files within <use> tags, particularly to prevent security errors for SVGs.
1520
+ $this->debug_message( 'searching for use tags: #(<use.+?href=["\'])(https?:)?//(?:www\.)?' . $escaped_upload_domain . '([^"\'?>]+?)/' . $this->content_path . '/#is' );
1521
+ $content = preg_replace( '#(<use\s+?(?>xlink:)?href=["\'])(https?:)?//(?>www\.)?' . $escaped_upload_domain . '([^"\'?>]+?)?/' . $this->content_path . '/#is', '$1$2//' . $this->upload_domain . '$3/?wpcontent-bypass?/', $content );
1522
  }
1523
  // Pre-empt rewriting of wp-includes and wp-content if the extension is not allowed by using a temporary placeholder.
1524
  $content = preg_replace( '#(https?:)?//(?:www\.)?' . $escaped_upload_domain . '([^"\'?>]+?)?/' . $this->content_path . '/([^"\'?>]+?)\.(htm|html|php|ashx|m4v|mov|wvm|qt|webm|ogv|mp4|m4p|mpg|mpeg|mpv)#i', '$1//' . $this->upload_domain . '$2/?wpcontent-bypass?/$3.$4', $content );
2056
  $newwidth = intval( $base * $multiplier );
2057
  if ( 1920 === (int) $multiplier ) {
2058
  $newwidth = 1920;
2059
+ if ( ! $w_descriptor || 1920 >= $reqwidth || 'soft' !== $crop ) {
2060
  continue;
2061
  }
2062
  }
2184
  foreach ( $multipliers as $multiplier ) {
2185
  $newwidth = intval( $width * $multiplier );
2186
  if ( 1920 === (int) $multiplier ) {
2187
+ if ( $multiplier >= $width ) {
2188
+ continue;
2189
+ }
2190
  $newwidth = 1920;
2191
  }
2192
  if ( $newwidth < 50 ) {
2204
 
2205
  if ( 1 === $multiplier ) {
2206
  $args = array();
2207
+ } elseif ( $zoom && $multiplier <= 10 ) {
2208
  $args = array(
2209
  'zoom' => $multiplier,
2210
  );
2648
  return $args;
2649
  }
2650
 
2651
+ /**
2652
+ * Exclude pages from being processed for things like page builders.
2653
+ *
2654
+ * @since 6.1.9
2655
+ *
2656
+ * @param boolean $skip Whether ExactDN should skip processing.
2657
+ * @param string $uri The URI of the page (no domain or scheme included).
2658
+ * @return boolean True to skip the page, unchanged otherwise.
2659
+ */
2660
+ function skip_page( $skip = false, $uri = '' ) {
2661
+ if ( false !== strpos( $uri, 'ct_builder=' ) ) {
2662
+ return true;
2663
+ }
2664
+ if ( false !== strpos( $uri, '?fl_builder' ) ) {
2665
+ return true;
2666
+ }
2667
+ return $skip;
2668
+ }
2669
+
2670
  /**
2671
  * Exclude images and other resources from being processed based on user specified list.
2672
  *
common.php CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  exit;
15
  }
16
 
17
- define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '618.0' );
18
 
19
  // Initialize a couple globals.
20
  $eio_debug = '';
@@ -4122,7 +4122,7 @@ function ewww_image_optimizer_delete( $id ) {
4122
  }
4123
  if ( ewwwio_is_file( $file_path . '.webp' ) ) {
4124
  ewwwio_debug_message( 'removing: ' . $file_path . '.webp' );
4125
- ewwwio_delete_file( $image['path'] . '.webp' );
4126
  }
4127
  $webpfileold = preg_replace( '/\.\w+$/', '.webp', $file_path );
4128
  if ( ewwwio_is_file( $webpfileold ) ) {
@@ -13070,9 +13070,6 @@ AddType image/webp .webp</pre>
13070
  <a href='http://shareasale.com/r.cfm?b=917225&amp;u=1481701&amp;m=41388&amp;urllink=&amp;afftrack='>WP Engine</a>* -
13071
  <?php esc_html_e( 'ewww.io is powered by WP Engine, and their performance is worth every penny. This is "managed WordPress hosting" at it\'s finest. 20% discount off your first payment with our link.', 'ewww-image-optimizer' ); ?>
13072
  <br>
13073
- <a href="https://kinsta.com?kaid=OCKKBJARSDFR">Kinsta</a>* -
13074
- <?php esc_html_e( 'Their performance is the same blazing speed as WP Engine, and the support is top notch as well. Very solid offering and highly recommended.', 'ewww-image-optimizer' ); ?>
13075
- <br>
13076
  <a href="https://www.cloudways.com/en/?id=48939">Cloudways</a>* -
13077
  <?php esc_html_e( 'Simple, yet powerful, managed VPS hosting. I use their hosting for a few client sites and performance is crazy fast. Support has been great any time I\'ve needed their assistance.', 'ewww-image-optimizer' ); ?>
13078
  </p>
14
  exit;
15
  }
16
 
17
+ define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '619.0' );
18
 
19
  // Initialize a couple globals.
20
  $eio_debug = '';
4122
  }
4123
  if ( ewwwio_is_file( $file_path . '.webp' ) ) {
4124
  ewwwio_debug_message( 'removing: ' . $file_path . '.webp' );
4125
+ ewwwio_delete_file( $file_path . '.webp' );
4126
  }
4127
  $webpfileold = preg_replace( '/\.\w+$/', '.webp', $file_path );
4128
  if ( ewwwio_is_file( $webpfileold ) ) {
13070
  <a href='http://shareasale.com/r.cfm?b=917225&amp;u=1481701&amp;m=41388&amp;urllink=&amp;afftrack='>WP Engine</a>* -
13071
  <?php esc_html_e( 'ewww.io is powered by WP Engine, and their performance is worth every penny. This is "managed WordPress hosting" at it\'s finest. 20% discount off your first payment with our link.', 'ewww-image-optimizer' ); ?>
13072
  <br>
 
 
 
13073
  <a href="https://www.cloudways.com/en/?id=48939">Cloudways</a>* -
13074
  <?php esc_html_e( 'Simple, yet powerful, managed VPS hosting. I use their hosting for a few client sites and performance is crazy fast. Support has been great any time I\'ve needed their assistance.', 'ewww-image-optimizer' ); ?>
13075
  </p>
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: Reduce file sizes for images within WordPress including NextGEN Gallery and GRAND FlAGallery. Uses jpegtran, optipng/pngout, and gifsicle.
15
  Author: Exactly WWW
16
- Version: 6.1.8
17
  Author URI: https://ewww.io/
18
  License: GPLv3
19
  */
13
  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: Exactly WWW
16
+ Version: 6.1.9
17
  Author URI: https://ewww.io/
18
  License: GPLv3
19
  */
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: optimize, image, convert, webp, resize, compress, lazy load, optimization,
5
  Requires at least: 5.4
6
  Tested up to: 5.7
7
  Requires PHP: 7.1
8
- Stable tag: 6.1.8
9
  License: GPLv3
10
 
11
  Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
@@ -132,6 +132,12 @@ That's not a question, but since I made it up, I'll answer it. See this resource
132
  * Feature requests can be viewed and submitted on our [feedback portal](https://feedback.ewww.io/b/features)
133
  * 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/)
134
 
 
 
 
 
 
 
135
  = 6.1.8 =
136
  * fixed: Lazy Load fails to auto-scale with img-crop class for Easy IO
137
  * fixed: WebP files sometimes fail to be re-generated after Photo Engine (WP/LR) sync
5
  Requires at least: 5.4
6
  Tested up to: 5.7
7
  Requires PHP: 7.1
8
+ Stable tag: 6.1.9
9
  License: GPLv3
10
 
11
  Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
132
  * Feature requests can be viewed and submitted on our [feedback portal](https://feedback.ewww.io/b/features)
133
  * 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/)
134
 
135
+ = 6.1.9 =
136
+ * fixed: Easy IO's Include All Resources compat with Oxygen Builder and Beaver Builder
137
+ * fixed: regex to detect SVG images in use elements caused excessive backtracking
138
+ * fixed: WebP version of full-size image not removed when attachment deleted due to undefined variable
139
+ * fixed: Easy IO adds invalid zoom parameter of 1920 to srcset URL
140
+
141
  = 6.1.8 =
142
  * fixed: Lazy Load fails to auto-scale with img-crop class for Easy IO
143
  * fixed: WebP files sometimes fail to be re-generated after Photo Engine (WP/LR) sync