Skip to content

Commit

Permalink
cleanup on new tools page and bulk script
Browse files Browse the repository at this point in the history
  • Loading branch information
nosilver4u committed Sep 26, 2019
1 parent 7196b0b commit 0d0ccab
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 278 deletions.
4 changes: 2 additions & 2 deletions aux-optimize.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function ewww_image_optimizer_aux_images_table() {
<td><?php echo $type; ?></td>
<td>
<?php echo "$savings <br>$size_string"; ?><br>
<a class="removeimage" onclick="ewwwRemoveImage( <?php echo $optimized_image['id']; ?> )"><?php esc_html_e( 'Remove from table', 'ewww-image-optimizer' ); ?></a>
<a class="removeimage" onclick="ewwwRemoveImage( <?php echo $optimized_image['id']; ?> )"><?php esc_html_e( 'Remove from history', 'ewww-image-optimizer' ); ?></a>
<?php if ( $optimized_image['backup'] ) { ?>
<br><a class="restoreimage" onclick="ewwwRestoreImage( <?php echo $optimized_image['id']; ?> )"><?php esc_html_e( 'Restore original', 'ewww-image-optimizer' ); ?></a>
<?php } ?>
Expand Down Expand Up @@ -177,7 +177,7 @@ function ewww_image_optimizer_aux_images_table() {
<td><?php echo $type; ?></td>
<td>
<?php echo "$savings <br>$size_string"; ?><br>
<a class="removeimage" onclick="ewwwRemoveImage( <?php echo $optimized_image['id']; ?> )"><?php esc_html_e( 'Remove from table', 'ewww-image-optimizer' ); ?></a>
<a class="removeimage" onclick="ewwwRemoveImage( <?php echo $optimized_image['id']; ?> )"><?php esc_html_e( 'Remove from history', 'ewww-image-optimizer' ); ?></a>
<?php if ( $optimized_image['backup'] ) { ?>
<br><a class="restoreimage" onclick="ewwwRestoreImage( <?php echo $optimized_image['id']; ?> )"><?php esc_html_e( 'Restore original', 'ewww-image-optimizer' ); ?></a>
<?php } ?>
Expand Down
10 changes: 9 additions & 1 deletion bulk.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ function ewww_image_optimizer_display_tools() {
'<span id="ewww-pointer" style="display:none">0</span>' . "\n" .
"</div>\n";
echo $output;
echo "<div>\n<p id='ewww-clear-table-info' class='ewww-tool-info'>" . 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' ) . "</p>\n";
echo '<hr>';
echo "<div>\n<p id='ewww-clear-table-info' class='ewww-tool-info'>" .
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 "</p>\n";
echo "<form id='ewww-clear-table' class='ewww-tool-form' method='post' action=''>\n" .
"<input type='submit' class='button-secondary action' value='" . esc_attr__( 'Erase Optimization History', 'ewww-image-optimizer' ) . "' />\n" .
"</form>\n</div>\n";
Expand All @@ -74,6 +77,10 @@ function ewww_image_optimizer_tool_script( $hook ) {
$image_count = ewww_image_optimizer_aux_images_table_count();
// Submit a couple variables for our javascript to work with.
$loading_image = plugins_url( '/images/wpspin.gif', __FILE__ );
$erase_warning = esc_html__( 'Warning: this cannot be undone and will cause a bulk optimize to re-optimize all images.', 'ewww-image-optimizer' );
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) {
$erase_warning = esc_html__( 'Warning: this cannot be undone. Re-optimizing images will use additional API credits.', 'ewww-image-optimizer' );
}
wp_localize_script(
'ewwwtoolscript',
'ewww_vars',
Expand All @@ -85,6 +92,7 @@ function ewww_image_optimizer_tool_script( $hook ) {
'remove_failed' => esc_html__( 'Could not remove image from table.', 'ewww-image-optimizer' ),
'original_restored' => esc_html__( 'Original Restored', 'ewww-image-optimizer' ),
'restoring' => '<p>' . esc_html__( 'Restoring', 'ewww-image-optimizer' ) . "&nbsp;<img src='$loading_image' /></p>",
'erase_warning' => $erase_warning,
)
);
// Load the stylesheet for the jquery progressbar.
Expand Down
12 changes: 12 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 4 additions & 1 deletion common.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down Expand Up @@ -8417,6 +8417,9 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
'</div><!-- end .ewww-guage -->';
$status_output .= $savings_guage;
$status_output .= '<p style="text-align:center"><strong>' . esc_html__( 'Savings', 'ewww-image-optimizer' ) . '</strong></p>';
if ( 'network-multisite' !== $network ) {
$status_output .= '<p><a href="tools.php?page=ewww-image-optimizer-tools">' . esc_html__( 'View optimized images.', 'ewww-image-optimizer' ) . '</a></p>';
}
$status_output .= '</div><!-- end .ewww-status-detail --></li>';
}
ewwwio_debug_message( ewww_image_optimizer_aux_images_table_count() . ' images have been optimized' );
Expand Down
2 changes: 1 addition & 1 deletion ewww-image-optimizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
14 changes: 8 additions & 6 deletions includes/eio-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
});
Expand Down
Loading

0 comments on commit 0d0ccab

Please sign in to comment.