Imagify Image Optimizer - Version 1.8.4

Version Description

  • 2018/11/12 =
  • Improvement: automatic optimization is delayed further, it now happens after the image original data is stored in the database. This new process should be more reliable.
  • Improvement: compatibility with wordpress.com.
  • Improvement: some wording and typos in the plan suggestion tool.
  • Improvement: improved wording and added a link to a new documentation entry for the case when no php extension are available for image manipulation.
  • Improvement: prevent plugins from accidentally overwriting the header containing the API key when contacting our servers.
  • Bug Fix: the handle in the original/optimized image comparator was a bit shy, but after some personal work it should stick to the cursor hopefully.
  • Bug Fix: a php notice in the WP Retina 2x compatibility code.
  • Bug Fix: handle a specific error case when contacting our servers fails.
Download this release

Release Info

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

Code changes from version 1.8.3 to 1.8.4

Files changed (106) hide show
  1. assets/css/files-list.css +0 -0
  2. assets/css/files-list.min.css +0 -0
  3. assets/css/pricing-modal.css +4 -0
  4. assets/css/pricing-modal.min.css +1 -1
  5. assets/images/big-blue-check.png +0 -0
  6. assets/images/icon-alert.svg +0 -0
  7. assets/images/icon-arrow-choice.png +0 -0
  8. assets/images/icon-arrow-choice.svg +0 -0
  9. assets/images/icon-doc-image.svg +0 -0
  10. assets/images/icon-external.svg +0 -0
  11. assets/images/icon-level.svg +0 -0
  12. assets/images/icon-load.svg +0 -0
  13. assets/images/icon-lock.png +0 -0
  14. assets/images/icon-lock.svg +0 -0
  15. assets/images/icon-pack.png +0 -0
  16. assets/images/icon-pack.svg +0 -0
  17. assets/images/icon-time.svg +0 -0
  18. assets/images/imagify-logo.png +0 -0
  19. assets/images/imagify-menu-bar-de.jpg +0 -0
  20. assets/images/imagify-menu-bar-en.jpg +0 -0
  21. assets/images/imagify-menu-bar-es.jpg +0 -0
  22. assets/images/imagify-menu-bar-fr.jpg +0 -0
  23. assets/images/imagify-menu-bar-it.jpg +0 -0
  24. assets/images/lazyload.png +0 -0
  25. assets/images/logo-wprocket.png +0 -0
  26. assets/images/logo-wprocket.svg +0 -0
  27. assets/images/logo-wprocket@2x.png +0 -0
  28. assets/images/pic-ericwaltr.jpg +0 -0
  29. assets/images/pic-srhdesign.jpg +0 -0
  30. assets/images/spinner.gif +0 -0
  31. assets/images/upload-image.png +0 -0
  32. assets/js/chart.js +0 -0
  33. assets/js/chart.min.js +0 -0
  34. assets/js/files-list.js +0 -0
  35. assets/js/files-list.min.js +0 -0
  36. assets/js/formdata-polyfill.js +0 -0
  37. assets/js/formdata-polyfill.min.js +0 -0
  38. assets/js/imagify-gulp.js +0 -0
  39. assets/js/imagify-gulp.min.js +0 -0
  40. assets/js/imagify-wp-retina-2x.js +0 -0
  41. assets/js/imagify-wp-retina-2x.min.js +0 -0
  42. assets/js/jquery.twentytwenty.js +4 -4
  43. assets/js/jquery.twentytwenty.min.js +1 -1
  44. imagify.php +3 -2
  45. inc/3rd-party/3rd-party.php +1 -0
  46. inc/3rd-party/amazon-s3-and-cloudfront/inc/classes/class-imagify-as3cf-attachment.php +0 -0
  47. inc/3rd-party/amazon-s3-and-cloudfront/inc/classes/class-imagify-as3cf.php +1 -155
  48. inc/3rd-party/enable-media-replace/inc/classes/class-imagify-enable-media-replace.php +59 -63
  49. inc/3rd-party/hosting/siteground.php +0 -0
  50. inc/3rd-party/hosting/wordpress-com.php +30 -0
  51. inc/3rd-party/hosting/wpengine.php +0 -0
  52. inc/3rd-party/nextgen-gallery/inc/admin/ajax.php +0 -0
  53. inc/3rd-party/nextgen-gallery/inc/admin/bulk.php +0 -0
  54. inc/3rd-party/nextgen-gallery/inc/admin/enqueue.php +0 -0
  55. inc/3rd-party/nextgen-gallery/inc/admin/gallery.php +0 -0
  56. inc/3rd-party/nextgen-gallery/inc/admin/heartbeat.php +0 -0
  57. inc/3rd-party/nextgen-gallery/inc/admin/menu.php +0 -0
  58. inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg-attachment.php +0 -0
  59. inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg-db.php +0 -0
  60. inc/3rd-party/nextgen-gallery/inc/common/attachments.php +0 -0
  61. inc/3rd-party/nextgen-gallery/inc/functions/admin-stats.php +0 -0
  62. inc/3rd-party/nextgen-gallery/inc/functions/attachments.php +0 -0
  63. inc/3rd-party/nextgen-gallery/inc/functions/common.php +0 -0
  64. inc/3rd-party/regenerate-thumbnails/inc/classes/class-imagify-regenerate-thumbnails.php +7 -3
  65. inc/3rd-party/wp-retina-2x/inc/classes/class-imagify-wp-retina-2x-core.php +15 -5
  66. inc/3rd-party/wp-retina-2x/inc/classes/class-imagify-wp-retina-2x.php +0 -0
  67. inc/3rd-party/wp-rocket.php +0 -0
  68. inc/3rd-party/wp-time-capsule/inc/classes/class-imagify-wp-time-capsule.php +0 -0
  69. inc/3rd-party/wp-time-capsule/wp-time-capsule.php +0 -0
  70. inc/admin/custom-folders.php +0 -0
  71. inc/classes/class-imagify-abstract-attachment.php +0 -0
  72. inc/classes/class-imagify-abstract-cron.php +0 -0
  73. inc/classes/class-imagify-abstract-db.php +0 -0
  74. inc/classes/class-imagify-abstract-options.php +0 -0
  75. inc/classes/class-imagify-admin-ajax-post.php +79 -55
  76. inc/classes/class-imagify-attachment.php +38 -4
  77. inc/classes/class-imagify-auto-optimization.php +403 -0
  78. inc/classes/class-imagify-cron-library-size.php +0 -0
  79. inc/classes/class-imagify-cron-rating.php +0 -0
  80. inc/classes/class-imagify-cron-sync-files.php +0 -0
  81. inc/classes/class-imagify-custom-folders.php +0 -0
  82. inc/classes/class-imagify-data.php +0 -0
  83. inc/classes/class-imagify-db.php +0 -0
  84. inc/classes/class-imagify-file-attachment.php +0 -0
  85. inc/classes/class-imagify-files-db.php +0 -0
  86. inc/classes/class-imagify-files-iterator.php +0 -0
  87. inc/classes/class-imagify-files-recursive-iterator.php +0 -0
  88. inc/classes/class-imagify-files-scan.php +0 -0
  89. inc/classes/class-imagify-files-stats.php +0 -0
  90. inc/classes/class-imagify-filesystem.php +2 -0
  91. inc/classes/class-imagify-folders-db.php +0 -0
  92. inc/classes/class-imagify-options.php +0 -0
  93. inc/classes/class-imagify-requirements.php +0 -0
  94. inc/classes/class-imagify-settings.php +0 -0
  95. inc/classes/class-imagify-views.php +0 -0
  96. inc/classes/class-imagify.php +75 -4
  97. inc/common/attachments.php +0 -75
  98. inc/functions/admin-ui.php +0 -0
  99. inc/functions/api.php +4 -3
  100. inc/functions/common.php +5 -0
  101. inc/functions/deprecated.php +402 -0
  102. inc/functions/i18n.php +5 -1
  103. inc/functions/process.php +5 -1
  104. readme.txt +12 -2
  105. uninstall.php +1 -0
  106. views/modal-payment.php +13 -15
assets/css/files-list.css CHANGED
File without changes
assets/css/files-list.min.css CHANGED
File without changes
assets/css/pricing-modal.css CHANGED
@@ -101,6 +101,10 @@
101
  .imagify-modal-title {
102
  font-size: 1.8em;
103
  }
 
 
 
 
104
  .imagify-analyzing .imagify-numbers-calc,
105
  .imagify-numbers-notcalc,
106
  .imagify-modal-section.imagify-analyzing .imagify-modal-cols,
101
  .imagify-modal-title {
102
  font-size: 1.8em;
103
  }
104
+ .imagify-modal-title .imagify-inner-sub-title {
105
+ display: block;
106
+ font-size: .56em;
107
+ }
108
  .imagify-analyzing .imagify-numbers-calc,
109
  .imagify-numbers-notcalc,
110
  .imagify-modal-section.imagify-analyzing .imagify-modal-cols,
