Imagify Image Optimizer - Version 1.9.6

Version Description

  • 2019/07/22 =
  • Improvement: now images that are "already optimized" can also get webp versions.
  • Fix: progress bar height in the admin bar for Chrome and Safari.
Download this release

Release Info

Developer wp_media
Plugin Icon 128x128 Imagify Image Optimizer
Version 1.9.6
Comparing to
See all releases

Code changes from version 1.9.5 to 1.9.6

assets/css/admin-bar.css CHANGED
@@ -28,6 +28,7 @@
28
  }
29
  #wp-admin-bar-imagify-profile .imagify-progress {
30
  height: 1.5em;
 
31
  }
32
  .imagify-progress {
33
  transition: width .3s;
@@ -158,4 +159,4 @@
158
  background: #f5a623;
159
  color: #FFF;
160
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
161
- }
28
  }
29
  #wp-admin-bar-imagify-profile .imagify-progress {
30
  height: 1.5em;
31
+ font-size: 1em;
32
  }
33
  .imagify-progress {
34
  transition: width .3s;
159
  background: #f5a623;
160
  color: #FFF;
161
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
162
+ }
assets/css/admin-bar.min.css CHANGED
@@ -1 +1 @@
1
- #wp-admin-bar-imagify .button-text,.imagify-meteo-icon{display:inline-block;vertical-align:middle}.imagify-account,.imagify-account-link{padding-right:15px}.imagify-meteo-icon{height:38px;margin-right:10px}.imagify-user-plan{color:#40b1d0}.imagify-meteo-title.imagify-meteo-title{color:#FFF;font-size:17px}.imagify-space-left>p{color:#FFF}#wp-admin-bar-imagify-profile [class^=imagify-bar-]{position:relative;height:1.5em;width:100%;background:#60758D;color:#FFF;font-size:10px}#wp-admin-bar-imagify-profile .imagify-progress{height:1.5em}.imagify-progress{-webkit-transition:width .3s;-o-transition:width .3s;transition:width .3s}.imagify-bar-positive .imagify-progress{background:#8CC152}.imagify-bar-positive .imagify-barnb{color:#8CC152}.imagify-bar-negative .imagify-progress{background:#73818C}.imagify-bar-negative .imagify-barnb{color:#73818C}.imagify-bar-neutral .imagify-progress{background:#F5A623}.imagify-space-left .imagify-bar-negative .imagify-progress{background:#D0021B}#wpadminbar #wp-admin-bar-imagify-profile *{line-height:1.5;white-space:initial}#wpadminbar #wp-admin-bar-imagify .ab-submenu{padding-bottom:0}#wpadminbar #wp-admin-bar-imagify-profile .ab-item{height:auto;padding:0 13px}#wpadminbar #wp-admin-bar-imagify-profile{min-width:200px;padding:15px 0 10px;margin-top:.7em;background:#222}#wp-admin-bar-imagify .dashicons{font-family:dashicons;font-size:18px;vertical-align:middle;margin:0 5px 0 0}#wp-admin-bar-imagify .imagify-abq-row{display:table;width:100%}#wp-admin-bar-imagify .imagify-abq-row+.imagify-abq-row{margin-top:.75em}#wp-admin-bar-imagify .imagify-abq-row>*{display:table-cell}#wp-admin-bar-imagify-profile .imagify-meteo-icon{padding-right:7px}#wp-admin-bar-imagify-profile .imagify-meteo-icon img{width:37px}#wp-admin-bar-imagify-profile .imagify-meteo-title{font-size:17px}#wp-admin-bar-imagify-profile .imagify-meteo-subs{color:#72889F}#wpadminbar #wp-admin-bar-imagify-profile strong{font-weight:700}#wpadminbar #wp-admin-bar-imagify-profile .imagify-user-plan,#wpadminbar #wp-admin-bar-imagify-profile a{padding:0;color:#40B1D0}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link{display:table}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link>*{display:table-cell}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left{max-width:210px;min-width:210px;width:210px}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left p{font-size:12px}#wp-admin-bar-imagify-profile .imagify-error,#wp-admin-bar-imagify-profile .imagify-warning{padding:10px;margin:0 -13px -13px}#wp-admin-bar-imagify-profile .imagify-error p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p{margin-top:.5em}#wp-admin-bar-imagify-profile .imagify-error p+p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p+p{margin-top:1em}#wpadminbar #wp-admin-bar-imagify-profile .imagify-btn-ghost{display:inline-block;height:auto;padding:7px 10px;border:1px solid #FFF;text-align:center;background:0 0;color:#FFF;border-radius:3px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}#wpadminbar #wp-admin-bar-imagify-profile .imagify-btn-ghost:focus,#wpadminbar #wp-admin-bar-imagify-profile .imagify-btn-ghost:hover{background:#FFF;color:#888}#wpadminbar .imagify-warning *{background:#f5a623;color:#FFF;text-shadow:0 0 2px rgba(0,0,0,.2)}
1
+ #wp-admin-bar-imagify .button-text,.imagify-meteo-icon{display:inline-block;vertical-align:middle}.imagify-account,.imagify-account-link{padding-right:15px}.imagify-meteo-icon{height:38px;margin-right:10px}.imagify-user-plan{color:#40b1d0}.imagify-meteo-title.imagify-meteo-title{color:#FFF;font-size:17px}.imagify-space-left>p{color:#FFF}#wp-admin-bar-imagify-profile [class^=imagify-bar-]{position:relative;height:1.5em;width:100%;background:#60758D;color:#FFF;font-size:10px}#wp-admin-bar-imagify-profile .imagify-progress{height:1.5em;font-size:1em}.imagify-progress{-webkit-transition:width .3s;-o-transition:width .3s;transition:width .3s}.imagify-bar-positive .imagify-progress{background:#8CC152}.imagify-bar-positive .imagify-barnb{color:#8CC152}.imagify-bar-negative .imagify-progress{background:#73818C}.imagify-bar-negative .imagify-barnb{color:#73818C}.imagify-bar-neutral .imagify-progress{background:#F5A623}.imagify-space-left .imagify-bar-negative .imagify-progress{background:#D0021B}#wpadminbar #wp-admin-bar-imagify-profile *{line-height:1.5;white-space:initial}#wpadminbar #wp-admin-bar-imagify .ab-submenu{padding-bottom:0}#wpadminbar #wp-admin-bar-imagify-profile .ab-item{height:auto;padding:0 13px}#wpadminbar #wp-admin-bar-imagify-profile{min-width:200px;padding:15px 0 10px;margin-top:.7em;background:#222}#wp-admin-bar-imagify .dashicons{font-family:dashicons;font-size:18px;vertical-align:middle;margin:0 5px 0 0}#wp-admin-bar-imagify .imagify-abq-row{display:table;width:100%}#wp-admin-bar-imagify .imagify-abq-row+.imagify-abq-row{margin-top:.75em}#wp-admin-bar-imagify .imagify-abq-row>*{display:table-cell}#wp-admin-bar-imagify-profile .imagify-meteo-icon{padding-right:7px}#wp-admin-bar-imagify-profile .imagify-meteo-icon img{width:37px}#wp-admin-bar-imagify-profile .imagify-meteo-title{font-size:17px}#wp-admin-bar-imagify-profile .imagify-meteo-subs{color:#72889F}#wpadminbar #wp-admin-bar-imagify-profile strong{font-weight:700}#wpadminbar #wp-admin-bar-imagify-profile .imagify-user-plan,#wpadminbar #wp-admin-bar-imagify-profile a{padding:0;color:#40B1D0}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link{display:table}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link>*{display:table-cell}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left{max-width:210px;min-width:210px;width:210px}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left p{font-size:12px}#wp-admin-bar-imagify-profile .imagify-error,#wp-admin-bar-imagify-profile .imagify-warning{padding:10px;margin:0 -13px -13px}#wp-admin-bar-imagify-profile .imagify-error p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p{margin-top:.5em}#wp-admin-bar-imagify-profile .imagify-error p+p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p+p{margin-top:1em}#wpadminbar #wp-admin-bar-imagify-profile .imagify-btn-ghost{display:inline-block;height:auto;padding:7px 10px;border:1px solid #FFF;text-align:center;background:0 0;color:#FFF;border-radius:3px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}#wpadminbar #wp-admin-bar-imagify-profile .imagify-btn-ghost:focus,#wpadminbar #wp-admin-bar-imagify-profile .imagify-btn-ghost:hover{background:#FFF;color:#888}#wpadminbar .imagify-warning *{background:#f5a623;color:#FFF;text-shadow:0 0 2px rgba(0,0,0,.2)}
assets/js/files-list.js CHANGED
@@ -57,7 +57,7 @@ window.imagify.drawMeAChart = function( canvas ) {
57
  $( '#doaction, #doaction2' ).on( 'click.imagify', this.processBulkAction );
58
 
59
  // Optimize, restore, etc.
60
- $document.on( 'click.imagify', '.button-imagify-optimize, .button-imagify-manual-reoptimize, .button-imagify-generate-webp, .button-imagify-restore, .button-imagify-refresh-status', this.processOptimization );
61
 
62
  $document.on( 'imagifybeat-send', this.addToImagifybeat );
63
  $document.on( 'imagifybeat-tick', this.processImagifybeat );
57
  $( '#doaction, #doaction2' ).on( 'click.imagify', this.processBulkAction );
58
 
59
  // Optimize, restore, etc.
60
+ $document.on( 'click.imagify', '.button-imagify-optimize, .button-imagify-manual-reoptimize, .button-imagify-generate-webp, .button-imagify-delete-webp, .button-imagify-restore, .button-imagify-refresh-status', this.processOptimization );
61
 
62
  $document.on( 'imagifybeat-send', this.addToImagifybeat );
63
  $document.on( 'imagifybeat-tick', this.processImagifybeat );
assets/js/files-list.min.js CHANGED
@@ -1 +1 @@
1
- window.imagify.drawMeAChart=function(a){a.each(function(){var a=parseInt(jQuery(this).closest(".imagify-chart").next(".imagify-chart-value").text(),10);new window.imagify.Chart(this,{type:"doughnut",data:{datasets:[{data:[a,100-a],backgroundColor:["#00B3D3","#D8D8D8"],borderColor:"#fff",borderWidth:1}]},options:{legend:{display:!1},events:[],animation:{easing:"easeOutBounce"},tooltips:{enabled:!1},responsive:!1}})})},function(a,b,c,d){c.imagify.filesList={working:[],init:function(){var d,e=a(b);a(c).on("canvasprinted.imagify",this.updateChart).trigger("canvasprinted.imagify"),this.insertBulkActionTags(),a("#doaction, #doaction2").on("click.imagify",this.processBulkAction),e.on("click.imagify",".button-imagify-optimize, .button-imagify-manual-reoptimize, .button-imagify-generate-webp, .button-imagify-restore, .button-imagify-refresh-status",this.processOptimization),e.on("imagifybeat-send",this.addToImagifybeat),e.on("imagifybeat-tick",this.processImagifybeat),d=a(".wp-list-table.imagify-files .button-imagify-processing"),d.length&&(d.closest("tr").find('.check-column [name="bulk_select[]"]').each(function(){var a=c.imagify.filesList.sanitizeId(this.value);c.imagify.filesList.lockItem(c.imagifyFiles.context,a)}),c.imagify.beat.interval(15))},updateChart:function(b,d){var e;d=d||".imagify-consumption-chart",e=a(d),c.imagify.drawMeAChart(e),e.closest(".imagify-datas-list").siblings(".imagify-datas-details").hide()},insertBulkActionTags:function(){var b='<option value="imagify-bulk-optimize">'+c.imagifyFiles.labels.bulkActionsOptimize+"</option>";(c.imagifyFiles.backupOption||a(".file-has-backup").length)&&(b+='<option value="imagify-bulk-restore">'+c.imagifyFiles.labels.bulkActionsRestore+"</option>"),a('.bulkactions select[name="action"] option:first-child, .bulkactions select[name="action2"] option:first-child').after(b)},processBulkAction:function(b){var c,d=a(this).prev("select").val();"imagify-bulk-optimize"!==d&&"imagify-bulk-restore"!==d&&"imagify-bulk-refresh-status"!==d||(b.preventDefault(),c=d.replace("imagify-bulk-",""),a('input[name="bulk_select[]"]:checked').closest("tr").find(".button-imagify-"+c).each(function(b,c){setTimeout(function(){a(c).trigger("click.imagify")},500*b)}))},processOptimization:function(b){var d,e,f,g=a(this),h=g.closest("tr"),i=h.find('.check-column [type="checkbox"]'),j=imagify.filesList.sanitizeId(i.val()),k=c.imagifyFiles.context;b.preventDefault(),imagify.filesList.isItemLocked(k,j)||(imagify.filesList.lockItem(k,j),e=g.attr("href"),f=c.imagify.template("imagify-button-processing"),d=g.closest(".column-actions, .column-status"),d.html(f({label:g.data("processing-label")})),a.get(e.replace("admin-post.php","admin-ajax.php")).done(function(a){if(!a.success)return a.data&&a.data.row?h.html('<td class="colspanchange" colspan="'+h.children().length+'">'+a.data.row+"</td>"):d.html(a.data),h.find('.check-column [type="checkbox"]').prop("checked",!1),void imagify.filesList.unlockItem(k,j);a.data&&a.data.columns?c.imagify.filesList.displayProcessResult(k,j,a.data.columns):c.imagify.beat.interval(15)}))},addToImagifybeat:function(b,d){var e=a('.wp-list-table.imagify-files .check-column [name="bulk_select[]"]');e.length&&(d[c.imagifyFiles.imagifybeatID]={},e.each(function(){var a=c.imagify.filesList.sanitizeId(this.value),b=c.imagifyFiles.context,e=c.imagify.filesList.isItemLocked(b,a)?1:0;d[c.imagifyFiles.imagifybeatID][b]=d[c.imagifyFiles.imagifybeatID][b]||{},d[c.imagifyFiles.imagifybeatID][b]["_"+a]=e}))},processImagifybeat:function(b,d){void 0!==d[c.imagifyFiles.imagifybeatID]&&a.each(d[c.imagifyFiles.imagifybeatID],function(b,d){var e,f;(e=a.trim(b).match(/^(.+)_(\d+)$/))&&(f=c.imagify.filesList.sanitizeId(e[2]),(e=c.imagify.filesList.sanitizeContext(e[1]))===c.imagifyFiles.context&&c.imagify.filesList.displayProcessResult(e,f,d))})},displayProcessResult:function(b,d,e){var f=c.imagify.filesList.getContainers(d);a.each(e,function(a,b){f.children(".column-"+a).html(b)}),f.find('.check-column [type="checkbox"]').prop("checked",!1),c.imagify.filesList.unlockItem(b,d),c.imagify.filesList.working.length||c.imagify.beat.resetInterval()},getContainers:function(b){return a('.wp-list-table.imagify-files .check-column [name="bulk_select[]"][value="'+b+'"]').closest("tr")},sanitizeId:function(a){return parseInt(a,10)},sanitizeContext:function(a){return(a=a.replace("/[^a-z0-9_-]/gi","").toLowerCase())||"wp"},lockItem:function(a,b){this.isItemLocked(a,b)||this.working.push(a+"_"+b)},unlockItem:function(a,b){var c=a+"_"+b,d=_.indexOf(this.working,c);d>-1&&this.working.splice(d,1)},isItemLocked:function(a,b){return _.indexOf(this.working,a+"_"+b)>-1}},c.imagify.filesList.init()}(jQuery,document,window),function(a){for(var b=0,c=["ms","moz","webkit","o"],d=0;d<c.length&&!a.requestAnimationFrame;++d)a.requestAnimationFrame=a[c[d]+"RequestAnimationFrame"],a.cancelAnimationFrame=a[c[d]+"CancelAnimationFrame"]||a[c[d]+"CancelRequestAnimationFrame"];a.requestAnimationFrame||(a.requestAnimationFrame=function(a){var c=(new Date).getTime(),d=Math.max(0,16-(c-b)),e=setTimeout(function(){a(c+d)},d);return b=c+d,e}),a.cancelAnimationFrame||(a.cancelAnimationFrame=function(a){clearTimeout(a)})}(window),function(a,b,c,d){function e(){c.cancelAnimationFrame(g),g=c.requestAnimationFrame(f)}function f(){var b=a(c),f=b.scrollTop(),g=b.outerHeight();a.each(h,function(){var c,i=a(this),j=i.offset().top,k=j+i.outerHeight(),l=f-150,m=f+g+150;h=h.not(i),h.length||b.off("scroll resize orientationchange",e),k>=l&&j<=m&&(c=i.attr("data-lazy-src"),d!==c&&c&&i.attr("src",c).removeAttr("data-lazy-src"),i.next("noscript").remove())})}var g,h=a("#imagify-files-list-form").find("[data-lazy-src]");h.length&&(a(c).on("scroll resize orientationchange",e),f())}(jQuery,document,window);
1
+ window.imagify.drawMeAChart=function(a){a.each(function(){var a=parseInt(jQuery(this).closest(".imagify-chart").next(".imagify-chart-value").text(),10);new window.imagify.Chart(this,{type:"doughnut",data:{datasets:[{data:[a,100-a],backgroundColor:["#00B3D3","#D8D8D8"],borderColor:"#fff",borderWidth:1}]},options:{legend:{display:!1},events:[],animation:{easing:"easeOutBounce"},tooltips:{enabled:!1},responsive:!1}})})},function(a,b,c,d){c.imagify.filesList={working:[],init:function(){var d,e=a(b);a(c).on("canvasprinted.imagify",this.updateChart).trigger("canvasprinted.imagify"),this.insertBulkActionTags(),a("#doaction, #doaction2").on("click.imagify",this.processBulkAction),e.on("click.imagify",".button-imagify-optimize, .button-imagify-manual-reoptimize, .button-imagify-generate-webp, .button-imagify-delete-webp, .button-imagify-restore, .button-imagify-refresh-status",this.processOptimization),e.on("imagifybeat-send",this.addToImagifybeat),e.on("imagifybeat-tick",this.processImagifybeat),d=a(".wp-list-table.imagify-files .button-imagify-processing"),d.length&&(d.closest("tr").find('.check-column [name="bulk_select[]"]').each(function(){var a=c.imagify.filesList.sanitizeId(this.value);c.imagify.filesList.lockItem(c.imagifyFiles.context,a)}),c.imagify.beat.interval(15))},updateChart:function(b,d){var e;d=d||".imagify-consumption-chart",e=a(d),c.imagify.drawMeAChart(e),e.closest(".imagify-datas-list").siblings(".imagify-datas-details").hide()},insertBulkActionTags:function(){var b='<option value="imagify-bulk-optimize">'+c.imagifyFiles.labels.bulkActionsOptimize+"</option>";(c.imagifyFiles.backupOption||a(".file-has-backup").length)&&(b+='<option value="imagify-bulk-restore">'+c.imagifyFiles.labels.bulkActionsRestore+"</option>"),a('.bulkactions select[name="action"] option:first-child, .bulkactions select[name="action2"] option:first-child').after(b)},processBulkAction:function(b){var c,d=a(this).prev("select").val();"imagify-bulk-optimize"!==d&&"imagify-bulk-restore"!==d&&"imagify-bulk-refresh-status"!==d||(b.preventDefault(),c=d.replace("imagify-bulk-",""),a('input[name="bulk_select[]"]:checked').closest("tr").find(".button-imagify-"+c).each(function(b,c){setTimeout(function(){a(c).trigger("click.imagify")},500*b)}))},processOptimization:function(b){var d,e,f,g=a(this),h=g.closest("tr"),i=h.find('.check-column [type="checkbox"]'),j=imagify.filesList.sanitizeId(i.val()),k=c.imagifyFiles.context;b.preventDefault(),imagify.filesList.isItemLocked(k,j)||(imagify.filesList.lockItem(k,j),e=g.attr("href"),f=c.imagify.template("imagify-button-processing"),d=g.closest(".column-actions, .column-status"),d.html(f({label:g.data("processing-label")})),a.get(e.replace("admin-post.php","admin-ajax.php")).done(function(a){if(!a.success)return a.data&&a.data.row?h.html('<td class="colspanchange" colspan="'+h.children().length+'">'+a.data.row+"</td>"):d.html(a.data),h.find('.check-column [type="checkbox"]').prop("checked",!1),void imagify.filesList.unlockItem(k,j);a.data&&a.data.columns?c.imagify.filesList.displayProcessResult(k,j,a.data.columns):c.imagify.beat.interval(15)}))},addToImagifybeat:function(b,d){var e=a('.wp-list-table.imagify-files .check-column [name="bulk_select[]"]');e.length&&(d[c.imagifyFiles.imagifybeatID]={},e.each(function(){var a=c.imagify.filesList.sanitizeId(this.value),b=c.imagifyFiles.context,e=c.imagify.filesList.isItemLocked(b,a)?1:0;d[c.imagifyFiles.imagifybeatID][b]=d[c.imagifyFiles.imagifybeatID][b]||{},d[c.imagifyFiles.imagifybeatID][b]["_"+a]=e}))},processImagifybeat:function(b,d){void 0!==d[c.imagifyFiles.imagifybeatID]&&a.each(d[c.imagifyFiles.imagifybeatID],function(b,d){var e,f;(e=a.trim(b).match(/^(.+)_(\d+)$/))&&(f=c.imagify.filesList.sanitizeId(e[2]),(e=c.imagify.filesList.sanitizeContext(e[1]))===c.imagifyFiles.context&&c.imagify.filesList.displayProcessResult(e,f,d))})},displayProcessResult:function(b,d,e){var f=c.imagify.filesList.getContainers(d);a.each(e,function(a,b){f.children(".column-"+a).html(b)}),f.find('.check-column [type="checkbox"]').prop("checked",!1),c.imagify.filesList.unlockItem(b,d),c.imagify.filesList.working.length||c.imagify.beat.resetInterval()},getContainers:function(b){return a('.wp-list-table.imagify-files .check-column [name="bulk_select[]"][value="'+b+'"]').closest("tr")},sanitizeId:function(a){return parseInt(a,10)},sanitizeContext:function(a){return(a=a.replace("/[^a-z0-9_-]/gi","").toLowerCase())||"wp"},lockItem:function(a,b){this.isItemLocked(a,b)||this.working.push(a+"_"+b)},unlockItem:function(a,b){var c=a+"_"+b,d=_.indexOf(this.working,c);d>-1&&this.working.splice(d,1)},isItemLocked:function(a,b){return _.indexOf(this.working,a+"_"+b)>-1}},c.imagify.filesList.init()}(jQuery,document,window),function(a){for(var b=0,c=["ms","moz","webkit","o"],d=0;d<c.length&&!a.requestAnimationFrame;++d)a.requestAnimationFrame=a[c[d]+"RequestAnimationFrame"],a.cancelAnimationFrame=a[c[d]+"CancelAnimationFrame"]||a[c[d]+"CancelRequestAnimationFrame"];a.requestAnimationFrame||(a.requestAnimationFrame=function(a){var c=(new Date).getTime(),d=Math.max(0,16-(c-b)),e=setTimeout(function(){a(c+d)},d);return b=c+d,e}),a.cancelAnimationFrame||(a.cancelAnimationFrame=function(a){clearTimeout(a)})}(window),function(a,b,c,d){function e(){c.cancelAnimationFrame(g),g=c.requestAnimationFrame(f)}function f(){var b=a(c),f=b.scrollTop(),g=b.outerHeight();a.each(h,function(){var c,i=a(this),j=i.offset().top,k=j+i.outerHeight(),l=f-150,m=f+g+150;h=h.not(i),h.length||b.off("scroll resize orientationchange",e),k>=l&&j<=m&&(c=i.attr("data-lazy-src"),d!==c&&c&&i.attr("src",c).removeAttr("data-lazy-src"),i.next("noscript").remove())})}var g,h=a("#imagify-files-list-form").find("[data-lazy-src]");h.length&&(a(c).on("scroll resize orientationchange",e),f())}(jQuery,document,window);
assets/js/media-modal.js CHANGED
@@ -56,7 +56,7 @@ window.imagify.drawMeAChart = function( canvas ) {
56
  $document.on( 'click', '.imagify-datas-more-action a', this.toggleSlide );
57
 
58
  // Optimize, restore, etc.
59
- $document.on( 'click', '.button-imagify-restore, .button-imagify-optimize, .button-imagify-manual-reoptimize, .button-imagify-optimize-missing-sizes, .button-imagify-generate-webp', this.processOptimization );
60
 
61
  $document.on( 'imagifybeat-send', this.addToImagifybeat );
62
  $document.on( 'imagifybeat-tick', this.processImagifybeat );
56
  $document.on( 'click', '.imagify-datas-more-action a', this.toggleSlide );
57
 
58
  // Optimize, restore, etc.
59
+ $document.on( 'click', '.button-imagify-restore, .button-imagify-optimize, .button-imagify-manual-reoptimize, .button-imagify-optimize-missing-sizes, .button-imagify-generate-webp, .button-imagify-delete-webp', this.processOptimization );
60
 
61
  $document.on( 'imagifybeat-send', this.addToImagifybeat );
62
  $document.on( 'imagifybeat-tick', this.processImagifybeat );
assets/js/media-modal.min.js CHANGED
@@ -1 +1 @@
1
- window.imagify.drawMeAChart=function(a){a.each(function(){var a=parseInt(jQuery(this).closest(".imagify-chart").next(".imagify-chart-value").text(),10);new window.imagify.Chart(this,{type:"doughnut",data:{datasets:[{data:[a,100-a],backgroundColor:["#00B3D3","#D8D8D8"],borderColor:"#fff",borderWidth:1}]},options:{legend:{display:!1},events:[],animation:{easing:"easeOutBounce"},tooltips:{enabled:!1},responsive:!1}})})},function(a,b,c,d){c.imagify.modal={working:[],init:function(){var d,e=a(b);a(c).on("canvasprinted.imagify",this.updateChart).trigger("canvasprinted.imagify"),a(".imagify-datas-details").hide(),e.on("click",".imagify-datas-more-action a",this.toggleSlide),e.on("click",".button-imagify-restore, .button-imagify-optimize, .button-imagify-manual-reoptimize, .button-imagify-optimize-missing-sizes, .button-imagify-generate-webp",this.processOptimization),e.on("imagifybeat-send",this.addToImagifybeat),e.on("imagifybeat-tick",this.processImagifybeat),d=a(".imagify-data-actions-container .button-imagify-processing"),d.length&&(d.closest(".imagify-data-actions-container").each(function(){var b=a(this),d=c.imagify.modal.sanitizeId(b.data("id")),e=c.imagify.modal.sanitizeContext(b.data("context"));c.imagify.modal.lockItem(e,d)}),c.imagify.beat.interval(15))},updateChart:function(b,d){var e;d=d||".imagify-consumption-chart",e=a(d),c.imagify.drawMeAChart(e),e.closest(".imagify-datas-list").siblings(".imagify-datas-details").hide()},processOptimization:function(b){var d,e,f=a(this),g=f.parents(".imagify-data-actions-container"),h=c.imagify.modal.sanitizeId(g.data("id")),i=c.imagify.modal.sanitizeContext(g.data("context"));b.preventDefault(),c.imagify.modal.isItemLocked(i,h)||(c.imagify.modal.lockItem(i,h),d=f.attr("href"),e=c.imagify.template("imagify-button-processing"),g.html(e({label:f.data("processing-label")})),a.get(d.replace("admin-post.php","admin-ajax.php")).done(function(a){a.data&&a.data.html?c.imagify.modal.displayProcessResult(i,h,a.data.html):c.imagify.beat.interval(15)}))},addToImagifybeat:function(b,d){var e=a(".imagify-data-actions-container");e.length&&(d[c.imagifyModal.imagifybeatID]={},e.each(function(){var b=a(this),e=c.imagify.modal.sanitizeId(b.data("id")),f=c.imagify.modal.sanitizeContext(b.data("context")),g=c.imagify.modal.isItemLocked(f,e)?1:0;d[c.imagifyModal.imagifybeatID][f]=d[c.imagifyModal.imagifybeatID][f]||{},d[c.imagifyModal.imagifybeatID][f]["_"+e]=g}))},processImagifybeat:function(b,d){void 0!==d[c.imagifyModal.imagifybeatID]&&a.each(d[c.imagifyModal.imagifybeatID],function(b,d){var e,f;(e=a.trim(b).match(/^(.+)_(\d+)$/))&&(f=c.imagify.modal.sanitizeId(e[2]),e=c.imagify.modal.sanitizeContext(e[1]),c.imagify.modal.displayProcessResult(e,f,d))})},displayProcessResult:function(a,b,d){var e=c.imagify.modal.getContainers(a,b);e.html(d),c.imagify.modal.unlockItem(a,b),c.imagify.modal.working.length||(c.imagify.modal.openSlide(e),c.imagify.beat.resetInterval())},openSlide:function(b){b.each(function(){var b=a(this),c=b.find(".imagify-datas-more-action a").data("close");b.find(".imagify-datas-more-action a").addClass("is-open").find(".the-text").text(c),b.find(".imagify-datas-details").show().addClass("is-open")})},toggleSlide:function(b){var c=a(this);b.preventDefault(),c.hasClass("is-open")?(a(c.attr("href")).slideUp(300).removeClass("is-open"),c.removeClass("is-open").find(".the-text").text(c.data("open"))):(a(c.attr("href")).slideDown(300).addClass("is-open"),c.addClass("is-open").find(".the-text").text(c.data("close")))},getContainers:function(b,c){return a('.imagify-data-actions-container[data-id="'+c+'"][data-context="'+b+'"]')},sanitizeId:function(a){return parseInt(a,10)},sanitizeContext:function(a){return(a=a.replace("/[^a-z0-9_-]/gi","").toLowerCase())||"wp"},lockItem:function(a,b){this.isItemLocked(a,b)||this.working.push(a+"_"+b)},unlockItem:function(a,b){var c=a+"_"+b,d=_.indexOf(this.working,c);d>-1&&this.working.splice(d,1)},isItemLocked:function(a,b){return _.indexOf(this.working,a+"_"+b)>-1}},c.imagify.modal.init()}(jQuery,document,window);
1
+ window.imagify.drawMeAChart=function(a){a.each(function(){var a=parseInt(jQuery(this).closest(".imagify-chart").next(".imagify-chart-value").text(),10);new window.imagify.Chart(this,{type:"doughnut",data:{datasets:[{data:[a,100-a],backgroundColor:["#00B3D3","#D8D8D8"],borderColor:"#fff",borderWidth:1}]},options:{legend:{display:!1},events:[],animation:{easing:"easeOutBounce"},tooltips:{enabled:!1},responsive:!1}})})},function(a,b,c,d){c.imagify.modal={working:[],init:function(){var d,e=a(b);a(c).on("canvasprinted.imagify",this.updateChart).trigger("canvasprinted.imagify"),a(".imagify-datas-details").hide(),e.on("click",".imagify-datas-more-action a",this.toggleSlide),e.on("click",".button-imagify-restore, .button-imagify-optimize, .button-imagify-manual-reoptimize, .button-imagify-optimize-missing-sizes, .button-imagify-generate-webp, .button-imagify-delete-webp",this.processOptimization),e.on("imagifybeat-send",this.addToImagifybeat),e.on("imagifybeat-tick",this.processImagifybeat),d=a(".imagify-data-actions-container .button-imagify-processing"),d.length&&(d.closest(".imagify-data-actions-container").each(function(){var b=a(this),d=c.imagify.modal.sanitizeId(b.data("id")),e=c.imagify.modal.sanitizeContext(b.data("context"));c.imagify.modal.lockItem(e,d)}),c.imagify.beat.interval(15))},updateChart:function(b,d){var e;d=d||".imagify-consumption-chart",e=a(d),c.imagify.drawMeAChart(e),e.closest(".imagify-datas-list").siblings(".imagify-datas-details").hide()},processOptimization:function(b){var d,e,f=a(this),g=f.parents(".imagify-data-actions-container"),h=c.imagify.modal.sanitizeId(g.data("id")),i=c.imagify.modal.sanitizeContext(g.data("context"));b.preventDefault(),c.imagify.modal.isItemLocked(i,h)||(c.imagify.modal.lockItem(i,h),d=f.attr("href"),e=c.imagify.template("imagify-button-processing"),g.html(e({label:f.data("processing-label")})),a.get(d.replace("admin-post.php","admin-ajax.php")).done(function(a){a.data&&a.data.html?c.imagify.modal.displayProcessResult(i,h,a.data.html):c.imagify.beat.interval(15)}))},addToImagifybeat:function(b,d){var e=a(".imagify-data-actions-container");e.length&&(d[c.imagifyModal.imagifybeatID]={},e.each(function(){var b=a(this),e=c.imagify.modal.sanitizeId(b.data("id")),f=c.imagify.modal.sanitizeContext(b.data("context")),g=c.imagify.modal.isItemLocked(f,e)?1:0;d[c.imagifyModal.imagifybeatID][f]=d[c.imagifyModal.imagifybeatID][f]||{},d[c.imagifyModal.imagifybeatID][f]["_"+e]=g}))},processImagifybeat:function(b,d){void 0!==d[c.imagifyModal.imagifybeatID]&&a.each(d[c.imagifyModal.imagifybeatID],function(b,d){var e,f;(e=a.trim(b).match(/^(.+)_(\d+)$/))&&(f=c.imagify.modal.sanitizeId(e[2]),e=c.imagify.modal.sanitizeContext(e[1]),c.imagify.modal.displayProcessResult(e,f,d))})},displayProcessResult:function(a,b,d){var e=c.imagify.modal.getContainers(a,b);e.html(d),c.imagify.modal.unlockItem(a,b),c.imagify.modal.working.length||(c.imagify.modal.openSlide(e),c.imagify.beat.resetInterval())},openSlide:function(b){b.each(function(){var b=a(this),c=b.find(".imagify-datas-more-action a").data("close");b.find(".imagify-datas-more-action a").addClass("is-open").find(".the-text").text(c),b.find(".imagify-datas-details").show().addClass("is-open")})},toggleSlide:function(b){var c=a(this);b.preventDefault(),c.hasClass("is-open")?(a(c.attr("href")).slideUp(300).removeClass("is-open"),c.removeClass("is-open").find(".the-text").text(c.data("open"))):(a(c.attr("href")).slideDown(300).addClass("is-open"),c.addClass("is-open").find(".the-text").text(c.data("close")))},getContainers:function(b,c){return a('.imagify-data-actions-container[data-id="'+c+'"][data-context="'+b+'"]')},sanitizeId:function(a){return parseInt(a,10)},sanitizeContext:function(a){return(a=a.replace("/[^a-z0-9_-]/gi","").toLowerCase())||"wp"},lockItem:function(a,b){this.isItemLocked(a,b)||this.working.push(a+"_"+b)},unlockItem:function(a,b){var c=a+"_"+b,d=_.indexOf(this.working,c);d>-1&&this.working.splice(d,1)},isItemLocked:function(a,b){return _.indexOf(this.working,a+"_"+b)>-1}},c.imagify.modal.init()}(jQuery,document,window);
classes/Bulk/CustomFolders.php CHANGED
@@ -108,7 +108,7 @@ class CustomFolders extends AbstractBulk {
108
  ON ( fi.folder_id = fo.folder_id )
109
  WHERE
110
  fi.mime_type IN ( $mime_types )
111
- AND fi.status = 'success'
112
  AND ( fi.data NOT LIKE %s OR fi.data IS NULL )
113
  ORDER BY fi.file_id DESC",
114
  '%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
@@ -178,9 +178,8 @@ class CustomFolders extends AbstractBulk {
178
  ON ( fi.folder_id = fo.folder_id )
179
  WHERE
180
  fi.mime_type IN ( $mime_types )
181
- AND fi.status = 'success'
182
- AND ( fi.data NOT LIKE %s OR fi.data IS NULL )
183
- ORDER BY fi.file_id DESC",
184
  '%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
185
  ) );
186
  }
108
  ON ( fi.folder_id = fo.folder_id )
109
  WHERE
110
  fi.mime_type IN ( $mime_types )
111
+ AND ( fi.status = 'success' OR fi.status = 'already_optimized' )
112
  AND ( fi.data NOT LIKE %s OR fi.data IS NULL )
113
  ORDER BY fi.file_id DESC",
114
  '%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
178
  ON ( fi.folder_id = fo.folder_id )
179
  WHERE
180
  fi.mime_type IN ( $mime_types )
181
+ AND ( fi.status = 'success' OR fi.status = 'already_optimized' )
182
+ AND ( fi.data NOT LIKE %s OR fi.data IS NULL )",
 
183
  '%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
184
  ) );
