EWWW Image Optimizer - Version 6.1.6

Version Description

  • added: support for BuddyPress uploads via Vikinger theme.
  • added: compatibility with Weglot.
  • added: use 'img-crop' id/class, or data-img-crop attribute to force cropping with Easy IO + Lazy Load.
  • changed: Resize Existing enabled by default for new installs.
  • changed: Lazy Load JS moved to footer
  • fixed: prevent Resize Detection from flagging SVG files.
Download this release

Release Info

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

Code changes from version 6.1.5 to 6.1.6

bulk.php CHANGED
@@ -248,16 +248,30 @@ function ewww_image_optimizer_bulk_preview() {
248
  return;
249
  }
250
  if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) {
251
- echo '<a id="ewww-bulk-credits-available" target="_blank" style="margin-left:20px" class="page-title-action" href="https://ewww.io/my-account/">' . esc_html__( 'Image credits available:', 'ewww-image-optimizer' ) . ' ' . esc_html( ewww_image_optimizer_cloud_quota() ) . '</a>';
252
  echo '<hr class="wp-header-end">';
253
  }
254
  if (
255
  ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) &&
256
  ewww_image_optimizer_easy_active()
257
  ) {
258
- echo '<div id="ewww-bulk-warning" class="ewww-bulk-info notice notice-warning"><p>' . esc_html__( 'Easy IO is automatically optimizing your site! Bulk Optimization of local images is not necessary unless you wish to save storage space. Please be sure you have a backup of your images before proceeding.', 'ewww-image-optimizer' ) . '</p></div>';
 
 
 
 
 
 
 
259
  } else {
260
- echo '<div id="ewww-bulk-warning" class="ewww-bulk-info notice notice-warning"><p>' . esc_html__( 'Bulk Optimization will alter your original images and cannot be undone. Please be sure you have a backup of your images before proceeding.', 'ewww-image-optimizer' ) . '</p></div>';
 
 
 
 
 
 
 
261
  }
262
  // Retrieve the value of the 'bulk resume' option and set the button text for the form to use.
263
  $resume = get_option( 'ewww_image_optimizer_bulk_resume' );
@@ -312,6 +326,31 @@ function ewww_image_optimizer_bulk_preview() {
312
  ewww_image_optimizer_aux_images();
313
  }
314
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  /**
316
  * Outputs the status area and delay/force controls for the Bulk optimize page.
317
  */
@@ -1586,7 +1625,7 @@ function ewww_image_optimizer_bulk_quota_update() {
1586
  }
1587
  ewwwio_ob_clean();
1588
  if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) {
1589
- echo esc_html__( 'Image credits available:', 'ewww-image-optimizer' ) . ' ' . esc_html( ewww_image_optimizer_cloud_quota() );
1590
  }
1591
  ewwwio_memory( __FUNCTION__ );
1592
  die();
@@ -2051,7 +2090,6 @@ function ewww_image_optimizer_bulk_loop( $hook = '', $delay = 0 ) {
2051
  /* translators: %s: number of seconds */
2052
  $output['results'] .= sprintf( '<p>' . esc_html( _n( 'Elapsed: %s second', 'Elapsed: %s seconds', $elapsed, 'ewww-image-optimizer' ) ) . '</p>', number_format_i18n( $elapsed, 1 ) );
2053
  // Store the updated list of attachment IDs back in the 'bulk_attachments' option.
2054
- // update_option( 'ewww_image_optimizer_bulk_attachments', $attachments, false );.
2055
  if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_debug' ) ) {
2056
  global $eio_debug;
2057
  $debug_button = esc_html__( 'Show Debug Output', 'ewww-image-optimizer' );
248
  return;
249
  }
250
  if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) {
251
+ echo '<span id="ewww-bulk-credits-available">' . esc_html__( 'Image credits available:', 'ewww-image-optimizer' ) . ' ' . wp_kses_post( ewww_image_optimizer_cloud_quota() ) . '</span>';
252
  echo '<hr class="wp-header-end">';
253
  }
254
  if (
255
  ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) &&
256
  ewww_image_optimizer_easy_active()
257
  ) {
258
+ ?>
259
+ <div id="ewww-bulk-warning" class="ewww-bulk-info notice notice-warning">
260
+ <p>
261
+ <?php esc_html_e( 'Easy IO is automatically optimizing your site! Bulk Optimization of local images is not necessary unless you wish to save storage space. Please be sure you have a backup of your images before proceeding.', 'ewww-image-optimizer' ); ?>
262
+ <?php ewww_image_optimizer_bulk_resize_warning_message(); ?>
263
+ </p>
264
+ </div>
265
+ <?php
266
  } else {
267
+ ?>
268
+ <div id="ewww-bulk-warning" class="ewww-bulk-info notice notice-warning">
269
+ <p>
270
+ <?php esc_html_e( 'Bulk Optimization will alter your original images and cannot be undone. Please be sure you have a backup of your images before proceeding.', 'ewww-image-optimizer' ); ?>
271
+ <?php ewww_image_optimizer_bulk_resize_warning_message(); ?>
272
+ </p>
273
+ </div>
274
+ <?php
275
  }
276
  // Retrieve the value of the 'bulk resume' option and set the button text for the form to use.
277
  $resume = get_option( 'ewww_image_optimizer_bulk_resume' );
326
  ewww_image_optimizer_aux_images();
327
  }
328
 
329
+ /**
330
+ * Make sure folks know their images will be resized during bulk optimization.
331
+ */
332
+ function ewww_image_optimizer_bulk_resize_warning_message() {
333
+ if (
334
+ ewww_image_optimizer_get_option( 'ewww_image_optimizer_resize_existing' ) &&
335
+ ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_maxmediawidth' ) || ewww_image_optimizer_get_option( 'ewww_image_optimizer_maxmediaheight' ) )
336
+ ) {
337
+ if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_resize_other_existing' ) ) {
338
+ printf(
339
+ /* translators: 1: width in pixels, 2: height in pixels */
340
+ esc_html__( 'All images will be scaled to %1$d x %2$d.', 'ewww-image-optimizer' ),
341
+ (int) ewww_image_optimizer_get_option( 'ewww_image_optimizer_maxmediawidth' ),
342
+ (int) ewww_image_optimizer_get_option( 'ewww_image_optimizer_maxmediaheight' ),
343
+ );
344
+ } else {
345
+ printf(
346
+ /* translators: 1: width in pixels, 2: height in pixels */
347
+ esc_html__( 'All images in the Media Library will be scaled to %1$d x %2$d.', 'ewww-image-optimizer' ),
348
+ (int) ewww_image_optimizer_get_option( 'ewww_image_optimizer_maxmediawidth' ),
349
+ (int) ewww_image_optimizer_get_option( 'ewww_image_optimizer_maxmediaheight' ),
350
+ );
351
+ }
352
+ }
353
+ }
354
  /**
355
  * Outputs the status area and delay/force controls for the Bulk optimize page.
356
  */
1625
  }
1626
  ewwwio_ob_clean();
1627
  if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) {
1628
+ echo esc_html__( 'Image credits available:', 'ewww-image-optimizer' ) . ' ' . wp_kses_post( ewww_image_optimizer_cloud_quota() );
1629
  }
1630
  ewwwio_memory( __FUNCTION__ );
1631
  die();
2090
  /* translators: %s: number of seconds */
2091
  $output['results'] .= sprintf( '<p>' . esc_html( _n( 'Elapsed: %s second', 'Elapsed: %s seconds', $elapsed, 'ewww-image-optimizer' ) ) . '</p>', number_format_i18n( $elapsed, 1 ) );
2092
  // Store the updated list of attachment IDs back in the 'bulk_attachments' option.
 
2093
  if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_debug' ) ) {
2094
  global $eio_debug;
2095
  $debug_button = esc_html__( 'Show Debug Output', 'ewww-image-optimizer' );
changelog.txt CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  = 6.1.5 =
2
  * changed: use core wp_getimagesize() for proper error handling
3
  * fixed: prevent erasing title attributes for admin users when Lazy Load and Resize Detection are enabled
1
+ = 6.1.6 =
2
+ * added: support for BuddyPress uploads via Vikinger theme.
3
+ * added: compatibility with Weglot.
4
+ * added: use 'img-crop' id/class, or data-img-crop attribute to force cropping with Easy IO + Lazy Load.
5
+ * changed: Resize Existing enabled by default for new installs.
6
+ * fixed: prevent Resize Detection from flagging SVG files.
7
+ * fixed: prevent Resize Detection from flagging SVG files.
8
+
9
  = 6.1.5 =
10
  * changed: use core wp_getimagesize() for proper error handling
11
  * fixed: prevent erasing title attributes for admin users when Lazy Load and Resize Detection are enabled
classes/class-eio-alt-webp-weglot-alt.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Implements integration with WebP rewriting and Weglot.
4
+ *
5
+ * @link https://ewww.io
6
+ * @package EIO
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Add the data-alt and data-title attribute of noscript elements to the list of DOM checkers for Weglot.
15
+ *
16
+ * @param array $dom_checkers Contains the list of all the classes Weglot is checking by default.
17
+ * @return array The updated list of classes.
18
+ */
19
+ function eio_weglot_dom_check( $dom_checkers ) {
20
+ ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
21
+
22
+ if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_webp_for_cdn' ) ) {
23
+ return $dom_checkers;
24
+ }
25
+
26
+ /**
27
+ * A lovely little class to send 'alt' hints to Weglot.
28
+ */
29
+ class EIO_Alt_Webp_Weglot_Alt extends Weglot\Parser\Check\Dom\AbstractDomChecker {
30
+
31
+ /**
32
+ * Type of tag we want Weglot to detect.
33
+ */
34
+ const DOM = 'noscript';
35
+
36
+ /**
37
+ * Name of the attribute in that tag we want Weglot to detect.
38
+ */
39
+ const PROPERTY = 'data-alt';
40
+
41
+ /**
42
+ * Do not change unless it's not text but a media URL like a .pdf file for example.
43
+ */
44
+ const WORD_TYPE = Weglot\Client\Api\Enum\WordType::TEXT;
45
+ }
46
+
47
+ /**
48
+ * A lovely little class to send 'title' hints to Weglot.
49
+ */
50
+ class EIO_Alt_Webp_Weglot_Title extends Weglot\Parser\Check\Dom\AbstractDomChecker {
51
+
52
+ /**
53
+ * Type of tag we want Weglot to detect.
54
+ */
55
+ const DOM = 'noscript';
56
+
57
+ /**
58
+ * Name of the attribute in that tag we want Weglot to detect.
59
+ */
60
+ const PROPERTY = 'data-title';
61
+
62
+ /**
63
+ * Do not change unless it's not text but a media URL like a .pdf file for example.
64
+ */
65
+ const WORD_TYPE = Weglot\Client\Api\Enum\WordType::TEXT;
66
+ }
67
+
68
+ ewwwio_debug_message( 'registering Weglot integration for JS WebP (data-* attrs on noscript)' );
69
+ $dom_checkers[] = '\EIO_Alt_Webp_Weglot_Alt';
70
+ $dom_checkers[] = '\EIO_Alt_Webp_Weglot_Title';
71
+ return $dom_checkers;
72
+ }
73
+ // Instruct Weglot to filter data-alt tags on noscript elements.
74
+ add_filter( 'weglot_get_dom_checkers', 'eio_weglot_dom_check' );
classes/class-eio-alt-webp.php CHANGED
@@ -422,7 +422,7 @@ class EIO_Alt_Webp extends EIO_Page_Parser {
422
  $buffer = str_replace( $image, $new_image, $buffer );
423
  }
424
  } elseif ( ! empty( $file ) && strpos( $image, 'data-src=' ) && ( strpos( $image, 'data-lazy-type="image' ) || strpos( $image, 'lazyload' ) ) ) {
425
- // a3 Lazy Load.
426
  $new_image = $image;
427
  $real_file = $this->get_attribute( $new_image, 'data-src' );
428
  ewwwio_debug_message( "checking webp for Lazy Load data-src: $real_file" );
422
  $buffer = str_replace( $image, $new_image, $buffer );
423
  }