assets/css/pricing-modal.min.css CHANGED
@@ -1 +1 @@
1
- .imagify-2-free:after,.imagify-cols:after,.imagify-price-discount:before{content:""}.imagify-border-styled,.imagify-flex-table,.imagify-modal-cols,.imagify-offer-header,.imagify-payment-modal .imagify-modal-content,.imagify-tabs{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.imagify-analyzing .imagify-numbers-calc,.imagify-modal-content.imagify-iframe-viewing .imagify-modal-sidebar,.imagify-modal-content.imagify-success-viewing .imagify-modal-sidebar,.imagify-modal-section .imagify-loader,.imagify-modal-section.imagify-analyzing .imagify-modal-cols,.imagify-numbers-notcalc{display:none}.imagify-border-styled,.imagify-modal-cols{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.imagify-payment-modal{text-align:center;color:#7A8996}.imagify-payment-modal *{-webkit-box-sizing:border-box;box-sizing:border-box}.imagify-modal-loader{position:absolute;top:0;left:0;right:0;bottom:0;background:url(../images/loader-balls.svg) center no-repeat #fff;z-index:10}.imagify-payment-modal .imagify-modal-content{width:980px;max-width:100%;min-width:925px;padding:0}.imagify-modal-content.imagify-iframe-viewing{width:980px;height:672px;overflow:hidden}.imagify-iframe-viewing #imagify-payment-process-view{width:980px;height:668px}.imagify-payment-modal .imagify-modal-main{width:70%}.imagify-iframe-viewing .imagify-modal-main{width:auto}.imagify-payment-modal .imagify-modal-content.imagify-success-viewing{min-width:auto;width:450px;min-height:300px}.imagify-success-viewing .imagify-modal-main{width:100%}.imagify-payment-modal .imagify-modal-sidebar{width:30%;padding:15px 20px;background:#1F2332;color:#FFF}.imagify-modal-section{padding:0 25px}.imagify-modal-section.section-gray{margin:0 0 1em;padding:10px 25px 15px;background:#F6F7FB}.imagify-tabs-contents .section-gray{padding:8px 25px 10px}.imagify-modal-section .imagify-modal-title:first-child{margin-top:1em;margin-bottom:1.5em}.imagify-modal-section.section-gray .imagify-modal-title{margin-top:.5em;margin-bottom:.5em}.imagify-modal-title{font-size:1.8em}.imagify-analyzing .imagify-numbers-notcalc,.imagify-modal-section.imagify-analyzing .imagify-loader{display:block}.imagify-modal-section .imagify-loader{margin:2em auto}.imagify-border-styled{width:200px;margin:0 auto;color:#8BC34A;font-weight:700;font-size:.925em}.imagify-big-number,.imagify-payment-modal strong{font-weight:700;color:#4A4A4A}.imagify-border-styled:after,.imagify-border-styled:before{content:"";height:1px;background:rgba(0,0,0,.1);-ms-flex-preferred-size:40px;flex-basis:40px}.imagify-border-styled:before{margin-right:5px}.imagify-border-styled:after{margin-left:5px}.imagify-big-number{font-size:3.7em;margin:-3px 0;line-height:1}.imagify-popin-message{padding:5px 15px;text-align:left}.imagify-popin-message.imagify-error p{color:#FFF}.imagify-small-options{width:300px;margin:1em auto .5em;background:#338EA6;border-radius:4px}.imagify-small-options input[type=radio]:checked+label,.imagify-small-options input[type=radio]:not(:checked)+label{padding:8px 10px;font-size:13px;color:#FFF;-webkit-box-shadow:none;box-shadow:none;border-left:0}.imagify-small-options input[type=radio]:not(:checked)+label{background:#338EA6;color:rgba(255,255,255,.4)}.imagify-small-options input[type=radio]:checked+label{background:#40B1D0}.imagify-cols:after{display:table;clear:both}.js .imagify-iframe-viewing .close-btn{display:none}.imagify-modal .imagify-cols{padding:0 20px}.imagify-payment-modal .imagify-iconed{margin:1.5em 5em 1.5em 0}.imagify-iconed{position:relative;text-align:left;padding-left:42px;margin-right:15px;font-weight:500}.imagify-iconed .dashicons,.imagify-iconed .icon{position:absolute;font-size:2em;left:0;top:2px;color:#40B1D0}.imagify-payment-modal .close-btn{top:10px;right:10px;width:24px;height:24px;padding:2px 0 0 4.5px;color:#FFF;background:#40B1D0;border-radius:50%;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-payment-modal .close-btn i{margin-left:-3.5px;margin-top:-.5px}.imagify-payment-modal .close-btn:hover{background:#F6F7FB}.imagify-offer-line{margin-top:1.5em}.imagify-offer-line+.imagify-offer-line{margin-top:.75em}.imagify-offer-header{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 0 0 15px;border-radius:4px 4px 0 0;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-offer-header.imagify-offer-header.imagify-offer-header .imagify-inline-options label:last-child{border-radius:0 4px 0 0}.imagify-offer-header .imagify-inline-options{width:auto}.imagify-offer-title{font-weight:700;margin:0}.imagify-offer-header,.imagify-offer-header .imagify-inline-options input[type=radio]:not(:checked)+label{background:#E5EBEF}.imagify-offer-onetime .imagify-offer-header{padding-top:8px;padding-bottom:8px}.imagify-offer-onetimes>div{padding-top:15px;padding-bottom:15px}.imagify-offer-header .imagify-inline-options input[type=radio]:checked+label,.imagify-offer-header .imagify-inline-options input[type=radio]:not(:checked)+label{position:relative;padding:7px 30px;font-size:1em;letter-spacing:.05em;color:inherit;-webkit-box-shadow:0 0 0;box-shadow:0 0 0;border-radius:0}.imagify-offer-header .imagify-inline-options input[type=radio]:checked+label{background:#F6F7FB}.imagify-2-free{position:absolute;bottom:100%;left:0;right:0;padding:2px 10px;margin-bottom:8px;font-size:.8em;letter-spacing:0;text-transform:none;text-align:center;color:#FFF;background:#10121A;border-radius:2px}.imagify-2-free:after{position:absolute;left:50%;bottom:-3px;margin-left:-3px;border-top:3px solid #10121A;border-left:3px solid transparent;border-right:3px solid transparent}.imagify-2-free.imagify-b-right{bottom:auto;left:100%;right:-100%;margin-bottom:0;margin-left:8px}.imagify-2-free.imagify-b-right:after{left:-3px;bottom:auto;top:50%;margin-top:-3px;margin-left:0;border-right:3px solid #10121A;border-top:3px solid transparent;border-bottom:3px solid transparent;border-left:0}.imagify-2-free.imagify-b-bottom{bottom:-100%;left:0;right:0;margin-top:8px}.imagify-2-free.imagify-b-bottom:after{top:-3px;bottom:auto;border-bottom:3px solid #10121A;border-left:3px solid transparent;border-right:3px solid transparent;border-top:0}.imagify-offer-content{text-align:left;background:#F6F7FB;border-radius:0 0 4px 4px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-offer-onetime .imagify-offer-content{padding:10px 0}div.imagify-col-checkbox{position:relative;width:25.5%;padding-top:10px;padding-bottom:7px}.imagify-col-checkbox label{display:block;padding-left:55px!important}.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:checked,.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:not(:checked){position:absolute;top:50%;left:6px;margin:-8px 0 0}.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:checked+label:before,.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:not(:checked)+label:before{margin:0;top:-2px;left:6px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-offer-by,.imagify-offer-size{-webkit-transition:all .275s;-o-transition:all .275s}.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:checked+label:after,.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:not(:checked)+label:after{top:1px;left:13px}.imagify-offer-size{font-size:30px;color:#2E3243;font-weight:700;transition:all .275s}.imagify-offer-by{font-size:10px;transition:all .275s}.imagify-approx{display:none;font-size:11px;line-height:1.2;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}div.imagify-col-price{width:35%}.imagify-flex-table .imagify-price-block{padding-left:0;padding-right:0}.imagify-offer-monthlies .imagify-price-block,.imagify-offer-monthly .imagify-flex-table .imagify-price-block{padding-top:0}.imagify-flex-table .imagify-price-complement{padding-right:0;font-size:10px;font-weight:700}.imagify-price-block,.imagify-price-discount{white-space:nowrap}.imagify-price-block span,.imagify-price-discount span{display:inline-block;vertical-align:middle}.imagify-price-discount.imagify-price-discount{position:relative;-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;padding-top:15px;font-weight:700;width:70px}.imagify-price-discount:before{position:absolute;top:25px;width:62%;height:2px;background:#2E3243;-webkit-transform:rotate(-15deg);-ms-transform:rotate(-15deg);transform:rotate(-15deg)}.imagify-offer-onetimes .imagify-price-discount:before{width:100%}.imagify-price-discount-dollar{color:#2E3243}.imagify-price-discount-number{color:#8BA6B4}.imagify-offer-selected .imagify-price-discount-number{color:#FFF}span.imagify-dollars{color:#1F2332;font-size:18px;font-weight:700;vertical-align:-2px}.imagify-offer-onetime .imagify-col-price{padding-top:0}.imagify-offer-onetime .imagify-dollars{vertical-align:-1px}.imagify-price-big,.imagify-price-mini{color:#40B1D0;font-weight:700}.imagify-price-big{font-size:36px}span.imagify-price-mini{font-size:18px;vertical-align:2px}span.imagify-price-by{font-size:10px;color:#1F2332;vertical-align:-13px;text-indent:-27px}.imagify-offer-selected,.imagify-offer-selected .imagify-checkbox.imagify-checkbox:checked+label:after,.imagify-offer-selected .imagify-checkbox.imagify-checkbox:not(:checked)+label:after,.imagify-offer-selected .imagify-col-other-actions a,.imagify-offer-selected .imagify-offer-size,.imagify-offer-selected .imagify-offer-title,.imagify-offer-selected .imagify-price-big,.imagify-offer-selected .imagify-price-complement,.imagify-offer-selected .imagify-price-mini{color:#FFF}.imagify-col-other-actions{width:18.5%;text-align:right}.imagify-col-other-actions a{font-size:11px}.imagify-offer-selected .imagify-offer-header,.imagify-offer-selected .imagify-offer-header .imagify-inline-options input[type=radio]:not(:checked)+label{background:#338EA6}.imagify-offer-selected .imagify-offer-content,.imagify-offer-selected .imagify-offer-header .imagify-inline-options input[type=radio]:checked+label{background:#40B1D0}.imagify-offer-selected .imagify-checkbox.imagify-checkbox:checked+label:before,.imagify-offer-selected .imagify-checkbox.imagify-checkbox:not(:checked)+label:before{border-color:#FFF;background:#40B1D0}.imagify-offer-selected .imagify-offer-by{color:#2E3243}.imagify-enough-free .imagify-not-enough-title,.imagify-enough-title{display:none}.imagify-enough-free .imagify-enough-title{display:block}.imagify-submit-line{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin:2em 0;text-align:left}.imagify-coupon-section{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.imagify-coupon-section p{margin:0;line-height:1.3}.imagify-coupon-text{width:200px;max-width:100%;padding-right:15px}.imagify-coupon-loader{display:none}.imagify-coupon-text.checking{text-align:right}.imagify-coupon-text.checking .imagify-coupon-loader{display:inline}.imagify-coupon-text.checking label{display:none}.imagify-coupon-input{position:relative}.imagify-coupon-input input{position:relative;z-index:1}[id=imagify-coupon-validate].button-secondary{position:absolute;top:1px;right:3px;bottom:2px;-webkit-box-shadow:none;box-shadow:none;padding:4px 10px;z-index:0;-webkit-transition:-webkit-transform .275s;-o-transition:transform .275s;transition:transform .275s;transition:transform .275s,-webkit-transform .275s}.imagify-canbe-validate [id=imagify-coupon-validate]{-webkit-transform:translateX(45px);-ms-transform:translateX(45px);transform:translateX(45px)}.imagify-modal-section+.imagify-modal-promotion{margin-top:-1em}.imagify-modal-promotion{position:relative;overflow:hidden;display:none;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:15px 25px;background:#604D90;text-shadow:0 0 3px rgba(0,0,0,.3)}.imagify-modal-promotion.active{display:-webkit-box;display:-ms-flexbox;display:flex}[id=imagify-pricing-tab-onetime] .imagify-modal-promotion{margin-bottom:4em}.imagify-modal-promotion:before{content:"\f488";position:absolute;top:28px;left:8%;font-family:dashicons;font-size:90px;color:#8476A9;text-shadow:none}.imagify-modal-promotion p{position:relative;margin:.2em 0;color:#FFF}.imagify-promo-title{-ms-flex-preferred-size:100%;flex-basis:100%;text-transform:uppercase;font-size:20px;font-weight:700;letter-spacing:.125em}.imagify-until-date{-ms-flex-preferred-size:200px;flex-basis:200px;text-align:right}.imagify-until-date strong{color:#FFF}.imagify-submit-line button{font-size:16px}input.imagify-coupon-code{padding:10px;border:2px solid #7A8996;font-size:.875em;font-weight:700;border-radius:3px}.validated.imagify-coupon-section .imagify-coupon-text,.validated.imagify-coupon-section strong{color:#8BC34A}.validated.imagify-coupon-section .imagify-coupon-code{color:#8BC34A;border-color:#8BC34A}.invalid.imagify-coupon-section .imagify-coupon-text,.invalid.imagify-coupon-section strong{color:#d0021b}.invalid.imagify-coupon-section .imagify-coupon-code{color:#d0021b;border-color:#d0021b}.imagify-footer-lines{width:500px;max-width:100%;margin:2em auto 2.5em;font-size:.85em;line-height:1.5}.imagify-year-selected .imagify-switch-my .imagify-yearly{display:block}.imagify-month-selected .imagify-switch-my .imagify-yearly,.imagify-year-selected .imagify-switch-my .imagify-monthly{display:none}.imagify-month-selected .imagify-switch-my .imagify-monthly{display:block}.imagify-flex-table{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.imagify-flex-table>*{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;padding:7px 15px}div.imagify-col-details{width:22%;padding-left:25px}.imagify-col-details p{margin:0}.imagify-pricing-table{margin:0 20px}.imagify-pricing-table .imagify-offer-line{padding:.6em 0;border:2px solid #E8EEF0;text-align:left;border-radius:3px}.imagify-pricing-table .imagify-offer-line:first-child{margin-top:.75em}.imagify-pricing-table .imagify-offer-line.imagify-offer-selected:first-child{margin-top:1.75em}.imagify-pricing-table .imagify-offer-line+.imagify-offer-line{margin-top:-2px}.imagify-pricing-table .imagify-col-other-actions{width:20.5%}.imagify-pricing-table .imagify-approx{margin-left:0;line-height:.5;margin-bottom:1em}.imagify-pricing-table .imagify-offer-selected{-webkit-transform:scale(1.03);-ms-transform:scale(1.03);transform:scale(1.03);background:#40B1D0;border-width:0}.imagify-pricing-table .imagify-offer-selected .imagify-approx{color:#FFF}.imagify-pricing-table .imagify-button-secondary{padding:3px 20px;-webkit-box-shadow:none;box-shadow:none;text-transform:uppercase;font-size:12px;letter-spacing:.025em}.imagify-offer-selected.imagify-offer-selected .imagify-button-secondary{border:2px solid #FFF;background:#40B1D0;-webkit-box-shadow:none;box-shadow:none;text-shadow:none!important}.imagify-offer-selected.imagify-offer-selected .imagify-button-secondary:focus,.imagify-offer-selected.imagify-offer-selected .imagify-button-secondary:hover{background:#FFF;color:#40B1D0}.imagify-col .imagify-special-needs{margin-left:25px}.imagify-special-needs strong{font-size:25px;font-weight:700;color:#40B1D0}.imagify-special-needs span{display:block;font-size:12px;margin-top:-.5em}div.imagify-col-price{position:relative}.imagify-recommend{display:none;position:absolute;left:-20px;bottom:100%;padding:0;margin-bottom:8px;color:#1F2332;font-weight:700;font-style:italic}.imagify-offer-selected .imagify-recommend,.imagify-tab-content.imagify-current{display:block}[class*=imagify-onetime-] .imagify-recommend{left:65px;margin-bottom:20px}.imagify-recommend:before{content:"";position:absolute;top:7px;left:-35px;width:29px;height:30px;background:url(../images/icon-arrow-choice.png) 0 no-repeat;background-size:contain}@media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (-o-min-device-pixel-ratio:2/1),only screen and (min-resolution:192dpi),only screen and (min-resolution:2dppx){.imagify-recommend:before{background-image:url(../images/icon-arrow-choice.svg)}}.imagify-offer-line[class*=imagify-onetime-]{padding:0;margin:.3em 0 0}.imagify-offer-line.imagify-offer-line[class*=imagify-onetime-]:first-child{margin-top:2em}.imagify-offer-line[class*=imagify-onetime-]+.imagify-offer-line{margin-top:.5em}.imagify-offer-selected.imagify-offer-line[class*=imagify-onetime-]{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);border-width:2px}.imagify-offer-line[class*=imagify-onetime-] .imagify-col-details{position:relative;overflow:hidden;width:21%;background:#1F2332;color:#FFF}.imagify-offer-selected.imagify-offer-line[class*=imagify-onetime-] .imagify-col-details{background:#338EA6}.imagify-offer-line[class*=imagify-onetime-] .imagify-col-details:before{content:"";position:absolute;bottom:0;right:25px;width:75px;height:54px;background:url(../images/icon-pack.png)}.imagify-offer-line[class*=imagify-onetime-] .imagify-col-other-actions{width:30%}.imagify-offer-line[class*=imagify-onetime-] .imagify-approx,.imagify-offer-line[class*=imagify-onetime-] .imagify-offer-size{color:#FFF}.imagify-offer-line[class*=imagify-onetime-] .imagify-offer-size{font-size:24px}.imagify-offer-line[class*=imagify-onetime-] .imagify-approx{font-size:12px}.imagify-offer-line[class*=imagify-onetime-] .imagify-price-block{padding-left:10px}.imagify-offer-line[class*=imagify-onetime-] .imagify-dollars{vertical-align:middle}.imagify-offer-line[class*=imagify-onetime-] .imagify-price-big{vertical-align:-5px}.imagify-offer-line[class*=imagify-onetime-] .imagify-price-mini{vertical-align:7px}.imagify-tabs{margin-bottom:0;list-style:none;background:#E5EBEF}.imagify-modal-content .imagify-tabs{margin:1em 0 0}.imagify-tab{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;width:50%;margin:0;font-size:23px}.imagify-tab a{display:block;padding:15px 10px;color:inherit;text-decoration:none}.imagify-tab a:focus{-webkit-box-shadow:none;box-shadow:none;outline:0;color:#40B1D8}.imagify-tab.imagify-current a{background:#F6F7FB}.imagify-tab-content{display:none}.imagify-tab-content .imagify-modal-section:first-child{margin-top:0}.imagify-modal-sidebar-content,.imagify-payment-modal .imagify-modal-sidebar{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.imagify-modal-sidebar-content{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}p.imagify-modal-sidebar-title.imagify-modal-sidebar-title{margin-top:5px;padding-right:40px;font-size:18px;color:#FFF}.imagify-modal-testimony{margin-top:1em}.imagify-modal-testimony+.imagify-modal-testimony{margin-top:2em}@media (max-height:620px){.imagify-modal-testimony+.imagify-modal-testimony{display:none}}.imagify-modal-testimony-person{display:table;width:100%}.imagify-modal-testimony-person>*{display:table-cell;vertical-align:middle}.imagify-modal-avatar{width:114px;line-height:0}.imagify-modal-avatar img{border:2px solid #FFF;border-radius:50%;width:96px;height:96px}.imagify-modal-identity a{text-decoration:none;font-weight:700}.imagify-modal-identity a:first-child{font-size:13px}.imagify-modal-identity a:first-child+a{display:block;font-size:10px;color:#7A8996}.imagify-modal-testimony-content.imagify-modal-testimony-content p{font-size:13px;font-style:italic;line-height:1.7;color:#7A8996}.imagify-modal-sidebar-trust{margin-top:auto;padding-top:1.5em}.imagify-modal-sidebar-trust p{margin:0;font-weight:700;font-size:12px;line-height:1.7}.imagify-modal-sidebar-trust p img{margin-right:3px;vertical-align:-2px}.imagify-modal-sidebar-trust p+p{font-size:11px}.imagify-cart{text-align:left}.imagify-cart .imagify-cart-list{border-top:1px solid rgba(122,137,150,.2);border-bottom:1px solid rgba(122,137,150,.2)}.imagify-cart .imagify-cart-label{margin-bottom:.5em;font-size:10px;color:#2E3243}.imagify-cart-list p{margin:0;font-weight:700}.imagify-cart-item{margin:.4em 0}.imagify-cart .imagify-cart-suggestion{margin-top:-.3em}.imagify-cart-suggestion a,.imagify-cl-description p{font-size:10px}.imagify-remove-from-cart{border:0;padding:0;width:14px;height:14px;line-height:13px;border-radius:50%;background:#40B1D0;cursor:pointer;-webkit-transition:background .3s;-o-transition:background .3s;transition:background .3s}.imagify-remove-from-cart i:before{position:relative;top:-6px;left:-3px;font-size:13px;color:#FFF}.imagify-remove-from-cart:focus,.imagify-remove-from-cart:hover{background:#D0021B}.imagify-cart .imagify-cl-remove{-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;width:45px}.imagify-cart .imagify-cl-name{-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;width:200px}.imagify-cart .imagify-cl-description{-webkit-align-self:flex-start;-ms-flex-item-align:start;align-self:flex-start;padding-top:10px}.imagify-cart .imagify-cl-price{text-align:right}#imagify-payment-iframe{width:980px;height:672px;background:url(../images/loader-balls.svg) 50% 50% no-repeat #f6f7fb}.imagify-success-view{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:100%}.imagify-success-view p{font-weight:700;font-size:16px}.imagify-cart-emptied-item{margin:.3em auto;padding:6px 20px;background:#E6EBEF;border-radius:20px}.imagify-cart-emptied-item.imagify-cart-emptied-item p{font-weight:700}.imagify-cart-emptied-item a{color:#40b1d0;float:right;font-weight:700}
1
+ .imagify-2-free:after,.imagify-cols:after,.imagify-price-discount:before{content:""}.imagify-border-styled,.imagify-flex-table,.imagify-modal-cols,.imagify-offer-header,.imagify-payment-modal .imagify-modal-content,.imagify-tabs{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.imagify-border-styled,.imagify-modal-cols{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.imagify-payment-modal{text-align:center;color:#7A8996}.imagify-payment-modal *{-webkit-box-sizing:border-box;box-sizing:border-box}.imagify-modal-loader{position:absolute;top:0;left:0;right:0;bottom:0;background:url(../images/loader-balls.svg) center no-repeat #fff;z-index:10}.imagify-payment-modal .imagify-modal-content{width:980px;max-width:100%;min-width:925px;padding:0}.imagify-modal-content.imagify-iframe-viewing{width:980px;height:672px;overflow:hidden}.imagify-iframe-viewing #imagify-payment-process-view{width:980px;height:668px}.imagify-payment-modal .imagify-modal-main{width:70%}.imagify-iframe-viewing .imagify-modal-main{width:auto}.imagify-payment-modal .imagify-modal-content.imagify-success-viewing{min-width:auto;width:450px;min-height:300px}.imagify-success-viewing .imagify-modal-main{width:100%}.imagify-payment-modal .imagify-modal-sidebar{width:30%;padding:15px 20px;background:#1F2332;color:#FFF}.imagify-modal-content.imagify-iframe-viewing .imagify-modal-sidebar,.imagify-modal-content.imagify-success-viewing .imagify-modal-sidebar{display:none}.imagify-modal-section{padding:0 25px}.imagify-modal-section.section-gray{margin:0 0 1em;padding:10px 25px 15px;background:#F6F7FB}.imagify-tabs-contents .section-gray{padding:8px 25px 10px}.imagify-modal-section .imagify-modal-title:first-child{margin-top:1em;margin-bottom:1.5em}.imagify-modal-section.section-gray .imagify-modal-title{margin-top:.5em;margin-bottom:.5em}.imagify-modal-title{font-size:1.8em}.imagify-modal-title .imagify-inner-sub-title{display:block;font-size:.56em}.imagify-analyzing .imagify-numbers-calc,.imagify-modal-section .imagify-loader,.imagify-modal-section.imagify-analyzing .imagify-modal-cols,.imagify-numbers-notcalc{display:none}.imagify-analyzing .imagify-numbers-notcalc,.imagify-modal-section.imagify-analyzing .imagify-loader{display:block}.imagify-modal-section .imagify-loader{margin:2em auto}.imagify-border-styled{width:200px;margin:0 auto;color:#8BC34A;font-weight:700;font-size:.925em}.imagify-big-number,.imagify-payment-modal strong{font-weight:700;color:#4A4A4A}.imagify-border-styled:after,.imagify-border-styled:before{content:"";height:1px;background:rgba(0,0,0,.1);-ms-flex-preferred-size:40px;flex-basis:40px}.imagify-border-styled:before{margin-right:5px}.imagify-border-styled:after{margin-left:5px}.imagify-big-number{font-size:3.7em;margin:-3px 0;line-height:1}.imagify-popin-message{padding:5px 15px;text-align:left}.imagify-popin-message.imagify-error p{color:#FFF}.imagify-small-options{width:300px;margin:1em auto .5em;background:#338EA6;border-radius:4px}.imagify-small-options input[type=radio]:checked+label,.imagify-small-options input[type=radio]:not(:checked)+label{padding:8px 10px;font-size:13px;color:#FFF;-webkit-box-shadow:none;box-shadow:none;border-left:0}.imagify-small-options input[type=radio]:not(:checked)+label{background:#338EA6;color:rgba(255,255,255,.4)}.imagify-small-options input[type=radio]:checked+label{background:#40B1D0}.imagify-cols:after{display:table;clear:both}.js .imagify-iframe-viewing .close-btn{display:none}.imagify-modal .imagify-cols{padding:0 20px}.imagify-payment-modal .imagify-iconed{margin:1.5em 5em 1.5em 0}.imagify-iconed{position:relative;text-align:left;padding-left:42px;margin-right:15px;font-weight:500}.imagify-iconed .dashicons,.imagify-iconed .icon{position:absolute;font-size:2em;left:0;top:2px;color:#40B1D0}.imagify-payment-modal .close-btn{top:10px;right:10px;width:24px;height:24px;padding:2px 0 0 4.5px;color:#FFF;background:#40B1D0;border-radius:50%;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-payment-modal .close-btn i{margin-left:-3.5px;margin-top:-.5px}.imagify-payment-modal .close-btn:hover{background:#F6F7FB}.imagify-offer-line{margin-top:1.5em}.imagify-offer-line+.imagify-offer-line{margin-top:.75em}.imagify-offer-header{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 0 0 15px;border-radius:4px 4px 0 0;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-offer-header.imagify-offer-header.imagify-offer-header .imagify-inline-options label:last-child{border-radius:0 4px 0 0}.imagify-offer-header .imagify-inline-options{width:auto}.imagify-offer-title{font-weight:700;margin:0}.imagify-offer-header,.imagify-offer-header .imagify-inline-options input[type=radio]:not(:checked)+label{background:#E5EBEF}.imagify-offer-onetime .imagify-offer-header{padding-top:8px;padding-bottom:8px}.imagify-offer-onetimes>div{padding-top:15px;padding-bottom:15px}.imagify-offer-header .imagify-inline-options input[type=radio]:checked+label,.imagify-offer-header .imagify-inline-options input[type=radio]:not(:checked)+label{position:relative;padding:7px 30px;font-size:1em;letter-spacing:.05em;color:inherit;-webkit-box-shadow:0 0 0;box-shadow:0 0 0;border-radius:0}.imagify-offer-header .imagify-inline-options input[type=radio]:checked+label{background:#F6F7FB}.imagify-2-free{position:absolute;bottom:100%;left:0;right:0;padding:2px 10px;margin-bottom:8px;font-size:.8em;letter-spacing:0;text-transform:none;text-align:center;color:#FFF;background:#10121A;border-radius:2px}.imagify-2-free:after{position:absolute;left:50%;bottom:-3px;margin-left:-3px;border-top:3px solid #10121A;border-left:3px solid transparent;border-right:3px solid transparent}.imagify-2-free.imagify-b-right{bottom:auto;left:100%;right:-100%;margin-bottom:0;margin-left:8px}.imagify-2-free.imagify-b-right:after{left:-3px;bottom:auto;top:50%;margin-top:-3px;margin-left:0;border-right:3px solid #10121A;border-top:3px solid transparent;border-bottom:3px solid transparent;border-left:0}.imagify-2-free.imagify-b-bottom{bottom:-100%;left:0;right:0;margin-top:8px}.imagify-2-free.imagify-b-bottom:after{top:-3px;bottom:auto;border-bottom:3px solid #10121A;border-left:3px solid transparent;border-right:3px solid transparent;border-top:0}.imagify-offer-content{text-align:left;background:#F6F7FB;border-radius:0 0 4px 4px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-offer-onetime .imagify-offer-content{padding:10px 0}div.imagify-col-checkbox{position:relative;width:25.5%;padding-top:10px;padding-bottom:7px}.imagify-col-checkbox label{display:block;padding-left:55px!important}.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:checked,.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:not(:checked){position:absolute;top:50%;left:6px;margin:-8px 0 0}.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:checked+label:before,.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:not(:checked)+label:before{margin:0;top:-2px;left:6px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-offer-by,.imagify-offer-size{-webkit-transition:all .275s;-o-transition:all .275s}.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:checked+label:after,.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:not(:checked)+label:after{top:1px;left:13px}.imagify-offer-size{font-size:30px;color:#2E3243;font-weight:700;transition:all .275s}.imagify-offer-by{font-size:10px;transition:all .275s}.imagify-approx{display:none;font-size:11px;line-height:1.2;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}div.imagify-col-price{width:35%}.imagify-flex-table .imagify-price-block{padding-left:0;padding-right:0}.imagify-offer-monthlies .imagify-price-block,.imagify-offer-monthly .imagify-flex-table .imagify-price-block{padding-top:0}.imagify-flex-table .imagify-price-complement{padding-right:0;font-size:10px;font-weight:700}.imagify-price-block,.imagify-price-discount{white-space:nowrap}.imagify-price-block span,.imagify-price-discount span{display:inline-block;vertical-align:middle}.imagify-price-discount.imagify-price-discount{position:relative;-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;padding-top:15px;font-weight:700;width:70px}.imagify-price-discount:before{position:absolute;top:25px;width:62%;height:2px;background:#2E3243;-webkit-transform:rotate(-15deg);-ms-transform:rotate(-15deg);transform:rotate(-15deg)}.imagify-offer-onetimes .imagify-price-discount:before{width:100%}.imagify-price-discount-dollar{color:#2E3243}.imagify-price-discount-number{color:#8BA6B4}.imagify-offer-selected .imagify-price-discount-number{color:#FFF}span.imagify-dollars{color:#1F2332;font-size:18px;font-weight:700;vertical-align:-2px}.imagify-offer-onetime .imagify-col-price{padding-top:0}.imagify-offer-onetime .imagify-dollars{vertical-align:-1px}.imagify-price-big,.imagify-price-mini{color:#40B1D0;font-weight:700}.imagify-price-big{font-size:36px}span.imagify-price-mini{font-size:18px;vertical-align:2px}span.imagify-price-by{font-size:10px;color:#1F2332;vertical-align:-13px;text-indent:-27px}.imagify-offer-selected,.imagify-offer-selected .imagify-checkbox.imagify-checkbox:checked+label:after,.imagify-offer-selected .imagify-checkbox.imagify-checkbox:not(:checked)+label:after,.imagify-offer-selected .imagify-col-other-actions a,.imagify-offer-selected .imagify-offer-size,.imagify-offer-selected .imagify-offer-title,.imagify-offer-selected .imagify-price-big,.imagify-offer-selected .imagify-price-complement,.imagify-offer-selected .imagify-price-mini{color:#FFF}.imagify-col-other-actions{width:18.5%;text-align:right}.imagify-col-other-actions a{font-size:11px}.imagify-offer-selected .imagify-offer-header,.imagify-offer-selected .imagify-offer-header .imagify-inline-options input[type=radio]:not(:checked)+label{background:#338EA6}.imagify-offer-selected .imagify-offer-content,.imagify-offer-selected .imagify-offer-header .imagify-inline-options input[type=radio]:checked+label{background:#40B1D0}.imagify-offer-selected .imagify-checkbox.imagify-checkbox:checked+label:before,.imagify-offer-selected .imagify-checkbox.imagify-checkbox:not(:checked)+label:before{border-color:#FFF;background:#40B1D0}.imagify-offer-selected .imagify-offer-by{color:#2E3243}.imagify-enough-free .imagify-not-enough-title,.imagify-enough-title{display:none}.imagify-enough-free .imagify-enough-title{display:block}.imagify-submit-line{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin:2em 0;text-align:left}.imagify-coupon-section{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.imagify-coupon-section p{margin:0;line-height:1.3}.imagify-coupon-text{width:200px;max-width:100%;padding-right:15px}.imagify-coupon-loader{display:none}.imagify-coupon-text.checking{text-align:right}.imagify-coupon-text.checking .imagify-coupon-loader{display:inline}.imagify-coupon-text.checking label{display:none}.imagify-coupon-input{position:relative}.imagify-coupon-input input{position:relative;z-index:1}[id=imagify-coupon-validate].button-secondary{position:absolute;top:1px;right:3px;bottom:2px;-webkit-box-shadow:none;box-shadow:none;padding:4px 10px;z-index:0;-webkit-transition:-webkit-transform .275s;-o-transition:transform .275s;transition:transform .275s;transition:transform .275s,-webkit-transform .275s}.imagify-canbe-validate [id=imagify-coupon-validate]{-webkit-transform:translateX(45px);-ms-transform:translateX(45px);transform:translateX(45px)}.imagify-modal-section+.imagify-modal-promotion{margin-top:-1em}.imagify-modal-promotion{position:relative;overflow:hidden;display:none;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:15px 25px;background:#604D90;text-shadow:0 0 3px rgba(0,0,0,.3)}.imagify-modal-promotion.active{display:-webkit-box;display:-ms-flexbox;display:flex}[id=imagify-pricing-tab-onetime] .imagify-modal-promotion{margin-bottom:4em}.imagify-modal-promotion:before{content:"\f488";position:absolute;top:28px;left:8%;font-family:dashicons;font-size:90px;color:#8476A9;text-shadow:none}.imagify-modal-promotion p{position:relative;margin:.2em 0;color:#FFF}.imagify-promo-title{-ms-flex-preferred-size:100%;flex-basis:100%;text-transform:uppercase;font-size:20px;font-weight:700;letter-spacing:.125em}.imagify-until-date{-ms-flex-preferred-size:200px;flex-basis:200px;text-align:right}.imagify-until-date strong{color:#FFF}.imagify-submit-line button{font-size:16px}input.imagify-coupon-code{padding:10px;border:2px solid #7A8996;font-size:.875em;font-weight:700;border-radius:3px}.validated.imagify-coupon-section .imagify-coupon-text,.validated.imagify-coupon-section strong{color:#8BC34A}.validated.imagify-coupon-section .imagify-coupon-code{color:#8BC34A;border-color:#8BC34A}.invalid.imagify-coupon-section .imagify-coupon-text,.invalid.imagify-coupon-section strong{color:#d0021b}.invalid.imagify-coupon-section .imagify-coupon-code{color:#d0021b;border-color:#d0021b}.imagify-footer-lines{width:500px;max-width:100%;margin:2em auto 2.5em;font-size:.85em;line-height:1.5}.imagify-year-selected .imagify-switch-my .imagify-yearly{display:block}.imagify-month-selected .imagify-switch-my .imagify-yearly,.imagify-year-selected .imagify-switch-my .imagify-monthly{display:none}.imagify-month-selected .imagify-switch-my .imagify-monthly{display:block}.imagify-flex-table{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.imagify-flex-table>*{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;padding:7px 15px}div.imagify-col-details{width:22%;padding-left:25px}.imagify-col-details p{margin:0}.imagify-pricing-table{margin:0 20px}.imagify-pricing-table .imagify-offer-line{padding:.6em 0;border:2px solid #E8EEF0;text-align:left;border-radius:3px}.imagify-pricing-table .imagify-offer-line:first-child{margin-top:.75em}.imagify-pricing-table .imagify-offer-line.imagify-offer-selected:first-child{margin-top:1.75em}.imagify-pricing-table .imagify-offer-line+.imagify-offer-line{margin-top:-2px}.imagify-pricing-table .imagify-col-other-actions{width:20.5%}.imagify-pricing-table .imagify-approx{margin-left:0;line-height:.5;margin-bottom:1em}.imagify-pricing-table .imagify-offer-selected{-webkit-transform:scale(1.03);-ms-transform:scale(1.03);transform:scale(1.03);background:#40B1D0;border-width:0}.imagify-pricing-table .imagify-offer-selected .imagify-approx{color:#FFF}.imagify-pricing-table .imagify-button-secondary{padding:3px 20px;-webkit-box-shadow:none;box-shadow:none;text-transform:uppercase;font-size:12px;letter-spacing:.025em}.imagify-offer-selected.imagify-offer-selected .imagify-button-secondary{border:2px solid #FFF;background:#40B1D0;-webkit-box-shadow:none;box-shadow:none;text-shadow:none!important}.imagify-offer-selected.imagify-offer-selected .imagify-button-secondary:focus,.imagify-offer-selected.imagify-offer-selected .imagify-button-secondary:hover{background:#FFF;color:#40B1D0}.imagify-col .imagify-special-needs{margin-left:25px}.imagify-special-needs strong{font-size:25px;font-weight:700;color:#40B1D0}.imagify-special-needs span{display:block;font-size:12px;margin-top:-.5em}div.imagify-col-price{position:relative}.imagify-recommend{display:none;position:absolute;left:-20px;bottom:100%;padding:0;margin-bottom:8px;color:#1F2332;font-weight:700;font-style:italic}.imagify-offer-selected .imagify-recommend,.imagify-tab-content.imagify-current{display:block}[class*=imagify-onetime-] .imagify-recommend{left:65px;margin-bottom:20px}.imagify-recommend:before{content:"";position:absolute;top:7px;left:-35px;width:29px;height:30px;background:url(../images/icon-arrow-choice.png) 0 no-repeat;background-size:contain}@media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (-o-min-device-pixel-ratio:2/1),only screen and (min-resolution:192dpi),only screen and (min-resolution:2dppx){.imagify-recommend:before{background-image:url(../images/icon-arrow-choice.svg)}}.imagify-offer-line[class*=imagify-onetime-]{padding:0;margin:.3em 0 0}.imagify-offer-line.imagify-offer-line[class*=imagify-onetime-]:first-child{margin-top:2em}.imagify-offer-line[class*=imagify-onetime-]+.imagify-offer-line{margin-top:.5em}.imagify-offer-selected.imagify-offer-line[class*=imagify-onetime-]{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);border-width:2px}.imagify-offer-line[class*=imagify-onetime-] .imagify-col-details{position:relative;overflow:hidden;width:21%;background:#1F2332;color:#FFF}.imagify-offer-selected.imagify-offer-line[class*=imagify-onetime-] .imagify-col-details{background:#338EA6}.imagify-offer-line[class*=imagify-onetime-] .imagify-col-details:before{content:"";position:absolute;bottom:0;right:25px;width:75px;height:54px;background:url(../images/icon-pack.png)}.imagify-offer-line[class*=imagify-onetime-] .imagify-col-other-actions{width:30%}.imagify-offer-line[class*=imagify-onetime-] .imagify-approx,.imagify-offer-line[class*=imagify-onetime-] .imagify-offer-size{color:#FFF}.imagify-offer-line[class*=imagify-onetime-] .imagify-offer-size{font-size:24px}.imagify-offer-line[class*=imagify-onetime-] .imagify-approx{font-size:12px}.imagify-offer-line[class*=imagify-onetime-] .imagify-price-block{padding-left:10px}.imagify-offer-line[class*=imagify-onetime-] .imagify-dollars{vertical-align:middle}.imagify-offer-line[class*=imagify-onetime-] .imagify-price-big{vertical-align:-5px}.imagify-offer-line[class*=imagify-onetime-] .imagify-price-mini{vertical-align:7px}.imagify-tabs{margin-bottom:0;list-style:none;background:#E5EBEF}.imagify-modal-content .imagify-tabs{margin:1em 0 0}.imagify-tab{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;width:50%;margin:0;font-size:23px}.imagify-tab a{display:block;padding:15px 10px;color:inherit;text-decoration:none}.imagify-tab a:focus{-webkit-box-shadow:none;box-shadow:none;outline:0;color:#40B1D8}.imagify-tab.imagify-current a{background:#F6F7FB}.imagify-tab-content{display:none}.imagify-tab-content .imagify-modal-section:first-child{margin-top:0}.imagify-modal-sidebar-content,.imagify-payment-modal .imagify-modal-sidebar{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.imagify-modal-sidebar-content{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}p.imagify-modal-sidebar-title.imagify-modal-sidebar-title{margin-top:5px;padding-right:40px;font-size:18px;color:#FFF}.imagify-modal-testimony{margin-top:1em}.imagify-modal-testimony+.imagify-modal-testimony{margin-top:2em}@media (max-height:620px){.imagify-modal-testimony+.imagify-modal-testimony{display:none}}.imagify-modal-testimony-person{display:table;width:100%}.imagify-modal-testimony-person>*{display:table-cell;vertical-align:middle}.imagify-modal-avatar{width:114px;line-height:0}.imagify-modal-avatar img{border:2px solid #FFF;border-radius:50%;width:96px;height:96px}.imagify-modal-identity a{text-decoration:none;font-weight:700}.imagify-modal-identity a:first-child{font-size:13px}.imagify-modal-identity a:first-child+a{display:block;font-size:10px;color:#7A8996}.imagify-modal-testimony-content.imagify-modal-testimony-content p{font-size:13px;font-style:italic;line-height:1.7;color:#7A8996}.imagify-modal-sidebar-trust{margin-top:auto;padding-top:1.5em}.imagify-modal-sidebar-trust p{margin:0;font-weight:700;font-size:12px;line-height:1.7}.imagify-modal-sidebar-trust p img{margin-right:3px;vertical-align:-2px}.imagify-modal-sidebar-trust p+p{font-size:11px}.imagify-cart{text-align:left}.imagify-cart .imagify-cart-list{border-top:1px solid rgba(122,137,150,.2);border-bottom:1px solid rgba(122,137,150,.2)}.imagify-cart .imagify-cart-label{margin-bottom:.5em;font-size:10px;color:#2E3243}.imagify-cart-list p{margin:0;font-weight:700}.imagify-cart-item{margin:.4em 0}.imagify-cart .imagify-cart-suggestion{margin-top:-.3em}.imagify-cart-suggestion a,.imagify-cl-description p{font-size:10px}.imagify-remove-from-cart{border:0;padding:0;width:14px;height:14px;line-height:13px;border-radius:50%;background:#40B1D0;cursor:pointer;-webkit-transition:background .3s;-o-transition:background .3s;transition:background .3s}.imagify-remove-from-cart i:before{position:relative;top:-6px;left:-3px;font-size:13px;color:#FFF}.imagify-remove-from-cart:focus,.imagify-remove-from-cart:hover{background:#D0021B}.imagify-cart .imagify-cl-remove{-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;width:45px}.imagify-cart .imagify-cl-name{-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;width:200px}.imagify-cart .imagify-cl-description{-webkit-align-self:flex-start;-ms-flex-item-align:start;align-self:flex-start;padding-top:10px}.imagify-cart .imagify-cl-price{text-align:right}#imagify-payment-iframe{width:980px;height:672px;background:url(../images/loader-balls.svg) 50% 50% no-repeat #f6f7fb}.imagify-success-view{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:100%}.imagify-success-view p{font-weight:700;font-size:16px}.imagify-cart-emptied-item{margin:.3em auto;padding:6px 20px;background:#E6EBEF;border-radius:20px}.imagify-cart-emptied-item.imagify-cart-emptied-item p{font-weight:700}.imagify-cart-emptied-item a{color:#40b1d0;float:right;font-weight:700}
assets/images/big-blue-check.png CHANGED
File without changes
assets/images/icon-alert.svg CHANGED
File without changes
assets/images/icon-arrow-choice.png CHANGED
File without changes
assets/images/icon-arrow-choice.svg CHANGED
File without changes
assets/images/icon-doc-image.svg CHANGED
File without changes
assets/images/icon-external.svg CHANGED
File without changes
assets/images/icon-level.svg CHANGED
File without changes
assets/images/icon-load.svg CHANGED
File without changes
assets/images/icon-lock.png CHANGED
File without changes
assets/images/icon-lock.svg CHANGED
File without changes
assets/images/icon-pack.png CHANGED
File without changes
assets/images/icon-pack.svg CHANGED
File without changes
assets/images/icon-time.svg CHANGED
File without changes
assets/images/imagify-logo.png CHANGED
File without changes
assets/images/imagify-menu-bar-de.jpg CHANGED
File without changes
assets/images/imagify-menu-bar-en.jpg CHANGED
File without changes
assets/images/imagify-menu-bar-es.jpg CHANGED
File without changes
assets/images/imagify-menu-bar-fr.jpg CHANGED
File without changes
assets/images/imagify-menu-bar-it.jpg CHANGED
File without changes
assets/images/lazyload.png CHANGED
File without changes
assets/images/logo-wprocket.png CHANGED
File without changes
assets/images/logo-wprocket.svg CHANGED
File without changes
assets/images/logo-wprocket@2x.png CHANGED
File without changes
assets/images/pic-ericwaltr.jpg CHANGED
File without changes
assets/images/pic-srhdesign.jpg CHANGED
File without changes
assets/images/spinner.gif CHANGED
File without changes
assets/images/upload-image.png CHANGED
File without changes
assets/js/chart.js CHANGED
File without changes
assets/js/chart.min.js CHANGED
File without changes
assets/js/files-list.js CHANGED
File without changes
assets/js/files-list.min.js CHANGED
File without changes
assets/js/formdata-polyfill.js CHANGED
File without changes
assets/js/formdata-polyfill.min.js CHANGED
File without changes
assets/js/imagify-gulp.js CHANGED
File without changes
assets/js/imagify-gulp.min.js CHANGED
File without changes
assets/js/imagify-wp-retina-2x.js CHANGED
File without changes
assets/js/imagify-wp-retina-2x.min.js CHANGED
File without changes
assets/js/jquery.twentytwenty.js CHANGED
@@ -22,12 +22,12 @@
22
  imgHeight = 0,
23
  $slider, $overlay,
24
  calcOffset = function( dimensionPct ) {
25
- var width = parseInt( $beforeImg.attr( 'width' ), 10 ),
26
- height = parseInt( $beforeImg.attr( 'height' ), 10 );
27
 
28
  if ( ! width || ! height ) {
29
- width = parseInt( $beforeImg.width(), 10 );
30
- height = parseInt( $beforeImg.height(), 10 );
31
  }
32
 
33
  return {
22
  imgHeight = 0,
23
  $slider, $overlay,
24
  calcOffset = function( dimensionPct ) {
25
+ var width = parseInt( $beforeImg.width(), 10 ),
26
+ height = parseInt( $beforeImg.height(), 10 );
27
 
28
  if ( ! width || ! height ) {
29
+ width = parseInt( $beforeImg.attr( 'width' ), 10 );
30
+ height = parseInt( $beforeImg.attr( 'height' ), 10 );
31
  }
32
 
33
  return {
assets/js/jquery.twentytwenty.min.js CHANGED
@@ -1 +1 @@
1
- !function(a,b,c,d){a.fn.twentytwenty=function(b,d){return b=a.extend({handlePosition:.5,orientation:"horizontal",labelBefore:"Before",labelAfter:"After"},b),this.each(function(){var e,f,g=b.handlePosition,h=a(this),i=b.orientation,j="vertical"===i?"down":"left",k="vertical"===i?"up":"right",l=h.find("img:first"),m=h.find("img:last"),n=0,o=0,p=0,q=0,r=function(a){var b=parseInt(l.attr("width"),10),c=parseInt(l.attr("height"),10);return b&&c||(b=parseInt(l.width(),10),c=parseInt(l.height(),10)),{w:b+"px",h:c+"px",cw:a*b+"px",ch:a*c+"px"}},s=function(a){var b=h.find(".twentytwenty-before");"vertical"===i?b.css("clip","rect(0,"+a.w+","+a.ch+",0)"):b.css("clip","rect(0,"+a.cw+","+a.h+",0)"),h.css("height",a.h),"function"==typeof d&&d()},t=function(a){var b=r(a);"vertical"===i?e.css("top",b.ch):e.css("left",b.cw),s(b)};h.parent(".twentytwenty-wrapper").length&&h.unwrap(),h.wrap('<div class="twentytwenty-wrapper twentytwenty-'+i+'"></div>'),h.children(".twentytwenty-overlay, .twentytwenty-handle").remove(),h.append('<div class="twentytwenty-overlay"></div>'),h.append('<div class="twentytwenty-handle"></div>'),e=h.find(".twentytwenty-handle"),e.append('<span class="twentytwenty-'+j+'-arrow"></span>'),e.append('<span class="twentytwenty-'+k+'-arrow"></span>'),h.addClass("twentytwenty-container"),l.addClass("twentytwenty-before"),m.addClass("twentytwenty-after"),f=h.find(".twentytwenty-overlay"),f.append('<div class="twentytwenty-labels twentytwenty-before-label"><span class="twentytwenty-label-content">'+b.labelBefore+"</span></div>"),f.append('<div class="twentytwenty-labels twentytwenty-after-label"><span class="twentytwenty-label-content">'+b.labelAfter+"</span></div>"),a(c).on("resize.twentytwenty",function(){t(g)}),e.on("movestart",function(a){"vertical"!==i&&(a.distX>a.distY&&a.distX<-a.distY||a.distX<a.distY&&a.distX>-a.distY)?a.preventDefault():"vertical"===i&&(a.distX<a.distY&&a.distX<-a.distY||a.distX>a.distY&&a.distX>-a.distY)&&a.preventDefault(),h.addClass("active"),n=h.offset().left,o=h.offset().top,p=l.width(),q=l.height()}),e.on("moveend",function(){h.removeClass("active")}),e.on("move",function(a){h.hasClass("active")&&(g="vertical"===i?(a.pageY-o)/q:(a.pageX-n)/p,g<0?g=0:g>1&&(g=1),t(g))}),h.find("img").on("mousedown",function(a){a.preventDefault()}),a(c).trigger("resize.twentytwenty")})}}(jQuery,document,window),function(a,b,c,d){var e=function(b){b.each(function(){var b=parseInt(a(this).closest(".imagify-chart").next(".imagify-chart-value").text(),10);new c.imagify.Chart(this,{type:"doughnut",data:{datasets:[{data:[b,100-b],backgroundColor:["#00B3D3","#D8D8D8"],borderColor:"#2A2E3C",borderWidth:1}]},options:{legend:{display:!1},events:[],animation:{easing:"easeOutBounce"},tooltips:{enabled:!1},responsive:!1,cutoutPercentage:60}})})},f=function(b){var d,f={width:0,height:0,originalUrl:"",optimizedUrl:"",originalSize:0,optimizedSize:0,saving:0,modalAppendTo:a("body"),trigger:a('[data-target="imagify-visual-comparison"]'),modalId:"imagify-visual-comparison",openModal:!1},g=a.extend({},f,b);if(0===g.width||0===g.height||""===g.originalUrl||""===g.optimizedUrl||0===g.originalSize||0===g.optimizedSize||0===g.saving)return"error";d='<div id="'+g.modalId+'" class="imagify-modal imagify-visual-comparison" aria-hidden="true">',d+='<div class="imagify-modal-content loading">',d+='<div class="twentytwenty-container">',d+='<img class="imagify-img-before" alt="" width="'+g.width+'" height="'+g.height+'">',d+='<img class="imagify-img-after" alt="" width="'+g.width+'" height="'+g.height+'">',d+="</div>",d+='<div class="imagify-comparison-levels">',d+='<div class="imagify-c-level imagify-level-original go-left">',d+='<p class="imagify-c-level-row">',d+='<span class="label">'+imagifyTTT.labels.filesize+"</span>",d+='<span class="value level">'+g.originalSize+"</span>",d+="</p>",d+="</div>",d+='<div class="imagify-c-level imagify-level-optimized go-right">',d+='<p class="imagify-c-level-row">',d+='<span class="label">'+imagifyTTT.labels.filesize+"</span>",d+='<span class="value level">'+g.optimizedSize+"</span>",d+="</p>",d+='<p class="imagify-c-level-row">',d+='<span class="label">'+imagifyTTT.labels.saving+"</span>",d+='<span class="value"><span class="imagify-chart"><span class="imagify-chart-container"><canvas id="imagify-consumption-chart-normal" width="15" height="15"></canvas></span></span><span class="imagify-chart-value">'+g.saving+"</span>%</span>",d+="</p>",d+="</div>",d+="</div>",d+='<button class="close-btn absolute" type="button"><i aria-hidden="true" class="dashicons dashicons-no-alt"></i><span class="screen-reader-text">'+imagifyTTT.labels.close+"</span></button>",d+="</div>",d+="</div>",g.modalAppendTo.append(d),g.trigger.on("click.imagify",function(b){var d,f,h=a(a(this).data("target")),i=0;b.preventDefault(),g.openModal&&c.imagify.openModal(a(this)),h.find(".imagify-modal-content").css({width:.85*a(c).outerWidth()+"px","max-width":g.width}),h.find(".imagify-img-before").on("load",function(){i++}).attr("src",g.originalUrl),h.find(".imagify-img-after").on("load",function(){i++}).attr("src",g.optimizedUrl+(g.optimizedUrl.indexOf("?")>0?"&":"?")+"v="+Date.now()),d=h.find(".twentytwenty-container"),f=setInterval(function(){if(2===i)return d.twentytwenty({handlePosition:.3,orientation:"horizontal",labelBefore:imagifyTTT.labels.originalL,labelAfter:imagifyTTT.labels.optimizedL},function(){var b,f,g,i,j,k,l=a(c).height(),m=h.find(".twentytwenty-container").height(),n=h.find(".twentytwenty-wrapper").position().top;d.closest(".imagify-modal-content").hasClass("loaded")||(d.closest(".imagify-modal-content").removeClass("loading").addClass("loaded"),e(h.find(".imagify-level-optimized .imagify-chart canvas"))),l<m&&!h.hasClass("modal-is-too-high")&&(h.addClass("modal-is-too-high"),b=h.find(".twentytwenty-handle"),f=h.find(".twentytwenty-label-content"),g=h.find(".imagify-comparison-levels"),i=g.outerHeight(),j=(l-n-b.height())/2,k=l-3*n-i,b.css({top:j}),f.css({top:k,bottom:"auto"}),h.find(".twentytwenty-wrapper").css({paddingBottom:i}),h.find(".imagify-modal-content").on("scroll.imagify",function(){var c=a(this).scrollTop();b.css({top:j+c}),f.css({top:k+c}),g.css({bottom:-c})}))}),clearInterval(f),f=null,"done"},75)})};if(a(".imagify-visual-comparison-btn").on("click",function(){var b,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;1!==a(".twentytwenty-wrapper").length&&(a(a(this).data("target")).find(".imagify-modal-content").css("width",.95*a(c).outerWidth()+"px"),a(".twentytwenty-container").length>0&&a(c).outerWidth()<=800||(b=a(".twentytwenty-container"),d=0,f=b.data("loader"),g=b.data("label-original"),h=b.data("label-normal"),i=b.data("label-aggressive"),j=b.data("label-ultra"),k=b.data("original-label").replace(/\*\*/,"<strong>").replace(/\*\*/,"</strong>"),l=b.data("original-alt"),m=b.data("original-img"),n=b.data("original-dim").split("x"),o=b.data("normal-alt"),p=b.data("normal-img"),q=b.data("normal-dim").split("x"),r=b.data("aggressive-alt"),s=b.data("aggressive-img"),t=b.data("aggressive-dim").split("x"),u=b.data("ultra-label").replace(/\*\*/,"<strong>").replace(/\*\*/,"</strong>"),v=b.data("ultra-alt"),w=b.data("ultra-img"),x=b.data("ultra-dim").split("x"),y='<span class="twentytwenty-duo-buttons twentytwenty-duo-left">',y+='<button type="button" class="imagify-comparison-original selected" data-img="original">'+g+"</button>",y+='<button type="button" class="imagify-comparison-normal" data-img="normal">'+h+"</button>",y+='<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">'+i+"</button>",y+="</span>",z='<span class="twentytwenty-duo-buttons twentytwenty-duo-right">',z+='<button type="button" class="imagify-comparison-normal" data-img="normal">'+h+"</button>",z+='<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">'+i+"</button>",z+='<button type="button" class="imagify-comparison-ultra selected" data-img="ultra">'+j+"</button>",z+="</span>",b.before('<img class="loader" src="'+f+'" alt="Loading…" width="64" height="64">'),a(".twentytwenty-left-buttons").append(y),a(".twentytwenty-right-buttons").append(z),A='<img class="img-original" alt="'+l+'" width="'+n[0]+'" height="'+n[1]+'">',A+='<img class="img-normal" alt="'+o+'" width="'+q[0]+'" height="'+q[1]+'">',A+='<img class="img-aggressive" alt="'+r+'" width="'+t[0]+'" height="'+t[1]+'">',A+='<img class="img-ultra" alt="'+v+'" width="'+x[0]+'" height="'+x[1]+'">',A+=a(".twentytwenty-left-buttons").lenght?y+z:"",b.closest(".imagify-modal-content").addClass("loading").find(".twentytwenty-container").append(A),a(".img-original").on("load",function(){d++}).attr("src",m),a(".img-normal").on("load",function(){d++}).attr("src",p),a(".img-aggressive").on("load",function(){d++}).attr("src",s),a(".img-ultra").on("load",function(){d++}).attr("src",w),B=setInterval(function(){4===d&&(b.twentytwenty({handlePosition:.6,orientation:"horizontal",labelBefore:k,labelAfter:u},function(){b.closest(".imagify-modal-content").hasClass("loaded")||(b.closest(".imagify-modal-content").removeClass("loading").addClass("loaded"),e(a(".imagify-level-ultra .imagify-chart canvas")))}),clearInterval(B),B=null)},75),a(".imagify-comparison-title").on("click",".twentytwenty-duo-buttons button:not(.selected)",function(b){var c,d=a(this),f=d.closest(".imagify-comparison-title").nextAll(".twentytwenty-wrapper").find(".twentytwenty-container"),g=d.closest(".twentytwenty-duo-buttons").hasClass("twentytwenty-duo-left")?"left":"right",h="left"===g?d.closest(".imagify-comparison-title").find(".twentytwenty-duo-right"):d.closest(".imagify-comparison-title").find(".twentytwenty-duo-left"),i=d.closest(".twentytwenty-duo-buttons").find("button"),j=f.find(".twentytwenty-before"),k=f.find(".twentytwenty-after"),l=d.data("img");b.stopPropagation(),b.preventDefault(),i.removeClass("selected"),d.addClass("selected"),h.find(".selected").data("img")===l&&h.find("button:not(.selected)").eq(0).trigger("click"),"left"===g&&(c=j.css("clip"),j.attr("style",""),j.removeClass("twentytwenty-before"),f.find(".img-"+l).addClass("twentytwenty-before").css("clip",c),a(".twentytwenty-before-label .twentytwenty-label-content").text(f.data(l+"-label")),a(".imagify-c-level.go-left").attr("aria-hidden","true").removeClass("go-left go-right"),a(".imagify-level-"+l).attr("aria-hidden","false").addClass("go-left")),"right"===g&&(k.removeClass("twentytwenty-after"),f.find(".img-"+l).addClass("twentytwenty-after"),a(".twentytwenty-after-label .twentytwenty-label-content").text(f.data(l+"-label")),a(".imagify-c-level.go-right").attr("aria-hidden","true").removeClass("go-left go-right"),a(".imagify-level-"+l).attr("aria-hidden","false").addClass("go-right")),e(a(".imagify-level-"+l+" .imagify-chart canvas"))})))}),imagifyTTT.imageWidth&&a(".post-php .wp_attachment_image .thumbnail").length>0){var g,h,i=a(".post-php .wp_attachment_image"),j={src:a("#imagify-full-original").val(),size:a("#imagify-full-original-size").val()},k=a("#misc-publishing-actions").find(".misc-pub-imagify .button-primary");imagifyTTT.widthLimit=parseInt(imagifyTTT.widthLimit,10),imagifyTTT.imageWidth>imagifyTTT.widthLimit&&j.src?(g=a(".misc-pub-filesize strong").text(),h=a(".imagify-data-item .imagify-chart-value").text(),a('[id^="imgedit-open-btn-"]').before('<button type="button" class="imagify-button-primary button-primary imagify-modal-trigger" data-target="#imagify-visual-comparison" id="imagify-start-comparison">'+imagifyTTT.labels.compare+"</button>"),f({width:parseInt(imagifyTTT.imageWidth,10),height:parseInt(imagifyTTT.imageHeight,10),originalUrl:j.src,optimizedUrl:imagifyTTT.imageSrc,originalSize:j.size,optimizedSize:g,saving:h,modalAppendTo:i,trigger:a("#imagify-start-comparison"),modalId:"imagify-visual-comparison"})):imagifyTTT.imageWidth<imagifyTTT.widthLimit&&j.src||a("#imagify-full-original").length>0&&""===j.src||1===a("#misc-publishing-actions").find(".misc-pub-imagify .button-primary").length&&(a('[id^="imgedit-open-btn-"]').before('<span class="spinner imagify-hidden"></span><a class="imagify-button-primary button-primary imagify-optimize-trigger" id="imagify-optimize-trigger" href="'+k.attr("href")+'">'+imagifyTTT.labels.optimize+"</a>"),a("#imagify-optimize-trigger").on("click",function(){a(this).prev(".spinner").removeClass("imagify-hidden").addClass("is-active")}))}if(a(".upload-php .imagify-compare-images").length>0&&a(".imagify-compare-images").each(function(){var b=a(this),c=b.data("id"),d=b.closest("#post-"+c).find(".column-imagify_optimized_file");f({width:parseInt(b.data("full-width"),10),height:parseInt(b.data("full-height"),10),originalUrl:b.data("backup-src"),optimizedUrl:b.data("full-src"),originalSize:d.find(".original").text(),optimizedSize:d.find(".imagify-data-item .big").text(),saving:d.find(".imagify-chart-value").text(),modalAppendTo:b.closest(".column-primary"),trigger:b,modalId:"imagify-comparison-"+c})}),a(".upload-php").length>0){var l=function(){var b=setInterval(function(){var c,d,e;a(".media-modal .imagify-datas-details").length&&(d=a("#imagify-original-src").val(),d&&(e=a(".media-frame-content .attachment-actions"),e.find("#imagify-media-frame-comparison-btn").remove(),e.prepend('<button type="button" class="imagify-button-primary button-primary imagify-modal-trigger" data-target="#imagify-comparison-modal" id="imagify-media-frame-comparison-btn">'+imagifyTTT.labels.compare+"</button>"),c=a(".media-frame-content .compat-field-imagify"),f({width:parseInt(a("#imagify-full-width").val(),10),height:parseInt(a("#imagify-full-height").val(),10),originalUrl:d,optimizedUrl:a("#imagify-full-src").val(),originalSize:a("#imagify-original-size").val(),optimizedSize:c.find(".imagify-data-item .big").text(),saving:c.find(".imagify-chart-value").text(),modalAppendTo:a(".media-frame-content .thumbnail-image"),trigger:a("#imagify-media-frame-comparison-btn"),modalId:"imagify-comparison-modal",openModal:!0})),clearInterval(b),b=null)},20)};a(".upload-php").on("click",".media-frame.mode-grid .attachment, .edit-media-header .left, .edit-media-header .right",function(){l()}),function(a){var b={};return c.location.href.replace(/[?&]+([^=&]+)=?([^&]*)?/gi,function(a,c,d){b[c]=void 0!==d?d:""}),a?b[a]?b[a]:null:b}("item")&&l()}if(a("#imagify-files-list-form").length>0){var m=function(b){b.each(function(){var b=a(this),c=b.data("id"),d=b.closest("tr").find(".column-optimization .imagify-data-item");a("#imagify-comparison-"+c).remove(),f({width:parseInt(b.data("full-width"),10),height:parseInt(b.data("full-height"),10),originalUrl:b.data("backup-src"),optimizedUrl:b.data("full-src"),originalSize:d.find(".original").text(),optimizedSize:d.find(".optimized").text(),saving:d.find(".imagify-chart-value").text(),modalAppendTo:b.closest(".column-primary"),trigger:b,modalId:"imagify-comparison-"+c})})};a(c).on("comparisonprinted.imagify",function(b,c){var d;c=c||0,d=c?a("#imagify-files-list-form").find('.imagify-compare-images[data-id="'+c+'"]'):a("#imagify-files-list-form").find(".imagify-compare-images"),d.length&&m(d)}).trigger("comparisonprinted.imagify")}}(jQuery,document,window);
1
+ !function(a,b,c,d){a.fn.twentytwenty=function(b,d){return b=a.extend({handlePosition:.5,orientation:"horizontal",labelBefore:"Before",labelAfter:"After"},b),this.each(function(){var e,f,g=b.handlePosition,h=a(this),i=b.orientation,j="vertical"===i?"down":"left",k="vertical"===i?"up":"right",l=h.find("img:first"),m=h.find("img:last"),n=0,o=0,p=0,q=0,r=function(a){var b=parseInt(l.width(),10),c=parseInt(l.height(),10);return b&&c||(b=parseInt(l.attr("width"),10),c=parseInt(l.attr("height"),10)),{w:b+"px",h:c+"px",cw:a*b+"px",ch:a*c+"px"}},s=function(a){var b=h.find(".twentytwenty-before");"vertical"===i?b.css("clip","rect(0,"+a.w+","+a.ch+",0)"):b.css("clip","rect(0,"+a.cw+","+a.h+",0)"),h.css("height",a.h),"function"==typeof d&&d()},t=function(a){var b=r(a);"vertical"===i?e.css("top",b.ch):e.css("left",b.cw),s(b)};h.parent(".twentytwenty-wrapper").length&&h.unwrap(),h.wrap('<div class="twentytwenty-wrapper twentytwenty-'+i+'"></div>'),h.children(".twentytwenty-overlay, .twentytwenty-handle").remove(),h.append('<div class="twentytwenty-overlay"></div>'),h.append('<div class="twentytwenty-handle"></div>'),e=h.find(".twentytwenty-handle"),e.append('<span class="twentytwenty-'+j+'-arrow"></span>'),e.append('<span class="twentytwenty-'+k+'-arrow"></span>'),h.addClass("twentytwenty-container"),l.addClass("twentytwenty-before"),m.addClass("twentytwenty-after"),f=h.find(".twentytwenty-overlay"),f.append('<div class="twentytwenty-labels twentytwenty-before-label"><span class="twentytwenty-label-content">'+b.labelBefore+"</span></div>"),f.append('<div class="twentytwenty-labels twentytwenty-after-label"><span class="twentytwenty-label-content">'+b.labelAfter+"</span></div>"),a(c).on("resize.twentytwenty",function(){t(g)}),e.on("movestart",function(a){"vertical"!==i&&(a.distX>a.distY&&a.distX<-a.distY||a.distX<a.distY&&a.distX>-a.distY)?a.preventDefault():"vertical"===i&&(a.distX<a.distY&&a.distX<-a.distY||a.distX>a.distY&&a.distX>-a.distY)&&a.preventDefault(),h.addClass("active"),n=h.offset().left,o=h.offset().top,p=l.width(),q=l.height()}),e.on("moveend",function(){h.removeClass("active")}),e.on("move",function(a){h.hasClass("active")&&(g="vertical"===i?(a.pageY-o)/q:(a.pageX-n)/p,g<0?g=0:g>1&&(g=1),t(g))}),h.find("img").on("mousedown",function(a){a.preventDefault()}),a(c).trigger("resize.twentytwenty")})}}(jQuery,document,window),function(a,b,c,d){var e=function(b){b.each(function(){var b=parseInt(a(this).closest(".imagify-chart").next(".imagify-chart-value").text(),10);new c.imagify.Chart(this,{type:"doughnut",data:{datasets:[{data:[b,100-b],backgroundColor:["#00B3D3","#D8D8D8"],borderColor:"#2A2E3C",borderWidth:1}]},options:{legend:{display:!1},events:[],animation:{easing:"easeOutBounce"},tooltips:{enabled:!1},responsive:!1,cutoutPercentage:60}})})},f=function(b){var d,f={width:0,height:0,originalUrl:"",optimizedUrl:"",originalSize:0,optimizedSize:0,saving:0,modalAppendTo:a("body"),trigger:a('[data-target="imagify-visual-comparison"]'),modalId:"imagify-visual-comparison",openModal:!1},g=a.extend({},f,b);if(0===g.width||0===g.height||""===g.originalUrl||""===g.optimizedUrl||0===g.originalSize||0===g.optimizedSize||0===g.saving)return"error";d='<div id="'+g.modalId+'" class="imagify-modal imagify-visual-comparison" aria-hidden="true">',d+='<div class="imagify-modal-content loading">',d+='<div class="twentytwenty-container">',d+='<img class="imagify-img-before" alt="" width="'+g.width+'" height="'+g.height+'">',d+='<img class="imagify-img-after" alt="" width="'+g.width+'" height="'+g.height+'">',d+="</div>",d+='<div class="imagify-comparison-levels">',d+='<div class="imagify-c-level imagify-level-original go-left">',d+='<p class="imagify-c-level-row">',d+='<span class="label">'+imagifyTTT.labels.filesize+"</span>",d+='<span class="value level">'+g.originalSize+"</span>",d+="</p>",d+="</div>",d+='<div class="imagify-c-level imagify-level-optimized go-right">',d+='<p class="imagify-c-level-row">',d+='<span class="label">'+imagifyTTT.labels.filesize+"</span>",d+='<span class="value level">'+g.optimizedSize+"</span>",d+="</p>",d+='<p class="imagify-c-level-row">',d+='<span class="label">'+imagifyTTT.labels.saving+"</span>",d+='<span class="value"><span class="imagify-chart"><span class="imagify-chart-container"><canvas id="imagify-consumption-chart-normal" width="15" height="15"></canvas></span></span><span class="imagify-chart-value">'+g.saving+"</span>%</span>",d+="</p>",d+="</div>",d+="</div>",d+='<button class="close-btn absolute" type="button"><i aria-hidden="true" class="dashicons dashicons-no-alt"></i><span class="screen-reader-text">'+imagifyTTT.labels.close+"</span></button>",d+="</div>",d+="</div>",g.modalAppendTo.append(d),g.trigger.on("click.imagify",function(b){var d,f,h=a(a(this).data("target")),i=0;b.preventDefault(),g.openModal&&c.imagify.openModal(a(this)),h.find(".imagify-modal-content").css({width:.85*a(c).outerWidth()+"px","max-width":g.width}),h.find(".imagify-img-before").on("load",function(){i++}).attr("src",g.originalUrl),h.find(".imagify-img-after").on("load",function(){i++}).attr("src",g.optimizedUrl+(g.optimizedUrl.indexOf("?")>0?"&":"?")+"v="+Date.now()),d=h.find(".twentytwenty-container"),f=setInterval(function(){if(2===i)return d.twentytwenty({handlePosition:.3,orientation:"horizontal",labelBefore:imagifyTTT.labels.originalL,labelAfter:imagifyTTT.labels.optimizedL},function(){var b,f,g,i,j,k,l=a(c).height(),m=h.find(".twentytwenty-container").height(),n=h.find(".twentytwenty-wrapper").position().top;d.closest(".imagify-modal-content").hasClass("loaded")||(d.closest(".imagify-modal-content").removeClass("loading").addClass("loaded"),e(h.find(".imagify-level-optimized .imagify-chart canvas"))),l<m&&!h.hasClass("modal-is-too-high")&&(h.addClass("modal-is-too-high"),b=h.find(".twentytwenty-handle"),f=h.find(".twentytwenty-label-content"),g=h.find(".imagify-comparison-levels"),i=g.outerHeight(),j=(l-n-b.height())/2,k=l-3*n-i,b.css({top:j}),f.css({top:k,bottom:"auto"}),h.find(".twentytwenty-wrapper").css({paddingBottom:i}),h.find(".imagify-modal-content").on("scroll.imagify",function(){var c=a(this).scrollTop();b.css({top:j+c}),f.css({top:k+c}),g.css({bottom:-c})}))}),clearInterval(f),f=null,"done"},75)})};if(a(".imagify-visual-comparison-btn").on("click",function(){var b,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;1!==a(".twentytwenty-wrapper").length&&(a(a(this).data("target")).find(".imagify-modal-content").css("width",.95*a(c).outerWidth()+"px"),a(".twentytwenty-container").length>0&&a(c).outerWidth()<=800||(b=a(".twentytwenty-container"),d=0,f=b.data("loader"),g=b.data("label-original"),h=b.data("label-normal"),i=b.data("label-aggressive"),j=b.data("label-ultra"),k=b.data("original-label").replace(/\*\*/,"<strong>").replace(/\*\*/,"</strong>"),l=b.data("original-alt"),m=b.data("original-img"),n=b.data("original-dim").split("x"),o=b.data("normal-alt"),p=b.data("normal-img"),q=b.data("normal-dim").split("x"),r=b.data("aggressive-alt"),s=b.data("aggressive-img"),t=b.data("aggressive-dim").split("x"),u=b.data("ultra-label").replace(/\*\*/,"<strong>").replace(/\*\*/,"</strong>"),v=b.data("ultra-alt"),w=b.data("ultra-img"),x=b.data("ultra-dim").split("x"),y='<span class="twentytwenty-duo-buttons twentytwenty-duo-left">',y+='<button type="button" class="imagify-comparison-original selected" data-img="original">'+g+"</button>",y+='<button type="button" class="imagify-comparison-normal" data-img="normal">'+h+"</button>",y+='<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">'+i+"</button>",y+="</span>",z='<span class="twentytwenty-duo-buttons twentytwenty-duo-right">',z+='<button type="button" class="imagify-comparison-normal" data-img="normal">'+h+"</button>",z+='<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">'+i+"</button>",z+='<button type="button" class="imagify-comparison-ultra selected" data-img="ultra">'+j+"</button>",z+="</span>",b.before('<img class="loader" src="'+f+'" alt="Loading…" width="64" height="64">'),a(".twentytwenty-left-buttons").append(y),a(".twentytwenty-right-buttons").append(z),A='<img class="img-original" alt="'+l+'" width="'+n[0]+'" height="'+n[1]+'">',A+='<img class="img-normal" alt="'+o+'" width="'+q[0]+'" height="'+q[1]+'">',A+='<img class="img-aggressive" alt="'+r+'" width="'+t[0]+'" height="'+t[1]+'">',A+='<img class="img-ultra" alt="'+v+'" width="'+x[0]+'" height="'+x[1]+'">',A+=a(".twentytwenty-left-buttons").lenght?y+z:"",b.closest(".imagify-modal-content").addClass("loading").find(".twentytwenty-container").append(A),a(".img-original").on("load",function(){d++}).attr("src",m),a(".img-normal").on("load",function(){d++}).attr("src",p),a(".img-aggressive").on("load",function(){d++}).attr("src",s),a(".img-ultra").on("load",function(){d++}).attr("src",w),B=setInterval(function(){4===d&&(b.twentytwenty({handlePosition:.6,orientation:"horizontal",labelBefore:k,labelAfter:u},function(){b.closest(".imagify-modal-content").hasClass("loaded")||(b.closest(".imagify-modal-content").removeClass("loading").addClass("loaded"),e(a(".imagify-level-ultra .imagify-chart canvas")))}),clearInterval(B),B=null)},75),a(".imagify-comparison-title").on("click",".twentytwenty-duo-buttons button:not(.selected)",function(b){var c,d=a(this),f=d.closest(".imagify-comparison-title").nextAll(".twentytwenty-wrapper").find(".twentytwenty-container"),g=d.closest(".twentytwenty-duo-buttons").hasClass("twentytwenty-duo-left")?"left":"right",h="left"===g?d.closest(".imagify-comparison-title").find(".twentytwenty-duo-right"):d.closest(".imagify-comparison-title").find(".twentytwenty-duo-left"),i=d.closest(".twentytwenty-duo-buttons").find("button"),j=f.find(".twentytwenty-before"),k=f.find(".twentytwenty-after"),l=d.data("img");b.stopPropagation(),b.preventDefault(),i.removeClass("selected"),d.addClass("selected"),h.find(".selected").data("img")===l&&h.find("button:not(.selected)").eq(0).trigger("click"),"left"===g&&(c=j.css("clip"),j.attr("style",""),j.removeClass("twentytwenty-before"),f.find(".img-"+l).addClass("twentytwenty-before").css("clip",c),a(".twentytwenty-before-label .twentytwenty-label-content").text(f.data(l+"-label")),a(".imagify-c-level.go-left").attr("aria-hidden","true").removeClass("go-left go-right"),a(".imagify-level-"+l).attr("aria-hidden","false").addClass("go-left")),"right"===g&&(k.removeClass("twentytwenty-after"),f.find(".img-"+l).addClass("twentytwenty-after"),a(".twentytwenty-after-label .twentytwenty-label-content").text(f.data(l+"-label")),a(".imagify-c-level.go-right").attr("aria-hidden","true").removeClass("go-left go-right"),a(".imagify-level-"+l).attr("aria-hidden","false").addClass("go-right")),e(a(".imagify-level-"+l+" .imagify-chart canvas"))})))}),imagifyTTT.imageWidth&&a(".post-php .wp_attachment_image .thumbnail").length>0){var g,h,i=a(".post-php .wp_attachment_image"),j={src:a("#imagify-full-original").val(),size:a("#imagify-full-original-size").val()},k=a("#misc-publishing-actions").find(".misc-pub-imagify .button-primary");imagifyTTT.widthLimit=parseInt(imagifyTTT.widthLimit,10),imagifyTTT.imageWidth>imagifyTTT.widthLimit&&j.src?(g=a(".misc-pub-filesize strong").text(),h=a(".imagify-data-item .imagify-chart-value").text(),a('[id^="imgedit-open-btn-"]').before('<button type="button" class="imagify-button-primary button-primary imagify-modal-trigger" data-target="#imagify-visual-comparison" id="imagify-start-comparison">'+imagifyTTT.labels.compare+"</button>"),f({width:parseInt(imagifyTTT.imageWidth,10),height:parseInt(imagifyTTT.imageHeight,10),originalUrl:j.src,optimizedUrl:imagifyTTT.imageSrc,originalSize:j.size,optimizedSize:g,saving:h,modalAppendTo:i,trigger:a("#imagify-start-comparison"),modalId:"imagify-visual-comparison"})):imagifyTTT.imageWidth<imagifyTTT.widthLimit&&j.src||a("#imagify-full-original").length>0&&""===j.src||1===a("#misc-publishing-actions").find(".misc-pub-imagify .button-primary").length&&(a('[id^="imgedit-open-btn-"]').before('<span class="spinner imagify-hidden"></span><a class="imagify-button-primary button-primary imagify-optimize-trigger" id="imagify-optimize-trigger" href="'+k.attr("href")+'">'+imagifyTTT.labels.optimize+"</a>"),a("#imagify-optimize-trigger").on("click",function(){a(this).prev(".spinner").removeClass("imagify-hidden").addClass("is-active")}))}if(a(".upload-php .imagify-compare-images").length>0&&a(".imagify-compare-images").each(function(){var b=a(this),c=b.data("id"),d=b.closest("#post-"+c).find(".column-imagify_optimized_file");f({width:parseInt(b.data("full-width"),10),height:parseInt(b.data("full-height"),10),originalUrl:b.data("backup-src"),optimizedUrl:b.data("full-src"),originalSize:d.find(".original").text(),optimizedSize:d.find(".imagify-data-item .big").text(),saving:d.find(".imagify-chart-value").text(),modalAppendTo:b.closest(".column-primary"),trigger:b,modalId:"imagify-comparison-"+c})}),a(".upload-php").length>0){var l=function(){var b=setInterval(function(){var c,d,e;a(".media-modal .imagify-datas-details").length&&(d=a("#imagify-original-src").val(),d&&(e=a(".media-frame-content .attachment-actions"),e.find("#imagify-media-frame-comparison-btn").remove(),e.prepend('<button type="button" class="imagify-button-primary button-primary imagify-modal-trigger" data-target="#imagify-comparison-modal" id="imagify-media-frame-comparison-btn">'+imagifyTTT.labels.compare+"</button>"),c=a(".media-frame-content .compat-field-imagify"),f({width:parseInt(a("#imagify-full-width").val(),10),height:parseInt(a("#imagify-full-height").val(),10),originalUrl:d,optimizedUrl:a("#imagify-full-src").val(),originalSize:a("#imagify-original-size").val(),optimizedSize:c.find(".imagify-data-item .big").text(),saving:c.find(".imagify-chart-value").text(),modalAppendTo:a(".media-frame-content .thumbnail-image"),trigger:a("#imagify-media-frame-comparison-btn"),modalId:"imagify-comparison-modal",openModal:!0})),clearInterval(b),b=null)},20)};a(".upload-php").on("click",".media-frame.mode-grid .attachment, .edit-media-header .left, .edit-media-header .right",function(){l()}),function(a){var b={};return c.location.href.replace(/[?&]+([^=&]+)=?([^&]*)?/gi,function(a,c,d){b[c]=void 0!==d?d:""}),a?b[a]?b[a]:null:b}("item")&&l()}if(a("#imagify-files-list-form").length>0){var m=function(b){b.each(function(){var b=a(this),c=b.data("id"),d=b.closest("tr").find(".column-optimization .imagify-data-item");a("#imagify-comparison-"+c).remove(),f({width:parseInt(b.data("full-width"),10),height:parseInt(b.data("full-height"),10),originalUrl:b.data("backup-src"),optimizedUrl:b.data("full-src"),originalSize:d.find(".original").text(),optimizedSize:d.find(".optimized").text(),saving:d.find(".imagify-chart-value").text(),modalAppendTo:b.closest(".column-primary"),trigger:b,modalId:"imagify-comparison-"+c})})};a(c).on("comparisonprinted.imagify",function(b,c){var d;c=c||0,d=c?a("#imagify-files-list-form").find('.imagify-compare-images[data-id="'+c+'"]'):a("#imagify-files-list-form").find(".imagify-compare-images"),d.length&&m(d)}).trigger("comparisonprinted.imagify")}}(jQuery,document,window);
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.8.3
7
  * Author: WP Media
8
  * Author URI: https://wp-media.me/
9
  * Licence: GPLv2
@@ -17,7 +17,7 @@
17
  defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
18
 
19
  // Imagify defines.
20
- define( 'IMAGIFY_VERSION', '1.8.3' );
21
  define( 'IMAGIFY_WP_MIN', '4.0' );
22
  define( 'IMAGIFY_SLUG', 'imagify' );
23
  define( 'IMAGIFY_FILE', __FILE__ );
@@ -83,6 +83,7 @@ function _imagify_init() {
83
  require IMAGIFY_COMMON_PATH . 'partners.php';
84
  require IMAGIFY_3RD_PARTY_PATH . '3rd-party.php';
85
 
 
86
  Imagify_Options::get_instance()->init();
87
  Imagify_Data::get_instance()->init();
88
  Imagify_Folders_DB::get_instance()->init();
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.8.4
7
  * Author: WP Media
8
  * Author URI: https://wp-media.me/
9
  * Licence: GPLv2
17
  defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
18
 
19
  // Imagify defines.
20
+ define( 'IMAGIFY_VERSION', '1.8.4' );
21
  define( 'IMAGIFY_WP_MIN', '4.0' );
22
  define( 'IMAGIFY_SLUG', 'imagify' );
23
  define( 'IMAGIFY_FILE', __FILE__ );
83
  require IMAGIFY_COMMON_PATH . 'partners.php';
84
  require IMAGIFY_3RD_PARTY_PATH . '3rd-party.php';
85
 
86
+ Imagify_Auto_Optimization::get_instance()->init();
87
  Imagify_Options::get_instance()->init();
88
  Imagify_Data::get_instance()->init();
89
  Imagify_Folders_DB::get_instance()->init();
inc/3rd-party/3rd-party.php CHANGED
@@ -20,4 +20,5 @@ require IMAGIFY_3RD_PARTY_PATH . 'yoast-seo.php';
20
  * Hosting.
21
  */
22
  require IMAGIFY_3RD_PARTY_PATH . 'hosting/siteground.php';
 
23
  require IMAGIFY_3RD_PARTY_PATH . 'hosting/wpengine.php';
20
  * Hosting.
21
  */
22
  require IMAGIFY_3RD_PARTY_PATH . 'hosting/siteground.php';
23
+ require IMAGIFY_3RD_PARTY_PATH . 'hosting/wordpress-com.php';
24
  require IMAGIFY_3RD_PARTY_PATH . 'hosting/wpengine.php';
inc/3rd-party/amazon-s3-and-cloudfront/inc/classes/class-imagify-as3cf-attachment.php CHANGED
File without changes
inc/3rd-party/amazon-s3-and-cloudfront/inc/classes/class-imagify-as3cf.php CHANGED
@@ -14,7 +14,7 @@ class Imagify_AS3CF extends Imagify_AS3CF_Deprecated {
14
  *
15
  * @var string
16
  */
17
- const VERSION = '1.0.2';
18
 
19
  /**
20
  * Context used with get_imagify_attachment().
@@ -109,22 +109,6 @@ class Imagify_AS3CF extends Imagify_AS3CF_Deprecated {
109
  * Stats.
110
  */
111
  add_filter( 'imagify_total_attachment_filesize', array( $this, 'add_stats_for_s3_files' ), 8, 4 );
112
-
113
- /**
114
- * Automatic optimisation.
115
- */
116
- // Remove some of our hooks: let S3 work first in these cases.
117
- remove_filter( 'wp_generate_attachment_metadata', '_imagify_optimize_attachment', IMAGIFY_INT_MAX );
118
- remove_action( 'wp_ajax_imagify_async_optimize_upload_new_media', array( Imagify_Admin_Ajax_Post::get_instance(), 'imagify_async_optimize_upload_new_media_callback' ) );
119
- remove_action( 'shutdown', '_imagify_optimize_save_image_editor_file' );
120
- remove_action( 'wp_ajax_imagify_async_optimize_save_image_editor_file', array( Imagify_Admin_Ajax_Post::get_instance(), 'imagify_async_optimize_save_image_editor_file_callback' ) );
121
-
122
- // Store the IDs of the attachments being uploaded.
123
- add_filter( 'wp_generate_attachment_metadata', array( $this, 'store_upload_ids' ), 10, 2 );
124
- // Once uploaded to S3, launch the async optimization.
125
- add_filter( 'wp_update_attachment_metadata', array( $this, 'do_async_job' ), 210, 2 );
126
- // Do the optimization in a new thread.
127
- add_action( 'wp_ajax_imagify_async_optimize_as3cf', array( $this, 'optimize' ) );
128
  }
129
 
130
 
@@ -307,142 +291,4 @@ class Imagify_AS3CF extends Imagify_AS3CF_Deprecated {
307
  'thumbnails' => count( $files ) - 1,
308
  );
309
  }
310
-
311
-
312
- /** ----------------------------------------------------------------------------------------- */
313
- /** AUTOMATIC OPTIMIZATION: OPTIMIZE AFTER S3 HAS DONE ITS WORK ============================= */
314
- /** ----------------------------------------------------------------------------------------- */
315
-
316
- /**
317
- * Filter the generated attachment meta data.
318
- * This is used when a new attachment has just been uploaded (or not, when wp_generate_attachment_metadata() is used).
319
- * We use it to tell the difference later in wp_update_attachment_metadata().
320
- *
321
- * @since 1.6.6
322
- * @author Grégory Viguier
323
- * @see $this->do_async_job()
324
- *
325
- * @param array $metadata An array of attachment meta data.
326
- * @param int $attachment_id Current attachment ID.
327
- * @return array
328
- */
329
- public function store_upload_ids( $metadata, $attachment_id ) {
330
-
331
- if ( imagify_is_attachment_mime_type_supported( $attachment_id ) ) {
332
- $this->uploads[ $attachment_id ] = 1;
333
- }
334
-
335
- return $metadata;
336
- }
337
-
338
- /**
339
- * After an image (maybe) being sent to S3, launch an async optimization.
340
- *
341
- * @since 1.6.6
342
- * @author Grégory Viguier
343
- * @see $this->store_upload_ids()
344
- *
345
- * @param array $metadata An array of attachment meta data.
346
- * @param int $attachment_id Current attachment ID.
347
- * @return array
348
- */
349
- public function do_async_job( $metadata, $attachment_id ) {
350
- static $auto_optimize;
351
-
352
- $is_new_upload = ! empty( $this->uploads[ $attachment_id ] );
353
- unset( $this->uploads[ $attachment_id ] );
354
-
355
- if ( ! $metadata || ! imagify_is_attachment_mime_type_supported( $attachment_id ) ) {
356
- return $metadata;
357
- }
358
-
359
- if ( ! isset( $auto_optimize ) ) {
360
- $auto_optimize = Imagify_Requirements::is_api_key_valid() && get_imagify_option( 'auto_optimize' );
361
- }
362
-
363
- if ( $is_new_upload ) {
364
- // It's a new upload.
365
- if ( ! $auto_optimize ) {
366
- // Auto-optimization is disabled.
367
- return $metadata;
368
- }
369
-
370
- /** This filter is documented in inc/common/attachments.php. */
371
- $optimize = apply_filters( 'imagify_auto_optimize_attachment', true, $attachment_id, $metadata );
372
-
373
- if ( ! $optimize ) {
374
- return $metadata;
375
- }
376
- }
377
-
378
- if ( ! $is_new_upload ) {
379
- $attachment = get_imagify_attachment( self::CONTEXT, $attachment_id, 'as3cf_async_job' );
380
-
381
- if ( ! $attachment->get_data() ) {
382
- // It's not a new upload and the attachment is not optimized yet.
383
- return $metadata;
384
- }
385
- }
386
-
387
- $data = array();
388
-
389
- // Some specifics for the image editor.
390
- if ( isset( $_POST['action'], $_POST['do'], $_POST['postid'] ) && 'image-editor' === $_POST['action'] && (int) $_POST['postid'] === $attachment_id ) { // WPCS: CSRF ok.
391
- check_ajax_referer( 'image_editor-' . $_POST['postid'] );
392
- $data = $_POST;
393
- }
394
-
395
- imagify_do_async_job( array(
396
- 'action' => 'imagify_async_optimize_as3cf',
397
- '_ajax_nonce' => wp_create_nonce( 'imagify_async_optimize_as3cf' ),
398
- 'post_id' => $attachment_id,
399
- 'metadata' => $metadata,
400
- 'data' => $data,
401
- ) );
402
-
403
- return $metadata;
404
- }
405
-
406
- /**
407
- * Once an image has been sent to S3, optimize it and send it again.
408
- *
409
- * @since 1.6.6
410
- * @author Grégory Viguier
411
- */
412
- public function optimize() {
413
- check_ajax_referer( 'imagify_async_optimize_as3cf' );
414
-
415
- if ( empty( $_POST['post_id'] ) || ! imagify_current_user_can( 'auto-optimize' ) ) {
416
- die();
417
- }
418
-
419
- $attachment_id = absint( $_POST['post_id'] );
420
-
421
- if ( ! $attachment_id || empty( $_POST['metadata'] ) || ! is_array( $_POST['metadata'] ) || empty( $_POST['metadata']['sizes'] ) ) {
422
- die();
423
- }
424
-
425
- if ( ! imagify_is_attachment_mime_type_supported( $attachment_id ) ) {
426
- die();
427
- }
428
-
429
- $optimization_level = null;
430
- $attachment = get_imagify_attachment( self::CONTEXT, $attachment_id, 'as3cf_optimize' );
431
-
432
- // Some specifics for the image editor.
433
- if ( ! empty( $_POST['data']['do'] ) ) {
434
- $optimization_level = $attachment->get_optimization_level();
435
-
436
- // Remove old optimization data.
437
- $attachment->delete_imagify_data();
438
-
439
- if ( 'restore' === $_POST['data']['do'] ) {
440
- // Restore the backup file.
441
- $attachment->restore();
442
- }
443
- }
444
-
445
- // Optimize it.
446
- $attachment->optimize( $optimization_level, $_POST['metadata'] );
447
- }
448
  }
14
  *
15
  * @var string
16
  */
17
+ const VERSION = '1.1';
18
 
19
  /**
20
  * Context used with get_imagify_attachment().
109
  * Stats.
110
  */
111
  add_filter( 'imagify_total_attachment_filesize', array( $this, 'add_stats_for_s3_files' ), 8, 4 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  }
113
 
114
 
291
  'thumbnails' => count( $files ) - 1,
292
  );
293
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  }
inc/3rd-party/enable-media-replace/inc/classes/class-imagify-enable-media-replace.php CHANGED
@@ -7,50 +7,65 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
7
  * @since 1.6.9
8
  * @author Grégory Viguier
9
  */
10
- class Imagify_Enable_Media_Replace {
11
 
12
  /**
13
  * Class version.
14
  *
15
- * @var string
 
 
16
  */
17
- const VERSION = '1.0.1';
18
 
19
  /**
20
  * The attachment ID.
21
  *
22
- * @var int
 
 
 
23
  */
24
  protected $attachment_id;
25
 
26
  /**
27
  * The attachment.
28
  *
29
- * @var object A Imagify_Attachment object (or any class extending it).
 
 
 
30
  */
31
  protected $attachment;
32
 
33
  /**
34
- * The path to the old backup file.
 
35
  *
36
- * @var string
 
 
 
37
  */
38
- protected $old_backup_path;
39
 
40
  /**
41
- * Filesystem object.
42
  *
43
- * @var object Imagify_Filesystem
44
- * @since 1.7.1
45
  * @access protected
46
  * @author Grégory Viguier
47
  */
48
- protected $filesystem;
49
 
50
  /**
51
  * The single instance of the class.
52
  *
53
- * @var object
 
 
 
54
  */
55
  protected static $_instance;
56
 
@@ -78,9 +93,7 @@ class Imagify_Enable_Media_Replace {
78
  * @since 1.6.9
79
  * @author Grégory Viguier
80
  */
81
- protected function __construct() {
82
- $this->filesystem = Imagify_Filesystem::get_instance();
83
- }
84
 
85
  /**
86
  * Launch the hooks before the files and data are replaced.
@@ -98,17 +111,20 @@ class Imagify_Enable_Media_Replace {
98
  return $unfiltered;
99
  }
100
 
101
- // Remove the automatic optimization.
102
- remove_filter( 'wp_generate_attachment_metadata', '_imagify_optimize_attachment', IMAGIFY_INT_MAX );
103
-
104
  // Store the old backup file path.
105
  add_filter( 'emr_unique_filename', array( $this, 'store_old_backup_path' ), 10, 3 );
106
- // Optimize and delete the old backup file.
107
- add_action( 'emr_returnurl', array( $this, 'optimize' ) );
 
108
 
109
  return $unfiltered;
110
  }
111
 
 
 
 
 
 
112
  /**
113
  * When the user chooses to change the file name, store the old backup file path. This path will be used later to delete the file.
114
  *
@@ -129,66 +145,46 @@ class Imagify_Enable_Media_Replace {
129
  $backup_path = $this->get_attachment()->get_backup_path();
130
 
131
  if ( $backup_path ) {
132
- $this->old_backup_path = $backup_path;
 
 
 
 
 
133
  }
134
 
135
  return $new_filename;
136
  }
137
 
138
  /**
139
- * Optimize the attachment files if the old ones were also optimized.
140
- * Delete the old backup file.
141
  *
142
- * @since 1.6.9
143
  * @author Grégory Viguier
144
- * @see $this->store_old_backup_path()
145
  *
146
- * @param string $return_url The URL the user will be redirected to.
147
- * @return string The same URL.
148
  */
149
- public function optimize( $return_url ) {
150
- $attachment = $this->get_attachment();
151
-
152
- if ( $attachment->get_data() ) {
153
- /**
154
- * The old images have been optimized in the past.
155
- */
156
- // Use the same otimization level for the new ones.
157
- $optimization_level = $attachment->get_optimization_level();
158
-
159
- // Remove old optimization data.
160
- $attachment->delete_imagify_data();
161
-
162
- // Optimize and overwrite the previous backup file if exists and needed.
163
- add_filter( 'imagify_backup_overwrite_backup', '__return_true', 42 );
164
- $attachment->optimize( $optimization_level );
165
- remove_filter( 'imagify_backup_overwrite_backup', '__return_true', 42 );
166
- }
167
-
168
- /**
169
- * Delete the old backup file.
170
- */
171
- if ( ! $this->old_backup_path || ! $this->filesystem->exists( $this->old_backup_path ) ) {
172
- // The user didn't choose to rename the files, or there is no old backup.
173
- $this->old_backup_path = null;
174
- return $return_url;
175
  }
176
 
177
- $new_backup_path = $attachment->get_raw_backup_path();
178
 
179
- if ( $new_backup_path === $this->old_backup_path ) {
180
- // We don't want to delete the new backup.
181
- $this->old_backup_path = null;
182
- return $return_url;
183
  }
184
 
185
- // Finally, delete the old backup file.
186
- $this->filesystem->delete( $this->old_backup_path );
187
-
188
  $this->old_backup_path = null;
189
- return $return_url;
190
  }
191
 
 
 
 
 
 
192
  /**
193
  * Get the attachment.
194
  *
7
  * @since 1.6.9
8
  * @author Grégory Viguier
9
  */
10
+ class Imagify_Enable_Media_Replace extends Imagify_Enable_Media_Replace_Deprecated {
11
 
12
  /**
13
  * Class version.
14
  *
15
+ * @var string
16
+ * @since 1.6.9
17
+ * @author Grégory Viguier
18
  */
19
+ const VERSION = '2.0';
20
 
21
  /**
22
  * The attachment ID.
23
  *
24
+ * @var int
25
+ * @since 1.6.9
26
+ * @access protected
27
+ * @author Grégory Viguier
28
  */
29
  protected $attachment_id;
30
 
31
  /**
32
  * The attachment.
33
  *
34
+ * @var object A Imagify_Attachment object (or any class extending it).
35
+ * @since 1.6.9
36
+ * @access protected
37
+ * @author Grégory Viguier
38
  */
39
  protected $attachment;
40
 
41
  /**
42
+ * Tell if the attachment has data.
43
+ * No data means not processed by Imagify, or restored.
44
  *
45
+ * @var bool
46
+ * @since 1.8.4
47
+ * @access protected
48
+ * @author Grégory Viguier
49
  */
50
+ protected $attachment_has_data;
51
 
52
  /**
53
+ * The path to the old backup file.
54
  *
55
+ * @var string
56
+ * @since 1.6.9
57
  * @access protected
58
  * @author Grégory Viguier
59
  */
60
+ protected $old_backup_path;
61
 
62
  /**
63
  * The single instance of the class.
64
  *
65
+ * @var object
66
+ * @since 1.6.9
67
+ * @access protected
68
+ * @author Grégory Viguier
69
  */
70
  protected static $_instance;
71
 
93
  * @since 1.6.9
94
  * @author Grégory Viguier
95
  */
96
+ protected function __construct() {}
 
 
97
 
98
  /**
99
  * Launch the hooks before the files and data are replaced.
111
  return $unfiltered;
112
  }
113
 
 
 
 
114
  // Store the old backup file path.
115
  add_filter( 'emr_unique_filename', array( $this, 'store_old_backup_path' ), 10, 3 );
116
+ // Delete the old backup file.
117
+ add_action( 'imagify_before_auto_optimization_launch', array( $this, 'delete_backup' ) );
118
+ add_action( 'imagify_not_optimized_attachment_updated', array( $this, 'delete_backup' ) );
119
 
120
  return $unfiltered;
121
  }
122
 
123
+
124
+ /** ----------------------------------------------------------------------------------------- */
125
+ /** HOOKS =================================================================================== */
126
+ /** ----------------------------------------------------------------------------------------- */
127
+
128
  /**
129
  * When the user chooses to change the file name, store the old backup file path. This path will be used later to delete the file.
130
  *
145
  $backup_path = $this->get_attachment()->get_backup_path();
146
 
147
  if ( $backup_path ) {
148
+ $this->old_backup_path = $backup_path;
149
+ $this->attachment_has_data = $this->get_attachment()->get_data();
150
+ } else {
151
+ $this->attachment_id = null;
152
+ $this->old_backup_path = null;
153
+ $this->attachment_has_data = null;
154
  }
155
 
156
  return $new_filename;
157
  }
158
 
159
  /**
160
+ * Delete previous backup file. This is done after the images have been already replaced by Enable Media Replace.
161
+ * It will prevent having a backup file not corresponding to the current images.
162
  *
163
+ * @since 1.8.4
164
  * @author Grégory Viguier
 
165
  *
166
+ * @param int $attachment_id The attachment ID.
 
167
  */
168
+ public function delete_backup( $attachment_id ) {
169
+ if ( $attachment_id !== $this->attachment_id ) {
170
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  }
172
 
173
+ $filesystem = Imagify_Filesystem::get_instance();
174
 
175
+ if ( ! $this->old_backup_path || ! $filesystem->exists( $this->old_backup_path ) ) {
176
+ return;
 
 
177
  }
178
 
179
+ $filesystem->delete( $this->old_backup_path );
 
 
180
  $this->old_backup_path = null;
 
181
  }
182
 
183
+
184
+ /** ----------------------------------------------------------------------------------------- */
185
+ /** TOOLS =================================================================================== */
186
+ /** ----------------------------------------------------------------------------------------- */
187
+
188
  /**
189
  * Get the attachment.
190
  *
inc/3rd-party/hosting/siteground.php CHANGED
File without changes
inc/3rd-party/hosting/wordpress-com.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
3
+
4
+ if ( defined( 'WPCOMSH_VERSION' ) ) :
5
+
6
+ add_filter( 'imagify_site_root', 'imagify_wpcom_site_root', IMAGIFY_INT_MAX );
7
+ /**
8
+ * Filter the path to the site's root.
9
+ *
10
+ * @since 1.8.4
11
+ * @author Grégory Viguier
12
+ *
13
+ * @param string|null $root_path Path to the site's root. Default is null.
14
+ * @return string|null
15
+ */
16
+ function imagify_wpcom_site_root( $root_path ) {
17
+ $upload_basedir = imagify_get_filesystem()->get_upload_basedir( true );
18
+
19
+ if ( strpos( $upload_basedir, '/wp-content/' ) === false ) {
20
+ // Uh oooooh...
21
+ return $root_path;
22
+ }
23
+
24
+ $upload_basedir = explode( '/wp-content/', $upload_basedir );
25
+ $upload_basedir = reset( $upload_basedir );
26
+
27
+ return $upload_basedir . '/';
28
+ }
29
+
30
+ endif;
inc/3rd-party/hosting/wpengine.php CHANGED
File without changes
inc/3rd-party/nextgen-gallery/inc/admin/ajax.php CHANGED
File without changes
inc/3rd-party/nextgen-gallery/inc/admin/bulk.php CHANGED
File without changes
inc/3rd-party/nextgen-gallery/inc/admin/enqueue.php CHANGED
File without changes
inc/3rd-party/nextgen-gallery/inc/admin/gallery.php CHANGED
File without changes
inc/3rd-party/nextgen-gallery/inc/admin/heartbeat.php CHANGED
File without changes
inc/3rd-party/nextgen-gallery/inc/admin/menu.php CHANGED
File without changes
inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg-attachment.php CHANGED
File without changes
inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg-db.php CHANGED
File without changes
inc/3rd-party/nextgen-gallery/inc/common/attachments.php CHANGED
File without changes
inc/3rd-party/nextgen-gallery/inc/functions/admin-stats.php CHANGED
File without changes
inc/3rd-party/nextgen-gallery/inc/functions/attachments.php CHANGED
File without changes
inc/3rd-party/nextgen-gallery/inc/functions/common.php CHANGED
File without changes
inc/3rd-party/regenerate-thumbnails/inc/classes/class-imagify-regenerate-thumbnails.php CHANGED
@@ -16,7 +16,7 @@ class Imagify_Regenerate_Thumbnails {
16
  * @since 1.7.1
17
  * @author Grégory Viguier
18
  */
19
- const VERSION = '1.0';
20
 
21
  /**
22
  * Action used for the ajax callback.
@@ -122,6 +122,8 @@ class Imagify_Regenerate_Thumbnails {
122
  if ( $attachment ) {
123
  // The attachment can be regenerated: backup the optimized full-sized file.
124
  $this->backup_optimized_file( $attachment_id );
 
 
125
  }
126
 
127
  return $dispatch_result;
@@ -148,13 +150,15 @@ class Imagify_Regenerate_Thumbnails {
148
  if ( ! $sizes ) {
149
  // Put the optimized full-sized file back.
150
  $this->put_optimized_file_back( $this->get_attachment( $attachment_id ) );
 
 
151
 
152
  return $metadata;
153
  }
154
 
155
- $action = Imagify_Regenerate_Thumbnails::ACTION;
156
  $context = $this->get_attachment( $attachment_id )->get_context();
157
- $_ajax_nonce = wp_create_nonce( Imagify_Regenerate_Thumbnails::get_nonce_name( $attachment_id, $context ) );
158
 
159
  imagify_do_async_job( compact( 'action', '_ajax_nonce', 'sizes', 'attachment_id', 'context' ) );
160
 
16
  * @since 1.7.1
17
  * @author Grégory Viguier
18
  */
19
+ const VERSION = '1.1';
20
 
21
  /**
22
  * Action used for the ajax callback.
122
  if ( $attachment ) {
123
  // The attachment can be regenerated: backup the optimized full-sized file.
124
  $this->backup_optimized_file( $attachment_id );
125
+ // Prevent automatic optimization.
126
+ Imagify_Auto_Optimization::prevent_optimization( $attachment_id );
127
  }
128
 
129
  return $dispatch_result;
150
  if ( ! $sizes ) {
151
  // Put the optimized full-sized file back.
152
  $this->put_optimized_file_back( $this->get_attachment( $attachment_id ) );
153
+ // Allow auto-optimization back.
154
+ Imagify_Auto_Optimization::allow_optimization( $attachment_id );
155
 
156
  return $metadata;
157
  }
158
 
159
+ $action = self::ACTION;
160
  $context = $this->get_attachment( $attachment_id )->get_context();
161
+ $_ajax_nonce = wp_create_nonce( self::get_nonce_name( $attachment_id, $context ) );
162
 
163
  imagify_do_async_job( compact( 'action', '_ajax_nonce', 'sizes', 'attachment_id', 'context' ) );
164
 
inc/3rd-party/wp-retina-2x/inc/classes/class-imagify-wp-retina-2x-core.php CHANGED
@@ -16,7 +16,7 @@ class Imagify_WP_Retina_2x_Core {
16
  * @since 1.8
17
  * @author Grégory Viguier
18
  */
19
- const VERSION = '1.0';
20
 
21
  /**
22
  * Filesystem object.
@@ -262,13 +262,13 @@ class Imagify_WP_Retina_2x_Core {
262
  $attachment->delete_backup();
263
 
264
  // Prevent auto-optimization.
265
- add_filter( 'imagify_auto_optimize_attachment', '__return_false', 442 );
266
 
267
  // Generate the non-retina images and the related WP metadata.
268
  wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $original_path ) );
269
 
270
  // Allow auto-optimization back.
271
- remove_filter( 'imagify_auto_optimize_attachment', '__return_false', 442 );
272
 
273
  // Generate retina images (since the Imagify data has been deleted, the images won't be optimized here).
274
  $result = $this->generate_retina_images( $attachment );
@@ -1091,8 +1091,12 @@ class Imagify_WP_Retina_2x_Core {
1091
  }
1092
  }
1093
 
1094
- $results[ $file_path ] = call_user_func( $method, $file_path );
1095
- $results[ $attachment_id ] = $results[ $file_path ];
 
 
 
 
1096
 
1097
  return $results[ $file_path ];
1098
  }
@@ -1593,7 +1597,13 @@ class Imagify_WP_Retina_2x_Core {
1593
  $metadata['width'] = $dimensions['width'];
1594
  $metadata['height'] = $dimensions['height'];
1595
 
 
 
 
1596
  wp_update_attachment_metadata( $attachment->get_id(), $metadata );
 
 
 
1597
  return true;
1598
  }
1599
 
16
  * @since 1.8
17
  * @author Grégory Viguier
18
  */
19
+ const VERSION = '1.1';
20
 
21
  /**
22
  * Filesystem object.
262
  $attachment->delete_backup();
263
 
264
  // Prevent auto-optimization.
265
+ Imagify_Auto_Optimization::prevent_optimization( $attachment_id );
266
 
267
  // Generate the non-retina images and the related WP metadata.
268
  wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $original_path ) );
269
 
270
  // Allow auto-optimization back.
271
+ Imagify_Auto_Optimization::allow_optimization( $attachment_id );
272
 
273
  // Generate retina images (since the Imagify data has been deleted, the images won't be optimized here).
274
  $result = $this->generate_retina_images( $attachment );
1091
  }
1092
  }
1093
 
1094
+ // $file_path is now a path for sure.
1095
+ $results[ $file_path ] = call_user_func( $method, $file_path );
1096
+
1097
+ if ( ! empty( $attachment_id ) ) {
1098
+ $results[ $attachment_id ] = $results[ $file_path ];
1099
+ }
1100
 
1101
  return $results[ $file_path ];
1102
  }
1597
  $metadata['width'] = $dimensions['width'];
1598
  $metadata['height'] = $dimensions['height'];
1599
 
1600
+ // Prevent auto-optimization.
1601
+ Imagify_Auto_Optimization::prevent_optimization( $attachment_id );
1602
+
1603
  wp_update_attachment_metadata( $attachment->get_id(), $metadata );
1604
+
1605
+ // Allow auto-optimization back.
1606
+ Imagify_Auto_Optimization::allow_optimization( $attachment_id );
1607
  return true;
1608
  }
1609
 
inc/3rd-party/wp-retina-2x/inc/classes/class-imagify-wp-retina-2x.php CHANGED
File without changes
inc/3rd-party/wp-rocket.php CHANGED
File without changes
inc/3rd-party/wp-time-capsule/inc/classes/class-imagify-wp-time-capsule.php CHANGED
File without changes
inc/3rd-party/wp-time-capsule/wp-time-capsule.php CHANGED
File without changes
inc/admin/custom-folders.php CHANGED
File without changes
inc/classes/class-imagify-abstract-attachment.php CHANGED
File without changes
inc/classes/class-imagify-abstract-cron.php CHANGED
File without changes
inc/classes/class-imagify-abstract-db.php CHANGED
File without changes
inc/classes/class-imagify-abstract-options.php CHANGED
File without changes
inc/classes/class-imagify-admin-ajax-post.php CHANGED
@@ -7,7 +7,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
7
  * @since 1.6.11
8
  * @author Grégory Viguier
9
  */
10
- class Imagify_Admin_Ajax_Post {
11
 
12
  /**
13
  * Class version.
@@ -48,8 +48,7 @@ class Imagify_Admin_Ajax_Post {
48
  protected $ajax_only_actions = array(
49
  'imagify_bulk_upload',
50
  'imagify_bulk_optimize_file',
51
- 'imagify_async_optimize_upload_new_media',
52
- 'imagify_async_optimize_save_image_editor_file',
53
  'imagify_get_unoptimized_attachment_ids',
54
  'imagify_get_unoptimized_file_ids',
55
  'imagify_check_backup_dir_is_writable',
@@ -597,76 +596,93 @@ class Imagify_Admin_Ajax_Post {
597
  /** ----------------------------------------------------------------------------------------- */
598
 
599
  /**
600
- * Optimize image on picture uploading with async request.
601
  *
602
- * @since 1.6.11
603
  * @access public
604
- * @author Julio Potier
605
- * @see _imagify_optimize_attachment()
606
  */
607
- public function imagify_async_optimize_upload_new_media_callback() {
608
- if ( empty( $_POST['_ajax_nonce'] ) || empty( $_POST['attachment_id'] ) || empty( $_POST['metadata'] ) || empty( $_POST['context'] ) ) { // WPCS: CSRF ok.
609
- return;
610
  }
611
 
612
- $context = imagify_sanitize_context( $_POST['context'] );
613
  $attachment_id = absint( $_POST['attachment_id'] );
614
 
615
- imagify_check_nonce( 'new_media-' . $attachment_id );
616
- imagify_check_user_capacity( 'auto-optimize' );
617
-
618
- $attachment = get_imagify_attachment( $context, $attachment_id, 'imagify_async_optimize_upload_new_media' );
619
 
620
- // Optimize it!!!!!
621
- $attachment->optimize( null, $_POST['metadata'] );
622
- die( 1 );
623
- }
624
-
625
- /**
626
- * Optimize image on picture editing (resize, crop...) with async request.
627
- *
628
- * @since 1.6.11
629
- * @access public
630
- * @author Julio Potier
631
- */
632
- public function imagify_async_optimize_save_image_editor_file_callback() {
633
- $attachment_id = ! empty( $_POST['postid'] ) ? absint( $_POST['postid'] ) : 0;
634
-
635
- if ( ! $attachment_id || empty( $_POST['do'] ) ) {
636
- return;
637
  }
638
 
639
- imagify_check_nonce( 'image_editor-' . $attachment_id );
640
- imagify_check_user_capacity( 'edit_post', $attachment_id );
641
-
642
- $attachment = get_imagify_attachment( 'wp', $attachment_id, 'wp_ajax_imagify_async_optimize_save_image_editor_file' );
643
 
644
- if ( ! $attachment->get_data() ) {
645
- return;
646
  }
647
 
648
- $optimization_level = $attachment->get_optimization_level();
649
- $metadata = wp_get_attachment_metadata( $attachment_id );
650
 
651
- // Remove old optimization data.
652
- $attachment->delete_imagify_data();
653
 
654
- if ( 'restore' === $_POST['do'] ) {
655
- // Restore the backup file.
656
- $attachment->restore();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
657
 
658
- // Get old metadata to regenerate all thumbnails.
659
- $metadata = array( 'sizes' => array() );
660
- $backup_sizes = (array) get_post_meta( $attachment_id, '_wp_attachment_backup_sizes', true );
 
 
 
661
 
662
- foreach ( $backup_sizes as $size_key => $size_data ) {
663
- $size_key = str_replace( '-origin', '' , $size_key );
664
- $metadata['sizes'][ $size_key ] = $size_data;
 
 
 
 
 
 
 
 
 
 
 
 
 
665
  }
 
 
 
666
  }
667
 
668
- // Optimize it!!!!!
669
- $attachment->optimize( $optimization_level, $metadata );
 
 
 
 
 
 
 
 
670
  die( 1 );
671
  }
672
 
@@ -1495,11 +1511,19 @@ class Imagify_Admin_Ajax_Post {
1495
  */
1496
  public function check_can_optimize() {
1497
  if ( ! Imagify_Requirements::is_api_key_valid() ) {
1498
- wp_send_json_error( array( 'message' => 'invalid-api-key' ) );
 
 
 
 
1499
  }
1500
 
1501
  if ( Imagify_Requirements::is_over_quota() ) {
1502
- wp_send_json_error( array( 'message' => 'over-quota' ) );
 
 
 
 
1503
  }
1504
  }
1505
 
7
  * @since 1.6.11
8
  * @author Grégory Viguier
9
  */
10
+ class Imagify_Admin_Ajax_Post extends Imagify_Admin_Ajax_Post_Deprecated {
11
 
12
  /**
13
  * Class version.
48
  protected $ajax_only_actions = array(
49
  'imagify_bulk_upload',
50
  'imagify_bulk_optimize_file',
51
+ 'imagify_auto_optimize',
 
52
  'imagify_get_unoptimized_attachment_ids',
53
  'imagify_get_unoptimized_file_ids',
54
  'imagify_check_backup_dir_is_writable',
596
  /** ----------------------------------------------------------------------------------------- */
597
 
598
  /**
599
+ * Optimize image with async request.
600
  *
601
+ * @since 1.8.4
602
  * @access public
603
+ * @author Grégory Viguier
604
+ * @see Imagify_Auto_Optimization->do_auto_optimization()
605
  */
606
+ public function imagify_auto_optimize_callback() {
607
+ if ( empty( $_POST['_ajax_nonce'] ) || empty( $_POST['attachment_id'] ) || empty( $_POST['context'] ) ) { // WPCS: CSRF ok.
608
+ imagify_die( __( 'Invalid request', 'imagify' ) );
609
  }
610
 
 
611
  $attachment_id = absint( $_POST['attachment_id'] );
612
 
613
+ imagify_check_nonce( 'imagify_auto_optimize-' . $attachment_id );
 
 
 
614
 
615
+ if ( ! get_transient( 'imagify-auto-optimize-' . $attachment_id ) ) {
616
+ imagify_die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
617
  }
618
 
619
+ delete_transient( 'imagify-auto-optimize-' . $attachment_id );
 
 
 
620
 
621
+ if ( ! imagify_is_attachment_mime_type_supported( $attachment_id ) ) {
622
+ imagify_die( __( 'This type of file is not supported.', 'imagify' ) );
623
  }
624
 
625
+ $this->check_can_optimize();
 
626
 
627
+ @set_time_limit( 0 );
 
628
 
629
+ /**
630
+ * Let's start.
631
+ */
632
+ $context = imagify_sanitize_context( $_POST['context'] );
633
+ $attachment = get_imagify_attachment( $context, $attachment_id, 'auto_optimize' );
634
+ $is_new_upload = ! empty( $_POST['is_new_upload'] );
635
+
636
+ /**
637
+ * Triggered before an attachment is auto-optimized.
638
+ *
639
+ * @since 1.8.4
640
+ * @author Grégory Viguier
641
+ *
642
+ * @param int $attachment_id The attachment ID.
643
+ * @param bool $is_new_upload True if it's a new upload. False otherwize.
644
+ */
645
+ do_action( 'imagify_before_auto_optimization', $attachment_id, $is_new_upload );
646
 
647
+ if ( $is_new_upload ) {
648
+ /**
649
+ * It's a new upload.
650
+ */
651
+ // $metadata is provided to tell `$attachment->optimize()` it's a new upload.
652
+ $metadata = wp_get_attachment_metadata( $attachment_id, true );
653
 
654
+ // Optimize.
655
+ $attachment->optimize( null, $metadata );
656
+ } else {
657
+ /**
658
+ * The attachment has already been optimized (or at least it has been tried).
659
+ */
660
+ // Get the optimization level before remove our data.
661
+ $optimization_level = $attachment->get_optimization_level();
662
+
663
+ // Remove old optimization data.
664
+ $attachment->delete_imagify_data();
665
+
666
+ // Some specifics for the image editor.
667
+ if ( ! empty( $_POST['data']['do'] ) && 'restore' === $_POST['data']['do'] ) {
668
+ // Restore the backup file.
669
+ $attachment->restore();
670
  }
671
+
672
+ // Optimize.
673
+ $attachment->optimize( $optimization_level );
674
  }
675
 
676
+ /**
677
+ * Triggered after an attachment is auto-optimized.
678
+ *
679
+ * @since 1.8.4
680
+ * @author Grégory Viguier
681
+ *
682
+ * @param int $attachment_id The attachment ID.
683
+ * @param bool $is_new_upload True if it's a new upload. False otherwize.
684
+ */
685
+ do_action( 'imagify_after_auto_optimization', $attachment_id, $is_new_upload );
686
  die( 1 );
687
  }
688
 
1511
  */
1512
  public function check_can_optimize() {
1513
  if ( ! Imagify_Requirements::is_api_key_valid() ) {
1514
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
1515
+ wp_send_json_error( array( 'message' => 'invalid-api-key' ) );
1516
+ }
1517
+
1518
+ imagify_die( __( 'Your API key is not valid!', 'imagify' ) );
1519
  }
1520
 
1521
  if ( Imagify_Requirements::is_over_quota() ) {
1522
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
1523
+ wp_send_json_error( array( 'message' => 'over-quota' ) );
1524
+ }
1525
+
1526
+ imagify_die( __( 'You have used all your credits!', 'imagify' ) );
1527
  }
1528
  }
1529
 
inc/classes/class-imagify-attachment.php CHANGED
@@ -13,7 +13,7 @@ class Imagify_Attachment extends Imagify_Abstract_Attachment {
13
  *
14
  * @var string
15
  */
16
- const VERSION = '1.1.3';
17
 
18
  /**
19
  * Get the attachment backup file path, even if the file doesn't exist.
@@ -133,11 +133,46 @@ class Imagify_Attachment extends Imagify_Abstract_Attachment {
133
  return false;
134
  }
135
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  $metadata = wp_get_attachment_metadata( $this->id );
137
  $metadata['width'] = $size['width'];
138
  $metadata['height'] = $size['height'];
139
 
140
  wp_update_attachment_metadata( $this->id, $metadata );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  return true;
142
  }
143
 
@@ -764,7 +799,7 @@ class Imagify_Attachment extends Imagify_Abstract_Attachment {
764
  * @since 1.0
765
  *
766
  * @param int $id The attachment ID
767
- */
768
  do_action( 'before_imagify_restore_attachment', $this->id );
769
 
770
  // Create the original image from the backup.
@@ -776,7 +811,6 @@ class Imagify_Attachment extends Imagify_Abstract_Attachment {
776
  require_once ABSPATH . 'wp-admin/includes/image.php';
777
  }
778
 
779
- remove_filter( 'wp_generate_attachment_metadata', '_imagify_optimize_attachment', IMAGIFY_INT_MAX );
780
  wp_generate_attachment_metadata( $this->id, $attachment_path );
781
 
782
  // Restore the original size in the metadata.
@@ -792,7 +826,7 @@ class Imagify_Attachment extends Imagify_Abstract_Attachment {
792
  * @since 1.0
793
  *
794
  * @param int $id The attachment ID
795
- */
796
  do_action( 'after_imagify_restore_attachment', $this->id );
797
  }
798
  }
13
  *
14
  * @var string
15
  */
16
+ const VERSION = '1.1.4';
17
 
18
  /**
19
  * Get the attachment backup file path, even if the file doesn't exist.
133
  return false;
134
  }
135
 
136
+ /**
137
+ * Triggered before updating an image width and height into its metadata.
138
+ *
139
+ * @since 1.8.4
140
+ * @see Imagify_Filesystem->get_image_size()
141
+ * @author Grégory Viguier
142
+ *
143
+ * @param int $attachment_id The attachment ID.
144
+ * @param array $size {
145
+ * An array with, among other data:
146
+ *
147
+ * @type int $width The image width.
148
+ * @type int $height The image height.
149
+ * }
150
+ */
151
+ do_action( 'before_imagify_update_metadata_size', $this->id, $size );
152
+
153
  $metadata = wp_get_attachment_metadata( $this->id );
154
  $metadata['width'] = $size['width'];
155
  $metadata['height'] = $size['height'];
156
 
157
  wp_update_attachment_metadata( $this->id, $metadata );
158
+
159
+ /**
160
+ * Triggered after updating an image width and height into its metadata.
161
+ *
162
+ * @since 1.8.4
163
+ * @see Imagify_Filesystem->get_image_size()
164
+ * @author Grégory Viguier
165
+ *
166
+ * @param int $attachment_id The attachment ID.
167
+ * @param array $size {
168
+ * An array with, among other data:
169
+ *
170
+ * @type int $width The image width.
171
+ * @type int $height The image height.
172
+ * }
173
+ */
174
+ do_action( 'after_imagify_update_metadata_size', $this->id, $size );
175
+
176
  return true;
177
  }
178
 
799
  * @since 1.0
800
  *
801
  * @param int $id The attachment ID
802
+ */
803
  do_action( 'before_imagify_restore_attachment', $this->id );
804
 
805
  // Create the original image from the backup.
811
  require_once ABSPATH . 'wp-admin/includes/image.php';
812
  }
813
 
 
814
  wp_generate_attachment_metadata( $this->id, $attachment_path );
815
 
816
  // Restore the original size in the metadata.
826
  * @since 1.0
827
  *
828
  * @param int $id The attachment ID
829
+ */
830
  do_action( 'after_imagify_restore_attachment', $this->id );
831
  }
832
  }
inc/classes/class-imagify-auto-optimization.php ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
3
+
4
+ /**
5
+ * Class that handles the auto-optimization process.
6
+ * This occurs when a new image is uploaded, and when an optimized image is worked with (resized, etc).
7
+ * The process will work only if wp_update_attachment_metadata() is used.
8
+ *
9
+ * @since 1.8.4
10
+ * @author Grégory Viguier
11
+ */
12
+ class Imagify_Auto_Optimization {
13
+
14
+ /**
15
+ * Class version.
16
+ *
17
+ * @var string
18
+ * @since 1.8.4
19
+ * @author Grégory Viguier
20
+ */
21
+ const VERSION = '1.0';
22
+
23
+ /**
24
+ * An array containing the IDs (as keys) of attachments just being uploaded.
25
+ *
26
+ * @var array
27
+ * @since 1.8.4
28
+ * @access protected
29
+ * @author Grégory Viguier
30
+ */
31
+ protected $uploads = array();
32
+
33
+ /**
34
+ * An array containing the IDs (as keys) of attachments that must be optimized automatically.
35
+ * The values tell if the attachment is a new upload.
36
+ *
37
+ * @var array
38
+ * @since 1.8.4
39
+ * @access protected
40
+ * @author Grégory Viguier
41
+ */
42
+ protected $attachments = array();
43
+
44
+ /**
45
+ * The single instance of the class.
46
+ *
47
+ * @var object
48
+ * @since 1.8.4
49
+ * @access protected
50
+ * @author Grégory Viguier
51
+ */
52
+ protected static $instance;
53
+
54
+ /**
55
+ * Used to prevent an auto-optimization locally.
56
+ *
57
+ * @var array
58
+ * @since 1.8.4
59
+ * @access private
60
+ * @author Grégory Viguier
61
+ */
62
+ private static $prevented = array();
63
+
64
+ /**
65
+ * Get the main Instance.
66
+ * Ensures only one instance of class is loaded or can be loaded.
67
+ *
68
+ * @since 1.8.4
69
+ * @access public
70
+ * @author Grégory Viguier
71
+ *
72
+ * @return object Main instance.
73
+ */
74
+ public static function get_instance() {
75
+ if ( ! isset( self::$instance ) ) {
76
+ self::$instance = new self();
77
+ }
78
+
79
+ return self::$instance;
80
+ }
81
+
82
+ /**
83
+ * The class constructor.
84
+ *
85
+ * @since 1.8.4
86
+ * @access protected
87
+ * @author Grégory Viguier
88
+ */
89
+ protected function __construct() {}
90
+
91
+ /**
92
+ * Init.
93
+ *
94
+ * @since 1.8.4
95
+ * @access public
96
+ * @author Grégory Viguier
97
+ */
98
+ public function init() {
99
+ $prio = IMAGIFY_INT_MAX - 30;
100
+
101
+ // Automatic optimization tunel.
102
+ add_action( 'add_attachment', array( $this, 'store_upload_ids' ), $prio );
103
+ add_filter( 'wp_update_attachment_metadata', array( $this, 'store_ids_to_optimize' ), $prio, 2 );
104
+ add_action( 'updated_post_meta', array( $this, 'do_auto_optimization' ), $prio, 4 );
105
+ add_action( 'added_post_meta', array( $this, 'do_auto_optimization' ), $prio, 4 );
106
+ add_action( 'deleted_post_meta', array( $this, 'unset_optimization' ), $prio, 3 );
107
+
108
+ // Prevent to re-optimize when updating the image width and height (when resizing the full image).
109
+ add_action( 'before_imagify_update_metadata_size', array( __CLASS__, 'prevent_optimization' ), 5 );
110
+ add_action( 'after_imagify_update_metadata_size', array( __CLASS__, 'allow_optimization' ), 5 );
111
+ }
112
+
113
+ /**
114
+ * Remove the hooks.
115
+ *
116
+ * @since 1.8.4
117
+ * @access public
118
+ * @author Grégory Viguier
119
+ */
120
+ public function remove_hooks() {
121
+ $prio = IMAGIFY_INT_MAX - 30;
122
+
123
+ remove_action( 'add_attachment', array( $this, 'store_upload_ids' ), $prio );
124
+ remove_filter( 'wp_update_attachment_metadata', array( $this, 'store_ids_to_optimize' ), $prio );
125
+ remove_action( 'updated_post_meta', array( $this, 'do_auto_optimization' ), $prio );
126
+ remove_action( 'added_post_meta', array( $this, 'do_auto_optimization' ), $prio );
127
+ remove_action( 'deleted_post_meta', array( $this, 'unset_optimization' ), $prio );
128
+ remove_action( 'before_imagify_update_metadata_size', array( __CLASS__, 'prevent_optimization' ), 5 );
129
+ remove_action( 'after_imagify_update_metadata_size', array( __CLASS__, 'allow_optimization' ), 5 );
130
+ }
131
+
132
+
133
+ /** ----------------------------------------------------------------------------------------- */
134
+ /** HOOKS =================================================================================== */
135
+ /** ----------------------------------------------------------------------------------------- */
136
+
137
+ /**
138
+ * Store the ID of attachments that just have been uploaded.
139
+ * We use those IDs to tell the difference later in `wp_update_attachment_metadata()`.
140
+ *
141
+ * @since 1.8.4
142
+ * @access public
143
+ * @see $this->store_ids_to_optimize()
144
+ * @author Grégory Viguier
145
+ *
146
+ * @param int $attachment_id Current attachment ID.
147
+ */
148
+ public function store_upload_ids( $attachment_id ) {
149
+ if ( ! self::is_optimization_prevented( $attachment_id ) && imagify_is_attachment_mime_type_supported( $attachment_id ) ) {
150
+ $this->uploads[ $attachment_id ] = 1;
151
+ }
152
+ }
153
+
154
+ /**
155
+ * After the attachment meta data has been generated, launch an async optimization.
156
+ * Two cases are possible to trigger the optimization:
157
+ * - It's a new upload and auto-optimization is enabled.
158
+ * - It's not a new upload (it is regenerated) and the attachment is already optimized.
159
+ *
160
+ * @since 1.8.4
161
+ * @access public
162
+ * @see $this->store_upload_ids()
163
+ * @author Grégory Viguier
164
+ *
165
+ * @param array $metadata An array of attachment meta data.
166
+ * @param int $attachment_id Current attachment ID.
167
+ * @return array
168
+ */
169
+ public function store_ids_to_optimize( $metadata, $attachment_id ) {
170
+ static $auto_optimize;
171
+
172
+ if ( self::is_optimization_prevented( $attachment_id ) ) {
173
+ return $metadata;
174
+ }
175
+
176
+ $is_new_upload = ! empty( $this->uploads[ $attachment_id ] );
177
+ unset( $this->uploads[ $attachment_id ] );
178
+
179
+ if ( ! $metadata || ! imagify_is_attachment_mime_type_supported( $attachment_id ) ) {
180
+ return $metadata;
181
+ }
182
+
183
+ if ( $is_new_upload ) {
184
+ // It's a new upload.
185
+ if ( ! isset( $auto_optimize ) ) {
186
+ $auto_optimize = get_imagify_option( 'auto_optimize' );
187
+ }
188
+
189
+ if ( ! $auto_optimize ) {
190
+ /**
191
+ * Fires when a new attachment is uploaded but auto-optimization is disabled.
192
+ *
193
+ * @since 1.8.4
194
+ * @author Grégory Viguier
195
+ *
196
+ * @param int $attachment_id Attachment ID.
197
+ * @param array $metadata An array of attachment meta data.
198
+ */
199
+ do_action( 'imagify_new_attachment_auto_optimization_disabled', $attachment_id, $metadata );
200
+
201
+ return $metadata;
202
+ }
203
+
204
+ /**
205
+ * Allow to prevent automatic optimization for a specific attachment.
206
+ *
207
+ * @since 1.6.12
208
+ * @author Grégory Viguier
209
+ *
210
+ * @param bool $optimize True to optimize, false otherwise.
211
+ * @param int $attachment_id Attachment ID.
212
+ * @param array $metadata An array of attachment meta data.
213
+ */
214
+ $optimize = apply_filters( 'imagify_auto_optimize_attachment', true, $attachment_id, $metadata );
215
+
216
+ if ( ! $optimize ) {
217
+ return $metadata;
218
+ }
219
+
220
+ /**
221
+ * It's a new upload and auto-optimization is enabled.
222
+ */
223
+ }
224
+
225
+ if ( ! $is_new_upload ) {
226
+ // An existing attachment being regenerated (or something).
227
+ $attachment = get_imagify_attachment( 'wp', $attachment_id, 'auto_optimization' );
228
+
229
+ if ( ! $attachment->get_data() ) {
230
+ /**
231
+ * Fires when an attachment is updated but not optimized yet.
232
+ *
233
+ * @since 1.8.4
234
+ * @author Grégory Viguier
235
+ *
236
+ * @param int $attachment_id Attachment ID.
237
+ * @param array $metadata An array of attachment meta data.
238
+ */
239
+ do_action( 'imagify_not_optimized_attachment_updated', $attachment_id, $metadata );
240
+
241
+ return $metadata;
242
+ }
243
+
244
+ /**
245
+ * Allow to prevent automatic reoptimization for a specific attachment.
246
+ *
247
+ * @since 1.8.4
248
+ * @author Grégory Viguier
249
+ *
250
+ * @param bool $optimize True to optimize, false otherwise.
251
+ * @param int $attachment_id Attachment ID.
252
+ * @param array $metadata An array of attachment meta data.
253
+ */
254
+ $optimize = apply_filters( 'imagify_auto_optimize_optimized_attachment', true, $attachment_id, $metadata );
255
+
256
+ if ( ! $optimize ) {
257
+ return $metadata;
258
+ }
259
+
260
+ /**
261
+ * The attachment already exists and was already optimized.
262
+ */
263
+ }
264
+
265
+ // Ready for the next step.
266
+ $this->attachments[ $attachment_id ] = $is_new_upload;
267
+
268
+ return $metadata;
269
+ }
270
+
271
+ /**
272
+ * Launch auto optimization immediately after the post meta '_wp_attachment_metadata' is added or updated.
273
+ *
274
+ * @since 1.8.4
275
+ * @access public
276
+ * @author Grégory Viguier
277
+ *
278
+ * @param int $meta_id ID of the metadata entry.
279
+ * @param int $attachment_id Current attachment ID.
280
+ * @param string $meta_key Meta key.
281
+ * @param mixed $metadata Meta value.
282
+ */
283
+ public function do_auto_optimization( $meta_id, $attachment_id, $meta_key, $metadata ) {
284
+ if ( '_wp_attachment_metadata' !== $meta_key || ! isset( $this->attachments[ $attachment_id ] ) ) {
285
+ return;
286
+ }
287
+
288
+ if ( self::is_optimization_prevented( $attachment_id ) ) {
289
+ return;
290
+ }
291
+
292
+ $is_new_upload = $this->attachments[ $attachment_id ];
293
+ unset( $this->attachments[ $attachment_id ] );
294
+
295
+ // Some specifics for the image editor.
296
+ if ( isset( $_POST['action'], $_POST['do'], $_POST['postid'] ) && 'image-editor' === $_POST['action'] && (int) $_POST['postid'] === $attachment_id ) { // WPCS: CSRF ok.
297
+ check_ajax_referer( 'image_editor-' . $attachment_id );
298
+
299
+ if ( ! current_user_can( 'edit_post', $attachment_id ) ) {
300
+ imagify_die();
301
+ }
302
+
303
+ $data = $_POST;
304
+ } else {
305
+ $data = array();
306
+ }
307
+
308
+ // Instead of using user permissions, use a transient.
309
+ set_transient( 'imagify-auto-optimize-' . $attachment_id, 1, 60 );
310
+
311
+ /**
312
+ * Fires before an attachment auto-optimization is triggered.
313
+ *
314
+ * @since 1.8.4
315
+ * @author Grégory Viguier
316
+ *
317
+ * @param int $attachment_id The attachment ID.
318
+ * @param bool $is_new_upload True if it's a new upload. False otherwize.
319
+ */
320
+ do_action( 'imagify_before_auto_optimization_launch', $attachment_id, $is_new_upload );
321
+
322
+ imagify_do_async_job( array(
323
+ 'action' => 'imagify_auto_optimize',
324
+ '_ajax_nonce' => wp_create_nonce( 'imagify_auto_optimize-' . $attachment_id ),
325
+ 'attachment_id' => $attachment_id,
326
+ 'is_new_upload' => $is_new_upload,
327
+ 'context' => 'wp',
328
+ 'data' => $data,
329
+ ) );
330
+ }
331
+
332
+ /**
333
+ * Remove the attachment ID from the $attachments property if the post meta '_wp_attachment_metadata' is deleted.
334
+ *
335
+ * @since 1.8.4
336
+ * @access public
337
+ * @author Grégory Viguier
338
+ *
339
+ * @param int $meta_ids An array of deleted metadata entry IDs.
340
+ * @param int $attachment_id Current attachment ID.
341
+ * @param string $meta_key Meta key.
342
+ */
343
+ public function unset_optimization( $meta_ids, $attachment_id, $meta_key ) {
344
+ if ( '_wp_attachment_metadata' !== $meta_key || ! isset( $this->attachments[ $attachment_id ] ) ) {
345
+ return;
346
+ }
347
+
348
+ unset( $this->attachments[ $attachment_id ] );
349
+ }
350
+
351
+
352
+ /** ----------------------------------------------------------------------------------------- */
353
+ /** TOOLS =================================================================================== */
354
+ /** ----------------------------------------------------------------------------------------- */
355
+
356
+ /**
357
+ * Prevent an auto-optimization locally.
358
+ * How to use it:
359
+ * Imagify_Auto_Optimization::prevent_optimization( $attachment_id );
360
+ * wp_update_attachment_metadata( $attachment_id );
361
+ * Imagify_Auto_Optimization::allow_optimization( $attachment_id );
362
+ *
363
+ * @since 1.8.4
364
+ * @access public
365
+ * @author Grégory Viguier
366
+ *
367
+ * @param int $attachment_id Current attachment ID.
368
+ */
369
+ public static function prevent_optimization( $attachment_id ) {
370
+ self::$prevented[ $attachment_id ] = 1;
371
+ }
372
+
373
+ /**
374
+ * Allow an auto-optimization locally.
375
+ * How to use it:
376
+ * Imagify_Auto_Optimization::prevent_optimization( $attachment_id );
377
+ * wp_update_attachment_metadata( $attachment_id );
378
+ * Imagify_Auto_Optimization::allow_optimization( $attachment_id );
379
+ *
380
+ * @since 1.8.4
381
+ * @access public
382
+ * @author Grégory Viguier
383
+ *
384
+ * @param int $attachment_id Current attachment ID.
385
+ */
386
+ public static function allow_optimization( $attachment_id ) {
387
+ unset( self::$prevented[ $attachment_id ] );
388
+ }
389
+
390
+ /**
391
+ * Tell if an auto-optimization is prevented locally.
392
+ *
393
+ * @since 1.8.4
394
+ * @access public
395
+ * @author Grégory Viguier
396
+ *
397
+ * @param int $attachment_id Current attachment ID.
398
+ * @return bool
399
+ */
400
+ public static function is_optimization_prevented( $attachment_id ) {
401
+ return ! empty( self::$prevented[ $attachment_id ] );
402
+ }
403
+ }
inc/classes/class-imagify-cron-library-size.php CHANGED
File without changes
inc/classes/class-imagify-cron-rating.php CHANGED
File without changes
inc/classes/class-imagify-cron-sync-files.php CHANGED
File without changes
inc/classes/class-imagify-custom-folders.php CHANGED
File without changes
inc/classes/class-imagify-data.php CHANGED
File without changes
inc/classes/class-imagify-db.php CHANGED
File without changes
inc/classes/class-imagify-file-attachment.php CHANGED
File without changes
inc/classes/class-imagify-files-db.php CHANGED
File without changes
inc/classes/class-imagify-files-iterator.php CHANGED
File without changes
inc/classes/class-imagify-files-recursive-iterator.php CHANGED
File without changes
inc/classes/class-imagify-files-scan.php CHANGED
File without changes
inc/classes/class-imagify-files-stats.php CHANGED
File without changes
inc/classes/class-imagify-filesystem.php CHANGED
@@ -759,6 +759,8 @@ class Imagify_Filesystem extends WP_Filesystem_Direct {
759
  $root_path = apply_filters( 'imagify_site_root', null );
760
 
761
  if ( is_string( $root_path ) ) {
 
 
762
  return $root_path;
763
  }
764
 
759
  $root_path = apply_filters( 'imagify_site_root', null );
760
 
761
  if ( is_string( $root_path ) ) {
762
+ $root_path = trailingslashit( wp_normalize_path( $root_path ) );
763
+
764
  return $root_path;
765
  }
766
 
inc/classes/class-imagify-folders-db.php CHANGED
File without changes
inc/classes/class-imagify-options.php CHANGED
File without changes
inc/classes/class-imagify-requirements.php CHANGED
File without changes
inc/classes/class-imagify-settings.php CHANGED
File without changes
inc/classes/class-imagify-views.php CHANGED
File without changes
inc/classes/class-imagify.php CHANGED
@@ -11,7 +11,7 @@ class Imagify extends Imagify_Deprecated {
11
  *
12
  * @var string
13
  */
14
- const VERSION = '1.1.2';
15
  /**
16
  * The Imagify API endpoint.
17
  *
@@ -26,6 +26,13 @@ class Imagify extends Imagify_Deprecated {
26
  */
27
  private $api_key = '';
28
 
 
 
 
 
 
 
 
29
  /**
30
  * HTTP headers. Each http call must fill it (even if it's with an empty array).
31
  *
@@ -69,6 +76,7 @@ class Imagify extends Imagify_Deprecated {
69
  }
70
 
71
  $this->api_key = get_imagify_option( 'api_key' );
 
72
  $this->filesystem = Imagify_Filesystem::get_instance();
73
 
74
  $this->all_headers['Accept'] = 'Accept: application/json';
@@ -408,6 +416,15 @@ class Imagify extends Imagify_Deprecated {
408
  }
409
  }
410
 
 
 
 
 
 
 
 
 
 
411
  $response = wp_remote_request( self::API_ENDPOINT . $url, $args );
412
 
413
  if ( is_wp_error( $response ) ) {
@@ -440,7 +457,11 @@ class Imagify extends Imagify_Deprecated {
440
  $url = self::API_ENDPOINT . $url;
441
 
442
  try {
443
- $ch = curl_init();
 
 
 
 
444
 
445
  if ( isset( $args['post_data']['image'] ) && is_string( $args['post_data']['image'] ) && $this->filesystem->exists( $args['post_data']['image'] ) ) {
446
  $args['post_data']['image'] = curl_file_create( $args['post_data']['image'] );
@@ -495,7 +516,7 @@ class Imagify extends Imagify_Deprecated {
495
  */
496
  do_action( 'imagify_curl_http_response', $url, $args, $e );
497
 
498
- return new WP_Error( 'curl', 'Unknown error occurred' );
499
  } // End try().
500
 
501
  $args['headers'] = $this->headers;
@@ -555,9 +576,59 @@ class Imagify extends Imagify_Deprecated {
555
  if ( 200 !== $http_code ) {
556
  $error = trim( (string) $error );
557
  $error = '' !== $error ? ' - ' . htmlentities( $error ) : '';
558
- return new WP_Error( $http_code, "Unknown error occurred ({$http_code}{$error})" );
559
  }
560
 
561
  return $response;
562
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
563
  }
11
  *
12
  * @var string
13
  */
14
+ const VERSION = '1.2';
15
  /**
16
  * The Imagify API endpoint.
17
  *
26
  */
27
  private $api_key = '';
28
 
29
+ /**
30
+ * Random key used to store the API key in the request args.
31
+ *
32
+ * @var string
33
+ */
34
+ private $secure_key = '';
35
+
36
  /**
37
  * HTTP headers. Each http call must fill it (even if it's with an empty array).
38
  *
76
  }
77
 
78
  $this->api_key = get_imagify_option( 'api_key' );
79
+ $this->secure_key = $this->generate_secure_key();
80
  $this->filesystem = Imagify_Filesystem::get_instance();
81
 
82
  $this->all_headers['Accept'] = 'Accept: application/json';
416
  }
417
  }
418
 
419
+ if ( ! empty( $args['headers']['Authorization'] ) ) {
420
+ // Make sure our API has not overwritten by some other plugin.
421
+ $args[ $this->secure_key ] = preg_replace( '/^token /', '', $args['headers']['Authorization'] );
422
+
423
+ if ( ! has_filter( 'http_request_args', array( $this, 'force_api_key_header' ) ) ) {
424
+ add_filter( 'http_request_args', array( $this, 'force_api_key_header' ), IMAGIFY_INT_MAX + 25, 2 );
425
+ }
426
+ }
427
+
428
  $response = wp_remote_request( self::API_ENDPOINT . $url, $args );
429
 
430
  if ( is_wp_error( $response ) ) {
457
  $url = self::API_ENDPOINT . $url;
458
 
459
  try {
460
+ $ch = @curl_init();
461
+
462
+ if ( ! is_resource( $ch ) ) {
463
+ throw new Exception( 'Could not initialize a new cURL handle' );
464
+ }
465
 
466
  if ( isset( $args['post_data']['image'] ) && is_string( $args['post_data']['image'] ) && $this->filesystem->exists( $args['post_data']['image'] ) ) {
467
  $args['post_data']['image'] = curl_file_create( $args['post_data']['image'] );
516
  */
517
  do_action( 'imagify_curl_http_response', $url, $args, $e );
518
 
519
+ return new WP_Error( 'curl', 'An error occurred (' . $e->getMessage() . ')' );
520
  } // End try().
521
 
522
  $args['headers'] = $this->headers;
576
  if ( 200 !== $http_code ) {
577
  $error = trim( (string) $error );
578
  $error = '' !== $error ? ' - ' . htmlentities( $error ) : '';
579
+ return new WP_Error( $http_code, "An error occurred ({$http_code}{$error})" );
580
  }
581
 
582
  return $response;
583
  }
584
+
585
+ /**
586
+ * Generate a random key.
587
+ * Similar to wp_generate_password() but without filter.
588
+ *
589
+ * @access private
590
+ * @since 1.8.4
591
+ * @see wp_generate_password()
592
+ * @author Grégory Viguier
593
+ *
594
+ * @return string
595
+ */
596
+ private function generate_secure_key() {
597
+ $length = wp_rand( 12, 20 );
598
+ $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_ []{}<>~`+=,.;:/?|';
599
+ $password = '';
600
+
601
+ for ( $i = 0; $i < $length; $i++ ) {
602
+ $password .= substr( $chars, wp_rand( 0, strlen( $chars ) - 1 ), 1 );
603
+ }
604
+
605
+ return $password;
606
+ }
607
+
608
+ /**
609
+ * Filter the arguments used in an HTTP request, to make sure our API key has not been overwritten by some other plugin.
610
+ *
611
+ * @access public
612
+ * @since 1.8.4
613
+ * @author Grégory Viguier
614
+ *
615
+ * @param array $args An array of HTTP request arguments.
616
+ * @param string $url The request URL.
617
+ * @return array
618
+ */
619
+ public function force_api_key_header( $args, $url ) {
620
+ if ( strpos( $url, self::API_ENDPOINT ) === false ) {
621
+ return $args;
622
+ }
623
+
624
+ if ( ! empty( $args['headers']['Authorization'] ) || ! empty( $args[ $this->secure_key ] ) ) {
625
+ if ( ! empty( $args[ $this->secure_key ] ) ) {
626
+ $args['headers']['Authorization'] = 'token ' . $args[ $this->secure_key ];
627
+ } else {
628
+ $args['headers']['Authorization'] = 'token ' . $this->api_key;
629
+ }
630
+ }
631
+
632
+ return $args;
633
+ }
634
  }
inc/common/attachments.php CHANGED
@@ -1,49 +1,6 @@
1
  <?php
2
  defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
3
 
4
- add_filter( 'wp_generate_attachment_metadata', '_imagify_optimize_attachment', IMAGIFY_INT_MAX, 2 );
5
- /**
6
- * Auto-optimize when a new attachment is generated.
7
- *
8
- * @since 1.0
9
- * @since 1.5 Async job.
10
- * @see Imagify_Admin_Ajax_Post::imagify_async_optimize_upload_new_media_callback()
11
- *
12
- * @param array $metadata An array of attachment meta data.
13
- * @param int $attachment_id Current attachment ID.
14
- * @return array
15
- */
16
- function _imagify_optimize_attachment( $metadata, $attachment_id ) {
17
-
18
- if ( ! Imagify_Requirements::is_api_key_valid() || ! get_imagify_option( 'auto_optimize' ) ) {
19
- return $metadata;
20
- }
21
-
22
- /**
23
- * Allow to prevent automatic optimization for a specific attachment.
24
- *
25
- * @since 1.6.12
26
- * @author Grégory Viguier
27
- *
28
- * @param bool $optimize True to optimize, false otherwise.
29
- * @param int $attachment_id Attachment ID.
30
- * @param array $metadata An array of attachment meta data.
31
- */
32
- $optimize = apply_filters( 'imagify_auto_optimize_attachment', true, $attachment_id, $metadata );
33
-
34
- if ( ! $optimize ) {
35
- return $metadata;
36
- }
37
-
38
- $context = 'wp';
39
- $action = 'imagify_async_optimize_upload_new_media';
40
- $_ajax_nonce = wp_create_nonce( 'new_media-' . $attachment_id );
41
-
42
- imagify_do_async_job( compact( 'action', '_ajax_nonce', 'metadata', 'attachment_id', 'context' ) );
43
-
44
- return $metadata;
45
- }
46
-
47
  add_action( 'delete_attachment', '_imagify_delete_backup_file' );
48
  /**
49
  * Delete the backup file when an attachement is deleted.
@@ -55,35 +12,3 @@ add_action( 'delete_attachment', '_imagify_delete_backup_file' );
55
  function _imagify_delete_backup_file( $post_id ) {
56
  get_imagify_attachment( 'wp', $post_id, 'delete_attachment' )->delete_backup();
57
  }
58
-
59
- add_action( 'shutdown', '_imagify_optimize_save_image_editor_file' );
60
- /**
61
- * Optimize an attachment after being resized.
62
- *
63
- * @since 1.3.6
64
- * @since 1.4 Async job.
65
- */
66
- function _imagify_optimize_save_image_editor_file() {
67
- if ( ! isset( $_POST['action'], $_POST['do'], $_POST['postid'] ) || 'image-editor' !== $_POST['action'] || 'open' === $_POST['do'] ) { // WPCS: CSRF ok.
68
- return;
69
- }
70
-
71
- $attachment_id = absint( $_POST['postid'] );
72
-
73
- if ( ! $attachment_id || ! Imagify_Requirements::is_api_key_valid() ) {
74
- return;
75
- }
76
-
77
- check_ajax_referer( 'image_editor-' . $attachment_id );
78
-
79
- $attachment = get_imagify_attachment( 'wp', $attachment_id, 'save_image_editor_file' );
80
-
81
- if ( ! $attachment->get_data() ) {
82
- return;
83
- }
84
-
85
- $body = $_POST;
86
- $body['action'] = 'imagify_async_optimize_save_image_editor_file';
87
-
88
- imagify_do_async_job( $body );
89
- }
1
  <?php
2
  defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  add_action( 'delete_attachment', '_imagify_delete_backup_file' );
5
  /**
6
  * Delete the backup file when an attachement is deleted.
12
  function _imagify_delete_backup_file( $post_id ) {
13
  get_imagify_attachment( 'wp', $post_id, 'delete_attachment' )->delete_backup();
14
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/functions/admin-ui.php CHANGED
File without changes
inc/functions/api.php CHANGED
@@ -207,6 +207,7 @@ function imagify_translate_api_message( $message ) {
207
 
208
  $messages = array(
209
  // Local messages from Imagify::curl_http_call() and Imagify::handle_response().
 
210
  'Unknown error occurred' => __( 'Unknown error occurred.', 'imagify' ),
211
  'Your image is too big to be uploaded on our server' => __( 'Your file is too big to be uploaded on our server.', 'imagify' ),
212
  'cURL isn\'t installed on the server' => __( 'cURL is not available on the server.', 'imagify' ),
@@ -238,9 +239,9 @@ function imagify_translate_api_message( $message ) {
238
  }
239
 
240
  // Local message.
241
- if ( preg_match( '@^Unknown error occurred \((\d+)(.*?)\)$@', $trim_message, $matches ) ) {
242
- /* translators: 1 is a http status code, 2 is an error message. */
243
- return sprintf( __( 'Unknown error occurred (%1$d%2$s).', 'imagify' ), $matches[1], esc_html( strip_tags( $matches[2] ) ) );
244
  }
245
 
246
  // API message.
207
 
208
  $messages = array(
209
  // Local messages from Imagify::curl_http_call() and Imagify::handle_response().
210
+ 'Could not initialize a new cURL handle' => __( 'Could not initialize a new cURL handle.', 'imagify' ),
211
  'Unknown error occurred' => __( 'Unknown error occurred.', 'imagify' ),
212
  'Your image is too big to be uploaded on our server' => __( 'Your file is too big to be uploaded on our server.', 'imagify' ),
213
  'cURL isn\'t installed on the server' => __( 'cURL is not available on the server.', 'imagify' ),
239
  }
240
 
241
  // Local message.
242
+ if ( preg_match( '@^(?:Unknown|An) error occurred \((.+)\)$@', $trim_message, $matches ) ) {
243
+ /* translators: %s is an error message. */
244
+ return sprintf( __( 'An error occurred (%s).', 'imagify' ), esc_html( strip_tags( $matches[1] ) ) );
245
  }
246
 
247
  // API message.
inc/functions/common.php CHANGED
@@ -197,6 +197,7 @@ function imagify_autoload( $class ) {
197
  'Imagify_Admin_Ajax_Post' => 1,
198
  'Imagify_Assets' => 1,
199
  'Imagify_Attachment' => 1,
 
200
  'Imagify_Cron_Library_Size' => 1,
201
  'Imagify_Cron_Rating' => 1,
202
  'Imagify_Cron_Sync_Files' => 1,
@@ -306,6 +307,10 @@ function imagify_get_external_url( $target, $query_args = array() ) {
306
  $url = $site_url . 'documentation/';
307
  break;
308
 
 
 
 
 
309
  case 'register':
310
  $partner = imagify_get_partner();
311
 
197
  'Imagify_Admin_Ajax_Post' => 1,
198
  'Imagify_Assets' => 1,
199
  'Imagify_Attachment' => 1,
200
+ 'Imagify_Auto_Optimization' => 1,
201
  'Imagify_Cron_Library_Size' => 1,
202
  'Imagify_Cron_Rating' => 1,
203
  'Imagify_Cron_Sync_Files' => 1,
307
  $url = $site_url . 'documentation/';
308
  break;
309
 
310
+ case 'documentation-imagick-gd':
311
+ $url = $site_url . 'documentation/solve-imagemagick-gd-required/';
312
+ break;
313
+
314
  case 'register':
315
  $partner = imagify_get_partner();
316
 
inc/functions/deprecated.php CHANGED
@@ -337,6 +337,155 @@ class Imagify_AS3CF_Deprecated {
337
 
338
  return imagify_is_attachment_mime_type_supported( $post_id );
339
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  }
341
 
342
  /**
@@ -366,6 +515,179 @@ class Imagify_Notices_Deprecated {
366
  }
367
  }
368
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
369
  if ( class_exists( 'WpeCommon' ) ) :
370
 
371
  /**
@@ -994,6 +1316,86 @@ function is_imagify_servers_up() {
994
  return Imagify_Requirements::is_api_up();
995
  }
996
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
997
  if ( is_admin() ) :
998
 
999
  /**
337
 
338
  return imagify_is_attachment_mime_type_supported( $post_id );
339
  }
340
+
341
+
342
+ /** ----------------------------------------------------------------------------------------- */
343
+ /** AUTOMATIC OPTIMIZATION: OPTIMIZE AFTER S3 HAS DONE ITS WORK ============================= */
344
+ /** ----------------------------------------------------------------------------------------- */
345
+
346
+ /**
347
+ * Filter the generated attachment meta data.
348
+ * This is used when a new attachment has just been uploaded (or not, when wp_generate_attachment_metadata() is used).
349
+ * We use it to tell the difference later in wp_update_attachment_metadata().
350
+ *
351
+ * @since 1.6.6
352
+ * @since 1.8.4 Deprecated
353
+ * @author Grégory Viguier
354
+ * @see $this->do_async_job()
355
+ * @deprecated
356
+ *
357
+ * @param array $metadata An array of attachment meta data.
358
+ * @param int $attachment_id Current attachment ID.
359
+ * @return array
360
+ */
361
+ public function store_upload_ids( $metadata, $attachment_id ) {
362
+ _deprecated_function( get_class( $this ) . '::' . __FUNCTION__ . '()', '1.8.4', 'Imagify_Auto_Optimization::get_instance()->store_upload_ids( $attachment_id )' );
363
+
364
+ if ( imagify_is_attachment_mime_type_supported( $attachment_id ) ) {
365
+ $this->uploads[ $attachment_id ] = 1;
366
+ }
367
+
368
+ return $metadata;
369
+ }
370
+
371
+ /**
372
+ * After an image (maybe) being sent to S3, launch an async optimization.
373
+ *
374
+ * @since 1.6.6
375
+ * @since 1.8.4 Deprecated
376
+ * @author Grégory Viguier
377
+ * @see $this->store_upload_ids()
378
+ * @deprecated
379
+ *
380
+ * @param array $metadata An array of attachment meta data.
381
+ * @param int $attachment_id Current attachment ID.
382
+ * @return array
383
+ */
384
+ public function do_async_job( $metadata, $attachment_id ) {
385
+ static $auto_optimize;
386
+
387
+ _deprecated_function( get_class( $this ) . '::' . __FUNCTION__ . '()', '1.8.4', 'Imagify_Auto_Optimization::get_instance()->do_auto_optimization( $meta_id, $attachment_id, $meta_key, $metadata )' );
388
+
389
+ $is_new_upload = ! empty( $this->uploads[ $attachment_id ] );
390
+ unset( $this->uploads[ $attachment_id ] );
391
+
392
+ if ( ! $metadata || ! imagify_is_attachment_mime_type_supported( $attachment_id ) ) {
393
+ return $metadata;
394
+ }
395
+
396
+ if ( ! isset( $auto_optimize ) ) {
397
+ $auto_optimize = Imagify_Requirements::is_api_key_valid() && get_imagify_option( 'auto_optimize' );
398
+ }
399
+
400
+ if ( $is_new_upload ) {
401
+ // It's a new upload.
402
+ if ( ! $auto_optimize ) {
403
+ // Auto-optimization is disabled.
404
+ return $metadata;
405
+ }
406
+
407
+ /** This filter is documented in inc/common/attachments.php. */
408
+ $optimize = apply_filters( 'imagify_auto_optimize_attachment', true, $attachment_id, $metadata );
409
+
410
+ if ( ! $optimize ) {
411
+ return $metadata;
412
+ }
413
+ }
414
+
415
+ if ( ! $is_new_upload ) {
416
+ $attachment = get_imagify_attachment( self::CONTEXT, $attachment_id, 'as3cf_async_job' );
417
+
418
+ if ( ! $attachment->get_data() ) {
419
+ // It's not a new upload and the attachment is not optimized yet.
420
+ return $metadata;
421
+ }
422
+ }
423
+
424
+ $data = array();
425
+
426
+ // Some specifics for the image editor.
427
+ if ( isset( $_POST['action'], $_POST['do'], $_POST['postid'] ) && 'image-editor' === $_POST['action'] && (int) $_POST['postid'] === $attachment_id ) { // WPCS: CSRF ok.
428
+ check_ajax_referer( 'image_editor-' . $_POST['postid'] );
429
+ $data = $_POST;
430
+ }
431
+
432
+ imagify_do_async_job( array(
433
+ 'action' => 'imagify_async_optimize_as3cf',
434
+ '_ajax_nonce' => wp_create_nonce( 'imagify_async_optimize_as3cf' ),
435
+ 'post_id' => $attachment_id,
436
+ 'metadata' => $metadata,
437
+ 'data' => $data,
438
+ ) );
439
+
440
+ return $metadata;
441
+ }
442
+
443
+ /**
444
+ * Once an image has been sent to S3, optimize it and send it again.
445
+ *
446
+ * @since 1.6.6
447
+ * @since 1.8.4 Deprecated
448
+ * @author Grégory Viguier
449
+ * @deprecated
450
+ */
451
+ public function optimize() {
452
+ _deprecated_function( get_class( $this ) . '::' . __FUNCTION__ . '()', '1.8.4', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_auto_optimize_callback()' );
453
+
454
+ check_ajax_referer( 'imagify_async_optimize_as3cf' );
455
+
456
+ if ( empty( $_POST['post_id'] ) || ! imagify_current_user_can( 'auto-optimize' ) ) {
457
+ die();
458
+ }
459
+
460
+ $attachment_id = absint( $_POST['post_id'] );
461
+
462
+ if ( ! $attachment_id || empty( $_POST['metadata'] ) || ! is_array( $_POST['metadata'] ) || empty( $_POST['metadata']['sizes'] ) ) {
463
+ die();
464
+ }
465
+
466
+ if ( ! imagify_is_attachment_mime_type_supported( $attachment_id ) ) {
467
+ die();
468
+ }
469
+
470
+ $optimization_level = null;
471
+ $attachment = get_imagify_attachment( self::CONTEXT, $attachment_id, 'as3cf_optimize' );
472
+
473
+ // Some specifics for the image editor.
474
+ if ( ! empty( $_POST['data']['do'] ) ) {
475
+ $optimization_level = $attachment->get_optimization_level();
476
+
477
+ // Remove old optimization data.
478
+ $attachment->delete_imagify_data();
479
+
480
+ if ( 'restore' === $_POST['data']['do'] ) {
481
+ // Restore the backup file.
482
+ $attachment->restore();
483
+ }
484
+ }
485
+
486
+ // Optimize it.
487
+ $attachment->optimize( $optimization_level, $_POST['metadata'] );
488
+ }
489
  }
490
 
491
  /**
515
  }
516
  }
517
 
518
+ /**
519
+ * Class for deprecated methods from Imagify_Admin_Ajax_Post.
520
+ *
521
+ * @since 1.8.4
522
+ * @author Grégory Viguier
523
+ * @deprecated
524
+ */
525
+ class Imagify_Admin_Ajax_Post_Deprecated {
526
+
527
+ /**
528
+ * Optimize image on picture uploading with async request.
529
+ *
530
+ * @since 1.6.11
531
+ * @since 1.8.4 Deprecated
532
+ * @access public
533
+ * @author Julio Potier
534
+ * @see _imagify_optimize_attachment()
535
+ * @deprecated
536
+ */
537
+ public function imagify_async_optimize_upload_new_media_callback() {
538
+ _deprecated_function( get_class( $this ) . '::' . __FUNCTION__ . '()', '1.8.4', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_auto_optimize_callback()' );
539
+
540
+ if ( empty( $_POST['_ajax_nonce'] ) || empty( $_POST['attachment_id'] ) || empty( $_POST['metadata'] ) || empty( $_POST['context'] ) ) { // WPCS: CSRF ok.
541
+ return;
542
+ }
543
+
544
+ $context = imagify_sanitize_context( $_POST['context'] );
545
+ $attachment_id = absint( $_POST['attachment_id'] );
546
+
547
+ imagify_check_nonce( 'new_media-' . $attachment_id );
548
+ imagify_check_user_capacity( 'auto-optimize' );
549
+
550
+ $attachment = get_imagify_attachment( $context, $attachment_id, 'imagify_async_optimize_upload_new_media' );
551
+
552
+ // Optimize it!!!!!
553
+ $attachment->optimize( null, $_POST['metadata'] );
554
+ die( 1 );
555
+ }
556
+
557
+ /**
558
+ * Optimize image on picture editing (resize, crop...) with async request.
559
+ *
560
+ * @since 1.6.11
561
+ * @since 1.8.4 Deprecated
562
+ * @access public
563
+ * @author Julio Potier
564
+ * @deprecated
565
+ */
566
+ public function imagify_async_optimize_save_image_editor_file_callback() {
567
+ _deprecated_function( get_class( $this ) . '::' . __FUNCTION__ . '()', '1.8.4', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_auto_optimize_callback()' );
568
+
569
+ $attachment_id = ! empty( $_POST['postid'] ) ? absint( $_POST['postid'] ) : 0;
570
+
571
+ if ( ! $attachment_id || empty( $_POST['do'] ) ) {
572
+ return;
573
+ }
574
+
575
+ imagify_check_nonce( 'image_editor-' . $attachment_id );
576
+ imagify_check_user_capacity( 'edit_post', $attachment_id );
577
+
578
+ $attachment = get_imagify_attachment( 'wp', $attachment_id, 'wp_ajax_imagify_async_optimize_save_image_editor_file' );
579
+
580
+ if ( ! $attachment->get_data() ) {
581
+ return;
582
+ }
583
+
584
+ $optimization_level = $attachment->get_optimization_level();
585
+ $metadata = wp_get_attachment_metadata( $attachment_id );
586
+
587
+ // Remove old optimization data.
588
+ $attachment->delete_imagify_data();
589
+
590
+ if ( 'restore' === $_POST['do'] ) {
591
+ // Restore the backup file.
592
+ $attachment->restore();
593
+
594
+ // Get old metadata to regenerate all thumbnails.
595
+ $metadata = array( 'sizes' => array() );
596
+ $backup_sizes = (array) get_post_meta( $attachment_id, '_wp_attachment_backup_sizes', true );
597
+
598
+ foreach ( $backup_sizes as $size_key => $size_data ) {
599
+ $size_key = str_replace( '-origin', '' , $size_key );
600
+ $metadata['sizes'][ $size_key ] = $size_data;
601
+ }
602
+ }
603
+
604
+ // Optimize it!!!!!
605
+ $attachment->optimize( $optimization_level, $metadata );
606
+ die( 1 );
607
+ }
608
+ }
609
+
610
+ /**
611
+ * Compat class for Enable Media Replace plugin.
612
+ *
613
+ * @since 1.8.4
614
+ * @author Grégory Viguier
615
+ * @deprecated
616
+ */
617
+ class Imagify_Enable_Media_Replace_Deprecated {
618
+
619
+ /**
620
+ * Filesystem object.
621
+ *
622
+ * @var object Imagify_Filesystem
623
+ * @since 1.7.1
624
+ * @since 1.8.4 Deprecated
625
+ * @author Grégory Viguier
626
+ * @access protected
627
+ */
628
+ protected $filesystem;
629
+
630
+ /**
631
+ * Optimize the attachment files if the old ones were also optimized.
632
+ * Delete the old backup file.
633
+ *
634
+ * @since 1.6.9
635
+ * @since 1.8.4 Deprecated
636
+ * @author Grégory Viguier
637
+ * @see $this->store_old_backup_path()
638
+ * @access protected
639
+ *
640
+ * @param string $return_url The URL the user will be redirected to.
641
+ * @return string The same URL.
642
+ */
643
+ public function optimize( $return_url ) {
644
+ _deprecated_function( get_class( $this ) . '::' . __FUNCTION__ . '()', '1.8.4' );
645
+
646
+ $attachment = $this->get_attachment();
647
+
648
+ if ( $attachment->get_data() ) {
649
+ /**
650
+ * The old images have been optimized in the past.
651
+ */
652
+ // Use the same otimization level for the new ones.
653
+ $optimization_level = $attachment->get_optimization_level();
654
+
655
+ // Remove old optimization data.
656
+ $attachment->delete_imagify_data();
657
+
658
+ // Optimize and overwrite the previous backup file if exists and needed.
659
+ add_filter( 'imagify_backup_overwrite_backup', '__return_true', 42 );
660
+ $attachment->optimize( $optimization_level );
661
+ remove_filter( 'imagify_backup_overwrite_backup', '__return_true', 42 );
662
+ }
663
+
664
+ $filesystem = Imagify_Filesystem::get_instance();
665
+
666
+ /**
667
+ * Delete the old backup file.
668
+ */
669
+ if ( ! $this->old_backup_path || ! $filesystem->exists( $this->old_backup_path ) ) {
670
+ // The user didn't choose to rename the files, or there is no old backup.
671
+ $this->old_backup_path = null;
672
+ return $return_url;
673
+ }
674
+
675
+ $new_backup_path = $attachment->get_raw_backup_path();
676
+
677
+ if ( $new_backup_path === $this->old_backup_path ) {
678
+ // We don't want to delete the new backup.
679
+ $this->old_backup_path = null;
680
+ return $return_url;
681
+ }
682
+
683
+ // Finally, delete the old backup file.
684
+ $filesystem->delete( $this->old_backup_path );
685
+
686
+ $this->old_backup_path = null;
687
+ return $return_url;
688
+ }
689
+ }
690
+
691
  if ( class_exists( 'WpeCommon' ) ) :
692
 
693
  /**
1316
  return Imagify_Requirements::is_api_up();
1317
  }
1318
 
1319
+ /**
1320
+ * Auto-optimize when a new attachment is generated.
1321
+ *
1322
+ * @since 1.0
1323
+ * @since 1.5 Async job.
1324
+ * @since 1.8.4 Deprecated
1325
+ * @see Imagify_Admin_Ajax_Post_Deprecated::imagify_async_optimize_upload_new_media_callback()
1326
+ * @deprecated
1327
+ *
1328
+ * @param array $metadata An array of attachment meta data.
1329
+ * @param int $attachment_id Current attachment ID.
1330
+ * @return array
1331
+ */
1332
+ function _imagify_optimize_attachment( $metadata, $attachment_id ) {
1333
+ _deprecated_function( __FUNCTION__ . '()', '1.8.4', 'Imagify_Auto_Optimization::get_instance()->store_upload_ids()' );
1334
+
1335
+ if ( ! Imagify_Requirements::is_api_key_valid() || ! get_imagify_option( 'auto_optimize' ) ) {
1336
+ return $metadata;
1337
+ }
1338
+
1339
+ /**
1340
+ * Allow to prevent automatic optimization for a specific attachment.
1341
+ *
1342
+ * @since 1.6.12
1343
+ * @author Grégory Viguier
1344
+ *
1345
+ * @param bool $optimize True to optimize, false otherwise.
1346
+ * @param int $attachment_id Attachment ID.
1347
+ * @param array $metadata An array of attachment meta data.
1348
+ */
1349
+ $optimize = apply_filters( 'imagify_auto_optimize_attachment', true, $attachment_id, $metadata );
1350
+
1351
+ if ( ! $optimize ) {
1352
+ return $metadata;
1353
+ }
1354
+
1355
+ $context = 'wp';
1356
+ $action = 'imagify_async_optimize_upload_new_media';
1357
+ $_ajax_nonce = wp_create_nonce( 'new_media-' . $attachment_id );
1358
+
1359
+ imagify_do_async_job( compact( 'action', '_ajax_nonce', 'metadata', 'attachment_id', 'context' ) );
1360
+
1361
+ return $metadata;
1362
+ }
1363
+
1364
+ /**
1365
+ * Optimize an attachment after being resized.
1366
+ *
1367
+ * @since 1.3.6
1368
+ * @since 1.4 Async job.
1369
+ * @since 1.8.4 Deprecated
1370
+ * @deprecated
1371
+ */
1372
+ function _imagify_optimize_save_image_editor_file() {
1373
+ _deprecated_function( __FUNCTION__ . '()', '1.8.4' );
1374
+
1375
+ if ( ! isset( $_POST['action'], $_POST['do'], $_POST['postid'] ) || 'image-editor' !== $_POST['action'] || 'open' === $_POST['do'] ) { // WPCS: CSRF ok.
1376
+ return;
1377
+ }
1378
+
1379
+ $attachment_id = absint( $_POST['postid'] );
1380
+
1381
+ if ( ! $attachment_id || ! Imagify_Requirements::is_api_key_valid() ) {
1382
+ return;
1383
+ }
1384
+
1385
+ check_ajax_referer( 'image_editor-' . $attachment_id );
1386
+
1387
+ $attachment = get_imagify_attachment( 'wp', $attachment_id, 'save_image_editor_file' );
1388
+
1389
+ if ( ! $attachment->get_data() ) {
1390
+ return;
1391
+ }
1392
+
1393
+ $body = $_POST;
1394
+ $body['action'] = 'imagify_async_optimize_save_image_editor_file';
1395
+
1396
+ imagify_do_async_job( $body );
1397
+ }
1398
+
1399
  if ( is_admin() ) :
1400
 
1401
  /**
inc/functions/i18n.php CHANGED
@@ -151,7 +151,11 @@ function get_imagify_localize_script_translations( $context ) {
151
  'error' => __( 'Error', 'imagify' ),
152
  ),
153
  'curlMissing' => __( 'cURL is not available on the server.', 'imagify' ),
154
- 'editorMissing' => __( 'No php extensions are available to edit images on the server.', 'imagify' ),
 
 
 
 
155
  'extHttpBlocked' => __( 'External HTTP requests are blocked.', 'imagify' ),
156
  'apiDown' => __( 'Sorry, our servers are temporarily unavailable. Please, try again in a couple of minutes.', 'imagify' ),
157
  'invalidAPIKeyTitle' => __( 'Your API key is not valid!', 'imagify' ),
151
  'error' => __( 'Error', 'imagify' ),
152
  ),
153
  'curlMissing' => __( 'cURL is not available on the server.', 'imagify' ),
154
+ 'editorMissing' => sprintf(
155
+ /* translators: %s is a "More info?" link. */
156
+ __( 'No php extensions are available to edit images on the server. ImageMagick or GD is required. %s', 'imagify' ),
157
+ '<a href="' . esc_url( imagify_get_external_url( 'documentation-imagick-gd' ) ) . '" target="_blank">' . __( 'More info?', 'imagify' ) . '</a>'
158
+ ),
159
  'extHttpBlocked' => __( 'External HTTP requests are blocked.', 'imagify' ),
160
  'apiDown' => __( 'Sorry, our servers are temporarily unavailable. Please, try again in a couple of minutes.', 'imagify' ),
161
  'invalidAPIKeyTitle' => __( 'Your API key is not valid!', 'imagify' ),
inc/functions/process.php CHANGED
@@ -47,7 +47,11 @@ function do_imagify( $file_path, $args = array() ) {
47
 
48
  // Check if imageMagick or GD is available.
49
  if ( $filesystem->is_image( $file_path ) && ! Imagify_Requirements::supports_image_editor() ) {
50
- return new WP_Error( 'image_editor', __( 'No php extensions are available to edit images on the server.', 'imagify' ) );
 
 
 
 
51
  }
52
 
53
  // Check if external HTTP requests are blocked.
47
 
48
  // Check if imageMagick or GD is available.
49
  if ( $filesystem->is_image( $file_path ) && ! Imagify_Requirements::supports_image_editor() ) {
50
+ return new WP_Error( 'image_editor', sprintf(
51
+ /* translators: %s is a "More info?" link. */
52
+ __( 'No php extensions are available to edit images on the server. ImageMagick or GD is required. %s', 'imagify' ),
53
+ '<a href="' . esc_url( imagify_get_external_url( 'documentation-imagick-gd' ) ) . '" target="_blank">' . __( 'More info?', 'imagify' ) . '</a>'
54
+ ) );
55
  }
56
 
57
  // Check if external HTTP requests are blocked.
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: wp_media, GregLone
3
  Tags: compress image, images, performance, optimization, photos, upload, resize, gif, png, jpg, reduce image size, retina
4
  Requires at least: 4.0.0
5
  Tested up to: 4.9.8
6
- Stable tag: 1.8.3
7
 
8
  Dramatically reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth.
9
 
@@ -138,7 +138,17 @@ When the plugin is disabled, your existing images remain optimized. Backups of t
138
  4. Other Media Page
139
 
140
  == Changelog ==
141
- = 1.8.3 - 2018/11/24 =
 
 
 
 
 
 
 
 
 
 
142
  * Improvement: compatibility with new version of WP Offload Media plugin.
143
  * Improvement: some wording about EXIF Data and the 2MB limit.
144
  * Bug Fix: the lock icon now displays correctly.
3
  Tags: compress image, images, performance, optimization, photos, upload, resize, gif, png, jpg, reduce image size, retina
4
  Requires at least: 4.0.0
5
  Tested up to: 4.9.8
6
+ Stable tag: 1.8.4
7
 
8
  Dramatically reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth.
9
 
138
  4. Other Media Page
139
 
140
  == Changelog ==
141
+ = 1.8.4 - 2018/11/12 =
142
+ * Improvement: automatic optimization is delayed further, it now happens after the image original data is stored in the database. This new process should be more reliable.
143
+ * Improvement: compatibility with wordpress.com.
144
+ * Improvement: some wording and typos in the plan suggestion tool.
145
+ * Improvement: improved wording and added a link to a new documentation entry for the case when no php extension are available for image manipulation.
146
+ * Improvement: prevent plugins from accidentally overwriting the header containing the API key when contacting our servers.
147
+ * Bug Fix: the handle in the original/optimized image comparator was a bit shy, but after some personal work it should stick to the cursor hopefully.
148
+ * Bug Fix: a php notice in the WP Retina 2x compatibility code.
149
+ * Bug Fix: handle a specific error case when contacting our servers fails.
150
+
151
+ = 1.8.3 - 2018/10/24 =
152
  * Improvement: compatibility with new version of WP Offload Media plugin.
153
  * Improvement: some wording about EXIF Data and the 2MB limit.
154
  * Bug Fix: the lock icon now displays correctly.
uninstall.php CHANGED
@@ -29,6 +29,7 @@ delete_transient( 'imagify_user' );
29
  $transients = implode( '" OR option_name LIKE "', array(
30
  '\_transient\_%imagify-async-in-progress-%',
31
  '\_transient\_%imagify-ngg-async-in-progress-%',
 
32
  '\_site\_transient\_%imagify-file-async-in-progress-%',
33
  '\_transient\_%imagify\_rpc\_%',
34
  '\_site\_transient\_imagify\_%\_process\_lock%',
29
  $transients = implode( '" OR option_name LIKE "', array(
30
  '\_transient\_%imagify-async-in-progress-%',
31
  '\_transient\_%imagify-ngg-async-in-progress-%',
32
+ '\_transient\_%imagify-auto-optimize-%',
33
  '\_site\_transient\_%imagify-file-async-in-progress-%',
34
  '\_transient\_%imagify\_rpc\_%',
35
  '\_site\_transient\_imagify\_%\_process\_lock%',
views/modal-payment.php CHANGED
@@ -15,8 +15,8 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
15
 
16
  <div class="imagify-modal-section section-gray imagify-estimation-block imagify-analyzing">
17
  <p class="imagify-modal-title">
18
- <span class="imagify-numbers-calc"><?php esc_html_e( 'We analysed your images', 'imagify' ); ?></span>
19
- <span class="imagify-numbers-notcalc"><?php esc_html_e( 'We are analysing your images', 'imagify' ); ?></span>
20
  </p>
21
 
22
  <img src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>loader-balls.svg" width="77" height="48" alt="<?php esc_attr_e( 'Analyzing', 'imagify' ); ?>" class="imagify-loader">
@@ -66,16 +66,16 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
66
 
67
  <div class="imagify-modal-section imagify-pre-checkout-offers">
68
  <p class="imagify-modal-title">
69
- <span class="imagify-not-enough-title"><?php esc_html_e( 'We recommend you this plan', 'imagify' ); ?></span>
70
  <span class="imagify-enough-title"><?php esc_html_e( 'The free plan is enough to optimize your images', 'imagify' ); ?></span>
71
-
72
  </p>
73
 
74
  <div class="imagify-offer-line imagify-offer-monthly imagify-offer-selected imagify-month-selected" data-offer='{"lite":{"id":3,"name":"Lite","data":1073741824,"dataf":"1 GB","imgs":5000,"prices":{"monthly":4.99,"yearly":4.16,"add":4}}}'>
75
  <div class="imagify-offer-header">
76
  <p class="imagify-offer-title imagify-switch-my">
77
- <span aria-hidden="false" class="imagify-monthly"><?php esc_html_e( 'Subscribe a monthly plan', 'imagify' ); ?></span>
78
- <span aria-hidden="true" class="imagify-yearly"><?php esc_html_e( 'Subscribe a yearly plan', 'imagify' ); ?></span>
79
  </p>
80
  <div class="imagify-inline-options imagify-radio-line">
81
  <input id="imagify-subscription-monthly" type="radio" value="monthly" name="plan-subscription" checked="checked">
@@ -128,7 +128,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
128
  <?php
129
  printf(
130
  /* translators: %s is a formatted price. */
131
- __( '%s per<br>additionnal Gb', 'imagify' ),
132
  '<span class="imagify-price-add-data"></span>'
133
  );
134
  ?>
@@ -146,7 +146,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
146
  <div class="imagify-offer-line imagify-offer-onetime" data-offer='{"recommended":{"id":999,"name":"Customized","data":3000001337,"dataf":"3 GB","imgs":54634,"price":28.98}}'>
147
  <div class="imagify-offer-header">
148
  <p class="imagify-offer-title">
149
- <?php esc_html_e( 'Optimize the images you already have, buy a One Time plan', 'imagify' ); ?>
150
  </p>
151
  </div><!-- .imagify-offer-header -->
152
 
@@ -193,7 +193,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
193
 
194
  <img src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>loader-balls.svg" width="60" height="36" alt="<?php esc_attr_e( 'Checking Coupon', 'imagify' ); ?>" class="imagify-coupon-loader">
195
 
196
- <label for="imagify-coupon-code"><?php _e( 'If you have a <strong>coupon code</strong><br> use it there:', 'imagify' ); ?></label>
197
  </p>
198
  <p class="imagify-coupon-input">
199
  <input type="text" class="imagify-coupon-code" name="imagify-coupon-code" id="imagify-coupon-code" value="" placeholder="<?php _e( 'Coupon Code', 'imagify' ); ?>" autocomplete="off">
@@ -208,7 +208,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
208
  </div>
209
  </div>
210
 
211
- <p class="imagify-footer-lines"><?php esc_html_e( 'Monthly plans come with credits which is renewed every months. The billing happens automatically each month or year depending the billing period you choose.', 'imagify' ); ?></p>
212
  </div>
213
  </div><!-- .imagify-pre-checkout-view -->
214
 
@@ -389,7 +389,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
389
 
390
  <div class="imagify-modal-sidebar">
391
  <div class="imagify-modal-sidebar-content imagify-txt-start">
392
- <p class="imagify-modal-sidebar-title"><?php esc_html_e( 'What do our user think about Imagify', 'imagify' ); ?></p>
393
 
394
  <div class="imagify-modal-testimony">
395
  <div class="imagify-modal-testimony-person">
@@ -397,8 +397,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
397
  <img src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>pic-srhdesign.jpg" alt="">
398
  </span>
399
  <p class="imagify-modal-identity">
400
- <a href="https://twitter.com/SRHDesign" target="_blank">@SRHDesign</a>
401
- <a href="https://twitter.com/SRHDesign/status/686486119249260544" target="_blank"><time datetime="2016-01-11">11 jan. 2016 @ 17:40</time></a>
402
  </p>
403
  </div>
404
  <div class="imagify-modal-testimony-content">
@@ -412,8 +411,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
412
  <img src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>pic-ericwaltr.jpg" alt="">
413
  </span>
414
  <p class="imagify-modal-identity">
415
- <a href="https://twitter.com/EricWaltr" target="_blank">@EricWaltr</a>
416
- <a href="https://twitter.com/EricWaltR/status/679053496382038016" target="_blank"><time datetime="2016-01-11">21 dec. 2015 @ 22:39</time></a>
417
  </p>
418
  </div>
419
  <div class="imagify-modal-testimony-content">
15
 
16
  <div class="imagify-modal-section section-gray imagify-estimation-block imagify-analyzing">
17
  <p class="imagify-modal-title">
18
+ <span class="imagify-numbers-calc"><?php esc_html_e( 'We analyzed your images', 'imagify' ); ?></span>
19
+ <span class="imagify-numbers-notcalc"><?php esc_html_e( 'We are analyzing your images', 'imagify' ); ?></span>
20
  </p>
21
 
22
  <img src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>loader-balls.svg" width="77" height="48" alt="<?php esc_attr_e( 'Analyzing', 'imagify' ); ?>" class="imagify-loader">
66
 
67
  <div class="imagify-modal-section imagify-pre-checkout-offers">
68
  <p class="imagify-modal-title">
69
+ <span class="imagify-not-enough-title"><?php esc_html_e( 'Our recommendation for you', 'imagify' ); ?></span>
70
  <span class="imagify-enough-title"><?php esc_html_e( 'The free plan is enough to optimize your images', 'imagify' ); ?></span>
71
+ <br/><span class="imagify-inner-sub-title"><?php esc_html_e( 'Based on your recent upload usage.', 'imagify' ); ?></span>
72
  </p>
73
 
74
  <div class="imagify-offer-line imagify-offer-monthly imagify-offer-selected imagify-month-selected" data-offer='{"lite":{"id":3,"name":"Lite","data":1073741824,"dataf":"1 GB","imgs":5000,"prices":{"monthly":4.99,"yearly":4.16,"add":4}}}'>
75
  <div class="imagify-offer-header">
76
  <p class="imagify-offer-title imagify-switch-my">
77
+ <span aria-hidden="false" class="imagify-monthly"><?php esc_html_e( 'Subscribe to a monthly plan', 'imagify' ); ?></span>
78
+ <span aria-hidden="true" class="imagify-yearly"><?php esc_html_e( 'Subscribe to a yearly plan', 'imagify' ); ?></span>
79
  </p>
80
  <div class="imagify-inline-options imagify-radio-line">
81
  <input id="imagify-subscription-monthly" type="radio" value="monthly" name="plan-subscription" checked="checked">
128
  <?php
129
  printf(
130
  /* translators: %s is a formatted price. */
131
+ __( '%s per<br>additional Gb', 'imagify' ),
132
  '<span class="imagify-price-add-data"></span>'
133
  );
134
  ?>
146
  <div class="imagify-offer-line imagify-offer-onetime" data-offer='{"recommended":{"id":999,"name":"Customized","data":3000001337,"dataf":"3 GB","imgs":54634,"price":28.98}}'>
147
  <div class="imagify-offer-header">
148
  <p class="imagify-offer-title">
149
+ <?php esc_html_e( 'Optimize the images you already have with a One Time plan', 'imagify' ); ?>
150
  </p>
151
  </div><!-- .imagify-offer-header -->
152
 
193
 
194
  <img src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>loader-balls.svg" width="60" height="36" alt="<?php esc_attr_e( 'Checking Coupon', 'imagify' ); ?>" class="imagify-coupon-loader">
195
 
196
+ <label for="imagify-coupon-code"><?php _e( 'If you have a <strong>coupon code</strong><br> use it here:', 'imagify' ); ?></label>
197
  </p>
198
  <p class="imagify-coupon-input">
199
  <input type="text" class="imagify-coupon-code" name="imagify-coupon-code" id="imagify-coupon-code" value="" placeholder="<?php _e( 'Coupon Code', 'imagify' ); ?>" autocomplete="off">
208
  </div>
209
  </div>
210
 
211
+ <p class="imagify-footer-lines"><?php esc_html_e( 'Monthly plans come with credits which are renewed every month. The billing happens automatically each month or year, depending on which billing period you choose.', 'imagify' ); ?></p>
212
  </div>
213
  </div><!-- .imagify-pre-checkout-view -->
214
 
389
 
390
  <div class="imagify-modal-sidebar">
391
  <div class="imagify-modal-sidebar-content imagify-txt-start">
392
+ <p class="imagify-modal-sidebar-title"><?php esc_html_e( 'What do our users think about Imagify', 'imagify' ); ?></p>
393
 
394
  <div class="imagify-modal-testimony">
395
  <div class="imagify-modal-testimony-person">
397
  <img src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>pic-srhdesign.jpg" alt="">
398
  </span>
399
  <p class="imagify-modal-identity">
400
+ <a href="https://twitter.com/SRHDesign/status/686486119249260544" target="_blank">@SRHDesign</a>
 
401
  </p>
402
  </div>
403
  <div class="imagify-modal-testimony-content">
411
  <img src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>pic-ericwaltr.jpg" alt="">
412
  </span>
413
  <p class="imagify-modal-identity">
414
+ <a href="https://twitter.com/EricWaltR/status/679053496382038016" target="_blank">@EricWaltr</a>
 
415
  </p>
416
  </div>
417
  <div class="imagify-modal-testimony-content">