diff --git a/aux-optimize.php b/aux-optimize.php index 599d34b3..3ea4a0ed 100644 --- a/aux-optimize.php +++ b/aux-optimize.php @@ -149,7 +149,7 @@ function ewww_image_optimizer_aux_images_table() {
" . esc_html__( 'The optimization history prevents the plugin from re-optimizing images, but you may erase the history to reduce database size or to force the plugin to re-optimize all images.', 'ewww-image-optimizer' ) . "
\n"; + echo '" . + esc_html__( 'The optimization history prevents the plugin from re-optimizing images, but you may erase the history to reduce database size or to force the plugin to re-optimize all images.', 'ewww-image-optimizer' ); + echo "
\n"; echo "\n' . esc_html__( 'Restoring', 'ewww-image-optimizer' ) . "
", + 'erase_warning' => $erase_warning, ) ); // Load the stylesheet for the jquery progressbar. diff --git a/changelog.txt b/changelog.txt index aa8541c3..d822f86a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,15 @@ += 5.0.0 = +* added: use native lazy load attributes to supplement lazy loader and make placeholders more efficient +* added: GCS sub-folder rewriting with ExactDN for cleaner URLs +* added: option to optimize original versions of scaled images for WP 5.3 +* added: ability to erase optimization history from Tools page +* changed: define EWWWIO_WPLR_AUTO (any value) to enable auto-optimize on images from WP/LR Sync +* changed: thumbnails could be converted even if original was not +* changed: Show Optimized Images table moved to Tools menu +* fixed: full-size image optimization not deferred if scaled by WP 5.3 +* fixed: data-width and data-height attributes missing when JS WebP active +* security: rewrote escapeshellarg() wrapper to be more secure + = 4.9.3 = * fixed: ExactDN incorrectly scales Elementor background images rather than cropping * fixed: ExactDN cannot work with Divi/Elementor background images due to use of external CSS files diff --git a/common.php b/common.php index 8b37e630..7871ccd9 100644 --- a/common.php +++ b/common.php @@ -22,7 +22,7 @@ exit; } -define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '493.3' ); +define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '500.0' ); // Initialize a couple globals. $eio_debug = ''; @@ -8417,6 +8417,9 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) { '' . esc_html__( 'Savings', 'ewww-image-optimizer' ) . '
'; + if ( 'network-multisite' !== $network ) { + $status_output .= '' . esc_html__( 'View optimized images.', 'ewww-image-optimizer' ) . '
'; + } $status_output .= ''; } ewwwio_debug_message( ewww_image_optimizer_aux_images_table_count() . ' images have been optimized' ); diff --git a/ewww-image-optimizer.php b/ewww-image-optimizer.php index 3023661e..8a76f15b 100644 --- a/ewww-image-optimizer.php +++ b/ewww-image-optimizer.php @@ -13,7 +13,7 @@ Plugin URI: https://wordpress.org/plugins/ewww-image-optimizer/ Description: Reduce file sizes for images within WordPress including NextGEN Gallery and GRAND FlAGallery. Uses jpegtran, optipng/pngout, and gifsicle. Author: Exactly WWW -Version: 4.9.3 +Version: 5.0.0 Author URI: https://ewww.io/ License: GPLv3 */ diff --git a/includes/eio-tools.js b/includes/eio-tools.js index 90343d83..aa63e9f7 100644 --- a/includes/eio-tools.js +++ b/includes/eio-tools.js @@ -110,12 +110,14 @@ jQuery(document).ready(function($) { action: 'bulk_aux_images_table_clear', ewww_wpnonce: ewww_vars._wpnonce, }; - $.post(ajaxurl, ewww_table_data, function(response) { - $('#ewww-table-info').hide(); - $('#ewww-show-table').hide(); - $('#ewww-clear-table').hide(); - $('#ewww-clear-table-info').html(response); - }); + if (confirm(ewww_vars.erase_warning)) { + $.post(ajaxurl, ewww_table_data, function(response) { + $('#ewww-table-info').hide(); + $('#ewww-show-table').hide(); + $('#ewww-clear-table').hide(); + $('#ewww-clear-table-info').html(response); + }); + } return false; }); }); diff --git a/includes/eio.js b/includes/eio.js index b54ef5ef..e76956b4 100644 --- a/includes/eio.js +++ b/includes/eio.js @@ -234,284 +234,180 @@ jQuery(document).ready(function($) { }); return false; } else { - $(function() { - $("#ewww-delay-slider").slider({ - min: 0, - max: 30, - value: $("#ewww-delay").val(), - slide: function(event, ui) { - $("#ewww-delay").val(ui.value); - } + $(function() { + $("#ewww-delay-slider").slider({ + min: 0, + max: 30, + value: $("#ewww-delay").val(), + slide: function(event, ui) { + $("#ewww-delay").val(ui.value); + } + }); }); - }); - var ewwwdelayinput = document.getElementById("ewww-delay"); - ewwwdelayinput.onblur = function() { - if (isNaN(this.value)) { - this.value = 0; + var ewwwdelayinput = document.getElementById("ewww-delay"); + ewwwdelayinput.onblur = function() { + if (isNaN(this.value)) { + this.value = 0; + } else { + this.value = Math.ceil(this.value); + } + }; + var ewww_attachments = ewww_vars.attachments; + var ewww_i = 0; + var ewww_k = 0; + var ewww_import_total = 0; + var ewww_force = 0; + var ewww_delay = 0; + var ewww_batch_limit = 0; + var ewww_aux = false; + var ewww_main = false; + var ewww_quota_update = 0; + var ewww_scan_failures = 0; + var ewww_bulk_start_time = 0; + var ewww_bulk_elapsed_time = 0; + var ewww_time_per_image = 0; + var ewww_time_remaining = 0; + var ewww_days_remaining = 0; + var ewww_hours_remaining = 0; + var ewww_minutes_remaining = 0; + var ewww_seconds_remaining = 0; + var ewww_countdown = false; + var ewww_tiny_skip = ''; + // initialize the ajax actions for the appropriate bulk page + var ewww_quota_update_data = { + action: 'bulk_quota_update', + ewww_wpnonce: ewww_vars._wpnonce, + }; + if (ewww_vars.gallery == 'flag') { + var ewww_init_action = 'bulk_flag_init'; + var ewww_loop_action = 'bulk_flag_loop'; + var ewww_cleanup_action = 'bulk_flag_cleanup'; + } else if (ewww_vars.gallery == 'nextgen') { + var ewww_preview_action = 'bulk_ngg_preview'; + var ewww_init_action = 'bulk_ngg_init'; + var ewww_loop_action = 'bulk_ngg_loop'; + var ewww_cleanup_action = 'bulk_ngg_cleanup'; } else { - this.value = Math.ceil(this.value); - } - }; - var ewww_attachments = ewww_vars.attachments; - var ewww_i = 0; - var ewww_k = 0; - var ewww_import_total = 0; - var ewww_force = 0; - var ewww_delay = 0; - var ewww_batch_limit = 0; - var ewww_aux = false; - var ewww_main = false; - var ewww_quota_update = 0; - var ewww_scan_failures = 0; - var ewww_bulk_start_time = 0; - var ewww_bulk_elapsed_time = 0; - var ewww_time_per_image = 0; - var ewww_time_remaining = 0; - var ewww_days_remaining = 0; - var ewww_hours_remaining = 0; - var ewww_minutes_remaining = 0; - var ewww_seconds_remaining = 0; - var ewww_countdown = false; - var ewww_tiny_skip = ''; - // initialize the ajax actions for the appropriate bulk page - var ewww_quota_update_data = { - action: 'bulk_quota_update', - ewww_wpnonce: ewww_vars._wpnonce, - }; - if (ewww_vars.gallery == 'flag') { - var ewww_init_action = 'bulk_flag_init'; - var ewww_loop_action = 'bulk_flag_loop'; - var ewww_cleanup_action = 'bulk_flag_cleanup'; - } else if (ewww_vars.gallery == 'nextgen') { - var ewww_preview_action = 'bulk_ngg_preview'; - var ewww_init_action = 'bulk_ngg_init'; - var ewww_loop_action = 'bulk_ngg_loop'; - var ewww_cleanup_action = 'bulk_ngg_cleanup'; - } else { - var ewww_scan_action = 'bulk_scan'; - var ewww_init_action = 'bulk_init'; - var ewww_loop_action = 'bulk_loop'; - var ewww_cleanup_action = 'bulk_cleanup'; - ewww_main = true; - } - var ewww_init_data = { - action: ewww_init_action, - ewww_wpnonce: ewww_vars._wpnonce, - }; - var ewww_table_action = 'bulk_aux_images_table'; - var ewww_table_count_action = 'bulk_aux_images_table_count'; - var ewww_import_init_action = 'bulk_import_init'; - var ewww_import_loop_action = 'bulk_import_loop'; - $(document).on('click', '.ewww-show-debug-meta', function() { - var post_id = $(this).data('id'); - $('.ewww-debug-meta-' + post_id).toggle(); - }); - $('#ewww-aux-start').submit(function() { - ewww_aux = true; - //ewww_init_action = 'bulk_init'; - //ewww_loop_action = 'bulk_aux_images_loop'; - //ewww_cleanup_action = 'bulk_aux_images_cleanup'; - if ($('#ewww-force:checkbox:checked').val()) { - ewww_force = 1; + var ewww_scan_action = 'bulk_scan'; + var ewww_init_action = 'bulk_init'; + var ewww_loop_action = 'bulk_loop'; + var ewww_cleanup_action = 'bulk_cleanup'; + ewww_main = true; } - $('#ewww-aux-start').hide(); - $('.ewww-bulk-info').hide(); - $('.ewww-aux-table').hide(); - $('#ewww-show-table').hide(); - $('#ewww-scanning').show(); - //ewww_vars.scanning = $('#ewww-scanning').html(); - ewwwStartScan(); - return false; - }); - function ewwwStartScan() { - var ewww_scan_data = { - action: ewww_scan_action, - ewww_force: ewww_force, - ewww_scan: true, + var ewww_init_data = { + action: ewww_init_action, ewww_wpnonce: ewww_vars._wpnonce, }; - $.post(ajaxurl, ewww_scan_data, function(response) { - var is_json = true; - try { - var ewww_response = $.parseJSON(response); - } catch (err) { - is_json = false; - } - if ( ! is_json ) { - $('#ewww-scanning').html('' + ewww_vars.invalid_response + ''); - console.log( response ); - return false; + var ewww_table_action = 'bulk_aux_images_table'; + var ewww_table_count_action = 'bulk_aux_images_table_count'; + var ewww_import_init_action = 'bulk_import_init'; + var ewww_import_loop_action = 'bulk_import_loop'; + $(document).on('click', '.ewww-show-debug-meta', function() { + var post_id = $(this).data('id'); + $('.ewww-debug-meta-' + post_id).toggle(); + }); + $('#ewww-aux-start').submit(function() { + ewww_aux = true; + //ewww_init_action = 'bulk_init'; + //ewww_loop_action = 'bulk_aux_images_loop'; + //ewww_cleanup_action = 'bulk_aux_images_cleanup'; + if ($('#ewww-force:checkbox:checked').val()) { + ewww_force = 1; } - ewww_init_data = { - action: ewww_init_action, + $('#ewww-aux-start').hide(); + $('.ewww-bulk-info').hide(); + $('.ewww-aux-table').hide(); + $('#ewww-show-table').hide(); + $('#ewww-scanning').show(); + //ewww_vars.scanning = $('#ewww-scanning').html(); + ewwwStartScan(); + return false; + }); + function ewwwStartScan() { + var ewww_scan_data = { + action: ewww_scan_action, + ewww_force: ewww_force, + ewww_scan: true, ewww_wpnonce: ewww_vars._wpnonce, }; - if ( ewww_response.error ) { - $('#ewww-scanning').html('' + ewww_response.error + ''); - } else if ( ewww_response.remaining ) { - $('.ewww-aux-table').hide(); - $('#ewww-show-table').hide(); - //if ( ! ewww_response.notice ) { - // ewww_response.notice = ''; - //} - $('#ewww-scanning').html( ewww_response.remaining ); - if ( ewww_response.notice ) { - $('#ewww-scanning').append( '