424
  } elseif ( ! empty( $file ) && strpos( $image, 'data-src=' ) && ( strpos( $image, 'data-lazy-type="image' ) || strpos( $image, 'lazyload' ) ) ) {
425
+ // a3 or EWWW IO Lazy Load.
426
  $new_image = $image;
427
  $real_file = $this->get_attribute( $new_image, 'data-src' );
428
  ewwwio_debug_message( "checking webp for Lazy Load data-src: $real_file" );
classes/class-eio-lazy-load.php CHANGED
@@ -961,24 +961,32 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
961
  if ( $this->is_amp() ) {
962
  return;
963
  }
 
 
 
964
  $plugin_file = constant( strtoupper( $this->prefix ) . 'PLUGIN_FILE' );
965
- wp_enqueue_script( 'eio-lazy-load-pre', plugins_url( '/includes/lazysizes-pre.js', $plugin_file ), array(), $this->version );
966
- wp_enqueue_script( 'eio-lazy-load', plugins_url( '/includes/lazysizes.js', $plugin_file ), array(), $this->version );
967
- wp_enqueue_script( 'eio-lazy-load-post', plugins_url( '/includes/lazysizes-post.js', $plugin_file ), array(), $this->version );
968
- wp_enqueue_script( 'eio-lazy-load-uvh', plugins_url( '/includes/ls.unveilhooks.js', $plugin_file ), array(), $this->version );
969
  if ( defined( strtoupper( $this->prefix ) . 'LAZY_PRINT' ) && constant( strtoupper( $this->prefix ) . 'LAZY_PRINT' ) ) {
970
- wp_enqueue_script( 'eio-lazy-load-print', plugins_url( '/includes/ls.print.js', $plugin_file ), array(), $this->version );
971
  }
972
  $threshold = defined( 'EIO_LL_THRESHOLD' ) && EIO_LL_THRESHOLD ? EIO_LL_THRESHOLD : 0;
973
- wp_localize_script(
974
  'eio-lazy-load',
975
- 'eio_lazy_vars',
976
- array(
977
- 'exactdn_domain' => ( $this->parsing_exactdn ? $this->exactdn_domain : '' ),
978
- 'skip_autoscale' => ( defined( 'EIO_LL_AUTOSCALE' ) && ! EIO_LL_AUTOSCALE ? 1 : 0 ),
979
- 'threshold' => (int) $threshold > 50 ? (int) $threshold : 0,
980
- )
 
 
 
 
981
  );
 
982
  }
983
 
984
  /**
@@ -989,21 +997,29 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
989
  if ( $this->is_amp() ) {
990
  return;
991
  }
 
 
 
992
  $plugin_file = constant( strtoupper( $this->prefix ) . 'PLUGIN_FILE' );
993
- wp_enqueue_script( 'eio-lazy-load', plugins_url( '/includes/lazysizes.min.js', $plugin_file ), array(), $this->version );
994
  if ( defined( strtoupper( $this->prefix ) . 'LAZY_PRINT' ) && constant( strtoupper( $this->prefix ) . 'LAZY_PRINT' ) ) {
995
- wp_enqueue_script( 'eio-lazy-load-print', plugins_url( '/includes/ls.print.min.js', $plugin_file ), array(), $this->version );
996
  }
997
  $threshold = defined( 'EIO_LL_THRESHOLD' ) && EIO_LL_THRESHOLD ? EIO_LL_THRESHOLD : 0;
998
- wp_localize_script(
999
  'eio-lazy-load',
1000
- 'eio_lazy_vars',
1001
- array(
1002
- 'exactdn_domain' => ( $this->parsing_exactdn ? $this->exactdn_domain : '' ),
1003
- 'skip_autoscale' => ( defined( 'EIO_LL_AUTOSCALE' ) && ! EIO_LL_AUTOSCALE ? 1 : 0 ),
1004
- 'threshold' => (int) $threshold > 50 ? (int) $threshold : 0,
1005
- )
 
 
 
 
1006
  );
 
1007
  }
1008
  }
1009
  }
961
  if ( $this->is_amp() ) {
962
  return;
963
  }
964
+ if ( ! defined( 'EIO_LL_FOOTER' ) ) {
965
+ define( 'EIO_LL_FOOTER', true );
966
+ }
967
  $plugin_file = constant( strtoupper( $this->prefix ) . 'PLUGIN_FILE' );
968
+ wp_enqueue_script( 'eio-lazy-load-pre', plugins_url( '/includes/lazysizes-pre.js', $plugin_file ), array(), $this->version, EIO_LL_FOOTER );
969
+ wp_enqueue_script( 'eio-lazy-load', plugins_url( '/includes/lazysizes.js', $plugin_file ), array(), $this->version, EIO_LL_FOOTER );
970
+ wp_enqueue_script( 'eio-lazy-load-post', plugins_url( '/includes/lazysizes-post.js', $plugin_file ), array(), $this->version, EIO_LL_FOOTER );
971
+ wp_enqueue_script( 'eio-lazy-load-uvh', plugins_url( '/includes/ls.unveilhooks.js', $plugin_file ), array(), $this->version, EIO_LL_FOOTER );
972
  if ( defined( strtoupper( $this->prefix ) . 'LAZY_PRINT' ) && constant( strtoupper( $this->prefix ) . 'LAZY_PRINT' ) ) {
973
+ wp_enqueue_script( 'eio-lazy-load-print', plugins_url( '/includes/ls.print.js', $plugin_file ), array(), $this->version, EIO_LL_FOOTER );
974
  }
975
  $threshold = defined( 'EIO_LL_THRESHOLD' ) && EIO_LL_THRESHOLD ? EIO_LL_THRESHOLD : 0;
976
+ wp_add_inline_script(
977
  'eio-lazy-load',
978
+ 'var eio_lazy_vars = ' .
979
+ wp_json_encode(
980
+ array(
981
+ 'exactdn_domain' => ( $this->parsing_exactdn ? $this->exactdn_domain : '' ),
982
+ 'skip_autoscale' => ( defined( 'EIO_LL_AUTOSCALE' ) && ! EIO_LL_AUTOSCALE ? 1 : 0 ),
983
+ 'threshold' => (int) $threshold > 50 ? (int) $threshold : 0,
984
+ )
985
+ )
986
+ . ';',
987
+ 'before'
988
  );
989
+ return;
990
  }
991
 
992
  /**
997
  if ( $this->is_amp() ) {
998
  return;
999
  }
1000
+ if ( ! defined( 'EIO_LL_FOOTER' ) ) {
1001
+ define( 'EIO_LL_FOOTER', true );
1002
+ }
1003
  $plugin_file = constant( strtoupper( $this->prefix ) . 'PLUGIN_FILE' );
1004
+ wp_enqueue_script( 'eio-lazy-load', plugins_url( '/includes/lazysizes.min.js', $plugin_file ), array(), $this->version, EIO_LL_FOOTER );
1005
  if ( defined( strtoupper( $this->prefix ) . 'LAZY_PRINT' ) && constant( strtoupper( $this->prefix ) . 'LAZY_PRINT' ) ) {
1006
+ wp_enqueue_script( 'eio-lazy-load-print', plugins_url( '/includes/ls.print.min.js', $plugin_file ), array(), $this->version, EIO_LL_FOOTER );
1007
  }
1008
  $threshold = defined( 'EIO_LL_THRESHOLD' ) && EIO_LL_THRESHOLD ? EIO_LL_THRESHOLD : 0;
1009
+ wp_add_inline_script(
1010
  'eio-lazy-load',
1011
+ 'var eio_lazy_vars = ' .
1012
+ wp_json_encode(
1013
+ array(
1014
+ 'exactdn_domain' => ( $this->parsing_exactdn ? $this->exactdn_domain : '' ),
1015
+ 'skip_autoscale' => ( defined( 'EIO_LL_AUTOSCALE' ) && ! EIO_LL_AUTOSCALE ? 1 : 0 ),
1016
+ 'threshold' => (int) $threshold > 50 ? (int) $threshold : 0,
1017
+ )
1018
+ )
1019
+ . ';',
1020
+ 'before'
1021
  );
1022
+ return;
1023
  }
1024
  }
1025
  }
classes/class-exactdn.php CHANGED
@@ -1114,6 +1114,11 @@ if ( ! class_exists( 'ExactDN' ) ) {
1114
  }
1115
  }
1116
 
 
 
 
 
 
1117
  // Detect if image source is for a custom-cropped thumbnail and prevent further URL manipulation.
1118
  if ( ! $fullsize_url && preg_match_all( '#-e[a-z0-9]+(-\d+x\d+)?\.(' . implode( '|', $this->extensions ) . '){1}$#i', wp_basename( $src ), $filename ) ) {
1119
  $fullsize_url = true;
1114
  }
1115
  }
1116
 
1117
+ // Override fit by class/id/attr 'img-crop'.
1118
+ if ( 'fit' === $transform && strpos( $images['img_tag'][ $index ], 'img-crop' ) ) {
1119
+ $transform = 'resize';
1120
+ }
1121
+
1122
  // Detect if image source is for a custom-cropped thumbnail and prevent further URL manipulation.
1123
  if ( ! $fullsize_url && preg_match_all( '#-e[a-z0-9]+(-\d+x\d+)?\.(' . implode( '|', $this->extensions ) . '){1}$#i', wp_basename( $src ), $filename ) ) {
1124
  $fullsize_url = true;
common.php CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  exit;
15
  }
16
 
17
- define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '615' );
18
 
19
  // Initialize a couple globals.
20
  $eio_debug = '';
@@ -82,6 +82,8 @@ if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_noauto' ) ) {
82
  add_filter( 'mpp_generate_metadata', 'ewww_image_optimizer_resize_from_meta_data', 15, 2 );
83
  // Processes an attachment after IRSC has done a thumb regen.
84
  add_filter( 'sirsc_attachment_images_ready', 'ewww_image_optimizer_resize_from_meta_data', 15, 2 );
 
 
85
  }
86
  // Skips resizing for images with 'noresize' in the filename.
87
  add_filter( 'ewww_image_optimizer_resize_dimensions', 'ewww_image_optimizer_noresize', 10, 2 );
@@ -210,6 +212,7 @@ if ( defined( 'WP_CLI' ) && WP_CLI ) {
210
  if ( 'done' !== get_option( 'ewww_image_optimizer_relative_migration_status' ) ) {
211
  require_once( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'classes/class-ewwwio-relative-migration.php' );
212
  }
 
213
 
214
  /**
215
  * Setup page parsing classes after theme functions.php is loaded and plugins have run init routines.
@@ -472,17 +475,6 @@ function ewww_image_optimizer_superadmin_permissions( $permissions ) {
472
  return $permissions;
473
  }
474
 
475
- if ( ! function_exists( 'boolval' ) ) {
476
- /**
477
- * Cast a value to boolean.
478
- *
479
- * @param mixed $value Any value that can be cast to boolean.
480
- * @return bool The boolean version of the provided value.
481
- */
482
- function boolval( $value ) {
483
- return (bool) $value;
484
- }
485
- }
486
  if ( ! function_exists( 'wp_getimagesize' ) ) {
487
  /**
488
  * Stub for WP prior to 5.7.
@@ -4704,12 +4696,15 @@ function ewww_image_optimizer_cloud_quota( $raw = false ) {
4704
  if ( $raw ) {
4705
  return $quota;
4706
  }
4707
- if ( ! empty( $quota['unlimited'] ) ) {
4708
- $quota['consumed'] = max( $quota['consumed'], 0 );
 
 
4709
  return sprintf(
4710
- /* translators: %d: Number of images */
4711
- __( 'optimized %d images.', 'ewww-image-optimizer' ),
4712
- $quota['consumed']
 
4713
  );