185
  }
classes/Bulk/WP.php CHANGED
@@ -44,7 +44,7 @@ class WP extends AbstractBulk {
44
  ] );
45
  $ids = $wpdb->get_col( $wpdb->prepare( // WPCS: unprepared SQL ok.
46
  "
47
- SELECT p.ID
48
  FROM $wpdb->posts AS p
49
  $nodata_join
50
  LEFT JOIN $wpdb->postmeta AS mt1
@@ -63,7 +63,6 @@ class WP extends AbstractBulk {
63
  AND p.post_type = 'attachment'
64
  AND p.post_status IN ( $statuses )
65
  $nodata_where
66
- GROUP BY p.ID
67
  ORDER BY
68
  CASE mt1.meta_value
69
  WHEN 'already_optimized' THEN 2
@@ -210,7 +209,7 @@ class WP extends AbstractBulk {
210
  ON ( p.ID = mt2.post_id AND mt2.meta_key = '_imagify_data' )
211
  WHERE
212
  p.post_mime_type IN ( $mime_types )
213
- AND mt1.meta_value = 'success'
214
  AND mt2.meta_value NOT LIKE %s
215
  AND p.post_type = 'attachment'
216
  AND p.post_status IN ( $statuses )
@@ -314,7 +313,7 @@ class WP extends AbstractBulk {
314
  ON ( p.ID = mt2.post_id AND mt2.meta_key = '_imagify_data' )
315
  WHERE
316
  p.post_mime_type IN ( $mime_types )
317
- AND mt1.meta_value = 'success'
318
  AND mt2.meta_value NOT LIKE %s
319
  AND p.post_type = 'attachment'
320
  AND p.post_status IN ( $statuses )
44
  ] );
45
  $ids = $wpdb->get_col( $wpdb->prepare( // WPCS: unprepared SQL ok.
46
  "
47
+ SELECT DISTINCT p.ID
48
  FROM $wpdb->posts AS p
49
  $nodata_join
50
  LEFT JOIN $wpdb->postmeta AS mt1
63
  AND p.post_type = 'attachment'
64
  AND p.post_status IN ( $statuses )
65
  $nodata_where
 
66
  ORDER BY
67
  CASE mt1.meta_value
68
  WHEN 'already_optimized' THEN 2
209
  ON ( p.ID = mt2.post_id AND mt2.meta_key = '_imagify_data' )
210
  WHERE
211
  p.post_mime_type IN ( $mime_types )
212
+ AND ( mt1.meta_value = 'success' OR mt1.meta_value = 'already_optimized' )
213
  AND mt2.meta_value NOT LIKE %s
214
  AND p.post_type = 'attachment'
215
  AND p.post_status IN ( $statuses )
313
  ON ( p.ID = mt2.post_id AND mt2.meta_key = '_imagify_data' )
314
  WHERE
315
  p.post_mime_type IN ( $mime_types )
316
+ AND ( mt1.meta_value = 'success' OR mt1.meta_value = 'already_optimized' )
317
  AND mt2.meta_value NOT LIKE %s
318
  AND p.post_type = 'attachment'
319
  AND p.post_status IN ( $statuses )
classes/Job/MediaOptimization.php CHANGED
@@ -207,15 +207,16 @@ class MediaOptimization extends \Imagify_Abstract_Background_Process {
207
  if ( 'full' === $current_size ) {
208
  if ( is_wp_error( $data ) ) {
209
  // Don't go further if there is an error.
210
- $item['task'] = 'after';
211
  $item['error'] = $data;
212
- return $item;
213
- }
214
 
215
- if ( ! $this->optimization_process->get_data()->is_optimized() ) {
216
- // Don't go thurther if the full size has not the "success" status.
217
- $item['task'] = 'after';
218
- return $item;
 
 
 
219
  }
220
  }
221
 
@@ -224,7 +225,7 @@ class MediaOptimization extends \Imagify_Abstract_Background_Process {
224
  $item['task'] = 'after';
225
  }
226
 
227
- // Optimize the next file.
228
  return $item;
229
  }
230
 
207
  if ( 'full' === $current_size ) {
208
  if ( is_wp_error( $data ) ) {
209
  // Don't go further if there is an error.
210
+ $item['sizes'] = [];
211
  $item['error'] = $data;
 
 
212
 
213
+ } elseif ( 'already_optimized' === $data['status'] ) {
214
+ // Status is "already_optimized", try to create webp versions only.
215
+ $item['sizes'] = array_filter( $item['sizes'], [ $this->optimization_process, 'is_size_webp' ] );
216
+
217
+ } elseif ( 'success' !== $data['status'] ) {
218
+ // Don't go further if the full size has not the "success" status.
219
+ $item['sizes'] = [];
220
  }
221
  }
222
 
225
  $item['task'] = 'after';
226
  }
227
 
228
+ // Optimize the next file or go to the next task.
229
  return $item;
230
  }
231
 
classes/Optimization/Process/AbstractProcess.php CHANGED
@@ -258,10 +258,22 @@ abstract class AbstractProcess implements ProcessInterface {
258
  return new \WP_Error( 'media_not_supported', __( 'This media is not supported.', 'imagify' ) );
259
  }
260
 
261
- if ( $this->get_data()->is_optimized() ) {
 
 
262
  return new \WP_Error( 'optimized', __( 'This media has already been optimized by Imagify.', 'imagify' ) );
263
  }
264
 
 
 
 
 
 
 
 
 
 
 
265
  $sizes = $media->get_media_files();
266
  $args = is_array( $args ) ? $args : [];
267
 
@@ -444,7 +456,7 @@ abstract class AbstractProcess implements ProcessInterface {
444
  *
445
  * @param string $size The media size.
446
  * @param int $optimization_level The optimization level (0=normal, 1=aggressive, 2=ultra).
447
- * @return \sdtClass|\WP_Error Optimized image data. A \WP_Error object on error.
448
  */
449
  public function optimize_size( $size, $optimization_level = null ) {
450
  if ( ! $this->is_valid() ) { // Bail out.
@@ -1373,7 +1385,7 @@ abstract class AbstractProcess implements ProcessInterface {
1373
 
1374
  $data = $this->get_data();
1375
 
1376
- if ( ! $data->is_optimized() ) {
1377
  return new \WP_Error( 'not_optimized', __( 'This media has not been optimized by Imagify yet.', 'imagify' ) );
1378
  }
1379
 
@@ -1408,20 +1420,22 @@ abstract class AbstractProcess implements ProcessInterface {
1408
  * This doesn't delete the related optimization data.
1409
  *
1410
  * @since 1.9
 
1411
  * @access public
1412
  * @author Grégory Viguier
1413
  *
1414
- * @param bool $keep_full Set to true to keep the full size.
 
1415
  */
1416
  public function delete_webp_files( $keep_full = false ) {
1417
  if ( ! $this->is_valid() ) {
1418
- return;
1419
  }
1420
 
1421
  $media = $this->get_media();
1422
 
1423
  if ( ! $media->is_image() ) {
1424
- return;
1425
  }
1426
 
1427
  $files = $media->get_media_files();
@@ -1431,14 +1445,33 @@ abstract class AbstractProcess implements ProcessInterface {
1431
  }
1432
 
1433
  if ( ! $files ) {
1434
- return;
1435
  }
1436
 
 
 
1437
  foreach ( $files as $file ) {
1438
  if ( 0 === strpos( $file['mime-type'], 'image/' ) ) {
1439
- $this->delete_webp_file( $file['path'] );
 
 
 
 
1440
  }
1441
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
1442
  }
1443
 
1444
  /**
@@ -1446,22 +1479,65 @@ abstract class AbstractProcess implements ProcessInterface {
1446
  * This doesn't delete the related optimization data.
1447
  *
1448
  * @since 1.9
 
1449
  * @access protected
1450
  * @author Grégory Viguier
1451
  *
1452
- * @param string $file_path Path to the non-webp file.
 
1453
  */
1454
  protected function delete_webp_file( $file_path ) {
1455
  if ( ! $file_path ) {
1456
- return;
1457
  }
1458
 
1459
  $webp_file = new File( $file_path );
1460
  $webp_path = $webp_file->get_path_to_webp();
1461
 
1462
- if ( $webp_path && $this->filesystem->is_writable( $webp_path ) && $this->filesystem->is_file( $webp_path ) ) {
1463
- $this->filesystem->delete( $webp_path, false, 'f' );
1464
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1465
  }
1466
 
1467
  /**
@@ -1788,7 +1864,7 @@ abstract class AbstractProcess implements ProcessInterface {
1788
  * @param int $level The optimization level.
1789
  * @param object $media_data The DataInterface instance of the media.
1790
  */
1791
- $data = apply_filters( "imagify{$_unauthorized}_file_optimization_data", $data, $response, $size, $level, $this->get_data() );
1792
 
1793
  // Store.
1794
  $this->get_data()->update_size_optimization_data( $size, $data );
258
  return new \WP_Error( 'media_not_supported', __( 'This media is not supported.', 'imagify' ) );
259
  }
260
 
261
+ $data = $this->get_data();
262
+
263
+ if ( $data->is_optimized() ) {
264
  return new \WP_Error( 'optimized', __( 'This media has already been optimized by Imagify.', 'imagify' ) );
265
  }
266
 
267
+ if ( $data->is_already_optimized() && $this->has_webp() ) {
268
+ // If already optimized but has webp, delete webp versions and optimization data.
269
+ $data->delete_optimization_data();
270
+ $deleted = $this->delete_webp_files();
271
+
272
+ if ( is_wp_error( $deleted ) ) {
273
+ return new \WP_Error( 'webp_not_deleted', __( 'Previous webp files could not be deleted.', 'imagify' ) );
274
+ }
275
+ }
276
+
277
  $sizes = $media->get_media_files();
278
  $args = is_array( $args ) ? $args : [];
279
 
456
  *
457
  * @param string $size The media size.
458
  * @param int $optimization_level The optimization level (0=normal, 1=aggressive, 2=ultra).
459
+ * @return array|\WP_Error Optimized image data. A \WP_Error object on error.
460
  */
461
  public function optimize_size( $size, $optimization_level = null ) {
462
  if ( ! $this->is_valid() ) { // Bail out.
1385
 
1386
  $data = $this->get_data();
1387
 
1388
+ if ( ! $data->is_optimized() && ! $data->is_already_optimized() ) {
1389
  return new \WP_Error( 'not_optimized', __( 'This media has not been optimized by Imagify yet.', 'imagify' ) );
1390
  }
1391
 
1420
  * This doesn't delete the related optimization data.
1421
  *
1422
  * @since 1.9
1423
+ * @since 1.9.6 Return WP_Error or true.
1424
  * @access public
1425
  * @author Grégory Viguier
1426
  *
1427
+ * @param bool $keep_full Set to true to keep the full size.
1428
+ * @return bool|\WP_Error True on success. A \WP_Error object on failure.
1429
  */
1430
  public function delete_webp_files( $keep_full = false ) {
1431
  if ( ! $this->is_valid() ) {
1432
+ return new \WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) );
1433
  }
1434
 
1435
  $media = $this->get_media();
1436
 
1437
  if ( ! $media->is_image() ) {
1438
+ return new \WP_Error( 'media_not_an_image', __( 'This media is not an image.', 'imagify' ) );
1439
  }
1440
 
1441
  $files = $media->get_media_files();
1445
  }
1446
 
1447
  if ( ! $files ) {
1448
+ return true;
1449
  }
1450
 
1451
+ $error_count = 0;
1452
+
1453
  foreach ( $files as $file ) {
1454
  if ( 0 === strpos( $file['mime-type'], 'image/' ) ) {
1455
+ $deleted = $this->delete_webp_file( $file['path'] );
1456
+
1457
+ if ( is_wp_error( $deleted ) ) {
1458
+ ++$error_count;
1459
+ }
1460
  }
1461
  }
1462
+
1463
+ if ( $error_count ) {
1464
+ return new \WP_Error(
1465
+ 'files_not_deleted',
1466
+ sprintf(
1467
+ /* translators: %s is a formatted number, don’t use %d. */
1468
+ _n( '%s file could not be deleted.', '%s files could not be deleted.', $error_count, 'imagify' ),
1469
+ number_format_i18n( $error_count )
1470
+ )
1471
+ );
1472
+ }
1473
+
1474
+ return true;
1475
  }
1476
 
1477
  /**
1479
  * This doesn't delete the related optimization data.
1480
  *
1481
  * @since 1.9
1482
+ * @since 1.9.6 Return WP_Error or true.
1483
  * @access protected
1484
  * @author Grégory Viguier
1485
  *
1486
+ * @param string $file_path Path to the non-webp file.
1487
+ * @return bool|\WP_Error True on success. A \WP_Error object on failure.
1488
  */
1489
  protected function delete_webp_file( $file_path ) {
1490
  if ( ! $file_path ) {
1491
+ return new \WP_Error( 'no_path', __( 'Path to non-webp file not provided.', 'imagify' ) );
1492
  }
1493
 
1494
  $webp_file = new File( $file_path );
1495
  $webp_path = $webp_file->get_path_to_webp();
1496
 
1497
+ if ( ! $webp_path ) {
1498
+ return new \WP_Error( 'no_webp_path', __( 'Could not get the path to the webp file.', 'imagify' ) );
1499
  }
1500
+
1501
+ if ( ! $this->filesystem->exists( $webp_path ) ) {
1502
+ return true;
1503
+ }
1504
+
1505
+ if ( ! $this->filesystem->is_writable( $webp_path ) ) {
1506
+ return new \WP_Error(
1507
+ 'file_not_writable',
1508
+ sprintf(
1509
+ /* translators: %s is a file path. */
1510
+ __( 'The file %s does not seem to be writable.', 'imagify' ),
1511
+ '<code>' . esc_html( $this->filesystem->make_path_relative( $webp_path ) ) . '</code>'
1512
+ )
1513
+ );
1514
+ }
1515
+
1516
+ if ( ! $this->filesystem->is_file( $webp_path ) ) {
1517
+ return new \WP_Error(
1518
+ 'not_a_file',
1519
+ sprintf(
1520
+ /* translators: %s is a file path. */
1521
+ __( 'This does not seem to be a file: %s.', 'imagify' ),
1522
+ '<code>' . esc_html( $this->filesystem->make_path_relative( $webp_path ) ) . '</code>'
1523
+ )
1524
+ );
1525
+ }
1526
+
1527
+ $deleted = $this->filesystem->delete( $webp_path, false, 'f' );
1528
+
1529
+ if ( ! $deleted ) {
1530
+ return new \WP_Error(
1531
+ 'file_not_deleted',
1532
+ sprintf(
1533
+ /* translators: %s is a file path. */
1534
+ __( 'The file %s could not be deleted.', 'imagify' ),
1535
+ '<code>' . esc_html( $this->filesystem->make_path_relative( $webp_path ) ) . '</code>'
1536
+ )
1537
+ );
1538
+ }
1539
+
1540
+ return true;
1541
  }
1542
 
1543
  /**
1864
  * @param int $level The optimization level.
1865
  * @param object $media_data The DataInterface instance of the media.
1866
  */
1867
+ $data = (array) apply_filters( "imagify{$_unauthorized}_file_optimization_data", $data, $response, $size, $level, $this->get_data() );
1868
 
1869
  // Store.
1870
  $this->get_data()->update_size_optimization_data( $size, $data );
classes/Optimization/Process/ProcessInterface.php CHANGED
@@ -239,12 +239,17 @@ interface ProcessInterface {
239
 
240
  /**
241
  * Delete the webp images.
 
242
  *
243
  * @since 1.9
 
244
  * @access public
245
  * @author Grégory Viguier
 
 
 
246
  */
247
- public function delete_webp_files();
248
 
249
  /**
250
  * Tell if a thumbnail size is an "Imagify webp" size.
239
 
240
  /**
241
  * Delete the webp images.
242
+ * This doesn't delete the related optimization data.
243
  *
244
  * @since 1.9
245
+ * @since 1.9.6 Return WP_Error or true.
246
  * @access public
247
  * @author Grégory Viguier
248
+ *
249
+ * @param bool $keep_full Set to true to keep the full size.
250
+ * @return bool|\WP_Error True on success. A \WP_Error object on failure.
251
  */
252
+ public function delete_webp_files( $keep_full = false );
253
 
254
  /**
255
  * Tell if a thumbnail size is an "Imagify webp" size.
imagify.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Imagify
4
  * Plugin URI: https://wordpress.org/plugins/imagify/
5
  * Description: Dramaticaly reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth using Imagify, the new most advanced image optimization tool.
6
- * Version: 1.9.5
7
  * Requires PHP: 5.4
8
  * Author: WP Media
9
  * Author URI: https://wp-media.me/
@@ -20,7 +20,7 @@
20
  defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
21
 
22
  // Imagify defines.
23
- define( 'IMAGIFY_VERSION', '1.9.5' );
24
  define( 'IMAGIFY_SLUG', 'imagify' );
25
  define( 'IMAGIFY_FILE', __FILE__ );
26
  define( 'IMAGIFY_PATH', realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' );
3
  * Plugin Name: Imagify
4
  * Plugin URI: https://wordpress.org/plugins/imagify/
5
  * Description: Dramaticaly reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth using Imagify, the new most advanced image optimization tool.
6
+ * Version: 1.9.6
7
  * Requires PHP: 5.4
8
  * Author: WP Media
9
  * Author URI: https://wp-media.me/
20
  defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
21
 
22
  // Imagify defines.
23
+ define( 'IMAGIFY_VERSION', '1.9.6' );
24
  define( 'IMAGIFY_SLUG', 'imagify' );
25
  define( 'IMAGIFY_FILE', __FILE__ );
26
  define( 'IMAGIFY_PATH', realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' );
inc/3rd-party/nextgen-gallery/classes/Bulk/NGG.php CHANGED
@@ -43,7 +43,7 @@ class NGG extends \Imagify\Bulk\AbstractBulk {
43
  $data = [];
44
  $images = $wpdb->get_results( $wpdb->prepare( // WPCS: unprepared SQL ok.
45
  "
46
- SELECT picture.pid as id, picture.filename, idata.optimization_level, idata.status, idata.data
47
  FROM $ngg_table as picture
48
  LEFT JOIN $wpdb->ngg_imagify_data as idata
49
  ON picture.pid = idata.pid
@@ -137,7 +137,7 @@ class NGG extends \Imagify\Bulk\AbstractBulk {
137
  INNER JOIN $data_table AS data
138
  ON ( ngg.pid = data.pid )
139
  WHERE
140
- data.status = 'success'
141
  AND data.data NOT LIKE %s
142
  ORDER BY ngg.pid DESC",
143
  '%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
@@ -205,9 +205,8 @@ class NGG extends \Imagify\Bulk\AbstractBulk {
205
  INNER JOIN $data_table AS data
206
  ON ( ngg.pid = data.pid )
207
  WHERE
208
- data.status = 'success'
209
- AND data.data NOT LIKE %s
210
- ORDER BY ngg.pid DESC",
211
  '%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
212
  ) );
213
  }
43
  $data = [];
44
  $images = $wpdb->get_results( $wpdb->prepare( // WPCS: unprepared SQL ok.
45
  "
46
+ SELECT DISTINCT picture.pid as id, picture.filename, idata.optimization_level, idata.status, idata.data
47
  FROM $ngg_table as picture
48
  LEFT JOIN $wpdb->ngg_imagify_data as idata
49
  ON picture.pid = idata.pid
137
  INNER JOIN $data_table AS data
138
  ON ( ngg.pid = data.pid )
139
  WHERE
140
+ ( data.status = 'success' OR data.status = 'already_optimized' )
141
  AND data.data NOT LIKE %s
142
  ORDER BY ngg.pid DESC",
143
  '%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
205
  INNER JOIN $data_table AS data
206
  ON ( ngg.pid = data.pid )
207
  WHERE
208
+ ( data.status = 'success' OR data.status = 'already_optimized' )
209
+ AND data.data NOT LIKE %s",
 
210
  '%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
211
  ) );
212
  }
inc/admin/upgrader.php CHANGED
@@ -294,6 +294,11 @@ function _imagify_new_upgrade( $network_version, $site_version ) {
294
  if ( version_compare( $site_version, '1.8.2' ) < 0 ) {
295
  Imagify_Options::get_instance()->set( 'partner_links', 1 );
296
  }
 
 
 
 
 
297
  }
298
 
299
  add_action( 'upgrader_process_complete', 'imagify_maybe_reset_opcache', 20, 2 );
294
  if ( version_compare( $site_version, '1.8.2' ) < 0 ) {
295
  Imagify_Options::get_instance()->set( 'partner_links', 1 );
296
  }
297
+
298
+ // 1.9.6
299
+ if ( version_compare( $site_version, '1.9.6' ) < 0 ) {
300
+ \Imagify\Stats\OptimizedMediaWithoutWebp::get_instance()->clear_cache();
301
+ }
302
  }
303
 
304
  add_action( 'upgrader_process_complete', 'imagify_maybe_reset_opcache', 20, 2 );
inc/classes/class-imagify-admin-ajax-post.php CHANGED
@@ -33,6 +33,7 @@ class Imagify_Admin_Ajax_Post extends Imagify_Admin_Ajax_Post_Deprecated {
33
  'imagify_manual_reoptimize',
34
  'imagify_optimize_missing_sizes',
35
  'imagify_generate_webp_versions',
 
36
  'imagify_restore',
37
  // Custom folders optimization.
38
  'imagify_optimize_file',
@@ -237,6 +238,44 @@ class Imagify_Admin_Ajax_Post extends Imagify_Admin_Ajax_Post_Deprecated {
237
  return imagify_get_optimization_process( $media_id, $context )->generate_webp_versions();
238
  }
239
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
  /**
241
  * Restore a media.
242
  *
@@ -577,6 +616,41 @@ class Imagify_Admin_Ajax_Post extends Imagify_Admin_Ajax_Post_Deprecated {
577
  wp_send_json_success();
578
  }
579
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
580
  /**
581
  * Process a restoration to the original attachment.
582
  *
33
  'imagify_manual_reoptimize',
34
  'imagify_optimize_missing_sizes',
35
  'imagify_generate_webp_versions',
36
+ 'imagify_delete_webp_versions',
37
  'imagify_restore',
38
  // Custom folders optimization.
39
  'imagify_optimize_file',
238
  return imagify_get_optimization_process( $media_id, $context )->generate_webp_versions();
239
  }
240
 
241
+ /**
242
+ * Delete webp images for media that are "already_optimize".
243
+ *
244
+ * @since 1.9.6
245
+ * @access protected
246
+ * @author Grégory Viguier
247
+ *
248
+ * @param int $media_id The media ID.
249
+ * @param string $context The context.
250
+ * @return bool|WP_Error True if successfully launched. A \WP_Error instance on failure.
251
+ */
252
+ protected function delete_webp_versions( $media_id, $context ) {
253
+ $process = imagify_get_optimization_process( $media_id, $context );
254
+
255
+ if ( ! $process->is_valid() ) {
256
+ return new \WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) );
257
+ }
258
+
259
+ $data = $process->get_data();
260
+
261
+ if ( ! $data->is_already_optimized() ) {
262
+ return new \WP_Error( 'not_already_optimized', __( 'This media does not have the right optimization status.', 'imagify' ) );
263
+ }
264
+
265
+ if ( ! $process->has_webp() ) {
266
+ return true;
267
+ }
268
+
269
+ $data->delete_optimization_data();
270
+ $deleted = $process->delete_webp_files();
271
+
272
+ if ( is_wp_error( $deleted ) ) {
273
+ return new \WP_Error( 'webp_not_deleted', __( 'Previous webp files could not be deleted.', 'imagify' ) );
274
+ }
275
+
276
+ return true;
277
+ }
278
+
279
  /**
280
  * Restore a media.
281
  *
616
  wp_send_json_success();
617
  }
618
 
619
+ /**
620
+ * Generate webp images if they are missing.
621
+ *
622
+ * @since 1.9.6
623
+ * @access public
624
+ * @author Grégory Viguier
625
+ */
626
+ public function imagify_delete_webp_versions_callback() {
627
+ $context = $this->get_context();
628
+ $media_id = $this->get_media_id();
629
+
630
+ if ( ! $media_id || ! $context ) {
631
+ imagify_die( __( 'Invalid request', 'imagify' ) );
632
+ }
633
+
634
+ imagify_check_nonce( 'imagify-delete-webp-versions-' . $media_id . '-' . $context );
635
+
636
+ if ( ! imagify_get_context( $context )->current_user_can( 'manual-restore', $media_id ) ) {
637
+ imagify_die();
638
+ }
639
+
640
+ $result = $this->delete_webp_versions( $media_id, $context );
641
+
642
+ imagify_maybe_redirect( is_wp_error( $result ) ? $result : false );
643
+
644
+ if ( is_wp_error( $result ) ) {
645
+ // Return an error message.
646
+ $output = $result->get_error_message();
647
+
648
+ wp_send_json_error( [ 'html' => $output ] );
649
+ }
650
+
651
+ wp_send_json_success();
652
+ }
653
+
654
  /**
655
  * Process a restoration to the original attachment.
656
  *
inc/classes/class-imagify-files-list-table.php CHANGED
@@ -741,6 +741,7 @@ class Imagify_Files_List_Table extends WP_List_Table {
741
  $this->retry_button( $item );
742
  $this->reoptimize_buttons( $item );
743
  $this->generate_webp_versions_button( $item );
 
744
  $this->restore_button( $item );
745
  }
746
 
@@ -853,7 +854,7 @@ class Imagify_Files_List_Table extends WP_List_Table {
853
  }
854
 
855
  /**
856
- * Prints buttons to re-optimize the file to other levels.
857
  *
858
  * @since 1.7
859
  * @access protected
@@ -869,6 +870,23 @@ class Imagify_Files_List_Table extends WP_List_Table {
869
  }
870
  }
871
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
872
  /**
873
  * Prints a button to restore the file.
874
  *
741
  $this->retry_button( $item );
742
  $this->reoptimize_buttons( $item );
743
  $this->generate_webp_versions_button( $item );
744
+ $this->delete_webp_versions_button( $item );
745
  $this->restore_button( $item );
746
  }
747
 
854
  }
855
 
856
  /**
857
+ * Prints a button to generate webp versions if they are missing.
858
  *
859
  * @since 1.7
860
  * @access protected
870
  }
871
  }
872
 
873
+ /**
874
+ * Prints a button to delete webp versions when the status is "already_optimized".
875
+ *
876
+ * @since 1.9.6
877
+ * @access protected
878
+ * @author Grégory Viguier
879
+ *
880
+ * @param object $item The current item. It must contain at least a $process property.
881
+ */
882
+ protected function delete_webp_versions_button( $item ) {
883
+ $button = get_imagify_attachment_delete_webp_versions_link( $item->process );
884
+
885
+ if ( $button ) {
886
+ echo $button . '<br/>';
887
+ }
888
+ }
889
+
890
  /**
891
  * Prints a button to restore the file.
892
  *
inc/functions/admin-ui.php CHANGED
@@ -24,6 +24,7 @@ function get_imagify_attachment_optimization_text( $process ) {
24
  $reoptimize_link = get_imagify_attachment_reoptimize_link( $process );
25
  $reoptimize_link .= get_imagify_attachment_optimize_missing_thumbnails_link( $process );
26
  $reoptimize_link .= get_imagify_attachment_generate_webp_versions_link( $process );
 
27
  $reoptimize_output = $reoptimize_link ? $reoptimize_link : '';
28
  $reoptimize_output_before = '<div class="imagify-datas-actions-links">';
29
  $reoptimize_output_after = '</div><!-- .imagify-datas-actions-links -->';
@@ -332,7 +333,9 @@ function get_imagify_attachment_generate_webp_versions_link( $process ) {
332
  return '';
333
  }
334
 
335
- if ( ! $process->get_data()->is_optimized() ) {
 
 
336
  return '';
337
  }
338
 
@@ -371,6 +374,52 @@ function get_imagify_attachment_generate_webp_versions_link( $process ) {
371
  return $output . '<br/>';
372
  }
373
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
  /**
375
  * Get all data to diplay for a specific media.
376
  *
24
  $reoptimize_link = get_imagify_attachment_reoptimize_link( $process );
25
  $reoptimize_link .= get_imagify_attachment_optimize_missing_thumbnails_link( $process );
26
  $reoptimize_link .= get_imagify_attachment_generate_webp_versions_link( $process );
27
+ $reoptimize_link .= get_imagify_attachment_delete_webp_versions_link( $process );
28
  $reoptimize_output = $reoptimize_link ? $reoptimize_link : '';
29
  $reoptimize_output_before = '<div class="imagify-datas-actions-links">';
30
  $reoptimize_output_after = '</div><!-- .imagify-datas-actions-links -->';
333
  return '';
334
  }
335
 
336
+ $data = $process->get_data();
337
+
338
+ if ( ! $data->is_optimized() && ! $data->is_already_optimized() ) {
339
  return '';
340
  }
341
 
374
  return $output . '<br/>';
375
  }
376
 
377
+ /**
378
+ * Get the link to delete webp versions when the status is "already_optimized".
379
+ *
380
+ * @since 1.9.6
381
+ * @author Grégory Viguier
382
+ *
383
+ * @param ProcessInterface $process The optimization process object.
384
+ * @return string The output to print.
385
+ */
386
+ function get_imagify_attachment_delete_webp_versions_link( $process ) {
387
+ if ( ! $process->is_valid() ) {
388
+ return '';
389
+ }
390
+
391
+ $media = $process->get_media();
392
+ $context = $media->get_context();
393
+ $media_id = $media->get_id();
394
+
395
+ if ( ! imagify_get_context( $context )->current_user_can( 'manual-restore', $media_id ) ) {
396
+ imagify_die();
397
+ }
398
+
399
+ $data = $process->get_data();
400
+
401
+ if ( ! $data->is_already_optimized() || ! $process->has_webp() ) {
402
+ return '';
403
+ }
404
+
405
+ $class = '';
406
+ $url = get_imagify_admin_url( 'delete-webp-versions', [
407
+ 'attachment_id' => $media_id,
408
+ 'context' => $context,
409
+ ] );
410
+
411
+ if ( ! Imagify_Views::get_instance()->is_media_page() ) {
412
+ $class .= 'button-imagify-delete-webp';
413
+ }
414
+
415
+ return Imagify_Views::get_instance()->get_template( 'button/delete-webp', [
416
+ 'url' => $url,
417
+ 'atts' => [
418
+ 'class' => $class,
419
+ ],
420
+ ] );
421
+ }
422
+
423
  /**
424
  * Get all data to diplay for a specific media.
425
  *
inc/functions/admin.php CHANGED
@@ -104,6 +104,9 @@ function get_imagify_admin_url( $action = 'settings', $arg = [] ) {
104
  case 'generate-webp-versions':
105
  return wp_nonce_url( admin_url( 'admin-post.php?action=imagify_generate_webp_versions&attachment_id=' . $id . '&context=' . $context ), 'imagify-generate-webp-versions-' . $id . '-' . $context );
106
 
 
 
 
107
  case 'optimize':
108
  case 'manual-upload': // Deprecated.
109
  case 'manual-optimize':
104
  case 'generate-webp-versions':
105
  return wp_nonce_url( admin_url( 'admin-post.php?action=imagify_generate_webp_versions&attachment_id=' . $id . '&context=' . $context ), 'imagify-generate-webp-versions-' . $id . '-' . $context );
106
 
107
+ case 'delete-webp-versions':
108
+ return wp_nonce_url( admin_url( 'admin-post.php?action=imagify_delete_webp_versions&attachment_id=' . $id . '&context=' . $context ), 'imagify-delete-webp-versions-' . $id . '-' . $context );
109
+
110
  case 'optimize':
111
  case 'manual-upload': // Deprecated.
112
  case 'manual-optimize':
package.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "name": "imagify",
3
  "description": "Imagify Image Optimizer. Dramatically reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth.",
4
- "version": "1.9.5",
5
  "homepage": "https://wordpress.org/plugins/imagify/",
6
  "license": "GPL-2.0",
7
  "private": true,
1
  {
2
  "name": "imagify",
3
  "description": "Imagify Image Optimizer. Dramatically reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth.",
4
+ "version": "1.9.6",
5
  "homepage": "https://wordpress.org/plugins/imagify/",
6
  "license": "GPL-2.0",
7
  "private": true,
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
- === Imagify - WebP & Image Compression ===
2
  Contributors: wp_media, GregLone
3
- Tags: compress image, images, optimize, performance, webp
4
  Requires at least: 4.0.0
5
  Tested up to: 5.2.2
6
- Stable tag: 1.9.5
7
 
8
  Optimize images in one click: reduce image file sizes, convert WebP, keep your images beautiful… and boost your loading time and your SEO!
9
 
@@ -153,6 +153,10 @@ When the plugin is disabled, your existing images remain optimized. Backups of t
153
  4. Other Media Page
154
 
155
  == Changelog ==
 
 
 
 
156
  = 1.9.5 - 2019/07/16 =
157
  * Improvement: Basic Authentication support. If it does not work automatically, you can still define the constants `IMAGIFY_AUTH_USER` and `IMAGIFY_AUTH_PASSWORD` in your `wp-config.php` file.
158
  * Improvement: webp images are not created for animated gif images by default anymore. Use the filter `imagify_pre_can_create_webp_version` if you still want to create an unanimated webp version of them.
1
+ === Imagify WebP & Image Compression and Optimization ===
2
  Contributors: wp_media, GregLone
3
+ Tags: optimize images, images, optimize, performance, webp
4
  Requires at least: 4.0.0
5
  Tested up to: 5.2.2
6
+ Stable tag: 1.9.6
7
 
8
  Optimize images in one click: reduce image file sizes, convert WebP, keep your images beautiful… and boost your loading time and your SEO!
9
 
153
  4. Other Media Page
154
 
155
  == Changelog ==
156
+ = 1.9.6 - 2019/07/22 =
157
+ * Improvement: now images that are "already optimized" can also get webp versions.
158
+ * Fix: progress bar height in the admin bar for Chrome and Safari.
159
+
160
  = 1.9.5 - 2019/07/16 =
161
  * Improvement: Basic Authentication support. If it does not work automatically, you can still define the constants `IMAGIFY_AUTH_USER` and `IMAGIFY_AUTH_PASSWORD` in your `wp-config.php` file.
162
  * Improvement: webp images are not created for animated gif images by default anymore. Use the filter `imagify_pre_can_create_webp_version` if you still want to create an unanimated webp version of them.
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitc75cefd5fcd7d6d644e0342a0ffbe040::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitdcc95c2dd8902a9b7b27a6aff354b874::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitc75cefd5fcd7d6d644e0342a0ffbe040
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitc75cefd5fcd7d6d644e0342a0ffbe040
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitc75cefd5fcd7d6d644e0342a0ffbe040', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitc75cefd5fcd7d6d644e0342a0ffbe040', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInitc75cefd5fcd7d6d644e0342a0ffbe040::getInitializer($loader));
31
  } else {
32
  $classMap = require __DIR__ . '/autoload_classmap.php';
33
  if ($classMap) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitdcc95c2dd8902a9b7b27a6aff354b874
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitdcc95c2dd8902a9b7b27a6aff354b874', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitdcc95c2dd8902a9b7b27a6aff354b874', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInitdcc95c2dd8902a9b7b27a6aff354b874::getInitializer($loader));
31
  } else {
32
  $classMap = require __DIR__ . '/autoload_classmap.php';
33
  if ($classMap) {
vendor/composer/autoload_static.php CHANGED
@@ -7,7 +7,7 @@ namespace Composer\Autoload;
7
  use Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader as ClassLoaderWPMediaImagifyWordPressPlugin;
8
 
9
 
10
- class ComposerStaticInitc75cefd5fcd7d6d644e0342a0ffbe040
11
  {
12
  public static $prefixLengthsPsr4 = array (
13
  'I' =>
@@ -273,9 +273,9 @@ class ComposerStaticInitc75cefd5fcd7d6d644e0342a0ffbe040
273
  public static function getInitializer(ClassLoaderWPMediaImagifyWordPressPlugin $loader)
274
  {
275
  return \Closure::bind(function () use ($loader) {
276
- $loader->prefixLengthsPsr4 = ComposerStaticInitc75cefd5fcd7d6d644e0342a0ffbe040::$prefixLengthsPsr4;
277
- $loader->prefixDirsPsr4 = ComposerStaticInitc75cefd5fcd7d6d644e0342a0ffbe040::$prefixDirsPsr4;
278
- $loader->classMap = ComposerStaticInitc75cefd5fcd7d6d644e0342a0ffbe040::$classMap;
279
 
280
  }, null, ClassLoaderWPMediaImagifyWordPressPlugin::class);
281
  }
7
  use Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader as ClassLoaderWPMediaImagifyWordPressPlugin;
8
 
9
 
10
+ class ComposerStaticInitdcc95c2dd8902a9b7b27a6aff354b874
11
  {
12
  public static $prefixLengthsPsr4 = array (
13
  'I' =>
273
  public static function getInitializer(ClassLoaderWPMediaImagifyWordPressPlugin $loader)
274
  {
275
  return \Closure::bind(function () use ($loader) {
276
+ $loader->prefixLengthsPsr4 = ComposerStaticInitdcc95c2dd8902a9b7b27a6aff354b874::$prefixLengthsPsr4;
277
+ $loader->prefixDirsPsr4 = ComposerStaticInitdcc95c2dd8902a9b7b27a6aff354b874::$prefixDirsPsr4;
278
+ $loader->classMap = ComposerStaticInitdcc95c2dd8902a9b7b27a6aff354b874::$classMap;
279
 
280
  }, null, ClassLoaderWPMediaImagifyWordPressPlugin::class);
281
  }
views/button/delete-webp.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
3
+
4
+ $html_atts = '';
5
+
6
+ if ( empty( $data['atts'] ) ) {
7
+ $data['atts'] = [];
8
+ }
9
+
10
+ if ( ! isset( $data['atts']['class'] ) ) {
11
+ // Class used for JS.
12
+ $data['atts']['class'] = 'button-imagify-delete-webp';
13
+ }
14
+
15
+ if ( ! isset( $data['atts']['data-processing-label'] ) ) {
16
+ // Used for JS.
17
+ $data['atts']['data-processing-label'] = __( 'Deleting...', 'imagify' );
18
+ }
19
+
20
+ $html_atts = $this->build_attributes( $data['atts'] );
21
+ ?>
22
+
23
+ <a href="<?php echo esc_url( $data['url'] ); ?>"<?php echo $html_atts; ?>>
24
+ <span class="dashicons dashicons-image-rotate"></span>
25
+ <?php esc_html_e( 'Delete webp images', 'imagify' ); ?>
26
+ </a>
27
+
28
+ <?php
29
+ if ( ! empty( $data['atts']['data-processing-label'] ) ) {
30
+ $this->print_js_template_in_footer( 'button/processing' );
31
+ }
views/button/retry-optimize.php CHANGED
@@ -21,7 +21,19 @@ $html_atts = $this->build_attributes( $data['atts'] );
21
 
22
  if ( ! empty( $data['error'] ) ) {
23
  ?>
24
- <strong><?php echo esc_html( imagify_translate_api_message( $data['error'] ) ); ?></strong>
 
 
 
 
 
 
 
 
 
 
 
 
25
  <br/>
26
  <?php
27
  }
21
 
22
  if ( ! empty( $data['error'] ) ) {
23
  ?>
24
+ <strong>
25
+ <?php
26
+ echo wp_kses(
27
+ imagify_translate_api_message( $data['error'] ),
28
+ [
29
+ 'br' => true,
30
+ 'code' => true,
31
+ 'em' => true,
32
+ 'strong' => true,
33
+ ]
34
+ );
35
+ ?>
36
+ </strong>
37
  <br/>
38
  <?php
39
  }