Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ExactDN fix for duplicate srcset
  • Loading branch information
nosilver4u committed Dec 6, 2018
1 parent 39c64eb commit 088d398
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions changelog.txt
@@ -1,3 +1,7 @@
= 4.5.3 =
* fixed: ExactDN duplicates srcset instead of replacing it
* security: remote code execution, low exposure

= 4.5.2 =
* added: automatic migration to move image paths from absolute to relative
* changed: default quality for PNG to JPG did not match WordPress default
Expand Down
4 changes: 2 additions & 2 deletions classes/class-exactdn.php
Expand Up @@ -926,7 +926,7 @@ function filter_the_content( $content ) {
$new_srcset_attr = $this->get_attribute( $new_tag, $this->srcset_attr );
if ( $new_srcset_attr && false === strpos( $new_srcset_attr, ' ' . (int) $width . 'w' ) ) {
ewwwio_debug_message( 'src not in srcset, adding' );
$this->set_attribute( $new_tag, $this->srcset_attr, $srcset_url . $new_srcset_attr );
$this->set_attribute( $new_tag, $this->srcset_attr, $srcset_url . $new_srcset_attr, true );
}
}

Expand Down Expand Up @@ -968,7 +968,7 @@ function filter_the_content( $content ) {
$new_srcset_attr = $this->get_attribute( $new_tag, $this->srcset_attr );
if ( $new_srcset_attr && false === strpos( $new_srcset_attr, ' ' . (int) $width . 'w' ) ) {
ewwwio_debug_message( 'src not in srcset, adding' );
$this->set_attribute( $new_tag, $this->srcset_attr, $srcset_url . $new_srcset_attr );
$this->set_attribute( $new_tag, $this->srcset_attr, $srcset_url . $new_srcset_attr, true );
// Replace original tag with modified version.
$content = str_replace( $tag, $new_tag, $content );
}
Expand Down
3 changes: 2 additions & 1 deletion common.php
Expand Up @@ -19,11 +19,12 @@
// TODO: use this: https://codex.wordpress.org/AJAX_in_Plugins#The_post-load_JavaScript_Event .
// TODO: can some of the bulk "fallbacks" be implemented for async processing?
// TODO: check to see if we can use PHP and WP core is_iterable and is_countable functions.
// TODO: ExactDN can use data-id attribute in 5.0 instead of trying to grok wp-image-1234 in the class.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}

define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '452.0' );
define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '453.0' );

// Initialize a couple globals.
$ewww_debug = '';
Expand Down
2 changes: 1 addition & 1 deletion ewww-image-optimizer.php
Expand Up @@ -14,7 +14,7 @@
Description: Reduce file sizes for images within WordPress including NextGEN Gallery and GRAND FlAGallery. Uses jpegtran, optipng/pngout, and gifsicle.
Author: Exactly WWW
Text Domain: ewww-image-optimizer
Version: 4.5.2
Version: 4.5.3
Author URI: https://ewww.io/
License: GPLv3
*/
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Expand Up @@ -5,7 +5,7 @@ Tags: image, compress, resize, optimize, optimization, lossless, lossy, seo, web
Requires at least: 4.9
Tested up to: 5.0
Requires PHP: 5.6
Stable tag: 4.5.2
Stable tag: 4.5.3
License: GPLv3

Speed up your website and improve your visitors' experience by automatically compressing and resizing images and PDFs. Boost SEO and improve sales.
Expand Down Expand Up @@ -174,6 +174,10 @@ http://developer.yahoo.com/performance/rules.html#opt_images
* Feature requests can be viewed and submitted at https://github.com/nosilver4u/ewww-image-optimizer/labels/enhancement
* 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/

= 4.5.3 =
* fixed: ExactDN duplicates srcset instead of replacing it
* security: remote code execution, low exposure

= 4.5.2 =
* added: automatic migration to move image paths from absolute to relative
* changed: default quality for PNG to JPG did not match WordPress default
Expand Down
2 changes: 1 addition & 1 deletion unique.php
Expand Up @@ -2471,7 +2471,7 @@ function ewww_image_optimizer( $file, $gallery_type = 4, $converted = false, $ne
if ( $optimize ) {
$tempfile = $file . '.tmp'; // temporary GIF output.
// Run gifsicle on the GIF.
exec( "$nice " . $tools['GIFSICLE'] . " -O3 --careful -o $tempfile " . ewww_image_optimizer_escapeshellarg( $file ) );
exec( "$nice " . $tools['GIFSICLE'] . ' -O3 --careful -o ' . ewww_image_optimizer_escapeshellarg( $tempfile ) . ' ' . ewww_image_optimizer_escapeshellarg( $file ) );
// Retrieve the filesize of the temporary GIF.
$new_size = ewww_image_optimizer_filesize( $tempfile );
// If the new GIF is smaller.
Expand Down

0 comments on commit 088d398

Please sign in to comment.