4714
  } elseif ( ! $quota['licensed'] && $quota['consumed'] > 0 ) {
4715
  return sprintf(
@@ -10790,48 +10785,6 @@ function ewww_image_optimizer_intro_wizard() {
10790
  </div>
10791
  <div id='ewwwio-wizard-body'>
10792
  <?php if ( 1 === $wizard_step ) : ?>
10793
- <?php if ( $display_exec_notice ) : ?>
10794
- <div id='ewww-image-optimizer-warning-exec' class='ewwwio-notice notice-warning'>
10795
- <?php esc_html_e( 'Sites where the exec() function is disabled require cloud-based optimization, because free server-based optimization will not work.', 'ewww-image-optimizer' ); ?>
10796
- <br>
10797
- <strong>
10798
- <?php esc_html_e( 'You may ask your system administrator to enable exec() for free server-based optimization. Otherwise, choose between free cloud-based JPG-only compression and premium optimization below.', 'ewww-image-optimizer' ); ?>
10799
- <?php ewwwio_help_link( 'https://docs.ewww.io/article/29-what-is-exec-and-why-do-i-need-it', '592dd12d0428634b4a338c39' ); ?>
10800
- </strong>
10801
- </div>
10802
- <?php elseif ( $tools_missing_notice && $tools_available ) : ?>
10803
- <div id='ewww-image-optimizer-warning-opt-missing' class='ewwwio-notice notice-warning'>
10804
- <?php
10805
- printf(
10806
- /* translators: %s: comma-separated list of missing tools */
10807
- esc_html__( 'EWWW Image Optimizer uses open-source tools to enable free mode, but your server is missing these: %s.', 'ewww-image-optimizer' ),
10808
- esc_html( $tools_missing_message )
10809
- );
10810
- echo '<br><br>';
10811
- printf(
10812
- /* translators: %s: Installation Instructions (link) */
10813
- esc_html__( 'You may install missing tools via the %s or continue with reduced functionality.', 'ewww-image-optimizer' ),
10814
- "<a href='https://docs.ewww.io/article/6-the-plugin-says-i-m-missing-something' data-beacon-article='585371e3c697912ffd6c0ba1' target='_blank'>" . esc_html__( 'Installation Instructions', 'ewww-image-optimizer' ) . '</a>'
10815
- );
10816
- ?>
10817
- </div>
10818
- <?php elseif ( $tools_missing_notice ) : ?>
10819
- <div id='ewww-image-optimizer-warning-opt-missing' class='ewwwio-notice notice-warning'>
10820
- <?php
10821
- printf(
10822
- /* translators: %s: comma-separated list of missing tools */
10823
- esc_html__( 'EWWW Image Optimizer uses open-source tools to enable free mode, but your server is missing these: %s.', 'ewww-image-optimizer' ),
10824
- esc_html( $tools_missing_message )
10825
- );
10826
- echo '<br><br>';
10827
- printf(
10828
- /* translators: %s: Installation Instructions (link) */
10829
- esc_html__( 'You may install missing tools via the %s. Otherwise, choose between free cloud-based JPG-only compression and premium optimization below.', 'ewww-image-optimizer' ),
10830
- "<a href='https://docs.ewww.io/article/6-the-plugin-says-i-m-missing-something' data-beacon-article='585371e3c697912ffd6c0ba1' target='_blank'>" . esc_html__( 'Installation Instructions', 'ewww-image-optimizer' ) . '</a>'
10831
- );
10832
- ?>
10833
- </div>
10834
- <?php endif; ?>
10835
  <form id='ewwwio-wizard-step-1' class='ewwwio-wizard-form' method='post' action=''>
10836
  <input type='hidden' name='ewwwio_wizard_step' value='2' />
10837
  <?php wp_nonce_field( 'ewww_image_optimizer_wizard' ); ?>
@@ -10844,9 +10797,10 @@ function ewww_image_optimizer_intro_wizard() {
10844
  </div>
10845
  <div class='ewwwio-wizard-form-group'>
10846
  <input type='radio' id='ewww_image_optimizer_budget_pay' name='ewww_image_optimizer_budget' value='pay' required <?php checked( $show_premium ); ?>/>
10847
- <label for='ewww_image_optimizer_budget_pay'><?php esc_html_e( 'Get 5x more optimization and priority support', 'ewww-image-optimizer' ); ?></label><br>
10848
  <div class="ewwwio-wizard-form-group ewwwio-premium-setup" <?php echo ( $show_premium ? "style='display:block'" : '' ); ?>>
10849
- <p><strong><a href='https://ewww.io/plans/' target='_blank'>&gt;&gt;<?php esc_html_e( 'Start your free trial', 'ewww-image-optimizer' ); ?></a></strong></p>
 
10850
  <div id='ewwwio-api-activation-result'></div>
10851
  <p id='ewww_image_optimizer_cloud_key_container'>
10852
  <label for='ewww_image_optimizer_cloud_key'><?php esc_html_e( 'Compress API Key', 'ewww-image-optimizer' ); ?></label><br>
@@ -10873,9 +10827,9 @@ function ewww_image_optimizer_intro_wizard() {
10873
  ?>
10874
  </span>
10875
  <?php if ( empty( ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) ) : ?>
10876
- <br>
10877
  <a href="<?php echo esc_url( add_query_arg( 'site_url', trim( $easyio_site_url ), 'https://ewww.io/manage-sites/' ) ); ?>" target="_blank">
10878
- <?php esc_html_e( 'Add your Site URL to your account:', 'easy-image-optimizer' ); ?>
10879
  </a>
10880
  <input type='text' id='exactdn_site_url' name='exactdn_site_url' value='<?php echo esc_url( trim( $easyio_site_url ) ); ?>' readonly />
10881
  <span id='exactdn-site-url-copy'><?php esc_html_e( 'Click to Copy', 'ewww-image-optimizer' ); ?></span>
@@ -10890,6 +10844,48 @@ function ewww_image_optimizer_intro_wizard() {
10890
  </div>
10891
  <input type='radio' id='ewww_image_optimizer_budget_free' name='ewww_image_optimizer_budget' value='free' required />
10892
  <label for='ewww_image_optimizer_budget_free'><?php esc_html_e( 'Stick with free mode for now', 'ewww-image-optimizer' ); ?></label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10893
  </div>
10894
  <div class='ewwwio-flex-space-between'>
10895
  <p><input type='submit' class='button-primary' value='<?php esc_attr_e( 'Next', 'ewww-image-optimizer' ); ?>' /></p>
@@ -11846,7 +11842,7 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
11846
  <input type='hidden' id='ewww_image_optimizer_cloud_key' name='ewww_image_optimizer_cloud_key' value='<?php echo esc_attr( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ); ?>' />
11847
  <p>
11848
  <?php if ( false !== strpos( $verify_cloud, 'great' ) ) : ?>
11849
- <span style="color: #3eadc9; font-weight: bolder"><?php esc_html_e( 'Verified,', 'ewww-image-optimizer' ); ?> </span><?php echo esc_html( ewww_image_optimizer_cloud_quota() ); ?>
11850
  <?php elseif ( 'exceeded quota' === $verify_cloud ) : ?>
11851
  <span style="color: orange; font-weight: bolder"><a href="https://docs.ewww.io/article/101-soft-quotas-on-unlimited-plans" data-beacon-article="608ddf128996210f18bd95d3" target="_blank"><?php esc_html_e( 'Soft quota reached, contact us for more', 'ewww-image-optimizer' ); ?></a></span>
11852
  <?php elseif ( 'exceeded' === $verify_cloud ) : ?>
@@ -12037,6 +12033,13 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
12037
  <?php else : ?>
12038
  <p class='description'>
12039
  <?php esc_html_e( 'Resize uploaded images to these dimensions (in pixels).', 'ewww-image-optimizer' ); ?>
 
 
 
 
 
 
 
12040
  </p>
12041
  <?php endif; ?>
12042
  </td>
@@ -12155,14 +12158,16 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
12155
  <?php endif; ?>
12156
  <?php endif; ?>
12157
  <?php if ( $free_exec ) : ?>
12158
- <tr>
12159
- <th>&nbsp;</th>
 
 
12160
  <td>
12161
- <p class='description'><?php esc_html_e( 'WebP conversion requires an API key or Easy IO subscription.', 'ewww-image-optimizer' ); ?></p>
12162
  </td>
12163
  </tr>
12164
  <?php elseif ( ! ewww_image_optimizer_easy_active() || ewww_image_optimizer_get_option( 'ewww_image_optimizer_webp' ) ) : ?>
12165
- <tr>
12166
  <th scope='row'>
12167
  <label for='ewww_image_optimizer_webp'><?php esc_html_e( 'WebP Conversion', 'ewww-image-optimizer' ); ?></label>
12168
  <span><?php ewwwio_help_link( 'https://docs.ewww.io/article/16-ewww-io-and-webp-images', '5854745ac697912ffd6c1c89' ); ?></span>
@@ -12415,17 +12420,30 @@ AddType image/webp .webp</pre>
12415
  ?>
12416
  </p>
12417
  </td>
 
12418
  <?php endif; ?>
 
 
 
 
 
 
 
 
12419
  <?php elseif ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) : ?>
12420
- <tr>
12421
- <th>&nbsp;</th>
 
 
12422
  <td>
12423
  <p class='description'><?php esc_html_e( 'WebP images are served automatically by Easy IO.', 'ewww-image-optimizer' ); ?></p>
12424
  </td>
12425
  </tr>
12426
  <?php elseif ( get_option( 'easyio_exactdn' ) ) : ?>
12427
  <tr>
12428
- <th>&nbsp;</th>
 
 
12429
  <td>
12430
  <p class='description'><?php esc_html_e( 'WebP images are served automatically by Easy Image Optimizer.', 'ewww-image-optimizer' ); ?></p>
12431
  </td>
@@ -12459,7 +12477,7 @@ AddType image/webp .webp</pre>
12459
  <tr>
12460
  <th scope='row'>
12461
  <label for='ewww_image_optimizer_jpg_level'><?php esc_html_e( 'JPG Optimization Level', 'ewww-image-optimizer' ); ?></label>
12462
- <?php ewwwio_help_link( 'https://docs.ewww.io/article/7-basic-configuration', '585373d5c697912ffd6c0bb2' ); ?>
12463
  </th>
12464
  <td>
12465
  <select id='ewww_image_optimizer_jpg_level' name='ewww_image_optimizer_jpg_level'>
@@ -12486,7 +12504,7 @@ AddType image/webp .webp</pre>
12486
  <tr>
12487
  <th scope='row'>
12488
  <label for='ewww_image_optimizer_png_level'><?php esc_html_e( 'PNG Optimization Level', 'ewww-image-optimizer' ); ?></label>
12489
- <?php ewwwio_help_link( 'https://docs.ewww.io/article/7-basic-configuration', '585373d5c697912ffd6c0bb2,5854531bc697912ffd6c1afa' ); ?>
12490
  </th>
12491
  <td>
12492
  <select id='ewww_image_optimizer_png_level' name='ewww_image_optimizer_png_level'>
@@ -12513,7 +12531,7 @@ AddType image/webp .webp</pre>
12513
  <tr>
12514
  <th scope='row'>
12515
  <label for='ewww_image_optimizer_gif_level'><?php esc_html_e( 'GIF Optimization Level', 'ewww-image-optimizer' ); ?></label>
12516
- <?php ewwwio_help_link( 'https://docs.ewww.io/article/7-basic-configuration', '585373d5c697912ffd6c0bb2' ); ?>
12517
  </th>
12518
  <td>
12519
  <select id='ewww_image_optimizer_gif_level' name='ewww_image_optimizer_gif_level'>
@@ -12529,7 +12547,7 @@ AddType image/webp .webp</pre>
12529
  <tr>
12530
  <th scope='row'>
12531
  <label for='ewww_image_optimizer_pdf_level'><?php esc_html_e( 'PDF Optimization Level', 'ewww-image-optimizer' ); ?></label>
12532
- <?php ewwwio_help_link( 'https://docs.ewww.io/article/7-basic-configuration', '585373d5c697912ffd6c0bb2' ); ?>
12533
  </th>
12534
  <td>
12535
  <select id='ewww_image_optimizer_pdf_level' name='ewww_image_optimizer_pdf_level'>
@@ -12549,7 +12567,7 @@ AddType image/webp .webp</pre>
12549
  <tr>
12550
  <th scope='row'>
12551
  <label for='ewww_image_optimizer_svg_level'><?php esc_html_e( 'SVG Optimization Level', 'ewww-image-optimizer' ); ?></label>
12552
- <?php ewwwio_help_link( 'https://docs.ewww.io/article/7-basic-configuration', '585373d5c697912ffd6c0bb2' ); ?>
12553
  </th>
12554
  <td>
12555
  <select id='ewww_image_optimizer_svg_level' name='ewww_image_optimizer_svg_level'>
@@ -12590,7 +12608,7 @@ AddType image/webp .webp</pre>
12590
  <tr>
12591
  <th scope='row'>
12592
  <label for='ewww_image_optimizer_backup_files'><?php esc_html_e( 'Backup Originals', 'ewww-image-optimizer' ); ?></label>
12593
- <?php ewwwio_help_link( 'https://docs.ewww.io/article/7-basic-configuration', '585373d5c697912ffd6c0bb2' ); ?>
12594
  </th>
12595
  <td>
12596
  <input type='checkbox' id='ewww_image_optimizer_backup_files' name='ewww_image_optimizer_backup_files' value='true' <?php checked( ewww_image_optimizer_get_option( 'ewww_image_optimizer_backup_files' ) ); ?> <?php disabled( $disable_level ); ?>>
@@ -12968,7 +12986,6 @@ AddType image/webp .webp</pre>
12968
  <tr>
12969
  <th scope='row'>
12970
  <label for='ewww_image_optimizer_debug'><?php esc_html_e( 'Debugging', 'ewww-image-optimizer' ); ?></label>
12971
- <span><?php ewwwio_help_link( 'https://docs.ewww.io/article/7-basic-configuration', '585373d5c697912ffd6c0bb2' ); ?></span>
12972
  </th>
12973
  <td>
12974
  <input type='checkbox' id='ewww_image_optimizer_debug' name='ewww_image_optimizer_debug' value='true' <?php checked( ewww_image_optimizer_get_option( 'ewww_image_optimizer_debug' ) ); ?> />
14
  exit;
15
  }
16
 
17
+ define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '616.0' );
18
 
19
  // Initialize a couple globals.
20
  $eio_debug = '';
82
  add_filter( 'mpp_generate_metadata', 'ewww_image_optimizer_resize_from_meta_data', 15, 2 );
83
  // Processes an attachment after IRSC has done a thumb regen.
84
  add_filter( 'sirsc_attachment_images_ready', 'ewww_image_optimizer_resize_from_meta_data', 15, 2 );
85
+ // Process BuddyPress uploads from Vikinger theme.
86
+ add_action( 'vikinger_file_uploaded', 'ewww_image_optimizer' );
87
  }
88
  // Skips resizing for images with 'noresize' in the filename.
89
  add_filter( 'ewww_image_optimizer_resize_dimensions', 'ewww_image_optimizer_noresize', 10, 2 );
212
  if ( 'done' !== get_option( 'ewww_image_optimizer_relative_migration_status' ) ) {
213
  require_once( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'classes/class-ewwwio-relative-migration.php' );
214
  }
215
+ require_once( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'classes/class-eio-alt-webp-weglot-alt.php' );
216
 
217
  /**
218
  * Setup page parsing classes after theme functions.php is loaded and plugins have run init routines.
475
  return $permissions;
476
  }
477
 
 
 
 
 
 
 
 
 
 
 
 
478
  if ( ! function_exists( 'wp_getimagesize' ) ) {
479
  /**
480
  * Stub for WP prior to 5.7.
4696
  if ( $raw ) {
4697
  return $quota;
4698
  }
4699
+ if ( ! empty( $quota['unlimited'] ) && $quota['consumed'] >= 0 ) {
4700
+ $consumed = (int) $quota['consumed'];
4701
+ $soft_cap = '<a title="Help" data-beacon-article="608ddf128996210f18bd95d3" href="https://docs.ewww.io/article/101-soft-quotas-on-unlimited-plans">' . (int) $quota['soft_cap'] . '</a>';
4702
+ $soft_cap .= ewwwio_get_help_link( 'https://docs.ewww.io/article/101-soft-quotas-on-unlimited-plans', '608ddf128996210f18bd95d3' );
4703
  return sprintf(
4704
+ /* translators: 1: Number of images optimized, 2: image quota */
4705
+ __( 'optimized %1$d (of %2$s) images.', 'ewww-image-optimizer' ),
4706
+ $consumed,
4707
+ $soft_cap
4708
  );
4709
  } elseif ( ! $quota['licensed'] && $quota['consumed'] > 0 ) {
4710
  return sprintf(
10785
  </div>
10786
  <div id='ewwwio-wizard-body'>
10787
  <?php if ( 1 === $wizard_step ) : ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10788
  <form id='ewwwio-wizard-step-1' class='ewwwio-wizard-form' method='post' action=''>
10789
  <input type='hidden' name='ewwwio_wizard_step' value='2' />
10790
  <?php wp_nonce_field( 'ewww_image_optimizer_wizard' ); ?>
10797
  </div>
10798
  <div class='ewwwio-wizard-form-group'>
10799
  <input type='radio' id='ewww_image_optimizer_budget_pay' name='ewww_image_optimizer_budget' value='pay' required <?php checked( $show_premium ); ?>/>
10800
+ <label for='ewww_image_optimizer_budget_pay'><?php esc_html_e( 'Activate 5x more optimization and priority support', 'ewww-image-optimizer' ); ?></label><br>
10801
  <div class="ewwwio-wizard-form-group ewwwio-premium-setup" <?php echo ( $show_premium ? "style='display:block'" : '' ); ?>>
10802
+ <?php /* translators: %s: free trial (link) */ ?>
10803
+ <p><strong>&gt;&gt;<?php printf( esc_html__( 'Start your %s or activate your service below', 'ewww-image-optimizer' ), "<a href='https://ewww.io/plans/' target='_blank'>" . esc_html__( 'free trial', 'ewww-image-optimizer' ) . '</a>' ); ?></strong></p>
10804
  <div id='ewwwio-api-activation-result'></div>
10805
  <p id='ewww_image_optimizer_cloud_key_container'>
10806
  <label for='ewww_image_optimizer_cloud_key'><?php esc_html_e( 'Compress API Key', 'ewww-image-optimizer' ); ?></label><br>
10827
  ?>
10828
  </span>
10829
  <?php if ( empty( ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) ) : ?>
10830
+ <br><br>
10831
  <a href="<?php echo esc_url( add_query_arg( 'site_url', trim( $easyio_site_url ), 'https://ewww.io/manage-sites/' ) ); ?>" target="_blank">
10832
+ <?php esc_html_e( 'First, add your Site URL to your account:', 'easy-image-optimizer' ); ?>
10833
  </a>
10834
  <input type='text' id='exactdn_site_url' name='exactdn_site_url' value='<?php echo esc_url( trim( $easyio_site_url ) ); ?>' readonly />
10835
  <span id='exactdn-site-url-copy'><?php esc_html_e( 'Click to Copy', 'ewww-image-optimizer' ); ?></span>
10844
  </div>
10845
  <input type='radio' id='ewww_image_optimizer_budget_free' name='ewww_image_optimizer_budget' value='free' required />
10846
  <label for='ewww_image_optimizer_budget_free'><?php esc_html_e( 'Stick with free mode for now', 'ewww-image-optimizer' ); ?></label>
10847
+ <?php if ( $display_exec_notice ) : ?>
10848
+ <div id='ewww-image-optimizer-warning-exec' class='ewwwio-notice notice-warning' style='display:none;'>
10849
+ <?php esc_html_e( 'Sites where the exec() function is disabled require cloud-based optimization, because free server-based optimization will not work.', 'ewww-image-optimizer' ); ?>
10850
+ <br>
10851
+ <strong>
10852
+ <?php esc_html_e( 'You may ask your system administrator to enable exec() for free server-based optimization. Otherwise, continue with free cloud-based JPG-only compression or select premium optimization above.', 'ewww-image-optimizer' ); ?>
10853
+ <?php ewwwio_help_link( 'https://docs.ewww.io/article/29-what-is-exec-and-why-do-i-need-it', '592dd12d0428634b4a338c39' ); ?>
10854
+ </strong>
10855
+ </div>
10856
+ <?php elseif ( $tools_missing_notice && $tools_available ) : ?>
10857
+ <div id='ewww-image-optimizer-warning-opt-missing' class='ewwwio-notice notice-warning' style='display:none;'>
10858
+ <?php
10859
+ printf(
10860
+ /* translators: %s: comma-separated list of missing tools */
10861
+ esc_html__( 'EWWW Image Optimizer uses open-source tools to enable free mode, but your server is missing these: %s.', 'ewww-image-optimizer' ),
10862
+ esc_html( $tools_missing_message )
10863
+ );
10864
+ echo '<br><br>';
10865
+ printf(
10866
+ /* translators: %s: Installation Instructions (link) */
10867
+ esc_html__( 'You may install missing tools via the %s or continue with reduced functionality.', 'ewww-image-optimizer' ),
10868
+ "<a href='https://docs.ewww.io/article/6-the-plugin-says-i-m-missing-something' data-beacon-article='585371e3c697912ffd6c0ba1' target='_blank'>" . esc_html__( 'Installation Instructions', 'ewww-image-optimizer' ) . '</a>'
10869
+ );
10870
+ ?>
10871
+ </div>
10872
+ <?php elseif ( $tools_missing_notice ) : ?>
10873
+ <div id='ewww-image-optimizer-warning-opt-missing' class='ewwwio-notice notice-warning' style='display:none;'>
10874
+ <?php
10875
+ printf(
10876
+ /* translators: %s: comma-separated list of missing tools */
10877
+ esc_html__( 'EWWW Image Optimizer uses open-source tools to enable free mode, but your server is missing these: %s.', 'ewww-image-optimizer' ),
10878
+ esc_html( $tools_missing_message )
10879
+ );
10880
+ echo '<br><br>';
10881
+ printf(
10882
+ /* translators: %s: Installation Instructions (link) */
10883
+ esc_html__( 'You may install missing tools via the %s. Otherwise, continue with free cloud-based JPG-only compression or select premium optimization above.', 'ewww-image-optimizer' ),
10884
+ "<a href='https://docs.ewww.io/article/6-the-plugin-says-i-m-missing-something' data-beacon-article='585371e3c697912ffd6c0ba1' target='_blank'>" . esc_html__( 'Installation Instructions', 'ewww-image-optimizer' ) . '</a>'
10885
+ );
10886
+ ?>
10887
+ </div>
10888
+ <?php endif; ?>
10889
  </div>
10890
  <div class='ewwwio-flex-space-between'>
10891
  <p><input type='submit' class='button-primary' value='<?php esc_attr_e( 'Next', 'ewww-image-optimizer' ); ?>' /></p>
11842
  <input type='hidden' id='ewww_image_optimizer_cloud_key' name='ewww_image_optimizer_cloud_key' value='<?php echo esc_attr( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ); ?>' />
11843
  <p>
11844
  <?php if ( false !== strpos( $verify_cloud, 'great' ) ) : ?>
11845
+ <span style="color: #3eadc9; font-weight: bolder"><?php esc_html_e( 'Verified,', 'ewww-image-optimizer' ); ?> </span><?php echo wp_kses_post( ewww_image_optimizer_cloud_quota() ); ?>
11846
  <?php elseif ( 'exceeded quota' === $verify_cloud ) : ?>
11847
  <span style="color: orange; font-weight: bolder"><a href="https://docs.ewww.io/article/101-soft-quotas-on-unlimited-plans" data-beacon-article="608ddf128996210f18bd95d3" target="_blank"><?php esc_html_e( 'Soft quota reached, contact us for more', 'ewww-image-optimizer' ); ?></a></span>
11848
  <?php elseif ( 'exceeded' === $verify_cloud ) : ?>
12033
  <?php else : ?>
12034
  <p class='description'>
12035
  <?php esc_html_e( 'Resize uploaded images to these dimensions (in pixels).', 'ewww-image-optimizer' ); ?>
12036
+ <?php
12037
+ printf(
12038
+ /* translators: %s: Bulk Optimizer (link) */
12039
+ esc_html__( 'Use the %s for existing uploads.', 'ewww-image-optimizer' ),
12040
+ '<a href="' . esc_url( admin_url( 'upload.php?page=ewww-image-optimizer-bulk' ) ) . '">' . esc_html__( 'Bulk Optimizer', 'ewww-image-optimizer' ) . '</a>'
12041
+ );
12042
+ ?>
12043
  </p>
12044
  <?php endif; ?>
12045
  </td>
12158
  <?php endif; ?>
12159
  <?php endif; ?>
12160
  <?php if ( $free_exec ) : ?>
12161
+ <tr id='ewww_image_optimizer_webp_container'>
12162
+ <th scope='row'>
12163
+ <label for='ewww_image_optimizer_webp'><?php esc_html_e( 'WebP Conversion', 'ewww-image-optimizer' ); ?></label>
12164
+ </th>
12165
  <td>
12166
+ <p class='description'><?php esc_html_e( 'Your site needs an API key or Easy IO subscription for WebP conversion.', 'ewww-image-optimizer' ); ?></p>
12167
  </td>
12168
  </tr>
12169
  <?php elseif ( ! ewww_image_optimizer_easy_active() || ewww_image_optimizer_get_option( 'ewww_image_optimizer_webp' ) ) : ?>
12170
+ <tr id='ewww_image_optimizer_webp_container'>
12171
  <th scope='row'>
12172
  <label for='ewww_image_optimizer_webp'><?php esc_html_e( 'WebP Conversion', 'ewww-image-optimizer' ); ?></label>
12173
  <span><?php ewwwio_help_link( 'https://docs.ewww.io/article/16-ewww-io-and-webp-images', '5854745ac697912ffd6c1c89' ); ?></span>
12420
  ?>
12421
  </p>
12422
  </td>
12423
+ </tr>
12424
  <?php endif; ?>
12425
+ <tr id='ewww_image_optimizer_webp_easyio_container' style='display:none;'>
12426
+ <th scope='row'>
12427
+ <label for='ewww_image_optimizer_webp'><?php esc_html_e( 'WebP Conversion', 'ewww-image-optimizer' ); ?></label>
12428
+ </th>
12429
+ <td>
12430
+ <p class='description'><?php esc_html_e( 'WebP images are served automatically by Easy IO.', 'ewww-image-optimizer' ); ?></p>
12431
+ </td>
12432
+ </tr>
12433
  <?php elseif ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) : ?>
12434
+ <tr id='ewww_image_optimizer_webp_easyio_container'>
12435
+ <th scope='row'>
12436
+ <label for='ewww_image_optimizer_webp'><?php esc_html_e( 'WebP Conversion', 'ewww-image-optimizer' ); ?></label>
12437
+ </th>
12438
  <td>
12439
  <p class='description'><?php esc_html_e( 'WebP images are served automatically by Easy IO.', 'ewww-image-optimizer' ); ?></p>
12440
  </td>
12441
  </tr>
12442
  <?php elseif ( get_option( 'easyio_exactdn' ) ) : ?>
12443
  <tr>
12444
+ <th scope='row'>
12445
+ <label for='ewww_image_optimizer_webp'><?php esc_html_e( 'WebP Conversion', 'ewww-image-optimizer' ); ?></label>
12446
+ </th>
12447
  <td>
12448
  <p class='description'><?php esc_html_e( 'WebP images are served automatically by Easy Image Optimizer.', 'ewww-image-optimizer' ); ?></p>
12449
  </td>
12477
  <tr>
12478
  <th scope='row'>
12479
  <label for='ewww_image_optimizer_jpg_level'><?php esc_html_e( 'JPG Optimization Level', 'ewww-image-optimizer' ); ?></label>
12480
+ <?php ewwwio_help_link( 'https://docs.ewww.io/article/102-local-compression-options', '60c24b24a6d12c2cd643e9fb' ); ?>
12481
  </th>
12482
  <td>
12483
  <select id='ewww_image_optimizer_jpg_level' name='ewww_image_optimizer_jpg_level'>
12504
  <tr>
12505
  <th scope='row'>
12506
  <label for='ewww_image_optimizer_png_level'><?php esc_html_e( 'PNG Optimization Level', 'ewww-image-optimizer' ); ?></label>
12507
+ <?php ewwwio_help_link( 'https://docs.ewww.io/article/102-local-compression-options', '60c24b24a6d12c2cd643e9fb' ); ?>
12508
  </th>
12509
  <td>
12510
  <select id='ewww_image_optimizer_png_level' name='ewww_image_optimizer_png_level'>
12531
  <tr>
12532
  <th scope='row'>
12533
  <label for='ewww_image_optimizer_gif_level'><?php esc_html_e( 'GIF Optimization Level', 'ewww-image-optimizer' ); ?></label>
12534
+ <?php ewwwio_help_link( 'https://docs.ewww.io/article/102-local-compression-options', '60c24b24a6d12c2cd643e9fb' ); ?>
12535
  </th>
12536
  <td>
12537
  <select id='ewww_image_optimizer_gif_level' name='ewww_image_optimizer_gif_level'>
12547
  <tr>
12548
  <th scope='row'>
12549
  <label for='ewww_image_optimizer_pdf_level'><?php esc_html_e( 'PDF Optimization Level', 'ewww-image-optimizer' ); ?></label>
12550
+ <?php ewwwio_help_link( 'https://docs.ewww.io/article/102-local-compression-options', '60c24b24a6d12c2cd643e9fb' ); ?>
12551
  </th>
12552
  <td>
12553
  <select id='ewww_image_optimizer_pdf_level' name='ewww_image_optimizer_pdf_level'>
12567
  <tr>
12568
  <th scope='row'>
12569
  <label for='ewww_image_optimizer_svg_level'><?php esc_html_e( 'SVG Optimization Level', 'ewww-image-optimizer' ); ?></label>
12570
+ <?php ewwwio_help_link( 'https://docs.ewww.io/article/102-local-compression-options', '60c24b24a6d12c2cd643e9fb' ); ?>
12571
  </th>
12572
  <td>
12573
  <select id='ewww_image_optimizer_svg_level' name='ewww_image_optimizer_svg_level'>
12608
  <tr>
12609
  <th scope='row'>
12610
  <label for='ewww_image_optimizer_backup_files'><?php esc_html_e( 'Backup Originals', 'ewww-image-optimizer' ); ?></label>
12611
+ <?php ewwwio_help_link( 'https://docs.ewww.io/article/102-local-compression-options', '60c24b24a6d12c2cd643e9fb' ); ?>
12612
  </th>
12613
  <td>
12614
  <input type='checkbox' id='ewww_image_optimizer_backup_files' name='ewww_image_optimizer_backup_files' value='true' <?php checked( ewww_image_optimizer_get_option( 'ewww_image_optimizer_backup_files' ) ); ?> <?php disabled( $disable_level ); ?>>
12986
  <tr>
12987
  <th scope='row'>
12988
  <label for='ewww_image_optimizer_debug'><?php esc_html_e( 'Debugging', 'ewww-image-optimizer' ); ?></label>
 
12989
  </th>
12990
  <td>
12991
  <input type='checkbox' id='ewww_image_optimizer_debug' name='ewww_image_optimizer_debug' value='true' <?php checked( ewww_image_optimizer_get_option( 'ewww_image_optimizer_debug' ) ); ?> />
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.5
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.6
17
  Author URI: https://ewww.io/
18
  License: GPLv3
19
  */
includes/eio-settings.js CHANGED
@@ -7,6 +7,8 @@ jQuery(document).ready(function($) {
7
  $('.ewwwio-premium-setup').show();
8
  } else {
9
  $('.ewwwio-premium-setup').hide();
 
 
10
  }
11
  }
12
  );
