EWWW Image Optimizer - Version 4.5.0

Version Description

  • added: Alt WebP supports BJ Lazy Load, a3 Lazy Load, WP Rocket Lazy Load, Jetpack Lazy Load, and WP Retina Lazy Load
  • added: ExactDN rewrites relative image urls that start with a single slash
  • changed: ExactDN srcset markup for smaller images improved
  • fixed: errors during upload/download with WP Offload Media
  • fixed: Alt WebP refuses to process page when FB tracking pixel is present
  • fixed: SVG files within tags throw errors with ExactDN
  • fixed: thumbnail generation fails with S3 Uploads plugin
  • fixed: unable to modify WebP conversion option when ExactDN is enabled
  • fixed: ExactDN inserts full-size image without arguments
  • removed: PHP 5.5 no longer supported
Download this release

Release Info

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

Code changes from version 4.4.2 to 4.5.0

.travis.yml CHANGED
@@ -12,7 +12,6 @@ branches:
12
  - master
13
 
14
  php:
15
- - 5.5
16
  - 5.6
17
  - 7.0
18
  - 7.1
@@ -24,9 +23,9 @@ env:
24
 
25
  matrix:
26
  include:
27
- - php: 5.5
28
  env: WP_VERSION=latest WP_MULTISITE=1
29
- - php: 7.1
30
  env: WP_VERSION=latest WP_MULTISITE=1
31
 
32
  before_script:
12
  - master
13
 
14
  php:
 
15
  - 5.6
16
  - 7.0
17
  - 7.1
23
 
24
  matrix:
25
  include:
26
+ - php: 5.6
27
  env: WP_VERSION=latest WP_MULTISITE=1
28
+ - php: 7.2
29
  env: WP_VERSION=latest WP_MULTISITE=1
30
 
31
  before_script:
changelog.txt CHANGED
@@ -1,3 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
  = 4.4.2 =
2
  * added: notice for Pantheon users that an API key is required
3
  * added: ExactDN fully supports protocol-relative urls for non-image resources
1
+ = 4.5.0 =
2
+ * added: Alt WebP supports BJ Lazy Load, a3 Lazy Load, WP Rocket Lazy Load, Jetpack Lazy Load, and WP Retina Lazy Load
3
+ * added: ExactDN rewrites relative image urls that start with a single slash
4
+ * changed: ExactDN srcset markup for smaller images improved
5
+ * fixed: errors during upload/download with WP Offload Media
6
+ * fixed: Alt WebP refuses to process page when FB tracking pixel is present
7
+ * fixed: SVG files within <use> tags throw errors with ExactDN
8
+ * fixed: thumbnail generation fails with S3 Uploads plugin
9
+ * fixed: unable to modify WebP conversion option when ExactDN is enabled
10
+ * fixed: ExactDN inserts full-size image without arguments
11
+ * removed: PHP 5.5 no longer supported
12
+
13
  = 4.4.2 =
14
  * added: notice for Pantheon users that an API key is required
15
  * added: ExactDN fully supports protocol-relative urls for non-image resources
classes/class-ewww-image.php CHANGED
@@ -122,7 +122,7 @@ class EWWW_Image {
122
  $ewwwdb = $wpdb;
123
  }
124
  $ewwwdb->flush();
125
- if ( $path && is_file( $path ) ) {
126
  ewwwio_debug_message( "creating EWWW_Image with $path" );
127
  $new_image = ewww_image_optimizer_find_already_optimized( $path );
128
  if ( ! $new_image ) {
122
  $ewwwdb = $wpdb;
123
  }
124
  $ewwwdb->flush();
125
+ if ( $path && ( is_file( $path ) || 0 === strpos( $path, 's3://' ) ) ) {
126
  ewwwio_debug_message( "creating EWWW_Image with $path" );
127
  $new_image = ewww_image_optimizer_find_already_optimized( $path );
128
  if ( ! $new_image ) {
classes/class-ewwwio-alt-webp.php CHANGED
@@ -16,13 +16,12 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  class EWWWIO_Alt_Webp extends EWWWIO_Page_Parser {
17
 
18
  /**
19
- * The Alt WebP inline script contents. Current length 12941.
20
  *
21
  * @access private
22
  * @var string $inline_script
23
  */
24
- private $inline_script = 'var Arrive=function(d,t,c){"use strict";if(d.MutationObserver&&"undefined"!=typeof HTMLElement){var a,e,i=0,u=(a=HTMLElement.prototype.matches||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector,{matchesSelector:function(t,e){return t instanceof HTMLElement&&a.call(t,e)},addMethod:function(t,e,a){var i=t[e];t[e]=function(){return a.length==arguments.length?a.apply(this,arguments):"function"==typeof i?i.apply(this,arguments):void 0}},callCallbacks:function(t,e){e&&e.options.onceOnly&&1==e.firedElems.length&&(t=[t[0]]);for(var a,i=0;a=t[i];i++)a&&a.callback&&a.callback.call(a.elem,a.elem);e&&e.options.onceOnly&&1==e.firedElems.length&&e.me.unbindEventWithSelectorAndCallback.call(e.target,e.selector,e.callback)},checkChildNodesRecursively:function(t,e,a,i){for(var r,n=0;r=t[n];n++)a(r,e,i)&&i.push({callback:e.callback,elem:r}),0<r.childNodes.length&&u.checkChildNodesRecursively(r.childNodes,e,a,i)},mergeArrays:function(t,e){var a,i={};for(a in t)t.hasOwnProperty(a)&&(i[a]=t[a]);for(a in e)e.hasOwnProperty(a)&&(i[a]=e[a]);return i},toElementsArray:function(t){return void 0===t||"number"==typeof t.length&&t!==d||(t=[t]),t}}),h=((e=function(){this._eventsBucket=[],this._beforeAdding=null,this._beforeRemoving=null}).prototype.addEvent=function(t,e,a,i){var r={target:t,selector:e,options:a,callback:i,firedElems:[]};return this._beforeAdding&&this._beforeAdding(r),this._eventsBucket.push(r),r},e.prototype.removeEvent=function(t){for(var e,a=this._eventsBucket.length-1;e=this._eventsBucket[a];a--)if(t(e)){this._beforeRemoving&&this._beforeRemoving(e);var i=this._eventsBucket.splice(a,1);i&&i.length&&(i[0].callback=null)}},e.prototype.beforeAdding=function(t){this._beforeAdding=t},e.prototype.beforeRemoving=function(t){this._beforeRemoving=t},e),s=function(r,n){var s=new h,o=this,l={fireOnAttributesModification:!1};return s.beforeAdding(function(e){var t,a=e.target;a!==d.document&&a!==d||(a=document.getElementsByTagName("html")[0]),t=new MutationObserver(function(t){n.call(this,t,e)});var i=r(e.options);t.observe(a,i),e.observer=t,e.me=o}),s.beforeRemoving(function(t){t.observer.disconnect()}),this.bindEvent=function(t,e,a){e=u.mergeArrays(l,e);for(var i=u.toElementsArray(this),r=0;r<i.length;r++)s.addEvent(i[r],t,e,a)},this.unbindEvent=function(){var a=u.toElementsArray(this);s.removeEvent(function(t){for(var e=0;e<a.length;e++)if(this===c||t.target===a[e])return!0;return!1})},this.unbindEventWithSelectorOrCallback=function(a){var t,i=u.toElementsArray(this),r=a;t="function"==typeof a?function(t){for(var e=0;e<i.length;e++)if((this===c||t.target===i[e])&&t.callback===r)return!0;return!1}:function(t){for(var e=0;e<i.length;e++)if((this===c||t.target===i[e])&&t.selector===a)return!0;return!1},s.removeEvent(t)},this.unbindEventWithSelectorAndCallback=function(a,i){var r=u.toElementsArray(this);s.removeEvent(function(t){for(var e=0;e<r.length;e++)if((this===c||t.target===r[e])&&t.selector===a&&t.callback===i)return!0;return!1})},this},r=new function(){var l={fireOnAttributesModification:!1,onceOnly:!1,existing:!1};function n(t,e,a){return!(!u.matchesSelector(t,e.selector)||(t._id===c&&(t._id=i++),-1!=e.firedElems.indexOf(t._id))||(e.firedElems.push(t._id),0))}var d=(r=new s(function(t){var e={attributes:!1,childList:!0,subtree:!0};return t.fireOnAttributesModification&&(e.attributes=!0),e},function(t,r){t.forEach(function(t){var e=t.addedNodes,a=t.target,i=[];null!==e&&0<e.length?u.checkChildNodesRecursively(e,r,n,i):"attributes"===t.type&&n(a,r)&&i.push({callback:r.callback,elem:a}),u.callCallbacks(i,r)})})).bindEvent;return r.bindEvent=function(t,e,a){void 0===a?(a=e,e=l):e=u.mergeArrays(l,e);var i=u.toElementsArray(this);if(e.existing){for(var r=[],n=0;n<i.length;n++)for(var s=i[n].querySelectorAll(t),o=0;o<s.length;o++)r.push({callback:a,elem:s[o]});if(e.onceOnly&&r.length)return a.call(r[0].elem,r[0].elem);setTimeout(u.callCallbacks,1,r)}d.call(this,t,e,a)},r},o=new function(){var i={};function r(t,e){return u.matchesSelector(t,e.selector)}var n=(o=new s(function(){return{childList:!0,subtree:!0}},function(t,i){t.forEach(function(t){var e=t.removedNodes,a=[];null!==e&&0<e.length&&u.checkChildNodesRecursively(e,i,r,a),u.callCallbacks(a,i)})})).bindEvent;return o.bindEvent=function(t,e,a){void 0===a?(a=e,e=i):e=u.mergeArrays(i,e),n.call(this,t,e,a)},o};t&&g(t.fn),g(HTMLElement.prototype),g(NodeList.prototype),g(HTMLCollection.prototype),g(HTMLDocument.prototype),g(Window.prototype);var n={};return l(r,n,"unbindAllArrive"),l(o,n,"unbindAllLeave"),n}function l(t,e,a){u.addMethod(e,a,t.unbindEvent),u.addMethod(e,a,t.unbindEventWithSelectorOrCallback),u.addMethod(e,a,t.unbindEventWithSelectorAndCallback)}function g(t){t.arrive=r.bindEvent,l(r,t,"unbindArrive"),t.leave=o.bindEvent,l(o,t,"unbindLeave")}}(window,"undefined"==typeof jQuery?null:jQuery,void 0);function check_webp_feature(t,e){var a=new Image;a.onload=function(){ewww_webp_supported=0<a.width&&0<a.height,e(ewww_webp_supported)},a.onerror=function(){e(ewww_webp_supported=!1)},a.src="data:image/webp;base64,"+{alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"}[t]}function ewww_load_images(i){!function(s){function a(t,e){for(var a=["align","alt","border","crossorigin","height","hspace","ismap","longdesc","usemap","vspace","width","accesskey","class","contenteditable","contextmenu","dir","draggable","dropzone","hidden","id","lang","spellcheck","style","tabindex","title","translate","sizes","data-caption","data-attachment-id","data-permalink","data-orig-size","data-comments-opened","data-image-meta","data-image-title","data-image-description","data-event-trigger","data-highlight-color","data-highlight-opacity","data-highlight-border-color","data-highlight-border-width","data-highlight-border-opacity","data-no-lazy","data-lazy","data-large_image_width","data-large_image_height"],i=0,r=a.length;i<r;i++){var n=s(t).attr("data-"+a[i]);void 0!==n&&!1!==n&&s(e).attr(a[i],n)}return e}i&&(s(".batch-image img, .image-wrapper a, .ngg-pro-masonry-item a, .ngg-galleria-offscreen-seo-wrapper a").each(function(){var t;void 0!==(t=s(this).attr("data-webp"))&&!1!==t&&s(this).attr("data-src",t),void 0!==(t=s(this).attr("data-webp-thumbnail"))&&!1!==t&&s(this).attr("data-thumbnail",t)}),s(".image-wrapper a, .ngg-pro-masonry-item a").each(function(){var t=s(this).attr("data-webp");void 0!==t&&!1!==t&&s(this).attr("href",t)}),s(".rev_slider ul li").each(function(){void 0!==(e=s(this).attr("data-webp-thumb"))&&!1!==e&&s(this).attr("data-thumb",e);for(var t=1;t<11;){var e;void 0!==(e=s(this).attr("data-webp-param"+t))&&!1!==e&&s(this).attr("data-param"+t,e),t++}}),s(".rev_slider img").each(function(){var t=s(this).attr("data-webp-lazyload");void 0!==t&&!1!==t&&s(this).attr("data-lazyload",t)}),s("div.woocommerce-product-gallery__image").each(function(){var t=s(this).attr("data-webp-thumb");void 0!==t&&!1!==t&&s(this).attr("data-thumb",t)})),s("img.ewww_webp_lazy_retina").each(function(){var t;i?void 0!==(t=s(this).attr("data-srcset-webp"))&&!1!==t&&s(this).attr("data-srcset",t):void 0!==(t=s(this).attr("data-srcset-img"))&&!1!==t&&s(this).attr("data-srcset",t);s(this).removeClass("ewww_webp_lazy_retina")}),s("video").each(function(){var t;i?void 0!==(t=s(this).attr("data-poster-webp"))&&!1!==t&&s(this).attr("poster",t):void 0!==(t=s(this).attr("data-poster-image"))&&!1!==t&&s(this).attr("poster",t)}),s("img.ewww_webp_lazy_load").each(function(){var t;i?(s(this).attr("data-lazy-src",s(this).attr("data-lazy-webp-src")),void 0!==(t=s(this).attr("data-srcset-webp"))&&!1!==t&&s(this).attr("srcset",t),void 0!==(t=s(this).attr("data-lazy-srcset-webp"))&&!1!==t&&s(this).attr("data-lazy-srcset",t)):(s(this).attr("data-lazy-src",s(this).attr("data-lazy-img-src")),void 0!==(t=s(this).attr("data-srcset"))&&!1!==t&&s(this).attr("srcset",t),void 0!==(t=s(this).attr("data-lazy-srcset-img"))&&!1!==t&&s(ewww_img).attr("data-lazy-srcset",t));s(this).removeClass("ewww_webp_lazy_load")}),s(".ewww_webp_lazy_hueman").each(function(){var t,e=document.createElement("img");(s(e).attr("src",s(this).attr("data-src")),i)?(s(e).attr("data-src",s(this).attr("data-webp-src")),void 0!==(t=s(this).attr("data-srcset-webp"))&&!1!==t&&s(e).attr("data-srcset",t)):(s(e).attr("data-src",s(this).attr("data-img")),void 0!==(t=s(this).attr("data-srcset-img"))&&!1!==t&&s(e).attr("data-srcset",t));e=a(this,e),s(this).after(e),s(this).removeClass("ewww_webp_lazy_hueman")}),s(".ewww_webp").each(function(){var t=document.createElement("img");if(i){if(s(t).attr("src",s(this).attr("data-webp")),void 0!==(e=s(this).attr("data-srcset-webp"))&&!1!==e&&s(t).attr("srcset",e),void 0!==(e=s(this).attr("data-webp-orig-file"))&&!1!==e)s(t).attr("data-orig-file",e);else void 0!==(e=s(this).attr("data-orig-file"))&&!1!==e&&s(t).attr("data-orig-file",e);if(void 0!==(e=s(this).attr("data-webp-medium-file"))&&!1!==e)s(t).attr("data-medium-file",e);else void 0!==(e=s(this).attr("data-medium-file"))&&!1!==e&&s(t).attr("data-medium-file",e);if(void 0!==(e=s(this).attr("data-webp-large-file"))&&!1!==e)s(t).attr("data-large-file",e);else void 0!==(e=s(this).attr("data-large-file"))&&!1!==e&&s(t).attr("data-large-file",e);if(void 0!==(e=s(this).attr("data-webp-large_image"))&&!1!==e)s(t).attr("data-large_image",e);else void 0!==(e=s(this).attr("data-large_image"))&&!1!==e&&s(t).attr("data-large_image",e);if(void 0!==(e=s(this).attr("data-webp-src"))&&!1!==e)s(t).attr("data-src",e);else void 0!==(e=s(this).attr("data-src"))&&!1!==e&&s(t).attr("data-src",e)}else{var e;s(t).attr("src",s(this).attr("data-img")),void 0!==(e=s(this).attr("data-srcset-img"))&&!1!==e&&s(t).attr("srcset",e),void 0!==(e=s(this).attr("data-orig-file"))&&!1!==e&&s(t).attr("data-orig-file",e),void 0!==(e=s(this).attr("data-medium-file"))&&!1!==e&&s(t).attr("data-medium-file",e),void 0!==(e=s(this).attr("data-large-file"))&&!1!==e&&s(t).attr("data-large-file",e),void 0!==(e=s(this).attr("data-large_image"))&&!1!==e&&s(t).attr("data-large_image",e),void 0!==(e=s(this).attr("data-src"))&&!1!==e&&s(t).attr("data-src",e)}t=a(this,t),s(this).after(t),s(this).removeClass("ewww_webp")})}(jQuery),jQuery.fn.isotope&&jQuery.fn.imagesLoaded&&(jQuery(".fusion-posts-container-infinite").imagesLoaded(function(){jQuery(".fusion-posts-container-infinite").hasClass("isotope")&&jQuery(".fusion-posts-container-infinite").isotope()}),jQuery(".fusion-portfolio:not(.fusion-recent-works) .fusion-portfolio-wrapper").imagesLoaded(function(){jQuery(".fusion-portfolio:not(.fusion-recent-works) .fusion-portfolio-wrapper").isotope()}))}var ewww_webp_supported=!1,ewww_jquery_waiting_timer=0;function ewww_ngg_plus_parse_galleries(t){t&&jQuery.each(galleries,function(t,e){galleries[t].images_list=ewww_ngg_plus_parse_image_list(e.images_list)})}function ewww_ngg_plus_load_galleries(t){var r;t&&((r=jQuery)(window).on("ngg.galleria.themeadded",function(t,e){console.log(e),window.ngg_galleria._create_backup=window.ngg_galleria.create,window.ngg_galleria.create=function(t,e){var a=r(t).data("id");return console.log(a),galleries["gallery_"+a].images_list=ewww_ngg_plus_parse_image_list(galleries["gallery_"+a].images_list),window.ngg_galleria._create_backup(t,e)}}),r(window).on("override_nplModal_methods",function(t,i){i._set_events_backup=i.set_events,i.set_events=function(){return r("#npl_content").bind("npl_images_ready",function(t,e){var a=i.fetch_images.gallery_image_cache[e];a=ewww_ngg_plus_parse_image_list(a)}),i._set_events_backup()}}))}function ewww_ngg_plus_parse_image_list(r){var t;return(t=jQuery).each(r,function(a,i){void 0!==i["image-webp"]&&(r[a].image=i["image-webp"],delete r[a]["image-webp"]),void 0!==i["thumb-webp"]&&(r[a].thumb=i["thumb-webp"],delete r[a]["thumb-webp"]),void 0!==i.full_image_webp&&(r[a].full_image=i.full_image_webp,delete r[a].full_image_webp),void 0!==i.srcsets&&t.each(i.srcsets,function(t,e){void 0!==i.srcsets[t+"-webp"]&&(r[a].srcsets[t]=i.srcsets[t+"-webp"],delete r[a].srcsets[t+"-webp"])}),void 0!==i.full_srcsets&&t.each(i.full_srcsets,function(t,e){void 0!==i.full_srcsets[t+"-webp"]&&(r[a].full_srcsets[t]=i.full_srcsets[t+"-webp"],delete r[a].full_srcsets[t+"-webp"])})}),r}ewww_jquery_waiting=setInterval(function(){if(window.jQuery){check_webp_feature("alpha",ewww_load_images),check_webp_feature("alpha",ewww_ngg_plus_load_galleries),document.arrive(".ewww_webp",function(){ewww_load_images(ewww_webp_supported)});var t=0,e=setInterval(function(){"undefined"!=typeof galleries&&(check_webp_feature("alpha",ewww_ngg_plus_parse_galleries),clearInterval(e)),1e3<(t+=25)&&clearInterval(e)},25);clearInterval(ewww_jquery_waiting)}1e4<(ewww_jquery_waiting_timer+=100)&&clearInterval(ewww_jquery_waiting)},100);';
25
-
26
 
27
  /**
28
  * Indicates if we are filtering ExactDN urls.
@@ -221,7 +220,7 @@ class EWWWIO_Alt_Webp extends EWWWIO_Page_Parser {
221
  $this->set_attribute( $nscript, 'data-webp-orig-file', $this->generate_url( $data_orig_file ) );
222
  ewwwio_debug_message( "replacing $data_orig_file in data-orig-file" );
223
  }
224
- $this->set_attribute( $nscript, 'data-orig-file', $data_orig_file );
225
  }
226
  $data_medium_file = $this->get_attribute( $image, 'data-medium-file' );
227
  if ( $data_medium_file ) {
@@ -230,7 +229,7 @@ class EWWWIO_Alt_Webp extends EWWWIO_Page_Parser {
230
  $this->set_attribute( $nscript, 'data-webp-medium-file', $this->generate_url( $data_medium_file ) );
231
  ewwwio_debug_message( "replacing $data_medium_file in data-medium-file" );
232
  }
233
- $this->set_attribute( $nscript, 'data-medium-file', $data_medium_file );
234
  }
235
  $data_large_file = $this->get_attribute( $image, 'data-large-file' );
236
  if ( $data_large_file ) {
@@ -239,7 +238,7 @@ class EWWWIO_Alt_Webp extends EWWWIO_Page_Parser {
239
  $this->set_attribute( $nscript, 'data-webp-large-file', $this->generate_url( $data_large_file ) );
240
  ewwwio_debug_message( "replacing $data_large_file in data-large-file" );
241
  }
242
- $this->set_attribute( $nscript, 'data-large-file', $data_large_file );
243
  }
244
  return $nscript;
245
  }
@@ -317,29 +316,35 @@ class EWWWIO_Alt_Webp extends EWWWIO_Page_Parser {
317
  return $buffer;
318
  }
319
 
320
- // TODO: Eventually route through a custom parsing routine for noscript images.
321
- $noscript_images = $this->get_noscript_images_from_html( $buffer );
322
- if ( ! empty( $noscript_images ) && isset( $noscript_images[0] ) ) {
323
- foreach ( $noscript_images[0] as $nindex => $noscript_image ) {
324
- if ( strpos( $noscript_image, 'facebook.com/tr?' ) ) {
325
- unset( $noscript_images[0][ $nindex ] );
326
- }
327
- }
328
- if ( empty( $noscript_images[0] ) ) {
329
- $noscript_images = false;
330
- } else {
331
- ewwwio_debug_message( 'noscript-encased images found, will not process any img elements' );
332
- }
333
- }
334
  /* TODO: detect non-utf8 encoding and convert the buffer (if necessary). */
335
 
336
- $images = $this->get_images_from_html( $buffer, false );
337
- if ( empty( $noscript_images ) && ewww_image_optimizer_iterable( $images[0] ) ) {
338
  foreach ( $images[0] as $index => $image ) {
339
  $file = $images['img_url'][ $index ];
340
  ewwwio_debug_message( "parsing an image: $file" );
341
- // If a CDN path match was found, or .webp image existsence is confirmed, and this is not a lazy-load 'dummy' image.
342
- if ( $this->validate_image_url( $file ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  ewwwio_debug_message( 'found a webp image or forced path' );
344
  $nscript = '<noscript>';
345
  $this->set_attribute( $nscript, 'data-img', $file );
@@ -360,95 +365,87 @@ class EWWWIO_Alt_Webp extends EWWWIO_Page_Parser {
360
  }
361
  $nscript = $this->attr_copy( $image, $nscript );
362
  $this->set_attribute( $nscript, 'class', 'ewww_webp' );
 
363
  $buffer = str_replace( $image, $nscript . $image . '</noscript>', $buffer );
364
- }
365
- // NOTE: lazy loads are shutoff for now, since they don't work consistently
366
- // WP Retina 2x lazy loads.
367
- if ( false && empty( $file ) && $image->getAttribute( 'data-srcset' ) && strpos( $image->getAttribute( 'class' ), 'lazyload' ) ) {
368
- $srcset = $image->getAttribute( 'data-srcset' );
369
- $srcset_webp = $this->srcset_replace( $srcset );
370
- if ( $srcset_webp ) {
371
- $nimage = $html->createElement( 'img' );
372
- $nimage->setAttribute( 'data-srcset-webp', $srcset_webp );
373
- $nimage->setAttribute( 'data-srcset-img', $srcset );
374
- ewww_image_optimizer_webp_attr_copy( $image, $nimage, '' );
375
- $nimage->setAttribute( 'class', $image->getAttribute( 'class' ) . ' ewww_webp_lazy_retina' );
376
- $image->parentNode->replaceChild( $nimage, $image );
377
  }
378
- }
379
- // Hueman theme lazy-loads.
380
- if ( false && ! empty( $file ) && strpos( $file, 'image/gif;base64,R0lGOD' ) && $image->getAttribute( 'data-src' ) && $image->getAttribute( 'data-srcset' ) ) {
381
- $dummy = $file;
382
- $file = $image->getAttribute( 'data-src' );
383
- ewwwio_debug_message( "checking webp for hueman data-src: $file" );
384
- $filepath = ABSPATH . str_replace( $home_url, '', $file );
385
- if ( $valid_path || is_file( $filepath . '.webp' ) ) {
386
- ewwwio_debug_message( "found webp for Hueman lazyload: $filepath" );
387
- $nscript = $html->createElement( 'noscript' );
388
- $nscript->setAttribute( 'data-src', $dummy );
389
- $nscript->setAttribute( 'data-img', $file );
390
- $nscript->setAttribute( 'data-webp-src', $file . '.webp' );
391
- $image->setAttribute( 'src', $file );
392
- if ( $image->getAttribute( 'data-srcset' ) ) {
393
- $srcset = $image->getAttribute( 'data-srcset' );
394
- $srcset_webp = ewww_image_optimizer_webp_srcset_replace( $srcset );
395
- if ( $srcset_webp ) {
396
- $nscript->setAttribute( 'data-srcset-webp', $srcset_webp );
397
- }
398
- $nscript->setAttribute( 'data-srcset-img', $srcset );
399
  }
400
- ewww_image_optimizer_webp_attr_copy( $image, $nscript );
401
- $nscript->setAttribute( 'class', 'ewww_webp_lazy_hueman' );
402
- $image->parentNode->replaceChild( $nscript, $image );
403
- $nscript->appendChild( $image );
404
  }
405
- }
406
- // Lazy Load plugin (and hopefully Cherry variant) and BJ Lazy Load.
407
- if ( false && ! empty( $file ) && ( strpos( $file, 'image/gif;base64,R0lGOD' ) || strpos( $file, 'lazy-load/images/1x1' ) ) && $image->getAttribute( 'data-lazy-src' ) && ! empty( $image->nextSibling ) && 'noscript' == $image->nextSibling->nodeName ) {
408
- $dummy = $file;
409
- $nimage = $html->createElement( 'img' );
410
- $nimage->setAttribute( 'src', $dummy );
411
- $file = $image->getAttribute( 'data-lazy-src' );
412
- ewwwio_debug_message( "checking webp for Lazy Load data-lazy-src: $file" );
413
- $filepath = ABSPATH . str_replace( $home_url, '', $file );
414
- if ( $valid_path || is_file( $filepath . '.webp' ) ) {
415
- ewwwio_debug_message( "found webp for Lazy Load: $filepath" );
416
- $nimage->setAttribute( 'data-lazy-img-src', $file );
417
- $nimage->setAttribute( 'data-lazy-webp-src', $file . '.webp' );
418
- if ( $image->getAttribute( 'srcset' ) ) {
419
- $srcset = $image->getAttribute( 'srcset' );
420
- $srcset_webp = ewww_image_optimizer_webp_srcset_replace( $srcset, $home_url, $valid_path );
421
- if ( $srcset_webp ) {
422
- $nimage->setAttribute( 'data-srcset-webp', $srcset_webp );
423
- }
424
- $nimage->setAttribute( 'data-srcset', $srcset );
425
- }
426
- if ( $image->getAttribute( 'data-lazy-srcset' ) ) {
427
- $srcset = $image->getAttribute( 'data-lazy-srcset' );
428
- $srcset_webp = ewww_image_optimizer_webp_srcset_replace( $srcset, $home_url, $valid_path );
429
- if ( $srcset_webp ) {
430
- $nimage->setAttribute( 'data-lazy-srcset-webp', $srcset_webp );
431
- }
432
- $nimage->setAttribute( 'data-lazy-srcset-img', $srcset );
433
  }
434
- ewww_image_optimizer_webp_attr_copy( $image, $nimage, '' );
435
- $nimage->setAttribute( 'class', $image->getAttribute( 'class' ) . ' ewww_webp_lazy_load' );
436
- $image->parentNode->replaceChild( $nimage, $image );
437
  }
438
- } // End if().
 
 
 
 
439
  // Rev Slider data-lazyload attribute on image elements.
440
  if ( $this->get_attribute( $image, 'data-lazyload' ) ) {
441
- $lazyload = $this->get_attribute( $image, 'data-lazyload' );
 
442
  if ( $lazyload ) {
443
  if ( $this->validate_image_url( $lazyload ) ) {
444
- $this->set_attribute( $image, 'data-webp-lazyload', $this->generate_url( $lazyload ) );
445
  ewwwio_debug_message( "replacing with webp for data-lazyload: $lazyload" );
446
- $buffer = str_replace( $images[0][ $index ], $image, $buffer );
447
  }
448
  }
449
  }
450
  } // End foreach().
451
  } // End if().
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
452
  // Images listed as picture/source elements. Mostly for NextGEN, but should work anywhere.
453
  $pictures = $this->get_picture_tags_from_html( $buffer );
454
  if ( ewww_image_optimizer_iterable( $pictures ) ) {
@@ -619,7 +616,7 @@ class EWWWIO_Alt_Webp extends EWWWIO_Page_Parser {
619
  */
620
  function validate_image_url( $image ) {
621
  ewwwio_debug_message( "webp validation for $image" );
622
- if ( strpos( $image, 'assets/images/dummy.png' ) || strpos( $image, 'base64,R0lGOD' ) || strpos( $image, 'lazy-load/images/1x1' ) || strpos( $image, 'assets/images/transparent.png' ) ) {
623
  ewwwio_debug_message( 'lazy load placeholder' );
624
  return false;
625
  }
16
  class EWWWIO_Alt_Webp extends EWWWIO_Page_Parser {
17
 
18
  /**
19
+ * The Alt WebP inline script contents. Current length 11804.
20
  *
21
  * @access private
22
  * @var string $inline_script
23
  */
24
+ private $inline_script = 'var Arrive=function(w,e,c){"use strict";if(w.MutationObserver&&"undefined"!=typeof HTMLElement){var a,t,r=0,d=(a=HTMLElement.prototype.matches||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector,{matchesSelector:function(e,t){return e instanceof HTMLElement&&a.call(e,t)},addMethod:function(e,t,a){var r=e[t];e[t]=function(){return a.length==arguments.length?a.apply(this,arguments):"function"==typeof r?r.apply(this,arguments):void 0}},callCallbacks:function(e,t){t&&t.options.onceOnly&&1==t.firedElems.length&&(e=[e[0]]);for(var a,r=0;a=e[r];r++)a&&a.callback&&a.callback.call(a.elem,a.elem);t&&t.options.onceOnly&&1==t.firedElems.length&&t.me.unbindEventWithSelectorAndCallback.call(t.target,t.selector,t.callback)},checkChildNodesRecursively:function(e,t,a,r){for(var i,n=0;i=e[n];n++)a(i,t,r)&&r.push({callback:t.callback,elem:i}),0<i.childNodes.length&&d.checkChildNodesRecursively(i.childNodes,t,a,r)},mergeArrays:function(e,t){var a,r={};for(a in e)e.hasOwnProperty(a)&&(r[a]=e[a]);for(a in t)t.hasOwnProperty(a)&&(r[a]=t[a]);return r},toElementsArray:function(e){return void 0===e||"number"==typeof e.length&&e!==w||(e=[e]),e}}),u=((t=function(){this._eventsBucket=[],this._beforeAdding=null,this._beforeRemoving=null}).prototype.addEvent=function(e,t,a,r){var i={target:e,selector:t,options:a,callback:r,firedElems:[]};return this._beforeAdding&&this._beforeAdding(i),this._eventsBucket.push(i),i},t.prototype.removeEvent=function(e){for(var t,a=this._eventsBucket.length-1;t=this._eventsBucket[a];a--)if(e(t)){this._beforeRemoving&&this._beforeRemoving(t);var r=this._eventsBucket.splice(a,1);r&&r.length&&(r[0].callback=null)}},t.prototype.beforeAdding=function(e){this._beforeAdding=e},t.prototype.beforeRemoving=function(e){this._beforeRemoving=e},t),l=function(i,n){var l=new u,s=this,o={fireOnAttributesModification:!1};return l.beforeAdding(function(t){var e,a=t.target;a!==w.document&&a!==w||(a=document.getElementsByTagName("html")[0]),e=new MutationObserver(function(e){n.call(this,e,t)});var r=i(t.options);e.observe(a,r),t.observer=e,t.me=s}),l.beforeRemoving(function(e){e.observer.disconnect()}),this.bindEvent=function(e,t,a){t=d.mergeArrays(o,t);for(var r=d.toElementsArray(this),i=0;i<r.length;i++)l.addEvent(r[i],e,t,a)},this.unbindEvent=function(){var a=d.toElementsArray(this);l.removeEvent(function(e){for(var t=0;t<a.length;t++)if(this===c||e.target===a[t])return!0;return!1})},this.unbindEventWithSelectorOrCallback=function(a){var e,r=d.toElementsArray(this),i=a;e="function"==typeof a?function(e){for(var t=0;t<r.length;t++)if((this===c||e.target===r[t])&&e.callback===i)return!0;return!1}:function(e){for(var t=0;t<r.length;t++)if((this===c||e.target===r[t])&&e.selector===a)return!0;return!1},l.removeEvent(e)},this.unbindEventWithSelectorAndCallback=function(a,r){var i=d.toElementsArray(this);l.removeEvent(function(e){for(var t=0;t<i.length;t++)if((this===c||e.target===i[t])&&e.selector===a&&e.callback===r)return!0;return!1})},this},i=new function(){var o={fireOnAttributesModification:!1,onceOnly:!1,existing:!1};function n(e,t,a){return!(!d.matchesSelector(e,t.selector)||(e._id===c&&(e._id=r++),-1!=t.firedElems.indexOf(e._id))||(t.firedElems.push(e._id),0))}var w=(i=new l(function(e){var t={attributes:!1,childList:!0,subtree:!0};return e.fireOnAttributesModification&&(t.attributes=!0),t},function(e,i){e.forEach(function(e){var t=e.addedNodes,a=e.target,r=[];null!==t&&0<t.length?d.checkChildNodesRecursively(t,i,n,r):"attributes"===e.type&&n(a,i)&&r.push({callback:i.callback,elem:a}),d.callCallbacks(r,i)})})).bindEvent;return i.bindEvent=function(e,t,a){void 0===a?(a=t,t=o):t=d.mergeArrays(o,t);var r=d.toElementsArray(this);if(t.existing){for(var i=[],n=0;n<r.length;n++)for(var l=r[n].querySelectorAll(e),s=0;s<l.length;s++)i.push({callback:a,elem:l[s]});if(t.onceOnly&&i.length)return a.call(i[0].elem,i[0].elem);setTimeout(d.callCallbacks,1,i)}w.call(this,e,t,a)},i},s=new function(){var r={};function i(e,t){return d.matchesSelector(e,t.selector)}var n=(s=new l(function(){return{childList:!0,subtree:!0}},function(e,r){e.forEach(function(e){var t=e.removedNodes,a=[];null!==t&&0<t.length&&d.checkChildNodesRecursively(t,r,i,a),d.callCallbacks(a,r)})})).bindEvent;return s.bindEvent=function(e,t,a){void 0===a?(a=t,t=r):t=d.mergeArrays(r,t),n.call(this,e,t,a)},s};e&&h(e.fn),h(HTMLElement.prototype),h(NodeList.prototype),h(HTMLCollection.prototype),h(HTMLDocument.prototype),h(Window.prototype);var n={};return o(i,n,"unbindAllArrive"),o(s,n,"unbindAllLeave"),n}function o(e,t,a){d.addMethod(t,a,e.unbindEvent),d.addMethod(t,a,e.unbindEventWithSelectorOrCallback),d.addMethod(t,a,e.unbindEventWithSelectorAndCallback)}function h(e){e.arrive=i.bindEvent,o(i,e,"unbindArrive"),e.leave=s.bindEvent,o(s,e,"unbindLeave")}}(window,"undefined"==typeof jQuery?null:jQuery,void 0);function check_webp_feature(e,t){var a=new Image;a.onload=function(){ewww_webp_supported=0<a.width&&0<a.height,t(ewww_webp_supported)},a.onerror=function(){t(ewww_webp_supported=!1)},a.src="data:image/webp;base64,"+{alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"}[e]}function ewww_load_images(t){!function(n){n.fn.extend({ewwwattr:function(e,t){return void 0!==t&&!1!==t&&this.attr(e,t),this}});t&&(n(".batch-image img, .image-wrapper a, .ngg-pro-masonry-item a, .ngg-galleria-offscreen-seo-wrapper a").each(function(){n(this).ewwwattr("data-src",n(this).attr("data-webp")),n(this).ewwwattr("data-thumbnail",n(this).attr("data-webp-thumbnail"))}),n(".image-wrapper a, .ngg-pro-masonry-item a").each(function(){n(this).ewwwattr("href",n(this).attr("data-webp"))}),n(".rev_slider ul li").each(function(){n(this).ewwwattr("data-thumb",n(this).attr("data-webp-thumb"));for(var e=1;e<11;)n(this).ewwwattr("data-param"+e,n(this).attr("data-webp-param"+e)),e++}),n(".rev_slider img").each(function(){n(this).ewwwattr("data-lazyload",n(this).attr("data-webp-lazyload"))}),n("div.woocommerce-product-gallery__image").each(function(){n(this).ewwwattr("data-thumb",n(this).attr("data-webp-thumb"))})),n("img.ewww_webp_lazy_retina").each(function(){t&&n(this).ewwwattr("data-srcset",n(this).attr("data-srcset-webp")),n(this).removeClass("ewww_webp_lazy_retina")}),n("video").each(function(){t?n(this).ewwwattr("poster",n(this).attr("data-poster-webp")):n(this).ewwwattr("poster",n(this).attr("data-poster-image"))}),n("img.ewww_webp_lazy_load").each(function(){t&&(n(this).ewwwattr("data-lazy-srcset",n(this).attr("data-lazy-srcset-webp")),n(this).ewwwattr("data-srcset",n(this).attr("data-srcset-webp")),n(this).ewwwattr("data-lazy-src",n(this).attr("data-lazy-src-webp")),n(this).ewwwattr("data-src",n(this).attr("data-src-webp")),n(this).ewwwattr("data-orig-file",n(this).attr("data-webp-orig-file")),n(this).ewwwattr("data-medium-file",n(this).attr("data-webp-medium-file")),n(this).ewwwattr("data-large-file",n(this).attr("data-webp-large-file"))),n(this).removeClass("ewww_webp_lazy_load")}),n(".ewww_webp").each(function(){var e=document.createElement("img");t?(n(e).ewwwattr("src",n(this).attr("data-webp")),n(e).ewwwattr("srcset",n(this).attr("data-srcset-webp")),n(e).ewwwattr("data-orig-file",n(this).attr("data-orig-file")),n(e).ewwwattr("data-orig-file",n(this).attr("data-webp-orig-file")),n(e).ewwwattr("data-medium-file",n(this).attr("data-medium-file")),n(e).ewwwattr("data-medium-file",n(this).attr("data-webp-medium-file")),n(e).ewwwattr("data-large-file",n(this).attr("data-large-file")),n(e).ewwwattr("data-large-file",n(this).attr("data-webp-large-file")),n(e).ewwwattr("data-large_image",n(this).attr("data-large_image")),n(e).ewwwattr("data-large_image",n(this).attr("data-webp-large_image")),n(e).ewwwattr("data-src",n(this).attr("data-src")),n(e).ewwwattr("data-src",n(this).attr("data-webp-src"))):(n(e).ewwwattr("src",n(this).attr("data-img")),n(e).ewwwattr("srcset",n(this).attr("data-srcset-img")),n(e).ewwwattr("data-orig-file",n(this).attr("data-orig-file")),n(e).ewwwattr("data-medium-file",n(this).attr("data-medium-file")),n(e).ewwwattr("data-large-file",n(this).attr("data-large-file")),n(e).ewwwattr("data-large_image",n(this).attr("data-large_image")),n(e).ewwwattr("data-src",n(this).attr("data-src"))),e=function(e,t){for(var a=["align","alt","border","crossorigin","height","hspace","ismap","longdesc","usemap","vspace","width","accesskey","class","contenteditable","contextmenu","dir","draggable","dropzone","hidden","id","lang","spellcheck","style","tabindex","title","translate","sizes","data-caption","data-attachment-id","data-permalink","data-orig-size","data-comments-opened","data-image-meta","data-image-title","data-image-description","data-event-trigger","data-highlight-color","data-highlight-opacity","data-highlight-border-color","data-highlight-border-width","data-highlight-border-opacity","data-no-lazy","data-lazy","data-large_image_width","data-large_image_height"],r=0,i=a.length;r<i;r++)n(t).ewwwattr(a[r],n(e).attr("data-"+a[r]));return t}(this,e),n(this).after(e),n(this).removeClass("ewww_webp")})}(jQuery),jQuery.fn.isotope&&jQuery.fn.imagesLoaded&&(jQuery(".fusion-posts-container-infinite").imagesLoaded(function(){jQuery(".fusion-posts-container-infinite").hasClass("isotope")&&jQuery(".fusion-posts-container-infinite").isotope()}),jQuery(".fusion-portfolio:not(.fusion-recent-works) .fusion-portfolio-wrapper").imagesLoaded(function(){jQuery(".fusion-portfolio:not(.fusion-recent-works) .fusion-portfolio-wrapper").isotope()}))}var ewww_webp_supported=!1,ewww_jquery_waiting_timer=0;function ewww_ngg_plus_parse_galleries(e){e&&jQuery.each(galleries,function(e,t){galleries[e].images_list=ewww_ngg_plus_parse_image_list(t.images_list)})}function ewww_ngg_plus_load_galleries(e){var i;e&&((i=jQuery)(window).on("ngg.galleria.themeadded",function(e,t){window.ngg_galleria._create_backup=window.ngg_galleria.create,window.ngg_galleria.create=function(e,t){var a=i(e).data("id");return galleries["gallery_"+a].images_list=ewww_ngg_plus_parse_image_list(galleries["gallery_"+a].images_list),window.ngg_galleria._create_backup(e,t)}}),i(window).on("override_nplModal_methods",function(e,r){r._set_events_backup=r.set_events,r.set_events=function(){return i("#npl_content").bind("npl_images_ready",function(e,t){var a=r.fetch_images.gallery_image_cache[t];a=ewww_ngg_plus_parse_image_list(a)}),r._set_events_backup()}}))}function ewww_ngg_plus_parse_image_list(i){var e;return(e=jQuery).each(i,function(a,r){void 0!==r["image-webp"]&&(i[a].image=r["image-webp"],delete i[a]["image-webp"]),void 0!==r["thumb-webp"]&&(i[a].thumb=r["thumb-webp"],delete i[a]["thumb-webp"]),void 0!==r.full_image_webp&&(i[a].full_image=r.full_image_webp,delete i[a].full_image_webp),void 0!==r.srcsets&&e.each(r.srcsets,function(e,t){void 0!==r.srcsets[e+"-webp"]&&(i[a].srcsets[e]=r.srcsets[e+"-webp"],delete i[a].srcsets[e+"-webp"])}),void 0!==r.full_srcsets&&e.each(r.full_srcsets,function(e,t){void 0!==r.full_srcsets[e+"-webp"]&&(i[a].full_srcsets[e]=r.full_srcsets[e+"-webp"],delete i[a].full_srcsets[e+"-webp"])})}),i}ewww_jquery_waiting=setInterval(function(){if(window.jQuery){check_webp_feature("alpha",ewww_load_images),check_webp_feature("alpha",ewww_ngg_plus_load_galleries),document.arrive(".ewww_webp",function(){ewww_load_images(ewww_webp_supported)});var e=0,t=setInterval(function(){"undefined"!=typeof galleries&&(check_webp_feature("alpha",ewww_ngg_plus_parse_galleries),clearInterval(t)),1e3<(e+=25)&&clearInterval(t)},25);clearInterval(ewww_jquery_waiting)}1e4<(ewww_jquery_waiting_timer+=100)&&clearInterval(ewww_jquery_waiting)},100);';
 
25
 
26
  /**
27
  * Indicates if we are filtering ExactDN urls.
220
  $this->set_attribute( $nscript, 'data-webp-orig-file', $this->generate_url( $data_orig_file ) );
221
  ewwwio_debug_message( "replacing $data_orig_file in data-orig-file" );
222
  }
223
+ $this->set_attribute( $nscript, 'data-orig-file', $data_orig_file, true );
224
  }
225
  $data_medium_file = $this->get_attribute( $image, 'data-medium-file' );
226
  if ( $data_medium_file ) {
229
  $this->set_attribute( $nscript, 'data-webp-medium-file', $this->generate_url( $data_medium_file ) );
230
  ewwwio_debug_message( "replacing $data_medium_file in data-medium-file" );
231
  }
232
+ $this->set_attribute( $nscript, 'data-medium-file', $data_medium_file, true );
233
  }
234
  $data_large_file = $this->get_attribute( $image, 'data-large-file' );
235
  if ( $data_large_file ) {
238
  $this->set_attribute( $nscript, 'data-webp-large-file', $this->generate_url( $data_large_file ) );
239
  ewwwio_debug_message( "replacing $data_large_file in data-large-file" );
240
  }
241
+ $this->set_attribute( $nscript, 'data-large-file', $data_large_file, true );
242
  }
243
  return $nscript;
244
  }
316
  return $buffer;
317
  }
318
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
  /* TODO: detect non-utf8 encoding and convert the buffer (if necessary). */
320
 
321
+ $images = $this->get_images_from_html( preg_replace( '/<noscript.*?\/noscript>/', '', $buffer ), false );
322
+ if ( ewww_image_optimizer_iterable( $images[0] ) ) {
323
  foreach ( $images[0] as $index => $image ) {
324
  $file = $images['img_url'][ $index ];
325
  ewwwio_debug_message( "parsing an image: $file" );
326
+ if ( strpos( $image, 'jetpack-lazy-image' ) && $this->validate_image_url( $file ) ) {
327
+ $new_image = $image;
328
+ $new_image = $this->jetpack_replace( $image, $new_image );
329
+ $real_file = $this->get_attribute( $new_image, 'data-lazy-src' );
330
+ ewwwio_debug_message( 'checking webp for Jetpack Lazy Load data-lazy-src' );
331
+ if ( $real_file && $this->validate_image_url( $real_file ) ) {
332
+ ewwwio_debug_message( "found webp for Lazy Load: $real_file" );
333
+ $this->set_attribute( $new_image, 'data-lazy-src-webp', $this->generate_url( $real_file ) );
334
+ }
335
+ $srcset = $this->get_attribute( $new_image, 'data-lazy-srcset' );
336
+ if ( $srcset ) {
337
+ $srcset_webp = $this->srcset_replace( $srcset );
338
+ if ( $srcset_webp ) {
339
+ $this->set_attribute( $new_image, 'data-lazy-srcset-webp', $srcset_webp );
340
+ }
341
+ }
342
+ if ( $new_image !== $image ) {
343
+ $this->set_attribute( $new_image, 'class', $this->get_attribute( $new_image, 'class' ) . ' ewww_webp_lazy_load', true );
344
+ $buffer = str_replace( $image, $new_image, $buffer );
345
+ }
346
+ } elseif ( $this->validate_image_url( $file ) && false === strpos( $image, 'lazyload' ) ) {
347
+ // If a CDN path match was found, or .webp image existsence is confirmed, and this is not a lazy-load 'dummy' image.
348
  ewwwio_debug_message( 'found a webp image or forced path' );
349
  $nscript = '<noscript>';
350
  $this->set_attribute( $nscript, 'data-img', $file );
365
  }
366
  $nscript = $this->attr_copy( $image, $nscript );
367
  $this->set_attribute( $nscript, 'class', 'ewww_webp' );
368
+ ewwwio_debug_message( "going to swap\n$image\nwith\n$nscript" . $image . '</noscript>' );
369
  $buffer = str_replace( $image, $nscript . $image . '</noscript>', $buffer );
370
+ } elseif ( ! empty( $file ) && strpos( $image, 'data-lazy-src=' ) ) {
371
+ // BJ Lazy Load & WP Rocket.
372
+ $new_image = $image;
373
+ $real_file = $this->get_attribute( $new_image, 'data-lazy-src' );
374
+ ewwwio_debug_message( "checking webp for Lazy Load data-lazy-src: $real_file" );
375
+ if ( $this->validate_image_url( $real_file ) ) {
376
+ ewwwio_debug_message( "found webp for Lazy Load: $real_file" );
377
+ $this->set_attribute( $new_image, 'data-lazy-src-webp', $this->generate_url( $real_file ) );
 
 
 
 
 
378
  }
379
+ $srcset = $this->get_attribute( $new_image, 'data-lazy-srcset' );
380
+ if ( $srcset ) {
381
+ $srcset_webp = $this->srcset_replace( $srcset );
382
+ if ( $srcset_webp ) {
383
+ $this->set_attribute( $new_image, 'data-lazy-srcset-webp', $srcset_webp );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  }
 
 
 
 
385
  }
386
+ if ( $new_image !== $image ) {
387
+ $this->set_attribute( $new_image, 'class', $this->get_attribute( $new_image, 'class' ) . ' ewww_webp_lazy_load', true );
388
+ $buffer = str_replace( $image, $new_image, $buffer );
389
+ }
390
+ } elseif ( ! empty( $file ) && strpos( $image, 'data-src=' ) && strpos( $image, 'data-lazy-type="image' ) ) {
391
+ // a3 Lazy Load.
392
+ $new_image = $image;
393
+ $real_file = $this->get_attribute( $new_image, 'data-src' );
394
+ ewwwio_debug_message( "checking webp for Lazy Load data-src: $real_file" );
395
+ if ( $this->validate_image_url( $real_file ) ) {
396
+ ewwwio_debug_message( 'found webp for Lazy Load' );
397
+ $this->set_attribute( $new_image, 'data-src-webp', $this->generate_url( $real_file ) );
398
+ }
399
+ $srcset = $this->get_attribute( $new_image, 'data-srcset' );
400
+ if ( $srcset ) {
401
+ $srcset_webp = $this->srcset_replace( $srcset );
402
+ if ( $srcset_webp ) {
403
+ $this->set_attribute( $new_image, 'data-srcset-webp', $srcset_webp );
 
 
 
 
 
 
 
 
 
 
404
  }
 
 
 
405
  }
406
+ if ( $new_image !== $image ) {
407
+ $this->set_attribute( $new_image, 'class', $this->get_attribute( $new_image, 'class' ) . ' ewww_webp_lazy_load', true );
408
+ $buffer = str_replace( $image, $new_image, $buffer );
409
+ }
410
+ }
411
  // Rev Slider data-lazyload attribute on image elements.
412
  if ( $this->get_attribute( $image, 'data-lazyload' ) ) {
413
+ $new_image = $image;
414
+ $lazyload = $this->get_attribute( $new_image, 'data-lazyload' );
415
  if ( $lazyload ) {
416
  if ( $this->validate_image_url( $lazyload ) ) {
417
+ $this->set_attribute( $new_image, 'data-webp-lazyload', $this->generate_url( $lazyload ) );
418
  ewwwio_debug_message( "replacing with webp for data-lazyload: $lazyload" );
419
+ $buffer = str_replace( $image, $new_image, $buffer );
420
  }
421
  }
422
  }
423
  } // End foreach().
424
  } // End if().
425
+ // Look for images to parse WP Retina Lazy Load.
426
+ if ( class_exists( 'Meow_WR2X_Core' ) && strpos( $buffer, ' lazyload' ) ) {
427
+ $images = $this->get_elements_from_html( $buffer, 'img' );
428
+ if ( ewww_image_optimizer_iterable( $images ) ) {
429
+ foreach ( $images as $index => $image ) {
430
+ $file = $this->get_attribute( $image, 'src' );
431
+ if ( ( empty( $file ) || strpos( $image, 'R0lGODlhAQABAIAAAAAAAP' ) ) && strpos( $image, ' data-srcset=' ) && strpos( $this->get_attribute( $image, 'class' ), 'lazyload' ) ) {
432
+ $new_image = $image;
433
+ $srcset = $this->get_attribute( $new_image, 'data-srcset' );
434
+ ewwwio_debug_message( 'checking webp for Retina Lazy Load data-src' );
435
+ if ( $srcset ) {
436
+ $srcset_webp = $this->srcset_replace( $srcset );
437
+ if ( $srcset_webp ) {
438
+ $this->set_attribute( $new_image, 'data-srcset-webp', $srcset_webp );
439
+ }
440
+ }
441
+ if ( $new_image !== $image ) {
442
+ $this->set_attribute( $new_image, 'class', $this->get_attribute( $new_image, 'class' ) . ' ewww_webp_lazy_load', true );
443
+ $buffer = str_replace( $image, $new_image, $buffer );
444
+ }
445
+ }
446
+ }
447
+ }
448
+ }
449
  // Images listed as picture/source elements. Mostly for NextGEN, but should work anywhere.
450
  $pictures = $this->get_picture_tags_from_html( $buffer );
451
  if ( ewww_image_optimizer_iterable( $pictures ) ) {
616
  */
617
  function validate_image_url( $image ) {
618
  ewwwio_debug_message( "webp validation for $image" );
619
+ if ( strpos( $image, 'assets/images/dummy.png' ) || strpos( $image, 'base64,R0lGOD' ) || strpos( $image, 'lazy-load/images/1x1' ) || strpos( $image, 'assets/images/transparent.png' ) || strpos( $image, 'assets/images/lazy' ) ) {
620
  ewwwio_debug_message( 'lazy load placeholder' );
621
  return false;
622
  }
classes/class-ewwwio-gd-editor.php CHANGED
@@ -546,6 +546,7 @@ if ( class_exists( 'Bbpp_Animated_Gif' ) ) {
546
  unset( $this->ewww_image );
547
  return parent::_save( $image, $filename, $mime_type );
548
  }
 
549
  if ( ( ! defined( 'EWWWIO_EDITOR_OVERWRITE' ) || ! EWWWIO_EDITOR_OVERWRITE ) && is_file( $filename ) && empty( $ewww_preempt_editor ) ) {
550
  ewwwio_debug_message( "detected existing file: $filename" );
551
  $current_size = getimagesize( $filename );
546
  unset( $this->ewww_image );
547
  return parent::_save( $image, $filename, $mime_type );
548
  }
549
+ global $ewww_preempt_editor;
550
  if ( ( ! defined( 'EWWWIO_EDITOR_OVERWRITE' ) || ! EWWWIO_EDITOR_OVERWRITE ) && is_file( $filename ) && empty( $ewww_preempt_editor ) ) {
551
  ewwwio_debug_message( "detected existing file: $filename" );
552
  $current_size = getimagesize( $filename );
classes/class-ewwwio-imagick-editor.php CHANGED
@@ -250,9 +250,6 @@ if ( class_exists( 'WP_Thumb_Image_Editor_Imagick' ) ) {
250
  */
251
  protected function _save( $image, $filename = null, $mime_type = null ) {
252
  global $ewww_preempt_editor;
253
- if ( ! empty( $ewww_preempt_editor ) ) {
254
- return parent::_save( $image, $filename, $mime_type );
255
- }
256
  list( $filename, $extension, $mime_type ) = $this->get_output_format( $filename, $mime_type );
257
  if ( ! $filename ) {
258
  $filename = $this->generate_filename( null, null, $extension );
@@ -264,9 +261,7 @@ if ( class_exists( 'WP_Thumb_Image_Editor_Imagick' ) ) {
264
  }
265
  $upload_dir = wp_upload_dir();
266
 
267
- if ( strpos( $filename, $upload_dir['basedir'] ) === 0 ) {
268
- $temp_filename = tempnam( get_temp_dir(), 's3-uploads' );
269
- }
270
 
271
  $saved = parent::_save( $image, $temp_filename, $mime_type );
272
 
@@ -275,7 +270,7 @@ if ( class_exists( 'WP_Thumb_Image_Editor_Imagick' ) ) {
275
  unset( $s3_uploads_image );
276
  return $saved;
277
  }
278
- if ( is_file( $saved['path'] ) ) {
279
  $temp_filename = $saved['path'];
280
  ewww_image_optimizer( $temp_filename );
281
  ewwwio_debug_message( "image editor (s3 uploads) saved: $temp_filename" );
250
  */
251
  protected function _save( $image, $filename = null, $mime_type = null ) {
252
  global $ewww_preempt_editor;
 
 
 
253
  list( $filename, $extension, $mime_type ) = $this->get_output_format( $filename, $mime_type );
254
  if ( ! $filename ) {
255
  $filename = $this->generate_filename( null, null, $extension );
261
  }
262
  $upload_dir = wp_upload_dir();
263
 
264
+ $temp_filename = tempnam( get_temp_dir(), 's3-uploads' );
 
 
265
 
266
  $saved = parent::_save( $image, $temp_filename, $mime_type );
267
 
270
  unset( $s3_uploads_image );
271
  return $saved;
272
  }
273
+ if ( is_file( $saved['path'] ) && empty( $ewww_preempt_editor ) ) {
274
  $temp_filename = $saved['path'];
275
  ewww_image_optimizer( $temp_filename );
276
  ewwwio_debug_message( "image editor (s3 uploads) saved: $temp_filename" );
classes/class-ewwwio-page-parser.php CHANGED
@@ -160,17 +160,21 @@ class EWWWIO_Page_Parser {
160
  function set_attribute( &$element, $name, $value, $replace = false ) {
161
  if ( $replace ) {
162
  $new_element = preg_replace( '#' . $name . '\s*=\s*(["\'])([^\1]+?)\1#is', "$name=$1$value$1", $element );
163
- if ( $new_element !== $element ) {
164
  $element = $new_element;
165
  return;
166
  }
167
  $element = preg_replace( '#' . $name . '\s*=\s*([^\s]+?)#is', '', $element );
168
  }
 
 
 
 
169
  if ( false === strpos( $value, '"' ) ) {
170
- $element = rtrim( $element, '>' ) . " $name=\"$value\">";
171
  return;
172
  }
173
- $element = rtrim( $element, '>' ) . " $name='$value'>";
174
  }
175
 
176
  /**
160
  function set_attribute( &$element, $name, $value, $replace = false ) {
161
  if ( $replace ) {
162
  $new_element = preg_replace( '#' . $name . '\s*=\s*(["\'])([^\1]+?)\1#is', "$name=$1$value$1", $element );
163
+ if ( strpos( $new_element, "$name=" ) ) {
164
  $element = $new_element;
165
  return;
166
  }
167
  $element = preg_replace( '#' . $name . '\s*=\s*([^\s]+?)#is', '', $element );
168
  }
169
+ $closing = ' />';
170
+ if ( false === strpos( $element, '/>' ) ) {
171
+ $closing = '>';
172
+ }
173
  if ( false === strpos( $value, '"' ) ) {
174
+ $element = rtrim( $element, $closing ) . " $name=\"$value\"$closing";
175
  return;
176
  }
177
+ $element = rtrim( $element, $closing ) . " $name='$value'$closing";
178
  }
179
 
180
  /**
classes/class-exactdn.php CHANGED
@@ -726,6 +726,11 @@ class ExactDN extends EWWWIO_Page_Parser {
726
  $lazy = true;
727
  }
728
 
 
 
 
 
 
729
  // Check if image URL should be used with ExactDN.
730
  if ( $this->validate_image_url( $src ) ) {
731
  ewwwio_debug_message( 'url validated' );
@@ -970,6 +975,7 @@ class ExactDN extends EWWWIO_Page_Parser {
970
  }
971
  if ( $srcset_fill && ! ewww_image_optimizer_get_option( 'exactdn_prevent_srcset_fill' ) && false !== strpos( $src, $this->exactdn_domain ) ) {
972
  if ( ! $this->get_attribute( $images['img_tag'][ $index ], $this->srcset_attr ) && ! $this->get_attribute( $images['img_tag'][ $index ], 'sizes' ) ) {
 
973
  $zoom = false;
974
  // If $width is empty, we'll search the url for a width param, then we try searching the img element, with fall back to the filename.
975
  if ( empty( $width ) || ! is_numeric( $width ) ) {
@@ -1010,12 +1016,14 @@ class ExactDN extends EWWWIO_Page_Parser {
1010
  $escaped_upload_domain = str_replace( '.', '\.', ltrim( $this->upload_domain, 'w.' ) );
1011
  ewwwio_debug_message( $escaped_upload_domain );
1012
  if ( ! empty( $this->user_exclusions ) ) {
1013
- $content = preg_replace( '#(https?:)?//(?:www\.)?' . $escaped_upload_domain . '([^"\'?>]+?)?/wp-content/([^"\'?>]+?)?(' . implode( '|', $this->user_exclusions ) . ')#i', '$1://' . $this->upload_domain . '$2/?wpcontent-bypass?/$3$4', $content );
 
 
 
 
1014
  }
1015
- // Pre-empt rewriting of simple-social-icons SVG (because they aren't allowed in use tags.
1016
- $content = preg_replace( '#(https?:)?//(?:www\.)?' . $escaped_upload_domain . '([^"\'?>]+?)?/wp-content/plugins/simple-social-icons#i', '$1//' . $this->upload_domain . '$2/?wpcontent-bypass?/plugins/simple-social-icons', $content );
1017
  // Pre-empt rewriting of wp-includes and wp-content if the extension is not allowed by using a temporary placeholder.
1018
- $content = preg_replace( '#(https?:)?//(?:www\.)?' . $escaped_upload_domain . '([^"\'?>]+?)?/wp-content/([^"\'?>]+?)\.(php|ashx|m4v|mov|wvm|qt|webm|ogv|mp4|m4p|mpg|mpeg|mpv)#i', '$1://' . $this->upload_domain . '$2/?wpcontent-bypass?/$3.$4', $content );
1019
  $content = str_replace( 'wp-content/themes/jupiter"', '?wpcontent-bypass?/themes/jupiter"', $content );
1020
  $content = preg_replace( '#(https?:)?//(?:www\.)?' . $escaped_upload_domain . '/([^"\'?>]+?)?(nextgen-image|wp-includes|wp-content)/#i', '$1//' . $this->exactdn_domain . '/$2$3/', $content );
1021
  $content = str_replace( '?wpcontent-bypass?', 'wp-content', $content );
@@ -1378,6 +1386,8 @@ class ExactDN extends EWWWIO_Page_Parser {
1378
  $upload_dir = wp_get_upload_dir();
1379
  $resize_existing = defined( 'EXACTDN_RESIZE_EXISTING' ) && EXACTDN_RESIZE_EXISTING;
1380
 
 
 
1381
  foreach ( $sources as $i => $source ) {
1382
  if ( ! $this->validate_image_url( $source['url'] ) ) {
1383
  continue;
@@ -1423,8 +1433,6 @@ class ExactDN extends EWWWIO_Page_Parser {
1423
  /**
1424
  * At this point, $sources is the original srcset with ExactDN URLs.
1425
  * Now, we're going to construct additional sizes based on multiples of the content_width.
1426
- * TODO: Then we will also insert additional sizes from the ExactDN feedback loop.
1427
- * This will reduce the gap between the largest defined size and the original image.
1428
  */
1429
 
1430
  /**
@@ -1453,7 +1461,7 @@ class ExactDN extends EWWWIO_Page_Parser {
1453
  $fullheight = $image_meta['height'];
1454
  $reqwidth = $size_array[0];
1455
  $reqheight = $size_array[1];
1456
- ewwwio_debug_message( "requested w $reqwidth h $reqheight full w $fullwidth full h $fullheight" );
1457
 
1458
  $constrained_size = wp_constrain_dimensions( $fullwidth, $fullheight, $reqwidth );
1459
  $expected_size = array( $reqwidth, $reqheight );
@@ -1461,9 +1469,11 @@ class ExactDN extends EWWWIO_Page_Parser {
1461
  ewwwio_debug_message( $constrained_size[0] );
1462
  ewwwio_debug_message( $constrained_size[1] );
1463
  if ( abs( $constrained_size[0] - $expected_size[0] ) <= 1 && abs( $constrained_size[1] - $expected_size[1] ) <= 1 ) {
 
1464
  $crop = 'soft';
1465
  $base = $this->get_content_width() ? $this->get_content_width() : 1900; // Provide a default width if none set by the theme.
1466
  } else {
 
1467
  $crop = 'hard';
1468
  $base = $reqwidth;
1469
  }
@@ -1475,6 +1485,9 @@ class ExactDN extends EWWWIO_Page_Parser {
1475
  foreach ( $multipliers as $multiplier ) {
1476
 
1477
  $newwidth = intval( $base * $multiplier );
 
 
 
1478
  foreach ( $currentwidths as $currentwidth ) {
1479
  // If a new width would be within 50 pixels of an existing one or larger than the full size image, skip.
1480
  if ( abs( $currentwidth - $newwidth ) < 50 || ( $newwidth > $fullwidth ) ) {
@@ -1482,7 +1495,7 @@ class ExactDN extends EWWWIO_Page_Parser {
1482
  }
1483
  } // foreach ( $currentwidths as $currentwidth ){
1484
 
1485
- if ( 1 === $multiplier ) {
1486
  $args = array();
1487
  } elseif ( 'soft' == $crop ) {
1488
  $args = array(
@@ -1502,7 +1515,10 @@ class ExactDN extends EWWWIO_Page_Parser {
1502
  'descriptor' => 'w',
1503
  'value' => $newwidth,
1504
  );
 
 
1505
  } // foreach ( $multipliers as $multiplier )
 
1506
  if ( is_array( $newsources ) ) {
1507
  $sources = array_replace( $sources, $newsources );
1508
  }
@@ -1581,7 +1597,8 @@ class ExactDN extends EWWWIO_Page_Parser {
1581
  if ( ! $width ) {
1582
  return '';
1583
  }
1584
- $srcset = '';
 
1585
 
1586
  if (
1587
  /** Short-circuit via exactdn_srcset_multipliers filter. */
@@ -1594,6 +1611,15 @@ class ExactDN extends EWWWIO_Page_Parser {
1594
 
1595
  foreach ( $multipliers as $multiplier ) {
1596
  $newwidth = intval( $width * $multiplier );
 
 
 
 
 
 
 
 
 
1597
  if ( $filename_width && $newwidth > $filename_width ) {
1598
  continue;
1599
  }
@@ -1615,6 +1641,8 @@ class ExactDN extends EWWWIO_Page_Parser {
1615
  'descriptor' => 'w',
1616
  'value' => $newwidth,
1617
  );
 
 
1618
  }
1619
  }
1620
  if ( ! empty( $sources ) ) {
726
  $lazy = true;
727
  }
728
 
729
+ // Check for relative urls that start with a slash. Unlikely that we'll attempt relative urls beyond that.
730
+ if ( '/' === substr( $src, 0, 1 ) && '/' !== substr( $src, 1, 1 ) ) {
731
+ $src = '//' . $this->upload_domain . $src;
732
+ }
733
+
734
  // Check if image URL should be used with ExactDN.
735
  if ( $this->validate_image_url( $src ) ) {
736
  ewwwio_debug_message( 'url validated' );
975
  }
976
  if ( $srcset_fill && ! ewww_image_optimizer_get_option( 'exactdn_prevent_srcset_fill' ) && false !== strpos( $src, $this->exactdn_domain ) ) {
977
  if ( ! $this->get_attribute( $images['img_tag'][ $index ], $this->srcset_attr ) && ! $this->get_attribute( $images['img_tag'][ $index ], 'sizes' ) ) {
978
+ ewwwio_debug_message( "srcset filling with $src" );
979
  $zoom = false;
980
  // If $width is empty, we'll search the url for a width param, then we try searching the img element, with fall back to the filename.
981
  if ( empty( $width ) || ! is_numeric( $width ) ) {
1016
  $escaped_upload_domain = str_replace( '.', '\.', ltrim( $this->upload_domain, 'w.' ) );
1017
  ewwwio_debug_message( $escaped_upload_domain );
1018
  if ( ! empty( $this->user_exclusions ) ) {
1019
+ $content = preg_replace( '#(https?:)?//(?:www\.)?' . $escaped_upload_domain . '([^"\'?>]+?)?/wp-content/([^"\'?>]+?)?(' . implode( '|', $this->user_exclusions ) . ')#i', '$1//' . $this->upload_domain . '$2/?wpcontent-bypass?/$3$4', $content );
1020
+ }
1021
+ if ( strpos( $content, '<use ' ) ) {
1022
+ // Pre-empt rewriting of files within <use> tags, particularly to prevent security errors for SVGs.
1023
+ $content = preg_replace( '#(<use.+?href=["\'])(https?:)?//(?:www\.)?' . $escaped_upload_domain . '([^"\'?>]+?)/wp-content/#is', '$1$2//' . $this->upload_domain . '$3/?wpcontent-bypass?/', $content );
1024
  }
 
 
1025
  // Pre-empt rewriting of wp-includes and wp-content if the extension is not allowed by using a temporary placeholder.
1026
+ $content = preg_replace( '#(https?:)?//(?:www\.)?' . $escaped_upload_domain . '([^"\'?>]+?)?/wp-content/([^"\'?>]+?)\.(php|ashx|m4v|mov|wvm|qt|webm|ogv|mp4|m4p|mpg|mpeg|mpv)#i', '$1//' . $this->upload_domain . '$2/?wpcontent-bypass?/$3.$4', $content );
1027
  $content = str_replace( 'wp-content/themes/jupiter"', '?wpcontent-bypass?/themes/jupiter"', $content );
1028
  $content = preg_replace( '#(https?:)?//(?:www\.)?' . $escaped_upload_domain . '/([^"\'?>]+?)?(nextgen-image|wp-includes|wp-content)/#i', '$1//' . $this->exactdn_domain . '/$2$3/', $content );
1029
  $content = str_replace( '?wpcontent-bypass?', 'wp-content', $content );
1386
  $upload_dir = wp_get_upload_dir();
1387
  $resize_existing = defined( 'EXACTDN_RESIZE_EXISTING' ) && EXACTDN_RESIZE_EXISTING;
1388
 
1389
+ ewwwio_debug_message( 'current list has ' . count( $sources ) . ' image(s)' );
1390
+
1391
  foreach ( $sources as $i => $source ) {
1392
  if ( ! $this->validate_image_url( $source['url'] ) ) {
1393
  continue;
1433
  /**
1434
  * At this point, $sources is the original srcset with ExactDN URLs.
1435
  * Now, we're going to construct additional sizes based on multiples of the content_width.
 
 
1436
  */
1437
 
1438
  /**
1461
  $fullheight = $image_meta['height'];
1462
  $reqwidth = $size_array[0];
1463
  $reqheight = $size_array[1];
1464
+ ewwwio_debug_message( "filling additional sizes with requested w $reqwidth h $reqheight full w $fullwidth full h $fullheight" );
1465
 
1466
  $constrained_size = wp_constrain_dimensions( $fullwidth, $fullheight, $reqwidth );
1467
  $expected_size = array( $reqwidth, $reqheight );
1469
  ewwwio_debug_message( $constrained_size[0] );
1470
  ewwwio_debug_message( $constrained_size[1] );
1471
  if ( abs( $constrained_size[0] - $expected_size[0] ) <= 1 && abs( $constrained_size[1] - $expected_size[1] ) <= 1 ) {
1472
+ ewwwio_debug_message( 'soft cropping' );
1473
  $crop = 'soft';
1474
  $base = $this->get_content_width() ? $this->get_content_width() : 1900; // Provide a default width if none set by the theme.
1475
  } else {
1476
+ ewwwio_debug_message( 'hard cropping' );
1477
  $crop = 'hard';
1478
  $base = $reqwidth;
1479
  }
1485
  foreach ( $multipliers as $multiplier ) {
1486
 
1487
  $newwidth = intval( $base * $multiplier );
1488
+ if ( $newwidth < 50 ) {
1489
+ continue;
1490
+ }
1491
  foreach ( $currentwidths as $currentwidth ) {
1492
  // If a new width would be within 50 pixels of an existing one or larger than the full size image, skip.
1493
  if ( abs( $currentwidth - $newwidth ) < 50 || ( $newwidth > $fullwidth ) ) {
1495
  }
1496
  } // foreach ( $currentwidths as $currentwidth ){
1497
 
1498
+ if ( 1 === $multiplier && abs( $newwidth - $fullwidth ) < 5 ) {
1499
  $args = array();
1500
  } elseif ( 'soft' == $crop ) {
1501
  $args = array(
1515
  'descriptor' => 'w',
1516
  'value' => $newwidth,
1517
  );
1518
+
1519
+ $currentwidths[] = $newwidth;
1520
  } // foreach ( $multipliers as $multiplier )
1521
+
1522
  if ( is_array( $newsources ) ) {
1523
  $sources = array_replace( $sources, $newsources );
1524
  }
1597
  if ( ! $width ) {
1598
  return '';
1599
  }
1600
+ $srcset = '';
1601
+ $currentwidths = array();
1602
 
1603
  if (
1604
  /** Short-circuit via exactdn_srcset_multipliers filter. */
1611
 
1612
  foreach ( $multipliers as $multiplier ) {
1613
  $newwidth = intval( $width * $multiplier );
1614
+ if ( $newwidth < 50 ) {
1615
+ continue;
1616
+ }
1617
+ foreach ( $currentwidths as $currentwidth ) {
1618
+ // If a new width would be within 50 pixels of an existing one or larger than the full size image, skip.
1619
+ if ( abs( $currentwidth - $newwidth ) < 50 ) {
1620
+ continue 2; // Back to the foreach ( $multipliers as $multiplier ).
1621
+ }
1622
+ } // foreach ( $currentwidths as $currentwidth ){
1623
  if ( $filename_width && $newwidth > $filename_width ) {
1624
  continue;
1625
  }
1641
  'descriptor' => 'w',
1642
  'value' => $newwidth,
1643
  );
1644
+
1645
+ $currentwidths[] = $newwidth;
1646
  }
1647
  }
1648
  if ( ! empty( $sources ) ) {
common.php CHANGED
@@ -10,7 +10,6 @@
10
  * @package EWWW_Image_Optimizer
11
  */
12
 
13
- // TODO: attempt lazy load support with a3 plugin and one from automattic for alt webp. or are we back here: https://developers.google.com/web/fundamentals/performance/lazy-loading-guidance/images-and-video/
14
  // TODO: might be able to use the Custom Bulk Actions in 4.7 to support the bulk optimize drop-down menu.
15
  // TODO: need to make the scheduler so it can resume without having to re-run the queue population, and then we can probably also flush the queue when scheduled opt starts, but later it would be nice to implement the bulk_loop as the aux_loop so that it could handle media properly.
16
  // TODO: Add a custom async function for parallel mode to store image as pending and use the row ID instead of relative path.
@@ -18,14 +17,13 @@
18
  // TODO: write some conversion tests.
19
  // TODO: check this patch, to see if the use of 'full' causes any issues: https://core.trac.wordpress.org/ticket/37840 .
20
  // TODO: use this: https://codex.wordpress.org/AJAX_in_Plugins#The_post-load_JavaScript_Event .
21
- // TODO: relative urls with ExactDN: https://github.com/nosilver4u/ewww-image-optimizer/issues/17 .
22
- // TODO: avoid ExactDN + SVG issues in <use> tags: https://github.com/nosilver4u/ewww-image-optimizer/issues/18 .
23
  // TODO: can some of the bulk "fallbacks" be implemented for async processing?
 
24
  if ( ! defined( 'ABSPATH' ) ) {
25
  exit;
26
  }
27
 
28
- define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '442.0' );
29
 
30
  // Initialize a couple globals.
31
  $ewww_debug = '';
@@ -819,6 +817,13 @@ function ewww_image_optimizer_ajax_compat_check() {
819
  ewww_image_optimizer_image_sizes( false );
820
  return;
821
  }
 
 
 
 
 
 
 
822
  }
823
  // Check for Image Watermark plugin.
824
  if ( ! empty( $_POST['iw-action'] ) ) {
@@ -1320,7 +1325,7 @@ function ewww_image_optimizer_pngout_installed() {
1320
  * Display a notice that PHP version 5.5 support is going away.
1321
  */
1322
  function ewww_image_optimizer_php55_warning() {
1323
- echo '<div id="ewww-image-optimizer-notice-php55" class="notice notice-info"><p><a href="https://docs.ewww.io/article/55-upgrading-php" target="_blank" data-beacon-article="5ab2baa6042863478ea7c2ae">' . esc_html__( 'The next major release of EWWW Image Optimizer will require PHP 5.6 or greater. Newer versions of PHP, like 5.6, 7.0 and 7.1, are significantly faster and much more secure. If you are unsure how to upgrade to a supported version, ask your webhost for instructions.', 'ewww-image-optimizer' ) . '</a></p></div>';
1324
  }
1325
 
1326
  /**
@@ -5629,7 +5634,7 @@ function ewww_image_optimizer_detect_wpsf_location_lock() {
5629
  function ewww_image_optimizer_as3cf_attachment_file_paths( $paths, $id ) {
5630
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
5631
  foreach ( $paths as $size => $path ) {
5632
- if ( is_string( $path ) ) {
5633
  $paths[ $size . '-webp' ] = $path . '.webp';
5634
  ewwwio_debug_message( "added $path.webp to as3cf queue" );
5635
  }
@@ -7441,6 +7446,8 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
7441
  ewww_image_optimizer_get_option( 'ewww_image_optimizer_maxotherheight' )
7442
  ) {
7443
  $resize_score += 30;
 
 
7444
  } else {
7445
  $resize_recommendations[] = esc_html__( 'Configure maximum image dimensions in Resize settings.', 'ewww-image-optimizer' ) . ewwwio_help_link( 'https://docs.ewww.io/article/41-resize-settings', '59849911042863033a1ba5f9' );
7446
  }
@@ -7964,7 +7971,7 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
7964
  $output[] = "</table>\n</div>\n";
7965
  $output[] = "<div id='ewww-webp-settings'>\n";
7966
  $output[] = "<table class='form-table'>\n";
7967
- if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) {
7968
  $output[] = "<tr class='$network_class'><th scope='row'><label for='ewww_image_optimizer_webp'>" . esc_html__( 'JPG/PNG to WebP', 'ewww-image-optimizer' ) . '</label>' .
7969
  ewwwio_help_link( 'https://docs.ewww.io/article/16-ewww-io-and-webp-images', '5854745ac697912ffd6c1c89' ) .
7970
  "</th><td><span><input type='checkbox' id='ewww_image_optimizer_webp' name='ewww_image_optimizer_webp' value='true' " .
10
  * @package EWWW_Image_Optimizer
11
  */
12
 
 
13
  // TODO: might be able to use the Custom Bulk Actions in 4.7 to support the bulk optimize drop-down menu.
14
  // TODO: need to make the scheduler so it can resume without having to re-run the queue population, and then we can probably also flush the queue when scheduled opt starts, but later it would be nice to implement the bulk_loop as the aux_loop so that it could handle media properly.
15
  // TODO: Add a custom async function for parallel mode to store image as pending and use the row ID instead of relative path.
17
  // TODO: write some conversion tests.
18
  // TODO: check this patch, to see if the use of 'full' causes any issues: https://core.trac.wordpress.org/ticket/37840 .
19
  // TODO: use this: https://codex.wordpress.org/AJAX_in_Plugins#The_post-load_JavaScript_Event .
 
 
20
  // TODO: can some of the bulk "fallbacks" be implemented for async processing?
21
+ // TODO: check to see if we can use PHP and WP core is_iterable and is_countable functions.
22
  if ( ! defined( 'ABSPATH' ) ) {
23
  exit;
24
  }
25
 
26
+ define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '450.0' );
27
 
28
  // Initialize a couple globals.
29
  $ewww_debug = '';
817
  ewww_image_optimizer_image_sizes( false );
818
  return;
819
  }
820
+ if ( 'mic_crop_image' == $_REQUEST['action'] ) {
821
+ ewwwio_debug_message( 'doing Manual Image Crop' );
822
+ if ( ! defined( 'EWWWIO_EDITOR_OVERWRITE' ) ) {
823
+ define( 'EWWWIO_EDITOR_OVERWRITE', true );
824
+ }
825
+ return;
826
+ }
827
  }
828
  // Check for Image Watermark plugin.
829
  if ( ! empty( $_POST['iw-action'] ) ) {
1325
  * Display a notice that PHP version 5.5 support is going away.
1326
  */
1327
  function ewww_image_optimizer_php55_warning() {
1328
+ echo '<div id="ewww-image-optimizer-notice-php55" class="notice notice-info"><p><a href="https://docs.ewww.io/article/55-upgrading-php" target="_blank" data-beacon-article="5ab2baa6042863478ea7c2ae">' . esc_html__( 'The next major release of EWWW Image Optimizer will require PHP 5.6 or greater. Newer versions of PHP, like 7.1 and 7.2, are significantly faster and much more secure. If you are unsure how to upgrade to a supported version, ask your webhost for instructions.', 'ewww-image-optimizer' ) . '</a></p></div>';
1329
  }
1330
 
1331
  /**
5634
  function ewww_image_optimizer_as3cf_attachment_file_paths( $paths, $id ) {
5635
  ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
5636
  foreach ( $paths as $size => $path ) {
5637
+ if ( is_string( $path ) && is_file( $path . '.webp' ) ) {
5638
  $paths[ $size . '-webp' ] = $path . '.webp';
5639
  ewwwio_debug_message( "added $path.webp to as3cf queue" );
5640
  }
7446
  ewww_image_optimizer_get_option( 'ewww_image_optimizer_maxotherheight' )
7447
  ) {
7448
  $resize_score += 30;
7449
+ } elseif ( defined( 'IMSANITY_VERSION' ) ) {
7450
+ $resize_score += 30;
7451
  } else {
7452
  $resize_recommendations[] = esc_html__( 'Configure maximum image dimensions in Resize settings.', 'ewww-image-optimizer' ) . ewwwio_help_link( 'https://docs.ewww.io/article/41-resize-settings', '59849911042863033a1ba5f9' );
7453
  }
7971
  $output[] = "</table>\n</div>\n";
7972
  $output[] = "<div id='ewww-webp-settings'>\n";
7973
  $output[] = "<table class='form-table'>\n";
7974
+ if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) || ewww_image_optimizer_get_option( 'ewww_image_optimizer_webp' ) ) {
7975
  $output[] = "<tr class='$network_class'><th scope='row'><label for='ewww_image_optimizer_webp'>" . esc_html__( 'JPG/PNG to WebP', 'ewww-image-optimizer' ) . '</label>' .
7976
  ewwwio_help_link( 'https://docs.ewww.io/article/16-ewww-io-and-webp-images', '5854745ac697912ffd6c1c89' ) .
7977
  "</th><td><span><input type='checkbox' id='ewww_image_optimizer_webp' name='ewww_image_optimizer_webp' value='true' " .
docs/CONTRIBUTING.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to EWWW IO
2
+
3
+ :+1::tada: First off, thanks for taking the time to contribute! :tada::+1:
4
+
5
+ ## Code of Conduct
6
+
7
+ Someday, we'll have something more substantial. For now, let's keep it simple:
8
+
9
+ * Be nice, you'll catch more flies with honey (or something like that)
10
+ * Do not file an issue to ask for support. Issues are for bugs and feature requests, but if you have a question, you can [contact us](https://ewww.io/contact-us/) directly.
11
+ * Do not issue a pull request without submitting an Issue first.
12
+
13
+ ## Coding Standards
14
+
15
+ All PHP code submitted must follow the [WordPress Coding Standards](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards), specifically the Core ruleset. All commits are automatically tested for this, but it helps if you know what the [rules are](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/). JS and CSS code is honestly a bit unruly at this point.
16
+
17
+ ## Reporting Issues
18
+
19
+ When you submit a bug:
20
+
21
+ * Include as much detail as possible. If you're not sure about something, include it anyway.
22
+ * Include steps to reproduce the issue, in as much detail as possible, including other plugins/themes that are involved, and settings that may affect the bug.
23
+ * Explain what behavior you expected to see, and point out exactly what you saw instead that was not expected.
24
+ * If applicable, provide screenshots.
25
+ * Provide images that you've used to reproduce the issue.
26
+ * Enable EWWW IO's debugging option and provide as much of it as possible. You may wish to redact the user account and file system paths listed.
27
+ * Check older versions to see if it is a regression. You can download them from the [Advanced section at wordpress.org](https://wordpress.org/plugins/ewww-image-optimizer/advanced/).
ewww-image-optimizer.php CHANGED
@@ -12,9 +12,9 @@
12
  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: Shane Bishop
16
  Text Domain: ewww-image-optimizer
17
- Version: 4.4.2
18
  Author URI: https://ewww.io/
19
  License: GPLv3
20
  */
@@ -37,7 +37,7 @@ if ( ! defined( 'EWWW_IMAGE_OPTIMIZER_TOOL_PATH' ) ) {
37
  }
38
 
39
  // Check the PHP version.
40
- if ( ! defined( 'PHP_VERSION_ID' ) || PHP_VERSION_ID < 50500 ) {
41
  add_action( 'network_admin_notices', 'ewww_image_optimizer_unsupported_php' );
42
  add_action( 'admin_notices', 'ewww_image_optimizer_unsupported_php' );
43
  // Loads the plugin translations.
@@ -135,7 +135,7 @@ if ( ! function_exists( 'ewww_image_optimizer_unsupported_php' ) ) {
135
  * Display a notice that the PHP version is too old.
136
  */
137
  function ewww_image_optimizer_unsupported_php() {
138
- echo '<div id="ewww-image-optimizer-warning-php" class="error"><p><a href="https://docs.ewww.io/article/55-upgrading-php" target="_blank" data-beacon-article="5ab2baa6042863478ea7c2ae">' . esc_html__( 'EWWW Image Optimizer requires PHP 5.5 or greater. Newer versions of PHP, like 5.6, 7.0 and 7.1, are significantly faster and much more secure. If you are unsure how to upgrade to a supported version, ask your webhost for instructions.', 'ewww-image-optimizer' ) . '</a></p></div>';
139
  }
140
 
141
  /**
12
  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
  Text Domain: ewww-image-optimizer
17
+ Version: 4.5.0
18
  Author URI: https://ewww.io/
19
  License: GPLv3
20
  */
37
  }
38
 
39
  // Check the PHP version.
40
+ if ( ! defined( 'PHP_VERSION_ID' ) || PHP_VERSION_ID < 50600 ) {
41
  add_action( 'network_admin_notices', 'ewww_image_optimizer_unsupported_php' );
42
  add_action( 'admin_notices', 'ewww_image_optimizer_unsupported_php' );
43
  // Loads the plugin translations.
135
  * Display a notice that the PHP version is too old.
136
  */
137
  function ewww_image_optimizer_unsupported_php() {
138
+ echo '<div id="ewww-image-optimizer-warning-php" class="error"><p><a href="https://docs.ewww.io/article/55-upgrading-php" target="_blank" data-beacon-article="5ab2baa6042863478ea7c2ae">' . esc_html__( 'EWWW Image Optimizer requires PHP 5.6 or greater. Newer versions of PHP, like 7.1 and 7.2, are significantly faster and much more secure. If you are unsure how to upgrade to a supported version, ask your webhost for instructions.', 'ewww-image-optimizer' ) . '</a></p></div>';
139
  }
140
 
141
  /**
includes/load_webp.js CHANGED
@@ -480,218 +480,102 @@ function check_webp_feature(feature, callback) {
480
  }
481
  function ewww_load_images(ewww_webp_supported) {
482
  (function($) {
 
 
 
 
 
 
 
 
483
  var attr_prefix = 'data-';
484
  function ewww_copy_attrs(ewww_nscript, ewww_img) {
485
  var attrs = ['align','alt','border','crossorigin','height','hspace','ismap','longdesc','usemap','vspace','width','accesskey','class','contenteditable','contextmenu','dir','draggable','dropzone','hidden','id','lang','spellcheck','style','tabindex','title','translate','sizes','data-caption','data-attachment-id','data-permalink','data-orig-size','data-comments-opened','data-image-meta','data-image-title','data-image-description','data-event-trigger','data-highlight-color','data-highlight-opacity','data-highlight-border-color','data-highlight-border-width','data-highlight-border-opacity','data-no-lazy','data-lazy','data-large_image_width','data-large_image_height'];
486
  for (var i = 0, len = attrs.length; i < len; i++) {
487
- var ewww_attr = $(ewww_nscript).attr(attr_prefix + attrs[i]);
488
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
489
- $(ewww_img).attr(attrs[i], ewww_attr);
490
- }
491
  }
492
  return ewww_img;
493
  }
494
  if (ewww_webp_supported) {
495
  $('.batch-image img, .image-wrapper a, .ngg-pro-masonry-item a, .ngg-galleria-offscreen-seo-wrapper a').each(function() {
496
- var ewww_attr = $(this).attr('data-webp');
497
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
498
- $(this).attr('data-src', ewww_attr);
499
- }
500
- var ewww_attr = $(this).attr('data-webp-thumbnail');
501
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
502
- $(this).attr('data-thumbnail', ewww_attr);
503
- }
504
  });
505
  $('.image-wrapper a, .ngg-pro-masonry-item a').each(function() {
506
- var ewww_attr = $(this).attr('data-webp');
507
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
508
- $(this).attr('href', ewww_attr);
509
- }
510
  });
511
  $('.rev_slider ul li').each(function() {
512
- var ewww_attr = $(this).attr('data-webp-thumb');
513
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
514
- $(this).attr('data-thumb', ewww_attr);
515
- }
516
  var param_num = 1;
517
  while ( param_num < 11 ) {
518
- var ewww_attr = $(this).attr('data-webp-param' + param_num);
519
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
520
- $(this).attr('data-param' + param_num, ewww_attr);
521
- }
522
  param_num++;
523
  }
524
  });
525
  $('.rev_slider img').each(function() {
526
- var ewww_attr = $(this).attr('data-webp-lazyload');
527
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
528
- $(this).attr('data-lazyload', ewww_attr);
529
- }
530
  });
531
  $('div.woocommerce-product-gallery__image').each(function() {
532
- var ewww_attr = $(this).attr('data-webp-thumb');
533
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
534
- $(this).attr('data-thumb', ewww_attr);
535
- }
536
  });
537
  }
 
538
  $('img.ewww_webp_lazy_retina').each(function() {
539
  if (ewww_webp_supported) {
540
- var ewww_attr = $(this).attr('data-srcset-webp');
541
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
542
- $(this).attr('data-srcset', ewww_attr);
543
- }
544
- } else {
545
- var ewww_attr = $(this).attr('data-srcset-img');
546
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
547
- $(this).attr('data-srcset', ewww_attr);
548
- }
549
  }
550
  $(this).removeClass('ewww_webp_lazy_retina');
551
  });
552
  $('video').each(function() {
553
  if (ewww_webp_supported) {
554
- var ewww_attr = $(this).attr('data-poster-webp');
555
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
556
- $(this).attr('poster', ewww_attr);
557
- }
558
  } else {
559
- var ewww_attr = $(this).attr('data-poster-image');
560
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
561
- $(this).attr('poster', ewww_attr);
562
- }
563
  }
564
  });
565
  $('img.ewww_webp_lazy_load').each(function() {
566
  if (ewww_webp_supported) {
567
- $(this).attr('data-lazy-src', $(this).attr('data-lazy-webp-src'));
568
- var ewww_attr = $(this).attr('data-srcset-webp');
569
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
570
- $(this).attr('srcset', ewww_attr);
571
- }
572
- var ewww_attr = $(this).attr('data-lazy-srcset-webp');
573
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
574
- $(this).attr('data-lazy-srcset', ewww_attr);
575
- }
576
- } else {
577
- $(this).attr('data-lazy-src', $(this).attr('data-lazy-img-src'));
578
- var ewww_attr = $(this).attr('data-srcset');
579
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
580
- $(this).attr('srcset', ewww_attr);
581
- }
582
- var ewww_attr = $(this).attr('data-lazy-srcset-img');
583
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
584
- $(ewww_img).attr('data-lazy-srcset', ewww_attr);
585
- }
586
  }
587
  $(this).removeClass('ewww_webp_lazy_load');
588
  });
589
- $('.ewww_webp_lazy_hueman').each(function() {
590
- var ewww_img = document.createElement('img');
591
- $(ewww_img).attr('src', $(this).attr('data-src'));
592
- if (ewww_webp_supported) {
593
- $(ewww_img).attr('data-src', $(this).attr('data-webp-src'));
594
- var ewww_attr = $(this).attr('data-srcset-webp');
595
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
596
- $(ewww_img).attr('data-srcset', ewww_attr);
597
- }
598
- } else {
599
- $(ewww_img).attr('data-src', $(this).attr('data-img'));
600
- var ewww_attr = $(this).attr('data-srcset-img');
601
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
602
- $(ewww_img).attr('data-srcset', ewww_attr);
603
- }
604
- }
605
- ewww_img = ewww_copy_attrs(this, ewww_img);
606
- $(this).after(ewww_img);
607
- $(this).removeClass('ewww_webp_lazy_hueman');
608
- });
609
  $('.ewww_webp').each(function() {
610
  var ewww_img = document.createElement('img');
611
  if (ewww_webp_supported) {
612
- $(ewww_img).attr('src', $(this).attr('data-webp'));
613
- var ewww_attr = $(this).attr('data-srcset-webp');
614
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
615
- $(ewww_img).attr('srcset', ewww_attr);
616
- }
617
- var ewww_attr = $(this).attr('data-webp-orig-file');
618
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
619
- $(ewww_img).attr('data-orig-file', ewww_attr);
620
- } else {
621
- var ewww_attr = $(this).attr('data-orig-file');
622
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
623
- $(ewww_img).attr('data-orig-file', ewww_attr);
624
- }
625
- }
626
- var ewww_attr = $(this).attr('data-webp-medium-file');
627
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
628
- $(ewww_img).attr('data-medium-file', ewww_attr);
629
- } else {
630
- var ewww_attr = $(this).attr('data-medium-file');
631
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
632
- $(ewww_img).attr('data-medium-file', ewww_attr);
633
- }
634
- }
635
- var ewww_attr = $(this).attr('data-webp-large-file');
636
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
637
- $(ewww_img).attr('data-large-file', ewww_attr);
638
- } else {
639
- var ewww_attr = $(this).attr('data-large-file');
640
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
641
- $(ewww_img).attr('data-large-file', ewww_attr);
642
- }
643
- }
644
- var ewww_attr = $(this).attr('data-webp-large_image');
645
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
646
- $(ewww_img).attr('data-large_image', ewww_attr);
647
- } else {
648
- var ewww_attr = $(this).attr('data-large_image');
649
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
650
- $(ewww_img).attr('data-large_image', ewww_attr);
651
- }
652
- }
653
- var ewww_attr = $(this).attr('data-webp-src');
654
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
655
- $(ewww_img).attr('data-src', ewww_attr);
656
- } else {
657
- var ewww_attr = $(this).attr('data-src');
658
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
659
- $(ewww_img).attr('data-src', ewww_attr);
660
- }
661
- }
662
  } else {
663
- $(ewww_img).attr('src', $(this).attr('data-img'));
664
- var ewww_attr = $(this).attr('data-srcset-img');
665
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
666
- $(ewww_img).attr('srcset', ewww_attr);
667
- }
668
- var ewww_attr = $(this).attr('data-orig-file');
669
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
670
- $(ewww_img).attr('data-orig-file', ewww_attr);
671
- }
672
- var ewww_attr = $(this).attr('data-medium-file');
673
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
674
- $(ewww_img).attr('data-medium-file', ewww_attr);
675
- }
676
- var ewww_attr = $(this).attr('data-large-file');
677
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
678
- $(ewww_img).attr('data-large-file', ewww_attr);
679
- }
680
- var ewww_attr = $(this).attr('data-large_image');
681
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
682
- $(ewww_img).attr('data-large_image', ewww_attr);
683
- }
684
- var ewww_attr = $(this).attr('data-src');
685
- if (typeof ewww_attr !== typeof undefined && ewww_attr !== false) {
686
- $(ewww_img).attr('data-src', ewww_attr);
687
- }
688
  }
689
  ewww_img = ewww_copy_attrs(this, ewww_img);
690
  $(this).after(ewww_img);
691
  $(this).removeClass('ewww_webp');
692
  });
 
693
  })(jQuery);
694
- if ( jQuery.fn.isotope && jQuery.fn.imagesLoaded ) {
695
  jQuery('.fusion-posts-container-infinite').imagesLoaded( function() {
696
  if ( jQuery( '.fusion-posts-container-infinite' ).hasClass( 'isotope' ) ) {
697
  jQuery( '.fusion-posts-container-infinite' ).isotope();
@@ -742,11 +626,9 @@ function ewww_ngg_plus_load_galleries(ewww_webp_supported) {
742
  if (ewww_webp_supported) {
743
  (function($) {
744
  $(window).on('ngg.galleria.themeadded', function(event, themename) {
745
- console.log(themename);
746
  window.ngg_galleria._create_backup = window.ngg_galleria.create;
747
  window.ngg_galleria.create = function(gallery_parent, themename) {
748
  var gallery_id = $(gallery_parent).data('id');
749
- console.log(gallery_id);
750
  galleries['gallery_' + gallery_id].images_list = ewww_ngg_plus_parse_image_list(galleries['gallery_' + gallery_id].images_list);
751
  return window.ngg_galleria._create_backup(gallery_parent, themename);
752
  };
480
  }
481
  function ewww_load_images(ewww_webp_supported) {
482
  (function($) {
483
+ $.fn.extend({
484
+ ewwwattr: function(attr, value) {
485
+ if (typeof value !== typeof undefined && value !== false) {
486
+ this.attr(attr, value);
487
+ }
488
+ return this;
489
+ }
490
+ });
491
  var attr_prefix = 'data-';
492
  function ewww_copy_attrs(ewww_nscript, ewww_img) {
493
  var attrs = ['align','alt','border','crossorigin','height','hspace','ismap','longdesc','usemap','vspace','width','accesskey','class','contenteditable','contextmenu','dir','draggable','dropzone','hidden','id','lang','spellcheck','style','tabindex','title','translate','sizes','data-caption','data-attachment-id','data-permalink','data-orig-size','data-comments-opened','data-image-meta','data-image-title','data-image-description','data-event-trigger','data-highlight-color','data-highlight-opacity','data-highlight-border-color','data-highlight-border-width','data-highlight-border-opacity','data-no-lazy','data-lazy','data-large_image_width','data-large_image_height'];
494
  for (var i = 0, len = attrs.length; i < len; i++) {
495
+ $(ewww_img).ewwwattr(attrs[i], $(ewww_nscript).attr(attr_prefix + attrs[i]));
 
 
 
496
  }
497
  return ewww_img;
498
  }
499
  if (ewww_webp_supported) {
500
  $('.batch-image img, .image-wrapper a, .ngg-pro-masonry-item a, .ngg-galleria-offscreen-seo-wrapper a').each(function() {
501
+ $(this).ewwwattr('data-src', $(this).attr('data-webp'));
502
+ $(this).ewwwattr('data-thumbnail', $(this).attr('data-webp-thumbnail'));
 
 
 
 
 
 
503
  });
504
  $('.image-wrapper a, .ngg-pro-masonry-item a').each(function() {
505
+ $(this).ewwwattr('href', $(this).attr('data-webp'));
 
 
 
506
  });
507
  $('.rev_slider ul li').each(function() {
508
+ $(this).ewwwattr('data-thumb', $(this).attr('data-webp-thumb'));
 
 
 
509
  var param_num = 1;
510
  while ( param_num < 11 ) {
511
+ $(this).ewwwattr('data-param' + param_num, $(this).attr('data-webp-param' + param_num));
 
 
 
512
  param_num++;
513
  }
514
  });
515
  $('.rev_slider img').each(function() {
516
+ $(this).ewwwattr('data-lazyload', $(this).attr('data-webp-lazyload'));
 
 
 
517
  });
518
  $('div.woocommerce-product-gallery__image').each(function() {
519
+ $(this).ewwwattr('data-thumb', $(this).attr('data-webp-thumb'));
 
 
 
520
  });
521
  }
522
+ // we should not need this section, as it should be covered by ewww_webp_lazy_load
523
  $('img.ewww_webp_lazy_retina').each(function() {
524
  if (ewww_webp_supported) {
525
+ $(this).ewwwattr('data-srcset', $(this).attr('data-srcset-webp'));
 
 
 
 
 
 
 
 
526
  }
527
  $(this).removeClass('ewww_webp_lazy_retina');
528
  });
529
  $('video').each(function() {
530
  if (ewww_webp_supported) {
531
+ $(this).ewwwattr('poster', $(this).attr('data-poster-webp'));
 
 
 
532
  } else {
533
+ $(this).ewwwattr('poster', $(this).attr('data-poster-image'));
 
 
 
534
  }
535
  });
536
  $('img.ewww_webp_lazy_load').each(function() {
537
  if (ewww_webp_supported) {
538
+ $(this).ewwwattr('data-lazy-srcset', $(this).attr('data-lazy-srcset-webp'));
539
+ $(this).ewwwattr('data-srcset', $(this).attr('data-srcset-webp'));
540
+ $(this).ewwwattr('data-lazy-src', $(this).attr('data-lazy-src-webp'));
541
+ $(this).ewwwattr('data-src', $(this).attr('data-src-webp'));
542
+ $(this).ewwwattr('data-orig-file', $(this).attr('data-webp-orig-file'));
543
+ $(this).ewwwattr('data-medium-file', $(this).attr('data-webp-medium-file'));
544
+ $(this).ewwwattr('data-large-file', $(this).attr('data-webp-large-file'));
 
 
 
 
 
 
 
 
 
 
 
 
545
  }
546
  $(this).removeClass('ewww_webp_lazy_load');
547
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
548
  $('.ewww_webp').each(function() {
549
  var ewww_img = document.createElement('img');
550
  if (ewww_webp_supported) {
551
+ $(ewww_img).ewwwattr('src', $(this).attr('data-webp'));
552
+ $(ewww_img).ewwwattr('srcset', $(this).attr('data-srcset-webp'));
553
+ $(ewww_img).ewwwattr('data-orig-file', $(this).attr('data-orig-file'));
554
+ $(ewww_img).ewwwattr('data-orig-file', $(this).attr('data-webp-orig-file'));
555
+ $(ewww_img).ewwwattr('data-medium-file', $(this).attr('data-medium-file'));
556
+ $(ewww_img).ewwwattr('data-medium-file', $(this).attr('data-webp-medium-file'));
557
+ $(ewww_img).ewwwattr('data-large-file', $(this).attr('data-large-file'));
558
+ $(ewww_img).ewwwattr('data-large-file', $(this).attr('data-webp-large-file'));
559
+ $(ewww_img).ewwwattr('data-large_image', $(this).attr('data-large_image'));
560
+ $(ewww_img).ewwwattr('data-large_image', $(this).attr('data-webp-large_image'));
561
+ $(ewww_img).ewwwattr('data-src', $(this).attr('data-src'));
562
+ $(ewww_img).ewwwattr('data-src', $(this).attr('data-webp-src'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
563
  } else {
564
+ $(ewww_img).ewwwattr('src', $(this).attr('data-img'));
565
+ $(ewww_img).ewwwattr('srcset', $(this).attr('data-srcset-img'));
566
+ $(ewww_img).ewwwattr('data-orig-file', $(this).attr('data-orig-file'));
567
+ $(ewww_img).ewwwattr('data-medium-file', $(this).attr('data-medium-file'));
568
+ $(ewww_img).ewwwattr('data-large-file', $(this).attr('data-large-file'));
569
+ $(ewww_img).ewwwattr('data-large_image', $(this).attr('data-large_image'));
570
+ $(ewww_img).ewwwattr('data-src', $(this).attr('data-src'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
  }
572
  ewww_img = ewww_copy_attrs(this, ewww_img);
573
  $(this).after(ewww_img);
574
  $(this).removeClass('ewww_webp');
575
  });
576
+ // $(document.body).trigger('post-load');
577
  })(jQuery);
578
+ if (jQuery.fn.isotope && jQuery.fn.imagesLoaded) {
579
  jQuery('.fusion-posts-container-infinite').imagesLoaded( function() {
580
  if ( jQuery( '.fusion-posts-container-infinite' ).hasClass( 'isotope' ) ) {
581
  jQuery( '.fusion-posts-container-infinite' ).isotope();
626
  if (ewww_webp_supported) {
627
  (function($) {
628
  $(window).on('ngg.galleria.themeadded', function(event, themename) {
 
629
  window.ngg_galleria._create_backup = window.ngg_galleria.create;
630
  window.ngg_galleria.create = function(gallery_parent, themename) {
631
  var gallery_id = $(gallery_parent).data('id');
 
632
  galleries['gallery_' + gallery_id].images_list = ewww_ngg_plus_parse_image_list(galleries['gallery_' + gallery_id].images_list);
633
  return window.ngg_galleria._create_backup(gallery_parent, themename);
634
  };
includes/load_webp.min.js CHANGED
@@ -1 +1 @@
1
- var Arrive=function(d,t,c){"use strict";if(d.MutationObserver&&"undefined"!=typeof HTMLElement){var a,e,i=0,u=(a=HTMLElement.prototype.matches||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector,{matchesSelector:function(t,e){return t instanceof HTMLElement&&a.call(t,e)},addMethod:function(t,e,a){var i=t[e];t[e]=function(){return a.length==arguments.length?a.apply(this,arguments):"function"==typeof i?i.apply(this,arguments):void 0}},callCallbacks:function(t,e){e&&e.options.onceOnly&&1==e.firedElems.length&&(t=[t[0]]);for(var a,i=0;a=t[i];i++)a&&a.callback&&a.callback.call(a.elem,a.elem);e&&e.options.onceOnly&&1==e.firedElems.length&&e.me.unbindEventWithSelectorAndCallback.call(e.target,e.selector,e.callback)},checkChildNodesRecursively:function(t,e,a,i){for(var r,n=0;r=t[n];n++)a(r,e,i)&&i.push({callback:e.callback,elem:r}),0<r.childNodes.length&&u.checkChildNodesRecursively(r.childNodes,e,a,i)},mergeArrays:function(t,e){var a,i={};for(a in t)t.hasOwnProperty(a)&&(i[a]=t[a]);for(a in e)e.hasOwnProperty(a)&&(i[a]=e[a]);return i},toElementsArray:function(t){return void 0===t||"number"==typeof t.length&&t!==d||(t=[t]),t}}),h=((e=function(){this._eventsBucket=[],this._beforeAdding=null,this._beforeRemoving=null}).prototype.addEvent=function(t,e,a,i){var r={target:t,selector:e,options:a,callback:i,firedElems:[]};return this._beforeAdding&&this._beforeAdding(r),this._eventsBucket.push(r),r},e.prototype.removeEvent=function(t){for(var e,a=this._eventsBucket.length-1;e=this._eventsBucket[a];a--)if(t(e)){this._beforeRemoving&&this._beforeRemoving(e);var i=this._eventsBucket.splice(a,1);i&&i.length&&(i[0].callback=null)}},e.prototype.beforeAdding=function(t){this._beforeAdding=t},e.prototype.beforeRemoving=function(t){this._beforeRemoving=t},e),s=function(r,n){var s=new h,o=this,l={fireOnAttributesModification:!1};return s.beforeAdding(function(e){var t,a=e.target;a!==d.document&&a!==d||(a=document.getElementsByTagName("html")[0]),t=new MutationObserver(function(t){n.call(this,t,e)});var i=r(e.options);t.observe(a,i),e.observer=t,e.me=o}),s.beforeRemoving(function(t){t.observer.disconnect()}),this.bindEvent=function(t,e,a){e=u.mergeArrays(l,e);for(var i=u.toElementsArray(this),r=0;r<i.length;r++)s.addEvent(i[r],t,e,a)},this.unbindEvent=function(){var a=u.toElementsArray(this);s.removeEvent(function(t){for(var e=0;e<a.length;e++)if(this===c||t.target===a[e])return!0;return!1})},this.unbindEventWithSelectorOrCallback=function(a){var t,i=u.toElementsArray(this),r=a;t="function"==typeof a?function(t){for(var e=0;e<i.length;e++)if((this===c||t.target===i[e])&&t.callback===r)return!0;return!1}:function(t){for(var e=0;e<i.length;e++)if((this===c||t.target===i[e])&&t.selector===a)return!0;return!1},s.removeEvent(t)},this.unbindEventWithSelectorAndCallback=function(a,i){var r=u.toElementsArray(this);s.removeEvent(function(t){for(var e=0;e<r.length;e++)if((this===c||t.target===r[e])&&t.selector===a&&t.callback===i)return!0;return!1})},this},r=new function(){var l={fireOnAttributesModification:!1,onceOnly:!1,existing:!1};function n(t,e,a){return!(!u.matchesSelector(t,e.selector)||(t._id===c&&(t._id=i++),-1!=e.firedElems.indexOf(t._id))||(e.firedElems.push(t._id),0))}var d=(r=new s(function(t){var e={attributes:!1,childList:!0,subtree:!0};return t.fireOnAttributesModification&&(e.attributes=!0),e},function(t,r){t.forEach(function(t){var e=t.addedNodes,a=t.target,i=[];null!==e&&0<e.length?u.checkChildNodesRecursively(e,r,n,i):"attributes"===t.type&&n(a,r)&&i.push({callback:r.callback,elem:a}),u.callCallbacks(i,r)})})).bindEvent;return r.bindEvent=function(t,e,a){void 0===a?(a=e,e=l):e=u.mergeArrays(l,e);var i=u.toElementsArray(this);if(e.existing){for(var r=[],n=0;n<i.length;n++)for(var s=i[n].querySelectorAll(t),o=0;o<s.length;o++)r.push({callback:a,elem:s[o]});if(e.onceOnly&&r.length)return a.call(r[0].elem,r[0].elem);setTimeout(u.callCallbacks,1,r)}d.call(this,t,e,a)},r},o=new function(){var i={};function r(t,e){return u.matchesSelector(t,e.selector)}var n=(o=new s(function(){return{childList:!0,subtree:!0}},function(t,i){t.forEach(function(t){var e=t.removedNodes,a=[];null!==e&&0<e.length&&u.checkChildNodesRecursively(e,i,r,a),u.callCallbacks(a,i)})})).bindEvent;return o.bindEvent=function(t,e,a){void 0===a?(a=e,e=i):e=u.mergeArrays(i,e),n.call(this,t,e,a)},o};t&&g(t.fn),g(HTMLElement.prototype),g(NodeList.prototype),g(HTMLCollection.prototype),g(HTMLDocument.prototype),g(Window.prototype);var n={};return l(r,n,"unbindAllArrive"),l(o,n,"unbindAllLeave"),n}function l(t,e,a){u.addMethod(e,a,t.unbindEvent),u.addMethod(e,a,t.unbindEventWithSelectorOrCallback),u.addMethod(e,a,t.unbindEventWithSelectorAndCallback)}function g(t){t.arrive=r.bindEvent,l(r,t,"unbindArrive"),t.leave=o.bindEvent,l(o,t,"unbindLeave")}}(window,"undefined"==typeof jQuery?null:jQuery,void 0);function check_webp_feature(t,e){var a=new Image;a.onload=function(){ewww_webp_supported=0<a.width&&0<a.height,e(ewww_webp_supported)},a.onerror=function(){e(ewww_webp_supported=!1)},a.src="data:image/webp;base64,"+{alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"}[t]}function ewww_load_images(i){!function(s){function a(t,e){for(var a=["align","alt","border","crossorigin","height","hspace","ismap","longdesc","usemap","vspace","width","accesskey","class","contenteditable","contextmenu","dir","draggable","dropzone","hidden","id","lang","spellcheck","style","tabindex","title","translate","sizes","data-caption","data-attachment-id","data-permalink","data-orig-size","data-comments-opened","data-image-meta","data-image-title","data-image-description","data-event-trigger","data-highlight-color","data-highlight-opacity","data-highlight-border-color","data-highlight-border-width","data-highlight-border-opacity","data-no-lazy","data-lazy","data-large_image_width","data-large_image_height"],i=0,r=a.length;i<r;i++){var n=s(t).attr("data-"+a[i]);void 0!==n&&!1!==n&&s(e).attr(a[i],n)}return e}i&&(s(".batch-image img, .image-wrapper a, .ngg-pro-masonry-item a, .ngg-galleria-offscreen-seo-wrapper a").each(function(){var t;void 0!==(t=s(this).attr("data-webp"))&&!1!==t&&s(this).attr("data-src",t),void 0!==(t=s(this).attr("data-webp-thumbnail"))&&!1!==t&&s(this).attr("data-thumbnail",t)}),s(".image-wrapper a, .ngg-pro-masonry-item a").each(function(){var t=s(this).attr("data-webp");void 0!==t&&!1!==t&&s(this).attr("href",t)}),s(".rev_slider ul li").each(function(){void 0!==(e=s(this).attr("data-webp-thumb"))&&!1!==e&&s(this).attr("data-thumb",e);for(var t=1;t<11;){var e;void 0!==(e=s(this).attr("data-webp-param"+t))&&!1!==e&&s(this).attr("data-param"+t,e),t++}}),s(".rev_slider img").each(function(){var t=s(this).attr("data-webp-lazyload");void 0!==t&&!1!==t&&s(this).attr("data-lazyload",t)}),s("div.woocommerce-product-gallery__image").each(function(){var t=s(this).attr("data-webp-thumb");void 0!==t&&!1!==t&&s(this).attr("data-thumb",t)})),s("img.ewww_webp_lazy_retina").each(function(){var t;i?void 0!==(t=s(this).attr("data-srcset-webp"))&&!1!==t&&s(this).attr("data-srcset",t):void 0!==(t=s(this).attr("data-srcset-img"))&&!1!==t&&s(this).attr("data-srcset",t);s(this).removeClass("ewww_webp_lazy_retina")}),s("video").each(function(){var t;i?void 0!==(t=s(this).attr("data-poster-webp"))&&!1!==t&&s(this).attr("poster",t):void 0!==(t=s(this).attr("data-poster-image"))&&!1!==t&&s(this).attr("poster",t)}),s("img.ewww_webp_lazy_load").each(function(){var t;i?(s(this).attr("data-lazy-src",s(this).attr("data-lazy-webp-src")),void 0!==(t=s(this).attr("data-srcset-webp"))&&!1!==t&&s(this).attr("srcset",t),void 0!==(t=s(this).attr("data-lazy-srcset-webp"))&&!1!==t&&s(this).attr("data-lazy-srcset",t)):(s(this).attr("data-lazy-src",s(this).attr("data-lazy-img-src")),void 0!==(t=s(this).attr("data-srcset"))&&!1!==t&&s(this).attr("srcset",t),void 0!==(t=s(this).attr("data-lazy-srcset-img"))&&!1!==t&&s(ewww_img).attr("data-lazy-srcset",t));s(this).removeClass("ewww_webp_lazy_load")}),s(".ewww_webp_lazy_hueman").each(function(){var t,e=document.createElement("img");(s(e).attr("src",s(this).attr("data-src")),i)?(s(e).attr("data-src",s(this).attr("data-webp-src")),void 0!==(t=s(this).attr("data-srcset-webp"))&&!1!==t&&s(e).attr("data-srcset",t)):(s(e).attr("data-src",s(this).attr("data-img")),void 0!==(t=s(this).attr("data-srcset-img"))&&!1!==t&&s(e).attr("data-srcset",t));e=a(this,e),s(this).after(e),s(this).removeClass("ewww_webp_lazy_hueman")}),s(".ewww_webp").each(function(){var t=document.createElement("img");if(i){if(s(t).attr("src",s(this).attr("data-webp")),void 0!==(e=s(this).attr("data-srcset-webp"))&&!1!==e&&s(t).attr("srcset",e),void 0!==(e=s(this).attr("data-webp-orig-file"))&&!1!==e)s(t).attr("data-orig-file",e);else void 0!==(e=s(this).attr("data-orig-file"))&&!1!==e&&s(t).attr("data-orig-file",e);if(void 0!==(e=s(this).attr("data-webp-medium-file"))&&!1!==e)s(t).attr("data-medium-file",e);else void 0!==(e=s(this).attr("data-medium-file"))&&!1!==e&&s(t).attr("data-medium-file",e);if(void 0!==(e=s(this).attr("data-webp-large-file"))&&!1!==e)s(t).attr("data-large-file",e);else void 0!==(e=s(this).attr("data-large-file"))&&!1!==e&&s(t).attr("data-large-file",e);if(void 0!==(e=s(this).attr("data-webp-large_image"))&&!1!==e)s(t).attr("data-large_image",e);else void 0!==(e=s(this).attr("data-large_image"))&&!1!==e&&s(t).attr("data-large_image",e);if(void 0!==(e=s(this).attr("data-webp-src"))&&!1!==e)s(t).attr("data-src",e);else void 0!==(e=s(this).attr("data-src"))&&!1!==e&&s(t).attr("data-src",e)}else{var e;s(t).attr("src",s(this).attr("data-img")),void 0!==(e=s(this).attr("data-srcset-img"))&&!1!==e&&s(t).attr("srcset",e),void 0!==(e=s(this).attr("data-orig-file"))&&!1!==e&&s(t).attr("data-orig-file",e),void 0!==(e=s(this).attr("data-medium-file"))&&!1!==e&&s(t).attr("data-medium-file",e),void 0!==(e=s(this).attr("data-large-file"))&&!1!==e&&s(t).attr("data-large-file",e),void 0!==(e=s(this).attr("data-large_image"))&&!1!==e&&s(t).attr("data-large_image",e),void 0!==(e=s(this).attr("data-src"))&&!1!==e&&s(t).attr("data-src",e)}t=a(this,t),s(this).after(t),s(this).removeClass("ewww_webp")})}(jQuery),jQuery.fn.isotope&&jQuery.fn.imagesLoaded&&(jQuery(".fusion-posts-container-infinite").imagesLoaded(function(){jQuery(".fusion-posts-container-infinite").hasClass("isotope")&&jQuery(".fusion-posts-container-infinite").isotope()}),jQuery(".fusion-portfolio:not(.fusion-recent-works) .fusion-portfolio-wrapper").imagesLoaded(function(){jQuery(".fusion-portfolio:not(.fusion-recent-works) .fusion-portfolio-wrapper").isotope()}))}var ewww_webp_supported=!1,ewww_jquery_waiting_timer=0;function ewww_ngg_plus_parse_galleries(t){t&&jQuery.each(galleries,function(t,e){galleries[t].images_list=ewww_ngg_plus_parse_image_list(e.images_list)})}function ewww_ngg_plus_load_galleries(t){var r;t&&((r=jQuery)(window).on("ngg.galleria.themeadded",function(t,e){console.log(e),window.ngg_galleria._create_backup=window.ngg_galleria.create,window.ngg_galleria.create=function(t,e){var a=r(t).data("id");return console.log(a),galleries["gallery_"+a].images_list=ewww_ngg_plus_parse_image_list(galleries["gallery_"+a].images_list),window.ngg_galleria._create_backup(t,e)}}),r(window).on("override_nplModal_methods",function(t,i){i._set_events_backup=i.set_events,i.set_events=function(){return r("#npl_content").bind("npl_images_ready",function(t,e){var a=i.fetch_images.gallery_image_cache[e];a=ewww_ngg_plus_parse_image_list(a)}),i._set_events_backup()}}))}function ewww_ngg_plus_parse_image_list(r){var t;return(t=jQuery).each(r,function(a,i){void 0!==i["image-webp"]&&(r[a].image=i["image-webp"],delete r[a]["image-webp"]),void 0!==i["thumb-webp"]&&(r[a].thumb=i["thumb-webp"],delete r[a]["thumb-webp"]),void 0!==i.full_image_webp&&(r[a].full_image=i.full_image_webp,delete r[a].full_image_webp),void 0!==i.srcsets&&t.each(i.srcsets,function(t,e){void 0!==i.srcsets[t+"-webp"]&&(r[a].srcsets[t]=i.srcsets[t+"-webp"],delete r[a].srcsets[t+"-webp"])}),void 0!==i.full_srcsets&&t.each(i.full_srcsets,function(t,e){void 0!==i.full_srcsets[t+"-webp"]&&(r[a].full_srcsets[t]=i.full_srcsets[t+"-webp"],delete r[a].full_srcsets[t+"-webp"])})}),r}ewww_jquery_waiting=setInterval(function(){if(window.jQuery){check_webp_feature("alpha",ewww_load_images),check_webp_feature("alpha",ewww_ngg_plus_load_galleries),document.arrive(".ewww_webp",function(){ewww_load_images(ewww_webp_supported)});var t=0,e=setInterval(function(){"undefined"!=typeof galleries&&(check_webp_feature("alpha",ewww_ngg_plus_parse_galleries),clearInterval(e)),1e3<(t+=25)&&clearInterval(e)},25);clearInterval(ewww_jquery_waiting)}1e4<(ewww_jquery_waiting_timer+=100)&&clearInterval(ewww_jquery_waiting)},100);
1
+ var Arrive=function(w,e,c){"use strict";if(w.MutationObserver&&"undefined"!=typeof HTMLElement){var a,t,r=0,d=(a=HTMLElement.prototype.matches||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector,{matchesSelector:function(e,t){return e instanceof HTMLElement&&a.call(e,t)},addMethod:function(e,t,a){var r=e[t];e[t]=function(){return a.length==arguments.length?a.apply(this,arguments):"function"==typeof r?r.apply(this,arguments):void 0}},callCallbacks:function(e,t){t&&t.options.onceOnly&&1==t.firedElems.length&&(e=[e[0]]);for(var a,r=0;a=e[r];r++)a&&a.callback&&a.callback.call(a.elem,a.elem);t&&t.options.onceOnly&&1==t.firedElems.length&&t.me.unbindEventWithSelectorAndCallback.call(t.target,t.selector,t.callback)},checkChildNodesRecursively:function(e,t,a,r){for(var i,n=0;i=e[n];n++)a(i,t,r)&&r.push({callback:t.callback,elem:i}),0<i.childNodes.length&&d.checkChildNodesRecursively(i.childNodes,t,a,r)},mergeArrays:function(e,t){var a,r={};for(a in e)e.hasOwnProperty(a)&&(r[a]=e[a]);for(a in t)t.hasOwnProperty(a)&&(r[a]=t[a]);return r},toElementsArray:function(e){return void 0===e||"number"==typeof e.length&&e!==w||(e=[e]),e}}),u=((t=function(){this._eventsBucket=[],this._beforeAdding=null,this._beforeRemoving=null}).prototype.addEvent=function(e,t,a,r){var i={target:e,selector:t,options:a,callback:r,firedElems:[]};return this._beforeAdding&&this._beforeAdding(i),this._eventsBucket.push(i),i},t.prototype.removeEvent=function(e){for(var t,a=this._eventsBucket.length-1;t=this._eventsBucket[a];a--)if(e(t)){this._beforeRemoving&&this._beforeRemoving(t);var r=this._eventsBucket.splice(a,1);r&&r.length&&(r[0].callback=null)}},t.prototype.beforeAdding=function(e){this._beforeAdding=e},t.prototype.beforeRemoving=function(e){this._beforeRemoving=e},t),l=function(i,n){var l=new u,s=this,o={fireOnAttributesModification:!1};return l.beforeAdding(function(t){var e,a=t.target;a!==w.document&&a!==w||(a=document.getElementsByTagName("html")[0]),e=new MutationObserver(function(e){n.call(this,e,t)});var r=i(t.options);e.observe(a,r),t.observer=e,t.me=s}),l.beforeRemoving(function(e){e.observer.disconnect()}),this.bindEvent=function(e,t,a){t=d.mergeArrays(o,t);for(var r=d.toElementsArray(this),i=0;i<r.length;i++)l.addEvent(r[i],e,t,a)},this.unbindEvent=function(){var a=d.toElementsArray(this);l.removeEvent(function(e){for(var t=0;t<a.length;t++)if(this===c||e.target===a[t])return!0;return!1})},this.unbindEventWithSelectorOrCallback=function(a){var e,r=d.toElementsArray(this),i=a;e="function"==typeof a?function(e){for(var t=0;t<r.length;t++)if((this===c||e.target===r[t])&&e.callback===i)return!0;return!1}:function(e){for(var t=0;t<r.length;t++)if((this===c||e.target===r[t])&&e.selector===a)return!0;return!1},l.removeEvent(e)},this.unbindEventWithSelectorAndCallback=function(a,r){var i=d.toElementsArray(this);l.removeEvent(function(e){for(var t=0;t<i.length;t++)if((this===c||e.target===i[t])&&e.selector===a&&e.callback===r)return!0;return!1})},this},i=new function(){var o={fireOnAttributesModification:!1,onceOnly:!1,existing:!1};function n(e,t,a){return!(!d.matchesSelector(e,t.selector)||(e._id===c&&(e._id=r++),-1!=t.firedElems.indexOf(e._id))||(t.firedElems.push(e._id),0))}var w=(i=new l(function(e){var t={attributes:!1,childList:!0,subtree:!0};return e.fireOnAttributesModification&&(t.attributes=!0),t},function(e,i){e.forEach(function(e){var t=e.addedNodes,a=e.target,r=[];null!==t&&0<t.length?d.checkChildNodesRecursively(t,i,n,r):"attributes"===e.type&&n(a,i)&&r.push({callback:i.callback,elem:a}),d.callCallbacks(r,i)})})).bindEvent;return i.bindEvent=function(e,t,a){void 0===a?(a=t,t=o):t=d.mergeArrays(o,t);var r=d.toElementsArray(this);if(t.existing){for(var i=[],n=0;n<r.length;n++)for(var l=r[n].querySelectorAll(e),s=0;s<l.length;s++)i.push({callback:a,elem:l[s]});if(t.onceOnly&&i.length)return a.call(i[0].elem,i[0].elem);setTimeout(d.callCallbacks,1,i)}w.call(this,e,t,a)},i},s=new function(){var r={};function i(e,t){return d.matchesSelector(e,t.selector)}var n=(s=new l(function(){return{childList:!0,subtree:!0}},function(e,r){e.forEach(function(e){var t=e.removedNodes,a=[];null!==t&&0<t.length&&d.checkChildNodesRecursively(t,r,i,a),d.callCallbacks(a,r)})})).bindEvent;return s.bindEvent=function(e,t,a){void 0===a?(a=t,t=r):t=d.mergeArrays(r,t),n.call(this,e,t,a)},s};e&&h(e.fn),h(HTMLElement.prototype),h(NodeList.prototype),h(HTMLCollection.prototype),h(HTMLDocument.prototype),h(Window.prototype);var n={};return o(i,n,"unbindAllArrive"),o(s,n,"unbindAllLeave"),n}function o(e,t,a){d.addMethod(t,a,e.unbindEvent),d.addMethod(t,a,e.unbindEventWithSelectorOrCallback),d.addMethod(t,a,e.unbindEventWithSelectorAndCallback)}function h(e){e.arrive=i.bindEvent,o(i,e,"unbindArrive"),e.leave=s.bindEvent,o(s,e,"unbindLeave")}}(window,"undefined"==typeof jQuery?null:jQuery,void 0);function check_webp_feature(e,t){var a=new Image;a.onload=function(){ewww_webp_supported=0<a.width&&0<a.height,t(ewww_webp_supported)},a.onerror=function(){t(ewww_webp_supported=!1)},a.src="data:image/webp;base64,"+{alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"}[e]}function ewww_load_images(t){!function(n){n.fn.extend({ewwwattr:function(e,t){return void 0!==t&&!1!==t&&this.attr(e,t),this}});t&&(n(".batch-image img, .image-wrapper a, .ngg-pro-masonry-item a, .ngg-galleria-offscreen-seo-wrapper a").each(function(){n(this).ewwwattr("data-src",n(this).attr("data-webp")),n(this).ewwwattr("data-thumbnail",n(this).attr("data-webp-thumbnail"))}),n(".image-wrapper a, .ngg-pro-masonry-item a").each(function(){n(this).ewwwattr("href",n(this).attr("data-webp"))}),n(".rev_slider ul li").each(function(){n(this).ewwwattr("data-thumb",n(this).attr("data-webp-thumb"));for(var e=1;e<11;)n(this).ewwwattr("data-param"+e,n(this).attr("data-webp-param"+e)),e++}),n(".rev_slider img").each(function(){n(this).ewwwattr("data-lazyload",n(this).attr("data-webp-lazyload"))}),n("div.woocommerce-product-gallery__image").each(function(){n(this).ewwwattr("data-thumb",n(this).attr("data-webp-thumb"))})),n("img.ewww_webp_lazy_retina").each(function(){t&&n(this).ewwwattr("data-srcset",n(this).attr("data-srcset-webp")),n(this).removeClass("ewww_webp_lazy_retina")}),n("video").each(function(){t?n(this).ewwwattr("poster",n(this).attr("data-poster-webp")):n(this).ewwwattr("poster",n(this).attr("data-poster-image"))}),n("img.ewww_webp_lazy_load").each(function(){t&&(n(this).ewwwattr("data-lazy-srcset",n(this).attr("data-lazy-srcset-webp")),n(this).ewwwattr("data-srcset",n(this).attr("data-srcset-webp")),n(this).ewwwattr("data-lazy-src",n(this).attr("data-lazy-src-webp")),n(this).ewwwattr("data-src",n(this).attr("data-src-webp")),n(this).ewwwattr("data-orig-file",n(this).attr("data-webp-orig-file")),n(this).ewwwattr("data-medium-file",n(this).attr("data-webp-medium-file")),n(this).ewwwattr("data-large-file",n(this).attr("data-webp-large-file"))),n(this).removeClass("ewww_webp_lazy_load")}),n(".ewww_webp").each(function(){var e=document.createElement("img");t?(n(e).ewwwattr("src",n(this).attr("data-webp")),n(e).ewwwattr("srcset",n(this).attr("data-srcset-webp")),n(e).ewwwattr("data-orig-file",n(this).attr("data-orig-file")),n(e).ewwwattr("data-orig-file",n(this).attr("data-webp-orig-file")),n(e).ewwwattr("data-medium-file",n(this).attr("data-medium-file")),n(e).ewwwattr("data-medium-file",n(this).attr("data-webp-medium-file")),n(e).ewwwattr("data-large-file",n(this).attr("data-large-file")),n(e).ewwwattr("data-large-file",n(this).attr("data-webp-large-file")),n(e).ewwwattr("data-large_image",n(this).attr("data-large_image")),n(e).ewwwattr("data-large_image",n(this).attr("data-webp-large_image")),n(e).ewwwattr("data-src",n(this).attr("data-src")),n(e).ewwwattr("data-src",n(this).attr("data-webp-src"))):(n(e).ewwwattr("src",n(this).attr("data-img")),n(e).ewwwattr("srcset",n(this).attr("data-srcset-img")),n(e).ewwwattr("data-orig-file",n(this).attr("data-orig-file")),n(e).ewwwattr("data-medium-file",n(this).attr("data-medium-file")),n(e).ewwwattr("data-large-file",n(this).attr("data-large-file")),n(e).ewwwattr("data-large_image",n(this).attr("data-large_image")),n(e).ewwwattr("data-src",n(this).attr("data-src"))),e=function(e,t){for(var a=["align","alt","border","crossorigin","height","hspace","ismap","longdesc","usemap","vspace","width","accesskey","class","contenteditable","contextmenu","dir","draggable","dropzone","hidden","id","lang","spellcheck","style","tabindex","title","translate","sizes","data-caption","data-attachment-id","data-permalink","data-orig-size","data-comments-opened","data-image-meta","data-image-title","data-image-description","data-event-trigger","data-highlight-color","data-highlight-opacity","data-highlight-border-color","data-highlight-border-width","data-highlight-border-opacity","data-no-lazy","data-lazy","data-large_image_width","data-large_image_height"],r=0,i=a.length;r<i;r++)n(t).ewwwattr(a[r],n(e).attr("data-"+a[r]));return t}(this,e),n(this).after(e),n(this).removeClass("ewww_webp")})}(jQuery),jQuery.fn.isotope&&jQuery.fn.imagesLoaded&&(jQuery(".fusion-posts-container-infinite").imagesLoaded(function(){jQuery(".fusion-posts-container-infinite").hasClass("isotope")&&jQuery(".fusion-posts-container-infinite").isotope()}),jQuery(".fusion-portfolio:not(.fusion-recent-works) .fusion-portfolio-wrapper").imagesLoaded(function(){jQuery(".fusion-portfolio:not(.fusion-recent-works) .fusion-portfolio-wrapper").isotope()}))}var ewww_webp_supported=!1,ewww_jquery_waiting_timer=0;function ewww_ngg_plus_parse_galleries(e){e&&jQuery.each(galleries,function(e,t){galleries[e].images_list=ewww_ngg_plus_parse_image_list(t.images_list)})}function ewww_ngg_plus_load_galleries(e){var i;e&&((i=jQuery)(window).on("ngg.galleria.themeadded",function(e,t){window.ngg_galleria._create_backup=window.ngg_galleria.create,window.ngg_galleria.create=function(e,t){var a=i(e).data("id");return galleries["gallery_"+a].images_list=ewww_ngg_plus_parse_image_list(galleries["gallery_"+a].images_list),window.ngg_galleria._create_backup(e,t)}}),i(window).on("override_nplModal_methods",function(e,r){r._set_events_backup=r.set_events,r.set_events=function(){return i("#npl_content").bind("npl_images_ready",function(e,t){var a=r.fetch_images.gallery_image_cache[t];a=ewww_ngg_plus_parse_image_list(a)}),r._set_events_backup()}}))}function ewww_ngg_plus_parse_image_list(i){var e;return(e=jQuery).each(i,function(a,r){void 0!==r["image-webp"]&&(i[a].image=r["image-webp"],delete i[a]["image-webp"]),void 0!==r["thumb-webp"]&&(i[a].thumb=r["thumb-webp"],delete i[a]["thumb-webp"]),void 0!==r.full_image_webp&&(i[a].full_image=r.full_image_webp,delete i[a].full_image_webp),void 0!==r.srcsets&&e.each(r.srcsets,function(e,t){void 0!==r.srcsets[e+"-webp"]&&(i[a].srcsets[e]=r.srcsets[e+"-webp"],delete i[a].srcsets[e+"-webp"])}),void 0!==r.full_srcsets&&e.each(r.full_srcsets,function(e,t){void 0!==r.full_srcsets[e+"-webp"]&&(i[a].full_srcsets[e]=r.full_srcsets[e+"-webp"],delete i[a].full_srcsets[e+"-webp"])})}),i}ewww_jquery_waiting=setInterval(function(){if(window.jQuery){check_webp_feature("alpha",ewww_load_images),check_webp_feature("alpha",ewww_ngg_plus_load_galleries),document.arrive(".ewww_webp",function(){ewww_load_images(ewww_webp_supported)});var e=0,t=setInterval(function(){"undefined"!=typeof galleries&&(check_webp_feature("alpha",ewww_ngg_plus_parse_galleries),clearInterval(t)),1e3<(e+=25)&&clearInterval(t)},25);clearInterval(ewww_jquery_waiting)}1e4<(ewww_jquery_waiting_timer+=100)&&clearInterval(ewww_jquery_waiting)},100);
license.txt CHANGED
@@ -673,6 +673,9 @@ the library. If this is what you want to do, use the GNU Lesser General
673
  Public License instead of this License. But first, please read
674
  <http://www.gnu.org/philosophy/why-not-lgpl.html>.
675
 
 
 
 
676
  Licenses of included software:
677
 
678
  arrive.js
673
  Public License instead of this License. But first, please read
674
  <http://www.gnu.org/philosophy/why-not-lgpl.html>.
675
 
676
+ Additional Copyrights
677
+
678
+ Portions of the software are derived from
679
  Licenses of included software:
680
 
681
  arrive.js
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: nosilver4u
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MKMQKCBFFG3WW
4
  Tags: image, compress, resize, optimize, optimization, lossless, lossy, seo, webp, wp-cli, scale, tinypng, tinyjpg
5
  Requires at least: 4.9
6
- Tested up to: 4.9
7
- Requires PHP: 5.5
8
- Stable tag: 4.4.2
9
  License: GPLv3
10
 
11
  Speed up your website and improve your visitors' experience by automatically compressing and resizing images and PDFs. Boost SEO and improve sales.
@@ -174,6 +174,18 @@ http://developer.yahoo.com/performance/rules.html#opt_images
174
  * Feature requests can be submitted via https://ewww.io/contact-us/ and commented on here: https://trello.com/b/Fp81dWof/ewww-image-optimizer
175
  * If you would like to help translate this plugin in your language, get started here: https://translate.wordpress.org/projects/wp-plugins/ewww-image-optimizer/
176
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  = 4.4.2 =
178
  * added: notice for Pantheon users that an API key is required
179
  * added: ExactDN fully supports protocol-relative urls for non-image resources
@@ -203,63 +215,10 @@ http://developer.yahoo.com/performance/rules.html#opt_images
203
  * deprecated: PHP 5.5 support will be removed in the next major release (version 4.5)
204
  * removed: PHP 5.4 no longer supported
205
 
206
- = 4.3.2 =
207
- * changed: prevent dynamic JS/CSS urls within wp-admin/ from being rewritten by ExactDN
208
- * fixed: auto-convert PNG to JPG was running on images with transparency
209
- * fixed: Alt WebP broken on sites that have jquery-migrate disabled
210
-
211
- = 4.3.1 =
212
- * fixed: fatal error on older WP versions due to missing privacy policy function
213
-
214
- = 4.3.0 =
215
- * added: Alt WebP enables instant conversion with ExactDN, no need for bulk optimize
216
- * added: links within settings and other notices for contextual help
217
- * added: auto-convert large PNG images to JPG during upload, define EWWW_IMAGE_OPTIMIZER_DISABLE_AUTOCONVERT to skip
218
- * added: use file modification time to add query strings on JS/CSS files for cache invalidation on ExactDN
219
- * added: use EXACTDN_EXCLUDE in wp-config.php to bypass ExactDN for JS, CSS, etc.
220
- * added: NextGEN image urls properly rewritten for ExactDN
221
- * added: NextGEN dynamic thumbs included during manual/bulk optimization
222
- * added: auto-installer for Cloud plugin when running EWWW IO on a "banned" webhost
223
- * added: suggested privacy policy text for users of the API and ExactDN
224
- * added: detect wordpress.com sites and disable exec function and binaries
225
- * changed: resizing uses the primary media dimensions unless the "other" dimensions are configured
226
- * changed: Resize Other Images removed from GUI, configure via Overrides tab
227
- * changed: filter NextGEN quality to prevent oversized thumbs
228
- * changed: allow crop via filter even when one dimension is the same as the original
229
- * changed: auto-rotate function disabled with EWWW_IMAGE_OPTIMIZER_DISABLE_AUTOROTATE
230
- * changed: one-click copy for debug info, and debug collapsed by default in media library and bulk results
231
- * changed: bulk operations for batches of NextGEN images now use the bulk optimizer page instead of loading inline
232
- * fixed: thumbs not generated during WP/LR Sync
233
- * fixed: uploading images in the Gutenberg editor uses the wrong resize dimensions
234
- * fixed: unique filename function producing names with a hyphen and no digits
235
- * fixed: encoded ampersands within the path portion of a url prevent ExactDN parsing
236
- * fixed: entering a decimal for bulk delay does nothing
237
- * fixed: if urls on a localized WPML domain are using the default domain, ExactDN ignores them
238
- * fixed: toggle for plugin status and bulk status generate admin-ajax.php 403 errors
239
- * fixed: PNGOUT installer confirmation notice was missing
240
- * deprecated: PHP 5.4 support will be removed in the next major release (version 4.4)
241
-
242
  = Earlier versions =
243
  Please refer to the separate changelog.txt file.
244
 
245
- == Upgrade Notice ==
246
-
247
- = 4.2.0 =
248
- * ExactDN verification rewritten, please report any issues immediately.
249
- * PHP 5.3 support discontinued, see https://docs.ewww.io/article/55-upgrading-php
250
-
251
- = 4.1.0 =
252
- * Security update: gifsicle and optipng have been updated to resolve security flaws.
253
- * ExactDN now processes JS/CSS/Fonts for even more speed.
254
-
255
- = 4.0.0 =
256
- * Introduced new ExactDN with CDN and automatic image resizing.
257
-
258
- = 3.6.0 =
259
- * API functions have been rewritten to use core WP detection for https capability, please report any errors right away.
260
- * Several options have been removed from the user interface, see the changelog for details.
261
-
262
  == Contact and Credits ==
263
 
264
- Written by [Shane Bishop](https://ewww.io). Based upon CW Image Optimizer, which was written by [Jacob Allred](http://www.jacoballred.com/) at [Corban Works, LLC](http://www.corbanworks.com/). CW Image Optimizer was based on WP Smush.it. Jpegtran is the work of the Independent JPEG Group. PEL is the work of Martin Geisler, Lars Olesen, and Erik Oskam. ExactDN class based upon the Photon module from Jetpack.
265
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MKMQKCBFFG3WW
4
  Tags: image, compress, resize, optimize, optimization, lossless, lossy, seo, webp, wp-cli, scale, tinypng, tinyjpg
5
  Requires at least: 4.9
6
+ Tested up to: 5.0
7
+ Requires PHP: 5.6
8
+ Stable tag: 4.5.0
9
  License: GPLv3
10
 
11
  Speed up your website and improve your visitors' experience by automatically compressing and resizing images and PDFs. Boost SEO and improve sales.
174
  * Feature requests can be submitted via https://ewww.io/contact-us/ and commented on here: https://trello.com/b/Fp81dWof/ewww-image-optimizer
175
  * If you would like to help translate this plugin in your language, get started here: https://translate.wordpress.org/projects/wp-plugins/ewww-image-optimizer/
176
 
177
+ = 4.5.0 =
178
+ * added: Alt WebP supports BJ Lazy Load, a3 Lazy Load, WP Rocket Lazy Load, Jetpack Lazy Load, and WP Retina Lazy Load
179
+ * added: ExactDN rewrites relative image urls that start with a single slash
180
+ * changed: ExactDN srcset markup for smaller images improved
181
+ * fixed: errors during upload/download with WP Offload Media
182
+ * fixed: Alt WebP refuses to process page when FB tracking pixel is present
183
+ * fixed: SVG files within <use> tags throw errors with ExactDN
184
+ * fixed: thumbnail generation fails with S3 Uploads plugin
185
+ * fixed: unable to modify WebP conversion option when ExactDN is enabled
186
+ * fixed: ExactDN inserts full-size image without arguments
187
+ * removed: PHP 5.5 no longer supported
188
+
189
  = 4.4.2 =
190
  * added: notice for Pantheon users that an API key is required
191
  * added: ExactDN fully supports protocol-relative urls for non-image resources
215
  * deprecated: PHP 5.5 support will be removed in the next major release (version 4.5)
216
  * removed: PHP 5.4 no longer supported
217
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  = Earlier versions =
219
  Please refer to the separate changelog.txt file.
220
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  == Contact and Credits ==
222
 
223
+ Written by [Shane Bishop](https://ewww.io). Based upon CW Image Optimizer, which was written by [Jacob Allred](http://www.jacoballred.com/) at [Corban Works, LLC](http://www.corbanworks.com/). CW Image Optimizer was based on WP Smush.it. Jpegtran is the work of the Independent JPEG Group. PEL is the work of Martin Geisler, Lars Olesen, and Erik Oskam. ExactDN and HTML parsing classes based upon the Photon module from Jetpack.
224