@@ -173,6 +175,10 @@ jQuery(document).ready(function($) {
173
  $('#ewwwio-easy-activation-result').show();
174
  $('.ewwwio-exactdn-options input').prop('disabled', false);
175
  $('.ewwwio-exactdn-options').show();
 
 
 
 
176
  }
177
  });
178
  return false;
7
  $('.ewwwio-premium-setup').show();
8
  } else {
9
  $('.ewwwio-premium-setup').hide();
10
+ $('#ewww-image-optimizer-warning-opt-missing').show();
11
+ $('#ewww-image-optimizer-warning-exec').show();
12
  }
13
  }
14
  );
175
  $('#ewwwio-easy-activation-result').show();
176
  $('.ewwwio-exactdn-options input').prop('disabled', false);
177
  $('.ewwwio-exactdn-options').show();
178
+ $('#ewww_image_optimizer_webp_container').hide();
179
+ $('.ewww_image_optimizer_webp_setting_container').hide();
180
+ $('.ewww_image_optimizer_webp_rewrite_setting_container').hide();
181
+ $('#ewww_image_optimizer_webp_easyio_container').show();
182
  }
183
  });
184
  return false;
includes/jquery-ui-1.10.1.custom.css CHANGED
@@ -401,6 +401,20 @@ a.ewww-remove-image, a.ewww-restore-image {
401
  padding-bottom: 0px;
402
  }
403
  /* bulk and settings ui */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
404
  h2.ewww-hndle {
405
  font-size: 14px;
406
  padding: 8px 12px;
401
  padding-bottom: 0px;
402
  }
403
  /* bulk and settings ui */
404
+ #ewww-bulk-credits-available {
405
+ margin-left: 20px;
406
+ padding: 4px 8px;
407
+ position: relative;
408
+ top: -3px;
409
+ border: 1px solid #2271b1;
410
+ border-radius: 2px;
411
+ text-shadow: none;
412
+ font-weight: 600;
413
+ font-size: 13px;
414
+ line-height: normal;
415
+ color: #2271b1;
416
+ background: #f6f7f7;
417
+ }
418
  h2.ewww-hndle {
419
  font-size: 14px;
420
  padding: 8px 12px;
includes/lazysizes-post.js CHANGED
@@ -158,7 +158,7 @@ document.addEventListener('lazybeforeunveil', function(e){
158
  }
159
  if (!shouldAutoScale(target)||!shouldAutoScale(target.parentNode)){
160
  var newSrc = false;
161
- } else if ( window.lazySizes.hC(target,'et_pb_jt_filterable_grid_item_image') || window.lazySizes.hC(target,'ss-foreground-image') ) {
162
  console.log('img that needs a hard crop');
163
  var newSrc = constrainSrc(src,targetWidth,targetHeight,'img-crop');
164
  } else {
158
  }
159
  if (!shouldAutoScale(target)||!shouldAutoScale(target.parentNode)){
160
  var newSrc = false;
161
+ } else if ( window.lazySizes.hC(target,'et_pb_jt_filterable_grid_item_image') || window.lazySizes.hC(target,'ss-foreground-image') || window.lazySizes.hC(target,'img-crop') ) {
162
  console.log('img that needs a hard crop');
163
  var newSrc = constrainSrc(src,targetWidth,targetHeight,'img-crop');
164
  } else {
includes/lazysizes.min.js CHANGED
@@ -1 +1 @@
1
- var ewww_webp_supported=!1;function lazysizesWebP(e,t){var a=new Image;a.onload=function(){ewww_webp_supported=0<a.width&&0<a.height,t()},a.onerror=function(){t()},a.src="data:image/webp;base64,"+{alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"}[e]}function shouldAutoScale(e){if(1==eio_lazy_vars.skip_autoscale)return!1;if(e.hasAttributes())for(var t=e.attributes,a=/skip-autoscale/,i=t.length-1;0<=i;i--){if(a.test(t[i].name))return!1;if(a.test(t[i].value))return!1}return!0}function constrainSrc(e,t,a,i){if(null===e)return e;var r=/w=(\d+)/,n=/fit=(\d+),(\d+)/,o=/resize=(\d+),(\d+)/,s=decodeURIComponent(e);if("undefined"==typeof eio_lazy_vars&&(eio_lazy_vars={exactdn_domain:".exactdn.com"}),0<e.search("\\?")&&0<e.search(eio_lazy_vars.exactdn_domain)){var l=o.exec(s);if(l&&t<l[1])return s.replace(o,"resize="+t+","+a);var d=r.exec(e);if(d&&t<=d[1]){if("bg-cover"!==i&&"img-crop"!==i)return e.replace(r,"w="+t);var c=d[1]-t;return 20<c||a<1080?e.replace(r,"resize="+t+","+a):e}var u=n.exec(s);if(u&&t<u[1]){if("bg-cover"!==i&&"img-crop"!==i)return s.replace(n,"fit="+t+","+a);var f=u[1]-t,A=u[2]-a;return 20<f||20<A?e.replace(r,"resize="+t+","+a):e}if(!d&&!u&&!l)return"img"===i?e+"&fit="+t+","+a:"bg-cover"===i||"img-crop"===i?e+"?resize="+t+","+a:t<a?e+"&h="+a:e+"&w="+t}return-1==e.search("\\?")&&0<e.search(eio_lazy_vars.exactdn_domain)?"img"===i?e+"?fit="+t+","+a:"bg-cover"===i||"img-crop"===i?e+"?resize="+t+","+a:t<a?e+"?h="+a:e+"?w="+t:e}window.lazySizesConfig=window.lazySizesConfig||{},window.lazySizesConfig.init=!1,window.lazySizesConfig.expand=500<document.documentElement.clientHeight&&500<document.documentElement.clientWidth?1e3:740,50<eio_lazy_vars.threshold&&(window.lazySizesConfig.expand=eio_lazy_vars.threshold),function(e,t){var a=function(i,A,n){"use strict";var g,h;if(function(){var e,t={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};for(e in h=i.lazySizesConfig||i.lazysizesConfig||{},t)e in h||(h[e]=t[e])}(),!A||!A.getElementsByClassName)return{init:function(){},cfg:h,noSupport:!0};var z=A.documentElement,r=i.HTMLPictureElement,o="addEventListener",v="getAttribute",e=i[o].bind(i),m=i.setTimeout,a=i.requestAnimationFrame||m,s=i.requestIdleCallback,p=/^picture$/i,l=["load","error","lazyincluded","_lazyloaded"],d={},y=Array.prototype.forEach,c=function(e,t){return d[t]||(d[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),d[t].test(e[v]("class")||"")&&d[t]},b=function(e,t){c(e,t)||e.setAttribute("class",(e[v]("class")||"").trim()+" "+t)},w=function(e,t){var a;(a=c(e,t))&&e.setAttribute("class",(e[v]("class")||"").replace(a," "))},_=function(t,a,e){var i=e?o:"removeEventListener";e&&_(t,a),l.forEach(function(e){t[i](e,a)})},C=function(e,t,a,i,r){var n=A.createEvent("Event");return a||(a={}),a.instance=g,n.initEvent(t,!i,!r),n.detail=a,e.dispatchEvent(n),n},E=function(e,t){var a;!r&&(a=i.picturefill||h.pf)?(t&&t.src&&!e[v]("srcset")&&e.setAttribute("srcset",t.src),a({reevaluate:!0,elements:[e]})):t&&t.src&&(e.src=t.src)},u=function(e,t){return(getComputedStyle(e,null)||{})[t]},f=function(e,t,a){for(a=a||e.offsetWidth;a<h.minSize&&t&&!e._lazysizesWidth;)a=t.offsetWidth,t=t.parentNode;return a},S=(we=[],_e=[],Ce=we,Ee=function(){var e=Ce;for(Ce=we.length?_e:we,be=!(ye=!0);e.length;)e.shift()();ye=!1},Se=function(e,t){ye&&!t?e.apply(this,arguments):(Ce.push(e),be||(be=!0,(A.hidden?m:a)(Ee)))},Se._lsFlush=Ee,Se),t=function(a,e){return e?function(){S(a)}:function(){var e=this,t=arguments;S(function(){a.apply(e,t)})}},W=function(e){var t,a,i=function(){t=null,e()},r=function(){var e=n.now()-a;e<99?m(r,99-e):(s||i)(i)};return function(){a=n.now(),t||(t=m(r,99))}},x=(ee=/^img$/i,te=/^iframe$/i,ae="onscroll"in i&&!/(gle|ing)bot/.test(navigator.userAgent),ie=0,re=0,ne=-1,oe=function(e){re--,(!e||re<0||!e.target)&&(re=0)},se=function(e){return null==$&&($="hidden"==u(A.body,"visibility")),$||!("hidden"==u(e.parentNode,"visibility")&&"hidden"==u(e,"visibility"))},le=function(e,t){var a,i=e,r=se(e);for(I-=t,G+=t,J-=t,O+=t;r&&(i=i.offsetParent)&&i!=A.body&&i!=z;)(r=0<(u(i,"opacity")||1))&&"visible"!=u(i,"overflow")&&(a=i.getBoundingClientRect(),r=O>a.left&&J<a.right&&G>a.top-1&&I<a.bottom+1);return r},de=function(){var e,t,a,i,r,n,o,s,l,d,c,u,f=g.elements;if((D=h.loadMode)&&re<8&&(e=f.length)){for(t=0,ne++;t<e;t++)if(f[t]&&!f[t]._lazyRace)if(!ae||g.prematureUnveil&&g.prematureUnveil(f[t]))ze(f[t]);else if((s=f[t][v]("data-expand"))&&(n=1*s)||(n=ie),d||(d=!h.expand||h.expand<1?500<z.clientHeight&&500<z.clientWidth?500:370:h.expand,g._defEx=d,c=d*h.expFactor,u=h.hFac,$=null,ie<c&&re<1&&2<ne&&2<D&&!A.hidden?(ie=c,ne=0):ie=1<D&&1<ne&&re<6?d:0),l!==n&&(U=innerWidth+n*u,F=innerHeight+n,o=-1*n,l=n),a=f[t].getBoundingClientRect(),(G=a.bottom)>=o&&(I=a.top)<=F&&(O=a.right)>=o*u&&(J=a.left)<=U&&(G||O||J||I)&&(h.loadHidden||se(f[t]))&&(P&&re<3&&!s&&(D<3||ne<4)||le(f[t],n))){if(ze(f[t]),r=!0,9<re)break}else!r&&P&&!i&&re<4&&ne<4&&2<D&&(k[0]||h.preloadAfterLoad)&&(k[0]||!s&&(G||O||J||I||"auto"!=f[t][v](h.sizesAttr)))&&(i=k[0]||f[t]);i&&!r&&ze(i)}},q=de,V=0,X=h.throttleDelay,Y=h.ricTimeout,K=function(){j=!1,V=n.now(),q()},Z=s&&49<Y?function(){s(K,{timeout:Y}),Y!==h.ricTimeout&&(Y=h.ricTimeout)}:t(function(){m(K)},!0),ce=function(e){var t;(e=!0===e)&&(Y=33),j||(j=!0,(t=X-(n.now()-V))<0&&(t=0),e||t<9?Z():m(Z,t))},ue=function(e){var t=e.target;t._lazyCache?delete t._lazyCache:(oe(e),b(t,h.loadedClass),w(t,h.loadingClass),_(t,Ae),C(t,"lazyloaded"))},fe=t(ue),Ae=function(e){fe({target:e.target})},ge=function(e){var t,a=e[v](h.srcsetAttr);(t=h.customMedia[e[v]("data-media")||e[v]("media")])&&e.setAttribute("media",t),a&&e.setAttribute("srcset",a)},he=t(function(t,e,a,i,r){var n,o,s,l,d,c,u,f,A;(d=C(t,"lazybeforeunveil",e)).defaultPrevented||(i&&(a?b(t,h.autosizesClass):t.setAttribute("sizes",i)),o=t[v](h.srcsetAttr),n=t[v](h.srcAttr),r&&(s=t.parentNode,l=s&&p.test(s.nodeName||"")),c=e.firesLoad||"src"in t&&(o||n||l),d={target:t},b(t,h.loadingClass),c&&(clearTimeout(H),H=m(oe,2500),_(t,Ae,!0)),l&&y.call(s.getElementsByTagName("source"),ge),o?t.setAttribute("srcset",o):n&&!l&&(te.test(t.nodeName)?(f=n,0==(A=(u=t).getAttribute("data-load-mode")||h.iframeLoadMode)?u.contentWindow.location.replace(f):1==A&&(u.src=f)):t.src=n),r&&(o||l)&&E(t,{src:n})),t._lazyRace&&delete t._lazyRace,w(t,h.lazyClass),S(function(){var e=t.complete&&1<t.naturalWidth;c&&!e||(e&&b(t,h.fastLoadedClass),ue(d),t._lazyCache=!0,m(function(){"_lazyCache"in t&&delete t._lazyCache},9)),"lazy"==t.loading&&re--},!0)}),ze=function(e){if(!e._lazyRace){var t,a=ee.test(e.nodeName),i=a&&(e[v](h.sizesAttr)||e[v]("sizes")),r="auto"==i;(!r&&P||!a||!e[v]("src")&&!e.srcset||e.complete||c(e,h.errorClass)||!c(e,h.lazyClass))&&(t=C(e,"lazyunveilread").detail,r&&M.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,re++,he(e,t,r,i,a))}},ve=W(function(){h.loadMode=3,ce()}),me=function(){3==h.loadMode&&(h.loadMode=2),ve()},pe=function(){P||(n.now()-T<999?m(pe,999):(P=!0,h.loadMode=3,ce(),e("scroll",me,!0)))},{_:function(){T=n.now(),g.elements=A.getElementsByClassName(h.lazyClass),k=A.getElementsByClassName(h.lazyClass+" "+h.preloadClass),e("scroll",ce,!0),e("resize",ce,!0),e("pageshow",function(e){if(e.persisted){var t=A.querySelectorAll("."+h.loadingClass);t.length&&t.forEach&&a(function(){t.forEach(function(e){e.complete&&ze(e)})})}}),i.MutationObserver?new MutationObserver(ce).observe(z,{childList:!0,subtree:!0,attributes:!0}):(z[o]("DOMNodeInserted",ce,!0),z[o]("DOMAttrModified",ce,!0),setInterval(ce,999)),e("hashchange",ce,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){A[o](e,ce,!0)}),/d$|^c/.test(A.readyState)?pe():(e("load",pe),A[o]("DOMContentLoaded",ce),m(pe,2e4)),g.elements.length?(de(),S._lsFlush()):ce()},checkElems:ce,unveil:ze,_aLSL:me}),M=(N=t(function(e,t,a,i){var r,n,o;if(e._lazysizesWidth=i,i+="px",e.setAttribute("sizes",i),p.test(t.nodeName||""))for(r=t.getElementsByTagName("source"),n=0,o=r.length;n<o;n++)r[n].setAttribute("sizes",i);a.detail.dataAttr||E(e,a.detail)}),R=function(e,t,a){var i,r=e.parentNode;r&&(a=f(e,r,a),(i=C(e,"lazybeforesizes",{width:a,dataAttr:!!t})).defaultPrevented||(a=i.detail.width)&&a!==e._lazysizesWidth&&N(e,r,i,a))},Q=W(function(){var e,t=L.length;if(t)for(e=0;e<t;e++)R(L[e])}),{_:function(){L=A.getElementsByClassName(h.autosizesClass),e("resize",Q)},checkElems:Q,updateElem:R}),B=function(){!B.i&&A.getElementsByClassName&&(B.i=!0,M._(),x._())};var L,N,R,Q;var k,P,H,D,T,U,F,I,J,O,G,$,q,j,V,X,Y,K,Z,ee,te,ae,ie,re,ne,oe,se,le,de,ce,ue,fe,Ae,ge,he,ze,ve,me,pe;var ye,be,we,_e,Ce,Ee,Se;return m(function(){h.init&&B()}),g={cfg:h,autoSizer:M,loader:x,init:B,uP:E,aC:b,rC:w,hC:c,fire:C,gW:f,rAF:S}}(e,e.document,Date);e.lazySizes=a,"object"==typeof module&&module.exports&&(module.exports=a)}("undefined"!=typeof window?window:{}),lazysizesWebP("alpha",lazySizes.init),document.addEventListener("lazybeforesizes",function(e){e.target.getAttribute("data-src");void 0!==e.target._lazysizesWidth&&e.detail.width<e.target._lazysizesWidth&&(e.detail.width=e.target._lazysizesWidth)}),document.addEventListener("lazybeforeunveil",function(e){var t=e.target,a=t.getAttribute("data-srcset");if(t.naturalWidth&&!a&&1<t.naturalWidth&&1<t.naturalHeight){var i=window.devicePixelRatio||1,r=t.naturalWidth,n=t.naturalHeight,o=t.getAttribute("data-eio-rwidth"),s=t.getAttribute("data-eio-rheight");o&&r<o&&(r=o,n=s);var l=t.clientWidth&&1.25*t.clientWidth<r,d=t.clientHeight&&1.25*t.clientHeight<n;if(l||d){var c=Math.round(t.offsetWidth*i),u=Math.round(t.offsetHeight*i),f=t.getAttribute("data-src"),A=t.getAttribute("data-src-webp");if(ewww_webp_supported&&A&&-1==f.search("webp=1")&&(f=A),shouldAutoScale(t)&&shouldAutoScale(t.parentNode))if(window.lazySizes.hC(t,"et_pb_jt_filterable_grid_item_image")||window.lazySizes.hC(t,"ss-foreground-image"))g=constrainSrc(f,c,u,"img-crop");else g=constrainSrc(f,c,u,"img");else var g=!1;g&&f!=g&&t.setAttribute("data-src",g)}}if(ewww_webp_supported){if(a){var h=t.getAttribute("data-srcset-webp");h&&t.setAttribute("data-srcset",h)}if(!(A=t.getAttribute("data-src-webp")))return;t.setAttribute("data-src",A)}}),function(e,t){var a=function(){t(e.lazySizes),e.removeEventListener("lazyunveilread",a,!0)};t=t.bind(null,e,e.document),"object"==typeof module&&module.exports?t(require("lazysizes")):e.lazySizes?a():e.addEventListener("lazyunveilread",a,!0)}(window,function(o,e,s){"use strict";var l;e.addEventListener&&(l=/\(|\)|\s|'/,addEventListener("lazybeforeunveil",function(e){var t,a;if(e.detail.instance==s&&(!e.defaultPrevented&&("none"==e.target.preload&&(e.target.preload="auto"),t=e.target.getAttribute("data-bg")))){ewww_webp_supported&&(a=e.target.getAttribute("data-bg-webp"))&&(t=a);var i=o.devicePixelRatio||1,r=Math.round(e.target.offsetWidth*i),n=Math.round(e.target.offsetHeight*i);shouldAutoScale(e.target)&&shouldAutoScale(e.target.parentNode)&&(t=o.lazySizes.hC(e.target,"wp-block-cover")?(o.lazySizes.hC(e.target,"has-parallax")&&(r=Math.round(o.screen.width*i),n=Math.round(o.screen.height*i)),constrainSrc(t,r,n,"bg-cover")):o.lazySizes.hC(e.target,"elementor-bg")?constrainSrc(t,r,n,"bg-cover"):constrainSrc(t,r,n,"bg")),e.target.style.backgroundImage="url("+(l.test(t)?JSON.stringify(t):t)+")"}},!1))});
1
+ var ewww_webp_supported=!1;function lazysizesWebP(e,t){var a=new Image;a.onload=function(){ewww_webp_supported=0<a.width&&0<a.height,t()},a.onerror=function(){t()},a.src="data:image/webp;base64,"+{alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"}[e]}function shouldAutoScale(e){if(1==eio_lazy_vars.skip_autoscale)return!1;if(e.hasAttributes())for(var t=e.attributes,a=/skip-autoscale/,i=t.length-1;0<=i;i--){if(a.test(t[i].name))return!1;if(a.test(t[i].value))return!1}return!0}function constrainSrc(e,t,a,i){if(null===e)return e;var r=/w=(\d+)/,n=/fit=(\d+),(\d+)/,o=/resize=(\d+),(\d+)/,s=decodeURIComponent(e);if("undefined"==typeof eio_lazy_vars&&(eio_lazy_vars={exactdn_domain:".exactdn.com"}),0<e.search("\\?")&&0<e.search(eio_lazy_vars.exactdn_domain)){var l=o.exec(s);if(l&&t<l[1])return s.replace(o,"resize="+t+","+a);var d=r.exec(e);if(d&&t<=d[1]){if("bg-cover"!==i&&"img-crop"!==i)return e.replace(r,"w="+t);var c=d[1]-t;return 20<c||a<1080?e.replace(r,"resize="+t+","+a):e}var u=n.exec(s);if(u&&t<u[1]){if("bg-cover"!==i&&"img-crop"!==i)return s.replace(n,"fit="+t+","+a);var f=u[1]-t,A=u[2]-a;return 20<f||20<A?e.replace(r,"resize="+t+","+a):e}if(!d&&!u&&!l)return"img"===i?e+"&fit="+t+","+a:"bg-cover"===i||"img-crop"===i?e+"?resize="+t+","+a:t<a?e+"&h="+a:e+"&w="+t}return-1==e.search("\\?")&&0<e.search(eio_lazy_vars.exactdn_domain)?"img"===i?e+"?fit="+t+","+a:"bg-cover"===i||"img-crop"===i?e+"?resize="+t+","+a:t<a?e+"?h="+a:e+"?w="+t:e}window.lazySizesConfig=window.lazySizesConfig||{},window.lazySizesConfig.init=!1,window.lazySizesConfig.expand=500<document.documentElement.clientHeight&&500<document.documentElement.clientWidth?1e3:740,50<eio_lazy_vars.threshold&&(window.lazySizesConfig.expand=eio_lazy_vars.threshold),function(e,t){var a=function(i,A,n){"use strict";var g,h;if(function(){var e,t={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};for(e in h=i.lazySizesConfig||i.lazysizesConfig||{},t)e in h||(h[e]=t[e])}(),!A||!A.getElementsByClassName)return{init:function(){},cfg:h,noSupport:!0};var z=A.documentElement,r=i.HTMLPictureElement,o="addEventListener",m="getAttribute",e=i[o].bind(i),v=i.setTimeout,a=i.requestAnimationFrame||v,s=i.requestIdleCallback,p=/^picture$/i,l=["load","error","lazyincluded","_lazyloaded"],d={},y=Array.prototype.forEach,c=function(e,t){return d[t]||(d[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),d[t].test(e[m]("class")||"")&&d[t]},b=function(e,t){c(e,t)||e.setAttribute("class",(e[m]("class")||"").trim()+" "+t)},w=function(e,t){var a;(a=c(e,t))&&e.setAttribute("class",(e[m]("class")||"").replace(a," "))},_=function(t,a,e){var i=e?o:"removeEventListener";e&&_(t,a),l.forEach(function(e){t[i](e,a)})},C=function(e,t,a,i,r){var n=A.createEvent("Event");return a||(a={}),a.instance=g,n.initEvent(t,!i,!r),n.detail=a,e.dispatchEvent(n),n},S=function(e,t){var a;!r&&(a=i.picturefill||h.pf)?(t&&t.src&&!e[m]("srcset")&&e.setAttribute("srcset",t.src),a({reevaluate:!0,elements:[e]})):t&&t.src&&(e.src=t.src)},u=function(e,t){return(getComputedStyle(e,null)||{})[t]},f=function(e,t,a){for(a=a||e.offsetWidth;a<h.minSize&&t&&!e._lazysizesWidth;)a=t.offsetWidth,t=t.parentNode;return a},E=(we=[],_e=[],Ce=we,Se=function(){var e=Ce;for(Ce=we.length?_e:we,be=!(ye=!0);e.length;)e.shift()();ye=!1},Ee=function(e,t){ye&&!t?e.apply(this,arguments):(Ce.push(e),be||(be=!0,(A.hidden?v:a)(Se)))},Ee._lsFlush=Se,Ee),t=function(a,e){return e?function(){E(a)}:function(){var e=this,t=arguments;E(function(){a.apply(e,t)})}},W=function(e){var t,a,i=function(){t=null,e()},r=function(){var e=n.now()-a;e<99?v(r,99-e):(s||i)(i)};return function(){a=n.now(),t||(t=v(r,99))}},x=(ee=/^img$/i,te=/^iframe$/i,ae="onscroll"in i&&!/(gle|ing)bot/.test(navigator.userAgent),ie=0,re=0,ne=-1,oe=function(e){re--,(!e||re<0||!e.target)&&(re=0)},se=function(e){return null==$&&($="hidden"==u(A.body,"visibility")),$||!("hidden"==u(e.parentNode,"visibility")&&"hidden"==u(e,"visibility"))},le=function(e,t){var a,i=e,r=se(e);for(I-=t,G+=t,J-=t,O+=t;r&&(i=i.offsetParent)&&i!=A.body&&i!=z;)(r=0<(u(i,"opacity")||1))&&"visible"!=u(i,"overflow")&&(a=i.getBoundingClientRect(),r=O>a.left&&J<a.right&&G>a.top-1&&I<a.bottom+1);return r},de=function(){var e,t,a,i,r,n,o,s,l,d,c,u,f=g.elements;if((D=h.loadMode)&&re<8&&(e=f.length)){for(t=0,ne++;t<e;t++)if(f[t]&&!f[t]._lazyRace)if(!ae||g.prematureUnveil&&g.prematureUnveil(f[t]))ze(f[t]);else if((s=f[t][m]("data-expand"))&&(n=1*s)||(n=ie),d||(d=!h.expand||h.expand<1?500<z.clientHeight&&500<z.clientWidth?500:370:h.expand,g._defEx=d,c=d*h.expFactor,u=h.hFac,$=null,ie<c&&re<1&&2<ne&&2<D&&!A.hidden?(ie=c,ne=0):ie=1<D&&1<ne&&re<6?d:0),l!==n&&(U=innerWidth+n*u,F=innerHeight+n,o=-1*n,l=n),a=f[t].getBoundingClientRect(),(G=a.bottom)>=o&&(I=a.top)<=F&&(O=a.right)>=o*u&&(J=a.left)<=U&&(G||O||J||I)&&(h.loadHidden||se(f[t]))&&(P&&re<3&&!s&&(D<3||ne<4)||le(f[t],n))){if(ze(f[t]),r=!0,9<re)break}else!r&&P&&!i&&re<4&&ne<4&&2<D&&(k[0]||h.preloadAfterLoad)&&(k[0]||!s&&(G||O||J||I||"auto"!=f[t][m](h.sizesAttr)))&&(i=k[0]||f[t]);i&&!r&&ze(i)}},q=de,V=0,X=h.throttleDelay,Y=h.ricTimeout,K=function(){j=!1,V=n.now(),q()},Z=s&&49<Y?function(){s(K,{timeout:Y}),Y!==h.ricTimeout&&(Y=h.ricTimeout)}:t(function(){v(K)},!0),ce=function(e){var t;(e=!0===e)&&(Y=33),j||(j=!0,(t=X-(n.now()-V))<0&&(t=0),e||t<9?Z():v(Z,t))},ue=function(e){var t=e.target;t._lazyCache?delete t._lazyCache:(oe(e),b(t,h.loadedClass),w(t,h.loadingClass),_(t,Ae),C(t,"lazyloaded"))},fe=t(ue),Ae=function(e){fe({target:e.target})},ge=function(e){var t,a=e[m](h.srcsetAttr);(t=h.customMedia[e[m]("data-media")||e[m]("media")])&&e.setAttribute("media",t),a&&e.setAttribute("srcset",a)},he=t(function(t,e,a,i,r){var n,o,s,l,d,c,u,f,A;(d=C(t,"lazybeforeunveil",e)).defaultPrevented||(i&&(a?b(t,h.autosizesClass):t.setAttribute("sizes",i)),o=t[m](h.srcsetAttr),n=t[m](h.srcAttr),r&&(s=t.parentNode,l=s&&p.test(s.nodeName||"")),c=e.firesLoad||"src"in t&&(o||n||l),d={target:t},b(t,h.loadingClass),c&&(clearTimeout(H),H=v(oe,2500),_(t,Ae,!0)),l&&y.call(s.getElementsByTagName("source"),ge),o?t.setAttribute("srcset",o):n&&!l&&(te.test(t.nodeName)?(f=n,0==(A=(u=t).getAttribute("data-load-mode")||h.iframeLoadMode)?u.contentWindow.location.replace(f):1==A&&(u.src=f)):t.src=n),r&&(o||l)&&S(t,{src:n})),t._lazyRace&&delete t._lazyRace,w(t,h.lazyClass),E(function(){var e=t.complete&&1<t.naturalWidth;c&&!e||(e&&b(t,h.fastLoadedClass),ue(d),t._lazyCache=!0,v(function(){"_lazyCache"in t&&delete t._lazyCache},9)),"lazy"==t.loading&&re--},!0)}),ze=function(e){if(!e._lazyRace){var t,a=ee.test(e.nodeName),i=a&&(e[m](h.sizesAttr)||e[m]("sizes")),r="auto"==i;(!r&&P||!a||!e[m]("src")&&!e.srcset||e.complete||c(e,h.errorClass)||!c(e,h.lazyClass))&&(t=C(e,"lazyunveilread").detail,r&&M.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,re++,he(e,t,r,i,a))}},me=W(function(){h.loadMode=3,ce()}),ve=function(){3==h.loadMode&&(h.loadMode=2),me()},pe=function(){P||(n.now()-T<999?v(pe,999):(P=!0,h.loadMode=3,ce(),e("scroll",ve,!0)))},{_:function(){T=n.now(),g.elements=A.getElementsByClassName(h.lazyClass),k=A.getElementsByClassName(h.lazyClass+" "+h.preloadClass),e("scroll",ce,!0),e("resize",ce,!0),e("pageshow",function(e){if(e.persisted){var t=A.querySelectorAll("."+h.loadingClass);t.length&&t.forEach&&a(function(){t.forEach(function(e){e.complete&&ze(e)})})}}),i.MutationObserver?new MutationObserver(ce).observe(z,{childList:!0,subtree:!0,attributes:!0}):(z[o]("DOMNodeInserted",ce,!0),z[o]("DOMAttrModified",ce,!0),setInterval(ce,999)),e("hashchange",ce,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){A[o](e,ce,!0)}),/d$|^c/.test(A.readyState)?pe():(e("load",pe),A[o]("DOMContentLoaded",ce),v(pe,2e4)),g.elements.length?(de(),E._lsFlush()):ce()},checkElems:ce,unveil:ze,_aLSL:ve}),M=(N=t(function(e,t,a,i){var r,n,o;if(e._lazysizesWidth=i,i+="px",e.setAttribute("sizes",i),p.test(t.nodeName||""))for(r=t.getElementsByTagName("source"),n=0,o=r.length;n<o;n++)r[n].setAttribute("sizes",i);a.detail.dataAttr||S(e,a.detail)}),R=function(e,t,a){var i,r=e.parentNode;r&&(a=f(e,r,a),(i=C(e,"lazybeforesizes",{width:a,dataAttr:!!t})).defaultPrevented||(a=i.detail.width)&&a!==e._lazysizesWidth&&N(e,r,i,a))},Q=W(function(){var e,t=L.length;if(t)for(e=0;e<t;e++)R(L[e])}),{_:function(){L=A.getElementsByClassName(h.autosizesClass),e("resize",Q)},checkElems:Q,updateElem:R}),B=function(){!B.i&&A.getElementsByClassName&&(B.i=!0,M._(),x._())};var L,N,R,Q;var k,P,H,D,T,U,F,I,J,O,G,$,q,j,V,X,Y,K,Z,ee,te,ae,ie,re,ne,oe,se,le,de,ce,ue,fe,Ae,ge,he,ze,me,ve,pe;var ye,be,we,_e,Ce,Se,Ee;return v(function(){h.init&&B()}),g={cfg:h,autoSizer:M,loader:x,init:B,uP:S,aC:b,rC:w,hC:c,fire:C,gW:f,rAF:E}}(e,e.document,Date);e.lazySizes=a,"object"==typeof module&&module.exports&&(module.exports=a)}("undefined"!=typeof window?window:{}),lazysizesWebP("alpha",lazySizes.init),document.addEventListener("lazybeforesizes",function(e){e.target.getAttribute("data-src");void 0!==e.target._lazysizesWidth&&e.detail.width<e.target._lazysizesWidth&&(e.detail.width=e.target._lazysizesWidth)}),document.addEventListener("lazybeforeunveil",function(e){var t=e.target,a=t.getAttribute("data-srcset");if(t.naturalWidth&&!a&&1<t.naturalWidth&&1<t.naturalHeight){var i=window.devicePixelRatio||1,r=t.naturalWidth,n=t.naturalHeight,o=t.getAttribute("data-eio-rwidth"),s=t.getAttribute("data-eio-rheight");o&&r<o&&(r=o,n=s);var l=t.clientWidth&&1.25*t.clientWidth<r,d=t.clientHeight&&1.25*t.clientHeight<n;if(l||d){var c=Math.round(t.offsetWidth*i),u=Math.round(t.offsetHeight*i),f=t.getAttribute("data-src"),A=t.getAttribute("data-src-webp");if(ewww_webp_supported&&A&&-1==f.search("webp=1")&&(f=A),shouldAutoScale(t)&&shouldAutoScale(t.parentNode))if(window.lazySizes.hC(t,"et_pb_jt_filterable_grid_item_image")||window.lazySizes.hC(t,"ss-foreground-image")||window.lazySizes.hC(t,"img-crop"))g=constrainSrc(f,c,u,"img-crop");else g=constrainSrc(f,c,u,"img");else var g=!1;g&&f!=g&&t.setAttribute("data-src",g)}}if(ewww_webp_supported){if(a){var h=t.getAttribute("data-srcset-webp");h&&t.setAttribute("data-srcset",h)}if(!(A=t.getAttribute("data-src-webp")))return;t.setAttribute("data-src",A)}}),function(e,t){var a=function(){t(e.lazySizes),e.removeEventListener("lazyunveilread",a,!0)};t=t.bind(null,e,e.document),"object"==typeof module&&module.exports?t(require("lazysizes")):e.lazySizes?a():e.addEventListener("lazyunveilread",a,!0)}(window,function(o,e,s){"use strict";var l;e.addEventListener&&(l=/\(|\)|\s|'/,addEventListener("lazybeforeunveil",function(e){var t,a;if(e.detail.instance==s&&(!e.defaultPrevented&&("none"==e.target.preload&&(e.target.preload="auto"),t=e.target.getAttribute("data-bg")))){ewww_webp_supported&&(a=e.target.getAttribute("data-bg-webp"))&&(t=a);var i=o.devicePixelRatio||1,r=Math.round(e.target.offsetWidth*i),n=Math.round(e.target.offsetHeight*i);shouldAutoScale(e.target)&&shouldAutoScale(e.target.parentNode)&&(t=o.lazySizes.hC(e.target,"wp-block-cover")?(o.lazySizes.hC(e.target,"has-parallax")&&(r=Math.round(o.screen.width*i),n=Math.round(o.screen.height*i)),constrainSrc(t,r,n,"bg-cover")):o.lazySizes.hC(e.target,"elementor-bg")?constrainSrc(t,r,n,"bg-cover"):constrainSrc(t,r,n,"bg")),e.target.style.backgroundImage="url("+(l.test(t)?JSON.stringify(t):t)+")"}},!1))});
includes/resize_detection.js CHANGED
@@ -20,6 +20,13 @@ function checkImageSizes() {
20
  return false;
21
  }
22
  function checkImageScale(img) {
 
 
 
 
 
 
 
23
  console.log('checking size of: ' + img.src);
24
  if (img.naturalWidth) {
25
  if (img.naturalWidth > 25 && img.naturalHeight > 25 && img.clientWidth > 25 && img.clientHeight > 25) {
20
  return false;
21
  }
22
  function checkImageScale(img) {
23
+ if (!img.src) {
24
+ return;
25
+ }
26
+ if ('string' == typeof img.src && img.src.search(/\.svg/) > -1) {
27
+ console.log('not checking size of SVG: ' + img.src);
28
+ return;
29
+ }
30
  console.log('checking size of: ' + img.src);
31
  if (img.naturalWidth) {
32
  if (img.naturalWidth > 25 && img.naturalHeight > 25 && img.clientWidth > 25 && img.clientHeight > 25) {
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.5
9
  License: GPLv3
10
 
11
  Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
@@ -50,7 +50,7 @@ Configure any folder within your WordPress install to be optimized. The Bulk Opt
50
 
51
  = Plugin Compatibility =
52
 
53
- EWWW IO has been tested with hundreds (if not thousands) of [plugins and themes](https://docs.ewww.io/article/84-plugin-compatibility), here are just a few of the most common ones: BuddyPress (Activity Plus add-on too), Cloudinary, Easy Watermark, FileBird, FooGallery, GD bbPress Attachments, GRAND FlAGallery, Gmedia Photo Gallery, MediaPress, Meta Slider, Microsoft Azure Storage, MyArcadePlugin, NextGEN Gallery, Regenerate Thumbnails, WP Offload Media, [WPML](https://wpml.org/plugin/ewww-image-optimizer/), WP Retina 2x, WP RSS Aggregator, WP Symposium. [Read more...](https://docs.ewww.io/article/84-plugin-compatibility)
54
 
55
  = WebP Images =
56
 
@@ -132,6 +132,14 @@ 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.5 =
136
  * changed: use core wp_getimagesize() for proper error handling
137
  * fixed: prevent erasing title attributes for admin users when Lazy Load and Resize Detection are enabled
5
  Requires at least: 5.4
6
  Tested up to: 5.7
7
  Requires PHP: 7.1
8
+ Stable tag: 6.1.6
9
  License: GPLv3
10
 
11
  Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
50
 
51
  = Plugin Compatibility =
52
 
53
+ EWWW IO has been tested with hundreds (if not thousands) of [plugins and themes](https://docs.ewww.io/article/84-plugin-compatibility), here are just a few of the most common ones: BuddyPress (Activity Plus add-on too), Cloudinary, Easy Watermark, FileBird, FooGallery, GD bbPress Attachments, GRAND FlAGallery, Gmedia Photo Gallery, MediaPress, Meta Slider, Microsoft Azure Storage, MyArcadePlugin, NextGEN Gallery, Regenerate Thumbnails, [Weglot](https://weglot.com/integrations/wordpress-translation-plugin/demo/), WP Offload Media, [WPML](https://wpml.org/plugin/ewww-image-optimizer/), WP Retina 2x, WP RSS Aggregator, WP Symposium. [Read more...](https://docs.ewww.io/article/84-plugin-compatibility)
54
 
55
  = WebP Images =
56
 
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.6 =
136
+ * added: support for BuddyPress uploads via Vikinger theme.
137
+ * added: compatibility with Weglot.
138
+ * added: use 'img-crop' id/class, or data-img-crop attribute to force cropping with Easy IO + Lazy Load.
139
+ * changed: Resize Existing enabled by default for new installs.
140
+ * changed: Lazy Load JS moved to footer
141
+ * fixed: prevent Resize Detection from flagging SVG files.
142
+
143
  = 6.1.5 =
144
  * changed: use core wp_getimagesize() for proper error handling
145
  * fixed: prevent erasing title attributes for admin users when Lazy Load and Resize Detection are enabled
unique.php CHANGED
@@ -51,7 +51,9 @@ function ewww_image_optimizer_exec_init() {
51
  if ( EWWW_IMAGE_OPTIMIZER_CLOUD ) {
52
  ewwwio_debug_message( 'cloud options enabled, shutting off binaries' );
53
  ewww_image_optimizer_disable_tools();
54
- } elseif (
 
 
55
  defined( 'WPCOMSH_VERSION' ) ||
56
  ! empty( $_ENV['PANTHEON_ENVIRONMENT'] ) ||
57
  defined( 'WPE_PLUGIN_VERSION' ) ||
@@ -61,7 +63,8 @@ function ewww_image_optimizer_exec_init() {
61
  ) {
62
  if (
63
  ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) &&
64
- ( ! is_object( $exactdn ) || ! $exactdn->get_exactdn_domain() )
 
65
  ) {
66
  add_action( 'network_admin_notices', 'ewww_image_optimizer_notice_hosting_requires_api' );
67
  add_action( 'admin_notices', 'ewww_image_optimizer_notice_hosting_requires_api' );
@@ -71,23 +74,46 @@ function ewww_image_optimizer_exec_init() {
71
  }
72
  ewwwio_debug_message( 'WPE/wp.com/pantheon/flywheel site, disabling tools' );
73
  ewww_image_optimizer_disable_tools();
74
- // Check if this is an unsupported OS (not Linux or Mac OSX or FreeBSD or Windows or SunOS).
75
- } elseif ( 'Linux' !== PHP_OS && 'Darwin' !== PHP_OS && 'FreeBSD' !== PHP_OS && 'WINNT' !== PHP_OS && 'SunOS' !== PHP_OS ) {
 
 
 
 
 
 
 
 
 
 
 
 
76
  // Call the function to display a notice.
77
  add_action( 'network_admin_notices', 'ewww_image_optimizer_notice_os' );
78
  add_action( 'admin_notices', 'ewww_image_optimizer_notice_os' );
79
  // Turn off all the tools.
80
  ewwwio_debug_message( 'unsupported OS, disabling tools: ' . PHP_OS );
81
  ewww_image_optimizer_disable_tools();
82
- } else {
83
- add_action( 'load-upload.php', 'ewww_image_optimizer_tool_init', 9 );
84
- add_action( 'load-media-new.php', 'ewww_image_optimizer_tool_init' );
85
- add_action( 'load-media_page_ewww-image-optimizer-bulk', 'ewww_image_optimizer_tool_init' );
86
- add_action( 'load-settings_page_ewww-image-optimizer-options', 'ewww_image_optimizer_tool_init' );
87
- add_action( 'load-plugins.php', 'ewww_image_optimizer_tool_init' );
88
- add_action( 'load-ims_gallery_page_ewww-ims-optimize', 'ewww_image_optimizer_tool_init' );
89
  }
90
- ewwwio_memory( __FUNCTION__ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  }
92
 
93
  /**
@@ -125,6 +151,7 @@ function ewww_image_optimizer_set_defaults() {
125
  add_option( 'ewww_image_optimizer_svg_level', '0' );
126
  add_option( 'ewww_image_optimizer_jpg_quality', '' );
127
  add_option( 'ewww_image_optimizer_webp_quality', '' );
 
128
  add_option( 'ewww_image_optimizer_exactdn', false );
129
  add_option( 'ewww_image_optimizer_exactdn_plan_id', 0 );
130
  add_option( 'exactdn_all_the_things', true );
@@ -152,6 +179,7 @@ function ewww_image_optimizer_set_defaults() {
152
  add_site_option( 'ewww_image_optimizer_svg_level', '0' );
153
  add_site_option( 'ewww_image_optimizer_jpg_quality', '' );
154
  add_site_option( 'ewww_image_optimizer_webp_quality', '' );
 
155
  add_site_option( 'ewww_image_optimizer_disable_pngout', true );
156
  add_site_option( 'ewww_image_optimizer_disable_svgcleaner', true );
157
  add_site_option( 'ewww_image_optimizer_optipng_level', 2 );
@@ -588,7 +616,7 @@ function ewww_image_optimizer_notice_utils( $quiet = null ) {
588
  ob_start();
589
  // Display a warning if exec() is disabled, can't run local tools without it.
590
  echo "<div id='ewww-image-optimizer-warning-exec' class='notice notice-warning is-dismissible'><p>" .
591
- esc_html__( 'Sites where the exec() function is banned require cloud-based optimization, because free server-based optimization will not work. Those who upgrade to our premium service receive much higher compression, PNG/GIF/PDF compression, WebP conversion, and image backups.', 'ewww-image-optimizer' ) . '<br>' .
592
  '<strong>' .
593
  ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) || get_option( 'easyio_exactdn' ) ?
594
  esc_html__( 'Sites that use Easy IO already have built-in image optimization and may dismiss this notice to disable local compression.', 'ewww-image-optimizer' )
51
  if ( EWWW_IMAGE_OPTIMIZER_CLOUD ) {
52
  ewwwio_debug_message( 'cloud options enabled, shutting off binaries' );
53
  ewww_image_optimizer_disable_tools();
54
+ return;
55
+ }
56
+ if (
57
  defined( 'WPCOMSH_VERSION' ) ||
58
  ! empty( $_ENV['PANTHEON_ENVIRONMENT'] ) ||
59
  defined( 'WPE_PLUGIN_VERSION' ) ||
63
  ) {
64
  if (
65
  ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) &&
66
+ ( ! is_object( $exactdn ) || ! $exactdn->get_exactdn_domain() ) &&
67
+ ewww_image_optimizer_get_option( 'ewww_image_optimizer_wizard_complete' )
68
  ) {
69
  add_action( 'network_admin_notices', 'ewww_image_optimizer_notice_hosting_requires_api' );
70
  add_action( 'admin_notices', 'ewww_image_optimizer_notice_hosting_requires_api' );
74
  }
75
  ewwwio_debug_message( 'WPE/wp.com/pantheon/flywheel site, disabling tools' );
76
  ewww_image_optimizer_disable_tools();
77
+ return;
78
+ }
79
+ // Check if this is an unsupported OS (not Linux or Mac OSX or FreeBSD or Windows or SunOS).
80
+ if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_wizard_complete' ) ) {
81
+ if (
82
+ ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) &&
83
+ ( ! is_object( $exactdn ) || ! $exactdn->get_exactdn_domain() ) &&
84
+ ewww_image_optimizer_os_supported()
85
+ ) {
86
+ add_action( 'load-media_page_ewww-image-optimizer-bulk', 'ewww_image_optimizer_tool_init' );
87
+ }
88
+ return;
89
+ }
90
+ if ( ! ewww_image_optimizer_os_supported() ) {
91
  // Call the function to display a notice.
92
  add_action( 'network_admin_notices', 'ewww_image_optimizer_notice_os' );
93
  add_action( 'admin_notices', 'ewww_image_optimizer_notice_os' );
94
  // Turn off all the tools.
95
  ewwwio_debug_message( 'unsupported OS, disabling tools: ' . PHP_OS );
96
  ewww_image_optimizer_disable_tools();
97
+ return;
 
 
 
 
 
 
98
  }
99
+ add_action( 'load-upload.php', 'ewww_image_optimizer_tool_init', 9 );
100
+ add_action( 'load-media-new.php', 'ewww_image_optimizer_tool_init' );
101
+ add_action( 'load-media_page_ewww-image-optimizer-bulk', 'ewww_image_optimizer_tool_init' );
102
+ add_action( 'load-settings_page_ewww-image-optimizer-options', 'ewww_image_optimizer_tool_init' );
103
+ add_action( 'load-plugins.php', 'ewww_image_optimizer_tool_init' );
104
+ add_action( 'load-ims_gallery_page_ewww-ims-optimize', 'ewww_image_optimizer_tool_init' );
105
+ }
106
+
107
+ /**
108
+ * Check if free mode is supported on this operating system.
109
+ *
110
+ * @return bool True if the PHP_OS is supported, false otherwise.
111
+ */
112
+ function ewww_image_optimizer_os_supported() {
113
+ if ( 'Linux' !== PHP_OS && 'Darwin' !== PHP_OS && 'FreeBSD' !== PHP_OS && 'WINNT' !== PHP_OS && 'SunOS' !== PHP_OS ) {
114
+ return false;
115
+ }
116
+ return true;
117
  }
118
 
119
  /**
151
  add_option( 'ewww_image_optimizer_svg_level', '0' );
152
  add_option( 'ewww_image_optimizer_jpg_quality', '' );
153
  add_option( 'ewww_image_optimizer_webp_quality', '' );
154
+ add_option( 'ewww_image_optimizer_resize_existing', true );
155
  add_option( 'ewww_image_optimizer_exactdn', false );
156
  add_option( 'ewww_image_optimizer_exactdn_plan_id', 0 );
157
  add_option( 'exactdn_all_the_things', true );
179
  add_site_option( 'ewww_image_optimizer_svg_level', '0' );
180
  add_site_option( 'ewww_image_optimizer_jpg_quality', '' );
181
  add_site_option( 'ewww_image_optimizer_webp_quality', '' );
182
+ add_site_option( 'ewww_image_optimizer_resize_existing', true );
183
  add_site_option( 'ewww_image_optimizer_disable_pngout', true );
184
  add_site_option( 'ewww_image_optimizer_disable_svgcleaner', true );
185
  add_site_option( 'ewww_image_optimizer_optipng_level', 2 );
616
  ob_start();
617
  // Display a warning if exec() is disabled, can't run local tools without it.
618
  echo "<div id='ewww-image-optimizer-warning-exec' class='notice notice-warning is-dismissible'><p>" .
619
+ esc_html__( 'Sites where the exec() function is disabled require cloud-based optimization, because free server-based optimization will not work. Those who upgrade to our premium service receive much higher compression, PNG/GIF/PDF compression, WebP conversion, and image backups.', 'ewww-image-optimizer' ) . '<br>' .
620
  '<strong>' .
621
  ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) || get_option( 'easyio_exactdn' ) ?
622
  esc_html__( 'Sites that use Easy IO already have built-in image optimization and may dismiss this notice to disable local compression.', 'ewww-image-optimizer' )