Imagify Image Optimizer - Version 1.6.5

Version Description

  • Improvement: Code quality of the whole plugin has been improved to fit more WordPress coding standards.
  • Improvement: Lots of internationalisation improvements. Now the plugin's internationalisation fully rely on the repository system.
  • Bug Fix: Fixed an error with php 7.1: Uncaught Error: [] operator not supported for strings in /wp-content/plugins/imagify/inc/functions/admin.php:134.
Download this release

Release Info

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

Code changes from version 1.6.4 to 1.6.5

Files changed (98) hide show
  1. assets/css/admin-bar.min.css +1 -1
  2. assets/css/admin.min.css +1 -1
  3. assets/css/sweetalert2.min.css +1 -1
  4. assets/css/twentytwenty.min.css +1 -1
  5. assets/images/big-blue-check.png +0 -0
  6. assets/images/check-1.svg +0 -0
  7. assets/images/check-mini-1.svg +0 -0
  8. assets/images/icon-arrow-choice.png +0 -0
  9. assets/images/icon-arrow-choice.svg +0 -0
  10. assets/images/icon-lock.png +0 -0
  11. assets/images/icon-lock.svg +0 -0
  12. assets/images/icon-pack.png +0 -0
  13. assets/images/icon-pack.svg +0 -0
  14. assets/images/mushrooms-aggressive.jpg +0 -0
  15. assets/images/mushrooms-normal.jpg +0 -0
  16. assets/images/mushrooms-original.jpg +0 -0
  17. assets/images/mushrooms-ultra.jpg +0 -0
  18. assets/images/pic-ericwaltr.jpg +0 -0
  19. assets/images/pic-srhdesign.jpg +0 -0
  20. assets/js/admin.js +1054 -931
  21. assets/js/admin.min.js +1 -36
  22. assets/js/bulk.js +352 -337
  23. assets/js/bulk.min.js +1 -17
  24. assets/js/imagify.js +290 -0
  25. assets/js/imagify.min.js +1 -5
  26. assets/js/jquery.twentytwenty.js +477 -456
  27. assets/js/jquery.twentytwenty.min.js +1 -28
  28. assets/js/options.js +80 -60
  29. assets/js/options.min.js +1 -4
  30. assets/js/upload.js +159 -128
  31. assets/js/upload.min.js +1 -6
  32. contributors.txt +3 -2
  33. imagify.php +81 -78
  34. inc/3rd-party/3rd-party.php +4 -4
  35. inc/3rd-party/enable-media-replace.php +31 -28
  36. inc/3rd-party/hosting/wpengine.php +13 -13
  37. inc/3rd-party/nextgen-gallery/inc/admin/ajax.php +73 -70
  38. inc/3rd-party/nextgen-gallery/inc/admin/bulk.php +15 -13
  39. inc/3rd-party/nextgen-gallery/inc/admin/db.php +7 -8
  40. inc/3rd-party/nextgen-gallery/inc/admin/enqueue.php +16 -16
  41. inc/3rd-party/nextgen-gallery/inc/admin/gallery.php +27 -6
  42. inc/3rd-party/nextgen-gallery/inc/admin/heartbeat.php +32 -26
  43. inc/3rd-party/nextgen-gallery/inc/admin/menu.php +6 -6
  44. inc/3rd-party/nextgen-gallery/inc/classes/class-attachment.php +0 -480
  45. inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg-attachment.php +515 -0
  46. inc/3rd-party/nextgen-gallery/inc/classes/{class-db.php → class-imagify-ngg-db.php} +76 -50
  47. inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg-storage.php +92 -0
  48. inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg.php +100 -0
  49. inc/3rd-party/nextgen-gallery/inc/classes/class-ngg-storage.php +0 -72
  50. inc/3rd-party/nextgen-gallery/inc/classes/class-ngg.php +0 -32
  51. inc/3rd-party/nextgen-gallery/inc/common/attachments.php +54 -41
  52. inc/3rd-party/nextgen-gallery/inc/functions/admin-stats.php +35 -41
  53. inc/3rd-party/nextgen-gallery/nextgen-gallery.php +16 -13
  54. inc/3rd-party/wp-retina-2x.php +72 -42
  55. inc/admin/ajax.php +456 -444
  56. inc/admin/enqueue.php +46 -40
  57. inc/admin/heartbeat.php +38 -30
  58. inc/admin/media.php +37 -17
  59. inc/admin/menu.php +8 -9
  60. inc/admin/meta-boxes.php +44 -33
  61. inc/admin/options.php +102 -83
  62. inc/admin/plugins.php +12 -11
  63. inc/admin/ui/bulk.php +192 -119
  64. inc/admin/ui/notices.php +184 -108
  65. inc/admin/ui/options.php +188 -139
  66. inc/admin/upgrader.php +101 -98
  67. inc/admin/upload.php +62 -52
  68. inc/api/imagify.php +54 -344
  69. inc/classes/abstracts/{abstract-attachment.php → class-imagify-abstract-attachment.php} +181 -156
  70. inc/classes/abstracts/{abstract-db.php → class-imagify-abstract-db.php} +115 -63
  71. inc/classes/class-attachment.php +0 -408
  72. inc/classes/class-imagify-attachment.php +436 -0
  73. inc/classes/{class-user.php → class-imagify-user.php} +62 -47
  74. inc/classes/class-imagify.php +368 -0
  75. inc/common/admin-bar.php +23 -22
  76. inc/common/attachments.php +37 -26
  77. inc/common/cron.php +36 -36
  78. inc/compat.php +230 -19
  79. inc/functions/admin-stats.php +319 -308
  80. inc/functions/admin-ui.php +250 -158
  81. inc/functions/admin.php +120 -81
  82. inc/functions/api.php +25 -27
  83. inc/functions/attachments.php +66 -63
  84. inc/functions/common.php +30 -0
  85. inc/functions/deprecated.php +185 -0
  86. inc/functions/files.php +39 -9
  87. inc/functions/formatting.php +30 -27
  88. inc/functions/i18n.php +89 -66
  89. inc/functions/options.php +39 -32
  90. inc/functions/process.php +69 -69
  91. languages/imagify-de_DE.mo +0 -0
  92. languages/imagify-de_DE.po +0 -1203
  93. languages/imagify-de_DE_formal.mo +0 -0
  94. languages/imagify-de_DE_formal.po +0 -1223
  95. languages/imagify-es_ES.mo +0 -0
  96. languages/imagify-es_ES.po +0 -1228
  97. languages/imagify-fr_FR.mo +0 -0
  98. languages/imagify-fr_FR.po +0 -596
assets/css/admin-bar.min.css CHANGED
@@ -1 +1 @@
1
- #wpadminbar #wp-admin-bar-imagify-profile *{line-height:1.5;white-space:initial}#wpadminbar #wp-admin-bar-imagify .ab-submenu{padding-bottom:0}#wpadminbar #wp-admin-bar-imagify-profile .ab-item{height:auto;padding:0 13px}#wpadminbar #wp-admin-bar-imagify-profile{min-width:200px;padding:15px 0 10px;margin-top:0.7em;background:#222}#wp-admin-bar-imagify .dashicons{font-family:"dashicons";font-size:18px;vertical-align:middle;margin:0 5px 0 0}#wp-admin-bar-imagify .button-text{display:inline-block;vertical-align:middle}#wp-admin-bar-imagify .imagify-abq-row{display:table;width:100%}#wp-admin-bar-imagify .imagify-abq-row+.imagify-abq-row{margin-top:.75em}#wp-admin-bar-imagify .imagify-abq-row >*{display:table-cell}#wp-admin-bar-imagify-profile .imagify-meteo-icon{padding-right:7px}#wp-admin-bar-imagify-profile .imagify-meteo-icon img{width:37px}#wp-admin-bar-imagify-profile .imagify-meteo-title{font-size:17px}#wp-admin-bar-imagify-profile .imagify-meteo-subs{color:#72889F}#wpadminbar #wp-admin-bar-imagify-profile strong{font-weight:bold}#wpadminbar #wp-admin-bar-imagify-profile .imagify-user-plan,#wpadminbar #wp-admin-bar-imagify-profile a{padding:0;color:#40B1D0}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link{display:table}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link >* {display:table-cell}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left{max-width:210px;min-width:210px;width:210px}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left p{font-size:12px}#wp-admin-bar-imagify-profile .imagify-error,#wp-admin-bar-imagify-profile .imagify-warning{padding:10px;margin:0 -13px -13px}#wp-admin-bar-imagify-profile .imagify-error p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p{margin-top:.5em}#wp-admin-bar-imagify-profile .imagify-error p+p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p+p{margin-top:1em}#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost{display:inline-block;height:auto;padding:7px 10px;border:1px solid #FFF;text-align:center;background:transparent;color:#FFF;border-radius:3px;transition:all .275s}#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost:hover,#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost:focus{background:#FFF;color:#888}#wpadminbar .imagify-warning *{background:#f5a623;color:#FFF;text-shadow:0 0 2px rgba(0,0,0,0.2)}
1
+ #wpadminbar #wp-admin-bar-imagify-profile *{line-height:1.5;white-space:initial}#wpadminbar #wp-admin-bar-imagify .ab-submenu{padding-bottom:0}#wpadminbar #wp-admin-bar-imagify-profile .ab-item{height:auto;padding:0 13px}#wpadminbar #wp-admin-bar-imagify-profile{min-width:200px;padding:15px 0 10px;margin-top:.7em;background:#222}#wp-admin-bar-imagify .dashicons{font-family:dashicons;font-size:18px;vertical-align:middle;margin:0 5px 0 0}#wp-admin-bar-imagify .button-text{display:inline-block;vertical-align:middle}#wp-admin-bar-imagify .imagify-abq-row{display:table;width:100%}#wp-admin-bar-imagify .imagify-abq-row+.imagify-abq-row{margin-top:.75em}#wp-admin-bar-imagify .imagify-abq-row>*{display:table-cell}#wp-admin-bar-imagify-profile .imagify-meteo-icon{padding-right:7px}#wp-admin-bar-imagify-profile .imagify-meteo-icon img{width:37px}#wp-admin-bar-imagify-profile .imagify-meteo-title{font-size:17px}#wp-admin-bar-imagify-profile .imagify-meteo-subs{color:#72889F}#wpadminbar #wp-admin-bar-imagify-profile strong{font-weight:700}#wpadminbar #wp-admin-bar-imagify-profile .imagify-user-plan,#wpadminbar #wp-admin-bar-imagify-profile a{padding:0;color:#40B1D0}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link{display:table}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link>*{display:table-cell}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left{max-width:210px;min-width:210px;width:210px}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left p{font-size:12px}#wp-admin-bar-imagify-profile .imagify-error,#wp-admin-bar-imagify-profile .imagify-warning{padding:10px;margin:0 -13px -13px}#wp-admin-bar-imagify-profile .imagify-error p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p{margin-top:.5em}#wp-admin-bar-imagify-profile .imagify-error p+p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p+p{margin-top:1em}#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost{display:inline-block;height:auto;padding:7px 10px;border:1px solid #FFF;text-align:center;background:0 0;color:#FFF;border-radius:3px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost:focus,#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost:hover{background:#FFF;color:#888}#wpadminbar .imagify-warning *{background:#f5a623;color:#FFF;text-shadow:0 0 2px rgba(0,0,0,.2)}
assets/css/admin.min.css CHANGED
@@ -1 +1 @@
1
- .imagify-start{float:left}.imagify-end{float:right}.imagify-txt-start.imagify-txt-start.imagify-txt-start{text-align:left}.imagify-txt-center.imagify-txt-center.imagify-txt-center{text-align:center}.imagify-txt-end.imagify-txt-end.imagify-txt-end{text-align:right}.imagify-mt1.imagify-mt1{margin-top:1em}.imagify-mb1.imagify-mb1{margin-bottom:1em}.imagify-mr1.imagify-mr1{margin-right:1em}.imagify-ml2.imagify-ml2{margin-left:2em}.imagify-mr2.imagify-mr2{margin-right:2em}.imagify-pl0.imagify-pl0.imagify-pl0{padding-left:0}.imagify-pr1.imagify-pr1{padding-right:1em}.imagify-oh{overflow:hidden}.imagify-clear{clear:both}.imagify-clearfix:after,.imagify-inline-options:after{content:"";display:table;clear:both}.imagify-count.imagify-count{counter-reset:num}.imagify-count .imagify-count-title{font-weight:bold}.imagify-default-settings{color:#73818c;font-weight:normal}.imagify-count .imagify-count-title:before{counter-increment:num 1;content:counter(num) ". "}.imagify-table{display:table;width:100%}.imagify-cell{display:table-cell;padding:10px;vertical-align:top}.imagify-cell.va-top,.va-top .imagify-cell{vertical-align:top}.imagify-bulk-submit .imagify-cell{padding-top:0}body.imagify-modal-is-open{overflow:hidden}.imagify-plugins-error{overflow:hidden;padding-left:20px;list-style-type:disc}.imagify-plugins-error li{width:300px;line-height:30px}@media (max-width:570px){.imagify-plugins-error li{width:auto}}.imagify-notice-dismiss.notice-dismiss{text-decoration:none}.imagify-spinner{display:inline-block;width:20px;height:20px;margin-right:5px;vertical-align:middle;background:rgba(0,0,0,0) url("../images/spinner.gif") no-repeat scroll 0 0 / 20px 20px;opacity:0.7}.spinner.imagify-hidden{width:0;margin:4px 0 0 0}.misc-pub-section.misc-pub-imagify h4{font-size:14px;margin-top:5px;margin-bottom:0}.imagify-sweet-alert button{margin-top:17px !important;height:45px !important;letter-spacing:3px;text-transform:uppercase !important;border-radius:3px !important;background-color:#40b1d0 !important;box-shadow:0 3px 0 #338ea6 !important}.imagify-sweet-alert button.loading{border-radius:100% !important;height:40px !important;padding:0!important;box-shadow:none!important}.imagify-sweet-alert button.swal2-cancel{background:#777 !important;box-shadow:0 3px 0 #444 !important}.imagify-sweet-alert-signup .sa-confirm-button-container{width:40%}.imagify-sweet-alert-signup button{width:100%;padding:0 !important}.imagify-sweet-alert .sa-input-error:before,.imagify-sweet-alert .sa-input-error:after,.imagify-sweet-alert .la-ball-fall{top:25% !important}#wpwrap{transition:all .4s}.stop-scrolling #wpwrap{filter:blur(2px)}.stop-scrolling #wpwrap #wpadminbar{top:-32px}.imagify-primary.imagify-primary.imagify-primary{color:#40b1d0}.imagify-secondary.imagify-secondary.imagify-secondary{color:#8cc152}#imagify-check-api-container{font-weight:bold}#imagify-check-api-container .dashicons{font-size:25px}#imagify-check-api-container .dashicons-no:before{color:#f06e57;vertical-align:-1px}#imagify-check-api-container .dashicons-yes:before{color:#8BC34A;vertical-align:-1px}.imagify-valid{color:#8BC34A}.imagify-chart{width:33.33%;position:relative}#imagify-overview-chart-legend{overflow:hidden}.imagify-doughnut-legend{margin-top:38px;list-style:none}.imagify-doughnut-legend li{display:block;padding-left:30px;position:relative;margin-bottom:15px;border-radius:5px;padding:3px 8px 2px 31px;font-size:14px;font-weight:600;cursor:default;-webkit-transition:background-color 200ms ease-in-out;-moz-transition:background-color 200ms ease-in-out;-o-transition:background-color 200ms ease-in-out;transition:background-color 200ms ease-in-out}.imagify-doughnut-legend li span{display:block;position:absolute;left:0;top:0;width:25px;height:25px;border-radius:50%}.imagify-chart{float:left;margin-bottom:20px}td .imagify-chart{float:none;margin-bottom:0}.imagify-chart-container{position:relative;width:180px;float:left;margin-right:20px}.imagify-global-optim-phrase{width:180px;padding-top:20px;font-size:14px;font-weight:bold;text-align:center}.imagify-total-percent{color:#46b1ce}td .imagify-chart-container{width:18px;height:18px;float:none;margin-right:10px}td .imagify-chart{top:4px}.imagify-chart-percent{position:absolute;left:0;right:0;top:50%;margin-top:-14px;text-align:center;font-size:55px;font-weight:bold;color:#46B1CE}.imagify-chart-percent span{font-size:20px;vertical-align:super}.media_page_imagify-bulk-optimization .notice,body[class*="_imagify-ngg-bulk-optimization"] .notice,.settings_page_imagify .notice{margin-right:20px;margin-left:2px}.media_page_imagify-bulk-optimization .media-item,body[class*="_imagify-ngg-bulk-optimization"] .media-item{margin:0}.media_page_imagify-bulk-optimization .media-item .progress,body[class*="_imagify-ngg-bulk-optimization"] .media-item .progress{float:none;width:100%;margin:0;background:#1F2331;box-shadow:0;border-radius:0}.media_page_imagify-bulk-optimization .media-item .percent,body[class*="_imagify-ngg-bulk-optimization"] .media-item .percent{width:auto;padding:0 5px;line-height:1.85;font-size:12px}.media_page_imagify-bulk-optimization .media-item .progress,body[class*="_imagify-ngg-bulk-optimization"] .media-item .progress,body[class*="_imagify-ngg-bulk-optimization"] .media-item .percent,.media_page_imagify-bulk-optimization .media-item .percent{text-align:right}.media_page_imagify-bulk-optimization .media-item .progress .bar,body[class*="_imagify-ngg-bulk-optimization"] .media-item .progress .bar{width:1px;height:22px;margin-top:0;background:#46B1CE;border-radius:0;overflow:visible;-webkit-transition:width .5s;transition:width .5s}.imagify-settings a,.imagify-settings .button,.imagify-settings input,.imagify-welcome a,.imagify-welcome .button,.imagify-weolcome input{-webkit-transition:all .275s;transition:all .275s}.imagify-settings a{color:#40b1d0}.imagify-options-title{padding-bottom:.5em;border-bottom:3px solid #F2F2F2;font-size:13px;font-weight:500;text-transform:uppercase;letter-spacing:0.025em;color:#40b1d0}.imagify-settings,.imagify-settings p,.imagify-settings th{color:#5F758E}@media (max-width:782px){.imagify-settings .form-table th{padding-top:2em;padding-bottom:.5em}}.imagify-settings .form-table td{vertical-align:top}.imagify-settings .form-table th span{cursor:pointer}.imagify-middle th{padding-top:35px}.imagify-settings .button,.imagify-welcome .button,.imagify-notice .button,.imagify-button.imagify-button,.imagify-button-primary.imagify-button-primary,.imagify-button-secondary.imagify-button-secondary{height:auto;padding:8px 20px;border:0 none;font-size:14px;font-weight:600;box-shadow:0 3px 0 rgba(0,0,0,.15);border-radius:3px;cursor:pointer;transition:all .275s}.imagify-notice .button-mini{padding:2px 10px;font-size:13px}.button-primary.button-mini{padding:2px 10px}.imagify-settings .button.button-mini-flat{padding:3px 6px 5px;font-size:12px;box-shadow:none!important;line-height:1.2}.imagify-settings .button.button-mini-flat:hover,.imagify-settings .button.button-mini-flat:focus{box-shadow:none!important}.imagify-title .button-ghost.button-ghost,.imagify-button-ghost.imagify-button-ghost{padding:2px 9px;border:1px solid #40B1D0;font-size:12px;font-weight:normal;color:#40B1D0;background:transparent;box-shadow:none}.imagify-title .button-ghost.button-ghost:hover,.imagify-title .button-ghost.button-ghost:focus,.imagify-button-ghost.imagify-button-ghost:hover,.imagify-button-ghost.imagify-button-ghost:focus{border-color:transparent;color:#000;background:#40B1D0}.imagify-button-ghost.imagify-button-ghost:hover,.imagify-button-ghost.imagify-button-ghost:focus{color:#FFF}.imagify-button-medium.imagify-button-medium{text-transform:uppercase;letter-spacing:0.1em;padding:3px 10px;font-weight:bold}.imagify-button-medium.imagify-button-ghost{border-width:2px}.button .dashicons{margin-right:5px;vertical-align:middle}.imagify-settings .button-primary.button-primary,.imagify-welcome .button-primary.button-primary,.imagify-button-primary.imagify-button-primary{background:#40B1D0;color:#FFF;box-shadow:0 3px 0 rgba(51,142,166,1);text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799!important}.imagify-button-secondary.imagify-button-secondary{background:#8BC34A;color:#FFF;box-shadow:0 3px 0 #6F9C3B;text-shadow:0 -1px 1px #6F9C3B,1px 0 1px #6F9C3B,0 1px 1px #6F9C3B!important}.imagify-settings .button-primary:hover,.imagify-settings .button-primary:focus,.imagify-welcome .button-primary:hover,.imagify-welcome .button-primary:focus,.imagify-button-primary.imagify-button-primary:hover,.imagify-button-primary.imagify-button-primary:focus{background:rgb(51,142,166);box-shadow:0 3px 0 rgb(31,122,146)}.imagify-button-secondary.imagify-button-secondary:hover,.imagify-button-secondary.imagify-button-secondary:focus{background:#6F9C3B;color:#FFF}.imagify-button-light.imagify-button-light{background:#FFF;color:#4a4a4a;box-shadow:0 2px 0 rgba(0,0,0,.2)}.imagify-button-light.imagify-button-light:hover,.imagify-button-light.imagify-button-light:focus{color:#FFF;background:rgba(0,0,0,.2)}.imagify-section-positive .imagify-button-light{color:#709A41}.imagify-button.imagify-button-big{font-size:15px;padding:11px 30px}.imagify-button-big .dashicons{font-size:1.45em;margin-right:6px;margin-left:-4px}.imagify-settings .button .dashicons,.imagify-welcome .button .dashicons,.imagify-notice .button .dashicons,.imagify-button.imagify-button .dashicons,.imagify-button-primary.imagify-button-primary .dashicons,.imagify-button-secondary.imagify-button-secondary .dashicons{vertical-align:middle}.button-text{display:inline-block;vertical-align:middle}#imagify-bulk-action{padding:11px 20px}.wp_attachment_image .imagify-button-primary,.media-frame-content .imagify-button-primary{float:left;padding:0 10px 1px;margin:0 5px 2px 0;font-size:13px;line-height:26px;box-shadow:0 3px 0 rgba(51,142,166,1)}.imagify-settings input[type="text"]{color:#4A4A4A;font-weight:600;box-shadow:none}.imagify-settings div.submit.submit{padding-left:235px;padding-top:40px}.imagify-settings p.submit{float:left;margin-top:0}.imagify-settings p.submit .button{margin:0 5px}@media (max-width:850px){.imagify-settings div.submit{padding-left:0}.imagify-settings p.submit{text-align:center}}.imagify-title.imagify-title{position:relative;padding:30px 50px;font-size:23px;background:#2E3243;color:#FFF}.imagify-settings .imagify-title + .imagify-notice{margin:0;border-right:1px solid #D9D9D9;padding-top:15px;padding-bottom:15px}.imagify-logo{vertical-align:top}.imagify-sub-header,.imagify-sub-title.imagify-sub-title,.imagify-settings div.submit,.imagify-section{margin:0;padding:20px;background:#F2F5F7}.imagify-sub-title.imagify-sub-title,.imagify-section-positive{padding-left:40px}.imagify-section-positive{background:#8cc152;color:#FFF}.imagify-section-positive p{color:#FFF}.imagify-section-gray{background:#D9E4EB}.imagify-section-gray .imagify-count-title{color:#4a4a4a}.imagify-section p:first-child{margin-top:0}.imagify-section p:last-child{margin-bottom:0}p.imagify-section-title.imagify-section-title{font-size:20px;margin-top:-.3em;margin-bottom:-.6em}.imagify-bulk-info{margin:1em 1em 1em 5px;transition:margin .3s}@media (max-width:850px){.imagify-bulk-info{margin:1em}}.imagify-bulk-info p{display:inline-block;text-align:left;width:400px;max-width:100%;font-weight:bold}@media (min-width:1500px){.imagify-settings div.submit{display:table;width:100%}.imagify-settings div.submit > *{display:table-cell;vertical-align:middle}.imagify-bulk-info{padding:0 25px;text-align:right}}.imagify-settings div.submit{margin-top:2em;padding:20px 0}.imagify-sub-header th{text-align:right}.imagify-sub-header .form-table{margin:0}.imagify-sub-header th,.imagify-sub-header td{padding-top:0;padding-bottom:0}[for="api_key"]{padding-top:5px}.imagify-notice .imagify-rate-us.imagify-rate-us{position:relative;bottom:0;right:0;text-align:left}.imagify-notice .imagify-rate-us .stars{margin:0}.imagify-rate-us.imagify-rate-us{position:absolute;bottom:50%;right:20px;text-align:right;margin-bottom:-2.4em;color:#FFF}.imagify-rate-us a{color:#40B1D0}.imagify-rate-us .stars{display:inline-block;margin:2px 0 0 10px;text-decoration:none;letter-spacing:.2em;vertical-align:-1px}.imagify-rate-us .stars .dashicons:before{font-size:18px}.imagify-rate-us a:hover,.imagify-rate-us a:focus{color:#FEE102}@media (max-width:1220px){.imagify-rate-us.imagify-rate-us{position:static;margin-bottom:0;text-align:left}.imagify-rate-us.imagify-rate-us br{display:none}.imagify-rate-us .stars{display:block;margin-left:0}}.imagify-rkt-notice.imagify-rkt-notice{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;-ms-grid-row-align:center;align-items:center;padding:10px 45px 10px 0;border:0 none;box-shadow:none;color:#FFF;background:#412355}.media_page_imagify-bulk-optimization .imagify-rkt-notice{margin-left:2px;margin-right:20px}@media (max-width:782px){.media_page_imagify-bulk-optimization .imagify-rkt-notice{margin-left:0;margin-right:12px}}.imagify-rkt-notice .imagify-cross{position:absolute;right:8px;top:50%;width:22px;height:22px;padding:0;margin-top:-11px;background:transparent;color:#FD7300;border-radius:50%;transition:all .275s}.imagify-rkt-notice .imagify-cross .dashicons{position:relative;top:2px;left:1px;transition:all .275s}.imagify-rkt-notice .imagify-cross:hover{background:#FFF}.imagify-rkt-notice .imagify-cross:hover .dashicons{color:#412355}.imagify-rkt-notice .imagify-rkt-cta,.imagify-rkt-notice .imagify-rkt-logo,.imagify-rkt-notice .imagify-rkt-coupon{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0}.imagify-rkt-notice .imagify-rkt-logo{width:150px!important;text-align:center;padding:0 25px 0 30px;line-height:0.8}.imagify-rkt-notice .imagify-rkt-msg{width:100%!important;padding:0 15px;font-size:14px;line-height:1.6}.imagify-rkt-notice .imagify-rkt-coupon{width:150px!important;padding:0 15px}.imagify-rkt-notice .imagify-rkt-coupon-code{padding:5px 10px;font-size:23px;font-weight:bold;border:1px dashed #F7A933;color:#F7A933}.imagify-rkt-notice .imagify-rkt-cta{width:250px!important;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;-webkit-flex-basis:200px;-ms-flex-preferred-size:200px;flex-basis:200px}.imagify-rkt-notice .button.button{position:relative;top:-1px;height:auto;font-weight:600;font-size:14px;box-shadow:0 4px 0 #B27A27;border:0 none;padding:9px 18px 9px;background:#F7A933;text-shadow:1px 1px 1px rgba(0,0,0,.2)}@media (max-width:880px){.imagify-rkt-notice{-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.imagify-rkt-notice .imagify-rkt-msg,.imagify-rkt-notice .imagify-rkt-cta,.imagify-rkt-notice .imagify-rkt-logo{text-align:left;padding:5px 15px}.imagify-cross.imagify-cross{top:8px;margin-top:0}.imagify-rkt-notice .imagify-cross .dashicons{top:1px}}.imagify-settings-section{padding:10px 20px}[id="imagify-settings"],.imagify-welcome .imagify-settings-section{border:1px solid #D9D9D9;border-top:0 none;background:#FFF}.imagify-br{line-height:2}.imagify-important{color:#F5A623}.imagify-info,.imagify-info a{color:#40B1D0;font-size:12px}.imagify-info{position:relative;display:inline-block;padding-left:25px;vertical-align:top}.imagify-info .dashicons{position:absolute;left:0;top:-1px}label + .imagify-info,label + .imagify-options-line,.imagify-visual-label{display:inline-block;max-width:70%;margin-left:15px;margin-top:2px!important;-webkit-transition:opacity .3s;transition:opacity .3s}.imagify-visual-label{vertical-align:-5px}label[for="imagify_sizes_full"] + .imagify-info{vertical-align:middle}.imagify-settings.imagify-settings [type="checkbox"]:not(:checked) + label + .imagify-options-line,.imagify-settings.imagify-settings [type="checkbox"]:not(:checked) + label .imagify-visual-label{opacity:.5}.imagify-settings.imagify-settings [type="checkbox"]:checked + label + .imagify-options-line,.imagify-settings.imagify-settings [type="checkbox"]:checked + label .imagify-visual-label{opacity:1}.imagify-checkbox-marged{max-width:500px;margin-left:45px}.imagify-settings.imagify-settings [type="checkbox"]:not(:checked),.imagify-settings.imagify-settings [type="checkbox"]:checked,.imagify-checkbox.imagify-checkbox:not(:checked),.imagify-checkbox.imagify-checkbox:checked{opacity:0.01}.imagify-settings.imagify-settings [type="checkbox"]:not(:checked):focus,.imagify-settings.imagify-settings [type="checkbox"]:checked:focus,.imagify-checkbox.imagify-checkbox:not(:checked):focus,.imagify-checkbox.imagify-checkbox:checked:focus{box-shadow:none!important;outline:none!important;border:0 none!important}.imagify-settings [type="checkbox"]:not(:checked) + label,.imagify-settings [type="checkbox"]:checked + label,.imagify-checkbox.imagify-checkbox:not(:checked) + label,.imagify-checkbox.imagify-checkbox:checked + label{position:relative;padding-left:6px;cursor:pointer;vertical-align:top}.imagify-settings [type="checkbox"]:not(:checked) + label:before,.imagify-settings [type="checkbox"]:checked + label:before,.imagify-checkbox.imagify-checkbox:not(:checked) + label:before,.imagify-checkbox.imagify-checkbox:checked + label:before{content:'';position:absolute;left:0;top:0;width:28px;height:28px;margin:0 0 0 -24px;border:2px solid #8BA6B4;background:#FFFFFF;border-radius:4px}.imagify-settings [type="checkbox"]:not(:checked) + label:after,.imagify-settings [type="checkbox"]:checked + label:after,.imagify-checkbox.imagify-checkbox:not(:checked) + label:after,.imagify-checkbox.imagify-checkbox:checked + label:after{content:"✓";position:absolute;font-size:1.4em;top:3px;left:-16px;-webkit-transition:all .2s;-moz-transition:all .2s;-ms-transition:all .2s;transition:all .2s}.imagify-settings [type="checkbox"][disabled]:not(:checked) + label:before,.imagify-settings [type="checkbox"][disabled]:checked + label:before,.imagify-checkbox.imagify-checkbox[disabled]:not(:checked) + label:before,.imagify-checkbox.imagify-checkbox[disabled]:checked + label:before{border-color:#ccc;background:#ddd}.imagify-settings [type="checkbox"]:not(:checked) + label:after,.imagify-checkbox.imagify-checkbox:not(:checked) + label:after{opacity:0;-webkit-transform:scale(0);-moz-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}.imagify-settings [type="checkbox"]:checked + label:after,.imagify-checkbox.imagify-checkbox:checked + label:after{opacity:1;-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}input[id^="imagify_sizes_"]:checked + label{font-weight:bold}.medium.imagify-checkbox:not(:checked) + label:before,.medium.imagify-checkbox:checked + label:before{width:22px;height:22px;border-width:1.5px;border-radius:2px;margin-top:0}.medium.imagify-checkbox:not(:checked) + label:after,.medium.imagify-checkbox:checked + label:after{font-size:1.1em;left:-17px;top:3px}.imagify-settings .mini[type="checkbox"]:not(:checked) + label:before,.imagify-settings .mini[type="checkbox"]:checked + label:before,.mini.imagify-checkbox:not(:checked) + label:before,.mini.imagify-checkbox:checked + label:before{width:15px;height:15px;border-width:1px;border-radius:2px;margin-top:0}.imagify-settings .mini[type="checkbox"]:not(:checked) + label:after,.imagify-settings .mini[type="checkbox"]:checked + label:after,.mini.imagify-checkbox:not(:checked) + label:after,.mini.imagify-checkbox:checked + label:after{font-size:.9em;left:-21px;top:1px}.imagify-settings [type="checkbox"]:not(:checked):focus + label:before,.imagify-settings [type="checkbox"]:checked:focus + label:before,.imagify-checkbox.imagify-checkbox:not(:checked):focus + label:before,.imagify-checkbox.imagify-checkbox:checked:focus + label:before{border-style:dotted;border-color:#40b1d0}.imagify-inline-options{position:relative;display:table;width:100%;max-width:600px;border-collapse:collapse}.imagify-small-options{width:300px;margin:1em auto .5em;background:#338EA6;border-radius:4px}.imagify-inline-options input[type="radio"]:not(:checked),.imagify-inline-options input[type="radio"]:checked{position:absolute;left:5px;top:5px;display:none}.imagify-inline-options input[type="radio"]:not(:checked) + label,.imagify-inline-options input[type="radio"]:checked + label{position:relative;display:table-cell;padding:13px 10px;text-align:center;font-weight:600;font-size:16px;text-transform:uppercase;letter-spacing:0.1em;color:#FFF;background:#2E3243;border-left:1px solid rgba(255,255,255,0.2);box-shadow:0 -3px 0 rgba(0,0,0,0.1) inset,inset -1px 0 0 rgba(255,255,255,0.2);z-index:2;-webkit-transition:all .275s;transition:all .275s}.imagify-small-options input[type="radio"]:not(:checked) + label,.imagify-small-options input[type="radio"]:checked + label{padding:8px 10px;font-size:13px;color:#FFF;box-shadow:none;border-left:0}.imagify-bulk-submit .imagify-inline-options input[type="radio"]:not(:checked) + label,.imagify-bulk-submit .imagify-inline-options input[type="radio"]:checked + label{margin-bottom:1.75em}.imagify-inline-options input[type="radio"]:not(:checked) + label:first-of-type,.imagify-inline-options input[type="radio"]:checked + label:first-of-type{border-radius:3px 0 0 3px}.imagify-inline-options input[type="radio"]:not(:checked) + label:last-of-type,.imagify-inline-options input[type="radio"]:checked + label:last-of-type{border-radius:0 3px 3px 0}.imagify-inline-options input[type="radio"]:checked + label{background:#8BC34A}.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-inline-options .imagify-info{margin-top:15px}.imagify-btn-info{display:block;font-size:0.7em;letter-spacing:0;line-height:1;text-transform:none}#describe-resize-larger input{width:5em}.imagify-cols:after{content:"";display:table;clear:both}.imagify-col{float:left;width:50%}.imagify-main{float:left;width:70%}.imagify-sidebar{float:right;width:28%;max-width:300px}.imagify-sidebar-section{border:1px solid #BBB;background:#FFF}.imagify-sidebar-section + .imagify-sidebar-section{margin-top:2em}@media (max-width:820px){.imagify-settings{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.imagify-main{width:auto;float:none}.imagify-sidebar{order:2;float:none;width:auto;max-width:none;margin-left:0;margin-top:25px}.wp-media-products{text-align:center}.wp-media-products li{display:inline-block;width:100%;max-width:276px}}@media (min-width:1400px){.imagify-main{width:74%}}.imagify-sidebar-title{display:block;padding:20px 15px;border-bottom:1px solid #BBB;font-size:14px;font-weight:bold;color:#23282d;background:#F2F5F7}.imagify-sidebar-title img{vertical-align:top;margin-right:5px}.imagify-sidebar .wp-media-products{margin-top:0;margin-bottom:-.5em}.imagify-sidebar .wp-media-products .links{display:block;padding:85px 25px 24px;text-align:center;background-color:#2E3243;background-size:contain;background-repeat:no-repeat;background-position:50% 0;text-decoration:none}.imagify-sidebar .wp-media-products .links p{margin:1.5em auto;color:#FFF}.imagify-sidebar .wp-media-products .wprocket-link{background-image:linear-gradient(to bottom,rgba(59,30,78,0),rgba(59,30,78,0) 130px,rgba(59,30,78,1) 210px),url("../images/sidebar-wp-rocket.jpg");background-color:#3B1E4E;background-repeat:repeat-x,no-repeat}.imagify-sidebar-content{padding:10px 20px}.imagify-mark-styled{display:inline-block;padding:1px 2px 1px 4px;line-height:1.3;font-weight:bold;background:#F7A933;transform-origin:50% 50%;transform:rotateZ(-2deg) rotateX(-10deg) skewX(-2deg) skewY(-3deg);text-shadow:1px 1px 0 rgba(0,0,0,0.2)}.imagify-mark-styled span{display:inline-block;transform:rotateZ(2deg) rotateX(10deg) skewX(2deg) skewY(3deg)}.imagify-discount-code{margin:0.35em 0 .5em;display:block;font-size:2em;letter-spacing:.05em;font-weight:bold;text-align:center;text-shadow:1px 1px 0 rgba(0,0,0,0.2)}.imagify-big-text{font-size:15px;font-weight:bold}.imagify-big-text strong{font-size:20px}a.btn-rocket{display:block;font-size:1.15em;padding:12px;background:#F7A933;box-shadow:0 3px 0 #D69626;border-radius:3px;color:#FFF;text-transform:uppercase;font-weight:bold;text-shadow:1px 1px 0 rgba(0,0,0,0.2);text-decoration:none}a.btn-rocket:hover,a.btn-rocket:focus{background:darkorange;box-shadow:0 3px 0 darkorange}.imagify-welcome{margin:30px 20px 0 0}.imagify-welcome .baseline{display:inline-block;margin:.2em 0 0 2em;font-size:17px}.imagify-welcome .imagify-logo{vertical-align:middle}.imagify-welcome-remove{position:absolute;top:50%;right:15px;margin-top:-8px;color:#FFF;text-decoration:none}.imagify-columns{overflow:hidden;padding:15px 0;counter-reset:cols}.imagify-columns [class^="col-"]{float:left;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.imagify-columns .col-1-3{width:33.333%;padding-left:28px}.imagify-columns .col-2-3{width:66.666%;padding-left:28px}.imagify-columns .col-1-2{width:50%;padding:0 20px}.imagify-columns .col-overview{padding-left:20px}.imagify-columns .col-informations{width:36.6%;padding-right:30px}.imagify-columns .col-statistics{width:30%}@media (max-width:830px){.imagify-columns [class^="col-"]{float:none;margin-bottom:1.5em}.imagify-columns .col-1-3,.imagify-columns .col-1-2{width:auto;padding:0 28px;clear:both;padding-top:1em}}.imagify-columns [class^="col-"] img{float:left;margin-right:18px}.imagify-col-content{overflow:hidden}.imagify-col-title{margin:0 0 15px 0;font-size:23px}.counter .imagify-col-title:before{counter-increment:cols;content:counter(cols) ". ";color:#40B1D0}.imagify-col-desc{color:#5F758E;margin-bottom:2em}.imagify-notice.imagify-notice{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:0;margin:10px 20px 10px 2px;border:0 none;background:#2E3243;box-shadow:none;color:#FFF}@media (max-width:782px){.imagify-notice.imagify-notice,.imagify-welcome{margin-right:12px}}@media (max-width:450px){.imagify-notice.imagify-notice{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}}.wrap .imagify-notice{margin:5px 15px 2px;position:relative}.imagify-notice-logo{padding:18px 23px;background:#40B1D0}.updated .imagify-notice-logo{background:#8BC34A}.error .imagify-notice-logo{background:#D0021B}.imagify-popin-message{padding:5px 15px;text-align:left}.imagify-popin-message.imagify-error p{color:#FFF}.imagify-notice-title{font-size:15px}.imagify-notice-content{padding:5px 23px}.imagify-notice-content.imagify-notice-content p{margin:0.65em 0}.imagify-notice a{color:#40B1D0}.imagify-notice a:hover,.imagify-notice a:focus{color:#FEE102}.imagify-notice code{background:rgba(0,0,0,0.4) none repeat scroll 0 0}.column-imagify_optimized_file.column-imagify_optimized_file{width:300px;text-align:center;vertical-align:middle}.column-imagify_optimized_file > *{max-width:235px;margin:0 auto}ul.imagify-datas-list.imagify-datas-list{margin:0 auto;color:#555;font-size:10px}.compat-field-imagify .label{vertical-align:top}.compat-field-imagify ul.imagify-datas-list{margin-top:7px;font-size:11px}ul.imagify-datas-list .big{font-size:12px;color:#40B1D0}.imagify-data-item{overflow:hidden}.imagify-data-item .imagify-chart{display:inline-block;top:1px;width:20px;vertical-align:middle;margin-bottom:0}li.imagify-data-item{clear:both;margin-bottom:2px}ul.imagify-datas-list .imagify-data-item span.data,ul.imagify-datas-list .imagify-data-item strong{float:left;width:50%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}ul.imagify-datas-list .imagify-data-item span.data{text-align:left;padding-right:5px}.compat-field-imagify .imagify-datas-list .imagify-data-item .data{width:130px;text-align:left;font-weight:bold}.media-sidebar .imagify-datas-list .imagify-data-item .data{width:auto;float:none}ul.imagify-datas-list .imagify-data-item strong{text-align:left;padding-left:5px}.media-sidebar .imagify-datas-list .imagify-data-item strong{width:auto;float:none}.imagify-datas-more-action.imagify-datas-more-action{margin:.4em auto;background:linear-gradient(to bottom,transparent,transparent 49%,rgba(0,0,0,.075) 50%,rgba(0,0,0,.075) 58%,transparent 58%,transparent)}.imagify-datas-more-action a{display:inline-block;padding:0 5px;background:#40B1D0;color:#FFF;text-transform:uppercase;font-size:9px;font-weight:bold;line-height:1.9;text-decoration:none}.imagify-datas-more-action a.is-open{background:#555}.imagify-datas-more-action a.is-open .dashicons{transform:rotate(180deg)}.imagify-datas-more-action a .dashicons{font-size:14px;vertical-align:middle;line-height:.8}.imagify-datas-more-action a .dashicons:before{vertical-align:middle;line-height:20px}.imagify-datas-more-action .the-text{display:inline-block;vertical-align:middle;height:20px;line-height:20px}ul.imagify-datas-details.imagify-datas-details{margin:.7em auto}.imagify-datas-details strong{color:#40B1D0}.imagify-datas-details .original{color:#555}.imagify-datas-actions-links{overflow:hidden;border-top:2px solid transparent;padding-top:5px;font-size:8px}.imagify-datas-actions-links a{position:relative;display:inline-block;padding-left:17px;text-decoration:none;font-weight:600}.compat-field-imagify .imagify-datas-actions-links{max-width:300px}.misc-pub-imagify .imagify-datas-actions-links{border-top:2px solid #f2f2f2;padding-bottom:5px}.compat-field-imagify .imagify-datas-actions-links a,.misc-pub-imagify .imagify-datas-actions-links a{font-size:10px;float:left;width:50%}.media-sidebar .compat-field-imagify .imagify-datas-actions-links a,.submitbox .misc-pub-imagify .imagify-datas-actions-links a{display:block;width:auto;float:none}.column-imagify_optimized_file .imagify-datas-actions-links a{margin:0 .7em;padding-left:15px}.imagify-datas-actions-links a:only-child{float:none;width:auto}.imagify-datas-details.is-open + .imagify-datas-actions-links{border-top-color:rgba(0,0,0,.075)}.imagify-datas-actions-links .dashicons{position:absolute;left:0;top:4px;width:12px;margin-right:2px;font-size:11px}.imagify-title > h1{padding:0}.imagify-title-right{display:table;float:right;margin-top:-10px}.imagify-title-right p{margin:0}.imagify-title-right a{font-weight:bold;text-decoration:none}.imagify-title-right > div{display:table-cell;vertical-align:middle}.imagify-title-right .dashicons-arrow-down-alt2{vertical-align:-4px;margin-left:2px}@media (max-width:1200px){.imagify-bulk .imagify-title{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}.imagify-title-right{-webkit-box-ordinal-group:3;-webkit-order:2;-ms-flex-order:2;order:2;margin-top:20px}}.imagify-account,.imagify-account-link{padding-right:15px}.imagify-sep-v{width:1px;background:rgba(255,255,255,.2)}.imagify-credit-left{position:relative;min-width:280px;padding-left:15px}.imagify-meteo-icon{display:inline-block;height:38px;vertical-align:middle;margin-right:10px}.imagify-user-plan{color:#40b1d0}@media (max-width:630px){.imagify-title-right{display:block;width:auto}.imagify-title-right > div{display:block;width:auto;margin-top:10px;max-width:100%}.imagify-credit-left{padding-left:0}}.imagify-meteo-title.imagify-meteo-title{color:#FFF;font-size:17px}.imagify-space-left{display:inline-block;min-height:38px;min-width:245px;vertical-align:middle}.imagify-space-left > p{color:#FFF}[class^="imagify-bar-"],#wp-admin-bar-imagify-profile [class^="imagify-bar-"]{position:relative;height:15px;width:100%;background:#60758D;color:#FFF;font-size:10px}.base-transparent{background:transparent}[class^="imagify-bar-"].right-outside-number{-webkit-box-sizing:border-box;box-sizing:border-box;padding-right:45px}.right-outside-number .imagify-barnb{display:block;margin-right:-45px;text-align:right;font-weight:bold;line-height:15px}.imagify-progress-value,#wp-admin-bar-imagify-profile .imagify-progress-value{position:absolute;top:0;right:0;left:0;bottom:0;text-align:center;line-height:13px;font-weight:bold}.imagify-progress,#wp-admin-bar-imagify-profile .imagify-progress{height:15px}.imagify-progress{transition:width .3s}.imagify-bar-positive .imagify-progress{background:#8CC152}.imagify-bar-positive .imagify-barnb{color:#8CC152}.imagify-bar-negative .imagify-progress{background:#73818C}.imagify-bar-negative .imagify-barnb{color:#73818C}.imagify-bar-neutral .imagify-progress{background:#F5A623}.imagify-space-left .imagify-bar-negative .imagify-progress{background:#D0021B}#wpadminbar #wp-admin-bar-imagify-profile *{line-height:1.5;white-space:initial}#wpadminbar #wp-admin-bar-imagify .ab-submenu{padding-bottom:0}#wpadminbar #wp-admin-bar-imagify-profile .ab-item{height:auto;padding:0 13px}#wpadminbar #wp-admin-bar-imagify-profile{min-width:200px;padding:15px 0 10px;margin-top:0.7em;background:#222}#wp-admin-bar-imagify .dashicons{font-family:"dashicons";font-size:18px;vertical-align:middle;margin:0 5px 0 0}#wp-admin-bar-imagify .button-text{display:inline-block;vertical-align:middle}#wp-admin-bar-imagify .imagify-abq-row{display:table;width:100%}#wp-admin-bar-imagify .imagify-abq-row + .imagify-abq-row{margin-top:.75em}#wp-admin-bar-imagify .imagify-abq-row > *{display:table-cell}#wp-admin-bar-imagify-profile .imagify-meteo-icon{padding-right:7px}#wp-admin-bar-imagify-profile .imagify-meteo-icon img{width:37px}#wp-admin-bar-imagify-profile .imagify-meteo-title{font-size:17px}#wp-admin-bar-imagify-profile .imagify-meteo-subs{color:#72889F}#wpadminbar #wp-admin-bar-imagify-profile strong{font-weight:bold}#wpadminbar #wp-admin-bar-imagify-profile .imagify-user-plan,#wpadminbar #wp-admin-bar-imagify-profile a{padding:0;color:#40B1D0}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link{display:table}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link > *{display:table-cell}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left{max-width:210px;min-width:210px;width:210px}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left p{font-size:12px}#wp-admin-bar-imagify-profile .imagify-error,#wp-admin-bar-imagify-profile .imagify-warning{padding:10px;margin:0 -13px -13px}#wp-admin-bar-imagify-profile .imagify-error p + p,#wp-admin-bar-imagify-profile .imagify-warning p + p{margin-top:.5em}#wp-admin-bar-imagify-profile .imagify-error p + p + p,#wp-admin-bar-imagify-profile .imagify-warning p + p + p{margin-top:1em}.btn-ghost,#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost{display:inline-block;height:auto;padding:7px 10px;border:1px solid #FFF;text-align:center;background:transparent;color:#FFF;border-radius:3px;transition:all .275s}.btn-ghost:hover,.btn-ghost:focus,#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost:hover,#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost:focus{background:#FFF;color:#888}.imagify-list-infos{max-width:100%;width:415px}.imagify-list-infos li,.imagify-info-block{position:relative;padding:10px;padding-left:42px;background:#D9E4EB;border-radius:4px;line-height:1.6}.imagify-list-infos .imagify-alt.imagify-alt{background:#8BA7B5;color:#FFF;font-weight:bold}.imagify-list-infos li + li{margin-top:1em}.imagify-list-infos li:before,.imagify-info-block:before{content:"";position:absolute;left:13px;top:14px;height:16px;width:16px;border:1px solid #46b1ce;border-radius:10px}.imagify-list-infos li:after,.imagify-info-block:after{content:"i";position:absolute;left:20px;top:13px;font-style:italic;color:#46b1ce}.imagify-cell .imagify-info-block{padding-top:0}.imagify-cell .imagify-info-block:after{top:6px}.imagify-cell .imagify-info-block:before{top:7px}.imagify-list-infos .imagify-alt:before,.imagify-list-infos .imagify-alt:after{color:#fff;border-color:#fff}.imagify-sub-title.imagify-sub-title{font-size:23px;background:#FFF;color:#2E3243;border-left:1px solid #D9D9D9;border-right:1px solid #D9D9D9;font-weight:lighter}.imagify-sub-title .icon-bulk{margin-right:10px;vertical-align:middle}.imagify-sub-title .title-text{display:inline-block;line-height:1;vertical-align:middle}.imagify-bulk .imagify-settings-section{border:1px solid #D9D9D9;border-top:0;background:#F2F5F7;color:#4A4A4A}.imagify-bulk .imagify-settings-section p,.imagify-bulk .imagify-settings-section li,.imagify-bulk .imagify-settings-section h3{color:#4A4A4A}.imagify-bulk .imagify-settings-section h3{margin-bottom:2em}.imagify-title .imagify-tooltips{position:absolute;top:100%;left:0}.imagify-tooltips .icon-round{float:left;display:inline-block;width:28px;height:28px;border:1px solid #FFF;margin-right:8px;margin-bottom:8px;font-size:17px;font-style:italic;line-height:29px;font-weight:bold;text-align:center;border-radius:50%}.imagify-tooltips .tooltip-content{display:block;position:relative;max-width:250px;padding:7px 15px 8px;background:#2e3242;color:#FFF;font-size:10px;border-radius:3px}.imagify-tooltips.right .tooltip-content{margin-left:12px}.imagify-tooltips.bottom .tooltip-content{margin-top:4px}.imagify-inline-options label .tooltip-content{position:absolute;left:0;right:0;top:100%;text-transform:none;font-size:10px;letter-spacing:0;text-align:center}.imagify-tooltips .tooltip-content:after{content:"";position:absolute}.imagify-tooltips.right .tooltip-content:after{top:16px;left:-6px;border-right:8px solid #2e3242;border-top:6px solid transparent;border-bottom:6px solid transparent}.imagify-tooltips.bottom .tooltip-content:after{top:-5px;left:50%;margin-left:-3px;border-bottom:6px solid #2e3242;border-left:6px solid transparent;border-right:6px solid transparent}.imagify-space-tooltips .tooltip-content{max-width:280px;margin-top:20px;margin-left:0;padding:5px 15px 5px;font-size:13px;background:#40B1D0;box-shadow:0 3px 0 #338EA6}.imagify-space-tooltips .tooltip-content:after{top:-14px;left:50%;margin-left:-7px;border:0 none;border-bottom:15px solid #40B1D0;border-left:15px solid transparent;border-right:15px solid transparent}.tooltip-content.tooltip-table{display:table;width:100%}.tooltip-content.tooltip-table > *{display:table-cell;vertical-align:middle}.tooltip-content .cell-icon{width:28px}.tooltip-content .cell-icon .icon{margin-bottom:0}.tooltip-content .cell-text{padding:5px 10px 5px 0;line-height:1.3}.tooltip-content .cell-sep{width:1px;background:rgba(255,255,255,.4)}.tooltip-content .cell-cta{padding-left:10px}.tooltip-content .cell-cta a{display:block;color:#FFF;width:100%;height:100%;white-space:nowrap}.imagify-number-you-optimized .number{display:table-cell;padding-right:15px;font-size:36px;font-weight:bold;line-height:1.1;vertical-align:middle;white-space:nowrap}.imagify-number-you-optimized .text{display:table-cell;vertical-align:middle;overflow:hidden;font-size:12px}.imagify-number-you-optimized .text br{display:none}.imagify-number-you-optimized > p{display:table}.imagify-number-you-optimized{padding-bottom:0.85em;margin-bottom:1.35em;overflow:hidden;border-bottom:1px solid rgba(0,0,0,0.05)}.imagify-bars p{font-weight:bold;font-size:12px;margin-bottom:0}.imagify-bars + .imagify-number-you-optimized{border-bottom:0;padding-top:0.85em}.imagify-bars + .imagify-number-you-optimized p{color:#46b1ce}.imagify-bulk-table{margin-top:2em;max-height:600px;max-height:60vh;overflow:auto}.imagify-bulk-table table{width:100%;border-spacing:0;border-collapse:collapse;border:1px solid #D3D3D3}.imagify-bulk-table td{padding:8px 15px}.imagify-bulk-table thead tr,.imagify-bulk-table thead th{background:#2E3242}.imagify-bulk-table tfoot tr,.imagify-bulk-table tfoot th{background:#73818C}.imagify-bulk-table thead th{padding:14px 15px;text-align:left;color:#F2F5F7;font-weight:bold;font-size:14px}.imagify-bulk-table tfoot td{padding:14px 15px;color:#F9FAFA}.imagify-bulk-table tbody tr,.imagify-bulk-table tbody td{background:#FFF}.imagify-bulk-table tbody tr:nth-child(odd),.imagify-bulk-table tbody tr:nth-child(odd) td{background:#F2F5F7}.imagify-bulk-table .imagify-row-progress{display:none}.imagify-bulk-table .imagify-row-progress,.imagify-bulk-table .imagify-row-progress td{height:15px;padding:0}.imagify-bulk-table .imagify-no-uploaded-yet td{height:200px;font-size:17px;letter-spacing:.1em;word-spacing:.12em;vertical-align:middle;text-transform:uppercase;font-weight:bold;text-align:center;color:#999;background-color:#FFF}.imagify-row-complete{padding:35px 20px;margin-top:2em;background:#8BC34A;color:#FFF;text-shadow:0 0 2px rgba(0,0,0,.1)}.imagify-row-complete .imagify-ac-chart{margin-top:3px}.imagify-row-complete p{color:#FFF;margin:0}@-webkit-keyframes congrate{0%{opacity:0;-webkit-transform:scale(1)}50%{-webkit-transform:scale(1.05);opacity:1}100%{-webkit-transform:scale(1);opacity:1}}​ @keyframes congrate{0%{opacity:0;transform:scale(1)}50%{transform:scale(1.05);opacity:1}100%{transform:scale(1);opacity:1}}.imagify-row-complete.done{-webkit-animation:congrate 500ms ease-in-out;animation:congrate 500ms ease-in-out}.imagify-all-complete{margin:1.5em 0}.imagify-all-complete > div{display:inline-block;vertical-align:middle}.imagify-ac-report{min-width:310px}.imagify-ac-chart{width:46px;height:46px;float:left;margin:0 20px 0 10px}.imagify-ac-report-text{overflow:hidden}.imagify-ac-report-text p{line-height:1.3}.imagify-ac-rt-big{font-weight:bold;font-size:24px;letter-spacing:0.15em;word-spacing:0.15em;text-transform:uppercase}.imagify-ac-share{text-align:right}.imagify-ac-share-content{display:inline-block;padding:10px 15px;background:rgba(255,255,255,.2)}.imagify-ac-share-content > *{display:inline-block;vertical-align:middle}.imagify-bulk-table .imagify-ac-share-content p{margin-right:5px}.imagify-share-networks,.imagify-share-networks li{margin:0}.imagify-share-networks li{display:inline-block}.imagify-share-networks a{display:inline-block;vertical-align:-7px;margin:0 5px;text-decoration:none;color:#FFF}.imagify-cell-filename{max-width:200px}.imagify-cell-status{max-width:145px}.imagify-cell-status .dashicons-warning{margin-right:2px}.imagify-cell-thumbnails{max-width:120px}td.imagify-cell-filename{text-overflow:clip;white-space:nowrap;overflow:hidden}.imagify-bulk-table td.imagify-cell-totaloriginal{padding-right:78px}.imagiuploaded,.imagifilename{display:inline-block;vertical-align:middle}.imagifilename{font-size:12px}.imagiuploaded{width:33px;height:33px;margin-right:5px;margin-left:-8px;overflow:hidden;background:url(../images/upload-image.png) 0 0 no-repeat;background-size:cover}.imagiuploaded img{max-widht:100%;height:auto}.imagistatus{color:#8CA6B3;text-transform:uppercase;font-weight:bold}.status-compressing{color:#46B1CE}.status-error{color:#CE0B24}.status-warning{color:#f5a623}.status-complete{color:#8CC152}.imagify-error{background:#D0021B;color:#FFF}.imagify-warning,#wpadminbar .imagify-warning *{background:#f5a623;color:#FFF;text-shadow:0 0 2px rgba(0,0,0,0.2)}.imagify-bulk-table .imagify-cell-thumbnails{text-align:center}.imagify-cell-percentage,.imagify-cell-savings{color:#46B1CE;font-weight:bold}.imagify-cell-optimized{font-weight:bold}.imagify-cell-totaloriginal{text-align:right}.dashicons.rotate{-webkit-animation:icon-rotate 2.6s infinite linear;animation:icon-rotate 2.6s infinite linear}.dashicons-admin-generic{transform-origin:48.75% 51.75%}.imagify-modal{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.js .imagify-modal{display:none;position:fixed;top:0;right:0;bottom:0;left:0;background-color:#1F2332;background-color:rgba(31,35,50,.95);z-index:99999}.imagify-modal-content{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;width:800px;max-width:95%;max-height:90vw;overflow:auto;padding:20px 25px;margin:1em auto;background:#FFF;box-shadow:1px 1px 4px rgba(0,0,0,.7);border-radius:3px}#imagify-visual-comparison .imagify-modal-content,.imagify-visual-comparison .imagify-modal-content{max-width:1400px;background:transparent;padding:5px;box-shadow:none;border-radius:0}.imagify-modal .h2{margin:.5em 0;color:#8ba6b4;font-weight:normal;font-size:24px;letter-spacing:0.075em;text-align:center}.imagify-modal .h3{color:#40b1d0;font-weight:normal;font-size:18px;letter-spacing:0.075em;text-align:center}.text-justify{text-align:justify}.imagify-modal .close-btn{display:none;visibility:hidden;position:absolute;right:20px;top:20px;font-size:1.2em;border:0;background:transparent none;border-radius:0;cursor:pointer}.imagify-modal .close-btn i{margin-left:-2px}.imagify-modal .close-btn:hover,.imagify-modal .close-btn:focus{color:#40b1d0}.js .imagify-modal .close-btn{display:block;visibility:visible}.js .imagify-iframe-viewing .close-btn{display:none}#imagify-visual-comparison .close-btn,.imagify-visual-comparison .close-btn{top:50px;right:5px;width:33px;height:33px;padding:1px 0 0 2px;border:1px solid #F2F2F2;color:#F2F2F2;line-height:19px;text-align:center;border-radius:50%}.wp_attachment_image #imagify-visual-comparison .close-btn,.imagify-visual-comparison .close-btn{top:0}.wp_attachment_image #imagify-visual-comparison .imagify-modal-content,.imagify-visual-comparison .imagify-modal-content{padding-top:40px}.imagify-modal .imagify-comparison-title{font-size:28px;margin-bottom:1em;color:#F2F2F2;text-align:left}.imagify-modal .imagify-comparison-title .twentytwenty-duo-buttons{position:static;margin:0 10px 0 15px}.imagify-comparison-title .twentytwenty-duo-buttons button{float:none;padding:6px 12px;font-size:16px;text-transform:none;border:1px solid #40B1D0;color:#888899;letter-spacing:0}.imagify-comparison-title .twentytwenty-duo-buttons button:focus{outline:none;box-shadow:none}.imagify-comparison-title .twentytwenty-duo-buttons .selected{border:1px solid #40B1D0;color:#FFF;background:#40B1D0}.imagify-comparison-levels{margin:15px 0;overflow:hidden}.imagify-comparison-levels div{display:none;min-width:175px;font-size:11px}.imagify-comparison-levels .imagify-chart,.imagify-comparison-levels .imagify-chart-container{width:25px;float:none;margin:0}.imagify-visual-comparison .imagify-chart-container canvas{width:15px!important;height:15px!important;margin-right:5px}.imagify-c-level.go-left{float:left}.imagify-c-level.go-right{float:right}.imagify-c-level.go-right,.imagify-c-level.go-left{display:table}.imagify-c-level .imagify-c-level-row{display:table-row;margin:0;color:#FFF}.imagify-c-level-row > span{display:table-cell;padding:2px 0}.imagify-c-level-row .value{text-align:right;padding-left:5px}.imagify-c-level-row .value.level{color:#40b1d0}.imagify-c-level-row .value.size{color:#8bc34a;font-weight:bold}.imagify-c-level-row .value .imagify-chart{top:1px}@-webkit-keyframes icon-rotate{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes icon-rotate{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}.imagify-menu-bar-img{margin-top:1em}.imagify-modal .loader{position:absolute;top:50%;left:50%;margin:-32px 0 0 -32px;opacity:0;visibility:hidden;transition:opacity .4s}.imagify-modal .loading .loader{visibility:visible;opacity:1}.imagify-settings .imagify-visual-comparison-text{margin-top:1em;color:#40b1d0;font-weight:bold}.imagify-modal-cols,.imagify-border-styled,.imagify-offer-header,.imagify-payment-modal .imagify-modal-content,.imagify-flex-table,.imagify-tabs{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row}.imagify-modal-cols,.imagify-border-styled{-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}.imagify-payment-modal{text-align:center;color:#7A8996}.imagify-payment-modal *{box-sizing:border-box}.imagify-modal-loader{position:absolute;top:0;left:0;right:0;bottom:0;background:#fff url('../images/loader-balls.svg') center no-repeat;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-analyzing .imagify-numbers-calc,.imagify-numbers-notcalc,.imagify-modal-section.imagify-analyzing .imagify-modal-cols,.imagify-modal-section .imagify-loader{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:bold;font-size:0.925em}.imagify-big-number{font-size:3.7em;font-weight:bold;margin:-3px 0;color:#4A4A4A;line-height:1}.imagify-border-styled:before,.imagify-border-styled:after{content:"";height:1px;background:rgba(0,0,0,.1);-webkit-flex-basis:40px;-ms-flex-preferred-size:40px;flex-basis:40px}.imagify-border-styled:before{margin-right:5px}.imagify-border-styled:after{margin-left:5px}.imagify-payment-modal strong{font-weight:bold;color:#4A4A4A}.imagify-col{-webkit-flex-basis:50%;-ms-flex-preferred-size:50%;flex-basis:50%}.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;transition:all .275s}.imagify-payment-modal .close-btn i{margin-left:-3.5px;margin-top:-0.5px}.imagify-payment-modal .close-btn:hover{background:#F6F7FB}.imagify-offer-line{margin-top:1.5em}.imagify-offer-line + .imagify-offer-line{margin-top:0.75em}.imagify-offer-header{-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;padding:0 0 0 15px;border-radius:4px 4px 0 0;-webkit-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:bold;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"]:not(:checked) + label,.imagify-offer-header .imagify-inline-options input[type="radio"]:checked + label{position:relative;padding:7px 30px;font-size:1em;letter-spacing:0.05em;color:inherit;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:0.8em;letter-spacing:0;text-transform:none;text-align:center;color:#FFF;background:#10121A;border-radius:2px}.imagify-2-free:after{content:"";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;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}.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:not(:checked),.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:checked{position:absolute;top:50%;left:6px;margin:-8px 0 0 0}.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:not(:checked) + label:before,.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:checked + label:before{margin:0;top:-2px;left:6px;-webkit-transition:all .275s;transition:all .275s}.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:not(:checked) + label:after,.imagify-col-checkbox .imagify-checkbox.imagify-checkbox:checked + label:after{top:1px;left:13px}.imagify-col-checkbox label{padding-left:55px!important}.imagify-offer-size{font-size:30px;color:#2E3243;font-weight:bold;-webkit-transition:all .275s;transition:all .275s}.imagify-offer-by{font-size:10px;-webkit-transition:all .275s;transition:all .275s}.imagify-approx{display:none;font-size:11px;line-height:1.2;-webkit-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-monthly .imagify-flex-table .imagify-price-block,.imagify-offer-monthlies .imagify-price-block{padding-top:0}.imagify-flex-table .imagify-price-complement{padding-right:0;font-size:10px;font-weight:bold}.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;flex-grow:0;padding-top:15px;font-weight:bold;width:70px}.imagify-price-discount:before{content:"";position:absolute;top:25px;width:62%;height:2px;background:#2E3243;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:bold;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:bold}.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-col-other-actions{width:18.5%;text-align:right}.imagify-col-other-actions a{font-size:11px}.imagify-offer-selected,.imagify-offer-selected .imagify-offer-title,.imagify-offer-selected .imagify-offer-size,.imagify-offer-selected .imagify-price-big,.imagify-offer-selected .imagify-price-mini,.imagify-offer-selected .imagify-price-complement,.imagify-offer-selected .imagify-col-other-actions a{color:#FFF}.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-header .imagify-inline-options input[type="radio"]:checked + label{background:#40B1D0}.imagify-offer-selected .imagify-offer-content{background:#40B1D0}.imagify-offer-selected .imagify-checkbox.imagify-checkbox:not(:checked) + label:before,.imagify-offer-selected .imagify-checkbox.imagify-checkbox:checked + label:before{border-color:#FFF;background:#40B1D0}.imagify-offer-selected .imagify-offer-by{color:#2E3243}.imagify-enough-title{display:none}.imagify-enough-free .imagify-not-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;box-shadow:none;padding:4px 10px;z-index:0;transition:transform .275s}.imagify-canbe-validate [id="imagify-coupon-validate"]{transform:translateX(45px)}.imagify-modal-section + .imagify-modal-promotion{margin-top:-1em}.imagify-modal-promotion{position:relative;overflow:hidden;display:none;align-items:center;padding:15px 25px;background:#604D90;text-shadow:0 0 3px rgba(0,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:bold;letter-spacing:0.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:0.875em;font-weight:bold;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:0.85em;line-height:1.5}.imagify-year-selected .imagify-switch-my .imagify-yearly{display:block}.imagify-year-selected .imagify-switch-my .imagify-monthly{display:none}.imagify-month-selected .imagify-switch-my .imagify-yearly{display:none}.imagify-month-selected .imagify-switch-my .imagify-monthly{display:block}.imagify-flex-table{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}.imagify-flex-table > *{-webkit-box-flex:1;-webkit-flex-grow: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:0.5;margin-bottom:1em}.imagify-pricing-table .imagify-offer-selected{-webkit-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;box-shadow:none;text-transform:uppercase;font-size:12px;letter-spacing:0.025em}.imagify-offer-selected.imagify-offer-selected .imagify-button-secondary{border:2px solid #FFF;background:#40B1D0;box-shadow:none;text-shadow:none!important}.imagify-offer-selected.imagify-offer-selected .imagify-button-secondary:hover,.imagify-offer-selected.imagify-offer-selected .imagify-button-secondary:focus{background:#FFF;color:#40B1D0}.imagify-col .imagify-special-needs{margin-left:25px}.imagify-special-needs strong{font-size:25px;font-weight:bold;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:bold;font-style:italic}.imagify-offer-selected .imagify-recommend{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") scroll 0 no-repeat;background-size:contain}@media 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);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-offer-size,.imagify-offer-line[class*="imagify-onetime-"] .imagify-approx{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;-webkit-flex-grow: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{box-shadow:none;outline:none;color:#40B1D8}.imagify-tab.imagify-current a{background:#F6F7FB}.imagify-tab-content.imagify-current{display:block}.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:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}.imagify-modal-sidebar-content{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1}p.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:bold}.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 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:bold;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:0.5em;font-size:10px;color:#2E3243}.imagify-cart-list p{margin:0;font-weight:bold}.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;transition:background .3s}.imagify-remove-from-cart i:before{position:relative;top:-6px;left:-3px;font-size:13px;color:#FFF}.imagify-remove-from-cart:hover,.imagify-remove-from-cart:focus{background:#D0021B}.imagify-cart .imagify-cl-remove{-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;width:45px}.imagify-cart .imagify-cl-name{-webkit-box-flex:0;-webkit-flex-grow: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:#f6f7fb url(../images/loader-balls.svg) 50% 50% no-repeat}.imagify-success-view{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;height:100%}.imagify-success-view p{font-weight:bold;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:bold}.imagify-cart-emptied-item a{color:#40b1d0;float:right;font-weight:bold}
1
+ .imagify-cell,.imagify-cell.va-top,.va-top .imagify-cell{vertical-align:top}#imagify-overview-chart-legend,.imagify-oh,body.imagify-modal-is-open{overflow:hidden}.imagify-start{float:left}.imagify-end{float:right}.imagify-txt-start.imagify-txt-start.imagify-txt-start{text-align:left}.imagify-txt-center.imagify-txt-center.imagify-txt-center{text-align:center}.imagify-txt-end.imagify-txt-end.imagify-txt-end{text-align:right}.imagify-mt1.imagify-mt1{margin-top:1em}.imagify-mb1.imagify-mb1{margin-bottom:1em}.imagify-mr1.imagify-mr1{margin-right:1em}.imagify-ml2.imagify-ml2{margin-left:2em}.imagify-mr2.imagify-mr2{margin-right:2em}.imagify-pl0.imagify-pl0.imagify-pl0{padding-left:0}.imagify-pr1.imagify-pr1{padding-right:1em}.imagify-clear{clear:both}.imagify-clearfix:after,.imagify-inline-options:after{content:"";display:table;clear:both}.imagify-count.imagify-count{counter-reset:num}.imagify-count .imagify-count-title{font-weight:700}.imagify-default-settings{color:#73818c;font-weight:400}.imagify-count .imagify-count-title:before{counter-increment:num 1;content:counter(num) ". "}.imagify-table{display:table;width:100%}.imagify-cell{display:table-cell;padding:10px}.imagify-bulk-submit .imagify-cell{padding-top:0}.imagify-plugins-error{overflow:hidden;padding-left:20px;list-style-type:disc}.imagify-plugins-error li{width:300px;line-height:30px}@media (max-width:570px){.imagify-plugins-error li{width:auto}}.imagify-notice-dismiss.notice-dismiss{text-decoration:none}.imagify-spinner{display:inline-block;width:20px;height:20px;margin-right:5px;vertical-align:middle;background:url(../images/spinner.gif) 0 0/20px 20px no-repeat rgba(0,0,0,0);opacity:.7}.spinner.imagify-hidden{width:0;margin:4px 0 0}.misc-pub-section.misc-pub-imagify h4{font-size:14px;margin-top:5px;margin-bottom:0}.imagify-sweet-alert button{margin-top:17px!important;height:45px!important;letter-spacing:3px;text-transform:uppercase!important;border-radius:3px!important;background-color:#40b1d0!important;-webkit-box-shadow:0 3px 0 #338ea6!important;box-shadow:0 3px 0 #338ea6!important}.imagify-sweet-alert button.loading{border-radius:100%!important;height:40px!important;padding:0!important;-webkit-box-shadow:none!important;box-shadow:none!important}.imagify-sweet-alert button.swal2-cancel{background:#777!important;-webkit-box-shadow:0 3px 0 #444!important;box-shadow:0 3px 0 #444!important}.imagify-sweet-alert-signup .sa-confirm-button-container{width:40%}.imagify-sweet-alert-signup button{width:100%;padding:0!important}.imagify-sweet-alert .la-ball-fall,.imagify-sweet-alert .sa-input-error:after,.imagify-sweet-alert .sa-input-error:before{top:25%!important}#wpwrap{-webkit-transition:all .4s;-o-transition:all .4s;transition:all .4s}.stop-scrolling #wpwrap{-webkit-filter:blur(2px);filter:blur(2px)}.stop-scrolling #wpwrap #wpadminbar{top:-32px}.imagify-primary.imagify-primary.imagify-primary{color:#40b1d0}.imagify-secondary.imagify-secondary.imagify-secondary{color:#8cc152}#imagify-check-api-container{font-weight:700}#imagify-check-api-container .dashicons{font-size:25px}#imagify-check-api-container .dashicons-no:before{color:#f06e57;vertical-align:-1px}#imagify-check-api-container .dashicons-yes:before{color:#8BC34A;vertical-align:-1px}.imagify-valid{color:#8BC34A}.imagify-chart{width:33.33%;position:relative}.imagify-doughnut-legend{margin-top:38px;list-style:none}.imagify-doughnut-legend li{display:block;padding-left:30px;position:relative;margin-bottom:15px;border-radius:5px;padding:3px 8px 2px 31px;font-size:14px;font-weight:600;cursor:default;-webkit-transition:background-color .2s ease-in-out;-o-transition:background-color .2s ease-in-out;transition:background-color .2s ease-in-out}.imagify-doughnut-legend li span{display:block;position:absolute;left:0;top:0;width:25px;height:25px;border-radius:50%}.button-text,.imagify-bulk-info p{display:inline-block}.imagify-chart{float:left;margin-bottom:20px}td .imagify-chart{float:none;margin-bottom:0;top:4px}.imagify-chart-container{position:relative;width:180px;float:left;margin-right:20px}.imagify-global-optim-phrase{width:180px;padding-top:20px;font-size:14px;font-weight:700;text-align:center}.imagify-total-percent{color:#46b1ce}td .imagify-chart-container{width:18px;height:18px;float:none;margin-right:10px}.imagify-chart-percent{position:absolute;left:0;right:0;top:50%;margin-top:-14px;text-align:center;font-size:55px;font-weight:700;color:#46B1CE}.imagify-chart-percent span{font-size:20px;vertical-align:super}.media_page_imagify-bulk-optimization .notice,.settings_page_imagify .notice,body[class*="_imagify-ngg-bulk-optimization"] .notice{margin-right:20px;margin-left:2px}.media_page_imagify-bulk-optimization .media-item,body[class*="_imagify-ngg-bulk-optimization"] .media-item{margin:0}.media_page_imagify-bulk-optimization .media-item .progress,body[class*="_imagify-ngg-bulk-optimization"] .media-item .progress{float:none;width:100%;margin:0;background:#1F2331;-webkit-box-shadow:0;box-shadow:0;border-radius:0}.media_page_imagify-bulk-optimization .media-item .percent,body[class*="_imagify-ngg-bulk-optimization"] .media-item .percent{width:auto;padding:0 5px;line-height:1.85;font-size:12px}.media_page_imagify-bulk-optimization .media-item .percent,.media_page_imagify-bulk-optimization .media-item .progress,body[class*="_imagify-ngg-bulk-optimization"] .media-item .percent,body[class*="_imagify-ngg-bulk-optimization"] .media-item .progress{text-align:right}.media_page_imagify-bulk-optimization .media-item .progress .bar,body[class*="_imagify-ngg-bulk-optimization"] .media-item .progress .bar{width:1px;height:22px;margin-top:0;background:#46B1CE;border-radius:0;overflow:visible;-webkit-transition:width .5s;-o-transition:width .5s;transition:width .5s}.imagify-settings .button,.imagify-settings a,.imagify-settings input,.imagify-welcome .button,.imagify-welcome a,.imagify-weolcome input{-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-settings a{color:#40b1d0}.imagify-options-title{padding-bottom:.5em;border-bottom:3px solid #F2F2F2;font-size:13px;font-weight:500;text-transform:uppercase;letter-spacing:.025em;color:#40b1d0}.imagify-settings,.imagify-settings p,.imagify-settings th{color:#5F758E}@media (max-width:782px){.imagify-settings .form-table th{padding-top:2em;padding-bottom:.5em}}.imagify-settings .form-table td{vertical-align:top}.button .dashicons,.button-text,.imagify-button-primary.imagify-button-primary .dashicons,.imagify-button-secondary.imagify-button-secondary .dashicons,.imagify-button.imagify-button .dashicons,.imagify-notice .button .dashicons,.imagify-settings .button .dashicons,.imagify-welcome .button .dashicons{vertical-align:middle}.imagify-settings .form-table th span{cursor:pointer}.imagify-middle th{padding-top:35px}.imagify-button-primary.imagify-button-primary,.imagify-button-secondary.imagify-button-secondary,.imagify-button.imagify-button,.imagify-notice .button,.imagify-settings .button,.imagify-welcome .button{height:auto;padding:8px 20px;border:0;font-size:14px;font-weight:600;-webkit-box-shadow:0 3px 0 rgba(0,0,0,.15);box-shadow:0 3px 0 rgba(0,0,0,.15);border-radius:3px;cursor:pointer;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-notice .button-mini{padding:2px 10px;font-size:13px}.button-primary.button-mini{padding:2px 10px}.imagify-settings .button.button-mini-flat{padding:3px 6px 5px;font-size:12px;-webkit-box-shadow:none!important;box-shadow:none!important;line-height:1.2}.imagify-settings .button.button-mini-flat:focus,.imagify-settings .button.button-mini-flat:hover{-webkit-box-shadow:none!important;box-shadow:none!important}.imagify-button-ghost.imagify-button-ghost,.imagify-title .button-ghost.button-ghost{padding:2px 9px;border:1px solid #40B1D0;font-size:12px;font-weight:400;color:#40B1D0;background:0 0;-webkit-box-shadow:none;box-shadow:none}.imagify-button-ghost.imagify-button-ghost:focus,.imagify-button-ghost.imagify-button-ghost:hover,.imagify-title .button-ghost.button-ghost:focus,.imagify-title .button-ghost.button-ghost:hover{border-color:transparent;color:#000;background:#40B1D0}.imagify-button-ghost.imagify-button-ghost:focus,.imagify-button-ghost.imagify-button-ghost:hover{color:#FFF}.imagify-button-medium.imagify-button-medium{text-transform:uppercase;letter-spacing:.1em;padding:3px 10px;font-weight:700}.imagify-button-medium.imagify-button-ghost{border-width:2px}.button .dashicons{margin-right:5px}.imagify-button-primary.imagify-button-primary,.imagify-settings .button-primary.button-primary,.imagify-welcome .button-primary.button-primary{background:#40B1D0;color:#FFF;-webkit-box-shadow:0 3px 0 rgba(51,142,166,1);box-shadow:0 3px 0 rgba(51,142,166,1);text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799!important}.imagify-button-secondary.imagify-button-secondary{background:#8BC34A;color:#FFF;-webkit-box-shadow:0 3px 0 #6F9C3B;box-shadow:0 3px 0 #6F9C3B;text-shadow:0 -1px 1px #6F9C3B,1px 0 1px #6F9C3B,0 1px 1px #6F9C3B!important}.imagify-button-primary.imagify-button-primary:focus,.imagify-button-primary.imagify-button-primary:hover,.imagify-settings .button-primary:focus,.imagify-settings .button-primary:hover,.imagify-welcome .button-primary:focus,.imagify-welcome .button-primary:hover{background:#338ea6;-webkit-box-shadow:0 3px 0 #1f7a92;box-shadow:0 3px 0 #1f7a92}.imagify-button-secondary.imagify-button-secondary:focus,.imagify-button-secondary.imagify-button-secondary:hover{background:#6F9C3B;color:#FFF}.imagify-button-light.imagify-button-light{background:#FFF;color:#4a4a4a;-webkit-box-shadow:0 2px 0 rgba(0,0,0,.2);box-shadow:0 2px 0 rgba(0,0,0,.2)}.imagify-button-light.imagify-button-light:focus,.imagify-button-light.imagify-button-light:hover{color:#FFF;background:rgba(0,0,0,.2)}.imagify-section-positive .imagify-button-light{color:#709A41}.imagify-button.imagify-button-big{font-size:15px;padding:11px 30px}.imagify-button-big .dashicons{font-size:1.45em;margin-right:6px;margin-left:-4px}.imagify-info,.imagify-logo{vertical-align:top}#imagify-bulk-action{padding:11px 20px}.media-frame-content .imagify-button-primary,.wp_attachment_image .imagify-button-primary{float:left;padding:0 10px 1px;margin:0 5px 2px 0;font-size:13px;line-height:26px;-webkit-box-shadow:0 3px 0 rgba(51,142,166,1);box-shadow:0 3px 0 rgba(51,142,166,1)}.imagify-settings input[type=text]{color:#4A4A4A;font-weight:600;-webkit-box-shadow:none;box-shadow:none}.imagify-settings div.submit.submit{padding-left:235px;padding-top:40px}.imagify-settings p.submit{float:left;margin-top:0}.imagify-settings p.submit .button{margin:0 5px}@media (max-width:850px){.imagify-settings div.submit{padding-left:0}.imagify-settings p.submit{text-align:center}}.imagify-title.imagify-title{position:relative;padding:30px 50px;font-size:23px;background:#2E3243;color:#FFF}.imagify-settings .imagify-title+.imagify-notice{margin:0;border-right:1px solid #D9D9D9;padding-top:15px;padding-bottom:15px}.imagify-section,.imagify-settings div.submit,.imagify-sub-header,.imagify-sub-title.imagify-sub-title{margin:0;padding:20px;background:#F2F5F7}.imagify-section-positive,.imagify-sub-title.imagify-sub-title{padding-left:40px}.imagify-section-positive{background:#8cc152;color:#FFF}.imagify-section-positive p{color:#FFF}.imagify-section-gray{background:#D9E4EB}.imagify-section-gray .imagify-count-title{color:#4a4a4a}.imagify-section p:first-child{margin-top:0}.imagify-section p:last-child{margin-bottom:0}p.imagify-section-title.imagify-section-title{font-size:20px;margin-top:-.3em;margin-bottom:-.6em}.imagify-bulk-info{margin:1em 1em 1em 5px;-webkit-transition:margin .3s;-o-transition:margin .3s;transition:margin .3s}@media (max-width:850px){.imagify-bulk-info{margin:1em}}.imagify-bulk-info p{text-align:left;width:400px;max-width:100%;font-weight:700}@media (min-width:1500px){.imagify-settings div.submit{display:table;width:100%}.imagify-settings div.submit>*{display:table-cell;vertical-align:middle}.imagify-bulk-info{padding:0 25px;text-align:right}}.imagify-settings div.submit{margin-top:2em;padding:20px 0}.imagify-notice .imagify-rate-us .stars,.imagify-sub-header .form-table{margin:0}.imagify-sub-header th{text-align:right}.imagify-sub-header td,.imagify-sub-header th{padding-top:0;padding-bottom:0}[for=api_key]{padding-top:5px}.imagify-notice .imagify-rate-us.imagify-rate-us{position:relative;bottom:0;right:0;text-align:left}.imagify-rate-us.imagify-rate-us{position:absolute;bottom:50%;right:20px;text-align:right;margin-bottom:-2.4em;color:#FFF}.imagify-rate-us a{color:#40B1D0}.imagify-rate-us .stars{display:inline-block;margin:2px 0 0 10px;text-decoration:none;letter-spacing:.2em;vertical-align:-1px}.imagify-rate-us .stars .dashicons:before{font-size:18px}.imagify-rate-us a:focus,.imagify-rate-us a:hover{color:#FEE102}@media (max-width:1220px){.imagify-rate-us.imagify-rate-us{position:static;margin-bottom:0;text-align:left}.imagify-rate-us.imagify-rate-us br{display:none}.imagify-rate-us .stars{display:block;margin-left:0}}.imagify-rkt-notice.imagify-rkt-notice{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;-ms-grid-row-align:center;align-items:center;padding:10px 45px 10px 0;border:0;-webkit-box-shadow:none;box-shadow:none;color:#FFF;background:#412355}.media_page_imagify-bulk-optimization .imagify-rkt-notice{margin-left:2px;margin-right:20px}@media (max-width:782px){.media_page_imagify-bulk-optimization .imagify-rkt-notice{margin-left:0;margin-right:12px}}.imagify-rkt-notice .imagify-cross{position:absolute;right:8px;top:50%;width:22px;height:22px;padding:0;margin-top:-11px;background:0 0;color:#FD7300;border-radius:50%;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-rkt-notice .imagify-cross .dashicons{position:relative;top:2px;left:1px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.imagify-rkt-notice .imagify-cross:hover{background:#FFF}.imagify-rkt-notice .imagify-cross:hover .dashicons{color:#412355}.imagify-rkt-notice .imagify-rkt-coupon,.imagify-rkt-notice .imagify-rkt-cta,.imagify-rkt-notice .imagify-rkt-logo{-ms-flex-negative:0;flex-shrink:0}.imagify-rkt-notice .imagify-rkt-logo{width:150px!important;text-align:center;padding:0 25px 0 30px;line-height:.8}.imagify-rkt-notice .imagify-rkt-msg{width:100%!important;padding:0 15px;font-size:14px;line-height:1.6}.imagify-rkt-notice .imagify-rkt-coupon{width:150px!important;padding:0 15px}.imagify-rkt-notice .imagify-rkt-coupon-code{padding:5px 10px;font-size:23px;font-weight:700;border:1px dashed #F7A933;color:#F7A933}.imagify-rkt-notice .imagify-rkt-cta{width:250px!important;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:200px;flex-basis:200px}.imagify-rkt-notice .button.button{position:relative;top:-1px;height:auto;font-weight:600;font-size:14px;-webkit-box-shadow:0 4px 0 #B27A27;box-shadow:0 4px 0 #B27A27;border:0;padding:9px 18px;background:#F7A933;text-shadow:1px 1px 1px rgba(0,0,0,.2)}@media (max-width:880px){.imagify-rkt-notice{-ms-flex-wrap:wrap;flex-wrap:wrap}.imagify-rkt-notice .imagify-rkt-cta,.imagify-rkt-notice .imagify-rkt-logo,.imagify-rkt-notice .imagify-rkt-msg{text-align:left;padding:5px 15px}.imagify-cross.imagify-cross{top:8px;margin-top:0}.imagify-rkt-notice .imagify-cross .dashicons{top:1px}}.imagify-settings-section{padding:10px 20px}.imagify-welcome .imagify-settings-section,[id=imagify-settings]{border:1px solid #D9D9D9;border-top:0 none;background:#FFF}.imagify-br{line-height:2}.imagify-important{color:#F5A623}.imagify-info,.imagify-info a{color:#40B1D0;font-size:12px}.imagify-info{position:relative;display:inline-block;padding-left:25px}.imagify-info .dashicons{position:absolute;left:0;top:-1px}.imagify-visual-label,label+.imagify-info,label+.imagify-options-line{display:inline-block;max-width:70%;margin-left:15px;margin-top:2px!important;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}.imagify-visual-label{vertical-align:-5px}label[for=imagify_sizes_full]+.imagify-info{vertical-align:middle}.imagify-settings.imagify-settings [type=checkbox]:not(:checked)+label .imagify-visual-label,.imagify-settings.imagify-settings [type=checkbox]:not(:checked)+label+.imagify-options-line{opacity:.5}.imagify-settings.imagify-settings [type=checkbox]:checked+label .imagify-visual-label,.imagify-settings.imagify-settings [type=checkbox]:checked+label+.imagify-options-line{opacity:1}.imagify-checkbox-marged{max-width:500px;margin-left:45px}.imagify-checkbox.imagify-checkbox:checked,.imagify-checkbox.imagify-checkbox:not(:checked),.imagify-settings.imagify-settings [type=checkbox]:checked,.imagify-settings.imagify-settings [type=checkbox]:not(:checked){opacity:.01}.imagify-checkbox.imagify-checkbox:checked:focus,.imagify-checkbox.imagify-checkbox:not(:checked):focus,.imagify-settings.imagify-settings [type=checkbox]:checked:focus,.imagify-settings.imagify-settings [type=checkbox]:not(:checked):focus{-webkit-box-shadow:none!important;box-shadow:none!important;outline:0!important;border:0!important}.imagify-checkbox.imagify-checkbox:checked+label,.imagify-checkbox.imagify-checkbox:not(:checked)+label,.imagify-settings [type=checkbox]:checked+label,.imagify-settings [type=checkbox]:not(:checked)+label{position:relative;padding-left:6px;cursor:pointer;vertical-align:top}.imagify-checkbox.imagify-checkbox:checked+label:before,.imagify-checkbox.imagify-checkbox:not(:checked)+label:before,.imagify-settings [type=checkbox]:checked+label:before,.imagify-settings [type=checkbox]:not(:checked)+label:before{content:'';position:absolute;left:0;top:0;width:28px;height:28px;margin:0 0 0 -24px;border:2px solid #8BA6B4;background:#FFF;border-radius:4px}.imagify-checkbox.imagify-checkbox:checked+label:after,.imagify-checkbox.imagify-checkbox:not(:checked)+label:after,.imagify-settings [type=checkbox]:checked+label:after,.imagify-settings [type=checkbox]:not(:checked)+label:after{content:"✓";position:absolute;font-size:1.4em;top:3px;left:-16px;-webkit-transition:all .2s;-o-transition:all .2s;transition:all .2s}.imagify-checkbox.imagify-checkbox[disabled]:checked+label:before,.imagify-checkbox.imagify-checkbox[disabled]:not(:checked)+label:before,.imagify-settings [type=checkbox][disabled]:checked+label:before,.imagify-settings [type=checkbox][disabled]:not(:checked)+label:before{border-color:#ccc;background:#ddd}.imagify-checkbox.imagify-checkbox:not(:checked)+label:after,.imagify-settings [type=checkbox]:not(:checked)+label:after{opacity:0;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}.imagify-checkbox.imagify-checkbox:checked+label:after,.imagify-settings [type=checkbox]:checked+label:after{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}input[id^=imagify_sizes_]:checked+label{font-weight:700}.medium.imagify-checkbox:checked+label:before,.medium.imagify-checkbox:not(:checked)+label:before{width:22px;height:22px;border-width:1.5px;border-radius:2px;margin-top:0}.medium.imagify-checkbox:checked+label:after,.medium.imagify-checkbox:not(:checked)+label:after{font-size:1.1em;left:-17px;top:3px}.imagify-settings .mini[type=checkbox]:checked+label:before,.imagify-settings .mini[type=checkbox]:not(:checked)+label:before,.mini.imagify-checkbox:checked+label:before,.mini.imagify-checkbox:not(:checked)+label:before{width:15px;height:15px;border-width:1px;border-radius:2px;margin-top:0}.imagify-settings .mini[type=checkbox]:checked+label:after,.imagify-settings .mini[type=checkbox]:not(:checked)+label:after,.mini.imagify-checkbox:checked+label:after,.mini.imagify-checkbox:not(:checked)+label:after{font-size:.9em;left:-21px;top:1px}.imagify-checkbox.imagify-checkbox:checked:focus+label:before,.imagify-checkbox.imagify-checkbox:not(:checked):focus+label:before,.imagify-settings [type=checkbox]:checked:focus+label:before,.imagify-settings [type=checkbox]:not(:checked):focus+label:before{border-style:dotted;border-color:#40b1d0}.imagify-inline-options{position:relative;display:table;width:100%;max-width:600px;border-collapse:collapse}.imagify-small-options{width:300px;margin:1em auto .5em;background:#338EA6;border-radius:4px}.imagify-inline-options input[type=radio]:checked,.imagify-inline-options input[type=radio]:not(:checked){position:absolute;left:5px;top:5px;display:none}.imagify-inline-options input[type=radio]:checked+label,.imagify-inline-options input[type=radio]:not(:checked)+label{position:relative;display:table-cell;padding:13px 10px;text-align:center;font-weight:600;font-size:16px;text-transform:uppercase;letter-spacing:.1em;color:#FFF;background:#2E3243;border-left:1px solid rgba(255,255,255,.2);-webkit-box-shadow:0 -3px 0 rgba(0,0,0,.1) inset,inset -1px 0 0 rgba(255,255,255,.2);box-shadow:0 -3px 0 rgba(0,0,0,.1) inset,inset -1px 0 0 rgba(255,255,255,.2);z-index:2;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}.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-bulk-submit .imagify-inline-options input[type=radio]:checked+label,.imagify-bulk-submit .imagify-inline-options input[type=radio]:not(:checked)+label{margin-bottom:1.75em}.imagify-inline-options input[type=radio]:checked+label:first-of-type,.imagify-inline-options input[type=radio]:not(:checked)+label:first-of-type{border-radius:3px 0 0 3px}.imagify-inline-options input[type=radio]:checked+label:last-of-type,.imagify-inline-options input[type=radio]:not(:checked)+label:last-of-type{border-radius:0 3px 3px 0}.imagify-inline-options input[type=radio]:checked+label{background:#8BC34A}.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-inline-options .imagify-info{margin-top:15px}.imagify-btn-info{display:block;font-size:.7em;letter-spacing:0;line-height:1;text-transform:none}.imagify-datas-more-action a,a.btn-rocket{text-transform:uppercase;text-decoration:none}#describe-resize-larger input{width:5em}.imagify-cols:after{content:"";display:table;clear:both}.imagify-col{float:left;width:50%}.imagify-main{float:left;width:70%}.imagify-sidebar{float:right;width:28%;max-width:300px}.imagify-sidebar-section{border:1px solid #BBB;background:#FFF}.imagify-sidebar-section+.imagify-sidebar-section{margin-top:2em}@media (max-width:820px){.imagify-main,.imagify-sidebar{float:none;width:auto}.imagify-settings{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.imagify-sidebar{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2;max-width:none;margin-left:0;margin-top:25px}.wp-media-products{text-align:center}.wp-media-products li{display:inline-block;width:100%;max-width:276px}}@media (min-width:1400px){.imagify-main{width:74%}}.imagify-sidebar-title{display:block;padding:20px 15px;border-bottom:1px solid #BBB;font-size:14px;font-weight:700;color:#23282d;background:#F2F5F7}.imagify-sidebar-title img{vertical-align:top;margin-right:5px}.imagify-sidebar .wp-media-products{margin-top:0;margin-bottom:-.5em}.imagify-sidebar .wp-media-products .links{display:block;padding:85px 25px 24px;text-align:center;background-color:#2E3243;background-size:contain;background-repeat:no-repeat;background-position:50% 0;text-decoration:none}.imagify-sidebar .wp-media-products .links p{margin:1.5em auto;color:#FFF}.imagify-sidebar .wp-media-products .wprocket-link{background-image:-o-linear-gradient(top,rgba(59,30,78 ,0),rgba(59,30,78 ,0) 130px,rgba(59 ,30 ,78 ,1) 210px),url(../images/sidebar-wp-rocket.jpg);background-image:linear-gradient(to bottom,rgba(59,30,78 ,0),rgba(59,30,78 ,0) 130px,rgba(59 ,30 ,78 ,1) 210px),url(../images/sidebar-wp-rocket.jpg);background-color:#3B1E4E;background-repeat:repeat-x,no-repeat}.imagify-sidebar-content{padding:10px 20px}.imagify-mark-styled{display:inline-block;padding:1px 2px 1px 4px;line-height:1.3;font-weight:700;background:#F7A933;-webkit-transform-origin:50% 50%;-ms-transform-origin:50% 50%;transform-origin:50% 50%;-webkit-transform:rotateZ(-2deg) rotateX(-10deg) skewX(-2deg) skewY(-3deg);transform:rotateZ(-2deg) rotateX(-10deg) skewX(-2deg) skewY(-3deg);text-shadow:1px 1px 0 rgba(0,0,0,.2)}.imagify-mark-styled span{display:inline-block;-webkit-transform:rotateZ(2deg) rotateX(10deg) skewX(2deg) skewY(3deg);transform:rotateZ(2deg) rotateX(10deg) skewX(2deg) skewY(3deg)}.imagify-discount-code,a.btn-rocket{display:block;text-shadow:1px 1px 0 rgba(0,0,0,.2);font-weight:700}.imagify-discount-code{margin:.35em 0 .5em;font-size:2em;letter-spacing:.05em;text-align:center}.imagify-big-text{font-size:15px;font-weight:700}.imagify-big-text strong{font-size:20px}a.btn-rocket{font-size:1.15em;padding:12px;background:#F7A933;-webkit-box-shadow:0 3px 0 #D69626;box-shadow:0 3px 0 #D69626;border-radius:3px;color:#FFF}a.btn-rocket:focus,a.btn-rocket:hover{background:#ff8c00;-webkit-box-shadow:0 3px 0 #ff8c00;box-shadow:0 3px 0 #ff8c00}.imagify-welcome{margin:30px 20px 0 0}.imagify-welcome .baseline{display:inline-block;margin:.2em 0 0 2em;font-size:17px}.imagify-welcome .imagify-logo{vertical-align:middle}.imagify-welcome-remove{position:absolute;top:50%;right:15px;margin-top:-8px;color:#FFF;text-decoration:none}.imagify-columns{overflow:hidden;padding:15px 0;counter-reset:cols}.imagify-columns [class^=col-]{float:left;-webkit-box-sizing:border-box;box-sizing:border-box}.imagify-columns .col-1-3{width:33.333%;padding-left:28px}.imagify-columns .col-2-3{width:66.666%;padding-left:28px}.imagify-columns .col-1-2{width:50%;padding:0 20px}.imagify-columns .col-overview{padding-left:20px}.imagify-columns .col-informations{width:36.6%;padding-right:30px}.imagify-columns .col-statistics{width:30%}@media (max-width:830px){.imagify-columns [class^=col-]{float:none;margin-bottom:1.5em}.imagify-columns .col-1-2,.imagify-columns .col-1-3{width:auto;padding:0 28px;clear:both;padding-top:1em}}.imagify-columns [class^=col-] img{float:left;margin-right:18px}.imagify-col-content{overflow:hidden}.imagify-col-title{margin:0 0 15px;font-size:23px}.counter .imagify-col-title:before{counter-increment:cols;content:counter(cols) ". ";color:#40B1D0}.imagify-col-desc{color:#5F758E;margin-bottom:2em}.imagify-notice.imagify-notice{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;padding:0;margin:10px 20px 10px 2px;border:0;background:#2E3243;-webkit-box-shadow:none;box-shadow:none;color:#FFF}@media (max-width:782px){.imagify-notice.imagify-notice,.imagify-welcome{margin-right:12px}}@media (max-width:450px){.imagify-notice.imagify-notice{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}}.wrap .imagify-notice{margin:5px 15px 2px;position:relative}.imagify-notice-logo{padding:18px 23px;background:#40B1D0}.updated .imagify-notice-logo{background:#8BC34A}.error .imagify-notice-logo{background:#D0021B}.imagify-popin-message{padding:5px 15px;text-align:left}.imagify-popin-message.imagify-error p{color:#FFF}.imagify-notice-title{font-size:15px}.imagify-notice-content{padding:5px 23px}.imagify-notice-content.imagify-notice-content p{margin:.65em 0}.imagify-notice a{color:#40B1D0}.imagify-notice a:focus,.imagify-notice a:hover{color:#FEE102}.imagify-notice code{background:rgba(0,0,0,.4)}.column-imagify_optimized_file.column-imagify_optimized_file{width:300px;text-align:center;vertical-align:middle}.column-imagify_optimized_file>*{max-width:235px;margin:0 auto}ul.imagify-datas-list.imagify-datas-list{margin:0 auto;color:#555;font-size:10px}.compat-field-imagify .label{vertical-align:top}.compat-field-imagify ul.imagify-datas-list{margin-top:7px;font-size:11px}ul.imagify-datas-list .big{font-size:12px;color:#40B1D0}.imagify-data-item{overflow:hidden}.imagify-data-item .imagify-chart{display:inline-block;top:1px;width:20px;vertical-align:middle;margin-bottom:0}li.imagify-data-item{clear:both;margin-bottom:2px}ul.imagify-datas-list .imagify-data-item span.data,ul.imagify-datas-list .imagify-data-item strong{float:left;width:50%;-webkit-box-sizing:border-box;box-sizing:border-box}ul.imagify-datas-list .imagify-data-item span.data{text-align:left;padding-right:5px}.compat-field-imagify .imagify-datas-list .imagify-data-item .data{width:130px;text-align:left;font-weight:700}.media-sidebar .imagify-datas-list .imagify-data-item .data,.media-sidebar .imagify-datas-list .imagify-data-item strong{width:auto;float:none}ul.imagify-datas-list .imagify-data-item strong{text-align:left;padding-left:5px}.imagify-datas-more-action.imagify-datas-more-action{margin:.4em auto;background:-webkit-gradient(linear,left top,left bottom,from(transparent),color-stop(49%,transparent),color-stop(50%,rgba(0,0,0,.075)),color-stop(58%,rgba(0,0,0,.075)),color-stop(58%,transparent),to(transparent));background:-o-linear-gradient(top,transparent,transparent 49%,rgba(0,0,0,.075) 50%,rgba(0,0,0,.075) 58%,transparent 58%,transparent);background:linear-gradient(to bottom,transparent,transparent 49%,rgba(0,0,0,.075) 50%,rgba(0,0,0,.075) 58%,transparent 58%,transparent)}.imagify-datas-more-action a{display:inline-block;padding:0 5px;background:#40B1D0;color:#FFF;font-size:9px;font-weight:700;line-height:1.9}.imagify-datas-more-action a.is-open{background:#555}.imagify-datas-more-action a.is-open .dashicons{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.imagify-datas-more-action a .dashicons{font-size:14px;vertical-align:middle;line-height:.8}.imagify-datas-more-action .the-text,.imagify-datas-more-action a .dashicons:before{line-height:20px;vertical-align:middle}.imagify-datas-more-action .the-text{display:inline-block;height:20px}ul.imagify-datas-details.imagify-datas-details{margin:.7em auto}.imagify-datas-details strong{color:#40B1D0}.imagify-datas-details .original{color:#555}.imagify-datas-actions-links{overflow:hidden;border-top:2px solid transparent;padding-top:5px;font-size:8px}.imagify-datas-actions-links a{position:relative;display:inline-block;padding-left:17px;text-decoration:none;font-weight:600}.compat-field-imagify .imagify-datas-actions-links{max-width:300px}.misc-pub-imagify .imagify-datas-actions-links{border-top:2px solid #f2f2f2;padding-bottom:5px}.compat-field-imagify .imagify-datas-actions-links a,.misc-pub-imagify .imagify-datas-actions-links a{font-size:10px;float:left;width:50%}.media-sidebar .compat-field-imagify .imagify-datas-actions-links a,.submitbox .misc-pub-imagify .imagify-datas-actions-links a{display:block;width:auto;float:none}.column-imagify_optimized_file .imagify-datas-actions-links a{margin:0 .7em;padding-left:15px}.imagify-datas-actions-links a:only-child{float:none;width:auto}.imagify-datas-details.is-open+.imagify-datas-actions-links{border-top-color:rgba(0,0,0,.075)}.imagify-datas-actions-links .dashicons{position:absolute;left:0;top:4px;width:12px;margin-right:2px;font-size:11px}.imagify-title>h1{padding:0}.imagify-title-right{display:table;float:right;margin-top:-10px}.imagify-title-right p{margin:0}.imagify-title-right a{font-weight:700;text-decoration:none}.imagify-title-right>div{display:table-cell;vertical-align:middle}.imagify-title-right .dashicons-arrow-down-alt2{vertical-align:-4px;margin-left:2px}@media (max-width:1200px){.imagify-bulk .imagify-title{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.imagify-title-right{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2;margin-top:20px}}.imagify-account,.imagify-account-link{padding-right:15px}.imagify-sep-v{width:1px;background:rgba(255,255,255,.2)}.imagify-credit-left{position:relative;min-width:280px;padding-left:15px}.imagify-meteo-icon{display:inline-block;height:38px;vertical-align:middle;margin-right:10px}.imagify-user-plan{color:#40b1d0}@media (max-width:630px){.imagify-title-right,.imagify-title-right>div{display:block;width:auto}.imagify-title-right>div{margin-top:10px;max-width:100%}.imagify-credit-left{padding-left:0}}.imagify-meteo-title.imagify-meteo-title{color:#FFF;font-size:17px}.imagify-space-left{display:inline-block;min-height:38px;min-width:245px;vertical-align:middle}.imagify-space-left>p{color:#FFF}#wp-admin-bar-imagify-profile [class^=imagify-bar-],[class^=imagify-bar-]{position:relative;height:15px;width:100%;background:#60758D;color:#FFF;font-size:10px}.base-transparent{background:0 0}[class^=imagify-bar-].right-outside-number{-webkit-box-sizing:border-box;box-sizing:border-box;padding-right:45px}.right-outside-number .imagify-barnb{display:block;margin-right:-45px;text-align:right;font-weight:700;line-height:15px}#wp-admin-bar-imagify-profile .imagify-progress-value,.imagify-progress-value{position:absolute;top:0;right:0;left:0;bottom:0;text-align:center;line-height:13px;font-weight:700}#wp-admin-bar-imagify-profile .imagify-progress,.imagify-progress{height:15px}.imagify-progress{-webkit-transition:width .3s;-o-transition:width .3s;transition:width .3s}.imagify-bar-positive .imagify-progress{background:#8CC152}.imagify-bar-positive .imagify-barnb{color:#8CC152}.imagify-bar-negative .imagify-progress{background:#73818C}.imagify-bar-negative .imagify-barnb{color:#73818C}.imagify-bar-neutral .imagify-progress{background:#F5A623}.imagify-space-left .imagify-bar-negative .imagify-progress{background:#D0021B}#wpadminbar #wp-admin-bar-imagify-profile *{line-height:1.5;white-space:initial}#wpadminbar #wp-admin-bar-imagify .ab-submenu{padding-bottom:0}#wpadminbar #wp-admin-bar-imagify-profile .ab-item{height:auto;padding:0 13px}#wpadminbar #wp-admin-bar-imagify-profile{min-width:200px;padding:15px 0 10px;margin-top:.7em;background:#222}#wp-admin-bar-imagify .dashicons{font-family:dashicons;font-size:18px;vertical-align:middle;margin:0 5px 0 0}#wp-admin-bar-imagify .button-text{display:inline-block;vertical-align:middle}#wp-admin-bar-imagify .imagify-abq-row{display:table;width:100%}#wp-admin-bar-imagify .imagify-abq-row+.imagify-abq-row{margin-top:.75em}#wp-admin-bar-imagify .imagify-abq-row>*{display:table-cell}#wp-admin-bar-imagify-profile .imagify-meteo-icon{padding-right:7px}#wp-admin-bar-imagify-profile .imagify-meteo-icon img{width:37px}#wp-admin-bar-imagify-profile .imagify-meteo-title{font-size:17px}#wp-admin-bar-imagify-profile .imagify-meteo-subs{color:#72889F}#wpadminbar #wp-admin-bar-imagify-profile strong{font-weight:700}#wpadminbar #wp-admin-bar-imagify-profile .imagify-user-plan,#wpadminbar #wp-admin-bar-imagify-profile a{padding:0;color:#40B1D0}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link{display:table}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link>*{display:table-cell}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left{max-width:210px;min-width:210px;width:210px}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left p{font-size:12px}#wp-admin-bar-imagify-profile .imagify-error,#wp-admin-bar-imagify-profile .imagify-warning{padding:10px;margin:0 -13px -13px}#wp-admin-bar-imagify-profile .imagify-error p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p{margin-top:.5em}#wp-admin-bar-imagify-profile .imagify-error p+p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p+p,.imagify-list-infos li+li{margin-top:1em}#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost,.btn-ghost{display:inline-block;height:auto;padding:7px 10px;border:1px solid #FFF;text-align:center;background:0 0;color:#FFF;border-radius:3px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost:focus,#wpadminbar #wp-admin-bar-imagify-profile .btn-ghost:hover,.btn-ghost:focus,.btn-ghost:hover{background:#FFF;color:#888}.imagify-list-infos{max-width:100%;width:415px}.imagify-info-block,.imagify-list-infos li{position:relative;padding:10px;padding-left:42px;background:#D9E4EB;border-radius:4px;line-height:1.6}.imagify-list-infos .imagify-alt.imagify-alt{background:#8BA7B5;color:#FFF;font-weight:700}.imagify-info-block:before,.imagify-list-infos li:before{content:"";position:absolute;left:13px;top:14px;height:16px;width:16px;border:1px solid #46b1ce;border-radius:10px}.imagify-info-block:after,.imagify-list-infos li:after{content:"i";position:absolute;left:20px;top:13px;font-style:italic;color:#46b1ce}.imagify-cell .imagify-info-block{padding-top:0}.imagify-cell .imagify-info-block:after{top:6px}.imagify-cell .imagify-info-block:before{top:7px}.imagify-list-infos .imagify-alt:after,.imagify-list-infos .imagify-alt:before{color:#fff;border-color:#fff}.imagify-sub-title.imagify-sub-title{font-size:23px;background:#FFF;color:#2E3243;border-left:1px solid #D9D9D9;border-right:1px solid #D9D9D9;font-weight:lighter}.imagify-sub-title .icon-bulk{margin-right:10px;vertical-align:middle}.imagify-sub-title .title-text{display:inline-block;line-height:1;vertical-align:middle}.imagify-bulk .imagify-settings-section{border:1px solid #D9D9D9;border-top:0;background:#F2F5F7;color:#4A4A4A}.imagify-bulk .imagify-settings-section h3,.imagify-bulk .imagify-settings-section li,.imagify-bulk .imagify-settings-section p{color:#4A4A4A}.imagify-bulk .imagify-settings-section h3{margin-bottom:2em}.imagify-title .imagify-tooltips{position:absolute;top:100%;left:0}.imagify-tooltips .icon-round{float:left;display:inline-block;width:28px;height:28px;border:1px solid #FFF;margin-right:8px;margin-bottom:8px;font-size:17px;font-style:italic;line-height:29px;font-weight:700;text-align:center;border-radius:50%}.imagify-tooltips .tooltip-content{display:block;position:relative;max-width:250px;padding:7px 15px 8px;background:#2e3242;color:#FFF;font-size:10px;border-radius:3px}.imagify-tooltips.right .tooltip-content{margin-left:12px}.imagify-tooltips.bottom .tooltip-content{margin-top:4px}.imagify-inline-options label .tooltip-content{position:absolute;left:0;right:0;top:100%;text-transform:none;font-size:10px;letter-spacing:0;text-align:center}.imagify-ac-rt-big,.imagistatus{text-transform:uppercase;font-weight:700}.imagify-tooltips .tooltip-content:after{content:"";position:absolute}.imagify-tooltips.right .tooltip-content:after{top:16px;left:-6px;border-right:8px solid #2e3242;border-top:6px solid transparent;border-bottom:6px solid transparent}.imagify-tooltips.bottom .tooltip-content:after{top:-5px;left:50%;margin-left:-3px;border-bottom:6px solid #2e3242;border-left:6px solid transparent;border-right:6px solid transparent}.imagify-space-tooltips .tooltip-content{max-width:280px;margin-top:20px;margin-left:0;padding:5px 15px;font-size:13px;background:#40B1D0;-webkit-box-shadow:0 3px 0 #338EA6;box-shadow:0 3px 0 #338EA6}.imagify-space-tooltips .tooltip-content:after{top:-14px;left:50%;margin-left:-7px;border:0;border-bottom:15px solid #40B1D0;border-left:15px solid transparent;border-right:15px solid transparent}.tooltip-content.tooltip-table{display:table;width:100%}.tooltip-content.tooltip-table>*{display:table-cell;vertical-align:middle}.tooltip-content .cell-icon{width:28px}.tooltip-content .cell-icon .icon{margin-bottom:0}.tooltip-content .cell-text{padding:5px 10px 5px 0;line-height:1.3}.tooltip-content .cell-sep{width:1px;background:rgba(255,255,255,.4)}.tooltip-content .cell-cta{padding-left:10px}.tooltip-content .cell-cta a{display:block;color:#FFF;width:100%;height:100%;white-space:nowrap}.imagify-number-you-optimized .number{display:table-cell;padding-right:15px;font-size:36px;font-weight:700;line-height:1.1;vertical-align:middle;white-space:nowrap}.imagify-number-you-optimized .text{display:table-cell;vertical-align:middle;overflow:hidden;font-size:12px}.imagify-number-you-optimized .text br{display:none}.imagify-number-you-optimized>p{display:table}.imagify-number-you-optimized{padding-bottom:.85em;margin-bottom:1.35em;overflow:hidden;border-bottom:1px solid rgba(0,0,0,.05)}.imagify-bars p{font-weight:700;font-size:12px;margin-bottom:0}.imagify-bars+.imagify-number-you-optimized{border-bottom:0;padding-top:.85em}.imagify-bars+.imagify-number-you-optimized p{color:#46b1ce}.imagify-bulk-table{margin-top:2em;max-height:600px;max-height:60vh;overflow:auto}.imagify-ac-report-text,.imagiuploaded{overflow:hidden}.imagify-bulk-table table{width:100%;border-spacing:0;border-collapse:collapse;border:1px solid #D3D3D3}.imagify-bulk-table td{padding:8px 15px}.imagify-bulk-table thead th,.imagify-bulk-table thead tr{background:#2E3242}.imagify-bulk-table tfoot th,.imagify-bulk-table tfoot tr{background:#73818C}.imagify-bulk-table thead th{padding:14px 15px;text-align:left;color:#F2F5F7;font-weight:700;font-size:14px}.imagify-bulk-table tfoot td{padding:14px 15px;color:#F9FAFA}.imagify-bulk-table tbody td,.imagify-bulk-table tbody tr{background:#FFF}.imagify-bulk-table tbody tr:nth-child(odd),.imagify-bulk-table tbody tr:nth-child(odd) td{background:#F2F5F7}.imagify-bulk-table .imagify-row-progress{display:none}.imagify-bulk-table .imagify-row-progress,.imagify-bulk-table .imagify-row-progress td{height:15px;padding:0}.imagify-bulk-table .imagify-no-uploaded-yet td{height:200px;font-size:17px;letter-spacing:.1em;word-spacing:.12em;vertical-align:middle;text-transform:uppercase;font-weight:700;text-align:center;color:#999;background-color:#FFF}.imagify-row-complete{padding:35px 20px;margin-top:2em;background:#8BC34A;color:#FFF;text-shadow:0 0 2px rgba(0,0,0,.1)}.imagify-row-complete .imagify-ac-chart{margin-top:3px}.imagify-row-complete p{color:#FFF;margin:0}@-webkit-keyframes congrate{0%{opacity:0;-webkit-transform:scale(1)}50%{-webkit-transform:scale(1.05);opacity:1}100%{-webkit-transform:scale(1);opacity:1}}​ @keyframes congrate{0%{opacity:0;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.05);-ms-transform:scale(1.05);transform:scale(1.05);opacity:1}100%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);opacity:1}}.imagify-row-complete.done{-webkit-animation:congrate .5s ease-in-out;animation:congrate .5s ease-in-out}.imagify-all-complete{margin:1.5em 0}.imagify-all-complete>div{display:inline-block;vertical-align:middle}.imagify-ac-report{min-width:310px}.imagify-ac-chart{width:46px;height:46px;float:left;margin:0 20px 0 10px}.imagify-ac-report-text p{line-height:1.3}.imagify-ac-rt-big{font-size:24px;letter-spacing:.15em;word-spacing:.15em}.imagify-ac-share{text-align:right}.imagify-ac-share-content{display:inline-block;padding:10px 15px;background:rgba(255,255,255,.2)}.imagify-ac-share-content>*{display:inline-block;vertical-align:middle}.imagify-bulk-table .imagify-ac-share-content p{margin-right:5px}.imagify-share-networks,.imagify-share-networks li{margin:0}.imagify-share-networks li{display:inline-block}.imagify-share-networks a{display:inline-block;vertical-align:-7px;margin:0 5px;text-decoration:none;color:#FFF}.imagify-cell-filename{max-width:200px}.imagify-cell-status{max-width:145px}.imagify-cell-status .dashicons-warning{margin-right:2px}.imagify-cell-thumbnails{max-width:120px}td.imagify-cell-filename{-o-text-overflow:clip;text-overflow:clip;white-space:nowrap;overflow:hidden}.imagify-bulk-table td.imagify-cell-totaloriginal{padding-right:78px}.imagifilename,.imagiuploaded{display:inline-block;vertical-align:middle}.imagifilename{font-size:12px}.imagiuploaded{width:33px;height:33px;margin-right:5px;margin-left:-8px;background:url(../images/upload-image.png) no-repeat;background-size:cover}.imagiuploaded img{max-widht:100%;height:auto}.imagistatus{color:#8CA6B3}.status-compressing{color:#46B1CE}.status-error{color:#CE0B24}.status-warning{color:#f5a623}.status-complete{color:#8CC152}.imagify-error{background:#D0021B;color:#FFF}#wpadminbar .imagify-warning *,.imagify-warning{background:#f5a623;color:#FFF;text-shadow:0 0 2px rgba(0,0,0,.2)}.imagify-bulk-table .imagify-cell-thumbnails{text-align:center}.imagify-cell-percentage,.imagify-cell-savings{color:#46B1CE;font-weight:700}.imagify-cell-optimized{font-weight:700}.imagify-cell-totaloriginal{text-align:right}.imagify-modal .h2,.imagify-modal .h3{font-weight:400;letter-spacing:.075em;text-align:center}.dashicons.rotate{-webkit-animation:icon-rotate 2.6s infinite linear;animation:icon-rotate 2.6s infinite linear}.dashicons-admin-generic{-webkit-transform-origin:48.75% 51.75%;-ms-transform-origin:48.75% 51.75%;transform-origin:48.75% 51.75%}.imagify-modal{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.js .imagify-modal{display:none;position:fixed;top:0;right:0;bottom:0;left:0;background-color:#1F2332;background-color:rgba(31,35,50,.95);z-index:99999}.imagify-modal-content{-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:800px;max-width:95%;max-height:90vw;overflow:auto;padding:20px 25px;margin:1em auto;background:#FFF;-webkit-box-shadow:1px 1px 4px rgba(0,0,0,.7);box-shadow:1px 1px 4px rgba(0,0,0,.7);border-radius:3px}#imagify-visual-comparison .imagify-modal-content,.imagify-visual-comparison .imagify-modal-content{max-width:1400px;background:0 0;padding:5px;-webkit-box-shadow:none;box-shadow:none;border-radius:0}.imagify-modal .h2{margin:.5em 0;color:#8ba6b4;font-size:24px}.imagify-modal .h3{color:#40b1d0;font-size:18px}.text-justify{text-align:justify}.imagify-modal .close-btn{display:none;visibility:hidden;position:absolute;right:20px;top:20px;font-size:1.2em;border:0;background:0 0;border-radius:0;cursor:pointer}.imagify-modal .close-btn i{margin-left:-2px}.imagify-modal .close-btn:focus,.imagify-modal .close-btn:hover{color:#40b1d0}.js .imagify-modal .close-btn{display:block;visibility:visible}.js .imagify-iframe-viewing .close-btn{display:none}#imagify-visual-comparison .close-btn,.imagify-visual-comparison .close-btn{top:50px;right:5px;width:33px;height:33px;padding:1px 0 0 2px;border:1px solid #F2F2F2;color:#F2F2F2;line-height:19px;text-align:center;border-radius:50%}.imagify-visual-comparison .close-btn,.wp_attachment_image #imagify-visual-comparison .close-btn{top:0}.imagify-visual-comparison .imagify-modal-content,.wp_attachment_image #imagify-visual-comparison .imagify-modal-content{padding-top:40px}.imagify-modal .imagify-comparison-title{font-size:28px;margin-bottom:1em;color:#F2F2F2;text-align:left}.imagify-modal .imagify-comparison-title .twentytwenty-duo-buttons{position:static;margin:0 10px 0 15px}.imagify-comparison-title .twentytwenty-duo-buttons button{float:none;padding:6px 12px;font-size:16px;text-transform:none;border:1px solid #40B1D0;color:#889;letter-spacing:0}.imagify-comparison-title .twentytwenty-duo-buttons button:focus{outline:0;-webkit-box-shadow:none;box-shadow:none}.imagify-comparison-title .twentytwenty-duo-buttons .selected{border:1px solid #40B1D0;color:#FFF;background:#40B1D0}.imagify-comparison-levels{margin:15px 0;overflow:hidden}.imagify-comparison-levels div{display:none;min-width:175px;font-size:11px}.imagify-comparison-levels .imagify-chart,.imagify-comparison-levels .imagify-chart-container{width:25px;float:none;margin:0}.imagify-visual-comparison .imagify-chart-container canvas{width:15px!important;height:15px!important;margin-right:5px}.imagify-c-level.go-left{float:left}.imagify-c-level.go-right{float:right}.imagify-c-level.go-left,.imagify-c-level.go-right{display:table}.imagify-c-level .imagify-c-level-row{display:table-row;margin:0;color:#FFF}.imagify-c-level-row>span{display:table-cell;padding:2px 0}.imagify-c-level-row .value{text-align:right;padding-left:5px}.imagify-c-level-row .value.level{color:#40b1d0}.imagify-c-level-row .value.size{color:#8bc34a;font-weight:700}.imagify-c-level-row .value .imagify-chart{top:1px}@-webkit-keyframes icon-rotate{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes icon-rotate{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.imagify-menu-bar-img{margin-top:1em}.imagify-modal .loader{position:absolute;top:50%;left:50%;margin:-32px 0 0 -32px;opacity:0;visibility:hidden;-webkit-transition:opacity .4s;-o-transition:opacity .4s;transition:opacity .4s}.imagify-modal .loading .loader{visibility:visible;opacity:1}.imagify-settings .imagify-visual-comparison-text{margin-top:1em;color:#40b1d0;font-weight:700}.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-big-number{font-size:3.7em;margin:-3px 0;line-height:1}.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-col{-ms-flex-preferred-size:50%;flex-basis:50%}.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{content:"";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{content:"";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-col-other-actions{width:18.5%;text-align:right}.imagify-col-other-actions a{font-size:11px}.imagify-offer-selected,.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-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{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 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/css/sweetalert2.min.css CHANGED
@@ -1 +1 @@
1
- .swal2-modal,.swal2-overlay{position:fixed;display:none}.swal2-overlay{background-color:rgba(0,0,0,.4);left:0;right:0;top:0;bottom:0;z-index:1000}.swal2-modal{background-color:#fff;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;border-radius:5px;box-sizing:border-box;text-align:center;left:50%;top:50%;margin-top:-200px;max-height:90%;overflow-x:hidden;overflow-y:auto;z-index:2000}.swal2-modal.loading{overflow-y:hidden}.swal2-modal h2{color:#575757;font-size:30px;text-align:center;font-weight:600;text-transform:none;position:relative;margin:0;padding:0;line-height:60px;display:block}.swal2-modal hr{height:10px;color:transparent;border:0}.swal2-modal button.styled{color:#fff;border:0;box-shadow:none;font-size:17px;font-weight:500;border-radius:3px;padding:10px 32px;margin:0 5px;cursor:pointer}.swal2-content,.swal2-icon{padding:0;position:relative}.swal2-modal button.styled:not(.loading)[disabled]{opacity:.4;cursor:no-drop}.swal2-modal button.styled.loading{box-sizing:border-box;border:4px solid transparent;width:40px;height:40px;padding:0;margin:-2px 30px;vertical-align:top;background-color:transparent!important;color:transparent;cursor:default;border-radius:100%;-webkit-animation:rotate-loading 1.5s linear 0s infinite normal;animation:rotate-loading 1.5s linear 0s infinite normal}.swal2-modal button:not(.styled).loading:after{display:inline-block;content:"";margin-left:5px;vertical-align:-1px;height:6px;width:6px;border:3px solid #999;border-right-color:transparent;border-radius:50%;-webkit-animation:rotate-loading 1.5s linear 0s infinite normal;animation:rotate-loading 1.5s linear 0s infinite normal}.swal2-checkbox input,.swal2-checkbox span,.swal2-radio input,.swal2-radio span{vertical-align:middle}.swal2-modal .swal2-image{margin:20px auto;max-width:100%}.swal2-modal .swal2-close{font-size:36px;line-height:36px;font-family:serif;position:absolute;top:5px;right:13px;cursor:pointer;color:#cfcfcf;-webkit-transition:all .1s ease;transition:all .1s ease}.swal2-modal .swal2-close:hover{color:#d55}.swal2-modal>.swal2-checkbox,.swal2-modal>.swal2-input,.swal2-modal>.swal2-radio,.swal2-modal>.swal2-select,.swal2-modal>.swal2-textarea{display:none}.swal2-content{font-size:18px;text-align:center;font-weight:300;float:none;margin:0;line-height:normal;color:#555}.swal2-icon.swal2-info,.swal2-icon.swal2-question,.swal2-icon.swal2-warning{font-size:60px;line-height:80px;text-align:center}.swal2-icon{width:80px;height:80px;border:4px solid grey;border-radius:50%;margin:20px auto 30px;box-sizing:content-box;cursor:default;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon.swal2-error{border-color:#f27474}.swal2-icon.swal2-error .x-mark{position:relative;display:block}.swal2-icon.swal2-error .line{position:absolute;height:5px;width:47px;background-color:#f27474;display:block;top:37px;border-radius:2px}.swal2-icon.swal2-error .line.left{-webkit-transform:rotate(45deg);transform:rotate(45deg);left:17px}.swal2-icon.swal2-error .line.right{-webkit-transform:rotate(-45deg);transform:rotate(-45deg);right:16px}.swal2-icon.swal2-warning{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;color:#f8bb86;border-color:#f8bb86}.swal2-icon.swal2-info{font-family:"Open Sans",sans-serif;color:#3fc3ee;border-color:#3fc3ee}.swal2-icon.swal2-question{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;color:#c9dae1;border-color:#c9dae1}.swal2-icon.swal2-success{border-color:#a5dc86}.swal2-icon.swal2-success::after,.swal2-icon.swal2-success::before{content:'';position:absolute;width:60px;height:120px;background:#fff}.swal2-icon.swal2-success::before{border-radius:120px 0 0 120px;top:-7px;left:-33px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:60px 60px;transform-origin:60px 60px}.swal2-icon.swal2-success::after{border-radius:0 120px 120px 0;top:-11px;left:30px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:0 60px;transform-origin:0 60px}.swal2-icon.swal2-success .placeholder{width:80px;height:80px;border:4px solid rgba(165,220,134,.2);border-radius:50%;box-sizing:content-box;position:absolute;left:-4px;top:-4px;z-index:2}.swal2-icon.swal2-success .fix{width:7px;height:90px;background-color:#fff;position:absolute;left:28px;top:8px;z-index:1;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-icon.swal2-success .line{height:5px;background-color:#a5dc86;display:block;border-radius:2px;position:absolute;z-index:2}.swal2-icon.swal2-success .line.tip{width:25px;left:14px;top:46px;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.swal2-icon.swal2-success .line.long{width:47px;right:8px;top:38px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-checkbox,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:20px auto}.swal2-input:not([type=file]),.swal2-textarea{width:100%;box-sizing:border-box;border-radius:3px;border:1px solid #d7d7d7;font-size:18px;box-shadow:inset 0 1px 1px rgba(0,0,0,.06);-webkit-transition:all .3s;transition:all .3s}.swal2-input:not([type=file]).error,.swal2-textarea.error{border-color:#f06e57!important}.swal2-input:not([type=file]):focus,.swal2-textarea:focus{outline:0;box-shadow:0 0 3px #c4e6f5;border:1px solid #b4dbed}.swal2-input:not([type=file]):focus::-moz-placeholder,.swal2-textarea:focus::-moz-placeholder{-webkit-transition:opacity .3s 30ms ease;transition:opacity .3s 30ms ease;opacity:.8}.swal2-input:not([type=file]):focus:-ms-input-placeholder,.swal2-textarea:focus:-ms-input-placeholder{-webkit-transition:opacity .3s 30ms ease;transition:opacity .3s 30ms ease;opacity:.8}.swal2-input:not([type=file]):focus::-webkit-input-placeholder,.swal2-textarea:focus::-webkit-input-placeholder{-webkit-transition:opacity .3s 30ms ease;transition:opacity .3s 30ms ease;opacity:.8}.swal2-input:not([type=file])::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#bdbdbd}.swal2-input:not([type=file]):-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#bdbdbd}.swal2-input:not([type=file])::-webkit-input-placeholder,.swal2-textarea::-webkit-input-placeholder{color:#bdbdbd}.swal2-input:not([type=file]){height:43px;padding:0 12px}.swal2-input[type=file]{font-size:20px}.swal2-textarea{height:108px;padding:12px}.swal2-select{color:#555;font-size:inherit;padding:5px 10px;min-width:40%;max-width:100%}.swal2-radio{border:0}.swal2-radio label:not(:first-child){margin-left:20px}.swal2-radio input{margin:0 3px 0 0}.swal2-checkbox{color:#555}.swal2-validationerror{background-color:#f1f1f1;margin:0 -20px;overflow:hidden;padding:10px;color:#797979;font-size:16px;font-weight:300;display:none}.swal2-validationerror::before{content:"!";display:inline-block;width:24px;height:24px;border-radius:50%;background-color:#ea7d7d;color:#fff;line-height:24px;text-align:center;margin-right:10px}@-webkit-keyframes showSweetAlert{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes showSweetAlert{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hideSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}@keyframes hideSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}.show-swal2{-webkit-animation:showSweetAlert .3s;animation:showSweetAlert .3s}.show-swal2.no-animation{-webkit-animation:none;animation:none}.hide-swal2{-webkit-animation:hideSweetAlert .15s;animation:hideSweetAlert .15s}.hide-swal2.no-animation{-webkit-animation:none;animation:none}@-webkit-keyframes animate-success-tip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@keyframes animate-success-tip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@-webkit-keyframes animate-success-long{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@keyframes animate-success-long{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@-webkit-keyframes rotatePlaceholder{0%,5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}100%,12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@keyframes rotatePlaceholder{0%,5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}100%,12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}.animate-success-tip{-webkit-animation:animate-success-tip .75s;animation:animate-success-tip .75s}.animate-success-long{-webkit-animation:animate-success-long .75s;animation:animate-success-long .75s}.swal2-icon.swal2-success.animate::after{-webkit-animation:rotatePlaceholder 4.25s ease-in;animation:rotatePlaceholder 4.25s ease-in}@-webkit-keyframes animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}@keyframes animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}.animate-error-icon{-webkit-animation:animate-error-icon .5s;animation:animate-error-icon .5s}@-webkit-keyframes animate-x-mark{0%,50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}100%{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}@keyframes animate-x-mark{0%,50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}100%{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}.animate-x-mark{-webkit-animation:animate-x-mark .5s;animation:animate-x-mark .5s}@-webkit-keyframes pulse-warning{0%{border-color:#f8d486}100%{border-color:#f8bb86}}@keyframes pulse-warning{0%{border-color:#f8d486}100%{border-color:#f8bb86}}.pulse-warning{-webkit-animation:pulse-warning .75s infinite alternate;animation:pulse-warning .75s infinite alternate}@-webkit-keyframes rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}
1
+ .swal2-modal,.swal2-overlay{position:fixed;display:none}.swal2-overlay{background-color:rgba(0,0,0,.4);left:0;right:0;top:0;bottom:0;z-index:1000}.swal2-modal{background-color:#fff;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;border-radius:5px;-webkit-box-sizing:border-box;box-sizing:border-box;text-align:center;left:50%;top:50%;margin-top:-200px;max-height:90%;overflow-x:hidden;overflow-y:auto;z-index:2000}.swal2-modal.loading{overflow-y:hidden}.swal2-modal h2{color:#575757;font-size:30px;text-align:center;font-weight:600;text-transform:none;position:relative;margin:0;padding:0;line-height:60px;display:block}.swal2-modal hr{height:10px;color:transparent;border:0}.swal2-modal button.styled{color:#fff;border:0;-webkit-box-shadow:none;box-shadow:none;font-size:17px;font-weight:500;border-radius:3px;padding:10px 32px;margin:0 5px;cursor:pointer}.swal2-content,.swal2-icon{padding:0;position:relative}.swal2-modal button.styled:not(.loading)[disabled]{opacity:.4;cursor:no-drop}.swal2-modal button.styled.loading{-webkit-box-sizing:border-box;box-sizing:border-box;border:4px solid transparent;border-color:transparent;width:40px;height:40px;padding:0;margin:-2px 30px;vertical-align:top;background-color:transparent!important;color:transparent;cursor:default;border-radius:100%;-webkit-animation:rotate-loading 1.5s linear 0s infinite normal;animation:rotate-loading 1.5s linear 0s infinite normal}.swal2-modal button:not(.styled).loading:after{display:inline-block;content:"";margin-left:5px;vertical-align:-1px;height:6px;width:6px;border:3px solid #999;border-right-color:transparent;border-radius:50%;-webkit-animation:rotate-loading 1.5s linear 0s infinite normal;animation:rotate-loading 1.5s linear 0s infinite normal}.swal2-checkbox input,.swal2-checkbox span,.swal2-radio input,.swal2-radio span{vertical-align:middle}.swal2-modal .swal2-image{margin:20px auto;max-width:100%}.swal2-modal .swal2-close{font-size:36px;line-height:36px;font-family:serif;position:absolute;top:5px;right:13px;cursor:pointer;color:#cfcfcf;-webkit-transition:all .1s ease;-o-transition:all .1s ease;transition:all .1s ease}.swal2-modal .swal2-close:hover{color:#d55}.swal2-modal>.swal2-checkbox,.swal2-modal>.swal2-input,.swal2-modal>.swal2-radio,.swal2-modal>.swal2-select,.swal2-modal>.swal2-textarea{display:none}.swal2-content{font-size:18px;text-align:center;font-weight:300;float:none;margin:0;line-height:normal;color:#555}.swal2-icon.swal2-info,.swal2-icon.swal2-question,.swal2-icon.swal2-warning{font-size:60px;line-height:80px;text-align:center}.swal2-icon{width:80px;height:80px;border:4px solid grey;border-radius:50%;margin:20px auto 30px;-webkit-box-sizing:content-box;box-sizing:content-box;cursor:default;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon.swal2-error{border-color:#f27474}.swal2-icon.swal2-error .x-mark{position:relative;display:block}.swal2-icon.swal2-error .line{position:absolute;height:5px;width:47px;background-color:#f27474;display:block;top:37px;border-radius:2px}.swal2-icon.swal2-error .line.left{-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);left:17px}.swal2-icon.swal2-error .line.right{-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);right:16px}.swal2-icon.swal2-warning{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;color:#f8bb86;border-color:#f8bb86}.swal2-icon.swal2-info{font-family:"Open Sans",sans-serif;color:#3fc3ee;border-color:#3fc3ee}.swal2-icon.swal2-question{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;color:#c9dae1;border-color:#c9dae1}.swal2-icon.swal2-success{border-color:#a5dc86}.swal2-icon.swal2-success::after,.swal2-icon.swal2-success::before{content:'';position:absolute;width:60px;height:120px;background:#fff}.swal2-icon.swal2-success::before{border-radius:120px 0 0 120px;top:-7px;left:-33px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:60px 60px;-ms-transform-origin:60px 60px;transform-origin:60px 60px}.swal2-icon.swal2-success::after{border-radius:0 120px 120px 0;top:-11px;left:30px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:0 60px;-ms-transform-origin:0 60px;transform-origin:0 60px}.swal2-icon.swal2-success .placeholder{width:80px;height:80px;border:4px solid rgba(165,220,134,.2);border-radius:50%;-webkit-box-sizing:content-box;box-sizing:content-box;position:absolute;left:-4px;top:-4px;z-index:2}.swal2-icon.swal2-success .fix{width:7px;height:90px;background-color:#fff;position:absolute;left:28px;top:8px;z-index:1;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-icon.swal2-success .line{height:5px;background-color:#a5dc86;display:block;border-radius:2px;position:absolute;z-index:2}.swal2-icon.swal2-success .line.tip{width:25px;left:14px;top:46px;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.swal2-icon.swal2-success .line.long{width:47px;right:8px;top:38px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-checkbox,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:20px auto}.swal2-input:not([type=file]),.swal2-textarea{width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:3px;border:1px solid #d7d7d7;font-size:18px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.06);box-shadow:inset 0 1px 1px rgba(0,0,0,.06);-webkit-transition:all .3s;-o-transition:all .3s;transition:all .3s}.swal2-input:not([type=file]).error,.swal2-textarea.error{border-color:#f06e57!important}.swal2-input:not([type=file]):focus,.swal2-textarea:focus{outline:0;-webkit-box-shadow:0 0 3px #c4e6f5;box-shadow:0 0 3px #c4e6f5;border:1px solid #b4dbed}.swal2-input:not([type=file]):focus::-moz-placeholder,.swal2-textarea:focus::-moz-placeholder{-webkit-transition:opacity .3s 30ms ease;-o-transition:opacity .3s 30ms ease;transition:opacity .3s 30ms ease;opacity:.8}.swal2-input:not([type=file]):focus:-ms-input-placeholder,.swal2-textarea:focus:-ms-input-placeholder{-webkit-transition:opacity .3s 30ms ease;-o-transition:opacity .3s 30ms ease;transition:opacity .3s 30ms ease;opacity:.8}.swal2-input:not([type=file]):focus::-webkit-input-placeholder,.swal2-textarea:focus::-webkit-input-placeholder{-webkit-transition:opacity .3s 30ms ease;-o-transition:opacity .3s 30ms ease;transition:opacity .3s 30ms ease;opacity:.8}.swal2-input:not([type=file])::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#bdbdbd}.swal2-input:not([type=file]):-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#bdbdbd}.swal2-input:not([type=file])::-webkit-input-placeholder,.swal2-textarea::-webkit-input-placeholder{color:#bdbdbd}.swal2-input:not([type=file]){height:43px;padding:0 12px}.swal2-input[type=file]{font-size:20px}.swal2-textarea{height:108px;padding:12px}.swal2-select{color:#555;font-size:inherit;padding:5px 10px;min-width:40%;max-width:100%}.swal2-radio{border:0}.swal2-radio label:not(:first-child){margin-left:20px}.swal2-radio input{margin:0 3px 0 0}.swal2-checkbox{color:#555}.swal2-validationerror{background-color:#f1f1f1;margin:0 -20px;overflow:hidden;padding:10px;color:#797979;font-size:16px;font-weight:300;display:none}.swal2-validationerror::before{content:"!";display:inline-block;width:24px;height:24px;border-radius:50%;background-color:#ea7d7d;color:#fff;line-height:24px;text-align:center;margin-right:10px}@-webkit-keyframes showSweetAlert{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes showSweetAlert{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hideSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}@keyframes hideSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}.show-swal2{-webkit-animation:showSweetAlert .3s;animation:showSweetAlert .3s}.show-swal2.no-animation{-webkit-animation:none;animation:none}.hide-swal2{-webkit-animation:hideSweetAlert .15s;animation:hideSweetAlert .15s}.hide-swal2.no-animation{-webkit-animation:none;animation:none}@-webkit-keyframes animate-success-tip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@keyframes animate-success-tip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@-webkit-keyframes animate-success-long{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@keyframes animate-success-long{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@-webkit-keyframes rotatePlaceholder{0%,5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}100%,12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@keyframes rotatePlaceholder{0%,5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}100%,12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}.animate-success-tip{-webkit-animation:animate-success-tip .75s;animation:animate-success-tip .75s}.animate-success-long{-webkit-animation:animate-success-long .75s;animation:animate-success-long .75s}.swal2-icon.swal2-success.animate::after{-webkit-animation:rotatePlaceholder 4.25s ease-in;animation:rotatePlaceholder 4.25s ease-in}@-webkit-keyframes animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}@keyframes animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}.animate-error-icon{-webkit-animation:animate-error-icon .5s;animation:animate-error-icon .5s}@-webkit-keyframes animate-x-mark{0%,50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}100%{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}@keyframes animate-x-mark{0%,50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}100%{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}.animate-x-mark{-webkit-animation:animate-x-mark .5s;animation:animate-x-mark .5s}@-webkit-keyframes pulse-warning{0%{border-color:#f8d486}100%{border-color:#f8bb86}}@keyframes pulse-warning{0%{border-color:#f8d486}100%{border-color:#f8bb86}}.pulse-warning{-webkit-animation:pulse-warning .75s infinite alternate;animation:pulse-warning .75s infinite alternate}@-webkit-keyframes rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}
assets/css/twentytwenty.min.css CHANGED
@@ -1 +1 @@
1
- .twentytwenty-handle{z-index:40;position:absolute;left:50%;top:50%;height:64px;width:64px;margin-left:-32px;margin-top:-32px;border-radius:50%;box-shadow:0 3px 0 #338EA6;background:#40B1D0;cursor:pointer}.twentytwenty-horizontal .twentytwenty-handle:before,.twentytwenty-horizontal .twentytwenty-handle:after{left:50%;width:2px;height:9999px;margin-left:-1px}.twentytwenty-horizontal .twentytwenty-handle:before{bottom:50%;margin-bottom:32px;box-shadow:0 3px 0 white,0px 0px 12px rgba(51,51,51,0.5)}.twentytwenty-horizontal .twentytwenty-handle:after{top:50%;margin-top:34px;box-shadow:0 -3px 0 white,0px 0px 12px rgba(51,51,51,0.5)}.twentytwenty-horizontal .twentytwenty-handle:before,.twentytwenty-horizontal .twentytwenty-handle:after{content:"";position:absolute;z-index:30;display:block;background:#F2F5F7;box-shadow:0px 0px 12px rgba(51,51,51,0.5)}.twentytwenty-labels,.twentytwenty-overlay{position:absolute;top:0;width:100%;height:100%;-webkit-transition-duration:0.5s;transition-duration:0.5s}.twentytwenty-labels{opacity:1;-webkit-transition-property:opacity;transition-property:opacity}.twentytwenty-labels .twentytwenty-label-content{position:absolute;padding:0 12px;font-size:13px;letter-spacing:0.1em;line-height:38px;color:white;background:#1F2332;border-radius:2px}.twentytwenty-horizontal .twentytwenty-labels .twentytwenty-label-content{bottom:15px}.twentytwenty-after-label .twentytwenty-label-content{background:#40B1D0}.twentytwenty-left-arrow,.twentytwenty-right-arrow{position:absolute;width:0;height:0;border:8px inset transparent}.twentytwenty-left-arrow,.twentytwenty-right-arrow{top:50%;margin-top:-8px}.twentytwenty-container{box-sizing:content-box;position:relative;z-index:0;overflow:hidden;box-shadow:0 5px 10px rgba(0,0,0,0.15);opacity:0;-webkit-transition:opacity 0.4s;transition:opacity 0.4s;-webkit-user-select:none;-moz-user-select:none}.twentytwenty-container *{box-sizing:content-box}.twentytwenty-container img{position:absolute;top:0;display:block;width:100%;height:auto}.loaded .twentytwenty-container{opacity:1}.twentytwenty-container.active .twentytwenty-overlay .twentytwenty-labels,.twentytwenty-container.active .twentytwenty-overlay:hover .twentytwenty-labels{opacity:0}.twentytwenty-horizontal .twentytwenty-before-label .twentytwenty-label-content{left:15px}.twentytwenty-horizontal .twentytwenty-after-label .twentytwenty-label-content{right:15px}.twentytwenty-overlay{z-index:25}.twentytwenty-before{z-index:20}.twentytwenty-after{z-index:10}.twentytwenty-duo-buttons{position:absolute;top:10px;z-index:30;overflow:hidden}.twentytwenty-duo-buttons button{float:left;padding:2px 6px;font-size:11px;text-transform:uppercase;letter-spacing:0.125em;font-weight:bold;border:0;background:#1f2332;color:#FFF;transition:all .3s;cursor:pointer}.twentytwenty-duo-buttons button:hover,.twentytwenty-duo-buttons button:focus{background:#444}.twentytwenty-duo-buttons button:first-child{border-radius:3px 0 0 3px}.twentytwenty-duo-buttons button:last-child{border-radius:0 3px 3px 0}.twentytwenty-duo-buttons button.selected{background:#8bc34a;text-shadow:0 0 1px rgba(0,0,0,.2);cursor:default}.twentytwenty-duo-left{left:10px}.twentytwenty-duo-right{right:10px}.twentytwenty-left-arrow{left:50%;margin-left:-22px;border-right:8px solid white}.twentytwenty-right-arrow{right:50%;margin-right:-22px;border-left:8px solid white}.modal-is-too-high .imagify-comparison-levels{position:absolute;padding:15px 20px;background:rgba(31,35,50,0.95);bottom:0;left:0;right:0;margin-bottom:0}
1
+ .twentytwenty-handle{z-index:40;position:absolute;left:50%;top:50%;height:64px;width:64px;margin-left:-32px;margin-top:-32px;border-radius:50%;-webkit-box-shadow:0 3px 0 #338EA6;box-shadow:0 3px 0 #338EA6;background:#40B1D0;cursor:pointer}.twentytwenty-horizontal .twentytwenty-handle:after,.twentytwenty-horizontal .twentytwenty-handle:before{left:50%;width:2px;height:9999px;margin-left:-1px;content:"";position:absolute;z-index:30;display:block;background:#F2F5F7;-webkit-box-shadow:0 0 12px rgba(51,51,51,.5);box-shadow:0 0 12px rgba(51,51,51,.5)}.twentytwenty-horizontal .twentytwenty-handle:before{bottom:50%;margin-bottom:32px}.twentytwenty-horizontal .twentytwenty-handle:after{top:50%;margin-top:34px}.twentytwenty-labels,.twentytwenty-overlay{position:absolute;top:0;width:100%;height:100%;-webkit-transition-duration:.5s;-o-transition-duration:.5s;transition-duration:.5s}.twentytwenty-labels{opacity:1;-webkit-transition-property:opacity;-o-transition-property:opacity;transition-property:opacity}.twentytwenty-labels .twentytwenty-label-content{position:absolute;padding:0 12px;font-size:13px;letter-spacing:.1em;line-height:38px;color:#fff;background:#1F2332;border-radius:2px}.twentytwenty-horizontal .twentytwenty-labels .twentytwenty-label-content{bottom:15px}.twentytwenty-after-label .twentytwenty-label-content{background:#40B1D0}.twentytwenty-left-arrow,.twentytwenty-right-arrow{position:absolute;width:0;height:0;border:8px inset transparent;top:50%;margin-top:-8px}.twentytwenty-container{-webkit-box-sizing:content-box;box-sizing:content-box;position:relative;z-index:0;overflow:hidden;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.15);box-shadow:0 5px 10px rgba(0,0,0,.15);opacity:0;-webkit-transition:opacity .4s;-o-transition:opacity .4s;transition:opacity .4s;-webkit-user-select:none;-moz-user-select:none}.twentytwenty-container *{-webkit-box-sizing:content-box;box-sizing:content-box}.twentytwenty-container img{position:absolute;top:0;display:block;width:100%;height:auto}.loaded .twentytwenty-container{opacity:1}.twentytwenty-container.active .twentytwenty-overlay .twentytwenty-labels,.twentytwenty-container.active .twentytwenty-overlay:hover .twentytwenty-labels{opacity:0}.twentytwenty-horizontal .twentytwenty-before-label .twentytwenty-label-content{left:15px}.twentytwenty-horizontal .twentytwenty-after-label .twentytwenty-label-content{right:15px}.twentytwenty-overlay{z-index:25}.twentytwenty-before{z-index:20}.twentytwenty-after{z-index:10}.twentytwenty-duo-buttons{position:absolute;top:10px;z-index:30;overflow:hidden}.twentytwenty-duo-buttons button{float:left;padding:2px 6px;font-size:11px;text-transform:uppercase;letter-spacing:.125em;font-weight:700;border:0;background:#1f2332;color:#FFF;-webkit-transition:all .3s;-o-transition:all .3s;transition:all .3s;cursor:pointer}.twentytwenty-duo-buttons button:focus,.twentytwenty-duo-buttons button:hover{background:#444}.twentytwenty-duo-buttons button:first-child{border-radius:3px 0 0 3px}.twentytwenty-duo-buttons button:last-child{border-radius:0 3px 3px 0}.twentytwenty-duo-buttons button.selected{background:#8bc34a;text-shadow:0 0 1px rgba(0,0,0,.2);cursor:default}.twentytwenty-duo-left{left:10px}.twentytwenty-duo-right{right:10px}.twentytwenty-left-arrow{left:50%;margin-left:-22px;border-right:8px solid #fff}.twentytwenty-right-arrow{right:50%;margin-right:-22px;border-left:8px solid #fff}.modal-is-too-high .imagify-comparison-levels{position:absolute;padding:15px 20px;background:rgba(31,35,50,.95);bottom:0;left:0;right:0;margin-bottom:0}
assets/images/big-blue-check.png CHANGED
File without changes
assets/images/check-1.svg CHANGED
File without changes
assets/images/check-mini-1.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-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/mushrooms-aggressive.jpg CHANGED
File without changes
assets/images/mushrooms-normal.jpg CHANGED
File without changes
assets/images/mushrooms-original.jpg CHANGED
File without changes
assets/images/mushrooms-ultra.jpg CHANGED
File without changes
assets/images/pic-ericwaltr.jpg CHANGED
File without changes
assets/images/pic-srhdesign.jpg CHANGED
File without changes
assets/js/admin.js CHANGED
@@ -1,1066 +1,1189 @@
1
- jQuery(function($){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- var concat = ajaxurl.indexOf("?") > 0 ? "&" : "?",
4
- imagify = {
5
- log: function ( content ) {
6
- if (console !== 'undefined') console.log( content );
7
- },
8
- info: function ( content ) {
9
- if (console !== 'undefined') console.info( content );
10
- }
11
- };
12
 
13
- /*
14
- * Create a new Imagify account
 
 
 
15
  */
16
- $('#imagify-signup').click( function(e){
17
  e.preventDefault();
18
 
19
- // Display the sign up form
20
- swal({
21
- title: imagifyAdmin.labels.signupTitle,
22
- html: imagifyAdmin.labels.signupText,
23
- confirmButtonText: imagifyAdmin.labels.signupConfirmButtonText,
24
- input: 'email',
25
- closeOnConfirm: false,
26
- allowOutsideClick: true,
27
  showLoaderOnConfirm: true,
28
- customClass: "imagify-sweet-alert imagify-sweet-alert-signup",
29
- inputValidator: function(inputValue) {
30
- return new Promise(function(resolve, reject) {
31
- if ($.trim(inputValue) == "" || ! inputValue) {
32
- reject(imagifyAdmin.labels.signupErrorEmptyEmail);
33
- } else {
34
- resolve();
35
- }
36
- });
37
- },
38
- preConfirm: function(inputValue) {
39
- return new Promise(function(resolve, reject) {
40
- setTimeout(function() {
41
- $.get(ajaxurl + concat + "action=imagify_signup&email=" +inputValue + "&imagifysignupnonce="+ $('#imagifysignupnonce').val())
42
- .done(function(response){
43
- if( !response.success ) {
44
- reject(response.data);
45
- } else {
46
- resolve();
47
- }
48
- });
49
- }, 2000);
50
- });
51
  },
52
- }).then(function(inputValue){
53
- swal({
54
- title:imagifyAdmin.labels.signupSuccessTitle,
55
- html: imagifyAdmin.labels.signupSuccessText,
56
- type: "success",
57
- customClass: "imagify-sweet-alert"
58
- });
59
- });
60
- });
61
- /*
62
- * Check and save the Imagify API Key
 
63
  */
64
- $('#imagify-save-api-key').click( function(e){
65
  e.preventDefault();
66
 
67
- // Display the sign up form
68
- swal({
69
- title: imagifyAdmin.labels.saveApiKeyTitle,
70
- html: imagifyAdmin.labels.saveApiKeyText,
71
- confirmButtonText: imagifyAdmin.labels.saveApiKeyConfirmButtonText,
72
- input: 'text',
73
- allowOutsideClick: true,
74
  showLoaderOnConfirm: true,
75
- customClass: "imagify-sweet-alert imagify-sweet-alert-signup",
76
- inputValidator: function(inputValue) {
77
- return new Promise(function(resolve, reject) {
78
- if ($.trim(inputValue) == "" || ! inputValue) {
79
- reject(imagifyAdmin.labels.ApiKeyErrorEmpty);
80
- } else {
81
- resolve();
82
- }
83
- });
84
  },
85
- preConfirm: function(inputValue) {
86
- return new Promise(function(resolve, reject) {
87
- $.get(ajaxurl + concat + "action=imagify_check_api_key_validity&api_key=" +inputValue + "&imagifycheckapikeynonce="+ $('#imagifycheckapikeynonce').val())
88
- .done(function(response){
89
- if( !response.success ) {
90
- reject( response.data );
91
- } else {
92
- resolve();
93
- }
94
- });
95
- });
96
  },
97
- }).then(function(inputValue){
98
- swal({
99
- title: imagifyAdmin.labels.ApiKeyCheckSuccessTitle,
100
- html: imagifyAdmin.labels.ApiKeyCheckSuccessText,
101
- type: "success",
102
- customClass: "imagify-sweet-alert"
103
- });
104
- });
105
- });
106
-
107
- /*
108
- * Toggle an Imagify notice
109
  */
110
- $('.imagify-notice-dismiss').click( function( e ) {
 
 
 
 
111
  e.preventDefault();
112
-
113
- var obj = $(this),
114
- parent = obj.parents('.imagify-welcome, .imagify-notice'),
115
- href = obj.attr('href');
116
-
117
- // Hide the notice
118
- parent.fadeTo( 100 , 0, function() {
119
- $(this).slideUp( 100, function() {
120
- $(this).remove();
121
- });
122
- });
123
-
124
- // Save the dismiss notice
125
- $.get( href.replace( 'admin-post.php', 'admin-ajax.php' ) );
126
- });
127
-
128
-
129
- /*
130
- * Imagify Light modal
131
- */
132
- var imagify_open_modal = function( $the_link ){
133
 
134
- var the_target = $the_link.data('target') || $the_link.attr('href');
 
 
 
 
 
 
 
 
 
 
 
135
 
136
- $( the_target ).css('display', 'flex').hide().fadeIn(400).attr('aria-hidden', 'false').attr('tabindex', '0').focus().removeAttr('tabindex').addClass('modal-is-open');
137
- $('body').addClass('imagify-modal-is-open');
138
 
 
 
 
 
 
 
 
 
139
  };
140
 
141
- // accessibility
142
  $( '.imagify-modal' ).attr( 'aria-hidden', 'true' );
143
 
144
- // on click on modal trigger
145
- $( '.imagify-modal-trigger' ).on('click.imagify', function(){
146
- imagify_open_modal( $(this) );
 
147
  return false;
148
- });
149
-
150
- // on click on close button
151
- $( document ).on( 'click.imagify', '.imagify-modal .close-btn', function(){
152
- $(this).closest( '.imagify-modal' ).fadeOut( 400 ).attr( 'aria-hidden', 'true' ).removeClass( 'modal-is-open' );
153
-
154
- // in Payment modal case
155
- if ( $(this).closest( '.imagify-modal' ).hasClass( 'imagify-payment-modal' ) ) {
156
-
157
- // reset viewing class & aria-labelledby
158
- $(this).closest( '.imagify-modal-content' ).removeClass( 'imagify-success-viewing imagify-iframe-viewing' );
159
-
160
- // reset first view after fadeout ~= 300 ms
161
- setTimeout( function() {
162
- $( '.imagify-modal-views' ).hide();
163
- $( '#imagify-pre-checkout-view' ).show();
164
- }, 300 );
165
- }
166
 
167
  $( 'body' ).removeClass( 'imagify-modal-is-open' );
168
- })
169
- .on( 'blur.imagify', '.imagify-modal .close-btn', function(){
170
- var $modal = $(this).closest('.imagify-modal');
171
- if ( $modal.attr('aria-hidden') === 'false' ) {
172
- $modal.attr('tabindex', '0').focus().removeAttr('tabindex');
173
- }
174
- });
175
 
176
- // On click on dropped layer of modal
177
- $( document ).on('click.imagify', '.imagify-modal', function( e ) {
 
 
 
 
178
  $( e.target ).filter( '.modal-is-open' ).find( '.close-btn' ).trigger( 'click.imagify' );
179
- });
180
-
181
- // `Esc` key binding
182
- $( window ).on( 'keydown.imagify', function( e ) {
183
- if ( e.keyCode == 27 && $('.imagify-modal.modal-is-open').length > 0 ) {
184
-
185
  e.preventDefault();
186
-
187
- // trigger the event
188
- $('.imagify-modal.modal-is-open').find('.close-btn').trigger('click.imagify');
189
 
190
  return false;
191
  }
192
- });
193
-
194
- var busy = false,
195
- xhr = false;
196
-
197
- $( '#wp-admin-bar-imagify' ).hover( function() {
198
- if ( true === busy ) {
199
- return;
200
- }
201
-
202
- busy = true;
203
-
204
- var $adminBarProfile = $('#wp-admin-bar-imagify-profile-content');
205
-
206
- if( $adminBarProfile.is(':empty') ) {
207
- xhr = $.get(ajaxurl + concat + "action=imagify_get_admin_bar_profile&imagifygetadminbarprofilenonce="+ $('#imagifygetadminbarprofilenonce').val())
208
- .done(function(response){
209
- $adminBarProfile.html(response.data);
210
- $('#wp-admin-bar-imagify-profile-loading').remove();
211
- busy = false;
212
- });
213
- }
214
- });
215
 
216
  /**
217
- * Payment Modal
218
- *
219
  * @since 1.6
220
  * @since 1.6.3 include discount campaign
221
  * @author Geoffrey
222
  */
223
-
224
- if ( $('#imagify-pricing-modal').length ) {
225
- var $modal = $('#imagify-pricing-modal'),
226
- imagify_get_html_price = function( content, period ) {
227
- if ( ! period ) period = null;
228
- output = '';
229
 
230
- if ( typeof content === 'object' ) {
231
- var monthly = content.monthly + "",
232
- yearly = content.yearly + "",
233
- m = monthly.split('.'),
234
- y = yearly.split('.');
235
 
236
- output += '<span class="imagify-switch-my"><span aria-hidden="' + ( period === 'monthly' ? 'false' : 'true' ) + '" class="imagify-monthly"><span class="imagify-price-big">' + m[0] + '</span> <span class="imagify-price-mini">.' + ( m[1].length === 1 ? m[1] + '0' : ( '' + m[1] ).substring( 0, 2 ) ) + '</span></span> <span aria-hidden="' + ( period === 'yearly' ? 'false' : 'true' ) + '" class="imagify-yearly"><span class="imagify-price-big">' + y[0] + '</span> <span class="imagify-price-mini">.' + ( y[1].length === 1 ? y[1] + '0' : ( '' + y[1] ).substring( 0, 2 ) ) + '</span></span></span>';
237
- } else {
238
- var content = content + "", // be sure content is a string
239
- v = content.split('.');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
 
241
- output += '<span class="imagify-price-big">' + v[0] + '</span> <span class="imagify-price-mini">.' + ( v[1].length === 1 ? v[1] + '0' : ( '' + v[1] ).substring( 0, 2 ) ) + '</span>';
242
- }
 
 
 
 
 
243
 
244
  return output;
245
- },
246
- imagify_get_html_discount_price = function( content, period ) {
247
- if ( ! period ) period = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  output = '';
249
 
250
- if ( typeof content === 'object' ) {
251
- var monthly = content.monthly + "",
252
- yearly = content.yearly + "";
253
-
254
- output += '<span class="imagify-price-discount">'
255
- + '<span class="imagify-price-discount-dollar">$</span>'
256
- + '<span class="imagify-switch-my">'
257
- + '<span aria-hidden="' + ( period === 'monthly' ? 'false' : 'true' ) + '" class="imagify-monthly">'
258
- + '<span class="imagify-price-discount-number">' + monthly + '</span>'
259
- + '</span>'
260
- + '<span aria-hidden="' + ( period === 'yearly' ? 'false' : 'true' ) + '" class="imagify-yearly">'
261
- + '<span class="imagify-price-discount-number">' + yearly + '</span>'
262
- + '</span>'
263
- + '</span>'
264
- + '</span>';
265
- } else {
266
- var content = content + ""; // be sure content is a string
267
 
268
- output += '<span class="imagify-price-discount">'
269
- + '<span class="imagify-price-discount-dollar">$</span>'
270
- + '<span class="imagify-price-discount-number">' + content + '</span>'
271
- + '</span>';
272
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
 
274
- return output;
275
- },
276
- imagify_populate_offer = function ( $offer, datas, type, classes ) {
277
- var promo = window.imagify_discount_datas,
278
- add = datas.additional_gb, // 4 (monthly)
279
- ann = datas.annual_cost, // 49.9 (monthly)
280
- id = datas.id, // 3 (monthly/onetime)
281
- lab = datas.label, // 'lite' (monthly/onetime)
282
- mon = datas.monthly_cost, // 4.99 (monthly)
283
- quo = datas.quota, // 1000 (MB) - 5000 images (monthly/onetime)
284
- cos = datas.cost, // 3.49 (onetime)
285
- name = ( quo >= 1000 ? quo/1000 + ' GB' : quo + ' MB' ),
286
- pcs = type === 'monthly' ? { monthly: mon, yearly: Math.round( ann / 12 * 100 ) / 100 } : cos,
287
- pcsd = pcs; // used if discount is active
288
-
289
- // change pricing value only if discount in percentage is active
290
- // and if offer is a monthly and not a onetime
291
- if ( promo.is_active && promo.coupon_type === 'percentage' && type === 'monthly' ) {
292
- var percent = ( 100 - promo.coupon_value ) / 100;
293
- pcs = type === 'monthly' ? { monthly: mon * percent, yearly: Math.round( ( ann * percent ) / 12 * 100 ) / 100 } : cos * percent;
294
- }
295
 
296
- if ( typeof classes !== 'undefined' ) {
297
- $offer.addClass( 'imagify-' + type + '-' + lab + classes);
298
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
 
300
- // name
301
- $offer.find('.imagify-offer-size').text( name );
302
-
303
- // main prices (pcs can be an object or a string)
304
- $offer.find('.imagify-number-block').html( imagify_get_html_price( pcs, 'monthly' ) );
305
-
306
- // discount prices
307
- if ( promo.is_active && promo.coupon_type === 'percentage' && type === 'monthly' ) {
308
-
309
- $offer.find('.imagify-price-block').prev( '.imagify-price-discount' ).remove();
310
- $offer.find('.imagify-price-block').before( imagify_get_html_discount_price( pcsd, 'monthly' ) );
311
- }
312
 
313
- // nb images
314
- $offer.find('.imagify-approx-nb').text( quo * 5 );
315
 
316
- if ( type === 'monthly' ) {
317
- // additionnal price
318
- $offer.find('.imagify-price-add-data').text( '$' + add );
319
- }
320
 
321
- // button data-offer attr
322
- var $datas_c = $offer.find('.imagify-payment-btn-select-plan').length ? $offer.find('.imagify-payment-btn-select-plan') : $offer,
323
- datas_content = ( type === 'monthly' )
324
- ?
325
- '{"' + lab + '":{"id":' + id + ',"name":"' + name + '","data":' + quo + ',"dataf":"' + name + '","imgs":' + ( quo * 5 ) + ',"prices":{"monthly":' + pcs.monthly + ',"yearly":' + pcs.yearly + ',"add":' + add + '}}}'
326
- :
327
- '{"ot' + lab + '":{"id":' + id + ',"name":"' + name + '","data":' + quo + ',"dataf":"' + name + '","imgs":' + ( quo * 5 ) + ',"price":' + pcs + '}}'
328
- ;
329
 
330
- $datas_c.attr('data-offer', datas_content);
 
 
331
 
332
- return $offer;
333
- },
334
- imagify_populate_pay_btn = function() {
335
- var pl_datas = JSON.parse( $( '.imagify-offer-monthly' ).attr( 'data-offer' ) ),
336
- ot_datas = JSON.parse( $( '.imagify-offer-onetime' ).attr( 'data-offer' ) ),
337
- price = 0,
338
- price_pl = 0,
339
- price_ot = 0;
340
-
341
- // calculate price_pl only if that offer is selected
342
- if ( $( '.imagify-offer-monthly' ).hasClass( 'imagify-offer-selected' ) ) {
343
- price_pl = $('#imagify-subscription-monthly').filter(':checked').length ? pl_datas[ Object.keys( pl_datas )[0] ].prices.monthly : pl_datas[ Object.keys( pl_datas )[0] ].prices.yearly * 12;
344
- }
345
- // calculate price_ot only if that offer is selected
346
- if ( $( '.imagify-offer-onetime' ).hasClass( 'imagify-offer-selected' ) ) {
347
- price_ot = ot_datas[ Object.keys( ot_datas )[0] ].price;
348
- }
 
349
 
350
- // calculate price
351
- price = parseFloat( price_ot + price_pl ).toFixed(2);
352
 
353
- // edit button price
354
- $( '.imagify-global-amount' ).text( price );
 
 
 
 
355
 
356
- if ( price == '0.00' || price === 0 ) {
357
- $( '#imagify-modal-checkout-btn' ).attr( 'disabled', 'disabled' ).addClass( 'imagify-button-disabled' );
 
 
358
  } else {
359
- $( '#imagify-modal-checkout-btn' ).removeAttr( 'disabled' ).removeClass( 'imagify-button-disabled' );
360
  }
 
361
 
362
- },
363
- imagify_get_pricing = function( $button ){
364
- var nonce = $button.data('nonce'),
365
- prices_rq_datas = {
366
- action: 'imagify_get_prices',
367
- imagifynonce: nonce
368
- },
369
- imgs_rq_datas = {
370
- action: 'imagify_get_images_counts',
371
- imagifynonce: nonce
372
- },
373
- prices_rq_discount = {
374
- action: 'imagify_get_discount',
375
- imagifynonce: nonce
376
- };
377
-
378
- $modal.find('.imagify-modal-loader').hide().show();
379
-
380
- /*
381
- TODO: change the way to waterfall requests
382
- Use setInterval + counter instead
383
- */
384
-
385
- // get the true prices
386
- $.post( ajaxurl, prices_rq_datas, function( prices_response ) {
387
-
388
- if ( prices_response.success ) {
389
-
390
- // get the image estimates sizes
391
- $.post( ajaxurl, imgs_rq_datas, function( imgs_response ) {
392
-
393
- if ( imgs_response.success ) {
394
-
395
- // get the discount informations
396
- $.post( ajaxurl, prices_rq_discount, function( discount_response ) {
397
-
398
- if ( discount_response.success ) {
399
-
400
- var images_datas = imgs_response.data
401
- prices_datas = prices_response.data,
402
- promo_datas = discount_response.data,
403
- monthlies = prices_datas.monthlies,
404
- onetimes = prices_datas.onetimes,
405
- mo_user_cons = Math.round( images_datas.average_month_size.raw / 1000000 ), // 1000000 in MB,
406
- ot_user_cons = Math.round( images_datas.total_library_size.raw / 1000000 ), // in MB,
407
- $mo_tpl = $('#imagify-offer-monthly-template'),
408
- $ot_tpl = $('#imagify-offer-onetime-template'),
409
- ot_clone = $ot_tpl.html(),
410
- mo_clone = $mo_tpl.html(),
411
- ot_html = '',
412
- mo_html = '',
413
- ot_suggested = false,
414
- mo_suggested = false,
415
- $estim_block = $( '.imagify-estimation-block' );
416
-
417
- // Refresh Analyzing block
418
- $estim_block.removeClass( 'imagify-analyzing' );
419
- $estim_block.find( '.average-month-size' ).text( images_datas.average_month_size.human );
420
- $estim_block.find( '.total-library-size' ).text( images_datas.total_library_size.human );
421
-
422
- // Switch offers title is < 25mb
423
- if ( mo_user_cons < 25 && ot_user_cons < 25 ) {
424
- $( '.imagify-pre-checkout-offers .imagify-modal-title' ).addClass( 'imagify-enough-free' );
425
- $('.imagify-offer-selected' ).removeClass( 'imagify-offer-selected' ).find( '.imagify-checkbox' ).removeAttr( 'checked' );
426
- } else {
427
- $( '.imagify-enough-free' ).removeClass( 'imagify-enough-free' );
428
- $('.imagify-offer-selected' ).addClass( 'imagify-offer-selected' ).find( '.imagify-checkbox' ).attr( 'checked', 'checked' );
429
- }
430
-
431
- // Don't create prices table if something went wrong during request
432
- if ( monthlies === null || onetimes === null ) {
433
- var $offers_block = $( '.imagify-pre-checkout-offers' );
434
-
435
- // hide main content
436
- $offers_block.hide().attr( 'aria-hidden', true );
437
-
438
- // show error message
439
- $offers_block.closest('.imagify-modal-views').find('.imagify-popin-message').remove();
440
- $offers_block.after('<div class="imagify-popin-message imagify-error"><p>' + imagifyAdmin.labels.errorPriceAPI + '</p></div>');
441
-
442
- // show the modal content
443
- $modal.find('.imagify-modal-loader').fadeOut(300);
444
-
445
- return;
446
- }
447
-
448
- // Autofill coupon code & Show banner if discount is active
449
- window.imagify_discount_datas = promo_datas;
450
-
451
- if ( promo_datas.is_active ) {
452
- var $banners = $( '.imagify-modal-promotion' ),
453
- date_end = promo_datas.date_end.split('T')[0],
454
- promo = promo_datas.coupon_value;
455
- discount = promo_datas.coupon_type === 'percentage' ? promo + '%' : '$' + promo;
456
-
457
- // fill coupon code
458
- $( '#imagify-coupon-code' ).val( promo_datas.label ).attr( 'readonly', true );
459
-
460
- // show banners
461
- $banners.addClass( 'active' ).attr( 'aria-hidden', 'false' );
462
-
463
- // populate banners
464
- $banners.find( '.imagify-promotion-number' ).text( discount );
465
- $banners.find( '.imagify-promotion-date' ).text( date_end );
466
-
467
-
468
- // auto validate coupon
469
- imagify_check_coupon();
470
- }
471
-
472
- /**
473
- * Below lines will build Plan and Onetime offers lists
474
- * It will also pre-select a Plan and Onetime in both of views: pre-checkout and pricing tables
475
- */
476
-
477
- // Now, do the MONTHLIES Markup
478
- $.each( monthlies, function( index, value ) {
479
-
480
- // if it's free, don't show it
481
- if ( value.label === 'free' ) {
482
- return true; // continue-like (but $.each is not a loop… so)
483
- }
484
-
485
- var $tpl= $( mo_clone ).clone();
486
-
487
- // if offer is too big (far) than estimated needs, don't show the offer
488
- if ( mo_suggested !== false && ( index - mo_suggested ) > 2 ) {
489
- return true;
490
- }
491
-
492
- // parent classes
493
- classes = '';
494
- if ( ( mo_user_cons < value.quota && mo_suggested === false ) ) {
495
- classes = ' imagify-offer-selected';
496
- mo_suggested = index;
497
-
498
- // add this offer as pre-selected item in pre-checkout view
499
- var $offer = $('.imagify-pre-checkout-offers').find('.imagify-offer-monthly');
500
-
501
- // populate the Pre-checkout view depending on user_cons
502
- imagify_populate_offer( $offer, value, 'monthly' );
503
- }
504
-
505
- // populate each offer
506
- $tpl = imagify_populate_offer( $tpl, value, 'monthly', classes );
507
-
508
- // complete Monthlies HTML
509
- mo_html += $tpl[0].outerHTML;
510
-
511
- });
512
-
513
- // Deal with the case of too much small offers (before recommanded one)
514
- var prev_offers = $( mo_html ).filter('.imagify-offer-selected').prevAll();
515
-
516
- // if we have more than 1 previous offer
517
- if ( prev_offers.length > 1 ) {
518
- var nb_to_remove = prev_offers.length - 1,
519
- $total_offers = $( mo_html );
520
-
521
- // remove too far previous offer
522
- for ( i = 0; i < nb_to_remove; i++ ) {
523
- delete $total_offers[ i ]
524
- }
525
-
526
- // rebuild mo_html with removed items
527
- mo_html = '';
528
- for ( j = 0; j < $total_offers.length; j++) {
529
- mo_html += $( '<div/>' ).append($total_offers[j]).html();
530
- }
531
- }
532
-
533
- // Do the ONETIMES Markup
534
- $.each( onetimes, function( index, value ) {
535
- var $tpl = $( ot_clone ).clone(),
536
- $offer = $( '.imagify-pre-checkout-offers' ).find( '.imagify-offer-onetime' );
537
-
538
- // parent classes
539
- classes = '';
540
- if ( ( ot_user_cons < value.quota && ot_suggested === false ) ) {
541
- classes = ' imagify-offer-selected';
542
- ot_suggested = true;
543
-
544
- // populate the Pre-checkout view depending on user_cons
545
- imagify_populate_offer( $offer, value, 'onetime' );
546
- }
547
-
548
- // if too big, populate with the biggest offer available
549
- // TODO: create custom offers at this point
550
- if ( index === onetimes.length-1 && ot_suggested === false ) {
551
- // populate the Pre-checkout view depending on user_cons
552
- var tvalue = onetimes[ onetimes.length - 1 ];
553
- imagify_populate_offer( $offer, tvalue, 'onetime' );
554
- }
555
-
556
- // populate each offer
557
- $tpl = imagify_populate_offer( $tpl, value, 'onetime', classes );
558
-
559
- // complete Onetimes HTML
560
- ot_html += $tpl[0].outerHTML;
561
- });
562
-
563
- // Fill pricing tables
564
- if ( $mo_tpl.parent().find( '.imagify-offer-line' ) ) {
565
- $mo_tpl.parent().find( '.imagify-offer-line' ).remove();
566
- }
567
- $mo_tpl.before( mo_html );
568
-
569
- if ( $ot_tpl.parent().find( '.imagify-offer-line' ) ) {
570
- $ot_tpl.parent().find( '.imagify-offer-line' ).remove();
571
- }
572
- $ot_tpl.before( ot_html );
573
-
574
- // Show the content
575
- $modal.find( '.imagify-modal-loader' ).fadeOut( 300 );
576
-
577
- } else {
578
- // TODO: replace modal content by any information
579
- // an error occurred
580
- }
581
-
582
- }); // third AJAX request to get discount information
583
 
584
- } else {
585
- // TODO: replace modal content by any information
586
- // an error occurred
587
- }
588
 
589
- }); // second AJAX request for image estimation sizes
 
590
 
591
- } else {
592
- // TODO: replace modal content by any information
593
- // an error occurred
594
- }
 
 
595
 
596
- // populate Pay button
597
- imagify_populate_pay_btn();
598
- }); // end $.post
599
- },
600
- imagify_check_check = function( $checkbox ) {
601
- var sel_class = 'imagify-offer-selected';
602
 
603
- $checkbox.each(function(){
604
- if ( $(this).is(':checked') ) {
605
- $(this).closest('.imagify-offer-line').addClass( sel_class );
606
- }
607
- else {
608
- $(this).closest('.imagify-offer-line').removeClass( sel_class );
609
- }
610
- });
611
 
612
- // Update pay button
613
- imagify_populate_pay_btn();
614
- },
615
- imagify_check_radio = function( $radio ) {
616
- var year_class = 'imagify-year-selected',
617
- month_class = 'imagify-month-selected';
618
-
619
- $radio.each(function(){
620
- // to handle modal pricing & modal suggestion
621
- var $_this = $(this);
622
- var $parent = '';
623
-
624
- if ( $_this.parent('.imagify-cart-list-switcher').length ) {
625
- $parent = $_this.closest('.imagify-cart');
626
- } else if ( $_this.parent('.imagify-small-options').length ) {
627
- $parent = $_this.parent('.imagify-small-options').next('.imagify-pricing-table');
628
- } else {
629
- $parent = $_this.closest('.imagify-offer-line');
630
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
631
 
632
- var $to_switch = $parent.find('.imagify-switch-my');
 
633
 
634
- if ( $_this.val() === 'yearly' ) {
635
- $parent.addClass( year_class ).removeClass( month_class );
636
- $to_switch.find('.imagify-monthly').attr('aria-hidden', 'true');
637
- $to_switch.find('.imagify-yearly').attr('aria-hidden', 'false');
638
- } else {
639
- $parent.addClass( month_class ).removeClass( year_class );
640
- $to_switch.find('.imagify-monthly').attr('aria-hidden', 'false');
641
- $to_switch.find('.imagify-yearly').attr('aria-hidden', 'true');
642
  }
643
- });
644
 
645
- // update Pay button information
646
- imagify_populate_pay_btn();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
647
 
648
- return $radio;
649
- },
650
- imagify_check_coupon = function() {
651
- var code = $( '#imagify-coupon-code' ).val();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
652
 
653
- if ( code !== '' ) {
654
- var $cptext = $( '.imagify-coupon-text' ),
655
- $label = $cptext.find( 'label' ),
656
- $section = $( '.imagify-coupon-section' ),
657
- nonce = $( '#imagify-get-pricing-modal' ).data( 'nonce' );
658
 
659
- $cptext.addClass( 'checking' );
 
660
 
661
- // get the true prices
662
- $.post( ajaxurl, {action: 'imagify_check_coupon', coupon: code, imagifynonce: nonce }, function( response ) {
 
663
 
664
- $cptext.removeClass( 'checking' );
 
 
 
665
 
666
- // error during the request
667
- if ( response.success === 'false' ) {
668
 
669
- $label.text( imagifyAdmin.labels.errorCouponAPI );
670
- $section.removeClass( 'validated' ).addClass( 'invalid' );
 
 
 
671
 
672
- } else {
673
- if ( response.data.success ) {
674
- var coupon_value = response.data.coupon_type === 'percentage' ? response.data.value + '%' : '$' + response.data.value;
675
- $section.removeClass( 'invalid' ).addClass( 'validated' );
676
- $label.html( imagifyAdmin.labels.successCouponAPI );
677
- $label.find( '.imagify-coupon-offer' ).text( coupon_value );
678
- $label.find( '.imagify-coupon-word' ).text( code );
679
- } else {
680
- $section.removeClass( 'validated' ).addClass( 'invalid' );
681
- $label.text( response.data.detail );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
682
  }
683
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
684
  }
685
- });
686
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
687
  }
688
- },
689
- $checkboxes = $('.imagify-offer-line').find('.imagify-checkbox'),
690
- $radios = $('.imagify-payment-modal').find('.imagify-radio-line').find('input');
691
-
692
- // check all boxes on load
693
- imagify_check_check( $checkboxes );
694
- imagify_check_radio( $radios.filter(':checked') );
695
-
696
- // check coupon onload
697
- imagify_check_coupon();
698
-
699
- var populate_btn_price = setInterval( function() {
700
- imagify_populate_pay_btn();
701
- }, 1000 );
702
-
703
- // check the changed box
704
- $checkboxes.on('change.imagify', function(){
705
- imagify_check_check( $(this) );
706
- });
707
-
708
- // check the radio box
709
- $radios.on('change.imagify', function(){
710
- imagify_check_radio( $(this) );
711
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
712
 
713
  /**
714
- * Get pricings on modal opening
715
- * Build the pricing tables inside modal
716
  */
717
- $('#imagify-get-pricing-modal').on('click.imagify-ajax', function(){
718
- imagify_get_pricing( $(this) );
719
- });
720
 
721
  /**
722
  * 1) Modal Payment change/select plan
723
  * 2) Checkout selection(s)
724
  * 3) Payment process
725
  */
726
-
727
- // plans selection view & payment process view hidden by default
728
- var $plans_view = $('#imagify-plans-selection-view'),
729
- $payment_view = $('#imagify-payment-process-view'),
730
- $pre_view = $('#imagify-pre-checkout-view'),
731
- $success_view = $('#imagify-success-view'),
732
- speedFadeIn = 300,
733
- $another_btn = $('.imagify-choose-another-plan'),
734
- imagify_iframe_set_src = function( params ) {
735
- /*
736
- params = {
737
- 'monthly': {
738
- 'lite': {
739
- name: 'something',
740
- id: ''
741
- }
742
- },
743
- 'onetime': {
744
- 'recommended': {
745
- name: 'Recommend',
746
- id: ''
747
- }
748
- },
749
- 'period': 'monthly'|'yearly'
750
- }
751
- */
752
- var $iframe = $('#imagify-payment-iframe'),
753
- iframe_src = $iframe.attr('src'),
754
- pay_src = $iframe.data('src'),
755
- monthly_id = 0,
756
- onetime_id = 0;
757
-
758
- // if we get new informations about products
759
- if ( typeof params === 'object' ) {
760
- if ( params.monthly ) {
761
- monthly_id = params.monthly[ Object.keys( params.monthly )[0] ].id;
762
- }
763
- if ( params.onetime ) {
764
- onetime_id = params.onetime[ Object.keys( params.onetime )[0] ].id;
765
- // if onetime ID === 999 it's a custom plan, send datas instead
766
- onetime_id = ( onetime_id == 999 ? params.onetime[ Object.keys( params.onetime )[0] ].data : onetime_id );
767
- }
768
-
769
- if ( params.period ) {
770
- var key = imagify_get_api_key(),
771
- rt_onetime = onetime_id,
772
- rt_yearly = params.period === 'yearly' ? monthly_id : 0,
773
- rt_monthly = params.period === 'monthly' ? monthly_id : 0,
774
- coupon = $('#imagify-coupon-code').val(),
775
- rt_coupon = coupon === '' ? 'none' : coupon,
776
- // not used but…
777
- amount = parseFloat( $( '.imagify-global-amount' ).text() ).toFixed(2);
778
-
779
- // compose route
780
- // pay_src + :ontimeplan(0)/:monthlyplan(0)/:yearlyplan(0)/:coupon(none)/
781
- pay_src = pay_src + rt_onetime + '/' + rt_monthly + '/' + rt_yearly + '/' + rt_coupon + '/';
782
-
783
- // iFrame sort of cache fix
784
- $iframeClone = $iframe.clone();
785
- $iframe.remove();
786
-
787
- $iframeClone.attr( 'src', pay_src );
788
- $payment_view.html( $iframeClone );
789
 
790
- } else {
791
- imagify.info( 'No period defined' );
792
- }
793
- }
794
- // if we only change monthly/yearly payment mode
795
- else if ( typeof params === 'string' && iframe_src !== '' ) {
796
- tofind = params === 'monthly' ? 'yearly' : 'monthly';
797
- iframe_src = iframe_src.replace( tofind, params );
798
- $iframe.attr( 'src', iframe_src );
799
- }
800
- },
801
- imagify_get_period = function() {
802
- return ( $('.imagify-offer-monthly').hasClass('imagify-month-selected') ? 'monthly' : 'yearly' );
803
- },
804
- imagify_get_api_key = function(){
805
- return $('#imagify-payment-iframe').data('imagify-api');
806
- };
807
 
808
- /**
809
- * Get validation for Coupon Code
810
- * - On blur
811
- * - On Enter or Spacebar press
812
- * - On click OK button
813
- *
814
- * @since 1.6.3 Only if field hasn't readonly attribute (discount auto-applied)
815
- */
816
- $( '#imagify-coupon-code' ).on( 'blur.imagify', function() {
817
- if ( ! $(this).attr('readonly') ) {
818
- imagify_check_coupon();
 
 
819
  }
820
- } ).on( 'keydown.imagify', function( e ) {
821
- if ( ! $(this).attr('readonly') ) {
822
- if ( e.keyCode === 13 || e.keyCode === 32 ) {
823
- imagify_check_coupon();
824
- return false;
825
- }
826
- if ( $(this).val().length >= 3 ) {
827
- $(this).closest( '.imagify-coupon-input' ).addClass( 'imagify-canbe-validate' );
828
- } else {
829
- $(this).closest( '.imagify-coupon-input' ).removeClass( 'imagify-canbe-validate' );
830
- }
831
  }
832
- } );
833
 
834
- $( '#imagify-coupon-validate' ).on( 'click.imagify', function() {
835
- imagify_check_coupon();
836
- $(this).closest( '.imagify-canbe-validate' ).removeClass( 'imagify-canbe-validate' );
837
- } );
 
 
 
 
 
 
 
 
838
  /**
839
- * View game, step by step
840
  */
841
- // init views
842
- //$pre_view.hide();
843
- $plans_view.hide();
844
- $payment_view.hide();
845
- $success_view.hide();
846
-
847
- // 1) when you decide to choose another plan
848
-
849
- // 1.a) on click, display choices
850
- $another_btn.on('click.imagify', function(){
851
- var $_this = $(this),
852
- type = $_this.data('imagify-choose');
853
-
854
- // hide current
855
- $_this.closest('.imagify-modal-views').hide().attr('aria-hidden', 'true');
856
- // hide the checkout view (click could be a triggered action ;p)
857
- $payment_view.hide().attr('aria-hidden', 'true');
858
-
859
- // show choices
860
- $plans_view.fadeIn(speedFadeIn).attr('aria-hidden', 'false');
861
-
862
- // trigger on tab
863
- var temp = setInterval(function(){
864
- var tab = type == 'plan' ? 'monthly' : 'onetime';
865
- $plans_view.find('a[href="#imagify-pricing-tab-' + tab + '"]').trigger('click.imagify');
866
- clearInterval( temp );
867
- temp = null;
868
- }, 60 );
 
 
 
 
 
869
 
870
- return false;
871
- });
872
-
873
- // 1.b) on click in a choice, return to pre-checkout step
874
- $modal.on('click.imagify', '.imagify-payment-btn-select-plan', function(){
875
-
876
- var $_this = $(this),
877
- $offer_line = $_this.closest('.imagify-offer-line'),
878
- datas = $_this.data('offer'),
879
- datas_str = $_this.attr('data-offer'),
880
- is_onetime = ( $_this.closest('.imagify-tab-content').attr('id') === 'imagify-pricing-tab-monthly' ? false : true ),
881
- $target_line = ( is_onetime ? $pre_view.find('.imagify-offer-onetime') : $pre_view.find('.imagify-offer-monthly') ),
882
- period = ( is_onetime ? null : ( ( $_this.closest('.imagify-pricing-table').hasClass('imagify-month-selected') ) ? 'monthly' : 'yearly') ),
883
- price = ( is_onetime ? imagify_get_html_price( datas[ Object.keys( datas )[0] ].price ) : imagify_get_html_price ( datas[ Object.keys( datas )[0] ].prices, period ) ),
884
- discount = $offer_line.find('.imagify-price-discount').html(),
885
- imgs = $offer_line.find('.imagify-approx-nb').text(),
886
- offer_size = $offer_line.find('.imagify-offer-size').text(),
887
- monthly_txt = ( ! is_onetime ? '<span class="imagify-price-by">' + $offer_line.find('.imagify-price-by').text() + '</span>' : '' );
888
-
889
- // change views to go back pre-checkout
890
- $plans_view.hide().attr('aria-hidden', 'true');
891
- $pre_view.fadeIn(speedFadeIn).attr('aria-hidden', 'false');
892
-
893
- // change price (+ "/month" if found in monthly plans)
894
- $target_line.find('.imagify-number-block').html( price + monthly_txt )
895
-
896
- // change discount
897
- $target_line.find('.imagify-price-discount').html( discount );
898
-
899
- // change approx images nb
900
- $target_line.find('.imagify-approx-nb').text( imgs );
901
-
902
- // change offer size name
903
- $target_line.find('.imagify-offer-size').text( offer_size );
904
-
905
- // change datas (json)
906
- $target_line.attr('data-offer', datas_str );
907
-
908
- if ( ! is_onetime ) {
909
- $target_line.find('.imagify-price-add-data').text( $offer_line.find('.imagify-price-add-data').text() );
910
-
911
- // trigger period selected from offer selection view to pre-checkout view
912
- if ( period === 'monthly' ) {
913
- $target_line.find('#imagify-subscription-monthly').trigger('click.imagify');
914
- }
915
- else {
916
- $target_line.find('#imagify-subscription-yearly').trigger('click.imagify');
917
- }
918
- $target_line.find('.imagify-inline-options').find('input:radio:checked').trigger('change.imagify');
919
  }
920
 
921
- // update price information in button
922
- imagify_populate_pay_btn();
 
923
 
924
- return false;
925
- });
 
 
 
926
 
 
 
 
 
927
 
928
- // 2) when you checkout
929
- $( '#imagify-modal-checkout-btn' ).on( 'click.imagify', function() {
 
 
 
 
 
 
930
 
931
- // do nothing if button disabled
932
- if ( $( this ).hasClass( 'imagify-button-disabled' ) ) {
933
- return;
934
- }
935
 
936
- var $monthly_offer = $( '.imagify-offer-monthly' ),
937
- $onetime_offer = $( '.imagify-offer-onetime' ),
938
- checkout_datas = {},
939
- period_choosen = $monthly_offer.hasClass( 'imagify-year-selected' ) ? 'year' : 'month';
940
 
941
- // if user choose a monthly plan
942
- if ( $monthly_offer.hasClass( 'imagify-offer-selected' ) ) {
943
-
944
- checkout_datas.monthly = JSON.parse( $monthly_offer.attr( 'data-offer' ) );
945
- $( '.imagify-cart-list-my-choice' ).show();
946
 
947
- // price calculation
948
- prices = checkout_datas.monthly[Object.keys(checkout_datas.monthly)[0]].prices;
949
- save_price = Math.round( ( ( prices.monthly - prices.yearly ) * 12 ) * 100 ) / 100;
950
- $( '.imagify-nb-save-per-year' ).text( '$' + save_price );
 
 
 
951
 
952
- } else {
953
- $( '.imagify-cart-list-my-choice' ).hide();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
954
  }
955
 
956
- // if user choose a one time plan
957
- if ( $onetime_offer.hasClass('imagify-offer-selected') ) {
958
- checkout_datas.onetime = JSON.parse( $onetime_offer.attr('data-offer') );
 
 
 
 
 
 
 
959
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
960
 
961
- // change views to go to checkout/payment view
962
- $pre_view.hide().attr( 'aria-hidden', 'true' );
963
- $payment_view.fadeIn( speedFadeIn ).attr( 'aria-hidden', 'false' )
964
- .closest( '.imagify-modal-content' ).addClass( 'imagify-iframe-viewing' );
 
 
 
 
 
 
 
 
 
 
965
 
966
- checkout_datas.period = imagify_get_period();
 
 
 
 
 
967
 
968
- imagify_iframe_set_src( checkout_datas );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
969
  return false;
970
- });
971
-
972
- /**
973
- * Go back to previous step ("Choose Another Plan" links)
974
- */
975
- $('.imagify-back-to-plans').on('click.imagify', function(){
976
- var $_this = $(this),
977
- is_onetime = $_this.closest('.imagify-cart-item').hasClass('imagify-cart-item-onetime');
 
 
 
 
 
 
 
 
 
 
978
 
979
- if ( is_onetime ) {
980
- $('.imagify-offer-onetime').find('.imagify-choose-another-plan').trigger('click.imagify');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
981
  } else {
982
- $('.imagify-offer-monthly').find('.imagify-choose-another-plan').trigger('click.imagify');
983
  }
 
 
984
 
985
- return false;
986
- });
 
 
987
 
988
- /**
989
- * Public function triggered by payement iframe
990
- */
991
- //$pre_view.hide();
992
- //$plans_view.hide();
993
- //$payment_view.hide();
994
- //$success_view.hide();
995
- var paymentClose = function() {
996
- $( '.imagify-iframe-viewing .close-btn' ).trigger( 'click.imagify' );
997
- $( '.imagify-iframe-viewing' ).removeClass( 'imagify-iframe-viewing' );
998
- return false;
999
- },
1000
- paymentBack = function() {
1001
- $( '.imagify-iframe-viewing' ).removeClass( 'imagify-iframe-viewing' );
1002
- $payment_view.hide();
1003
- $pre_view.fadeIn(200);
1004
- return false;
1005
- },
1006
- paymentSuccess = function() {
1007
- $( '.imagify-iframe-viewing' ).removeClass( 'imagify-iframe-viewing' );
1008
- $payment_view.hide();
1009
- $success_view.closest( '.imagify-modal-content' ).addClass( 'imagify-success-viewing' );
1010
- $success_view.closest( '.imagify-modal' ).attr( 'aria-labelledby', 'imagify-success-view' );
1011
- $success_view.fadeIn(200);
1012
- return false;
1013
- },
1014
- checkPluginMessage = function(event) {
1015
- var origin = event.origin || event.originalEvent.origin;
1016
-
1017
- if ( origin === 'https://app.imagify.io' || origin === 'http://dapp.imagify.io' ) {
1018
- switch (event.data) {
1019
- case 'cancel': paymentClose(); break;
1020
- case 'back': paymentBack(); break;
1021
- case 'success': paymentSuccess(); break;
1022
- }
1023
- }
1024
- };
1025
 
1026
- // message/communication API
1027
- window.addEventListener( 'message', checkPluginMessage, true );
 
 
1028
 
1029
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1030
 
1031
  /**
1032
- * Tabs
1033
- *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1034
  * @Markup:
1035
  * ul.imagify-tabs
1036
- * li.imagify-tab.imagify-current
1037
- * a[href="#target"]
1038
  * div.imagify-tabs-contents
1039
- * div.imagify-tab-content#target
1040
  */
1041
- if ( $('.imagify-tabs').length ) {
1042
-
1043
- var $tabs = $('.imagify-tab');
 
1044
 
1045
- $tabs.on('click.imagify', function(){
1046
-
1047
- var $_this = $(this);
1048
 
1049
- if ( ! $_this.hasClass('imagify-current') ) {
1050
- var target = $_this.find('a').attr('href') || '#' + $_this.find('a').attr('aria-controls'),
1051
- curr_class = 'imagify-current';
1052
 
1053
- // show right tab content
1054
- $_this.closest('.imagify-tabs').next('.imagify-tabs-contents').find('.imagify-tab-content').hide().attr('aria-hidden', 'true');
1055
- $( target ).fadeIn(275).attr('aria-hidden', 'false');
1056
 
1057
- // change active tabs
1058
- $_this.closest('.imagify-tabs').find('.imagify-tab').removeClass( curr_class ).attr('aria-selected', 'false');
1059
- $_this.addClass( curr_class ).attr('aria-selected', 'true');
1060
- }
1061
 
1062
- return false;
1063
- });
 
 
1064
 
1065
- }
1066
- });
1
+ /* globals ajaxurl: false, console: false, imagify: true, imagifyAdmin: true, swal: false, Promise: false */
2
+
3
+ window.imagify = window.imagify || {
4
+ concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?',
5
+ log: function( content ) {
6
+ if ( undefined !== console ) {
7
+ console.log( content );
8
+ }
9
+ },
10
+ info: function( content ) {
11
+ if ( undefined !== console ) {
12
+ console.info( content );
13
+ }
14
+ }
15
+ };
16
+
17
+ // Admin bar =======================================================================================
18
+ (function($, d, w, undefined) {
19
+
20
+ var busy = false;
21
+
22
+ $( '#wp-admin-bar-imagify' ).hover( function() {
23
+ var $adminBarProfile;
24
+
25
+ if ( true === busy ) {
26
+ return;
27
+ }
28
+
29
+ busy = true;
30
+
31
+ $adminBarProfile = $( '#wp-admin-bar-imagify-profile-content' );
32
+
33
+ if ( ! $adminBarProfile.is( ':empty' ) ) {
34
+ return;
35
+ }
36
+
37
+ $.get( ajaxurl + imagify.concat + 'action=imagify_get_admin_bar_profile&imagifygetadminbarprofilenonce=' + $( '#imagifygetadminbarprofilenonce' ).val() )
38
+ .done( function( response ) {
39
+ $adminBarProfile.html( response.data );
40
+ $( '#wp-admin-bar-imagify-profile-loading' ).remove();
41
+ busy = false;
42
+ } );
43
+ } );
44
+
45
+ } )(jQuery, document, window);
46
 
 
 
 
 
 
 
 
 
 
47
 
48
+ // The big welcome notice ==========================================================================
49
+ (function($, d, w, undefined) {
50
+
51
+ /**
52
+ * 1. Create a new Imagify account.
53
  */
54
+ $( '#imagify-signup' ).on( 'click.imagify', function( e ) {
55
  e.preventDefault();
56
 
57
+ // Display the sign up form.
58
+ swal( {
59
+ title: imagifyAdmin.labels.signupTitle,
60
+ html: imagifyAdmin.labels.signupText,
61
+ confirmButtonText: imagifyAdmin.labels.signupConfirmButtonText,
62
+ input: 'email',
63
+ allowOutsideClick: true,
 
64
  showLoaderOnConfirm: true,
65
+ customClass: 'imagify-sweet-alert imagify-sweet-alert-signup',
66
+ inputValidator: function( inputValue ) {
67
+ return new Promise( function( resolve, reject ) {
68
+ if ( $.trim( inputValue ) === '' || ! inputValue ) {
69
+ reject( imagifyAdmin.labels.signupErrorEmptyEmail );
70
+ } else {
71
+ resolve();
72
+ }
73
+ } );
74
+ },
75
+ preConfirm: function( inputValue ) {
76
+ return new Promise( function( resolve, reject ) {
77
+ setTimeout( function() {
78
+ $.get( ajaxurl + imagify.concat + 'action=imagify_signup&email=' + inputValue + '&imagifysignupnonce=' + $( '#imagifysignupnonce' ).val() )
79
+ .done( function( response ) {
80
+ if ( ! response.success ) {
81
+ reject( response.data );
82
+ } else {
83
+ resolve();
84
+ }
85
+ } );
86
+ }, 2000 );
87
+ } );
88
  },
89
+ } ).then( function() {
90
+ swal( {
91
+ title: imagifyAdmin.labels.signupSuccessTitle,
92
+ html: imagifyAdmin.labels.signupSuccessText,
93
+ type: 'success',
94
+ customClass: 'imagify-sweet-alert'
95
+ } );
96
+ } );
97
+ } );
98
+
99
+ /**
100
+ * 2. Check and save the Imagify API Key.
101
  */
102
+ $( '#imagify-save-api-key' ).on( 'click.imagify', function( e ) {
103
  e.preventDefault();
104
 
105
+ // Display the API key form.
106
+ swal( {
107
+ title: imagifyAdmin.labels.saveApiKeyTitle,
108
+ html: imagifyAdmin.labels.saveApiKeyText,
109
+ confirmButtonText: imagifyAdmin.labels.saveApiKeyConfirmButtonText,
110
+ input: 'text',
111
+ allowOutsideClick: true,
112
  showLoaderOnConfirm: true,
113
+ customClass: 'imagify-sweet-alert imagify-sweet-alert-signup',
114
+ inputValidator: function( inputValue ) {
115
+ return new Promise( function( resolve, reject ) {
116
+ if ( $.trim( inputValue ) === '' || ! inputValue ) {
117
+ reject( imagifyAdmin.labels.ApiKeyErrorEmpty );
118
+ } else {
119
+ resolve();
120
+ }
121
+ } );
122
  },
123
+ preConfirm: function( inputValue ) {
124
+ return new Promise( function( resolve, reject ) {
125
+ $.get( ajaxurl + imagify.concat + 'action=imagify_check_api_key_validity&api_key=' + inputValue + '&imagifycheckapikeynonce=' + $( '#imagifycheckapikeynonce' ).val() )
126
+ .done( function( response ) {
127
+ if ( ! response.success ) {
128
+ reject( response.data );
129
+ } else {
130
+ resolve();
131
+ }
132
+ } );
133
+ } );
134
  },
135
+ } ).then( function() {
136
+ swal( {
137
+ title: imagifyAdmin.labels.ApiKeyCheckSuccessTitle,
138
+ html: imagifyAdmin.labels.ApiKeyCheckSuccessText,
139
+ type: 'success',
140
+ customClass: 'imagify-sweet-alert'
141
+ } );
142
+ } );
143
+ } );
144
+
145
+ /**
146
+ * Close an Imagify notice.
147
  */
148
+ $( '.imagify-notice-dismiss' ).on( 'click.imagify', function( e ) {
149
+ var $this = $( this ),
150
+ $parent = $this.parents( '.imagify-welcome, .imagify-notice' ),
151
+ href = $this.attr( 'href' );
152
+
153
  e.preventDefault();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
155
+ // Hide the notice.
156
+ $parent.fadeTo( 100 , 0, function() {
157
+ $( this ).slideUp( 100, function() {
158
+ $( this ).remove();
159
+ } );
160
+ } );
161
+
162
+ // Save the dismiss notice.
163
+ $.get( href.replace( 'admin-post.php', 'admin-ajax.php' ) );
164
+ } );
165
+
166
+ } )(jQuery, document, window);
167
 
 
 
168
 
169
+ // Imagify light modal =============================================================================
170
+ (function($, d, w, undefined) {
171
+
172
+ var imagify_open_modal = function( $the_link ) {
173
+ var the_target = $the_link.data( 'target' ) || $the_link.attr( 'href' );
174
+
175
+ $( the_target ).css( 'display', 'flex' ).hide().fadeIn( 400 ).attr( 'aria-hidden', 'false' ).attr( 'tabindex', '0' ).focus().removeAttr( 'tabindex' ).addClass( 'modal-is-open' );
176
+ $( 'body' ).addClass( 'imagify-modal-is-open' );
177
  };
178
 
179
+ // Accessibility.
180
  $( '.imagify-modal' ).attr( 'aria-hidden', 'true' );
181
 
182
+ $( d )
183
+ // On click on modal trigger.
184
+ .on( 'click.imagify', '.imagify-modal-trigger', function() {
185
+ imagify_open_modal( $( this ) );
186
  return false;
187
+ } )
188
+ // On click on close button.
189
+ .on( 'click.imagify', '.imagify-modal .close-btn', function() {
190
+ var $modal = $( this ).closest( '.imagify-modal' );
191
+
192
+ $modal.fadeOut( 400 ).attr( 'aria-hidden', 'true' ).removeClass( 'modal-is-open' ).trigger( 'modalClosed.imagify' );
 
 
 
 
 
 
 
 
 
 
 
 
193
 
194
  $( 'body' ).removeClass( 'imagify-modal-is-open' );
195
+ } )
196
+ // On close button blur, improve accessibility.
197
+ .on( 'blur.imagify', '.imagify-modal .close-btn', function() {
198
+ var $modal = $( this ).closest( '.imagify-modal' );
 
 
 
199
 
200
+ if ( $modal.attr( 'aria-hidden' ) === 'false' ) {
201
+ $modal.attr( 'tabindex', '0' ).focus().removeAttr( 'tabindex' );
202
+ }
203
+ } )
204
+ // On click on dropped layer of modal.
205
+ .on( 'click.imagify', '.imagify-modal', function( e ) {
206
  $( e.target ).filter( '.modal-is-open' ).find( '.close-btn' ).trigger( 'click.imagify' );
207
+ } )
208
+ // `Esc` key binding.
209
+ .on( 'keydown.imagify', function( e ) {
210
+ if ( 27 === e.keyCode && $( '.imagify-modal.modal-is-open' ).length > 0 ) {
 
 
211
  e.preventDefault();
212
+ // Trigger the event.
213
+ $( '.imagify-modal.modal-is-open' ).find( '.close-btn' ).trigger( 'click.imagify' );
 
214
 
215
  return false;
216
  }
217
+ } );
218
+
219
+ } )(jQuery, document, window);
220
+
221
+
222
+ // Imagify payment modal ===========================================================================
223
+ (function($, d, w, undefined) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
 
225
  /**
226
+ * Payment Modal.
227
+ *
228
  * @since 1.6
229
  * @since 1.6.3 include discount campaign
230
  * @author Geoffrey
231
  */
232
+ var imagifyModal = {};
 
 
 
 
 
233
 
234
+ if ( ! $( '#imagify-pricing-modal' ).length ) {
235
+ return;
236
+ }
 
 
237
 
238
+ imagifyModal = {
239
+ $modal: $( '#imagify-pricing-modal' ),
240
+ $checkboxes: $( '.imagify-offer-line .imagify-checkbox' ),
241
+ $radios: $( '.imagify-payment-modal .imagify-radio-line input' ),
242
+ // Plans selection view & payment process view hidden by default.
243
+ $preView: $( '#imagify-pre-checkout-view' ),
244
+ $plansView: $( '#imagify-plans-selection-view' ).hide(),
245
+ $paymentView: $( '#imagify-payment-process-view' ).hide(),
246
+ $successView: $( '#imagify-success-view' ).hide(),
247
+ $anotherBtn: $( '.imagify-choose-another-plan' ),
248
+ speedFadeIn: 300,
249
+
250
+ getHtmlPrice: function( content, period ) {
251
+ var monthly, yearly, m, y, output;
252
+
253
+ if ( ! period ) {
254
+ period = null;
255
+ }
256
 
257
+ if ( typeof content !== 'object' ) {
258
+ content += ''; // Be sure content is a string.
259
+ content = content.split( '.' );
260
+ content[1] = content[1].length === 1 ? content[1] + '0' : ( '' + content[1] ).substring( 0, 2 );
261
+
262
+ output = '<span class="imagify-price-big">' + content[0] + '</span> ';
263
+ output += '<span class="imagify-price-mini">.' + content[1] + '</span>';
264
 
265
  return output;
266
+ }
267
+
268
+ monthly = content.monthly + '';
269
+ yearly = content.yearly + '';
270
+ m = monthly.split( '.' );
271
+ y = yearly.split( '.' );
272
+ output = '<span class="imagify-switch-my">';
273
+ output += '<span aria-hidden="' + ( period === 'monthly' ? 'false' : 'true' ) + '" class="imagify-monthly">';
274
+ output += '<span class="imagify-price-big">' + m[0] + '</span> ';
275
+ output += '<span class="imagify-price-mini">.' + ( m[1].length === 1 ? m[1] + '0' : ( '' + m[1] ).substring( 0, 2 ) ) + '</span>';
276
+ output += '</span> ';
277
+ output += '<span aria-hidden="' + ( period === 'yearly' ? 'false' : 'true' ) + '" class="imagify-yearly">';
278
+ output += '<span class="imagify-price-big">' + y[0] + '</span> ';
279
+ output += '<span class="imagify-price-mini">.' + ( y[1].length === 1 ? y[1] + '0' : ( '' + y[1] ).substring( 0, 2 ) ) + '</span>';
280
+ output += '</span>';
281
+ output += '</span>';
282
+
283
+ return output;
284
+ },
285
+
286
+ getHtmlDiscountPrice: function( content, period ) {
287
+ var monthly, yearly,
288
  output = '';
289
 
290
+ if ( ! period ) {
291
+ period = null;
292
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
 
294
+ if ( typeof content === 'object' ) {
295
+ monthly = content.monthly + '';
296
+ yearly = content.yearly + '';
297
+
298
+ output += '<span class="imagify-price-discount">';
299
+ output += '<span class="imagify-price-discount-dollar">$</span>';
300
+ output += '<span class="imagify-switch-my">';
301
+ output += '<span aria-hidden="' + ( period === 'monthly' ? 'false' : 'true' ) + '" class="imagify-monthly">';
302
+ output += '<span class="imagify-price-discount-number">' + monthly + '</span>';
303
+ output += '</span>';
304
+ output += '<span aria-hidden="' + ( period === 'yearly' ? 'false' : 'true' ) + '" class="imagify-yearly">';
305
+ output += '<span class="imagify-price-discount-number">' + yearly + '</span>';
306
+ output += '</span>';
307
+ output += '</span>';
308
+ output += '</span>';
309
+ } else {
310
+ content += ''; // Be sure content is a string.
311
+ output += '<span class="imagify-price-discount">';
312
+ output += '<span class="imagify-price-discount-dollar">$</span>';
313
+ output += '<span class="imagify-price-discount-number">' + content + '</span>';
314
+ output += '</span>';
315
+ }
316
 
317
+ return output;
318
+ },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
 
320
+ /**
321
+ * @uses imagifyModal.getHtmlPrice()
322
+ * @uses imagifyModal.getHtmlDiscountPrice()
323
+ */
324
+ populateOffer: function ( $offer, datas, type, classes ) {
325
+ var promo = w.imagify_discount_datas,
326
+ add = datas.additional_gb, // 4 (monthly)
327
+ ann = datas.annual_cost, // 49.9 (monthly)
328
+ id = datas.id, // 3 (monthly/onetime)
329
+ lab = datas.label, // 'lite' (monthly/onetime)
330
+ mon = datas.monthly_cost, // 4.99 (monthly)
331
+ quo = datas.quota, // 1000 (MB) - 5000 images (monthly/onetime)
332
+ cos = datas.cost, // 3.49 (onetime)
333
+ name = ( quo >= 1000 ? quo/1000 + ' GB' : quo + ' MB' ),
334
+ pcs = type === 'monthly' ? { monthly: mon, yearly: Math.round( ann / 12 * 100 ) / 100 } : cos,
335
+ pcsd = pcs, // Used if discount is active.
336
+ percent, $datas_c, datas_content;
337
+
338
+ // Change pricing value only if discount in percentage is active and if offer is a monthly and not a onetime.
339
+ if ( promo.is_active && 'percentage' === promo.coupon_type && 'monthly' === type ) {
340
+ percent = ( 100 - promo.coupon_value ) / 100;
341
+ pcs = 'monthly' === type ? { monthly: mon * percent, yearly: Math.round( ( ann * percent ) / 12 * 100 ) / 100 } : cos * percent;
342
+ }
343
 
344
+ if ( typeof classes !== 'undefined' ) {
345
+ $offer.addClass( 'imagify-' + type + '-' + lab + classes);
346
+ }
 
 
 
 
 
 
 
 
 
347
 
348
+ // Name.
349
+ $offer.find( '.imagify-offer-size' ).text( name );
350
 
351
+ // Main prices (pcs can be an object or a string).
352
+ $offer.find( '.imagify-number-block' ).html( imagifyModal.getHtmlPrice( pcs, 'monthly' ) );
 
 
353
 
354
+ // discount prices
355
+ if ( promo.is_active && 'percentage' === promo.coupon_type && 'monthly' === type ) {
 
 
 
 
 
 
356
 
357
+ $offer.find( '.imagify-price-block' ).prev( '.imagify-price-discount' ).remove();
358
+ $offer.find( '.imagify-price-block' ).before( imagifyModal.getHtmlDiscountPrice( pcsd, 'monthly' ) );
359
+ }
360
 
361
+ // Nb images.
362
+ $offer.find( '.imagify-approx-nb' ).text( quo * 5 );
363
+
364
+ if ( 'monthly' === type ) {
365
+ // Additionnal price.
366
+ $offer.find( '.imagify-price-add-data' ).text( '$' + add );
367
+ }
368
+
369
+ // Button data-offer attr.
370
+ $datas_c = $offer.find( '.imagify-payment-btn-select-plan' ).length ? $offer.find( '.imagify-payment-btn-select-plan' ) : $offer;
371
+
372
+ if ( 'monthly' === type ) {
373
+ datas_content = '{"' + lab + '":{"id":' + id + ',"name":"' + name + '","data":' + quo + ',"dataf":"' + name + '","imgs":' + ( quo * 5 ) + ',"prices":{"monthly":' + pcs.monthly + ',"yearly":' + pcs.yearly + ',"add":' + add + '}}}';
374
+ } else {
375
+ datas_content = '{"ot' + lab + '":{"id":' + id + ',"name":"' + name + '","data":' + quo + ',"dataf":"' + name + '","imgs":' + ( quo * 5 ) + ',"price":' + pcs + '}}';
376
+ }
377
+
378
+ $datas_c.attr( 'data-offer', datas_content );
379
 
380
+ return $offer;
381
+ },
382
 
383
+ populatePayBtn: function() {
384
+ var pl_datas = JSON.parse( $( '.imagify-offer-monthly' ).attr( 'data-offer' ) ),
385
+ ot_datas = JSON.parse( $( '.imagify-offer-onetime' ).attr( 'data-offer' ) ),
386
+ price = 0,
387
+ price_pl = 0,
388
+ price_ot = 0;
389
 
390
+ // Calculate price_pl only if that offer is selected.
391
+ if ( $( '.imagify-offer-monthly' ).hasClass( 'imagify-offer-selected' ) ) {
392
+ if ( $( '#imagify-subscription-monthly' ).filter( ':checked' ).length ) {
393
+ price_pl = pl_datas[ Object.keys( pl_datas )[0] ].prices.monthly;
394
  } else {
395
+ price_pl = pl_datas[ Object.keys( pl_datas )[0] ].prices.yearly * 12;
396
  }
397
+ }
398
 
399
+ // Calculate price_ot only if that offer is selected.
400
+ if ( $( '.imagify-offer-onetime' ).hasClass( 'imagify-offer-selected' ) ) {
401
+ price_ot = ot_datas[ Object.keys( ot_datas )[0] ].price;
402
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
 
404
+ // Calculate price.
405
+ price = parseFloat( price_ot + price_pl ).toFixed( 2 );
 
 
406
 
407
+ // Edit button price.
408
+ //$( '.imagify-global-amount' ).text( price ); // Not used.
409
 
410
+ if ( '0.00' === price || 0 === price ) {
411
+ $( '#imagify-modal-checkout-btn' ).attr( 'disabled', 'disabled' ).addClass( 'imagify-button-disabled' );
412
+ } else {
413
+ $( '#imagify-modal-checkout-btn' ).removeAttr( 'disabled' ).removeClass( 'imagify-button-disabled' );
414
+ }
415
+ },
416
 
417
+ checkCoupon: function() {
418
+ var code = $( '#imagify-coupon-code' ).val(),
419
+ $cptext, $label, $section, nonce;
 
 
 
420
 
421
+ if ( '' === code ) {
422
+ return;
423
+ }
 
 
 
 
 
424
 
425
+ $cptext = $( '.imagify-coupon-text' );
426
+ $label = $cptext.find( 'label' );
427
+ $section = $( '.imagify-coupon-section' );
428
+ nonce = $( '#imagify-get-pricing-modal' ).data( 'nonce' );
429
+
430
+ $cptext.addClass( 'checking' );
431
+
432
+ // Get the true prices.
433
+ $.post( ajaxurl, { action: 'imagify_check_coupon', coupon: code, imagifynonce: nonce }, function( response ) {
434
+ var coupon_value;
435
+
436
+ $cptext.removeClass( 'checking' );
437
+
438
+ // Error during the request.
439
+ if ( ! response.success ) {
440
+ $section.removeClass( 'validated' ).addClass( 'invalid' );
441
+ $label.text( imagifyAdmin.labels.errorCouponAPI );
442
+ } else if ( response.data.success ) {
443
+ coupon_value = 'percentage' === response.data.coupon_type ? response.data.value + '%' : '$' + response.data.value;
444
+ $section.removeClass( 'invalid' ).addClass( 'validated' );
445
+ $label.html( imagifyAdmin.labels.successCouponAPI );
446
+ $label.find( '.imagify-coupon-offer' ).text( coupon_value );
447
+ $label.find( '.imagify-coupon-word' ).text( code );
448
+ } else {
449
+ $section.removeClass( 'validated' ).addClass( 'invalid' );
450
+ $label.text( response.data.detail );
451
+ }
452
+ } );
453
+ },
454
+
455
+ /**
456
+ * @uses imagifyModal.populateOffer()
457
+ * @uses imagifyModal.populatePayBtn()
458
+ * @uses imagifyModal.checkCoupon()
459
+ */
460
+ getPricing: function( $button ){
461
+ var nonce = $button.data( 'nonce' ),
462
+ prices_rq_datas = {
463
+ action: 'imagify_get_prices',
464
+ imagifynonce: nonce
465
+ },
466
+ imgs_rq_datas = {
467
+ action: 'imagify_get_images_counts',
468
+ imagifynonce: nonce
469
+ },
470
+ prices_rq_discount = {
471
+ action: 'imagify_get_discount',
472
+ imagifynonce: nonce
473
+ };
474
+
475
+ imagifyModal.$modal.find( '.imagify-modal-loader' ).hide().show();
476
+
477
+ /**
478
+ * TODO: change the way to waterfall requests.
479
+ * Use setInterval + counter instead.
480
+ */
481
+
482
+ // Get the true prices.
483
+ $.post( ajaxurl, prices_rq_datas, function( prices_response ) {
484
+
485
+ if ( ! prices_response.success ) {
486
+ // TODO: replace modal content by any information.
487
+ // An error occurred.
488
+
489
+ // Populate Pay button.
490
+ imagifyModal.populatePayBtn();
491
+ return;
492
+ }
493
 
494
+ // get the image estimates sizes
495
+ $.post( ajaxurl, imgs_rq_datas, function( imgs_response ) {
496
 
497
+ if ( ! imgs_response.success ) {
498
+ // TODO: replace modal content by any information.
499
+ // An error occurred.
500
+ return;
 
 
 
 
501
  }
 
502
 
503
+ // Get the discount informations.
504
+ $.post( ajaxurl, prices_rq_discount, function( discount_response ) {
505
+ var images_datas, prices_datas, promo_datas, monthlies, onetimes,
506
+ mo_user_cons, ot_user_cons,
507
+ $mo_tpl, $ot_tpl,
508
+ ot_clone, mo_clone,
509
+ ot_html = '',
510
+ mo_html = '',
511
+ ot_suggested = false,
512
+ mo_suggested = false,
513
+ $estim_block, $offers_block,
514
+ $banners, date_end, promo, discount,
515
+ prev_offers, nb_to_remove, $total_offers,
516
+ i, j;
517
+
518
+ if ( ! discount_response.success ) {
519
+ // TODO: replace modal content by any information.
520
+ // An error occurred.
521
+ return;
522
+ }
523
 
524
+ images_datas = imgs_response.data;
525
+ prices_datas = prices_response.data;
526
+ promo_datas = discount_response.data;
527
+ monthlies = prices_datas.monthlies;
528
+ onetimes = prices_datas.onetimes;
529
+ mo_user_cons = Math.round( images_datas.average_month_size.raw / 1000000 ); // 1000000 in MB,
530
+ ot_user_cons = Math.round( images_datas.total_library_size.raw / 1000000 ); // in MB,
531
+ $mo_tpl = $( '#imagify-offer-monthly-template' );
532
+ $ot_tpl = $( '#imagify-offer-onetime-template' );
533
+ ot_clone = $ot_tpl.html();
534
+ mo_clone = $mo_tpl.html();
535
+ $estim_block = $( '.imagify-estimation-block' );
536
+
537
+ // Refresh Analyzing block.
538
+ $estim_block.removeClass( 'imagify-analyzing' );
539
+ $estim_block.find( '.average-month-size' ).text( images_datas.average_month_size.human );
540
+ $estim_block.find( '.total-library-size' ).text( images_datas.total_library_size.human );
541
+
542
+ // Switch offers title is < 25mb.
543
+ if ( mo_user_cons < 25 && ot_user_cons < 25 ) {
544
+ $( '.imagify-pre-checkout-offers .imagify-modal-title' ).addClass( 'imagify-enough-free' );
545
+ $( '.imagify-offer-selected' ).removeClass( 'imagify-offer-selected' ).find( '.imagify-checkbox' ).removeAttr( 'checked' );
546
+ } else {
547
+ $( '.imagify-enough-free' ).removeClass( 'imagify-enough-free' );
548
+ $( '.imagify-offer-selected' ).addClass( 'imagify-offer-selected' ).find( '.imagify-checkbox' ).attr( 'checked', 'checked' );
549
+ }
550
 
551
+ // Don't create prices table if something went wrong during request.
552
+ if ( null === monthlies || null === onetimes ) {
553
+ $offers_block = $( '.imagify-pre-checkout-offers' );
 
 
554
 
555
+ // Hide main content.
556
+ $offers_block.hide().attr( 'aria-hidden', true );
557
 
558
+ // Show error message.
559
+ $offers_block.closest( '.imagify-modal-views' ).find( '.imagify-popin-message' ).remove();
560
+ $offers_block.after( '<div class="imagify-popin-message imagify-error"><p>' + imagifyAdmin.labels.errorPriceAPI + '</p></div>' );
561
 
562
+ // Show the modal content.
563
+ imagifyModal.$modal.find( '.imagify-modal-loader' ).fadeOut( 300 );
564
+ return;
565
+ }
566
 
567
+ // Autofill coupon code & Show banner if discount is active.
568
+ w.imagify_discount_datas = promo_datas;
569
 
570
+ if ( promo_datas.is_active ) {
571
+ $banners = $( '.imagify-modal-promotion' );
572
+ date_end = promo_datas.date_end.split( 'T' )[0];
573
+ promo = promo_datas.coupon_value;
574
+ discount = 'percentage' === promo_datas.coupon_type ? promo + '%' : '$' + promo;
575
 
576
+ // Fill coupon code.
577
+ $( '#imagify-coupon-code' ).val( promo_datas.label ).attr( 'readonly', true );
578
+
579
+ // Show banners.
580
+ $banners.addClass( 'active' ).attr( 'aria-hidden', 'false' );
581
+
582
+ // Populate banners.
583
+ $banners.find( '.imagify-promotion-number' ).text( discount );
584
+ $banners.find( '.imagify-promotion-date' ).text( date_end );
585
+
586
+ // Auto validate coupon.
587
+ imagifyModal.checkCoupon();
588
+ }
589
+
590
+ /**
591
+ * Below lines will build Plan and Onetime offers lists.
592
+ * It will also pre-select a Plan and Onetime in both of views: pre-checkout and pricing tables.
593
+ */
594
+
595
+ // Now, do the MONTHLIES Markup.
596
+ $.each( monthlies, function( index, value ) {
597
+ var $tpl, $offer,
598
+ classes = '';
599
+
600
+ // If it's free, don't show it.
601
+ if ( 'free' === value.label ) {
602
+ return true; // Continue-like (but $.each is not a loop... so).
603
+ }
604
+
605
+ $tpl = $( mo_clone ).clone();
606
+
607
+ // If offer is too big (far) than estimated needs, don't show the offer.
608
+ if ( false !== mo_suggested && ( index - mo_suggested ) > 2 ) {
609
+ return true;
610
+ }
611
+
612
+ // Parent classes.
613
+ if ( ( mo_user_cons < value.quota && false === mo_suggested ) ) {
614
+ classes = ' imagify-offer-selected';
615
+ mo_suggested = index;
616
+
617
+ // Add this offer as pre-selected item in pre-checkout view.
618
+ $offer = $( '.imagify-pre-checkout-offers' ).find( '.imagify-offer-monthly' );
619
+
620
+ // Populate the Pre-checkout view depending on user_cons.
621
+ imagifyModal.populateOffer( $offer, value, 'monthly' );
622
+ }
623
+
624
+ // Populate each offer.
625
+ $tpl = imagifyModal.populateOffer( $tpl, value, 'monthly', classes );
626
+
627
+ // Complete Monthlies HTML.
628
+ mo_html += $tpl[0].outerHTML;
629
+ } );
630
+
631
+ // Deal with the case of too much small offers (before recommanded one).
632
+ prev_offers = $( mo_html ).filter( '.imagify-offer-selected' ).prevAll();
633
+
634
+ // If we have more than 1 previous offer.
635
+ if ( prev_offers.length > 1 ) {
636
+ nb_to_remove = prev_offers.length - 1;
637
+ $total_offers = $( mo_html );
638
+
639
+ // Remove too far previous offer.
640
+ for ( i = 0; i < nb_to_remove; i++ ) {
641
+ delete $total_offers[ i ];
642
+ }
643
+
644
+ // Rebuild mo_html with removed items.
645
+ mo_html = '';
646
+ for ( j = 0; j < $total_offers.length; j++) {
647
+ mo_html += $( '<div/>' ).append( $total_offers[ j ] ).html();
648
+ }
649
+ }
650
+
651
+ // Do the ONETIMES Markup.
652
+ $.each( onetimes, function( index, value ) {
653
+ var $tpl = $( ot_clone ).clone(),
654
+ $offer = $( '.imagify-pre-checkout-offers' ).find( '.imagify-offer-onetime' ),
655
+ classes = '',
656
+ tvalue;
657
+
658
+ // Parent classes.
659
+ if ( ( ot_user_cons < value.quota && ot_suggested === false ) ) {
660
+ classes = ' imagify-offer-selected';
661
+ ot_suggested = true;
662
+
663
+ // Populate the Pre-checkout view depending on user_cons.
664
+ imagifyModal.populateOffer( $offer, value, 'onetime' );
665
+ }
666
+
667
+ // If too big, populate with the biggest offer available.
668
+ // TODO: create custom offers at this point.
669
+ if ( ( onetimes.length - 1 ) === index && false === ot_suggested ) {
670
+ // populate the Pre-checkout view depending on user_cons
671
+ tvalue = onetimes[ onetimes.length - 1 ];
672
+ imagifyModal.populateOffer( $offer, tvalue, 'onetime' );
673
  }
674
 
675
+ // Populate each offer.
676
+ $tpl = imagifyModal.populateOffer( $tpl, value, 'onetime', classes );
677
+
678
+ // complete Onetimes HTML
679
+ ot_html += $tpl[0].outerHTML;
680
+ } );
681
+
682
+ // Fill pricing tables.
683
+ if ( $mo_tpl.parent().find( '.imagify-offer-line' ) ) {
684
+ $mo_tpl.parent().find( '.imagify-offer-line' ).remove();
685
+ }
686
+
687
+ $mo_tpl.before( mo_html );
688
+
689
+ if ( $ot_tpl.parent().find( '.imagify-offer-line' ) ) {
690
+ $ot_tpl.parent().find( '.imagify-offer-line' ).remove();
691
  }
 
692
 
693
+ $ot_tpl.before( ot_html );
694
+
695
+ // Show the content.
696
+ imagifyModal.$modal.find( '.imagify-modal-loader' ).fadeOut( 300 );
697
+
698
+ } ); // Third AJAX request to get discount information.
699
+
700
+ } ); // Second AJAX request for image estimation sizes.
701
+
702
+ // Populate Pay button.
703
+ imagifyModal.populatePayBtn();
704
+ } ); // End $.post.
705
+ },
706
+
707
+ /**
708
+ * @uses imagifyModal.populatePayBtn()
709
+ */
710
+ checkCheckbox: function( $checkbox ) {
711
+ var sel_class = 'imagify-offer-selected';
712
+
713
+ $checkbox.each( function() {
714
+ var $this = $( this );
715
+
716
+ if ( $this.is( ':checked' ) ) {
717
+ $this.closest( '.imagify-offer-line' ).addClass( sel_class );
718
+ } else {
719
+ $this.closest( '.imagify-offer-line' ).removeClass( sel_class );
720
  }
721
+ } );
722
+
723
+ // Update pay button.
724
+ imagifyModal.populatePayBtn();
725
+ },
726
+
727
+ /**
728
+ * @uses imagifyModal.populatePayBtn()
729
+ */
730
+ checkRadio: function( $radio ) {
731
+ var year_class = 'imagify-year-selected',
732
+ month_class = 'imagify-month-selected';
733
+
734
+ $radio.each( function() {
735
+ // To handle modal pricing & modal suggestion.
736
+ var $_this = $( this ),
737
+ $parent, $to_switch;
738
+
739
+ if ( $_this.parent( '.imagify-cart-list-switcher' ).length ) {
740
+ $parent = $_this.closest( '.imagify-cart' );
741
+ } else if ( $_this.parent( '.imagify-small-options' ).length ) {
742
+ $parent = $_this.parent( '.imagify-small-options' ).next( '.imagify-pricing-table' );
743
+ } else {
744
+ $parent = $_this.closest( '.imagify-offer-line' );
745
+ }
746
+
747
+ $to_switch = $parent.find( '.imagify-switch-my' );
748
+
749
+ if ( $_this.val() === 'yearly' ) {
750
+ $parent.addClass( year_class ).removeClass( month_class );
751
+ $to_switch.find( '.imagify-monthly' ).attr( 'aria-hidden', 'true' );
752
+ $to_switch.find( '.imagify-yearly' ).attr( 'aria-hidden', 'false' );
753
+ } else {
754
+ $parent.addClass( month_class ).removeClass( year_class );
755
+ $to_switch.find( '.imagify-monthly' ).attr( 'aria-hidden', 'false' );
756
+ $to_switch.find( '.imagify-yearly' ).attr( 'aria-hidden', 'true' );
757
+ }
758
+ } );
759
+
760
+ // Update Pay button information.
761
+ imagifyModal.populatePayBtn();
762
+
763
+ return $radio;
764
+ },
765
 
766
  /**
767
+ * Currently not used.
768
+ * @uses imagifyModal.populatePayBtn()
769
  */
770
+ populateBtnPrice: setInterval( function() {
771
+ imagifyModal.populatePayBtn();
772
+ }, 1000 ),
773
 
774
  /**
775
  * 1) Modal Payment change/select plan
776
  * 2) Checkout selection(s)
777
  * 3) Payment process
778
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
779
 
780
+ getPeriod: function() {
781
+ return $( '.imagify-offer-monthly' ).hasClass( 'imagify-month-selected' ) ? 'monthly' : 'yearly';
782
+ },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
783
 
784
+ getApiKey: function() {
785
+ return $( '#imagify-payment-iframe' ).data( 'imagify-api' );
786
+ },
787
+
788
+ switchToView: function( $view, data ) {
789
+ var viewId = $view.attr( 'id' ),
790
+ $modalContent = imagifyModal.$modal.children( '.imagify-modal-content' );
791
+
792
+ $view.siblings( '.imagify-modal-views' ).hide().attr( 'aria-hidden', 'true' );
793
+
794
+ // Plans view has tabs: display the right one.
795
+ if ( data && data.tab ) {
796
+ $view.find( 'a[href="#' + data.tab + '"]' ).trigger( 'click.imagify' );
797
  }
798
+
799
+ // Payment view: it's an iframe.
800
+ if ( 'imagify-payment-process-view' === viewId ) {
801
+ $modalContent.addClass( 'imagify-iframe-viewing' );
802
+ } else {
803
+ $modalContent.removeClass( 'imagify-iframe-viewing' );
 
 
 
 
 
804
  }
 
805
 
806
+ // Success view: some tweaks.
807
+ if ( 'imagify-success-view' === viewId ) {
808
+ $modalContent.addClass( 'imagify-success-viewing' );
809
+ imagifyModal.$modal.attr( 'aria-labelledby', 'imagify-success-view' );
810
+ } else {
811
+ $modalContent.removeClass( 'imagify-success-viewing' );
812
+ imagifyModal.$modal.removeAttr( 'aria-labelledby' );
813
+ }
814
+
815
+ $view.fadeIn( imagifyModal.speedFadeIn ).attr( 'aria-hidden', 'false' );
816
+ },
817
+
818
  /**
819
+ * @uses imagifyModal.getApiKey()
820
  */
821
+ iframeSetSrc: function( params ) {
822
+ /**
823
+ * params = {
824
+ * 'monthly': {
825
+ * 'lite': {
826
+ * name: 'something',
827
+ * id: ''
828
+ * }
829
+ * },
830
+ * 'onetime': {
831
+ * 'recommended': {
832
+ * name: 'Recommend',
833
+ * id: ''
834
+ * }
835
+ * },
836
+ * 'period': 'monthly'|'yearly'
837
+ * }
838
+ */
839
+
840
+ var $iframe = $( '#imagify-payment-iframe' ),
841
+ iframe_src = $iframe.attr( 'src' ),
842
+ pay_src = $iframe.data( 'src' ),
843
+ monthly_id = 0,
844
+ onetime_id = 0,
845
+ key, rt_onetime, rt_yearly, rt_monthly, coupon, rt_coupon, amount, $iframeClone, tofind;
846
+
847
+ // If we only change monthly/yearly payment mode.
848
+ if ( typeof params === 'string' && '' !== iframe_src ) {
849
+ tofind = 'monthly' === params ? 'yearly' : 'monthly';
850
+ iframe_src = iframe_src.replace( tofind, params );
851
+ $iframe.attr( 'src', iframe_src );
852
+ return;
853
+ }
854
 
855
+ // If we get new informations about products.
856
+ if ( typeof params !== 'object' ) {
857
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
858
  }
859
 
860
+ if ( params.monthly ) {
861
+ monthly_id = params.monthly[ Object.keys( params.monthly )[0] ].id;
862
+ }
863
 
864
+ if ( params.onetime ) {
865
+ onetime_id = params.onetime[ Object.keys( params.onetime )[0] ].id;
866
+ // If onetime ID === 999 it's a custom plan, send datas instead.
867
+ onetime_id = ( onetime_id + '' === '999' ? params.onetime[ Object.keys( params.onetime )[0] ].data : onetime_id );
868
+ }
869
 
870
+ if ( ! params.period ) {
871
+ imagify.info( 'No period defined' );
872
+ return;
873
+ }
874
 
875
+ key = imagifyModal.getApiKey();
876
+ rt_onetime = onetime_id;
877
+ rt_yearly = 'yearly' === params.period ? monthly_id : 0;
878
+ rt_monthly = 'monthly' === params.period ? monthly_id : 0;
879
+ coupon = $( '#imagify-coupon-code' ).val();
880
+ rt_coupon = '' === coupon ? 'none' : coupon;
881
+ // Not used but...
882
+ amount = parseFloat( $( '.imagify-global-amount' ).text() ).toFixed( 2 );
883
 
884
+ // Compose route.
885
+ // pay_src + :ontimeplan(0)/:monthlyplan(0)/:yearlyplan(0)/:coupon(none)/
886
+ pay_src = pay_src + rt_onetime + '/' + rt_monthly + '/' + rt_yearly + '/' + rt_coupon + '/';
 
887
 
888
+ // iFrame sort of cache fix.
889
+ $iframeClone = $iframe.remove().attr( 'src', pay_src );
 
 
890
 
891
+ imagifyModal.$paymentView.html( $iframeClone );
892
+ },
 
 
 
893
 
894
+ /**
895
+ * Public function triggered by payement iframe.
896
+ */
897
+ paymentClose: function() {
898
+ $( '.imagify-iframe-viewing .close-btn' ).trigger( 'click.imagify' );
899
+ $( '.imagify-iframe-viewing' ).removeClass( 'imagify-iframe-viewing' );
900
+ },
901
 
902
+ /**
903
+ * @uses imagifyModal.switchToView()
904
+ */
905
+ paymentBack: function() {
906
+ imagifyModal.switchToView( imagifyModal.$preView );
907
+ },
908
+
909
+ /**
910
+ * @uses imagifyModal.switchToView()
911
+ */
912
+ paymentSuccess: function() {
913
+ imagifyModal.switchToView( imagifyModal.$successView );
914
+ },
915
+
916
+ /**
917
+ * @uses imagifyModal.paymentClose()
918
+ * @uses imagifyModal.paymentBack()
919
+ * @uses imagifyModal.paymentSuccess()
920
+ */
921
+ checkPluginMessage: function( event ) {
922
+ var origin = event.origin || event.originalEvent.origin;
923
+
924
+ if ( 'https://app.imagify.io' !== origin && 'http://dapp.imagify.io' !== origin ) {
925
+ return;
926
  }
927
 
928
+ switch ( event.data ) {
929
+ case 'cancel':
930
+ imagifyModal.paymentClose();
931
+ break;
932
+ case 'back':
933
+ imagifyModal.paymentBack();
934
+ break;
935
+ case 'success':
936
+ imagifyModal.paymentSuccess();
937
+ break;
938
  }
939
+ }
940
+ };
941
+
942
+ /**
943
+ * INIT.
944
+ */
945
+
946
+ // Check all boxes on load.
947
+ imagifyModal.checkCheckbox( imagifyModal.$checkboxes );
948
+ imagifyModal.checkRadio( imagifyModal.$radios.filter( ':checked' ) );
949
+
950
+ // Check coupon onload.
951
+ imagifyModal.checkCoupon();
952
+
953
+ // Check the changed box.
954
+ imagifyModal.$checkboxes.on( 'change.imagify', function() {
955
+ imagifyModal.checkCheckbox( $( this ) );
956
+ } );
957
+
958
+ // Check the radio box.
959
+ imagifyModal.$radios.on( 'change.imagify', function() {
960
+ imagifyModal.checkRadio( $( this ) );
961
+ } );
962
 
963
+ /**
964
+ * Get pricings on modal opening.
965
+ * Build the pricing tables inside modal.
966
+ */
967
+ $( '#imagify-get-pricing-modal' ).on( 'click.imagify-ajax', function() {
968
+ imagifyModal.getPricing( $( this ) );
969
+ } );
970
+
971
+ /**
972
+ * Reset the modal on close.
973
+ */
974
+ $( d ).on( 'modalClosed.imagify', '.imagify-payment-modal', function() {
975
+ // Reset viewing class & aria-labelledby.
976
+ $( this ).find( '.imagify-modal-content' ).removeClass( 'imagify-success-viewing imagify-iframe-viewing' );
977
 
978
+ // Reset first view after fadeout ~= 300 ms.
979
+ setTimeout( function() {
980
+ $( '.imagify-modal-views' ).hide();
981
+ $( '#imagify-pre-checkout-view' ).show();
982
+ }, 300 );
983
+ } );
984
 
985
+ /**
986
+ * Get validation for Coupon Code
987
+ * - On blur
988
+ * - On Enter or Spacebar press
989
+ * - On click OK button
990
+ *
991
+ * @since 1.6.3 Only if field hasn't readonly attribute (discount auto-applied).
992
+ */
993
+ $( '#imagify-coupon-code' ).on( 'blur.imagify', function() {
994
+ if ( ! $( this ).attr('readonly') ) {
995
+ imagifyModal.checkCoupon();
996
+ }
997
+ } ).on( 'keydown.imagify', function( e ) {
998
+ var $this = $( this );
999
+
1000
+ if ( $this.attr( 'readonly' ) ) {
1001
+ return;
1002
+ }
1003
+ if ( 13 === e.keyCode || 32 === e.keyCode ) {
1004
+ imagifyModal.checkCoupon();
1005
  return false;
1006
+ }
1007
+ if ( $this.val().length >= 3 ) {
1008
+ $this.closest( '.imagify-coupon-input' ).addClass( 'imagify-canbe-validate' );
1009
+ } else {
1010
+ $this.closest( '.imagify-coupon-input' ).removeClass( 'imagify-canbe-validate' );
1011
+ }
1012
+ } );
1013
+
1014
+ $( '#imagify-coupon-validate' ).on( 'click.imagify', function() {
1015
+ imagifyModal.checkCoupon();
1016
+ $( this ).closest( '.imagify-canbe-validate' ).removeClass( 'imagify-canbe-validate' );
1017
+ } );
1018
+
1019
+ /**
1020
+ * View game, step by step.
1021
+ */
1022
+
1023
+ // 1) when you decide to choose another plan.
1024
 
1025
+ /**
1026
+ * 1.a) on click, display choices.
1027
+ *
1028
+ * @uses imagifyModal.switchToView()
1029
+ */
1030
+ imagifyModal.$anotherBtn.on( 'click.imagify', function() {
1031
+ var type = $( this ).data( 'imagify-choose' ),
1032
+ tab = 'imagify-pricing-tab-' + ( 'plan' === type ? 'monthly' : 'onetime' );
1033
+
1034
+ imagifyModal.switchToView( imagifyModal.$plansView, { tab: tab } );
1035
+
1036
+ return false;
1037
+ } );
1038
+
1039
+ /**
1040
+ * 1.b) on click in a choice, return to pre-checkout step.
1041
+ *
1042
+ * @uses imagifyModal.getHtmlPrice()
1043
+ * @uses imagifyModal.switchToView()
1044
+ * @uses imagifyModal.populatePayBtn()
1045
+ */
1046
+ imagifyModal.$modal.on( 'click.imagify', '.imagify-payment-btn-select-plan', function() {
1047
+ var $_this = $( this ),
1048
+ $offer_line = $_this.closest( '.imagify-offer-line' ),
1049
+ datas = $_this.data( 'offer' ),
1050
+ datas_str = $_this.attr( 'data-offer' ),
1051
+ is_onetime = $_this.closest( '.imagify-tab-content' ).attr( 'id' ) !== 'imagify-pricing-tab-monthly',
1052
+ $target_line = is_onetime ? imagifyModal.$preView.find( '.imagify-offer-onetime' ) : imagifyModal.$preView.find( '.imagify-offer-monthly' ),
1053
+ period = is_onetime ? null : ( $_this.closest( '.imagify-pricing-table' ).hasClass( 'imagify-month-selected' ) ? 'monthly' : 'yearly' ),
1054
+ price = is_onetime ? imagifyModal.getHtmlPrice( datas[ Object.keys( datas )[0] ].price ) : imagifyModal.getHtmlPrice ( datas[ Object.keys( datas )[0] ].prices, period ),
1055
+ monthly_txt = is_onetime ? '' : '<span class="imagify-price-by">' + $offer_line.find( '.imagify-price-by' ).text() + '</span>',
1056
+ discount = $offer_line.find( '.imagify-price-discount' ).html(),
1057
+ imgs = $offer_line.find( '.imagify-approx-nb' ).text(),
1058
+ offer_size = $offer_line.find( '.imagify-offer-size' ).text();
1059
+
1060
+ // Change views to go back pre-checkout.
1061
+ imagifyModal.switchToView( imagifyModal.$preView );
1062
+
1063
+ // Change price (+ "/month" if found in monthly plans).
1064
+ $target_line.find( '.imagify-number-block' ).html( price + monthly_txt );
1065
+
1066
+ // Change discount.
1067
+ $target_line.find( '.imagify-price-discount' ).html( discount );
1068
+
1069
+ // Change approx images nb.
1070
+ $target_line.find( '.imagify-approx-nb' ).text( imgs );
1071
+
1072
+ // Change offer size name.
1073
+ $target_line.find( '.imagify-offer-size' ).text( offer_size );
1074
+
1075
+ // Change datas (json).
1076
+ $target_line.attr( 'data-offer', datas_str );
1077
+
1078
+ if ( ! is_onetime ) {
1079
+ $target_line.find( '.imagify-price-add-data' ).text( $offer_line.find( '.imagify-price-add-data' ).text() );
1080
+
1081
+ // Trigger period selected from offer selection view to pre-checkout view.
1082
+ if ( 'monthly' === period ) {
1083
+ $target_line.find( '#imagify-subscription-monthly' ).trigger( 'click.imagify' );
1084
  } else {
1085
+ $target_line.find( '#imagify-subscription-yearly' ).trigger( 'click.imagify' );
1086
  }
1087
+ $target_line.find( '.imagify-inline-options' ).find( 'input:radio:checked' ).trigger( 'change.imagify' );
1088
+ }
1089
 
1090
+ // Update price information in button.
1091
+ imagifyModal.populatePayBtn();
1092
+ return false;
1093
+ } );
1094
 
1095
+ /**
1096
+ * 2) when you checkout.
1097
+ *
1098
+ * @uses imagifyModal.switchToView()
1099
+ * @uses imagifyModal.getPeriod()
1100
+ * @uses imagifyModal.iframeSetSrc()
1101
+ */
1102
+ $( '#imagify-modal-checkout-btn' ).on( 'click.imagify', function() {
1103
+ var $monthly_offer, $onetime_offer, checkout_datas;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1104
 
1105
+ // Do nothing if button disabled.
1106
+ if ( $( this ).hasClass( 'imagify-button-disabled' ) ) {
1107
+ return;
1108
+ }
1109
 
1110
+ $monthly_offer = $( '.imagify-offer-monthly' );
1111
+ $onetime_offer = $( '.imagify-offer-onetime' );
1112
+ checkout_datas = {};
1113
+
1114
+ // If user choose a monthly plan.
1115
+ if ( $monthly_offer.hasClass( 'imagify-offer-selected' ) ) {
1116
+ checkout_datas.monthly = JSON.parse( $monthly_offer.attr( 'data-offer' ) );
1117
+ }
1118
+
1119
+ // If user choose a one time plan.
1120
+ if ( $onetime_offer.hasClass( 'imagify-offer-selected' ) ) {
1121
+ checkout_datas.onetime = JSON.parse( $onetime_offer.attr( 'data-offer' ) );
1122
+ }
1123
+
1124
+ // Change views to go to checkout/payment view.
1125
+ imagifyModal.switchToView( imagifyModal.$paymentView );
1126
+
1127
+ checkout_datas.period = imagifyModal.getPeriod();
1128
+
1129
+ imagifyModal.iframeSetSrc( checkout_datas );
1130
+ return false;
1131
+ } );
1132
 
1133
  /**
1134
+ * Go back to previous step ("Choose Another Plan" links).
1135
+ */
1136
+ $( '.imagify-back-to-plans' ).on( 'click.imagify', function() {
1137
+ var $_this = $( this ),
1138
+ is_onetime = $_this.closest( '.imagify-cart-item' ).hasClass( 'imagify-cart-item-onetime' );
1139
+
1140
+ if ( is_onetime ) {
1141
+ $( '.imagify-offer-onetime' ).find( '.imagify-choose-another-plan' ).trigger( 'click.imagify' );
1142
+ } else {
1143
+ $( '.imagify-offer-monthly' ).find( '.imagify-choose-another-plan' ).trigger( 'click.imagify' );
1144
+ }
1145
+
1146
+ return false;
1147
+ } );
1148
+
1149
+ // Message/communication API.
1150
+ w.addEventListener( 'message', imagifyModal.checkPluginMessage, true );
1151
+
1152
+ } )(jQuery, document, window);
1153
+
1154
+
1155
+ (function($, d, w, undefined) {
1156
+
1157
+ /**
1158
+ * Tabs.
1159
+ *
1160
  * @Markup:
1161
  * ul.imagify-tabs
1162
+ * li.imagify-tab.imagify-current
1163
+ * a[href="#target"]
1164
  * div.imagify-tabs-contents
1165
+ * div.imagify-tab-content#target
1166
  */
1167
+ $( '.imagify-tab' ).on( 'click.imagify', function( e ) {
1168
+ var $_this = $( this ),
1169
+ curr_class = 'imagify-current',
1170
+ target;
1171
 
1172
+ e.preventDefault();
 
 
1173
 
1174
+ if ( $_this.hasClass( 'imagify-current' ) ) {
1175
+ return;
1176
+ }
1177
 
1178
+ target = $_this.find( 'a' ).attr( 'href' ) || '#' + $_this.find( 'a' ).attr( 'aria-controls' );
 
 
1179
 
1180
+ // Show right tab content.
1181
+ $_this.closest( '.imagify-tabs' ).next( '.imagify-tabs-contents' ).find( '.imagify-tab-content' ).hide().attr( 'aria-hidden', 'true' );
1182
+ $( target ).fadeIn( 275 ).attr( 'aria-hidden', 'false' );
 
1183
 
1184
+ // Change active tabs.
1185
+ $_this.closest( '.imagify-tabs' ).find( '.imagify-tab' ).removeClass( curr_class ).attr( 'aria-selected', 'false' );
1186
+ $_this.addClass( curr_class ).attr( 'aria-selected', 'true' );
1187
+ } );
1188
 
1189
+ } )(jQuery, document, window);
 
assets/js/admin.min.js CHANGED
@@ -1,36 +1 @@
1
- jQuery(function(a){var w=0<ajaxurl.indexOf("?")?"&":"?",H={log:function(a){"undefined"!==console&&console.log(a)},info:function(a){"undefined"!==console&&console.info(a)}};a("#imagify-signup").click(function(b){b.preventDefault();swal({title:imagifyAdmin.labels.signupTitle,html:imagifyAdmin.labels.signupText,confirmButtonText:imagifyAdmin.labels.signupConfirmButtonText,input:"email",closeOnConfirm:!1,allowOutsideClick:!0,showLoaderOnConfirm:!0,customClass:"imagify-sweet-alert imagify-sweet-alert-signup",
2
- inputValidator:function(b){return new Promise(function(d,e){""!=a.trim(b)&&b?d():e(imagifyAdmin.labels.signupErrorEmptyEmail)})},preConfirm:function(b){return new Promise(function(d,e){setTimeout(function(){a.get(ajaxurl+w+"action=imagify_signup&email="+b+"&imagifysignupnonce="+a("#imagifysignupnonce").val()).done(function(a){a.success?d():e(a.data)})},2E3)})}}).then(function(a){swal({title:imagifyAdmin.labels.signupSuccessTitle,html:imagifyAdmin.labels.signupSuccessText,type:"success",customClass:"imagify-sweet-alert"})})});
3
- a("#imagify-save-api-key").click(function(b){b.preventDefault();swal({title:imagifyAdmin.labels.saveApiKeyTitle,html:imagifyAdmin.labels.saveApiKeyText,confirmButtonText:imagifyAdmin.labels.saveApiKeyConfirmButtonText,input:"text",allowOutsideClick:!0,showLoaderOnConfirm:!0,customClass:"imagify-sweet-alert imagify-sweet-alert-signup",inputValidator:function(b){return new Promise(function(d,e){""!=a.trim(b)&&b?d():e(imagifyAdmin.labels.ApiKeyErrorEmpty)})},preConfirm:function(b){return new Promise(function(d,
4
- e){a.get(ajaxurl+w+"action=imagify_check_api_key_validity&api_key="+b+"&imagifycheckapikeynonce="+a("#imagifycheckapikeynonce").val()).done(function(a){a.success?d():e(a.data)})})}}).then(function(a){swal({title:imagifyAdmin.labels.ApiKeyCheckSuccessTitle,html:imagifyAdmin.labels.ApiKeyCheckSuccessText,type:"success",customClass:"imagify-sweet-alert"})})});a(".imagify-notice-dismiss").click(function(b){b.preventDefault();var d=a(this);b=d.parents(".imagify-welcome, .imagify-notice");d=d.attr("href");
5
- b.fadeTo(100,0,function(){a(this).slideUp(100,function(){a(this).remove()})});a.get(d.replace("admin-post.php","admin-ajax.php"))});a(".imagify-modal").attr("aria-hidden","true");a(".imagify-modal-trigger").on("click.imagify",function(){var b=a(this),b=b.data("target")||b.attr("href");a(b).css("display","flex").hide().fadeIn(400).attr("aria-hidden","false").attr("tabindex","0").focus().removeAttr("tabindex").addClass("modal-is-open");a("body").addClass("imagify-modal-is-open");return!1});a(document).on("click.imagify",
6
- ".imagify-modal .close-btn",function(){a(this).closest(".imagify-modal").fadeOut(400).attr("aria-hidden","true").removeClass("modal-is-open");a(this).closest(".imagify-modal").hasClass("imagify-payment-modal")&&(a(this).closest(".imagify-modal-content").removeClass("imagify-success-viewing imagify-iframe-viewing"),setTimeout(function(){a(".imagify-modal-views").hide();a("#imagify-pre-checkout-view").show()},300));a("body").removeClass("imagify-modal-is-open")}).on("blur.imagify",".imagify-modal .close-btn",
7
- function(){var b=a(this).closest(".imagify-modal");"false"===b.attr("aria-hidden")&&b.attr("tabindex","0").focus().removeAttr("tabindex")});a(document).on("click.imagify",".imagify-modal",function(b){a(b.target).filter(".modal-is-open").find(".close-btn").trigger("click.imagify")});a(window).on("keydown.imagify",function(b){if(27==b.keyCode&&0<a(".imagify-modal.modal-is-open").length)return b.preventDefault(),a(".imagify-modal.modal-is-open").find(".close-btn").trigger("click.imagify"),!1});var x=
8
- !1;a("#wp-admin-bar-imagify").hover(function(){if(!0!==x){x=!0;var b=a("#wp-admin-bar-imagify-profile-content");b.is(":empty")&&a.get(ajaxurl+w+"action=imagify_get_admin_bar_profile&imagifygetadminbarprofilenonce="+a("#imagifygetadminbarprofilenonce").val()).done(function(d){b.html(d.data);a("#wp-admin-bar-imagify-profile-loading").remove();x=!1})}});if(a("#imagify-pricing-modal").length){var y=a("#imagify-pricing-modal"),z=function(a,d){d||(d=null);output="";if("object"===typeof a){var b=a.yearly+
9
- "",e=(a.monthly+"").split("."),b=b.split(".");output+='<span class="imagify-switch-my"><span aria-hidden="'+("monthly"===d?"false":"true")+'" class="imagify-monthly"><span class="imagify-price-big">'+e[0]+'</span> <span class="imagify-price-mini">.'+(1===e[1].length?e[1]+"0":(""+e[1]).substring(0,2))+'</span></span> <span aria-hidden="'+("yearly"===d?"false":"true")+'" class="imagify-yearly"><span class="imagify-price-big">'+b[0]+'</span> <span class="imagify-price-mini">.'+(1===b[1].length?b[1]+
10
- "0":(""+b[1]).substring(0,2))+"</span></span></span>"}else e=(a+"").split("."),output+='<span class="imagify-price-big">'+e[0]+'</span> <span class="imagify-price-mini">.'+(1===e[1].length?e[1]+"0":(""+e[1]).substring(0,2))+"</span>";return output},I=function(a,d){d||(d=null);output="";return output="object"===typeof a?output+('<span class="imagify-price-discount"><span class="imagify-price-discount-dollar">$</span><span class="imagify-switch-my"><span aria-hidden="'+("monthly"===d?"false":"true")+
11
- '" class="imagify-monthly"><span class="imagify-price-discount-number">'+(a.monthly+"")+'</span></span><span aria-hidden="'+("yearly"===d?"false":"true")+'" class="imagify-yearly"><span class="imagify-price-discount-number">'+(a.yearly+"")+"</span></span></span></span>"):output+('<span class="imagify-price-discount"><span class="imagify-price-discount-dollar">$</span><span class="imagify-price-discount-number">'+(a+"")+"</span></span>")},m=function(a,d,c,e){var b=window.imagify_discount_datas,f=d.additional_gb,
12
- B=d.annual_cost,C=d.id,A=d.label,D=d.monthly_cost,l=d.quota;d=d.cost;var q=1E3<=l?l/1E3+" GB":l+" MB",h="monthly"===c?{monthly:D,yearly:Math.round(B/12*100)/100}:d,k=h;b.is_active&&"percentage"===b.coupon_type&&"monthly"===c&&(h=(100-b.coupon_value)/100,h="monthly"===c?{monthly:D*h,yearly:Math.round(B*h/12*100)/100}:d*h);"undefined"!==typeof e&&a.addClass("imagify-"+c+"-"+A+e);a.find(".imagify-offer-size").text(q);a.find(".imagify-number-block").html(z(h,"monthly"));b.is_active&&"percentage"===b.coupon_type&&
13
- "monthly"===c&&(a.find(".imagify-price-block").prev(".imagify-price-discount").remove(),a.find(".imagify-price-block").before(I(k,"monthly")));a.find(".imagify-approx-nb").text(5*l);"monthly"===c&&a.find(".imagify-price-add-data").text("$"+f);(a.find(".imagify-payment-btn-select-plan").length?a.find(".imagify-payment-btn-select-plan"):a).attr("data-offer","monthly"===c?'{"'+A+'":{"id":'+C+',"name":"'+q+'","data":'+l+',"dataf":"'+q+'","imgs":'+5*l+',"prices":{"monthly":'+h.monthly+',"yearly":'+h.yearly+
14
- ',"add":'+f+"}}}":'{"ot'+A+'":{"id":'+C+',"name":"'+q+'","data":'+l+',"dataf":"'+q+'","imgs":'+5*l+',"price":'+h+"}}");return a},r=function(){var b=JSON.parse(a(".imagify-offer-monthly").attr("data-offer")),d=JSON.parse(a(".imagify-offer-onetime").attr("data-offer")),c=0,e=0;a(".imagify-offer-monthly").hasClass("imagify-offer-selected")&&(c=a("#imagify-subscription-monthly").filter(":checked").length?b[Object.keys(b)[0]].prices.monthly:12*b[Object.keys(b)[0]].prices.yearly);a(".imagify-offer-onetime").hasClass("imagify-offer-selected")&&
15
- (e=d[Object.keys(d)[0]].price);b=parseFloat(e+c).toFixed(2);a(".imagify-global-amount").text(b);"0.00"==b||0===b?a("#imagify-modal-checkout-btn").attr("disabled","disabled").addClass("imagify-button-disabled"):a("#imagify-modal-checkout-btn").removeAttr("disabled").removeClass("imagify-button-disabled")},J=function(b){b=b.data("nonce");var d={action:"imagify_get_prices",imagifynonce:b},c={action:"imagify_get_images_counts",imagifynonce:b},e={action:"imagify_get_discount",imagifynonce:b};y.find(".imagify-modal-loader").hide().show();
16
- a.post(ajaxurl,d,function(b){b.success&&a.post(ajaxurl,c,function(d){d.success&&a.post(ajaxurl,e,function(c){if(c.success){var e=d.data;prices_datas=b.data;promo_datas=c.data;monthlies=prices_datas.monthlies;onetimes=prices_datas.onetimes;mo_user_cons=Math.round(e.average_month_size.raw/1E6);ot_user_cons=Math.round(e.total_library_size.raw/1E6);$mo_tpl=a("#imagify-offer-monthly-template");$ot_tpl=a("#imagify-offer-onetime-template");ot_clone=$ot_tpl.html();mo_clone=$mo_tpl.html();mo_html=ot_html=
17
- "";mo_suggested=ot_suggested=!1;$estim_block=a(".imagify-estimation-block");$estim_block.removeClass("imagify-analyzing");$estim_block.find(".average-month-size").text(e.average_month_size.human);$estim_block.find(".total-library-size").text(e.total_library_size.human);25>mo_user_cons&&25>ot_user_cons?(a(".imagify-pre-checkout-offers .imagify-modal-title").addClass("imagify-enough-free"),a(".imagify-offer-selected").removeClass("imagify-offer-selected").find(".imagify-checkbox").removeAttr("checked")):
18
- (a(".imagify-enough-free").removeClass("imagify-enough-free"),a(".imagify-offer-selected").addClass("imagify-offer-selected").find(".imagify-checkbox").attr("checked","checked"));if(null===monthlies||null===onetimes)c=a(".imagify-pre-checkout-offers"),c.hide().attr("aria-hidden",!0),c.closest(".imagify-modal-views").find(".imagify-popin-message").remove(),c.after('<div class="imagify-popin-message imagify-error"><p>'+imagifyAdmin.labels.errorPriceAPI+"</p></div>");else{window.imagify_discount_datas=
19
- promo_datas;if(promo_datas.is_active){c=a(".imagify-modal-promotion");var e=promo_datas.date_end.split("T")[0],f=promo_datas.coupon_value;discount="percentage"===promo_datas.coupon_type?f+"%":"$"+f;a("#imagify-coupon-code").val(promo_datas.label).attr("readonly",!0);c.addClass("active").attr("aria-hidden","false");c.find(".imagify-promotion-number").text(discount);c.find(".imagify-promotion-date").text(e);n()}a.each(monthlies,function(b,d){if("free"===d.label)return!0;var c=a(mo_clone).clone();if(!1!==
20
- mo_suggested&&2<b-mo_suggested)return!0;classes="";if(mo_user_cons<d.quota&&!1===mo_suggested){classes=" imagify-offer-selected";mo_suggested=b;var e=a(".imagify-pre-checkout-offers").find(".imagify-offer-monthly");m(e,d,"monthly")}c=m(c,d,"monthly",classes);mo_html+=c[0].outerHTML});c=a(mo_html).filter(".imagify-offer-selected").prevAll();if(1<c.length){c=c.length-1;e=a(mo_html);for(i=0;i<c;i++)delete e[i];mo_html="";for(j=0;j<e.length;j++)mo_html+=a("<div/>").append(e[j]).html()}a.each(onetimes,
21
- function(b,d){var c=a(ot_clone).clone(),e=a(".imagify-pre-checkout-offers").find(".imagify-offer-onetime");classes="";ot_user_cons<d.quota&&!1===ot_suggested&&(classes=" imagify-offer-selected",ot_suggested=!0,m(e,d,"onetime"));b===onetimes.length-1&&!1===ot_suggested&&m(e,onetimes[onetimes.length-1],"onetime");c=m(c,d,"onetime",classes);ot_html+=c[0].outerHTML});$mo_tpl.parent().find(".imagify-offer-line")&&$mo_tpl.parent().find(".imagify-offer-line").remove();$mo_tpl.before(mo_html);$ot_tpl.parent().find(".imagify-offer-line")&&
22
- $ot_tpl.parent().find(".imagify-offer-line").remove();$ot_tpl.before(ot_html)}y.find(".imagify-modal-loader").fadeOut(300)}})});r()})},E=function(b){b.each(function(){a(this).is(":checked")?a(this).closest(".imagify-offer-line").addClass("imagify-offer-selected"):a(this).closest(".imagify-offer-line").removeClass("imagify-offer-selected")});r()},F=function(b){b.each(function(){var b=a(this),c;c=b.parent(".imagify-cart-list-switcher").length?b.closest(".imagify-cart"):b.parent(".imagify-small-options").length?
23
- b.parent(".imagify-small-options").next(".imagify-pricing-table"):b.closest(".imagify-offer-line");var e=c.find(".imagify-switch-my");"yearly"===b.val()?(c.addClass("imagify-year-selected").removeClass("imagify-month-selected"),e.find(".imagify-monthly").attr("aria-hidden","true"),e.find(".imagify-yearly").attr("aria-hidden","false")):(c.addClass("imagify-month-selected").removeClass("imagify-year-selected"),e.find(".imagify-monthly").attr("aria-hidden","false"),e.find(".imagify-yearly").attr("aria-hidden",
24
- "true"))});r();return b},n=function(){var b=a("#imagify-coupon-code").val();if(""!==b){var d=a(".imagify-coupon-text"),c=d.find("label"),e=a(".imagify-coupon-section"),g=a("#imagify-get-pricing-modal").data("nonce");d.addClass("checking");a.post(ajaxurl,{action:"imagify_check_coupon",coupon:b,imagifynonce:g},function(a){d.removeClass("checking");"false"===a.success?(c.text(imagifyAdmin.labels.errorCouponAPI),e.removeClass("validated").addClass("invalid")):a.data.success?(a="percentage"===a.data.coupon_type?
25
- a.data.value+"%":"$"+a.data.value,e.removeClass("invalid").addClass("validated"),c.html(imagifyAdmin.labels.successCouponAPI),c.find(".imagify-coupon-offer").text(a),c.find(".imagify-coupon-word").text(b)):(e.removeClass("validated").addClass("invalid"),c.text(a.data.detail))})}},p=a(".imagify-offer-line").find(".imagify-checkbox"),G=a(".imagify-payment-modal").find(".imagify-radio-line").find("input");E(p);F(G.filter(":checked"));n();setInterval(function(){r()},1E3);p.on("change.imagify",function(){E(a(this))});
26
- G.on("change.imagify",function(){F(a(this))});a("#imagify-get-pricing-modal").on("click.imagify-ajax",function(){J(a(this))});var u=a("#imagify-plans-selection-view"),k=a("#imagify-payment-process-view"),t=a("#imagify-pre-checkout-view"),v=a("#imagify-success-view"),p=a(".imagify-choose-another-plan");a("#imagify-coupon-code").on("blur.imagify",function(){a(this).attr("readonly")||n()}).on("keydown.imagify",function(b){if(!a(this).attr("readonly")){if(13===b.keyCode||32===b.keyCode)return n(),!1;
27
- 3<=a(this).val().length?a(this).closest(".imagify-coupon-input").addClass("imagify-canbe-validate"):a(this).closest(".imagify-coupon-input").removeClass("imagify-canbe-validate")}});a("#imagify-coupon-validate").on("click.imagify",function(){n();a(this).closest(".imagify-canbe-validate").removeClass("imagify-canbe-validate")});u.hide();k.hide();v.hide();p.on("click.imagify",function(){var b=a(this),d=b.data("imagify-choose");b.closest(".imagify-modal-views").hide().attr("aria-hidden","true");k.hide().attr("aria-hidden",
28
- "true");u.fadeIn(300).attr("aria-hidden","false");var c=setInterval(function(){u.find('a[href="#imagify-pricing-tab-'+("plan"==d?"monthly":"onetime")+'"]').trigger("click.imagify");clearInterval(c);c=null},60);return!1});y.on("click.imagify",".imagify-payment-btn-select-plan",function(){var b=a(this),d=b.closest(".imagify-offer-line"),c=b.data("offer"),e=b.attr("data-offer"),g="imagify-pricing-tab-monthly"===b.closest(".imagify-tab-content").attr("id")?!1:!0,f=g?t.find(".imagify-offer-onetime"):t.find(".imagify-offer-monthly"),
29
- b=g?null:b.closest(".imagify-pricing-table").hasClass("imagify-month-selected")?"monthly":"yearly",c=g?z(c[Object.keys(c)[0]].price):z(c[Object.keys(c)[0]].prices,b),k=d.find(".imagify-price-discount").html(),m=d.find(".imagify-approx-nb").text(),n=d.find(".imagify-offer-size").text(),p=g?"":'<span class="imagify-price-by">'+d.find(".imagify-price-by").text()+"</span>";u.hide().attr("aria-hidden","true");t.fadeIn(300).attr("aria-hidden","false");f.find(".imagify-number-block").html(c+p);f.find(".imagify-price-discount").html(k);
30
- f.find(".imagify-approx-nb").text(m);f.find(".imagify-offer-size").text(n);f.attr("data-offer",e);g||(f.find(".imagify-price-add-data").text(d.find(".imagify-price-add-data").text()),"monthly"===b?f.find("#imagify-subscription-monthly").trigger("click.imagify"):f.find("#imagify-subscription-yearly").trigger("click.imagify"),f.find(".imagify-inline-options").find("input:radio:checked").trigger("change.imagify"));r();return!1});a("#imagify-modal-checkout-btn").on("click.imagify",function(){if(!a(this).hasClass("imagify-button-disabled")){var b=
31
- a(".imagify-offer-monthly"),d=a(".imagify-offer-onetime"),c={};b.hasClass("imagify-year-selected");b.hasClass("imagify-offer-selected")?(c.monthly=JSON.parse(b.attr("data-offer")),a(".imagify-cart-list-my-choice").show(),prices=c.monthly[Object.keys(c.monthly)[0]].prices,save_price=Math.round(1200*(prices.monthly-prices.yearly))/100,a(".imagify-nb-save-per-year").text("$"+save_price)):a(".imagify-cart-list-my-choice").hide();d.hasClass("imagify-offer-selected")&&(c.onetime=JSON.parse(d.attr("data-offer")));
32
- t.hide().attr("aria-hidden","true");k.fadeIn(300).attr("aria-hidden","false").closest(".imagify-modal-content").addClass("imagify-iframe-viewing");c.period=a(".imagify-offer-monthly").hasClass("imagify-month-selected")?"monthly":"yearly";var b=a("#imagify-payment-iframe"),e=b.attr("src"),d=b.data("src"),g=0,f=0;"object"===typeof c?(c.monthly&&(g=c.monthly[Object.keys(c.monthly)[0]].id),c.onetime&&(f=c.onetime[Object.keys(c.onetime)[0]].id,f=999==f?c.onetime[Object.keys(c.onetime)[0]].data:f),c.period?
33
- (a("#imagify-payment-iframe").data("imagify-api"),e=f,f="yearly"===c.period?g:0,c="monthly"===c.period?g:0,g=a("#imagify-coupon-code").val(),g=""===g?"none":g,parseFloat(a(".imagify-global-amount").text()).toFixed(2),d=d+e+"/"+c+"/"+f+"/"+g+"/",$iframeClone=b.clone(),b.remove(),$iframeClone.attr("src",d),k.html($iframeClone)):H.info("No period defined")):"string"===typeof c&&""!==e&&(tofind="monthly"===c?"yearly":"monthly",e=e.replace(tofind,c),b.attr("src",e));return!1}});a(".imagify-back-to-plans").on("click.imagify",
34
- function(){a(this).closest(".imagify-cart-item").hasClass("imagify-cart-item-onetime")?a(".imagify-offer-onetime").find(".imagify-choose-another-plan").trigger("click.imagify"):a(".imagify-offer-monthly").find(".imagify-choose-another-plan").trigger("click.imagify");return!1});window.addEventListener("message",function(b){var d=b.origin||b.originalEvent.origin;if("https://app.imagify.io"===d||"http://dapp.imagify.io"===d)switch(b.data){case "cancel":a(".imagify-iframe-viewing .close-btn").trigger("click.imagify");
35
- a(".imagify-iframe-viewing").removeClass("imagify-iframe-viewing");break;case "back":a(".imagify-iframe-viewing").removeClass("imagify-iframe-viewing");k.hide();t.fadeIn(200);break;case "success":a(".imagify-iframe-viewing").removeClass("imagify-iframe-viewing"),k.hide(),v.closest(".imagify-modal-content").addClass("imagify-success-viewing"),v.closest(".imagify-modal").attr("aria-labelledby","imagify-success-view"),v.fadeIn(200)}},!0)}if(a(".imagify-tabs").length)a(".imagify-tab").on("click.imagify",
36
- function(){var b=a(this);if(!b.hasClass("imagify-current")){var d=b.find("a").attr("href")||"#"+b.find("a").attr("aria-controls");b.closest(".imagify-tabs").next(".imagify-tabs-contents").find(".imagify-tab-content").hide().attr("aria-hidden","true");a(d).fadeIn(275).attr("aria-hidden","false");b.closest(".imagify-tabs").find(".imagify-tab").removeClass("imagify-current").attr("aria-selected","false");b.addClass("imagify-current").attr("aria-selected","true")}return!1})});
1
+ window.imagify=window.imagify||{concat:ajaxurl.indexOf("?")>0?"&":"?",log:function(a){void 0!==console&&console.log(a)},info:function(a){void 0!==console&&console.info(a)}},function(a,b,c,d){var e=!1;a("#wp-admin-bar-imagify").hover(function(){var b;!0!==e&&(e=!0,b=a("#wp-admin-bar-imagify-profile-content"),b.is(":empty")&&a.get(ajaxurl+imagify.concat+"action=imagify_get_admin_bar_profile&imagifygetadminbarprofilenonce="+a("#imagifygetadminbarprofilenonce").val()).done(function(c){b.html(c.data),a("#wp-admin-bar-imagify-profile-loading").remove(),e=!1}))})}(jQuery,document,window),function(a,b,c,d){a("#imagify-signup").on("click.imagify",function(b){b.preventDefault(),swal({title:imagifyAdmin.labels.signupTitle,html:imagifyAdmin.labels.signupText,confirmButtonText:imagifyAdmin.labels.signupConfirmButtonText,input:"email",allowOutsideClick:!0,showLoaderOnConfirm:!0,customClass:"imagify-sweet-alert imagify-sweet-alert-signup",inputValidator:function(b){return new Promise(function(c,d){""!==a.trim(b)&&b?c():d(imagifyAdmin.labels.signupErrorEmptyEmail)})},preConfirm:function(b){return new Promise(function(c,d){setTimeout(function(){a.get(ajaxurl+imagify.concat+"action=imagify_signup&email="+b+"&imagifysignupnonce="+a("#imagifysignupnonce").val()).done(function(a){a.success?c():d(a.data)})},2e3)})}}).then(function(){swal({title:imagifyAdmin.labels.signupSuccessTitle,html:imagifyAdmin.labels.signupSuccessText,type:"success",customClass:"imagify-sweet-alert"})})}),a("#imagify-save-api-key").on("click.imagify",function(b){b.preventDefault(),swal({title:imagifyAdmin.labels.saveApiKeyTitle,html:imagifyAdmin.labels.saveApiKeyText,confirmButtonText:imagifyAdmin.labels.saveApiKeyConfirmButtonText,input:"text",allowOutsideClick:!0,showLoaderOnConfirm:!0,customClass:"imagify-sweet-alert imagify-sweet-alert-signup",inputValidator:function(b){return new Promise(function(c,d){""!==a.trim(b)&&b?c():d(imagifyAdmin.labels.ApiKeyErrorEmpty)})},preConfirm:function(b){return new Promise(function(c,d){a.get(ajaxurl+imagify.concat+"action=imagify_check_api_key_validity&api_key="+b+"&imagifycheckapikeynonce="+a("#imagifycheckapikeynonce").val()).done(function(a){a.success?c():d(a.data)})})}}).then(function(){swal({title:imagifyAdmin.labels.ApiKeyCheckSuccessTitle,html:imagifyAdmin.labels.ApiKeyCheckSuccessText,type:"success",customClass:"imagify-sweet-alert"})})}),a(".imagify-notice-dismiss").on("click.imagify",function(b){var c=a(this),d=c.parents(".imagify-welcome, .imagify-notice"),e=c.attr("href");b.preventDefault(),d.fadeTo(100,0,function(){a(this).slideUp(100,function(){a(this).remove()})}),a.get(e.replace("admin-post.php","admin-ajax.php"))})}(jQuery,document,window),function(a,b,c,d){var e=function(b){var c=b.data("target")||b.attr("href");a(c).css("display","flex").hide().fadeIn(400).attr("aria-hidden","false").attr("tabindex","0").focus().removeAttr("tabindex").addClass("modal-is-open"),a("body").addClass("imagify-modal-is-open")};a(".imagify-modal").attr("aria-hidden","true"),a(b).on("click.imagify",".imagify-modal-trigger",function(){return e(a(this)),!1}).on("click.imagify",".imagify-modal .close-btn",function(){a(this).closest(".imagify-modal").fadeOut(400).attr("aria-hidden","true").removeClass("modal-is-open").trigger("modalClosed.imagify"),a("body").removeClass("imagify-modal-is-open")}).on("blur.imagify",".imagify-modal .close-btn",function(){var b=a(this).closest(".imagify-modal");"false"===b.attr("aria-hidden")&&b.attr("tabindex","0").focus().removeAttr("tabindex")}).on("click.imagify",".imagify-modal",function(b){a(b.target).filter(".modal-is-open").find(".close-btn").trigger("click.imagify")}).on("keydown.imagify",function(b){if(27===b.keyCode&&a(".imagify-modal.modal-is-open").length>0)return b.preventDefault(),a(".imagify-modal.modal-is-open").find(".close-btn").trigger("click.imagify"),!1})}(jQuery,document,window),function(a,b,c,d){var e={};a("#imagify-pricing-modal").length&&(e={$modal:a("#imagify-pricing-modal"),$checkboxes:a(".imagify-offer-line .imagify-checkbox"),$radios:a(".imagify-payment-modal .imagify-radio-line input"),$preView:a("#imagify-pre-checkout-view"),$plansView:a("#imagify-plans-selection-view").hide(),$paymentView:a("#imagify-payment-process-view").hide(),$successView:a("#imagify-success-view").hide(),$anotherBtn:a(".imagify-choose-another-plan"),speedFadeIn:300,getHtmlPrice:function(a,b){var c,d,e,f,g;return b||(b=null),"object"!=typeof a?(a+="",a=a.split("."),a[1]=1===a[1].length?a[1]+"0":(""+a[1]).substring(0,2),g='<span class="imagify-price-big">'+a[0]+"</span> ",g+='<span class="imagify-price-mini">.'+a[1]+"</span>"):(c=a.monthly+"",d=a.yearly+"",e=c.split("."),f=d.split("."),g='<span class="imagify-switch-my">',g+='<span aria-hidden="'+("monthly"===b?"false":"true")+'" class="imagify-monthly">',g+='<span class="imagify-price-big">'+e[0]+"</span> ",g+='<span class="imagify-price-mini">.'+(1===e[1].length?e[1]+"0":(""+e[1]).substring(0,2))+"</span>",g+="</span> ",g+='<span aria-hidden="'+("yearly"===b?"false":"true")+'" class="imagify-yearly">',g+='<span class="imagify-price-big">'+f[0]+"</span> ",g+='<span class="imagify-price-mini">.'+(1===f[1].length?f[1]+"0":(""+f[1]).substring(0,2))+"</span>",g+="</span>",g+="</span>")},getHtmlDiscountPrice:function(a,b){var c,d,e="";return b||(b=null),"object"==typeof a?(c=a.monthly+"",d=a.yearly+"",e+='<span class="imagify-price-discount">',e+='<span class="imagify-price-discount-dollar">$</span>',e+='<span class="imagify-switch-my">',e+='<span aria-hidden="'+("monthly"===b?"false":"true")+'" class="imagify-monthly">',e+='<span class="imagify-price-discount-number">'+c+"</span>",e+="</span>",e+='<span aria-hidden="'+("yearly"===b?"false":"true")+'" class="imagify-yearly">',e+='<span class="imagify-price-discount-number">'+d+"</span>",e+="</span>",e+="</span>",e+="</span>"):(a+="",e+='<span class="imagify-price-discount">',e+='<span class="imagify-price-discount-dollar">$</span>',e+='<span class="imagify-price-discount-number">'+a+"</span>",e+="</span>"),e},populateOffer:function(a,b,d,f){var g,h,i,j=c.imagify_discount_datas,k=b.additional_gb,l=b.annual_cost,m=b.id,n=b.label,o=b.monthly_cost,p=b.quota,q=b.cost,r=p>=1e3?p/1e3+" GB":p+" MB",s="monthly"===d?{monthly:o,yearly:Math.round(l/12*100)/100}:q,t=s;return j.is_active&&"percentage"===j.coupon_type&&"monthly"===d&&(g=(100-j.coupon_value)/100,s="monthly"===d?{monthly:o*g,yearly:Math.round(l*g/12*100)/100}:q*g),void 0!==f&&a.addClass("imagify-"+d+"-"+n+f),a.find(".imagify-offer-size").text(r),a.find(".imagify-number-block").html(e.getHtmlPrice(s,"monthly")),j.is_active&&"percentage"===j.coupon_type&&"monthly"===d&&(a.find(".imagify-price-block").prev(".imagify-price-discount").remove(),a.find(".imagify-price-block").before(e.getHtmlDiscountPrice(t,"monthly"))),a.find(".imagify-approx-nb").text(5*p),"monthly"===d&&a.find(".imagify-price-add-data").text("$"+k),h=a.find(".imagify-payment-btn-select-plan").length?a.find(".imagify-payment-btn-select-plan"):a,i="monthly"===d?'{"'+n+'":{"id":'+m+',"name":"'+r+'","data":'+p+',"dataf":"'+r+'","imgs":'+5*p+',"prices":{"monthly":'+s.monthly+',"yearly":'+s.yearly+',"add":'+k+"}}}":'{"ot'+n+'":{"id":'+m+',"name":"'+r+'","data":'+p+',"dataf":"'+r+'","imgs":'+5*p+',"price":'+s+"}}",h.attr("data-offer",i),a},populatePayBtn:function(){var b=JSON.parse(a(".imagify-offer-monthly").attr("data-offer")),c=JSON.parse(a(".imagify-offer-onetime").attr("data-offer")),d=0,e=0,f=0;a(".imagify-offer-monthly").hasClass("imagify-offer-selected")&&(e=a("#imagify-subscription-monthly").filter(":checked").length?b[Object.keys(b)[0]].prices.monthly:12*b[Object.keys(b)[0]].prices.yearly),a(".imagify-offer-onetime").hasClass("imagify-offer-selected")&&(f=c[Object.keys(c)[0]].price),d=parseFloat(f+e).toFixed(2),"0.00"===d||0===d?a("#imagify-modal-checkout-btn").attr("disabled","disabled").addClass("imagify-button-disabled"):a("#imagify-modal-checkout-btn").removeAttr("disabled").removeClass("imagify-button-disabled")},checkCoupon:function(){var b,c,d,e,f=a("#imagify-coupon-code").val();""!==f&&(b=a(".imagify-coupon-text"),c=b.find("label"),d=a(".imagify-coupon-section"),e=a("#imagify-get-pricing-modal").data("nonce"),b.addClass("checking"),a.post(ajaxurl,{action:"imagify_check_coupon",coupon:f,imagifynonce:e},function(a){var e;b.removeClass("checking"),a.success?a.data.success?(e="percentage"===a.data.coupon_type?a.data.value+"%":"$"+a.data.value,d.removeClass("invalid").addClass("validated"),c.html(imagifyAdmin.labels.successCouponAPI),c.find(".imagify-coupon-offer").text(e),c.find(".imagify-coupon-word").text(f)):(d.removeClass("validated").addClass("invalid"),c.text(a.data.detail)):(d.removeClass("validated").addClass("invalid"),c.text(imagifyAdmin.labels.errorCouponAPI))}))},getPricing:function(b){var d=b.data("nonce"),f={action:"imagify_get_prices",imagifynonce:d},g={action:"imagify_get_images_counts",imagifynonce:d},h={action:"imagify_get_discount",imagifynonce:d};e.$modal.find(".imagify-modal-loader").hide().show(),a.post(ajaxurl,f,function(b){if(!b.success)return void e.populatePayBtn();a.post(ajaxurl,g,function(d){d.success&&a.post(ajaxurl,h,function(f){var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C="",D="",E=!1,F=!1;if(f.success){if(g=d.data,h=b.data,i=f.data,j=h.monthlies,k=h.onetimes,l=Math.round(g.average_month_size.raw/1e6),m=Math.round(g.total_library_size.raw/1e6),n=a("#imagify-offer-monthly-template"),o=a("#imagify-offer-onetime-template"),p=o.html(),q=n.html(),r=a(".imagify-estimation-block"),r.removeClass("imagify-analyzing"),r.find(".average-month-size").text(g.average_month_size.human),r.find(".total-library-size").text(g.total_library_size.human),l<25&&m<25?(a(".imagify-pre-checkout-offers .imagify-modal-title").addClass("imagify-enough-free"),a(".imagify-offer-selected").removeClass("imagify-offer-selected").find(".imagify-checkbox").removeAttr("checked")):(a(".imagify-enough-free").removeClass("imagify-enough-free"),a(".imagify-offer-selected").addClass("imagify-offer-selected").find(".imagify-checkbox").attr("checked","checked")),null===j||null===k)return s=a(".imagify-pre-checkout-offers"),s.hide().attr("aria-hidden",!0),s.closest(".imagify-modal-views").find(".imagify-popin-message").remove(),s.after('<div class="imagify-popin-message imagify-error"><p>'+imagifyAdmin.labels.errorPriceAPI+"</p></div>"),void e.$modal.find(".imagify-modal-loader").fadeOut(300);if(c.imagify_discount_datas=i,i.is_active&&(t=a(".imagify-modal-promotion"),u=i.date_end.split("T")[0],v=i.coupon_value,w="percentage"===i.coupon_type?v+"%":"$"+v,a("#imagify-coupon-code").val(i.label).attr("readonly",!0),t.addClass("active").attr("aria-hidden","false"),t.find(".imagify-promotion-number").text(w),t.find(".imagify-promotion-date").text(u),e.checkCoupon()),a.each(j,function(b,c){var d,f,g="";return"free"===c.label||(d=a(q).clone(),!1!==F&&b-F>2||(l<c.quota&&!1===F&&(g=" imagify-offer-selected",F=b,f=a(".imagify-pre-checkout-offers").find(".imagify-offer-monthly"),e.populateOffer(f,c,"monthly")),d=e.populateOffer(d,c,"monthly",g),void(D+=d[0].outerHTML)))}),x=a(D).filter(".imagify-offer-selected").prevAll(),x.length>1){for(y=x.length-1,z=a(D),A=0;A<y;A++)delete z[A];for(D="",B=0;B<z.length;B++)D+=a("<div/>").append(z[B]).html()}a.each(k,function(b,c){var d,f=a(p).clone(),g=a(".imagify-pre-checkout-offers").find(".imagify-offer-onetime"),h="";m<c.quota&&!1===E&&(h=" imagify-offer-selected",E=!0,e.populateOffer(g,c,"onetime")),k.length-1===b&&!1===E&&(d=k[k.length-1],e.populateOffer(g,d,"onetime")),f=e.populateOffer(f,c,"onetime",h),C+=f[0].outerHTML}),n.parent().find(".imagify-offer-line")&&n.parent().find(".imagify-offer-line").remove(),n.before(D),o.parent().find(".imagify-offer-line")&&o.parent().find(".imagify-offer-line").remove(),o.before(C),e.$modal.find(".imagify-modal-loader").fadeOut(300)}})}),e.populatePayBtn()})},checkCheckbox:function(b){b.each(function(){var b=a(this);b.is(":checked")?b.closest(".imagify-offer-line").addClass("imagify-offer-selected"):b.closest(".imagify-offer-line").removeClass("imagify-offer-selected")}),e.populatePayBtn()},checkRadio:function(b){return b.each(function(){var b,c,d=a(this);b=d.parent(".imagify-cart-list-switcher").length?d.closest(".imagify-cart"):d.parent(".imagify-small-options").length?d.parent(".imagify-small-options").next(".imagify-pricing-table"):d.closest(".imagify-offer-line"),c=b.find(".imagify-switch-my"),"yearly"===d.val()?(b.addClass("imagify-year-selected").removeClass("imagify-month-selected"),c.find(".imagify-monthly").attr("aria-hidden","true"),c.find(".imagify-yearly").attr("aria-hidden","false")):(b.addClass("imagify-month-selected").removeClass("imagify-year-selected"),c.find(".imagify-monthly").attr("aria-hidden","false"),c.find(".imagify-yearly").attr("aria-hidden","true"))}),e.populatePayBtn(),b},populateBtnPrice:setInterval(function(){e.populatePayBtn()},1e3),getPeriod:function(){return a(".imagify-offer-monthly").hasClass("imagify-month-selected")?"monthly":"yearly"},getApiKey:function(){return a("#imagify-payment-iframe").data("imagify-api")},switchToView:function(a,b){var c=a.attr("id"),d=e.$modal.children(".imagify-modal-content");a.siblings(".imagify-modal-views").hide().attr("aria-hidden","true"),b&&b.tab&&a.find('a[href="#'+b.tab+'"]').trigger("click.imagify"),"imagify-payment-process-view"===c?d.addClass("imagify-iframe-viewing"):d.removeClass("imagify-iframe-viewing"),"imagify-success-view"===c?(d.addClass("imagify-success-viewing"),e.$modal.attr("aria-labelledby","imagify-success-view")):(d.removeClass("imagify-success-viewing"),e.$modal.removeAttr("aria-labelledby")),a.fadeIn(e.speedFadeIn).attr("aria-hidden","false")},iframeSetSrc:function(b){var c,d,f,g,h,i,j,k=a("#imagify-payment-iframe"),l=k.attr("src"),m=k.data("src"),n=0,o=0;if("string"==typeof b&&""!==l)return j="monthly"===b?"yearly":"monthly",l=l.replace(j,b),void k.attr("src",l);if("object"==typeof b){if(b.monthly&&(n=b.monthly[Object.keys(b.monthly)[0]].id),b.onetime&&(o=b.onetime[Object.keys(b.onetime)[0]].id,o=o+""=="999"?b.onetime[Object.keys(b.onetime)[0]].data:o),!b.period)return void imagify.info("No period defined");e.getApiKey(),c=o,d="yearly"===b.period?n:0,f="monthly"===b.period?n:0,g=a("#imagify-coupon-code").val(),h=""===g?"none":g,parseFloat(a(".imagify-global-amount").text()).toFixed(2),m=m+c+"/"+f+"/"+d+"/"+h+"/",i=k.remove().attr("src",m),e.$paymentView.html(i)}},paymentClose:function(){a(".imagify-iframe-viewing .close-btn").trigger("click.imagify"),a(".imagify-iframe-viewing").removeClass("imagify-iframe-viewing")},paymentBack:function(){e.switchToView(e.$preView)},paymentSuccess:function(){e.switchToView(e.$successView)},checkPluginMessage:function(a){var b=a.origin||a.originalEvent.origin;if("https://app.imagify.io"===b||"http://dapp.imagify.io"===b)switch(a.data){case"cancel":e.paymentClose();break;case"back":e.paymentBack();break;case"success":e.paymentSuccess()}}},e.checkCheckbox(e.$checkboxes),e.checkRadio(e.$radios.filter(":checked")),e.checkCoupon(),e.$checkboxes.on("change.imagify",function(){e.checkCheckbox(a(this))}),e.$radios.on("change.imagify",function(){e.checkRadio(a(this))}),a("#imagify-get-pricing-modal").on("click.imagify-ajax",function(){e.getPricing(a(this))}),a(b).on("modalClosed.imagify",".imagify-payment-modal",function(){a(this).find(".imagify-modal-content").removeClass("imagify-success-viewing imagify-iframe-viewing"),setTimeout(function(){a(".imagify-modal-views").hide(),a("#imagify-pre-checkout-view").show()},300)}),a("#imagify-coupon-code").on("blur.imagify",function(){a(this).attr("readonly")||e.checkCoupon()}).on("keydown.imagify",function(b){var c=a(this);if(!c.attr("readonly"))return 13===b.keyCode||32===b.keyCode?(e.checkCoupon(),!1):void(c.val().length>=3?c.closest(".imagify-coupon-input").addClass("imagify-canbe-validate"):c.closest(".imagify-coupon-input").removeClass("imagify-canbe-validate"))}),a("#imagify-coupon-validate").on("click.imagify",function(){e.checkCoupon(),a(this).closest(".imagify-canbe-validate").removeClass("imagify-canbe-validate")}),e.$anotherBtn.on("click.imagify",function(){var b=a(this).data("imagify-choose"),c="imagify-pricing-tab-"+("plan"===b?"monthly":"onetime");return e.switchToView(e.$plansView,{tab:c}),!1}),e.$modal.on("click.imagify",".imagify-payment-btn-select-plan",function(){var b=a(this),c=b.closest(".imagify-offer-line"),d=b.data("offer"),f=b.attr("data-offer"),g="imagify-pricing-tab-monthly"!==b.closest(".imagify-tab-content").attr("id"),h=g?e.$preView.find(".imagify-offer-onetime"):e.$preView.find(".imagify-offer-monthly"),i=g?null:b.closest(".imagify-pricing-table").hasClass("imagify-month-selected")?"monthly":"yearly",j=g?e.getHtmlPrice(d[Object.keys(d)[0]].price):e.getHtmlPrice(d[Object.keys(d)[0]].prices,i),k=g?"":'<span class="imagify-price-by">'+c.find(".imagify-price-by").text()+"</span>",l=c.find(".imagify-price-discount").html(),m=c.find(".imagify-approx-nb").text(),n=c.find(".imagify-offer-size").text();return e.switchToView(e.$preView),h.find(".imagify-number-block").html(j+k),h.find(".imagify-price-discount").html(l),h.find(".imagify-approx-nb").text(m),h.find(".imagify-offer-size").text(n),h.attr("data-offer",f),g||(h.find(".imagify-price-add-data").text(c.find(".imagify-price-add-data").text()),"monthly"===i?h.find("#imagify-subscription-monthly").trigger("click.imagify"):h.find("#imagify-subscription-yearly").trigger("click.imagify"),h.find(".imagify-inline-options").find("input:radio:checked").trigger("change.imagify")),e.populatePayBtn(),!1}),a("#imagify-modal-checkout-btn").on("click.imagify",function(){var b,c,d;if(!a(this).hasClass("imagify-button-disabled"))return b=a(".imagify-offer-monthly"),c=a(".imagify-offer-onetime"),d={},b.hasClass("imagify-offer-selected")&&(d.monthly=JSON.parse(b.attr("data-offer"))),c.hasClass("imagify-offer-selected")&&(d.onetime=JSON.parse(c.attr("data-offer"))),e.switchToView(e.$paymentView),d.period=e.getPeriod(),e.iframeSetSrc(d),!1}),a(".imagify-back-to-plans").on("click.imagify",function(){return a(this).closest(".imagify-cart-item").hasClass("imagify-cart-item-onetime")?a(".imagify-offer-onetime").find(".imagify-choose-another-plan").trigger("click.imagify"):a(".imagify-offer-monthly").find(".imagify-choose-another-plan").trigger("click.imagify"),!1}),c.addEventListener("message",e.checkPluginMessage,!0))}(jQuery,document,window),function(a,b,c,d){a(".imagify-tab").on("click.imagify",function(b){var c,d=a(this);b.preventDefault(),d.hasClass("imagify-current")||(c=d.find("a").attr("href")||"#"+d.find("a").attr("aria-controls"),d.closest(".imagify-tabs").next(".imagify-tabs-contents").find(".imagify-tab-content").hide().attr("aria-hidden","true"),a(c).fadeIn(275).attr("aria-hidden","false"),d.closest(".imagify-tabs").find(".imagify-tab").removeClass("imagify-current").attr("aria-selected","false"),d.addClass("imagify-current").attr("aria-selected","true"))})}(jQuery,document,window);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/bulk.js CHANGED
@@ -1,382 +1,397 @@
1
- jQuery(function($){
2
 
3
- var concat = ajaxurl.indexOf("?") > 0 ? "&" : "?";
4
-
5
- // avoid error on IE
6
- var imagify = {
7
- log: function (content) {
8
- if (console !== 'undefined') console.log(content);
9
- }
10
- };
11
-
12
- var overviewCanvas = document.getElementById("imagify-overview-chart"),
13
- overviewData = [
14
- {
15
- value: imagifyBulk.labels.totalUnoptimizedAttachments,
16
- color:"#D9E4EB",
17
- highlight: "#D9E4EB",
18
- label: imagifyBulk.labels.overviewChartLabels.unoptimized
19
- },
20
- {
21
- value: imagifyBulk.labels.totalOptimizedAttachments,
22
- color: "#46B1CE",
23
- highlight: "#46B1CE",
24
- label: imagifyBulk.labels.overviewChartLabels.optimized
25
- },
26
- {
27
- value: imagifyBulk.labels.totalErrorsAttachments,
28
- color: "#2E3242",
29
- highlight: "#2E3242",
30
- label: imagifyBulk.labels.overviewChartLabels.error
31
  }
32
- ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
- // to avoid JS error
35
  if ( overviewCanvas ) {
36
- var overviewDoughnut = new Chart(overviewCanvas.getContext("2d")).Doughnut(overviewData, {
37
- segmentStrokeColor : "transparent",
38
- segmentStrokeWidth : 0,
39
- animateRotate : true,
40
- animation: true,
41
  percentageInnerCutout: 85,
42
- legendTemplate : "<ul class=\"imagify-<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>",
43
- tooltipTemplate: "<%= value %>"
44
- });
45
 
46
- //then you just need to generate the legend
47
- //var overviewLegend = overviewDoughnut.generateLegend();
48
- //bugged `segments undefined` ?
 
 
49
 
50
- //and append it to your page somewhere
51
  overviewLegend = '<ul class="imagify-doughnut-legend">';
52
-
53
- $(overviewData).each(function(i){
54
- overviewLegend += '<li><span style="background-color:' + overviewData[i].color + '"></span>' + overviewData[i].label + '</li>';
55
- });
56
 
57
  overviewLegend += '</ul>';
58
-
59
- document.getElementById("imagify-overview-chart-legend").innerHTML = overviewLegend;
60
  }
61
-
62
- // Heartbeat
63
- $(document).on('heartbeat-send', function(e, data) {
64
- data['imagify_heartbeat'] = imagifyBulk.heartbeat_id;
65
- });
66
-
67
  // Listen for the custom event "heartbeat-tick" on $(document).
68
- $(document).on( 'heartbeat-tick', function(e, data) {
69
- if ( ! data['imagify_bulk_data'] ) {
70
- return;
71
- }
72
-
73
- data = data['imagify_bulk_data'];
74
-
75
- // The overview chart percent
76
- $('#imagify-overview-chart-percent').html(data.optimized_attachments_percent + '<span>%</span>');
77
- $('.imagify-total-percent').html(data.optimized_attachments_percent + '%' );
78
-
79
- // The comsuption bar
80
- $('.imagify-unconsumed-percent').html(data.unconsumed_quota + '%');
81
- $('.imagify-unconsumed-bar').css('width', data.unconsumed_quota + '%');
82
-
83
- // The total optimized images
84
- $('#imagify-total-optimized-attachments').html(data.already_optimized_attachments);
85
-
86
- // The original bar
87
- $('#imagify-original-bar').find('.imagify-barnb')
88
- .html(data.original_human);
89
-
90
- // The optimized bar
91
- $('#imagify-optimized-bar').css('width', data.optimized_percent + '%')
92
- .find('.imagify-barnb')
93
- .html(data.optimized_human);
94
-
95
- // The Percent data
96
- $('#imagify-total-optimized-attachments-pct').html( data.optimized_percent + '%' );
97
 
98
  overviewDoughnut.segments[0].value = data.unoptimized_attachments;
99
  overviewDoughnut.segments[1].value = data.optimized_attachments;
100
  overviewDoughnut.segments[2].value = data.errors_attachments;
101
  overviewDoughnut.update();
102
- });
103
 
104
  // Simulate a click on the "Imagif'em all" button
105
- $('#imagify-simulate-bulk-action').click(function(e){
106
  e.preventDefault();
107
- $('#imagify-bulk-action').trigger('click');
108
- });
109
 
110
- $('#imagify-bulk-action').click(function(){
111
- var $obj = $(this),
112
- $optimization_level = $('[name="optimization_level"]:checked').val();
 
113
 
114
- if (typeof $optimization_level === "undefined") {
115
- $optimization_level = -1;
116
  }
117
-
118
- if ( $obj.attr('disabled') ) {
119
  return false;
120
  }
121
 
122
- $obj.attr('disabled', 'disabled');
123
- $obj.find('.dashicons').addClass('rotate');
124
-
125
-
126
- confirmMessage = function(){
127
  return imagifyBulk.labels.processing;
128
  };
129
- $(window).on('beforeunload', confirmMessage);
130
-
131
- // Display an alert to wait
132
- swal({
133
- title:imagifyBulk.labels.waitTitle,
134
- html: imagifyBulk.labels.waitText,
 
135
  showConfirmButton: false,
136
- imageUrl: imagifyBulk.labels.waitImageUrl
137
- });
138
-
139
- $.get(ajaxurl+concat+"action="+imagifyBulk.ajax_action+"&optimization_level="+$optimization_level+"&imagifybulkuploadnonce="+$('#imagifybulkuploadnonce').val())
140
- .done(function(response) {
141
- if( !response.success ) {
142
- $obj.removeAttr('disabled');
143
- $obj.find('.dashicons').removeClass('rotate');
144
-
145
- swal_title = '';
146
- swal_text = '';
147
-
148
- // remove confirm dialog before quit the page
149
- $(window).off('beforeunload', confirmMessage);
150
-
151
- if ( response.data.message == 'invalid-api-key' ) {
 
 
 
 
 
152
  swal_title = imagifyBulk.labels.invalidAPIKeyTitle;
153
  }
154
-
155
- if ( response.data.message == 'over-quota' ) {
156
  swal_title = imagifyBulk.labels.overQuotaTitle;
157
- text = imagifyBulk.labels.overQuotaText;
158
  }
159
-
160
- if ( response.data.message == 'no-images' ) {
161
  swal_title = imagifyBulk.labels.noAttachmentToOptimizeTitle;
162
  swal_text = imagifyBulk.labels.noAttachmentToOptimizeText;
163
  }
164
-
165
- // Display an alert to warn that all images has been optimized
166
- swal({
167
- title: swal_title,
168
- html: swal_text,
169
- type: "info",
170
- customClass: "imagify-sweet-alert"
171
- });
172
-
173
- } else {
174
- swal.close();
175
-
176
- var config = {
177
- 'lib': ajaxurl+concat+"action=imagify_bulk_upload&imagifybulkuploadnonce="+$('#imagifybulkuploadnonce').val(),
178
- 'images': response.data,
179
- 'context': imagifyBulk.ajax_context
180
- }
181
 
182
- var table = $('.imagify-bulk-table table tbody'),
183
- files = 0,
184
- errors = 0,
185
- original_overall_size = 0,
186
- overall_saving = 0;
187
-
188
- $('.imagify-row-progress').slideDown();
189
- $('.imagify-no-uploaded-yet, .imagify-row-complete').hide(200);
190
-
191
- Optimizer = new ImagifyGulp(config);
192
-
193
- // before the attachment optimization
194
- Optimizer.before(function(data) {
195
- table.find('.imagify-row-progress').after('<tr id="attachment-'+data.id+'"><td class="imagify-cell-filename"><span class="imagiuploaded"><img src="'+data.thumbnail+'"/>"</span><span class="imagifilename">'+data.filename+'</span></td><td class="imagify-cell-status"><span class="imagistatus status-compressing"><span class="dashicons dashicons-admin-generic rotate"></span>Compressing<span></span></span></td><td class="imagify-cell-original"></td><td class="imagify-cell-optimized"></td><td class="imagify-cell-percentage"></td><td class="imagify-cell-thumbnails"></td><td class="imagify-cell-savings"></td></tr>');
196
- })
197
- // after the attachment optimization
198
- .each(function (data) {
199
- var $progress = $('#imagify-progress-bar');
200
- $progress.css({'width': data.progress + '%'});
201
- $progress.find('.percent').html(data.progress + '%');
202
-
203
- if ( data.success ) {
204
- $('#attachment-'+data.image+' .imagify-cell-status').html('<span class="imagistatus status-complete"><span class="dashicons dashicons-yes"></span>Complete</span>');
205
- $('#attachment-'+data.image+' .imagify-cell-original').html(data.original_size_human);
206
- $('#attachment-'+data.image+' .imagify-cell-optimized').html(data.new_size_human);
207
- $('#attachment-'+data.image+' .imagify-cell-percentage').html('<span class="imagify-chart"><span class="imagify-chart-container"><canvas height="18" width="18" id="imagify-consumption-chart" style="width: 18px; height: 18px;"></canvas></span></span><span class="imagipercent">'+data.percent+'</span>%');
208
- draw_me_a_chart( $('#attachment-'+data.image+' .imagify-cell-percentage').find('canvas') );
209
- $('#attachment-'+data.image+' .imagify-cell-thumbnails').html(data.thumbnails);
210
- $('#attachment-'+data.image+' .imagify-cell-savings').html(Optimizer.humanSize(data.overall_saving, 1));
211
-
212
- // The table footer total optimized files
213
- files = files + data.thumbnails + 1;
214
- $('.imagify-cell-nb-files').html(files + ' file(s)');
215
-
216
- // The table footer original size
217
- original_overall_size = original_overall_size + data.original_overall_size;
218
- $('.imagify-total-original').html(Optimizer.humanSize(original_overall_size, 1));
219
-
220
- // The table footer overall saving
221
- overall_saving = overall_saving + data.overall_saving;
222
- $('.imagify-total-gain').html(Optimizer.humanSize(overall_saving, 1));
223
-
224
- } else {
225
- error_class = 'error';
226
- error_dashicon = 'dismiss';
227
- error_message = 'Error';
228
-
229
- if ( data.error.indexOf("You've consumed all your data") >= 0 ) {
230
- swal({
231
- title: imagifyBulk.labels.overQuotaTitle,
232
- html: imagifyBulk.labels.overQuotaText,
233
- type: "error",
234
- customClass: "imagify-sweet-alert",
235
- }).then( function() {
236
- location.reload();
237
- });
238
- }
239
-
240
- if ( data.error.indexOf("This image is already compressed") >=0 ) {
241
- error_class = 'warning';
242
- error_dashicon = 'warning';
243
- error_message = 'Notice';
244
- } else {
245
- errors++;
246
- $('.imagify-cell-errors').html(errors + ' error(s)');
247
- }
248
-
249
- $('#attachment-'+data.image).after('<tr><td colspan="7"><span class="status-'+error_class+'">'+data.error+'</span></td></tr>');
250
-
251
- $('#attachment-'+data.image+' .imagify-cell-status').html('<span class="imagistatus status-'+error_class+'"><span class="dashicons dashicons-'+error_dashicon+'"></span>'+error_message+'</span>');
252
- }
253
- })
254
- // after all attachments optimization
255
- .done(function (data) {
256
- $obj.removeAttr('disabled');
257
- $obj.find('.dashicons').removeClass('rotate');
258
-
259
- // remove confirm dialog before quit the page
260
- $(window).off('beforeunload', confirmMessage);
261
-
262
- // Hide the progress bar
263
- $('.imagify-row-progress').slideUp();
264
-
265
- if ( data.global_percent !== 'NaN' ) {
266
- // Display the complete section
267
- $('.imagify-row-complete').removeClass('hidden')
268
- .addClass( 'done' )
269
- .attr('aria-hidden', 'false');
270
- $('html, body').animate({
271
- scrollTop: $('.imagify-row-complete').offset().top
272
- }, 200);
273
-
274
- $('.imagify-ac-rt-total-gain').html(data.global_gain_human);
275
- $('.imagify-ac-rt-total-original').html(data.global_original_size_human);
276
-
277
- text2share = imagifyBulk.labels.textToShare;
278
- text2share = text2share.replace( '%1$s', data.global_gain_human );
279
- text2share = text2share.replace( '%2$s', data.global_original_size_human );
280
- text2share = encodeURIComponent(text2share);
281
-
282
- $('.imagify-sn-twitter').attr( 'href', 'https://twitter.com/intent/tweet?source=webclient&amp;original_referer=' + imagifyBulk.labels.pluginURL + '&amp;text=' + text2share + '&amp;url=' + imagifyBulk.labels.pluginURL + '&amp;related=imagify&amp;hastags=performance,web,wordpress' );
283
-
284
- $('.imagify-ac-chart').attr('data-percent', data.global_percent);
285
- draw_me_complete_chart( $('.imagify-ac-chart').find('canvas') );
286
- }
287
- })
288
- .error(function (id) {
289
- imagify.log('Can\'t optimize image with id ' + id);
290
- })
291
- .run();
292
  }
293
- })
294
- .fail(function () {
295
- swal({
296
- title: imagifyBulk.labels.getUnoptimizedImagesErrorTitle,
297
- html: imagifyBulk.labels.getUnoptimizedImagesErrorText,
298
- type: "error",
299
- customClass: "imagify-sweet-alert"
300
- }).then(function(){
301
- location.reload();
302
- });
303
- });
304
- });
305
 
306
- /*
307
- * Mini chart
308
- * You can use draw_me_a_chart() function with AJAX calls
309
- *
310
- * @param {element} canvas
311
- */
312
- function draw_me_a_chart( canvas ) {
313
- canvas.each(function(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
314
 
315
- var the_value = parseInt( $(this).closest('.imagify-chart').next('.imagipercent').text() ),
316
- overviewData = [
317
- {
318
- value: the_value,
319
- color: "#00B3D3"
320
- },
321
- {
322
- value: 100 - the_value,
323
- color:"#D8D8D8"
324
  }
325
- ],
326
- overviewDoughnut = new Chart( $(this)[0].getContext("2d")).Doughnut(overviewData, {
327
- segmentStrokeColor : "#FFF",
328
- segmentStrokeWidth : 1,
329
- animateRotate : true,
330
- tooltipEvents: []
331
- });
332
- });
333
- }
334
 
335
- /*
336
- * Complete Chart
337
- * You can use draw_me_complete_chart() function with AJAX calls
338
- *
339
- * @param {element} canvas
340
- */
341
- function draw_me_complete_chart( canvas ) {
342
- canvas.each(function(){
343
 
344
- var the_value = parseInt( $(this).closest('.imagify-ac-chart').attr('data-percent') ),
345
- overviewData = [
346
- {
347
- value: the_value,
348
- color: "#40B1D0"
349
- },
350
- {
351
- value: 100 - the_value,
352
- color:"#FFFFFF"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
353
  }
354
- ],
355
- overviewDoughnut = new Chart( $(this)[0].getContext("2d")).Doughnut(overviewData, {
356
- segmentStrokeColor : "transparent",
357
- segmentStrokeWidth : 0,
358
- animateRotate : true,
359
- animation: true,
360
- percentageInnerCutout: 70,
361
- tooltipEvents: []
362
- });
363
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  }
365
- });
366
-
367
- var width = 700, height = 290;
368
- if ( window.innerWidth ) {
369
- var clientLeft = (window.innerWidth-width)/2;
370
- var clientTop = (window.innerHeight-height)/2;
371
- }
372
- else {
373
- var clientLeft = (document.body.clientWidth-width)/2;
374
- var clientTop = (document.body.clientHeight-height)/2;
375
- }
376
-
377
- [].forEach.call( document.querySelectorAll('.imagify-share-networks a'), function(el) {
378
- el.addEventListener('click', function(evt) {
379
- window.open(this.href,'',"status=no, scrollbars=no, menubar=no, top="+clientTop+", left="+clientLeft+", width="+width+", height="+height);
380
- evt.preventDefault();
381
- }, false);
382
- });
1
+ /* globals ajaxurl: false, console: false, imagify: true, ImagifyGulp: false, swal: false */
2
 
3
+ window.imagify = window.imagify || {
4
+ concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?',
5
+ log: function( content ) {
6
+ if ( undefined !== console ) {
7
+ console.log( content );
8
+ }
9
+ },
10
+ info: function( content ) {
11
+ if ( undefined !== console ) {
12
+ console.info( content );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  }
14
+ }
15
+ };
16
+
17
+ (function($, d, w, undefined) {
18
+ var overviewCanvas = d.getElementById( 'imagify-overview-chart' ),
19
+ overviewData = [
20
+ {
21
+ value: imagifyBulk.labels.totalUnoptimizedAttachments,
22
+ color: '#D9E4EB',
23
+ highlight: '#D9E4EB',
24
+ label: imagifyBulk.labels.overviewChartLabels.unoptimized
25
+ },
26
+ {
27
+ value: imagifyBulk.labels.totalOptimizedAttachments,
28
+ color: '#46B1CE',
29
+ highlight: '#46B1CE',
30
+ label: imagifyBulk.labels.overviewChartLabels.optimized
31
+ },
32
+ {
33
+ value: imagifyBulk.labels.totalErrorsAttachments,
34
+ color: '#2E3242',
35
+ highlight: '#2E3242',
36
+ label: imagifyBulk.labels.overviewChartLabels.error
37
+ }
38
+ ],
39
+ overviewDoughnut, overviewLegend;
40
+
41
+ /**
42
+ * Mini chart.
43
+ * You can use drawMeAChart() function with AJAX calls.
44
+ *
45
+ * @param {element} canvas
46
+ */
47
+ function drawMeAChart( canvas ) {
48
+ canvas.each( function() {
49
+ var $this = $( this ),
50
+ theValue = parseInt( $this.closest( '.imagify-chart' ).next( '.imagipercent' ).text(), 10 ),
51
+ overviewData = [
52
+ {
53
+ value: theValue,
54
+ color: '#00B3D3'
55
+ },
56
+ {
57
+ value: 100 - theValue,
58
+ color:'#D8D8D8'
59
+ }
60
+ ];
61
+
62
+ new Chart( $this[0].getContext( '2d' ) ).Doughnut( overviewData, {
63
+ segmentStrokeColor: '#FFF',
64
+ segmentStrokeWidth: 1,
65
+ animateRotate: true,
66
+ tooltipEvents: []
67
+ } );
68
+ } );
69
+ }
70
+
71
+ /*
72
+ * Complete Chart.
73
+ * You can use drawMeCompleteChart() function with AJAX calls.
74
+ *
75
+ * @param {element} canvas
76
+ */
77
+ function drawMeCompleteChart( canvas ) {
78
+ canvas.each( function() {
79
+ var $this = $( this ),
80
+ theValue = parseInt( $this.closest( '.imagify-ac-chart' ).attr( 'data-percent' ), 10 ),
81
+ overviewData = [
82
+ {
83
+ value: theValue,
84
+ color: '#40B1D0'
85
+ },
86
+ {
87
+ value: 100 - theValue,
88
+ color: '#FFFFFF'
89
+ }
90
+ ];
91
+
92
+ new Chart( $this[0].getContext( '2d' ) ).Doughnut( overviewData, {
93
+ segmentStrokeColor: 'transparent',
94
+ segmentStrokeWidth: 0,
95
+ animateRotate: true,
96
+ animation: true,
97
+ percentageInnerCutout: 70,
98
+ tooltipEvents: []
99
+ } );
100
+ } );
101
+ }
102
 
 
103
  if ( overviewCanvas ) {
104
+ overviewDoughnut = new Chart( overviewCanvas.getContext( '2d' ) ).Doughnut( overviewData, {
105
+ segmentStrokeColor: 'transparent',
106
+ segmentStrokeWidth: 0,
107
+ animateRotate: true,
108
+ animation: true,
109
  percentageInnerCutout: 85,
110
+ legendTemplate: '<ul class="imagify-<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>',
111
+ tooltipTemplate: '<%= value %>'
112
+ } );
113
 
114
+ /**
115
+ * Then you just need to generate the legend.
116
+ * var overviewLegend = overviewDoughnut.generateLegend();
117
+ * bugged `segments undefined` ?
118
+ */
119
 
120
+ // And append it to your page somewhere.
121
  overviewLegend = '<ul class="imagify-doughnut-legend">';
122
+
123
+ $( overviewData ).each( function( i ) {
124
+ overviewLegend += '<li><span style="background-color:' + overviewData[ i ].color + '"></span>' + overviewData[ i ].label + '</li>';
125
+ } );
126
 
127
  overviewLegend += '</ul>';
128
+
129
+ d.getElementById( 'imagify-overview-chart-legend' ).innerHTML = overviewLegend;
130
  }
131
+
132
+ // Heartbeat.
133
+ $( d ).on( 'heartbeat-send', function( e, data ) {
134
+ data.imagify_heartbeat = imagifyBulk.heartbeat_id;
135
+ } );
136
+
137
  // Listen for the custom event "heartbeat-tick" on $(document).
138
+ $( d ).on( 'heartbeat-tick', function( e, data ) {
139
+ if ( ! data.imagify_bulk_data ) {
140
+ return;
141
+ }
142
+
143
+ data = data.imagify_bulk_data;
144
+
145
+ // The overview chart percent.
146
+ $( '#imagify-overview-chart-percent' ).html( data.optimized_attachments_percent + '<span>%</span>' );
147
+ $( '.imagify-total-percent' ).html( data.optimized_attachments_percent + '%' );
148
+
149
+ // The comsuption bar.
150
+ $( '.imagify-unconsumed-percent' ).html( data.unconsumed_quota + '%' );
151
+ $( '.imagify-unconsumed-bar' ).css( 'width', data.unconsumed_quota + '%' );
152
+
153
+ // The total optimized images.
154
+ $( '#imagify-total-optimized-attachments' ).html( data.already_optimized_attachments );
155
+
156
+ // The original bar.
157
+ $( '#imagify-original-bar' ).find( '.imagify-barnb' ).html( data.original_human );
158
+
159
+ // The optimized bar.
160
+ $( '#imagify-optimized-bar' ).css( 'width', data.optimized_percent + '%' ).find( '.imagify-barnb' ).html( data.optimized_human );
161
+
162
+ // The Percent data.
163
+ $( '#imagify-total-optimized-attachments-pct' ).html( data.optimized_percent + '%' );
 
 
 
164
 
165
  overviewDoughnut.segments[0].value = data.unoptimized_attachments;
166
  overviewDoughnut.segments[1].value = data.optimized_attachments;
167
  overviewDoughnut.segments[2].value = data.errors_attachments;
168
  overviewDoughnut.update();
169
+ } );
170
 
171
  // Simulate a click on the "Imagif'em all" button
172
+ $( '#imagify-simulate-bulk-action' ).on( 'click', function( e ) {
173
  e.preventDefault();
174
+ $( '#imagify-bulk-action' ).trigger( 'click' );
175
+ } );
176
 
177
+ $( '#imagify-bulk-action' ).on( 'click', function() {
178
+ var $obj = $( this ),
179
+ optimizationLevel = $( '[name="optimization_level"]:checked' ).val(),
180
+ confirmMessage;
181
 
182
+ if ( optimizationLevel === undefined ) {
183
+ optimizationLevel = -1;
184
  }
185
+
186
+ if ( $obj.attr( 'disabled' ) ) {
187
  return false;
188
  }
189
 
190
+ $obj.attr( 'disabled', 'disabled' );
191
+ $obj.find( '.dashicons' ).addClass( 'rotate' );
192
+
193
+ confirmMessage = function() {
 
194
  return imagifyBulk.labels.processing;
195
  };
196
+
197
+ $( w ).on( 'beforeunload', confirmMessage );
198
+
199
+ // Display an alert to wait.
200
+ swal( {
201
+ title: imagifyBulk.labels.waitTitle,
202
+ html: imagifyBulk.labels.waitText,
203
  showConfirmButton: false,
204
+ imageUrl: imagifyBulk.labels.waitImageUrl
205
+ } );
206
+
207
+ $.get( ajaxurl + imagify.concat + 'action=' + imagifyBulk.ajax_action + '&optimization_level=' + optimizationLevel + '&imagifybulkuploadnonce=' + $( '#imagifybulkuploadnonce' ).val() )
208
+ .done( function( response ) {
209
+ var swal_title = '',
210
+ swal_text = '',
211
+ text, Optimizer, table,
212
+ files = 0,
213
+ errors = 0,
214
+ original_overall_size = 0,
215
+ overall_saving = 0;
216
+
217
+ if ( ! response.success ) {
218
+ $obj.removeAttr( 'disabled' );
219
+ $obj.find( '.dashicons' ).removeClass( 'rotate' );
220
+
221
+ // Remove confirm dialog before quit the page.
222
+ $( w ).off( 'beforeunload', confirmMessage );
223
+
224
+ if ( 'invalid-api-key' === response.data.message ) {
225
  swal_title = imagifyBulk.labels.invalidAPIKeyTitle;
226
  }
227
+
228
+ if ( 'over-quota' === response.data.message ) {
229
  swal_title = imagifyBulk.labels.overQuotaTitle;
230
+ text = imagifyBulk.labels.overQuotaText;
231
  }
232
+
233
+ if ( 'no-images' === response.data.message ) {
234
  swal_title = imagifyBulk.labels.noAttachmentToOptimizeTitle;
235
  swal_text = imagifyBulk.labels.noAttachmentToOptimizeText;
236
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
 
238
+ // Display an alert to warn that all images has been optimized.
239
+ swal( {
240
+ title: swal_title,
241
+ html: swal_text,
242
+ type: 'info',
243
+ customClass: 'imagify-sweet-alert'
244
+ } );
245
+
246
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  }
 
 
 
 
 
 
 
 
 
 
 
 
248
 
249
+ swal.close();
250
+
251
+ $( '.imagify-row-progress' ).slideDown();
252
+ $( '.imagify-no-uploaded-yet, .imagify-row-complete' ).hide( 200 );
253
+
254
+ table = $( '.imagify-bulk-table table tbody' );
255
+ Optimizer = new ImagifyGulp( {
256
+ 'lib': ajaxurl + imagify.concat + 'action=imagify_bulk_upload&imagifybulkuploadnonce=' + $( '#imagifybulkuploadnonce' ).val(),
257
+ 'images': response.data,
258
+ 'context': imagifyBulk.ajax_context
259
+ } );
260
+
261
+ // Before the attachment optimization.
262
+ Optimizer.before( function( data ) {
263
+ table.find( '.imagify-row-progress' ).after( '<tr id="attachment-' + data.id + '"><td class="imagify-cell-filename"><span class="imagiuploaded"><img src="' + data.thumbnail + '"/>"</span><span class="imagifilename">' + data.filename + '</span></td><td class="imagify-cell-status"><span class="imagistatus status-compressing"><span class="dashicons dashicons-admin-generic rotate"></span>Compressing<span></span></span></td><td class="imagify-cell-original"></td><td class="imagify-cell-optimized"></td><td class="imagify-cell-percentage"></td><td class="imagify-cell-thumbnails"></td><td class="imagify-cell-savings"></td></tr>' );
264
+ } )
265
+ // After the attachment optimization.
266
+ .each( function( data ) {
267
+ var $progress = $( '#imagify-progress-bar' ),
268
+ errorClass = 'error',
269
+ errorDashicon = 'dismiss',
270
+ errorMessage = 'Error';
271
+
272
+ $progress.css( { 'width': data.progress + '%' } );
273
+ $progress.find( '.percent' ).html( data.progress + '%' );
274
+
275
+ if ( data.success ) {
276
+ $( '#attachment-' + data.image + ' .imagify-cell-status' ).html( '<span class="imagistatus status-complete"><span class="dashicons dashicons-yes"></span>Complete</span>' );
277
+ $( '#attachment-' + data.image + ' .imagify-cell-original' ).html( data.original_size_human );
278
+ $( '#attachment-' + data.image + ' .imagify-cell-optimized' ).html( data.new_size_human );
279
+ $( '#attachment-' + data.image + ' .imagify-cell-percentage' ).html( '<span class="imagify-chart"><span class="imagify-chart-container"><canvas height="18" width="18" id="imagify-consumption-chart" style="width: 18px; height: 18px;"></canvas></span></span><span class="imagipercent">' + data.percent + '</span>%' );
280
+ drawMeAChart( $( '#attachment-' + data.image + ' .imagify-cell-percentage' ).find( 'canvas' ) );
281
+ $( '#attachment-' + data.image + ' .imagify-cell-thumbnails' ).html( data.thumbnails );
282
+ $( '#attachment-' + data.image + ' .imagify-cell-savings' ).html( Optimizer.humanSize( data.overall_saving, 1 ) );
283
+
284
+ // The table footer total optimized files.
285
+ files = files + data.thumbnails + 1;
286
+ $( '.imagify-cell-nb-files' ).html( files + ' file(s)' );
287
+
288
+ // The table footer original size.
289
+ original_overall_size = original_overall_size + data.original_overall_size;
290
+ $( '.imagify-total-original' ).html( Optimizer.humanSize( original_overall_size, 1 ) );
291
+
292
+ // The table footer overall saving.
293
+ overall_saving = overall_saving + data.overall_saving;
294
+ $( '.imagify-total-gain' ).html( Optimizer.humanSize( overall_saving, 1 ) );
295
+
296
+ return;
297
+ }
298
 
299
+ if ( data.error.indexOf( "You've consumed all your data" ) >= 0 ) {
300
+ swal( {
301
+ title: imagifyBulk.labels.overQuotaTitle,
302
+ html: imagifyBulk.labels.overQuotaText,
303
+ type: 'error',
304
+ customClass: 'imagify-sweet-alert',
305
+ } ).then( function() {
306
+ location.reload();
307
+ } );
308
  }
 
 
 
 
 
 
 
 
 
309
 
310
+ if ( data.error.indexOf( 'This image is already compressed' ) >= 0 ) {
311
+ errorClass = 'warning';
312
+ errorDashicon = 'warning';
313
+ errorMessage = 'Notice';
314
+ } else {
315
+ errors++;
316
+ $( '.imagify-cell-errors' ).html( errors + ' error(s)' );
317
+ }
318
 
319
+ $( '#attachment-' + data.image ).after( '<tr><td colspan="7"><span class="status-' + errorClass + '">' + data.error + '</span></td></tr>' );
320
+
321
+ $( '#attachment-' + data.image + ' .imagify-cell-status' ).html( '<span class="imagistatus status-' + errorClass + '"><span class="dashicons dashicons-' + errorDashicon + '"></span>' + errorMessage + '</span>' );
322
+ } )
323
+ // After all attachments optimization.
324
+ .done( function( data ) {
325
+ var text2share;
326
+
327
+ $obj.removeAttr( 'disabled' ).find( '.dashicons' ).removeClass( 'rotate' );
328
+
329
+ // Remove confirm dialog before quit the page.
330
+ $( w ).off( 'beforeunload', confirmMessage );
331
+
332
+ // Hide the progress bar.
333
+ $( '.imagify-row-progress' ).slideUp();
334
+
335
+ if ( 'NaN' !== data.global_percent ) {
336
+ // Display the complete section.
337
+ $( '.imagify-row-complete' ).removeClass( 'hidden' ).addClass( 'done' ).attr( 'aria-hidden', 'false' );
338
+ $( 'html, body' ).animate( {
339
+ scrollTop: $( '.imagify-row-complete' ).offset().top
340
+ }, 200 );
341
+
342
+ $( '.imagify-ac-rt-total-gain' ).html( data.global_gain_human );
343
+ $( '.imagify-ac-rt-total-original' ).html( data.global_original_size_human );
344
+
345
+ text2share = imagifyBulk.labels.textToShare;
346
+ text2share = text2share.replace( '%1$s', data.global_gain_human );
347
+ text2share = text2share.replace( '%2$s', data.global_original_size_human );
348
+ text2share = encodeURIComponent( text2share );
349
+
350
+ $( '.imagify-sn-twitter' ).attr( 'href', 'https://twitter.com/intent/tweet?source=webclient&amp;original_referer=' + imagifyBulk.labels.pluginURL + '&amp;text=' + text2share + '&amp;url=' + imagifyBulk.labels.pluginURL + '&amp;related=imagify&amp;hastags=performance,web,wordpress' );
351
+
352
+ $( '.imagify-ac-chart' ).attr( 'data-percent', data.global_percent );
353
+ drawMeCompleteChart( $( '.imagify-ac-chart' ).find( 'canvas' ) );
354
  }
355
+ } )
356
+ .error( function( id ) {
357
+ imagify.log( 'Can\'t optimize image with id ' + id );
358
+ } )
359
+ .run();
360
+ } )
361
+ .fail( function() {
362
+ swal( {
363
+ title: imagifyBulk.labels.getUnoptimizedImagesErrorTitle,
364
+ html: imagifyBulk.labels.getUnoptimizedImagesErrorText,
365
+ type: 'error',
366
+ customClass: 'imagify-sweet-alert'
367
+ } ).then( function() {
368
+ location.reload();
369
+ } );
370
+ } );
371
+ } );
372
+
373
+ } )(jQuery, document, window);
374
+
375
+
376
+ (function($, d, w, undefined) {
377
+
378
+ var width = 700,
379
+ height = 290,
380
+ clientLeft, clientTop;
381
+
382
+ if ( w.innerWidth ) {
383
+ clientLeft = ( w.innerWidth - width ) / 2;
384
+ clientTop = ( w.innerHeight - height ) / 2;
385
+ } else {
386
+ clientLeft = ( d.body.clientWidth - width ) / 2;
387
+ clientTop = ( d.body.clientHeight - height ) / 2;
388
  }
389
+
390
+ [].forEach.call( d.querySelectorAll( '.imagify-share-networks a' ), function( el ) {
391
+ el.addEventListener( 'click', function( evt ) {
392
+ w.open( this.href, '', 'status=no, scrollbars=no, menubar=no, top=' + clientTop + ', left=' + clientLeft + ', width=' + width + ', height=' + height );
393
+ evt.preventDefault();
394
+ }, false );
395
+ } );
396
+
397
+ } )(jQuery, document, window);
 
 
 
 
 
 
 
 
 
assets/js/bulk.min.js CHANGED
@@ -1,17 +1 @@
1
- jQuery(function(b){function l(c){c.each(function(){var a=parseInt(b(this).closest(".imagify-chart").next(".imagipercent").text()),a=[{value:a,color:"#00B3D3"},{value:100-a,color:"#D8D8D8"}];(new Chart(b(this)[0].getContext("2d"))).Doughnut(a,{segmentStrokeColor:"#FFF",segmentStrokeWidth:1,animateRotate:!0,tooltipEvents:[]})})}function m(c){c.each(function(){var a=parseInt(b(this).closest(".imagify-ac-chart").attr("data-percent")),a=[{value:a,color:"#40B1D0"},{value:100-a,color:"#FFFFFF"}];(new Chart(b(this)[0].getContext("2d"))).Doughnut(a,
2
- {segmentStrokeColor:"transparent",segmentStrokeWidth:0,animateRotate:!0,animation:!0,percentageInnerCutout:70,tooltipEvents:[]})})}var g=0<ajaxurl.indexOf("?")?"&":"?",n={log:function(b){"undefined"!==console&&console.log(b)}},f=document.getElementById("imagify-overview-chart"),e=[{value:imagifyBulk.labels.totalUnoptimizedAttachments,color:"#D9E4EB",highlight:"#D9E4EB",label:imagifyBulk.labels.overviewChartLabels.unoptimized},{value:imagifyBulk.labels.totalOptimizedAttachments,color:"#46B1CE",highlight:"#46B1CE",
3
- label:imagifyBulk.labels.overviewChartLabels.optimized},{value:imagifyBulk.labels.totalErrorsAttachments,color:"#2E3242",highlight:"#2E3242",label:imagifyBulk.labels.overviewChartLabels.error}];if(f){var d=(new Chart(f.getContext("2d"))).Doughnut(e,{segmentStrokeColor:"transparent",segmentStrokeWidth:0,animateRotate:!0,animation:!0,percentageInnerCutout:85,legendTemplate:'<ul class="imagify-<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>',
4
- tooltipTemplate:"<%= value %>"});overviewLegend='<ul class="imagify-doughnut-legend">';b(e).each(function(b){overviewLegend+='<li><span style="background-color:'+e[b].color+'"></span>'+e[b].label+"</li>"});overviewLegend+="</ul>";document.getElementById("imagify-overview-chart-legend").innerHTML=overviewLegend}b(document).on("heartbeat-send",function(b,a){a.imagify_heartbeat=imagifyBulk.heartbeat_id});b(document).on("heartbeat-tick",function(c,a){a.imagify_bulk_data&&(a=a.imagify_bulk_data,b("#imagify-overview-chart-percent").html(a.optimized_attachments_percent+
5
- "<span>%</span>"),b(".imagify-total-percent").html(a.optimized_attachments_percent+"%"),b(".imagify-unconsumed-percent").html(a.unconsumed_quota+"%"),b(".imagify-unconsumed-bar").css("width",a.unconsumed_quota+"%"),b("#imagify-total-optimized-attachments").html(a.already_optimized_attachments),b("#imagify-original-bar").find(".imagify-barnb").html(a.original_human),b("#imagify-optimized-bar").css("width",a.optimized_percent+"%").find(".imagify-barnb").html(a.optimized_human),b("#imagify-total-optimized-attachments-pct").html(a.optimized_percent+
6
- "%"),d.segments[0].value=a.unoptimized_attachments,d.segments[1].value=a.optimized_attachments,d.segments[2].value=a.errors_attachments,d.update())});b("#imagify-simulate-bulk-action").click(function(c){c.preventDefault();b("#imagify-bulk-action").trigger("click")});b("#imagify-bulk-action").click(function(){var c=b(this),a=b('[name="optimization_level"]:checked').val();"undefined"===typeof a&&(a=-1);if(c.attr("disabled"))return!1;c.attr("disabled","disabled");c.find(".dashicons").addClass("rotate");
7
- confirmMessage=function(){return imagifyBulk.labels.processing};b(window).on("beforeunload",confirmMessage);swal({title:imagifyBulk.labels.waitTitle,html:imagifyBulk.labels.waitText,showConfirmButton:!1,imageUrl:imagifyBulk.labels.waitImageUrl});b.get(ajaxurl+g+"action="+imagifyBulk.ajax_action+"&optimization_level="+a+"&imagifybulkuploadnonce="+b("#imagifybulkuploadnonce").val()).done(function(a){if(a.success){swal.close();a={lib:ajaxurl+g+"action=imagify_bulk_upload&imagifybulkuploadnonce="+b("#imagifybulkuploadnonce").val(),
8
- images:a.data,context:imagifyBulk.ajax_context};var e=b(".imagify-bulk-table table tbody"),d=0,f=0,h=0,k=0;b(".imagify-row-progress").slideDown();b(".imagify-no-uploaded-yet, .imagify-row-complete").hide(200);Optimizer=new ImagifyGulp(a);Optimizer.before(function(b){e.find(".imagify-row-progress").after('<tr id="attachment-'+b.id+'"><td class="imagify-cell-filename"><span class="imagiuploaded"><img src="'+b.thumbnail+'"/>"</span><span class="imagifilename">'+b.filename+'</span></td><td class="imagify-cell-status"><span class="imagistatus status-compressing"><span class="dashicons dashicons-admin-generic rotate"></span>Compressing<span></span></span></td><td class="imagify-cell-original"></td><td class="imagify-cell-optimized"></td><td class="imagify-cell-percentage"></td><td class="imagify-cell-thumbnails"></td><td class="imagify-cell-savings"></td></tr>')}).each(function(a){var c=
9
- b("#imagify-progress-bar");c.css({width:a.progress+"%"});c.find(".percent").html(a.progress+"%");a.success?(b("#attachment-"+a.image+" .imagify-cell-status").html('<span class="imagistatus status-complete"><span class="dashicons dashicons-yes"></span>Complete</span>'),b("#attachment-"+a.image+" .imagify-cell-original").html(a.original_size_human),b("#attachment-"+a.image+" .imagify-cell-optimized").html(a.new_size_human),b("#attachment-"+a.image+" .imagify-cell-percentage").html('<span class="imagify-chart"><span class="imagify-chart-container"><canvas height="18" width="18" id="imagify-consumption-chart" style="width: 18px; height: 18px;"></canvas></span></span><span class="imagipercent">'+
10
- a.percent+"</span>%"),l(b("#attachment-"+a.image+" .imagify-cell-percentage").find("canvas")),b("#attachment-"+a.image+" .imagify-cell-thumbnails").html(a.thumbnails),b("#attachment-"+a.image+" .imagify-cell-savings").html(Optimizer.humanSize(a.overall_saving,1)),d=d+a.thumbnails+1,b(".imagify-cell-nb-files").html(d+" file(s)"),h+=a.original_overall_size,b(".imagify-total-original").html(Optimizer.humanSize(h,1)),k+=a.overall_saving,b(".imagify-total-gain").html(Optimizer.humanSize(k,1))):(error_class=
11
- "error",error_dashicon="dismiss",error_message="Error",0<=a.error.indexOf("You've consumed all your data")&&swal({title:imagifyBulk.labels.overQuotaTitle,html:imagifyBulk.labels.overQuotaText,type:"error",customClass:"imagify-sweet-alert"}).then(function(){location.reload()}),0<=a.error.indexOf("This image is already compressed")?(error_dashicon=error_class="warning",error_message="Notice"):(f++,b(".imagify-cell-errors").html(f+" error(s)")),b("#attachment-"+a.image).after('<tr><td colspan="7"><span class="status-'+
12
- error_class+'">'+a.error+"</span></td></tr>"),b("#attachment-"+a.image+" .imagify-cell-status").html('<span class="imagistatus status-'+error_class+'"><span class="dashicons dashicons-'+error_dashicon+'"></span>'+error_message+"</span>"))}).done(function(a){c.removeAttr("disabled");c.find(".dashicons").removeClass("rotate");b(window).off("beforeunload",confirmMessage);b(".imagify-row-progress").slideUp();"NaN"!==a.global_percent&&(b(".imagify-row-complete").removeClass("hidden").addClass("done").attr("aria-hidden",
13
- "false"),b("html, body").animate({scrollTop:b(".imagify-row-complete").offset().top},200),b(".imagify-ac-rt-total-gain").html(a.global_gain_human),b(".imagify-ac-rt-total-original").html(a.global_original_size_human),text2share=imagifyBulk.labels.textToShare,text2share=text2share.replace("%1$s",a.global_gain_human),text2share=text2share.replace("%2$s",a.global_original_size_human),text2share=encodeURIComponent(text2share),b(".imagify-sn-twitter").attr("href","https://twitter.com/intent/tweet?source=webclient&amp;original_referer="+
14
- imagifyBulk.labels.pluginURL+"&amp;text="+text2share+"&amp;url="+imagifyBulk.labels.pluginURL+"&amp;related=imagify&amp;hastags=performance,web,wordpress"),b(".imagify-ac-chart").attr("data-percent",a.global_percent),m(b(".imagify-ac-chart").find("canvas")))}).error(function(a){n.log("Can't optimize image with id "+a)}).run()}else c.removeAttr("disabled"),c.find(".dashicons").removeClass("rotate"),swal_text=swal_title="",b(window).off("beforeunload",confirmMessage),"invalid-api-key"==a.data.message&&
15
- (swal_title=imagifyBulk.labels.invalidAPIKeyTitle),"over-quota"==a.data.message&&(swal_title=imagifyBulk.labels.overQuotaTitle,text=imagifyBulk.labels.overQuotaText),"no-images"==a.data.message&&(swal_title=imagifyBulk.labels.noAttachmentToOptimizeTitle,swal_text=imagifyBulk.labels.noAttachmentToOptimizeText),swal({title:swal_title,html:swal_text,type:"info",customClass:"imagify-sweet-alert"})}).fail(function(){swal({title:imagifyBulk.labels.getUnoptimizedImagesErrorTitle,html:imagifyBulk.labels.getUnoptimizedImagesErrorText,
16
- type:"error",customClass:"imagify-sweet-alert"}).then(function(){location.reload()})})})});var width=700,height=290;if(window.innerWidth)var clientLeft=(window.innerWidth-width)/2,clientTop=(window.innerHeight-height)/2;else clientLeft=(document.body.clientWidth-width)/2,clientTop=(document.body.clientHeight-height)/2;
17
- [].forEach.call(document.querySelectorAll(".imagify-share-networks a"),function(b){b.addEventListener("click",function(b){window.open(this.href,"","status=no, scrollbars=no, menubar=no, top="+clientTop+", left="+clientLeft+", width="+width+", height="+height);b.preventDefault()},!1)});
1
+ window.imagify=window.imagify||{concat:ajaxurl.indexOf("?")>0?"&":"?",log:function(a){void 0!==console&&console.log(a)},info:function(a){void 0!==console&&console.info(a)}},function(a,b,c,d){function e(b){b.each(function(){var b=a(this),c=parseInt(b.closest(".imagify-chart").next(".imagipercent").text(),10),d=[{value:c,color:"#00B3D3"},{value:100-c,color:"#D8D8D8"}];new Chart(b[0].getContext("2d")).Doughnut(d,{segmentStrokeColor:"#FFF",segmentStrokeWidth:1,animateRotate:!0,tooltipEvents:[]})})}function f(b){b.each(function(){var b=a(this),c=parseInt(b.closest(".imagify-ac-chart").attr("data-percent"),10),d=[{value:c,color:"#40B1D0"},{value:100-c,color:"#FFFFFF"}];new Chart(b[0].getContext("2d")).Doughnut(d,{segmentStrokeColor:"transparent",segmentStrokeWidth:0,animateRotate:!0,animation:!0,percentageInnerCutout:70,tooltipEvents:[]})})}var g,h,i=b.getElementById("imagify-overview-chart"),j=[{value:imagifyBulk.labels.totalUnoptimizedAttachments,color:"#D9E4EB",highlight:"#D9E4EB",label:imagifyBulk.labels.overviewChartLabels.unoptimized},{value:imagifyBulk.labels.totalOptimizedAttachments,color:"#46B1CE",highlight:"#46B1CE",label:imagifyBulk.labels.overviewChartLabels.optimized},{value:imagifyBulk.labels.totalErrorsAttachments,color:"#2E3242",highlight:"#2E3242",label:imagifyBulk.labels.overviewChartLabels.error}];i&&(g=new Chart(i.getContext("2d")).Doughnut(j,{segmentStrokeColor:"transparent",segmentStrokeWidth:0,animateRotate:!0,animation:!0,percentageInnerCutout:85,legendTemplate:'<ul class="imagify-<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>',tooltipTemplate:"<%= value %>"}),h='<ul class="imagify-doughnut-legend">',a(j).each(function(a){h+='<li><span style="background-color:'+j[a].color+'"></span>'+j[a].label+"</li>"}),h+="</ul>",b.getElementById("imagify-overview-chart-legend").innerHTML=h),a(b).on("heartbeat-send",function(a,b){b.imagify_heartbeat=imagifyBulk.heartbeat_id}),a(b).on("heartbeat-tick",function(b,c){c.imagify_bulk_data&&(c=c.imagify_bulk_data,a("#imagify-overview-chart-percent").html(c.optimized_attachments_percent+"<span>%</span>"),a(".imagify-total-percent").html(c.optimized_attachments_percent+"%"),a(".imagify-unconsumed-percent").html(c.unconsumed_quota+"%"),a(".imagify-unconsumed-bar").css("width",c.unconsumed_quota+"%"),a("#imagify-total-optimized-attachments").html(c.already_optimized_attachments),a("#imagify-original-bar").find(".imagify-barnb").html(c.original_human),a("#imagify-optimized-bar").css("width",c.optimized_percent+"%").find(".imagify-barnb").html(c.optimized_human),a("#imagify-total-optimized-attachments-pct").html(c.optimized_percent+"%"),g.segments[0].value=c.unoptimized_attachments,g.segments[1].value=c.optimized_attachments,g.segments[2].value=c.errors_attachments,g.update())}),a("#imagify-simulate-bulk-action").on("click",function(b){b.preventDefault(),a("#imagify-bulk-action").trigger("click")}),a("#imagify-bulk-action").on("click",function(){var b,d=a(this),g=a('[name="optimization_level"]:checked').val();if(void 0===g&&(g=-1),d.attr("disabled"))return!1;d.attr("disabled","disabled"),d.find(".dashicons").addClass("rotate"),b=function(){return imagifyBulk.labels.processing},a(c).on("beforeunload",b),swal({title:imagifyBulk.labels.waitTitle,html:imagifyBulk.labels.waitText,showConfirmButton:!1,imageUrl:imagifyBulk.labels.waitImageUrl}),a.get(ajaxurl+imagify.concat+"action="+imagifyBulk.ajax_action+"&optimization_level="+g+"&imagifybulkuploadnonce="+a("#imagifybulkuploadnonce").val()).done(function(g){var h,i,j="",k="",l=0,m=0,n=0,o=0;if(!g.success)return d.removeAttr("disabled"),d.find(".dashicons").removeClass("rotate"),a(c).off("beforeunload",b),"invalid-api-key"===g.data.message&&(j=imagifyBulk.labels.invalidAPIKeyTitle),"over-quota"===g.data.message&&(j=imagifyBulk.labels.overQuotaTitle,imagifyBulk.labels.overQuotaText),"no-images"===g.data.message&&(j=imagifyBulk.labels.noAttachmentToOptimizeTitle,k=imagifyBulk.labels.noAttachmentToOptimizeText),void swal({title:j,html:k,type:"info",customClass:"imagify-sweet-alert"});swal.close(),a(".imagify-row-progress").slideDown(),a(".imagify-no-uploaded-yet, .imagify-row-complete").hide(200),i=a(".imagify-bulk-table table tbody"),h=new ImagifyGulp({lib:ajaxurl+imagify.concat+"action=imagify_bulk_upload&imagifybulkuploadnonce="+a("#imagifybulkuploadnonce").val(),images:g.data,context:imagifyBulk.ajax_context}),h.before(function(a){i.find(".imagify-row-progress").after('<tr id="attachment-'+a.id+'"><td class="imagify-cell-filename"><span class="imagiuploaded"><img src="'+a.thumbnail+'"/>"</span><span class="imagifilename">'+a.filename+'</span></td><td class="imagify-cell-status"><span class="imagistatus status-compressing"><span class="dashicons dashicons-admin-generic rotate"></span>Compressing<span></span></span></td><td class="imagify-cell-original"></td><td class="imagify-cell-optimized"></td><td class="imagify-cell-percentage"></td><td class="imagify-cell-thumbnails"></td><td class="imagify-cell-savings"></td></tr>')}).each(function(b){var c=a("#imagify-progress-bar"),d="error",f="dismiss",g="Error";if(c.css({width:b.progress+"%"}),c.find(".percent").html(b.progress+"%"),b.success)return a("#attachment-"+b.image+" .imagify-cell-status").html('<span class="imagistatus status-complete"><span class="dashicons dashicons-yes"></span>Complete</span>'),a("#attachment-"+b.image+" .imagify-cell-original").html(b.original_size_human),a("#attachment-"+b.image+" .imagify-cell-optimized").html(b.new_size_human),a("#attachment-"+b.image+" .imagify-cell-percentage").html('<span class="imagify-chart"><span class="imagify-chart-container"><canvas height="18" width="18" id="imagify-consumption-chart" style="width: 18px; height: 18px;"></canvas></span></span><span class="imagipercent">'+b.percent+"</span>%"),e(a("#attachment-"+b.image+" .imagify-cell-percentage").find("canvas")),a("#attachment-"+b.image+" .imagify-cell-thumbnails").html(b.thumbnails),a("#attachment-"+b.image+" .imagify-cell-savings").html(h.humanSize(b.overall_saving,1)),l=l+b.thumbnails+1,a(".imagify-cell-nb-files").html(l+" file(s)"),n+=b.original_overall_size,a(".imagify-total-original").html(h.humanSize(n,1)),o+=b.overall_saving,void a(".imagify-total-gain").html(h.humanSize(o,1));b.error.indexOf("You've consumed all your data")>=0&&swal({title:imagifyBulk.labels.overQuotaTitle,html:imagifyBulk.labels.overQuotaText,type:"error",customClass:"imagify-sweet-alert"}).then(function(){location.reload()}),b.error.indexOf("This image is already compressed")>=0?(d="warning",f="warning",g="Notice"):(m++,a(".imagify-cell-errors").html(m+" error(s)")),a("#attachment-"+b.image).after('<tr><td colspan="7"><span class="status-'+d+'">'+b.error+"</span></td></tr>"),a("#attachment-"+b.image+" .imagify-cell-status").html('<span class="imagistatus status-'+d+'"><span class="dashicons dashicons-'+f+'"></span>'+g+"</span>")}).done(function(e){var g;d.removeAttr("disabled").find(".dashicons").removeClass("rotate"),a(c).off("beforeunload",b),a(".imagify-row-progress").slideUp(),"NaN"!==e.global_percent&&(a(".imagify-row-complete").removeClass("hidden").addClass("done").attr("aria-hidden","false"),a("html, body").animate({scrollTop:a(".imagify-row-complete").offset().top},200),a(".imagify-ac-rt-total-gain").html(e.global_gain_human),a(".imagify-ac-rt-total-original").html(e.global_original_size_human),g=imagifyBulk.labels.textToShare,g=g.replace("%1$s",e.global_gain_human),g=g.replace("%2$s",e.global_original_size_human),g=encodeURIComponent(g),a(".imagify-sn-twitter").attr("href","https://twitter.com/intent/tweet?source=webclient&amp;original_referer="+imagifyBulk.labels.pluginURL+"&amp;text="+g+"&amp;url="+imagifyBulk.labels.pluginURL+"&amp;related=imagify&amp;hastags=performance,web,wordpress"),a(".imagify-ac-chart").attr("data-percent",e.global_percent),f(a(".imagify-ac-chart").find("canvas")))}).error(function(a){imagify.log("Can't optimize image with id "+a)}).run()}).fail(function(){swal({title:imagifyBulk.labels.getUnoptimizedImagesErrorTitle,html:imagifyBulk.labels.getUnoptimizedImagesErrorText,type:"error",customClass:"imagify-sweet-alert"}).then(function(){location.reload()})})})}(jQuery,document,window),function(a,b,c,d){var e,f;c.innerWidth?(e=(c.innerWidth-700)/2,f=(c.innerHeight-290)/2):(e=(b.body.clientWidth-700)/2,f=(b.body.clientHeight-290)/2),[].forEach.call(b.querySelectorAll(".imagify-share-networks a"),function(a){a.addEventListener("click",function(a){c.open(this.href,"","status=no, scrollbars=no, menubar=no, top="+f+", left="+e+", width=700, height=290"),a.preventDefault()},!1)})}(jQuery,document,window);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/imagify.js ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * imagify-gulpjs - version 0.0.1 - 2016-04-07
3
+ * WP Media <contact@wp-media.me>
4
+ */
5
+ (function () {
6
+ 'use strict';
7
+
8
+ var _createClass = function () {
9
+ function defineProperties( target, props ) {
10
+ for ( var i = 0; i < props.length; i++ ) {
11
+ var descriptor = props[i];
12
+ descriptor.enumerable = descriptor.enumerable || false;
13
+ descriptor.configurable = true;
14
+
15
+ if ( 'value' in descriptor ) {
16
+ descriptor.writable = true;
17
+ }
18
+ Object.defineProperty( target, descriptor.key, descriptor );
19
+ }
20
+ }
21
+
22
+ return function ( Constructor, protoProps, staticProps ) {
23
+ if ( protoProps ) {
24
+ defineProperties( Constructor.prototype, protoProps );
25
+ }
26
+ if ( staticProps ) {
27
+ defineProperties( Constructor, staticProps );
28
+ }
29
+
30
+ return Constructor;
31
+ };
32
+ }();
33
+
34
+ function _classCallCheck( instance, Constructor ) {
35
+ if ( ! ( instance instanceof Constructor ) ) {
36
+ throw new TypeError( 'Cannot call a class as a function' );
37
+ }
38
+ }
39
+
40
+ window.ImagifyGulp = function () {
41
+ function ImagifyGulp( settings ) {
42
+ _classCallCheck( this, ImagifyGulp );
43
+
44
+ this.buffer_size = 1;
45
+ this.lib_url = settings.lib;
46
+ this.default_thumb = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAIAAACRuyQOAAACy0lEQVRIx+1XS1PTUBTuT/MB1NGF3bhyhys3Pv+Ai8pCF6Bb3bsWq8xAh8441I2TSlKwPIKQJsI40IbSV0pJ6qe3OeZ1b9PaYViQyaJzc+757j3nO985TVx5v3o+b+IS6XyQUgtrj/NqWtJmZf3lavnpl53bC2vjRLqRUV4pxqbZcnrBx3F6G2ZzTjFg879IMwWtanV7g56K1Z2RtBGRpj7IWb0a8HhqOz9O2rjHfrOD34GvWcPEruGQkhmlcFgnF7bjABVJmvA4uj4vY2VJr545/yClw/okBywaadF/m63j1gT/sNO5DbXW8t4sLtJzSQtnAme/ys/BrU9FpdIgY2R3MBLidtQ+ZRt2T9qZvQrtf/N9X5BwbEQKmSVIFGZjEGlWNojB93KbCBolDNl49nVPAIYwUs5QGAOQwCtmuuyGG5ExGhZbtM7s+5+3BGC5nyazhB8RElSAePRwRaX1u9nScadfVYjtncV1HtKDlW0KQMqvID4kCAydHST2fgKhu24B7dTaSY4oYBf2MjN44yK9+FZmRnrdCnuhr3jyB7Vr89G8L9f7oU77VSPhp4POjNarzUgv77Z/ERh+R9oUXbqDXFyktFtJ5ag74cU9cBsCwy3DNoht5Fcf0pO8ysuTt27IFzKH/Hm/Qopi5ekP99zzgkU8goF7VN21ThfM9BKHylHEPbzoQ8wUlSGoG1QVnR3Vhppj66hCtgg/Ayr3tdLXCFQ7al4ABr2gAEBHoCbQFDu+RkCvqPVBx5LCZvq2dEDsgELuDqV7rM/SfvmocfNjkYcEdV8Kdcu4Wh6QLzzoPQKtQ9DQvQL9ZYhOiCYteXougo/9UEIv9YHxKK+iZ9qenouE8QIunCMMMzxHYIIomU2ksBOaI5ZHmCO8OavEnI0K2hjmvTnevPe3bjBlTvKvMsoMi4kVAgO/qBXMGvidGu8Me/lf4yIg/QYbLcmjDg4bKwAAAABJRU5ErkJggg==";
47
+ this.images = settings.images;
48
+ this.images_ids = Object.keys( settings.images );
49
+ this.total_images = this.images_ids.length;
50
+ this.processed_images = 0;
51
+ this.inprocess_images = 0;
52
+ this._before = function() {};
53
+ this._each = function() {};
54
+ this._done = function() {};
55
+ this._error = function() {};
56
+ this.total_original_size = 0;
57
+ this.total_optimized_size = 0;
58
+ this.total_gain = 0;
59
+ this.total_percent = 0;
60
+ this.global_original_size = 0;
61
+ this.global_optimized_size = 0;
62
+ this.global_gain = 0;
63
+ this.global_percent = 0;
64
+ this.context = settings.context || 'wp';
65
+ }
66
+
67
+ _createClass( ImagifyGulp, [ {
68
+ key: 'before',
69
+ value: function before( fnc ) {
70
+ this._before = fnc;
71
+ return this;
72
+ }
73
+ }, {
74
+ key: 'each',
75
+ value: function each( fnc ) {
76
+ this._each = fnc;
77
+ return this;
78
+ }
79
+ }, {
80
+ key: 'done',
81
+ value: function done( fnc ) {
82
+ this._done = fnc;
83
+ return this;
84
+ }
85
+ }, {
86
+ key: 'error',
87
+ value: function error( fnc ) {
88
+ this._error = fnc;
89
+ return this;
90
+ }
91
+ }, {
92
+ key: 'humanSize',
93
+ value: function humanSize( bytes ) {
94
+ if ( 0 === bytes ) {
95
+ return '0kb';
96
+ }
97
+
98
+ var sizes = [ 'b', 'kb', 'mb' ],
99
+ i = parseInt( Math.floor( Math.log( bytes ) / Math.log( 1024 ) ) );
100
+
101
+ return ( bytes / Math.pow( 1024, i ) ).toFixed( 2 ) + sizes[ i ];
102
+ }
103
+ }, {
104
+ key: 'run',
105
+ value: function run() {
106
+ var cpt = this.images_ids.length > this.buffer_size ? this.buffer_size : this.images_ids.length;
107
+
108
+ for ( var i = 0; i < cpt; i++ ) {
109
+ var id = this.images_ids.shift();
110
+ this.process( id );
111
+ }
112
+
113
+ return this;
114
+ }
115
+ }, {
116
+ key: 'process',
117
+ value: function process( id ) {
118
+ this.inprocess_images++;
119
+
120
+ var data = {
121
+ id: id,
122
+ image_id: parseInt( id.toString().substr( 1 ), 10 ),
123
+ image_src: this.images[ id ],
124
+ filename: this.images[ id ].split( '/' ).pop(),
125
+ thumbnail: this.default_thumb,
126
+ error: ''
127
+ };
128
+
129
+ this.createThumb( data );
130
+ }
131
+ }, {
132
+ key: 'createThumb',
133
+ value: function createThumb( data ) {
134
+ var self = this,
135
+ image = new Image();
136
+
137
+ image.onerror = function () {
138
+ var data_before = data;
139
+ data_before.id = data.image_id;
140
+
141
+ self._before(data_before);
142
+ self.send(data);
143
+ };
144
+
145
+ image.onload = function () {
146
+ var maxWidth = 33,
147
+ maxHeight = 33,
148
+ imageWidth = image.width,
149
+ imageHeight = image.height,
150
+ ratio = 1,
151
+ newHeight = 0,
152
+ newWidth = 0,
153
+ canvas = null,
154
+ ctx = null;
155
+
156
+ if ( imageWidth < imageHeight ) {
157
+ ratio = maxWidth / imageWidth;
158
+ newWidth = maxWidth;
159
+ newHeight = imageHeight * ratio;
160
+ } else {
161
+ ratio = maxHeight / imageHeight;
162
+ newHeight = maxHeight;
163
+ newWidth = imageWidth * ratio;
164
+ }
165
+
166
+ canvas = document.createElement( 'canvas' );
167
+
168
+ canvas.width = newWidth;
169
+ canvas.height = newHeight;
170
+ image.width = newWidth;
171
+ image.height = newHeight;
172
+
173
+ ctx = canvas.getContext( '2d' );
174
+ ctx.drawImage( this, 0, 0, newWidth, newHeight );
175
+
176
+ try {
177
+ data.thumbnail = canvas.toDataURL( 'image/jpeg' );
178
+ } catch ( e ) {
179
+ data.thumbnail = self.default_thumb;
180
+ }
181
+
182
+ var before_data = data;
183
+ before_data.id = data.image_id;
184
+
185
+ self._before(before_data);
186
+
187
+ self.send(data);
188
+
189
+ canvas = null;
190
+ };
191
+
192
+ image.src = data.image_src;
193
+ }
194
+ }, {
195
+ key: 'send',
196
+ value: function send( data ) {
197
+
198
+ var self = this,
199
+ transport = new XMLHttpRequest(),
200
+ err = false,
201
+ json = {},
202
+ response = {
203
+ filename: data.filename,
204
+ image: data.image_id,
205
+ error: ''
206
+ };
207
+
208
+ transport.onreadystatechange = function () {
209
+ if ( 4 === this.readyState ) {
210
+
211
+ self.processed_images++;
212
+
213
+ try {
214
+ json = JSON.parse( this.responseText );
215
+ err = false;
216
+ } catch ( e ) {
217
+ response.success = false;
218
+ response.error = 'Unknown error occured';
219
+ err = true;
220
+ }
221
+
222
+ response.progress = Math.floor( self.processed_images / self.total_images * 100 );
223
+
224
+ if ( ! err ) {
225
+ var json_data = json.data;
226
+
227
+ response.success = json.success;
228
+
229
+ if ( true === json.success ) {
230
+ self.total_original_size += json_data.original_size;
231
+ self.total_optimized_size += json_data.new_size;
232
+ self.total_gain += json_data.original_size - json_data.new_size;
233
+ self.total_percent = ( self.total_optimized_size / self.total_original_size * 100 ).toFixed( 2 );
234
+ self.global_original_size += json_data.original_overall_size;
235
+ self.global_optimized_size += json_data.new_overall_size;
236
+ self.global_gain += json_data.overall_saving;
237
+ self.global_percent = ( 100 - self.global_optimized_size / self.global_optimized_size * 100 ).toFixed( 2 );
238
+
239
+ response.original_size = json_data.original_size;
240
+ response.original_size_human = self.humanSize( json_data.original_size );
241
+
242
+ response.new_size = json_data.new_size;
243
+ response.new_size_human = self.humanSize( json_data.new_size );
244
+
245
+ response.percent = json_data.percent;
246
+ response.thumbnails = json_data.thumbnails;
247
+
248
+ response.overall_saving = json_data.overall_saving;
249
+ response.overall_saving_human = self.humanSize( json_data.overall_saving );
250
+
251
+ response.original_overall_size = json_data.original_overall_size;
252
+ response.original_overall_size_human = self.humanSize( json_data.original_overall_size );
253
+ } else {
254
+ response.error = json_data.error;
255
+ }
256
+ }
257
+
258
+ self._each( response );
259
+
260
+ if ( self.inprocess_images < self.total_images ) {
261
+ self.process( self.images_ids.shift() );
262
+ }
263
+
264
+ if ( self.processed_images === self.total_images ) {
265
+
266
+ var tmp_global_percent = 0;
267
+
268
+ if ( 0 !== self.global_original_size ) {
269
+ tmp_global_percent = ( 100 - 100 * ( self.global_optimized_size / self.global_original_size ) ).toFixed( 2 );
270
+ }
271
+
272
+ self._done( {
273
+ global_original_size_human: self.humanSize( self.global_original_size ),
274
+ global_gain_human: self.humanSize( self.global_gain ),
275
+ global_percent: tmp_global_percent
276
+ } );
277
+ }
278
+ }
279
+ };
280
+
281
+ transport.open( 'POST', this.lib_url, true );
282
+ transport.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
283
+ transport.send( 'image=' + data.image_id + '&context=' + this.context );
284
+ }
285
+ } ] );
286
+
287
+ return ImagifyGulp;
288
+ }();
289
+ //# sourceMappingURL=imagify-gulp.js.map
290
+ }());
assets/js/imagify.min.js CHANGED
@@ -1,5 +1 @@
1
- /*
2
- * imagify-gulpjs - version 0.0.1 - 2016-04-07
3
- * WP Media <contact@wp-media.me>
4
- */
5
- "use strict";function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),ImagifyGulp=function(){function a(b){_classCallCheck(this,a),this.buffer_size=imagifyBulk.buffer_size,this.lib_url=b.lib,this.default_thumb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAIAAACRuyQOAAACy0lEQVRIx+1XS1PTUBTuT/MB1NGF3bhyhys3Pv+Ai8pCF6Bb3bsWq8xAh8441I2TSlKwPIKQJsI40IbSV0pJ6qe3OeZ1b9PaYViQyaJzc+757j3nO985TVx5v3o+b+IS6XyQUgtrj/NqWtJmZf3lavnpl53bC2vjRLqRUV4pxqbZcnrBx3F6G2ZzTjFg879IMwWtanV7g56K1Z2RtBGRpj7IWb0a8HhqOz9O2rjHfrOD34GvWcPEruGQkhmlcFgnF7bjABVJmvA4uj4vY2VJr545/yClw/okBywaadF/m63j1gT/sNO5DbXW8t4sLtJzSQtnAme/ys/BrU9FpdIgY2R3MBLidtQ+ZRt2T9qZvQrtf/N9X5BwbEQKmSVIFGZjEGlWNojB93KbCBolDNl49nVPAIYwUs5QGAOQwCtmuuyGG5ExGhZbtM7s+5+3BGC5nyazhB8RElSAePRwRaX1u9nScadfVYjtncV1HtKDlW0KQMqvID4kCAydHST2fgKhu24B7dTaSY4oYBf2MjN44yK9+FZmRnrdCnuhr3jyB7Vr89G8L9f7oU77VSPhp4POjNarzUgv77Z/ERh+R9oUXbqDXFyktFtJ5ag74cU9cBsCwy3DNoht5Fcf0pO8ysuTt27IFzKH/Hm/Qopi5ekP99zzgkU8goF7VN21ThfM9BKHylHEPbzoQ8wUlSGoG1QVnR3Vhppj66hCtgg/Ayr3tdLXCFQ7al4ABr2gAEBHoCbQFDu+RkCvqPVBx5LCZvq2dEDsgELuDqV7rM/SfvmocfNjkYcEdV8Kdcu4Wh6QLzzoPQKtQ9DQvQL9ZYhOiCYteXougo/9UEIv9YHxKK+iZ9qenouE8QIunCMMMzxHYIIomU2ksBOaI5ZHmCO8OavEnI0K2hjmvTnevPe3bjBlTvKvMsoMi4kVAgO/qBXMGvidGu8Me/lf4yIg/QYbLcmjDg4bKwAAAABJRU5ErkJggg==",this.images=b.images,this.images_ids=Object.keys(b.images),this.total_images=this.images_ids.length,this.processed_images=0,this.inprocess_images=0,this._before=new Function,this._each=new Function,this._done=new Function,this._error=new Function,this.total_original_size=0,this.total_optimized_size=0,this.total_gain=0,this.total_percent=0,this.global_original_size=0,this.global_optimized_size=0,this.global_gain=0,this.global_percent=0,this.context=b.context||"wp"}return _createClass(a,[{key:"before",value:function(a){return this._before=a,this}},{key:"each",value:function(a){return this._each=a,this}},{key:"done",value:function(a){return this._done=a,this}},{key:"error",value:function(a){return this._error=a,this}},{key:"humanSize",value:function(a){if(0==a)return"0kb";var b=["b","kb","mb"],c=parseInt(Math.floor(Math.log(a)/Math.log(1024)));return(a/Math.pow(1024,c)).toFixed(2)+b[c]}},{key:"run",value:function(){for(var a=this.images_ids.length>this.buffer_size?this.buffer_size:this.images_ids.length,b=0;a>b;b++){var c=this.images_ids.shift();this.process(c)}return this}},{key:"process",value:function(a){this.inprocess_images++;var b={id:a,image_id:parseInt(a.toString().substr(1)),image_src:this.images[a],filename:this.images[a].split("/").pop(),thumbnail:this.default_thumb,error:""};this.createThumb(b)}},{key:"createThumb",value:function(a){var b=this,c=new Image;c.onerror=function(){var c=a;c.id=a.image_id,b._before(c),b.send(a)},c.onload=function(){var d=33,e=33,f=c.width,g=c.height,h=1,i=0,j=0,k=null,l=null;g>f?(h=d/f,j=d,i=g*h):(h=e/g,i=e,j=f*h),k=document.createElement("canvas"),k.width=j,k.height=i,c.width=j,c.height=i,l=k.getContext("2d"),l.drawImage(this,0,0,j,i);try{a.thumbnail=k.toDataURL("image/jpeg")}catch(m){a.thumbnail=b.default_thumb}var n=a;n.id=a.image_id,b._before(n),b.send(a),k=null},c.src=a.image_src}},{key:"send",value:function(a){var b=this,c=new XMLHttpRequest,d=!1,e={},f={filename:a.filename,image:a.image_id,error:""};c.onreadystatechange=function(){if(4===this.readyState){b.processed_images++;try{e=JSON.parse(this.responseText),d=!1}catch(a){f.success=!1,f.error="Unknown error occured",d=!0}if(f.progress=Math.floor(b.processed_images/b.total_images*100),!d){var c=e.data;f.success=e.success,e.success===!0?(b.total_original_size+=c.original_size,b.total_optimized_size+=c.new_size,b.total_gain+=c.original_size-c.new_size,b.total_percent=(b.total_optimized_size/b.total_original_size*100).toFixed(2),b.global_original_size+=c.original_overall_size,b.global_optimized_size+=c.new_overall_size,b.global_gain+=c.overall_saving,b.global_percent=(100-b.global_optimized_size/b.global_optimized_size*100).toFixed(2),f.original_size=c.original_size,f.original_size_human=b.humanSize(c.original_size),f.new_size=c.new_size,f.new_size_human=b.humanSize(c.new_size),f.percent=c.percent,f.thumbnails=c.thumbnails,f.overall_saving=c.overall_saving,f.overall_saving_human=b.humanSize(c.overall_saving),f.original_overall_size=c.original_overall_size,f.original_overall_size_human=b.humanSize(c.original_overall_size)):f.error=c.error}if(b._each(f),b.inprocess_images<b.total_images&&b.process(b.images_ids.shift()),b.processed_images==b.total_images){var g=0;0!=b.global_original_size&&(g=(100-100*(b.global_optimized_size/b.global_original_size)).toFixed(2)),b._done({global_original_size_human:b.humanSize(b.global_original_size),global_gain_human:b.humanSize(b.global_gain),global_percent:g})}}},c.open("POST",this.lib_url,!0),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send("image="+a.image_id+"&context="+this.context)}}]),a}();
1
+ !function(){"use strict";function a(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();window.ImagifyGulp=function(){function c(b){a(this,c),this.buffer_size=1,this.lib_url=b.lib,this.default_thumb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAIAAACRuyQOAAACy0lEQVRIx+1XS1PTUBTuT/MB1NGF3bhyhys3Pv+Ai8pCF6Bb3bsWq8xAh8441I2TSlKwPIKQJsI40IbSV0pJ6qe3OeZ1b9PaYViQyaJzc+757j3nO985TVx5v3o+b+IS6XyQUgtrj/NqWtJmZf3lavnpl53bC2vjRLqRUV4pxqbZcnrBx3F6G2ZzTjFg879IMwWtanV7g56K1Z2RtBGRpj7IWb0a8HhqOz9O2rjHfrOD34GvWcPEruGQkhmlcFgnF7bjABVJmvA4uj4vY2VJr545/yClw/okBywaadF/m63j1gT/sNO5DbXW8t4sLtJzSQtnAme/ys/BrU9FpdIgY2R3MBLidtQ+ZRt2T9qZvQrtf/N9X5BwbEQKmSVIFGZjEGlWNojB93KbCBolDNl49nVPAIYwUs5QGAOQwCtmuuyGG5ExGhZbtM7s+5+3BGC5nyazhB8RElSAePRwRaX1u9nScadfVYjtncV1HtKDlW0KQMqvID4kCAydHST2fgKhu24B7dTaSY4oYBf2MjN44yK9+FZmRnrdCnuhr3jyB7Vr89G8L9f7oU77VSPhp4POjNarzUgv77Z/ERh+R9oUXbqDXFyktFtJ5ag74cU9cBsCwy3DNoht5Fcf0pO8ysuTt27IFzKH/Hm/Qopi5ekP99zzgkU8goF7VN21ThfM9BKHylHEPbzoQ8wUlSGoG1QVnR3Vhppj66hCtgg/Ayr3tdLXCFQ7al4ABr2gAEBHoCbQFDu+RkCvqPVBx5LCZvq2dEDsgELuDqV7rM/SfvmocfNjkYcEdV8Kdcu4Wh6QLzzoPQKtQ9DQvQL9ZYhOiCYteXougo/9UEIv9YHxKK+iZ9qenouE8QIunCMMMzxHYIIomU2ksBOaI5ZHmCO8OavEnI0K2hjmvTnevPe3bjBlTvKvMsoMi4kVAgO/qBXMGvidGu8Me/lf4yIg/QYbLcmjDg4bKwAAAABJRU5ErkJggg==",this.images=b.images,this.images_ids=Object.keys(b.images),this.total_images=this.images_ids.length,this.processed_images=0,this.inprocess_images=0,this._before=function(){},this._each=function(){},this._done=function(){},this._error=function(){},this.total_original_size=0,this.total_optimized_size=0,this.total_gain=0,this.total_percent=0,this.global_original_size=0,this.global_optimized_size=0,this.global_gain=0,this.global_percent=0,this.context=b.context||"wp"}return b(c,[{key:"before",value:function(a){return this._before=a,this}},{key:"each",value:function(a){return this._each=a,this}},{key:"done",value:function(a){return this._done=a,this}},{key:"error",value:function(a){return this._error=a,this}},{key:"humanSize",value:function(a){if(0===a)return"0kb";var b=["b","kb","mb"],c=parseInt(Math.floor(Math.log(a)/Math.log(1024)));return(a/Math.pow(1024,c)).toFixed(2)+b[c]}},{key:"run",value:function(){for(var a=this.images_ids.length>this.buffer_size?this.buffer_size:this.images_ids.length,b=0;b<a;b++){var c=this.images_ids.shift();this.process(c)}return this}},{key:"process",value:function(a){this.inprocess_images++;var b={id:a,image_id:parseInt(a.toString().substr(1),10),image_src:this.images[a],filename:this.images[a].split("/").pop(),thumbnail:this.default_thumb,error:""};this.createThumb(b)}},{key:"createThumb",value:function(a){var b=this,c=new Image;c.onerror=function(){var c=a;c.id=a.image_id,b._before(c),b.send(a)},c.onload=function(){var d=c.width,e=c.height,f=1,g=0,h=0,i=null,j=null;d<e?(f=33/d,h=33,g=e*f):(f=33/e,g=33,h=d*f),i=document.createElement("canvas"),i.width=h,i.height=g,c.width=h,c.height=g,j=i.getContext("2d"),j.drawImage(this,0,0,h,g);try{a.thumbnail=i.toDataURL("image/jpeg")}catch(c){a.thumbnail=b.default_thumb}var k=a;k.id=a.image_id,b._before(k),b.send(a),i=null},c.src=a.image_src}},{key:"send",value:function(a){var b=this,c=new XMLHttpRequest,d=!1,e={},f={filename:a.filename,image:a.image_id,error:""};c.onreadystatechange=function(){if(4===this.readyState){b.processed_images++;try{e=JSON.parse(this.responseText),d=!1}catch(a){f.success=!1,f.error="Unknown error occured",d=!0}if(f.progress=Math.floor(b.processed_images/b.total_images*100),!d){var a=e.data;f.success=e.success,!0===e.success?(b.total_original_size+=a.original_size,b.total_optimized_size+=a.new_size,b.total_gain+=a.original_size-a.new_size,b.total_percent=(b.total_optimized_size/b.total_original_size*100).toFixed(2),b.global_original_size+=a.original_overall_size,b.global_optimized_size+=a.new_overall_size,b.global_gain+=a.overall_saving,b.global_percent=(100-b.global_optimized_size/b.global_optimized_size*100).toFixed(2),f.original_size=a.original_size,f.original_size_human=b.humanSize(a.original_size),f.new_size=a.new_size,f.new_size_human=b.humanSize(a.new_size),f.percent=a.percent,f.thumbnails=a.thumbnails,f.overall_saving=a.overall_saving,f.overall_saving_human=b.humanSize(a.overall_saving),f.original_overall_size=a.original_overall_size,f.original_overall_size_human=b.humanSize(a.original_overall_size)):f.error=a.error}if(b._each(f),b.inprocess_images<b.total_images&&b.process(b.images_ids.shift()),b.processed_images===b.total_images){var c=0;0!==b.global_original_size&&(c=(100-b.global_optimized_size/b.global_original_size*100).toFixed(2)),b._done({global_original_size_human:b.humanSize(b.global_original_size),global_gain_human:b.humanSize(b.global_gain),global_percent:c})}}},c.open("POST",this.lib_url,!0),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send("image="+a.image_id+"&context="+this.context)}}]),c}()}();
 
 
 
 
assets/js/jquery.twentytwenty.js CHANGED
@@ -1,13 +1,29 @@
1
- (function(window, $, undefined){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  $.fn.twentytwenty = function(options, callback) {
4
- var options = $.extend({
5
  handlePosition : 0.5,
6
  orientation : 'horizontal',
7
  labelBefore : 'Before',
8
  labelAfter : 'After'
9
- }
10
- , options);
11
  return this.each(function() {
12
 
13
  var sliderPct = options.handlePosition,
@@ -17,12 +33,12 @@
17
  afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right',
18
  $beforeImg = $container.find('img:first'),
19
  $afterImg = $container.find('img:last');
20
-
21
-
22
  $container.wrap('<div class="twentytwenty-wrapper twentytwenty-' + sliderOrientation + '"></div>');
23
  $container.append('<div class="twentytwenty-overlay"></div>');
24
  $container.append('<div class="twentytwenty-handle"></div>');
25
-
26
  var $slider = $container.find('.twentytwenty-handle');
27
 
28
  $slider.append('<span class="twentytwenty-' + beforeDirection + '-arrow"></span>');
@@ -30,7 +46,7 @@
30
  $container.addClass('twentytwenty-container');
31
  $beforeImg.addClass('twentytwenty-before');
32
  $afterImg.addClass('twentytwenty-after');
33
-
34
  var $overlay = $container.find('.twentytwenty-overlay');
35
 
36
  $overlay.append('<div class="twentytwenty-labels twentytwenty-before-label"><span class="twentytwenty-label-content">' + options.labelBefore + '</span></div>');
@@ -38,7 +54,7 @@
38
 
39
 
40
  // some usefull function and vars declarations
41
-
42
  var calcOffset = function(dimensionPct) {
43
  var w = $beforeImg.width();
44
  var h = $beforeImg.height();
@@ -76,10 +92,10 @@
76
  imgWidth = 0,
77
  imgHeight = 0;
78
 
79
- $(window).on('resize.twentytwenty', function(e) {
80
  adjustSlider( sliderPct );
81
  });
82
-
83
  $slider.on('movestart', function(e) {
84
  if ( ( ( e.distX > e.distY && e.distX < -e.distY ) || ( e.distX < e.distY && e.distX > -e.distY ) ) && sliderOrientation !== 'vertical' ) {
85
  e.preventDefault();
@@ -90,11 +106,11 @@
90
  $container.addClass('active');
91
  offsetX = $container.offset().left;
92
  offsetY = $container.offset().top;
93
- imgWidth = $beforeImg.width();
94
- imgHeight = $beforeImg.height();
95
  });
96
 
97
- $slider.on('moveend', function(e) {
98
  $container.removeClass('active');
99
  });
100
 
@@ -121,519 +137,524 @@
121
  });
122
  };
123
 
124
- })(window, jQuery);
125
 
126
  /**
127
  * Twentytwenty Imagify Init
128
  */
129
- (function($, window, document, undefined){
130
 
131
  /*
132
  * Mini chart
133
  *
134
  * @param {element} canvas
135
- */
136
- var draw_me_a_chart = function ( canvas ) {
137
- canvas.each(function(){
138
- var the_value = parseInt( $(this).closest('.imagify-chart').next('.imagify-chart-value').text() ),
139
- overviewData = [
140
- {
141
- value: the_value,
142
- color: '#00B3D3'
143
- },
144
- {
145
- value: 100 - the_value,
146
- color: '#D8D8D8'
147
- }
148
- ],
149
- overviewDoughnut = new Chart( $(this)[0].getContext('2d')).Doughnut(overviewData, {
150
- segmentStrokeColor : '#2A2E3C',
151
- segmentStrokeWidth : 1,
152
- animateRotate : true,
153
- percentageInnerCutout: 60,
154
- tooltipEvents : []
155
- });
156
- });
157
- };
158
-
159
- /**
160
- * Dynamic modal
161
- *
162
- * @param {object} Parameters to build modal with datas
163
  */
164
- var imagify_open_modal = function( $the_link ){
165
-
166
- var the_target = $the_link.data('target') || $the_link.attr('href');
167
-
168
- $( the_target ).css('display', 'flex').hide().fadeIn(400).attr('aria-hidden', 'false').attr('tabindex', '0').focus().removeAttr('tabindex').addClass('modal-is-open');
169
- $('body').addClass('imagify-modal-is-open');
 
 
 
 
 
 
 
 
170
 
 
 
 
 
 
 
 
 
171
  },
172
- imagify_twenty_modal = function( options ) {
173
-
174
- var defaults = {
175
- width: 0, //px
176
- height: 0, //px
177
- original_url: '', //url
178
- optimized_url: '', //url
179
- original_size: 0, //mb
180
- optimized_size: 0, // mb
181
- saving: 0, //percent
182
- modal_append_to: $('body'), // jQuery element
183
- trigger: $('[data-target="imagify-visual-comparison"]'), // jQuery element (button, link) with data-target="modal_id"
184
- modal_id: 'imagify-visual-comparison', // should be dynamic if multiple modals
185
- open_modal: false
186
- },
187
- settings = $.extend({}, defaults, options);
188
-
189
- if ( settings.width === 0 || settings.height === 0 || settings.original_url === ''|| settings.optimized_url === '' || settings.original_size === 0 || settings.optimized_size === 0 || settings.saving === 0 ) {
190
- return 'error';
191
- }
 
 
 
 
 
 
 
192
 
193
- // create modal box
194
- settings.modal_append_to.append(''
195
- + '<div id="' + settings.modal_id + '" class="imagify-modal imagify-visual-comparison" aria-hidden="true">'
196
- + '<div class="imagify-modal-content loading">'
197
- + '<div class="twentytwenty-container">'
198
- + '<img class="imagify-img-before" alt="" width="' + settings.width + '" height="' + settings.height + '">'
199
- + '<img class="imagify-img-after" alt="" width="' + settings.width + '" height="' + settings.height + '">'
200
- + '</div>'
201
- + '<div class="imagify-comparison-levels">'
202
- + '<div class="imagify-c-level imagify-level-original go-left">'
203
- + '<p class="imagify-c-level-row">'
204
- + '<span class="label">' + imagifyTTT.labels.filesize + '</span>'
205
- + '<span class="value level">' + settings.original_size + '</span>'
206
- + '</p>'
207
- + '</div>'
208
- + '<div class="imagify-c-level imagify-level-optimized go-right">'
209
- + '<p class="imagify-c-level-row">'
210
- + '<span class="label">' + imagifyTTT.labels.filesize + '</span>'
211
- + '<span class="value level">' + settings.optimized_size + '</span>'
212
- + '</p>'
213
- + '<p class="imagify-c-level-row">'
214
- + '<span class="label">' + imagifyTTT.labels.saving + '</span>'
215
- + '<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">' + settings.saving + '</span>%</span>'
216
- + '</p>'
217
- +'</div>'
218
- + '</div>'
219
- + '<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>'
220
- + '</div>'
221
- + '</div>'
222
- );
223
-
224
- settings.trigger.on('click.imagify', function(){
225
-
226
- var $modal = $( $(this).data('target') ),
227
- imgs_loaded = 0;
228
-
229
- if ( typeof imagify_open_modal === 'function' && settings.open_modal ) {
230
- imagify_open_modal( $(this) );
231
  }
232
 
233
- $modal.find('.imagify-modal-content').css({
234
- 'width' : ($(window).outerWidth()*0.85) + 'px',
235
- 'max-width' : settings.width
236
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
 
238
- // load before img
239
- $modal.find('.imagify-img-before').on('load', function(){
240
- imgs_loaded++;
241
- }).attr('src', settings.original_url);
242
-
243
- // load after img
244
- $modal.find('.imagify-img-after').on('load', function(){
245
- imgs_loaded++;
246
- }).attr('src', settings.optimized_url);
247
-
248
- var $tt = $modal.find('.twentytwenty-container'),
249
- check_load = setInterval( function(){
250
-
251
- if ( imgs_loaded === 2 ) {
252
- $tt.twentytwenty({
253
- handlePosition: 0.3,
254
- orientation: 'horizontal',
255
- labelBefore: imagifyTTT.labels.original_l,
256
- labelAfter: imagifyTTT.labels.optimized_l
257
- }, function(){
258
-
259
- var windowH = $(window).height(),
260
- ttH = $modal.find('.twentytwenty-container').height(),
261
- ttTop = $modal.find('.twentytwenty-wrapper').position().top;
262
-
263
- if ( ! $tt.closest('.imagify-modal-content').hasClass('loaded') ) {
264
- $tt.closest('.imagify-modal-content').removeClass('loading').addClass('loaded');
265
- draw_me_a_chart( $modal.find('.imagify-level-optimized').find('.imagify-chart').find('canvas') );
266
- }
267
-
268
- // check if image height is to big
269
- if ( windowH < ttH && ! $modal.hasClass('modal-is-too-high') ) {
270
- $modal.addClass('modal-is-too-high');
271
-
272
- var $handle = $modal.find('.twentytwenty-handle'),
273
- $labels = $modal.find('.twentytwenty-label-content'),
274
- $datas = $modal.find('.imagify-comparison-levels'),
275
- datasH = $datas.outerHeight(),
276
- handle_pos = ( windowH - ttTop - $handle.height() ) / 2,
277
- labels_pos = ( windowH - ttTop * 3 - datasH );
278
-
279
- $handle.css({
280
- top: handle_pos
281
- });
282
- $labels.css({
283
- top: labels_pos,
284
- bottom: 'auto'
285
- });
286
- $modal.find('.twentytwenty-wrapper').css({
287
- paddingBottom: datasH
288
- });
289
-
290
- $modal.find('.imagify-modal-content').on('scroll.imagify', function(){
291
- $handle.css({
292
- top: handle_pos + $(this).scrollTop()
293
- });
294
- $labels.css({
295
- top: labels_pos + $(this).scrollTop()
296
- });
297
- $datas.css({
298
- bottom: - ( $(this).scrollTop() )
299
- });
300
- });
301
- }
302
-
303
- });
304
- clearInterval( check_load );
305
- check_load = null;
306
- return 'done';
307
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  }, 75 );
309
 
310
- return false;
311
- });
312
- }; // imagify_twenty_modal( options );
313
 
314
 
315
  /**
316
  * The complexe visual comparison
317
  */
318
- $('.imagify-visual-comparison-btn').on('click', function(){
 
 
 
 
 
 
 
 
 
 
 
 
 
319
 
320
- if ( $('.twentytwenty-wrapper').length === 1) {
321
  return;
322
  }
323
-
324
- $( $(this).data('target') ).find('.imagify-modal-content').css('width', ($(window).outerWidth()*0.95) + 'px');
325
-
326
- if ( $('.twentytwenty-container').length > 0 && $(window).outerWidth() > 800 ) {
327
-
328
- var $tt = $('.twentytwenty-container'),
329
- imgs_loaded = 0,
330
- loader = $tt.data('loader'),
331
- label_original = $tt.data('label-original'),
332
- label_normal = $tt.data('label-normal'),
333
- label_aggressive = $tt.data('label-aggressive'),
334
- label_ultra = $tt.data('label-ultra'),
335
-
336
- original_label = $tt.data('original-label').replace(/\*\*/, '<strong>').replace(/\*\*/, '</strong>'),
337
- original_alt = $tt.data('original-alt'),
338
- original_src = $tt.data('original-img'),
339
- original_dim = $tt.data('original-dim').split('x'),
340
-
341
- normal_label = $tt.data('normal-label').replace(/\*\*/, '<strong>').replace(/\*\*/, '</strong>'),
342
- normal_alt = $tt.data('normal-alt'),
343
- normal_src = $tt.data('normal-img'),
344
- normal_dim = $tt.data('normal-dim').split('x'),
345
-
346
- aggressive_label = $tt.data('aggressive-label').replace(/\*\*/, '<strong>').replace(/\*\*/, '</strong>'),
347
- aggressive_alt = $tt.data('aggressive-alt'),
348
- aggressive_src = $tt.data('aggressive-img'),
349
- aggressive_dim = $tt.data('aggressive-dim').split('x'),
350
-
351
- ultra_label = $tt.data('ultra-label').replace(/\*\*/, '<strong>').replace(/\*\*/, '</strong>'),
352
- ultra_alt = $tt.data('ultra-alt'),
353
- ultra_src = $tt.data('ultra-img'),
354
- ultra_dim = $tt.data('ultra-dim').split('x'),
355
-
356
- tt_before_buttons = '<span class="twentytwenty-duo-buttons twentytwenty-duo-left">' +
357
- '<button type="button" class="imagify-comparison-original selected" data-img="original">' + label_original + '</button>' +
358
- '<button type="button" class="imagify-comparison-normal" data-img="normal">' + label_normal + '</button>' +
359
- '<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">' + label_aggressive + '</button>' +
360
- '</span>',
361
- tt_after_buttons = '<span class="twentytwenty-duo-buttons twentytwenty-duo-right">' +
362
- '<button type="button" class="imagify-comparison-normal" data-img="normal">' + label_normal + '</button>' +
363
- '<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">' + label_aggressive + '</button>' +
364
- '<button type="button" class="imagify-comparison-ultra selected" data-img="ultra">' + label_ultra + '</button>' +
365
- '</span>';
366
-
367
- // loader
368
- $tt.before('<img class="loader" src="' + loader + '" alt="Loading…" width="64" height="64">')
369
-
370
- // add switchers button only if needed
371
- // should be more locally integrate...
372
- var duo_buttons = ( $('.twentytwenty-left-buttons').lenght ) ? tt_before_buttons + tt_after_buttons : '';
373
- // should be more locally integrate...
374
- $('.twentytwenty-left-buttons').append(tt_before_buttons);
375
- $('.twentytwenty-right-buttons').append(tt_after_buttons);
376
-
377
- // add images to 50/50 area
378
- $tt.closest('.imagify-modal-content').addClass('loading').find('.twentytwenty-container').append(
379
- '<img class="img-original" alt="' + original_alt + '" width="' + original_dim[0] + '" height="' + original_dim[1] + '">' +
380
- '<img class="img-normal" alt="' + normal_alt + '" width="' + normal_dim[0] + '" height="' + normal_dim[1] + '">' +
381
- '<img class="img-aggressive" alt="' + aggressive_alt + '" width="' + aggressive_dim[0] + '" height="' + aggressive_dim[1] + '">' +
382
- '<img class="img-ultra" alt="' + ultra_alt + '" width="' + ultra_dim[0] + '" height="' + ultra_dim[1] + '">' +
383
- duo_buttons
384
- );
385
-
386
- // load image original
387
- $('.img-original').on('load', function(){
388
- imgs_loaded++;
389
- }).attr('src', original_src);
390
-
391
- // load image normal
392
- $('.img-normal').on('load', function(){
393
- imgs_loaded++;
394
- }).attr('src', normal_src);
395
-
396
- // load image aggressive
397
- $('.img-aggressive').on('load', function(){
398
- imgs_loaded++;
399
- }).attr('src', aggressive_src);
400
-
401
- // load image ultra
402
- $('.img-ultra').on('load', function(){
403
- imgs_loaded++;
404
- }).attr('src', ultra_src);
405
-
406
- var twenty_me = setInterval(function(){
407
- if ( imgs_loaded === 4 ) {
408
- $tt.twentytwenty({
409
- handlePosition: 0.6,
410
- orientation: 'horizontal',
411
- labelBefore: original_label,
412
- labelAfter: ultra_label
413
- }, function(){
414
- // fires on initialisation & each time the handle is moving
415
- if ( ! $tt.closest('.imagify-modal-content').hasClass('loaded') ) {
416
- $tt.closest('.imagify-modal-content').removeClass('loading').addClass('loaded');
417
- draw_me_a_chart( $('.imagify-level-ultra').find('.imagify-chart').find('canvas') );
418
- }
419
- });
420
- clearInterval( twenty_me );
421
- twenty_me = null;
422
- }
423
- }, 75);
424
-
425
- // on click on button choices
426
-
427
- $('.imagify-comparison-title').on('click', '.twentytwenty-duo-buttons button:not(.selected)', function(e){
428
-
429
- e.stopPropagation();
430
-
431
- var $_this = $(this),
432
- $container = $_this.closest('.imagify-comparison-title').nextAll('.twentytwenty-wrapper').find('.twentytwenty-container'),
433
- side = $_this.closest('.twentytwenty-duo-buttons').hasClass('twentytwenty-duo-left') ? 'left' : 'right',
434
- $other_side = side === 'left' ? $_this.closest('.imagify-comparison-title').find('.twentytwenty-duo-right') : $_this.closest('.imagify-comparison-title').find('.twentytwenty-duo-left'),
435
- $duo = $_this.closest('.twentytwenty-duo-buttons').find('button'),
436
- $img_before = $container.find('.twentytwenty-before'),
437
- $img_after = $container.find('.twentytwenty-after'),
438
- image = $_this.data('img');
439
-
440
- // button coloration
441
- $duo.removeClass('selected');
442
- $_this.addClass('selected');
443
-
444
- // other side action (to not compare same images)
445
- if ( $other_side.find('.selected').data('img') === image ) {
446
- $other_side.find('button:not(.selected)').eq(0).trigger('click');
447
- }
448
 
449
- // left buttons
450
- if ( side === 'left' ) {
451
- var clip_styles = $img_before.css('clip');
452
- $img_before.attr('style', '');
453
- $img_before.removeClass('twentytwenty-before');
454
- $container.find( '.img-' + image ).addClass('twentytwenty-before').css('clip', clip_styles);
455
- $('.twentytwenty-before-label').find('.twentytwenty-label-content').text( $container.data( image + '-label' ) );
456
- $('.imagify-c-level.go-left').attr('aria-hidden', 'true').removeClass('go-left go-right');
457
- $('.imagify-level-' + image).attr('aria-hidden', 'false').addClass('go-left');
458
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459
 
460
- // right buttons
461
- if ( side === 'right' ) {
462
- $img_after.removeClass('twentytwenty-after')
463
- $container.find( '.img-' + image ).addClass('twentytwenty-after');
464
- $('.twentytwenty-after-label').find('.twentytwenty-label-content').text( $container.data( image + '-label' ) );
465
- $('.imagify-c-level.go-right').attr('aria-hidden', 'true').removeClass('go-left go-right');
466
- $('.imagify-level-' + image).attr('aria-hidden', 'false').addClass('go-right');
 
 
 
467
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
468
 
469
- draw_me_a_chart( $('.imagify-level-' + image).find('.imagify-chart').find('canvas') );
470
-
471
- return false;
 
 
 
 
 
 
 
472
 
473
- });
474
- }
 
 
 
 
 
 
475
 
476
- });
 
 
 
477
 
478
 
479
  /**
480
- * Imagify comparison inside Media post visualization
481
  */
482
- if ( $('.post-php').find('.wp_attachment_image').find('.thumbnail').length > 0 ) {
483
-
484
- var $ori_parent = $('.post-php').find('.wp_attachment_image'),
485
- $thumbnail = $ori_parent.find('.thumbnail'),
486
- thumb = { src: $thumbnail.prop('src'), width: $thumbnail.width(), height: $thumbnail.height() },
487
- ori_source = { src: $('#imagify-full-original').val(), size: $('#imagify-full-original-size').val() },
488
- $optimize_btn = $('#misc-publishing-actions').find('.misc-pub-imagify').find('.button-primary'),
489
- width_limit = 360;
490
-
491
- // if shown image > 360, use twentytwenty
492
- if ( thumb.width > width_limit && $('#imagify-full-original').length > 0 && $('#imagify-full-original').val() !== '' ) {
493
-
494
- var imgs_loaded = 0,
495
- filesize = $('.misc-pub-filesize').find('strong').text(),
496
- saving = $('.imagify-data-item').find('.imagify-chart-value').text();
497
-
498
- // create button to trigger
499
- $('[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>')
500
-
501
- // Modal and trigger event creation
502
- var is_modalified = imagify_twenty_modal({
503
- width: thumb.width,
504
- height: thumb.height,
505
- original_url: ori_source.src,
506
- optimized_url: thumb.src,
507
- original_size: ori_source.size,
508
- optimized_size: filesize,
509
- saving: saving,
510
- modal_append_to: $ori_parent,
511
- trigger: $('#imagify-start-comparison'),
512
- modal_id: 'imagify-visual-comparison'
513
- });
514
  }
515
- // else put images next to next
516
- else if ( thumb.width < width_limit && $('#imagify-full-original').length > 0 && $('#imagify-full-original').val() !== '' ) {
517
  // TODO
518
  }
519
- // if image has no backup
520
- else if ( $('#imagify-full-original').length > 0 && $('#imagify-full-original').val() === '' ) {
521
  // do nothing ?
522
  }
523
- // in case image is not optimized
524
  else {
525
- // if is not in optimizing process, propose the Optimize button trigger
526
- if ( $('#misc-publishing-actions').find('.misc-pub-imagify').find('.button-primary').length === 1 ) {
527
- $('[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="' + $optimize_btn.attr('href') + '">' + imagifyTTT.labels.optimize + '</a>');
528
 
529
- $('#imagify-optimize-trigger').on('click', function(){
530
- $(this).prev('.spinner').removeClass('imagify-hidden').addClass('is-active');
531
- });
532
  }
533
  }
534
 
535
  }
536
 
537
  /**
538
- * Images comparison in attachments list page (upload.php)
539
  */
540
- if ( $('.upload-php').find('.imagify-compare-images').length > 0 ) {
541
-
542
- $('.imagify-compare-images').each(function(){
543
-
544
- var $_this = $(this),
545
- id = $_this.data('id'),
546
- $datas = $_this.closest('#post-' + id ).find('.column-imagify_optimized_file'),
547
-
548
- // Modal and trigger event creation
549
- is_modalified = imagify_twenty_modal({
550
- width: $_this.data('full-width'),
551
- height: $_this.data('full-height'),
552
- original_url: $_this.data('backup-src'),
553
- optimized_url: $_this.data('full-src'),
554
- original_size: $datas.find('.original').text(),
555
- optimized_size: $datas.find('.imagify-data-item').find('.big').text(),
556
- saving: $datas.find('.imagify-chart-value').text(),
557
- modal_append_to: $_this.closest('.column-primary'),
558
- trigger: $_this,
559
- modal_id: 'imagify-comparison-' + id
560
- });
561
-
562
- });
563
  }
564
 
565
  /**
566
- * Images Comparison in Grid View modal
567
  */
568
  if ( $('.upload-php').length > 0 ) {
569
 
570
-
571
- var get_var = function (param) {
572
  var vars = {};
573
- window.location.href.replace(
574
- /[?&]+([^=&]+)=?([^&]*)?/gi, // regexp
575
- function( m, key, value ) { // callback
576
- vars[key] = value !== undefined ? value : '';
 
577
  }
578
  );
579
 
580
  if ( param ) {
581
- return vars[param] ? vars[param] : null;
582
  }
583
  return vars;
584
  },
585
- imagify_content_in_modal = function() {
586
-
587
- var tempTimer = setInterval( function(){
588
- if ( $('.media-modal').find('.imagify-datas-details').length ) {
589
- if ( $('#imagify-original-src').length > 0 && $('#imagify-original-src') !== '' ) {
590
-
591
- // trigger creation
592
- $('.media-frame-content').find('.attachment-actions').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>' );
593
-
594
- // get datas
595
- var $datas = $('.media-frame-content').find('.compat-field-imagify');
596
-
597
- // Modal and trigger event creation
598
- is_modalified = imagify_twenty_modal({
599
- width: $('#imagify-full-width').val(),
600
- height: $('#imagify-full-height').val(),
601
- original_url: $('#imagify-original-src').val(),
602
- optimized_url: $('#imagify-full-src').val(),
603
- original_size: $('#imagify-original-size').val(),
604
- optimized_size: $datas.find('.imagify-data-item').find('.big').text(),
605
- saving: $datas.find('.imagify-chart-value').text(),
606
- modal_append_to: $('.media-frame-content').find('.thumbnail-image'),
607
- trigger: $('#imagify-media-frame-comparison-btn'),
608
- modal_id: 'imagify-comparison-modal',
609
- open_modal: true
610
- });
611
- }
612
-
613
- clearInterval(tempTimer);
614
- tempTimer = null;
615
  }
 
 
 
616
  }, 20 );
617
  },
618
  waitContent = setInterval( function() {
619
- if ( $('.upload-php').find('.media-frame.mode-grid').find('.attachments').length > 0 ) {
620
-
621
- // if attachment is clicked, build the modal inside the modal
622
- $('.upload-php').find('.media-frame.mode-grid').on('click', '.attachment', function(){
623
- imagify_content_in_modal();
624
- });
625
-
626
- // if attachment is mentionned in URL, build the modal inside the modal
627
- if ( get_var('item') ){
628
- imagify_content_in_modal();
629
- }
630
 
631
- clearInterval(waitContent);
632
- waitContent = null;
 
633
  }
634
- }, 100);
635
 
636
- // if URL contain item, that will open the WP Modal View
 
 
 
637
  }
638
 
639
- })(jQuery, window, document);
1
+ /* globals ajaxurl: false, console: false, imagifyTTT: true */
2
+
3
+ window.imagify = window.imagify || {
4
+ concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?',
5
+ log: function( content ) {
6
+ if ( undefined !== console ) {
7
+ console.log( content );
8
+ }
9
+ },
10
+ info: function( content ) {
11
+ if ( undefined !== console ) {
12
+ console.info( content );
13
+ }
14
+ }
15
+ };
16
+
17
+ (function($, d, w, undefined) {
18
 
19
  $.fn.twentytwenty = function(options, callback) {
20
+ options = $.extend({
21
  handlePosition : 0.5,
22
  orientation : 'horizontal',
23
  labelBefore : 'Before',
24
  labelAfter : 'After'
25
+ }, options);
26
+
27
  return this.each(function() {
28
 
29
  var sliderPct = options.handlePosition,
33
  afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right',
34
  $beforeImg = $container.find('img:first'),
35
  $afterImg = $container.find('img:last');
36
+
37
+
38
  $container.wrap('<div class="twentytwenty-wrapper twentytwenty-' + sliderOrientation + '"></div>');
39
  $container.append('<div class="twentytwenty-overlay"></div>');
40
  $container.append('<div class="twentytwenty-handle"></div>');
41
+
42
  var $slider = $container.find('.twentytwenty-handle');
43
 
44
  $slider.append('<span class="twentytwenty-' + beforeDirection + '-arrow"></span>');
46
  $container.addClass('twentytwenty-container');
47
  $beforeImg.addClass('twentytwenty-before');
48
  $afterImg.addClass('twentytwenty-after');
49
+
50
  var $overlay = $container.find('.twentytwenty-overlay');
51
 
52
  $overlay.append('<div class="twentytwenty-labels twentytwenty-before-label"><span class="twentytwenty-label-content">' + options.labelBefore + '</span></div>');
54
 
55
 
56
  // some usefull function and vars declarations
57
+
58
  var calcOffset = function(dimensionPct) {
59
  var w = $beforeImg.width();
60
  var h = $beforeImg.height();
92
  imgWidth = 0,
93
  imgHeight = 0;
94
 
95
+ $(window).on('resize.twentytwenty', function() {
96
  adjustSlider( sliderPct );
97
  });
98
+
99
  $slider.on('movestart', function(e) {
100
  if ( ( ( e.distX > e.distY && e.distX < -e.distY ) || ( e.distX < e.distY && e.distX > -e.distY ) ) && sliderOrientation !== 'vertical' ) {
101
  e.preventDefault();
106
  $container.addClass('active');
107
  offsetX = $container.offset().left;
108
  offsetY = $container.offset().top;
109
+ imgWidth = $beforeImg.width();
110
+ imgHeight = $beforeImg.height();
111
  });
112
 
113
+ $slider.on('moveend', function() {
114
  $container.removeClass('active');
115
  });
116
 
137
  });
138
  };
139
 
140
+ } )(jQuery, document, window);
141
 
142
  /**
143
  * Twentytwenty Imagify Init
144
  */
145
+ (function($, d, w, undefined) {
146
 
147
  /*
148
  * Mini chart
149
  *
150
  * @param {element} canvas
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  */
152
+ var drawMeAChart = function ( canvas ) {
153
+ canvas.each( function() {
154
+ var $this = $( this ),
155
+ theValue = parseInt( $this.closest( '.imagify-chart' ).next( '.imagify-chart-value' ).text() ),
156
+ overviewData = [
157
+ {
158
+ value: theValue,
159
+ color: '#00B3D3'
160
+ },
161
+ {
162
+ value: 100 - theValue,
163
+ color: '#D8D8D8'
164
+ }
165
+ ];
166
 
167
+ new Chart( $this[0].getContext( '2d' ) ).Doughnut( overviewData, {
168
+ segmentStrokeColor : '#2A2E3C',
169
+ segmentStrokeWidth : 1,
170
+ animateRotate : true,
171
+ percentageInnerCutout: 60,
172
+ tooltipEvents : []
173
+ } );
174
+ } );
175
  },
176
+ /**
177
+ * Dynamic modal
178
+ *
179
+ * @param {object} Parameters to build modal with datas
180
+ */
181
+ imagifyOpenModal = function( $theLink ) {
182
+ var theTarget = $theLink.data( 'target' ) || $theLink.attr( 'href' );
183
+
184
+ $( theTarget ).css( 'display', 'flex' ).hide().fadeIn( 400 ).attr( 'aria-hidden', 'false' ).attr( 'tabindex', '0' ).focus().removeAttr( 'tabindex' ).addClass( 'modal-is-open' );
185
+ $( 'body' ).addClass( 'imagify-modal-is-open' );
186
+ },
187
+ imagifyTwentyModal = function( options ) {
188
+ var defaults = {
189
+ width: 0, //px
190
+ height: 0, //px
191
+ originalUrl: '', //url
192
+ optimizedUrl: '', //url
193
+ originalSize: 0, //mb
194
+ optimizedSize: 0, // mb
195
+ saving: 0, //percent
196
+ modalAppendTo: $( 'body' ), // jQuery element
197
+ trigger: $( '[data-target="imagify-visual-comparison"]' ), // jQuery element (button, link) with data-target="modalId"
198
+ modalId: 'imagify-visual-comparison', // should be dynamic if multiple modals
199
+ openModal: false
200
+ },
201
+ settings = $.extend( {}, defaults, options ),
202
+ modalHtml;
203
 
204
+ if ( 0 === settings.width || 0 === settings.height || '' === settings.originalUrl || '' === settings.optimizedUrl || 0 === settings.originalSize || 0 === settings.optimizedSize || 0 === settings.saving ) {
205
+ return 'error';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  }
207
 
208
+ // create modal box
209
+ modalHtml = '<div id="' + settings.modalId + '" class="imagify-modal imagify-visual-comparison" aria-hidden="true">';
210
+ modalHtml += '<div class="imagify-modal-content loading">';
211
+ modalHtml += '<div class="twentytwenty-container">';
212
+ modalHtml += '<img class="imagify-img-before" alt="" width="' + settings.width + '" height="' + settings.height + '">';
213
+ modalHtml += '<img class="imagify-img-after" alt="" width="' + settings.width + '" height="' + settings.height + '">';
214
+ modalHtml += '</div>';
215
+ modalHtml += '<div class="imagify-comparison-levels">';
216
+ modalHtml += '<div class="imagify-c-level imagify-level-original go-left">';
217
+ modalHtml += '<p class="imagify-c-level-row">';
218
+ modalHtml += '<span class="label">' + imagifyTTT.labels.filesize + '</span>';
219
+ modalHtml += '<span class="value level">' + settings.originalSize + '</span>';
220
+ modalHtml += '</p>';
221
+ modalHtml += '</div>';
222
+ modalHtml += '<div class="imagify-c-level imagify-level-optimized go-right">';
223
+ modalHtml += '<p class="imagify-c-level-row">';
224
+ modalHtml += '<span class="label">' + imagifyTTT.labels.filesize + '</span>';
225
+ modalHtml += '<span class="value level">' + settings.optimizedSize + '</span>';
226
+ modalHtml += '</p>';
227
+ modalHtml += '<p class="imagify-c-level-row">';
228
+ modalHtml += '<span class="label">' + imagifyTTT.labels.saving + '</span>';
229
+ modalHtml += '<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">' + settings.saving + '</span>%</span>';
230
+ modalHtml += '</p>';
231
+ modalHtml += '</div>';
232
+ modalHtml += '</div>';
233
+ modalHtml += '<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>';
234
+ modalHtml += '</div>';
235
+ modalHtml += '</div>';
236
+
237
+ settings.modalAppendTo.append( modalHtml );
238
+
239
+ settings.trigger.on( 'click.imagify', function() {
240
+ var $modal = $( $( this ).data( 'target' ) ),
241
+ imgsLoaded = 0,
242
+ $tt, checkLoad;
243
+
244
+ if ( typeof imagifyOpenModal === 'function' && settings.openModal ) {
245
+ imagifyOpenModal( $( this ) );
246
+ }
247
 
248
+ $modal.find( '.imagify-modal-content').css( {
249
+ 'width' : ( $( w ).outerWidth() * 0.85 ) + 'px',
250
+ 'max-width': settings.width
251
+ } );
252
+
253
+ // Load before img.
254
+ $modal.find( '.imagify-img-before').on( 'load', function() {
255
+ imgsLoaded++;
256
+ } ).attr( 'src', settings.originalUrl );
257
+
258
+ // Load after img.
259
+ $modal.find( '.imagify-img-after' ).on( 'load', function() {
260
+ imgsLoaded++;
261
+ } ).attr( 'src', settings.optimizedUrl );
262
+
263
+ $tt = $modal.find( '.twentytwenty-container' );
264
+ checkLoad = setInterval( function() {
265
+ if ( 2 !== imgsLoaded ) {
266
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  }
268
+
269
+ $tt.twentytwenty( {
270
+ handlePosition: 0.3,
271
+ orientation: 'horizontal',
272
+ labelBefore: imagifyTTT.labels.original_l,
273
+ labelAfter: imagifyTTT.labels.optimized_l
274
+ }, function() {
275
+ var windowH = $( w ).height(),
276
+ ttH = $modal.find( '.twentytwenty-container' ).height(),
277
+ ttTop = $modal.find( '.twentytwenty-wrapper' ).position().top,
278
+ $handle, $labels, $datas, datasH, handlePos, labelsPos;
279
+
280
+ if ( ! $tt.closest( '.imagify-modal-content' ).hasClass( 'loaded' ) ) {
281
+ $tt.closest( '.imagify-modal-content' ).removeClass( 'loading' ).addClass( 'loaded' );
282
+ drawMeAChart( $modal.find( '.imagify-level-optimized' ).find( '.imagify-chart' ).find( 'canvas' ) );
283
+ }
284
+
285
+ // Check if image height is to big.
286
+ if ( windowH < ttH && ! $modal.hasClass( 'modal-is-too-high' ) ) {
287
+ $modal.addClass( 'modal-is-too-high' );
288
+
289
+ $handle = $modal.find( '.twentytwenty-handle' );
290
+ $labels = $modal.find( '.twentytwenty-label-content' );
291
+ $datas = $modal.find( '.imagify-comparison-levels' );
292
+ datasH = $datas.outerHeight();
293
+ handlePos = ( windowH - ttTop - $handle.height() ) / 2;
294
+ labelsPos = ( windowH - ttTop * 3 - datasH );
295
+
296
+ $handle.css( {
297
+ top: handlePos
298
+ } );
299
+ $labels.css( {
300
+ top: labelsPos,
301
+ bottom: 'auto'
302
+ } );
303
+ $modal.find( '.twentytwenty-wrapper' ).css( {
304
+ paddingBottom: datasH
305
+ } );
306
+ $modal.find( '.imagify-modal-content' ).on( 'scroll.imagify', function() {
307
+ var scrollTop = $( this ).scrollTop();
308
+
309
+ $handle.css( {
310
+ top: handlePos + scrollTop
311
+ } );
312
+ $labels.css( {
313
+ top: labelsPos + scrollTop
314
+ } );
315
+ $datas.css( {
316
+ bottom: - scrollTop
317
+ } );
318
+ } );
319
+ }
320
+ } );
321
+
322
+ clearInterval( checkLoad );
323
+ checkLoad = null;
324
+ return 'done';
325
  }, 75 );
326
 
327
+ return false;
328
+ } );
329
+ }; // imagifyTwentyModal( options );
330
 
331
 
332
  /**
333
  * The complexe visual comparison
334
  */
335
+ $( '.imagify-visual-comparison-btn' ).on( 'click', function() {
336
+ var $tt, imgsLoaded, loader,
337
+ labelOriginal, labelNormal, labelAggressive, labelUltra,
338
+ originalLabel, originalAlt, originalSrc, originalDim,
339
+ normalAlt, normalSrc, normalDim,
340
+ aggressiveAlt, aggressiveSrc, aggressiveDim,
341
+ ultraLabel, ultraAlt, ultraSrc, ultraDim,
342
+ ttBeforeButtons, ttAfterButtons, image50, twentyMe;
343
+
344
+ if ( $( '.twentytwenty-wrapper' ).length === 1 ) {
345
+ return;
346
+ }
347
+
348
+ $( $( this ).data( 'target' ) ).find( '.imagify-modal-content' ).css( 'width', ( $( w ).outerWidth() * 0.95 ) + 'px' );
349
 
350
+ if ( $( '.twentytwenty-container' ).length > 0 && $( w ).outerWidth() <= 800 ) {
351
  return;
352
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
353
 
354
+ $tt = $( '.twentytwenty-container' );
355
+ imgsLoaded = 0;
356
+ loader = $tt.data( 'loader' );
357
+ labelOriginal = $tt.data( 'label-original' );
358
+ labelNormal = $tt.data( 'label-normal' );
359
+ labelAggressive = $tt.data( 'label-aggressive' );
360
+ labelUltra = $tt.data( 'label-ultra' );
361
+
362
+ originalLabel = $tt.data( 'original-label' ).replace( /\*\*/, '<strong>' ).replace( /\*\*/, '</strong>' );
363
+ originalAlt = $tt.data( 'original-alt' );
364
+ originalSrc = $tt.data( 'original-img' );
365
+ originalDim = $tt.data( 'original-dim' ).split( 'x' );
366
+
367
+ normalAlt = $tt.data( 'normal-alt' );
368
+ normalSrc = $tt.data( 'normal-img' );
369
+ normalDim = $tt.data( 'normal-dim' ).split( 'x' );
370
+
371
+ aggressiveAlt = $tt.data( 'aggressive-alt' );
372
+ aggressiveSrc = $tt.data( 'aggressive-img' );
373
+ aggressiveDim = $tt.data( 'aggressive-dim' ).split( 'x' );
374
+
375
+ ultraLabel = $tt.data( 'ultra-label' ).replace( /\*\*/, '<strong>' ).replace( /\*\*/, '</strong>' );
376
+ ultraAlt = $tt.data( 'ultra-alt' );
377
+ ultraSrc = $tt.data( 'ultra-img' );
378
+ ultraDim = $tt.data( 'ultra-dim' ).split( 'x' );
379
+
380
+ ttBeforeButtons = '<span class="twentytwenty-duo-buttons twentytwenty-duo-left">';
381
+ ttBeforeButtons += '<button type="button" class="imagify-comparison-original selected" data-img="original">' + labelOriginal + '</button>';
382
+ ttBeforeButtons += '<button type="button" class="imagify-comparison-normal" data-img="normal">' + labelNormal + '</button>';
383
+ ttBeforeButtons += '<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">' + labelAggressive + '</button>';
384
+ ttBeforeButtons += '</span>';
385
+ ttAfterButtons = '<span class="twentytwenty-duo-buttons twentytwenty-duo-right">';
386
+ ttAfterButtons += '<button type="button" class="imagify-comparison-normal" data-img="normal">' + labelNormal + '</button>';
387
+ ttAfterButtons += '<button type="button" class="imagify-comparison-aggressive" data-img="aggressive">' + labelAggressive + '</button>';
388
+ ttAfterButtons += '<button type="button" class="imagify-comparison-ultra selected" data-img="ultra">' + labelUltra + '</button>';
389
+ ttAfterButtons += '</span>';
390
+
391
+ // Loader.
392
+ $tt.before( '<img class="loader" src="' + loader + '" alt="Loading…" width="64" height="64">' );
393
+
394
+ // Should be more locally integrated...
395
+ $( '.twentytwenty-left-buttons' ).append( ttBeforeButtons );
396
+ $( '.twentytwenty-right-buttons' ).append( ttAfterButtons );
397
+
398
+ image50 = '<img class="img-original" alt="' + originalAlt + '" width="' + originalDim[0] + '" height="' + originalDim[1] + '">';
399
+ image50 += '<img class="img-normal" alt="' + normalAlt + '" width="' + normalDim[0] + '" height="' + normalDim[1] + '">';
400
+ image50 += '<img class="img-aggressive" alt="' + aggressiveAlt + '" width="' + aggressiveDim[0] + '" height="' + aggressiveDim[1] + '">';
401
+ image50 += '<img class="img-ultra" alt="' + ultraAlt + '" width="' + ultraDim[0] + '" height="' + ultraDim[1] + '">';
402
+ // Add switchers button only if needed.
403
+ // Should be more locally integrated...
404
+ image50 += $( '.twentytwenty-left-buttons' ).lenght ? ttBeforeButtons + ttAfterButtons : '';
405
+
406
+ // Add images to 50/50 area.
407
+ $tt.closest( '.imagify-modal-content' ).addClass( 'loading' ).find( '.twentytwenty-container' ).append( image50 );
408
+
409
+ // Load image original.
410
+ $( '.img-original' ).on( 'load', function() {
411
+ imgsLoaded++;
412
+ } ).attr( 'src', originalSrc );
413
+
414
+ // Load image normal.
415
+ $( '.img-normal' ).on( 'load', function() {
416
+ imgsLoaded++;
417
+ } ).attr( 'src', normalSrc );
418
+
419
+ // Load image aggressive.
420
+ $( '.img-aggressive' ).on( 'load', function() {
421
+ imgsLoaded++;
422
+ } ).attr( 'src', aggressiveSrc );
423
+
424
+ // Load image ultra.
425
+ $( '.img-ultra' ).on( 'load', function() {
426
+ imgsLoaded++;
427
+ } ).attr( 'src', ultraSrc );
428
+
429
+ twentyMe = setInterval( function() {
430
+ if ( 4 !== imgsLoaded ) {
431
+ return;
432
+ }
433
 
434
+ $tt.twentytwenty({
435
+ handlePosition: 0.6,
436
+ orientation: 'horizontal',
437
+ labelBefore: originalLabel,
438
+ labelAfter: ultraLabel
439
+ }, function() {
440
+ // Fires on initialisation & each time the handle is moving.
441
+ if ( ! $tt.closest( '.imagify-modal-content' ).hasClass( 'loaded' ) ) {
442
+ $tt.closest( '.imagify-modal-content' ).removeClass( 'loading' ).addClass( 'loaded' );
443
+ drawMeAChart( $( '.imagify-level-ultra' ).find( '.imagify-chart' ).find( 'canvas' ) );
444
  }
445
+ } );
446
+
447
+ clearInterval( twentyMe );
448
+ twentyMe = null;
449
+ }, 75);
450
+
451
+ // On click on button choices.
452
+ $( '.imagify-comparison-title' ).on( 'click', '.twentytwenty-duo-buttons button:not(.selected)', function( e ) {
453
+ var $this = $( this ),
454
+ $container = $this.closest( '.imagify-comparison-title' ).nextAll( '.twentytwenty-wrapper' ).find( '.twentytwenty-container' ),
455
+ side = $this.closest( '.twentytwenty-duo-buttons' ).hasClass( 'twentytwenty-duo-left' ) ? 'left' : 'right',
456
+ $otherSide = 'left' === side ? $this.closest( '.imagify-comparison-title' ).find( '.twentytwenty-duo-right' ) : $this.closest( '.imagify-comparison-title' ).find( '.twentytwenty-duo-left' ),
457
+ $duo = $this.closest( '.twentytwenty-duo-buttons' ).find( 'button' ),
458
+ $imgBefore = $container.find( '.twentytwenty-before' ),
459
+ $imgAfter = $container.find( '.twentytwenty-after' ),
460
+ image = $this.data( 'img' ),
461
+ clipStyles;
462
+
463
+ e.stopPropagation();
464
+
465
+ // Button coloration.
466
+ $duo.removeClass( 'selected' );
467
+ $this.addClass( 'selected' );
468
+
469
+ // Other side action (to not compare same images).
470
+ if ( $otherSide.find( '.selected' ).data( 'img' ) === image ) {
471
+ $otherSide.find( 'button:not(.selected)' ).eq( 0 ).trigger( 'click' );
472
+ }
473
 
474
+ // Left buttons.
475
+ if ( 'left' === side ) {
476
+ clipStyles = $imgBefore.css( 'clip' );
477
+ $imgBefore.attr( 'style', '' );
478
+ $imgBefore.removeClass( 'twentytwenty-before' );
479
+ $container.find( '.img-' + image ).addClass( 'twentytwenty-before' ).css( 'clip', clipStyles );
480
+ $( '.twentytwenty-before-label' ).find( '.twentytwenty-label-content' ).text( $container.data( image + '-label' ) );
481
+ $( '.imagify-c-level.go-left' ).attr( 'aria-hidden', 'true' ).removeClass( 'go-left go-right' );
482
+ $( '.imagify-level-' + image ).attr( 'aria-hidden', 'false' ).addClass( 'go-left' );
483
+ }
484
 
485
+ // Right buttons.
486
+ if ( 'right' === side ) {
487
+ $imgAfter.removeClass( 'twentytwenty-after' );
488
+ $container.find( '.img-' + image ).addClass( 'twentytwenty-after' );
489
+ $( '.twentytwenty-after-label' ).find( '.twentytwenty-label-content' ).text( $container.data( image + '-label' ) );
490
+ $( '.imagify-c-level.go-right' ).attr( 'aria-hidden', 'true' ).removeClass( 'go-left go-right' );
491
+ $( '.imagify-level-' + image ).attr( 'aria-hidden', 'false' ).addClass( 'go-right' );
492
+ }
493
 
494
+ drawMeAChart( $( '.imagify-level-' + image ).find( '.imagify-chart' ).find( 'canvas' ) );
495
+ return false;
496
+ } );
497
+ } );
498
 
499
 
500
  /**
501
+ * Imagify comparison inside Media post visualization.
502
  */
503
+ if ( $( '.post-php' ).find( '.wp_attachment_image' ).find( '.thumbnail' ).length > 0 ) {
504
+
505
+ var $oriParent = $( '.post-php' ).find( '.wp_attachment_image' ),
506
+ $thumbnail = $oriParent.find( '.thumbnail' ),
507
+ thumb = { src: $thumbnail.prop( 'src' ), width: $thumbnail.width(), height: $thumbnail.height() },
508
+ oriSource = { src: $( '#imagify-full-original' ).val(), size: $( '#imagify-full-original-size' ).val() },
509
+ $optimizeBtn = $( '#misc-publishing-actions' ).find( '.misc-pub-imagify' ).find( '.button-primary' ),
510
+ widthLimit = 360,
511
+ filesize, saving;
512
+
513
+ // If shown image > 360, use twentytwenty.
514
+ if ( thumb.width > widthLimit && $( '#imagify-full-original' ).length > 0 && $( '#imagify-full-original' ).val() !== '' ) {
515
+
516
+ filesize = $( '.misc-pub-filesize' ).find( 'strong' ).text();
517
+ saving = $( '.imagify-data-item' ).find( '.imagify-chart-value' ).text();
518
+
519
+ // Create button to trigger.
520
+ $( '[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>' );
521
+
522
+ // Modal and trigger event creation.
523
+ imagifyTwentyModal( {
524
+ width: thumb.width,
525
+ height: thumb.height,
526
+ originalUrl: oriSource.src,
527
+ optimizedUrl: thumb.src,
528
+ originalSize: oriSource.size,
529
+ optimizedSize: filesize,
530
+ saving: saving,
531
+ modalAppendTo: $oriParent,
532
+ trigger: $( '#imagify-start-comparison' ),
533
+ modalId: 'imagify-visual-comparison'
534
+ } );
535
  }
536
+ // Else put images next to next.
537
+ else if ( thumb.width < widthLimit && $( '#imagify-full-original' ).length > 0 && $( '#imagify-full-original' ).val() !== '' ) {
538
  // TODO
539
  }
540
+ // If image has no backup.
541
+ else if ( $( '#imagify-full-original' ).length > 0 && $( '#imagify-full-original' ).val() === '' ) {
542
  // do nothing ?
543
  }
544
+ // In case image is not optimized.
545
  else {
546
+ // If is not in optimizing process, propose the Optimize button trigger.
547
+ if ( $( '#misc-publishing-actions' ).find( '.misc-pub-imagify' ).find( '.button-primary' ).length === 1 ) {
548
+ $( '[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="' + $optimizeBtn.attr( 'href' ) + '">' + imagifyTTT.labels.optimize + '</a>' );
549
 
550
+ $( '#imagify-optimize-trigger' ).on('click', function() {
551
+ $( this ).prev( '.spinner' ).removeClass( 'imagify-hidden' ).addClass( 'is-active' );
552
+ } );
553
  }
554
  }
555
 
556
  }
557
 
558
  /**
559
+ * Images comparison in attachments list page (upload.php).
560
  */
561
+ if ( $( '.upload-php' ).find( '.imagify-compare-images' ).length > 0 ) {
562
+
563
+ $( '.imagify-compare-images' ).each( function() {
564
+ var $this = $( this ),
565
+ id = $this.data( 'id' ),
566
+ $datas = $this.closest( '#post-' + id ).find( '.column-imagify_optimized_file' );
567
+
568
+ // Modal and trigger event creation.
569
+ imagifyTwentyModal( {
570
+ width: $this.data( 'full-width' ),
571
+ height: $this.data( 'full-height' ),
572
+ originalUrl: $this.data( 'backup-src' ),
573
+ optimizedUrl: $this.data( 'full-src' ),
574
+ originalSize: $datas.find( '.original' ).text(),
575
+ optimizedSize: $datas.find( '.imagify-data-item' ).find( '.big' ).text(),
576
+ saving: $datas.find( '.imagify-chart-value' ).text(),
577
+ modalAppendTo: $this.closest( '.column-primary' ),
578
+ trigger: $this,
579
+ modalId: 'imagify-comparison-' + id
580
+ } );
581
+ } );
 
 
582
  }
583
 
584
  /**
585
+ * Images Comparison in Grid View modal.
586
  */
587
  if ( $('.upload-php').length > 0 ) {
588
 
589
+ var getVar = function ( param ) {
 
590
  var vars = {};
591
+
592
+ w.location.href.replace(
593
+ /[?&]+([^=&]+)=?([^&]*)?/gi,//
594
+ function( m, key, value ) {
595
+ vars[ key ] = undefined !== value ? value : '';
596
  }
597
  );
598
 
599
  if ( param ) {
600
+ return vars[ param ] ? vars[ param ] : null;
601
  }
602
  return vars;
603
  },
604
+ imagifyContentInModal = function() {
605
+ var tempTimer = setInterval( function() {
606
+ var $datas;
607
+
608
+ if ( ! $( '.media-modal' ).find( '.imagify-datas-details' ).length ) {
609
+ return;
610
+ }
611
+
612
+ if ( $( '#imagify-original-src' ).length > 0 && $( '#imagify-original-src' ) !== '' ) {
613
+ // Trigger creation.
614
+ $( '.media-frame-content' ).find( '.attachment-actions' ).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>' );
615
+
616
+ // Get datas.
617
+ $datas = $( '.media-frame-content' ).find( '.compat-field-imagify' );
618
+
619
+ // Modal and trigger event creation.
620
+ imagifyTwentyModal( {
621
+ width: $( '#imagify-full-width' ).val(),
622
+ height: $( '#imagify-full-height' ).val(),
623
+ originalUrl: $( '#imagify-original-src' ).val(),
624
+ optimizedUrl: $( '#imagify-full-src' ).val(),
625
+ originalSize: $( '#imagify-original-size' ).val(),
626
+ optimizedSize: $datas.find( '.imagify-data-item' ).find( '.big' ).text(),
627
+ saving: $datas.find( '.imagify-chart-value' ).text(),
628
+ modalAppendTo: $( '.media-frame-content' ).find( '.thumbnail-image' ),
629
+ trigger: $( '#imagify-media-frame-comparison-btn' ),
630
+ modalId: 'imagify-comparison-modal',
631
+ openModal: true
632
+ } );
 
633
  }
634
+
635
+ clearInterval( tempTimer );
636
+ tempTimer = null;
637
  }, 20 );
638
  },
639
  waitContent = setInterval( function() {
640
+ if ( ! $('.upload-php').find('.media-frame.mode-grid').find('.attachments').length ) {
641
+ return;
642
+ }
643
+
644
+ // If attachment is clicked, build the modal inside the modal.
645
+ $( '.upload-php' ).find( '.media-frame.mode-grid' ).on( 'click', '.attachment', function() {
646
+ imagifyContentInModal();
647
+ } );
 
 
 
648
 
649
+ // If attachment is mentionned in URL, build the modal inside the modal.
650
+ if ( getVar( 'item' ) ) {
651
+ imagifyContentInModal();
652
  }
 
653
 
654
+ clearInterval( waitContent );
655
+ waitContent = null;
656
+ }, 100 );
657
+ // If URL contain item, that will open the WP Modal View.
658
  }
659
 
660
+ } )(jQuery, document, window);
assets/js/jquery.twentytwenty.min.js CHANGED
@@ -1,28 +1 @@
1
- (function(a,n,q){n.fn.twentytwenty=function(k,v){k=n.extend({handlePosition:.5,orientation:"horizontal",labelBefore:"Before",labelAfter:"After"},k);return this.each(function(){var f=k.handlePosition,c=n(this),d=k.orientation,p="vertical"===d?"down":"left",t="vertical"===d?"up":"right",l=c.find("img:first"),q=c.find("img:last");c.wrap('<div class="twentytwenty-wrapper twentytwenty-'+d+'"></div>');c.append('<div class="twentytwenty-overlay"></div>');c.append('<div class="twentytwenty-handle"></div>');
2
- var h=c.find(".twentytwenty-handle");h.append('<span class="twentytwenty-'+p+'-arrow"></span>');h.append('<span class="twentytwenty-'+t+'-arrow"></span>');c.addClass("twentytwenty-container");l.addClass("twentytwenty-before");q.addClass("twentytwenty-after");p=c.find(".twentytwenty-overlay");p.append('<div class="twentytwenty-labels twentytwenty-before-label"><span class="twentytwenty-label-content">'+k.labelBefore+"</span></div>");p.append('<div class="twentytwenty-labels twentytwenty-after-label"><span class="twentytwenty-label-content">'+
3
- k.labelAfter+"</span></div>");var w=function(a){var b,A,g;g=l.width();var y=l.height();b=g+"px";A=y+"px";g=a*g+"px";a=a*y+"px";h.css("vertical"===d?"top":"left","vertical"===d?a:g);y=c.find(".twentytwenty-before");"vertical"===d?y.css("clip","rect(0,"+b+","+a+",0)"):y.css("clip","rect(0,"+g+","+A+",0)");c.css("height",A);"function"===typeof v&&v()},x=0,u=0,r=0,b=0;n(a).on("resize.twentytwenty",function(a){w(f)});h.on("movestart",function(a){(a.distX>a.distY&&a.distX<-a.distY||a.distX<a.distY&&a.distX>
4
- -a.distY)&&"vertical"!==d?a.preventDefault():(a.distX<a.distY&&a.distX<-a.distY||a.distX>a.distY&&a.distX>-a.distY)&&"vertical"===d&&a.preventDefault();c.addClass("active");x=c.offset().left;u=c.offset().top;r=l.width();b=l.height()});h.on("moveend",function(a){c.removeClass("active")});h.on("move",function(a){c.hasClass("active")&&(f="vertical"===d?(a.pageY-u)/b:(a.pageX-x)/r,0>f&&(f=0),1<f&&(f=1),w(f))});c.find("img").on("mousedown",function(a){a.preventDefault()});n(a).trigger("resize.twentytwenty")})}})(window,
5
- jQuery);
6
- (function(a,n,q,k){var v=function(b){b.each(function(){var b=parseInt(a(this).closest(".imagify-chart").next(".imagify-chart-value").text()),b=[{value:b,color:"#00B3D3"},{value:100-b,color:"#D8D8D8"}];(new Chart(a(this)[0].getContext("2d"))).Doughnut(b,{segmentStrokeColor:"#2A2E3C",segmentStrokeWidth:1,animateRotate:!0,percentageInnerCutout:60,tooltipEvents:[]})})},f=function(b){b=b.data("target")||b.attr("href");a(b).css("display","flex").hide().fadeIn(400).attr("aria-hidden","false").attr("tabindex","0").focus().removeAttr("tabindex").addClass("modal-is-open");
7
- a("body").addClass("imagify-modal-is-open")},c=function(b){var c={width:0,height:0,original_url:"",optimized_url:"",original_size:0,optimized_size:0,saving:0,modal_append_to:a("body"),trigger:a('[data-target="imagify-visual-comparison"]'),modal_id:"imagify-visual-comparison",open_modal:!1},e=a.extend({},c,b);if(0===e.width||0===e.height||""===e.original_url||""===e.optimized_url||0===e.original_size||0===e.optimized_size||0===e.saving)return"error";e.modal_append_to.append('<div id="'+e.modal_id+
8
- '" class="imagify-modal imagify-visual-comparison" aria-hidden="true"><div class="imagify-modal-content loading"><div class="twentytwenty-container"><img class="imagify-img-before" alt="" width="'+e.width+'" height="'+e.height+'"><img class="imagify-img-after" alt="" width="'+e.width+'" height="'+e.height+'"></div><div class="imagify-comparison-levels"><div class="imagify-c-level imagify-level-original go-left"><p class="imagify-c-level-row"><span class="label">'+imagifyTTT.labels.filesize+'</span><span class="value level">'+
9
- e.original_size+'</span></p></div><div class="imagify-c-level imagify-level-optimized go-right"><p class="imagify-c-level-row"><span class="label">'+imagifyTTT.labels.filesize+'</span><span class="value level">'+e.optimized_size+'</span></p><p class="imagify-c-level-row"><span class="label">'+imagifyTTT.labels.saving+'</span><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">'+
10
- e.saving+'</span>%</span></p></div></div><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></div></div>");e.trigger.on("click.imagify",function(){var b=a(a(this).data("target")),c=0;"function"===typeof f&&e.open_modal&&f(a(this));b.find(".imagify-modal-content").css({width:.85*a(n).outerWidth()+"px","max-width":e.width});b.find(".imagify-img-before").on("load",function(){c++}).attr("src",
11
- e.original_url);b.find(".imagify-img-after").on("load",function(){c++}).attr("src",e.optimized_url);var m=b.find(".twentytwenty-container"),d=setInterval(function(){if(2===c)return m.twentytwenty({handlePosition:.3,orientation:"horizontal",labelBefore:imagifyTTT.labels.original_l,labelAfter:imagifyTTT.labels.optimized_l},function(){var e=a(n).height(),c=b.find(".twentytwenty-container").height(),d=b.find(".twentytwenty-wrapper").position().top;m.closest(".imagify-modal-content").hasClass("loaded")||
12
- (m.closest(".imagify-modal-content").removeClass("loading").addClass("loaded"),v(b.find(".imagify-level-optimized").find(".imagify-chart").find("canvas")));if(e<c&&!b.hasClass("modal-is-too-high")){b.addClass("modal-is-too-high");var g=b.find(".twentytwenty-handle"),f=b.find(".twentytwenty-label-content"),h=b.find(".imagify-comparison-levels"),c=h.outerHeight(),k=(e-d-g.height())/2,l=e-3*d-c;g.css({top:k});f.css({top:l,bottom:"auto"});b.find(".twentytwenty-wrapper").css({paddingBottom:c});b.find(".imagify-modal-content").on("scroll.imagify",
13
- function(){g.css({top:k+a(this).scrollTop()});f.css({top:l+a(this).scrollTop()});h.css({bottom:-a(this).scrollTop()})})}}),clearInterval(d),d=null,"done"},75);return!1})};a(".imagify-visual-comparison-btn").on("click",function(){if(1!==a(".twentytwenty-wrapper").length&&(a(a(this).data("target")).find(".imagify-modal-content").css("width",.95*a(n).outerWidth()+"px"),0<a(".twentytwenty-container").length&&800<a(n).outerWidth())){var b=a(".twentytwenty-container"),c=0,e=b.data("loader"),d=b.data("label-original"),
14
- g=b.data("label-normal"),f=b.data("label-aggressive"),h=b.data("label-ultra"),k=b.data("original-label").replace(/\*\*/,"<strong>").replace(/\*\*/,"</strong>"),l=b.data("original-alt"),q=b.data("original-img"),p=b.data("original-dim").split("x");b.data("normal-label").replace(/\*\*/,"<strong>").replace(/\*\*/,"</strong>");var t=b.data("normal-alt"),u=b.data("normal-img"),r=b.data("normal-dim").split("x");b.data("aggressive-label").replace(/\*\*/,"<strong>").replace(/\*\*/,"</strong>");var w=b.data("aggressive-alt"),
15
- x=b.data("aggressive-img"),B=b.data("aggressive-dim").split("x"),z=b.data("ultra-label").replace(/\*\*/,"<strong>").replace(/\*\*/,"</strong>"),E=b.data("ultra-alt"),F=b.data("ultra-img"),C=b.data("ultra-dim").split("x"),d='<span class="twentytwenty-duo-buttons twentytwenty-duo-left"><button type="button" class="imagify-comparison-original selected" data-img="original">'+d+'</button><button type="button" class="imagify-comparison-normal" data-img="normal">'+g+'</button><button type="button" class="imagify-comparison-aggressive" data-img="aggressive">'+
16
- f+"</button></span>",g='<span class="twentytwenty-duo-buttons twentytwenty-duo-right"><button type="button" class="imagify-comparison-normal" data-img="normal">'+g+'</button><button type="button" class="imagify-comparison-aggressive" data-img="aggressive">'+f+'</button><button type="button" class="imagify-comparison-ultra selected" data-img="ultra">'+h+"</button></span>";b.before('<img class="loader" src="'+e+'" alt="Loading\u2026" width="64" height="64">');e=a(".twentytwenty-left-buttons").lenght?
17
- d+g:"";a(".twentytwenty-left-buttons").append(d);a(".twentytwenty-right-buttons").append(g);b.closest(".imagify-modal-content").addClass("loading").find(".twentytwenty-container").append('<img class="img-original" alt="'+l+'" width="'+p[0]+'" height="'+p[1]+'"><img class="img-normal" alt="'+t+'" width="'+r[0]+'" height="'+r[1]+'"><img class="img-aggressive" alt="'+w+'" width="'+B[0]+'" height="'+B[1]+'"><img class="img-ultra" alt="'+E+'" width="'+C[0]+'" height="'+C[1]+'">'+e);a(".img-original").on("load",
18
- function(){c++}).attr("src",q);a(".img-normal").on("load",function(){c++}).attr("src",u);a(".img-aggressive").on("load",function(){c++}).attr("src",x);a(".img-ultra").on("load",function(){c++}).attr("src",F);var D=setInterval(function(){4===c&&(b.twentytwenty({handlePosition:.6,orientation:"horizontal",labelBefore:k,labelAfter:z},function(){b.closest(".imagify-modal-content").hasClass("loaded")||(b.closest(".imagify-modal-content").removeClass("loading").addClass("loaded"),v(a(".imagify-level-ultra").find(".imagify-chart").find("canvas")))}),
19
- clearInterval(D),D=null)},75);a(".imagify-comparison-title").on("click",".twentytwenty-duo-buttons button:not(.selected)",function(b){b.stopPropagation();var c=a(this);b=c.closest(".imagify-comparison-title").nextAll(".twentytwenty-wrapper").find(".twentytwenty-container");var e=c.closest(".twentytwenty-duo-buttons").hasClass("twentytwenty-duo-left")?"left":"right",d="left"===e?c.closest(".imagify-comparison-title").find(".twentytwenty-duo-right"):c.closest(".imagify-comparison-title").find(".twentytwenty-duo-left"),
20
- g=c.closest(".twentytwenty-duo-buttons").find("button"),f=b.find(".twentytwenty-before"),h=b.find(".twentytwenty-after"),m=c.data("img");g.removeClass("selected");c.addClass("selected");d.find(".selected").data("img")===m&&d.find("button:not(.selected)").eq(0).trigger("click");"left"===e&&(c=f.css("clip"),f.attr("style",""),f.removeClass("twentytwenty-before"),b.find(".img-"+m).addClass("twentytwenty-before").css("clip",c),a(".twentytwenty-before-label").find(".twentytwenty-label-content").text(b.data(m+
21
- "-label")),a(".imagify-c-level.go-left").attr("aria-hidden","true").removeClass("go-left go-right"),a(".imagify-level-"+m).attr("aria-hidden","false").addClass("go-left"));"right"===e&&(h.removeClass("twentytwenty-after"),b.find(".img-"+m).addClass("twentytwenty-after"),a(".twentytwenty-after-label").find(".twentytwenty-label-content").text(b.data(m+"-label")),a(".imagify-c-level.go-right").attr("aria-hidden","true").removeClass("go-left go-right"),a(".imagify-level-"+m).attr("aria-hidden","false").addClass("go-right"));
22
- v(a(".imagify-level-"+m).find(".imagify-chart").find("canvas"));return!1})}});if(0<a(".post-php").find(".wp_attachment_image").find(".thumbnail").length){q=a(".post-php").find(".wp_attachment_image");var d=q.find(".thumbnail"),p=d.prop("src"),t=d.width(),d=d.height(),l=a("#imagify-full-original").val(),z=a("#imagify-full-original-size").val(),h=a("#misc-publishing-actions").find(".misc-pub-imagify").find(".button-primary");if(360<t&&0<a("#imagify-full-original").length&&""!==a("#imagify-full-original").val()){var h=
23
- a(".misc-pub-filesize").find("strong").text(),w=a(".imagify-data-item").find(".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>");c({width:t,height:d,original_url:l,optimized_url:p,original_size:z,optimized_size:h,saving:w,modal_append_to:q,trigger:a("#imagify-start-comparison"),modal_id:"imagify-visual-comparison"})}else 360>
24
- t&&0<a("#imagify-full-original").length&&""!==a("#imagify-full-original").val()||0<a("#imagify-full-original").length&&""===a("#imagify-full-original").val()||1!==a("#misc-publishing-actions").find(".misc-pub-imagify").find(".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="'+h.attr("href")+'">'+imagifyTTT.labels.optimize+"</a>"),
25
- a("#imagify-optimize-trigger").on("click",function(){a(this).prev(".spinner").removeClass("imagify-hidden").addClass("is-active")}))}0<a(".upload-php").find(".imagify-compare-images").length&&a(".imagify-compare-images").each(function(){var b=a(this),d=b.data("id"),e=b.closest("#post-"+d).find(".column-imagify_optimized_file");c({width:b.data("full-width"),height:b.data("full-height"),original_url:b.data("backup-src"),optimized_url:b.data("full-src"),original_size:e.find(".original").text(),optimized_size:e.find(".imagify-data-item").find(".big").text(),
26
- saving:e.find(".imagify-chart-value").text(),modal_append_to:b.closest(".column-primary"),trigger:b,modal_id:"imagify-comparison-"+d})});if(0<a(".upload-php").length)var x=function(a){var c={};n.location.href.replace(/[?&]+([^=&]+)=?([^&]*)?/gi,function(a,b,d){c[b]=d!==k?d:""});return a?c[a]?c[a]:null:c},u=function(){var b=setInterval(function(){if(a(".media-modal").find(".imagify-datas-details").length){if(0<a("#imagify-original-src").length&&""!==a("#imagify-original-src")){a(".media-frame-content").find(".attachment-actions").prepend('<button type="button" class="imagify-button-primary button-primary imagify-modal-trigger" data-target="#imagify-comparison-modal" id="imagify-media-frame-comparison-btn">'+
27
- imagifyTTT.labels.compare+"</button>");var d=a(".media-frame-content").find(".compat-field-imagify");c({width:a("#imagify-full-width").val(),height:a("#imagify-full-height").val(),original_url:a("#imagify-original-src").val(),optimized_url:a("#imagify-full-src").val(),original_size:a("#imagify-original-size").val(),optimized_size:d.find(".imagify-data-item").find(".big").text(),saving:d.find(".imagify-chart-value").text(),modal_append_to:a(".media-frame-content").find(".thumbnail-image"),trigger:a("#imagify-media-frame-comparison-btn"),
28
- modal_id:"imagify-comparison-modal",open_modal:!0})}clearInterval(b);b=null}},20)},r=setInterval(function(){0<a(".upload-php").find(".media-frame.mode-grid").find(".attachments").length&&(a(".upload-php").find(".media-frame.mode-grid").on("click",".attachment",function(){u()}),x("item")&&u(),clearInterval(r),r=null)},100)})(jQuery,window,document);
1
+ window.imagify=window.imagify||{concat:ajaxurl.indexOf("?")>0?"&":"?",log:function(a){void 0!==console&&console.log(a)},info:function(a){void 0!==console&&console.info(a)}},function(a,b,c,d){a.fn.twentytwenty=function(b,c){return b=a.extend({handlePosition:.5,orientation:"horizontal",labelBefore:"Before",labelAfter:"After"},b),this.each(function(){var d=b.handlePosition,e=a(this),f=b.orientation,g="vertical"===f?"down":"left",h="vertical"===f?"up":"right",i=e.find("img:first"),j=e.find("img:last");e.wrap('<div class="twentytwenty-wrapper twentytwenty-'+f+'"></div>'),e.append('<div class="twentytwenty-overlay"></div>'),e.append('<div class="twentytwenty-handle"></div>');var k=e.find(".twentytwenty-handle");k.append('<span class="twentytwenty-'+g+'-arrow"></span>'),k.append('<span class="twentytwenty-'+h+'-arrow"></span>'),e.addClass("twentytwenty-container"),i.addClass("twentytwenty-before"),j.addClass("twentytwenty-after");var l=e.find(".twentytwenty-overlay");l.append('<div class="twentytwenty-labels twentytwenty-before-label"><span class="twentytwenty-label-content">'+b.labelBefore+"</span></div>"),l.append('<div class="twentytwenty-labels twentytwenty-after-label"><span class="twentytwenty-label-content">'+b.labelAfter+"</span></div>");var m=function(a){var b=i.width(),c=i.height();return{w:b+"px",h:c+"px",cw:a*b+"px",ch:a*c+"px"}},n=function(a){var b=e.find(".twentytwenty-before");"vertical"===f?b.css("clip","rect(0,"+a.w+","+a.ch+",0)"):b.css("clip","rect(0,"+a.cw+","+a.h+",0)"),e.css("height",a.h),"function"==typeof c&&c()},o=function(a){var b=m(a);k.css("vertical"===f?"top":"left","vertical"===f?b.ch:b.cw),n(b)},p=0,q=0,r=0,s=0;a(window).on("resize.twentytwenty",function(){o(d)}),k.on("movestart",function(a){(a.distX>a.distY&&a.distX<-a.distY||a.distX<a.distY&&a.distX>-a.distY)&&"vertical"!==f?a.preventDefault():(a.distX<a.distY&&a.distX<-a.distY||a.distX>a.distY&&a.distX>-a.distY)&&"vertical"===f&&a.preventDefault(),e.addClass("active"),p=e.offset().left,q=e.offset().top,r=i.width(),s=i.height()}),k.on("moveend",function(){e.removeClass("active")}),k.on("move",function(a){e.hasClass("active")&&(d="vertical"===f?(a.pageY-q)/s:(a.pageX-p)/r,d<0&&(d=0),d>1&&(d=1),o(d))}),e.find("img").on("mousedown",function(a){a.preventDefault()}),a(window).trigger("resize.twentytwenty")})}}(jQuery,document,window),function(a,b,c,d){var e=function(b){b.each(function(){var b=a(this),c=parseInt(b.closest(".imagify-chart").next(".imagify-chart-value").text()),d=[{value:c,color:"#00B3D3"},{value:100-c,color:"#D8D8D8"}];new Chart(b[0].getContext("2d")).Doughnut(d,{segmentStrokeColor:"#2A2E3C",segmentStrokeWidth:1,animateRotate:!0,percentageInnerCutout:60,tooltipEvents:[]})})},f=function(b){var c=b.data("target")||b.attr("href");a(c).css("display","flex").hide().fadeIn(400).attr("aria-hidden","false").attr("tabindex","0").focus().removeAttr("tabindex").addClass("modal-is-open"),a("body").addClass("imagify-modal-is-open")},g=function(b){var d,g={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},h=a.extend({},g,b);if(0===h.width||0===h.height||""===h.originalUrl||""===h.optimizedUrl||0===h.originalSize||0===h.optimizedSize||0===h.saving)return"error";d='<div id="'+h.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="'+h.width+'" height="'+h.height+'">',d+='<img class="imagify-img-after" alt="" width="'+h.width+'" height="'+h.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">'+h.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">'+h.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">'+h.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>",h.modalAppendTo.append(d),h.trigger.on("click.imagify",function(){var b,d,g=a(a(this).data("target")),i=0;return"function"==typeof f&&h.openModal&&f(a(this)),g.find(".imagify-modal-content").css({width:.85*a(c).outerWidth()+"px","max-width":h.width}),g.find(".imagify-img-before").on("load",function(){i++}).attr("src",h.originalUrl),g.find(".imagify-img-after").on("load",function(){i++}).attr("src",h.optimizedUrl),b=g.find(".twentytwenty-container"),d=setInterval(function(){if(2===i)return b.twentytwenty({handlePosition:.3,orientation:"horizontal",labelBefore:imagifyTTT.labels.original_l,labelAfter:imagifyTTT.labels.optimized_l},function(){var d,f,h,i,j,k,l=a(c).height(),m=g.find(".twentytwenty-container").height(),n=g.find(".twentytwenty-wrapper").position().top;b.closest(".imagify-modal-content").hasClass("loaded")||(b.closest(".imagify-modal-content").removeClass("loading").addClass("loaded"),e(g.find(".imagify-level-optimized").find(".imagify-chart").find("canvas"))),l<m&&!g.hasClass("modal-is-too-high")&&(g.addClass("modal-is-too-high"),d=g.find(".twentytwenty-handle"),f=g.find(".twentytwenty-label-content"),h=g.find(".imagify-comparison-levels"),i=h.outerHeight(),j=(l-n-d.height())/2,k=l-3*n-i,d.css({top:j}),f.css({top:k,bottom:"auto"}),g.find(".twentytwenty-wrapper").css({paddingBottom:i}),g.find(".imagify-modal-content").on("scroll.imagify",function(){var b=a(this).scrollTop();d.css({top:j+b}),f.css({top:k+b}),h.css({bottom:-b})}))}),clearInterval(d),d=null,"done"},75),!1})};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").find(".imagify-chart").find("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");return b.stopPropagation(),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").find(".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").find(".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).find(".imagify-chart").find("canvas")),!1})))}),a(".post-php").find(".wp_attachment_image").find(".thumbnail").length>0){var h,i,j=a(".post-php").find(".wp_attachment_image"),k=j.find(".thumbnail"),l={src:k.prop("src"),width:k.width(),height:k.height()},m={src:a("#imagify-full-original").val(),size:a("#imagify-full-original-size").val()},n=a("#misc-publishing-actions").find(".misc-pub-imagify").find(".button-primary");l.width>360&&a("#imagify-full-original").length>0&&""!==a("#imagify-full-original").val()?(h=a(".misc-pub-filesize").find("strong").text(),i=a(".imagify-data-item").find(".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>"),g({width:l.width,height:l.height,originalUrl:m.src,optimizedUrl:l.src,originalSize:m.size,optimizedSize:h,saving:i,modalAppendTo:j,trigger:a("#imagify-start-comparison"),modalId:"imagify-visual-comparison"})):l.width<360&&a("#imagify-full-original").length>0&&""!==a("#imagify-full-original").val()||a("#imagify-full-original").length>0&&""===a("#imagify-full-original").val()||1===a("#misc-publishing-actions").find(".misc-pub-imagify").find(".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="'+n.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").find(".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");g({width:b.data("full-width"),height:b.data("full-height"),originalUrl:b.data("backup-src"),optimizedUrl:b.data("full-src"),originalSize:d.find(".original").text(),optimizedSize:d.find(".imagify-data-item").find(".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 o=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},p=function(){var b=setInterval(function(){var c;a(".media-modal").find(".imagify-datas-details").length&&(a("#imagify-original-src").length>0&&""!==a("#imagify-original-src")&&(a(".media-frame-content").find(".attachment-actions").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").find(".compat-field-imagify"),g({width:a("#imagify-full-width").val(),height:a("#imagify-full-height").val(),originalUrl:a("#imagify-original-src").val(),optimizedUrl:a("#imagify-full-src").val(),originalSize:a("#imagify-original-size").val(),optimizedSize:c.find(".imagify-data-item").find(".big").text(),saving:c.find(".imagify-chart-value").text(),modalAppendTo:a(".media-frame-content").find(".thumbnail-image"),trigger:a("#imagify-media-frame-comparison-btn"),modalId:"imagify-comparison-modal",openModal:!0})),clearInterval(b),b=null)},20)},q=setInterval(function(){a(".upload-php").find(".media-frame.mode-grid").find(".attachments").length&&(a(".upload-php").find(".media-frame.mode-grid").on("click",".attachment",function(){p()}),o("item")&&p(),clearInterval(q),q=null)},100)}(jQuery,document,window);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/options.js CHANGED
@@ -1,103 +1,123 @@
1
- jQuery(function($){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /*
3
  * Process an API key check validity.
4
  */
5
  var busy = false,
6
- xhr = false;
7
-
8
- var concat = ajaxurl.indexOf("?") > 0 ? "&" : "?";
9
 
10
- $('#imagify-settings #api_key').blur(function(){
11
- var obj = $(this),
12
  value = obj.val();
13
 
14
- if( $.trim(value) === '' ) {
15
  return false;
16
  }
17
 
18
- if( $('#check_api_key').val() === value ) {
19
- $('#imagify-check-api-container').html('<span class="dashicons dashicons-yes"></span> ' + imagifyAdmin.labels.ValidApiKeyText);
20
  return false;
21
  }
22
 
23
  if ( true === busy ) {
24
  xhr.abort();
25
  } else {
26
- $('#imagify-check-api-container').remove();
27
- obj.after( '<span id="imagify-check-api-container"><span class="imagify-spinner"></span>' + imagifyAdmin.labels.waitApiKeyCheckText + "</span>" );
28
  }
29
 
30
  busy = true;
31
 
32
- xhr = $.get(ajaxurl+concat+"action=imagify_check_api_key_validity&api_key="+obj.val()+"&imagifycheckapikeynonce="+$('#imagifycheckapikeynonce').val())
33
- .done(function(response){
34
- if( !response.success ) {
35
- $('#imagify-check-api-container').html( '<span class="dashicons dashicons-no"></span> ' + response.data);
36
  } else {
37
- $('#imagify-check-api-container').remove();
38
- swal({
39
- title: imagifyAdmin.labels.ApiKeyCheckSuccessTitle,
40
- html: imagifyAdmin.labels.ApiKeyCheckSuccessText,
41
- type: "success",
42
- customClass: "imagify-sweet-alert"
43
- }).then(
44
- function(){
45
  location.reload();
46
- });
47
  }
48
 
49
  busy = false;
50
- });
51
- });
52
 
53
  /**
54
- * Check the boxes by clicking "labels" (aria-describedby items)
55
  */
56
- $('.imagify-options-line').css('cursor', 'pointer').on('click', function(e){
57
- if ( e.target.nodeName === 'INPUT' ) {
58
  return;
59
  }
60
- $('input[aria-describedby="' + $(this).attr('id') + '"]').trigger('click');
61
  return false;
62
- });
 
 
 
63
 
64
- $('.imagify-settings th span').on('click', function(e){
65
- if ( $(this).parent().next('td').find('input:checkbox').length === 1 ) {
66
- $(this).parent().next('td').find('input:checkbox').trigger('click');
67
  }
68
- })
69
 
70
  /**
71
- * Auto check on options-line input value change
72
  */
73
- $('.imagify-options-line').find('input').on('change focus', function(){
74
- var $checkbox = $(this).closest('.imagify-options-line').prev('label').prev('input');
 
75
  if ( ! $checkbox[0].checked ) {
76
- $checkbox.prop('checked', true);
77
  }
78
- });
79
 
80
  /**
81
- * Imagify Backup alert
82
  */
83
- $('.imagify-settings-section').find('#backup').on('change', function(){
84
- if ( ! $(this).is(':checked') ) {
85
- var $_this = $(this);
86
- swal({
87
- title: imagifyOptions.noBackupTitle,
88
- html: imagifyOptions.noBackupText,
89
- type: "warning",
90
- customClass: "imagify-sweet-alert",
91
- showCancelButton: true,
92
- cancelButtonText: imagifyAdmin.labels.swalCancel,
93
- reverseButtons: true,
94
- }).then(
95
- function() {
96
- },
97
- function(dismiss){
98
- $_this.prop('checked', true);
99
- });
100
  }
101
- });
102
 
103
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* globals ajaxurl: false, console: false, imagify: true, imagifyAdmin: true, imagifyOptions: true, swal: false */
2
+
3
+ window.imagify = window.imagify || {
4
+ concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?',
5
+ log: function( content ) {
6
+ if ( undefined !== console ) {
7
+ console.log( content );
8
+ }
9
+ },
10
+ info: function( content ) {
11
+ if ( undefined !== console ) {
12
+ console.info( content );
13
+ }
14
+ }
15
+ };
16
+
17
+ (function($, d, w, undefined) {
18
  /*
19
  * Process an API key check validity.
20
  */
21
  var busy = false,
22
+ xhr = false;
 
 
23
 
24
+ $( '#imagify-settings #api_key' ).on( 'blur', function() {
25
+ var obj = $( this ),
26
  value = obj.val();
27
 
28
+ if ( $.trim( value ) === '' ) {
29
  return false;
30
  }
31
 
32
+ if ( $( '#check_api_key' ).val() === value ) {
33
+ $( '#imagify-check-api-container' ).html( '<span class="dashicons dashicons-yes"></span> ' + imagifyAdmin.labels.ValidApiKeyText );
34
  return false;
35
  }
36
 
37
  if ( true === busy ) {
38
  xhr.abort();
39
  } else {
40
+ $( '#imagify-check-api-container' ).remove();
41
+ obj.after( '<span id="imagify-check-api-container"><span class="imagify-spinner"></span>' + imagifyAdmin.labels.waitApiKeyCheckText + '</span>' );
42
  }
43
 
44
  busy = true;
45
 
46
+ xhr = $.get( ajaxurl + imagify.concat + 'action=imagify_check_api_key_validity&api_key=' + obj.val() + '&imagifycheckapikeynonce=' + $( '#imagifycheckapikeynonce' ).val() )
47
+ .done( function( response ) {
48
+ if ( ! response.success ) {
49
+ $( '#imagify-check-api-container' ).html( '<span class="dashicons dashicons-no"></span> ' + response.data );
50
  } else {
51
+ $( '#imagify-check-api-container' ).remove();
52
+ swal( {
53
+ title: imagifyAdmin.labels.ApiKeyCheckSuccessTitle,
54
+ html: imagifyAdmin.labels.ApiKeyCheckSuccessText,
55
+ type: 'success',
56
+ customClass: 'imagify-sweet-alert'
57
+ } ).then(
58
+ function() {
59
  location.reload();
60
+ } );
61
  }
62
 
63
  busy = false;
64
+ } );
65
+ } );
66
 
67
  /**
68
+ * Check the boxes by clicking "labels" (aria-describedby items).
69
  */
70
+ $( '.imagify-options-line' ).css( 'cursor', 'pointer' ).on( 'click', function( e ) {
71
+ if ( 'INPUT' === e.target.nodeName ) {
72
  return;
73
  }
74
+ $( 'input[aria-describedby="' + $( this ).attr( 'id' ) + '"]' ).trigger( 'click' );
75
  return false;
76
+ } );
77
+
78
+ $( '.imagify-settings th span' ).on( 'click', function() {
79
+ var $input = $( this ).parent().next( 'td' ).find( 'input:checkbox' );
80
 
81
+ if ( $input.length === 1 ) {
82
+ $input.trigger( 'click' );
 
83
  }
84
+ } );
85
 
86
  /**
87
+ * Auto check on options-line input value change.
88
  */
89
+ $( '.imagify-options-line' ).find( 'input' ).on( 'change focus', function() {
90
+ var $checkbox = $( this ).closest( '.imagify-options-line' ).prev( 'label' ).prev( 'input' );
91
+
92
  if ( ! $checkbox[0].checked ) {
93
+ $checkbox.prop( 'checked', true );
94
  }
95
+ } );
96
 
97
  /**
98
+ * Imagify Backup alert.
99
  */
100
+ $( '.imagify-settings-section' ).find( '#backup' ).on( 'change', function() {
101
+ var $_this = $( this );
102
+
103
+ if ( $_this.is( ':checked' ) ) {
104
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
105
  }
 
106
 
107
+ swal( {
108
+ title: imagifyOptions.noBackupTitle,
109
+ html: imagifyOptions.noBackupText,
110
+ type: 'warning',
111
+ customClass: 'imagify-sweet-alert',
112
+ showCancelButton: true,
113
+ cancelButtonText: imagifyAdmin.labels.swalCancel,
114
+ reverseButtons: true
115
+ } ).then(
116
+ function() {},
117
+ function() {
118
+ $_this.prop( 'checked', true );
119
+ }
120
+ );
121
+ } );
122
+
123
+ } )(jQuery, document, window);
assets/js/options.min.js CHANGED
@@ -1,4 +1 @@
1
- jQuery(function(a){var c=!1,d=!1,f=0<ajaxurl.indexOf("?")?"&":"?";a("#imagify-settings #api_key").blur(function(){var b=a(this),e=b.val();if(""===a.trim(e))return!1;if(a("#check_api_key").val()===e)return a("#imagify-check-api-container").html('<span class="dashicons dashicons-yes"></span> '+imagifyAdmin.labels.ValidApiKeyText),!1;!0===c?d.abort():(a("#imagify-check-api-container").remove(),b.after('<span id="imagify-check-api-container"><span class="imagify-spinner"></span>'+imagifyAdmin.labels.waitApiKeyCheckText+
2
- "</span>"));c=!0;d=a.get(ajaxurl+f+"action=imagify_check_api_key_validity&api_key="+b.val()+"&imagifycheckapikeynonce="+a("#imagifycheckapikeynonce").val()).done(function(b){b.success?(a("#imagify-check-api-container").remove(),swal({title:imagifyAdmin.labels.ApiKeyCheckSuccessTitle,html:imagifyAdmin.labels.ApiKeyCheckSuccessText,type:"success",customClass:"imagify-sweet-alert"}).then(function(){location.reload()})):a("#imagify-check-api-container").html('<span class="dashicons dashicons-no"></span> '+
3
- b.data);c=!1})});a(".imagify-options-line").css("cursor","pointer").on("click",function(b){if("INPUT"!==b.target.nodeName)return a('input[aria-describedby="'+a(this).attr("id")+'"]').trigger("click"),!1});a(".imagify-settings th span").on("click",function(b){1===a(this).parent().next("td").find("input:checkbox").length&&a(this).parent().next("td").find("input:checkbox").trigger("click")});a(".imagify-options-line").find("input").on("change focus",function(){var b=a(this).closest(".imagify-options-line").prev("label").prev("input");
4
- b[0].checked||b.prop("checked",!0)});a(".imagify-settings-section").find("#backup").on("change",function(){if(!a(this).is(":checked")){var b=a(this);swal({title:imagifyOptions.noBackupTitle,html:imagifyOptions.noBackupText,type:"warning",customClass:"imagify-sweet-alert",showCancelButton:!0,cancelButtonText:imagifyAdmin.labels.swalCancel,reverseButtons:!0}).then(function(){},function(a){b.prop("checked",!0)})}})});
1
+ window.imagify=window.imagify||{concat:ajaxurl.indexOf("?")>0?"&":"?",log:function(a){void 0!==console&&console.log(a)},info:function(a){void 0!==console&&console.info(a)}},function(a,b,c,d){var e=!1,f=!1;a("#imagify-settings #api_key").on("blur",function(){var b=a(this),c=b.val();return""!==a.trim(c)&&(a("#check_api_key").val()===c?(a("#imagify-check-api-container").html('<span class="dashicons dashicons-yes"></span> '+imagifyAdmin.labels.ValidApiKeyText),!1):(!0===e?f.abort():(a("#imagify-check-api-container").remove(),b.after('<span id="imagify-check-api-container"><span class="imagify-spinner"></span>'+imagifyAdmin.labels.waitApiKeyCheckText+"</span>")),e=!0,void(f=a.get(ajaxurl+imagify.concat+"action=imagify_check_api_key_validity&api_key="+b.val()+"&imagifycheckapikeynonce="+a("#imagifycheckapikeynonce").val()).done(function(b){b.success?(a("#imagify-check-api-container").remove(),swal({title:imagifyAdmin.labels.ApiKeyCheckSuccessTitle,html:imagifyAdmin.labels.ApiKeyCheckSuccessText,type:"success",customClass:"imagify-sweet-alert"}).then(function(){location.reload()})):a("#imagify-check-api-container").html('<span class="dashicons dashicons-no"></span> '+b.data),e=!1}))))}),a(".imagify-options-line").css("cursor","pointer").on("click",function(b){if("INPUT"!==b.target.nodeName)return a('input[aria-describedby="'+a(this).attr("id")+'"]').trigger("click"),!1}),a(".imagify-settings th span").on("click",function(){var b=a(this).parent().next("td").find("input:checkbox");1===b.length&&b.trigger("click")}),a(".imagify-options-line").find("input").on("change focus",function(){var b=a(this).closest(".imagify-options-line").prev("label").prev("input");b[0].checked||b.prop("checked",!0)}),a(".imagify-settings-section").find("#backup").on("change",function(){var b=a(this);b.is(":checked")||swal({title:imagifyOptions.noBackupTitle,html:imagifyOptions.noBackupText,type:"warning",customClass:"imagify-sweet-alert",showCancelButton:!0,cancelButtonText:imagifyAdmin.labels.swalCancel,reverseButtons:!0}).then(function(){},function(){b.prop("checked",!0)})})}(jQuery,document,window);
 
 
 
assets/js/upload.js CHANGED
@@ -1,157 +1,188 @@
1
- jQuery(function($){
2
- /*
3
- * Add a "Imagify'em all" in the select list
4
- */
5
- var bulk_opt = '<option value="imagify-bulk-upload">' + imagifyUpload.bulkActionsLabels.optimize + '</option>';
6
- bulk_opt += '<option value="imagify-bulk-restore">' + imagifyUpload.bulkActionsLabels.restore + '</option>';
7
-
8
- $('.bulkactions select[name="action"]').find('option:last-child').before( bulk_opt );
9
- $('.bulkactions select[name="action2"]').find('option:last-child').before( bulk_opt );
10
-
11
- /*
12
- * Process optimization for all selected images
 
 
 
 
 
 
 
13
  */
14
- $('#doaction').add('#doaction2')
15
- .on('click', function(e) {
16
- value = $(this).prev('select').val();
17
- value = value.split('-');
18
 
19
- if ( 'imagify' !== value[0] ) {
20
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
- e.preventDefault();
24
-
25
- action = value[2];
26
- ids = $('input[name^="media"]:checked').map( function(){
27
- return this.value;
28
- }).get();
29
-
30
- ids.forEach( function( id, index ) {
31
- setTimeout(function(){
32
- $('#imagify-' + action + '-' + id ).trigger('click');
33
- }, index*300);
34
- });
35
-
36
- });
37
-
38
- /*
39
- * Process to one of these actions: restore, optimize or re-optimize
40
- */
41
- $(document).on('click', '.button-imagify-restore, .button-imagify-manual-upload, .button-imagify-manual-override-upload', function(e){
42
  e.preventDefault();
43
 
44
- var $obj = $(this);
45
- var $parent = ( $obj.parents('.column-imagify_optimized_file, .compat-field-imagify .field').length ) ? $obj.parents('.column-imagify_optimized_file, .compat-field-imagify .field') : $obj.closest('.column');
46
- var href = $obj.attr('href');
47
 
48
- $parent.html('<div class="button"><span class="imagify-spinner"></span>' + $obj.data('waiting-label') + '</div>');
49
 
50
  $.get( href.replace( 'admin-post.php', 'admin-ajax.php' ) )
51
  .done( function( response ){
52
  $parent.html( response.data );
53
- $parent.find('.imagify-datas-more-action a').addClass('is-open').find('.the-text').text( $parent.find('.imagify-datas-more-action a').data('close') );
54
- $parent.find('.imagify-datas-details').addClass('is-open');
55
-
56
- draw_me_a_chart( $parent.find('.imagify-chart-container').find('canvas') );
57
  } );
58
  } );
59
 
60
- /*
61
- * Toggle slide in custom column
62
  */
63
- $('.imagify-datas-details').hide();
64
 
65
- $(document).on('click', '.imagify-datas-more-action a', function(){
66
- if ( $(this).hasClass('is-open') ) {
67
- $( $(this).attr('href') ).slideUp('300').removeClass('is-open');
68
- $(this).removeClass('is-open').find('.the-text').text( $(this).data('open') );
69
- }
70
- else {
71
- $( $(this).attr('href') ).slideDown('300').addClass('is-open');
72
- $(this).addClass('is-open').find('.the-text').text( $(this).data('close') );
 
73
  }
74
  return false;
75
- });
76
-
77
-
78
- // Some usefull functions to help us with media modal
79
-
80
- var get_var = function (param) {
81
- var vars = {};
82
- window.location.href.replace(
83
- /[?&]+([^=&]+)=?([^&]*)?/gi, // regexp
84
- function( m, key, value ) { // callback
85
- vars[key] = value !== undefined ? value : '';
86
- }
87
- );
88
-
89
- if ( param ) {
90
- return vars[param] ? vars[param] : null;
 
 
 
 
 
 
 
 
 
 
 
 
91
  }
92
- return vars;
93
- },
94
- check_modal = function() {
95
- var tempTimer = setInterval( function(){
96
- if ( $('.media-modal').find('.imagify-datas-details').length ) {
97
- $('.media-modal').find('.imagify-datas-details').hide();
98
- draw_me_a_chart( $('.media-modal').find('#imagify-consumption-chart') );
99
- clearInterval(tempTimer);
100
- tempTimer = null;
101
- }
102
- }, 20 );
103
- };
104
-
105
- // Intercept the right moment if media details is clicked (mode grid)
106
- // Bear Feint
107
-
108
- $('.upload-php').find('.media-frame.mode-grid').on('click', '.attachment', function(){
109
  check_modal();
110
- });
111
 
112
- // On page load in upload.php check if item param exists
113
- if ( $('.upload-php').length > 0 && get_var('item') ) {
114
  check_modal();
115
  }
116
 
117
- // On media clicked
118
- $('#insert-media-button').on('click.imagify', function() {
119
  var waitContent = setInterval( function() {
120
- if ( $('.media-frame-content').find('.attachments').length > 0 ) {
121
- $('.media-frame-content').find('.attachments').on('click.imagify', '.attachment', function(){
 
 
122
  check_modal();
123
- });
124
- clearInterval(waitContent);
 
125
  }
126
  }, 100);
127
- });
128
 
129
- /*
130
- * Mini chart
131
- *
132
- * @param {element} canvas
133
- */
134
- function draw_me_a_chart( canvas ) {
135
- canvas.each(function(){
136
-
137
- var the_value = parseInt( $(this).closest('.imagify-chart').next('.imagify-chart-value').text() ),
138
- overviewData = [
139
- {
140
- value: the_value,
141
- color: '#00B3D3'
142
- },
143
- {
144
- value: 100 - the_value,
145
- color: '#D8D8D8'
146
- }
147
- ],
148
- overviewDoughnut = new Chart( $(this)[0].getContext('2d')).Doughnut(overviewData, {
149
- segmentStrokeColor : '#FFF',
150
- segmentStrokeWidth : 1,
151
- animateRotate : true,
152
- tooltipEvents : []
153
- });
154
- });
155
- }
156
- draw_me_a_chart( $('.imagify-chart-container').find('canvas') );
157
- });
1
+ /* globals ajaxurl: false, console: false, imagifyUpload: true, Chart: false */
2
+
3
+ window.imagify = window.imagify || {
4
+ concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?',
5
+ log: function( content ) {
6
+ if ( undefined !== console ) {
7
+ console.log( content );
8
+ }
9
+ },
10
+ info: function( content ) {
11
+ if ( undefined !== console ) {
12
+ console.info( content );
13
+ }
14
+ }
15
+ };
16
+
17
+ (function($, d, w, undefined) {
18
+ /**
19
+ * Add a "Imagify'em all" in the select list.
20
  */
21
+ var bulk_opt, get_var, check_modal;
22
+
23
+ bulk_opt = '<option value="imagify-bulk-upload">' + imagifyUpload.bulkActionsLabels.optimize + '</option>';
24
+ bulk_opt += '<option value="imagify-bulk-restore">' + imagifyUpload.bulkActionsLabels.restore + '</option>';
25
 
26
+ $( '.bulkactions select[name="action"]' ).find( 'option:last-child' ).before( bulk_opt );
27
+ $( '.bulkactions select[name="action2"]' ).find( 'option:last-child' ).before( bulk_opt );
28
+
29
+ /**
30
+ * Mini chart.
31
+ *
32
+ * @param {element} canvas
33
+ */
34
+ function draw_me_a_chart( canvas ) {
35
+ canvas.each( function() {
36
+ var the_value = parseInt( $( this ).closest( '.imagify-chart' ).next( '.imagify-chart-value' ).text() ),
37
+ overviewData = [
38
+ {
39
+ value: the_value,
40
+ color: '#00B3D3'
41
+ },
42
+ {
43
+ value: 100 - the_value,
44
+ color: '#D8D8D8'
45
  }
46
+ ];
47
+
48
+ new Chart( $( this )[0].getContext( '2d' ) ).Doughnut( overviewData, {
49
+ segmentStrokeColor : '#FFF',
50
+ segmentStrokeWidth : 1,
51
+ animateRotate : true,
52
+ tooltipEvents : []
53
+ } );
54
+ } );
55
+ }
56
+
57
+ /**
58
+ * Process optimization for all selected images.
59
+ */
60
+ $( '#doaction' )
61
+ .add( '#doaction2' )
62
+ .on( 'click', function( e ) {
63
+ var value = $( this ).prev( 'select' ).val().split( '-' ),
64
+ action, ids;
65
+
66
+ if ( value[0] !== 'imagify' ) {
67
+ return;
68
+ }
69
+
70
+ e.preventDefault();
71
+
72
+ action = value[2];
73
+ ids = $( 'input[name^="media"]:checked' ).map( function() {
74
+ return this.value;
75
+ } ).get();
76
+
77
+ ids.forEach( function( id, index ) {
78
+ setTimeout( function() {
79
+ $( '#imagify-' + action + '-' + id ).trigger( 'click' );
80
+ }, index * 300 );
81
+ } );
82
+ } );
83
+
84
+ /**
85
+ * Process to one of these actions: restore, optimize or re-optimize.
86
+ */
87
+ $( d ).on( 'click', '.button-imagify-restore, .button-imagify-manual-upload, .button-imagify-manual-override-upload', function( e ) {
88
+ var $obj = $( this ),
89
+ $parent = $obj.parents( '.column-imagify_optimized_file, .compat-field-imagify .field' ),
90
+ href = $obj.attr( 'href' );
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  e.preventDefault();
93
 
94
+ if ( ! $parent.length ) {
95
+ $parent = $obj.closest( '.column' );
96
+ }
97
 
98
+ $parent.html( '<div class="button"><span class="imagify-spinner"></span>' + $obj.data( 'waiting-label' ) + '</div>' );
99
 
100
  $.get( href.replace( 'admin-post.php', 'admin-ajax.php' ) )
101
  .done( function( response ){
102
  $parent.html( response.data );
103
+ $parent.find( '.imagify-datas-more-action a' ).addClass( 'is-open' ).find( '.the-text' ).text( $parent.find( '.imagify-datas-more-action a' ).data( 'close' ) );
104
+ $parent.find( '.imagify-datas-details' ).addClass( 'is-open' );
105
+
106
+ draw_me_a_chart( $parent.find( '.imagify-chart-container' ).find( 'canvas' ) );
107
  } );
108
  } );
109
 
110
+ /**
111
+ * Toggle slide in custom column.
112
  */
113
+ $( '.imagify-datas-details' ).hide();
114
 
115
+ $( d ).on( 'click', '.imagify-datas-more-action a', function() {
116
+ var $this = $( this );
117
+
118
+ if ( $this.hasClass( 'is-open' ) ) {
119
+ $( $this.attr( 'href' ) ).slideUp( 300 ).removeClass( 'is-open' );
120
+ $this.removeClass( 'is-open' ).find( '.the-text' ).text( $this.data( 'open' ) );
121
+ } else {
122
+ $( $this.attr( 'href' ) ).slideDown( 300 ).addClass( 'is-open' );
123
+ $this.addClass( 'is-open' ).find( '.the-text' ).text( $this.data( 'close' ) );
124
  }
125
  return false;
126
+ } );
127
+
128
+ /**
129
+ * Some usefull functions to help us with media modal.
130
+ */
131
+ get_var = function ( param ) {
132
+ var vars = {};
133
+
134
+ w.location.href.replace( /[?&]+([^=&]+)=?([^&]*)?/gi, function( m, key, value ) {
135
+ vars[ key ] = undefined !== value ? value : '';
136
+ } );
137
+
138
+ if ( param ) {
139
+ return vars[ param ] ? vars[ param ] : null;
140
+ }
141
+
142
+ return vars;
143
+ };
144
+
145
+ check_modal = function() {
146
+ var tempTimer = setInterval( function() {
147
+ var $details = $( '.media-modal .imagify-datas-details' );
148
+
149
+ if ( $details.length ) {
150
+ $details.hide();
151
+ draw_me_a_chart( $( '#imagify-consumption-chart' ) );
152
+ clearInterval( tempTimer );
153
+ tempTimer = null;
154
  }
155
+ }, 20 );
156
+ };
157
+
158
+ /**
159
+ * Intercept the right moment if media details is clicked (mode grid).
160
+ * Bear Feint.
161
+ */
162
+ $( '.upload-php' ).find( '.media-frame.mode-grid' ).on( 'click', '.attachment', function() {
 
 
 
 
 
 
 
 
 
163
  check_modal();
164
+ } );
165
 
166
+ // On page load in upload.php check if item param exists.
167
+ if ( $( '.upload-php' ).length && get_var( 'item' ) ) {
168
  check_modal();
169
  }
170
 
171
+ // On media clicked.
172
+ $( '#insert-media-button' ).on( 'click.imagify', function() {
173
  var waitContent = setInterval( function() {
174
+ var $attachments = $( '.media-frame-content .attachments' );
175
+
176
+ if ( $attachments.length ) {
177
+ $attachments.on( 'click.imagify', '.attachment', function() {
178
  check_modal();
179
+ } );
180
+ clearInterval( waitContent );
181
+ waitContent = null;
182
  }
183
  }, 100);
184
+ } );
185
 
186
+ draw_me_a_chart( $( '.imagify-chart-container' ).find( 'canvas' ) );
187
+
188
+ } )(jQuery, document, window);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/upload.min.js CHANGED
@@ -1,6 +1 @@
1
- jQuery(function(a){function e(b){b.each(function(){var b=parseInt(a(this).closest(".imagify-chart").next(".imagify-chart-value").text()),b=[{value:b,color:"#00B3D3"},{value:100-b,color:"#D8D8D8"}];(new Chart(a(this)[0].getContext("2d"))).Doughnut(b,{segmentStrokeColor:"#FFF",segmentStrokeWidth:1,animateRotate:!0,tooltipEvents:[]})})}var c='<option value="imagify-bulk-upload">'+imagifyUpload.bulkActionsLabels.optimize+"</option>",c=c+('<option value="imagify-bulk-restore">'+imagifyUpload.bulkActionsLabels.restore+
2
- "</option>");a('.bulkactions select[name="action"]').find("option:last-child").before(c);a('.bulkactions select[name="action2"]').find("option:last-child").before(c);a("#doaction").add("#doaction2").on("click",function(b){value=a(this).prev("select").val();value=value.split("-");"imagify"===value[0]&&(b.preventDefault(),action=value[2],ids=a('input[name^="media"]:checked').map(function(){return this.value}).get(),ids.forEach(function(b,c){setTimeout(function(){a("#imagify-"+action+"-"+b).trigger("click")},
3
- 300*c)}))});a(document).on("click",".button-imagify-restore, .button-imagify-manual-upload, .button-imagify-manual-override-upload",function(b){b.preventDefault();b=a(this);var d=b.parents(".column-imagify_optimized_file, .compat-field-imagify .field").length?b.parents(".column-imagify_optimized_file, .compat-field-imagify .field"):b.closest(".column"),c=b.attr("href");d.html('<div class="button"><span class="imagify-spinner"></span>'+b.data("waiting-label")+"</div>");a.get(c.replace("admin-post.php",
4
- "admin-ajax.php")).done(function(a){d.html(a.data);d.find(".imagify-datas-more-action a").addClass("is-open").find(".the-text").text(d.find(".imagify-datas-more-action a").data("close"));d.find(".imagify-datas-details").addClass("is-open");e(d.find(".imagify-chart-container").find("canvas"))})});a(".imagify-datas-details").hide();a(document).on("click",".imagify-datas-more-action a",function(){a(this).hasClass("is-open")?(a(a(this).attr("href")).slideUp("300").removeClass("is-open"),a(this).removeClass("is-open").find(".the-text").text(a(this).data("open"))):
5
- (a(a(this).attr("href")).slideDown("300").addClass("is-open"),a(this).addClass("is-open").find(".the-text").text(a(this).data("close")));return!1});var c=function(a){var d={};window.location.href.replace(/[?&]+([^=&]+)=?([^&]*)?/gi,function(a,b,c){d[b]=void 0!==c?c:""});return a?d[a]?d[a]:null:d},f=function(){var b=setInterval(function(){a(".media-modal").find(".imagify-datas-details").length&&(a(".media-modal").find(".imagify-datas-details").hide(),e(a(".media-modal").find("#imagify-consumption-chart")),
6
- clearInterval(b),b=null)},20)};a(".upload-php").find(".media-frame.mode-grid").on("click",".attachment",function(){f()});0<a(".upload-php").length&&c("item")&&f();a("#insert-media-button").on("click.imagify",function(){var b=setInterval(function(){0<a(".media-frame-content").find(".attachments").length&&(a(".media-frame-content").find(".attachments").on("click.imagify",".attachment",function(){f()}),clearInterval(b))},100)});e(a(".imagify-chart-container").find("canvas"))});
1
+ window.imagify=window.imagify||{concat:ajaxurl.indexOf("?")>0?"&":"?",log:function(a){void 0!==console&&console.log(a)},info:function(a){void 0!==console&&console.info(a)}},function(a,b,c,d){function e(b){b.each(function(){var b=parseInt(a(this).closest(".imagify-chart").next(".imagify-chart-value").text()),c=[{value:b,color:"#00B3D3"},{value:100-b,color:"#D8D8D8"}];new Chart(a(this)[0].getContext("2d")).Doughnut(c,{segmentStrokeColor:"#FFF",segmentStrokeWidth:1,animateRotate:!0,tooltipEvents:[]})})}var f,g,h;f='<option value="imagify-bulk-upload">'+imagifyUpload.bulkActionsLabels.optimize+"</option>",f+='<option value="imagify-bulk-restore">'+imagifyUpload.bulkActionsLabels.restore+"</option>",a('.bulkactions select[name="action"]').find("option:last-child").before(f),a('.bulkactions select[name="action2"]').find("option:last-child").before(f),a("#doaction").add("#doaction2").on("click",function(b){var c,d,e=a(this).prev("select").val().split("-");"imagify"===e[0]&&(b.preventDefault(),c=e[2],d=a('input[name^="media"]:checked').map(function(){return this.value}).get(),d.forEach(function(b,d){setTimeout(function(){a("#imagify-"+c+"-"+b).trigger("click")},300*d)}))}),a(b).on("click",".button-imagify-restore, .button-imagify-manual-upload, .button-imagify-manual-override-upload",function(b){var c=a(this),d=c.parents(".column-imagify_optimized_file, .compat-field-imagify .field"),f=c.attr("href");b.preventDefault(),d.length||(d=c.closest(".column")),d.html('<div class="button"><span class="imagify-spinner"></span>'+c.data("waiting-label")+"</div>"),a.get(f.replace("admin-post.php","admin-ajax.php")).done(function(a){d.html(a.data),d.find(".imagify-datas-more-action a").addClass("is-open").find(".the-text").text(d.find(".imagify-datas-more-action a").data("close")),d.find(".imagify-datas-details").addClass("is-open"),e(d.find(".imagify-chart-container").find("canvas"))})}),a(".imagify-datas-details").hide(),a(b).on("click",".imagify-datas-more-action a",function(){var b=a(this);return b.hasClass("is-open")?(a(b.attr("href")).slideUp(300).removeClass("is-open"),b.removeClass("is-open").find(".the-text").text(b.data("open"))):(a(b.attr("href")).slideDown(300).addClass("is-open"),b.addClass("is-open").find(".the-text").text(b.data("close"))),!1}),g=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},h=function(){var b=setInterval(function(){var c=a(".media-modal .imagify-datas-details");c.length&&(c.hide(),e(a("#imagify-consumption-chart")),clearInterval(b),b=null)},20)},a(".upload-php").find(".media-frame.mode-grid").on("click",".attachment",function(){h()}),a(".upload-php").length&&g("item")&&h(),a("#insert-media-button").on("click.imagify",function(){var b=setInterval(function(){var c=a(".media-frame-content .attachments");c.length&&(c.on("click.imagify",".attachment",function(){h()}),clearInterval(b),b=null)},100)}),e(a(".imagify-chart-container").find("canvas"))}(jQuery,document,window);
 
 
 
 
 
contributors.txt CHANGED
@@ -6,7 +6,8 @@ Developers:
6
  Geoffrey Crofte <geoffrey@wp-media.me>
7
  Sébastien Decamme <sebastien@wp-media.me>
8
  Julio Potier <julio@wp-media.me>
9
- Caspar Huebinger <caspar@wp-rocket.me>
 
10
  Grégory Viguier <gregory@wp-rocket.me>
11
 
12
  Interface Design:
@@ -16,4 +17,4 @@ Interface Design:
16
  Translation:
17
  Alice Orrù (Italian & Spanish) <alice@wp-rocket.me>
18
  Caspar Hübinger (German) <caspar@wp-rocket.me>
19
- Lucy Beer (English) <lucy@wp-rocket.me>
6
  Geoffrey Crofte <geoffrey@wp-media.me>
7
  Sébastien Decamme <sebastien@wp-media.me>
8
  Julio Potier <julio@wp-media.me>
9
+ Caspar Hübinger <caspar@wp-rocket.me>
10
+ Remy Perona <remy@wp-rocket.me>
11
  Grégory Viguier <gregory@wp-rocket.me>
12
 
13
  Interface Design:
17
  Translation:
18
  Alice Orrù (Italian & Spanish) <alice@wp-rocket.me>
19
  Caspar Hübinger (German) <caspar@wp-rocket.me>
20
+ Lucy Beer (English) <lucy@wp-rocket.me>
imagify.php CHANGED
@@ -1,37 +1,37 @@
1
  <?php
2
- /*
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 bandwith using Imagify, the new most advanced image optimization tool.
6
- Version: 1.6.4
7
- Author: WP Media
8
- Author URI: http://wp-media.me
9
- Licence: GPLv2
10
-
11
- Text Domain: imagify
12
- Domain Path: languages
13
-
14
- Copyright 2016 WP Media
15
- */
16
 
17
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
18
 
19
- // Imagify defines
20
- define( 'IMAGIFY_VERSION' , '1.6.4' );
21
- define( 'IMAGIFY_SLUG' , 'imagify' );
22
- define( 'IMAGIFY_SETTINGS_SLUG' , IMAGIFY_SLUG . '_settings' );
23
- define( 'IMAGIFY_WEB_MAIN' , 'https://imagify.io' );
24
- define( 'IMAGIFY_APP_MAIN' , 'https://app.imagify.io' );
25
  define( 'IMAGIFY_PAYMENT_URL' , IMAGIFY_APP_MAIN . '/#/plugin/' );
26
- define( 'IMAGIFY_FILE' , __FILE__ );
27
- define( 'IMAGIFY_PATH' , realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' );
28
- define( 'IMAGIFY_INC_PATH' , realpath( IMAGIFY_PATH . 'inc/' ) . '/' );
29
- define( 'IMAGIFY_API_PATH' , realpath( IMAGIFY_INC_PATH . 'api/' ) . '/' );
30
- define( 'IMAGIFY_ADMIN_PATH' , realpath( IMAGIFY_INC_PATH . 'admin' ) . '/' );
31
- define( 'IMAGIFY_ADMIN_UI_PATH' , realpath( IMAGIFY_ADMIN_PATH . 'ui' ) . '/' );
32
- define( 'IMAGIFY_COMMON_PATH' , realpath( IMAGIFY_INC_PATH . 'common' ) . '/' );
33
- define( 'IMAGIFY_FUNCTIONS_PATH' , realpath( IMAGIFY_INC_PATH . 'functions' ) . '/' );
34
- define( 'IMAGIFY_CLASSES_PATH' , realpath( IMAGIFY_INC_PATH . 'classes' ) . '/' );
35
  define( 'IMAGIFY_CLASSES_ABSTRACTS_PATH' , realpath( IMAGIFY_CLASSES_PATH . 'abstracts' ) . '/' );
36
  define( 'IMAGIFY_3RD_PARTY_PATH' , realpath( IMAGIFY_INC_PATH . '3rd-party' ) . '/' );
37
  define( 'IMAGIFY_URL' , plugin_dir_url( IMAGIFY_FILE ) );
@@ -43,62 +43,65 @@ define( 'IMAGIFY_ASSETS_CSS_URL' , IMAGIFY_ASSETS_URL . 'css/' );
43
  define( 'IMAGIFY_ASSETS_IMG_URL' , IMAGIFY_ASSETS_URL . 'images/' );
44
  define( 'IMAGIFY_MAX_BYTES' , 5242880 );
45
 
46
- /*
47
- * Tell WP what to do when plugin is loaded
 
48
  *
49
  * @since 1.0
50
  */
51
- add_action( 'plugins_loaded', '_imagify_init' );
52
  function _imagify_init() {
53
- // Load translations
54
- load_plugin_textdomain( 'imagify', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
55
 
56
- // Nothing to do if autosave
57
- if ( defined( 'DOING_AUTOSAVE' ) ) {
58
- return;
59
- }
60
 
61
- require( IMAGIFY_INC_PATH . 'compat.php' );
62
- require( IMAGIFY_FUNCTIONS_PATH . 'options.php' );
63
- require( IMAGIFY_API_PATH . 'imagify.php' );
64
- require( IMAGIFY_FUNCTIONS_PATH . 'formatting.php' );
65
- require( IMAGIFY_FUNCTIONS_PATH . 'files.php' );
66
- require( IMAGIFY_FUNCTIONS_PATH . 'admin.php' );
67
- require( IMAGIFY_FUNCTIONS_PATH . 'api.php' );
68
- require( IMAGIFY_FUNCTIONS_PATH . 'attachments.php' );
69
- require( IMAGIFY_FUNCTIONS_PATH . 'process.php' );
70
- require( IMAGIFY_CLASSES_ABSTRACTS_PATH . 'abstract-db.php' );
71
- require( IMAGIFY_CLASSES_ABSTRACTS_PATH . 'abstract-attachment.php' );
72
- require( IMAGIFY_CLASSES_PATH . 'class-user.php' );
73
- require( IMAGIFY_CLASSES_PATH . 'class-attachment.php' );
74
- require( IMAGIFY_FUNCTIONS_PATH . 'admin-ui.php' );
75
- require( IMAGIFY_FUNCTIONS_PATH . 'admin-stats.php' );
76
- require( IMAGIFY_FUNCTIONS_PATH . 'i18n.php' );
77
- require( IMAGIFY_COMMON_PATH . 'attachments.php' );
78
- require( IMAGIFY_COMMON_PATH . 'admin-bar.php' );
79
- require( IMAGIFY_COMMON_PATH . 'cron.php' );
80
- require( IMAGIFY_3RD_PARTY_PATH . '3rd-party.php' );
 
 
 
81
 
82
- if ( is_admin() ) {
83
- require( IMAGIFY_ADMIN_PATH . 'upgrader.php' );
84
- require( IMAGIFY_ADMIN_PATH . 'heartbeat.php' );
85
- require( IMAGIFY_ADMIN_PATH . 'ajax.php' );
86
- require( IMAGIFY_ADMIN_PATH . 'options.php' );
87
- require( IMAGIFY_ADMIN_PATH . 'menu.php' );
88
- require( IMAGIFY_ADMIN_PATH . 'plugins.php' );
89
- require( IMAGIFY_ADMIN_PATH . 'upload.php' );
90
- require( IMAGIFY_ADMIN_PATH . 'media.php' );
91
- require( IMAGIFY_ADMIN_PATH . 'enqueue.php' );
92
- require( IMAGIFY_ADMIN_PATH . 'meta-boxes.php' );
93
- require( IMAGIFY_ADMIN_UI_PATH . 'options.php' );
94
- require( IMAGIFY_ADMIN_UI_PATH . 'bulk.php' );
95
- require( IMAGIFY_ADMIN_UI_PATH . 'notices.php' );
96
- }
97
 
98
- /**
99
- * Fires when Imagify is correctly loaded
100
- *
101
- * @since 1.0
102
  */
103
  do_action( 'imagify_loaded' );
104
  }
1
  <?php
2
+ /**
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.6.5
7
+ * Author: WP Media
8
+ * Author URI: http://wp-media.me
9
+ * Licence: GPLv2
10
+ *
11
+ * Text Domain: imagify
12
+ * Domain Path: languages
13
+ *
14
+ * Copyright 2017 WP Media
15
+ */
16
 
17
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
18
 
19
+ // Imagify defines.
20
+ define( 'IMAGIFY_VERSION' , '1.6.5' );
21
+ define( 'IMAGIFY_SLUG' , 'imagify' );
22
+ define( 'IMAGIFY_SETTINGS_SLUG' , IMAGIFY_SLUG . '_settings' );
23
+ define( 'IMAGIFY_WEB_MAIN' , 'https://imagify.io' );
24
+ define( 'IMAGIFY_APP_MAIN' , 'https://app.imagify.io' );
25
  define( 'IMAGIFY_PAYMENT_URL' , IMAGIFY_APP_MAIN . '/#/plugin/' );
26
+ define( 'IMAGIFY_FILE' , __FILE__ );
27
+ define( 'IMAGIFY_PATH' , realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' );
28
+ define( 'IMAGIFY_INC_PATH' , realpath( IMAGIFY_PATH . 'inc/' ) . '/' );
29
+ define( 'IMAGIFY_API_PATH' , realpath( IMAGIFY_INC_PATH . 'api/' ) . '/' );
30
+ define( 'IMAGIFY_ADMIN_PATH' , realpath( IMAGIFY_INC_PATH . 'admin' ) . '/' );
31
+ define( 'IMAGIFY_ADMIN_UI_PATH' , realpath( IMAGIFY_ADMIN_PATH . 'ui' ) . '/' );
32
+ define( 'IMAGIFY_COMMON_PATH' , realpath( IMAGIFY_INC_PATH . 'common' ) . '/' );
33
+ define( 'IMAGIFY_FUNCTIONS_PATH' , realpath( IMAGIFY_INC_PATH . 'functions' ) . '/' );
34
+ define( 'IMAGIFY_CLASSES_PATH' , realpath( IMAGIFY_INC_PATH . 'classes' ) . '/' );
35
  define( 'IMAGIFY_CLASSES_ABSTRACTS_PATH' , realpath( IMAGIFY_CLASSES_PATH . 'abstracts' ) . '/' );
36
  define( 'IMAGIFY_3RD_PARTY_PATH' , realpath( IMAGIFY_INC_PATH . '3rd-party' ) . '/' );
37
  define( 'IMAGIFY_URL' , plugin_dir_url( IMAGIFY_FILE ) );
43
  define( 'IMAGIFY_ASSETS_IMG_URL' , IMAGIFY_ASSETS_URL . 'images/' );
44
  define( 'IMAGIFY_MAX_BYTES' , 5242880 );
45
 
46
+ add_action( 'plugins_loaded', '_imagify_init' );
47
+ /**
48
+ * Tell WP what to do when plugin is loaded.
49
  *
50
  * @since 1.0
51
  */
 
52
  function _imagify_init() {
53
+ // Load translations.
54
+ load_plugin_textdomain( 'imagify', false, dirname( plugin_basename( IMAGIFY_FILE ) ) . '/languages/' );
55
 
56
+ // Nothing to do if autosave.
57
+ if ( defined( 'DOING_AUTOSAVE' ) ) {
58
+ return;
59
+ }
60
 
61
+ require( IMAGIFY_INC_PATH . 'compat.php' );
62
+ require( IMAGIFY_API_PATH . 'imagify.php' );
63
+ require( IMAGIFY_FUNCTIONS_PATH . 'deprecated.php' );
64
+ require( IMAGIFY_FUNCTIONS_PATH . 'common.php' );
65
+ require( IMAGIFY_FUNCTIONS_PATH . 'options.php' );
66
+ require( IMAGIFY_FUNCTIONS_PATH . 'formatting.php' );
67
+ require( IMAGIFY_FUNCTIONS_PATH . 'files.php' );
68
+ require( IMAGIFY_FUNCTIONS_PATH . 'admin.php' );
69
+ require( IMAGIFY_FUNCTIONS_PATH . 'api.php' );
70
+ require( IMAGIFY_FUNCTIONS_PATH . 'attachments.php' );
71
+ require( IMAGIFY_FUNCTIONS_PATH . 'process.php' );
72
+ require( IMAGIFY_FUNCTIONS_PATH . 'admin-ui.php' );
73
+ require( IMAGIFY_FUNCTIONS_PATH . 'admin-stats.php' );
74
+ require( IMAGIFY_FUNCTIONS_PATH . 'i18n.php' );
75
+ require( IMAGIFY_CLASSES_ABSTRACTS_PATH . 'class-imagify-abstract-db.php' );
76
+ require( IMAGIFY_CLASSES_ABSTRACTS_PATH . 'class-imagify-abstract-attachment.php' );
77
+ require( IMAGIFY_CLASSES_PATH . 'class-imagify.php' );
78
+ require( IMAGIFY_CLASSES_PATH . 'class-imagify-user.php' );
79
+ require( IMAGIFY_CLASSES_PATH . 'class-imagify-attachment.php' );
80
+ require( IMAGIFY_COMMON_PATH . 'attachments.php' );
81
+ require( IMAGIFY_COMMON_PATH . 'admin-bar.php' );
82
+ require( IMAGIFY_COMMON_PATH . 'cron.php' );
83
+ require( IMAGIFY_3RD_PARTY_PATH . '3rd-party.php' );
84
 
85
+ if ( is_admin() ) {
86
+ require( IMAGIFY_ADMIN_PATH . 'upgrader.php' );
87
+ require( IMAGIFY_ADMIN_PATH . 'heartbeat.php' );
88
+ require( IMAGIFY_ADMIN_PATH . 'ajax.php' );
89
+ require( IMAGIFY_ADMIN_PATH . 'options.php' );
90
+ require( IMAGIFY_ADMIN_PATH . 'menu.php' );
91
+ require( IMAGIFY_ADMIN_PATH . 'plugins.php' );
92
+ require( IMAGIFY_ADMIN_PATH . 'upload.php' );
93
+ require( IMAGIFY_ADMIN_PATH . 'media.php' );
94
+ require( IMAGIFY_ADMIN_PATH . 'enqueue.php' );
95
+ require( IMAGIFY_ADMIN_PATH . 'meta-boxes.php' );
96
+ require( IMAGIFY_ADMIN_UI_PATH . 'options.php' );
97
+ require( IMAGIFY_ADMIN_UI_PATH . 'bulk.php' );
98
+ require( IMAGIFY_ADMIN_UI_PATH . 'notices.php' );
99
+ }
100
 
101
+ /**
102
+ * Fires when Imagify is correctly loaded.
103
+ *
104
+ * @since 1.0
105
  */
106
  do_action( 'imagify_loaded' );
107
  }
inc/3rd-party/3rd-party.php CHANGED
@@ -1,9 +1,9 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  require( IMAGIFY_3RD_PARTY_PATH . 'enable-media-replace.php' );
5
  require( IMAGIFY_3RD_PARTY_PATH . 'nextgen-gallery/nextgen-gallery.php' );
6
  require( IMAGIFY_3RD_PARTY_PATH . 'wp-retina-2x.php' );
7
 
8
- // Hosting
9
- require( IMAGIFY_3RD_PARTY_PATH . 'hosting/wpengine.php' );
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  require( IMAGIFY_3RD_PARTY_PATH . 'enable-media-replace.php' );
5
  require( IMAGIFY_3RD_PARTY_PATH . 'nextgen-gallery/nextgen-gallery.php' );
6
  require( IMAGIFY_3RD_PARTY_PATH . 'wp-retina-2x.php' );
7
 
8
+ // Hosting.
9
+ require( IMAGIFY_3RD_PARTY_PATH . 'hosting/wpengine.php' );
inc/3rd-party/enable-media-replace.php CHANGED
@@ -1,33 +1,36 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  if ( function_exists( 'emr_delete_current_files' ) ) :
5
 
6
- /**
7
- * Re-Optimize an attachment after replace it with Enable Media Replace.
8
- *
9
- * @since 1.0
10
- */
11
- add_action( 'enable-media-replace-upload-done', '_imagify_optimize_enable_media_replace' );
12
- function _imagify_optimize_enable_media_replace( $guid ) {
13
- global $wpdb;
14
- $attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid='%s';", $guid ) );
15
-
16
- // Stop if the attachment wasn't optimized yet by Imagify
17
- if ( ! get_post_meta( $attachment_id, '_imagify_data', true ) ) {
18
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  }
20
-
21
- $optimization_level = get_post_meta( $attachment_id, '_imagify_optimization_level', true );
22
-
23
- // Remove old optimization data
24
- delete_post_meta( $attachment_id, '_imagify_data' );
25
- delete_post_meta( $attachment_id, '_imagify_status' );
26
- delete_post_meta( $attachment_id, '_imagify_optimization_level' );
27
-
28
- // Optimize it!!!!!
29
- $attachment = new Imagify_Attachment( $attachment_id );
30
- $attachment->optimize( $optimization_level );
31
- }
32
 
33
- endif;
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  if ( function_exists( 'emr_delete_current_files' ) ) :
5
 
6
+ add_action( 'enable-media-replace-upload-done', '_imagify_optimize_enable_media_replace' );
7
+ /**
8
+ * Re-Optimize an attachment after replace it with Enable Media Replace.
9
+ *
10
+ * @since 1.0
11
+ *
12
+ * @param string $guid A post guid.
13
+ */
14
+ function _imagify_optimize_enable_media_replace( $guid ) {
15
+ global $wpdb;
16
+ $attachment_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid='%s';", $guid ) );
17
+
18
+ // Stop if the attachment wasn't optimized yet by Imagify.
19
+ if ( ! get_post_meta( $attachment_id, '_imagify_data', true ) ) {
20
+ return;
21
+ }
22
+
23
+ $optimization_level = get_post_meta( $attachment_id, '_imagify_optimization_level', true );
24
+ $class_name = get_imagify_attachment_class_name( 'wp' );
25
+ $attachment = new $class_name( $attachment_id );
26
+
27
+ // Remove old optimization data.
28
+ delete_post_meta( $attachment_id, '_imagify_data' );
29
+ delete_post_meta( $attachment_id, '_imagify_status' );
30
+ delete_post_meta( $attachment_id, '_imagify_optimization_level' );
31
+
32
+ // Optimize it!!!!!
33
+ $attachment->optimize( $optimization_level );
34
  }
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
+ endif;
inc/3rd-party/hosting/wpengine.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  if ( class_exists( 'WpeCommon' ) ) :
5
 
6
- /**
7
- * Conflict with WP Engine: it seems that WP Engine limits SQL queries size.
8
- *
9
- * @since 1.4.7
10
- * @author Jonathan Buttigieg
11
- */
12
- add_filter( 'imagify_unoptimized_attachment_limit', '_imagify_wengine_unoptimized_attachment_limit' );
13
- function _imagify_wengine_unoptimized_attachment_limit() {
14
- return 2500;
15
- }
16
 
17
- endif;
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  if ( class_exists( 'WpeCommon' ) ) :
5
 
6
+ add_filter( 'imagify_unoptimized_attachment_limit', '_imagify_wengine_unoptimized_attachment_limit' );
7
+ /**
8
+ * Conflict with WP Engine: it seems that WP Engine limits SQL queries size.
9
+ *
10
+ * @since 1.4.7
11
+ * @author Jonathan Buttigieg
12
+ */
13
+ function _imagify_wengine_unoptimized_attachment_limit() {
14
+ return 2500;
15
+ }
16
 
17
+ endif;
inc/3rd-party/nextgen-gallery/inc/admin/ajax.php CHANGED
@@ -1,107 +1,110 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
4
  /**
5
  * Get all unoptimized attachment ids.
6
  *
7
  * @since 1.0
8
  * @author Jonathan Buttigieg
9
  */
10
- add_action( 'wp_ajax_imagify_ngg_get_unoptimized_attachment_ids', '_do_wp_ajax_imagify_ngg_get_unoptimized_attachment_ids' );
11
  function _do_wp_ajax_imagify_ngg_get_unoptimized_attachment_ids() {
 
 
12
  check_ajax_referer( 'imagify-bulk-upload', 'imagifybulkuploadnonce' );
13
 
14
  if ( ! current_user_can( 'upload_files' ) ) {
15
  wp_send_json_error();
16
  }
17
-
18
  $user = new Imagify_User();
19
-
20
  if ( $user->is_over_quota() ) {
21
  wp_send_json_error( array( 'message' => 'over-quota' ) );
22
  }
23
-
24
  @set_time_limit( 0 );
25
-
26
- $optimization_level = $_GET['optimization_level'];
27
- $optimization_level = ( -1 != $optimization_level ) ? $optimization_level : get_imagify_option( 'optimization_level', 1 );
28
  $optimization_level = (int) $optimization_level;
29
-
30
  /**
31
- * Filter the unoptimized attachments limit query
32
  *
33
  * @since 1.4.4
34
  *
35
- * @param int The limit (-1 for unlimited)
36
  */
37
  $unoptimized_attachment_limit = apply_filters( 'imagify_unoptimized_attachment_limit', 10000 );
38
-
39
- global $wpdb;
40
-
41
- $storage = C_Gallery_Storage::get_instance();
42
- $ngg_table = $wpdb->prefix . 'ngg_pictures';
43
- $data = array();
44
- $images = $wpdb->get_results(
45
  "SELECT picture.pid as id, picture.filename, idata.optimization_level, idata.status, idata.data
46
  FROM $ngg_table as picture
47
  LEFT JOIN $wpdb->ngg_imagify_data as idata
48
  ON picture.pid = idata.pid
49
  WHERE idata.pid IS NULL
50
- OR idata.optimization_level != $optimization_level
51
  OR idata.status = 'error'
52
- LIMIT $unoptimized_attachment_limit"
53
- , ARRAY_A
54
- );
55
-
56
- // Save the optimization level in a transient to retrieve it later during the process
 
57
  set_transient( 'imagify_bulk_optimization_level', $optimization_level );
58
-
59
- foreach( $images as $image ) {
60
  $id = $image['id'];
61
-
62
- /** This filter is documented in inc/functions/process.php */
63
  $file_path = apply_filters( 'imagify_file_path', $storage->get_image_abspath( $id ) );
64
-
65
- if ( file_exists( $file_path ) ) {
66
- $attachment_data = maybe_unserialize( $image['data'] );
67
- $attachment_error = '';
68
-
69
- if ( isset( $attachment_data['sizes']['full']['error'] ) ) {
70
- $attachment_error = $attachment_data['sizes']['full']['error'];
71
- }
72
-
73
- $attachment_error = trim( $attachment_error );
74
- $attachment_status = $image['status'];
75
- $attachment_optimization_level = $image['optimization_level'];
76
- $attachment_backup_path = get_imagify_attachment_backup_path( $file_path );
77
-
78
- // Don't try to re-optimize if the optimization level is still the same
79
- if ( $optimization_level === $attachment_optimization_level && is_string( $attachment_error ) ) {
80
- continue;
81
- }
82
-
83
- // Don't try to re-optimize if there is no backup file
84
- if ( $optimization_level !== $attachment_optimization_level && ! file_exists( $attachment_backup_path ) && $attachment_status == 'success' ) {
85
- continue;
86
- }
87
-
88
- // Don't try to re-optimize images already compressed
89
- if ( $attachment_optimization_level >= $optimization_level && $attachment_status == 'already_optimized' ) {
90
- continue;
91
- }
92
-
93
- // Don't try to re-optimize images with an empty error message
94
- if ( $attachment_status == 'error' && empty( $attachment_error ) ) {
95
- continue;
96
- }
97
-
98
- $data[ '_' . $id ] = $storage->get_image_url( $id );
99
- }
100
- }
101
-
102
- if ( (bool) $data ) {
 
 
103
  wp_send_json_success( $data );
104
  }
105
-
106
  wp_send_json_error( array( 'message' => 'no-images' ) );
107
- }
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_action( 'wp_ajax_imagify_ngg_get_unoptimized_attachment_ids', '_do_wp_ajax_imagify_ngg_get_unoptimized_attachment_ids' );
5
  /**
6
  * Get all unoptimized attachment ids.
7
  *
8
  * @since 1.0
9
  * @author Jonathan Buttigieg
10
  */
 
11
  function _do_wp_ajax_imagify_ngg_get_unoptimized_attachment_ids() {
12
+ global $wpdb;
13
+
14
  check_ajax_referer( 'imagify-bulk-upload', 'imagifybulkuploadnonce' );
15
 
16
  if ( ! current_user_can( 'upload_files' ) ) {
17
  wp_send_json_error();
18
  }
19
+
20
  $user = new Imagify_User();
21
+
22
  if ( $user->is_over_quota() ) {
23
  wp_send_json_error( array( 'message' => 'over-quota' ) );
24
  }
25
+
26
  @set_time_limit( 0 );
27
+
28
+ $optimization_level = (int) $_GET['optimization_level'];
29
+ $optimization_level = ( -1 !== $optimization_level ) ? $optimization_level : get_imagify_option( 'optimization_level', 1 );
30
  $optimization_level = (int) $optimization_level;
31
+
32
  /**
33
+ * Filter the unoptimized attachments limit query.
34
  *
35
  * @since 1.4.4
36
  *
37
+ * @param int The limit (-1 for unlimited).
38
  */
39
  $unoptimized_attachment_limit = apply_filters( 'imagify_unoptimized_attachment_limit', 10000 );
40
+
41
+ $storage = C_Gallery_Storage::get_instance();
42
+ $ngg_table = $wpdb->prefix . 'ngg_pictures';
43
+ $data = array();
44
+ $images = $wpdb->get_results( $wpdb->prepare( // WPCS: unprepared SQL ok.
 
 
45
  "SELECT picture.pid as id, picture.filename, idata.optimization_level, idata.status, idata.data
46
  FROM $ngg_table as picture
47
  LEFT JOIN $wpdb->ngg_imagify_data as idata
48
  ON picture.pid = idata.pid
49
  WHERE idata.pid IS NULL
50
+ OR idata.optimization_level != %d
51
  OR idata.status = 'error'
52
+ LIMIT %d",
53
+ $optimization_level,
54
+ $unoptimized_attachment_limit
55
+ ), ARRAY_A );
56
+
57
+ // Save the optimization level in a transient to retrieve it later during the process.
58
  set_transient( 'imagify_bulk_optimization_level', $optimization_level );
59
+
60
+ foreach ( $images as $image ) {
61
  $id = $image['id'];
62
+
63
+ /** This filter is documented in inc/functions/process.php. */
64
  $file_path = apply_filters( 'imagify_file_path', $storage->get_image_abspath( $id ) );
65
+
66
+ if ( ! file_exists( $file_path ) ) {
67
+ continue;
68
+ }
69
+
70
+ $attachment_data = maybe_unserialize( $image['data'] );
71
+ $attachment_error = '';
72
+
73
+ if ( isset( $attachment_data['sizes']['full']['error'] ) ) {
74
+ $attachment_error = $attachment_data['sizes']['full']['error'];
75
+ }
76
+
77
+ $attachment_error = trim( $attachment_error );
78
+ $attachment_status = $image['status'];
79
+ $attachment_optimization_level = $image['optimization_level'];
80
+ $attachment_backup_path = get_imagify_attachment_backup_path( $file_path );
81
+
82
+ // Don't try to re-optimize if the optimization level is still the same.
83
+ if ( $optimization_level === $attachment_optimization_level && is_string( $attachment_error ) ) {
84
+ continue;
85
+ }
86
+
87
+ // Don't try to re-optimize if there is no backup file.
88
+ if ( 'success' === $attachment_status && $optimization_level !== $attachment_optimization_level && ! file_exists( $attachment_backup_path ) ) {
89
+ continue;
90
+ }
91
+
92
+ // Don't try to re-optimize images already compressed.
93
+ if ( 'already_optimized' === $attachment_status && $attachment_optimization_level >= $optimization_level ) {
94
+ continue;
95
+ }
96
+
97
+ // Don't try to re-optimize images with an empty error message.
98
+ if ( 'error' === $attachment_status && empty( $attachment_error ) ) {
99
+ continue;
100
+ }
101
+
102
+ $data[ '_' . $id ] = $storage->get_image_url( $id );
103
+ } // End foreach().
104
+
105
+ if ( $data ) {
106
  wp_send_json_success( $data );
107
  }
108
+
109
  wp_send_json_error( array( 'message' => 'no-images' ) );
110
+ }
inc/3rd-party/nextgen-gallery/inc/admin/bulk.php CHANGED
@@ -1,20 +1,22 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
4
  /**
5
- * Update all Imagify stats for NGG Bulk Optimization
6
  *
7
  * @since 1.5
8
  * @author Jonathan Buttigieg
9
  */
10
- add_action( 'admin_init', '_imagify_ngg_update_bulk_stats' );
11
- function _imagify_ngg_update_bulk_stats() {
12
- if ( isset( $_GET['page'] ) && 'imagify-ngg-bulk-optimization' === $_GET['page'] ) {
13
- add_filter( 'imagify_count_attachments' , 'imagify_ngg_count_attachments' );
14
- add_filter( 'imagify_count_optimized_attachments' , 'imagify_ngg_count_optimized_attachments' );
15
- add_filter( 'imagify_count_error_attachments' , 'imagify_ngg_count_error_attachments' );
16
- add_filter( 'imagify_count_unoptimized_attachments' , 'imagify_ngg_count_unoptimized_attachments' );
17
- add_filter( 'imagify_percent_optimized_attachments' , 'imagify_ngg_percent_optimized_attachments' );
18
- add_filter( 'imagify_count_saving_data' , 'imagify_ngg_count_saving_data' );
19
  }
20
- }
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_action( 'admin_init', '_imagify_ngg_update_bulk_stats' );
5
  /**
6
+ * Update all Imagify stats for NGG Bulk Optimization.
7
  *
8
  * @since 1.5
9
  * @author Jonathan Buttigieg
10
  */
11
+ function _imagify_ngg_update_bulk_stats() {
12
+ if ( empty( $_GET['page'] ) || 'imagify-ngg-bulk-optimization' !== $_GET['page'] ) { // WPCS: CSRF ok.
13
+ return;
 
 
 
 
 
 
14
  }
15
+
16
+ add_filter( 'imagify_count_attachments' , 'imagify_ngg_count_attachments' );
17
+ add_filter( 'imagify_count_optimized_attachments' , 'imagify_ngg_count_optimized_attachments' );
18
+ add_filter( 'imagify_count_error_attachments' , 'imagify_ngg_count_error_attachments' );
19
+ add_filter( 'imagify_count_unoptimized_attachments' , 'imagify_ngg_count_unoptimized_attachments' );
20
+ add_filter( 'imagify_percent_optimized_attachments' , 'imagify_ngg_percent_optimized_attachments' );
21
+ add_filter( 'imagify_count_saving_data' , 'imagify_ngg_count_saving_data' );
22
+ }
inc/3rd-party/nextgen-gallery/inc/admin/db.php CHANGED
@@ -1,18 +1,17 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
4
  /**
5
- * Create the Imagify table needed for NGG compatibility
6
  *
7
  * @since 1.5
8
  * @author Jonathan Buttigieg
9
  */
10
- add_action( 'admin_init' , '_imagify_create_ngg_table' );
11
  function _imagify_create_ngg_table() {
12
  global $wpdb;
13
-
14
  if ( ! get_option( $wpdb->prefix . 'ngg_imagify_data_db_version' ) ) {
15
- $db = new Imagify_NGG_DB();
16
- $db->create_table();
17
  }
18
- }
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_action( 'admin_init' , '_imagify_create_ngg_table' );
5
  /**
6
+ * Create the Imagify table needed for NGG compatibility.
7
  *
8
  * @since 1.5
9
  * @author Jonathan Buttigieg
10
  */
 
11
  function _imagify_create_ngg_table() {
12
  global $wpdb;
13
+
14
  if ( ! get_option( $wpdb->prefix . 'ngg_imagify_data_db_version' ) ) {
15
+ imagify_ngg_db()->create_table();
 
16
  }
17
+ }
inc/3rd-party/nextgen-gallery/inc/admin/enqueue.php CHANGED
@@ -1,34 +1,34 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
4
  /**
5
- * Add some JS for NGG compatibility
6
  *
7
  * @since 1.5
8
  * @author Jonathan Buttigieg
9
  */
10
- add_action( 'admin_print_styles', '_imagify_ngg_admin_print_styles', PHP_INT_MAX );
11
  function _imagify_ngg_admin_print_styles() {
12
  $current_screen = get_current_screen();
13
-
14
  /**
15
- * Scripts loaded in /wp-admin/admin.php?page=nggallery-manage-gallery
16
  */
17
  if ( isset( $current_screen ) && ( 'nggallery-manage-images' === $current_screen->base || 'nggallery-manage-gallery' === $current_screen->base ) ) {
18
  $upload_data = array(
19
- 'bulkActionsLabels' => array(
20
  'optimize' => __( 'Optimize', 'imagify' ),
21
  'restore' => __( 'Restore Original', 'imagify' ),
22
  ),
23
  );
24
  wp_localize_script( 'imagify-js-upload', 'imagifyUpload', $upload_data );
25
-
26
  wp_enqueue_script( 'imagify-js-chart' );
27
  wp_enqueue_script( 'imagify-js-upload' );
28
  }
29
-
30
  /**
31
- * Scripts loaded in /wp-admin/admin.php?page=imagify-ngg-bulk-optimization
32
  */
33
  if ( isset( $current_screen ) && false !== strpos( $current_screen->base, '_page_imagify-ngg-bulk-optimization' ) ) {
34
  wp_enqueue_script( 'heartbeat' );
@@ -37,10 +37,10 @@ function _imagify_ngg_admin_print_styles() {
37
  $bulk_data['heartbeat_id'] = 'update_ngg_bulk_data';
38
  $bulk_data['ajax_action'] = 'imagify_ngg_get_unoptimized_attachment_ids';
39
  $bulk_data['ajax_context'] = 'NGG';
40
-
41
  /** This filter is documented in inc/admin/enqueue.php */
42
- $bulk_data['buffer_size'] = apply_filters( 'imagify_bulk_buffer_size', 4 );
43
-
44
  wp_localize_script( 'imagify-js-bulk', 'imagifyBulk', $bulk_data );
45
  wp_enqueue_script( 'imagify-js-chart' );
46
  wp_enqueue_script( 'imagify-js-async' );
@@ -48,17 +48,17 @@ function _imagify_ngg_admin_print_styles() {
48
  }
49
  }
50
 
 
51
  /**
52
  * Add Intercom on Options page an Bulk Optimization
53
  *
54
  * @since 1.5
55
  * @author Jonathan Buttigieg
56
  */
57
- add_action( 'admin_footer', '_imagify_ngg_admin_print_intercom' );
58
  function _imagify_ngg_admin_print_intercom() {
59
  $current_screen = get_current_screen();
60
-
61
  if ( isset( $current_screen ) && false !== strpos( $current_screen->base, '_page_imagify-ngg-bulk-optimization' ) ) {
62
- _imagify_admin_print_intercom();
63
  }
64
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_action( 'admin_print_styles', '_imagify_ngg_admin_print_styles', PHP_INT_MAX );
5
  /**
6
+ * Add some JS for NGG compatibility.
7
  *
8
  * @since 1.5
9
  * @author Jonathan Buttigieg
10
  */
 
11
  function _imagify_ngg_admin_print_styles() {
12
  $current_screen = get_current_screen();
13
+
14
  /**
15
+ * Scripts loaded in /wp-admin/admin.php?page=nggallery-manage-gallery.
16
  */
17
  if ( isset( $current_screen ) && ( 'nggallery-manage-images' === $current_screen->base || 'nggallery-manage-gallery' === $current_screen->base ) ) {
18
  $upload_data = array(
19
+ 'bulkActionsLabels' => array(
20
  'optimize' => __( 'Optimize', 'imagify' ),
21
  'restore' => __( 'Restore Original', 'imagify' ),
22
  ),
23
  );
24
  wp_localize_script( 'imagify-js-upload', 'imagifyUpload', $upload_data );
25
+
26
  wp_enqueue_script( 'imagify-js-chart' );
27
  wp_enqueue_script( 'imagify-js-upload' );
28
  }
29
+
30
  /**
31
+ * Scripts loaded in /wp-admin/admin.php?page=imagify-ngg-bulk-optimization.
32
  */
33
  if ( isset( $current_screen ) && false !== strpos( $current_screen->base, '_page_imagify-ngg-bulk-optimization' ) ) {
34
  wp_enqueue_script( 'heartbeat' );
37
  $bulk_data['heartbeat_id'] = 'update_ngg_bulk_data';
38
  $bulk_data['ajax_action'] = 'imagify_ngg_get_unoptimized_attachment_ids';
39
  $bulk_data['ajax_context'] = 'NGG';
40
+
41
  /** This filter is documented in inc/admin/enqueue.php */
42
+ $bulk_data['buffer_size'] = apply_filters( 'imagify_bulk_buffer_size', 4 );
43
+
44
  wp_localize_script( 'imagify-js-bulk', 'imagifyBulk', $bulk_data );
45
  wp_enqueue_script( 'imagify-js-chart' );
46
  wp_enqueue_script( 'imagify-js-async' );
48
  }
49
  }
50
 
51
+ add_action( 'admin_footer', '_imagify_ngg_admin_print_intercom' );
52
  /**
53
  * Add Intercom on Options page an Bulk Optimization
54
  *
55
  * @since 1.5
56
  * @author Jonathan Buttigieg
57
  */
 
58
  function _imagify_ngg_admin_print_intercom() {
59
  $current_screen = get_current_screen();
60
+
61
  if ( isset( $current_screen ) && false !== strpos( $current_screen->base, '_page_imagify-ngg-bulk-optimization' ) ) {
62
+ _imagify_admin_print_intercom();
63
  }
64
+ }
inc/3rd-party/nextgen-gallery/inc/admin/gallery.php CHANGED
@@ -1,13 +1,16 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
- /*
5
- * Add "Imagify" column in admin.php?page=nggallery-manage-gallery
 
6
  *
7
  * @since 1.5
8
  * @author Jonathan Buttigieg
 
 
 
9
  */
10
- add_filter( 'ngg_manage_images_number_of_columns', '_imagify_ngg_manage_images_number_of_columns' );
11
  function _imagify_ngg_manage_images_number_of_columns( $count ) {
12
  $count++;
13
  add_filter( 'ngg_manage_images_column_' . $count . '_header', '_imagify_ngg_manage_media_columns' );
@@ -16,11 +19,29 @@ function _imagify_ngg_manage_images_number_of_columns( $count ) {
16
  return $count;
17
  }
18
 
 
 
 
 
 
 
 
 
19
  function _imagify_ngg_manage_media_columns() {
20
  return 'Imagify';
21
  }
22
 
 
 
 
 
 
 
 
 
 
 
23
  function _imagify_ngg_manage_media_custom_column( $output, $image ) {
24
  $attachment = new Imagify_NGG_Attachment( $image );
25
- echo get_imagify_media_column_content( $attachment, 'NGG' );
26
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_filter( 'ngg_manage_images_number_of_columns', '_imagify_ngg_manage_images_number_of_columns' );
5
+ /**
6
+ * Add "Imagify" column in admin.php?page=nggallery-manage-gallery.
7
  *
8
  * @since 1.5
9
  * @author Jonathan Buttigieg
10
+ *
11
+ * @param int $count Number of columns.
12
+ * @return int Incremented number of columns.
13
  */
 
14
  function _imagify_ngg_manage_images_number_of_columns( $count ) {
15
  $count++;
16
  add_filter( 'ngg_manage_images_column_' . $count . '_header', '_imagify_ngg_manage_media_columns' );
19
  return $count;
20
  }
21
 
22
+ /**
23
+ * Get the column title.
24
+ *
25
+ * @since 1.5
26
+ * @author Jonathan Buttigieg
27
+ *
28
+ * @return string
29
+ */
30
  function _imagify_ngg_manage_media_columns() {
31
  return 'Imagify';
32
  }
33
 
34
+ /**
35
+ * Get the column content.
36
+ *
37
+ * @since 1.5
38
+ * @author Jonathan Buttigieg
39
+ *
40
+ * @param string $output The column content.
41
+ * @param object $image An NGG Image object.
42
+ * @return string
43
+ */
44
  function _imagify_ngg_manage_media_custom_column( $output, $image ) {
45
  $attachment = new Imagify_NGG_Attachment( $image );
46
+ return get_imagify_media_column_content( $attachment, 'NGG' );
47
+ }
inc/3rd-party/nextgen-gallery/inc/admin/heartbeat.php CHANGED
@@ -1,41 +1,47 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  global $pagenow;
5
 
 
6
  /**
7
  * Prepare the data that goes back with the Heartbeat API.
8
  *
9
  * @since 1.5
 
 
 
 
10
  */
11
- add_filter( 'heartbeat_received', '_imagify_ngg_heartbeat_received', 10, 2 );
12
- function _imagify_ngg_heartbeat_received( $response, $data ) {
13
- if( isset( $data['imagify_heartbeat'] ) && 'update_ngg_bulk_data' === $data['imagify_heartbeat'] ) {
14
- add_filter( 'imagify_count_saving_data', 'imagify_ngg_count_saving_data' );
15
- $saving_data = imagify_count_saving_data();
16
- $user = new Imagify_User();
17
 
18
- $response['imagify_bulk_data'] = array(
19
- 'already_optimized_attachments' => $saving_data['count'],
20
- 'optimized_attachments' => imagify_ngg_count_optimized_attachments(),
21
- 'unoptimized_attachments' => imagify_ngg_count_unoptimized_attachments(),
22
- 'errors_attachments' => imagify_ngg_count_error_attachments(),
23
- 'optimized_attachments_percent' => imagify_ngg_percent_optimized_attachments(),
24
- 'optimized_percent' => $saving_data['percent'],
25
- 'original_human' => size_format( $saving_data['original_size'], 1 ),
26
- 'optimized_human' => size_format( $saving_data['optimized_size'], 1 ),
27
- 'unconsumed_quota' => $user->get_percent_unconsumed_quota(),
28
- );
29
- }
30
-
31
- return $response;
 
 
 
32
  }
33
 
34
  /**
35
- * Update the Heartbeat API settings
36
  *
37
  * @since 1.5
38
  */
39
- if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && 'imagify-ngg-bulk-optimization' === $_GET['page'] ) {
40
- add_filter( 'heartbeat_settings', '_imagify_heartbeat_settings', PHP_INT_MAX );
41
- }
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  global $pagenow;
5
 
6
+ add_filter( 'heartbeat_received', '_imagify_ngg_heartbeat_received', 10, 2 );
7
  /**
8
  * Prepare the data that goes back with the Heartbeat API.
9
  *
10
  * @since 1.5
11
+ *
12
+ * @param array $response The Heartbeat response.
13
+ * @param array $data The $_POST data sent.
14
+ * @return array
15
  */
16
+ function _imagify_ngg_heartbeat_received( $response, $data ) {
17
+ if ( ! isset( $data['imagify_heartbeat'] ) || 'update_ngg_bulk_data' !== $data['imagify_heartbeat'] ) {
18
+ return $response;
19
+ }
 
 
20
 
21
+ add_filter( 'imagify_count_saving_data', 'imagify_ngg_count_saving_data' );
22
+ $saving_data = imagify_count_saving_data();
23
+ $user = new Imagify_User();
24
+
25
+ $response['imagify_bulk_data'] = array(
26
+ 'already_optimized_attachments' => $saving_data['count'],
27
+ 'optimized_attachments' => imagify_ngg_count_optimized_attachments(),
28
+ 'unoptimized_attachments' => imagify_ngg_count_unoptimized_attachments(),
29
+ 'errors_attachments' => imagify_ngg_count_error_attachments(),
30
+ 'optimized_attachments_percent' => imagify_ngg_percent_optimized_attachments(),
31
+ 'optimized_percent' => $saving_data['percent'],
32
+ 'original_human' => size_format( $saving_data['original_size'], 1 ),
33
+ 'optimized_human' => size_format( $saving_data['optimized_size'], 1 ),
34
+ 'unconsumed_quota' => $user->get_percent_unconsumed_quota(),
35
+ );
36
+
37
+ return $response;
38
  }
39
 
40
  /**
41
+ * Update the Heartbeat API settings.
42
  *
43
  * @since 1.5
44
  */
45
+ if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && 'imagify-ngg-bulk-optimization' === $_GET['page'] ) { // WPCS: CSRF ok.
46
+ add_filter( 'heartbeat_settings', '_imagify_heartbeat_settings', PHP_INT_MAX );
47
+ }
inc/3rd-party/nextgen-gallery/inc/admin/menu.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
4
  /**
5
  * Add submenu in menu "Media"
6
  *
7
  * @since 1.5
8
  * @author Jonathan Buttigieg
9
  */
10
- add_action( 'admin_menu', '_imagify_ngg_bulk_optimization_menu' );
11
  function _imagify_ngg_bulk_optimization_menu() {
12
  if ( ! defined( 'NGGFOLDER' ) ) {
13
  return;
14
  }
15
-
16
- add_submenu_page( NGGFOLDER, __( 'Bulk Optimization', 'imagify' ), __( 'Bulk Optimization', 'imagify' ), apply_filters( 'imagify_capacity', 'manage_options' ), IMAGIFY_SLUG . '-ngg-bulk-optimization', '_imagify_display_bulk_page' );
17
- }
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_action( 'admin_menu', '_imagify_ngg_bulk_optimization_menu' );
5
  /**
6
  * Add submenu in menu "Media"
7
  *
8
  * @since 1.5
9
  * @author Jonathan Buttigieg
10
  */
 
11
  function _imagify_ngg_bulk_optimization_menu() {
12
  if ( ! defined( 'NGGFOLDER' ) ) {
13
  return;
14
  }
15
+
16
+ add_submenu_page( NGGFOLDER, __( 'Bulk Optimization', 'imagify' ), __( 'Bulk Optimization', 'imagify' ), imagify_get_capacity( true ), IMAGIFY_SLUG . '-ngg-bulk-optimization', '_imagify_display_bulk_page' );
17
+ }
inc/3rd-party/nextgen-gallery/inc/classes/class-attachment.php DELETED
@@ -1,480 +0,0 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
-
4
- class Imagify_NGG_Attachment extends Imagify_Abstract_Attachment {
5
- /**
6
- * The image object
7
- *
8
- * @since 1.5
9
- *
10
- * @var object
11
- * @access public
12
- */
13
- public $image;
14
-
15
- /**
16
- * The constructor
17
- *
18
- * @since 1.5
19
- * @author Jonathan Buttigieg
20
- *
21
- * @return void
22
- **/
23
- function __construct( $id ) {
24
- if ( is_object( $id ) ) {
25
- $this->image = $id;
26
- $this->id = $id->pid;
27
- } else {
28
- $this->image = nggdb::find_image( (int) $id );
29
- $this->id = $this->image->pid;
30
- }
31
-
32
- $this->row = $this->get_row();
33
-
34
- // Load nggAdmin classe
35
- $ngg_admin_functions_path = WP_PLUGIN_DIR . '/' . NGGFOLDER . '/products/photocrati_nextgen/modules/ngglegacy/admin/functions.php';
36
-
37
- if ( ! class_exists( 'nggAdmin' ) && file_exists( $ngg_admin_functions_path ) ) {
38
- require_once( $ngg_admin_functions_path );
39
- }
40
- }
41
-
42
- /**
43
- * Get the attachment backup filepath.
44
- *
45
- * @since 1.5
46
- * @author Jonathan Buttigieg
47
- *
48
- * @access public
49
- * @return string|false
50
- */
51
- public function get_backup_path() {
52
- $backup_path = $this->get_original_path() . '_backup';
53
-
54
- if( file_exists( $backup_path ) ) {
55
- return $backup_path;
56
- }
57
-
58
- return false;
59
- }
60
-
61
- /**
62
- * Get the attachment optimization data.
63
- *
64
- * @since 1.5
65
- * @author Jonathan Buttigieg
66
- *
67
- * @access public
68
- * @return array
69
- */
70
- public function get_data() {
71
- $row = ( (bool) $this->row ) ? $this->row : $this->get_row();
72
- return isset( $row['data'] ) ? unserialize( $row['data'] ) : false;
73
- }
74
-
75
- /**
76
- * Get the attachment optimization level.
77
- *
78
- * @since 1.5
79
- * @author Jonathan Buttigieg
80
- *
81
- * @access public
82
- * @return int
83
- */
84
- public function get_optimization_level() {
85
- $row = ( (bool) $this->row ) ? $this->row : $this->get_row();
86
- return isset( $row['optimization_level'] ) ? $row['optimization_level'] : false;
87
- }
88
-
89
- /**
90
- * Get the attachment SQL data row.
91
- *
92
- * @since 1.5
93
- * @author Jonathan Buttigieg
94
- *
95
- * @access public
96
- * @return array
97
- */
98
- public function get_row() {
99
- $result = Imagify_NGG_DB()->get( $this->id );
100
- return $result;
101
- }
102
-
103
- /**
104
- * Get the attachment optimization status (success or error).
105
- *
106
- * @since 1.5
107
- * @author Jonathan Buttigieg
108
- *
109
- * @access public
110
- * @return string
111
- */
112
- public function get_status() {
113
- $row = ( (bool) $this->row ) ? $this->row : $this->get_row();
114
- return isset( $row['status'] ) ? $row['status'] : false;
115
- }
116
-
117
- /**
118
- * Get the original attachment path.
119
- *
120
- * @since 1.5
121
- * @author Jonathan Buttigieg
122
- *
123
- * @access public
124
- * @return string
125
- */
126
- public function get_original_path() {
127
- return $this->image->imagePath;
128
- }
129
-
130
- /**
131
- * Get the original attachment URL.
132
- *
133
- * @since 1.5
134
- * @author Jonathan Buttigieg
135
- *
136
- * @access public
137
- * @return string
138
- */
139
- public function get_original_url() {
140
- return $this->image->imageURL;
141
- }
142
-
143
- /**
144
- * Update the metadata size of the attachment
145
- *
146
- * @since 1.5
147
- *
148
- * @access public
149
- * @return void
150
- */
151
- public function update_metadata_size() {
152
- $size = @getimagesize( $this->get_original_path() );
153
-
154
- if ( isset( $size[0], $size[1] ) ) {
155
- $metadata = $this->image->meta_data;
156
- $metadata['width'] = $metadata['full']['width'] = $size[0];
157
- $metadata['height'] = $metadata['full']['height'] = $size[1];
158
-
159
- nggdb::update_image_meta( $this->id , $metadata );
160
- }
161
- }
162
-
163
- /**
164
- * Fills statistics data with values from $data array
165
- *
166
- * @since 1.5
167
- * @author Jonathan Buttigieg
168
- *
169
- * @access public
170
- * @static
171
- * @param array $data The statistics data
172
- * @param object $response The API response
173
- * @param int $id The attachment ID
174
- * @param int $url The attachment URL
175
- * @param string $size The attachment size key
176
- * @return bool|array False if the original size has an error or an array contains the data for other result
177
- */
178
- static public function fill_data( $data, $response, $id, $url, $size = 'full' ) {
179
- if ( is_wp_error( $response ) ) {
180
- $error = $response->get_error_message();
181
- $error_status = 'error';
182
-
183
- $data['sizes'][ $size ] = array(
184
- 'success' => false,
185
- 'error' => $error
186
- );
187
-
188
- // Update the error status for the original size
189
- if ( 'full' === $size ) {
190
- if ( false !== strpos( $error, 'This image is already compressed' ) ) {
191
- $error_status = 'already_optimized';
192
- }
193
-
194
- IMAGIFY_NGG_DB()->update(
195
- $id,
196
- array(
197
- 'pid' => $id,
198
- 'status' => $error_status,
199
- 'data' => serialize( $data )
200
- )
201
- );
202
-
203
- return false;
204
- }
205
- } else {
206
- $data['sizes'][ $size ] = array(
207
- 'success' => true,
208
- 'file_url' => $url,
209
- 'original_size' => $response->original_size,
210
- 'optimized_size' => $response->new_size,
211
- 'percent' => $response->percent
212
- );
213
-
214
- $data['stats']['original_size'] += ( isset( $response->original_size ) ) ? $response->original_size : 0;
215
- $data['stats']['optimized_size'] += ( isset( $response->new_size ) ) ? $response->new_size : 0;
216
- $data['stats']['percent'] = round( ( ( $data['stats']['original_size'] - $data['stats']['optimized_size'] ) / $data['stats']['original_size'] ) * 100, 2 );
217
- }
218
-
219
- return $data;
220
- }
221
-
222
- /**
223
- * Optimize all sizes with Imagify.
224
- *
225
- * @since 1.5
226
- * @author Jonathan Buttigieg
227
- *
228
- * @access public
229
- * @param int $optimization_level The optimization level (2=ultra, 1=aggressive, 0=normal)
230
- * @param array $metadata The attachment meta data (not used here)
231
- * @return array $data The optimization data
232
- */
233
- public function optimize( $optimization_level = null, $metadata = array() ) {
234
- $optimization_level = ( is_null( $optimization_level ) ) ? (int) get_imagify_option( 'optimization_level', 1 ) : (int) $optimization_level;
235
-
236
- $id = $this->id;
237
- $data = array(
238
- 'stats' => array(
239
- 'original_size' => 0,
240
- 'optimized_size' => 0,
241
- 'percent' => 0,
242
- )
243
- );
244
-
245
- // To avoid issue with "original_size" at 0 in "_imagify_data"
246
- if ( 0 === $this->get_stats_data( 'original_size' ) ) {
247
- delete_post_meta( $id, '_imagify_data' );
248
- delete_post_meta( $id, '_imagify_status' );
249
- delete_post_meta( $id, '_imagify_optimization_level' );
250
- }
251
-
252
- // Get file path & URL for original image
253
- $attachment_path = $this->get_original_path();
254
- $attachment_url = $this->get_original_url();
255
- $attachment_original_size = $this->get_original_size( false );
256
-
257
- // Check if the full size is already optimized
258
- if ( $this->is_optimized() && ( $this->get_optimization_level() == $optimization_level ) ) {
259
- return;
260
- }
261
-
262
- /**
263
- * Fires before optimizing an attachment.
264
- *
265
- * @since 1.5
266
- *
267
- * @param int $id The attachment ID
268
- */
269
- do_action( 'before_imagify_ngg_optimize_attachment', $id );
270
-
271
- set_transient( 'imagify-ngg-async-in-progress-' . $id, true, 10 * MINUTE_IN_SECONDS );
272
-
273
- // Get the resize values for the original size
274
- $resized = false;
275
- $do_resize = get_imagify_option( 'resize_larger', false );
276
- $resize_width = get_imagify_option( 'resize_larger_w' );
277
- $attachment_size = @getimagesize( $attachment_path );
278
-
279
- if ( $do_resize && isset( $attachment_size[0] ) && $resize_width < $attachment_size[0] ) {
280
- $resized_attachment_path = $this->resize( $attachment_path, $attachment_size, $resize_width );
281
-
282
- if ( ! is_wp_error( $resized_attachment_path ) ) {
283
- if ( get_imagify_option( 'backup', false ) ) {
284
- $backup_path = get_imagify_attachment_backup_path( $attachment_path );
285
- $backup_path_info = pathinfo( $backup_path );
286
-
287
- wp_mkdir_p( $backup_path_info['dirname'] );
288
-
289
- // TO DO - check and send a error message if the backup can't be created
290
- @copy( $attachment_path, $backup_path );
291
- imagify_chmod_file( $backup_path );
292
- }
293
-
294
- @rename( $resized_attachment_path, $attachment_path );
295
- imagify_chmod_file( $attachment_path );
296
-
297
- // If resized temp file still exists, delete it
298
- if ( file_exists( $resized_attachment_path ) ) {
299
- unlink( $resized_attachment_path );
300
- }
301
-
302
- $resized = true;
303
- }
304
- }
305
-
306
- // Optimize the original size
307
- $response = do_imagify( $attachment_path, array(
308
- 'optimization_level' => $optimization_level,
309
- 'context' => 'ngg',
310
- 'resized' => $resized,
311
- 'original_size' => $attachment_original_size,
312
- ) );
313
- $data = $this->fill_data( $data, $response, $id, $attachment_url );
314
-
315
- // Save the optimization level
316
- IMAGIFY_NGG_DB()->update(
317
- $id,
318
- array(
319
- 'pid' => $id,
320
- 'optimization_level' => $optimization_level
321
- )
322
- );
323
-
324
- if ( (bool) ! $data ) {
325
- delete_transient( 'imagify-ngg-async-in-progress-' . $id );
326
- return;
327
- }
328
-
329
- // If we resized the original with success, we have to update the attachment metadata
330
- // If not, WordPress keeps the old attachment size.
331
- if ( $do_resize && $resized ) {
332
- $this->update_metadata_size();
333
- }
334
-
335
- // Optimize thumbnails
336
- $data = $this->optimize_thumbnails( $optimization_level, $data );
337
-
338
- // Save the status to success
339
- IMAGIFY_NGG_DB()->update(
340
- $id,
341
- array(
342
- 'pid' => $id,
343
- 'status' => 'success',
344
- )
345
- );
346
-
347
- /**
348
- * Fires after optimizing an attachment.
349
- *
350
- * @since 1.5
351
- *
352
- * @param int $id The attachment ID
353
- * @param array $data The optimization data
354
- */
355
- do_action( 'after_imagify_ngg_optimize_attachment', $id, $data );
356
-
357
- delete_transient( 'imagify-ngg-async-in-progress-' . $id );
358
-
359
- return $data;
360
- }
361
-
362
- /**
363
- * Optimize all thumbnails of an image
364
- *
365
- * @since 1.5
366
- * @author Jonathan Buttigieg
367
- *
368
- * @access public
369
- * @param int $optimization_level The optimization level (2=ultra, 1=aggressive, 0=normal)
370
- * @return array $data The optimization data
371
- */
372
- public function optimize_thumbnails( $optimization_level = null, $data = array() ) {
373
- $id = $this->id;
374
- $storage = C_Gallery_Storage::get_instance();
375
- $sizes = $storage->get_image_sizes();
376
- $data = ( (bool) $data ) ? $data : $this->get_data();
377
-
378
- // Stop if the original image has an error
379
- if ( $this->has_error() ) {
380
- return $data;
381
- }
382
-
383
- $optimization_level = ( is_null( $optimization_level ) ) ? (int) get_imagify_option( 'optimization_level', 1 ) : (int) $optimization_level;
384
-
385
- /**
386
- * Fires before optimizing all thumbnails.
387
- *
388
- * @since 1.5
389
- *
390
- * @param int $id The image ID
391
- */
392
- do_action( 'before_imagify_ngg_optimize_thumbnails', $id );
393
-
394
- if ( (bool) $sizes ) {
395
- foreach ( $sizes as $size_key ) {
396
- if ( 'full' == $size_key || isset( $data['sizes'][ $size_key ]['success'] ) ) {
397
- continue;
398
- }
399
-
400
- $thumbnail_path = $storage->get_image_abspath( $this->image, $size_key );
401
- $thumbnail_url = $storage->get_image_url( $this->image, $size_key );
402
-
403
- // Optimize the thumbnail size
404
- $response = do_imagify( $thumbnail_path, array(
405
- 'backup' => false,
406
- 'optimization_level' => $optimization_level,
407
- 'context' => 'wp'
408
- ) );
409
- $data = $this->fill_data( $data, $response, $id, $thumbnail_url, $size_key );
410
-
411
- /** This filter is documented in /inc/classes/class-attachment.php */
412
- $data = apply_filters( 'imagify_fill_ngg_thumbnail_data', $data, $response, $id, $thumbnail_path, $thumbnail_url, $size_key, $optimization_level );
413
- }
414
-
415
- IMAGIFY_NGG_DB()->update(
416
- $id,
417
- array(
418
- 'pid' => $id,
419
- 'data' => serialize( $data )
420
- )
421
- );
422
- }
423
-
424
- /**
425
- * Fires after optimizing all thumbnails.
426
- *
427
- * @since 1.5
428
- *
429
- * @param int $id The image ID
430
- * @param array $data The optimization data
431
- */
432
- do_action( 'after_imagify_ngg_optimize_thumbnails', $id, $data );
433
-
434
- return $data;
435
- }
436
-
437
- /**
438
- * Process an attachment restoration from the backup file.
439
- *
440
- * @since 1.5
441
- * @author Jonathan Buttigieg
442
- *
443
- * @access public
444
- * @return void
445
- */
446
- public function restore() {
447
- // Stop the process if there is no backup file to restore
448
- if ( ! $this->has_backup() ) {
449
- return;
450
- }
451
-
452
- $id = $this->id;
453
- $backup_path = $this->get_backup_path();
454
- $attachment_path = $this->get_original_path();
455
-
456
- /**
457
- * Fires before restoring an attachment.
458
- *
459
- * @since 1.5
460
- *
461
- * @param int $id The attachment ID
462
- */
463
- do_action( 'before_imagify_ngg_restore_attachment', $id );
464
-
465
- // Create the original image from the backup
466
- C_Gallery_Storage::get_instance()->recover_image( $id );
467
-
468
- // Remove old optimization data
469
- Imagify_NGG_DB()->delete( $id );
470
-
471
- /**
472
- * Fires after restoring an attachment.
473
- *
474
- * @since 1.5
475
- *
476
- * @param int $id The attachment ID
477
- */
478
- do_action( 'after_imagify_ngg_restore_attachment', $id );
479
- }
480
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg-attachment.php ADDED
@@ -0,0 +1,515 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
+
4
+ /**
5
+ * Imagify NextGen Gallery attachment class.
6
+ *
7
+ * @since 1.5
8
+ * @author Jonathan Buttigieg
9
+ */
10
+ class Imagify_NGG_Attachment extends Imagify_Attachment {
11
+
12
+ /**
13
+ * Class version.
14
+ *
15
+ * @var string
16
+ */
17
+ const VERSION = '1.0.1';
18
+
19
+ /**
20
+ * The image object.
21
+ *
22
+ * @since 1.5
23
+ *
24
+ * @var object A nggImage object.
25
+ * @access public
26
+ */
27
+ public $image;
28
+
29
+ /**
30
+ * The attachment SQL data row.
31
+ *
32
+ * @since 1.5
33
+ *
34
+ * @var array
35
+ * @access public
36
+ */
37
+ public $row;
38
+
39
+ /**
40
+ * The constructor.
41
+ *
42
+ * @since 1.5
43
+ * @author Jonathan Buttigieg
44
+ *
45
+ * @param int|object $id An image attachment ID or a NGG object.
46
+ * @return void
47
+ */
48
+ public function __construct( $id ) {
49
+ if ( is_object( $id ) ) {
50
+ $this->image = $id;
51
+ $this->id = $id->pid;
52
+ } else {
53
+ $this->image = nggdb::find_image( (int) $id );
54
+ $this->id = $this->image->pid;
55
+ }
56
+
57
+ $this->row = $this->get_row();
58
+
59
+ // Load nggAdmin class.
60
+ $ngg_admin_functions_path = WP_PLUGIN_DIR . '/' . NGGFOLDER . '/products/photocrati_nextgen/modules/ngglegacy/admin/functions.php';
61
+
62
+ if ( ! class_exists( 'nggAdmin' ) && file_exists( $ngg_admin_functions_path ) ) {
63
+ require_once( $ngg_admin_functions_path );
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Get the attachment backup filepath.
69
+ *
70
+ * @since 1.5
71
+ * @author Jonathan Buttigieg
72
+ *
73
+ * @access public
74
+ * @return string|bool The path. False on failure.
75
+ */
76
+ public function get_backup_path() {
77
+ $backup_path = $this->get_original_path() . '_backup';
78
+
79
+ if ( file_exists( $backup_path ) ) {
80
+ return $backup_path;
81
+ }
82
+
83
+ return false;
84
+ }
85
+
86
+ /**
87
+ * Get the attachment optimization data.
88
+ *
89
+ * @since 1.5
90
+ * @author Jonathan Buttigieg
91
+ *
92
+ * @access public
93
+ * @return array|bool
94
+ */
95
+ public function get_data() {
96
+ $row = $this->row ? $this->row : $this->get_row();
97
+ return isset( $row['data'] ) ? maybe_unserialize( $row['data'] ) : false;
98
+ }
99
+
100
+ /**
101
+ * Get the attachment optimization level.
102
+ *
103
+ * @since 1.5
104
+ * @author Jonathan Buttigieg
105
+ *
106
+ * @access public
107
+ * @return int|bool
108
+ */
109
+ public function get_optimization_level() {
110
+ $row = $this->row ? $this->row : $this->get_row();
111
+ return isset( $row['optimization_level'] ) ? (int) $row['optimization_level'] : false;
112
+ }
113
+
114
+ /**
115
+ * Get the attachment SQL data row.
116
+ *
117
+ * @since 1.5
118
+ * @author Jonathan Buttigieg
119
+ *
120
+ * @access public
121
+ * @return array
122
+ */
123
+ public function get_row() {
124
+ return imagify_ngg_db()->get( $this->id );
125
+ }
126
+
127
+ /**
128
+ * Get the attachment optimization status (success or error).
129
+ *
130
+ * @since 1.5
131
+ * @author Jonathan Buttigieg
132
+ *
133
+ * @access public
134
+ * @return string|bool
135
+ */
136
+ public function get_status() {
137
+ $row = $this->row ? $this->row : $this->get_row();
138
+ return isset( $row['status'] ) ? $row['status'] : false;
139
+ }
140
+
141
+ /**
142
+ * Get the original attachment path.
143
+ *
144
+ * @since 1.5
145
+ * @author Jonathan Buttigieg
146
+ *
147
+ * @access public
148
+ * @return string
149
+ */
150
+ public function get_original_path() {
151
+ return $this->image->imagePath;
152
+ }
153
+
154
+ /**
155
+ * Get the original attachment URL.
156
+ *
157
+ * @since 1.5
158
+ * @author Jonathan Buttigieg
159
+ *
160
+ * @access public
161
+ * @return string
162
+ */
163
+ public function get_original_url() {
164
+ return $this->image->imageURL;
165
+ }
166
+
167
+ /**
168
+ * Update the metadata size of the attachment.
169
+ *
170
+ * @since 1.5
171
+ *
172
+ * @access public
173
+ * @return void
174
+ */
175
+ public function update_metadata_size() {
176
+ $size = @getimagesize( $this->get_original_path() );
177
+
178
+ if ( isset( $size[0], $size[1] ) ) {
179
+ $metadata = $this->image->meta_data;
180
+ $metadata['width'] = $size[0];
181
+ $metadata['height'] = $size[1];
182
+ $metadata['full']['width'] = $size[0];
183
+ $metadata['full']['height'] = $size[1];
184
+
185
+ nggdb::update_image_meta( $this->id , $metadata );
186
+ }
187
+ }
188
+
189
+ /**
190
+ * Fills statistics data with values from $data array.
191
+ *
192
+ * @since 1.5
193
+ * @since 1.6.5 Not static anymore.
194
+ * @author Jonathan Buttigieg
195
+ * @access public
196
+ *
197
+ * @param array $data The statistics data.
198
+ * @param object $response The API response.
199
+ * @param int $id The attachment ID.
200
+ * @param int $url The attachment URL.
201
+ * @param string $size The attachment size key.
202
+ * @return bool|array False if the original size has an error or an array contains the data for other result.
203
+ */
204
+ public function fill_data( $data, $response, $id, $url, $size = 'full' ) {
205
+ $data['sizes'] = ! empty( $data['sizes'] ) && is_array( $data['sizes'] ) ? $data['sizes'] : array();
206
+
207
+ if ( is_wp_error( $response ) ) {
208
+ $error = $response->get_error_message();
209
+ $error_status = 'error';
210
+
211
+ $data['sizes'][ $size ] = array(
212
+ 'success' => false,
213
+ 'error' => $error,
214
+ );
215
+
216
+ // Update the error status for the original size.
217
+ if ( 'full' === $size ) {
218
+ if ( false !== strpos( $error, 'This image is already compressed' ) ) {
219
+ $error_status = 'already_optimized';
220
+ }
221
+
222
+ imagify_ngg_db()->update( $id, array(
223
+ 'pid' => $id,
224
+ 'status' => $error_status,
225
+ 'data' => serialize( $data ),
226
+ ) );
227
+
228
+ return false;
229
+ }
230
+ } else {
231
+ $response = (object) array_merge( array(
232
+ 'original_size' => 0,
233
+ 'new_size' => 0,
234
+ 'percent' => 0,
235
+ ), (array) $response );
236
+
237
+ $data['sizes'][ $size ] = array(
238
+ 'success' => true,
239
+ 'file_url' => $url,
240
+ 'original_size' => $response->original_size,
241
+ 'optimized_size' => $response->new_size,
242
+ 'percent' => $response->percent,
243
+ );
244
+
245
+ $data['stats']['original_size'] += $response->original_size;
246
+ $data['stats']['optimized_size'] += $response->new_size;
247
+ $data['stats']['percent'] = round( ( ( $data['stats']['original_size'] - $data['stats']['optimized_size'] ) / $data['stats']['original_size'] ) * 100, 2 );
248
+ } // End if().
249
+
250
+ return $data;
251
+ }
252
+
253
+ /**
254
+ * Optimize all sizes with Imagify.
255
+ *
256
+ * @since 1.5
257
+ * @author Jonathan Buttigieg
258
+ *
259
+ * @access public
260
+ * @param int $optimization_level The optimization level (2=ultra, 1=aggressive, 0=normal).
261
+ * @param array $metadata The attachment meta data (not used here).
262
+ * @return array $data The optimization data.
263
+ */
264
+ public function optimize( $optimization_level = null, $metadata = array() ) {
265
+ $optimization_level = is_null( $optimization_level ) ? (int) get_imagify_option( 'optimization_level', 1 ) : (int) $optimization_level;
266
+
267
+ $data = array(
268
+ 'stats' => array(
269
+ 'original_size' => 0,
270
+ 'optimized_size' => 0,
271
+ 'percent' => 0,
272
+ ),
273
+ );
274
+
275
+ // To avoid issue with "original_size" at 0 in "_imagify_data".
276
+ if ( 0 === (int) $this->get_stats_data( 'original_size' ) ) {
277
+ delete_post_meta( $this->id, '_imagify_data' );
278
+ delete_post_meta( $this->id, '_imagify_status' );
279
+ delete_post_meta( $this->id, '_imagify_optimization_level' );
280
+ }
281
+
282
+ // Get file path & URL for original image.
283
+ $attachment_path = $this->get_original_path();
284
+ $attachment_url = $this->get_original_url();
285
+ $attachment_original_size = $this->get_original_size( false );
286
+
287
+ // Check if the full size is already optimized.
288
+ if ( $this->is_optimized() && ( $this->get_optimization_level() === $optimization_level ) ) {
289
+ return;
290
+ }
291
+
292
+ /**
293
+ * Fires before optimizing an attachment.
294
+ *
295
+ * @since 1.5
296
+ *
297
+ * @param int $id The attachment ID
298
+ */
299
+ do_action( 'before_imagify_ngg_optimize_attachment', $this->id );
300
+
301
+ set_transient( 'imagify-ngg-async-in-progress-' . $this->id, true, 10 * MINUTE_IN_SECONDS );
302
+
303
+ // Get the resize values for the original size.
304
+ $resized = false;
305
+ $do_resize = get_imagify_option( 'resize_larger', false );
306
+ $resize_width = get_imagify_option( 'resize_larger_w' );
307
+ $attachment_size = @getimagesize( $attachment_path );
308
+
309
+ if ( $do_resize && isset( $attachment_size[0] ) && $resize_width < $attachment_size[0] ) {
310
+ $resized_attachment_path = $this->resize( $attachment_path, $attachment_size, $resize_width );
311
+
312
+ if ( ! is_wp_error( $resized_attachment_path ) ) {
313
+ $filesystem = imagify_get_filesystem();
314
+
315
+ if ( get_imagify_option( 'backup', false ) ) {
316
+ $backup_path = get_imagify_attachment_backup_path( $attachment_path );
317
+ $backup_path_info = pathinfo( $backup_path );
318
+
319
+ wp_mkdir_p( $backup_path_info['dirname'] );
320
+
321
+ // TO DO - check and send a error message if the backup can't be created.
322
+ $filesystem->copy( $attachment_path, $backup_path, true );
323
+ imagify_chmod_file( $backup_path );
324
+ }
325
+
326
+ $filesystem->move( $resized_attachment_path, $attachment_path, true );
327
+ imagify_chmod_file( $attachment_path );
328
+
329
+ // If resized temp file still exists, delete it.
330
+ if ( $filesystem->exists( $resized_attachment_path ) ) {
331
+ $filesystem->delete( $resized_attachment_path );
332
+ }
333
+
334
+ $resized = true;
335
+ }
336
+ }
337
+
338
+ // Optimize the original size.
339
+ $response = do_imagify( $attachment_path, array(
340
+ 'optimization_level' => $optimization_level,
341
+ 'context' => 'NGG',
342
+ 'resized' => $resized,
343
+ 'original_size' => $attachment_original_size,
344
+ ) );
345
+ $data = $this->fill_data( $data, $response, $this->id, $attachment_url );
346
+
347
+ if ( ! $data ) {
348
+ delete_transient( 'imagify-ngg-async-in-progress-' . $this->id );
349
+ return;
350
+ }
351
+
352
+ // Save the optimization level.
353
+ imagify_ngg_db()->update( $this->id, array(
354
+ 'pid' => $this->id,
355
+ 'optimization_level' => $optimization_level,
356
+ ) );
357
+
358
+ // If we resized the original with success, we have to update the attachment metadata.
359
+ // If not, WordPress keeps the old attachment size.
360
+ if ( $do_resize && $resized ) {
361
+ $this->update_metadata_size();
362
+ }
363
+
364
+ // Optimize thumbnails.
365
+ $data = $this->optimize_thumbnails( $optimization_level, $data );
366
+
367
+ // Save the status to success.
368
+ imagify_ngg_db()->update( $this->id, array(
369
+ 'pid' => $this->id,
370
+ 'status' => 'success',
371
+ ) );
372
+
373
+ /**
374
+ * Fires after optimizing an attachment.
375
+ *
376
+ * @since 1.5
377
+ *
378
+ * @param int $id The attachment ID.
379
+ * @param array $data The optimization data.
380
+ */
381
+ do_action( 'after_imagify_ngg_optimize_attachment', $this->id, $data );
382
+
383
+ delete_transient( 'imagify-ngg-async-in-progress-' . $this->id );
384
+
385
+ return $data;
386
+ }
387
+
388
+ /**
389
+ * Optimize all thumbnails of an image.
390
+ *
391
+ * @since 1.5
392
+ * @author Jonathan Buttigieg
393
+ *
394
+ * @access public
395
+ * @param int $optimization_level The optimization level (2=ultra, 1=aggressive, 0=normal).
396
+ * @param array $data The optimization data.
397
+ * @return array $data The optimization data.
398
+ */
399
+ public function optimize_thumbnails( $optimization_level = null, $data = array() ) {
400
+ $storage = C_Gallery_Storage::get_instance();
401
+ $sizes = $storage->get_image_sizes();
402
+ $data = $data ? $data : $this->get_data();
403
+
404
+ // Stop if the original image has an error.
405
+ if ( $this->has_error() ) {
406
+ return $data;
407
+ }
408
+
409
+ $optimization_level = is_null( $optimization_level ) ? (int) get_imagify_option( 'optimization_level', 1 ) : (int) $optimization_level;
410
+
411
+ /**
412
+ * Fires before optimizing all thumbnails.
413
+ *
414
+ * @since 1.5
415
+ *
416
+ * @param int $id The image ID.
417
+ */
418
+ do_action( 'before_imagify_ngg_optimize_thumbnails', $this->id );
419
+
420
+ if ( $sizes ) {
421
+ foreach ( $sizes as $size_key ) {
422
+ if ( 'full' === $size_key || isset( $data['sizes'][ $size_key ]['success'] ) ) {
423
+ continue;
424
+ }
425
+
426
+ $thumbnail_path = $storage->get_image_abspath( $this->image, $size_key );
427
+ $thumbnail_url = $storage->get_image_url( $this->image, $size_key );
428
+
429
+ // Optimize the thumbnail size.
430
+ $response = do_imagify( $thumbnail_path, array(
431
+ 'backup' => false,
432
+ 'optimization_level' => $optimization_level,
433
+ 'context' => 'wp',
434
+ ) );
435
+ $data = $this->fill_data( $data, $response, $this->id, $thumbnail_url, $size_key );
436
+
437
+ /**
438
+ * Filter the optimization data of a specific thumbnail.
439
+ *
440
+ * @since 1.5
441
+ *
442
+ * @param array $data The statistics data.
443
+ * @param object $response The API response.
444
+ * @param int $id The attachment ID.
445
+ * @param string $thumbnail_path The attachment path.
446
+ * @param string $thumbnail_url The attachment URL.
447
+ * @param string $size_key The attachment size key.
448
+ * @param bool $is_aggressive The optimization level.
449
+ * @return array $data The new optimization data.
450
+ */
451
+ $data = apply_filters( 'imagify_fill_ngg_thumbnail_data', $data, $response, $this->id, $thumbnail_path, $thumbnail_url, $size_key, $optimization_level );
452
+ }
453
+
454
+ imagify_ngg_db()->update( $this->id, array(
455
+ 'pid' => $this->id,
456
+ 'data' => serialize( $data ),
457
+ ) );
458
+ } // End if().
459
+
460
+ /**
461
+ * Fires after optimizing all thumbnails.
462
+ *
463
+ * @since 1.5
464
+ *
465
+ * @param int $id The image ID.
466
+ * @param array $data The optimization data.
467
+ */
468
+ do_action( 'after_imagify_ngg_optimize_thumbnails', $this->id, $data );
469
+
470
+ return $data;
471
+ }
472
+
473
+ /**
474
+ * Process an attachment restoration from the backup file.
475
+ *
476
+ * @since 1.5
477
+ * @author Jonathan Buttigieg
478
+ *
479
+ * @access public
480
+ * @return void
481
+ */
482
+ public function restore() {
483
+ // Stop the process if there is no backup file to restore.
484
+ if ( ! $this->has_backup() ) {
485
+ return;
486
+ }
487
+
488
+ $backup_path = $this->get_backup_path();
489
+ $attachment_path = $this->get_original_path();
490
+
491
+ /**
492
+ * Fires before restoring an attachment.
493
+ *
494
+ * @since 1.5
495
+ *
496
+ * @param int $id The attachment ID.
497
+ */
498
+ do_action( 'before_imagify_ngg_restore_attachment', $this->id );
499
+
500
+ // Create the original image from the backup.
501
+ C_Gallery_Storage::get_instance()->recover_image( $this->id );
502
+
503
+ // Remove old optimization data.
504
+ imagify_ngg_db()->delete( $this->id );
505
+
506
+ /**
507
+ * Fires after restoring an attachment.
508
+ *
509
+ * @since 1.5
510
+ *
511
+ * @param int $id The attachment ID.
512
+ */
513
+ do_action( 'after_imagify_ngg_restore_attachment', $this->id );
514
+ }
515
+ }
inc/3rd-party/nextgen-gallery/inc/classes/{class-db.php → class-imagify-ngg-db.php} RENAMED
@@ -1,67 +1,75 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  /**
5
- * Imagify NextGen Gallery DB class
6
  *
7
  * @since 1.5
8
  * @author Jonathan Buttigieg
9
- */
10
  class Imagify_NGG_DB extends Imagify_Abstract_DB {
 
 
 
 
 
 
 
 
11
  /**
12
- * The single instance of the class
13
  *
14
  * @access protected
15
  * @since 1.5
 
 
16
  */
17
- protected static $_instance = null;
18
-
19
  /**
20
- * Get things started
21
  *
22
  * @access public
23
  * @since 1.5
24
- * @author Jonathan Buttigieg
25
  */
26
- public function __construct() {
27
  global $wpdb;
28
-
29
  $this->table_name = $wpdb->prefix . 'ngg_imagify_data';
30
- $this->primary_key = 'pid'; // instead of data_id
31
  $this->version = '1.0';
32
-
33
- // Database declaration
34
  $wpdb->ngg_imagify_data = $this->table_name;
35
-
36
- // Add table to the index of WordPress tables
37
  $wpdb->tables[] = 'ngg_imagify_data';
38
  }
39
-
40
  /**
41
- * Main Instance
42
- *
43
- * Ensures only one instance of class is loaded or can be loaded.
44
  *
45
  * @access public
46
- * @since 1.5
47
- * @author Jonathan Buttigieg
48
  *
49
- * @return Main instance
50
  */
51
- public static function instance() {
52
- if ( is_null( self::$_instance ) ) {
53
  self::$_instance = new self();
54
  }
55
 
56
  return self::$_instance;
57
  }
58
-
59
  /**
60
- * Whitelist of columns
61
  *
62
  * @access public
63
  * @since 1.5
64
- * @author Jonathan Buttigieg
65
  *
66
  * @return array
67
  */
@@ -76,11 +84,11 @@ class Imagify_NGG_DB extends Imagify_Abstract_DB {
76
  }
77
 
78
  /**
79
- * Default column values
80
  *
81
  * @access public
82
  * @since 1.5
83
- * @author Jonathan Buttigieg
84
  *
85
  * @return array
86
  */
@@ -92,49 +100,67 @@ class Imagify_NGG_DB extends Imagify_Abstract_DB {
92
  'data' => '',
93
  );
94
  }
95
-
96
  /**
97
- * Create the table
98
  *
99
  * @access public
100
  * @since 1.5
101
  * @author Jonathan Buttigieg
102
- */
103
  public function create_table() {
104
  global $wpdb;
105
-
106
  if ( ! empty( $wpdb->charset ) ) {
107
  $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
108
  }
109
-
110
  if ( ! empty( $wpdb->collate ) ) {
111
  $charset_collate .= " COLLATE $wpdb->collate";
112
  }
113
-
114
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
115
-
116
- $sql = "CREATE TABLE " . $this->table_name . " (
117
- data_id int(11) NOT NULL AUTO_INCREMENT,
118
- pid int(11) NOT NULL,
119
- optimization_level varchar(1) NOT NULL,
120
- status varchar(30) NOT NULL,
121
- data longtext NOT NULL,
122
- PRIMARY KEY (data_id)
123
  ) $charset_collate;";
124
-
125
  maybe_create_table( $this->table_name, $sql );
126
-
127
  update_option( $this->table_name . '_db_version', $this->version );
128
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  }
130
 
131
  /**
132
- * Returns the main instance of Imagify to prevent the need to use globals.
133
  *
134
- * @since 1.5
135
  * @author Jonathan Buttigieg
 
 
136
  */
137
- function Imagify_NGG_DB() {
138
- return Imagify_NGG_DB::instance();
139
  }
140
- $GLOBALS['imagify_ngg_db'] = Imagify_NGG_DB();
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  /**
5
+ * Imagify NextGen Gallery DB class.
6
  *
7
  * @since 1.5
8
  * @author Jonathan Buttigieg
9
+ */
10
  class Imagify_NGG_DB extends Imagify_Abstract_DB {
11
+
12
+ /**
13
+ * Class version.
14
+ *
15
+ * @var string
16
+ */
17
+ const VERSION = '1.0.1';
18
+
19
  /**
20
+ * The single instance of the class.
21
  *
22
  * @access protected
23
  * @since 1.5
24
+ *
25
+ * @var object
26
  */
27
+ protected static $_instance;
28
+
29
  /**
30
+ * Get things started.
31
  *
32
  * @access public
33
  * @since 1.5
34
+ * @author Jonathan Buttigieg
35
  */
36
+ protected function __construct() {
37
  global $wpdb;
38
+
39
  $this->table_name = $wpdb->prefix . 'ngg_imagify_data';
40
+ $this->primary_key = 'pid'; // Instead of data_id.
41
  $this->version = '1.0';
42
+
43
+ // Database declaration.
44
  $wpdb->ngg_imagify_data = $this->table_name;
45
+
46
+ // Add table to the index of WordPress tables.
47
  $wpdb->tables[] = 'ngg_imagify_data';
48
  }
49
+
50
  /**
51
+ * Get the main Instance.
 
 
52
  *
53
  * @access public
54
+ * @since 1.6.5
55
+ * @author Grégory Viguier
56
  *
57
+ * @return object Main instance.
58
  */
59
+ public static function get_instance() {
60
+ if ( ! isset( self::$_instance ) ) {
61
  self::$_instance = new self();
62
  }
63
 
64
  return self::$_instance;
65
  }
66
+
67
  /**
68
+ * Whitelist of columns.
69
  *
70
  * @access public
71
  * @since 1.5
72
+ * @author Jonathan Buttigieg
73
  *
74
  * @return array
75
  */
84
  }
85
 
86
  /**
87
+ * Default column values.
88
  *
89
  * @access public
90
  * @since 1.5
91
+ * @author Jonathan Buttigieg
92
  *
93
  * @return array
94
  */
100
  'data' => '',
101
  );
102
  }
103
+
104
  /**
105
+ * Create the table.
106
  *
107
  * @access public
108
  * @since 1.5
109
  * @author Jonathan Buttigieg
110
+ */
111
  public function create_table() {
112
  global $wpdb;
113
+
114
  if ( ! empty( $wpdb->charset ) ) {
115
  $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
116
  }
117
+
118
  if ( ! empty( $wpdb->collate ) ) {
119
  $charset_collate .= " COLLATE $wpdb->collate";
120
  }
121
+
122
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
123
+
124
+ $sql = "CREATE TABLE {$this->table_name} (
125
+ data_id int(11) NOT NULL AUTO_INCREMENT,
126
+ pid int(11) NOT NULL,
127
+ optimization_level varchar(1) NOT NULL,
128
+ status varchar(30) NOT NULL,
129
+ data longtext NOT NULL,
130
+ PRIMARY KEY (data_id)
131
  ) $charset_collate;";
132
+
133
  maybe_create_table( $this->table_name, $sql );
134
+
135
  update_option( $this->table_name . '_db_version', $this->version );
136
  }
137
+
138
+ /**
139
+ * Main Instance.
140
+ * Ensures only one instance of class is loaded or can be loaded.
141
+ * Well, actually it ensures nothing since it's not a full singleton pattern.
142
+ *
143
+ * @access public
144
+ * @since 1.5
145
+ * @author Jonathan Buttigieg
146
+ *
147
+ * @return object Main instance.
148
+ */
149
+ public static function instance() {
150
+ $class_name = get_class( $this );
151
+ _deprecated_function( $class_name . '::' . __FUNCTION__ . '()', '1.6.5', 'imagify_ngg_db()' );
152
+ return self::get_instance();
153
+ }
154
  }
155
 
156
  /**
157
+ * Returns the main instance of the Imagify_NGG_DB class.
158
  *
159
+ * @since 1.6.5
160
  * @author Jonathan Buttigieg
161
+ *
162
+ * @return object The Imagify_NGG_DB instance.
163
  */
164
+ function imagify_ngg_db() {
165
+ return Imagify_NGG_DB::get_instance();
166
  }
 
inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg-storage.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
+
4
+ /**
5
+ * Imagify NextGen Gallery storage class.
6
+ *
7
+ * @since 1.5
8
+ * @author Jonathan Buttigieg
9
+ */
10
+ class Imagify_NGG_Storage extends Mixin {
11
+
12
+ /**
13
+ * Class version.
14
+ *
15
+ * @var string
16
+ */
17
+ const VERSION = '1.0.1';
18
+
19
+ /**
20
+ * Delete a gallery AND all the pictures associated to this gallery!
21
+ *
22
+ * @since 1.5
23
+ * @author Jonathan Buttigieg
24
+ *
25
+ * @param int|object $gallery A gallery ID or object.
26
+ * @return bool Whetther tha gallery was been deleted or not.
27
+ */
28
+ public function delete_gallery( $gallery ) {
29
+ $gallery_id = is_numeric( $gallery ) ? $gallery : $gallery->{$gallery->id_field};
30
+ $images_id = nggdb::get_ids_from_gallery( $gallery_id );
31
+
32
+ foreach ( $images_id as $pid ) {
33
+ imagify_ngg_db()->delete( $pid );
34
+ }
35
+
36
+ return $this->call_parent( 'delete_gallery', $gallery );
37
+ }
38
+
39
+ /**
40
+ * Generates a specific size for an image.
41
+ *
42
+ * @since 1.5
43
+ * @author Jonathan Buttigieg
44
+ *
45
+ * @param int|object $image An image ID or NGG object.
46
+ * @param string $size An image size.
47
+ * @param array $params An array of parameters.
48
+ * @param bool $skip_defaults Whatever NGG does with default settings.
49
+ * @return bool|object An object on success. False on failure.
50
+ */
51
+ public function generate_image_size( $image, $size, $params = null, $skip_defaults = false ) {
52
+ // $image could be an object or an (int) image ID.
53
+ if ( is_numeric( $image ) ) {
54
+ $image = $this->object->_image_mapper->find( $image );
55
+ }
56
+
57
+ // If a user adds a watermark, rotates or resizes an image, we restore it.
58
+ // TO DO - waiting for a hook to be able to re-optimize the original size after restoring.
59
+ if ( isset( $image->pid ) && ( true === $params['watermark'] || ( isset( $params['rotation'] ) || isset( $params['flip'] ) ) || ( ! empty( $params['width'] ) || ! empty( $params['height'] ) ) ) ) {
60
+ $attachment = new Imagify_NGG_Attachment( $image->pid );
61
+
62
+ if ( $attachment->is_optimized() ) {
63
+ imagify_ngg_db()->delete( $image->pid );
64
+ }
65
+ }
66
+
67
+ return $this->call_parent( 'generate_image_size', $image, $size, $params, $skip_defaults );
68
+ }
69
+
70
+ /**
71
+ * Recover image from backup copy and reprocess it.
72
+ *
73
+ * @since 1.5
74
+ * @author Jonathan Buttigieg
75
+ *
76
+ * @param int|object $image An image ID or NGG object.
77
+ * @return string|bool Result code on success. False on failure.
78
+ */
79
+ public function recover_image( $image ) {
80
+ // $image could be an object or an (int) image ID.
81
+ if ( is_numeric( $image ) ) {
82
+ $image = $this->object->_image_mapper->find( $image );
83
+ }
84
+
85
+ // Remove Imagify data.
86
+ if ( isset( $image->pid ) ) {
87
+ imagify_ngg_db()->delete( $image->pid );
88
+ }
89
+
90
+ return $this->call_parent( 'recover_image', $image );
91
+ }
92
+ }
inc/3rd-party/nextgen-gallery/inc/classes/class-imagify-ngg.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
+
4
+ /**
5
+ * Imagify NextGen Gallery class.
6
+ *
7
+ * @since 1.5
8
+ * @author Jonathan Buttigieg
9
+ */
10
+ class Imagify_NGG {
11
+
12
+ /**
13
+ * Class version.
14
+ *
15
+ * @var string
16
+ */
17
+ const VERSION = '1.0.2';
18
+
19
+ /**
20
+ * The single instance of the class.
21
+ *
22
+ * @access protected
23
+ * @since 1.5
24
+ *
25
+ * @var object
26
+ */
27
+ protected static $_instance;
28
+
29
+ /**
30
+ * The constructor.
31
+ *
32
+ * @since 1.5
33
+ * @since 1.6.5 Doesn't launch the hooks anymore.
34
+ * @author Jonathan Buttigieg
35
+ *
36
+ * @return void
37
+ */
38
+ protected function __construct() {}
39
+
40
+ /**
41
+ * Launch the hooks.
42
+ *
43
+ * @since 1.6.5
44
+ * @author Grégory Viguier
45
+ */
46
+ public function init() {
47
+ static $done = false;
48
+
49
+ if ( $done ) {
50
+ return;
51
+ }
52
+ $done = true;
53
+
54
+ add_action( 'init', array( $this, 'add_mixin' ) );
55
+ }
56
+
57
+ /**
58
+ * Get the main Instance.
59
+ *
60
+ * Ensures only one instance of class is loaded or can be loaded.
61
+ *
62
+ * @access public
63
+ * @since 1.6.5
64
+ * @author Grégory Viguier
65
+ *
66
+ * @return object Main instance.
67
+ */
68
+ public static function get_instance() {
69
+ if ( ! isset( self::$_instance ) ) {
70
+ self::$_instance = new self();
71
+ }
72
+
73
+ return self::$_instance;
74
+ }
75
+
76
+ /**
77
+ * Add custom NGG mixin to override its functions.
78
+ *
79
+ * @since 1.5
80
+ * @author Jonathan Buttigieg
81
+ *
82
+ * @return void
83
+ */
84
+ function add_mixin() {
85
+ include_once( 'class-imagify-ngg-storage.php' );
86
+ C_Gallery_Storage::get_instance()->get_wrapped_instance()->add_mixin( 'Imagify_NGG_Storage' );
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Returns the main instance of the Imagify_NGG class.
92
+ *
93
+ * @since 1.6.5
94
+ * @author Grégory Viguier
95
+ *
96
+ * @return object The Imagify_NGG instance.
97
+ */
98
+ function imagify_ngg() {
99
+ return Imagify_NGG::get_instance();
100
+ }
inc/3rd-party/nextgen-gallery/inc/classes/class-ngg-storage.php DELETED
@@ -1,72 +0,0 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
-
4
- class Imagify_NGG_Storage extends Mixin {
5
- /**
6
- * Delete a gallery AND all the pictures associated to this gallery!
7
- *
8
- * @since 1.5
9
- * @author Jonathan Buttigieg
10
- *
11
- * @return parent
12
- */
13
- public function delete_gallery( $gallery ) {
14
- $gallery_id = is_numeric( $gallery ) ? $gallery : $gallery->{$gallery->id_field};
15
- $images_id = nggdb::get_ids_from_gallery( $gallery_id );
16
-
17
- foreach( $images_id as $pid ) {
18
- Imagify_NGG_DB()->delete( $pid );
19
- }
20
-
21
- return $this->call_parent( 'delete_gallery', $gallery );
22
- }
23
-
24
- /**
25
- * Generates a specific size for an image
26
- *
27
- * @since 1.5
28
- * @author Jonathan Buttigieg
29
- *
30
- * @return parent
31
- */
32
- public function generate_image_size( $image, $size, $params = null, $skip_defaults = false ) {
33
- // $image could be an object or an (int) image ID
34
- if ( is_numeric( $image ) ) {
35
- $image = $this->object->_image_mapper->find( $image );
36
- }
37
-
38
- // If a user adds a watermark, rotates or resizes an image, we restore it
39
- // TO DO - waiting for a hook to be able to re-optimize the original size after restoring
40
- if ( isset( $image->pid ) && ( true === $params['watermark'] || ( isset( $params['rotation'] ) || isset( $params['flip'] ) ) || ( ! empty( $params['width'] ) || ! empty( $params['height'] ) ) ) ) {
41
- $attachment = new Imagify_NGG_Attachment( $image->pid );
42
-
43
- if ( $attachment->is_optimized() ) {
44
- Imagify_NGG_DB()->delete( $image->pid );
45
- }
46
- }
47
-
48
- return $this->call_parent( 'generate_image_size', $image, $size, $params, $skip_defaults );
49
- }
50
-
51
- /**
52
- * Recover image from backup copy and reprocess it
53
- *
54
- * @since 1.5
55
- * @author Jonathan Buttigieg
56
- *
57
- * @return parent
58
- **/
59
- function recover_image( $image ) {
60
- // $image could be an object or an (int) image ID
61
- if ( is_numeric( $image ) ) {
62
- $image = $this->object->_image_mapper->find( $image );
63
- }
64
-
65
- // Remove Imagify data
66
- if ( isset( $image->pid ) ) {
67
- Imagify_NGG_DB()->delete( $image->pid );
68
- }
69
-
70
- return $this->call_parent( 'recover_image', $image );
71
- }
72
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/3rd-party/nextgen-gallery/inc/classes/class-ngg.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
-
4
- class Imagify_NGG {
5
- /**
6
- * The constructor
7
- *
8
- * @since 1.5
9
- * @author Jonathan Buttigieg
10
- *
11
- * @return void
12
- **/
13
- public function __construct() {
14
- add_action( 'init', array( $this, 'add_mixin' ) );
15
- }
16
-
17
- /**
18
- * Add custom NGG mixin to override its functions
19
- *
20
- * @since 1.5
21
- * @author Jonathan Buttigieg
22
- *
23
- * @return void
24
- **/
25
- function add_mixin() {
26
- include_once( 'class-ngg-storage.php' );
27
- $storage = C_Gallery_Storage::get_instance();
28
- $storage->get_wrapped_instance()->add_mixin( 'Imagify_NGG_Storage' );
29
- }
30
- }
31
-
32
- $Imagify_NGG = new Imagify_NGG();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/3rd-party/nextgen-gallery/inc/common/attachments.php CHANGED
@@ -1,73 +1,86 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
4
  /**
5
- * Auto-optimize when a new attachment is generated
6
  *
7
  * @since 1.5
8
  * @author Jonathan Buttigieg
 
 
 
9
  */
10
- add_action( 'ngg_after_new_images_added', '_imagify_ngg_optimize_attachment', PHP_INT_MAX, 2 );
11
- function _imagify_ngg_optimize_attachment( $galleryID, $image_ids ) {
12
  $api_key = get_imagify_option( 'api_key', false );
13
 
14
- if ( ! empty( $api_key ) && get_imagify_option( 'auto_optimize', false ) ) {
15
- foreach ( $image_ids as $id ) {
16
- $body = array();
17
- $body['metadata'] = 1;
18
- $body['context'] = 'NGG';
19
- $body['attachment_id'] = $id;
20
- $body['action'] = 'imagify_async_optimize_upload_new_media';
21
- $body['_ajax_nonce'] = wp_create_nonce( 'new_media-' . $id );
 
 
 
22
 
23
- imagify_do_async_job( $body );
24
- }
25
  }
26
  }
27
 
 
28
  /**
29
  * Delete the Imagify data when an image is deleted.
30
  *
31
  * @since 1.5
32
  * @author Jonathan Buttigieg
 
 
33
  */
34
- add_action( 'ngg_delete_picture', '_imagify_ngg_delete_picture' );
35
  function _imagify_ngg_delete_picture( $image_id ) {
36
- Imagify_NGG_DB()->delete( $image_id );
37
  }
38
 
 
39
  /**
40
  * Import Imagify data from a WordPress image to a new NGG image
41
  *
42
  * @since 1.5
43
  * @author Jonathan Buttigieg
 
 
 
 
44
  */
45
- add_filter( 'ngg_medialibrary_imported_image', '_imagify_ngg_media_library_imported_image_data', 10, 2 );
46
  function _imagify_ngg_media_library_imported_image_data( $image, $attachment ) {
47
- $attachment = new Imagify_Attachment( $attachment->ID );
 
 
 
 
 
48
 
49
- if ( $attachment->is_optimized() ) {
50
- $full_size = $attachment->get_size_data();
51
- $data = array(
52
- 'stats' => array(
53
- 'original_size' => $full_size['original_size'],
54
- 'optimized_size' => $full_size['optimized_size'],
55
- 'percent' => $full_size['percent']
56
- ),
57
- 'sizes' => array( 'full' => $full_size )
58
- );
59
 
60
- Imagify_NGG_DB()->update(
61
- $image->pid,
62
- array(
63
- 'pid' => $image->pid,
64
- 'optimization_level' => $attachment->get_optimization_level(),
65
- 'status' => $attachment->get_status(),
66
- 'data' => maybe_serialize( $data )
67
- )
68
- );
69
 
70
- $image = new Imagify_NGG_Attachment( $image->pid );
71
- $image->optimize_thumbnails();
72
- }
73
- }
 
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_action( 'ngg_after_new_images_added', '_imagify_ngg_optimize_attachment', PHP_INT_MAX, 2 );
5
  /**
6
+ * Auto-optimize when a new attachment is generated.
7
  *
8
  * @since 1.5
9
  * @author Jonathan Buttigieg
10
+ *
11
+ * @param int $gallery_id A Gallery ID.
12
+ * @param array $image_ids Id's which are sucessfully added.
13
  */
14
+ function _imagify_ngg_optimize_attachment( $gallery_id, $image_ids ) {
 
15
  $api_key = get_imagify_option( 'api_key', false );
16
 
17
+ if ( ! $api_key || ! get_imagify_option( 'auto_optimize', false ) ) {
18
+ return;
19
+ }
20
+
21
+ foreach ( $image_ids as $id ) {
22
+ $body = array();
23
+ $body['metadata'] = 1;
24
+ $body['context'] = 'NGG';
25
+ $body['attachment_id'] = $id;
26
+ $body['action'] = 'imagify_async_optimize_upload_new_media';
27
+ $body['_ajax_nonce'] = wp_create_nonce( 'new_media-' . $id );
28
 
29
+ imagify_do_async_job( $body );
 
30
  }
31
  }
32
 
33
+ add_action( 'ngg_delete_picture', '_imagify_ngg_delete_picture' );
34
  /**
35
  * Delete the Imagify data when an image is deleted.
36
  *
37
  * @since 1.5
38
  * @author Jonathan Buttigieg
39
+ *
40
+ * @param int $image_id An image ID.
41
  */
 
42
  function _imagify_ngg_delete_picture( $image_id ) {
43
+ imagify_ngg_db()->delete( $image_id );
44
  }
45
 
46
+ add_filter( 'ngg_medialibrary_imported_image', '_imagify_ngg_media_library_imported_image_data', 10, 2 );
47
  /**
48
  * Import Imagify data from a WordPress image to a new NGG image
49
  *
50
  * @since 1.5
51
  * @author Jonathan Buttigieg
52
+ *
53
+ * @param object $image A NGG image object.
54
+ * @param object $attachment An attachment object.
55
+ * @return object
56
  */
 
57
  function _imagify_ngg_media_library_imported_image_data( $image, $attachment ) {
58
+ $class_name = get_imagify_attachment_class_name( 'wp' );
59
+ $attachment = new $class_name( $attachment->ID );
60
+
61
+ if ( ! $attachment->is_optimized() ) {
62
+ return $image;
63
+ }
64
 
65
+ $full_size = $attachment->get_size_data();
66
+ $data = array(
67
+ 'stats' => array(
68
+ 'original_size' => $full_size['original_size'],
69
+ 'optimized_size' => $full_size['optimized_size'],
70
+ 'percent' => $full_size['percent'],
71
+ ),
72
+ 'sizes' => array( 'full' => $full_size ),
73
+ );
 
74
 
75
+ imagify_ngg_db()->update( $image->pid, array(
76
+ 'pid' => $image->pid,
77
+ 'optimization_level' => $attachment->get_optimization_level(),
78
+ 'status' => $attachment->get_status(),
79
+ 'data' => maybe_serialize( $data ),
80
+ ) );
 
 
 
81
 
82
+ $image = new Imagify_NGG_Attachment( $image->pid );
83
+ $image->optimize_thumbnails();
84
+
85
+ return $image;
86
+ }
inc/3rd-party/nextgen-gallery/inc/functions/admin-stats.php CHANGED
@@ -1,7 +1,7 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
- /*
5
  * Count number of attachments.
6
  *
7
  * @since 1.5
@@ -11,18 +11,19 @@ defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
11
  */
12
  function imagify_ngg_count_attachments() {
13
  global $wpdb;
14
-
15
  static $count;
16
-
17
- if ( ! $count ) {
18
- $table_name = $wpdb->prefix . "ngg_pictures";
19
- $count = $wpdb->get_var( "SELECT COUNT($table_name.pid) FROM $table_name" );
20
  }
21
-
22
- return (int) $count;
 
 
 
23
  }
24
 
25
- /*
26
  * Count number of optimized attachments with an error.
27
  *
28
  * @since 1.5
@@ -32,15 +33,17 @@ function imagify_ngg_count_attachments() {
32
  */
33
  function imagify_ngg_count_error_attachments() {
34
  static $count;
35
-
36
- if ( ! $count ) {
37
- $count = (int) Imagify_NGG_DB()->get_column_by( 'COUNT(*)', 'status', 'error' );
38
  }
39
-
 
 
40
  return $count;
41
  }
42
 
43
- /*
44
  * Count number of optimized attachments (by Imagify or an other tool before).
45
  *
46
  * @since 1.5
@@ -50,15 +53,17 @@ function imagify_ngg_count_error_attachments() {
50
  */
51
  function imagify_ngg_count_optimized_attachments() {
52
  static $count;
53
-
54
- if ( ! $count ) {
55
- $count = (int) Imagify_NGG_DB()->get_column_by( 'COUNT(*)', 'status', 'success' );
56
  }
57
-
 
 
58
  return $count;
59
  }
60
 
61
- /*
62
  * Count number of unoptimized attachments.
63
  *
64
  * @since 1.0
@@ -67,16 +72,10 @@ function imagify_ngg_count_optimized_attachments() {
67
  * @return int The number of attachments.
68
  */
69
  function imagify_ngg_count_unoptimized_attachments() {
70
- static $count;
71
-
72
- if ( ! $count ) {
73
- $count = imagify_ngg_count_attachments() - imagify_ngg_count_optimized_attachments() - imagify_ngg_count_error_attachments();
74
- }
75
-
76
- return (int) $count;
77
  }
78
 
79
- /*
80
  * Count percent of optimized attachments.
81
  *
82
  * @since 1.0
@@ -85,15 +84,13 @@ function imagify_ngg_count_unoptimized_attachments() {
85
  * @return int The percent of optimized attachments.
86
  */
87
  function imagify_ngg_percent_optimized_attachments() {
88
- $total_attachments = imagify_ngg_count_attachments();
89
- $total_optimized_attachments = imagify_ngg_count_optimized_attachments();
90
 
91
- $percent = ( 0 !== $total_attachments ) ? round( ( 100 - ( ( $total_attachments - ( $total_optimized_attachments ) ) / $total_attachments ) * 100 ) ) : 0;
92
-
93
- return $percent;
94
  }
95
 
96
- /*
97
  * Count percent, original & optimized size of all images optimized by Imagify.
98
  *
99
  * @since 1.5
@@ -103,9 +100,6 @@ function imagify_ngg_percent_optimized_attachments() {
103
  */
104
  function imagify_ngg_count_saving_data() {
105
  global $wpdb;
106
-
107
- $table_name = $wpdb->ngg_imagify_data;
108
- $attachments = $wpdb->get_col( "SELECT $table_name.data FROM $table_name WHERE status = 'success'" );
109
-
110
- return $attachments;
111
- }
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ /**
5
  * Count number of attachments.
6
  *
7
  * @since 1.5
11
  */
12
  function imagify_ngg_count_attachments() {
13
  global $wpdb;
 
14
  static $count;
15
+
16
+ if ( isset( $count ) ) {
17
+ return $count;
 
18
  }
19
+
20
+ $table_name = $wpdb->prefix . 'ngg_pictures';
21
+ $count = (int) $wpdb->get_var( "SELECT COUNT($table_name.pid) FROM $table_name" ); // WPCS: unprepared SQL ok.
22
+
23
+ return $count;
24
  }
25
 
26
+ /**
27
  * Count number of optimized attachments with an error.
28
  *
29
  * @since 1.5
33
  */
34
  function imagify_ngg_count_error_attachments() {
35
  static $count;
36
+
37
+ if ( isset( $count ) ) {
38
+ return $count;
39
  }
40
+
41
+ $count = (int) imagify_ngg_db()->get_column_by( 'COUNT(*)', 'status', 'error' );
42
+
43
  return $count;
44
  }
45
 
46
+ /**
47
  * Count number of optimized attachments (by Imagify or an other tool before).
48
  *
49
  * @since 1.5
53
  */
54
  function imagify_ngg_count_optimized_attachments() {
55
  static $count;
56
+
57
+ if ( isset( $count ) ) {
58
+ return $count;
59
  }
60
+
61
+ $count = (int) imagify_ngg_db()->get_column_by( 'COUNT(*)', 'status', 'success' );
62
+
63
  return $count;
64
  }
65
 
66
+ /**
67
  * Count number of unoptimized attachments.
68
  *
69
  * @since 1.0
72
  * @return int The number of attachments.
73
  */
74
  function imagify_ngg_count_unoptimized_attachments() {
75
+ return imagify_ngg_count_attachments() - imagify_ngg_count_optimized_attachments() - imagify_ngg_count_error_attachments();
 
 
 
 
 
 
76
  }
77
 
78
+ /**
79
  * Count percent of optimized attachments.
80
  *
81
  * @since 1.0
84
  * @return int The percent of optimized attachments.
85
  */
86
  function imagify_ngg_percent_optimized_attachments() {
87
+ $total_attachments = imagify_ngg_count_attachments();
88
+ $total_optimized_attachments = imagify_ngg_count_optimized_attachments();
89
 
90
+ return ( 0 !== $total_attachments ) ? round( 100 - ( ( $total_attachments - $total_optimized_attachments ) / $total_attachments ) * 100 ) : 0;
 
 
91
  }
92
 
93
+ /**
94
  * Count percent, original & optimized size of all images optimized by Imagify.
95
  *
96
  * @since 1.5
100
  */
101
  function imagify_ngg_count_saving_data() {
102
  global $wpdb;
103
+
104
+ return $wpdb->get_col( "SELECT $table_name.data FROM {$wpdb->ngg_imagify_data} WHERE status = 'success'" ); // WPCS: unprepared SQL ok.
105
+ }
 
 
 
inc/3rd-party/nextgen-gallery/nextgen-gallery.php CHANGED
@@ -1,23 +1,26 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  if ( ! class_exists( 'C_NextGEN_Bootstrap' ) || ! class_exists( 'Mixin' ) || ! get_site_option( 'ngg_options' ) ) {
5
  return;
6
  }
7
 
8
- define( 'IMAGIFY_NGG_FILE' , __FILE__ );
9
- define( 'IMAGIFY_NGG_PATH' , realpath( plugin_dir_path( IMAGIFY_NGG_FILE ) ) . '/' );
10
- define( 'IMAGIFY_NGG_INC_PATH' , realpath( IMAGIFY_NGG_PATH . 'inc/' ) . '/' );
11
- define( 'IMAGIFY_NGG_ADMIN_PATH' , realpath( IMAGIFY_NGG_INC_PATH . 'admin' ) . '/' );
12
- define( 'IMAGIFY_NGG_COMMON_PATH' , realpath( IMAGIFY_NGG_INC_PATH . 'common' ) . '/' );
13
- define( 'IMAGIFY_NGG_FUNCTIONS_PATH' , realpath( IMAGIFY_NGG_INC_PATH . 'functions' ) . '/' );
14
- define( 'IMAGIFY_NGG_CLASSES_PATH' , realpath( IMAGIFY_NGG_INC_PATH . 'classes' ) . '/' );
15
 
16
- require( IMAGIFY_NGG_CLASSES_PATH . 'class-ngg.php' );
17
- require( IMAGIFY_NGG_CLASSES_PATH . 'class-db.php' );
18
- require( IMAGIFY_NGG_CLASSES_PATH . 'class-attachment.php' );
19
  require( IMAGIFY_NGG_FUNCTIONS_PATH . 'admin-stats.php' );
20
- require( IMAGIFY_NGG_COMMON_PATH . 'attachments.php' );
 
 
 
21
 
22
  if ( is_admin() ) {
23
  require( IMAGIFY_NGG_ADMIN_PATH . 'enqueue.php' );
@@ -27,4 +30,4 @@ if ( is_admin() ) {
27
  require( IMAGIFY_NGG_ADMIN_PATH . 'gallery.php' );
28
  require( IMAGIFY_NGG_ADMIN_PATH . 'bulk.php' );
29
  require( IMAGIFY_NGG_ADMIN_PATH . 'heartbeat.php' );
30
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  if ( ! class_exists( 'C_NextGEN_Bootstrap' ) || ! class_exists( 'Mixin' ) || ! get_site_option( 'ngg_options' ) ) {
5
  return;
6
  }
7
 
8
+ define( 'IMAGIFY_NGG_FILE' , __FILE__ );
9
+ define( 'IMAGIFY_NGG_PATH' , realpath( plugin_dir_path( IMAGIFY_NGG_FILE ) ) . '/' );
10
+ define( 'IMAGIFY_NGG_INC_PATH' , realpath( IMAGIFY_NGG_PATH . 'inc/' ) . '/' );
11
+ define( 'IMAGIFY_NGG_ADMIN_PATH' , realpath( IMAGIFY_NGG_INC_PATH . 'admin' ) . '/' );
12
+ define( 'IMAGIFY_NGG_COMMON_PATH' , realpath( IMAGIFY_NGG_INC_PATH . 'common' ) . '/' );
13
+ define( 'IMAGIFY_NGG_FUNCTIONS_PATH' , realpath( IMAGIFY_NGG_INC_PATH . 'functions' ) . '/' );
14
+ define( 'IMAGIFY_NGG_CLASSES_PATH' , realpath( IMAGIFY_NGG_INC_PATH . 'classes' ) . '/' );
15
 
16
+ require( IMAGIFY_NGG_CLASSES_PATH . 'class-imagify-ngg.php' );
17
+ require( IMAGIFY_NGG_CLASSES_PATH . 'class-imagify-ngg-db.php' );
18
+ require( IMAGIFY_NGG_CLASSES_PATH . 'class-imagify-ngg-attachment.php' );
19
  require( IMAGIFY_NGG_FUNCTIONS_PATH . 'admin-stats.php' );
20
+ require( IMAGIFY_NGG_COMMON_PATH . 'attachments.php' );
21
+
22
+ imagify_ngg()->init();
23
+ imagify_ngg_db();
24
 
25
  if ( is_admin() ) {
26
  require( IMAGIFY_NGG_ADMIN_PATH . 'enqueue.php' );
30
  require( IMAGIFY_NGG_ADMIN_PATH . 'gallery.php' );
31
  require( IMAGIFY_NGG_ADMIN_PATH . 'bulk.php' );
32
  require( IMAGIFY_NGG_ADMIN_PATH . 'heartbeat.php' );
33
+ }
inc/3rd-party/wp-retina-2x.php CHANGED
@@ -1,58 +1,88 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  if ( function_exists( 'wr2x_delete_attachment' ) && function_exists( 'wr2x_generate_images' ) ) :
5
 
6
- /**
7
- * Process to restore all retina versions for an attachment
8
- *
9
- * @since 1.0
10
- */
11
- add_action( 'before_imagify_restore_attachment', '_imagify_wr2x_delete_attachment_on_restore' );
12
- function _imagify_wr2x_delete_attachment_on_restore( $attachment_id ) {
13
- // Remove all retina versions if exists
14
- wr2x_delete_attachment( $attachment_id );
15
- }
16
-
17
- add_action( 'after_imagify_restore_attachment', '_imagify_wr2x_generate_images_on_restore' );
18
- function _imagify_wr2x_generate_images_on_restore( $attachment_id ) {
19
- // Regenerate all retina versions
20
- $metadata = wp_get_attachment_metadata( $attachment_id );
21
- wr2x_generate_images( $metadata );
22
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  endif;
25
 
26
  if ( function_exists( 'wr2x_get_retina' ) ) :
27
 
28
- /**
29
- * Process to generate the retina version of a thumbnail
30
- *
31
- * @since 1.0
32
- */
33
- add_filter( 'imagify_fill_thumbnail_data', '_imagify_optimize_wr2x', 10, 7 );
34
- function _imagify_optimize_wr2x( $data, $response, $id, $path, $url, $size_key, $optimization_level ) {
35
  /**
36
- * Allow to optimize the retina version generated by WP Retina x2
37
- *
38
- * @since 1.0
39
- *
40
- * @param bool true will force the optimization
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  */
42
- $do_retina = apply_filters( 'do_imagify_optimize_retina', true );
43
-
44
- $retina_path = wr2x_get_retina( $path );
45
-
46
- if ( ! empty( $retina_path ) && $do_retina ) {
 
 
 
 
 
 
 
 
 
 
47
  $response = do_imagify( $retina_path, array(
48
  'backup' => false,
49
  'optimization_level' => $optimization_level,
50
- 'context' => 'wp-retina'
51
  ) );
52
- $data = Imagify_Attachment::fill_data( $data, $response, $id, $url, $size_key . '@2x' );
 
 
 
53
  }
54
-
55
- return $data;
56
- }
57
 
58
- endif;
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  if ( function_exists( 'wr2x_delete_attachment' ) && function_exists( 'wr2x_generate_images' ) ) :
5
 
6
+ /**
7
+ * Process to restore all retina versions for an attachment.
8
+ *
9
+ * @since 1.0
10
+ */
11
+
12
+ add_action( 'before_imagify_restore_attachment', '_imagify_wr2x_delete_attachment_on_restore' );
13
+ /**
14
+ * Remove all retina versions if exists.
15
+ *
16
+ * @since 1.0
17
+ *
18
+ * @param int $attachment_id An attachment ID.
19
+ */
20
+ function _imagify_wr2x_delete_attachment_on_restore( $attachment_id ) {
21
+ wr2x_delete_attachment( $attachment_id );
22
+ }
23
+
24
+ add_action( 'after_imagify_restore_attachment', '_imagify_wr2x_generate_images_on_restore' );
25
+ /**
26
+ * Regenerate all retina versions.
27
+ *
28
+ * @since 1.0
29
+ *
30
+ * @param int $attachment_id An attachment ID.
31
+ */
32
+ function _imagify_wr2x_generate_images_on_restore( $attachment_id ) {
33
+ $metadata = wp_get_attachment_metadata( $attachment_id );
34
+ wr2x_generate_images( $metadata );
35
+ }
36
 
37
  endif;
38
 
39
  if ( function_exists( 'wr2x_get_retina' ) ) :
40
 
 
 
 
 
 
 
 
41
  /**
42
+ * Process to generate the retina version of a thumbnail.
43
+ *
44
+ * @since 1.0
45
+ */
46
+
47
+ add_filter( 'imagify_fill_thumbnail_data', '_imagify_optimize_wr2x', 10, 7 );
48
+ /**
49
+ * Filter the optimization data of each thumbnail.
50
+ *
51
+ * @since 1.0
52
+ *
53
+ * @param array $data The statistics data.
54
+ * @param object $response The API response.
55
+ * @param int $id The attachment ID.
56
+ * @param string $path The attachment path.
57
+ * @param string $url The attachment URL.
58
+ * @param string $size_key The attachment size key.
59
+ * @param bool $optimization_level The optimization level.
60
+ * @return array $data The new optimization data.
61
  */
62
+ function _imagify_optimize_wr2x( $data, $response, $id, $path, $url, $size_key, $optimization_level ) {
63
+ /**
64
+ * Allow to optimize the retina version generated by WP Retina x2.
65
+ *
66
+ * @since 1.0
67
+ *
68
+ * @param bool $do_retina True will force the optimization.
69
+ */
70
+ $do_retina = apply_filters( 'do_imagify_optimize_retina', true );
71
+ $retina_path = wr2x_get_retina( $path );
72
+
73
+ if ( empty( $retina_path )|| ! $do_retina ) {
74
+ return $data;
75
+ }
76
+
77
  $response = do_imagify( $retina_path, array(
78
  'backup' => false,
79
  'optimization_level' => $optimization_level,
80
+ 'context' => 'wp-retina',
81
  ) );
82
+ $class_name = get_imagify_attachment_class_name( 'wp' );
83
+ $attachment = new $class_name( $id );
84
+
85
+ return $attachment->fill_data( $data, $response, $id, $url, $size_key . '@2x' );
86
  }
 
 
 
87
 
88
+ endif;
inc/admin/ajax.php CHANGED
@@ -1,14 +1,18 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
 
 
 
 
 
4
  /**
5
  * Process all thumbnails of a specific image with Imagify with the manual method.
6
  *
7
  * @since 1.0
8
  * @author Jonathan Buttigieg
9
  */
10
- add_action( 'wp_ajax_imagify_manual_upload' , '_do_admin_post_imagify_manual_upload' );
11
- add_action( 'admin_post_imagify_manual_upload' , '_do_admin_post_imagify_manual_upload' );
12
  function _do_admin_post_imagify_manual_upload() {
13
  if ( defined( 'DOING_AJAX' ) ) {
14
  check_ajax_referer( 'imagify-manual-upload' );
@@ -23,33 +27,33 @@ function _do_admin_post_imagify_manual_upload() {
23
  wp_nonce_ays( '' );
24
  }
25
  }
26
-
27
- $context = $_GET['context'];
28
- $attachment_id = $_GET['attachment_id'];
29
- $class_name = get_imagify_attachment_class_name( $_GET['context'] );
30
  $attachment = new $class_name( $attachment_id );
31
-
32
  // Optimize it!!!!!
33
  $attachment->optimize();
34
-
35
  if ( ! defined( 'DOING_AJAX' ) ) {
36
  wp_safe_redirect( wp_get_referer() );
37
  die();
38
  }
39
-
40
- // Return the optimization statistics
41
  $output = get_imagify_attachment_optimization_text( $attachment, $context );
42
  wp_send_json_success( $output );
43
  }
44
 
 
 
45
  /**
46
- * Process a manual upload by overriding the optimization level.
47
  *
48
  * @since 1.0
49
  * @author Jonathan Buttigieg
50
  */
51
- add_action( 'wp_ajax_imagify_manual_override_upload', '_do_admin_post_imagify_manual_override_upload' );
52
- add_action( 'admin_post_imagify_manual_override_upload', '_do_admin_post_imagify_manual_override_upload' );
53
  function _do_admin_post_imagify_manual_override_upload() {
54
  if ( defined( 'DOING_AJAX' ) ) {
55
  check_ajax_referer( 'imagify-manual-override-upload' );
@@ -64,12 +68,13 @@ function _do_admin_post_imagify_manual_override_upload() {
64
  wp_nonce_ays( '' );
65
  }
66
  }
67
-
68
- $context = $_GET['context'];
69
- $class_name = get_imagify_attachment_class_name( $context );
70
- $attachment = new $class_name( $_GET['attachment_id'] );
71
-
72
- // Restore the backup file
 
73
  $attachment->restore();
74
 
75
  // Optimize it!!!!!
@@ -80,19 +85,19 @@ function _do_admin_post_imagify_manual_override_upload() {
80
  die();
81
  }
82
 
83
- // Return the optimization statistics
84
  $output = get_imagify_attachment_optimization_text( $attachment, $context );
85
  wp_send_json_success( $output );
86
  }
87
 
 
 
88
  /**
89
  * Process a restoration to the original attachment.
90
  *
91
  * @since 1.0
92
  * @author Jonathan Buttigieg
93
  */
94
- add_action( 'wp_ajax_imagify_restore_upload', '_do_admin_post_imagify_restore_upload' );
95
- add_action( 'admin_post_imagify_restore_upload', '_do_admin_post_imagify_restore_upload' );
96
  function _do_admin_post_imagify_restore_upload() {
97
  if ( defined( 'DOING_AJAX' ) ) {
98
  check_ajax_referer( 'imagify-restore-upload' );
@@ -107,263 +112,355 @@ function _do_admin_post_imagify_restore_upload() {
107
  wp_nonce_ays( '' );
108
  }
109
  }
110
-
111
- $class_name = get_imagify_attachment_class_name( $_GET['context'] );
112
- $attachment = new $class_name( $_GET['attachment_id'] );
113
-
114
- // Restore the backup file
 
 
115
  $attachment->restore();
116
-
117
  if ( ! defined( 'DOING_AJAX' ) ) {
118
  wp_safe_redirect( wp_get_referer() );
119
  die();
120
  }
121
 
122
- // Return the optimization button
123
- $output = '<a id="imagify-upload-' . $attachment->id . '" href="' . get_imagify_admin_url( 'manual-upload', array( 'attachment_id' => $attachment->id ) ) . '" class="button-primary button-imagify-manual-upload" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">' . __( 'Optimize', 'imagify' ) . '</a>';
124
  wp_send_json_success( $output );
125
  }
126
 
 
127
  /**
128
- * Get all unoptimized attachment ids.
129
  *
130
  * @since 1.0
131
  * @author Jonathan Buttigieg
132
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  add_action( 'wp_ajax_imagify_get_unoptimized_attachment_ids', '_do_wp_ajax_imagify_get_unoptimized_attachment_ids' );
 
 
 
 
 
 
134
  function _do_wp_ajax_imagify_get_unoptimized_attachment_ids() {
 
 
135
  check_ajax_referer( 'imagify-bulk-upload', 'imagifybulkuploadnonce' );
136
 
137
  if ( ! current_user_can( 'upload_files' ) ) {
138
  wp_send_json_error();
139
  }
140
-
141
  if ( ! imagify_valid_key() ) {
142
  wp_send_json_error( array( 'message' => 'invalid-api-key' ) );
143
  }
144
-
145
  $user = new Imagify_User();
146
-
147
  if ( $user->is_over_quota() ) {
148
  wp_send_json_error( array( 'message' => 'over-quota' ) );
149
  }
150
-
151
  @set_time_limit( 0 );
152
-
153
- $optimization_level = $_GET['optimization_level'];
154
- $optimization_level = ( -1 != $optimization_level ) ? $optimization_level : get_imagify_option( 'optimization_level', 1 );
155
  $optimization_level = (int) $optimization_level;
156
-
157
  $meta_query = array(
158
  'relation' => 'OR',
159
  array(
160
  'key' => '_imagify_optimization_level',
161
  'value' => $optimization_level,
162
- 'compare' => '!='
163
  ),
164
  array(
165
  'key' => '_imagify_optimization_level',
166
- 'compare' => 'NOT EXISTS'
167
  ),
168
  array(
169
  'key' => '_imagify_status',
170
  'value' => 'error',
171
- 'compare' => '='
172
  ),
173
  );
174
-
175
  /**
176
- * Filter the unoptimized attachments limit query
177
  *
178
  * @since 1.4.4
179
  *
180
- * @param int The limit (-1 for unlimited)
181
  */
182
  $unoptimized_attachment_limit = apply_filters( 'imagify_unoptimized_attachment_limit', 10000 );
183
-
184
  $args = array(
185
  'fields' => 'ids',
186
  'post_type' => 'attachment',
187
  'post_status' => 'any',
188
  'post_mime_type' => get_imagify_mime_type(),
189
- 'meta_query' => $meta_query,
190
  'posts_per_page' => $unoptimized_attachment_limit,
191
- 'orderby' => 'ID',
192
- 'order' => 'DESC',
193
  'no_found_rows' => true,
194
  'update_post_term_cache' => false,
195
  );
196
-
197
- global $wpdb;
198
-
199
  $data = array();
200
  $attachments = new WP_Query( $args );
201
  $ids = $attachments->posts;
202
- $ids = array_filter( (array) $ids );
203
- $sql_ids = implode( ',', $ids );
204
 
205
  if ( empty( $sql_ids ) ) {
206
  wp_send_json_error( array( 'message' => 'no-images' ) );
207
  }
208
-
209
- // Get attachments filename
210
- $attachments_filename = $wpdb->get_results(
211
  "SELECT pm.post_id as id, pm.meta_value as value
212
  FROM $wpdb->postmeta as pm
213
- WHERE pm.meta_key= '_wp_attached_file'
214
- AND pm.post_id IN ($sql_ids)
215
- ORDER BY pm.post_id DESC"
216
- , ARRAY_A
217
  );
218
-
219
- $attachments_filename = imagify_query_results_combine( $ids, $attachments_filename );
220
-
221
- // Get attachments data
222
- $attachments_data = $wpdb->get_results(
223
  "SELECT pm.post_id as id, pm.meta_value as value
224
  FROM $wpdb->postmeta as pm
225
- WHERE pm.meta_key= '_imagify_data'
226
- AND pm.post_id IN ($sql_ids)
227
- ORDER BY pm.post_id DESC"
228
- , ARRAY_A
229
  );
230
-
231
- $attachments_data = imagify_query_results_combine( $ids, $attachments_data );
232
  $attachments_data = array_map( 'maybe_unserialize', $attachments_data );
233
-
234
- // Get attachments optimization level
235
- $attachments_optimization_level = $wpdb->get_results(
236
  "SELECT pm.post_id as id, pm.meta_value as value
237
  FROM $wpdb->postmeta as pm
238
- WHERE pm.meta_key= '_imagify_optimization_level'
239
- AND pm.post_id IN ($sql_ids)
240
- ORDER BY pm.post_id DESC"
241
- , ARRAY_A
242
  );
243
-
244
  $attachments_optimization_level = imagify_query_results_combine( $ids, $attachments_optimization_level );
245
-
246
- // Get attachments status
247
- $attachments_status = $wpdb->get_results(
248
  "SELECT pm.post_id as id, pm.meta_value as value
249
  FROM $wpdb->postmeta as pm
250
- WHERE pm.meta_key= '_imagify_status'
251
- AND pm.post_id IN ($sql_ids)
252
- ORDER BY pm.post_id DESC"
253
- , ARRAY_A
254
  );
255
-
256
  $attachments_status = imagify_query_results_combine( $ids, $attachments_status );
257
-
258
- // Save the optimization level in a transient to retrieve it later during the process
259
  set_transient( 'imagify_bulk_optimization_level', $optimization_level );
260
-
261
- foreach( $ids as $id ) {
262
- /** This filter is documented in inc/functions/process.php */
263
  $file_path = apply_filters( 'imagify_file_path', get_imagify_attached_file( $attachments_filename[ $id ] ) );
264
-
265
- if ( file_exists( $file_path ) ) {
266
- $attachment_data = ( isset( $attachments_data[ $id ] ) ) ? $attachments_data[ $id ] : false;
267
- $attachment_error = '';
268
-
269
- if ( isset( $attachment_data['sizes']['full']['error'] ) ) {
270
- $attachment_error = $attachment_data['sizes']['full']['error'];
271
- }
272
-
273
- $attachment_error = trim( $attachment_error );
274
- $attachment_status = ( isset( $attachments_status[ $id ] ) ) ? $attachments_status[ $id ] : false;
275
- $attachment_optimization_level = ( isset( $attachments_optimization_level[ $id ] ) ) ? $attachments_optimization_level[ $id ] : false;
276
- $attachment_backup_path = get_imagify_attachment_backup_path( $file_path );
277
-
278
- // Don't try to re-optimize if the optimization level is still the same
279
- if ( $optimization_level === $attachment_optimization_level && is_string( $attachment_error ) ) {
280
- continue;
281
- }
282
-
283
- // Don't try to re-optimize if there is no backup file
284
- if ( $optimization_level !== $attachment_optimization_level && ! file_exists( $attachment_backup_path ) && $attachment_status == 'success' ) {
285
- continue;
286
- }
287
-
288
- // Don't try to re-optimize images already compressed
289
- if ( $attachment_optimization_level >= $optimization_level && $attachment_status == 'already_optimized' ) {
290
- continue;
291
- }
292
-
293
- // Don't try to re-optimize images with an empty error message
294
- if ( $attachment_status == 'error' && empty( $attachment_error ) ) {
295
- continue;
296
- }
297
-
298
- $data[ '_' . $id ] = get_imagify_attachment_url( $attachments_filename[ $id ] );
299
- }
300
- }
301
-
302
- if ( (bool) $data ) {
 
 
303
  wp_send_json_success( $data );
304
  }
305
-
306
  wp_send_json_error( array( 'message' => 'no-images' ) );
307
  }
308
 
309
- /**
310
- * Process all thumbnails of a specific image with Imagify with the bulk method.
311
- *
312
- * @since 1.0
313
- * @author Jonathan Buttigieg
314
- */
315
- add_action( 'wp_ajax_imagify_bulk_upload', '_do_wp_ajax_imagify_bulk_upload' );
316
- function _do_wp_ajax_imagify_bulk_upload() {
317
- check_ajax_referer( 'imagify-bulk-upload', 'imagifybulkuploadnonce' );
318
-
319
- if ( ! isset( $_POST['image'], $_POST['context'] ) || ! current_user_can( 'upload_files' ) ) {
320
- wp_send_json_error();
321
- }
322
-
323
- $class_name = get_imagify_attachment_class_name( $_POST['context'] );
324
- $attachment = new $class_name( $_POST['image'] );
325
- $optimization_level = get_transient( 'imagify_bulk_optimization_level' );
326
-
327
- // Restore it if the optimization level is updated
328
- if ( $optimization_level !== $attachment->get_optimization_level() ) {
329
- $attachment->restore();
330
- }
331
-
332
- // Optimize it!!!!!
333
- $attachment->optimize( $optimization_level );
334
-
335
- // Return the optimization statistics
336
- $fullsize_data = $attachment->get_size_data();
337
- $stats_data = $attachment->get_stats_data();
338
- $user = new Imagify_User();
339
- $data = array();
340
-
341
- if ( ! $attachment->is_optimized() ) {
342
- $data['success'] = false;
343
- $data['error'] = $fullsize_data['error'];
344
-
345
- wp_send_json_error( $data );
346
- }
347
-
348
- $data['success'] = true;
349
- $data['original_size'] = $fullsize_data['original_size'];
350
- $data['new_size'] = $fullsize_data['optimized_size'];
351
- $data['percent'] = $fullsize_data['percent'];
352
- $data['overall_saving'] = $stats_data['original_size'] - $stats_data['optimized_size'];
353
- $data['original_overall_size'] = $stats_data['original_size'];
354
- $data['new_overall_size'] = $stats_data['optimized_size'];
355
- $data['thumbnails'] = $attachment->get_optimized_sizes_count();
356
-
357
- wp_send_json_success( $data );
358
- }
359
 
 
360
  /**
361
  * Create a new Imagify account.
362
  *
363
  * @since 1.0
364
  * @author Jonathan Buttigieg
365
  */
366
- add_action( 'wp_ajax_imagify_signup', '_do_wp_ajax_imagify_signup' );
367
  function _do_wp_ajax_imagify_signup() {
368
  check_ajax_referer( 'imagify-signup', 'imagifysignupnonce' );
369
 
@@ -374,7 +471,7 @@ function _do_wp_ajax_imagify_signup() {
374
  $data = array(
375
  'email' => $_GET['email'],
376
  'password' => wp_generate_password( 12, false ),
377
- 'lang' => get_locale()
378
  );
379
 
380
  $response = add_imagify_user( $data );
@@ -386,13 +483,13 @@ function _do_wp_ajax_imagify_signup() {
386
  wp_send_json_success();
387
  }
388
 
 
389
  /**
390
  * Process an API key check validity.
391
  *
392
  * @since 1.0
393
  * @author Jonathan Buttigieg
394
  */
395
- add_action( 'wp_ajax_imagify_check_api_key_validity', '_do_wp_ajax_imagify_check_api_key_validity' );
396
  function _do_wp_ajax_imagify_check_api_key_validity() {
397
  check_ajax_referer( 'imagify-check-api-key', 'imagifycheckapikeynonce' );
398
 
@@ -405,7 +502,7 @@ function _do_wp_ajax_imagify_check_api_key_validity() {
405
  if ( is_wp_error( $response ) ) {
406
  wp_send_json_error( $response->get_error_message() );
407
  }
408
-
409
  $options = get_site_option( IMAGIFY_SETTINGS_SLUG );
410
  $options['api_key'] = sanitize_key( $_GET['api_key'] );
411
 
@@ -414,81 +511,19 @@ function _do_wp_ajax_imagify_check_api_key_validity() {
414
  wp_send_json_success();
415
  }
416
 
417
- /**
418
- * Process a dismissed notice.
419
- *
420
- * @since 1.0
421
- * @author Jonathan Buttigieg
422
- */
423
- add_action( 'wp_ajax_imagify_dismiss_notice', '_do_admin_post_imagify_dismiss_notice' );
424
- add_action( 'admin_post_imagify_dismiss_notice', '_do_admin_post_imagify_dismiss_notice' );
425
- function _do_admin_post_imagify_dismiss_notice() {
426
- if ( defined( 'DOING_AJAX' ) ) {
427
- check_ajax_referer( 'imagify-dismiss-notice' );
428
- } else {
429
- check_admin_referer( 'imagify-dismiss-notice' );
430
- }
431
-
432
- if ( ! isset( $_GET['notice'] ) || ! current_user_can( 'manage_options' ) ) {
433
- if ( defined( 'DOING_AJAX' ) ) {
434
- wp_send_json_error();
435
- } else {
436
- wp_nonce_ays( '' );
437
- }
438
- }
439
-
440
- $notice = $_GET['notice'];
441
-
442
- imagify_dismiss_notice( $notice );
443
-
444
- /**
445
- * Fires when a notice is dismissed.
446
- *
447
- * @since 1.4.2
448
- *
449
- * @param int $notice The notice slug
450
- */
451
- do_action( 'imagify_dismiss_notice', $notice );
452
-
453
- if ( ! defined( 'DOING_AJAX' ) ) {
454
- wp_safe_redirect( wp_get_referer() );
455
- die();
456
- }
457
-
458
- wp_send_json_success();
459
- }
460
-
461
- /**
462
- * Disable a plugin which can be in conflict with Imagify
463
- *
464
- * @since 1.2
465
- * @author Jonathan Buttigieg
466
- */
467
- add_action( 'admin_post_imagify_deactivate_plugin', '_imagify_deactivate_plugin' );
468
- function _imagify_deactivate_plugin() {
469
- if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'imagifydeactivatepluginnonce' ) ) {
470
- wp_nonce_ays( '' );
471
- }
472
-
473
- deactivate_plugins( $_GET['plugin'] );
474
-
475
- wp_safe_redirect( wp_get_referer() );
476
- die();
477
- }
478
-
479
  /**
480
  * Get admin bar profile output
481
  *
482
  * @since 1.2.3
483
  * @author Jonathan Buttigieg
484
  */
485
- add_action( 'wp_ajax_imagify_get_admin_bar_profile', '_do_wp_ajax_imagify_get_admin_bar_profile' );
486
  function _do_wp_ajax_imagify_get_admin_bar_profile() {
487
  check_ajax_referer( 'imagify-get-admin-bar-profile', 'imagifygetadminbarprofilenonce' );
488
-
489
- $user = new Imagify_User();
490
  $unconsumed_quota = $user->get_percent_unconsumed_quota();
491
- $meteo_icon = '<img src="' . IMAGIFY_ASSETS_IMG_URL . 'sun.svg" width="37" height="38" alt="" />';
492
  $bar_class = 'positive';
493
  $message = '';
494
 
@@ -502,250 +537,227 @@ function _do_wp_ajax_imagify_get_admin_bar_profile() {
502
  }
503
 
504
  if ( $unconsumed_quota <= 20 && $unconsumed_quota > 0 ) {
505
- $message = '
506
- <div class="imagify-error">
507
- <p><i class="dashicons dashicons-warning" aria-hidden="true"></i><strong>' . __( 'Oops, It\'s almost over!', 'imagify' ) . '</strong></p>
508
- <p>' . sprintf( __( 'You have almost used all your credit.%sDon\'t forget to upgrade your subscription to continue optimizing your images.', 'imagify' ), '<br/><br/>' ) . '</p>
509
- <p class="center txt-center text-center"><a class="btn btn-ghost" href="' . IMAGIFY_APP_MAIN . '/#/subscription" target="_blank">' . __( 'View My Subscription', 'imagify' ) . '</a></p>
510
- </div>
511
- ';
512
- }
513
-
514
- if ( $unconsumed_quota === 0 ) {
515
- $message = '
516
- <div class="imagify-error">
517
- <p><i class="dashicons dashicons-warning" aria-hidden="true"></i><strong>' . __( 'Oops, It\'s Over!', 'imagify' ) . '</strong></p>
518
- <p>' . sprintf( __( 'You have consumed all your credit for this month. You will have <strong>%s back on %s</strong>.', 'imagify' ), size_format( $user->quota * 1048576 ), date_i18n( get_option( 'date_format' ), strtotime( $user->next_date_update ) ) ) . '</p>
519
- <p class="center txt-center text-center"><a class="btn btn-ghost" href="' . IMAGIFY_APP_MAIN . '/#/subscription" target="_blank">' . __( 'Upgrade My Subscription', 'imagify' ) . '</a></p>
520
- </div>
521
- ';
522
- }
523
-
524
- // custom HTML
525
- $quota_section = '
526
- <div class="imagify-admin-bar-quota">
527
- <div class="imagify-abq-row">';
 
528
 
529
  if ( 1 === $user->plan_id ) {
530
- $quota_section .= '
531
- <div class="imagify-meteo-icon">
532
- ' . $meteo_icon . '
533
- </div>';
534
  }
535
 
536
- $quota_section .= '
537
- <div class="imagify-account">
538
- <p class="imagify-meteo-title">' . __( 'Account status', 'imagify' ) . '</p>
539
- <p class="imagify-meteo-subs">' . __( 'Your subscription:', 'imagify' ) . '&nbsp;<strong class="imagify-user-plan">' . $user->plan_label . '</strong></p>
540
- </div>
541
- </div>';
542
 
543
  if ( 1 === $user->plan_id ) {
544
- $quota_section .= '
545
- <div class="imagify-abq-row">
546
- <div class="imagify-space-left">
547
- <p>' . sprintf( __( 'You have %s space credit left', 'imagify'), '<span class="imagify-unconsumed-percent">' . $unconsumed_quota . '%</span>' ) . '</p>
548
- <div class="imagify-bar-' . $bar_class . '">
549
- <div style="width: ' . $unconsumed_quota . '%;" class="imagify-unconsumed-bar imagify-progress"></div>
550
- </div>
551
- </div>
552
- </div>';
553
- }
554
-
555
- $quota_section .= '
556
- <p class="imagify-abq-row">
557
- <a class="imagify-account-link" href="' . IMAGIFY_APP_MAIN . '/#/subscription" target="_blank">
558
- <span class="dashicons dashicons-admin-users"></span>
559
- <span class="button-text">' . __( 'View my subscription', 'imagify' ) . '</span>
560
- </a>
561
- </p>
562
- </div>
563
- ' . $message;
564
-
565
  wp_send_json_success( $quota_section );
566
  }
567
 
 
568
  /**
569
- * Optimize image on picture uploading with async request
570
  *
571
- * @since 1.5
572
- * @author Julio Potier
573
- **/
574
- add_action( 'wp_ajax_imagify_async_optimize_upload_new_media', '_do_admin_post_async_optimize_upload_new_media' );
575
- function _do_admin_post_async_optimize_upload_new_media() {
576
- if ( isset( $_POST['_ajax_nonce'], $_POST['attachment_id'], $_POST['metadata'], $_POST['context'] )
577
- && check_ajax_referer( 'new_media-' . $_POST['attachment_id'] )
578
- ) {
579
- $class_name = get_imagify_attachment_class_name( $_POST['context'] );
580
- $attachment = new $class_name( $_POST['attachment_id'] );
581
-
582
- // Optimize it!!!!!
583
- $attachment->optimize( null, $_POST['metadata'] );
584
-
585
- die( 1 );
586
  }
587
- }
588
- /**
589
- * Optimize image on picture editing with async request
590
- *
591
- * @since 1.4
592
- * @author Julio Potier
593
- **/
594
- add_action( 'wp_ajax_imagify_async_optimize_save_image_editor_file', '_do_admin_post_async_optimize_save_image_editor_file' );
595
- function _do_admin_post_async_optimize_save_image_editor_file() {
596
- if ( isset( $_POST['do'], $_POST['postid'] )
597
- && check_ajax_referer( 'image_editor-' . $_POST['postid'] )
598
- && get_post_meta( $_POST['postid'], '_imagify_data', true )
599
- ) {
600
-
601
- $attachment_id = $_POST['postid'];
602
- $optimization_level = get_post_meta( $attachment_id, '_imagify_optimization_level', true );
603
- $attachment = new Imagify_Attachment( $attachment_id );
604
- $metadata = wp_get_attachment_metadata( $attachment_id );
605
-
606
- // Remove old optimization data
607
- delete_post_meta( $attachment_id, '_imagify_data' );
608
- delete_post_meta( $attachment_id, '_imagify_status' );
609
- delete_post_meta( $attachment_id, '_imagify_optimization_level' );
610
-
611
- if ( 'restore' === $_POST['do'] ) {
612
- // Restore the backup file
613
- $attachment->restore();
614
-
615
- // Get old metadata to regenerate all thumbnails
616
- $metadata = array( 'sizes' => array() );
617
- $backup_sizes = (array) get_post_meta( $attachment_id, '_wp_attachment_backup_sizes', true );
618
-
619
- foreach ( $backup_sizes as $size_key => $size_data ) {
620
- $size_key = str_replace( '-origin', '' , $size_key );
621
- $metadata['sizes'][ $size_key ] = $size_data;
622
- }
623
- }
624
 
625
- // Optimize it!!!!!
626
- $attachment->optimize( $optimization_level, $metadata );
627
 
628
- die( 1 );
 
629
  }
 
 
 
 
 
 
 
 
 
630
  }
631
 
 
632
  /**
633
- * Get pricings from API for Onetime and Plans at the same time
634
- *
635
- * @return JSON WP formatted answer
636
  *
637
  * @since 1.6
638
  * @author Geoffrey Crofte
639
  */
640
- add_action( 'wp_ajax_imagify_get_prices', '_imagify_get_prices_from_api' );
641
- function _imagify_get_prices_from_api() {
642
- if ( check_ajax_referer( 'imagify_get_pricing_' . get_current_user_id(), 'imagifynonce', false) ) {
643
-
644
- $prices = array();
645
- $prices_all = get_imagify_all_prices();
646
 
647
- if ( is_object( $prices_all ) ) {
648
- $prices['onetimes'] = $prices_all -> Packs;
649
- $prices['monthlies'] = $prices_all -> Plans;
650
 
651
- wp_send_json_success( $prices );
652
- }
653
- else {
654
- wp_send_json_error( 'Prices variable is not an object' );
655
- }
656
- } else {
657
- wp_send_json_error( 'check_ajax_referer for prices failed' );
 
 
 
658
  }
 
 
659
  }
660
 
 
661
  /**
662
- * Check Coupon code on modal popin
663
- *
664
- * @return JSON WP formatted answer
665
  *
666
  * @since 1.6
667
  * @author Geoffrey Crofte
668
  */
669
- add_action( 'wp_ajax_imagify_check_coupon', '_imagify_check_coupon_code' );
670
- function _imagify_check_coupon_code() {
671
- if ( check_ajax_referer( 'imagify_get_pricing_' . get_current_user_id(), 'imagifynonce', false) ) {
672
-
673
- $coupon_response = check_imagify_coupon_code( $_POST[ 'coupon' ] );
674
-
675
- wp_send_json_success( $coupon_response );
676
- } else {
677
- wp_send_json_error( 'check_ajax_referer for coupon code checking failed' );
678
  }
 
 
 
 
 
 
 
 
 
 
679
  }
680
 
 
681
  /**
682
- * Get estimated sizes from the WordPress library
683
- *
684
- * @return JSON WP formatted answer
685
  *
686
  * @since 1.6
687
- * @author Geoffrey Crofte
688
  */
689
- add_action( 'wp_ajax_imagify_get_images_counts', '_imagify_get_estimated_sizes' );
690
- function _imagify_get_estimated_sizes() {
691
- if ( check_ajax_referer( 'imagify_get_pricing_' . get_current_user_id(), 'imagifynonce', false) ) {
692
 
693
- $raw_total_size_in_library = imagify_calculate_total_size_images_library();
694
- $raw_average_per_month = imagify_calculate_average_size_images_per_month();
695
- update_imagify_option( 'total_size_images_library', array( 'raw' => $raw_total_size_in_library, 'human' => size_format( $raw_total_size_in_library ) ) );
696
- update_imagify_option( 'average_size_images_per_month', array( 'raw' => $raw_average_per_month, 'human' => size_format( $raw_average_per_month ) ) );
697
 
698
- $images = array(
699
- 'total_library_size' => get_imagify_option( 'total_size_images_library', null ),
700
- 'average_month_size' => get_imagify_option( 'average_size_images_per_month', null )
701
- );
702
 
703
- wp_send_json_success( $images );
704
- } else {
705
- wp_send_json_error( 'check_ajax_referer for estimated image sizes failed' );
706
- }
707
  }
708
 
 
 
 
709
 
 
 
710
  /**
711
- * Get current discount promotion to display information on payment modal
712
- *
713
- * @return JSON WP formatted answer
714
  *
715
- * @since 1.6.3
716
- * @author Geoffrey Crofte
717
  */
718
- add_action( 'wp_ajax_imagify_get_discount', '_imagify_get_discount' );
719
- function _imagify_get_discount() {
720
- if ( check_ajax_referer( 'imagify_get_pricing_' . get_current_user_id(), 'imagifynonce', false) ) {
721
- $discount = check_imagify_discount();
722
- wp_send_json_success( $discount );
723
  } else {
724
- wp_send_json_error( 'check_ajax_referer for getting discount failed' );
725
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
726
  }
727
 
 
728
  /**
729
- * Estimate sizes and update the options values for them
730
  *
731
- * @since 1.6
732
- * @author Remy Perona
733
  */
734
- add_action( 'wp_ajax_imagify_update_estimate_sizes', '_imagify_update_estimate_sizes' );
735
- function _imagify_update_estimate_sizes() {
736
- if ( ! isset( $_POST['_ajax_nonce'] ) ) {
737
- die();
738
- }
739
-
740
- if ( ! check_ajax_referer( 'update_estimate_sizes' ) ) {
741
- die();
742
- }
743
-
744
- $raw_total_size_in_library = imagify_calculate_total_size_images_library();
745
- $raw_average_per_month = imagify_calculate_average_size_images_per_month();
746
 
747
- update_imagify_option( 'total_size_images_library', array( 'raw' => $raw_total_size_in_library, 'human' => size_format( $raw_total_size_in_library ) ) );
748
- update_imagify_option( 'average_size_images_per_month', array( 'raw' => $raw_average_per_month, 'human' => size_format( $raw_average_per_month ) ) );
749
 
750
- die( 1 );
751
- }
 
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ /** --------------------------------------------------------------------------------------------- */
5
+ /** MANUAL OPTIMIZATION ========================================================================= */
6
+ /** --------------------------------------------------------------------------------------------- */
7
+
8
+ add_action( 'wp_ajax_imagify_manual_upload', '_do_admin_post_imagify_manual_upload' );
9
+ add_action( 'admin_post_imagify_manual_upload', '_do_admin_post_imagify_manual_upload' );
10
  /**
11
  * Process all thumbnails of a specific image with Imagify with the manual method.
12
  *
13
  * @since 1.0
14
  * @author Jonathan Buttigieg
15
  */
 
 
16
  function _do_admin_post_imagify_manual_upload() {
17
  if ( defined( 'DOING_AJAX' ) ) {
18
  check_ajax_referer( 'imagify-manual-upload' );
27
  wp_nonce_ays( '' );
28
  }
29
  }
30
+
31
+ $context = esc_html( $_GET['context'] );
32
+ $attachment_id = absint( $_GET['attachment_id'] );
33
+ $class_name = get_imagify_attachment_class_name( $context );
34
  $attachment = new $class_name( $attachment_id );
35
+
36
  // Optimize it!!!!!
37
  $attachment->optimize();
38
+
39
  if ( ! defined( 'DOING_AJAX' ) ) {
40
  wp_safe_redirect( wp_get_referer() );
41
  die();
42
  }
43
+
44
+ // Return the optimization statistics.
45
  $output = get_imagify_attachment_optimization_text( $attachment, $context );
46
  wp_send_json_success( $output );
47
  }
48
 
49
+ add_action( 'wp_ajax_imagify_manual_override_upload', '_do_admin_post_imagify_manual_override_upload' );
50
+ add_action( 'admin_post_imagify_manual_override_upload', '_do_admin_post_imagify_manual_override_upload' );
51
  /**
52
+ * Process all thumbnails of a specific image with Imagify with a different optimization level.
53
  *
54
  * @since 1.0
55
  * @author Jonathan Buttigieg
56
  */
 
 
57
  function _do_admin_post_imagify_manual_override_upload() {
58
  if ( defined( 'DOING_AJAX' ) ) {
59
  check_ajax_referer( 'imagify-manual-override-upload' );
68
  wp_nonce_ays( '' );
69
  }
70
  }
71
+
72
+ $context = esc_html( $_GET['context'] );
73
+ $attachment_id = absint( $_GET['attachment_id'] );
74
+ $class_name = get_imagify_attachment_class_name( $context );
75
+ $attachment = new $class_name( $attachment_id );
76
+
77
+ // Restore the backup file.
78
  $attachment->restore();
79
 
80
  // Optimize it!!!!!
85
  die();
86
  }
87
 
88
+ // Return the optimization statistics.
89
  $output = get_imagify_attachment_optimization_text( $attachment, $context );
90
  wp_send_json_success( $output );
91
  }
92
 
93
+ add_action( 'wp_ajax_imagify_restore_upload', '_do_admin_post_imagify_restore_upload' );
94
+ add_action( 'admin_post_imagify_restore_upload', '_do_admin_post_imagify_restore_upload' );
95
  /**
96
  * Process a restoration to the original attachment.
97
  *
98
  * @since 1.0
99
  * @author Jonathan Buttigieg
100
  */
 
 
101
  function _do_admin_post_imagify_restore_upload() {
102
  if ( defined( 'DOING_AJAX' ) ) {
103
  check_ajax_referer( 'imagify-restore-upload' );
112
  wp_nonce_ays( '' );
113
  }
114
  }
115
+
116
+ $context = esc_html( $_GET['context'] );
117
+ $attachment_id = absint( $_GET['attachment_id'] );
118
+ $class_name = get_imagify_attachment_class_name( $context );
119
+ $attachment = new $class_name( $attachment_id );
120
+
121
+ // Restore the backup file.
122
  $attachment->restore();
123
+
124
  if ( ! defined( 'DOING_AJAX' ) ) {
125
  wp_safe_redirect( wp_get_referer() );
126
  die();
127
  }
128
 
129
+ // Return the optimization button.
130
+ $output = '<a id="imagify-upload-' . $attachment->id . '" href="' . esc_url( get_imagify_admin_url( 'manual-upload', array( 'attachment_id' => $attachment->id ) ) ) . '" class="button-primary button-imagify-manual-upload" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">' . __( 'Optimize', 'imagify' ) . '</a>';
131
  wp_send_json_success( $output );
132
  }
133
 
134
+ add_action( 'wp_ajax_imagify_bulk_upload', '_do_wp_ajax_imagify_bulk_upload' );
135
  /**
136
+ * Process all thumbnails of a specific image with Imagify with the bulk method.
137
  *
138
  * @since 1.0
139
  * @author Jonathan Buttigieg
140
  */
141
+ function _do_wp_ajax_imagify_bulk_upload() {
142
+ check_ajax_referer( 'imagify-bulk-upload', 'imagifybulkuploadnonce' );
143
+
144
+ if ( ! isset( $_POST['image'], $_POST['context'] ) || ! current_user_can( 'upload_files' ) ) {
145
+ wp_send_json_error();
146
+ }
147
+
148
+ $context = esc_html( $_POST['context'] );
149
+ $attachment_id = absint( $_POST['image'] );
150
+ $class_name = get_imagify_attachment_class_name( $context );
151
+ $attachment = new $class_name( $attachment_id );
152
+ $optimization_level = get_transient( 'imagify_bulk_optimization_level' );
153
+
154
+ // Restore it if the optimization level is updated.
155
+ if ( $optimization_level !== $attachment->get_optimization_level() ) {
156
+ $attachment->restore();
157
+ }
158
+
159
+ // Optimize it!!!!!
160
+ $attachment->optimize( $optimization_level );
161
+
162
+ // Return the optimization statistics.
163
+ $fullsize_data = $attachment->get_size_data();
164
+ $stats_data = $attachment->get_stats_data();
165
+ $user = new Imagify_User();
166
+ $data = array();
167
+
168
+ if ( ! $attachment->is_optimized() ) {
169
+ $data['success'] = false;
170
+ $data['error'] = $fullsize_data['error'];
171
+
172
+ wp_send_json_error( $data );
173
+ }
174
+
175
+ $data['success'] = true;
176
+ $data['original_size'] = $fullsize_data['original_size'];
177
+ $data['new_size'] = $fullsize_data['optimized_size'];
178
+ $data['percent'] = $fullsize_data['percent'];
179
+ $data['overall_saving'] = $stats_data['original_size'] - $stats_data['optimized_size'];
180
+ $data['original_overall_size'] = $stats_data['original_size'];
181
+ $data['new_overall_size'] = $stats_data['optimized_size'];
182
+ $data['thumbnails'] = $attachment->get_optimized_sizes_count();
183
+
184
+ wp_send_json_success( $data );
185
+ }
186
+
187
+ /** --------------------------------------------------------------------------------------------- */
188
+ /** AUTOMATIC OPTIMIZATION ====================================================================== */
189
+ /** --------------------------------------------------------------------------------------------- */
190
+
191
+ add_action( 'wp_ajax_imagify_async_optimize_upload_new_media', '_do_admin_post_async_optimize_upload_new_media' );
192
+ /**
193
+ * Optimize image on picture uploading with async request.
194
+ *
195
+ * @since 1.5
196
+ * @author Julio Potier
197
+ * @see _imagify_optimize_attachment()
198
+ */
199
+ function _do_admin_post_async_optimize_upload_new_media() {
200
+ if ( ! isset( $_POST['_ajax_nonce'], $_POST['attachment_id'], $_POST['metadata'], $_POST['context'] ) ) { // WPCS: CSRF ok.
201
+ return;
202
+ }
203
+
204
+ check_ajax_referer( 'new_media-' . $_POST['attachment_id'] );
205
+
206
+ $context = esc_html( $_POST['context'] );
207
+ $attachment_id = absint( $_POST['attachment_id'] );
208
+ $class_name = get_imagify_attachment_class_name( $context );
209
+ $attachment = new $class_name( $attachment_id );
210
+
211
+ // Optimize it!!!!!
212
+ $attachment->optimize( null, $_POST['metadata'] );
213
+ die( 1 );
214
+ }
215
+
216
+ add_action( 'wp_ajax_imagify_async_optimize_save_image_editor_file', '_do_admin_post_async_optimize_save_image_editor_file' );
217
+ /**
218
+ * Optimize image on picture editing (resize, crop...) with async request.
219
+ *
220
+ * @since 1.4
221
+ * @author Julio Potier
222
+ */
223
+ function _do_admin_post_async_optimize_save_image_editor_file() {
224
+ if ( ! isset( $_POST['do'], $_POST['postid'] ) ) { // WPCS: CSRF ok.
225
+ return;
226
+ }
227
+
228
+ check_ajax_referer( 'image_editor-' . $_POST['postid'] );
229
+
230
+ $attachment_id = absint( $_POST['postid'] );
231
+
232
+ if ( ! get_post_meta( $attachment_id, '_imagify_data', true ) ) {
233
+ return;
234
+ }
235
+
236
+ $optimization_level = (int) get_post_meta( $attachment_id, '_imagify_optimization_level', true );
237
+ $class_name = get_imagify_attachment_class_name( 'wp' );
238
+ $attachment = new $class_name( $attachment_id );
239
+ $metadata = wp_get_attachment_metadata( $attachment_id );
240
+
241
+ // Remove old optimization data.
242
+ delete_post_meta( $attachment_id, '_imagify_data' );
243
+ delete_post_meta( $attachment_id, '_imagify_status' );
244
+ delete_post_meta( $attachment_id, '_imagify_optimization_level' );
245
+
246
+ if ( 'restore' === $_POST['do'] ) {
247
+ // Restore the backup file.
248
+ $attachment->restore();
249
+
250
+ // Get old metadata to regenerate all thumbnails.
251
+ $metadata = array( 'sizes' => array() );
252
+ $backup_sizes = (array) get_post_meta( $attachment_id, '_wp_attachment_backup_sizes', true );
253
+
254
+ foreach ( $backup_sizes as $size_key => $size_data ) {
255
+ $size_key = str_replace( '-origin', '' , $size_key );
256
+ $metadata['sizes'][ $size_key ] = $size_data;
257
+ }
258
+ }
259
+
260
+ // Optimize it!!!!!
261
+ $attachment->optimize( $optimization_level, $metadata );
262
+ die( 1 );
263
+ }
264
+
265
+ /** --------------------------------------------------------------------------------------------- */
266
+ /** VARIOUS FOR OPTIMIZATION ==================================================================== */
267
+ /** --------------------------------------------------------------------------------------------- */
268
+
269
  add_action( 'wp_ajax_imagify_get_unoptimized_attachment_ids', '_do_wp_ajax_imagify_get_unoptimized_attachment_ids' );
270
+ /**
271
+ * Get all unoptimized attachment ids.
272
+ *
273
+ * @since 1.0
274
+ * @author Jonathan Buttigieg
275
+ */
276
  function _do_wp_ajax_imagify_get_unoptimized_attachment_ids() {
277
+ global $wpdb;
278
+
279
  check_ajax_referer( 'imagify-bulk-upload', 'imagifybulkuploadnonce' );
280
 
281
  if ( ! current_user_can( 'upload_files' ) ) {
282
  wp_send_json_error();
283
  }
284
+
285
  if ( ! imagify_valid_key() ) {
286
  wp_send_json_error( array( 'message' => 'invalid-api-key' ) );
287
  }
288
+
289
  $user = new Imagify_User();
290
+
291
  if ( $user->is_over_quota() ) {
292
  wp_send_json_error( array( 'message' => 'over-quota' ) );
293
  }
294
+
295
  @set_time_limit( 0 );
296
+
297
+ $optimization_level = (int) $_GET['optimization_level'];
298
+ $optimization_level = ( -1 !== $optimization_level ) ? $optimization_level : get_imagify_option( 'optimization_level', 1 );
299
  $optimization_level = (int) $optimization_level;
300
+
301
  $meta_query = array(
302
  'relation' => 'OR',
303
  array(
304
  'key' => '_imagify_optimization_level',
305
  'value' => $optimization_level,
306
+ 'compare' => '!=',
307
  ),
308
  array(
309
  'key' => '_imagify_optimization_level',
310
+ 'compare' => 'NOT EXISTS',
311
  ),
312
  array(
313
  'key' => '_imagify_status',
314
  'value' => 'error',
315
+ 'compare' => '=',
316
  ),
317
  );
318
+
319
  /**
320
+ * Filter the unoptimized attachments limit query.
321
  *
322
  * @since 1.4.4
323
  *
324
+ * @param int The limit (-1 for unlimited).
325
  */
326
  $unoptimized_attachment_limit = apply_filters( 'imagify_unoptimized_attachment_limit', 10000 );
327
+
328
  $args = array(
329
  'fields' => 'ids',
330
  'post_type' => 'attachment',
331
  'post_status' => 'any',
332
  'post_mime_type' => get_imagify_mime_type(),
333
+ 'meta_query' => $meta_query,
334
  'posts_per_page' => $unoptimized_attachment_limit,
335
+ 'orderby' => 'ID',
336
+ 'order' => 'DESC',
337
  'no_found_rows' => true,
338
  'update_post_term_cache' => false,
339
  );
340
+
 
 
341
  $data = array();
342
  $attachments = new WP_Query( $args );
343
  $ids = $attachments->posts;
344
+ $ids = array_filter( (array) $ids );
345
+ $sql_ids = implode( ',', $ids );
346
 
347
  if ( empty( $sql_ids ) ) {
348
  wp_send_json_error( array( 'message' => 'no-images' ) );
349
  }
350
+
351
+ // Get attachments filename.
352
+ $attachments_filename = $wpdb->get_results( // WPCS: unprepared SQL ok.
353
  "SELECT pm.post_id as id, pm.meta_value as value
354
  FROM $wpdb->postmeta as pm
355
+ WHERE pm.meta_key = '_wp_attached_file'
356
+ AND pm.post_id IN ($sql_ids)
357
+ ORDER BY pm.post_id DESC",
358
+ ARRAY_A
359
  );
360
+
361
+ $attachments_filename = imagify_query_results_combine( $ids, $attachments_filename );
362
+
363
+ // Get attachments data.
364
+ $attachments_data = $wpdb->get_results( // WPCS: unprepared SQL ok.
365
  "SELECT pm.post_id as id, pm.meta_value as value
366
  FROM $wpdb->postmeta as pm
367
+ WHERE pm.meta_key = '_imagify_data'
368
+ AND pm.post_id IN ($sql_ids)
369
+ ORDER BY pm.post_id DESC",
370
+ ARRAY_A
371
  );
372
+
373
+ $attachments_data = imagify_query_results_combine( $ids, $attachments_data );
374
  $attachments_data = array_map( 'maybe_unserialize', $attachments_data );
375
+
376
+ // Get attachments optimization level.
377
+ $attachments_optimization_level = $wpdb->get_results( // WPCS: unprepared SQL ok.
378
  "SELECT pm.post_id as id, pm.meta_value as value
379
  FROM $wpdb->postmeta as pm
380
+ WHERE pm.meta_key = '_imagify_optimization_level'
381
+ AND pm.post_id IN ($sql_ids)
382
+ ORDER BY pm.post_id DESC",
383
+ ARRAY_A
384
  );
385
+
386
  $attachments_optimization_level = imagify_query_results_combine( $ids, $attachments_optimization_level );
387
+
388
+ // Get attachments status.
389
+ $attachments_status = $wpdb->get_results( // WPCS: unprepared SQL ok.
390
  "SELECT pm.post_id as id, pm.meta_value as value
391
  FROM $wpdb->postmeta as pm
392
+ WHERE pm.meta_key = '_imagify_status'
393
+ AND pm.post_id IN ($sql_ids)
394
+ ORDER BY pm.post_id DESC",
395
+ ARRAY_A
396
  );
397
+
398
  $attachments_status = imagify_query_results_combine( $ids, $attachments_status );
399
+
400
+ // Save the optimization level in a transient to retrieve it later during the process.
401
  set_transient( 'imagify_bulk_optimization_level', $optimization_level );
402
+
403
+ foreach ( $ids as $id ) {
404
+ /** This filter is documented in inc/functions/process.php. */
405
  $file_path = apply_filters( 'imagify_file_path', get_imagify_attached_file( $attachments_filename[ $id ] ) );
406
+
407
+ if ( ! file_exists( $file_path ) ) {
408
+ continue;
409
+ }
410
+
411
+ $attachment_data = isset( $attachments_data[ $id ] ) ? $attachments_data[ $id ] : false;
412
+ $attachment_error = '';
413
+
414
+ if ( isset( $attachment_data['sizes']['full']['error'] ) ) {
415
+ $attachment_error = $attachment_data['sizes']['full']['error'];
416
+ }
417
+
418
+ $attachment_error = trim( $attachment_error );
419
+ $attachment_status = isset( $attachments_status[ $id ] ) ? $attachments_status[ $id ] : false;
420
+ $attachment_optimization_level = isset( $attachments_optimization_level[ $id ] ) ? $attachments_optimization_level[ $id ] : false;
421
+ $attachment_backup_path = get_imagify_attachment_backup_path( $file_path );
422
+
423
+ // Don't try to re-optimize if the optimization level is still the same.
424
+ if ( $optimization_level === $attachment_optimization_level && is_string( $attachment_error ) ) {
425
+ continue;
426
+ }
427
+
428
+ // Don't try to re-optimize if there is no backup file.
429
+ if ( 'success' === $attachment_status && $optimization_level !== $attachment_optimization_level && ! file_exists( $attachment_backup_path ) ) {
430
+ continue;
431
+ }
432
+
433
+ // Don't try to re-optimize images already compressed.
434
+ if ( 'already_optimized' === $attachment_status && $attachment_optimization_level >= $optimization_level ) {
435
+ continue;
436
+ }
437
+
438
+ // Don't try to re-optimize images with an empty error message.
439
+ if ( 'error' === $attachment_status && empty( $attachment_error ) ) {
440
+ continue;
441
+ }
442
+
443
+ $data[ '_' . $id ] = get_imagify_attachment_url( $attachments_filename[ $id ] );
444
+ } // End foreach().
445
+
446
+ if ( $data ) {
447
  wp_send_json_success( $data );
448
  }
449
+
450
  wp_send_json_error( array( 'message' => 'no-images' ) );
451
  }
452
 
453
+ /** --------------------------------------------------------------------------------------------- */
454
+ /** IMAGIFY ACCOUNT ============================================================================= */
455
+ /** --------------------------------------------------------------------------------------------- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
456
 
457
+ add_action( 'wp_ajax_imagify_signup', '_do_wp_ajax_imagify_signup' );
458
  /**
459
  * Create a new Imagify account.
460
  *
461
  * @since 1.0
462
  * @author Jonathan Buttigieg
463
  */
 
464
  function _do_wp_ajax_imagify_signup() {
465
  check_ajax_referer( 'imagify-signup', 'imagifysignupnonce' );
466
 
471
  $data = array(
472
  'email' => $_GET['email'],
473
  'password' => wp_generate_password( 12, false ),
474
+ 'lang' => get_locale(),
475
  );
476
 
477
  $response = add_imagify_user( $data );
483
  wp_send_json_success();
484
  }
485
 
486
+ add_action( 'wp_ajax_imagify_check_api_key_validity', '_do_wp_ajax_imagify_check_api_key_validity' );
487
  /**
488
  * Process an API key check validity.
489
  *
490
  * @since 1.0
491
  * @author Jonathan Buttigieg
492
  */
 
493
  function _do_wp_ajax_imagify_check_api_key_validity() {
494
  check_ajax_referer( 'imagify-check-api-key', 'imagifycheckapikeynonce' );
495
 
502
  if ( is_wp_error( $response ) ) {
503
  wp_send_json_error( $response->get_error_message() );
504
  }
505
+
506
  $options = get_site_option( IMAGIFY_SETTINGS_SLUG );
507
  $options['api_key'] = sanitize_key( $_GET['api_key'] );
508
 
511
  wp_send_json_success();
512
  }
513
 
514
+ add_action( 'wp_ajax_imagify_get_admin_bar_profile', '_do_wp_ajax_imagify_get_admin_bar_profile' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
515
  /**
516
  * Get admin bar profile output
517
  *
518
  * @since 1.2.3
519
  * @author Jonathan Buttigieg
520
  */
 
521
  function _do_wp_ajax_imagify_get_admin_bar_profile() {
522
  check_ajax_referer( 'imagify-get-admin-bar-profile', 'imagifygetadminbarprofilenonce' );
523
+
524
+ $user = new Imagify_User();
525
  $unconsumed_quota = $user->get_percent_unconsumed_quota();
526
+ $meteo_icon = '<img src="' . IMAGIFY_ASSETS_IMG_URL . 'sun.svg" width="37" height="38" alt="" />';
527
  $bar_class = 'positive';
528
  $message = '';
529
 
537
  }
538
 
539
  if ( $unconsumed_quota <= 20 && $unconsumed_quota > 0 ) {
540
+ $message = '<div class="imagify-error">';
541
+ $message .= '<p><i class="dashicons dashicons-warning" aria-hidden="true"></i><strong>' . __( 'Oops, It\'s almost over!', 'imagify' ) . '</strong></p>';
542
+ /* translators: %s is a line break. */
543
+ $message .= '<p>' . sprintf( __( 'You have almost used all your credit.%sDon\'t forget to upgrade your subscription to continue optimizing your images.', 'imagify' ), '<br/><br/>' ) . '</p>';
544
+ $message .= '<p class="center txt-center text-center"><a class="btn btn-ghost" href="' . IMAGIFY_APP_MAIN . '/#/subscription" target="_blank">' . __( 'View My Subscription', 'imagify' ) . '</a></p>';
545
+ $message .= '</div>';
546
+ }
547
+
548
+ if ( 0 === $unconsumed_quota ) {
549
+ $message = '<div class="imagify-error">';
550
+ $message .= '<p><i class="dashicons dashicons-warning" aria-hidden="true"></i><strong>' . __( 'Oops, It\'s Over!', 'imagify' ) . '</strong></p>';
551
+ $message .= '<p>' . sprintf(
552
+ /* translators: 1 is a data quota, 2 is a date. */
553
+ __( 'You have consumed all your credit for this month. You will have <strong>%1$s back on %2$s</strong>.', 'imagify' ),
554
+ size_format( $user->quota * 1048576 ),
555
+ date_i18n( get_option( 'date_format' ), strtotime( $user->next_date_update ) )
556
+ ) . '</p>';
557
+ $message .= '<p class="center txt-center text-center"><a class="btn btn-ghost" href="' . IMAGIFY_APP_MAIN . '/#/subscription" target="_blank">' . __( 'Upgrade My Subscription', 'imagify' ) . '</a></p>';
558
+ $message .= '</div>';
559
+ }
560
+
561
+ // Custom HTML.
562
+ $quota_section = '<div class="imagify-admin-bar-quota">';
563
+ $quota_section .= '<div class="imagify-abq-row">';
564
 
565
  if ( 1 === $user->plan_id ) {
566
+ $quota_section .= '<div class="imagify-meteo-icon">' . $meteo_icon . '</div>';
 
 
 
567
  }
568
 
569
+ $quota_section .= '<div class="imagify-account">';
570
+ $quota_section .= '<p class="imagify-meteo-title">' . __( 'Account status', 'imagify' ) . '</p>';
571
+ $quota_section .= '<p class="imagify-meteo-subs">' . __( 'Your subscription:', 'imagify' ) . '&nbsp;<strong class="imagify-user-plan">' . $user->plan_label . '</strong></p>';
572
+ $quota_section .= '</div>'; // .imagify-account
573
+ $quota_section .= '</div>'; // .imagify-abq-row
 
574
 
575
  if ( 1 === $user->plan_id ) {
576
+ $quota_section .= '<div class="imagify-abq-row">';
577
+ $quota_section .= '<div class="imagify-space-left">';
578
+ /* translators: %s is a data quota. */
579
+ $quota_section .= '<p>' . sprintf( __( 'You have %s space credit left', 'imagify' ), '<span class="imagify-unconsumed-percent">' . $unconsumed_quota . '%</span>' ) . '</p>';
580
+ $quota_section .= '<div class="imagify-bar-' . $bar_class . '">';
581
+ $quota_section .= '<div style="width: ' . $unconsumed_quota . '%;" class="imagify-unconsumed-bar imagify-progress"></div>';
582
+ $quota_section .= '</div>'; // .imagify-bar-{$bar_class}
583
+ $quota_section .= '</div>'; // .imagify-space-left
584
+ $quota_section .= '</div>'; // .imagify-abq-row
585
+ }
586
+
587
+ $quota_section .= '<p class="imagify-abq-row">';
588
+ $quota_section .= '<a class="imagify-account-link" href="' . IMAGIFY_APP_MAIN . '/#/subscription" target="_blank">';
589
+ $quota_section .= '<span class="dashicons dashicons-admin-users"></span>';
590
+ $quota_section .= '<span class="button-text">' . __( 'View my subscription', 'imagify' ) . '</span>';
591
+ $quota_section .= '</a>'; // .imagify-account-link
592
+ $quota_section .= '</p>'; // .imagify-abq-row
593
+ $quota_section .= '</div>'; // .imagify-admin-bar-quota
594
+ $quota_section .= $message;
595
+
 
596
  wp_send_json_success( $quota_section );
597
  }
598
 
599
+ add_action( 'wp_ajax_imagify_get_prices', '_imagify_get_prices_from_api' );
600
  /**
601
+ * Get pricings from API for Onetime and Plans at the same time.
602
  *
603
+ * @since 1.6
604
+ * @author Geoffrey Crofte
605
+ */
606
+ function _imagify_get_prices_from_api() {
607
+ if ( ! check_ajax_referer( 'imagify_get_pricing_' . get_current_user_id(), 'imagifynonce', false ) ) {
608
+ wp_send_json_error( 'check_ajax_referer for prices failed' );
 
 
 
 
 
 
 
 
 
609
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
610
 
611
+ $prices_all = get_imagify_all_prices();
 
612
 
613
+ if ( is_wp_error( $prices_all ) ) {
614
+ wp_send_json_error( 'Prices variable is a WP_Error: ' . $prices_all->get_error_message() );
615
  }
616
+
617
+ if ( ! is_object( $prices_all ) ) {
618
+ wp_send_json_error( 'Prices variable is not an object' );
619
+ }
620
+
621
+ wp_send_json_success( array(
622
+ 'onetimes' => $prices_all->Packs,
623
+ 'monthlies' => $prices_all->Plans,
624
+ ) );
625
  }
626
 
627
+ add_action( 'wp_ajax_imagify_check_coupon', '_imagify_check_coupon_code' );
628
  /**
629
+ * Check Coupon code on modal popin.
 
 
630
  *
631
  * @since 1.6
632
  * @author Geoffrey Crofte
633
  */
634
+ function _imagify_check_coupon_code() {
635
+ if ( ! check_ajax_referer( 'imagify_get_pricing_' . get_current_user_id(), 'imagifynonce', false ) ) {
636
+ wp_send_json_error( 'check_ajax_referer for coupon code checking failed' );
637
+ }
 
 
638
 
639
+ wp_send_json_success( check_imagify_coupon_code( $_POST['coupon'] ) );
640
+ }
 
641
 
642
+ add_action( 'wp_ajax_imagify_get_discount', '_imagify_get_discount' );
643
+ /**
644
+ * Get current discount promotion to display information on payment modal.
645
+ *
646
+ * @since 1.6.3
647
+ * @author Geoffrey Crofte
648
+ */
649
+ function _imagify_get_discount() {
650
+ if ( ! check_ajax_referer( 'imagify_get_pricing_' . get_current_user_id(), 'imagifynonce', false ) ) {
651
+ wp_send_json_error( 'check_ajax_referer for getting discount failed' );
652
  }
653
+
654
+ wp_send_json_success( check_imagify_discount() );
655
  }
656
 
657
+ add_action( 'wp_ajax_imagify_get_images_counts', '_imagify_get_estimated_sizes' );
658
  /**
659
+ * Get estimated sizes from the WordPress library.
 
 
660
  *
661
  * @since 1.6
662
  * @author Geoffrey Crofte
663
  */
664
+ function _imagify_get_estimated_sizes() {
665
+ if ( ! check_ajax_referer( 'imagify_get_pricing_' . get_current_user_id(), 'imagifynonce', false ) ) {
666
+ wp_send_json_error( 'check_ajax_referer for estimated image sizes failed' );
 
 
 
 
 
 
667
  }
668
+
669
+ $raw_total_size_in_library = imagify_calculate_total_size_images_library();
670
+ $raw_average_per_month = imagify_calculate_average_size_images_per_month();
671
+ update_imagify_option( 'total_size_images_library', array( 'raw' => $raw_total_size_in_library, 'human' => size_format( $raw_total_size_in_library ) ) );
672
+ update_imagify_option( 'average_size_images_per_month', array( 'raw' => $raw_average_per_month, 'human' => size_format( $raw_average_per_month ) ) );
673
+
674
+ wp_send_json_success( array(
675
+ 'total_library_size' => get_imagify_option( 'total_size_images_library', null ),
676
+ 'average_month_size' => get_imagify_option( 'average_size_images_per_month', null ),
677
+ ) );
678
  }
679
 
680
+ add_action( 'wp_ajax_imagify_update_estimate_sizes', '_imagify_update_estimate_sizes' );
681
  /**
682
+ * Estimate sizes and update the options values for them.
 
 
683
  *
684
  * @since 1.6
685
+ * @author Remy Perona
686
  */
687
+ function _imagify_update_estimate_sizes() {
688
+ check_ajax_referer( 'update_estimate_sizes' );
 
689
 
690
+ $raw_total_size_in_library = imagify_calculate_total_size_images_library();
691
+ $raw_average_per_month = imagify_calculate_average_size_images_per_month();
 
 
692
 
693
+ update_imagify_option( 'total_size_images_library', array( 'raw' => $raw_total_size_in_library, 'human' => size_format( $raw_total_size_in_library ) ) );
694
+ update_imagify_option( 'average_size_images_per_month', array( 'raw' => $raw_average_per_month, 'human' => size_format( $raw_average_per_month ) ) );
 
 
695
 
696
+ die( 1 );
 
 
 
697
  }
698
 
699
+ /** --------------------------------------------------------------------------------------------- */
700
+ /** OTHER ======================================================================================= */
701
+ /** --------------------------------------------------------------------------------------------- */
702
 
703
+ add_action( 'wp_ajax_imagify_dismiss_notice', '_do_admin_post_imagify_dismiss_notice' );
704
+ add_action( 'admin_post_imagify_dismiss_notice', '_do_admin_post_imagify_dismiss_notice' );
705
  /**
706
+ * Process a dismissed notice.
 
 
707
  *
708
+ * @since 1.0
709
+ * @author Jonathan Buttigieg
710
  */
711
+ function _do_admin_post_imagify_dismiss_notice() {
712
+ if ( defined( 'DOING_AJAX' ) ) {
713
+ check_ajax_referer( 'imagify-dismiss-notice' );
 
 
714
  } else {
715
+ check_admin_referer( 'imagify-dismiss-notice' );
716
  }
717
+
718
+ if ( ! isset( $_GET['notice'] ) || ! current_user_can( 'manage_options' ) ) {
719
+ if ( defined( 'DOING_AJAX' ) ) {
720
+ wp_send_json_error();
721
+ } else {
722
+ wp_nonce_ays( '' );
723
+ }
724
+ }
725
+
726
+ $notice = $_GET['notice'];
727
+
728
+ imagify_dismiss_notice( $notice );
729
+
730
+ /**
731
+ * Fires when a notice is dismissed.
732
+ *
733
+ * @since 1.4.2
734
+ *
735
+ * @param int $notice The notice slug
736
+ */
737
+ do_action( 'imagify_dismiss_notice', $notice );
738
+
739
+ if ( ! defined( 'DOING_AJAX' ) ) {
740
+ wp_safe_redirect( wp_get_referer() );
741
+ die();
742
+ }
743
+
744
+ wp_send_json_success();
745
  }
746
 
747
+ add_action( 'admin_post_imagify_deactivate_plugin', '_imagify_deactivate_plugin' );
748
  /**
749
+ * Disable a plugin which can be in conflict with Imagify
750
  *
751
+ * @since 1.2
752
+ * @author Jonathan Buttigieg
753
  */
754
+ function _imagify_deactivate_plugin() {
755
+ if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'imagifydeactivatepluginnonce' ) ) {
756
+ wp_nonce_ays( '' );
757
+ }
 
 
 
 
 
 
 
 
758
 
759
+ deactivate_plugins( $_GET['plugin'] );
 
760
 
761
+ wp_safe_redirect( wp_get_referer() );
762
+ die();
763
+ }
inc/admin/enqueue.php CHANGED
@@ -1,17 +1,17 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
4
  /**
5
  * Add some CSS on the whole administration
6
  *
7
  * @since 1.0
8
  */
9
- add_action( 'admin_print_styles', '_imagify_admin_print_styles' );
10
  function _imagify_admin_print_styles() {
11
  global $pagenow;
12
  $current_screen = get_current_screen();
13
- $css_ext = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.css' : '.min.css';
14
- $js_ext = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.js' : '.min.js';
15
 
16
  wp_register_style(
17
  'imagify-css-admin',
@@ -36,7 +36,7 @@ function _imagify_admin_print_styles() {
36
 
37
  wp_register_script(
38
  'imagify-js-async',
39
- IMAGIFY_ASSETS_JS_URL . 'imagify.min.js',
40
  array( 'imagify-js-bulk' ),
41
  IMAGIFY_VERSION,
42
  true
@@ -76,7 +76,7 @@ function _imagify_admin_print_styles() {
76
 
77
  wp_register_script(
78
  'imagify-js-chart',
79
- IMAGIFY_ASSETS_JS_URL . 'chart' . $js_ext,
80
  array(),
81
  IMAGIFY_VERSION,
82
  true
@@ -106,14 +106,14 @@ function _imagify_admin_print_styles() {
106
  );
107
 
108
  /*
109
- * Styles loaded in the whole admnistration
110
- */
111
  wp_enqueue_style( 'imagify-css-admin' );
112
  wp_enqueue_style( 'imagify-css-sweetalert' );
113
 
114
  /*
115
- * Scripts loaded in the whole admnistration
116
- */
117
  wp_enqueue_script( 'imagify-js-sweetalert' );
118
  wp_enqueue_script( 'imagify-js-admin' );
119
 
@@ -122,8 +122,8 @@ function _imagify_admin_print_styles() {
122
  wp_enqueue_script( 'imagify-js-admin' );
123
 
124
  /*
125
- * Scripts loaded in /wp-admin/options-general.php?page=imagify
126
- */
127
  if ( isset( $current_screen ) && ( 'settings_page_imagify' === $current_screen->base || 'settings_page_imagify-network' === $current_screen->base ) ) {
128
  wp_enqueue_script( 'imagify-js-chart' );
129
  wp_enqueue_script( 'imagify-js-event-move' );
@@ -136,20 +136,19 @@ function _imagify_admin_print_styles() {
136
  }
137
 
138
  /**
139
- * Scripts loaded in /wp-admin/upload.php and post.php
140
  */
141
  if ( isset( $current_screen ) && ( 'upload' === $current_screen->base || 'post' === $current_screen->base ) ) {
142
  $upload_data = get_imagify_localize_script_translations( 'upload' );
143
- wp_localize_script( 'imagify-js-upload', 'imagifyUpload', $upload_data );
144
  wp_enqueue_script( 'imagify-js-chart' );
145
  wp_enqueue_script( 'imagify-js-upload' );
146
  }
147
 
148
  /**
149
  * Scripts loaded in:
150
- * /wp-admin/post.php (for attachment post type)
151
- * /wp-admin/upload.php (for attachments list)
152
- *
153
  */
154
  if ( isset( $current_screen ) && ( ('post' === $current_screen->base && 'attachment' === $current_screen->post_type ) || 'upload' === $current_screen->base ) ) {
155
  wp_localize_script( 'imagify-js-twentytwenty', 'imagifyTTT', get_imagify_localize_script_translations( 'twentytwenty' ) );
@@ -160,23 +159,26 @@ function _imagify_admin_print_styles() {
160
  }
161
 
162
  /**
163
- * Scripts loaded in /wp-admin/upload.php?page=imagify-bulk-optimization
164
  */
165
  if ( isset( $current_screen ) && 'media_page_imagify-bulk-optimization' === $current_screen->base ) {
166
  wp_enqueue_script( 'heartbeat' );
167
-
168
  $bulk_data = get_imagify_localize_script_translations( 'bulk' );
169
  $bulk_data['heartbeat_id'] = 'update_bulk_data';
170
  $bulk_data['ajax_action'] = 'imagify_get_unoptimized_attachment_ids';
171
  $bulk_data['ajax_context'] = 'wp';
172
-
 
173
  /**
174
  * Filter the number of parallel queries during the Bulk Optimization
175
  *
176
  * @since 1.5.4
177
- */
178
- $bulk_data['buffer_size'] = apply_filters( 'imagify_bulk_buffer_size', get_imagify_bulk_buffer_size() );
179
-
 
 
180
  wp_localize_script( 'imagify-js-bulk', 'imagifyBulk', $bulk_data );
181
  wp_enqueue_script( 'imagify-js-chart' );
182
  wp_enqueue_script( 'imagify-js-async' );
@@ -184,42 +186,46 @@ function _imagify_admin_print_styles() {
184
  }
185
  }
186
 
 
 
187
  /**
188
  * Add Intercom on Options page an Bulk Optimization
189
  *
190
  * @since 1.0
191
  */
192
- add_action( 'admin_footer-media_page_imagify-bulk-optimization', '_imagify_admin_print_intercom' );
193
- add_action( 'admin_footer-settings_page_imagify', '_imagify_admin_print_intercom' );
194
- function _imagify_admin_print_intercom() {
 
 
195
  $user = get_imagify_user();
196
-
197
- if ( ! imagify_valid_key() || empty( $user->is_intercom ) || false === $user->display_support ) {
198
  return;
199
  }
200
- ?>
201
  <script>
202
  window.intercomSettings = {
203
- app_id: "cd6nxj3z",
204
  user_id: <?php echo (int) $user->id; ?>,
205
  };
206
  </script>
207
  <script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/cd6nxj3z';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script>
208
- <?php
209
  }
210
 
 
211
  /**
212
  * Remove Yoast SEO bugged script
213
  *
214
  * @since 1.4.1
215
  */
216
- add_action( 'wp_print_scripts', '_imagify_dequeue_yoastseo_script' );
217
  function _imagify_dequeue_yoastseo_script() {
218
- global $pagenow;
219
- $current_screen = get_current_screen();
220
-
221
- if ( isset( $current_screen ) && 'post' === $current_screen->base && 'attachment' === $current_screen->post_type ) {
222
- wp_dequeue_script( 'yoast-seo' );
223
- wp_deregister_script( 'yoast-seo' );
224
- }
225
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_action( 'admin_print_styles', '_imagify_admin_print_styles' );
5
  /**
6
  * Add some CSS on the whole administration
7
  *
8
  * @since 1.0
9
  */
 
10
  function _imagify_admin_print_styles() {
11
  global $pagenow;
12
  $current_screen = get_current_screen();
13
+ $css_ext = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.css' : '.min.css';
14
+ $js_ext = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.js' : '.min.js';
15
 
16
  wp_register_style(
17
  'imagify-css-admin',
36
 
37
  wp_register_script(
38
  'imagify-js-async',
39
+ IMAGIFY_ASSETS_JS_URL . 'imagify' . $js_ext,
40
  array( 'imagify-js-bulk' ),
41
  IMAGIFY_VERSION,
42
  true
76
 
77
  wp_register_script(
78
  'imagify-js-chart',
79
+ IMAGIFY_ASSETS_JS_URL . 'chart' . $js_ext,
80
  array(),
81
  IMAGIFY_VERSION,
82
  true
106
  );
107
 
108
  /*
109
+ * Styles loaded in the whole admnistration.
110
+ */
111
  wp_enqueue_style( 'imagify-css-admin' );
112
  wp_enqueue_style( 'imagify-css-sweetalert' );
113
 
114
  /*
115
+ * Scripts loaded in the whole admnistration.
116
+ */
117
  wp_enqueue_script( 'imagify-js-sweetalert' );
118
  wp_enqueue_script( 'imagify-js-admin' );
119
 
122
  wp_enqueue_script( 'imagify-js-admin' );
123
 
124
  /*
125
+ * Scripts loaded in /wp-admin/options-general.php?page=imagify.
126
+ */
127
  if ( isset( $current_screen ) && ( 'settings_page_imagify' === $current_screen->base || 'settings_page_imagify-network' === $current_screen->base ) ) {
128
  wp_enqueue_script( 'imagify-js-chart' );
129
  wp_enqueue_script( 'imagify-js-event-move' );
136
  }
137
 
138
  /**
139
+ * Scripts loaded in /wp-admin/upload.php and post.php.
140
  */
141
  if ( isset( $current_screen ) && ( 'upload' === $current_screen->base || 'post' === $current_screen->base ) ) {
142
  $upload_data = get_imagify_localize_script_translations( 'upload' );
143
+ wp_localize_script( 'imagify-js-upload', 'imagifyUpload', $upload_data );
144
  wp_enqueue_script( 'imagify-js-chart' );
145
  wp_enqueue_script( 'imagify-js-upload' );
146
  }
147
 
148
  /**
149
  * Scripts loaded in:
150
+ * /wp-admin/post.php (for attachment post type),
151
+ * /wp-admin/upload.php (for attachments list).
 
152
  */
153
  if ( isset( $current_screen ) && ( ('post' === $current_screen->base && 'attachment' === $current_screen->post_type ) || 'upload' === $current_screen->base ) ) {
154
  wp_localize_script( 'imagify-js-twentytwenty', 'imagifyTTT', get_imagify_localize_script_translations( 'twentytwenty' ) );
159
  }
160
 
161
  /**
162
+ * Scripts loaded in /wp-admin/upload.php?page=imagify-bulk-optimization.
163
  */
164
  if ( isset( $current_screen ) && 'media_page_imagify-bulk-optimization' === $current_screen->base ) {
165
  wp_enqueue_script( 'heartbeat' );
166
+
167
  $bulk_data = get_imagify_localize_script_translations( 'bulk' );
168
  $bulk_data['heartbeat_id'] = 'update_bulk_data';
169
  $bulk_data['ajax_action'] = 'imagify_get_unoptimized_attachment_ids';
170
  $bulk_data['ajax_context'] = 'wp';
171
+ $bulk_data['buffer_size'] = get_imagify_bulk_buffer_size();
172
+
173
  /**
174
  * Filter the number of parallel queries during the Bulk Optimization
175
  *
176
  * @since 1.5.4
177
+ *
178
+ * @param int $buffer_size Number of parallel queries.
179
+ */
180
+ $bulk_data['buffer_size'] = apply_filters( 'imagify_bulk_buffer_size', $bulk_data['buffer_size'] );
181
+
182
  wp_localize_script( 'imagify-js-bulk', 'imagifyBulk', $bulk_data );
183
  wp_enqueue_script( 'imagify-js-chart' );
184
  wp_enqueue_script( 'imagify-js-async' );
186
  }
187
  }
188
 
189
+ add_action( 'admin_footer-media_page_imagify-bulk-optimization', '_imagify_admin_print_intercom' );
190
+ add_action( 'admin_footer-settings_page_imagify', '_imagify_admin_print_intercom' );
191
  /**
192
  * Add Intercom on Options page an Bulk Optimization
193
  *
194
  * @since 1.0
195
  */
196
+ function _imagify_admin_print_intercom() {
197
+ if ( ! imagify_valid_key() ) {
198
+ return;
199
+ }
200
+
201
  $user = get_imagify_user();
202
+
203
+ if ( empty( $user->is_intercom ) || false === $user->display_support ) {
204
  return;
205
  }
206
+ ?>
207
  <script>
208
  window.intercomSettings = {
209
+ app_id: 'cd6nxj3z',
210
  user_id: <?php echo (int) $user->id; ?>,
211
  };
212
  </script>
213
  <script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/cd6nxj3z';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script>
214
+ <?php
215
  }
216
 
217
+ add_action( 'wp_print_scripts', '_imagify_dequeue_yoastseo_script' );
218
  /**
219
  * Remove Yoast SEO bugged script
220
  *
221
  * @since 1.4.1
222
  */
 
223
  function _imagify_dequeue_yoastseo_script() {
224
+ global $pagenow;
225
+ $current_screen = get_current_screen();
226
+
227
+ if ( isset( $current_screen ) && 'post' === $current_screen->base && 'attachment' === $current_screen->post_type ) {
228
+ wp_dequeue_script( 'yoast-seo' );
229
+ wp_deregister_script( 'yoast-seo' );
230
+ }
231
+ }
inc/admin/heartbeat.php CHANGED
@@ -1,46 +1,54 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  global $pagenow;
5
 
 
6
  /**
7
  * Prepare the data that goes back with the Heartbeat API.
8
  *
9
  * @since 1.4.5
 
 
 
 
10
  */
11
- add_filter( 'heartbeat_received', '_imagify_heartbeat_received', 10, 2 );
12
- function _imagify_heartbeat_received( $response, $data ) {
13
- if( isset( $data['imagify_heartbeat'] ) && 'update_bulk_data' === $data['imagify_heartbeat'] ) {
14
- $saving_data = imagify_count_saving_data();
15
- $user = new Imagify_User();
16
-
17
- $response['imagify_bulk_data'] = array(
18
- 'already_optimized_attachments' => $saving_data['count'],
19
- 'optimized_attachments' => imagify_count_optimized_attachments(),
20
- 'unoptimized_attachments' => imagify_count_unoptimized_attachments(),
21
- 'errors_attachments' => imagify_count_error_attachments(),
22
- 'optimized_attachments_percent' => imagify_percent_optimized_attachments(),
23
- 'optimized_percent' => $saving_data['percent'],
24
- 'original_human' => size_format( $saving_data['original_size'], 1 ),
25
- 'optimized_human' => size_format( $saving_data['optimized_size'], 1 ),
26
- 'unconsumed_quota' => $user->get_percent_unconsumed_quota(),
27
- );
28
- }
29
-
30
- return $response;
 
31
  }
32
 
33
 
 
 
 
34
  /**
35
- * Update the Heartbeat API settings
36
  *
37
  * @since 1.4.5
 
 
 
38
  */
39
- if ( 'upload.php' === $pagenow && isset( $_GET['page'] ) && 'imagify-bulk-optimization' === $_GET['page'] ) {
40
- add_filter( 'heartbeat_settings', '_imagify_heartbeat_settings', PHP_INT_MAX );
 
41
  }
42
-
43
- function _imagify_heartbeat_settings( $settings ) {
44
- $settings['interval'] = 30;
45
- return $settings;
46
- }
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  global $pagenow;
5
 
6
+ add_filter( 'heartbeat_received', '_imagify_heartbeat_received', 10, 2 );
7
  /**
8
  * Prepare the data that goes back with the Heartbeat API.
9
  *
10
  * @since 1.4.5
11
+ *
12
+ * @param array $response The Heartbeat response.
13
+ * @param array $data The $_POST data sent.
14
+ * @return array
15
  */
16
+ function _imagify_heartbeat_received( $response, $data ) {
17
+ if ( empty( $data['imagify_heartbeat'] ) || 'update_bulk_data' !== $data['imagify_heartbeat'] ) {
18
+ return $response;
19
+ }
20
+
21
+ $saving_data = imagify_count_saving_data();
22
+ $user = new Imagify_User();
23
+
24
+ $response['imagify_bulk_data'] = array(
25
+ 'already_optimized_attachments' => $saving_data['count'],
26
+ 'optimized_attachments' => imagify_count_optimized_attachments(),
27
+ 'unoptimized_attachments' => imagify_count_unoptimized_attachments(),
28
+ 'errors_attachments' => imagify_count_error_attachments(),
29
+ 'optimized_attachments_percent' => imagify_percent_optimized_attachments(),
30
+ 'optimized_percent' => $saving_data['percent'],
31
+ 'original_human' => size_format( $saving_data['original_size'], 1 ),
32
+ 'optimized_human' => size_format( $saving_data['optimized_size'], 1 ),
33
+ 'unconsumed_quota' => $user->get_percent_unconsumed_quota(),
34
+ );
35
+
36
+ return $response;
37
  }
38
 
39
 
40
+ if ( 'upload.php' === $pagenow && isset( $_GET['page'] ) && 'imagify-bulk-optimization' === $_GET['page'] ) { // WPCS: CSRF ok.
41
+ add_filter( 'heartbeat_settings', '_imagify_heartbeat_settings', PHP_INT_MAX );
42
+ }
43
  /**
44
+ * Update the Heartbeat API settings.
45
  *
46
  * @since 1.4.5
47
+ *
48
+ * @param array $settings Heartbeat API settings.
49
+ * @return array
50
  */
51
+ function _imagify_heartbeat_settings( $settings ) {
52
+ $settings['interval'] = 30;
53
+ return $settings;
54
  }
 
 
 
 
 
inc/admin/media.php CHANGED
@@ -1,20 +1,26 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
- /*
 
5
  * Add "Imagify" column in the Media Uploader
6
  *
7
  * @since 1.2
8
  * @author Jonathan Buttigieg
 
 
 
 
9
  */
10
- add_filter( 'attachment_fields_to_edit', '_imagify_attachment_fields_to_edit', PHP_INT_MAX, 2 );
11
  function _imagify_attachment_fields_to_edit( $form_fields, $post ) {
12
  global $pagenow;
13
- if ( 'post.php' == $pagenow ) {
 
14
  return $form_fields;
15
  }
16
-
17
- $attachment = new Imagify_Attachment( $post->ID );
 
18
 
19
  $form_fields['imagify'] = array(
20
  'label' => 'Imagify',
@@ -27,40 +33,54 @@ function _imagify_attachment_fields_to_edit( $form_fields, $post ) {
27
  return $form_fields;
28
  }
29
 
 
30
  /**
31
  * Add "Compare Original VS Optimized" link to the media row action
32
  *
33
  * @since 1.4.3
34
  * @author Geoffrey Crofte
 
 
 
 
35
  */
36
- add_filter( 'media_row_actions', '_imagify_add_actions_to_media_list_row', PHP_INT_MAX, 2 );
37
  function _imagify_add_actions_to_media_list_row( $actions, $post ) {
38
- // if this attachment is not an image, do nothing
39
  if ( ! wp_attachment_is_image( $post->ID ) ) {
40
  return $actions;
41
  }
42
 
43
- $attachment = new Imagify_Attachment();
 
44
 
45
- // if Imagify license not valid, or image is not optimized, do nothing
46
  if ( ! imagify_valid_key() || ! $attachment->is_optimized() ) {
47
  return $actions;
48
  }
49
 
50
- // if was not activated for that image, do nothing
51
- if ( '' === $attachment->get_backup_url() ) {
52
  return $actions;
53
  }
54
 
55
  $image = wp_get_attachment_image_src( $post->ID, 'full' );
56
 
57
- // if full image is too small
58
- if ( (int) $image[1] < 360 ) {
59
  return $actions;
60
  }
61
 
62
- // else, add action link for comparison (JS triggered)
63
- $actions['imagify-compare'] = '<a href="' . get_edit_post_link( $post->ID ) . '#imagify-compare" data-id="' . $post->ID . '" data-backup-src="' . $attachment->get_backup_url() . '" data-full-src="' . $image[0] . '" data-full-width="' . $image[1] . '" data-full-height="' . $image[2] . '" data-target="#imagify-comparison-' . $post->ID . '" class="imagify-compare-images imagify-modal-trigger">' . esc_html__('Compare Original VS Optimized', 'imagify') . '</a>';
 
 
 
 
 
 
 
 
 
64
 
65
  return $actions;
66
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_filter( 'attachment_fields_to_edit', '_imagify_attachment_fields_to_edit', PHP_INT_MAX, 2 );
5
+ /**
6
  * Add "Imagify" column in the Media Uploader
7
  *
8
  * @since 1.2
9
  * @author Jonathan Buttigieg
10
+ *
11
+ * @param array $form_fields An array of attachment form fields.
12
+ * @param object $post The WP_Post attachment object.
13
+ * @return array
14
  */
 
15
  function _imagify_attachment_fields_to_edit( $form_fields, $post ) {
16
  global $pagenow;
17
+
18
+ if ( 'post.php' === $pagenow ) {
19
  return $form_fields;
20
  }
21
+
22
+ $class_name = get_imagify_attachment_class_name( 'wp' );
23
+ $attachment = new $class_name( $post->ID );
24
 
25
  $form_fields['imagify'] = array(
26
  'label' => 'Imagify',
33
  return $form_fields;
34
  }
35
 
36
+ add_filter( 'media_row_actions', '_imagify_add_actions_to_media_list_row', PHP_INT_MAX, 2 );
37
  /**
38
  * Add "Compare Original VS Optimized" link to the media row action
39
  *
40
  * @since 1.4.3
41
  * @author Geoffrey Crofte
42
+ * @param array $actions An array of action links for each attachment.
43
+ * Default 'Edit', 'Delete Permanently', 'View'.
44
+ * @param object $post WP_Post object for the current attachment.
45
+ * @return array
46
  */
 
47
  function _imagify_add_actions_to_media_list_row( $actions, $post ) {
48
+ // If this attachment is not an image, do nothing.
49
  if ( ! wp_attachment_is_image( $post->ID ) ) {
50
  return $actions;
51
  }
52
 
53
+ $class_name = get_imagify_attachment_class_name( 'wp' );
54
+ $attachment = new $class_name( $post->ID );
55
 
56
+ // If Imagify license not valid, or image is not optimized, do nothing.
57
  if ( ! imagify_valid_key() || ! $attachment->is_optimized() ) {
58
  return $actions;
59
  }
60
 
61
+ // If was not activated for that image, do nothing.
62
+ if ( ! $attachment->get_backup_url() ) {
63
  return $actions;
64
  }
65
 
66
  $image = wp_get_attachment_image_src( $post->ID, 'full' );
67
 
68
+ // If full image is too small.
69
+ if ( ! $image || (int) $image[1] < 360 ) {
70
  return $actions;
71
  }
72
 
73
+ // Else, add action link for comparison (JS triggered).
74
+ $actions['imagify-compare'] = sprintf(
75
+ '<a href="%1$s#imagify-compare" data-id="%2$d" data-backup-src="%3$s" data-full-src="%4$s" data-full-width="%5$d" data-full-height="%6$d" data-target="#imagify-comparison-%2$d" class="imagify-compare-images imagify-modal-trigger">%7$s</a>',
76
+ esc_url( get_edit_post_link( $post->ID ) ),
77
+ $post->ID,
78
+ esc_url( $attachment->get_backup_url() ),
79
+ esc_url( $image[0] ),
80
+ $image[1],
81
+ $image[2],
82
+ esc_html__( 'Compare Original VS Optimized', 'imagify' )
83
+ );
84
 
85
  return $actions;
86
+ }
inc/admin/menu.php CHANGED
@@ -1,25 +1,24 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
4
  /**
5
- * Add submenu in menu "Settings"
6
  *
7
  * @since 1.0
8
  */
9
- add_action( ( imagify_is_active_for_network() ? 'network_' : '' ) . 'admin_menu', '_imagify_settings_menu' );
10
  function _imagify_settings_menu() {
11
  $page = imagify_is_active_for_network() ? 'settings.php' : 'options-general.php';
12
- $cap = imagify_is_active_for_network() ? 'manage_network_options' : 'manage_options';
13
 
14
- add_submenu_page( $page, 'Imagify', 'Imagify', apply_filters( 'imagify_capacity', $cap ), IMAGIFY_SLUG, '_imagify_display_options_page' );
15
  }
16
 
 
17
  /**
18
- * Add submenu in menu "Media"
19
  *
20
  * @since 1.0
21
  */
22
- add_action( 'admin_menu', '_imagify_bulk_optimization_menu' );
23
  function _imagify_bulk_optimization_menu() {
24
- add_media_page( __( 'Bulk Optimization', 'imagify' ), __( 'Bulk Optimization', 'imagify' ), apply_filters( 'imagify_capacity', 'manage_options' ), IMAGIFY_SLUG . '-bulk-optimization', '_imagify_display_bulk_page' );
25
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_action( ( imagify_is_active_for_network() ? 'network_' : '' ) . 'admin_menu', '_imagify_settings_menu' );
5
  /**
6
+ * Add submenu in menu "Settings".
7
  *
8
  * @since 1.0
9
  */
 
10
  function _imagify_settings_menu() {
11
  $page = imagify_is_active_for_network() ? 'settings.php' : 'options-general.php';
 
12
 
13
+ add_submenu_page( $page, 'Imagify', 'Imagify', imagify_get_capacity(), IMAGIFY_SLUG, '_imagify_display_options_page' );
14
  }
15
 
16
+ add_action( 'admin_menu', '_imagify_bulk_optimization_menu' );
17
  /**
18
+ * Add submenu in menu "Media".
19
  *
20
  * @since 1.0
21
  */
 
22
  function _imagify_bulk_optimization_menu() {
23
+ add_media_page( __( 'Bulk Optimization', 'imagify' ), __( 'Bulk Optimization', 'imagify' ), imagify_get_capacity( true ), IMAGIFY_SLUG . '-bulk-optimization', '_imagify_display_bulk_page' );
24
+ }
inc/admin/meta-boxes.php CHANGED
@@ -1,42 +1,53 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
4
  /**
5
- * Add a "Optimize It" button or the Imagify optimization data in the attachment submit area
6
  *
7
  * @since 1.0
8
  */
9
- add_action( 'attachment_submitbox_misc_actions', '_imagify_attachment_submitbox_misc_actions', PHP_INT_MAX );
10
  function _imagify_attachment_submitbox_misc_actions() {
11
- /** This filter is documented in inc/admin/options.php */
12
- if ( current_user_can( apply_filters( 'imagify_capacity', 'manage_options' ) ) ) {
13
- global $post;
14
- $attachment = new Imagify_Attachment();
15
-
16
- if ( ! imagify_valid_key() && ! $attachment->is_optimized() ) {
17
- echo '<div class="misc-pub-section misc-pub-imagify"><h4>' . __( 'Imagify', 'imagify' ) . '</h4></div>';
18
- echo '<div class="misc-pub-section misc-pub-imagify">';
19
- echo __( 'Invalid API key', 'imagify' );
20
- echo '<br/>';
21
- echo '<a href="' . get_imagify_admin_url( 'options-general' ) . '">' . __( 'Check your Settings', 'imagify' ) . '</a>';
22
- echo '</div>';
23
- } elseif ( $attachment->is_optimized() || $attachment->has_error() ) {
24
- echo '<div class="misc-pub-section misc-pub-imagify"><h4>' . __( 'Imagify', 'imagify' ) . '</h4></div>';
25
- echo get_imagify_attachment_optimization_text( $attachment );
26
- } elseif ( false !== get_transient( 'imagify-async-in-progress-' . $post->ID ) ) {
27
- echo '<div class="misc-pub-section misc-pub-imagify">';
28
- echo '<div class="button"><span class="imagify-spinner"></span>';
29
- _e( 'Optimizing...', 'imagify' );
30
- echo '</div>';
 
 
 
 
 
 
 
 
 
31
  echo '</div>';
32
- } else {
33
- $url = get_imagify_admin_url( 'manual-upload', array( 'attachment_id' => $post->ID ) );
34
- printf( '<div class="misc-pub-section misc-pub-imagify"><a class="button-primary" href="%s">%s</a></div>', $url, __( 'Optimize', 'imagify' ) );
35
- }
36
-
37
- if ( $attachment->is_optimized() ) {
38
- echo '<input id="imagify-full-original" type="hidden" value="' . $attachment->get_backup_url() . '">';
39
- echo '<input id="imagify-full-original-size" type="hidden" value="' . $attachment->get_original_size() . '">';
40
- }
 
 
41
  }
42
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_action( 'attachment_submitbox_misc_actions', '_imagify_attachment_submitbox_misc_actions', PHP_INT_MAX );
5
  /**
6
+ * Add a "Optimize It" button or the Imagify optimization data in the attachment submit area.
7
  *
8
  * @since 1.0
9
  */
 
10
  function _imagify_attachment_submitbox_misc_actions() {
11
+ global $post;
12
+
13
+ if ( ! current_user_can( imagify_get_capacity( true ) ) ) {
14
+ return;
15
+ }
16
+
17
+ $class_name = get_imagify_attachment_class_name( 'wp' );
18
+ $attachment = new $class_name( $post->ID );
19
+
20
+ if ( ! imagify_valid_key() && ! $attachment->is_optimized() ) {
21
+
22
+ echo '<div class="misc-pub-section misc-pub-imagify"><h4>' . __( 'Imagify', 'imagify' ) . '</h4></div>';
23
+ echo '<div class="misc-pub-section misc-pub-imagify">';
24
+ echo __( 'Invalid API key', 'imagify' );
25
+ echo '<br/>';
26
+ echo '<a href="' . esc_url( get_imagify_admin_url( 'options-general' ) ) . '">' . __( 'Check your Settings', 'imagify' ) . '</a>';
27
+ echo '</div>';
28
+
29
+ } elseif ( $attachment->is_optimized() || $attachment->has_error() ) {
30
+
31
+ echo '<div class="misc-pub-section misc-pub-imagify"><h4>' . __( 'Imagify', 'imagify' ) . '</h4></div>';
32
+ echo get_imagify_attachment_optimization_text( $attachment );
33
+
34
+ } elseif ( false !== get_transient( 'imagify-async-in-progress-' . $post->ID ) ) {
35
+
36
+ echo '<div class="misc-pub-section misc-pub-imagify">';
37
+ echo '<div class="button">';
38
+ echo '<span class="imagify-spinner"></span>';
39
+ _e( 'Optimizing...', 'imagify' );
40
  echo '</div>';
41
+ echo '</div>';
42
+
43
+ } else {
44
+
45
+ $url = get_imagify_admin_url( 'manual-upload', array( 'attachment_id' => $post->ID ) );
46
+ printf( '<div class="misc-pub-section misc-pub-imagify"><a class="button-primary" href="%s">%s</a></div>', esc_url( $url ), __( 'Optimize', 'imagify' ) );
47
+ }
48
+
49
+ if ( $attachment->is_optimized() ) {
50
+ echo '<input id="imagify-full-original" type="hidden" value="' . esc_url( $attachment->get_backup_url() ) . '">';
51
+ echo '<input id="imagify-full-original-size" type="hidden" value="' . esc_attr( $attachment->get_original_size() ) . '">';
52
  }
53
+ }
inc/admin/options.php CHANGED
@@ -1,93 +1,113 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
4
  /**
5
  * Fix the capability for our capacity filter hook
6
- *
7
  * @author Jonathan
8
  * @since 1.0
9
  */
10
- add_filter( 'option_page_capability_imagify', '_imagify_correct_capability_for_options_page' );
11
- function _imagify_correct_capability_for_options_page( $capability ) {
12
- $cap = ( imagify_is_active_for_network() ) ? 'manage_network_options' : 'manage_options';
13
- return apply_filters( 'imagify_capacity', $cap );
14
  }
15
 
 
16
  /**
17
  * Tell to WordPress to be confident with our setting, we are clean!
18
- *
19
  * @author Jonathan
20
  * @since 1.0
21
  */
22
- add_action( 'admin_init', '_imagify_register_setting' );
23
  function _imagify_register_setting() {
24
  register_setting( 'imagify', 'imagify_settings' );
25
  }
26
 
 
27
  /**
28
  * Filter specific options before its value is (maybe) serialized and updated.
29
  *
30
  * @author Jonathan
31
  * @since 1.0
 
 
 
 
32
  */
33
- add_filter( 'pre_update_option_' . IMAGIFY_SETTINGS_SLUG, '_imagify_pre_update_option', 10, 2 );
34
  function _imagify_pre_update_option( $value, $old_value ) {
35
- // Store all sizes even if one of them isn't checked
36
- if ( isset( $value['sizes'] ) ) {
 
 
37
  $value['disallowed-sizes'] = array();
38
- foreach( $value['sizes'] as $size_key => $size_value ) {
 
39
  if ( strpos( $size_key , '-hidden' ) ) {
40
  $key = str_replace( '-hidden', '', $size_key );
 
41
  if ( ! isset( $value['sizes'][ $key ] ) ) {
42
  $value['disallowed-sizes'][ $key ] = '1';
43
  }
44
  }
45
  }
46
  }
47
-
48
- // The max width for the "Resize larger images" option can't be 0
49
- if ( (bool) ! $value['resize_larger_w'] ) {
 
 
50
  $value['resize_larger_w'] = '';
51
  $value['resize_larger'] = 0;
52
  }
53
-
54
- // The max width for the "Resize larger images" option can't be less than the largest thumbnail width
55
  $max_sizes = get_imagify_max_intermediate_image_size();
56
- if ( (bool) $value['resize_larger_w'] && $value['resize_larger_w'] < $max_sizes['width'] ) {
 
57
  $value['resize_larger_w'] = $max_sizes['width'];
58
  }
59
 
60
- if ( ! isset( $value['total_size_images_library'] ) && isset( $old_value['total_size_images_library'] ) ) {
61
- $value['total_size_images_library'] = $old_value['total_size_images_library'];
62
- }
63
 
64
- if ( ! isset( $value['average_size_images_per_month'] ) && isset( $old_value['average_size_images_per_month'] ) ) {
65
- $value['average_size_images_per_month'] = $old_value['average_size_images_per_month'];
66
- }
67
 
68
- unset( $value['sizes'] );
69
  return $value;
70
  }
71
 
 
72
  /**
73
- * Used to launch some actions after saving the options
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  *
75
  * @author Jonathan
76
  * @since 1.0
77
- * @since 1.5 Used to redirect user to Bulk Optimizer (if requested)
 
 
 
78
  */
79
- add_action( 'update_option_' . IMAGIFY_SETTINGS_SLUG, '_imagify_after_save_options', 10, 2 );
80
- add_action( 'update_site_option_' . IMAGIFY_SETTINGS_SLUG, '_imagify_after_save_options', 10, 2 );
81
- function _imagify_after_save_options( $oldvalue, $value ) {
82
 
83
- if ( ! ( (bool) $oldvalue && (bool) $value ) ) {
84
- return;
85
- }
86
-
87
- if ( ! isset( $oldvalue['api_key'] ) || $oldvalue['api_key'] != $value['api_key'] ) {
88
- $api = new Imagify();
89
-
90
- if ( is_wp_error( $api->getUser() ) ) {
91
  imagify_renew_notice( 'wrong-api-key' );
92
  delete_site_transient( 'imagify_check_licence_1' );
93
  } else {
@@ -96,72 +116,71 @@ function _imagify_after_save_options( $oldvalue, $value ) {
96
  }
97
 
98
  /**
 
 
99
  * @author Geoffrey
100
  * @since 1.5
101
  */
102
- if ( isset( $_POST['submit-goto-bulk'] ) ) {
103
  wp_safe_redirect( get_admin_url( get_current_blog_id(), 'upload.php?page=imagify-bulk-optimization' ) );
104
- exit;
105
  }
106
  }
107
 
108
-
109
  if ( imagify_is_active_for_network() ) :
110
 
111
- /**
112
- * !options.php do not handle site options. Let's use admin-post.php for multisite installations.
113
- *
114
- * @since 1.0
115
- */
116
- add_action( 'admin_post_update', '_imagify_update_site_option_on_network' );
117
- function _imagify_update_site_option_on_network() {
118
- $option_group = IMAGIFY_SLUG;
119
-
120
- if ( ! isset( $_POST['option_page'] ) || $_POST['option_page'] !== $option_group ) {
121
- return;
122
- }
123
 
124
- $capability = apply_filters( "option_page_capability_{$option_group}", 'manage_network_options' );
 
 
125
 
126
- if ( ! current_user_can( $capability ) ) {
127
- wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
128
- }
129
 
130
- check_admin_referer( $option_group . '-options' );
 
 
131
 
132
- $whitelist_options = apply_filters( 'whitelist_options', array() );
133
 
134
- if ( ! isset( $whitelist_options[ $option_group ] ) ) {
135
- wp_die( __( '<strong>ERROR</strong>: options page not found.' ) );
136
- }
137
 
138
- $options = $whitelist_options[ $option_group ];
 
 
139
 
140
- if ( $options ) {
141
 
142
- foreach ( $options as $option ) {
143
- $option = trim( $option );
144
- $value = null;
 
145
 
146
- if ( isset( $_POST[ $option ] ) ) {
147
- $value = $_POST[ $option ];
148
- if ( ! is_array( $value ) ) {
149
- $value = trim( $value );
 
 
150
  }
151
- $value = wp_unslash( $value );
152
- }
153
 
154
- update_site_option( $option, $value );
 
155
  }
156
 
 
 
 
 
 
 
157
  }
158
-
159
- /**
160
- * Redirect back to the settings page that was submitted
161
- */
162
- $goback = add_query_arg( 'settings-updated', 'true', wp_get_referer() );
163
- wp_redirect( $goback );
164
- exit;
165
- }
166
 
167
- endif;
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_filter( 'option_page_capability_imagify', '_imagify_correct_capability_for_options_page' );
5
  /**
6
  * Fix the capability for our capacity filter hook
7
+ *
8
  * @author Jonathan
9
  * @since 1.0
10
  */
11
+ function _imagify_correct_capability_for_options_page() {
12
+ return imagify_get_capacity();
 
 
13
  }
14
 
15
+ add_action( 'admin_init', '_imagify_register_setting' );
16
  /**
17
  * Tell to WordPress to be confident with our setting, we are clean!
18
+ *
19
  * @author Jonathan
20
  * @since 1.0
21
  */
 
22
  function _imagify_register_setting() {
23
  register_setting( 'imagify', 'imagify_settings' );
24
  }
25
 
26
+ add_filter( 'pre_update_option_' . IMAGIFY_SETTINGS_SLUG, '_imagify_pre_update_option', 10, 2 );
27
  /**
28
  * Filter specific options before its value is (maybe) serialized and updated.
29
  *
30
  * @author Jonathan
31
  * @since 1.0
32
+ *
33
+ * @param mixed $value The new option value.
34
+ * @param mixed $old_value The old option value.
35
+ * @return array The new option value.
36
  */
 
37
  function _imagify_pre_update_option( $value, $old_value ) {
38
+ $value = is_array( $value ) ? $value : array();
39
+
40
+ // Store all sizes even if one of them isn't checked.
41
+ if ( ! empty( $value['sizes'] ) && is_array( $value['sizes'] ) ) {
42
  $value['disallowed-sizes'] = array();
43
+
44
+ foreach ( $value['sizes'] as $size_key => $size_value ) {
45
  if ( strpos( $size_key , '-hidden' ) ) {
46
  $key = str_replace( '-hidden', '', $size_key );
47
+
48
  if ( ! isset( $value['sizes'][ $key ] ) ) {
49
  $value['disallowed-sizes'][ $key ] = '1';
50
  }
51
  }
52
  }
53
  }
54
+
55
+ unset( $value['sizes'] );
56
+
57
+ // The max width for the "Resize larger images" option can't be 0.
58
+ if ( empty( $value['resize_larger_w'] ) ) {
59
  $value['resize_larger_w'] = '';
60
  $value['resize_larger'] = 0;
61
  }
62
+
63
+ // The max width for the "Resize larger images" option can't be less than the largest thumbnail width.
64
  $max_sizes = get_imagify_max_intermediate_image_size();
65
+
66
+ if ( ! empty( $value['resize_larger_w'] ) && $value['resize_larger_w'] < $max_sizes['width'] ) {
67
  $value['resize_larger_w'] = $max_sizes['width'];
68
  }
69
 
70
+ if ( ! isset( $value['total_size_images_library'] ) && isset( $old_value['total_size_images_library'] ) ) {
71
+ $value['total_size_images_library'] = $old_value['total_size_images_library'];
72
+ }
73
 
74
+ if ( ! isset( $value['average_size_images_per_month'] ) && isset( $old_value['average_size_images_per_month'] ) ) {
75
+ $value['average_size_images_per_month'] = $old_value['average_size_images_per_month'];
76
+ }
77
 
 
78
  return $value;
79
  }
80
 
81
+ add_action( 'update_site_option_' . IMAGIFY_SETTINGS_SLUG, '_imagify_after_save_network_options', 10, 3 );
82
  /**
83
+ * Used to launch some actions after saving the network options.
84
+ *
85
+ * @author Grégory Viguier
86
+ * @since 1.6.5
87
+ *
88
+ * @param string $option Name of the network option.
89
+ * @param mixed $value Current value of the network option.
90
+ * @param mixed $old_value Old value of the network option.
91
+ */
92
+ function _imagify_after_save_network_options( $option, $value, $old_value ) {
93
+ _imagify_after_save_options( $old_value, $value );
94
+ }
95
+
96
+ add_action( 'update_option_' . IMAGIFY_SETTINGS_SLUG, '_imagify_after_save_options', 10, 2 );
97
+ /**
98
+ * Used to launch some actions after saving the options.
99
  *
100
  * @author Jonathan
101
  * @since 1.0
102
+ * @since 1.5 Used to redirect user to Bulk Optimizer (if requested).
103
+ *
104
+ * @param mixed $old_value The old option value.
105
+ * @param mixed $value The new option value.
106
  */
107
+ function _imagify_after_save_options( $old_value, $value ) {
 
 
108
 
109
+ if ( $old_value && $value && ( ! isset( $old_value['api_key'] ) || $old_value['api_key'] !== $value['api_key'] ) ) {
110
+ if ( is_wp_error( imagify()->get_user() ) ) {
 
 
 
 
 
 
111
  imagify_renew_notice( 'wrong-api-key' );
112
  delete_site_transient( 'imagify_check_licence_1' );
113
  } else {
116
  }
117
 
118
  /**
119
+ * Redirect the user to the bulk optimization.
120
+ *
121
  * @author Geoffrey
122
  * @since 1.5
123
  */
124
+ if ( isset( $_POST['submit-goto-bulk'] ) ) { // WPCS: CSRF ok.
125
  wp_safe_redirect( get_admin_url( get_current_blog_id(), 'upload.php?page=imagify-bulk-optimization' ) );
126
+ exit;
127
  }
128
  }
129
 
 
130
  if ( imagify_is_active_for_network() ) :
131
 
132
+ add_action( 'admin_post_update', '_imagify_update_site_option_on_network' );
133
+ /**
134
+ * `options.php` do not handle site options. Let's use `admin-post.php` for multisite installations.
135
+ *
136
+ * @since 1.0
137
+ */
138
+ function _imagify_update_site_option_on_network() {
139
+ $option_group = IMAGIFY_SLUG;
 
 
 
 
140
 
141
+ if ( ! isset( $_POST['option_page'] ) || $_POST['option_page'] !== $option_group ) { // WPCS: CSRF ok.
142
+ return;
143
+ }
144
 
145
+ $capability = apply_filters( "option_page_capability_{$option_group}", 'manage_network_options' );
 
 
146
 
147
+ if ( ! current_user_can( $capability ) ) {
148
+ wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
149
+ }
150
 
151
+ check_admin_referer( $option_group . '-options' );
152
 
153
+ $whitelist_options = apply_filters( 'whitelist_options', array() );
 
 
154
 
155
+ if ( ! isset( $whitelist_options[ $option_group ] ) ) {
156
+ wp_die( __( '<strong>ERROR</strong>: options page not found.' ) );
157
+ }
158
 
159
+ $options = $whitelist_options[ $option_group ];
160
 
161
+ if ( $options ) {
162
+ foreach ( $options as $option ) {
163
+ $option = trim( $option );
164
+ $value = null;
165
 
166
+ if ( isset( $_POST[ $option ] ) ) {
167
+ $value = $_POST[ $option ];
168
+ if ( ! is_array( $value ) ) {
169
+ $value = trim( $value );
170
+ }
171
+ $value = wp_unslash( $value );
172
  }
 
 
173
 
174
+ update_site_option( $option, $value );
175
+ }
176
  }
177
 
178
+ /**
179
+ * Redirect back to the settings page that was submitted.
180
+ */
181
+ $goback = add_query_arg( 'settings-updated', 'true', wp_get_referer() );
182
+ wp_safe_redirect( $goback );
183
+ exit;
184
  }
 
 
 
 
 
 
 
 
185
 
186
+ endif;
inc/admin/plugins.php CHANGED
@@ -1,17 +1,18 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
 
4
  /**
5
- * Add link to the plugin configuration pages
6
  *
7
  * @since 1.0
 
 
 
8
  */
9
- add_filter( 'plugin_action_links_' . plugin_basename( IMAGIFY_FILE ), '_imagify_plugin_action_links' );
10
- add_filter( 'network_admin_plugin_action_links_' . plugin_basename( IMAGIFY_FILE ), '_imagify_plugin_action_links' );
11
- function _imagify_plugin_action_links( $actions )
12
- {
13
- array_unshift( $actions, sprintf( '<a href="%s">%s</a>', get_imagify_admin_url( 'bulk-optimization' ), __( 'Bulk Optimization', 'imagify' ) ) );
14
- array_unshift( $actions, sprintf( '<a href="%s">%s</a>', get_imagify_admin_url(), __( 'Settings' ) ) );
15
-
16
- return $actions;
17
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_filter( 'plugin_action_links_' . plugin_basename( IMAGIFY_FILE ), '_imagify_plugin_action_links' );
5
+ add_filter( 'network_admin_plugin_action_links_' . plugin_basename( IMAGIFY_FILE ), '_imagify_plugin_action_links' );
6
  /**
7
+ * Add link to the plugin configuration pages.
8
  *
9
  * @since 1.0
10
+ *
11
+ * @param array $actions An array of action links.
12
+ * @return array
13
  */
14
+ function _imagify_plugin_action_links( $actions ) {
15
+ array_unshift( $actions, sprintf( '<a href="%s">%s</a>', esc_url( get_imagify_admin_url( 'bulk-optimization' ) ), __( 'Bulk Optimization', 'imagify' ) ) );
16
+ array_unshift( $actions, sprintf( '<a href="%s">%s</a>', esc_url( get_imagify_admin_url() ), __( 'Settings' ) ) );
17
+ return $actions;
18
+ }
 
 
 
 
inc/admin/ui/bulk.php CHANGED
@@ -1,80 +1,94 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  /**
5
- * The main settings page construtor using the required functions from WP
6
  *
7
  * @since 1.0
8
  */
9
- function _imagify_display_bulk_page() {
10
  $user = new Imagify_User();
11
  ?>
12
  <div class="wrap imagify-settings imagify-bulk">
13
  <div class="imagify-title">
14
- <?php if ( ! defined( 'IMAGIFY_HIDDEN_ACCOUNT' ) || false === IMAGIFY_HIDDEN_ACCOUNT ) { ?>
15
- <div class="imagify-title-right">
16
- <div class="imagify-account">
17
- <p class="imagify-meteo-title"><?php _e( 'Account status', 'imagify' ); ?></p>
18
- <p class="imagify-meteo-subs"><?php _e( 'Your subscription:', 'imagify' ); ?>&nbsp;<strong class="imagify-user-plan"><?php echo $user->plan_label; ?></strong></p>
19
- </div>
20
- <div class="imagify-account-link">
21
- <a href="<?php echo IMAGIFY_APP_MAIN; ?>/#/subscription" class="button button-ghost" target="_blank">
22
- <span class="dashicons dashicons-admin-users"></span>
23
- <span class="button-text"><?php _e( 'View My Subscription', 'imagify' ); ?></span>
24
- </a>
25
- </div>
26
-
27
- <?php if ( 1 === $user->plan_id ) { ?>
28
- <div class="imagify-sep-v"></div>
29
- <div class="imagify-credit-left">
30
- <?php
31
- $unconsumed_quota = $user->get_percent_unconsumed_quota();
32
- $meteo_icon = '<img src="' . IMAGIFY_ASSETS_IMG_URL . 'sun.svg" width="37" height="38" alt="" />';
33
- $bar_class = 'positive';
34
- $is_display_bubble = false;
35
-
36
- if( $unconsumed_quota >= 21 && $unconsumed_quota <= 50 ) {
37
- $bar_class = 'neutral';
38
- $meteo_icon = '<img src="' . IMAGIFY_ASSETS_IMG_URL . 'cloudy-sun.svg" width="37" height="38" alt="" />';
39
- } elseif( $unconsumed_quota <= 20 ) {
40
- $bar_class = 'negative';
41
- $is_display_bubble = true;
42
- $meteo_icon = '<img src="' . IMAGIFY_ASSETS_IMG_URL . 'stormy.svg" width="38" height="36" alt="" />';
43
- }
44
- ?>
45
- <span class="imagify-meteo-icon"><?php echo $meteo_icon; ?></span>
46
- <div class="imagify-space-left">
47
-
48
- <p><?php printf( __( 'You have %s space credit left' , 'imagify' ), '<span class="imagify-unconsumed-percent">' . $unconsumed_quota . '%</span>' ); ?></p>
49
-
50
- <div class="imagify-bar-<?php echo $bar_class; ?>">
51
- <div class="imagify-unconsumed-bar imagify-progress" style="width: <?php echo $unconsumed_quota . '%'; ?>;"></div>
52
- </div>
53
  </div>
54
- <div class="imagify-space-tooltips imagify-tooltips <?php echo ( ! $is_display_bubble ) ? 'hidden' : ''; ?>">
55
- <div class="tooltip-content tooltip-table">
56
- <div class="cell-icon">
57
- <span aria-hidden="true" class="icon icon-round">i</span>
58
- </div>
59
- <div class="cell-text">
60
- <?php _e( 'Upgrade your account to continue optimizing your images', 'imagify' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  </div>
62
- <div class="cell-sep"></div>
63
- <div class="cell-cta">
64
- <a href="<?php echo IMAGIFY_APP_MAIN; ?>/#/subscription" target="_blank"><?php _e( 'More info', 'imagify' ); ?></a>
 
 
 
 
 
 
 
 
 
 
65
  </div>
66
  </div>
67
- </div>
 
 
68
  </div>
69
- <?php } ?>
70
- </div>
71
- <?php } ?>
72
-
73
  <img width="225" height="26" alt="Imagify" src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>imagify-logo.png" class="imagify-logo" />
74
  </div>
75
 
76
  <?php echo get_imagify_new_to_imagify(); ?>
77
-
78
  <div class="imagify-sub-title">
79
  <svg class="icon icon-bulk" viewBox="0 0 38 36" width="38" height="36" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="m233.09 177.21l-5.52 10.248c-.08.145-.018.272-.023.388-.074.193-.033.4-.033.619v21.615c0 .952.601 1.429 1.552 1.429h33.897c.952 0 1.962-.478 1.962-1.429v-21.615c0-.487-.323-.925-.649-1.24l-5.623-9.976c-.405-.726-1.202-1.179-2.034-1.182l-21.486-.068c-.849 0-1.64.464-2.043 1.211m30.424 32.869c0 .173-.378.018-.551.018h-33.897c-.172 0-.14.155-.14-.018v-21.576l33.961-.281c.066.008.186.09.263.128.054.027.205.049.258.073.002.014.106.027.106.041v21.615m-6.153-32.11l4.91 8.835h-14.992v-9.354l9.306.045c.322.001.619.192.776.474m-11.494-.523v9.358h-16.306l4.773-8.892c.155-.289.456-.484.787-.484l10.746.018m7.06 17.12c0 .39-.316.706-.706.706h-12.706c-.39 0-.706-.316-.706-.706 0-.39.316-.706.706-.706h12.706c.39 0 .706.316.706.706" transform="translate(-227-176)" fill="#7a8996"/></g></svg>
80
  <span class="title-text">
@@ -89,30 +103,46 @@ function _imagify_display_bulk_page() {
89
 
90
  <div class="col-1-3 col-overview">
91
  <h3><?php _e( 'Overview', 'imagify' ); ?></h3>
92
-
93
  <div class="imagify-chart-container">
94
  <canvas id="imagify-overview-chart" width="180" height="180"></canvas>
95
  <div id="imagify-overview-chart-percent" class="imagify-chart-percent"><?php echo imagify_percent_optimized_attachments(); ?><span>%</span></div>
96
  </div>
97
  <div id="imagify-overview-chart-legend"></div>
98
 
99
- <p class="imagify-global-optim-phrase imagify-clear"><?php printf( esc_html__( 'You optimized %s images of your website', 'imagify' ), '<span class="imagify-total-percent">' . imagify_percent_optimized_attachments() . '%</span>' ); ?></p>
 
 
 
 
 
 
 
 
100
  </div>
101
 
102
  <div class="col-1-3 col-statistics">
103
  <h3><?php _e( 'Statistics', 'imagify' ); ?></h3>
104
-
105
  <?php
106
- $total_saving_data = imagify_count_saving_data();
107
- $optimized_percent = $total_saving_data['percent'];
108
- $optimized_nb = $total_saving_data['optimized_size'];
109
- $original_nb = $total_saving_data['original_size'];
110
  ?>
111
-
112
  <div class="imagify-number-you-optimized">
113
  <p>
114
  <span id="imagify-total-optimized-attachments" class="number"><?php echo number_format_i18n( $total_saving_data['count'] ); ?></span>
115
- <span class="text"><?php printf( __( 'that\'s the number of images you optimized with Imagify', 'imagify' ), '<br>' ); ?></span>
 
 
 
 
 
 
 
 
116
  </p>
117
  </div>
118
 
@@ -124,7 +154,7 @@ function _imagify_display_bulk_page() {
124
 
125
  <p><?php _e( 'Optimized size', 'imagify' ); ?></p>
126
  <div class="imagify-bar-positive base-transparent right-outside-number">
127
-
128
  <div id="imagify-optimized-bar" class="imagify-progress" style="width: <?php echo $optimized_percent; ?>%"><span class="imagify-barnb"><?php echo size_format( $optimized_nb, 1 ); ?></span></div>
129
  </div>
130
 
@@ -133,7 +163,15 @@ function _imagify_display_bulk_page() {
133
  <div class="imagify-number-you-optimized">
134
  <p>
135
  <span id="imagify-total-optimized-attachments-pct" class="number"><?php echo number_format_i18n( $optimized_percent ); ?>%</span>
136
- <span class="text"><?php printf( __( 'that\'s the size you saved %sby using Imagify', 'imagify' ), '<br>' ); ?></span>
 
 
 
 
 
 
 
 
137
  </p>
138
  </div>
139
  </div>
@@ -142,15 +180,24 @@ function _imagify_display_bulk_page() {
142
  <h3><?php _e( 'Information', 'imagify' ); ?></h3>
143
  <ul class="imagify-list-infos">
144
  <li>
145
- <?php
146
- esc_html_e( 'Please be aware that optimizing a large number of images can take a while depending on your server and network speed.', 'imagify' );
147
 
148
- if ( get_transient( IMAGIFY_SLUG . '_large_library' ) ) {
149
- printf( __( 'If you have more than %s images, you will need to launch the bulk optimization several times.' , 'imagify' ), number_format_i18n( apply_filters( 'imagify_unoptimized_attachment_limit', 10000 ) ) );
150
- }
151
- ?>
 
 
 
 
 
 
 
 
 
152
  </li>
153
- <li><?php esc_html_e( 'You must keep this page open while the bulk optimizaton is processing. If you leave you can come back to continue where it left off.', 'imagify' ); ?></li>
154
  </ul>
155
  </div><!-- .col-1-2 -->
156
  </div><!-- .imagify-columns -->
@@ -159,50 +206,59 @@ function _imagify_display_bulk_page() {
159
  <div class="imagify-section imagify-section-gray">
160
  <div class="imagify-bulk-submit imagify-columns imagify-count">
161
  <div class="col-1-2">
162
- <?php if ( get_imagify_option( 'backup', 0 ) == "1" ) { ?>
163
 
164
- <p class="imagify-count-title"><?php esc_html_e( 'Select Your Compression Level', 'imagify' ); ?>
165
- <?php
 
 
166
  $default_set = esc_html__( 'Ultra', 'imagify' );
167
- switch( get_imagify_option( 'optimization_level' ) ) {
168
- case '1':
 
169
  $default_set = esc_html__( 'Aggressive', 'imagify' );
170
  break;
171
- case '0':
172
  $default_set = esc_html__( 'Normal', 'imagify' );
173
- break;
174
  }
175
 
 
176
  echo '<em class="imagify-default-settings">(' . sprintf( esc_html__( 'Your default setting: %s', 'imagify' ), '&nbsp;<strong class="imagify-primary">' . $default_set . '</strong>' ) . ')</em>';
177
- ?>
178
- </p>
179
- <p class="imagify-inline-options">
180
- <input type="radio" id="imagify-optimization_level_normal" name="optimization_level" value="0" <?php checked( get_imagify_option( 'optimization_level' ), 0 ); ?>>
181
- <label for="imagify-optimization_level_normal">
182
- <?php esc_html_e( 'Normal', 'imagify' ); ?>
183
- </label>
184
-
185
- <input type="radio" id="imagify-optimization_level_aggro" name="optimization_level" value="1" <?php checked( get_imagify_option( 'optimization_level' ), 1 ); ?>>
186
- <label for="imagify-optimization_level_aggro">
187
- <?php esc_html_e( 'Aggressive', 'imagify' ); ?>
188
- </label>
189
-
190
- <input type="radio" id="imagify-optimization_level_ultra" name="optimization_level" value="2" <?php checked( get_imagify_option( 'optimization_level' ), 2 ); ?>>
191
- <label for="imagify-optimization_level_ultra">
192
- <?php esc_html_e( 'Ultra', 'imagify' ); ?>
193
- </label>
194
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
 
196
- <?php
197
- }
198
- else {
199
- ?>
200
- <p>
201
- <strong><?php printf( __( 'Don\'t forget to check %syour settings%s before bulk optimization.', 'imagify' ), '<a href="' . get_imagify_admin_url() . '">', '</a>' ); ?></strong>
202
- </p>
203
- <?php
204
- }
205
- ?>
206
  </div>
207
  <div class="col-1-2">
208
  <p class="imagify-count-title"><?php esc_html_e( 'Let\'s go!', 'imagify' ); ?></p>
@@ -212,18 +268,26 @@ function _imagify_display_bulk_page() {
212
  <?php wp_nonce_field( 'imagify-bulk-upload', 'imagifybulkuploadnonce' ); ?>
213
  <button id="imagify-bulk-action" type="button" class="button button-primary">
214
  <span class="dashicons dashicons-admin-generic"></span>
215
- <span class="button-text"><?php _e( 'Imagif\'em all', 'imagify'); ?></span>
216
  </button>
217
  </p>
218
  </div>
219
  <div class="imagify-cell imagify-pl0">
220
- <p class="imagify-info-block"><?php printf( __( 'All images greater than %s will be optimized when using a paid plan.', 'imagify' ), size_format( get_imagify_max_image_size() ) ); ?></p>
 
 
 
 
 
 
 
 
221
  </div>
222
  </div>
223
  </div>
224
  </div><!-- .imagify-bulk-submit -->
225
  </div>
226
-
227
  <!-- The Success/Complete bar -->
228
  <div class="imagify-row-complete hidden" aria-hidden="true">
229
  <div class="imagify-all-complete">
@@ -237,7 +301,16 @@ function _imagify_display_bulk_page() {
237
  </div>
238
  <div class="imagify-ac-report-text">
239
  <p class="imagify-ac-rt-big"><?php _e( 'Well done!', 'imagify' ); ?></p>
240
- <p><?php printf( __( 'you saved %1$s out of %2$s', 'imagify' ), '<strong class="imagify-ac-rt-total-gain"></strong>', '<strong class="imagify-ac-rt-total-original"></strong>' ); ?></p>
 
 
 
 
 
 
 
 
 
241
  </div>
242
  </div>
243
  <div class="imagify-ac-share">
@@ -248,7 +321,7 @@ function _imagify_display_bulk_page() {
248
  <a target="_blank" class="imagify-sn-twitter" href=""><svg viewBox="0 0 23 18" width="23" height="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><title>Twitter</title><path d="m244.15 12.13c-.815.361-1.691.606-2.61.716.939-.563 1.659-1.453 1.998-2.514-.878.521-1.851.898-2.886 1.103-.829-.883-2.01-1.435-3.317-1.435-2.51 0-4.544 2.034-4.544 4.544 0 .356.04.703.118 1.035-3.777-.19-7.125-1.999-9.367-4.748-.391.671-.615 1.452-.615 2.285 0 1.576.802 2.967 2.02 3.782-.745-.024-1.445-.228-2.058-.568-.001.019-.001.038-.001.057 0 2.202 1.566 4.04 3.646 4.456-.381.104-.783.159-1.197.159-.293 0-.577-.028-.855-.081.578 1.805 2.256 3.119 4.245 3.156-1.555 1.219-3.515 1.945-5.644 1.945-.367 0-.728-.021-1.084-.063 2.01 1.289 4.399 2.041 6.966 2.041 8.359 0 12.929-6.925 12.929-12.929 0-.197-.004-.393-.013-.588.888-.64 1.658-1.44 2.268-2.352" transform="translate(-222-10)" fill="#fff"/></g></svg></a>
249
  </li>
250
  <li>
251
- <a target="_blank" class="imagify-sn-twitter-facebook" href="<?php echo esc_url('https://www.facebook.com/sharer/sharer.php?u=https://wordpress.org/plugins/imagify' ); ?>"><svg viewBox="0 0 18 18" width="18" height="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><title>Facebook</title><path d="m203.25 10h-16.5c-.415 0-.75.336-.75.75v16.5c0 .414.336.75.75.75h8.812v-6.75h-2.25v-2.813h2.25v-2.25c0-2.325 1.472-3.469 3.546-3.469.993 0 1.847.074 2.096.107v2.43h-1.438c-1.128 0-1.391.536-1.391 1.322v1.859h2.813l-.563 2.813h-2.25l.045 6.75h4.83c.414 0 .75-.336.75-.75v-16.5c0-.414-.336-.75-.75-.75" transform="translate(-186-10)" fill="#fff"/></g></svg></a>
252
  </li>
253
  </ul>
254
  </div>
@@ -291,7 +364,7 @@ function _imagify_display_bulk_page() {
291
  <!-- No image uploaded yet -->
292
  <tr class="imagify-no-uploaded-yet">
293
  <td colspan="7">
294
- <p><?php printf( __( '%sStart the bulk optimization%s', 'imagify' ), '<a id="imagify-simulate-bulk-action" href="#">', '</a>' ); ?></p>
295
  </td>
296
  </tr>
297
  </tbody>
@@ -299,7 +372,7 @@ function _imagify_display_bulk_page() {
299
  </div>
300
 
301
  <?php imagify_payment_modal(); ?>
302
-
303
  </div>
304
  <?php
305
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  /**
5
+ * The main settings page construtor using the required functions from WP.
6
  *
7
  * @since 1.0
8
  */
9
+ function _imagify_display_bulk_page() {
10
  $user = new Imagify_User();
11
  ?>
12
  <div class="wrap imagify-settings imagify-bulk">
13
  <div class="imagify-title">
14
+
15
+ <?php if ( ! defined( 'IMAGIFY_HIDDEN_ACCOUNT' ) || false === IMAGIFY_HIDDEN_ACCOUNT ) { ?>
16
+
17
+ <div class="imagify-title-right">
18
+ <div class="imagify-account">
19
+ <p class="imagify-meteo-title"><?php _e( 'Account status', 'imagify' ); ?></p>
20
+ <p class="imagify-meteo-subs"><?php _e( 'Your subscription:', 'imagify' ); ?>&nbsp;<strong class="imagify-user-plan"><?php echo $user->plan_label; ?></strong></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  </div>
22
+ <div class="imagify-account-link">
23
+ <a href="<?php echo IMAGIFY_APP_MAIN; ?>/#/subscription" class="button button-ghost" target="_blank">
24
+ <span class="dashicons dashicons-admin-users"></span>
25
+ <span class="button-text"><?php _e( 'View My Subscription', 'imagify' ); ?></span>
26
+ </a>
27
+ </div>
28
+
29
+ <?php if ( 1 === $user->plan_id ) { ?>
30
+
31
+ <div class="imagify-sep-v"></div>
32
+ <div class="imagify-credit-left">
33
+ <?php
34
+ $unconsumed_quota = $user->get_percent_unconsumed_quota();
35
+ $meteo_icon = '<img src="' . IMAGIFY_ASSETS_IMG_URL . 'sun.svg" width="37" height="38" alt="" />';
36
+ $bar_class = 'positive';
37
+ $is_display_bubble = false;
38
+
39
+ if ( $unconsumed_quota >= 21 && $unconsumed_quota <= 50 ) {
40
+ $bar_class = 'neutral';
41
+ $meteo_icon = '<img src="' . IMAGIFY_ASSETS_IMG_URL . 'cloudy-sun.svg" width="37" height="38" alt="" />';
42
+ } elseif ( $unconsumed_quota <= 20 ) {
43
+ $bar_class = 'negative';
44
+ $is_display_bubble = true;
45
+ $meteo_icon = '<img src="' . IMAGIFY_ASSETS_IMG_URL . 'stormy.svg" width="38" height="36" alt="" />';
46
+ }
47
+ ?>
48
+ <span class="imagify-meteo-icon"><?php echo $meteo_icon; ?></span>
49
+ <div class="imagify-space-left">
50
+
51
+ <p>
52
+ <?php
53
+ printf(
54
+ /* translators: %s is a data quota. */
55
+ __( 'You have %s space credit left' , 'imagify' ),
56
+ '<span class="imagify-unconsumed-percent">' . $unconsumed_quota . '%</span>'
57
+ );
58
+ ?>
59
+ </p>
60
+
61
+ <div class="imagify-bar-<?php echo $bar_class; ?>">
62
+ <div class="imagify-unconsumed-bar imagify-progress" style="width: <?php echo $unconsumed_quota . '%'; ?>;"></div>
63
+ </div>
64
  </div>
65
+ <div class="imagify-space-tooltips imagify-tooltips <?php echo ( ! $is_display_bubble ) ? 'hidden' : ''; ?>">
66
+ <div class="tooltip-content tooltip-table">
67
+ <div class="cell-icon">
68
+ <span aria-hidden="true" class="icon icon-round">i</span>
69
+ </div>
70
+ <div class="cell-text">
71
+ <?php _e( 'Upgrade your account to continue optimizing your images', 'imagify' ); ?>
72
+ </div>
73
+ <div class="cell-sep"></div>
74
+ <div class="cell-cta">
75
+ <a href="<?php echo IMAGIFY_APP_MAIN; ?>/#/subscription" target="_blank"><?php _e( 'More info', 'imagify' ); ?></a>
76
+ </div>
77
+ </div>
78
  </div>
79
  </div>
80
+
81
+ <?php } // End if(). ?>
82
+
83
  </div>
84
+
85
+ <?php } // End if(). ?>
86
+
 
87
  <img width="225" height="26" alt="Imagify" src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>imagify-logo.png" class="imagify-logo" />
88
  </div>
89
 
90
  <?php echo get_imagify_new_to_imagify(); ?>
91
+
92
  <div class="imagify-sub-title">
93
  <svg class="icon icon-bulk" viewBox="0 0 38 36" width="38" height="36" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="m233.09 177.21l-5.52 10.248c-.08.145-.018.272-.023.388-.074.193-.033.4-.033.619v21.615c0 .952.601 1.429 1.552 1.429h33.897c.952 0 1.962-.478 1.962-1.429v-21.615c0-.487-.323-.925-.649-1.24l-5.623-9.976c-.405-.726-1.202-1.179-2.034-1.182l-21.486-.068c-.849 0-1.64.464-2.043 1.211m30.424 32.869c0 .173-.378.018-.551.018h-33.897c-.172 0-.14.155-.14-.018v-21.576l33.961-.281c.066.008.186.09.263.128.054.027.205.049.258.073.002.014.106.027.106.041v21.615m-6.153-32.11l4.91 8.835h-14.992v-9.354l9.306.045c.322.001.619.192.776.474m-11.494-.523v9.358h-16.306l4.773-8.892c.155-.289.456-.484.787-.484l10.746.018m7.06 17.12c0 .39-.316.706-.706.706h-12.706c-.39 0-.706-.316-.706-.706 0-.39.316-.706.706-.706h12.706c.39 0 .706.316.706.706" transform="translate(-227-176)" fill="#7a8996"/></g></svg>
94
  <span class="title-text">
103
 
104
  <div class="col-1-3 col-overview">
105
  <h3><?php _e( 'Overview', 'imagify' ); ?></h3>
106
+
107
  <div class="imagify-chart-container">
108
  <canvas id="imagify-overview-chart" width="180" height="180"></canvas>
109
  <div id="imagify-overview-chart-percent" class="imagify-chart-percent"><?php echo imagify_percent_optimized_attachments(); ?><span>%</span></div>
110
  </div>
111
  <div id="imagify-overview-chart-legend"></div>
112
 
113
+ <p class="imagify-global-optim-phrase imagify-clear">
114
+ <?php
115
+ printf(
116
+ /* translators: %s is a percentage. */
117
+ esc_html__( 'You optimized %s of your website\'s images', 'imagify' ),
118
+ '<span class="imagify-total-percent">' . imagify_percent_optimized_attachments() . '%</span>'
119
+ );
120
+ ?>
121
+ </p>
122
  </div>
123
 
124
  <div class="col-1-3 col-statistics">
125
  <h3><?php _e( 'Statistics', 'imagify' ); ?></h3>
126
+
127
  <?php
128
+ $total_saving_data = imagify_count_saving_data();
129
+ $optimized_percent = $total_saving_data['percent'];
130
+ $optimized_nb = $total_saving_data['optimized_size'];
131
+ $original_nb = $total_saving_data['original_size'];
132
  ?>
133
+
134
  <div class="imagify-number-you-optimized">
135
  <p>
136
  <span id="imagify-total-optimized-attachments" class="number"><?php echo number_format_i18n( $total_saving_data['count'] ); ?></span>
137
+ <span class="text">
138
+ <?php
139
+ printf(
140
+ /* translators: you can use %s to include a line break. */
141
+ __( 'that\'s the number of images you optimized with Imagify', 'imagify' ),
142
+ '<br>'
143
+ );
144
+ ?>
145
+ </span>
146
  </p>
147
  </div>
148
 
154
 
155
  <p><?php _e( 'Optimized size', 'imagify' ); ?></p>
156
  <div class="imagify-bar-positive base-transparent right-outside-number">
157
+
158
  <div id="imagify-optimized-bar" class="imagify-progress" style="width: <?php echo $optimized_percent; ?>%"><span class="imagify-barnb"><?php echo size_format( $optimized_nb, 1 ); ?></span></div>
159
  </div>
160
 
163
  <div class="imagify-number-you-optimized">
164
  <p>
165
  <span id="imagify-total-optimized-attachments-pct" class="number"><?php echo number_format_i18n( $optimized_percent ); ?>%</span>
166
+ <span class="text">
167
+ <?php
168
+ printf(
169
+ /* translators: %s is a line break. */
170
+ __( 'that\'s the size you saved %sby using Imagify', 'imagify' ),
171
+ '<br>'
172
+ );
173
+ ?>
174
+ </span>
175
  </p>
176
  </div>
177
  </div>
180
  <h3><?php _e( 'Information', 'imagify' ); ?></h3>
181
  <ul class="imagify-list-infos">
182
  <li>
183
+ <?php
184
+ esc_html_e( 'Please be aware that optimizing a large number of images can take a while depending on your server and network speed.', 'imagify' );
185
 
186
+ if ( get_transient( IMAGIFY_SLUG . '_large_library' ) ) {
187
+ printf(
188
+ /* translators: %s is a formatted number. Don't use %d. */
189
+ __( 'If you have more than %s images, you will need to launch the bulk optimization several times.' , 'imagify' ),
190
+ /**
191
+ * Filter the unoptimized attachments limit.
192
+ *
193
+ * @param int Default is 10000.
194
+ */
195
+ number_format_i18n( apply_filters( 'imagify_unoptimized_attachment_limit', 10000 ) )
196
+ );
197
+ }
198
+ ?>
199
  </li>
200
+ <li><?php esc_html_e( 'You must keep this page open while the bulk optimization is processing. If you leave you can come back to continue where it left off.', 'imagify' ); ?></li>
201
  </ul>
202
  </div><!-- .col-1-2 -->
203
  </div><!-- .imagify-columns -->
206
  <div class="imagify-section imagify-section-gray">
207
  <div class="imagify-bulk-submit imagify-columns imagify-count">
208
  <div class="col-1-2">
 
209
 
210
+ <?php if ( (int) get_imagify_option( 'backup', 0 ) === 1 ) { ?>
211
+
212
+ <p class="imagify-count-title"><?php esc_html_e( 'Select Your Compression Level', 'imagify' ); ?>
213
+ <?php
214
  $default_set = esc_html__( 'Ultra', 'imagify' );
215
+
216
+ switch ( (int) get_imagify_option( 'optimization_level' ) ) {
217
+ case 1:
218
  $default_set = esc_html__( 'Aggressive', 'imagify' );
219
  break;
220
+ case 0:
221
  $default_set = esc_html__( 'Normal', 'imagify' );
 
222
  }
223
 
224
+ /* translators: %s is an optimization level. */
225
  echo '<em class="imagify-default-settings">(' . sprintf( esc_html__( 'Your default setting: %s', 'imagify' ), '&nbsp;<strong class="imagify-primary">' . $default_set . '</strong>' ) . ')</em>';
226
+ ?>
227
+ </p>
228
+ <p class="imagify-inline-options">
229
+ <input type="radio" id="imagify-optimization_level_normal" name="optimization_level" value="0" <?php checked( get_imagify_option( 'optimization_level' ), 0 ); ?>>
230
+ <label for="imagify-optimization_level_normal">
231
+ <?php esc_html_e( 'Normal', 'imagify' ); ?>
232
+ </label>
233
+
234
+ <input type="radio" id="imagify-optimization_level_aggro" name="optimization_level" value="1" <?php checked( get_imagify_option( 'optimization_level' ), 1 ); ?>>
235
+ <label for="imagify-optimization_level_aggro">
236
+ <?php esc_html_e( 'Aggressive', 'imagify' ); ?>
237
+ </label>
238
+
239
+ <input type="radio" id="imagify-optimization_level_ultra" name="optimization_level" value="2" <?php checked( get_imagify_option( 'optimization_level' ), 2 ); ?>>
240
+ <label for="imagify-optimization_level_ultra">
241
+ <?php esc_html_e( 'Ultra', 'imagify' ); ?>
242
+ </label>
243
+ </p>
244
+
245
+ <?php } else { ?>
246
+
247
+ <p>
248
+ <strong>
249
+ <?php
250
+ printf(
251
+ /* translators: 1 is the opening of a link, 2 is the closing of this link. */
252
+ __( 'Don\'t forget to check %1$syour settings%2$s before bulk optimization.', 'imagify' ),
253
+ '<a href="' . esc_url( get_imagify_admin_url() ) . '">',
254
+ '</a>'
255
+ );
256
+ ?>
257
+ </strong>
258
+ </p>
259
+
260
+ <?php } // End if(). ?>
261
 
 
 
 
 
 
 
 
 
 
 
262
  </div>
263
  <div class="col-1-2">
264
  <p class="imagify-count-title"><?php esc_html_e( 'Let\'s go!', 'imagify' ); ?></p>
268
  <?php wp_nonce_field( 'imagify-bulk-upload', 'imagifybulkuploadnonce' ); ?>
269
  <button id="imagify-bulk-action" type="button" class="button button-primary">
270
  <span class="dashicons dashicons-admin-generic"></span>
271
+ <span class="button-text"><?php _e( 'Imagif\'em all', 'imagify' ); ?></span>
272
  </button>
273
  </p>
274
  </div>
275
  <div class="imagify-cell imagify-pl0">
276
+ <p class="imagify-info-block">
277
+ <?php
278
+ printf(
279
+ /* translators: %s is a file size. */
280
+ __( 'All images greater than %s will be optimized when using a paid plan.', 'imagify' ),
281
+ size_format( get_imagify_max_image_size() )
282
+ );
283
+ ?>
284
+ </p>
285
  </div>
286
  </div>
287
  </div>
288
  </div><!-- .imagify-bulk-submit -->
289
  </div>
290
+
291
  <!-- The Success/Complete bar -->
292
  <div class="imagify-row-complete hidden" aria-hidden="true">
293
  <div class="imagify-all-complete">
301
  </div>
302
  <div class="imagify-ac-report-text">
303
  <p class="imagify-ac-rt-big"><?php _e( 'Well done!', 'imagify' ); ?></p>
304
+ <p>
305
+ <?php
306
+ printf(
307
+ /* translators: 1 and 2 are data sizes. */
308
+ __( 'you saved %1$s out of %2$s', 'imagify' ),
309
+ '<strong class="imagify-ac-rt-total-gain"></strong>',
310
+ '<strong class="imagify-ac-rt-total-original"></strong>'
311
+ );
312
+ ?>
313
+ </p>
314
  </div>
315
  </div>
316
  <div class="imagify-ac-share">
321
  <a target="_blank" class="imagify-sn-twitter" href=""><svg viewBox="0 0 23 18" width="23" height="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><title>Twitter</title><path d="m244.15 12.13c-.815.361-1.691.606-2.61.716.939-.563 1.659-1.453 1.998-2.514-.878.521-1.851.898-2.886 1.103-.829-.883-2.01-1.435-3.317-1.435-2.51 0-4.544 2.034-4.544 4.544 0 .356.04.703.118 1.035-3.777-.19-7.125-1.999-9.367-4.748-.391.671-.615 1.452-.615 2.285 0 1.576.802 2.967 2.02 3.782-.745-.024-1.445-.228-2.058-.568-.001.019-.001.038-.001.057 0 2.202 1.566 4.04 3.646 4.456-.381.104-.783.159-1.197.159-.293 0-.577-.028-.855-.081.578 1.805 2.256 3.119 4.245 3.156-1.555 1.219-3.515 1.945-5.644 1.945-.367 0-.728-.021-1.084-.063 2.01 1.289 4.399 2.041 6.966 2.041 8.359 0 12.929-6.925 12.929-12.929 0-.197-.004-.393-.013-.588.888-.64 1.658-1.44 2.268-2.352" transform="translate(-222-10)" fill="#fff"/></g></svg></a>
322
  </li>
323
  <li>
324
+ <a target="_blank" class="imagify-sn-twitter-facebook" href="<?php echo esc_url( 'https://www.facebook.com/sharer/sharer.php?u=https://wordpress.org/plugins/imagify' ); ?>"><svg viewBox="0 0 18 18" width="18" height="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><title>Facebook</title><path d="m203.25 10h-16.5c-.415 0-.75.336-.75.75v16.5c0 .414.336.75.75.75h8.812v-6.75h-2.25v-2.813h2.25v-2.25c0-2.325 1.472-3.469 3.546-3.469.993 0 1.847.074 2.096.107v2.43h-1.438c-1.128 0-1.391.536-1.391 1.322v1.859h2.813l-.563 2.813h-2.25l.045 6.75h4.83c.414 0 .75-.336.75-.75v-16.5c0-.414-.336-.75-.75-.75" transform="translate(-186-10)" fill="#fff"/></g></svg></a>
325
  </li>
326
  </ul>
327
  </div>
364
  <!-- No image uploaded yet -->
365
  <tr class="imagify-no-uploaded-yet">
366
  <td colspan="7">
367
+ <p><a id="imagify-simulate-bulk-action" href="#"><?php _e( 'Start the bulk optimization', 'imagify' ); ?></a></p>
368
  </td>
369
  </tr>
370
  </tbody>
372
  </div>
373
 
374
  <?php imagify_payment_modal(); ?>
375
+
376
  </div>
377
  <?php
378
+ }
inc/admin/ui/notices.php CHANGED
@@ -1,19 +1,21 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
4
  /**
5
- * This warning is displayed when the API key is empty
6
  *
7
  * @since 1.0
8
  * @author Jonathan Buttigieg
9
  */
10
- add_action( 'all_admin_notices', '_imagify_warning_empty_api_key_notice' );
11
  function _imagify_warning_empty_api_key_notice() {
12
  $current_screen = get_current_screen();
13
- $ignored_notices = get_user_meta( $GLOBALS['current_user']->ID, '_imagify_ignore_notices', true );
14
- $cap = ( imagify_is_active_for_network() ) ? 'manage_network_options' : 'manage_options';
15
-
16
- if ( ( isset( $current_screen ) && ( 'settings_page_imagify' === $current_screen->base || 'settings_page_imagify-network' === $current_screen->base ) ) || in_array( 'welcome-steps', (array) $ignored_notices ) || get_imagify_option( 'api_key', false ) || ! current_user_can( apply_filters( 'imagify_capacity', $cap ) ) ) {
 
 
17
  return;
18
  }
19
  ?>
@@ -23,7 +25,7 @@ function _imagify_warning_empty_api_key_notice() {
23
  <span class="baseline">
24
  <?php _e( 'Welcome to Imagify, the best way to easily optimize your images!', 'imagify' ); ?>
25
  </span>
26
- <a href="<?php echo get_imagify_admin_url( 'dismiss-notice', 'welcome-steps' ); ?>" class="imagify-notice-dismiss imagify-welcome-remove" title="<?php _e( 'Dismiss this notice', 'imagify' ); ?>"><span class="dashicons dashicons-dismiss"></span><span class="screen-reader-text"><?php _e( 'Dismiss this notice', 'imagify' ); ?></span></a>
27
  </div>
28
  <div class="imagify-settings-section">
29
  <div class="imagify-columns counter">
@@ -41,10 +43,20 @@ function _imagify_warning_empty_api_key_notice() {
41
  <img src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>key.svg" width="48" height="48" alt="">
42
  <div class="imagify-col-content">
43
  <p class="imagify-col-title"><?php _e( 'Enter your API Key', 'imagify' ); ?></p>
44
- <p class="imagify-col-desc"><?php printf( __( 'Save your API Key you have received by email or you can get it on your %sImagify account page%s.', 'imagify' ), '<a href="' . IMAGIFY_APP_MAIN . '/#/api">', '</a>' ); ?></p>
 
 
 
 
 
 
 
 
 
45
  <p>
46
  <?php wp_nonce_field( 'imagify-check-api-key', 'imagifycheckapikeynonce', false ); ?>
47
- <a id="imagify-save-api-key" href="<?php echo get_imagify_admin_url(); ?>" class="button button-primary"><?php _e( 'I have my API key', 'imagify' ); ?></a></p>
 
48
  </div>
49
  </div>
50
  <div class="col-1-3">
@@ -52,7 +64,7 @@ function _imagify_warning_empty_api_key_notice() {
52
  <div class="imagify-col-content">
53
  <p class="imagify-col-title"><?php _e( 'Configure it', 'imagify' ); ?></p>
54
  <p class="imagify-col-desc"><?php _e( 'It’s almost done! You have just to configure your optimization settings.', 'imagify' ); ?></p>
55
- <p><a href="<?php echo get_imagify_admin_url(); ?>" class="button button-primary"><?php _e( 'Go to Settings', 'imagify' ); ?></a></p>
56
  </div>
57
  </div>
58
  </div>
@@ -61,20 +73,23 @@ function _imagify_warning_empty_api_key_notice() {
61
  <?php
62
  }
63
 
 
64
  /**
65
- * This warning is displayed when the API key is empty
66
  *
67
  * @since 1.0
68
  * @author Jonathan Buttigieg
69
  */
70
- add_action( 'all_admin_notices', '_imagify_warning_wrong_api_key_notice' );
71
  function _imagify_warning_wrong_api_key_notice() {
72
- $current_screen = get_current_screen();
73
- $ignored_notices = get_user_meta( $GLOBALS['current_user']->ID, '_imagify_ignore_notices', true );
74
- $api_key = get_imagify_option( 'api_key', false );
75
- $cap = ( imagify_is_active_for_network() ) ? 'manage_network_options' : 'manage_options';
76
-
77
- if ( ( isset( $current_screen ) && 'media_page_imagify-bulk-optimization' !== $current_screen->base ) || in_array( 'wrong-api-key', (array) $ignored_notices ) || empty( $api_key ) || imagify_valid_key() || ! current_user_can( apply_filters( 'imagify_capacity', $cap ) ) ) {
 
 
 
78
  return;
79
  }
80
  ?>
@@ -86,52 +101,59 @@ function _imagify_warning_wrong_api_key_notice() {
86
  <div class="imagify-notice-content">
87
  <p class="imagify-notice-title"><strong><?php _e( 'Your API key isn\'t valid!', 'imagify' ); ?></strong></p>
88
  <p>
89
- <?php wp_nonce_field( 'imagify-signup', 'imagifysignupnonce', false ); ?>
90
- <?php printf( __( 'Go to your Imagify account page to get your API Key and specify it on %1$syour settings%3$s or %2$screate an account for free%3$s if you don\'t have one yet.', 'imagify' ), '<a href="' . get_imagify_admin_url() . '">', '<a id="imagify-signup" href="' . IMAGIFY_WEB_MAIN . '">', '</a>' ); ?></p>
 
 
 
 
 
 
 
 
 
91
  </div>
92
- <a href="<?php echo get_imagify_admin_url( 'dismiss-notice', 'wrong-api-key' ); ?>" class="imagify-notice-dismiss notice-dismiss" title="<?php esc_attr_e( 'Dismiss this notice', 'imagify' ); ?>"><span class="screen-reader-text"><?php _e( 'Dismiss this notice', 'imagify' ); ?></span></a>
93
  </div>
94
 
95
  <?php
96
  }
97
 
 
98
  /**
99
  * This warning is displayed when some plugins may conflict with Imagify
100
  *
101
  * @since 1.0
102
  * @author Jonathan Buttigieg
103
  */
104
- add_action( 'all_admin_notices', '_imagify_warning_plugins_to_deactivate_notice' );
105
  function _imagify_warning_plugins_to_deactivate_notice() {
106
  $plugins_to_deactivate = array();
107
- $cap = ( imagify_is_active_for_network() ) ? 'manage_network_options' : 'manage_options';
108
 
109
- // Deactivate all plugins who can cause conflicts with Imagify
110
  $plugins = array(
111
- 'wp-smush' => 'wp-smushit/wp-smush.php', // WP Smush
112
- 'wp-smush-pro' => 'wp-smush-pro/wp-smush.php', // WP Smush Pro
113
- 'kraken' => 'kraken-image-optimizer/kraken.php', // Kraken.io
114
- 'tinypng' => 'tiny-compress-images/tiny-compress-images.php', // TinyPNG
115
- 'shortpixel' => 'shortpixel-image-optimiser/wp-shortpixel.php', // Shortpixel
116
- 'ewww' => 'ewww-image-optimizer/ewww-image-optimizer.php', // EWWW Image Optimizer
117
- 'ewww-cloud' => 'ewww-image-optimizer-cloud/ewww-image-optimizer-cloud.php', // EWWW Image Optimizer Cloud
118
- 'imagerecycle' => 'imagerecycle-pdf-image-compression/wp-image-recycle.php', // ImageRecycle
119
  );
120
 
121
  /**
122
- * Filter the recommended plugins to deactivate to prevent conflicts
123
  *
124
  * @since 1.0
125
  *
126
- * @param string $plugins List of recommended plugins to deactivate
127
  */
128
  $plugins = apply_filters( 'imagify_plugins_to_deactivate', $plugins );
129
  $plugins = array_filter( $plugins, 'is_plugin_active' );
130
 
131
- /** This filter is documented in inc/admin/options.php */
132
- if ( ! (bool) $plugins || ! current_user_can( apply_filters( 'imagify_capacity', $cap ) ) ) {
133
  return;
134
- }
135
  ?>
136
  <div class="clear"></div>
137
  <div class="imagify-notice error below-h2">
@@ -144,8 +166,9 @@ function _imagify_warning_plugins_to_deactivate_notice() {
144
  <ul class="imagify-plugins-error">
145
  <?php
146
  foreach ( $plugins as $plugin ) {
147
- $plugin_data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $plugin );
148
- echo '<li>' . $plugin_data['Name'] . '</span> <a href="' . wp_nonce_url( admin_url( 'admin-post.php?action=imagify_deactivate_plugin&plugin=' . urlencode( $plugin ) ), 'imagifydeactivatepluginnonce' ) . '" class="button button-mini alignright">' . __( 'Deactivate', 'imagify' ) . '</a></li>';
 
149
  }
150
  ?>
151
  </ul>
@@ -154,21 +177,24 @@ function _imagify_warning_plugins_to_deactivate_notice() {
154
  <?php
155
  }
156
 
 
157
  /**
158
- * This notice is displayed when external HTTP requests are blocked via the WP_HTTP_BLOCK_EXTERNAL constant
159
  *
160
  * @since 1.0
161
  * @author Jonathan Buttigieg
162
  */
163
- add_action( 'all_admin_notices', '_imagify_http_block_external_notice' );
164
  function _imagify_http_block_external_notice() {
165
  $current_screen = get_current_screen();
166
- $ignored_notices = get_user_meta( $GLOBALS['current_user']->ID, '_imagify_ignore_notices', true );
167
 
168
- if ( ( isset( $current_screen ) && ( 'settings_page_imagify' === $current_screen->base || 'settings_page_imagify-network' === $current_screen->base ) ) || in_array( 'http-block-external', (array) $ignored_notices ) || ! current_user_can( apply_filters( 'imagify_capacity', 'manage_options' ) ) || ! is_imagify_blocked() ) {
169
  return;
170
  }
171
- ?>
 
 
 
 
172
  <div class="clear"></div>
173
  <div class="error imagify-notice below-h2">
174
  <div class="imagify-notice-logo">
@@ -176,36 +202,43 @@ function _imagify_http_block_external_notice() {
176
  </div>
177
  <div class="imagify-notice-content">
178
  <p class="imagify-notice-title"><strong><?php _e( 'The external HTTP requests are blocked!', 'imagify' ); ?></strong></p>
179
- <p><?php _e( 'You defined the <code>WP_HTTP_BLOCK_EXTERNAL</code> constant in the <code>wp-config.php</code> to block all external HTTP requests.', 'imagify' ); ?></p>
180
  <p>
181
- <?php _e( 'To optimize your images, you have to put the following code in your <code>wp-config.php</code> file so that it works correctly.', 'imagify' ); ?><br/>
182
- <?php _e( 'Click on the field and press Ctrl-A to select all.', 'imagify' ); ?>
 
 
 
183
  </p>
184
  <p><textarea readonly="readonly" class="large-text readonly" rows="1">define( 'WP_ACCESSIBLE_HOSTS', '*.imagify.io' );</textarea></p>
185
  </div>
186
- <a href="<?php echo get_imagify_admin_url( 'dismiss-notice', 'http-block-external' ); ?>" class="imagify-notice-dismiss notice-dismiss" title="<?php esc_attr_e( 'Dismiss this notice', 'imagify' ); ?>"><span class="screen-reader-text"><?php _e( 'Dismiss this notice', 'imagify' ); ?></span></a>
187
- </div>
188
  <?php
189
  }
190
 
 
191
  /**
192
- * This warning is displayed when the grid view is active on the library
193
  *
194
  * @since 1.0.2
195
  * @author Jonathan Buttigieg
196
  */
197
- add_action( 'all_admin_notices', '_imagify_warning_grid_view_notice' );
198
  function _imagify_warning_grid_view_notice() {
199
  global $wp_version;
200
- $current_screen = get_current_screen();
201
- $ignored_notices = get_user_meta( $GLOBALS['current_user']->ID, '_imagify_ignore_notices', true );
 
 
 
 
 
202
  $media_library_mode = get_user_option( 'media_library_mode', get_current_user_id() );
203
 
204
- if ( ( isset( $current_screen ) && 'upload' !== $current_screen->base ) || in_array( 'grid-view', (array) $ignored_notices ) || ! current_user_can( 'upload_files' ) || $media_library_mode == 'list' || version_compare( $wp_version, '4.0' ) < 0 ) {
205
  return;
206
  }
207
-
208
- // Don't display the notice if the API key isn't valid
209
  if ( ! imagify_valid_key() ) {
210
  return;
211
  }
@@ -218,36 +251,38 @@ function _imagify_warning_grid_view_notice() {
218
  <div class="imagify-notice-content">
219
  <p class="imagify-notice-title"><strong><?php _e( 'You\'re missing out!', 'imagify' ); ?></strong></p>
220
  <p><?php _e( 'Use the List view to optimize images with Imagify.', 'imagify' ); ?></p>
221
- <p><a href="<?php echo admin_url( 'upload.php?mode=list' ); ?>"><?php _e( 'Switch to the List View', 'imagify' ); ?></a></p>
222
  </div>
223
- <a href="<?php echo get_imagify_admin_url( 'dismiss-notice', 'grid-view' ); ?>" class="imagify-notice-dismiss notice-dismiss" title="<?php esc_attr_e( 'Dismiss this notice', 'imagify' ); ?>"><span class="screen-reader-text"><?php _e( 'Dismiss this notice', 'imagify' ); ?></span></a>
224
- </div>
225
  <?php
226
  }
227
 
 
228
  /**
229
- * This warning is displayed to warn the user that its quota is consumed for the current month
230
  *
231
  * @since 1.1.1
232
  * @author Jonathan Buttigieg
233
  */
234
- add_action( 'all_admin_notices', '_imagify_warning_over_quota_notice' );
235
  function _imagify_warning_over_quota_notice() {
236
- $current_screen = get_current_screen();
237
- $ignored_notices = get_user_meta( $GLOBALS['current_user']->ID, '_imagify_ignore_notices', true );
238
- $cap = ( imagify_is_active_for_network() ) ? 'manage_network_options' : 'manage_options';
 
 
239
 
240
- if ( ( isset( $current_screen ) && ( 'media_page_imagify-bulk-optimization' !== $current_screen->base && 'settings_page_imagify' !== $current_screen->base && 'settings_page_imagify-network' !== $current_screen->base ) ) || in_array( 'free-over-quota', (array) $ignored_notices ) || ! current_user_can( apply_filters( 'imagify_capacity', $cap ) ) ) {
241
  return;
242
  }
243
-
244
  $user = new Imagify_User();
245
-
246
- // Don't display the notice if the user doesn't use all his quota or the API key isn't valid
247
  if ( ! $user->is_over_quota() || ! imagify_valid_key() ) {
248
  return;
249
  }
250
-
251
  ?>
252
  <div class="clear"></div>
253
  <div class="error imagify-notice below-h2">
@@ -256,36 +291,52 @@ function _imagify_warning_over_quota_notice() {
256
  </div>
257
  <div class="imagify-notice-content">
258
  <p class="imagify-notice-title"><strong><?php _e( 'Oops, It\'s Over!', 'imagify' ); ?></strong></p>
259
- <p>
260
- <?php printf( __( 'You have consumed all your credit for this month. You will have <strong>%s back on %s</strong>.', 'imagify' ), size_format( $user->quota * 1048576 ), date_i18n( get_option( 'date_format' ), strtotime( $user->next_date_update ) ) ) . '<br/><br/>' . sprintf( __( 'To continue to optimize your images, log in to your Imagify account to %sbuy a pack or subscribe to a plan%s.', 'imagify' ), '<a href="' . IMAGIFY_APP_MAIN . '/#/subscription' . '">', '</a>' ); ?>
261
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  </div>
263
  <a href="<?php echo get_imagify_admin_url( 'dismiss-notice', 'free-over-quota' ); ?>" class="imagify-notice-dismiss notice-dismiss" title="<?php esc_attr_e( 'Dismiss this notice', 'imagify' ); ?>"><span class="screen-reader-text"><?php _e( 'Dismiss this notice', 'imagify' ); ?></span></a>
264
- </div>
265
  <?php
266
  }
267
 
 
268
  /**
269
  * Add a message about WP Rocket on the "Bulk Optimization" screen.
270
  *
271
  * @since 2.7
272
  * @author Jonathan Buttigieg
273
  */
274
- add_action( 'admin_notices', '_imagify_rocket_notice' );
275
  function _imagify_rocket_notice() {
276
- $current_screen = get_current_screen();
277
- $ignored_notices = get_user_meta( $GLOBALS['current_user']->ID, '_imagify_ignore_notices', true );
278
-
279
- if ( ( isset( $current_screen ) && 'media_page_imagify-bulk-optimization' !== $current_screen->base ) || in_array( 'wp-rocket', (array) $ignored_notices ) || ! current_user_can( apply_filters( 'imagify_capacity', 'manage_options' ) ) || defined( 'WP_ROCKET_VERSION' ) ) {
280
  return;
281
  }
282
 
283
- $dismiss_url = get_imagify_admin_url( 'dismiss-notice', 'wp-rocket' );
 
 
284
 
285
- $coupon_code = 'IMAGIFY20';
 
286
  $wprocket_url = 'http://wp-rocket.me/';
287
-
288
- switch( get_locale() ) {
289
  case 'fr_FR' :
290
  $wprocket_url = 'http://wp-rocket.me/fr/';
291
  break;
@@ -299,24 +350,25 @@ function _imagify_rocket_notice() {
299
  $wprocket_url = 'http://wp-rocket.me/de/';
300
  break;
301
  }
302
-
303
- $wprocket_url .= '?utm_source=imagify-coupon&utm_medium=plugin&utm_campaign=imagify';
304
  ?>
305
 
306
  <div class="updated imagify-rkt-notice">
307
  <a href="<?php echo $dismiss_url; ?>" class="imagify-cross"><span class="dashicons dashicons-no"></span></a>
308
-
309
  <p class="imagify-rkt-logo">
310
  <img src="<?php echo IMAGIFY_ASSETS_IMG_URL ?>logo-wprocket.png" srcset="<?php echo IMAGIFY_ASSETS_IMG_URL ?>logo-wprocket2x.png 2x" alt="WP Rocket" width="118" height="32">
311
  </p>
312
  <p class="imagify-rkt-msg">
313
  <?php
314
- esc_html_e( 'Discover the best caching plugin to speed up your website.', 'imagify');
315
- echo '<br>';
316
- printf(
317
- esc_html__( '%sGet %s off%s with this coupon code:%s', 'imagify' ),
318
- '<strong>', '20%', '</strong>', ' ' . $coupon_code
319
- );
 
320
  ?>
321
  </p>
322
  <p class="imagify-rkt-coupon">
@@ -330,24 +382,27 @@ function _imagify_rocket_notice() {
330
  <?php
331
  }
332
 
 
333
  /**
334
- * This notice is displayed to rate the plugin after 100 optimization & 7 days after the first installation
335
  *
336
  * @since 1.4.2
337
  * @author Jonathan Buttigieg
338
  */
339
- add_action( 'all_admin_notices', '_imagify_rating_notice' );
340
  function _imagify_rating_notice() {
341
- $user_images_count = get_site_transient( 'imagify_user_images_count' );
342
-
343
- if ( ! $user_images_count || get_site_transient( 'imagify_seen_rating_notice' ) ) {
344
  return;
345
  }
346
-
347
- $current_screen = get_current_screen();
348
- $ignored_notices = get_user_meta( $GLOBALS['current_user']->ID, '_imagify_ignore_notices', true );
349
 
350
- if ( ( isset( $current_screen ) && ( 'media_page_imagify-bulk-optimization' !== $current_screen->base && 'upload' !== $current_screen->base && 'media' !== $current_screen->base ) ) || in_array( 'rating', (array) $ignored_notices ) || ! current_user_can( apply_filters( 'imagify_capacity', 'manage_options' ) ) ) {
 
 
 
 
 
 
351
  return;
352
  }
353
  ?>
@@ -357,25 +412,46 @@ function _imagify_rating_notice() {
357
  <img class="imagify-logo" src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>imagify-logo.png" width="138" height="16" alt="Imagify" />
358
  </div>
359
  <div class="imagify-notice-content">
360
- <?php
361
- $imagify_rate_url = 'https://wordpress.org/support/view/plugin-reviews/imagify?rate=5#postform';
362
- ?>
363
- <p><?php printf( __( '%1$sCongratulations%2$s, you have optimized %1$s%3$d images%2$s and improved your website\'s speed by reducing your images size.', 'imagify' ), '<strong>', '</strong>', $user_images_count ); ?></p>
 
 
 
 
 
364
  <p class="imagify-rate-us">
365
- <?php printf( __( '%sDo you like this plugin?%s Please take a few seconds to %srate it on WordPress.org%s!', 'imagify' ), '<strong>', '</strong><br />', '<a href="' . $imagify_rate_url . '">', '</a>' ); ?>
 
 
 
 
 
 
 
 
 
 
 
366
  <br>
367
  <a class="stars" href="<?php echo $imagify_rate_url; ?>">☆☆☆☆☆</a>
368
  </p>
369
  </div>
370
- <a href="<?php echo get_imagify_admin_url( 'dismiss-notice', 'rating' ); ?>" class="imagify-notice-dismiss notice-dismiss" title="<?php esc_attr_e( 'Dismiss this notice', 'imagify' ); ?>"><span class="screen-reader-text"><?php _e( 'Dismiss this notice', 'imagify' ); ?></span></a>
371
  </div>
372
  <?php
373
  }
374
 
375
  add_action( 'imagify_dismiss_notice', '_imagify_clear_scheduled_rating' );
 
 
 
 
 
376
  function _imagify_clear_scheduled_rating( $notice ) {
377
  if ( 'rating' === $notice ) {
378
  set_site_transient( 'do_imagify_rating_cron', 'no' );
379
  wp_clear_scheduled_hook( 'imagify_rating_event' );
380
  }
381
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_action( 'all_admin_notices', '_imagify_warning_empty_api_key_notice' );
5
  /**
6
+ * This warning is displayed when the API key is empty.
7
  *
8
  * @since 1.0
9
  * @author Jonathan Buttigieg
10
  */
 
11
  function _imagify_warning_empty_api_key_notice() {
12
  $current_screen = get_current_screen();
13
+
14
+ if ( ! empty( $current_screen ) && ( 'settings_page_imagify' === $current_screen->base || 'settings_page_imagify-network' === $current_screen->base ) ) {
15
+ return;
16
+ }
17
+
18
+ if ( imagify_notice_is_dismissed( 'welcome-steps' ) || get_imagify_option( 'api_key', false ) || ! current_user_can( imagify_get_capacity() ) ) {
19
  return;
20
  }
21
  ?>
25
  <span class="baseline">
26
  <?php _e( 'Welcome to Imagify, the best way to easily optimize your images!', 'imagify' ); ?>
27
  </span>
28
+ <a href="<?php echo esc_url( get_imagify_admin_url( 'dismiss-notice', 'welcome-steps' ) ); ?>" class="imagify-notice-dismiss imagify-welcome-remove" title="<?php esc_attr_e( 'Dismiss this notice', 'imagify' ); ?>"><span class="dashicons dashicons-dismiss"></span><span class="screen-reader-text"><?php _e( 'Dismiss this notice', 'imagify' ); ?></span></a>
29
  </div>
30
  <div class="imagify-settings-section">
31
  <div class="imagify-columns counter">
43
  <img src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>key.svg" width="48" height="48" alt="">
44
  <div class="imagify-col-content">
45
  <p class="imagify-col-title"><?php _e( 'Enter your API Key', 'imagify' ); ?></p>
46
+ <p class="imagify-col-desc">
47
+ <?php
48
+ printf(
49
+ /* translators: 1 is a link tag start, 2 is the link tag end. */
50
+ __( 'Save your API Key you have received by email or you can get it on your %1$sImagify account page%2$s.', 'imagify' ),
51
+ '<a href="' . IMAGIFY_APP_MAIN . '/#/api">',
52
+ '</a>'
53
+ );
54
+ ?>
55
+ </p>
56
  <p>
57
  <?php wp_nonce_field( 'imagify-check-api-key', 'imagifycheckapikeynonce', false ); ?>
58
+ <a id="imagify-save-api-key" href="<?php echo esc_url( get_imagify_admin_url() ); ?>" class="button button-primary"><?php _e( 'I have my API key', 'imagify' ); ?></a>
59
+ </p>
60
  </div>
61
  </div>
62
  <div class="col-1-3">
64
  <div class="imagify-col-content">
65
  <p class="imagify-col-title"><?php _e( 'Configure it', 'imagify' ); ?></p>
66
  <p class="imagify-col-desc"><?php _e( 'It’s almost done! You have just to configure your optimization settings.', 'imagify' ); ?></p>
67
+ <p><a href="<?php echo esc_url( get_imagify_admin_url() ); ?>" class="button button-primary"><?php _e( 'Go to Settings', 'imagify' ); ?></a></p>
68
  </div>
69
  </div>
70
  </div>
73
  <?php
74
  }
75
 
76
+ add_action( 'all_admin_notices', '_imagify_warning_wrong_api_key_notice' );
77
  /**
78
+ * This warning is displayed when the API key is empty.
79
  *
80
  * @since 1.0
81
  * @author Jonathan Buttigieg
82
  */
 
83
  function _imagify_warning_wrong_api_key_notice() {
84
+ $current_screen = get_current_screen();
85
+
86
+ if ( empty( $current_screen ) || 'media_page_imagify-bulk-optimization' !== $current_screen->base ) {
87
+ return;
88
+ }
89
+
90
+ $api_key = get_imagify_option( 'api_key', false );
91
+
92
+ if ( imagify_notice_is_dismissed( 'wrong-api-key' ) || empty( $api_key ) || imagify_valid_key() || ! current_user_can( imagify_get_capacity() ) ) {
93
  return;
94
  }
95
  ?>
101
  <div class="imagify-notice-content">
102
  <p class="imagify-notice-title"><strong><?php _e( 'Your API key isn\'t valid!', 'imagify' ); ?></strong></p>
103
  <p>
104
+ <?php wp_nonce_field( 'imagify-signup', 'imagifysignupnonce', false ); ?>
105
+ <?php
106
+ printf(
107
+ /* translators: 1 and 2 are link tag starts, 3 is a link tag end. */
108
+ __( 'Go to your Imagify account page to get your API Key and specify it on %1$syour settings%3$s or %2$screate an account for free%3$s if you don\'t have one yet.', 'imagify' ),
109
+ '<a href="' . get_imagify_admin_url() . '">',
110
+ '<a id="imagify-signup" href="' . IMAGIFY_WEB_MAIN . '">',
111
+ '</a>'
112
+ );
113
+ ?>
114
+ </p>
115
  </div>
116
+ <a href="<?php echo esc_url( get_imagify_admin_url( 'dismiss-notice', 'wrong-api-key' ) ); ?>" class="imagify-notice-dismiss notice-dismiss" title="<?php esc_attr_e( 'Dismiss this notice', 'imagify' ); ?>"><span class="screen-reader-text"><?php _e( 'Dismiss this notice', 'imagify' ); ?></span></a>
117
  </div>
118
 
119
  <?php
120
  }
121
 
122
+ add_action( 'all_admin_notices', '_imagify_warning_plugins_to_deactivate_notice' );
123
  /**
124
  * This warning is displayed when some plugins may conflict with Imagify
125
  *
126
  * @since 1.0
127
  * @author Jonathan Buttigieg
128
  */
 
129
  function _imagify_warning_plugins_to_deactivate_notice() {
130
  $plugins_to_deactivate = array();
 
131
 
132
+ // Deactivate all plugins who can cause conflicts with Imagify.
133
  $plugins = array(
134
+ 'wp-smush' => 'wp-smushit/wp-smush.php', // WP Smush.
135
+ 'wp-smush-pro' => 'wp-smush-pro/wp-smush.php', // WP Smush Pro.
136
+ 'kraken' => 'kraken-image-optimizer/kraken.php', // Kraken.io.
137
+ 'tinypng' => 'tiny-compress-images/tiny-compress-images.php', // TinyPNG.
138
+ 'shortpixel' => 'shortpixel-image-optimiser/wp-shortpixel.php', // Shortpixel.
139
+ 'ewww' => 'ewww-image-optimizer/ewww-image-optimizer.php', // EWWW Image Optimizer.
140
+ 'ewww-cloud' => 'ewww-image-optimizer-cloud/ewww-image-optimizer-cloud.php', // EWWW Image Optimizer Cloud.
141
+ 'imagerecycle' => 'imagerecycle-pdf-image-compression/wp-image-recycle.php', // ImageRecycle.
142
  );
143
 
144
  /**
145
+ * Filter the recommended plugins to deactivate to prevent conflicts.
146
  *
147
  * @since 1.0
148
  *
149
+ * @param string $plugins List of recommended plugins to deactivate.
150
  */
151
  $plugins = apply_filters( 'imagify_plugins_to_deactivate', $plugins );
152
  $plugins = array_filter( $plugins, 'is_plugin_active' );
153
 
154
+ if ( ! $plugins || ! current_user_can( imagify_get_capacity() ) ) {
 
155
  return;
156
+ }
157
  ?>
158
  <div class="clear"></div>
159
  <div class="imagify-notice error below-h2">
166
  <ul class="imagify-plugins-error">
167
  <?php
168
  foreach ( $plugins as $plugin ) {
169
+ $plugin_data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $plugin );
170
+ $deactivate_url = esc_url( wp_nonce_url( admin_url( 'admin-post.php?action=imagify_deactivate_plugin&plugin=' . rawurlencode( $plugin ) ), 'imagifydeactivatepluginnonce' ) );
171
+ echo '<li>' . $plugin_data['Name'] . '</span> <a href="' . $deactivate_url . '" class="button button-mini alignright">' . __( 'Deactivate', 'imagify' ) . '</a></li>';
172
  }
173
  ?>
174
  </ul>
177
  <?php
178
  }
179
 
180
+ add_action( 'all_admin_notices', '_imagify_http_block_external_notice' );
181
  /**
182
+ * This notice is displayed when external HTTP requests are blocked via the WP_HTTP_BLOCK_EXTERNAL constant.
183
  *
184
  * @since 1.0
185
  * @author Jonathan Buttigieg
186
  */
 
187
  function _imagify_http_block_external_notice() {
188
  $current_screen = get_current_screen();
 
189
 
190
+ if ( empty( $current_screen ) || ( 'settings_page_imagify' === $current_screen->base || 'settings_page_imagify-network' === $current_screen->base ) ) {
191
  return;
192
  }
193
+
194
+ if ( imagify_notice_is_dismissed( 'http-block-external' ) || ! current_user_can( imagify_get_capacity( true ) ) || ! is_imagify_blocked() ) {
195
+ return;
196
+ }
197
+ ?>
198
  <div class="clear"></div>
199
  <div class="error imagify-notice below-h2">
200
  <div class="imagify-notice-logo">
202
  </div>
203
  <div class="imagify-notice-content">
204
  <p class="imagify-notice-title"><strong><?php _e( 'The external HTTP requests are blocked!', 'imagify' ); ?></strong></p>
 
205
  <p>
206
+ <?php _e( 'You defined the <code>WP_HTTP_BLOCK_EXTERNAL</code> constant in the <code>wp-config.php</code> to block all external HTTP requests.', 'imagify' ); ?>
207
+ </p>
208
+ <p>
209
+ <?php _e( 'To optimize your images, you have to put the following code in your <code>wp-config.php</code> file so that it works correctly.', 'imagify' ); ?><br/>
210
+ <?php _e( 'Click on the field and press Ctrl-A to select all.', 'imagify' ); ?>
211
  </p>
212
  <p><textarea readonly="readonly" class="large-text readonly" rows="1">define( 'WP_ACCESSIBLE_HOSTS', '*.imagify.io' );</textarea></p>
213
  </div>
214
+ <a href="<?php echo esc_url( get_imagify_admin_url( 'dismiss-notice', 'http-block-external' ) ); ?>" class="imagify-notice-dismiss notice-dismiss" title="<?php esc_attr_e( 'Dismiss this notice', 'imagify' ); ?>"><span class="screen-reader-text"><?php _e( 'Dismiss this notice', 'imagify' ); ?></span></a>
215
+ </div>
216
  <?php
217
  }
218
 
219
+ add_action( 'all_admin_notices', '_imagify_warning_grid_view_notice' );
220
  /**
221
+ * This warning is displayed when the grid view is active on the library.
222
  *
223
  * @since 1.0.2
224
  * @author Jonathan Buttigieg
225
  */
 
226
  function _imagify_warning_grid_view_notice() {
227
  global $wp_version;
228
+
229
+ $current_screen = get_current_screen();
230
+
231
+ if ( empty( $current_screen ) || 'upload' !== $current_screen->base ) {
232
+ return;
233
+ }
234
+
235
  $media_library_mode = get_user_option( 'media_library_mode', get_current_user_id() );
236
 
237
+ if ( imagify_notice_is_dismissed( 'grid-view' ) || ! current_user_can( 'upload_files' ) || 'list' === $media_library_mode || version_compare( $wp_version, '4.0' ) < 0 ) {
238
  return;
239
  }
240
+
241
+ // Don't display the notice if the API key isn't valid.
242
  if ( ! imagify_valid_key() ) {
243
  return;
244
  }
251
  <div class="imagify-notice-content">
252
  <p class="imagify-notice-title"><strong><?php _e( 'You\'re missing out!', 'imagify' ); ?></strong></p>
253
  <p><?php _e( 'Use the List view to optimize images with Imagify.', 'imagify' ); ?></p>
254
+ <p><a href="<?php echo esc_url( admin_url( 'upload.php?mode=list' ) ); ?>"><?php _e( 'Switch to the List View', 'imagify' ); ?></a></p>
255
  </div>
256
+ <a href="<?php echo esc_url( get_imagify_admin_url( 'dismiss-notice', 'grid-view' ) ); ?>" class="imagify-notice-dismiss notice-dismiss" title="<?php esc_attr_e( 'Dismiss this notice', 'imagify' ); ?>"><span class="screen-reader-text"><?php _e( 'Dismiss this notice', 'imagify' ); ?></span></a>
257
+ </div>
258
  <?php
259
  }
260
 
261
+ add_action( 'all_admin_notices', '_imagify_warning_over_quota_notice' );
262
  /**
263
+ * This warning is displayed to warn the user that its quota is consumed for the current month.
264
  *
265
  * @since 1.1.1
266
  * @author Jonathan Buttigieg
267
  */
 
268
  function _imagify_warning_over_quota_notice() {
269
+ $current_screen = get_current_screen();
270
+
271
+ if ( empty( $current_screen ) || ( 'media_page_imagify-bulk-optimization' !== $current_screen->base && 'settings_page_imagify' !== $current_screen->base && 'settings_page_imagify-network' !== $current_screen->base ) ) {
272
+ return;
273
+ }
274
 
275
+ if ( imagify_notice_is_dismissed( 'free-over-quota' ) || ! current_user_can( imagify_get_capacity() ) ) {
276
  return;
277
  }
278
+
279
  $user = new Imagify_User();
280
+
281
+ // Don't display the notice if the user doesn't use all his quota or the API key isn't valid.
282
  if ( ! $user->is_over_quota() || ! imagify_valid_key() ) {
283
  return;
284
  }
285
+
286
  ?>
287
  <div class="clear"></div>
288
  <div class="error imagify-notice below-h2">
291
  </div>
292
  <div class="imagify-notice-content">
293
  <p class="imagify-notice-title"><strong><?php _e( 'Oops, It\'s Over!', 'imagify' ); ?></strong></p>
294
+ <p><?php
295
+ printf(
296
+ /* translators: 1 is a "bold" tag start, 2 is a formatted data quota, 3 is a date, 4 is the "bold" tag end. */
297
+ __( 'You have consumed all your credit for this month. You will have %1$s%2$s back on %3$s%4$s.', 'imagify' ),
298
+ '<strong>',
299
+ size_format( $user->quota * 1048576 ),
300
+ date_i18n( get_option( 'date_format' ), strtotime( $user->next_date_update ) ),
301
+ '</strong>'
302
+ );
303
+ echo '<br/><br/>';
304
+ printf(
305
+ /* translators: 1 is a link tag start, 2 is the link tag end. */
306
+ __( 'To continue to optimize your images, log in to your Imagify account to %1$sbuy a pack or subscribe to a plan%2$s.', 'imagify' ),
307
+ '<a href="' . IMAGIFY_APP_MAIN . '/#/subscription">',
308
+ '</a>'
309
+ );
310
+ ?></p>
311
  </div>
312
  <a href="<?php echo get_imagify_admin_url( 'dismiss-notice', 'free-over-quota' ); ?>" class="imagify-notice-dismiss notice-dismiss" title="<?php esc_attr_e( 'Dismiss this notice', 'imagify' ); ?>"><span class="screen-reader-text"><?php _e( 'Dismiss this notice', 'imagify' ); ?></span></a>
313
+ </div>
314
  <?php
315
  }
316
 
317
+ add_action( 'admin_notices', '_imagify_rocket_notice' );
318
  /**
319
  * Add a message about WP Rocket on the "Bulk Optimization" screen.
320
  *
321
  * @since 2.7
322
  * @author Jonathan Buttigieg
323
  */
 
324
  function _imagify_rocket_notice() {
325
+ $current_screen = get_current_screen();
326
+
327
+ if ( empty( $current_screen ) || 'media_page_imagify-bulk-optimization' !== $current_screen->base ) {
 
328
  return;
329
  }
330
 
331
+ if ( defined( 'WP_ROCKET_VERSION' ) || imagify_notice_is_dismissed( 'wp-rocket' ) || ! current_user_can( imagify_get_capacity( true ) ) ) {
332
+ return;
333
+ }
334
 
335
+ $dismiss_url = get_imagify_admin_url( 'dismiss-notice', 'wp-rocket' );
336
+ $coupon_code = 'IMAGIFY20';
337
  $wprocket_url = 'http://wp-rocket.me/';
338
+
339
+ switch ( get_locale() ) {
340
  case 'fr_FR' :
341
  $wprocket_url = 'http://wp-rocket.me/fr/';
342
  break;
350
  $wprocket_url = 'http://wp-rocket.me/de/';
351
  break;
352
  }
353
+
354
+ $wprocket_url .= '?utm_source=imagify-coupon&utm_medium=plugin&utm_campaign=imagify';
355
  ?>
356
 
357
  <div class="updated imagify-rkt-notice">
358
  <a href="<?php echo $dismiss_url; ?>" class="imagify-cross"><span class="dashicons dashicons-no"></span></a>
359
+
360
  <p class="imagify-rkt-logo">
361
  <img src="<?php echo IMAGIFY_ASSETS_IMG_URL ?>logo-wprocket.png" srcset="<?php echo IMAGIFY_ASSETS_IMG_URL ?>logo-wprocket2x.png 2x" alt="WP Rocket" width="118" height="32">
362
  </p>
363
  <p class="imagify-rkt-msg">
364
  <?php
365
+ esc_html_e( 'Discover the best caching plugin to speed up your website.', 'imagify' );
366
+ echo '<br>';
367
+ printf(
368
+ /* translators: 1 is a "bold" tag start, 2 is a pourcentage, 3 is the "bold" tag end, 4 is a coupon code. */
369
+ esc_html__( '%1$sGet %2$s off%3$s with this coupon code: %4$s', 'imagify' ),
370
+ '<strong>', '20%', '</strong>', $coupon_code
371
+ );
372
  ?>
373
  </p>
374
  <p class="imagify-rkt-coupon">
382
  <?php
383
  }
384
 
385
+ add_action( 'all_admin_notices', '_imagify_rating_notice' );
386
  /**
387
+ * This notice is displayed to rate the plugin after 100 optimization & 7 days after the first installation.
388
  *
389
  * @since 1.4.2
390
  * @author Jonathan Buttigieg
391
  */
 
392
  function _imagify_rating_notice() {
393
+ $current_screen = get_current_screen();
394
+
395
+ if ( empty( $current_screen ) || ( 'media_page_imagify-bulk-optimization' !== $current_screen->base && 'upload' !== $current_screen->base && 'media' !== $current_screen->base ) ) {
396
  return;
397
  }
 
 
 
398
 
399
+ if ( imagify_notice_is_dismissed( 'rating' ) || ! current_user_can( imagify_get_capacity( true ) ) ) {
400
+ return;
401
+ }
402
+
403
+ $user_images_count = (int) get_site_transient( 'imagify_user_images_count' );
404
+
405
+ if ( ! $user_images_count || get_site_transient( 'imagify_seen_rating_notice' ) ) {
406
  return;
407
  }
408
  ?>
412
  <img class="imagify-logo" src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>imagify-logo.png" width="138" height="16" alt="Imagify" />
413
  </div>
414
  <div class="imagify-notice-content">
415
+ <p><?php
416
+ printf(
417
+ /* translators: 1 is a "bold" tag start, 2 is the "bold" tag end, 3 is a formatted number (don't use %3$d). */
418
+ __( '%1$sCongratulations%2$s, you have optimized %1$s%3$s images%2$s and improved your website\'s speed by reducing your images size.', 'imagify' ),
419
+ '<strong>',
420
+ '</strong>',
421
+ number_format_i18n( $user_images_count )
422
+ );
423
+ ?></p>
424
  <p class="imagify-rate-us">
425
+ <?php
426
+ $imagify_rate_url = 'https://wordpress.org/support/view/plugin-reviews/imagify?rate=5#postform';
427
+
428
+ printf(
429
+ /* translators: 1 is a "bold" tag start, 2 is the "bold" tag end + a line break tag, 3 is a link tag start, 4 is the link tag end. */
430
+ __( '%1$sDo you like this plugin?%2$s Please take a few seconds to %3$srate it on WordPress.org%4$s!', 'imagify' ),
431
+ '<strong>',
432
+ '</strong><br />',
433
+ '<a href="' . $imagify_rate_url . '">',
434
+ '</a>'
435
+ );
436
+ ?>
437
  <br>
438
  <a class="stars" href="<?php echo $imagify_rate_url; ?>">☆☆☆☆☆</a>
439
  </p>
440
  </div>
441
+ <a href="<?php echo esc_url( get_imagify_admin_url( 'dismiss-notice', 'rating' ) ); ?>" class="imagify-notice-dismiss notice-dismiss" title="<?php esc_attr_e( 'Dismiss this notice', 'imagify' ); ?>"><span class="screen-reader-text"><?php _e( 'Dismiss this notice', 'imagify' ); ?></span></a>
442
  </div>
443
  <?php
444
  }
445
 
446
  add_action( 'imagify_dismiss_notice', '_imagify_clear_scheduled_rating' );
447
+ /**
448
+ * Stop the rating cron when the notice is dismissed.
449
+ *
450
+ * @param string $notice The notice name.
451
+ */
452
  function _imagify_clear_scheduled_rating( $notice ) {
453
  if ( 'rating' === $notice ) {
454
  set_site_transient( 'do_imagify_rating_cron', 'no' );
455
  wp_clear_scheduled_hook( 'imagify_rating_event' );
456
  }
457
+ }
inc/admin/ui/options.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  /**
5
  * The main settings page construtor using the required functions from WP
@@ -9,13 +9,14 @@ defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
9
  function _imagify_display_options_page() {
10
  global $_wp_additional_image_sizes, $wp_version;
11
 
12
- if ( isset( $_POST['submit-goto-bulk'] ) ) {
13
  wp_safe_redirect( get_admin_url( get_current_blog_id(), 'upload.php?page=imagify-bulk-optimization' ) );
14
  }
15
  ?>
16
  <div class="wrap imagify-settings">
17
- <?php
18
- if ( ! defined( 'WP_ROCKET_VERSION' ) ) { ?>
 
19
  <div class="imagify-col imagify-sidebar">
20
  <div class="imagify-sidebar-section">
21
  <span class="imagify-sidebar-title">
@@ -31,9 +32,18 @@ function _imagify_display_options_page() {
31
  <p class="imagify-big-text">
32
  <?php
33
  $discount_percent = '20%';
34
- $discount_code = 'IMAGIFY20';
35
-
36
- printf( __( '%sGet %s off%s with this coupon code:%s', 'imagify' ), '<span class="imagify-mark-styled"><span>', '<strong>' . $discount_percent, '</strong></span></span>', '<span class="imagify-discount-code">' . $discount_code . '</span>' );
 
 
 
 
 
 
 
 
 
37
  ?>
38
  </p>
39
 
@@ -45,18 +55,24 @@ function _imagify_display_options_page() {
45
  </ul>
46
  </div>
47
  </div>
48
- <?php
49
- }
50
- ?>
51
 
52
  <div class="imagify-col imagify-main">
53
- <?php $heading_tag = version_compare( $GLOBALS['wp_version'], '4.3' ) >= 0 ? 'h1' : 'h2'; ?>
54
  <div class="imagify-title">
55
  <img width="225" height="26" alt="Imagify" src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>imagify-logo.png" class="imagify-logo" /> <small><sup><?php echo IMAGIFY_VERSION; ?></sup></small>
56
 
57
- <?php $imagify_rate_url = 'https://wordpress.org/support/view/plugin-reviews/imagify?rate=5#postform'; ?>
58
  <p class="imagify-rate-us">
59
- <?php printf( __( '%sDo you like this plugin?%s Please take a few seconds to %srate it on WordPress.org%s!', 'imagify' ), '<strong>', '</strong><br />', '<a href="' . $imagify_rate_url . '">', '</a>' ); ?>
 
 
 
 
 
 
 
60
  <br>
61
  <a class="stars" href="<?php echo $imagify_rate_url; ?>"><?php echo str_repeat( '<span class="dashicons dashicons-star-filled"></span>', 5 ); ?></a>
62
  </p>
@@ -75,43 +91,51 @@ function _imagify_display_options_page() {
75
 
76
  <?php echo get_imagify_new_to_imagify(); ?>
77
 
78
- <?php
79
- if ( ! defined( 'IMAGIFY_API_KEY' ) || ! IMAGIFY_API_KEY ) { ?>
80
- <div class="imagify-sub-header">
81
- <table class="form-table">
82
- <tbody>
83
- <tr>
84
- <th scope="row"><label for="api_key"><?php _e( 'API Key', 'imagify' ); ?></label></th>
85
- <td>
86
- <input type="text" size="35" value="<?php echo esc_attr( get_imagify_option( 'api_key' ) ); ?>" name="<?php echo IMAGIFY_SETTINGS_SLUG; ?>[api_key]" id="api_key">
87
- <?php
88
- if ( imagify_valid_key() ) {
89
- ?>
90
- <span id="imagify-check-api-container" class="imagify-valid">
91
- <span class="dashicons dashicons-yes"></span> <?php _e( 'Your API key is valid.', 'imagify' ); ?>
92
- </span>
93
- <?php
94
- } elseif ( ! imagify_valid_key() && get_imagify_option( 'api_key', false ) ) { ?>
95
 
96
- <span id="imagify-check-api-container">
97
- <span class="dashicons dashicons-no"></span> <?php _e( 'Your API key isn\'t valid!', 'imagify' ); ?>
98
- </span>
 
 
 
 
 
 
 
99
 
100
- <?php
101
- }
 
102
 
103
- if ( ! get_imagify_option( 'api_key', false ) ) {
104
- echo '<p class="description desc api_key">' . sprintf( __( 'Don\'t have an API Key yet? %sCreate one, it\'s FREE%s.', 'imagify' ), '<a id="imagify-signup" href="' . IMAGIFY_APP_MAIN . '/#/register">', '</a>' ) . '</p>';
105
- }
106
- ?>
107
- </td>
108
- </tr>
109
- </tbody>
110
- </table>
111
- </div>
112
- <?php
113
- }
114
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
116
  <div class="imagify-settings-section <?php echo ( ! imagify_valid_key() ) ? 'hidden' : ''; ?>">
117
 
@@ -145,7 +169,8 @@ function _imagify_display_options_page() {
145
  <p class="imagify-visual-comparison-text">
146
  <?php
147
  printf(
148
- __( 'Need help to choose? %sTry the Visual Comparison%s', 'imagify' ),
 
149
  '<button type="button" class="button button-primary button-mini-flat imagify-visual-comparison-btn imagify-modal-trigger" data-target="#imagify-visual-comparison">',
150
  '</button>'
151
  );
@@ -186,21 +211,23 @@ function _imagify_display_options_page() {
186
 
187
  <p id="describe-resize-larger" class="imagify-options-line">
188
  <?php
189
- $max_sizes = get_imagify_max_intermediate_image_size();
190
- printf(
191
- __( 'to maximum %s pixels width', 'imagify' ),
192
- '<input type="number" min="' . $max_sizes['width'] . '" name="' . IMAGIFY_SETTINGS_SLUG . '[resize_larger_w]" value="' . get_imagify_option( 'resize_larger_w', false ). '" size="5">'
193
- );
 
194
  ?>
195
  </p>
196
 
197
  <p class="imagify-checkbox-marged">
198
  <span class="imagify-info">
199
  <span class="dashicons dashicons-info"></span>
200
-
201
- <?php
202
- printf( __( 'This option is recommended to reduce larger images. You can save up to 80%% after resizing. The new width should not be less than your largest thumbnail width, which is actually %spx.', 'imagify' ), $max_sizes['width'] );
203
- ?>
 
204
  </span>
205
  </p>
206
  </td>
@@ -217,49 +244,51 @@ function _imagify_display_options_page() {
217
  <a href="https://en.wikipedia.org/wiki/Exchangeable_image_file_format" target="_blank"><?php _e( 'Learn more', 'imagify' ); ?></a>
218
  <br/><br/>
219
  <?php _e( 'If you are a photographer, you may be interested in this option if you are displaying on your pages some info like the model of your camera.', 'imagify' ); ?>
220
-
221
  </span>
222
  </td>
223
  </tr>
224
- <?php
225
- if ( ! imagify_is_active_for_network() ) { ?>
226
 
227
- <tr>
228
- <th scope="row"><?php _e( 'Files optimization', 'imagify' ); ?></th>
229
- <td>
230
- <p>
231
- <?php _e( 'You can choose to compress different image sizes created by WordPress here.', 'imagify' ); ?>
232
- <br/>
233
- <?php printf( __( 'The %soriginal size%s is %sautomatically optimized%s by Imagify.', 'imagify' ), '<strong>', '</strong>', '<strong>', '</strong>' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
234
  <br>
235
- <span class="imagify-important">
236
- <?php _e( 'Remember each additional image size will affect your Imagify monthly usage!', 'imagify' ); ?>
237
- </span>
238
- </p>
239
 
240
- <br>
 
241
 
242
- <?php
243
- $sizes = get_imagify_thumbnail_sizes();
244
-
245
- foreach( $sizes as $size_key => $size_data ) {
246
- $label = esc_html( stripslashes( $size_data['name'] ) );
247
- $label = sprintf( '%s - %d &times; %d', $label, $size_data['width'], $size_data['height'] );
 
 
 
 
248
  ?>
249
- <input type="hidden" name="<?php echo IMAGIFY_SETTINGS_SLUG; ?>[sizes][<?php echo $size_key; ?>-hidden]" value="1" />
250
- <input type="checkbox" id="imagify_sizes_<?php echo $size_key; ?>" class="mini" name="<?php echo IMAGIFY_SETTINGS_SLUG; ?>[sizes][<?php echo $size_key; ?>]" value="1" <?php echo ( ! array_key_exists( $size_key, get_imagify_option( 'disallowed-sizes', array() ) ) ) ? 'checked="checked"' : '' ?> />
251
- <label for="imagify_sizes_<?php echo $size_key; ?>" onclick=""><?php echo $label; ?></label>
252
- <br class="imagify-br">
253
 
254
- <?php
255
- }
256
- ?>
257
- </td>
258
- </tr>
259
 
260
- <?php
261
- }
262
- ?>
263
  </tbody>
264
  </table>
265
 
@@ -288,21 +317,28 @@ function _imagify_display_options_page() {
288
  </div>
289
  <div class="submit">
290
  <?php
291
- // classical submit
292
- submit_button();
293
-
294
- // submit and go to bulk page
295
- submit_button(
296
- esc_html__( 'Save &amp; Go to Bulk Optimizer', 'imagify' ),
297
- 'secondary imagify-button-secondary', // type/classes
298
- 'submit-goto-bulk', // name (id)
299
- true, // wrap
300
- array() //other attributes
301
- );
302
  ?>
303
 
304
  <div class="imagify-bulk-info">
305
- <p><?php printf( __( 'Once your settings saved, optimize all your images by using the %sImagify Bulk Optimization%s feature.', 'imagify' ), '<a href="' . get_admin_url() . 'upload.php?page=' . IMAGIFY_SLUG . '-bulk-optimization">', '</a>' ); ?></p>
 
 
 
 
 
 
 
306
  </div>
307
  </div>
308
  </form>
@@ -310,7 +346,7 @@ function _imagify_display_options_page() {
310
 
311
  <div id="imagify-more-info" class="imagify-modal">
312
  <div class="imagify-modal-content">
313
- <p class="h2"><?php _e('You can choose three levels of compression', 'imagify'); ?></p>
314
  <div class="imagify-columns">
315
  <div class="col-1-3">
316
  <p class="h3"><?php _e( 'Normal', 'imagify' ); ?></p>
@@ -324,7 +360,7 @@ function _imagify_display_options_page() {
324
  <em><?php _e( 'Note: the file size reduction will be less, compared to aggressive mode.', 'imagify' ); ?></em>
325
  </p>
326
  </div>
327
-
328
  <div class="col-1-3">
329
  <p class="h3"><?php _e( 'Aggressive', 'imagify' ); ?></p>
330
  <p>
@@ -365,40 +401,53 @@ function _imagify_display_options_page() {
365
 
366
  <p class="imagify-comparison-title">
367
  <?php
368
- printf (
369
- __( 'I want to compare%s and%s', 'imagify'),
370
- '<span class="twentytwenty-left-buttons"></span>',
371
- '<span class="twentytwenty-right-buttons"></span>'
372
- );
 
373
  ?>
374
  </p>
375
 
376
  <div class="twentytwenty-container"
377
- data-loader="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>loader-balls.svg"
378
- data-label-original="<?php esc_attr_e( 'Original', 'imagify' ); ?>"
379
- data-label-normal="<?php esc_attr_e( 'Normal', 'imagify' ); ?>"
380
- data-label-aggressive="<?php esc_attr_e( 'Aggressive', 'imagify' ); ?>"
381
- data-label-ultra="<?php esc_attr_e( 'Ultra', 'imagify' ); ?>"
382
-
383
- data-original-label="<?php esc_attr_e( 'Original', 'imagify' ); ?>"
384
- data-original-img="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>mushrooms-original.jpg"
385
- data-original-dim="1220x350"
386
- data-original-alt="<?php printf( esc_attr__( 'Original photography about %s', 'imagify' ), size_format(343040)); ?>"
387
-
388
- data-normal-label="<?php esc_attr_e( 'Normal', 'imagify' ); ?>"
389
- data-normal-img="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>mushrooms-normal.jpg"
390
- data-normal-dim="1220x350"
391
- data-normal-alt="<?php printf( esc_attr__( 'Optimized photography about %s', 'imagify' ), size_format(301056) ); ?>"
392
-
393
- data-aggressive-label="<?php esc_attr_e( 'Aggressive', 'imagify' ); ?>"
394
- data-aggressive-img="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>mushrooms-aggressive.jpg"
395
- data-aggressive-dim="1220x350"
396
- data-aggressive-alt="<?php printf( esc_attr__( 'Optimized photography about %s', 'imagify' ), size_format(108544) ); ?>"
397
-
398
- data-ultra-label="<?php esc_attr_e( 'Ultra', 'imagify' ); ?>"
399
- data-ultra-img="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>mushrooms-ultra.jpg"
400
- data-ultra-dim="1220x350"
401
- data-ultra-alt="<?php printf( esc_attr__( 'Optimized photography about %s', 'imagify' ), size_format(46080) ); ?>"></div>
 
 
 
 
 
 
 
 
 
 
 
 
402
 
403
  <div class="imagify-comparison-levels">
404
  <div class="imagify-c-level imagify-level-original go-left">
@@ -408,7 +457,7 @@ function _imagify_display_options_page() {
408
  </p>
409
  <p class="imagify-c-level-row">
410
  <span class="label"><?php _e( 'File Size:', 'imagify' ); ?></span>
411
- <span class="value"><?php echo size_format(343040); ?></span>
412
  </p>
413
  </div>
414
  <div class="imagify-c-level imagify-level-optimized imagify-level-normal" aria-hidden="true">
@@ -418,7 +467,7 @@ function _imagify_display_options_page() {
418
  </p>
419
  <p class="imagify-c-level-row">
420
  <span class="label"><?php _e( 'File Size:', 'imagify' ); ?></span>
421
- <span class="value size"><?php echo size_format(301056); ?></span>
422
  </p>
423
  <p class="imagify-c-level-row">
424
  <span class="label"><?php _e( 'Original Saving:', 'imagify' ); ?></span>
@@ -438,7 +487,7 @@ function _imagify_display_options_page() {
438
  </p>
439
  <p class="imagify-c-level-row">
440
  <span class="label"><?php _e( 'File Size:', 'imagify' ); ?></span>
441
- <span class="value size"><?php echo size_format(108544); ?></span>
442
  </p>
443
  <p class="imagify-c-level-row">
444
  <span class="label"><?php _e( 'Original Saving:', 'imagify' ); ?></span>
@@ -459,7 +508,7 @@ function _imagify_display_options_page() {
459
  </p>
460
  <p class="imagify-c-level-row">
461
  <span class="label"><?php _e( 'File Size:', 'imagify' ); ?></span>
462
- <span class="value size"><?php echo size_format(46080); ?></span>
463
  </p>
464
  <p class="imagify-c-level-row">
465
  <span class="label"><?php _e( 'Original Saving:', 'imagify' ); ?></span>
@@ -485,4 +534,4 @@ function _imagify_display_options_page() {
485
 
486
  </div>
487
  <?php
488
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  /**
5
  * The main settings page construtor using the required functions from WP
9
  function _imagify_display_options_page() {
10
  global $_wp_additional_image_sizes, $wp_version;
11
 
12
+ if ( isset( $_POST['submit-goto-bulk'] ) ) { // WPCS: CSRF ok.
13
  wp_safe_redirect( get_admin_url( get_current_blog_id(), 'upload.php?page=imagify-bulk-optimization' ) );
14
  }
15
  ?>
16
  <div class="wrap imagify-settings">
17
+
18
+ <?php if ( ! defined( 'WP_ROCKET_VERSION' ) ) { ?>
19
+
20
  <div class="imagify-col imagify-sidebar">
21
  <div class="imagify-sidebar-section">
22
  <span class="imagify-sidebar-title">
32
  <p class="imagify-big-text">
33
  <?php
34
  $discount_percent = '20%';
35
+ $discount_code = 'IMAGIFY20';
36
+
37
+ printf(
38
+ /* translators: 1 is the start of a styled wrapper, 2 is a "bold" tag start, 3 is a percentage, 4 is the "bold" tag end, 5 is the styled wrapper end, 6 is a discount code. */
39
+ __( '%1$sGet %2$s%3$s off%4$s%5$s with this coupon code: %6$s', 'imagify' ),
40
+ '<span class="imagify-mark-styled"><span>',
41
+ '<strong>',
42
+ $discount_percent,
43
+ '</strong>',
44
+ '</span></span>',
45
+ '<span class="imagify-discount-code">' . $discount_code . '</span>'
46
+ );
47
  ?>
48
  </p>
49
 
55
  </ul>
56
  </div>
57
  </div>
58
+
59
+ <?php } // End if(). ?>
 
60
 
61
  <div class="imagify-col imagify-main">
62
+ <?php $heading_tag = version_compare( $wp_version, '4.3' ) >= 0 ? 'h1' : 'h2'; ?>
63
  <div class="imagify-title">
64
  <img width="225" height="26" alt="Imagify" src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>imagify-logo.png" class="imagify-logo" /> <small><sup><?php echo IMAGIFY_VERSION; ?></sup></small>
65
 
66
+ <?php $imagify_rate_url = 'https://wordpress.org/support/view/plugin-reviews/imagify?rate=5#postform'; ?>
67
  <p class="imagify-rate-us">
68
+ <?php printf(
69
+ /* translators: 1 is a "bold" tag start, 2 is the "bold" tag end + a line break tag, 3 is a link tag start, 4 is the link tag end. */
70
+ __( '%1$sDo you like this plugin?%2$s Please take a few seconds to %3$srate it on WordPress.org%4$s!', 'imagify' ),
71
+ '<strong>',
72
+ '</strong><br />',
73
+ '<a href="' . $imagify_rate_url . '">',
74
+ '</a>'
75
+ ); ?>
76
  <br>
77
  <a class="stars" href="<?php echo $imagify_rate_url; ?>"><?php echo str_repeat( '<span class="dashicons dashicons-star-filled"></span>', 5 ); ?></a>
78
  </p>
91
 
92
  <?php echo get_imagify_new_to_imagify(); ?>
93
 
94
+ <?php if ( ! defined( 'IMAGIFY_API_KEY' ) || ! IMAGIFY_API_KEY ) { ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
 
96
+ <div class="imagify-sub-header">
97
+ <table class="form-table">
98
+ <tbody>
99
+ <tr>
100
+ <th scope="row"><label for="api_key"><?php _e( 'API Key', 'imagify' ); ?></label></th>
101
+ <td>
102
+ <input type="text" size="35" value="<?php echo esc_attr( get_imagify_option( 'api_key' ) ); ?>" name="<?php echo IMAGIFY_SETTINGS_SLUG; ?>[api_key]" id="api_key">
103
+ <?php
104
+ if ( imagify_valid_key() ) {
105
+ ?>
106
 
107
+ <span id="imagify-check-api-container" class="imagify-valid">
108
+ <span class="dashicons dashicons-yes"></span> <?php _e( 'Your API key is valid.', 'imagify' ); ?>
109
+ </span>
110
 
111
+ <?php
112
+ } elseif ( ! imagify_valid_key() && get_imagify_option( 'api_key', false ) ) { ?>
113
+
114
+ <span id="imagify-check-api-container">
115
+ <span class="dashicons dashicons-no"></span> <?php _e( 'Your API key isn\'t valid!', 'imagify' ); ?>
116
+ </span>
117
+
118
+ <?php
119
+ }
120
+
121
+ if ( ! get_imagify_option( 'api_key', false ) ) {
122
+ echo '<p class="description desc api_key">';
123
+ printf(
124
+ /* translators: 1 is a link tag start, 2 is the link tag end. */
125
+ __( 'Don\'t have an API Key yet? %1$sCreate one, it\'s FREE%2$s.', 'imagify' ),
126
+ '<a id="imagify-signup" href="' . IMAGIFY_APP_MAIN . '/#/register">',
127
+ '</a>'
128
+ );
129
+ echo '</p>';
130
+ }
131
+ ?>
132
+ </td>
133
+ </tr>
134
+ </tbody>
135
+ </table>
136
+ </div>
137
+
138
+ <?php } // End if(). ?>
139
 
140
  <div class="imagify-settings-section <?php echo ( ! imagify_valid_key() ) ? 'hidden' : ''; ?>">
141
 
169
  <p class="imagify-visual-comparison-text">
170
  <?php
171
  printf(
172
+ /* translators: 1 is a button tag start, 2 is the button tag end. */
173
+ __( 'Need help to choose? %1$sTry the Visual Comparison%2$s', 'imagify' ),
174
  '<button type="button" class="button button-primary button-mini-flat imagify-visual-comparison-btn imagify-modal-trigger" data-target="#imagify-visual-comparison">',
175
  '</button>'
176
  );
211
 
212
  <p id="describe-resize-larger" class="imagify-options-line">
213
  <?php
214
+ $max_sizes = get_imagify_max_intermediate_image_size();
215
+ printf(
216
+ /* translators: 1 is a text input for a number of pixels (don't use %d). */
217
+ __( 'to maximum %s pixels width', 'imagify' ),
218
+ '<input type="number" min="' . $max_sizes['width'] . '" name="' . IMAGIFY_SETTINGS_SLUG . '[resize_larger_w]" value="' . get_imagify_option( 'resize_larger_w', false ) . '" size="5">'
219
+ );
220
  ?>
221
  </p>
222
 
223
  <p class="imagify-checkbox-marged">
224
  <span class="imagify-info">
225
  <span class="dashicons dashicons-info"></span>
226
+ <?php printf(
227
+ /* translators: 1 is a number of pixels. */
228
+ __( 'This option is recommended to reduce larger images. You can save up to 80%% after resizing. The new width should not be less than your largest thumbnail width, which is actually %dpx.', 'imagify' ),
229
+ $max_sizes['width']
230
+ ); ?>
231
  </span>
232
  </p>
233
  </td>
244
  <a href="https://en.wikipedia.org/wiki/Exchangeable_image_file_format" target="_blank"><?php _e( 'Learn more', 'imagify' ); ?></a>
245
  <br/><br/>
246
  <?php _e( 'If you are a photographer, you may be interested in this option if you are displaying on your pages some info like the model of your camera.', 'imagify' ); ?>
247
+
248
  </span>
249
  </td>
250
  </tr>
 
 
251
 
252
+ <?php if ( ! imagify_is_active_for_network() ) { ?>
253
+
254
+ <tr>
255
+ <th scope="row"><?php _e( 'Files optimization', 'imagify' ); ?></th>
256
+ <td>
257
+ <p>
258
+ <?php _e( 'You can choose to compress different image sizes created by WordPress here.', 'imagify' ); ?>
259
+ <br/>
260
+ <?php printf(
261
+ /* translators: 1 is a "bold" tag start, 2 is the "bold" tag end. */
262
+ __( 'The %1$soriginal size%2$s is %1$sautomatically optimized%2$s by Imagify.', 'imagify' ),
263
+ '<strong>', '</strong>'
264
+ ); ?>
265
+ <br>
266
+ <span class="imagify-important">
267
+ <?php _e( 'Remember each additional image size will affect your Imagify monthly usage!', 'imagify' ); ?>
268
+ </span>
269
+ </p>
270
+
271
  <br>
 
 
 
 
272
 
273
+ <?php
274
+ $sizes = get_imagify_thumbnail_sizes();
275
 
276
+ foreach ( $sizes as $size_key => $size_data ) {
277
+ $label = esc_html( stripslashes( $size_data['name'] ) );
278
+ $label = sprintf( '%s - %d &times; %d', $label, $size_data['width'], $size_data['height'] );
279
+ ?>
280
+ <input type="hidden" name="<?php echo IMAGIFY_SETTINGS_SLUG; ?>[sizes][<?php echo $size_key; ?>-hidden]" value="1" />
281
+ <input type="checkbox" id="imagify_sizes_<?php echo $size_key; ?>" class="mini" name="<?php echo IMAGIFY_SETTINGS_SLUG; ?>[sizes][<?php echo $size_key; ?>]" value="1" <?php echo ( ! array_key_exists( $size_key, get_imagify_option( 'disallowed-sizes', array() ) ) ) ? 'checked="checked"' : '' ?> />
282
+ <label for="imagify_sizes_<?php echo $size_key; ?>" onclick=""><?php echo $label; ?></label>
283
+ <br class="imagify-br">
284
+ <?php
285
+ }
286
  ?>
287
+ </td>
288
+ </tr>
 
 
289
 
290
+ <?php } // End if(). ?>
 
 
 
 
291
 
 
 
 
292
  </tbody>
293
  </table>
294
 
317
  </div>
318
  <div class="submit">
319
  <?php
320
+ // Classical submit.
321
+ submit_button();
322
+
323
+ // Submit and go to bulk page.
324
+ submit_button(
325
+ esc_html__( 'Save &amp; Go to Bulk Optimizer', 'imagify' ),
326
+ 'secondary imagify-button-secondary', // Type/classes.
327
+ 'submit-goto-bulk', // Name (id).
328
+ true, // Wrap.
329
+ array() // Other attributes.
330
+ );
331
  ?>
332
 
333
  <div class="imagify-bulk-info">
334
+ <p><?php
335
+ printf(
336
+ /* translators: 1 is a link tag start, 2 is the link tag end. */
337
+ __( 'Once your settings saved, optimize all your images by using the %1$sImagify Bulk Optimization%2$s feature.', 'imagify' ),
338
+ '<a href="' . esc_url( get_admin_url() ) . 'upload.php?page=' . IMAGIFY_SLUG . '-bulk-optimization">',
339
+ '</a>'
340
+ );
341
+ ?></p>
342
  </div>
343
  </div>
344
  </form>
346
 
347
  <div id="imagify-more-info" class="imagify-modal">
348
  <div class="imagify-modal-content">
349
+ <p class="h2"><?php _e( 'You can choose three levels of compression', 'imagify' ); ?></p>
350
  <div class="imagify-columns">
351
  <div class="col-1-3">
352
  <p class="h3"><?php _e( 'Normal', 'imagify' ); ?></p>
360
  <em><?php _e( 'Note: the file size reduction will be less, compared to aggressive mode.', 'imagify' ); ?></em>
361
  </p>
362
  </div>
363
+
364
  <div class="col-1-3">
365
  <p class="h3"><?php _e( 'Aggressive', 'imagify' ); ?></p>
366
  <p>
401
 
402
  <p class="imagify-comparison-title">
403
  <?php
404
+ printf(
405
+ /* translators: 1 and 2 are optimization levels: "Original", "Normal", "Aggressive", or "Ultra". */
406
+ __( 'I want to compare %1$s and %2$s', 'imagify' ),
407
+ '<span class="twentytwenty-left-buttons"></span>',
408
+ '<span class="twentytwenty-right-buttons"></span>'
409
+ );
410
  ?>
411
  </p>
412
 
413
  <div class="twentytwenty-container"
414
+ data-loader="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>loader-balls.svg"
415
+ data-label-original="<?php esc_attr_e( 'Original', 'imagify' ); ?>"
416
+ data-label-normal="<?php esc_attr_e( 'Normal', 'imagify' ); ?>"
417
+ data-label-aggressive="<?php esc_attr_e( 'Aggressive', 'imagify' ); ?>"
418
+ data-label-ultra="<?php esc_attr_e( 'Ultra', 'imagify' ); ?>"
419
+
420
+ data-original-label="<?php esc_attr_e( 'Original', 'imagify' ); ?>"
421
+ data-original-img="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>mushrooms-original.jpg"
422
+ data-original-dim="1220x350"
423
+ data-original-alt="<?php
424
+ /* translators: %s is a formatted file size. */
425
+ printf( esc_attr__( 'Original photography about %s', 'imagify' ), size_format( 343040 ) );
426
+ ?>"
427
+
428
+ data-normal-label="<?php esc_attr_e( 'Normal', 'imagify' ); ?>"
429
+ data-normal-img="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>mushrooms-normal.jpg"
430
+ data-normal-dim="1220x350"
431
+ data-normal-alt="<?php
432
+ /* translators: %s is a formatted file size. */
433
+ printf( esc_attr__( 'Optimized photography about %s', 'imagify' ), size_format( 301056 ) );
434
+ ?>"
435
+
436
+ data-aggressive-label="<?php esc_attr_e( 'Aggressive', 'imagify' ); ?>"
437
+ data-aggressive-img="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>mushrooms-aggressive.jpg"
438
+ data-aggressive-dim="1220x350"
439
+ data-aggressive-alt="<?php
440
+ /* translators: %s is a formatted file size. */
441
+ printf( esc_attr__( 'Optimized photography about %s', 'imagify' ), size_format( 108544 ) );
442
+ ?>"
443
+
444
+ data-ultra-label="<?php esc_attr_e( 'Ultra', 'imagify' ); ?>"
445
+ data-ultra-img="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>mushrooms-ultra.jpg"
446
+ data-ultra-dim="1220x350"
447
+ data-ultra-alt="<?php
448
+ /* translators: %s is a formatted file size. */
449
+ printf( esc_attr__( 'Optimized photography about %s', 'imagify' ), size_format( 46080 ) );
450
+ ?>"></div>
451
 
452
  <div class="imagify-comparison-levels">
453
  <div class="imagify-c-level imagify-level-original go-left">
457
  </p>
458
  <p class="imagify-c-level-row">
459
  <span class="label"><?php _e( 'File Size:', 'imagify' ); ?></span>
460
+ <span class="value"><?php echo size_format( 343040 ); ?></span>
461
  </p>
462
  </div>
463
  <div class="imagify-c-level imagify-level-optimized imagify-level-normal" aria-hidden="true">
467
  </p>
468
  <p class="imagify-c-level-row">
469
  <span class="label"><?php _e( 'File Size:', 'imagify' ); ?></span>
470
+ <span class="value size"><?php echo size_format( 301056 ); ?></span>
471
  </p>
472
  <p class="imagify-c-level-row">
473
  <span class="label"><?php _e( 'Original Saving:', 'imagify' ); ?></span>
487
  </p>
488
  <p class="imagify-c-level-row">
489
  <span class="label"><?php _e( 'File Size:', 'imagify' ); ?></span>
490
+ <span class="value size"><?php echo size_format( 108544 ); ?></span>
491
  </p>
492
  <p class="imagify-c-level-row">
493
  <span class="label"><?php _e( 'Original Saving:', 'imagify' ); ?></span>
508
  </p>
509
  <p class="imagify-c-level-row">
510
  <span class="label"><?php _e( 'File Size:', 'imagify' ); ?></span>
511
+ <span class="value size"><?php echo size_format( 46080 ); ?></span>
512
  </p>
513
  <p class="imagify-c-level-row">
514
  <span class="label"><?php _e( 'Original Saving:', 'imagify' ); ?></span>
534
 
535
  </div>
536
  <?php
537
+ }
inc/admin/upgrader.php CHANGED
@@ -1,142 +1,145 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin&#8217; uh?' );
3
 
4
- /*
5
- * Tell WP what to do when admin is loaded aka upgrader
 
6
  *
7
  * @since 1.0
8
  */
9
- add_action( 'admin_init', '_imagify_upgrader' );
10
  function _imagify_upgrader() {
11
  $current_version = get_imagify_option( 'version' );
12
 
13
- // You can hook the upgrader to trigger any action when Imagify is upgraded
14
- // first install
15
  if ( ! $current_version ) {
16
  do_action( 'imagify_first_install' );
17
  }
18
- // already installed but got updated
19
- elseif ( IMAGIFY_VERSION != $current_version ) {
20
  do_action( 'imagify_upgrade', IMAGIFY_VERSION, $current_version );
21
  }
22
 
23
- // If any upgrade has been done, we flush and update version #
24
  if ( did_action( 'imagify_first_install' ) || did_action( 'imagify_upgrade' ) ) {
25
- $options = get_site_option( IMAGIFY_SETTINGS_SLUG ); // do not use get_imagify_option() here
26
  $options['version'] = IMAGIFY_VERSION;
27
 
28
  update_site_option( IMAGIFY_SETTINGS_SLUG, $options );
29
  }
30
  }
31
 
 
32
  /**
33
- * Keeps this function up to date at each version
34
  *
35
  * @since 1.0
36
  */
37
- add_action( 'imagify_first_install', '_imagify_first_install' );
38
- function _imagify_first_install() {
39
  // Set a transient to know when we will have to display a notice to ask the user to rate the plugin.
40
  set_site_transient( 'imagify_seen_rating_notice', true, DAY_IN_SECONDS * 3 );
41
-
42
- // Create Options
43
- add_site_option( IMAGIFY_SETTINGS_SLUG,
44
- array(
45
- 'api_key' => '',
46
- 'optimization_level' => 1,
47
- 'auto_optimize' => 1,
48
- 'backup' => 1,
49
- 'resize_larger' => '',
50
- 'resize_larger_w' => '',
51
- 'exif' => 0,
52
- 'disallowed-sizes' => array(),
53
- 'admin_bar_menu' => 1
54
- )
55
- );
56
  }
57
 
 
58
  /**
59
- * What to do when Imagify is updated, depending on versions
60
  *
61
  * @since 1.0
 
 
 
62
  */
63
- add_action( 'imagify_upgrade', '_imagify_new_upgrade', 10, 2 );
64
- function _imagify_new_upgrade( $imagify_version, $current_version ) {
65
- if ( version_compare( $current_version, '1.2', '<' ) ) {
66
- // Update all already optimized images status from 'error' to 'already_optimized'
67
- $query = new WP_Query(
68
- array(
69
- 'post_type' => 'attachment',
70
- 'post_status' => 'inherit',
71
- 'post_mime_type' => 'image',
72
- 'meta_key' => '_imagify_status',
73
- 'meta_value' => 'error',
74
- 'posts_per_page' => -1,
75
- 'update_post_term_cache' => false,
76
- 'no_found_rows' => true,
77
- 'fields' => 'ids'
78
- )
79
- );
80
-
81
- $ids = (array) $query->posts;
82
-
83
- foreach ( $ids as $id ) {
84
- $attachment = new Imagify_Attachment( $id );
85
- $attachment_error = $attachment->get_optimized_error();
86
- $attachment_error = trim( $attachment_error );
87
- $attachment_status = get_post_meta( $id, '_imagify_status', true );
88
-
89
- if ( false !== strpos( $attachment_error, 'This image is already compressed' ) ) {
90
- update_post_meta( $id, '_imagify_status', 'already_optimized' );
 
91
  }
92
  }
93
-
94
- // Auto-activate the Admin Bar option
95
  $options = get_site_option( IMAGIFY_SETTINGS_SLUG );
96
  $options['admin_bar_menu'] = 1;
97
  update_site_option( IMAGIFY_SETTINGS_SLUG, $options );
98
  }
99
-
100
- if ( version_compare( $current_version, '1.3.2', '<' ) ) {
101
- // Update all already optimized images status from 'error' to 'already_optimized'
102
- $query = new WP_Query(
103
- array(
104
- 'post_type' => 'attachment',
105
- 'post_status' => 'inherit',
106
- 'post_mime_type' => 'image',
107
- 'meta_query' => array(
108
- 'relation' => 'AND',
109
- array(
110
- 'key' => '_imagify_data',
111
- 'compare' => 'EXISTS'
112
- ),
113
- array(
114
- 'key' => '_imagify_optimization_level',
115
- 'compare' => 'NOT EXISTS'
116
- ),
117
  ),
118
- 'posts_per_page' => -1,
119
- 'update_post_term_cache' => false,
120
- 'no_found_rows' => true,
121
- 'fields' => 'ids'
122
- )
123
- );
124
-
125
- $ids = (array) $query->posts;
126
-
127
- foreach ( $ids as $id ) {
128
- $attachment = new Imagify_Attachment( $id );
129
- $attachment_stats = $attachment->get_stats_data();
130
-
131
- if ( isset( $attachment_stats['aggressive'] ) ) {
132
- update_post_meta( $id, '_imagify_optimization_level', (int) $attachment_stats['aggressive'] );
133
- }
 
134
  }
135
  }
136
-
137
- if ( version_compare( $current_version, '1.4.5', '<' ) ) {
138
- // Delete all transients used for async optimization
139
- global $wpdb;
140
  $wpdb->query( 'DELETE from ' . $wpdb->options . ' WHERE option_name LIKE "_transient_imagify-async-in-progress-%"' );
141
  }
142
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin&#8217; uh?' );
3
 
4
+ add_action( 'admin_init', '_imagify_upgrader' );
5
+ /**
6
+ * Tell WP what to do when admin is loaded aka upgrader.
7
  *
8
  * @since 1.0
9
  */
 
10
  function _imagify_upgrader() {
11
  $current_version = get_imagify_option( 'version' );
12
 
13
+ // You can hook the upgrader to trigger any action when Imagify is upgraded.
14
+ // First install.
15
  if ( ! $current_version ) {
16
  do_action( 'imagify_first_install' );
17
  }
18
+ // Already installed but got updated.
19
+ elseif ( IMAGIFY_VERSION !== $current_version ) {
20
  do_action( 'imagify_upgrade', IMAGIFY_VERSION, $current_version );
21
  }
22
 
23
+ // If any upgrade has been done, we flush and update version.
24
  if ( did_action( 'imagify_first_install' ) || did_action( 'imagify_upgrade' ) ) {
25
+ $options = get_site_option( IMAGIFY_SETTINGS_SLUG ); // Do not use get_imagify_option() here.
26
  $options['version'] = IMAGIFY_VERSION;
27
 
28
  update_site_option( IMAGIFY_SETTINGS_SLUG, $options );
29
  }
30
  }
31
 
32
+ add_action( 'imagify_first_install', '_imagify_first_install' );
33
  /**
34
+ * Keeps this function up to date at each version.
35
  *
36
  * @since 1.0
37
  */
38
+ function _imagify_first_install() {
 
39
  // Set a transient to know when we will have to display a notice to ask the user to rate the plugin.
40
  set_site_transient( 'imagify_seen_rating_notice', true, DAY_IN_SECONDS * 3 );
41
+
42
+ // Create Options.
43
+ add_site_option( IMAGIFY_SETTINGS_SLUG, array(
44
+ 'api_key' => '',
45
+ 'optimization_level' => 1,
46
+ 'auto_optimize' => 1,
47
+ 'backup' => 1,
48
+ 'resize_larger' => '',
49
+ 'resize_larger_w' => '',
50
+ 'exif' => 0,
51
+ 'disallowed-sizes' => array(),
52
+ 'admin_bar_menu' => 1,
53
+ ) );
 
 
54
  }
55
 
56
+ add_action( 'imagify_upgrade', '_imagify_new_upgrade', 10, 2 );
57
  /**
58
+ * What to do when Imagify is updated, depending on versions.
59
  *
60
  * @since 1.0
61
+ *
62
+ * @param string $imagify_version New Imagify version.
63
+ * @param string $current_version Old Imagify version.
64
  */
65
+ function _imagify_new_upgrade( $imagify_version, $current_version ) {
66
+ global $wpdb;
67
+
68
+ // 1.2
69
+ if ( version_compare( $current_version, '1.2' ) < 0 ) {
70
+ // Update all already optimized images status from 'error' to 'already_optimized'.
71
+ $query = new WP_Query( array(
72
+ 'post_type' => 'attachment',
73
+ 'post_status' => 'inherit',
74
+ 'post_mime_type' => 'image',
75
+ 'meta_key' => '_imagify_status',
76
+ 'meta_value' => 'error',
77
+ 'posts_per_page' => -1,
78
+ 'update_post_term_cache' => false,
79
+ 'no_found_rows' => true,
80
+ 'fields' => 'ids',
81
+ ) );
82
+
83
+ if ( $query->posts ) {
84
+ foreach ( (array) $query->posts as $id ) {
85
+ $class_name = get_imagify_attachment_class_name( 'wp' );
86
+ $attachment = new $class_name( $id );
87
+ $attachment_error = $attachment->get_optimized_error();
88
+ $attachment_error = trim( $attachment_error );
89
+ $attachment_status = get_post_meta( $id, '_imagify_status', true );
90
+
91
+ if ( false !== strpos( $attachment_error, 'This image is already compressed' ) ) {
92
+ update_post_meta( $id, '_imagify_status', 'already_optimized' );
93
+ }
94
  }
95
  }
96
+
97
+ // Auto-activate the Admin Bar option.
98
  $options = get_site_option( IMAGIFY_SETTINGS_SLUG );
99
  $options['admin_bar_menu'] = 1;
100
  update_site_option( IMAGIFY_SETTINGS_SLUG, $options );
101
  }
102
+
103
+ // 1.3.2
104
+ if ( version_compare( $current_version, '1.3.2' ) < 0 ) {
105
+ // Update all already optimized images status from 'error' to 'already_optimized'.
106
+ $query = new WP_Query( array(
107
+ 'post_type' => 'attachment',
108
+ 'post_status' => 'inherit',
109
+ 'post_mime_type' => 'image',
110
+ 'meta_query' => array(
111
+ 'relation' => 'AND',
112
+ array(
113
+ 'key' => '_imagify_data',
114
+ 'compare' => 'EXISTS',
115
+ ),
116
+ array(
117
+ 'key' => '_imagify_optimization_level',
118
+ 'compare' => 'NOT EXISTS',
 
119
  ),
120
+ ),
121
+ 'posts_per_page' => -1,
122
+ 'update_post_term_cache' => false,
123
+ 'no_found_rows' => true,
124
+ 'fields' => 'ids',
125
+ ) );
126
+
127
+ if ( $query->posts ) {
128
+ foreach ( (array) $query->posts as $id ) {
129
+ $class_name = get_imagify_attachment_class_name( 'wp' );
130
+ $attachment = new $class_name( $id );
131
+ $attachment_stats = $attachment->get_stats_data();
132
+
133
+ if ( isset( $attachment_stats['aggressive'] ) ) {
134
+ update_post_meta( $id, '_imagify_optimization_level', (int) $attachment_stats['aggressive'] );
135
+ }
136
+ }
137
  }
138
  }
139
+
140
+ // 1.4.5
141
+ if ( version_compare( $current_version, '1.4.5' ) < 0 ) {
142
+ // Delete all transients used for async optimization.
143
  $wpdb->query( 'DELETE from ' . $wpdb->options . ' WHERE option_name LIKE "_transient_imagify-async-in-progress-%"' );
144
  }
145
+ }
inc/admin/upload.php CHANGED
@@ -1,33 +1,49 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
- /*
5
- * Add "Imagify" column in upload.php
 
6
  *
7
  * @since 1.0
8
  * @author Jonathan Buttigieg
 
 
 
9
  */
10
- add_filter( 'manage_media_columns', '_imagify_manage_media_columns' );
11
  function _imagify_manage_media_columns( $columns ) {
12
  $columns['imagify_optimized_file'] = __( 'Imagify', 'imagify' );
13
  return $columns;
14
  }
15
 
16
- add_filter( 'manage_media_custom_column', '_imagify_manage_media_custom_column', 10, 2 );
 
 
 
 
 
 
 
 
 
17
  function _imagify_manage_media_custom_column( $column_name, $attachment_id ) {
18
- if ( 'imagify_optimized_file' == $column_name ) {
19
- $attachment = new Imagify_Attachment( $attachment_id );
20
- echo get_imagify_media_column_content( $attachment );
21
  }
 
 
 
 
 
22
  }
23
 
24
- /*
 
25
  * Adds a dropdown that allows filtering on the attachments Imagify status.
26
  *
27
  * @since 1.0
28
  * @author Jonathan Buttigieg
29
  */
30
- add_action( 'restrict_manage_posts', '_imagify_attachments_filter_dropdown' );
31
  function _imagify_attachments_filter_dropdown() {
32
  if ( 'upload.php' !== $GLOBALS['pagenow'] ) {
33
  return;
@@ -36,50 +52,48 @@ function _imagify_attachments_filter_dropdown() {
36
  $optimized = imagify_count_optimized_attachments();
37
  $unoptimized = imagify_count_unoptimized_attachments();
38
  $errors = imagify_count_error_attachments();
39
- $status = ( isset( $_GET['imagify-status'] ) ) ? $_GET['imagify-status'] : 0;
40
- $options = array(
41
  'optimized' => __( 'Optimized','imagify' ),
42
  'unoptimized' => __( 'Unoptimized','imagify' ),
43
  'errors' => __( 'Errors','imagify' ),
44
  );
45
 
46
- $output = '<label class="screen-reader-text" for="filter-by-optimization-status">' . __( 'Filter by status','imagify' ) . '</label>';
47
-
48
- $output .= '<select id="filter-by-optimization-status" name="imagify-status">';
49
- $output .= '<option value="0" selected="selected">' . __( 'All images','imagify' ) . '</option>';
50
 
51
- foreach( $options as $value => $label ) {
52
- $output .= '<option value="' . $value . '" ' . selected( $status, $value, false ) . '>' . $label . ' (' . ${$value} . ')</option>';
53
- }
54
-
55
- $output .= '</select>&nbsp;';
56
-
57
- echo $output;
58
  }
59
 
 
60
  /**
61
- * Modify the query based on the imagify-status variable in $_GET
62
  *
63
  * @since 1.0
64
  * @author Jonathan Buttigieg
 
 
 
65
  */
66
- add_filter( 'request', '_imagify_sort_attachments_by_status' );
67
  function _imagify_sort_attachments_by_status( $vars ) {
68
- if ( 'upload.php' !== $GLOBALS['pagenow'] || empty( $_GET['imagify-status'] ) ) {
69
  return $vars;
70
  }
71
-
72
- $status = $_GET['imagify-status'];
73
  $meta_key = '_imagify_status';
74
  $meta_compare = '=';
75
  $relation = array();
76
-
77
- switch( $status ) {
78
  case 'unoptimized':
79
  $meta_key = '_imagify_data';
80
  $meta_compare = 'NOT EXISTS';
81
- break;
82
-
83
  case 'optimized':
84
  $status = 'success';
85
  $relation = array(
@@ -87,28 +101,24 @@ function _imagify_sort_attachments_by_status( $vars ) {
87
  'value' => 'already_optimized',
88
  'compare' => $meta_compare,
89
  );
90
- break;
91
-
92
  case 'errors':
93
  $status = 'error';
94
- break;
95
  }
96
-
97
- $vars['post_mime_type'] = get_imagify_mime_type();
98
- $vars = array_merge(
99
- $vars,
100
- array(
101
- 'meta_query' => array(
102
- 'relation' => 'or',
103
- array(
104
- 'key' => $meta_key,
105
- 'value' => $status,
106
- 'compare' => $meta_compare,
107
- ),
108
- $relation
109
  ),
110
- )
111
- );
112
-
 
 
 
113
  return $vars;
114
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_filter( 'manage_media_columns', '_imagify_manage_media_columns' );
5
+ /**
6
+ * Add "Imagify" column in upload.php.
7
  *
8
  * @since 1.0
9
  * @author Jonathan Buttigieg
10
+ *
11
+ * @param array $columns An array of columns displayed in the Media list table.
12
+ * @return array
13
  */
 
14
  function _imagify_manage_media_columns( $columns ) {
15
  $columns['imagify_optimized_file'] = __( 'Imagify', 'imagify' );
16
  return $columns;
17
  }
18
 
19
+ add_action( 'manage_media_custom_column', '_imagify_manage_media_custom_column', 10, 2 );
20
+ /**
21
+ * Add content to the "Imagify" columns in upload.php.
22
+ *
23
+ * @since 1.0
24
+ * @author Jonathan Buttigieg
25
+ *
26
+ * @param string $column_name Name of the custom column.
27
+ * @param int $attachment_id Attachment ID.
28
+ */
29
  function _imagify_manage_media_custom_column( $column_name, $attachment_id ) {
30
+ if ( 'imagify_optimized_file' !== $column_name ) {
31
+ return;
 
32
  }
33
+
34
+ $class_name = get_imagify_attachment_class_name( 'wp' );
35
+ $attachment = new $class_name( $attachment_id );
36
+
37
+ echo get_imagify_media_column_content( $attachment );
38
  }
39
 
40
+ add_action( 'restrict_manage_posts', '_imagify_attachments_filter_dropdown' );
41
+ /**
42
  * Adds a dropdown that allows filtering on the attachments Imagify status.
43
  *
44
  * @since 1.0
45
  * @author Jonathan Buttigieg
46
  */
 
47
  function _imagify_attachments_filter_dropdown() {
48
  if ( 'upload.php' !== $GLOBALS['pagenow'] ) {
49
  return;
52
  $optimized = imagify_count_optimized_attachments();
53
  $unoptimized = imagify_count_unoptimized_attachments();
54
  $errors = imagify_count_error_attachments();
55
+ $status = isset( $_GET['imagify-status'] ) ? $_GET['imagify-status'] : 0; // WPCS: CSRF ok.
56
+ $options = array(
57
  'optimized' => __( 'Optimized','imagify' ),
58
  'unoptimized' => __( 'Unoptimized','imagify' ),
59
  'errors' => __( 'Errors','imagify' ),
60
  );
61
 
62
+ echo '<label class="screen-reader-text" for="filter-by-optimization-status">' . __( 'Filter by status','imagify' ) . '</label>';
63
+ echo '<select id="filter-by-optimization-status" name="imagify-status">';
64
+ echo '<option value="0" selected="selected">' . __( 'All images','imagify' ) . '</option>';
 
65
 
66
+ foreach ( $options as $value => $label ) {
67
+ echo '<option value="' . $value . '" ' . selected( $status, $value, false ) . '>' . $label . ' (' . ${$value} . ')</option>';
68
+ }
69
+ echo '</select>&nbsp;';
 
 
 
70
  }
71
 
72
+ add_filter( 'request', '_imagify_sort_attachments_by_status' );
73
  /**
74
+ * Modify the query based on the imagify-status variable in $_GET.
75
  *
76
  * @since 1.0
77
  * @author Jonathan Buttigieg
78
+ *
79
+ * @param array $vars The array of requested query variables.
80
+ * @return array
81
  */
 
82
  function _imagify_sort_attachments_by_status( $vars ) {
83
+ if ( 'upload.php' !== $GLOBALS['pagenow'] || empty( $_GET['imagify-status'] ) ) { // WPCS: CSRF ok.
84
  return $vars;
85
  }
86
+
87
+ $status = $_GET['imagify-status']; // WPCS: CSRF ok.
88
  $meta_key = '_imagify_status';
89
  $meta_compare = '=';
90
  $relation = array();
91
+
92
+ switch ( $status ) {
93
  case 'unoptimized':
94
  $meta_key = '_imagify_data';
95
  $meta_compare = 'NOT EXISTS';
96
+ break;
 
97
  case 'optimized':
98
  $status = 'success';
99
  $relation = array(
101
  'value' => 'already_optimized',
102
  'compare' => $meta_compare,
103
  );
104
+ break;
 
105
  case 'errors':
106
  $status = 'error';
 
107
  }
108
+
109
+ $vars = array_merge( $vars, array(
110
+ 'meta_query' => array(
111
+ 'relation' => 'or',
112
+ array(
113
+ 'key' => $meta_key,
114
+ 'value' => $status,
115
+ 'compare' => $meta_compare,
 
 
 
 
 
116
  ),
117
+ $relation,
118
+ ),
119
+ ) );
120
+
121
+ $vars['post_mime_type'] = get_imagify_mime_type();
122
+
123
  return $vars;
124
+ }
inc/api/imagify.php CHANGED
@@ -1,13 +1,14 @@
1
  <?php
 
2
 
3
  /**
4
  * Create a new user on Imagify.
5
  *
6
  * @param array $data All user data.
7
  * @return object
8
- **/
9
  function add_imagify_user( $data ) {
10
- return Imagify()->createUser( $data );
11
  }
12
 
13
  /**
@@ -15,36 +16,37 @@ function add_imagify_user( $data ) {
15
  *
16
  * @param string $data All user data.
17
  * @return object
18
- **/
19
  function update_imagify_user( $data ) {
20
- return Imagify()->updateUser( $data );
21
  }
22
 
23
  /**
24
  * Get your Imagify account infos.
25
  *
26
  * @return object
27
- **/
28
  function get_imagify_user() {
29
- return Imagify()->getUser();
30
  }
31
 
32
  /**
33
  * Get the Imagify API version.
34
  *
35
  * @return object
36
- **/
37
  function get_imagify_api_version() {
38
- return Imagify()->getApiVersion();
39
  }
40
 
41
  /**
42
  * Check your Imagify API key status.
43
  *
 
44
  * @return bool
45
- **/
46
  function get_imagify_status( $data ) {
47
- return Imagify()->getStatus( $data );
48
  }
49
 
50
  /**
@@ -52,9 +54,9 @@ function get_imagify_status( $data ) {
52
  *
53
  * @param array $data All image data.
54
  * @return object
55
- **/
56
  function fetch_imagify_image( $data ) {
57
- return Imagify()->fetchImage( $data );
58
  }
59
 
60
  /**
@@ -62,383 +64,91 @@ function fetch_imagify_image( $data ) {
62
  *
63
  * @param array $data All image data.
64
  * @return object
65
- **/
66
  function upload_imagify_image( $data ) {
67
- return Imagify()->uploadImage( $data );
68
  }
69
 
70
  /**
71
- * Get Imagify Plans Prices
72
  *
73
- * @return object
74
  * @since 1.5
75
  * @author Geoffrey Crofte
76
- **/
 
 
77
  function get_imagify_plans_prices() {
78
- return Imagify()->getPlansPrices();
79
  }
80
 
81
  /**
82
- * Get Imagify Plans Prices
83
  *
84
- * @return object
85
  * @since 1.5
86
  * @author Geoffrey Crofte
87
- **/
 
 
88
  function get_imagify_packs_prices() {
89
- return Imagify()->getPacksPrices();
90
  }
91
 
92
  /**
93
- * Get Imagify All Prices (plan & packs)
94
  *
95
- * @return object
96
  * @since 1.5.4
97
  * @author Geoffrey Crofte
98
- **/
 
 
99
  function get_imagify_all_prices() {
100
- return Imagify()->getAllPrices();
101
  }
102
 
103
  /**
104
- * Check if Coupon Code exists
105
- *
106
- * @param string $coupon the coupon code to check
107
- * @return object
108
  *
109
  * @since 1.6
110
  * @author Geoffrey Crofte
111
- **/
 
 
 
112
  function check_imagify_coupon_code( $coupon ) {
113
- return Imagify()->checkCouponCode( $coupon );
114
  }
115
 
116
  /**
117
- * Check if Discount/Promotion is available
118
  *
119
- * @return object
120
  * @since 1.6.3
121
  * @author Geoffrey Crofte
122
- **/
 
 
123
  function check_imagify_discount() {
124
- return Imagify()->checkDiscount();
125
  }
126
 
127
- /*
128
- * Get Maximum image size for free plan
129
  *
130
- * @return string
131
  * @since 1.5.6
132
  * @author Remy Perona
133
- **/
134
- function get_imagify_max_image_size() {
135
- if ( false === ( $max_image_size = get_transient( 'imagify_max_image_size' ) ) ) {
136
- $max_image_size = Imagify()->getPublicInfo()->max_image_size;
137
- set_transient( 'imagify_max_image_size', $max_image_size, 6 * HOUR_IN_SECONDS );
138
- }
139
-
140
- return $max_image_size;
141
- }
142
-
143
- /**
144
- * Imagify.io API for WordPress
145
  */
146
- class Imagify {
147
- /**
148
- * The Imagify API endpoint
149
- */
150
- const API_ENDPOINT = 'https://app.imagify.io/api/';
151
-
152
- /**
153
- * The Imagify API key
154
- */
155
- private $apiKey = '';
156
-
157
- /**
158
- * HTTP headers
159
- */
160
- private $headers = array();
161
-
162
- /**
163
- * @var The single instance of the class
164
- */
165
- protected static $_instance = null;
166
-
167
- /**
168
- * The constructor
169
- *
170
- * @return void
171
- **/
172
- public function __construct()
173
- {
174
- // check if the WordPress plugin is activated and the API key is stored in the options
175
- if ( defined( 'IMAGIFY_VERSION' ) && function_exists( 'get_imagify_option' ) ) {
176
- $apiKey = get_imagify_option( 'api_key', false );
177
- $this->apiKey = ( $apiKey ) ? $apiKey : $this->apiKey;
178
- }
179
-
180
- // check if the API key is defined with the PHP constant (it's ovveride the WordPress plugin option
181
- if ( defined( 'IMAGIFY_API_KEY' ) && IMAGIFY_API_KEY ) {
182
- $this->apiKey = IMAGIFY_API_KEY;
183
- }
184
 
185
- $this->headers['Accept'] = 'Accept: application/json';
186
- $this->headers['Content-Type'] = 'Content-Type: application/json';
187
- $this->headers['Authorization'] = 'Authorization: token ' . $this->apiKey;
188
- }
189
 
190
- /**
191
- * Main Imagify Instance
192
- *
193
- * Ensures only one instance of class is loaded or can be loaded.
194
- *
195
- * @static
196
- * @return Main instance
197
- */
198
- public static function instance() {
199
- if ( is_null( self::$_instance ) ) {
200
- self::$_instance = new self();
201
  }
202
-
203
- return self::$_instance;
204
  }
205
 
206
- /**
207
- * Create a user on your Imagify account.
208
- *
209
- * @param array $data All user data. Details here: --
210
- * @return object
211
- **/
212
- public function createUser( $data ) {
213
- unset( $this->headers['Authorization'], $this->headers['Accept'], $this->headers['Content-Type'] );
214
-
215
- $data['from_plugin'] = true;
216
- $args = array(
217
- 'method' => 'POST',
218
- 'post_data' => $data
219
- );
220
-
221
- return $this->httpCall( 'users/', $args );
222
- }
223
-
224
- /**
225
- * Get your Imagify account infos.
226
- *
227
- * @return object
228
- **/
229
- public function getUser() {
230
- static $user;
231
-
232
- if ( ! isset( $user ) ) {
233
- $user = $this->httpCall( 'users/me/', array( 'timeout' => 10 ) );
234
- }
235
-
236
- return $user;
237
- }
238
-
239
- /**
240
- * Check your Imagify API key status.
241
- *
242
- * @return object
243
- **/
244
- public function getStatus( $data ) {
245
- static $status;
246
-
247
- if ( ! isset( $status ) ) {
248
- unset( $this->headers['Accept'], $this->headers['Content-Type'] );
249
- $this->headers['Authorization'] = 'Authorization: token ' . $data;
250
-
251
- $status = $this->httpCall( 'status/', array( 'timeout' => 10 ) );
252
- }
253
-
254
- return $status;
255
- }
256
-
257
- /**
258
- * Get the Imagify API version.
259
- *
260
- * @return object
261
- **/
262
- public function getApiVersion() {
263
- static $api_version;
264
-
265
- if ( ! isset( $api_version ) ) {
266
- unset( $this->headers['Accept'], $this->headers['Content-Type'] );
267
-
268
- $api_version = $this->httpCall( 'version/', array( 'timeout' => 5 ) );
269
- }
270
-
271
- return $api_version;
272
- }
273
-
274
- /**
275
- * Update an existing user on your Imagify account.
276
- *
277
- * @param string $data All user data. Details here: --
278
- * @return object
279
- **/
280
- public function updateUser( $data ) {
281
- $args = array(
282
- 'method' => 'PUT',
283
- 'post_data' => $data,
284
- 'timeout' => 10
285
- );
286
-
287
- return $this->httpCall( 'users/me/', $args );
288
- }
289
-
290
- /**
291
- * Optimize an image from its binary content.
292
- *
293
- * @param string $data All options. Details here: --
294
- * @return object
295
- **/
296
- public function uploadImage( $data ) {
297
- if ( isset( $this->headers['Accept'], $this->headers['Content-Type'] ) ) {
298
- unset( $this->headers['Accept'], $this->headers['Content-Type'] );
299
- }
300
-
301
- $args = array(
302
- 'method' => 'POST',
303
- 'post_data' => $data
304
- );
305
-
306
- return $this->httpCall( 'upload/', $args );
307
- }
308
-
309
- /**
310
- * Optimize an image from its URL.
311
- *
312
- * @param string $data All options. Details here: --
313
- * @return object
314
- **/
315
- public function fetchImage( $data ) {
316
- $args = array(
317
- 'method' => 'POST',
318
- 'post_data' => json_encode( $data )
319
- );
320
- return $this->httpCall( 'fetch/', $args );
321
- }
322
-
323
- /**
324
- * Get prices for plans
325
- *
326
- * @return object
327
- */
328
- public function getPlansPrices() {
329
- return $this->httpCall( 'pricing/plan/' );
330
- }
331
-
332
- /**
333
- * Get prices for packs (one time)
334
- *
335
- * @return object
336
- */
337
- public function getPacksPrices() {
338
- return $this->httpCall( 'pricing/pack/' );
339
- }
340
-
341
- /**
342
- * Get all prices (packs & plans included)
343
- *
344
- * @return object
345
- */
346
- public function getAllPrices() {
347
- return $this->httpCall( 'pricing/all/' );
348
- }
349
-
350
- /**
351
- * Get all prices (packs & plans included)
352
- *
353
- * @return object
354
- */
355
- public function checkCouponCode( $coupon ) {
356
- return $this->httpCall( 'coupons/' . $coupon . '/' );
357
- }
358
-
359
- /**
360
- * Get information about current discount
361
- *
362
- * @return object
363
- */
364
- public function checkDiscount() {
365
- return $this->httpCall( 'pricing/discount/' );
366
- }
367
-
368
- /*
369
- * Get Public Info
370
- *
371
- * @return object
372
- */
373
- public function getPublicInfo() {
374
- return $this->httpCall( 'public-info' );
375
- }
376
-
377
- /**
378
- * Make an HTTP call using curl.
379
- *
380
- * @param string $url The URL to call
381
- * @param array $args The request args
382
- * @return object
383
- **/
384
- private function httpCall( $url, $args = array() ) {
385
- $default = array(
386
- 'method' => 'GET',
387
- 'post_data' => null,
388
- 'timeout' => 45
389
- );
390
- $args = array_merge( $default, $args );
391
-
392
- // Check if php-curl is enabled
393
- if ( ! function_exists( 'curl_init' ) || ! function_exists( 'curl_exec' ) ) {
394
- return new WP_Error( 'curl', 'cURL isn\'t installed on the server.' );
395
- }
396
-
397
- try {
398
- $ch = curl_init();
399
-
400
- if ( 'POST' == $args['method'] ) {
401
- curl_setopt( $ch, CURLOPT_POST, true );
402
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $args['post_data'] );
403
- }
404
-
405
- curl_setopt( $ch, CURLOPT_URL, self::API_ENDPOINT . $url );
406
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
407
- curl_setopt( $ch, CURLOPT_HTTPHEADER, $this->headers );
408
- curl_setopt( $ch, CURLOPT_TIMEOUT, $args['timeout'] );
409
- @curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
410
- curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
411
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
412
-
413
- $response = json_decode( curl_exec( $ch ) );
414
- $error = curl_error( $ch );
415
- $http_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
416
-
417
- curl_close( $ch );
418
- } catch( Exception $e ) {
419
- return new WP_Error( 'curl', 'Unknown error occurred' );
420
- }
421
-
422
- if ( 200 != $http_code && isset( $response->code, $response->detail ) ) {
423
- return new WP_Error( $http_code, $response->detail );
424
- } elseif ( 413 == $http_code ) {
425
- return new WP_Error( $http_code, 'Your image is too big to be uploaded on our server.' );
426
- } elseif ( 200 != $http_code ) {
427
- $http_code = (int) $http_code;
428
- $error = '' != $error ? ' - ' . htmlentities( $error ) : '';
429
- return new WP_Error( $http_code, "Unknown error occurred ({$http_code}{$error}) " );
430
- } else {
431
- return $response;
432
- }
433
-
434
- return $response;
435
- }
436
- }
437
-
438
- /**
439
- * Returns the main instance of Imagify to prevent the need to use globals.
440
- */
441
- function Imagify() {
442
- return Imagify::instance();
443
  }
444
- $GLOBALS['imagify'] = Imagify();
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  /**
5
  * Create a new user on Imagify.
6
  *
7
  * @param array $data All user data.
8
  * @return object
9
+ */
10
  function add_imagify_user( $data ) {
11
+ return imagify()->create_user( $data );
12
  }
13
 
14
  /**
16
  *
17
  * @param string $data All user data.
18
  * @return object
19
+ */
20
  function update_imagify_user( $data ) {
21
+ return imagify()->update_user( $data );
22
  }
23
 
24
  /**
25
  * Get your Imagify account infos.
26
  *
27
  * @return object
28
+ */
29
  function get_imagify_user() {
30
+ return imagify()->get_user();
31
  }
32
 
33
  /**
34
  * Get the Imagify API version.
35
  *
36
  * @return object
37
+ */
38
  function get_imagify_api_version() {
39
+ return imagify()->get_api_version();
40
  }
41
 
42
  /**
43
  * Check your Imagify API key status.
44
  *
45
+ * @param string $data An API key.
46
  * @return bool
47
+ */
48
  function get_imagify_status( $data ) {
49
+ return imagify()->get_status( $data );
50
  }
51
 
52
  /**
54
  *
55
  * @param array $data All image data.
56
  * @return object
57
+ */
58
  function fetch_imagify_image( $data ) {
59
+ return imagify()->fetch_image( $data );
60
  }
61
 
62
  /**
64
  *
65
  * @param array $data All image data.
66
  * @return object
67
+ */
68
  function upload_imagify_image( $data ) {
69
+ return imagify()->upload_image( $data );
70
  }
71
 
72
  /**
73
+ * Get Imagify Plans Prices.
74
  *
 
75
  * @since 1.5
76
  * @author Geoffrey Crofte
77
+ *
78
+ * @return object
79
+ */
80
  function get_imagify_plans_prices() {
81
+ return imagify()->get_plans_prices();
82
  }
83
 
84
  /**
85
+ * Get Imagify Plans Prices.
86
  *
 
87
  * @since 1.5
88
  * @author Geoffrey Crofte
89
+ *
90
+ * @return object
91
+ */
92
  function get_imagify_packs_prices() {
93
+ return imagify()->get_packs_prices();
94
  }
95
 
96
  /**
97
+ * Get Imagify All Prices (plan & packs).
98
  *
 
99
  * @since 1.5.4
100
  * @author Geoffrey Crofte
101
+ *
102
+ * @return object
103
+ */
104
  function get_imagify_all_prices() {
105
+ return imagify()->get_all_prices();
106
  }
107
 
108
  /**
109
+ * Check if Coupon Code exists.
 
 
 
110
  *
111
  * @since 1.6
112
  * @author Geoffrey Crofte
113
+ *
114
+ * @param string $coupon the coupon code to check.
115
+ * @return object
116
+ */
117
  function check_imagify_coupon_code( $coupon ) {
118
+ return imagify()->check_coupon_code( $coupon );
119
  }
120
 
121
  /**
122
+ * Check if Discount/Promotion is available.
123
  *
 
124
  * @since 1.6.3
125
  * @author Geoffrey Crofte
126
+ *
127
+ * @return object
128
+ */
129
  function check_imagify_discount() {
130
+ return imagify()->check_discount();
131
  }
132
 
133
+ /**
134
+ * Get Maximum image size for free plan.
135
  *
 
136
  * @since 1.5.6
137
  * @author Remy Perona
138
+ *
139
+ * @return string
 
 
 
 
 
 
 
 
 
 
140
  */
141
+ function get_imagify_max_image_size() {
142
+ $max_image_size = get_transient( 'imagify_max_image_size' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
 
144
+ if ( false === $max_image_size ) {
145
+ $max_image_size = imagify()->get_public_info();
 
 
146
 
147
+ if ( ! is_wp_error( $max_image_size ) ) {
148
+ $max_image_size = $max_image_size->max_image_size;
149
+ set_transient( 'imagify_max_image_size', $max_image_size, 6 * HOUR_IN_SECONDS );
 
 
 
 
 
 
 
 
150
  }
 
 
151
  }
152
 
153
+ return $max_image_size;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  }
 
inc/classes/abstracts/{abstract-attachment.php → class-imagify-abstract-attachment.php} RENAMED
@@ -1,48 +1,64 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
-
 
 
 
 
 
4
  class Imagify_Abstract_Attachment {
 
5
  /**
6
- * The attachment ID
 
 
 
 
 
 
 
7
  *
8
  * @since 1.0
9
  *
10
- * @var int
11
  * @access public
12
  */
13
  public $id;
14
 
15
- /**
16
- * The constructor
17
- *
18
  * @since 1.0
19
  *
20
- * @return void
21
- **/
22
- function __construct( $id = 0 ) {}
 
23
 
24
  /**
25
  * Get the attachment backup filepath.
26
  *
27
  * @since 1.0
28
- *
29
  * @access public
 
30
  * @return string|false
31
  */
32
- public function get_backup_path() {}
33
-
 
 
34
  /**
35
  * Get the attachment backup URL.
36
  *
37
  * @since 1.4
38
- *
39
  * @access public
 
40
  * @return string|false
41
  */
42
  public function get_backup_url() {
43
  $backup_path = $this->get_backup_path();
44
  $backup_url = str_replace( ABSPATH, site_url( '/' ), $backup_path );
45
-
46
  return $backup_url;
47
  }
48
 
@@ -50,75 +66,78 @@ class Imagify_Abstract_Attachment {
50
  * Get the attachment optimization data.
51
  *
52
  * @since 1.0
53
- *
54
  * @access public
 
55
  * @return array
56
  */
57
- public function get_data() {}
58
-
 
 
59
  /**
60
  * Get the attachment extension.
61
  *
62
  * @since 1.0
63
- *
64
  * @access public
 
65
  * @return string
66
  */
67
  public function get_extension() {
68
  $fullsize_path = $this->get_original_path();
69
  return pathinfo( $fullsize_path, PATHINFO_EXTENSION );
70
  }
71
-
72
  /**
73
  * Get the attachment error if there is one.
74
  *
75
  * @since 1.1.5
76
- *
77
  * @access public
 
78
  * @return string The message error
79
  */
80
  public function get_optimized_error() {
81
  $error = $this->get_size_data( 'full', 'error' );
82
-
83
  if ( is_string( $error ) ) {
84
  return $error;
85
  }
86
-
87
  return false;
88
  }
89
-
90
  /**
91
  * Get the attachment optimization level.
92
  *
93
  * @since 1.0
94
- *
95
  * @access public
 
96
  * @return int
97
  */
98
- public function get_optimization_level() {}
99
-
 
 
100
  /**
101
  * Get the attachment optimization level label.
102
  *
103
  * @since 1.2
104
- *
105
  * @access public
 
106
  * @return string
107
  */
108
  public function get_optimization_level_label() {
109
  $label = '';
110
  $level = $this->get_optimization_level();
111
-
112
- switch( $level ) {
113
  case 2:
114
  $label = __( 'Ultra', 'imagify' );
115
- break;
116
  case 1:
117
  $label = __( 'Aggressive', 'imagify' );
118
- break;
119
  case 0:
120
  $label = __( 'Normal', 'imagify' );
121
- break;
122
  }
123
 
124
  return $label;
@@ -128,8 +147,8 @@ class Imagify_Abstract_Attachment {
128
  * Count number of optimized sizes.
129
  *
130
  * @since 1.0
131
- *
132
  * @access public
 
133
  * @return int
134
  */
135
  public function get_optimized_sizes_count() {
@@ -137,9 +156,7 @@ class Imagify_Abstract_Attachment {
137
  $sizes = (array) $data['sizes'];
138
  $count = 0;
139
 
140
- if ( isset( $sizes['full'] ) ) {
141
- unset( $sizes['full'] );
142
- }
143
 
144
  foreach ( $sizes as $size ) {
145
  if ( $size['success'] ) {
@@ -147,46 +164,51 @@ class Imagify_Abstract_Attachment {
147
  }
148
  }
149
 
150
- return (int) $count;
151
  }
152
 
153
  /**
154
  * Get the attachment optimization status (success or error).
155
  *
156
  * @since 1.0
157
- *
158
  * @access public
 
159
  * @return string
160
  */
161
- public function get_status() {}
 
 
162
 
163
  /**
164
  * Get the original attachment path.
165
  *
166
  * @since 1.0
167
- *
168
  * @access public
 
169
  * @return string
170
  */
171
- public function get_original_path() {}
 
 
172
 
173
  /**
174
  * Get the original attachment size.
175
  *
176
  * @since 1.0
177
- *
178
  * @access public
179
- * @param bool $human_format True to display the image human format size (1Mb).
 
180
  * @return string
181
  */
182
  public function get_original_size( $human_format = true ) {
 
183
  $original_size = $this->get_size_data( 'full', 'original_size' );
184
- $original_size = ( empty( $original_size ) ) ? @filesize( $this->get_original_path() ) : (int) $original_size;
185
-
186
  if ( true === $human_format ) {
187
- $original_size = @size_format( $original_size, 2 );
188
  }
189
-
190
  return $original_size;
191
  }
192
 
@@ -194,20 +216,22 @@ class Imagify_Abstract_Attachment {
194
  * Get the original attachment URL.
195
  *
196
  * @since 1.0
197
- *
198
  * @access public
 
199
  * @return string
200
  */
201
- public function get_original_url() {}
 
 
202
 
203
- /*
204
  * Get the statistics of a specific size.
205
  *
206
  * @since 1.0
207
- *
208
  * @access public
209
- * @param string $size The thumbnail slug.
210
- * @param string $key The specific data slug.
 
211
  * @return array|string
212
  */
213
  public function get_size_data( $size = 'full', $key = '' ) {
@@ -224,14 +248,14 @@ class Imagify_Abstract_Attachment {
224
 
225
  return $stats;
226
  }
227
-
228
  /**
229
  * Get the global statistics data or a specific one.
230
  *
231
  * @since 1.0
232
- *
233
  * @access public
234
- * @param string $key The specific data slug.
 
235
  * @return array|string
236
  */
237
  public function get_stats_data( $key = '' ) {
@@ -253,33 +277,33 @@ class Imagify_Abstract_Attachment {
253
  * Check if the attachment is already optimized (before Imagify).
254
  *
255
  * @since 1.1.6
256
- *
257
  * @access public
258
- * @return bool True if the attachment is optimized.
 
259
  */
260
  public function is_already_optimized() {
261
- return ( 'already_optimized' === $this->get_status() ) > 0;
262
  }
263
-
264
  /**
265
  * Check if the attachment is optimized.
266
  *
267
  * @since 1.0
268
- *
269
  * @access public
270
- * @return bool True if the attachment is optimized.
 
271
  */
272
  public function is_optimized() {
273
- return ( 'success' === $this->get_status() ) > 0;
274
  }
275
 
276
  /**
277
  * Check if the attachment exceeding the limit size (> 5mo).
278
  *
279
  * @since 1.0
280
- *
281
  * @access public
282
- * @return bool True if the attachment is skipped.
 
283
  */
284
  public function is_exceeded() {
285
  $filepath = $this->get_original_path();
@@ -289,16 +313,16 @@ class Imagify_Abstract_Attachment {
289
  $size = filesize( $filepath );
290
  }
291
 
292
- return ( $size > IMAGIFY_MAX_BYTES ) > 0;
293
  }
294
 
295
  /**
296
  * Check if the attachment has a backup of the original size.
297
  *
298
  * @since 1.0
299
- *
300
  * @access public
301
- * @return bool True if the attachment has a backup.
 
302
  */
303
  public function has_backup() {
304
  return (bool) $this->get_backup_path();
@@ -308,21 +332,21 @@ class Imagify_Abstract_Attachment {
308
  * Check if the attachment has an error.
309
  *
310
  * @since 1.0
311
- *
312
  * @access public
313
- * @return bool True if the attachment has an error.
 
314
  */
315
  public function has_error() {
316
  $has_error = $this->get_size_data( 'full', 'error' );
317
- return ( is_string( $has_error ) ) > 0;
318
  }
319
-
320
  /**
321
  * Update the metadata size of the attachment
322
  *
323
  * @since 1.2
324
- *
325
  * @access public
 
326
  * @return void
327
  */
328
  public function update_metadata_size() {}
@@ -331,116 +355,117 @@ class Imagify_Abstract_Attachment {
331
  * Delete the backup file.
332
  *
333
  * @since 1.0
334
- *
335
  * @access public
 
336
  * @return void
337
  */
338
  public function delete_backup() {
339
  $backup_path = $this->get_backup_path();
340
 
341
  if ( ! empty( $backup_path ) ) {
342
- @unlink( $backup_path );
343
  }
344
  }
345
 
346
  /**
347
- * Fills statistics data with values from $data array
348
  *
349
  * @since 1.0
350
- *
351
  * @access public
352
- * @static
353
- * @param array $data The statistics data
354
- * @param object $response The API response
355
- * @param int $id The attachment ID
356
- * @param int $url The attachment URL
357
- * @param string $size The attachment size key
358
- * @return bool|array False if the original size has an error or an array contains the data for other result
359
  */
360
- static public function fill_data( $data, $response, $id, $url, $size = 'full' ) {}
 
 
361
 
362
  /**
363
  * Optimize all sizes with Imagify.
364
  *
365
  * @since 1.0
366
- *
367
  * @access public
368
- * @param int $optimization_level The optimization level (2=ultra, 1=aggressive, 0=normal)
369
- * @param array $metadata The attachment meta data
370
- * @return array $optimized_data The optimization data
 
371
  */
372
- public function optimize( $optimization_level = null, $metadata = array() ) {}
 
 
373
 
374
  /**
375
  * Process an attachment restoration from the backup file.
376
  *
377
  * @since 1.0
378
- *
379
  * @access public
 
380
  * @return void
381
  */
382
  public function restore() {}
383
 
384
- /**
385
- * Resize an image if bigger than the maximum width defined in the settings.
386
- *
387
- * @since 1.5.7
388
- * @author Remy Perona
389
- *
390
- * @param string $attachment_path Path to the image
391
- * @param array $attachment_sizes Array of original image dimensions
392
- * @param int $max_width Maximum width defined in the settings
393
- * @return string Path the the resized image or the original image if the resize failed
394
- */
395
- function resize( $attachment_path, $attachment_sizes, $max_width ) {
396
- // Prevent removal of the exif/meta data when resizing (only works with Imagick)
397
- add_filter( 'image_strip_meta', '__return_false' );
398
-
399
- $new_sizes = wp_constrain_dimensions( $attachment_sizes[0], $attachment_sizes[1], $max_width );
400
-
401
- $editor = wp_get_image_editor( $attachment_path );
402
-
403
- if ( is_wp_error( $editor ) ) {
404
- return $editor;
405
- }
406
-
407
- $image_type = pathinfo( $attachment_path, PATHINFO_EXTENSION );
408
-
409
- // try to correct for auto-rotation if the info is available
410
- if ( function_exists( 'exif_read_data' ) && ( $image_type == 'jpg' || $image_type == 'jpeg' ) ) {
411
- $exif = @exif_read_data( $attachment_path );
412
- $orientation = is_array( $exif ) && array_key_exists( 'Orientation', $exif ) ? $exif['Orientation'] : 0;
413
-
414
- switch( $orientation ) {
415
- case 3:
416
- $editor->rotate( 180 );
417
- break;
418
- case 6:
419
- $editor->rotate( -90 );
420
- break;
421
- case 8:
422
- $editor->rotate( 90 );
423
- break;
424
- }
425
- }
426
-
427
- $resized = $editor->resize( $new_sizes[0], $new_sizes[1], false );
428
-
429
- if ( is_wp_error( $resized ) ) {
430
- return $resized;
431
- }
432
-
433
- $resized_image_path = $editor->generate_filename( 'imagifyresized' );
434
-
435
- $resized_image_saved = $editor->save( $resized_image_path );
436
-
437
- if ( is_wp_error( $resized_image_saved ) ) {
438
- return $resized_image_saved;
439
- }
440
-
441
- // Remove the filter when we're done to prevent any conflict
442
- remove_filter( 'image_strip_meta', '__return_false' );
443
-
444
- return $resized_image_path;
445
- }
446
- }
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
+
4
+ /**
5
+ * Imagify Attachment base class.
6
+ *
7
+ * @since 1.0
8
+ */
9
  class Imagify_Abstract_Attachment {
10
+
11
  /**
12
+ * Class version.
13
+ *
14
+ * @var string
15
+ */
16
+ const VERSION = '1.0.1';
17
+
18
+ /**
19
+ * The attachment ID.
20
  *
21
  * @since 1.0
22
  *
23
+ * @var int
24
  * @access public
25
  */
26
  public $id;
27
 
28
+ /**
29
+ * The constructor.
30
+ *
31
  * @since 1.0
32
  *
33
+ * @param int $id The attachment ID.
34
+ * @return void
35
+ */
36
+ public function __construct( $id = 0 ) {}
37
 
38
  /**
39
  * Get the attachment backup filepath.
40
  *
41
  * @since 1.0
 
42
  * @access public
43
+ *
44
  * @return string|false
45
  */
46
+ public function get_backup_path() {
47
+ return '';
48
+ }
49
+
50
  /**
51
  * Get the attachment backup URL.
52
  *
53
  * @since 1.4
 
54
  * @access public
55
+ *
56
  * @return string|false
57
  */
58
  public function get_backup_url() {
59
  $backup_path = $this->get_backup_path();
60
  $backup_url = str_replace( ABSPATH, site_url( '/' ), $backup_path );
61
+
62
  return $backup_url;
63
  }
64
 
66
  * Get the attachment optimization data.
67
  *
68
  * @since 1.0
 
69
  * @access public
70
+ *
71
  * @return array
72
  */
73
+ public function get_data() {
74
+ return array();
75
+ }
76
+
77
  /**
78
  * Get the attachment extension.
79
  *
80
  * @since 1.0
 
81
  * @access public
82
+ *
83
  * @return string
84
  */
85
  public function get_extension() {
86
  $fullsize_path = $this->get_original_path();
87
  return pathinfo( $fullsize_path, PATHINFO_EXTENSION );
88
  }
89
+
90
  /**
91
  * Get the attachment error if there is one.
92
  *
93
  * @since 1.1.5
 
94
  * @access public
95
+ *
96
  * @return string The message error
97
  */
98
  public function get_optimized_error() {
99
  $error = $this->get_size_data( 'full', 'error' );
100
+
101
  if ( is_string( $error ) ) {
102
  return $error;
103
  }
104
+
105
  return false;
106
  }
107
+
108
  /**
109
  * Get the attachment optimization level.
110
  *
111
  * @since 1.0
 
112
  * @access public
113
+ *
114
  * @return int
115
  */
116
+ public function get_optimization_level() {
117
+ return -1;
118
+ }
119
+
120
  /**
121
  * Get the attachment optimization level label.
122
  *
123
  * @since 1.2
 
124
  * @access public
125
+ *
126
  * @return string
127
  */
128
  public function get_optimization_level_label() {
129
  $label = '';
130
  $level = $this->get_optimization_level();
131
+
132
+ switch ( $level ) {
133
  case 2:
134
  $label = __( 'Ultra', 'imagify' );
135
+ break;
136
  case 1:
137
  $label = __( 'Aggressive', 'imagify' );
138
+ break;
139
  case 0:
140
  $label = __( 'Normal', 'imagify' );
 
141
  }
142
 
143
  return $label;
147
  * Count number of optimized sizes.
148
  *
149
  * @since 1.0
 
150
  * @access public
151
+ *
152
  * @return int
153
  */
154
  public function get_optimized_sizes_count() {
156
  $sizes = (array) $data['sizes'];
157
  $count = 0;
158
 
159
+ unset( $sizes['full'] );
 
 
160
 
161
  foreach ( $sizes as $size ) {
162
  if ( $size['success'] ) {
164
  }
165
  }
166
 
167
+ return $count;
168
  }
169
 
170
  /**
171
  * Get the attachment optimization status (success or error).
172
  *
173
  * @since 1.0
 
174
  * @access public
175
+ *
176
  * @return string
177
  */
178
+ public function get_status() {
179
+ return '';
180
+ }
181
 
182
  /**
183
  * Get the original attachment path.
184
  *
185
  * @since 1.0
 
186
  * @access public
187
+ *
188
  * @return string
189
  */
190
+ public function get_original_path() {
191
+ return '';
192
+ }
193
 
194
  /**
195
  * Get the original attachment size.
196
  *
197
  * @since 1.0
 
198
  * @access public
199
+ *
200
+ * @param bool $human_format True to display the image human format size (1Mb).
201
  * @return string
202
  */
203
  public function get_original_size( $human_format = true ) {
204
+ $filesystem = imagify_get_filesystem();
205
  $original_size = $this->get_size_data( 'full', 'original_size' );
206
+ $original_size = empty( $original_size ) ? $filesystem->size( $this->get_original_path() ) : (int) $original_size;
207
+
208
  if ( true === $human_format ) {
209
+ $original_size = @size_format( $original_size, 2 );
210
  }
211
+
212
  return $original_size;
213
  }
214
 
216
  * Get the original attachment URL.
217
  *
218
  * @since 1.0
 
219
  * @access public
220
+ *
221
  * @return string
222
  */
223
+ public function get_original_url() {
224
+ return '';
225
+ }
226
 
227
+ /**
228
  * Get the statistics of a specific size.
229
  *
230
  * @since 1.0
 
231
  * @access public
232
+ *
233
+ * @param string $size The thumbnail slug.
234
+ * @param string $key The specific data slug.
235
  * @return array|string
236
  */
237
  public function get_size_data( $size = 'full', $key = '' ) {
248
 
249
  return $stats;
250
  }
251
+
252
  /**
253
  * Get the global statistics data or a specific one.
254
  *
255
  * @since 1.0
 
256
  * @access public
257
+ *
258
+ * @param string $key The specific data slug.
259
  * @return array|string
260
  */
261
  public function get_stats_data( $key = '' ) {
277
  * Check if the attachment is already optimized (before Imagify).
278
  *
279
  * @since 1.1.6
 
280
  * @access public
281
+ *
282
+ * @return bool True if the attachment is optimized.
283
  */
284
  public function is_already_optimized() {
285
+ return 'already_optimized' === $this->get_status();
286
  }
287
+
288
  /**
289
  * Check if the attachment is optimized.
290
  *
291
  * @since 1.0
 
292
  * @access public
293
+ *
294
+ * @return bool True if the attachment is optimized.
295
  */
296
  public function is_optimized() {
297
+ return 'success' === $this->get_status();
298
  }
299
 
300
  /**
301
  * Check if the attachment exceeding the limit size (> 5mo).
302
  *
303
  * @since 1.0
 
304
  * @access public
305
+ *
306
+ * @return bool True if the attachment is skipped.
307
  */
308
  public function is_exceeded() {
309
  $filepath = $this->get_original_path();
313
  $size = filesize( $filepath );
314
  }
315
 
316
+ return $size > IMAGIFY_MAX_BYTES;
317
  }
318
 
319
  /**
320
  * Check if the attachment has a backup of the original size.
321
  *
322
  * @since 1.0
 
323
  * @access public
324
+ *
325
+ * @return bool True if the attachment has a backup.
326
  */
327
  public function has_backup() {
328
  return (bool) $this->get_backup_path();
332
  * Check if the attachment has an error.
333
  *
334
  * @since 1.0
 
335
  * @access public
336
+ *
337
+ * @return bool True if the attachment has an error.
338
  */
339
  public function has_error() {
340
  $has_error = $this->get_size_data( 'full', 'error' );
341
+ return is_string( $has_error );
342
  }
343
+
344
  /**
345
  * Update the metadata size of the attachment
346
  *
347
  * @since 1.2
 
348
  * @access public
349
+ *
350
  * @return void
351
  */
352
  public function update_metadata_size() {}
355
  * Delete the backup file.
356
  *
357
  * @since 1.0
 
358
  * @access public
359
+ *
360
  * @return void
361
  */
362
  public function delete_backup() {
363
  $backup_path = $this->get_backup_path();
364
 
365
  if ( ! empty( $backup_path ) ) {
366
+ imagify_get_filesystem()->delete( $backup_path );
367
  }
368
  }
369
 
370
  /**
371
+ * Fills statistics data with values from $data array.
372
  *
373
  * @since 1.0
374
+ * @since 1.6.5 Not static anymore.
375
  * @access public
376
+ *
377
+ * @param array $data The statistics data.
378
+ * @param object $response The API response.
379
+ * @param int $id The attachment ID.
380
+ * @param int $url The attachment URL.
381
+ * @param string $size The attachment size key.
382
+ * @return bool|array False if the original size has an error or an array contains the data for other result.
383
  */
384
+ public function fill_data( $data, $response, $id, $url, $size = 'full' ) {
385
+ return array();
386
+ }
387
 
388
  /**
389
  * Optimize all sizes with Imagify.
390
  *
391
  * @since 1.0
 
392
  * @access public
393
+ *
394
+ * @param int $optimization_level The optimization level (2=ultra, 1=aggressive, 0=normal).
395
+ * @param array $metadata The attachment meta data.
396
+ * @return array $optimized_data The optimization data.
397
  */
398
+ public function optimize( $optimization_level = null, $metadata = array() ) {
399
+ return array();
400
+ }
401
 
402
  /**
403
  * Process an attachment restoration from the backup file.
404
  *
405
  * @since 1.0
 
406
  * @access public
407
+ *
408
  * @return void
409
  */
410
  public function restore() {}
411
 
412
+ /**
413
+ * Resize an image if bigger than the maximum width defined in the settings.
414
+ *
415
+ * @since 1.5.7
416
+ * @author Remy Perona
417
+ *
418
+ * @param string $attachment_path Path to the image.
419
+ * @param array $attachment_sizes Array of original image dimensions.
420
+ * @param int $max_width Maximum width defined in the settings.
421
+ * @return string Path the the resized image or the original image if the resize failed.
422
+ */
423
+ public function resize( $attachment_path, $attachment_sizes, $max_width ) {
424
+ // Prevent removal of the exif/meta data when resizing (only works with Imagick).
425
+ add_filter( 'image_strip_meta', '__return_false' );
426
+
427
+ $new_sizes = wp_constrain_dimensions( $attachment_sizes[0], $attachment_sizes[1], $max_width );
428
+ $editor = wp_get_image_editor( $attachment_path );
429
+
430
+ if ( is_wp_error( $editor ) ) {
431
+ return $editor;
432
+ }
433
+
434
+ $image_type = pathinfo( $attachment_path, PATHINFO_EXTENSION );
435
+
436
+ // Try to correct for auto-rotation if the info is available.
437
+ if ( function_exists( 'exif_read_data' ) && ( 'jpg' === $image_type || 'jpeg' === $image_type) ) {
438
+ $exif = @exif_read_data( $attachment_path );
439
+ $orientation = is_array( $exif ) && array_key_exists( 'Orientation', $exif ) ? $exif['Orientation'] : 0;
440
+
441
+ switch ( $orientation ) {
442
+ case 3:
443
+ $editor->rotate( 180 );
444
+ break;
445
+ case 6:
446
+ $editor->rotate( -90 );
447
+ break;
448
+ case 8:
449
+ $editor->rotate( 90 );
450
+ }
451
+ }
452
+
453
+ $resized = $editor->resize( $new_sizes[0], $new_sizes[1], false );
454
+
455
+ if ( is_wp_error( $resized ) ) {
456
+ return $resized;
457
+ }
458
+
459
+ $resized_image_path = $editor->generate_filename( 'imagifyresized' );
460
+ $resized_image_saved = $editor->save( $resized_image_path );
461
+
462
+ if ( is_wp_error( $resized_image_saved ) ) {
463
+ return $resized_image_saved;
464
+ }
465
+
466
+ // Remove the filter when we're done to prevent any conflict.
467
+ remove_filter( 'image_strip_meta', '__return_false' );
468
+
469
+ return $resized_image_path;
470
+ }
471
+ }
 
 
 
inc/classes/abstracts/{abstract-db.php → class-imagify-abstract-db.php} RENAMED
@@ -1,51 +1,89 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  /**
5
- * DB base class
6
  *
7
  * @source https://gist.github.com/pippinsplugins/e220a7f0f0f2fbe64608
8
  * @since 1.5
9
- */
10
  abstract class Imagify_Abstract_DB {
11
 
12
  /**
13
- * The name of our database table
14
  *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  * @access public
16
  * @since 1.5
17
  */
18
  public $table_name;
19
 
20
  /**
21
- * The version of our database table
22
  *
 
23
  * @access public
24
  * @since 1.5
25
  */
26
  public $version;
27
 
28
  /**
29
- * The name of the primary column
30
  *
 
31
  * @access public
32
  * @since 1.5
33
  */
34
  public $primary_key;
35
-
36
  /**
37
- * Get things started
38
  *
39
  * @access public
40
  * @since 1.5
41
  */
42
- public function __construct() {}
43
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  /**
45
- * Whitelist of columns
46
  *
47
  * @access public
48
  * @since 1.5
 
49
  * @return array
50
  */
51
  public function get_columns() {
@@ -53,10 +91,11 @@ abstract class Imagify_Abstract_DB {
53
  }
54
 
55
  /**
56
- * Default column values
57
  *
58
  * @access public
59
  * @since 1.5
 
60
  * @return array
61
  */
62
  public function get_column_defaults() {
@@ -64,164 +103,177 @@ abstract class Imagify_Abstract_DB {
64
  }
65
 
66
  /**
67
- * Retrieve a row by the primary key
68
  *
69
  * @access public
70
  * @since 1.5
71
- * @return object
 
 
72
  */
73
  public function get( $row_id ) {
74
  global $wpdb;
75
- return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ), ARRAY_A );
76
  }
77
 
78
  /**
79
- * Retrieve a row by a specific column / value
80
  *
81
  * @access public
82
  * @since 1.5
83
- * @return object
 
 
 
84
  */
85
  public function get_by( $column, $row_id ) {
86
  global $wpdb;
87
  $column = esc_sql( $column );
88
- return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ), ARRAY_A );
89
  }
90
 
91
  /**
92
- * Retrieve a specific column's value by the primary key
93
  *
94
  * @access public
95
  * @since 1.5
96
- * @return string
 
 
 
97
  */
98
  public function get_column( $column, $row_id ) {
99
  global $wpdb;
100
  $column = esc_sql( $column );
101
- return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
102
  }
103
 
104
  /**
105
- * Retrieve a specific column's value by the the specified column / value
106
  *
107
  * @access public
108
  * @since 1.5
109
- * @return string
 
 
 
 
110
  */
111
  public function get_column_by( $column, $column_where, $column_value ) {
112
  global $wpdb;
113
- $column_where = esc_sql( $column_where );
114
  $column = esc_sql( $column );
115
- return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
 
116
  }
117
 
118
  /**
119
- * Insert a new row
120
  *
121
  * @access public
122
  * @since 1.5
123
- * @return int
 
 
124
  */
125
  public function insert( $data ) {
126
  global $wpdb;
127
 
128
- // Set default values
129
  $data = wp_parse_args( $data, $this->get_column_defaults() );
130
 
131
- // Initialise column format array
132
  $column_formats = $this->get_columns();
133
 
134
- // Force fields to lower case
135
  $data = array_change_key_case( $data );
136
 
137
- // White list columns
138
  $data = array_intersect_key( $data, $column_formats );
139
 
140
- // Reorder $column_formats to match the order of columns given in $data
141
- $data_keys = array_keys( $data );
142
  $column_formats = array_merge( array_flip( $data_keys ), $column_formats );
143
-
144
  $wpdb->insert( $this->table_name, $data, $column_formats );
145
 
146
  return $wpdb->insert_id;
147
  }
148
 
149
  /**
150
- * Update a row
151
  *
152
  * @access public
153
  * @since 1.5
154
- * @return bool
 
 
 
 
155
  */
156
  public function update( $row_id, $data = array(), $where = '' ) {
157
  global $wpdb;
158
 
159
- // Row ID must be positive integer
160
  $row_id = absint( $row_id );
161
 
162
- if( empty( $row_id ) ) {
163
  return false;
164
  }
165
 
166
- if( empty( $where ) ) {
167
  $where = $this->primary_key;
168
  }
169
 
170
- // Initialise column format array
171
  $column_formats = $this->get_columns();
172
 
173
- // Force fields to lower case
174
  $data = array_change_key_case( $data );
175
 
176
- // White list columns
177
  $data = array_intersect_key( $data, $column_formats );
178
 
179
- // Reorder $column_formats to match the order of columns given in $data
180
- $data_keys = array_keys( $data );
181
  $column_formats = array_merge( array_flip( $data_keys ), $column_formats );
182
-
183
  if ( false === (bool) $this->get_column( $this->primary_key, $row_id ) ) {
184
  $this->insert( $data );
185
  return true;
186
  }
187
-
188
- if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
189
- return false;
190
- }
191
 
192
- return true;
193
  }
194
 
195
  /**
196
- * Delete a row identified by the primary key
197
  *
198
  * @access public
199
  * @since 1.5
200
- * @return bool
 
 
201
  */
202
  public function delete( $row_id = 0 ) {
203
  global $wpdb;
204
 
205
- // Row ID must be positive integer
206
  $row_id = absint( $row_id );
207
 
208
- if( empty( $row_id ) ) {
209
  return false;
210
  }
211
 
212
- if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
213
- return false;
214
- }
215
-
216
- return true;
217
  }
218
 
219
  /**
220
- * Check if the given table exists
221
  *
222
  * @since 1.5
223
- * @param string $table The table name
224
- * @return bool If the table name exists
 
225
  */
226
  public function table_exists( $table ) {
227
  global $wpdb;
@@ -230,4 +282,4 @@ abstract class Imagify_Abstract_DB {
230
  return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
231
  }
232
 
233
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  /**
5
+ * Imagify DB base class.
6
  *
7
  * @source https://gist.github.com/pippinsplugins/e220a7f0f0f2fbe64608
8
  * @since 1.5
9
+ */
10
  abstract class Imagify_Abstract_DB {
11
 
12
  /**
13
+ * Class version.
14
  *
15
+ * @var string
16
+ */
17
+ const VERSION = '1.0.1';
18
+
19
+ /**
20
+ * The single instance of the class.
21
+ *
22
+ * @access protected
23
+ * @since 1.5
24
+ *
25
+ * @var object
26
+ */
27
+ protected static $_instance;
28
+
29
+ /**
30
+ * The name of our database table.
31
+ *
32
+ * @var string
33
  * @access public
34
  * @since 1.5
35
  */
36
  public $table_name;
37
 
38
  /**
39
+ * The version of our database table.
40
  *
41
+ * @var string
42
  * @access public
43
  * @since 1.5
44
  */
45
  public $version;
46
 
47
  /**
48
+ * The name of the primary column.
49
  *
50
+ * @var string
51
  * @access public
52
  * @since 1.5
53
  */
54
  public $primary_key;
55
+
56
  /**
57
+ * Get things started.
58
  *
59
  * @access public
60
  * @since 1.5
61
  */
62
+ protected function __construct() {}
63
+
64
+ /**
65
+ * Get the main Instance.
66
+ *
67
+ * @access public
68
+ * @since 1.6.5
69
+ * @author Grégory Viguier
70
+ *
71
+ * @return object Main instance.
72
+ */
73
+ public static function get_instance() {
74
+ if ( ! isset( self::$_instance ) ) {
75
+ self::$_instance = new self();
76
+ }
77
+
78
+ return self::$_instance;
79
+ }
80
+
81
  /**
82
+ * Whitelist of columns.
83
  *
84
  * @access public
85
  * @since 1.5
86
+ *
87
  * @return array
88
  */
89
  public function get_columns() {
91
  }
92
 
93
  /**
94
+ * Default column values.
95
  *
96
  * @access public
97
  * @since 1.5
98
+ *
99
  * @return array
100
  */
101
  public function get_column_defaults() {
103
  }
104
 
105
  /**
106
+ * Retrieve a row by the primary key.
107
  *
108
  * @access public
109
  * @since 1.5
110
+ *
111
+ * @param string $row_id A primary key.
112
+ * @return object
113
  */
114
  public function get( $row_id ) {
115
  global $wpdb;
116
+ return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ), ARRAY_A ); // WPCS: unprepared SQL ok.
117
  }
118
 
119
  /**
120
+ * Retrieve a row by a specific column / value.
121
  *
122
  * @access public
123
  * @since 1.5
124
+ *
125
+ * @param string $column A column name.
126
+ * @param string $row_id A value.
127
+ * @return object
128
  */
129
  public function get_by( $column, $row_id ) {
130
  global $wpdb;
131
  $column = esc_sql( $column );
132
+ return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ), ARRAY_A ); // WPCS: unprepared SQL ok.
133
  }
134
 
135
  /**
136
+ * Retrieve a specific column's value by the primary key.
137
  *
138
  * @access public
139
  * @since 1.5
140
+ *
141
+ * @param string $column A column name.
142
+ * @param string $row_id A primary key.
143
+ * @return string
144
  */
145
  public function get_column( $column, $row_id ) {
146
  global $wpdb;
147
  $column = esc_sql( $column );
148
+ return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); // WPCS: unprepared SQL ok.
149
  }
150
 
151
  /**
152
+ * Retrieve a specific column's value by the the specified column / value.
153
  *
154
  * @access public
155
  * @since 1.5
156
+ *
157
+ * @param string $column A column name.
158
+ * @param string $column_where A column name.
159
+ * @param string $column_value A value.
160
+ * @return string
161
  */
162
  public function get_column_by( $column, $column_where, $column_value ) {
163
  global $wpdb;
 
164
  $column = esc_sql( $column );
165
+ $column_where = esc_sql( $column_where );
166
+ return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) ); // WPCS: unprepared SQL ok.
167
  }
168
 
169
  /**
170
+ * Insert a new row.
171
  *
172
  * @access public
173
  * @since 1.5
174
+ *
175
+ * @param string $data New data.
176
+ * @return int
177
  */
178
  public function insert( $data ) {
179
  global $wpdb;
180
 
181
+ // Set default values.
182
  $data = wp_parse_args( $data, $this->get_column_defaults() );
183
 
184
+ // Initialise column format array.
185
  $column_formats = $this->get_columns();
186
 
187
+ // Force fields to lower case.
188
  $data = array_change_key_case( $data );
189
 
190
+ // White list columns.
191
  $data = array_intersect_key( $data, $column_formats );
192
 
193
+ // Reorder $column_formats to match the order of columns given in $data.
194
+ $data_keys = array_keys( $data );
195
  $column_formats = array_merge( array_flip( $data_keys ), $column_formats );
196
+
197
  $wpdb->insert( $this->table_name, $data, $column_formats );
198
 
199
  return $wpdb->insert_id;
200
  }
201
 
202
  /**
203
+ * Update a row.
204
  *
205
  * @access public
206
  * @since 1.5
207
+ *
208
+ * @param string $row_id A primary key.
209
+ * @param array $data New data.
210
+ * @param string $where A column name.
211
+ * @return bool
212
  */
213
  public function update( $row_id, $data = array(), $where = '' ) {
214
  global $wpdb;
215
 
216
+ // Row ID must be positive integer.
217
  $row_id = absint( $row_id );
218
 
219
+ if ( ! $row_id ) {
220
  return false;
221
  }
222
 
223
+ if ( empty( $where ) ) {
224
  $where = $this->primary_key;
225
  }
226
 
227
+ // Initialise column format array.
228
  $column_formats = $this->get_columns();
229
 
230
+ // Force fields to lower case.
231
  $data = array_change_key_case( $data );
232
 
233
+ // White list columns.
234
  $data = array_intersect_key( $data, $column_formats );
235
 
236
+ // Reorder $column_formats to match the order of columns given in $data.
237
+ $data_keys = array_keys( $data );
238
  $column_formats = array_merge( array_flip( $data_keys ), $column_formats );
239
+
240
  if ( false === (bool) $this->get_column( $this->primary_key, $row_id ) ) {
241
  $this->insert( $data );
242
  return true;
243
  }
 
 
 
 
244
 
245
+ return (bool) $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats );
246
  }
247
 
248
  /**
249
+ * Delete a row identified by the primary key.
250
  *
251
  * @access public
252
  * @since 1.5
253
+ *
254
+ * @param string $row_id A primary key.
255
+ * @return bool
256
  */
257
  public function delete( $row_id = 0 ) {
258
  global $wpdb;
259
 
260
+ // Row ID must be positive integer.
261
  $row_id = absint( $row_id );
262
 
263
+ if ( ! $row_id ) {
264
  return false;
265
  }
266
 
267
+ return (bool) $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ); // WPCS: unprepared SQL ok.
 
 
 
 
268
  }
269
 
270
  /**
271
+ * Check if the given table exists.
272
  *
273
  * @since 1.5
274
+ *
275
+ * @param string $table The table name.
276
+ * @return bool True if the table name exists.
277
  */
278
  public function table_exists( $table ) {
279
  global $wpdb;
282
  return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
283
  }
284
 
285
+ }
inc/classes/class-attachment.php DELETED
@@ -1,408 +0,0 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
-
4
- class Imagify_Attachment extends Imagify_Abstract_Attachment {
5
- /**
6
- * The constructor
7
- *
8
- * @since 1.0
9
- *
10
- * @return void
11
- **/
12
- function __construct( $id = 0 ) {
13
- global $post;
14
-
15
- if ( is_object( $post ) && ! $id ) {
16
- $this->id = $post->ID;
17
- } else {
18
- $this->id = (int) $id;
19
- }
20
- }
21
-
22
- /**
23
- * Get the attachment backup filepath.
24
- *
25
- * @since 1.0
26
- *
27
- * @access public
28
- * @return string|false
29
- */
30
- public function get_backup_path() {
31
- $file_path = $this->get_original_path();
32
- $backup_path = get_imagify_attachment_backup_path( $file_path );
33
-
34
- if( file_exists( $backup_path ) ) {
35
- return $backup_path;
36
- }
37
-
38
- return false;
39
- }
40
-
41
- /**
42
- * Get the attachment optimization data.
43
- *
44
- * @since 1.0
45
- *
46
- * @access public
47
- * @return array
48
- */
49
- public function get_data() {
50
- return get_post_meta( $this->id, '_imagify_data', true );
51
- }
52
-
53
- /**
54
- * Get the attachment optimization level.
55
- *
56
- * @since 1.0
57
- *
58
- * @access public
59
- * @return int
60
- */
61
- public function get_optimization_level() {
62
- return get_post_meta( $this->id, '_imagify_optimization_level', true );
63
- }
64
-
65
- /**
66
- * Get the attachment optimization status (success or error).
67
- *
68
- * @since 1.0
69
- *
70
- * @access public
71
- * @return string
72
- */
73
- public function get_status() {
74
- return get_post_meta( $this->id, '_imagify_status', true );
75
- }
76
-
77
- /**
78
- * Get the original attachment path.
79
- *
80
- * @since 1.0
81
- *
82
- * @access public
83
- * @return string
84
- */
85
- public function get_original_path() {
86
- return get_attached_file( $this->id );
87
- }
88
-
89
- /**
90
- * Get the original attachment URL.
91
- *
92
- * @since 1.0
93
- *
94
- * @access public
95
- * @return string
96
- */
97
- public function get_original_url() {
98
- return wp_get_attachment_url( $this->id );
99
- }
100
-
101
- /**
102
- * Update the metadata size of the attachment
103
- *
104
- * @since 1.2
105
- *
106
- * @access public
107
- * @return void
108
- */
109
- public function update_metadata_size() {
110
- if ( ! wp_attachment_is_image( $this->id ) ) {
111
- return false;
112
- }
113
-
114
- $size = @getimagesize( $this->get_original_path() );
115
-
116
- if ( isset( $size[0], $size[1] ) ) {
117
- $metadata = wp_get_attachment_metadata( $this->id );
118
- $metadata['width'] = $size[0];
119
- $metadata['height'] = $size[1];
120
-
121
- wp_update_attachment_metadata( $this->id, $metadata );
122
- }
123
- }
124
-
125
- /**
126
- * Fills statistics data with values from $data array
127
- *
128
- * @since 1.0
129
- *
130
- * @access public
131
- * @static
132
- * @param array $data The statistics data
133
- * @param object $response The API response
134
- * @param int $id The attachment ID
135
- * @param int $url The attachment URL
136
- * @param string $size The attachment size key
137
- * @return bool|array False if the original size has an error or an array contains the data for other result
138
- */
139
- static public function fill_data( $data, $response, $id, $url, $size = 'full' ) {
140
- if ( is_wp_error( $response ) ) {
141
- $error = $response->get_error_message();
142
- $error_status = 'error';
143
-
144
- $data['sizes'][ $size ] = array(
145
- 'success' => false,
146
- 'error' => $error
147
- );
148
-
149
- // Update the error status for the original size
150
- if ( 'full' === $size ) {
151
- update_post_meta( $id, '_imagify_data', $data );
152
-
153
- if ( false !== strpos( $error, 'This image is already compressed' ) ) {
154
- $error_status = 'already_optimized';
155
- }
156
-
157
- update_post_meta( $id, '_imagify_status', $error_status );
158
-
159
- return false;
160
- }
161
- } else {
162
- $data['sizes'][ $size ] = array(
163
- 'success' => true,
164
- 'file_url' => $url,
165
- 'original_size' => $response->original_size,
166
- 'optimized_size' => $response->new_size,
167
- 'percent' => $response->percent
168
- );
169
-
170
- $data['stats']['original_size'] += ( isset( $response->original_size ) ) ? $response->original_size : 0;
171
- $data['stats']['optimized_size'] += ( isset( $response->new_size ) ) ? $response->new_size : 0;
172
- }
173
-
174
- return $data;
175
- }
176
-
177
- /**
178
- * Optimize all sizes with Imagify.
179
- *
180
- * @since 1.0
181
- *
182
- * @access public
183
- * @param int $optimization_level The optimization level (2=ultra, 1=aggressive, 0=normal)
184
- * @param array $metadata The attachment meta data
185
- * @return array $optimized_data The optimization data
186
- */
187
- public function optimize( $optimization_level = null, $metadata = array() ) {
188
- $optimization_level = ( is_null( $optimization_level ) ) ? (int) get_imagify_option( 'optimization_level', 1 ) : (int) $optimization_level;
189
-
190
- $id = $this->id;
191
- $metadata = ( (bool) $metadata ) ? $metadata : wp_get_attachment_metadata( $id );
192
- $sizes = ( isset( $metadata['sizes'] ) ) ? (array) $metadata['sizes'] : array();
193
- $data = array(
194
- 'stats' => array(
195
- 'original_size' => 0,
196
- 'optimized_size' => 0,
197
- 'percent' => 0,
198
- )
199
- );
200
-
201
- // To avoid issue with "original_size" at 0 in "_imagify_data"
202
- if ( 0 === $this->get_stats_data( 'original_size' ) ) {
203
- delete_post_meta( $id, '_imagify_data' );
204
- delete_post_meta( $id, '_imagify_status' );
205
- delete_post_meta( $id, '_imagify_optimization_level' );
206
- }
207
-
208
- // Get file path & URL for original image
209
- $attachment_path = $this->get_original_path();
210
- $attachment_url = $this->get_original_url();
211
- $attachment_original_size = $this->get_original_size( false );
212
-
213
- // Check if the attachment extension is allowed
214
- if ( ! $id || ! wp_attachment_is_image( $id ) ) {
215
- return;
216
- }
217
-
218
- // Check if the full size is already optimized
219
- if ( $this->is_optimized() && ( $this->get_optimization_level() == $optimization_level ) ) {
220
- return;
221
- }
222
-
223
- /**
224
- * Fires before optimizing an attachment.
225
- *
226
- * @since 1.0
227
- *
228
- * @param int $id The attachment ID
229
- */
230
- do_action( 'before_imagify_optimize_attachment', $id );
231
-
232
- set_transient( 'imagify-async-in-progress-' . $id, true, 10 * MINUTE_IN_SECONDS );
233
-
234
- // Get the resize values for the original size
235
- $resized = false;
236
- $do_resize = get_imagify_option( 'resize_larger', false );
237
- $resize_width = get_imagify_option( 'resize_larger_w' );
238
- $attachment_size = @getimagesize( $attachment_path );
239
-
240
- if ( $do_resize && isset( $attachment_size[0] ) && $resize_width < $attachment_size[0] ) {
241
- $resized_attachment_path = $this->resize( $attachment_path, $attachment_size, $resize_width );
242
-
243
- if ( ! is_wp_error( $resized_attachment_path ) ) {
244
- if ( get_imagify_option( 'backup', false ) ) {
245
- $backup_path = get_imagify_attachment_backup_path( $attachment_path );
246
- $backup_path_info = pathinfo( $backup_path );
247
-
248
- wp_mkdir_p( $backup_path_info['dirname'] );
249
-
250
- // TO DO - check and send a error message if the backup can't be created
251
- @copy( $attachment_path, $backup_path );
252
- imagify_chmod_file( $backup_path );
253
- }
254
-
255
- @rename( $resized_attachment_path, $attachment_path );
256
- imagify_chmod_file( $attachment_path );
257
-
258
- // If resized temp file still exists, delete it
259
- if ( file_exists( $resized_attachment_path ) ) {
260
- unlink( $resized_attachment_path );
261
- }
262
-
263
- $resized = true;
264
- }
265
- }
266
-
267
- // Optimize the original size
268
- $response = do_imagify( $attachment_path, array(
269
- 'optimization_level' => $optimization_level,
270
- 'context' => 'wp',
271
- 'resized' => $resized,
272
- 'original_size' => $attachment_original_size,
273
- ) );
274
- $data = $this->fill_data( $data, $response, $id, $attachment_url );
275
-
276
- // Save the optimization level
277
- update_post_meta( $id, '_imagify_optimization_level', $optimization_level );
278
-
279
- if ( (bool) ! $data ) {
280
- delete_transient( 'imagify-async-in-progress-' . $id );
281
- return;
282
- }
283
-
284
- // If we resized the original with success, we have to update the attachment metadata
285
- // If not, WordPress keeps the old attachment size.
286
- if ( $do_resize && $resized ) {
287
- $this->update_metadata_size();
288
- }
289
-
290
- // Optimize all thumbnails
291
- if ( (bool) $sizes ) {
292
- foreach ( $sizes as $size_key => $size_data ) {
293
- // Check if this size has to be optimized
294
- if ( array_key_exists( $size_key, get_imagify_option( 'disallowed-sizes', array() ) ) && ! imagify_is_active_for_network() ) {
295
- $data['sizes'][ $size_key ] = array(
296
- 'success' => false,
297
- 'error' => __( 'This size isn\'t authorized to be optimized. Update your Imagify settings if you want to optimize it.', 'imagify' )
298
- );
299
- continue;
300
- }
301
-
302
- $thumbnail_path = trailingslashit( dirname( $attachment_path ) ) . $size_data['file'];
303
- $thumbnail_url = trailingslashit( dirname( $attachment_url ) ) . $size_data['file'];
304
-
305
- // Optimize the thumbnail size
306
- $response = do_imagify( $thumbnail_path, array(
307
- 'backup' => false,
308
- 'optimization_level' => $optimization_level,
309
- 'context' => 'wp'
310
- ) );
311
- $data = $this->fill_data( $data, $response, $id, $thumbnail_url, $size_key );
312
-
313
- /**
314
- * Filter the optimization data of a specific thumbnail
315
- *
316
- * @since 1.0
317
- *
318
- * @param array $data The statistics data
319
- * @param object $response The API response
320
- * @param int $id The attachment ID
321
- * @param string $thumbnail_path The attachment path
322
- * @param string $thumbnail_url The attachment URL
323
- * @param string $size_key The attachment size key
324
- * @param bool $is_aggressive The optimization level
325
- * @return array $data The new optimization data
326
- */
327
- $data = apply_filters( 'imagify_fill_thumbnail_data', $data, $response, $id, $thumbnail_path, $thumbnail_url, $size_key, $optimization_level );
328
- }
329
- }
330
-
331
- $data['stats']['percent'] = round( ( ( $data['stats']['original_size'] - $data['stats']['optimized_size'] ) / $data['stats']['original_size'] ) * 100, 2 );
332
-
333
- update_post_meta( $id, '_imagify_data', $data );
334
- update_post_meta( $id, '_imagify_status', 'success' );
335
-
336
- $optimized_data = $this->get_data();
337
-
338
- /**
339
- * Fires after optimizing an attachment.
340
- *
341
- * @since 1.0
342
- *
343
- * @param int $id The attachment ID
344
- * @param array $optimized_data The optimization data
345
- */
346
- do_action( 'after_imagify_optimize_attachment', $id, $optimized_data );
347
-
348
- delete_transient( 'imagify-async-in-progress-' . $id );
349
-
350
- return $optimized_data;
351
- }
352
-
353
- /**
354
- * Process an attachment restoration from the backup file.
355
- *
356
- * @since 1.0
357
- *
358
- * @access public
359
- * @return void
360
- */
361
- public function restore() {
362
- // Stop the process if there is no backup file to restore
363
- if ( ! $this->has_backup() ) {
364
- return;
365
- }
366
-
367
- $id = $this->id;
368
- $backup_path = $this->get_backup_path();
369
- $attachment_path = $this->get_original_path();
370
-
371
- /**
372
- * Fires before restoring an attachment.
373
- *
374
- * @since 1.0
375
- *
376
- * @param int $id The attachment ID
377
- */
378
- do_action( 'before_imagify_restore_attachment', $id );
379
-
380
- // Create the original image from the backup
381
- @copy( $backup_path, $attachment_path );
382
- imagify_chmod_file( $attachment_path );
383
-
384
- if ( ! function_exists( 'wp_generate_attachment_metadata' ) ) {
385
- require_once( ABSPATH . 'wp-admin/includes/image.php' );
386
- }
387
-
388
- remove_filter( 'wp_generate_attachment_metadata', '_imagify_optimize_attachment', PHP_INT_MAX );
389
- wp_generate_attachment_metadata( $id, $attachment_path );
390
-
391
- // Remove old optimization data
392
- delete_post_meta( $id, '_imagify_data' );
393
- delete_post_meta( $id, '_imagify_status' );
394
- delete_post_meta( $id, '_imagify_optimization_level' );
395
-
396
- // Restore the original size in the metadata
397
- $this->update_metadata_size();
398
-
399
- /**
400
- * Fires after restoring an attachment.
401
- *
402
- * @since 1.0
403
- *
404
- * @param int $id The attachment ID
405
- */
406
- do_action( 'after_imagify_restore_attachment', $id );
407
- }
408
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/classes/class-imagify-attachment.php ADDED
@@ -0,0 +1,436 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
+
4
+ /**
5
+ * Imagify Attachment class.
6
+ *
7
+ * @since 1.0
8
+ */
9
+ class Imagify_Attachment extends Imagify_Abstract_Attachment {
10
+
11
+ /**
12
+ * Class version.
13
+ *
14
+ * @var string
15
+ */
16
+ const VERSION = '1.0.1';
17
+
18
+ /**
19
+ * The constructor
20
+ *
21
+ * @since 1.0
22
+ *
23
+ * @param int $id The attachment ID.
24
+ * @return void
25
+ */
26
+ public function __construct( $id = 0 ) {
27
+ global $post;
28
+
29
+ if ( is_object( $post ) && ! $id ) {
30
+ $this->id = $post->ID;
31
+ } else {
32
+ $this->id = (int) $id;
33
+ }
34
+ }
35
+
36
+ /**
37
+ * Get the attachment backup filepath.
38
+ *
39
+ * @since 1.0
40
+ * @access public
41
+ *
42
+ * @return string|bool
43
+ */
44
+ public function get_backup_path() {
45
+ $file_path = $this->get_original_path();
46
+ $backup_path = get_imagify_attachment_backup_path( $file_path );
47
+
48
+ if ( file_exists( $backup_path ) ) {
49
+ return $backup_path;
50
+ }
51
+
52
+ return false;
53
+ }
54
+
55
+ /**
56
+ * Get the attachment optimization data.
57
+ *
58
+ * @since 1.0
59
+ * @access public
60
+ *
61
+ * @return array
62
+ */
63
+ public function get_data() {
64
+ $data = get_post_meta( $this->id, '_imagify_data', true );
65
+ return is_array( $data ) ? $data : array();
66
+ }
67
+
68
+ /**
69
+ * Get the attachment optimization level.
70
+ *
71
+ * @since 1.0
72
+ * @access public
73
+ *
74
+ * @return int
75
+ */
76
+ public function get_optimization_level() {
77
+ return (int) get_post_meta( $this->id, '_imagify_optimization_level', true );
78
+ }
79
+
80
+ /**
81
+ * Get the attachment optimization status (success or error).
82
+ *
83
+ * @since 1.0
84
+ * @access public
85
+ *
86
+ * @return string
87
+ */
88
+ public function get_status() {
89
+ $status = get_post_meta( $this->id, '_imagify_status', true );
90
+ return is_string( $status ) ? $status : '';
91
+ }
92
+
93
+ /**
94
+ * Get the original attachment path.
95
+ *
96
+ * @since 1.0
97
+ * @access public
98
+ *
99
+ * @return string
100
+ */
101
+ public function get_original_path() {
102
+ return get_attached_file( $this->id );
103
+ }
104
+
105
+ /**
106
+ * Get the original attachment URL.
107
+ *
108
+ * @since 1.0
109
+ * @access public
110
+ *
111
+ * @return string
112
+ */
113
+ public function get_original_url() {
114
+ return wp_get_attachment_url( $this->id );
115
+ }
116
+
117
+ /**
118
+ * Update the metadata size of the attachment.
119
+ *
120
+ * @since 1.2
121
+ * @access public
122
+ *
123
+ * @return bool
124
+ */
125
+ public function update_metadata_size() {
126
+ if ( ! wp_attachment_is_image( $this->id ) ) {
127
+ return false;
128
+ }
129
+
130
+ $size = @getimagesize( $this->get_original_path() );
131
+
132
+ if ( ! isset( $size[0], $size[1] ) ) {
133
+ return false;
134
+ }
135
+
136
+ $metadata = wp_get_attachment_metadata( $this->id );
137
+ $metadata['width'] = $size[0];
138
+ $metadata['height'] = $size[1];
139
+
140
+ wp_update_attachment_metadata( $this->id, $metadata );
141
+ return true;
142
+ }
143
+
144
+ /**
145
+ * Fills statistics data with values from $data array.
146
+ *
147
+ * @since 1.0
148
+ * @since 1.6.5 Not static anymore.
149
+ * @access public
150
+ *
151
+ * @param array $data The statistics data.
152
+ * @param object $response The API response.
153
+ * @param int $id The attachment ID.
154
+ * @param int $url The attachment URL.
155
+ * @param string $size The attachment size key.
156
+ * @return bool|array False if the original size has an error or an array contains the data for other result.
157
+ */
158
+ public function fill_data( $data, $response, $id, $url, $size = 'full' ) {
159
+ $data['sizes'] = ! empty( $data['sizes'] ) && is_array( $data['sizes'] ) ? $data['sizes'] : array();
160
+
161
+ if ( is_wp_error( $response ) ) {
162
+ $error = $response->get_error_message();
163
+ $error_status = 'error';
164
+
165
+ $data['sizes'][ $size ] = array(
166
+ 'success' => false,
167
+ 'error' => $error,
168
+ );
169
+
170
+ // Update the error status for the original size.
171
+ if ( 'full' === $size ) {
172
+ update_post_meta( $id, '_imagify_data', $data );
173
+
174
+ if ( false !== strpos( $error, 'This image is already compressed' ) ) {
175
+ $error_status = 'already_optimized';
176
+ }
177
+
178
+ update_post_meta( $id, '_imagify_status', $error_status );
179
+
180
+ return false;
181
+ }
182
+ } else {
183
+ $response = (object) array_merge( array(
184
+ 'original_size' => 0,
185
+ 'new_size' => 0,
186
+ 'percent' => 0,
187
+ ), (array) $response );
188
+
189
+ $data['sizes'][ $size ] = array(
190
+ 'success' => true,
191
+ 'file_url' => $url,
192
+ 'original_size' => $response->original_size,
193
+ 'optimized_size' => $response->new_size,
194
+ 'percent' => $response->percent,
195
+ );
196
+
197
+ $data['stats']['original_size'] += $response->original_size;
198
+ $data['stats']['optimized_size'] += $response->new_size;
199
+ } // End if().
200
+
201
+ return $data;
202
+ }
203
+
204
+ /**
205
+ * Optimize all sizes with Imagify.
206
+ *
207
+ * @since 1.0
208
+ * @access public
209
+ *
210
+ * @param int $optimization_level The optimization level (2=ultra, 1=aggressive, 0=normal).
211
+ * @param array $metadata The attachment meta data.
212
+ * @return array $optimized_data The optimization data.
213
+ */
214
+ public function optimize( $optimization_level = null, $metadata = array() ) {
215
+ $optimization_level = is_null( $optimization_level ) ? (int) get_imagify_option( 'optimization_level', 1 ) : (int) $optimization_level;
216
+
217
+ $metadata = $metadata ? $metadata : wp_get_attachment_metadata( $this->id );
218
+ $sizes = isset( $metadata['sizes'] ) ? (array) $metadata['sizes'] : array();
219
+ $data = array(
220
+ 'stats' => array(
221
+ 'original_size' => 0,
222
+ 'optimized_size' => 0,
223
+ 'percent' => 0,
224
+ ),
225
+ );
226
+
227
+ // To avoid issue with "original_size" at 0 in "_imagify_data".
228
+ if ( 0 === (int) $this->get_stats_data( 'original_size' ) ) {
229
+ delete_post_meta( $this->id, '_imagify_data' );
230
+ delete_post_meta( $this->id, '_imagify_status' );
231
+ delete_post_meta( $this->id, '_imagify_optimization_level' );
232
+ }
233
+
234
+ // Get file path & URL for original image.
235
+ $attachment_path = $this->get_original_path();
236
+ $attachment_url = $this->get_original_url();
237
+ $attachment_original_size = $this->get_original_size( false );
238
+
239
+ // Check if the attachment extension is allowed.
240
+ if ( ! $this->id || ! wp_attachment_is_image( $this->id ) ) {
241
+ return;
242
+ }
243
+
244
+ // Check if the full size is already optimized.
245
+ if ( $this->is_optimized() && ( $this->get_optimization_level() === $optimization_level ) ) {
246
+ return;
247
+ }
248
+
249
+ /**
250
+ * Fires before optimizing an attachment.
251
+ *
252
+ * @since 1.0
253
+ *
254
+ * @param int $id The attachment ID.
255
+ */
256
+ do_action( 'before_imagify_optimize_attachment', $this->id );
257
+
258
+ set_transient( 'imagify-async-in-progress-' . $this->id, true, 10 * MINUTE_IN_SECONDS );
259
+
260
+ // Get the resize values for the original size.
261
+ $resized = false;
262
+ $do_resize = get_imagify_option( 'resize_larger', false );
263
+ $resize_width = get_imagify_option( 'resize_larger_w' );
264
+ $attachment_size = @getimagesize( $attachment_path );
265
+
266
+ if ( $do_resize && isset( $attachment_size[0] ) && $resize_width < $attachment_size[0] ) {
267
+ $resized_attachment_path = $this->resize( $attachment_path, $attachment_size, $resize_width );
268
+
269
+ if ( ! is_wp_error( $resized_attachment_path ) ) {
270
+ $filesystem = imagify_get_filesystem();
271
+
272
+ if ( get_imagify_option( 'backup', false ) ) {
273
+ $backup_path = get_imagify_attachment_backup_path( $attachment_path );
274
+ $backup_path_info = pathinfo( $backup_path );
275
+
276
+ wp_mkdir_p( $backup_path_info['dirname'] );
277
+
278
+ // TO DO - check and send a error message if the backup can't be created.
279
+ $filesystem->copy( $attachment_path, $backup_path, true );
280
+ imagify_chmod_file( $backup_path );
281
+ }
282
+
283
+ $filesystem->move( $resized_attachment_path, $attachment_path, true );
284
+ imagify_chmod_file( $attachment_path );
285
+
286
+ // If resized temp file still exists, delete it.
287
+ if ( $filesystem->exists( $resized_attachment_path ) ) {
288
+ $filesystem->delete( $resized_attachment_path );
289
+ }
290
+
291
+ $resized = true;
292
+ }
293
+ }
294
+
295
+ // Optimize the original size.
296
+ $response = do_imagify( $attachment_path, array(
297
+ 'optimization_level' => $optimization_level,
298
+ 'context' => 'wp',
299
+ 'resized' => $resized,
300
+ 'original_size' => $attachment_original_size,
301
+ ) );
302
+ $data = $this->fill_data( $data, $response, $this->id, $attachment_url );
303
+
304
+ if ( ! $data ) {
305
+ delete_transient( 'imagify-async-in-progress-' . $this->id );
306
+ return;
307
+ }
308
+
309
+ // Save the optimization level.
310
+ update_post_meta( $this->id, '_imagify_optimization_level', $optimization_level );
311
+
312
+ // If we resized the original with success, we have to update the attachment metadata.
313
+ // If not, WordPress keeps the old attachment size.
314
+ if ( $do_resize && $resized ) {
315
+ $this->update_metadata_size();
316
+ }
317
+
318
+ // Optimize all thumbnails.
319
+ if ( $sizes ) {
320
+ foreach ( $sizes as $size_key => $size_data ) {
321
+ // Check if this size has to be optimized.
322
+ if ( array_key_exists( $size_key, get_imagify_option( 'disallowed-sizes', array() ) ) && ! imagify_is_active_for_network() ) {
323
+ $data['sizes'][ $size_key ] = array(
324
+ 'success' => false,
325
+ 'error' => __( 'This size isn\'t authorized to be optimized. Update your Imagify settings if you want to optimize it.', 'imagify' ),
326
+ );
327
+ continue;
328
+ }
329
+
330
+ $thumbnail_path = trailingslashit( dirname( $attachment_path ) ) . $size_data['file'];
331
+ $thumbnail_url = trailingslashit( dirname( $attachment_url ) ) . $size_data['file'];
332
+
333
+ // Optimize the thumbnail size.
334
+ $response = do_imagify( $thumbnail_path, array(
335
+ 'backup' => false,
336
+ 'optimization_level' => $optimization_level,
337
+ 'context' => 'wp',
338
+ ) );
339
+ $data = $this->fill_data( $data, $response, $this->id, $thumbnail_url, $size_key );
340
+
341
+ /**
342
+ * Filter the optimization data of a specific thumbnail.
343
+ *
344
+ * @since 1.0
345
+ *
346
+ * @param array $data The statistics data.
347
+ * @param object $response The API response.
348
+ * @param int $id The attachment ID.
349
+ * @param string $thumbnail_path The attachment path.
350
+ * @param string $thumbnail_url The attachment URL.
351
+ * @param string $size_key The attachment size key.
352
+ * @param bool $is_aggressive The optimization level.
353
+ * @return array $data The new optimization data.
354
+ */
355
+ $data = apply_filters( 'imagify_fill_thumbnail_data', $data, $response, $this->id, $thumbnail_path, $thumbnail_url, $size_key, $optimization_level );
356
+ } // End foreach().
357
+ } // End if().
358
+
359
+ $data['stats']['percent'] = round( ( ( $data['stats']['original_size'] - $data['stats']['optimized_size'] ) / $data['stats']['original_size'] ) * 100, 2 );
360
+
361
+ update_post_meta( $this->id, '_imagify_data', $data );
362
+ update_post_meta( $this->id, '_imagify_status', 'success' );
363
+
364
+ $optimized_data = $this->get_data();
365
+
366
+ /**
367
+ * Fires after optimizing an attachment.
368
+ *
369
+ * @since 1.0
370
+ *
371
+ * @param int $id The attachment ID.
372
+ * @param array $optimized_data The optimization data.
373
+ */
374
+ do_action( 'after_imagify_optimize_attachment', $this->id, $optimized_data );
375
+
376
+ delete_transient( 'imagify-async-in-progress-' . $this->id );
377
+
378
+ return $optimized_data;
379
+ }
380
+
381
+ /**
382
+ * Process an attachment restoration from the backup file.
383
+ *
384
+ * @since 1.0
385
+ * @access public
386
+ *
387
+ * @return void
388
+ */
389
+ public function restore() {
390
+ // Stop the process if there is no backup file to restore.
391
+ if ( ! $this->has_backup() ) {
392
+ return;
393
+ }
394
+
395
+ $backup_path = $this->get_backup_path();
396
+ $attachment_path = $this->get_original_path();
397
+ $filesystem = imagify_get_filesystem();
398
+
399
+ /**
400
+ * Fires before restoring an attachment.
401
+ *
402
+ * @since 1.0
403
+ *
404
+ * @param int $id The attachment ID
405
+ */
406
+ do_action( 'before_imagify_restore_attachment', $this->id );
407
+
408
+ // Create the original image from the backup.
409
+ $filesystem->copy( $backup_path, $attachment_path, true );
410
+ imagify_chmod_file( $attachment_path );
411
+
412
+ if ( ! function_exists( 'wp_generate_attachment_metadata' ) ) {
413
+ require_once( ABSPATH . 'wp-admin/includes/image.php' );
414
+ }
415
+
416
+ remove_filter( 'wp_generate_attachment_metadata', '_imagify_optimize_attachment', PHP_INT_MAX );
417
+ wp_generate_attachment_metadata( $this->id, $attachment_path );
418
+
419
+ // Remove old optimization data.
420
+ delete_post_meta( $this->id, '_imagify_data' );
421
+ delete_post_meta( $this->id, '_imagify_status' );
422
+ delete_post_meta( $this->id, '_imagify_optimization_level' );
423
+
424
+ // Restore the original size in the metadata.
425
+ $this->update_metadata_size();
426
+
427
+ /**
428
+ * Fires after restoring an attachment.
429
+ *
430
+ * @since 1.0
431
+ *
432
+ * @param int $id The attachment ID
433
+ */
434
+ do_action( 'after_imagify_restore_attachment', $this->id );
435
+ }
436
+ }
inc/classes/{class-user.php → class-imagify-user.php} RENAMED
@@ -1,9 +1,22 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
 
 
 
 
4
  class Imagify_User {
 
 
 
 
 
 
 
 
5
  /**
6
- * The Imagify user ID
7
  *
8
  * @since 1.0
9
  *
@@ -11,9 +24,9 @@ class Imagify_User {
11
  * @access public
12
  */
13
  public $id;
14
-
15
  /**
16
- * The user email
17
  *
18
  * @since 1.0
19
  *
@@ -23,7 +36,7 @@ class Imagify_User {
23
  public $email;
24
 
25
  /**
26
- * The plan ID
27
  *
28
  * @since 1.0
29
  *
@@ -31,9 +44,9 @@ class Imagify_User {
31
  * @access public
32
  */
33
  public $plan_id;
34
-
35
  /**
36
- * The plan label
37
  *
38
  * @since 1.2
39
  *
@@ -43,7 +56,7 @@ class Imagify_User {
43
  public $plan_label;
44
 
45
  /**
46
- * The total quota
47
  *
48
  * @since 1.0
49
  *
@@ -51,9 +64,9 @@ class Imagify_User {
51
  * @access public
52
  */
53
  public $quota;
54
-
55
  /**
56
- * The total extra quota (Imagify Pack)
57
  *
58
  * @since 1.0
59
  *
@@ -61,9 +74,9 @@ class Imagify_User {
61
  * @access public
62
  */
63
  public $extra_quota;
64
-
65
  /**
66
- * The extra quota consumed
67
  *
68
  * @since 1.0
69
  *
@@ -73,7 +86,7 @@ class Imagify_User {
73
  public $extra_quota_consumed;
74
 
75
  /**
76
- * The current month consumed quota
77
  *
78
  * @since 1.0
79
  *
@@ -81,9 +94,9 @@ class Imagify_User {
81
  * @access public
82
  */
83
  public $consumed_current_month_quota;
84
-
85
  /**
86
- * The next month date to credit the account
87
  *
88
  * @since 1.1.1
89
  *
@@ -91,9 +104,9 @@ class Imagify_User {
91
  * @access public
92
  */
93
  public $next_date_update;
94
-
95
  /**
96
- * If the account is activate or not
97
  *
98
  * @since 1.0.1
99
  *
@@ -101,29 +114,31 @@ class Imagify_User {
101
  * @access public
102
  */
103
  public $is_active;
104
-
105
- /**
106
- * The constructor
107
- *
108
  * @since 1.0
109
  *
110
- * @return void
111
- **/
112
  public function __construct() {
113
  $user = get_imagify_user();
114
 
115
- if ( ! is_wp_error( $user ) ) {
116
- $this->id = $user->id;
117
- $this->email = $user->email;
118
- $this->plan_id = $user->plan_id;
119
- $this->plan_label = ucfirst( $user->plan_label );
120
- $this->quota = $user->quota;
121
- $this->extra_quota = $user->extra_quota;
122
- $this->extra_quota_consumed = $user->extra_quota_consumed;
123
- $this->consumed_current_month_quota = $user->consumed_current_month_quota;
124
- $this->next_date_update = $user->next_date_update;
125
- $this->is_active = $user->is_active;
126
  }
 
 
 
 
 
 
 
 
 
 
 
127
  }
128
 
129
  /**
@@ -138,19 +153,19 @@ class Imagify_User {
138
  $percent = 0;
139
  $quota = $this->quota;
140
  $consumed_quota = $this->consumed_current_month_quota;
141
-
142
  if ( ( $this->quota + $this->extra_quota ) - ( $this->consumed_current_month_quota + $this->extra_quota_consumed ) <= 0 ) {
143
  return 100;
144
  }
145
-
146
- if( imagify_round_half_five( $this->extra_quota_consumed ) < $this->extra_quota ) {
147
  $quota = $this->extra_quota + $quota;
148
  $consumed_quota = $consumed_quota + $this->extra_quota_consumed;
149
  }
150
-
151
  $percent = 100 - ( ( $quota - $consumed_quota ) / $quota ) * 100;
152
- $percent = min ( round( $percent, 1 ), 100 );
153
-
154
  return $percent;
155
  }
156
 
@@ -166,7 +181,7 @@ class Imagify_User {
166
  $percent = 100 - $this->get_percent_consumed_quota();
167
  return $percent;
168
  }
169
-
170
  /**
171
  * Check if the user has a free account.
172
  *
@@ -176,13 +191,13 @@ class Imagify_User {
176
  * @return bool
177
  */
178
  public function is_free() {
179
- if ( 1 == $this->plan_id ) {
180
  return true;
181
  }
182
-
183
  return false;
184
  }
185
-
186
  /**
187
  * Check if the user has consumed its quota.
188
  *
@@ -192,10 +207,10 @@ class Imagify_User {
192
  * @return bool
193
  */
194
  public function is_over_quota() {
195
- if ( $this->is_free() && 100 == $this->get_percent_consumed_quota() ) {
196
  return true;
197
  }
198
-
199
  return false;
200
  }
201
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ /**
5
+ * Imagify User class.
6
+ *
7
+ * @since 1.0
8
+ */
9
  class Imagify_User {
10
+
11
+ /**
12
+ * Class version.
13
+ *
14
+ * @var string
15
+ */
16
+ const VERSION = '1.0.1';
17
+
18
  /**
19
+ * The Imagify user ID.
20
  *
21
  * @since 1.0
22
  *
24
  * @access public
25
  */
26
  public $id;
27
+
28
  /**
29
+ * The user email.
30
  *
31
  * @since 1.0
32
  *
36
  public $email;
37
 
38
  /**
39
+ * The plan ID.
40
  *
41
  * @since 1.0
42
  *
44
  * @access public
45
  */
46
  public $plan_id;
47
+
48
  /**
49
+ * The plan label.
50
  *
51
  * @since 1.2
52
  *
56
  public $plan_label;
57
 
58
  /**
59
+ * The total quota.
60
  *
61
  * @since 1.0
62
  *
64
  * @access public
65
  */
66
  public $quota;
67
+
68
  /**
69
+ * The total extra quota (Imagify Pack).
70
  *
71
  * @since 1.0
72
  *
74
  * @access public
75
  */
76
  public $extra_quota;
77
+
78
  /**
79
+ * The extra quota consumed.
80
  *
81
  * @since 1.0
82
  *
86
  public $extra_quota_consumed;
87
 
88
  /**
89
+ * The current month consumed quota.
90
  *
91
  * @since 1.0
92
  *
94
  * @access public
95
  */
96
  public $consumed_current_month_quota;
97
+
98
  /**
99
+ * The next month date to credit the account.
100
  *
101
  * @since 1.1.1
102
  *
104
  * @access public
105
  */
106
  public $next_date_update;
107
+
108
  /**
109
+ * If the account is activate or not.
110
  *
111
  * @since 1.0.1
112
  *
114
  * @access public
115
  */
116
  public $is_active;
117
+
118
+ /**
119
+ * The constructor.
120
+ *
121
  * @since 1.0
122
  *
123
+ * @return void
124
+ */
125
  public function __construct() {
126
  $user = get_imagify_user();
127
 
128
+ if ( is_wp_error( $user ) ) {
129
+ return;
 
 
 
 
 
 
 
 
 
130
  }
131
+
132
+ $this->id = $user->id;
133
+ $this->email = $user->email;
134
+ $this->plan_id = (int) $user->plan_id;
135
+ $this->plan_label = ucfirst( $user->plan_label );
136
+ $this->quota = $user->quota;
137
+ $this->extra_quota = $user->extra_quota;
138
+ $this->extra_quota_consumed = $user->extra_quota_consumed;
139
+ $this->consumed_current_month_quota = $user->consumed_current_month_quota;
140
+ $this->next_date_update = $user->next_date_update;
141
+ $this->is_active = $user->is_active;
142
  }
143
 
144
  /**
153
  $percent = 0;
154
  $quota = $this->quota;
155
  $consumed_quota = $this->consumed_current_month_quota;
156
+
157
  if ( ( $this->quota + $this->extra_quota ) - ( $this->consumed_current_month_quota + $this->extra_quota_consumed ) <= 0 ) {
158
  return 100;
159
  }
160
+
161
+ if ( imagify_round_half_five( $this->extra_quota_consumed ) < $this->extra_quota ) {
162
  $quota = $this->extra_quota + $quota;
163
  $consumed_quota = $consumed_quota + $this->extra_quota_consumed;
164
  }
165
+
166
  $percent = 100 - ( ( $quota - $consumed_quota ) / $quota ) * 100;
167
+ $percent = min( round( $percent, 1 ), 100 );
168
+
169
  return $percent;
170
  }
171
 
181
  $percent = 100 - $this->get_percent_consumed_quota();
182
  return $percent;
183
  }
184
+
185
  /**
186
  * Check if the user has a free account.
187
  *
191
  * @return bool
192
  */
193
  public function is_free() {
194
+ if ( 1 === $this->plan_id ) {
195
  return true;
196
  }
197
+
198
  return false;
199
  }
200
+
201
  /**
202
  * Check if the user has consumed its quota.
203
  *
207
  * @return bool
208
  */
209
  public function is_over_quota() {
210
+ if ( $this->is_free() && 100 === $this->get_percent_consumed_quota() ) {
211
  return true;
212
  }
213
+
214
  return false;
215
  }
216
+ }
inc/classes/class-imagify.php ADDED
@@ -0,0 +1,368 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
+
4
+ /**
5
+ * Imagify.io API for WordPress.
6
+ */
7
+ class Imagify extends Imagify_Deprecated {
8
+
9
+ /**
10
+ * Class version.
11
+ *
12
+ * @var string
13
+ */
14
+ const VERSION = '1.0.1';
15
+ /**
16
+ * The Imagify API endpoint.
17
+ *
18
+ * @var string
19
+ */
20
+ const API_ENDPOINT = 'https://app.imagify.io/api/';
21
+
22
+ /**
23
+ * The Imagify API key.
24
+ *
25
+ * @var string
26
+ */
27
+ private $api_key = '';
28
+
29
+ /**
30
+ * HTTP headers.
31
+ *
32
+ * @var array
33
+ */
34
+ private $headers = array();
35
+
36
+ /**
37
+ * The single instance of the class.
38
+ *
39
+ * @access protected
40
+ *
41
+ * @var object
42
+ */
43
+ protected static $_instance;
44
+
45
+ /**
46
+ * The constructor.
47
+ *
48
+ * @return void
49
+ */
50
+ protected function __construct() {
51
+ // Check if the WordPress plugin is activated and the API key is stored in the options.
52
+ if ( defined( 'IMAGIFY_VERSION' ) && function_exists( 'get_imagify_option' ) ) {
53
+ $api_key = get_imagify_option( 'api_key', false );
54
+ $this->api_key = $api_key ? $api_key : $this->api_key;
55
+ }
56
+
57
+ // Check if the API key is defined with the PHP constant (it's ovveride the WordPress plugin option.
58
+ if ( defined( 'IMAGIFY_API_KEY' ) && IMAGIFY_API_KEY ) {
59
+ $this->api_key = IMAGIFY_API_KEY;
60
+ }
61
+
62
+ $this->headers['Accept'] = 'Accept: application/json';
63
+ $this->headers['Content-Type'] = 'Content-Type: application/json';
64
+ $this->headers['Authorization'] = 'Authorization: token ' . $this->api_key;
65
+ }
66
+
67
+ /**
68
+ * Get the main Instance.
69
+ *
70
+ * @access public
71
+ * @since 1.6.5
72
+ * @author Grégory Viguier
73
+ *
74
+ * @return object Main instance.
75
+ */
76
+ public static function get_instance() {
77
+ if ( ! isset( self::$_instance ) ) {
78
+ self::$_instance = new self();
79
+ }
80
+
81
+ return self::$_instance;
82
+ }
83
+
84
+ /**
85
+ * Get your Imagify account infos.
86
+ *
87
+ * @access public
88
+ * @since 1.6.5
89
+ *
90
+ * @return object
91
+ */
92
+ public function get_user() {
93
+ static $user;
94
+
95
+ if ( ! isset( $user ) ) {
96
+ $user = $this->http_call( 'users/me/', array(
97
+ 'timeout' => 10,
98
+ ) );
99
+ }
100
+
101
+ return $user;
102
+ }
103
+
104
+ /**
105
+ * Create a user on your Imagify account.
106
+ *
107
+ * @access public
108
+ * @since 1.6.5
109
+ *
110
+ * @param array $data All user data. Details here: --.
111
+ * @return object
112
+ */
113
+ public function create_user( $data ) {
114
+ unset( $this->headers['Authorization'], $this->headers['Accept'], $this->headers['Content-Type'] );
115
+
116
+ $data['from_plugin'] = true;
117
+
118
+ return $this->http_call( 'users/', array(
119
+ 'method' => 'POST',
120
+ 'post_data' => $data,
121
+ ) );
122
+ }
123
+
124
+ /**
125
+ * Update an existing user on your Imagify account.
126
+ *
127
+ * @access public
128
+ * @since 1.6.5
129
+ *
130
+ * @param string $data All user data. Details here: --.
131
+ * @return object
132
+ */
133
+ public function update_user( $data ) {
134
+ return $this->http_call( 'users/me/', array(
135
+ 'method' => 'PUT',
136
+ 'post_data' => $data,
137
+ 'timeout' => 10,
138
+ ) );
139
+ }
140
+
141
+ /**
142
+ * Check your Imagify API key status.
143
+ *
144
+ * @access public
145
+ * @since 1.6.5
146
+ *
147
+ * @param string $data The license key.
148
+ * @return object
149
+ */
150
+ public function get_status( $data ) {
151
+ static $status = array();
152
+
153
+ if ( ! isset( $status[ $data ] ) ) {
154
+ unset( $this->headers['Accept'], $this->headers['Content-Type'] );
155
+ $this->headers['Authorization'] = 'Authorization: token ' . $data;
156
+
157
+ $status[ $data ] = $this->http_call( 'status/', array(
158
+ 'timeout' => 10,
159
+ ) );
160
+ }
161
+
162
+ return $status[ $data ];
163
+ }
164
+
165
+ /**
166
+ * Get the Imagify API version.
167
+ *
168
+ * @access public
169
+ * @since 1.6.5
170
+ *
171
+ * @return object
172
+ */
173
+ public function get_api_version() {
174
+ static $api_version;
175
+
176
+ if ( ! isset( $api_version ) ) {
177
+ unset( $this->headers['Accept'], $this->headers['Content-Type'] );
178
+
179
+ $api_version = $this->http_call( 'version/', array(
180
+ 'timeout' => 5,
181
+ ) );
182
+ }
183
+
184
+ return $api_version;
185
+ }
186
+
187
+ /**
188
+ * Get Public Info.
189
+ *
190
+ * @access public
191
+ * @since 1.6.5
192
+ *
193
+ * @return object
194
+ */
195
+ public function get_public_info() {
196
+ return $this->http_call( 'public-info' );
197
+ }
198
+
199
+ /**
200
+ * Optimize an image from its binary content.
201
+ *
202
+ * @access public
203
+ * @since 1.6.5
204
+ *
205
+ * @param string $data All options. Details here: --.
206
+ * @return object
207
+ */
208
+ public function upload_image( $data ) {
209
+ unset( $this->headers['Accept'], $this->headers['Content-Type'] );
210
+
211
+ return $this->http_call( 'upload/', array(
212
+ 'method' => 'POST',
213
+ 'post_data' => $data,
214
+ ) );
215
+ }
216
+
217
+ /**
218
+ * Optimize an image from its URL.
219
+ *
220
+ * @access public
221
+ * @since 1.6.5
222
+ *
223
+ * @param string $data All options. Details here: --.
224
+ * @return object
225
+ */
226
+ public function fetch_image( $data ) {
227
+ return $this->http_call( 'fetch/', array(
228
+ 'method' => 'POST',
229
+ 'post_data' => wp_json_encode( $data ),
230
+ ) );
231
+ }
232
+
233
+ /**
234
+ * Get prices for plans.
235
+ *
236
+ * @access public
237
+ * @since 1.6.5
238
+ *
239
+ * @return object
240
+ */
241
+ public function get_plans_prices() {
242
+ return $this->http_call( 'pricing/plan/' );
243
+ }
244
+
245
+ /**
246
+ * Get prices for packs (one time).
247
+ *
248
+ * @access public
249
+ * @since 1.6.5
250
+ *
251
+ * @return object
252
+ */
253
+ public function get_packs_prices() {
254
+ return $this->http_call( 'pricing/pack/' );
255
+ }
256
+
257
+ /**
258
+ * Get all prices (packs & plans included).
259
+ *
260
+ * @access public
261
+ * @since 1.6.5
262
+ *
263
+ * @return object
264
+ */
265
+ public function get_all_prices() {
266
+ return $this->http_call( 'pricing/all/' );
267
+ }
268
+
269
+ /**
270
+ * Get all prices (packs & plans included).
271
+ *
272
+ * @access public
273
+ * @since 1.6.5
274
+ *
275
+ * @param string $coupon A coupon code.
276
+ * @return object
277
+ */
278
+ public function check_coupon_code( $coupon ) {
279
+ return $this->http_call( 'coupons/' . $coupon . '/' );
280
+ }
281
+
282
+ /**
283
+ * Get information about current discount.
284
+ *
285
+ * @access public
286
+ * @since 1.6.5
287
+ *
288
+ * @return object
289
+ */
290
+ public function check_discount() {
291
+ return $this->http_call( 'pricing/discount/' );
292
+ }
293
+
294
+ /**
295
+ * Make an HTTP call using curl.
296
+ *
297
+ * @access public
298
+ * @since 1.6.5
299
+ *
300
+ * @param string $url The URL to call.
301
+ * @param array $args The request args.
302
+ * @return object
303
+ */
304
+ private function http_call( $url, $args = array() ) {
305
+ $args = array_merge( array(
306
+ 'method' => 'GET',
307
+ 'post_data' => null,
308
+ 'timeout' => 45,
309
+ ), $args );
310
+
311
+ // Check if php-curl is enabled.
312
+ if ( ! function_exists( 'curl_init' ) || ! function_exists( 'curl_exec' ) ) {
313
+ return new WP_Error( 'curl', 'cURL isn\'t installed on the server.' );
314
+ }
315
+
316
+ try {
317
+ $ch = curl_init();
318
+
319
+ if ( 'POST' === $args['method'] ) {
320
+ curl_setopt( $ch, CURLOPT_POST, true );
321
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $args['post_data'] );
322
+ }
323
+
324
+ curl_setopt( $ch, CURLOPT_URL, self::API_ENDPOINT . $url );
325
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
326
+ curl_setopt( $ch, CURLOPT_HTTPHEADER, $this->headers );
327
+ curl_setopt( $ch, CURLOPT_TIMEOUT, $args['timeout'] );
328
+ @curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
329
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
330
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
331
+
332
+ $response = json_decode( curl_exec( $ch ) );
333
+ $error = curl_error( $ch );
334
+ $http_code = (int) curl_getinfo( $ch, CURLINFO_HTTP_CODE );
335
+
336
+ curl_close( $ch );
337
+ } catch ( Exception $e ) {
338
+ return new WP_Error( 'curl', 'Unknown error occurred' );
339
+ }
340
+
341
+ if ( 200 !== $http_code && isset( $response->code, $response->detail ) ) {
342
+ return new WP_Error( $http_code, $response->detail );
343
+ }
344
+
345
+ if ( 413 === $http_code ) {
346
+ return new WP_Error( $http_code, 'Your image is too big to be uploaded on our server.' );
347
+ }
348
+
349
+ if ( 200 !== $http_code ) {
350
+ $error = '' !== $error ? ' - ' . htmlentities( $error ) : '';
351
+ return new WP_Error( $http_code, "Unknown error occurred ({$http_code}{$error}) " );
352
+ }
353
+
354
+ return $response;
355
+ }
356
+ }
357
+
358
+ /**
359
+ * Returns the main instance of the Imagify class.
360
+ *
361
+ * @since 1.6.5
362
+ * @author Grégory Viguier
363
+ *
364
+ * @return object The Imagify instance.
365
+ */
366
+ function imagify() {
367
+ return Imagify::get_instance();
368
+ }
inc/common/admin-bar.php CHANGED
@@ -1,37 +1,35 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
4
  /**
5
- * Add Imagify menu in the admin bar
6
  *
7
  * @since 1.0
 
 
8
  */
9
- add_action( 'admin_bar_menu', '_imagify_admin_bar', PHP_INT_MAX );
10
  function _imagify_admin_bar( $wp_admin_bar ) {
11
- $cap = imagify_is_active_for_network() ? 'manage_network_options' : 'manage_options';
12
- /** This filter is documented in inc/admin/options.php */
13
- $cap = apply_filters( 'imagify_capacity', $cap );
14
-
15
- if ( ! current_user_can( $cap ) || ! get_imagify_option( 'admin_bar_menu', 0 ) ) {
16
  return;
17
  }
18
 
19
- // Parent
20
  $wp_admin_bar->add_menu( array(
21
  'id' => 'imagify',
22
  'title' => 'Imagify',
23
  'href' => get_imagify_admin_url(),
24
  ) );
25
 
26
- // Settings
27
  $wp_admin_bar->add_menu(array(
28
  'parent' => 'imagify',
29
  'id' => 'imagify-settings',
30
  'title' => __( 'Settings' ),
31
  'href' => get_imagify_admin_url(),
32
  ) );
33
-
34
- // Bulk Optimization
35
  if ( ! is_network_admin() ) {
36
  $wp_admin_bar->add_menu(array(
37
  'parent' => 'imagify',
@@ -40,20 +38,21 @@ function _imagify_admin_bar( $wp_admin_bar ) {
40
  'href' => get_imagify_admin_url( 'bulk-optimization' ),
41
  ) );
42
  }
43
-
44
- // Rate it
45
  $wp_admin_bar->add_menu(array(
46
  'parent' => 'imagify',
47
  'id' => 'imagify-rate-it',
 
48
  'title' => sprintf( __( 'Rate Imagify on %s', 'imagify' ), 'WordPress.org' ),
49
  'href' => 'https://wordpress.org/support/view/plugin-reviews/imagify?rate=5#postform',
50
  ) );
51
-
52
- // Quota & Profile informations
53
  if ( defined( 'IMAGIFY_HIDDEN_ACCOUNT' ) && IMAGIFY_HIDDEN_ACCOUNT ) {
54
  return;
55
  }
56
-
57
  if ( ( defined( 'IMAGIFY_API_KEY' ) && IMAGIFY_API_KEY ) || get_imagify_option( 'api_key', false ) ) {
58
  $wp_admin_bar->add_menu( array(
59
  'parent' => 'imagify',
@@ -63,15 +62,17 @@ function _imagify_admin_bar( $wp_admin_bar ) {
63
  }
64
  }
65
 
 
66
  /**
67
- * Include Admin Bar Profile informations styles in front
68
  *
69
  * @since 1.2
70
  */
71
- add_action( 'admin_bar_init', '_imagify_admin_bar_styles' );
72
  function _imagify_admin_bar_styles() {
73
- if ( ! is_admin() && get_imagify_option( 'admin_bar_menu', 0 ) ) {
74
- $css_ext = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.css' : '.min.css';
75
- wp_enqueue_style( 'imagify-css-admin-bar', IMAGIFY_ASSETS_CSS_URL . 'admin-bar' . $css_ext, array(), IMAGIFY_VERSION, 'all' );
76
  }
 
 
 
77
  }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_action( 'admin_bar_menu', '_imagify_admin_bar', PHP_INT_MAX );
5
  /**
6
+ * Add Imagify menu in the admin bar.
7
  *
8
  * @since 1.0
9
+ *
10
+ * @param object $wp_admin_bar WP_Admin_Bar instance, passed by reference.
11
  */
 
12
  function _imagify_admin_bar( $wp_admin_bar ) {
13
+ if ( ! current_user_can( imagify_get_capacity() ) || ! get_imagify_option( 'admin_bar_menu', 0 ) ) {
 
 
 
 
14
  return;
15
  }
16
 
17
+ // Parent.
18
  $wp_admin_bar->add_menu( array(
19
  'id' => 'imagify',
20
  'title' => 'Imagify',
21
  'href' => get_imagify_admin_url(),
22
  ) );
23
 
24
+ // Settings.
25
  $wp_admin_bar->add_menu(array(
26
  'parent' => 'imagify',
27
  'id' => 'imagify-settings',
28
  'title' => __( 'Settings' ),
29
  'href' => get_imagify_admin_url(),
30
  ) );
31
+
32
+ // Bulk Optimization.
33
  if ( ! is_network_admin() ) {
34
  $wp_admin_bar->add_menu(array(
35
  'parent' => 'imagify',
38
  'href' => get_imagify_admin_url( 'bulk-optimization' ),
39
  ) );
40
  }
41
+
42
+ // Rate it.
43
  $wp_admin_bar->add_menu(array(
44
  'parent' => 'imagify',
45
  'id' => 'imagify-rate-it',
46
+ /* translators: %s is WordPress.org. */
47
  'title' => sprintf( __( 'Rate Imagify on %s', 'imagify' ), 'WordPress.org' ),
48
  'href' => 'https://wordpress.org/support/view/plugin-reviews/imagify?rate=5#postform',
49
  ) );
50
+
51
+ // Quota & Profile informations.
52
  if ( defined( 'IMAGIFY_HIDDEN_ACCOUNT' ) && IMAGIFY_HIDDEN_ACCOUNT ) {
53
  return;
54
  }
55
+
56
  if ( ( defined( 'IMAGIFY_API_KEY' ) && IMAGIFY_API_KEY ) || get_imagify_option( 'api_key', false ) ) {
57
  $wp_admin_bar->add_menu( array(
58
  'parent' => 'imagify',
62
  }
63
  }
64
 
65
+ add_action( 'admin_bar_init', '_imagify_admin_bar_styles' );
66
  /**
67
+ * Include Admin Bar Profile informations styles in front.
68
  *
69
  * @since 1.2
70
  */
 
71
  function _imagify_admin_bar_styles() {
72
+ if ( is_admin() || ! get_imagify_option( 'admin_bar_menu', 0 ) ) {
73
+ return;
 
74
  }
75
+
76
+ $css_ext = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.css' : '.min.css';
77
+ wp_enqueue_style( 'imagify-css-admin-bar', IMAGIFY_ASSETS_CSS_URL . 'admin-bar' . $css_ext, array(), IMAGIFY_VERSION, 'all' );
78
  }
inc/common/attachments.php CHANGED
@@ -1,56 +1,67 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
4
  /**
5
- * Auto-optimize when a new attachment is generated
6
  *
7
  * @since 1.0
8
- * @since 1.5 Async job
 
 
 
 
 
9
  */
10
- add_filter( 'wp_generate_attachment_metadata', '_imagify_optimize_attachment', PHP_INT_MAX, 2 );
11
  function _imagify_optimize_attachment( $metadata, $attachment_id ) {
12
- $api_key = get_imagify_option( 'api_key', false );
13
-
14
- if ( ! empty( $api_key ) && get_imagify_option( 'auto_optimize', false ) ) {
15
- $context = 'wp';
16
- $action = 'imagify_async_optimize_upload_new_media';
17
- $_ajax_nonce = wp_create_nonce( 'new_media-' . $attachment_id );
18
 
19
- imagify_do_async_job( compact( 'action', '_ajax_nonce', 'metadata', 'attachment_id', 'context' ) );
 
20
  }
21
 
 
 
 
 
 
 
22
  return $metadata;
23
  }
24
 
 
25
  /**
26
  * Delete the backup file when an attachement is deleted.
27
  *
28
  * @since 1.0
 
 
29
  */
30
- add_action( 'delete_attachment', '_imagify_delete_backup_file' );
31
  function _imagify_delete_backup_file( $post_id ) {
32
- $attachment = new Imagify_Attachment( $post_id );
 
33
  $attachment->delete_backup();
34
  }
35
 
 
36
  /**
37
- * Optimize a resized attachment
38
  *
39
  * @since 1.3.6
40
- * @since 1.4 Async job
41
  */
42
- add_action( 'shutdown', '_imagify_optimize_save_image_editor_file' );
43
  function _imagify_optimize_save_image_editor_file() {
44
- if ( isset( $_POST['action'], $_POST['do'], $_POST['postid'] )
45
- && 'image-editor' === $_POST['action']
46
- && check_ajax_referer( 'image_editor-' . $_POST['postid'] )
47
- && get_post_meta( $_POST['postid'], '_imagify_data', true )
48
- && 'open' != $_POST['do']
49
- ) {
50
 
51
- $body = $_POST;
52
- $body['action'] = 'imagify_async_optimize_save_image_editor_file';
53
 
54
- imagify_do_async_job( $body );
 
55
  }
56
- }
 
 
 
 
 
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_filter( 'wp_generate_attachment_metadata', '_imagify_optimize_attachment', PHP_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 _do_admin_post_async_optimize_upload_new_media()
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 ( ! get_imagify_option( 'api_key' ) || ! get_imagify_option( 'auto_optimize' ) ) {
19
+ return $metadata;
20
  }
21
 
22
+ $context = 'wp';
23
+ $action = 'imagify_async_optimize_upload_new_media';
24
+ $_ajax_nonce = wp_create_nonce( 'new_media-' . $attachment_id );
25
+
26
+ imagify_do_async_job( compact( 'action', '_ajax_nonce', 'metadata', 'attachment_id', 'context' ) );
27
+
28
  return $metadata;
29
  }
30
 
31
+ add_action( 'delete_attachment', '_imagify_delete_backup_file' );
32
  /**
33
  * Delete the backup file when an attachement is deleted.
34
  *
35
  * @since 1.0
36
+ *
37
+ * @param int $post_id Attachment ID.
38
  */
 
39
  function _imagify_delete_backup_file( $post_id ) {
40
+ $class_name = get_imagify_attachment_class_name( 'wp' );
41
+ $attachment = new $class_name( $post_id );
42
  $attachment->delete_backup();
43
  }
44
 
45
+ add_action( 'shutdown', '_imagify_optimize_save_image_editor_file' );
46
  /**
47
+ * Optimize an attachment after being resized.
48
  *
49
  * @since 1.3.6
50
+ * @since 1.4 Async job.
51
  */
 
52
  function _imagify_optimize_save_image_editor_file() {
53
+ if ( ! isset( $_POST['action'], $_POST['do'], $_POST['postid'] ) || 'image-editor' !== $_POST['action'] || 'open' === $_POST['do'] ) { // WPCS: CSRF ok.
54
+ return;
55
+ }
 
 
 
56
 
57
+ check_ajax_referer( 'image_editor-' . $_POST['postid'] );
 
58
 
59
+ if ( ! get_post_meta( $_POST['postid'], '_imagify_data', true ) ) {
60
+ return;
61
  }
62
+
63
+ $body = $_POST;
64
+ $body['action'] = 'imagify_async_optimize_save_image_editor_file';
65
+
66
+ imagify_do_async_job( $body );
67
+ }
inc/common/cron.php CHANGED
@@ -1,91 +1,91 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
 
4
  /**
5
- * Planning cron
6
- * If the task is not programmed, it is automatically triggered
7
  *
8
  * @since 1.4.2
9
  */
10
- add_action( 'init', '_imagify_rating_scheduled' );
11
  function _imagify_rating_scheduled() {
12
  if ( ! wp_next_scheduled( 'imagify_rating_event' ) && ! get_site_transient( 'do_imagify_rating_cron' ) ) {
13
  wp_schedule_event( time(), 'daily', 'imagify_rating_event' );
14
  }
15
  }
16
 
 
17
  /**
18
  * Saved the user images count to display it later
19
- * in a notice message to ask him to rate Imagify on WordPress.org
20
  *
21
  * @since 1.4.2
22
  */
23
- add_action( 'imagify_rating_event', '_do_imagify_rating_cron' );
24
- function _do_imagify_rating_cron() {
25
- // Stop the process if the plugin isn't installed since 3 days
26
  if ( get_site_transient( 'imagify_seen_rating_notice' ) ) {
27
  return;
28
  }
29
 
30
- // Check if the Imagify servers & the API are accessible
31
  if ( ! is_imagify_servers_up() ) {
32
  return;
33
  }
34
-
35
  $user = get_imagify_user();
36
-
37
  if ( isset( $user ) && (int) $user->image_count > 100 ) {
38
  set_site_transient( 'imagify_user_images_count', $user->image_count );
39
  }
40
  }
41
 
 
42
  /**
43
- * Adds weekly interval for cron jobs
44
  *
45
  * @since 1.6
46
  * @author Remy Perona
47
  *
48
- * @param Array $schedules An array of intervals used by cron jobs
49
- * @return Array Updated array of intervals
50
  */
51
- add_filter( 'cron_schedules', 'imagify_purge_cron_schedule' );
52
  function imagify_purge_cron_schedule( $schedules ) {
53
- if ( array_key_exists( 'weekly', $schedules ) ) {
54
- return $schedules;
55
- }
56
 
57
- $schedules['weekly'] = array(
58
- 'interval' => 604800,
59
- 'display' => __( 'weekly', 'imagify' )
60
- );
61
 
62
  return $schedules;
63
  }
64
 
 
65
  /**
66
- * Planning cron task to update weekly the size of the images and the size of images uploaded by month
67
- * If the task is not programmed, it is automatically triggered
68
  *
69
  * @since 1.6
70
  * @author Remy Perona
71
  */
72
- add_action( 'init', '_imagify_update_library_size_calculations_scheduled' );
73
  function _imagify_update_library_size_calculations_scheduled() {
74
- if ( ! wp_next_scheduled( 'imagify_update_library_size_calculations_event' ) ) {
75
- wp_schedule_event( time(), 'weekly', 'imagify_update_library_size_calculations_event' );
76
- }
77
  }
78
 
 
79
  /**
80
- * Cron task to update weekly the size of the images and the size of images uploaded by month
81
  *
82
  * @since 1.6
83
  * @author Remy Perona
84
  */
85
- add_action( 'imagify_update_library_size_calculations_event', '_do_imagify_update_library_size_calculations' );
86
  function _do_imagify_update_library_size_calculations() {
87
- imagify_do_async_job( array(
88
- 'action' => 'imagify_update_estimate_sizes',
89
- '_ajax_nonce' => wp_create_nonce( 'update_estimate_sizes' ),
90
- ) );
91
- }
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ add_action( 'init', '_imagify_rating_scheduled' );
5
  /**
6
+ * Planning cron.
7
+ * If the task is not programmed, it is automatically triggered.
8
  *
9
  * @since 1.4.2
10
  */
 
11
  function _imagify_rating_scheduled() {
12
  if ( ! wp_next_scheduled( 'imagify_rating_event' ) && ! get_site_transient( 'do_imagify_rating_cron' ) ) {
13
  wp_schedule_event( time(), 'daily', 'imagify_rating_event' );
14
  }
15
  }
16
 
17
+ add_action( 'imagify_rating_event', '_do_imagify_rating_cron' );
18
  /**
19
  * Saved the user images count to display it later
20
+ * in a notice message to ask him to rate Imagify on WordPress.org.
21
  *
22
  * @since 1.4.2
23
  */
24
+ function _do_imagify_rating_cron() {
25
+ // Stop the process if the plugin isn't installed for 3 days.
 
26
  if ( get_site_transient( 'imagify_seen_rating_notice' ) ) {
27
  return;
28
  }
29
 
30
+ // Check if the Imagify servers & the API are accessible.
31
  if ( ! is_imagify_servers_up() ) {
32
  return;
33
  }
34
+
35
  $user = get_imagify_user();
36
+
37
  if ( isset( $user ) && (int) $user->image_count > 100 ) {
38
  set_site_transient( 'imagify_user_images_count', $user->image_count );
39
  }
40
  }
41
 
42
+ add_filter( 'cron_schedules', 'imagify_purge_cron_schedule' );
43
  /**
44
+ * Adds weekly interval for cron jobs.
45
  *
46
  * @since 1.6
47
  * @author Remy Perona
48
  *
49
+ * @param Array $schedules An array of intervals used by cron jobs.
50
+ * @return Array Updated array of intervals.
51
  */
 
52
  function imagify_purge_cron_schedule( $schedules ) {
53
+ if ( array_key_exists( 'weekly', $schedules ) ) {
54
+ return $schedules;
55
+ }
56
 
57
+ $schedules['weekly'] = array(
58
+ 'interval' => 604800,
59
+ 'display' => __( 'Once Weekly', 'imagify' ),
60
+ );
61
 
62
  return $schedules;
63
  }
64
 
65
+ add_action( 'init', '_imagify_update_library_size_calculations_scheduled' );
66
  /**
67
+ * Planning cron task to update weekly the size of the images and the size of images uploaded by month.
68
+ * If the task is not programmed, it is automatically triggered.
69
  *
70
  * @since 1.6
71
  * @author Remy Perona
72
  */
 
73
  function _imagify_update_library_size_calculations_scheduled() {
74
+ if ( ! wp_next_scheduled( 'imagify_update_library_size_calculations_event' ) ) {
75
+ wp_schedule_event( time(), 'weekly', 'imagify_update_library_size_calculations_event' );
76
+ }
77
  }
78
 
79
+ add_action( 'imagify_update_library_size_calculations_event', '_do_imagify_update_library_size_calculations' );
80
  /**
81
+ * Cron task to update weekly the size of the images and the size of images uploaded by month.
82
  *
83
  * @since 1.6
84
  * @author Remy Perona
85
  */
 
86
  function _do_imagify_update_library_size_calculations() {
87
+ imagify_do_async_job( array(
88
+ 'action' => 'imagify_update_estimate_sizes',
89
+ '_ajax_nonce' => wp_create_nonce( 'update_estimate_sizes' ),
90
+ ) );
91
+ }
inc/compat.php CHANGED
@@ -1,20 +1,231 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
-
4
- /**
5
- * Create a CURLFile object.
6
- *
7
- * @since PHP 5.5
8
- *
9
- * @param string $filename Path to the file which will be uploaded.
10
- * @param string $mimetype Mimetype of the file.
11
- * @param string $postname Name of the file to be used in the upload data.
12
- * @return string The CURLFile object.
13
- */
14
- if ( ! function_exists( 'curl_file_create' ) ) {
15
- function curl_file_create( $filename, $mimetype = '', $postname = '' ) {
16
- return "@$filename;filename="
17
- . ( $postname ? $postname : basename( $filename ) )
18
- . ( $mimetype ? ";type=$mimetype" : '' );
19
- }
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
+
4
+ if ( ! function_exists( 'curl_file_create' ) ) :
5
+
6
+ /**
7
+ * Create a CURLFile object.
8
+ *
9
+ * @since 1.0
10
+ * @since PHP 5.5
11
+ *
12
+ * @param string $filename Path to the file which will be uploaded.
13
+ * @param string $mimetype Mimetype of the file.
14
+ * @param string $postname Name of the file to be used in the upload data.
15
+ * @return string The CURLFile object.
16
+ */
17
+ function curl_file_create( $filename, $mimetype = '', $postname = '' ) {
18
+ return "@$filename;filename="
19
+ . ( $postname ? $postname : basename( $filename ) )
20
+ . ( $mimetype ? ";type=$mimetype" : '' );
21
+ }
22
+
23
+ endif;
24
+
25
+ if ( ! function_exists( 'wp_json_encode' ) ) :
26
+
27
+ /**
28
+ * Encode a variable into JSON, with some sanity checks.
29
+ *
30
+ * @since 1.6.5
31
+ * @since WP 4.1.0
32
+ *
33
+ * @param mixed $data Variable (usually an array or object) to encode as JSON.
34
+ * @param int $options Optional. Options to be passed to json_encode(). Default 0.
35
+ * @param int $depth Optional. Maximum depth to walk through $data. Must be greater than 0. Default 512.
36
+ * @return string|false The JSON encoded string, or false if it cannot be encoded.
37
+ */
38
+ function wp_json_encode( $data, $options = 0, $depth = 512 ) {
39
+ /*
40
+ * json_encode() has had extra params added over the years.
41
+ * $options was added in 5.3, and $depth in 5.5.
42
+ * We need to make sure we call it with the correct arguments.
43
+ */
44
+ if ( version_compare( PHP_VERSION, '5.5', '>=' ) ) {
45
+ $args = array( $data, $options, $depth );
46
+ } elseif ( version_compare( PHP_VERSION, '5.3', '>=' ) ) {
47
+ $args = array( $data, $options );
48
+ } else {
49
+ $args = array( $data );
50
+ }
51
+
52
+ // Prepare the data for JSON serialization.
53
+ $args[0] = _wp_json_prepare_data( $data );
54
+
55
+ $json = @call_user_func_array( 'json_encode', $args );
56
+
57
+ // If json_encode() was successful, no need to do more sanity checking.
58
+ // ... unless we're in an old version of PHP, and json_encode() returned
59
+ // a string containing 'null'. Then we need to do more sanity checking.
60
+ if ( false !== $json && ( version_compare( PHP_VERSION, '5.5', '>=' ) || false === strpos( $json, 'null' ) ) ) {
61
+ return $json;
62
+ }
63
+
64
+ try {
65
+ $args[0] = _wp_json_sanity_check( $data, $depth );
66
+ } catch ( Exception $e ) {
67
+ return false;
68
+ }
69
+
70
+ return call_user_func_array( 'json_encode', $args );
71
+ }
72
+
73
+ endif;
74
+
75
+ if ( ! function_exists( '_wp_json_prepare_data' ) ) :
76
+
77
+ /**
78
+ * Prepares response data to be serialized to JSON.
79
+ *
80
+ * This supports the JsonSerializable interface for PHP 5.2-5.3 as well.
81
+ *
82
+ * @since 1.6.5
83
+ * @since WP 4.4.0
84
+ * @access private
85
+ *
86
+ * @param mixed $data Native representation.
87
+ * @return bool|int|float|null|string|array Data ready for `json_encode()`.
88
+ */
89
+ function _wp_json_prepare_data( $data ) {
90
+ if ( ! defined( 'WP_JSON_SERIALIZE_COMPATIBLE' ) || WP_JSON_SERIALIZE_COMPATIBLE === false ) {
91
+ return $data;
92
+ }
93
+
94
+ switch ( gettype( $data ) ) {
95
+ case 'boolean':
96
+ case 'integer':
97
+ case 'double':
98
+ case 'string':
99
+ case 'NULL':
100
+ // These values can be passed through.
101
+ return $data;
102
+
103
+ case 'array':
104
+ // Arrays must be mapped in case they also return objects.
105
+ return array_map( '_wp_json_prepare_data', $data );
106
+
107
+ case 'object':
108
+ // If this is an incomplete object (__PHP_Incomplete_Class), bail.
109
+ if ( ! is_object( $data ) ) {
110
+ return null;
111
+ }
112
+
113
+ if ( $data instanceof JsonSerializable ) {
114
+ $data = $data->jsonSerialize();
115
+ } else {
116
+ $data = get_object_vars( $data );
117
+ }
118
+
119
+ // Now, pass the array (or whatever was returned from jsonSerialize through).
120
+ return _wp_json_prepare_data( $data );
121
+
122
+ default:
123
+ return null;
124
+ }
125
+ }
126
+
127
+ endif;
128
+
129
+ if ( ! function_exists( '_wp_json_sanity_check' ) ) :
130
+
131
+ /**
132
+ * Perform sanity checks on data that shall be encoded to JSON.
133
+ *
134
+ * @since 1.6.5
135
+ * @since WP 4.1.0
136
+ * @access private
137
+ * @throws Exception If the depth limit is reached.
138
+ *
139
+ * @see wp_json_encode()
140
+ *
141
+ * @param mixed $data Variable (usually an array or object) to encode as JSON.
142
+ * @param int $depth Maximum depth to walk through $data. Must be greater than 0.
143
+ * @return mixed The sanitized data that shall be encoded to JSON.
144
+ */
145
+ function _wp_json_sanity_check( $data, $depth ) {
146
+ if ( $depth < 0 ) {
147
+ throw new Exception( 'Reached depth limit' );
148
+ }
149
+
150
+ if ( is_array( $data ) ) {
151
+ $output = array();
152
+ foreach ( $data as $id => $el ) {
153
+ // Don't forget to sanitize the ID!
154
+ if ( is_string( $id ) ) {
155
+ $clean_id = _wp_json_convert_string( $id );
156
+ } else {
157
+ $clean_id = $id;
158
+ }
159
+
160
+ // Check the element type, so that we're only recursing if we really have to.
161
+ if ( is_array( $el ) || is_object( $el ) ) {
162
+ $output[ $clean_id ] = _wp_json_sanity_check( $el, $depth - 1 );
163
+ } elseif ( is_string( $el ) ) {
164
+ $output[ $clean_id ] = _wp_json_convert_string( $el );
165
+ } else {
166
+ $output[ $clean_id ] = $el;
167
+ }
168
+ }
169
+ } elseif ( is_object( $data ) ) {
170
+ $output = new stdClass;
171
+ foreach ( $data as $id => $el ) {
172
+ if ( is_string( $id ) ) {
173
+ $clean_id = _wp_json_convert_string( $id );
174
+ } else {
175
+ $clean_id = $id;
176
+ }
177
+
178
+ if ( is_array( $el ) || is_object( $el ) ) {
179
+ $output->$clean_id = _wp_json_sanity_check( $el, $depth - 1 );
180
+ } elseif ( is_string( $el ) ) {
181
+ $output->$clean_id = _wp_json_convert_string( $el );
182
+ } else {
183
+ $output->$clean_id = $el;
184
+ }
185
+ }
186
+ } elseif ( is_string( $data ) ) {
187
+ return _wp_json_convert_string( $data );
188
+ } else {
189
+ return $data;
190
+ } // End if().
191
+
192
+ return $output;
193
+ }
194
+
195
+ endif;
196
+
197
+ if ( ! function_exists( '_wp_json_convert_string' ) ) :
198
+
199
+ /**
200
+ * Convert a string to UTF-8, so that it can be safely encoded to JSON.
201
+ *
202
+ * @since 1.6.5
203
+ * @since WP 4.1.0
204
+ * @access private
205
+ *
206
+ * @see _wp_json_sanity_check()
207
+ *
208
+ * @staticvar bool $use_mb
209
+ *
210
+ * @param string $string The string which is to be converted.
211
+ * @return string The checked string.
212
+ */
213
+ function _wp_json_convert_string( $string ) {
214
+ static $use_mb = null;
215
+ if ( is_null( $use_mb ) ) {
216
+ $use_mb = function_exists( 'mb_convert_encoding' );
217
+ }
218
+
219
+ if ( $use_mb ) {
220
+ $encoding = mb_detect_encoding( $string, mb_detect_order(), true );
221
+ if ( $encoding ) {
222
+ return mb_convert_encoding( $string, 'UTF-8', $encoding );
223
+ } else {
224
+ return mb_convert_encoding( $string, 'UTF-8', 'UTF-8' );
225
+ }
226
+ } else {
227
+ return wp_check_invalid_utf8( $string, true );
228
+ }
229
+ }
230
+
231
+ endif;
inc/functions/admin-stats.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
- /*
5
  * Count number of attachments.
6
  *
7
  * @since 1.0
@@ -11,39 +11,42 @@ defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
11
  */
12
  function imagify_count_attachments() {
13
  global $wpdb;
 
14
 
15
  /**
16
- * Filter the number of attachments
17
- * 3rd party will be able to override the result
18
  *
19
  * @since 1.5
20
- */
21
- $count = apply_filters( 'imagify_count_attachments', false );
22
-
23
- if ( false !== $count ) {
24
- return $count;
 
 
25
  }
26
 
27
- static $count;
 
 
28
 
29
- if ( ! $count ) {
30
- $count = $wpdb->get_var(
31
- "SELECT COUNT($wpdb->posts.ID)
32
- FROM $wpdb->posts
33
- WHERE post_type = 'attachment'
34
- AND post_status != 'trash'
35
- AND ($wpdb->posts.post_mime_type = 'image/jpeg' OR $wpdb->posts.post_mime_type = 'image/png' OR $wpdb->posts.post_mime_type = 'image/gif')"
36
- );
37
 
38
- if ( $count > apply_filters( 'imagify_unoptimized_attachment_limit', 10000 ) ) {
39
- set_transient( 'imagify_large_library', 1 );
40
- }
41
  }
42
 
43
- return (int) $count;
44
  }
45
 
46
- /*
47
  * Count number of optimized attachments with an error.
48
  *
49
  * @since 1.0
@@ -53,39 +56,41 @@ function imagify_count_attachments() {
53
  */
54
  function imagify_count_error_attachments() {
55
  global $wpdb;
 
56
 
57
  /**
58
- * Filter the number of optimized attachments with an error
59
- * 3rd party will be able to override the result
60
  *
61
  * @since 1.5
62
- */
63
- $count = apply_filters( 'imagify_count_error_attachments', false );
64
-
65
- if ( false !== $count ) {
66
- return $count;
 
 
67
  }
68
-
69
- static $count;
70
-
71
- if ( ! $count ) {
72
- $count = $wpdb->get_var(
73
- "SELECT COUNT($wpdb->posts.ID)
74
- FROM $wpdb->posts
75
- INNER JOIN $wpdb->postmeta
76
- ON $wpdb->posts.ID = $wpdb->postmeta.post_id
77
- WHERE ($wpdb->posts.post_mime_type = 'image/jpeg' OR $wpdb->posts.post_mime_type = 'image/png' OR $wpdb->posts.post_mime_type = 'image/gif')
78
- AND ( ( $wpdb->postmeta.meta_key = '_imagify_status' AND CAST($wpdb->postmeta.meta_value AS CHAR) = 'error' )
79
- )
80
- AND $wpdb->posts.post_type = 'attachment'
81
- AND $wpdb->posts.post_status = 'inherit'"
82
- );
83
  }
84
 
85
- return (int) $count;
 
 
 
 
 
 
 
 
 
 
 
86
  }
87
 
88
- /*
89
  * Count number of optimized attachments (by Imagify or an other tool before).
90
  *
91
  * @since 1.0
@@ -95,38 +100,41 @@ function imagify_count_error_attachments() {
95
  */
96
  function imagify_count_optimized_attachments() {
97
  global $wpdb;
 
98
 
99
  /**
100
- * Filter the number of optimized attachments
101
- * 3rd party will be able to override the result
102
  *
103
  * @since 1.5
104
- */
105
- $count = apply_filters( 'imagify_count_optimized_attachments', false );
106
-
107
- if ( false !== $count ) {
108
- return $count;
 
 
109
  }
110
-
111
- static $count;
112
-
113
- if ( ! $count ) {
114
- $count = $wpdb->get_var(
115
- "SELECT COUNT($wpdb->posts.ID)
116
- FROM $wpdb->posts
117
- INNER JOIN $wpdb->postmeta
118
- ON $wpdb->posts.ID = $wpdb->postmeta.post_id
119
- WHERE ($wpdb->posts.post_mime_type = 'image/jpeg' OR $wpdb->posts.post_mime_type = 'image/png' OR $wpdb->posts.post_mime_type = 'image/gif')
120
- AND ( ( $wpdb->postmeta.meta_key = '_imagify_status' AND CAST($wpdb->postmeta.meta_value AS CHAR) = 'success' ) OR ( $wpdb->postmeta.meta_key = '_imagify_status' AND CAST($wpdb->postmeta.meta_value AS CHAR) = 'already_optimized' ) )
121
- AND $wpdb->posts.post_type = 'attachment'
122
- AND $wpdb->posts.post_status = 'inherit'"
123
- );
124
  }
125
 
126
- return (int) $count;
 
 
 
 
 
 
 
 
 
 
 
127
  }
128
 
129
- /*
130
  * Count number of unoptimized attachments.
131
  *
132
  * @since 1.0
@@ -136,27 +144,23 @@ function imagify_count_optimized_attachments() {
136
  */
137
  function imagify_count_unoptimized_attachments() {
138
  /**
139
- * Filter the number of unoptimized attachments
140
- * 3rd party will be able to override the result
141
  *
142
  * @since 1.5
143
- */
144
- $count = apply_filters( 'imagify_count_unoptimized_attachments', false );
145
-
146
- if ( false !== $count ) {
147
- return $count;
148
- }
149
-
150
- static $count;
151
-
152
- if ( ! $count ) {
153
- $count = imagify_count_attachments() - imagify_count_optimized_attachments() - imagify_count_error_attachments();
154
  }
155
 
156
- return (int) $count;
157
  }
158
 
159
- /*
160
  * Count percent of optimized attachments.
161
  *
162
  * @since 1.0
@@ -166,50 +170,53 @@ function imagify_count_unoptimized_attachments() {
166
  */
167
  function imagify_percent_optimized_attachments() {
168
  /**
169
- * Filter the percent of optimized attachments
170
- * 3rd party will be able to override the result
171
  *
172
  * @since 1.5
173
- */
 
 
174
  $percent = apply_filters( 'imagify_percent_optimized_attachments', false );
175
 
176
- if ( false === $percent ) {
177
- $total_attachments = imagify_count_attachments();
178
- $total_optimized_attachments = imagify_count_optimized_attachments();
179
-
180
- $percent = ( 0 !== $total_attachments ) ? round( ( 100 - ( ( $total_attachments - ( $total_optimized_attachments ) ) / $total_attachments ) * 100 ) ) : 0;
181
  }
182
 
183
- return $percent;
 
 
 
184
  }
185
 
186
- /*
187
  * Count percent, original & optimized size of all images optimized by Imagify.
188
  *
189
  * @since 1.0
190
  * @author Jonathan Buttigieg
191
  *
192
- * @return array An array containing the optimization data.
 
193
  */
194
  function imagify_count_saving_data( $key = '' ) {
195
  global $wpdb;
196
 
197
  /**
198
- * Filter the query to get all optimized attachments
199
- * 3rd party will be able to override the result
200
  *
201
  * @since 1.5
202
- */
203
  $attachments = apply_filters( 'imagify_count_saving_data', false );
204
 
205
  if ( false === $attachments ) {
206
- $attachments = $wpdb->get_col(
207
- "SELECT pm1.meta_value
208
- FROM $wpdb->postmeta as pm1
209
- INNER JOIN $wpdb->postmeta as pm2
210
- ON pm1.post_id = pm2.post_id
211
- WHERE pm1.meta_key= '_imagify_data'
212
- AND ( pm2.meta_key= '_imagify_status' AND pm2.meta_value= 'success' )"
213
  );
214
  }
215
 
@@ -217,271 +224,275 @@ function imagify_count_saving_data( $key = '' ) {
217
 
218
  $original_size = 0;
219
  $optimized_size = 0;
220
- $count = 0;
221
 
222
  foreach ( $attachments as $attachment_data ) {
223
  if ( ! $attachment_data ) {
224
  continue;
225
  }
226
-
227
  $stats_data = $attachment_data['stats'];
228
  $original_data = $attachment_data['sizes']['full'];
229
 
230
- // Incremente the original sizes
231
- $original_size += ( $original_data['original_size'] ) ? $original_data['original_size'] : 0;
232
- $optimized_size += ( $original_data['optimized_size'] ) ? $original_data['optimized_size'] : 0;
233
 
234
  unset( $attachment_data['sizes']['full'] );
235
 
236
- // Incremente the thumbnails sizes
237
  foreach ( $attachment_data['sizes'] as $size_key => $size_data ) {
238
  if ( ! empty( $size_data['success'] ) ) {
239
- $original_size += ( $size_data['original_size'] ) ? $size_data['original_size'] : 0;
240
- $optimized_size += ( $size_data['optimized_size'] ) ? $size_data['optimized_size'] : 0;
241
  }
242
  }
243
  }
244
 
245
  $data = array(
246
- 'count' => count( $attachments ),
247
- 'original_size' => (int) $original_size,
248
- 'optimized_size' => (int) $optimized_size,
249
- 'percent' => ( 0 !== $optimized_size ) ? ceil( ( ( $original_size - $optimized_size ) / $original_size ) * 100 ) : 0
250
  );
251
 
252
  if ( ! empty( $key ) ) {
253
- return $data[ $key ];
254
  }
255
 
256
  return $data;
257
  }
258
 
259
  /**
260
- * Returns the estimated total size of the images not optimized
261
  *
262
  * We estimate the total size of the images in the library by getting the latest 250 images and their thumbnails
263
- * add up their filesizes, and doing some maths to get the total size
264
- *
265
- * @return (int) the current estimated total size of images not optimized
266
  *
267
  * @since 1.6
268
  * @author Remy Perona
 
 
269
  */
270
  function imagify_calculate_total_size_images_library() {
271
- global $wpdb;
272
 
273
- $images_id = $wpdb->get_results( "
274
- SELECT ID FROM $wpdb->posts
275
- WHERE (post_mime_type LIKE 'image/%')
276
- AND post_type = 'attachment' AND (post_status = 'inherit')
277
- LIMIT 250
278
- ", ARRAY_A );
279
 
280
- $images_id = wp_list_pluck( $images_id, 'ID' );
281
 
282
- if ( ! (bool) $images_id ) {
283
- return 0;
284
- }
285
 
286
- $partial_total_images = count( $images_id );
287
- $total_images = imagify_count_attachments();
288
- $total_size_images = imagify_calculate_total_image_size( $images_id, $partial_total_images, $total_images );
289
 
290
- return (int) $total_size_images;
291
- }
292
 
293
  /**
294
- * Returns the estimated average size of the images uploaded per month
295
  *
296
  * We estimate the average size of the images uploaded in the library per month by getting the latest 250 images and their thumbnails
297
- * for the 3 latest months, add up their filesizes, and doing some maths to get the total average size
298
- *
299
- * @return (int) the current estimated average size of images uploaded per month
300
  *
301
  * @since 1.6
302
  * @author Remy Perona
 
 
303
  */
304
  function imagify_calculate_average_size_images_per_month() {
305
- $imagify_mime_types = get_imagify_mime_type();
306
-
307
- $partial_images_uploaded_last_month = new WP_Query( array(
308
- 'post_type' => 'attachment',
309
- 'post_status' => 'inherit',
310
- 'post_mime_type' => $imagify_mime_types,
311
- 'posts_per_page' => 250,
312
- 'date_query' => array(
313
- array(
314
- 'before' => 'now',
315
- 'after' => '1 month ago'
316
- )
317
- ),
318
- 'fields' => 'ids'
319
- ) );
320
-
321
- $partial_images_uploaded_two_months_ago = new WP_Query( array(
322
- 'post_type' => 'attachment',
323
- 'post_status' => 'inherit',
324
- 'post_mime_type' => $imagify_mime_types,
325
- 'posts_per_page' => 250,
326
- 'date_query' => array(
327
- array(
328
- 'before' => '1 month ago',
329
- 'after' => '2 months ago'
330
- )
331
- ),
332
- 'fields' => 'ids'
333
- ) );
334
-
335
- $partial_images_uploaded_three_months_ago = new WP_Query( array(
336
- 'post_type' => 'attachment',
337
- 'post_status' => 'inherit',
338
- 'post_mime_type' => $imagify_mime_types,
339
- 'posts_per_page' => 250,
340
- 'date_query' => array(
341
- array(
342
- 'before' => '2 months ago',
343
- 'after' => '3 months ago'
344
- )
345
- ),
346
- 'fields' => 'ids'
347
- ) );
348
-
349
- $images_uploaded_id = new WP_Query( array(
350
- 'post_type' => 'attachment',
351
- 'post_status' => 'inherit',
352
- 'post_mime_type' => $imagify_mime_types,
353
- 'posts_per_page' => -1,
354
- 'date_query' => array(
355
- array(
356
- 'before' => 'now',
357
- 'after' => '3 months ago'
358
- )
359
- ),
360
- 'fields' => 'ids'
361
- ) );
362
-
363
- $partial_images_uploaded_id = array_merge( $partial_images_uploaded_last_month->posts, $partial_images_uploaded_two_months_ago->posts, $partial_images_uploaded_three_months_ago->posts );
364
-
365
- if ( ! (bool) $partial_images_uploaded_id ) {
366
- return 0;
367
- }
368
-
369
- if ( ! (bool) $images_uploaded_id->posts ) {
370
- return 0;
371
- }
372
-
373
- $partial_total_images_uploaded = count( $partial_images_uploaded_id );
374
- $total_images_uploaded = $images_uploaded_id->post_count;
375
- $average_size_images_per_month = imagify_calculate_total_image_size( $partial_images_uploaded_id, $partial_total_images_uploaded, $total_images_uploaded ) / 3;
376
-
377
- return $average_size_images_per_month;
378
  }
379
 
380
  /**
381
- * Returns the estimated total size of images
382
- *
383
- * @param array $images_id Array of images ID
384
- * @param int $partial_total_images The number of images we're doing the calculation with
385
- * @param int $total_images The total number of images
386
- * @return int The estimated total size of images
387
  *
388
  * @since 1.6
389
  * @author Remy Perona
 
 
 
 
 
390
  */
391
  function imagify_calculate_total_image_size( $images_id, $partial_total_images, $total_images ) {
392
- global $wpdb;
393
- $partial_size_images = '';
394
- $partial_total_intermediate_images = '';
395
- $sql_ids = implode( ',', $images_id );
396
-
397
- // Get attachments filename
398
- $attachments_filename = $wpdb->get_results(
399
- "SELECT pm.post_id as id, pm.meta_value as value
400
- FROM $wpdb->postmeta as pm
401
- WHERE pm.meta_key= '_wp_attached_file'
402
- AND pm.post_id IN ($sql_ids)
403
- ORDER BY pm.post_id DESC"
404
- , ARRAY_A
 
405
  );
406
 
407
- $attachments_filename = imagify_query_results_combine( $images_id, $attachments_filename );
408
-
409
- // Get attachments data
410
- $attachments_data = $wpdb->get_results(
411
- "SELECT pm.post_id as id, pm.meta_value as value
412
- FROM $wpdb->postmeta as pm
413
- WHERE pm.meta_key= '_wp_attachment_metadata'
414
- AND pm.post_id IN ($sql_ids)
415
- ORDER BY pm.post_id DESC"
416
- , ARRAY_A
 
417
  );
418
-
419
- $attachments_data = imagify_query_results_combine( $images_id, $attachments_data );
420
  $attachments_data = array_map( 'maybe_unserialize', $attachments_data );
421
 
422
- // Get imagify data
423
- $imagify_data = $wpdb->get_results(
424
- "SELECT pm.post_id as id, pm.meta_value as value
425
- FROM $wpdb->postmeta as pm
426
- WHERE pm.meta_key= '_imagify_data'
427
- AND pm.post_id IN ($sql_ids)
428
- ORDER BY pm.post_id DESC"
429
- , ARRAY_A
 
430
  );
431
-
432
- $imagify_data = imagify_query_results_combine( $images_id, $imagify_data );
433
  $imagify_data = array_map( 'maybe_unserialize', $imagify_data );
434
-
435
- // Get attachments status
436
- $attachments_status = $wpdb->get_results(
437
- "SELECT pm.post_id as id, pm.meta_value as value
438
- FROM $wpdb->postmeta as pm
439
- WHERE pm.meta_key= '_imagify_status'
440
- AND pm.post_id IN ($sql_ids)
441
- ORDER BY pm.post_id DESC"
442
- , ARRAY_A
 
443
  );
444
-
445
  $attachments_status = imagify_query_results_combine( $images_id, $attachments_status );
446
 
447
- foreach( $images_id as $image_id ) {
448
- $attachment_status = ( isset( $attachments_status[ $image_id ] ) ) ? $attachments_status[ $image_id ] : false;
449
-
450
- if ( $attachments_status === 'success' ) {
451
- $imagify_data = ( isset( $imagify_data[ $image_id ] ) ) ? $imagify_data[ $image_id ] : false;
452
- $partial_size_images += $imagify_data['stats']['original_size'];
453
- foreach ( $attachment_data['sizes'] as $size ) {
454
- $partial_total_intermediate_images++;
455
- }
456
- continue;
457
- }
458
-
459
- $attachment_metadata = ( isset( $attachments_data[ $image_id ] ) ) ? $attachments_data[ $image_id ] : false;
460
- $sizes = ( isset( $attachment_metadata['sizes'] ) ) ? (array) $attachment_metadata['sizes'] : array();
461
-
462
- /** This filter is documented in inc/functions/process.php */
463
- $full_image = apply_filters( 'imagify_file_path', get_imagify_attached_file( $attachments_filename[ $image_id ] ) );
464
- $partial_size_images += filesize( $full_image );
465
-
466
- if ( (bool) $sizes ) {
467
- foreach ( $sizes as $size_key => $size_data ) {
468
- if ( array_key_exists( $size_key, get_imagify_option( 'disallowed-sizes', array() ) ) && ! imagify_is_active_for_network() ) {
469
- continue;
470
- }
471
-
472
- $thumbnail_path = trailingslashit( dirname( $full_image ) ) . $size_data['file'];
473
-
474
- if ( file_exists( $thumbnail_path ) ) {
475
- $partial_size_images += filesize( $thumbnail_path );
476
- $partial_total_intermediate_images++;
477
- }
478
- }
479
- }
480
- }
481
-
482
- $intermediate_images_per_image = $partial_total_intermediate_images / $partial_total_images;
483
- $average_size_images = $partial_size_images / ( $partial_total_images + $partial_total_intermediate_images );
484
- $total_size_images = $average_size_images * ( $total_images + ( $intermediate_images_per_image * $total_images ) );
485
-
486
- return $total_size_images;
487
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ /**
5
  * Count number of attachments.
6
  *
7
  * @since 1.0
11
  */
12
  function imagify_count_attachments() {
13
  global $wpdb;
14
+ static $count;
15
 
16
  /**
17
+ * Filter the number of attachments.
18
+ * 3rd party will be able to override the result.
19
  *
20
  * @since 1.5
21
+ *
22
+ * @param int|bool $pre_count Default is false. Provide an integer.
23
+ */
24
+ $pre_count = apply_filters( 'imagify_count_attachments', false );
25
+
26
+ if ( false !== $pre_count ) {
27
+ return (int) $pre_count;
28
  }
29
 
30
+ if ( isset( $count ) ) {
31
+ return $count;
32
+ }
33
 
34
+ $count = (int) $wpdb->get_var( "
35
+ SELECT COUNT( $wpdb->posts.ID )
36
+ FROM $wpdb->posts
37
+ WHERE post_type = 'attachment'
38
+ AND post_status != 'trash'
39
+ AND ( $wpdb->posts.post_mime_type = 'image/jpeg' OR $wpdb->posts.post_mime_type = 'image/png' OR $wpdb->posts.post_mime_type = 'image/gif' )"
40
+ );
 
41
 
42
+ if ( $count > apply_filters( 'imagify_unoptimized_attachment_limit', 10000 ) ) {
43
+ set_transient( 'imagify_large_library', 1 );
 
44
  }
45
 
46
+ return $count;
47
  }
48
 
49
+ /**
50
  * Count number of optimized attachments with an error.
51
  *
52
  * @since 1.0
56
  */
57
  function imagify_count_error_attachments() {
58
  global $wpdb;
59
+ static $count;
60
 
61
  /**
62
+ * Filter the number of optimized attachments with an error.
63
+ * 3rd party will be able to override the result.
64
  *
65
  * @since 1.5
66
+ *
67
+ * @param int|bool $pre_count Default is false. Provide an integer.
68
+ */
69
+ $pre_count = apply_filters( 'imagify_count_error_attachments', false );
70
+
71
+ if ( false !== $pre_count ) {
72
+ return (int) $pre_count;
73
  }
74
+
75
+ if ( isset( $count ) ) {
76
+ return $count;
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
78
 
79
+ $count = (int) $wpdb->get_var( "
80
+ SELECT COUNT( $wpdb->posts.ID )
81
+ FROM $wpdb->posts
82
+ INNER JOIN $wpdb->postmeta
83
+ ON $wpdb->posts.ID = $wpdb->postmeta.post_id
84
+ WHERE ( $wpdb->posts.post_mime_type = 'image/jpeg' OR $wpdb->posts.post_mime_type = 'image/png' OR $wpdb->posts.post_mime_type = 'image/gif' )
85
+ AND $wpdb->postmeta.meta_key = '_imagify_status' AND CAST( $wpdb->postmeta.meta_value AS CHAR ) = 'error'
86
+ AND $wpdb->posts.post_type = 'attachment'
87
+ AND $wpdb->posts.post_status = 'inherit'"
88
+ );
89
+
90
+ return $count;
91
  }
92
 
93
+ /**
94
  * Count number of optimized attachments (by Imagify or an other tool before).
95
  *
96
  * @since 1.0
100
  */
101
  function imagify_count_optimized_attachments() {
102
  global $wpdb;
103
+ static $count;
104
 
105
  /**
106
+ * Filter the number of optimized attachments.
107
+ * 3rd party will be able to override the result.
108
  *
109
  * @since 1.5
110
+ *
111
+ * @param int|bool $pre_count Default is false. Provide an integer.
112
+ */
113
+ $pre_count = apply_filters( 'imagify_count_optimized_attachments', false );
114
+
115
+ if ( false !== $pre_count ) {
116
+ return (int) $pre_count;
117
  }
118
+
119
+ if ( isset( $count ) ) {
120
+ return $count;
 
 
 
 
 
 
 
 
 
 
 
121
  }
122
 
123
+ $count = (int) $wpdb->get_var( "
124
+ SELECT COUNT( $wpdb->posts.ID )
125
+ FROM $wpdb->posts
126
+ INNER JOIN $wpdb->postmeta
127
+ ON $wpdb->posts.ID = $wpdb->postmeta.post_id
128
+ WHERE ( $wpdb->posts.post_mime_type = 'image/jpeg' OR $wpdb->posts.post_mime_type = 'image/png' OR $wpdb->posts.post_mime_type = 'image/gif' )
129
+ AND ( ( $wpdb->postmeta.meta_key = '_imagify_status' AND CAST( $wpdb->postmeta.meta_value AS CHAR ) = 'success' ) OR ( $wpdb->postmeta.meta_key = '_imagify_status' AND CAST( $wpdb->postmeta.meta_value AS CHAR ) = 'already_optimized' ) )
130
+ AND $wpdb->posts.post_type = 'attachment'
131
+ AND $wpdb->posts.post_status = 'inherit'"
132
+ );
133
+
134
+ return $count;
135
  }
136
 
137
+ /**
138
  * Count number of unoptimized attachments.
139
  *
140
  * @since 1.0
144
  */
145
  function imagify_count_unoptimized_attachments() {
146
  /**
147
+ * Filter the number of unoptimized attachments.
148
+ * 3rd party will be able to override the result.
149
  *
150
  * @since 1.5
151
+ *
152
+ * @param int|bool $pre_count Default is false. Provide an integer.
153
+ */
154
+ $pre_count = apply_filters( 'imagify_count_unoptimized_attachments', false );
155
+
156
+ if ( false !== $pre_count ) {
157
+ return (int) $pre_count;
 
 
 
 
158
  }
159
 
160
+ return imagify_count_attachments() - imagify_count_optimized_attachments() - imagify_count_error_attachments();
161
  }
162
 
163
+ /**
164
  * Count percent of optimized attachments.
165
  *
166
  * @since 1.0
170
  */
171
  function imagify_percent_optimized_attachments() {
172
  /**
173
+ * Filter the percent of optimized attachments.
174
+ * 3rd party will be able to override the result.
175
  *
176
  * @since 1.5
177
+ *
178
+ * @param int|bool $percent Default is false. Provide an integer.
179
+ */
180
  $percent = apply_filters( 'imagify_percent_optimized_attachments', false );
181
 
182
+ if ( false !== $percent ) {
183
+ return (int) $percent;
 
 
 
184
  }
185
 
186
+ $total_attachments = imagify_count_attachments();
187
+ $total_optimized_attachments = imagify_count_optimized_attachments();
188
+
189
+ return ( 0 !== $total_attachments ) ? round( ( 100 - ( ( $total_attachments - $total_optimized_attachments ) / $total_attachments ) * 100 ) ) : 0;
190
  }
191
 
192
+ /**
193
  * Count percent, original & optimized size of all images optimized by Imagify.
194
  *
195
  * @since 1.0
196
  * @author Jonathan Buttigieg
197
  *
198
+ * @param string $key What data to return. Choices are between 'count', 'original_size', 'optimized_size', and 'percent'. If left empty, the whole array is returned.
199
+ * @return array|int An array containing the optimization data. A single data if $key is provided.
200
  */
201
  function imagify_count_saving_data( $key = '' ) {
202
  global $wpdb;
203
 
204
  /**
205
+ * Filter the query to get all optimized attachments.
206
+ * 3rd party will be able to override the result.
207
  *
208
  * @since 1.5
209
+ */
210
  $attachments = apply_filters( 'imagify_count_saving_data', false );
211
 
212
  if ( false === $attachments ) {
213
+ $attachments = $wpdb->get_col( "
214
+ SELECT pm1.meta_value
215
+ FROM $wpdb->postmeta as pm1
216
+ INNER JOIN $wpdb->postmeta as pm2
217
+ ON pm1.post_id = pm2.post_id
218
+ WHERE pm1.meta_key = '_imagify_data'
219
+ AND ( pm2.meta_key = '_imagify_status' AND pm2.meta_value = 'success' )"
220
  );
221
  }
222
 
224
 
225
  $original_size = 0;
226
  $optimized_size = 0;
227
+ $count = 0;
228
 
229
  foreach ( $attachments as $attachment_data ) {
230
  if ( ! $attachment_data ) {
231
  continue;
232
  }
233
+
234
  $stats_data = $attachment_data['stats'];
235
  $original_data = $attachment_data['sizes']['full'];
236
 
237
+ // Increment the original sizes.
238
+ $original_size += $original_data['original_size'];
239
+ $optimized_size += $original_data['optimized_size'];
240
 
241
  unset( $attachment_data['sizes']['full'] );
242
 
243
+ // Increment the thumbnails sizes.
244
  foreach ( $attachment_data['sizes'] as $size_key => $size_data ) {
245
  if ( ! empty( $size_data['success'] ) ) {
246
+ $original_size += $size_data['original_size'];
247
+ $optimized_size += $size_data['optimized_size'];
248
  }
249
  }
250
  }
251
 
252
  $data = array(
253
+ 'count' => count( $attachments ),
254
+ 'original_size' => $original_size,
255
+ 'optimized_size' => $optimized_size,
256
+ 'percent' => $optimized_size ? ceil( ( ( $original_size - $optimized_size ) / $original_size ) * 100 ) : 0,
257
  );
258
 
259
  if ( ! empty( $key ) ) {
260
+ return isset( $data[ $key ] ) ? $data[ $key ] : 0;
261
  }
262
 
263
  return $data;
264
  }
265
 
266
  /**
267
+ * Returns the estimated total size of the images not optimized.
268
  *
269
  * We estimate the total size of the images in the library by getting the latest 250 images and their thumbnails
270
+ * add up their filesizes, and doing some maths to get the total size.
 
 
271
  *
272
  * @since 1.6
273
  * @author Remy Perona
274
+ *
275
+ * @return int The current estimated total size of images not optimized.
276
  */
277
  function imagify_calculate_total_size_images_library() {
278
+ global $wpdb;
279
 
280
+ $images_id = $wpdb->get_results( "
281
+ SELECT ID FROM $wpdb->posts
282
+ WHERE ( post_mime_type LIKE 'image/%' )
283
+ AND post_type = 'attachment' AND ( post_status = 'inherit' )
284
+ LIMIT 250
285
+ ", ARRAY_A );
286
 
287
+ $images_id = wp_list_pluck( $images_id, 'ID' );
288
 
289
+ if ( ! $images_id ) {
290
+ return 0;
291
+ }
292
 
293
+ $partial_total_images = count( $images_id );
294
+ $total_images = imagify_count_attachments();
295
+ $total_size_images = imagify_calculate_total_image_size( $images_id, $partial_total_images, $total_images );
296
 
297
+ return $total_size_images;
298
+ }
299
 
300
  /**
301
+ * Returns the estimated average size of the images uploaded per month.
302
  *
303
  * We estimate the average size of the images uploaded in the library per month by getting the latest 250 images and their thumbnails
304
+ * for the 3 latest months, add up their filesizes, and doing some maths to get the total average size.
 
 
305
  *
306
  * @since 1.6
307
  * @author Remy Perona
308
+ *
309
+ * @return int The current estimated average size of images uploaded per month.
310
  */
311
  function imagify_calculate_average_size_images_per_month() {
312
+ $imagify_mime_types = get_imagify_mime_type();
313
+
314
+ $partial_images_uploaded_last_month = new WP_Query( array(
315
+ 'post_type' => 'attachment',
316
+ 'post_status' => 'inherit',
317
+ 'post_mime_type' => $imagify_mime_types,
318
+ 'posts_per_page' => 250,
319
+ 'date_query' => array(
320
+ array(
321
+ 'before' => 'now',
322
+ 'after' => '1 month ago',
323
+ ),
324
+ ),
325
+ 'fields' => 'ids',
326
+ ) );
327
+
328
+ $partial_images_uploaded_two_months_ago = new WP_Query( array(
329
+ 'post_type' => 'attachment',
330
+ 'post_status' => 'inherit',
331
+ 'post_mime_type' => $imagify_mime_types,
332
+ 'posts_per_page' => 250,
333
+ 'date_query' => array(
334
+ array(
335
+ 'before' => '1 month ago',
336
+ 'after' => '2 months ago',
337
+ ),
338
+ ),
339
+ 'fields' => 'ids',
340
+ ) );
341
+
342
+ $partial_images_uploaded_three_months_ago = new WP_Query( array(
343
+ 'post_type' => 'attachment',
344
+ 'post_status' => 'inherit',
345
+ 'post_mime_type' => $imagify_mime_types,
346
+ 'posts_per_page' => 250,
347
+ 'date_query' => array(
348
+ array(
349
+ 'before' => '2 months ago',
350
+ 'after' => '3 months ago',
351
+ ),
352
+ ),
353
+ 'fields' => 'ids',
354
+ ) );
355
+
356
+ $partial_images_uploaded_id = array_merge( $partial_images_uploaded_last_month->posts, $partial_images_uploaded_two_months_ago->posts, $partial_images_uploaded_three_months_ago->posts );
357
+
358
+ if ( ! $partial_images_uploaded_id ) {
359
+ return 0;
360
+ }
361
+
362
+ $images_uploaded_id = new WP_Query( array(
363
+ 'post_type' => 'attachment',
364
+ 'post_status' => 'inherit',
365
+ 'post_mime_type' => $imagify_mime_types,
366
+ 'posts_per_page' => -1,
367
+ 'date_query' => array(
368
+ array(
369
+ 'before' => 'now',
370
+ 'after' => '3 months ago',
371
+ ),
372
+ ),
373
+ 'fields' => 'ids',
374
+ ) );
375
+
376
+ if ( ! $images_uploaded_id->posts ) {
377
+ return 0;
378
+ }
379
+
380
+ $partial_total_images_uploaded = count( $partial_images_uploaded_id );
381
+ $total_images_uploaded = $images_uploaded_id->post_count;
382
+ $average_size_images_per_month = imagify_calculate_total_image_size( $partial_images_uploaded_id, $partial_total_images_uploaded, $total_images_uploaded ) / 3;
383
+
384
+ return $average_size_images_per_month;
385
  }
386
 
387
  /**
388
+ * Returns the estimated total size of images.
 
 
 
 
 
389
  *
390
  * @since 1.6
391
  * @author Remy Perona
392
+ *
393
+ * @param array $images_id Array of images ID.
394
+ * @param int $partial_total_images The number of images we're doing the calculation with.
395
+ * @param int $total_images The total number of images.
396
+ * @return int The estimated total size of images.
397
  */
398
  function imagify_calculate_total_image_size( $images_id, $partial_total_images, $total_images ) {
399
+ global $wpdb;
400
+ $partial_size_images = '';
401
+ $partial_total_intermediate_images = '';
402
+ $sql_ids = implode( ',', $images_id );
403
+
404
+ // Get attachments filename.
405
+ $attachments_filename = $wpdb->get_results( // WPCS: unprepared SQL ok.
406
+ "
407
+ SELECT pm.post_id as id, pm.meta_value as value
408
+ FROM $wpdb->postmeta as pm
409
+ WHERE pm.meta_key = '_wp_attached_file'
410
+ AND pm.post_id IN ($sql_ids)
411
+ ORDER BY pm.post_id DESC
412
+ ", ARRAY_A
413
  );
414
 
415
+ $attachments_filename = imagify_query_results_combine( $images_id, $attachments_filename );
416
+
417
+ // Get attachments data.
418
+ $attachments_data = $wpdb->get_results( // WPCS: unprepared SQL ok.
419
+ "
420
+ SELECT pm.post_id as id, pm.meta_value as value
421
+ FROM $wpdb->postmeta as pm
422
+ WHERE pm.meta_key = '_wp_attachment_metadata'
423
+ AND pm.post_id IN ($sql_ids)
424
+ ORDER BY pm.post_id DESC
425
+ ", ARRAY_A
426
  );
427
+
428
+ $attachments_data = imagify_query_results_combine( $images_id, $attachments_data );
429
  $attachments_data = array_map( 'maybe_unserialize', $attachments_data );
430
 
431
+ // Get imagify data.
432
+ $imagify_data = $wpdb->get_results( // WPCS: unprepared SQL ok.
433
+ "
434
+ SELECT pm.post_id as id, pm.meta_value as value
435
+ FROM $wpdb->postmeta as pm
436
+ WHERE pm.meta_key = '_imagify_data'
437
+ AND pm.post_id IN ($sql_ids)
438
+ ORDER BY pm.post_id DESC
439
+ ", ARRAY_A
440
  );
441
+
442
+ $imagify_data = imagify_query_results_combine( $images_id, $imagify_data );
443
  $imagify_data = array_map( 'maybe_unserialize', $imagify_data );
444
+
445
+ // Get attachments status.
446
+ $attachments_status = $wpdb->get_results( // WPCS: unprepared SQL ok.
447
+ "
448
+ SELECT pm.post_id as id, pm.meta_value as value
449
+ FROM $wpdb->postmeta as pm
450
+ WHERE pm.meta_key = '_imagify_status'
451
+ AND pm.post_id IN ($sql_ids)
452
+ ORDER BY pm.post_id DESC
453
+ ", ARRAY_A
454
  );
455
+
456
  $attachments_status = imagify_query_results_combine( $images_id, $attachments_status );
457
 
458
+ foreach ( $images_id as $image_id ) {
459
+ $attachment_status = isset( $attachments_status[ $image_id ] ) ? $attachments_status[ $image_id ] : false;
460
+
461
+ if ( 'success' === $attachments_status ) {
462
+ $imagify_data = isset( $imagify_data[ $image_id ] ) ? $imagify_data[ $image_id ] : false;
463
+ $partial_size_images += $imagify_data['stats']['original_size'];
464
+ $partial_total_intermediate_images += count( $attachment_data['sizes'] );
465
+ continue;
466
+ }
467
+
468
+ $attachment_metadata = isset( $attachments_data[ $image_id ] ) ? $attachments_data[ $image_id ] : false;
469
+ $sizes = isset( $attachment_metadata['sizes'] ) ? (array) $attachment_metadata['sizes'] : array();
470
+
471
+ /** This filter is documented in inc/functions/process.php. */
472
+ $full_image = apply_filters( 'imagify_file_path', get_imagify_attached_file( $attachments_filename[ $image_id ] ) );
473
+ $partial_size_images += filesize( $full_image );
474
+
475
+ if ( ! $sizes ) {
476
+ continue;
477
+ }
478
+
479
+ foreach ( $sizes as $size_key => $size_data ) {
480
+ if ( array_key_exists( $size_key, get_imagify_option( 'disallowed-sizes', array() ) ) && ! imagify_is_active_for_network() ) {
481
+ continue;
482
+ }
483
+
484
+ $thumbnail_path = trailingslashit( dirname( $full_image ) ) . $size_data['file'];
485
+
486
+ if ( file_exists( $thumbnail_path ) ) {
487
+ $partial_size_images += filesize( $thumbnail_path );
488
+ $partial_total_intermediate_images++;
489
+ }
490
+ }
491
+ }
492
+
493
+ $intermediate_images_per_image = $partial_total_intermediate_images / $partial_total_images;
494
+ $average_size_images = $partial_size_images / ( $partial_total_images + $partial_total_intermediate_images );
495
+ $total_size_images = $average_size_images * ( $total_images + ( $intermediate_images_per_image * $total_images ) );
496
+
497
+ return $total_size_images;
498
+ }
inc/functions/admin-ui.php CHANGED
@@ -1,72 +1,82 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
- /*
5
  * Get the optimization data list for a specific attachment.
6
  *
7
  * @since 1.0
8
  * @author Jonathan Buttigieg
9
  *
10
- * @param object $attachment The attachment object.
11
- * @return string The output to print.
 
12
  */
13
  function get_imagify_attachment_optimization_text( $attachment, $context = 'wp' ) {
14
  global $pagenow;
15
 
16
- $attachment_id = $attachment->id;
17
- $data = $attachment->get_data();
18
- $output = ( 'post.php' !== $pagenow ) ? '<ul class="imagify-datas-list">' : '';
19
- $output_before = ( 'post.php' !== $pagenow ) ? '<li class="imagify-data-item">' : '<div class="misc-pub-section misc-pub-imagify imagify-data-item">';
20
- $output_after = ( 'post.php' != $pagenow ) ? '</li>' : '</div>';
21
- $reoptimize_link = get_imagify_attachment_reoptimize_link( $attachment, $context );
22
- $reoptimize_output = ( $reoptimize_link ) ? $reoptimize_link : '';
23
  $reoptimize_output_before = '<div class="imagify-datas-actions-links">';
24
  $reoptimize_output_after = '</div><!-- .imagify-datas-actions-links -->';
 
25
 
26
- $optimization_level = $attachment->get_optimization_level_label();
27
-
28
- if ( $error = get_imagify_attachment_error_text( $attachment, $context ) ) {
29
  $reoptimize_output = $reoptimize_output_before . $reoptimize_output . $reoptimize_output_after;
30
- $error = ( 'post.php' === $pagenow ) ? $output_before . $error . $reoptimize_output . $output_after : $error . $reoptimize_output;
31
 
32
- return $error;
33
  }
34
 
 
 
 
 
35
  if ( 'post.php' !== $pagenow ) {
36
  $output .= $output_before . '<span class="data">' . __( 'New Filesize:', 'imagify' ) . '</span> <strong class="big">' . size_format( $data['sizes']['full']['optimized_size'], 2 ) . '</strong>' . $output_after;
37
  }
38
 
39
  $chart = '<span class="imagify-chart">
40
- <span class="imagify-chart-container">
41
- <canvas id="imagify-consumption-chart" width="15" height="15"></canvas>
42
- </span>
43
- </span>';
44
 
45
- $output .= $output_before . '<span class="data">' . __( 'Original Saving:', 'imagify' ) . '</span> <strong>
46
- ' . ( ( 'post.php' !== $pagenow ) ? $chart : '' ) . '<span class="imagify-chart-value">' . $data['sizes']['full']['percent'] . '</span>%</strong>' . $output_after;
 
 
47
 
48
- // more details section
49
- if ( 'post.php' !== $pagenow ) {
50
- // new list
51
  $output .= '</ul>';
52
- $output .= '<p class="imagify-datas-more-action"><a href="#imagify-view-details-' . $attachment_id . '" data-close="' . __( 'Close details', 'imagify' ) . '" data-open="' . __( 'View details', 'imagify' ) . '"><span class="the-text">' . __( 'View details', 'imagify' ) . '</span><span class="dashicons dashicons-arrow-down-alt2"></span></a></p>';
 
 
 
 
 
53
  $output .= '<ul id="imagify-view-details-' . $attachment_id . '" class="imagify-datas-list imagify-datas-details">';
54
 
55
- // not in metabox
56
  $output .= $output_before . '<span class="data">' . __( 'Original Filesize:', 'imagify' ) . '</span> <strong class="original">' . $attachment->get_original_size() . '</strong>' . $output_after;
57
  }
58
 
59
  $output .= $output_before . '<span class="data">' . __( 'Level:', 'imagify' ) . '</span> <strong>' . $optimization_level . '</strong>' . $output_after;
60
 
61
- if ( $total_optimized_thumbnails = $attachment->get_optimized_sizes_count() ) {
 
 
62
  $output .= $output_before . '<span class="data">' . __( 'Thumbnails Optimized:', 'imagify' ) . '</span> <strong>' . $total_optimized_thumbnails . '</strong>' . $output_after;
63
  $output .= $output_before . '<span class="data">' . __( 'Overall Saving:', 'imagify' ) . '</span> <strong>' . $data['stats']['percent'] . '%</strong>' . $output_after;
64
  }
65
 
66
- // end of list
67
  $output .= ( 'post.php' !== $pagenow ) ? '</ul>' : '';
68
 
69
- // actions section
70
  $output .= ( 'post.php' !== $pagenow ) ? '' : $output_before;
71
  $output .= $reoptimize_output_before;
72
  $output .= $reoptimize_output;
@@ -74,15 +84,17 @@ function get_imagify_attachment_optimization_text( $attachment, $context = 'wp'
74
  if ( $attachment->has_backup() ) {
75
  $args = array(
76
  'attachment_id' => $attachment_id,
77
- 'context' => $context,
78
  );
79
- $class = ( 'post.php' !== $pagenow ) ? 'button-imagify-restore' : '';
80
- $output .= '<a id="imagify-restore-' . $attachment_id . '" href="' . get_imagify_admin_url( 'restore-upload', $args ) . '" class="' . $class . '" data-waiting-label="' . esc_attr__( 'Restoring...', 'imagify' ) . '"><span class="dashicons dashicons-image-rotate"></span>' . __( 'Restore Original', 'imagify' ) . '</a>';
 
 
81
 
82
- if ( 'upload.php' != $pagenow ) {
83
  $image = wp_get_attachment_image_src( $attachment_id, 'full' );
84
 
85
- $output .= '<input id="imagify-original-src" type="hidden" value="' . $attachment->get_backup_url() . '">';
86
  $output .= '<input id="imagify-original-size" type="hidden" value="' . $attachment->get_original_size() . '">';
87
  $output .= '<input id="imagify-full-src" type="hidden" value="' . $image[0] . '">';
88
  $output .= '<input id="imagify-full-width" type="hidden" value="' . $image[1] . '">';
@@ -96,112 +108,126 @@ function get_imagify_attachment_optimization_text( $attachment, $context = 'wp'
96
  return $output;
97
  }
98
 
99
- /*
100
  * Get the error message for a specific attachment.
101
  *
102
  * @since 1.0
103
  * @author Jonathan Buttigieg
104
  *
105
- * @param object $attachment The attachement object.
106
- * @return string The output to print.
 
107
  */
108
  function get_imagify_attachment_error_text( $attachment, $context = 'wp' ) {
109
  global $pagenow;
110
 
111
  $attachment_id = $attachment->id;
112
- $data = $attachment->get_data();
113
- $output = '';
114
- $args = array(
115
  'attachment_id' => $attachment_id,
116
- 'context' => $context,
117
  );
118
 
119
  if ( isset( $data['sizes']['full']['success'] ) && ! $data['sizes']['full']['success'] ) {
120
- $class = ( 'post.php' !== $pagenow ) ? 'button-imagify-manual-upload' : '';
121
- $output .= '<strong>' . $data['sizes']['full']['error'] . '</strong><br/><a id="imagify-upload-' . $attachment_id . '" class="button ' . $class . '" href="' . get_imagify_admin_url( 'manual-upload', $args ) . '" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">' . __( 'Try again', 'imagify' ) . '</a>';
 
122
  }
123
 
124
  return $output;
125
  }
126
 
127
- /*
128
  * Get the re-optimize link for a specific attachment.
129
  *
130
  * @since 1.0
131
  * @author Jonathan Buttigieg
132
  *
133
- * @param int $attachment_id The attachement ID.
134
- * @return string The output to print.
 
135
  */
136
  function get_imagify_attachment_reoptimize_link( $attachment, $context = 'wp' ) {
137
  global $pagenow;
138
 
139
- $attachment_id = $attachment->id;
140
- $level = (int) $attachment->get_optimization_level();
141
- $args = array(
142
- 'attachment_id' => $attachment_id,
143
- 'context' => $context,
144
- );
145
- $output = '';
146
-
147
- // Stop the process if the API key isn't valid
148
  if ( ! imagify_valid_key() ) {
149
- return $output;
150
  }
151
 
 
 
152
  // Don't display anything if there is no backup or the image has been optimized.
153
- if ( ! $attachment->has_backup() && ! $attachment->is_already_optimized() ) {
154
- return $output;
155
  }
156
 
157
- $class = ( 'post.php' !== $pagenow ) ? 'button-imagify-manual-override-upload' : '';
 
 
 
 
 
 
 
158
 
159
- // Re-optimize to Ultra
160
  if ( 1 === $level || 0 === $level ) {
161
  $args['optimization_level'] = 2;
162
- $output .= '<a href="' . get_imagify_admin_url( 'manual-override-upload', $args ) . '" class="' . $class . '" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '"><span class="dashicons dashicons-admin-generic"></span>' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), __( 'Ultra', 'imagify' ) ) . '</a>';
 
 
 
163
  }
164
 
165
- // Re-optimize to Aggressive
166
- if ( ( 2 === $level && ! $attachment->is_already_optimized() ) || 0 === $level ) {
167
  $args['optimization_level'] = 1;
168
- $output .= '<a href="' . get_imagify_admin_url( 'manual-override-upload', $args ) . '" class="' . $class . '" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '"><span class="dashicons dashicons-admin-generic"></span>' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), __( 'Aggressive', 'imagify' ) ) . '</a>';
 
 
 
169
  }
170
 
171
- // Re-optimize to Normal
172
- if ( ( 2 === $level || 1 === $level ) && ! $attachment->is_already_optimized() ) {
173
  $args['optimization_level'] = 0;
174
- $output .= '<a href="' . get_imagify_admin_url( 'manual-override-upload', $args ) . '" class="' . $class . '" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '"><span class="dashicons dashicons-admin-generic"></span>' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), __( 'Normal', 'imagify' ) ) . '</a>';
 
 
 
175
  }
176
 
177
  return $output;
178
  }
179
 
180
- /*
181
  * Get all data to diplay for a specific attachment.
182
  *
183
  * @since 1.2
184
  * @author Jonathan Buttigieg
185
  *
186
- * @param object $attachment The attachement object.
187
- * @return string The output to print.
 
188
  */
189
  function get_imagify_media_column_content( $attachment, $context = 'wp' ) {
190
  $attachment_id = $attachment->id;
191
  $attachment_ext = $attachment->get_extension();
192
- $output = '';
193
 
194
- // Check if the attachment extension is allowed
195
- if ( 'wp' === $context && ! wp_attachment_is_image( $attachment_id ) ) {
196
- $output = sprintf( __( '%s can\'t be optimized', 'imagify' ), strtoupper( $attachment_ext ) );
197
- return $output;
198
  }
199
 
200
- // Check if the API key is valid
201
  if ( ! imagify_valid_key() && ! $attachment->is_optimized() ) {
202
  $output .= __( 'Invalid API key', 'imagify' );
203
  $output .= '<br/>';
204
- $output .= '<a href="' . get_imagify_admin_url( 'options-general' ) . '">' . __( 'Check your Settings', 'imagify' ) . '</a>';
205
  return $output;
206
  }
207
 
@@ -209,17 +235,16 @@ function get_imagify_media_column_content( $attachment, $context = 'wp' ) {
209
  $transient_name = 'imagify-' . $transient_context . 'async-in-progress-' . $attachment_id;
210
 
211
  if ( false !== get_transient( $transient_name ) ) {
212
- $output = '<div class="button"><span class="imagify-spinner"></span>' . __( 'Optimizing...', 'imagify' ) . '</div>';
213
- return $output;
214
  }
215
 
216
- // Check if the image was optimized
217
  if ( ! $attachment->is_optimized() && ! $attachment->has_error() ) {
218
  $args = array(
219
  'attachment_id' => $attachment_id,
220
- 'context' => $context,
221
  );
222
- $output .= '<a id="imagify-upload-' . $attachment_id . '" href="' . get_imagify_admin_url( 'manual-upload', $args ) . '" class="button-primary button-imagify-manual-upload" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">' . __( 'Optimize', 'imagify' ) . '</a>';
223
  return $output;
224
  }
225
 
@@ -228,42 +253,55 @@ function get_imagify_media_column_content( $attachment, $context = 'wp' ) {
228
  }
229
 
230
  /**
231
- * Add a small section with button
232
- *
233
- * @return string HTML
234
  *
235
  * @since 1.6
236
  * @author Geoffrey
237
  *
238
- * @todo add only for no-payable users?
 
 
239
  */
240
  function get_imagify_new_to_imagify() {
241
- if ( apply_filters( 'imagify_show_new_to_imagify', true ) && imagify_valid_key() ) {
242
- return '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  <div class="imagify-section imagify-section-positive">
244
  <div class="imagify-start imagify-mr2">
245
- <button id="imagify-get-pricing-modal" data-nonce="' . wp_create_nonce('imagify_get_pricing_' . get_current_user_id() ) . '" data-target="#imagify-pricing-modal" type="button" class="imagify-modal-trigger imagify-button imagify-button-light imagify-button-big">
246
  <i class="dashicons dashicons-dashboard" aria-hidden="true"></i>
247
  <span class="button-text">' . esc_html__( 'What plan do I need?', 'imagify' ) . '</span>
248
  </button>
249
  </div>
250
  <div class="imagify-oh">
251
  <p class="imagify-section-title">' . esc_html__( 'You\'re new to Imagify?', 'imagify' ) . '</p>
252
- <p>' . esc_html__( 'Let us help you by analyzing your existing images and determinate the best plan for you', 'imagify' ) . '</p>
253
  </div>
254
  </div>
255
- ';
256
- }
257
  }
258
 
259
  /**
260
- * Return the formatted price present in pricing tables
261
- *
262
- * @param float $value the price value
263
- * @return string the markuped price
264
  *
265
  * @since 1.6
266
  * @author Geoffrey
 
 
 
267
  */
268
  function get_imagify_price_table_format( $value ) {
269
  $v = explode( '.', (string) $value );
@@ -272,29 +310,28 @@ function get_imagify_price_table_format( $value ) {
272
  }
273
 
274
  /**
275
- * Return the payment modal HTML
276
- * @return string HTML code for payement modal
277
  *
278
  * @since 1.6
279
- * @since 1.6.3 Include discount banners
280
  * @author Geoffrey
281
  *
282
- * @todo Make first offers dynamic thanks to consumption estimation
283
  */
284
  function imagify_payment_modal() {
285
- ?>
286
  <div id="imagify-pricing-modal" class="imagify-modal imagify-payment-modal" aria-hidden="false" role="dialog">
287
  <div class="imagify-modal-content">
288
  <div class="imagify-modal-main">
289
  <div class="imagify-modal-views imagify-pre-checkout-view" id="imagify-pre-checkout-view" aria-hidden="false">
290
 
291
- <?php
292
  $attachments_number = imagify_count_attachments();
293
  $total_size = get_imagify_option( 'total_size_images_library', false );
294
  $per_month = get_imagify_option( 'average_size_images_per_month', false );
295
- ?>
296
 
297
- <div class="imagify-modal-section section-gray imagify-estimation-block<?php echo $total_size === false ? ' imagify-analyzing' : ''; ?>">
298
  <p class="imagify-modal-title">
299
  <span class="imagify-numbers-calc"><?php esc_html_e( 'We analysed your images', 'imagify' ); ?></span>
300
  <span class="imagify-numbers-notcalc"><?php esc_html_e( 'We are analysing your images', 'imagify' ); ?></span>
@@ -305,18 +342,37 @@ function imagify_payment_modal() {
305
  <div class="imagify-modal-cols">
306
  <div class="imagify-col">
307
  <p>
308
- <span class="imagify-border-styled"><?php
309
- printf( _n( 'You have %s image', 'You have %s images', $attachments_number, 'imagify' ), '</span><span class="imagify-big-number">' . $attachments_number . '</span><span class="imagify-border-styled">' ); ?></span>
 
 
 
 
 
 
 
310
  </p>
311
  </div>
312
  <div class="imagify-col">
313
  <p class="imagify-iconed">
314
  <i class="dashicons dashicons-images-alt2" aria-hidden="true"></i>
315
- <?php printf( esc_html__( 'You currently have %s of images in your library.', 'imagify' ), '<strong class="imagify-dark total-library-size">' . ( isset( $total_size['human'] ) ? $total_size['human'] : $total_size ) . '</strong>' ); ?>
 
 
 
 
 
 
316
  </p>
317
  <p class="imagify-iconed">
318
  <i class="dashicons dashicons-cloud" aria-hidden="true"></i>
319
- <?php printf( esc_html__( 'You upload around %s of images per month.', 'imagify' ), '<strong class="imagify-dark average-month-size">' . ( isset( $per_month['human'] ) ? $per_month['human'] : $per_month ) . '</strong>' ); ?>
 
 
 
 
 
 
320
  </p>
321
  </div>
322
  </div>
@@ -355,7 +411,15 @@ function imagify_payment_modal() {
355
  <span class="imagify-offer-size">1 GB</span>
356
  <span class="imagify-offer-by"><?php esc_html_e( '/month', 'imagify' ); ?></span>
357
  </span>
358
- <span class="imagify-approx"><?php printf( esc_html__( 'approx: %s images', 'imagify' ), '<span class="imagify-approx-nb">5&nbsp;000</span>' ); ?></span>
 
 
 
 
 
 
 
 
359
  </label>
360
  </div>
361
  <div class="imagify-col-price imagify-flex-table">
@@ -376,8 +440,15 @@ function imagify_payment_modal() {
376
  </span>
377
  </span>
378
 
379
- <p class="imagify-price-complement"><?php printf( __( '%s per<br>
380
- additionnal Gb', 'imagify' ), '<span class="imagify-price-add-data"></span>' ); ?></p>
 
 
 
 
 
 
 
381
 
382
  </div>
383
  <div class="imagify-col-other-actions">
@@ -403,7 +474,15 @@ additionnal Gb', 'imagify' ), '<span class="imagify-price-add-data"></span>' );
403
  <span class="imagify-the-offer">
404
  <span class="imagify-offer-size">3 GB</span>
405
  </span>
406
- <span class="imagify-approx"><?php printf( esc_html__( 'approx: %s images', 'imagify' ), '<span class="imagify-approx-nb">54000</span>' ); ?></span>
 
 
 
 
 
 
 
 
407
  </label>
408
  </div>
409
  <div class="imagify-col-price imagify-flex-table">
@@ -440,30 +519,19 @@ additionnal Gb', 'imagify' ), '<span class="imagify-price-add-data"></span>' );
440
  <div class="imagify-submit-section">
441
  <button type="button" class="button button-secondary imagify-button-secondary" id="imagify-modal-checkout-btn">
442
  <i class="dashicons dashicons-cart" aria-hidden="true"></i>
443
- <?php
444
- _e( 'Checkout', 'imagify' );
445
- /*
446
- printf( esc_html__( 'Pay %s', 'imagify' ), '$<span class="imagify-global-amount">0.00</span>');
447
- */
448
- ?>
449
  </button>
450
  </div>
451
  </div>
452
 
453
- <p class="imagify-footer-lines"><?php esc_html_e( 'Monthly plans comes with credits which is renewed every months. The billing happens automatically each month or year depending the billing period you choose.', 'imagify' ); ?></p>
454
  </div>
455
  </div><!-- .imagify-pre-checkout-view -->
456
 
457
  <?php
458
-
459
- /**
460
- *
461
- *
462
- * SECOND MODAL VIEW
463
- *
464
- *
465
- */
466
-
467
  ?>
468
 
469
  <div class="imagify-modal-views imagify-plans-selection-view" id="imagify-plans-selection-view" aria-hidden="true">
@@ -509,7 +577,15 @@ additionnal Gb', 'imagify' ), '<span class="imagify-price-add-data"></span>' );
509
  <span class="imagify-offer-size"></span>
510
  <span class="imagify-offer-by"><?php esc_html_e( '/month', 'imagify' ); ?></span>
511
  </span>
512
- <span class="imagify-approx"><?php printf( __( 'approx: %s images', 'imagify' ), '<span class="imagify-approx-nb"></span>' ); ?></span>
 
 
 
 
 
 
 
 
513
  </p>
514
  </div>
515
  <div class="imagify-col-price imagify-flex-table">
@@ -523,8 +599,15 @@ additionnal Gb', 'imagify' ), '<span class="imagify-price-add-data"></span>' );
523
 
524
  <span class="imagify-recommend" aria-hidden="true"><?php esc_html_e( 'we recommend for you', 'imagify' ); ?></span>
525
 
526
- <p class="imagify-price-complement"><?php printf( __( '%s per<br>
527
- additionnal Gb', 'imagify' ), '<span class="imagify-price-add-data"></span>' ); ?></p>
 
 
 
 
 
 
 
528
 
529
  </div><!-- .imagify-col-price -->
530
 
@@ -559,7 +642,15 @@ additionnal Gb', 'imagify' ), '<span class="imagify-price-add-data"></span>' );
559
  <span class="imagify-the-offer">
560
  <span class="imagify-offer-size"></span>
561
  </span>
562
- <span class="imagify-approx"><?php printf( __( 'approx: %s images', 'imagify' ), '<span class="imagify-approx-nb"></span>' ); ?></span>
 
 
 
 
 
 
 
 
563
  </p>
564
  </div>
565
  <div class="imagify-col-price">
@@ -583,15 +674,9 @@ additionnal Gb', 'imagify' ), '<span class="imagify-price-add-data"></span>' );
583
 
584
 
585
  <?php
586
-
587
  /**
588
- *
589
- *
590
- * THIRD MODAL VIEW
591
- *
592
- *
593
- */
594
-
595
  ?>
596
 
597
  <div class="imagify-modal-views imagify-payment-process-view" id="imagify-payment-process-view" aria-hidden="true">
@@ -603,15 +688,9 @@ additionnal Gb', 'imagify' ), '<span class="imagify-price-add-data"></span>' );
603
  </div><!-- .imagify-modal-views -->
604
 
605
  <?php
606
-
607
  /**
608
- *
609
- *
610
- * Succes view
611
- *
612
- *
613
- */
614
-
615
  ?>
616
 
617
  <div class="imagify-modal-views imagify-success-view" id="imagify-success-view" aria-hidden="true">
@@ -671,25 +750,38 @@ additionnal Gb', 'imagify' ), '<span class="imagify-price-add-data"></span>' );
671
  <div class="imagify-modal-loader"></div>
672
  </div><!-- .imagify-modal-content-->
673
  </div><!-- .imagify-payment-modal -->
674
- <?php
675
  }
676
 
677
  /**
678
- * Print the discount banner used inside Payment Modal
679
  *
680
- * @return void
681
  * @author Geoffrey Crofte
682
  * @since 1.6.3
 
 
683
  */
684
  function imagify_print_discount_banner() {
685
- ?>
686
-
687
  <div class="imagify-modal-promotion" aria-hidden="true">
688
- <p class="imagify-promo-title"><?php printf( __( '%s OFF on all the subscriptions', 'secupress' ), '<span class="imagify-promotion-number"></span>' ); ?></p>
 
 
 
 
 
 
 
 
689
  <p class="imagify-until-date">
690
- <?php printf( __( 'Special Offer<br><strong>Until %s</strong>', 'secupress' ), '<span class="imagify-promotion-date"></span>' ); ?>
 
 
 
 
 
 
691
  </p>
692
  </div>
693
-
694
- <?php
695
  }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ /**
5
  * Get the optimization data list for a specific attachment.
6
  *
7
  * @since 1.0
8
  * @author Jonathan Buttigieg
9
  *
10
+ * @param object $attachment The attachment object.
11
+ * @param string $context A context.
12
+ * @return string The output to print.
13
  */
14
  function get_imagify_attachment_optimization_text( $attachment, $context = 'wp' ) {
15
  global $pagenow;
16
 
17
+ $output = ( 'post.php' !== $pagenow ) ? '<ul class="imagify-datas-list">' : '';
18
+ $output_before = ( 'post.php' !== $pagenow ) ? '<li class="imagify-data-item">' : '<div class="misc-pub-section misc-pub-imagify imagify-data-item">';
19
+ $output_after = ( 'post.php' !== $pagenow ) ? '</li>' : '</div>';
20
+ $reoptimize_link = get_imagify_attachment_reoptimize_link( $attachment, $context );
21
+ $reoptimize_output = $reoptimize_link ? $reoptimize_link : '';
 
 
22
  $reoptimize_output_before = '<div class="imagify-datas-actions-links">';
23
  $reoptimize_output_after = '</div><!-- .imagify-datas-actions-links -->';
24
+ $error = get_imagify_attachment_error_text( $attachment, $context );
25
 
26
+ if ( $error ) {
 
 
27
  $reoptimize_output = $reoptimize_output_before . $reoptimize_output . $reoptimize_output_after;
 
28
 
29
+ return 'post.php' === $pagenow ? $output_before . $error . $reoptimize_output . $output_after : $error . $reoptimize_output;
30
  }
31
 
32
+ $attachment_id = $attachment->id;
33
+ $data = $attachment->get_data();
34
+ $optimization_level = $attachment->get_optimization_level_label();
35
+
36
  if ( 'post.php' !== $pagenow ) {
37
  $output .= $output_before . '<span class="data">' . __( 'New Filesize:', 'imagify' ) . '</span> <strong class="big">' . size_format( $data['sizes']['full']['optimized_size'], 2 ) . '</strong>' . $output_after;
38
  }
39
 
40
  $chart = '<span class="imagify-chart">
41
+ <span class="imagify-chart-container">
42
+ <canvas id="imagify-consumption-chart" width="15" height="15"></canvas>
43
+ </span>
44
+ </span>';
45
 
46
+ $output .= $output_before;
47
+ $output .= '<span class="data">' . __( 'Original Saving:', 'imagify' ) . '</span> ';
48
+ $output .= '<strong>' . ( 'post.php' !== $pagenow ? $chart : '' ) . '<span class="imagify-chart-value">' . $data['sizes']['full']['percent'] . '</span>%</strong>';
49
+ $output .= $output_after;
50
 
51
+ // More details section.
52
+ if ( 'post.php' !== $pagenow ) {
53
+ // New list.
54
  $output .= '</ul>';
55
+ $output .= '<p class="imagify-datas-more-action">';
56
+ $output .= '<a href="#imagify-view-details-' . $attachment_id . '" data-close="' . __( 'Close details', 'imagify' ) . '" data-open="' . __( 'View details', 'imagify' ) . '">';
57
+ $output .= '<span class="the-text">' . __( 'View details', 'imagify' ) . '</span>';
58
+ $output .= '<span class="dashicons dashicons-arrow-down-alt2"></span>';
59
+ $output .= '</a>';
60
+ $output .= '</p>';
61
  $output .= '<ul id="imagify-view-details-' . $attachment_id . '" class="imagify-datas-list imagify-datas-details">';
62
 
63
+ // Not in metabox.
64
  $output .= $output_before . '<span class="data">' . __( 'Original Filesize:', 'imagify' ) . '</span> <strong class="original">' . $attachment->get_original_size() . '</strong>' . $output_after;
65
  }
66
 
67
  $output .= $output_before . '<span class="data">' . __( 'Level:', 'imagify' ) . '</span> <strong>' . $optimization_level . '</strong>' . $output_after;
68
 
69
+ $total_optimized_thumbnails = $attachment->get_optimized_sizes_count();
70
+
71
+ if ( $total_optimized_thumbnails ) {
72
  $output .= $output_before . '<span class="data">' . __( 'Thumbnails Optimized:', 'imagify' ) . '</span> <strong>' . $total_optimized_thumbnails . '</strong>' . $output_after;
73
  $output .= $output_before . '<span class="data">' . __( 'Overall Saving:', 'imagify' ) . '</span> <strong>' . $data['stats']['percent'] . '%</strong>' . $output_after;
74
  }
75
 
76
+ // End of list.
77
  $output .= ( 'post.php' !== $pagenow ) ? '</ul>' : '';
78
 
79
+ // Actions section.
80
  $output .= ( 'post.php' !== $pagenow ) ? '' : $output_before;
81
  $output .= $reoptimize_output_before;
82
  $output .= $reoptimize_output;
84
  if ( $attachment->has_backup() ) {
85
  $args = array(
86
  'attachment_id' => $attachment_id,
87
+ 'context' => $context,
88
  );
89
+ $class = ( 'post.php' !== $pagenow ) ? 'button-imagify-restore' : '';
90
+ $output .= '<a id="imagify-restore-' . $attachment_id . '" href="' . get_imagify_admin_url( 'restore-upload', $args ) . '" class="' . $class . '" data-waiting-label="' . esc_attr__( 'Restoring...', 'imagify' ) . '">';
91
+ $output .= '<span class="dashicons dashicons-image-rotate"></span>' . __( 'Restore Original', 'imagify' );
92
+ $output .= '</a>';
93
 
94
+ if ( 'upload.php' !== $pagenow ) {
95
  $image = wp_get_attachment_image_src( $attachment_id, 'full' );
96
 
97
+ $output .= '<input id="imagify-original-src" type="hidden" value="' . esc_url( $attachment->get_backup_url() ) . '">';
98
  $output .= '<input id="imagify-original-size" type="hidden" value="' . $attachment->get_original_size() . '">';
99
  $output .= '<input id="imagify-full-src" type="hidden" value="' . $image[0] . '">';
100
  $output .= '<input id="imagify-full-width" type="hidden" value="' . $image[1] . '">';
108
  return $output;
109
  }
110
 
111
+ /**
112
  * Get the error message for a specific attachment.
113
  *
114
  * @since 1.0
115
  * @author Jonathan Buttigieg
116
  *
117
+ * @param object $attachment The attachement object.
118
+ * @param string $context A context.
119
+ * @return string The output to print.
120
  */
121
  function get_imagify_attachment_error_text( $attachment, $context = 'wp' ) {
122
  global $pagenow;
123
 
124
  $attachment_id = $attachment->id;
125
+ $data = $attachment->get_data();
126
+ $output = '';
127
+ $args = array(
128
  'attachment_id' => $attachment_id,
129
+ 'context' => $context,
130
  );
131
 
132
  if ( isset( $data['sizes']['full']['success'] ) && ! $data['sizes']['full']['success'] ) {
133
+ $class = ( 'post.php' !== $pagenow ) ? 'button-imagify-manual-upload' : '';
134
+ $output .= '<strong>' . $data['sizes']['full']['error'] . '</strong><br/>';
135
+ $output .= '<a id="imagify-upload-' . $attachment_id . '" class="button ' . $class . '" href="' . esc_url( get_imagify_admin_url( 'manual-upload', $args ) ) . '" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">' . __( 'Try again', 'imagify' ) . '</a>';
136
  }
137
 
138
  return $output;
139
  }
140
 
141
+ /**
142
  * Get the re-optimize link for a specific attachment.
143
  *
144
  * @since 1.0
145
  * @author Jonathan Buttigieg
146
  *
147
+ * @param object $attachment The attachement object.
148
+ * @param string $context A context.
149
+ * @return string The output to print.
150
  */
151
  function get_imagify_attachment_reoptimize_link( $attachment, $context = 'wp' ) {
152
  global $pagenow;
153
 
154
+ // Stop the process if the API key isn't valid.
 
 
 
 
 
 
 
 
155
  if ( ! imagify_valid_key() ) {
156
+ return '';
157
  }
158
 
159
+ $is_already_optimized = $attachment->is_already_optimized();
160
+
161
  // Don't display anything if there is no backup or the image has been optimized.
162
+ if ( ! $attachment->has_backup() && ! $is_already_optimized ) {
163
+ return '';
164
  }
165
 
166
+ $attachment_id = $attachment->id;
167
+ $level = $attachment->get_optimization_level();
168
+ $args = array(
169
+ 'attachment_id' => $attachment_id,
170
+ 'context' => $context,
171
+ );
172
+ $output = '';
173
+ $class = ( 'post.php' !== $pagenow ) ? 'button-imagify-manual-override-upload' : '';
174
 
175
+ // Re-optimize to Ultra.
176
  if ( 1 === $level || 0 === $level ) {
177
  $args['optimization_level'] = 2;
178
+ $output .= '<a href="' . esc_url( get_imagify_admin_url( 'manual-override-upload', $args ) ) . '" class="' . $class . '" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">';
179
+ /* translators: %s is an optimization level. */
180
+ $output .= '<span class="dashicons dashicons-admin-generic"></span>' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), __( 'Ultra', 'imagify' ) );
181
+ $output .= '</a>';
182
  }
183
 
184
+ // Re-optimize to Aggressive.
185
+ if ( ( 2 === $level && ! $is_already_optimized ) || 0 === $level ) {
186
  $args['optimization_level'] = 1;
187
+ $output .= '<a href="' . esc_url( get_imagify_admin_url( 'manual-override-upload', $args ) ) . '" class="' . $class . '" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">';
188
+ /* translators: %s is an optimization level. */
189
+ $output .= '<span class="dashicons dashicons-admin-generic"></span>' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), __( 'Aggressive', 'imagify' ) );
190
+ $output .= '</a>';
191
  }
192
 
193
+ // Re-optimize to Normal.
194
+ if ( ( 2 === $level || 1 === $level ) && ! $is_already_optimized ) {
195
  $args['optimization_level'] = 0;
196
+ $output .= '<a href="' . esc_url( get_imagify_admin_url( 'manual-override-upload', $args ) ) . '" class="' . $class . '" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">';
197
+ /* translators: %s is an optimization level. */
198
+ $output .= '<span class="dashicons dashicons-admin-generic"></span>' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), __( 'Normal', 'imagify' ) );
199
+ $output .= '</a>';
200
  }
201
 
202
  return $output;
203
  }
204
 
205
+ /**
206
  * Get all data to diplay for a specific attachment.
207
  *
208
  * @since 1.2
209
  * @author Jonathan Buttigieg
210
  *
211
+ * @param object $attachment The attachement object.
212
+ * @param string $context A context.
213
+ * @return string The output to print.
214
  */
215
  function get_imagify_media_column_content( $attachment, $context = 'wp' ) {
216
  $attachment_id = $attachment->id;
217
  $attachment_ext = $attachment->get_extension();
218
+ $output = '';
219
 
220
+ // Check if the attachment extension is allowed.
221
+ if ( 'wp' === $context && ! wp_attachment_is_image( $attachment_id ) ) {
222
+ /* translators: %s is a file extension. */
223
+ return sprintf( __( '%s can\'t be optimized', 'imagify' ), strtoupper( $attachment_ext ) );
224
  }
225
 
226
+ // Check if the API key is valid.
227
  if ( ! imagify_valid_key() && ! $attachment->is_optimized() ) {
228
  $output .= __( 'Invalid API key', 'imagify' );
229
  $output .= '<br/>';
230
+ $output .= '<a href="' . esc_url( get_imagify_admin_url( 'options-general' ) ) . '">' . __( 'Check your Settings', 'imagify' ) . '</a>';
231
  return $output;
232
  }
233
 
235
  $transient_name = 'imagify-' . $transient_context . 'async-in-progress-' . $attachment_id;
236
 
237
  if ( false !== get_transient( $transient_name ) ) {
238
+ return '<div class="button"><span class="imagify-spinner"></span>' . __( 'Optimizing...', 'imagify' ) . '</div>';
 
239
  }
240
 
241
+ // Check if the image was optimized.
242
  if ( ! $attachment->is_optimized() && ! $attachment->has_error() ) {
243
  $args = array(
244
  'attachment_id' => $attachment_id,
245
+ 'context' => $context,
246
  );
247
+ $output .= '<a id="imagify-upload-' . $attachment_id . '" href="' . esc_url( get_imagify_admin_url( 'manual-upload', $args ) ) . '" class="button-primary button-imagify-manual-upload" data-waiting-label="' . esc_attr__( 'Optimizing...', 'imagify' ) . '">' . __( 'Optimize', 'imagify' ) . '</a>';
248
  return $output;
249
  }
250
 
253
  }
254
 
255
  /**
256
+ * Display the plan chooser section.
 
 
257
  *
258
  * @since 1.6
259
  * @author Geoffrey
260
  *
261
+ * @todo Add only for no-payable users?
262
+ *
263
+ * @return string HTML.
264
  */
265
  function get_imagify_new_to_imagify() {
266
+ if ( ! imagify_valid_key() ) {
267
+ return '';
268
+ }
269
+
270
+ /**
271
+ * Filter whether the plan chooser section is displayed.
272
+ *
273
+ * @param $show_new bool Default to true: display the section.
274
+ */
275
+ $show_new = apply_filters( 'imagify_show_new_to_imagify', true );
276
+
277
+ if ( ! $show_new ) {
278
+ return '';
279
+ }
280
+
281
+ return '
282
  <div class="imagify-section imagify-section-positive">
283
  <div class="imagify-start imagify-mr2">
284
+ <button id="imagify-get-pricing-modal" data-nonce="' . wp_create_nonce( 'imagify_get_pricing_' . get_current_user_id() ) . '" data-target="#imagify-pricing-modal" type="button" class="imagify-modal-trigger imagify-button imagify-button-light imagify-button-big">
285
  <i class="dashicons dashicons-dashboard" aria-hidden="true"></i>
286
  <span class="button-text">' . esc_html__( 'What plan do I need?', 'imagify' ) . '</span>
287
  </button>
288
  </div>
289
  <div class="imagify-oh">
290
  <p class="imagify-section-title">' . esc_html__( 'You\'re new to Imagify?', 'imagify' ) . '</p>
291
+ <p>' . esc_html__( 'Let us help you by analyzing your existing images and determine the best plan for you', 'imagify' ) . '</p>
292
  </div>
293
  </div>
294
+ ';
 
295
  }
296
 
297
  /**
298
+ * Return the formatted price present in pricing tables.
 
 
 
299
  *
300
  * @since 1.6
301
  * @author Geoffrey
302
+ *
303
+ * @param float $value The price value.
304
+ * @return string The markuped price.
305
  */
306
  function get_imagify_price_table_format( $value ) {
307
  $v = explode( '.', (string) $value );
310
  }
311
 
312
  /**
313
+ * Get the payment modal HTML.
 
314
  *
315
  * @since 1.6
316
+ * @since 1.6.3 Include discount banners.
317
  * @author Geoffrey
318
  *
319
+ * @todo Make first offers dynamic thanks to consumption estimation.
320
  */
321
  function imagify_payment_modal() {
322
+ ?>
323
  <div id="imagify-pricing-modal" class="imagify-modal imagify-payment-modal" aria-hidden="false" role="dialog">
324
  <div class="imagify-modal-content">
325
  <div class="imagify-modal-main">
326
  <div class="imagify-modal-views imagify-pre-checkout-view" id="imagify-pre-checkout-view" aria-hidden="false">
327
 
328
+ <?php
329
  $attachments_number = imagify_count_attachments();
330
  $total_size = get_imagify_option( 'total_size_images_library', false );
331
  $per_month = get_imagify_option( 'average_size_images_per_month', false );
332
+ ?>
333
 
334
+ <div class="imagify-modal-section section-gray imagify-estimation-block<?php echo false === $total_size ? ' imagify-analyzing' : ''; ?>">
335
  <p class="imagify-modal-title">
336
  <span class="imagify-numbers-calc"><?php esc_html_e( 'We analysed your images', 'imagify' ); ?></span>
337
  <span class="imagify-numbers-notcalc"><?php esc_html_e( 'We are analysing your images', 'imagify' ); ?></span>
342
  <div class="imagify-modal-cols">
343
  <div class="imagify-col">
344
  <p>
345
+ <span class="imagify-border-styled">
346
+ <?php
347
+ printf(
348
+ /* translators: %s is a formatted number (don't use %d). */
349
+ _n( 'You have %s image', 'You have %s images', $attachments_number, 'imagify' ),
350
+ '</span><span class="imagify-big-number">' . number_format_i18n( $attachments_number ) . '</span><span class="imagify-border-styled">'
351
+ );
352
+ ?>
353
+ </span>
354
  </p>
355
  </div>
356
  <div class="imagify-col">
357
  <p class="imagify-iconed">
358
  <i class="dashicons dashicons-images-alt2" aria-hidden="true"></i>
359
+ <?php
360
+ printf(
361
+ /* translators: %s is a formatted file size. */
362
+ esc_html__( 'You currently have %s of images in your library.', 'imagify' ),
363
+ '<strong class="imagify-dark total-library-size">' . ( isset( $total_size['human'] ) ? $total_size['human'] : $total_size ) . '</strong>'
364
+ );
365
+ ?>
366
  </p>
367
  <p class="imagify-iconed">
368
  <i class="dashicons dashicons-cloud" aria-hidden="true"></i>
369
+ <?php
370
+ printf(
371
+ /* translators: %s is a formatted file size. */
372
+ esc_html__( 'You upload around %s of images per month.', 'imagify' ),
373
+ '<strong class="imagify-dark average-month-size">' . ( isset( $per_month['human'] ) ? $per_month['human'] : $per_month ) . '</strong>'
374
+ );
375
+ ?>
376
  </p>
377
  </div>
378
  </div>
411
  <span class="imagify-offer-size">1 GB</span>
412
  <span class="imagify-offer-by"><?php esc_html_e( '/month', 'imagify' ); ?></span>
413
  </span>
414
+ <span class="imagify-approx">
415
+ <?php
416
+ printf(
417
+ /* translators: %s is a formatted number (don't use %d). */
418
+ esc_html__( 'approx: %s images', 'imagify' ),
419
+ '<span class="imagify-approx-nb">' . number_format_i18n( 5000 ) . '</span>'
420
+ );
421
+ ?>
422
+ </span>
423
  </label>
424
  </div>
425
  <div class="imagify-col-price imagify-flex-table">
440
  </span>
441
  </span>
442
 
443
+ <p class="imagify-price-complement">
444
+ <?php
445
+ printf(
446
+ /* translators: %s is a formatted price. */
447
+ __( '%s per<br>additionnal Gb', 'imagify' ),
448
+ '<span class="imagify-price-add-data"></span>'
449
+ );
450
+ ?>
451
+ </p>
452
 
453
  </div>
454
  <div class="imagify-col-other-actions">
474
  <span class="imagify-the-offer">
475
  <span class="imagify-offer-size">3 GB</span>
476
  </span>
477
+ <span class="imagify-approx">
478
+ <?php
479
+ printf(
480
+ /* translators: %s is a formatted number (don't use %d). */
481
+ esc_html__( 'approx: %s images', 'imagify' ),
482
+ '<span class="imagify-approx-nb">' . number_format_i18n( 54000 ) . '</span>'
483
+ );
484
+ ?>
485
+ </span>
486
  </label>
487
  </div>
488
  <div class="imagify-col-price imagify-flex-table">
519
  <div class="imagify-submit-section">
520
  <button type="button" class="button button-secondary imagify-button-secondary" id="imagify-modal-checkout-btn">
521
  <i class="dashicons dashicons-cart" aria-hidden="true"></i>
522
+ <?php _e( 'Checkout', 'imagify' ); ?>
 
 
 
 
 
523
  </button>
524
  </div>
525
  </div>
526
 
527
+ <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>
528
  </div>
529
  </div><!-- .imagify-pre-checkout-view -->
530
 
531
  <?php
532
+ /**
533
+ * SECOND MODAL VIEW.
534
+ */
 
 
 
 
 
 
535
  ?>
536
 
537
  <div class="imagify-modal-views imagify-plans-selection-view" id="imagify-plans-selection-view" aria-hidden="true">
577
  <span class="imagify-offer-size"></span>
578
  <span class="imagify-offer-by"><?php esc_html_e( '/month', 'imagify' ); ?></span>
579
  </span>
580
+ <span class="imagify-approx">
581
+ <?php
582
+ printf(
583
+ /* translators: %s is a formatted number (don't use %d). */
584
+ __( 'approx: %s images', 'imagify' ),
585
+ '<span class="imagify-approx-nb"></span>'
586
+ );
587
+ ?>
588
+ </span>
589
  </p>
590
  </div>
591
  <div class="imagify-col-price imagify-flex-table">
599
 
600
  <span class="imagify-recommend" aria-hidden="true"><?php esc_html_e( 'we recommend for you', 'imagify' ); ?></span>
601
 
602
+ <p class="imagify-price-complement">
603
+ <?php
604
+ printf(
605
+ /* translators: %s is a formatted price. */
606
+ __( '%s per<br>additionnal Gb', 'imagify' ),
607
+ '<span class="imagify-price-add-data"></span>'
608
+ );
609
+ ?>
610
+ </p>
611
 
612
  </div><!-- .imagify-col-price -->
613
 
642
  <span class="imagify-the-offer">
643
  <span class="imagify-offer-size"></span>
644
  </span>
645
+ <span class="imagify-approx">
646
+ <?php
647
+ printf(
648
+ /* translators: %s is a formatted number (don't use %d). */
649
+ __( 'approx: %s images', 'imagify' ),
650
+ '<span class="imagify-approx-nb"></span>'
651
+ );
652
+ ?>
653
+ </span>
654
  </p>
655
  </div>
656
  <div class="imagify-col-price">
674
 
675
 
676
  <?php
 
677
  /**
678
+ * THIRD MODAL VIEW.
679
+ */
 
 
 
 
 
680
  ?>
681
 
682
  <div class="imagify-modal-views imagify-payment-process-view" id="imagify-payment-process-view" aria-hidden="true">
688
  </div><!-- .imagify-modal-views -->
689
 
690
  <?php
 
691
  /**
692
+ * SUCCESS VIEW.
693
+ */
 
 
 
 
 
694
  ?>
695
 
696
  <div class="imagify-modal-views imagify-success-view" id="imagify-success-view" aria-hidden="true">
750
  <div class="imagify-modal-loader"></div>
751
  </div><!-- .imagify-modal-content-->
752
  </div><!-- .imagify-payment-modal -->
753
+ <?php
754
  }
755
 
756
  /**
757
+ * Print the discount banner used inside Payment Modal.
758
  *
 
759
  * @author Geoffrey Crofte
760
  * @since 1.6.3
761
+ *
762
+ * @return void
763
  */
764
  function imagify_print_discount_banner() {
765
+ ?>
 
766
  <div class="imagify-modal-promotion" aria-hidden="true">
767
+ <p class="imagify-promo-title">
768
+ <?php
769
+ printf(
770
+ /* translators: %s is a formatted percentage. */
771
+ __( '%s OFF on all the subscriptions', 'secupress' ),
772
+ '<span class="imagify-promotion-number"></span>'
773
+ );
774
+ ?>
775
+ </p>
776
  <p class="imagify-until-date">
777
+ <?php
778
+ printf(
779
+ /* translators: %s is a formatted date. */
780
+ __( 'Special Offer<br><strong>Until %s</strong>', 'secupress' ),
781
+ '<span class="imagify-promotion-date"></span>'
782
+ );
783
+ ?>
784
  </p>
785
  </div>
786
+ <?php
 
787
  }
inc/functions/admin.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  /**
5
  * Check if Imagify is activated on the network.
@@ -9,96 +9,103 @@ defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
9
  * return bool True if Imagify is activated on the network
10
  */
11
  function imagify_is_active_for_network() {
12
- if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
13
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
14
- }
15
- return is_plugin_active_for_network( 'imagify/imagify.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
17
 
18
- /*
19
  * Get the URL related to specific admin page or action.
20
  *
21
  * @since 1.0
22
  *
23
- * @return string The URL of the specific admin page or action
 
 
24
  */
25
  function get_imagify_admin_url( $action = 'options-general', $arg = array() ) {
26
  $url = '';
27
- $id = ( isset( $arg['attachment_id'] ) ) ? $arg['attachment_id'] : 0;
28
- $context = ( isset( $arg['context'] ) ) ? $arg['context'] : 'wp';
29
 
30
- switch( $action ) {
31
  case 'manual-override-upload':
32
  $level = ( isset( $arg['optimization_level'] ) ) ? $arg['optimization_level'] : 0;
33
- $url = wp_nonce_url( admin_url( 'admin-post.php?action=imagify_manual_override_upload&attachment_id=' . $id . '&optimization_level=' . $level . '&context=' . $context ), 'imagify-manual-override-upload' );
34
- break;
35
 
36
  case 'manual-upload':
37
- $url = wp_nonce_url( admin_url( 'admin-post.php?action=imagify_manual_upload&attachment_id=' . $id . '&context=' . $context ), 'imagify-manual-upload' );
38
- break;
39
 
40
  case 'restore-upload' :
41
- $url = wp_nonce_url( admin_url( 'admin-post.php?action=imagify_restore_upload&attachment_id=' . $id . '&context=' . $context ), 'imagify-restore-upload' );
42
- break;
43
 
44
  case 'dismiss-notice':
45
- $url = wp_nonce_url( admin_url( 'admin-post.php?action=imagify_dismiss_notice&notice=' . $arg ), 'imagify-dismiss-notice' );
46
- break;
47
 
48
  case 'bulk-optimization':
49
- $url = admin_url( 'upload.php?page=' . IMAGIFY_SLUG . '-bulk-optimization' );
50
- break;
51
 
52
- case 'options-general':
53
  default :
54
  $page = imagify_is_active_for_network() ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' );
55
- $url = $page . '?page=' . IMAGIFY_SLUG;
56
- break;
57
  }
58
-
59
- return $url;
60
  }
61
 
62
- /*
63
  * Get maximal width and height from all thumbnails.
64
  *
65
  * @since 1.1
66
  *
67
- * @return array An array containing the max with and height.
68
  */
69
  function get_imagify_max_intermediate_image_size() {
70
  global $_wp_additional_image_sizes;
71
-
72
  $width = 0;
73
  $height = 0;
74
- $limit = 9999;
 
75
  $get_intermediate_image_sizes = get_intermediate_image_sizes();
76
-
77
- // Create the full array with sizes and crop info
78
- foreach( $get_intermediate_image_sizes as $_size ) {
79
- if ( in_array( $_size, array( 'thumbnail', 'medium', 'large' ) ) ) {
80
- $_size_width = get_option( $_size . '_size_w' );
81
- $_size_height = get_option( $_size . '_size_h' );
82
- } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
83
- $_size_width = $_wp_additional_image_sizes[ $_size ]['width'];
84
- $_size_height = $_wp_additional_image_sizes[ $_size ]['height'];
85
- }
86
-
87
- if ( ! isset( $_size_width, $_size_height ) ) {
88
- continue;
89
- }
90
-
91
- if ( $_size_width < $limit ) {
92
- $width = max( $width, $_size_width );
93
- }
94
-
95
- if ( $_size_height < $limit ) {
96
- $height = max( $height, $_size_height );
97
- }
98
  }
99
- return array(
100
- 'width' => $width,
101
- 'height' => $height
 
102
  );
103
  }
104
 
@@ -107,30 +114,38 @@ function get_imagify_max_intermediate_image_size() {
107
  *
108
  * @since 1.0
109
  *
 
 
110
  * @return void
111
  */
112
  function imagify_renew_notice( $notice, $user_id = 0 ) {
113
- global $current_user;
114
- $user_id = ( 0 === $user_id ) ? $current_user->ID : $user_id;
115
  $notices = get_user_meta( $user_id, '_imagify_ignore_notices', true );
 
116
 
117
- if( $notices && false !== array_search( $notice, $notices ) ) {
118
- unset( $notices[array_search( $notice, $notices )] );
119
- update_user_meta( $user_id, '_imagify_ignore_notices', $notices );
120
  }
 
 
 
 
 
121
  }
122
 
123
  /**
124
- * Dismissed an Imagify notice.
125
  *
126
  * @since 1.0
127
  *
 
 
128
  * @return void
129
  */
130
  function imagify_dismiss_notice( $notice, $user_id = 0 ) {
131
- global $current_user;
132
- $user_id = ( 0 === $user_id ) ? $current_user->ID : $user_id;
133
  $notices = get_user_meta( $user_id, '_imagify_ignore_notices', true );
 
134
  $notices[] = $notice;
135
  $notices = array_filter( $notices );
136
  $notices = array_unique( $notices );
@@ -138,28 +153,52 @@ function imagify_dismiss_notice( $notice, $user_id = 0 ) {
138
  update_user_meta( $user_id, '_imagify_ignore_notices', $notices );
139
  }
140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  /**
142
  * Combine two arrays with some specific keys.
143
  * We use this function to combine the result of 2 SQL queries.
144
  *
145
  * @since 1.4.5
146
  *
147
- * @return array $result The combined array
 
 
148
  */
149
  function imagify_query_results_combine( $keys, $values ) {
150
- if ( ! $values ) {
151
  return array();
152
  }
153
-
154
  $result = array();
155
  $keys = array_flip( $keys );
156
-
157
  foreach ( $values as $v ) {
158
  if ( isset( $keys[ $v['id'] ] ) ) {
159
  $result[ $v['id'] ] = $v['value'];
160
  }
161
  }
162
-
163
  return $result;
164
  }
165
 
@@ -169,22 +208,22 @@ function imagify_query_results_combine( $keys, $values ) {
169
  * @since 1.5.10
170
  * @author Jonathan Buttigieg
171
  *
172
- * @return int The buffer size
173
  */
174
  function get_imagify_bulk_buffer_size() {
175
  $sizes = count( get_imagify_thumbnail_sizes() );
176
-
177
  switch ( true ) {
178
- case ( $sizes >= 10 ) :
179
- return 1;
180
- break;
181
- case ( $sizes >= 8 ) :
182
- return 2;
183
- break;
184
- case ( $sizes >= 6 ) :
185
- return 3;
186
- break;
187
- default:
188
- return 4;
189
  }
190
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  /**
5
  * Check if Imagify is activated on the network.
9
  * return bool True if Imagify is activated on the network
10
  */
11
  function imagify_is_active_for_network() {
12
+ static $is;
13
+
14
+ if ( isset( $is ) ) {
15
+ return $is;
16
+ }
17
+
18
+ if ( ! is_multisite() ) {
19
+ $is = false;
20
+ return $is;
21
+ }
22
+
23
+ if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
24
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
25
+ }
26
+
27
+ $is = is_plugin_active_for_network( plugin_basename( IMAGIFY_FILE ) );
28
+
29
+ return $is;
30
  }
31
 
32
+ /**
33
  * Get the URL related to specific admin page or action.
34
  *
35
  * @since 1.0
36
  *
37
+ * @param string $action An action.
38
+ * @param array $arg An array of arguments. It can contain an attachment ID and/or a context.
39
+ * @return string The URL of the specific admin page or action.
40
  */
41
  function get_imagify_admin_url( $action = 'options-general', $arg = array() ) {
42
  $url = '';
43
+ $id = isset( $arg['attachment_id'] ) ? $arg['attachment_id'] : 0;
44
+ $context = isset( $arg['context'] ) ? $arg['context'] : 'wp';
45
 
46
+ switch ( $action ) {
47
  case 'manual-override-upload':
48
  $level = ( isset( $arg['optimization_level'] ) ) ? $arg['optimization_level'] : 0;
49
+ return wp_nonce_url( admin_url( 'admin-post.php?action=imagify_manual_override_upload&attachment_id=' . $id . '&optimization_level=' . $level . '&context=' . $context ), 'imagify-manual-override-upload' );
 
50
 
51
  case 'manual-upload':
52
+ return wp_nonce_url( admin_url( 'admin-post.php?action=imagify_manual_upload&attachment_id=' . $id . '&context=' . $context ), 'imagify-manual-upload' );
 
53
 
54
  case 'restore-upload' :
55
+ return wp_nonce_url( admin_url( 'admin-post.php?action=imagify_restore_upload&attachment_id=' . $id . '&context=' . $context ), 'imagify-restore-upload' );
 
56
 
57
  case 'dismiss-notice':
58
+ return wp_nonce_url( admin_url( 'admin-post.php?action=imagify_dismiss_notice&notice=' . $arg ), 'imagify-dismiss-notice' );
 
59
 
60
  case 'bulk-optimization':
61
+ return admin_url( 'upload.php?page=' . IMAGIFY_SLUG . '-bulk-optimization' );
 
62
 
 
63
  default :
64
  $page = imagify_is_active_for_network() ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' );
65
+ return $page . '?page=' . IMAGIFY_SLUG;
 
66
  }
 
 
67
  }
68
 
69
+ /**
70
  * Get maximal width and height from all thumbnails.
71
  *
72
  * @since 1.1
73
  *
74
+ * @return array An array containing the max width and height.
75
  */
76
  function get_imagify_max_intermediate_image_size() {
77
  global $_wp_additional_image_sizes;
78
+
79
  $width = 0;
80
  $height = 0;
81
+ $limit = 9999;
82
+ $sizes = array( 'thumbnail' => 1, 'medium' => 1, 'large' => 1 );
83
  $get_intermediate_image_sizes = get_intermediate_image_sizes();
84
+
85
+ // Create the full array with sizes and crop info.
86
+ foreach ( $get_intermediate_image_sizes as $_size ) {
87
+ if ( isset( $sizes[ $_size ] ) ) {
88
+ $_size_width = get_option( $_size . '_size_w' );
89
+ $_size_height = get_option( $_size . '_size_h' );
90
+ } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
91
+ $_size_width = $_wp_additional_image_sizes[ $_size ]['width'];
92
+ $_size_height = $_wp_additional_image_sizes[ $_size ]['height'];
93
+ } else {
94
+ continue;
95
+ }
96
+
97
+ if ( $_size_width < $limit ) {
98
+ $width = max( $width, $_size_width );
99
+ }
100
+
101
+ if ( $_size_height < $limit ) {
102
+ $height = max( $height, $_size_height );
103
+ }
 
 
104
  }
105
+
106
+ return array(
107
+ 'width' => $width,
108
+ 'height' => $height,
109
  );
110
  }
111
 
114
  *
115
  * @since 1.0
116
  *
117
+ * @param string $notice A notice ID.
118
+ * @param int $user_id A user ID.
119
  * @return void
120
  */
121
  function imagify_renew_notice( $notice, $user_id = 0 ) {
122
+ $user_id = $user_id ? (int) $user_id : get_current_user_id();
 
123
  $notices = get_user_meta( $user_id, '_imagify_ignore_notices', true );
124
+ $notices = $notices && is_array( $notices ) ? array_flip( $notices ) : array();
125
 
126
+ if ( ! isset( $notices[ $notice ] ) ) {
127
+ return;
 
128
  }
129
+
130
+ unset( $notices[ $notice ] );
131
+ $notices = array_flip( $notices );
132
+ $notices = array_values( $notices );
133
+ update_user_meta( $user_id, '_imagify_ignore_notices', $notices );
134
  }
135
 
136
  /**
137
+ * Dismiss an Imagify notice.
138
  *
139
  * @since 1.0
140
  *
141
+ * @param string $notice A notice ID.
142
+ * @param int $user_id A user ID.
143
  * @return void
144
  */
145
  function imagify_dismiss_notice( $notice, $user_id = 0 ) {
146
+ $user_id = $user_id ? (int) $user_id : get_current_user_id();
 
147
  $notices = get_user_meta( $user_id, '_imagify_ignore_notices', true );
148
+ $notices = is_array( $notices ) ? $notices : array();
149
  $notices[] = $notice;
150
  $notices = array_filter( $notices );
151
  $notices = array_unique( $notices );
153
  update_user_meta( $user_id, '_imagify_ignore_notices', $notices );
154
  }
155
 
156
+ /**
157
+ * Tell if an Imagify notice is dismissed.
158
+ *
159
+ * @since 1.6.5
160
+ * @author Grégory Viguier
161
+ *
162
+ * @param string $notice A notice ID.
163
+ * @param int $user_id A user ID.
164
+ * @return bool
165
+ */
166
+ function imagify_notice_is_dismissed( $notice, $user_id = 0 ) {
167
+ $user_id = $user_id ? (int) $user_id : get_current_user_id();
168
+ $notices = get_user_meta( $user_id, '_imagify_ignore_notices', true );
169
+
170
+ if ( ! $notices || ! is_array( $notices ) ) {
171
+ return false;
172
+ }
173
+
174
+ $notices = array_flip( $notices );
175
+ return isset( $notices[ $notice ] );
176
+ }
177
+
178
  /**
179
  * Combine two arrays with some specific keys.
180
  * We use this function to combine the result of 2 SQL queries.
181
  *
182
  * @since 1.4.5
183
  *
184
+ * @param array $keys An array of keys.
185
+ * @param array $values An array of arrays like array( 'id' => id, 'value' => value ).
186
+ * @return array $result The combined arrays.
187
  */
188
  function imagify_query_results_combine( $keys, $values ) {
189
+ if ( ! $keys || ! $values ) {
190
  return array();
191
  }
192
+
193
  $result = array();
194
  $keys = array_flip( $keys );
195
+
196
  foreach ( $values as $v ) {
197
  if ( isset( $keys[ $v['id'] ] ) ) {
198
  $result[ $v['id'] ] = $v['value'];
199
  }
200
  }
201
+
202
  return $result;
203
  }
204
 
208
  * @since 1.5.10
209
  * @author Jonathan Buttigieg
210
  *
211
+ * @return int The buffer size.
212
  */
213
  function get_imagify_bulk_buffer_size() {
214
  $sizes = count( get_imagify_thumbnail_sizes() );
215
+
216
  switch ( true ) {
217
+ case ( $sizes >= 10 ) :
218
+ return 1;
219
+
220
+ case ( $sizes >= 8 ) :
221
+ return 2;
222
+
223
+ case ( $sizes >= 6 ) :
224
+ return 3;
225
+
226
+ default:
227
+ return 4;
228
  }
229
+ }
inc/functions/api.php CHANGED
@@ -1,28 +1,26 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  /**
5
  * Check if external requests are blocked for Imagify.
6
  *
7
  * @since 1.0
8
  *
9
- * return bool True if Imagify API can't be called
10
  */
11
  function is_imagify_blocked() {
12
  if ( ! defined( 'WP_HTTP_BLOCK_EXTERNAL' ) || ! WP_HTTP_BLOCK_EXTERNAL ) {
13
  return false;
14
  }
15
-
16
- if ( defined( 'WP_ACCESSIBLE_HOSTS' ) ) {
17
- $accessible_hosts = explode( ',', WP_ACCESSIBLE_HOSTS );
18
- $accessible_hosts = array_map( 'trim', $accessible_hosts );
19
-
20
- if ( in_array( '*.imagify.io', $accessible_hosts ) ) {
21
- return false;
22
- }
23
  }
24
-
25
- return true;
 
 
 
26
  }
27
 
28
  /**
@@ -33,29 +31,29 @@ function is_imagify_blocked() {
33
  * @return bool True if the Imagify API is available.
34
  */
35
  function is_imagify_servers_up() {
36
- static $imagify_api_version = null;
37
-
38
- if ( null !== $imagify_api_version ) {
39
  return $imagify_api_version;
40
  }
41
-
42
  $transient_name = 'imagify_check_api_version';
43
  $transient_expiration = 3 * MINUTE_IN_SECONDS;
44
-
45
  if ( get_site_transient( $transient_name ) ) {
46
  $imagify_api_version = true;
47
- return true;
48
  }
49
-
50
  if ( is_wp_error( get_imagify_api_version() ) ) {
51
- $imagify_api_version = false;
52
  set_site_transient( $transient_name, 0, $transient_expiration );
53
-
54
- return false;
 
55
  }
56
-
57
- $imagify_api_version = true;
58
  set_site_transient( $transient_name, 1, $transient_expiration );
59
-
60
- return true;
61
- }
 
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  /**
5
  * Check if external requests are blocked for Imagify.
6
  *
7
  * @since 1.0
8
  *
9
+ * return bool True if Imagify API can't be called.
10
  */
11
  function is_imagify_blocked() {
12
  if ( ! defined( 'WP_HTTP_BLOCK_EXTERNAL' ) || ! WP_HTTP_BLOCK_EXTERNAL ) {
13
  return false;
14
  }
15
+
16
+ if ( ! defined( 'WP_ACCESSIBLE_HOSTS' ) ) {
17
+ return true;
 
 
 
 
 
18
  }
19
+
20
+ $accessible_hosts = explode( ',', WP_ACCESSIBLE_HOSTS );
21
+ $accessible_hosts = array_map( 'trim', $accessible_hosts );
22
+
23
+ return ! in_array( '*.imagify.io', $accessible_hosts, true );
24
  }
25
 
26
  /**
31
  * @return bool True if the Imagify API is available.
32
  */
33
  function is_imagify_servers_up() {
34
+ static $imagify_api_version;
35
+
36
+ if ( isset( $imagify_api_version ) ) {
37
  return $imagify_api_version;
38
  }
39
+
40
  $transient_name = 'imagify_check_api_version';
41
  $transient_expiration = 3 * MINUTE_IN_SECONDS;
42
+
43
  if ( get_site_transient( $transient_name ) ) {
44
  $imagify_api_version = true;
45
+ return $imagify_api_version;
46
  }
47
+
48
  if ( is_wp_error( get_imagify_api_version() ) ) {
 
49
  set_site_transient( $transient_name, 0, $transient_expiration );
50
+
51
+ $imagify_api_version = false;
52
+ return $imagify_api_version;
53
  }
54
+
 
55
  set_site_transient( $transient_name, 1, $transient_expiration );
56
+
57
+ $imagify_api_version = true;
58
+ return $imagify_api_version;
59
+ }
inc/functions/attachments.php CHANGED
@@ -1,7 +1,7 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
- /*
5
  * Get all mime type which could be optimized by Imagify.
6
  *
7
  * @since 1.3
@@ -9,91 +9,91 @@ defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
9
  * @return array $mime_type The mime type.
10
  */
11
  function get_imagify_mime_type() {
12
- $mime_type = array(
13
- 'image/jpeg',
14
- 'image/png',
15
- 'image/gif'
16
  );
17
-
18
- return $mime_type;
19
  }
20
 
21
- /*
22
  * Get the backup path of a specific attachement.
23
  *
24
  * @since 1.0
25
  *
26
- * @param int $file_path The attachment path.
27
- * @return string $backup_path The backup path.
28
  */
29
  function get_imagify_attachment_backup_path( $file_path ) {
30
- $upload_dir = wp_upload_dir();
31
- $upload_basedir = trailingslashit( $upload_dir['basedir'] );
32
- $backup_dir = $upload_basedir . 'backup/';
33
-
34
  /**
35
- * Filter the backup directory path
36
  *
37
  * @since 1.0
38
  *
39
- * @param string $backup_dir The backup directory path
40
  */
41
- $backup_dir = apply_filters( 'imagify_backup_directory', $backup_dir );
42
- $backup_dir = trailingslashit( $backup_dir );
43
-
44
- $backup_path = str_replace( $upload_basedir, $backup_dir, $file_path );
45
- return $backup_path;
46
  }
47
 
48
- /*
49
  * Retrieve file path for an attachment based on filename.
50
  *
51
  * @since 1.4.5
52
  *
53
- * @param int $filename The filename.
54
- * @return string|false $file_path The file path to where the attached file should be, false otherwise.
55
  */
56
- function get_imagify_attached_file( $filename ) {
57
- $file_path = false;
58
-
59
  // If the file is relative, prepend upload dir.
60
- if ( $filename && 0 !== strpos( $filename, '/' ) && ! preg_match( '|^.:\\\|', $filename ) && ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) {
61
- $file_path = $uploads['basedir'] . "/$filename";
 
 
 
 
62
  }
63
-
64
- return $file_path;
65
  }
66
 
67
- /*
68
  * Retrieve the URL for an attachment based on filename.
69
  *
70
  * @since 1.4.5
71
  *
72
- * @param int $filename The filename.
73
- * @return string|false $url Attachment URL, otherwise false.
74
  */
75
- function get_imagify_attachment_url( $filename ) {
76
- $url = '';
77
-
78
- // Get upload directory.
79
- if ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) {
80
- // Check that the upload base exists in the file location.
81
- if ( 0 === strpos( $filename, $uploads['basedir'] ) ) {
82
- // Replace file location with url location.
83
- $url = str_replace( $uploads['basedir'], $uploads['baseurl'], $filename );
84
- } elseif ( false !== strpos( $filename, 'wp-content/uploads' ) ) {
85
- // Get the directory name relative to the basedir (back compat for pre-2.7 uploads)
86
- $url = trailingslashit( $uploads['baseurl'] . '/' . _wp_get_attachment_relative_path( $filename ) ) . basename( $filename );
87
- } else {
88
- // It's a newly-uploaded file, therefore $file is relative to the basedir.
89
- $url = $uploads['baseurl'] . "/$filename";
90
- }
91
  }
92
-
93
- return $url;
 
 
 
 
 
 
94
  }
95
 
96
- /*
97
  * Get size information for all currently-registered thumbnail sizes.
98
  *
99
  * @since 1.5.10
@@ -103,18 +103,21 @@ function get_imagify_attachment_url( $filename ) {
103
  */
104
  function get_imagify_thumbnail_sizes() {
105
  global $_wp_additional_image_sizes, $wp_version;
106
-
107
- $sizes = array();
108
- $is_wp44 = version_compare( $wp_version, '4.4-beta3' ) >= 0;
109
  $all_intermediate_image_sizes = get_intermediate_image_sizes();
110
  $intermediate_image_sizes = apply_filters( 'image_size_names_choose', $all_intermediate_image_sizes );
111
  $all_intermediate_image_sizes = array_combine( $all_intermediate_image_sizes, $all_intermediate_image_sizes );
112
  $intermediate_image_sizes = array_merge( $all_intermediate_image_sizes, $intermediate_image_sizes );
113
- $wp_image_sizes = $is_wp44 ? array( 'thumbnail', 'medium', 'medium_large', 'large' ) : array( 'thumbnail', 'medium', 'large' );
114
 
115
- // Create the full array with sizes and crop info
 
 
 
 
116
  foreach ( $intermediate_image_sizes as $size => $size_name ) {
117
- if ( in_array( $size, $wp_image_sizes ) && ! is_int( $size ) ) {
118
  $sizes[ $size ] = array(
119
  'width' => get_option( $size . '_size_w' ),
120
  'height' => get_option( $size . '_size_h' ),
@@ -128,6 +131,6 @@ function get_imagify_thumbnail_sizes() {
128
  );
129
  }
130
  }
131
-
132
  return $sizes;
133
- }
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
+ /**
5
  * Get all mime type which could be optimized by Imagify.
6
  *
7
  * @since 1.3
9
  * @return array $mime_type The mime type.
10
  */
11
  function get_imagify_mime_type() {
12
+ return array(
13
+ 'image/jpeg',
14
+ 'image/png',
15
+ 'image/gif',
16
  );
 
 
17
  }
18
 
19
+ /**
20
  * Get the backup path of a specific attachement.
21
  *
22
  * @since 1.0
23
  *
24
+ * @param int $file_path The attachment path.
25
+ * @return string The backup path.
26
  */
27
  function get_imagify_attachment_backup_path( $file_path ) {
28
+ $upload_dir = wp_upload_dir();
29
+ $upload_basedir = trailingslashit( $upload_dir['basedir'] );
30
+ $backup_dir = $upload_basedir . 'backup/';
31
+
32
  /**
33
+ * Filter the backup directory path.
34
  *
35
  * @since 1.0
36
  *
37
+ * @param string $backup_dir The backup directory path.
38
  */
39
+ $backup_dir = apply_filters( 'imagify_backup_directory', $backup_dir );
40
+ $backup_dir = trailingslashit( $backup_dir );
41
+
42
+ return str_replace( $upload_basedir, $backup_dir, $file_path );
 
43
  }
44
 
45
+ /**
46
  * Retrieve file path for an attachment based on filename.
47
  *
48
  * @since 1.4.5
49
  *
50
+ * @param int $filename The filename.
51
+ * @return string|false The file path to where the attached file should be, false otherwise.
52
  */
53
+ function get_imagify_attached_file( $filename ) {
 
 
54
  // If the file is relative, prepend upload dir.
55
+ if ( $filename && 0 !== strpos( $filename, '/' ) && ! preg_match( '|^.:\\\|', $filename ) ) {
56
+ $uploads = wp_upload_dir();
57
+
58
+ if ( false === $uploads['error'] ) {
59
+ return $uploads['basedir'] . "/$filename";
60
+ }
61
  }
62
+
63
+ return false;
64
  }
65
 
66
+ /**
67
  * Retrieve the URL for an attachment based on filename.
68
  *
69
  * @since 1.4.5
70
  *
71
+ * @param int $filename The filename.
72
+ * @return string|bool Attachment URL, otherwise false.
73
  */
74
+ function get_imagify_attachment_url( $filename ) {
75
+ $uploads = wp_upload_dir();
76
+
77
+ if ( false !== $uploads['error'] ) {
78
+ return '';
79
+ }
80
+
81
+ // Check that the upload base exists in the file location.
82
+ if ( 0 === strpos( $filename, $uploads['basedir'] ) ) {
83
+ // Replace file location with url location.
84
+ return str_replace( $uploads['basedir'], $uploads['baseurl'], $filename );
 
 
 
 
 
85
  }
86
+
87
+ if ( false !== strpos( $filename, 'wp-content/uploads' ) ) {
88
+ // Get the directory name relative to the basedir (back compat for pre-2.7 uploads).
89
+ return trailingslashit( $uploads['baseurl'] . '/' . _wp_get_attachment_relative_path( $filename ) ) . basename( $filename );
90
+ }
91
+
92
+ // It's a newly-uploaded file, therefore $file is relative to the basedir.
93
+ return $uploads['baseurl'] . "/$filename";
94
  }
95
 
96
+ /**
97
  * Get size information for all currently-registered thumbnail sizes.
98
  *
99
  * @since 1.5.10
103
  */
104
  function get_imagify_thumbnail_sizes() {
105
  global $_wp_additional_image_sizes, $wp_version;
106
+
107
+ $sizes = array();
 
108
  $all_intermediate_image_sizes = get_intermediate_image_sizes();
109
  $intermediate_image_sizes = apply_filters( 'image_size_names_choose', $all_intermediate_image_sizes );
110
  $all_intermediate_image_sizes = array_combine( $all_intermediate_image_sizes, $all_intermediate_image_sizes );
111
  $intermediate_image_sizes = array_merge( $all_intermediate_image_sizes, $intermediate_image_sizes );
112
+ $wp_image_sizes = array( 'thumbnail' => 1, 'medium' => 1, 'large' => 1 );
113
 
114
+ if ( version_compare( $wp_version, '4.4-beta3' ) >= 0 ) {
115
+ $wp_image_sizes['medium_large'] = 1;
116
+ }
117
+
118
+ // Create the full array with sizes and crop info.
119
  foreach ( $intermediate_image_sizes as $size => $size_name ) {
120
+ if ( isset( $wp_image_sizes[ $size ] ) && ! is_int( $size ) ) {
121
  $sizes[ $size ] = array(
122
  'width' => get_option( $size . '_size_w' ),
123
  'height' => get_option( $size . '_size_h' ),
131
  );
132
  }
133
  }
134
+
135
  return $sizes;
136
+ }
inc/functions/common.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
+
4
+ /**
5
+ * Get user capacity to operate Imagify.
6
+ *
7
+ * @since 1.6.5
8
+ * @author Grégory Viguier
9
+ *
10
+ * @param bool $force_mono Force capacity for mono-site.
11
+ * @return string
12
+ */
13
+ function imagify_get_capacity( $force_mono = false ) {
14
+ if ( $force_mono || ! is_multisite() ) {
15
+ $capacity = 'manage_options';
16
+ } else {
17
+ $capacity = imagify_is_active_for_network() ? 'manage_network_options' : 'manage_options';
18
+ }
19
+
20
+ /**
21
+ * Filter the user capacity used to operate Imagify.
22
+ *
23
+ * @since 1.0
24
+ * @since 1.6.5 Added $force_mono parameter.
25
+ *
26
+ * @param string $capacity The user capacity.
27
+ * @param bool $force_mono Force capacity for mono-site.
28
+ */
29
+ return apply_filters( 'imagify_capacity', $capacity, $force_mono );
30
+ }
inc/functions/deprecated.php ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
+
4
+ /**
5
+ * Deprecated imagify.io API for WordPress.
6
+ *
7
+ * @since 1.6.5
8
+ */
9
+ class Imagify_Deprecated {
10
+
11
+ /**
12
+ * A shorthand to display a message about a deprecated method.
13
+ *
14
+ * @since 1.6.5
15
+ * @author Grégory Viguier
16
+ *
17
+ * @param string $method_name The deprecated method.
18
+ */
19
+ protected function deprecated_camelcased_method( $method_name ) {
20
+ $class_name = get_class( $this );
21
+ $new_method_name = preg_replace( '/[A-Z]/', '_$0', $method_name );
22
+ _deprecated_function( $class_name . '::' . $method_name . '()', '1.6.5', $class_name . '::' . $new_method_name . '()' );
23
+ }
24
+
25
+ /**
26
+ * Main Instance.
27
+ * Ensures only one instance of class is loaded or can be loaded.
28
+ * Well, actually it ensures nothing since it's not a full singleton pattern.
29
+ *
30
+ * @return object Main instance.
31
+ */
32
+ public static function instance() {
33
+ $class_name = get_class( $this );
34
+ _deprecated_function( $class_name . '::' . __FUNCTION__ . '()', '1.6.5', 'imagify()' );
35
+ return Imagify::get_instance();
36
+ }
37
+
38
+ /**
39
+ * Get your Imagify account infos.
40
+ *
41
+ * @return object
42
+ */
43
+ public function getUser() {
44
+ $this->deprecated_camelcased_method( __FUNCTION__ );
45
+ return $this->get_user();
46
+ }
47
+
48
+ /**
49
+ * Create a user on your Imagify account.
50
+ *
51
+ * @param array $data All user data. Details here: --.
52
+ * @return object
53
+ */
54
+ public function createUser( $data ) {
55
+ $this->deprecated_camelcased_method( __FUNCTION__ );
56
+ return $this->create_user( $data );
57
+ }
58
+
59
+ /**
60
+ * Update an existing user on your Imagify account.
61
+ *
62
+ * @param string $data All user data. Details here: --.
63
+ * @return object
64
+ */
65
+ public function updateUser( $data ) {
66
+ $this->deprecated_camelcased_method( __FUNCTION__ );
67
+ return $this->update_user( $data );
68
+ }
69
+
70
+ /**
71
+ * Check your Imagify API key status.
72
+ *
73
+ * @param string $data The license key.
74
+ * @return object
75
+ */
76
+ public function getStatus( $data ) {
77
+ $this->deprecated_camelcased_method( __FUNCTION__ );
78
+ return $this->get_status( $data );
79
+ }
80
+
81
+ /**
82
+ * Get the Imagify API version.
83
+ *
84
+ * @return object
85
+ */
86
+ public function getApiVersion() {
87
+ $this->deprecated_camelcased_method( __FUNCTION__ );
88
+ return $this->get_api_version();
89
+ }
90
+
91
+ /**
92
+ * Get Public Info.
93
+ *
94
+ * @return object
95
+ */
96
+ public function getPublicInfo() {
97
+ $this->deprecated_camelcased_method( __FUNCTION__ );
98
+ return $this->get_public_info();
99
+ }
100
+
101
+ /**
102
+ * Optimize an image from its binary content.
103
+ *
104
+ * @param string $data All options. Details here: --.
105
+ * @return object
106
+ */
107
+ public function uploadImage( $data ) {
108
+ $this->deprecated_camelcased_method( __FUNCTION__ );
109
+ return $this->upload_image( $data );
110
+ }
111
+
112
+ /**
113
+ * Optimize an image from its URL.
114
+ *
115
+ * @param string $data All options. Details here: --.
116
+ * @return object
117
+ */
118
+ public function fetchImage( $data ) {
119
+ $this->deprecated_camelcased_method( __FUNCTION__ );
120
+ return $this->fetch_image( $data );
121
+ }
122
+
123
+ /**
124
+ * Get prices for plans.
125
+ *
126
+ * @return object
127
+ */
128
+ public function getPlansPrices() {
129
+ $this->deprecated_camelcased_method( __FUNCTION__ );
130
+ return $this->get_plans_prices();
131
+ }
132
+
133
+ /**
134
+ * Get prices for packs (one time).
135
+ *
136
+ * @return object
137
+ */
138
+ public function getPacksPrices() {
139
+ $this->deprecated_camelcased_method( __FUNCTION__ );
140
+ return $this->get_packs_prices();
141
+ }
142
+
143
+ /**
144
+ * Get all prices (packs & plans included).
145
+ *
146
+ * @return object
147
+ */
148
+ public function getAllPrices() {
149
+ $this->deprecated_camelcased_method( __FUNCTION__ );
150
+ return $this->get_all_prices();
151
+ }
152
+
153
+ /**
154
+ * Get all prices (packs & plans included).
155
+ *
156
+ * @param string $coupon A coupon code.
157
+ * @return object
158
+ */
159
+ public function checkCouponCode( $coupon ) {
160
+ $this->deprecated_camelcased_method( __FUNCTION__ );
161
+ return $this->check_coupon_code( $coupon );
162
+ }
163
+
164
+ /**
165
+ * Get information about current discount.
166
+ *
167
+ * @return object
168
+ */
169
+ public function checkDiscount() {
170
+ $this->deprecated_camelcased_method( __FUNCTION__ );
171
+ return $this->check_discount();
172
+ }
173
+
174
+ /**
175
+ * Make an HTTP call using curl.
176
+ *
177
+ * @param string $url The URL to call.
178
+ * @param array $args The request args.
179
+ * @return object
180
+ */
181
+ private function httpCall( $url, $args = array() ) {
182
+ $this->deprecated_camelcased_method( __FUNCTION__ );
183
+ return $this->http_call( $url, $args );
184
+ }
185
+ }
inc/functions/files.php CHANGED
@@ -1,17 +1,47 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  /**
5
- * Set the default file permissions using FS_CHMOD_FILE from WP
6
  *
7
- * @since 1.2
 
8
  *
9
- * @param string $file The path to file
10
- * @return bool
11
- **/
12
- function imagify_chmod_file( $file ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  if ( ! defined( 'FS_CHMOD_FILE' ) ) {
14
  define( 'FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) );
15
  }
16
- return @chmod( $file, FS_CHMOD_FILE );
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  /**
5
+ * Get WP Direct filesystem object. Also define chmod constants if not done yet.
6
  *
7
+ * @since 1.6.5
8
+ * @author Grégory Viguier
9
  *
10
+ * @return object A `$wp_filesystem` object.
11
+ */
12
+ function imagify_get_filesystem() {
13
+ static $filesystem;
14
+
15
+ if ( $filesystem ) {
16
+ return $filesystem;
17
+ }
18
+
19
+ require_once( ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php' );
20
+ require_once( ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php' );
21
+
22
+ $filesystem = new WP_Filesystem_Direct( new StdClass() );
23
+
24
+ // Set the permission constants if not already set.
25
+ if ( ! defined( 'FS_CHMOD_DIR' ) ) {
26
+ define( 'FS_CHMOD_DIR', ( fileperms( ABSPATH ) & 0777 | 0755 ) );
27
+ }
28
  if ( ! defined( 'FS_CHMOD_FILE' ) ) {
29
  define( 'FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) );
30
  }
31
+
32
+ return $filesystem;
33
+ }
34
+
35
+
36
+ /**
37
+ * Set the default file permissions using FS_CHMOD_FILE from WP.
38
+ *
39
+ * @since 1.2
40
+ * @since 1.6.5 Use WP Filesystem.
41
+ *
42
+ * @param string $file The path to file.
43
+ * @return bool
44
+ */
45
+ function imagify_chmod_file( $file ) {
46
+ return imagify_get_filesystem()->chmod( $file, FS_CHMOD_FILE );
47
+ }
inc/functions/formatting.php CHANGED
@@ -1,47 +1,50 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  /**
5
- * Round UP to nearest half integer
6
  *
7
  * @since 1.0
8
  * @source http://stackoverflow.com/a/13526408
9
  *
10
- * @param int $number The number to round up
11
- * @return int $number The formatted number
12
  */
13
  function imagify_round_half_five( $number ) {
14
- $number = strval( $number );
15
- $number = explode( '.', $number );
16
-
17
- if ( ! isset( $number[1] ) ) {
18
- return $number[0];
19
- }
20
-
21
- $decimal = floatval( '0.' . substr( $number[1], 0 , 2 ) ); // cut only 2 number
22
- if ( $decimal > 0 ) {
23
- if( $decimal <= 0.5 ) {
24
- return floatval( $number[0] ) + 0.5;
25
- } elseif ( $decimal > 0.5 && $decimal <= 0.99 ) {
26
- return floatval( $number[0]) + 1;
27
- }
28
- } else {
29
- return floatval( $number );
30
- }
 
 
 
31
  }
32
 
33
  /**
34
- * Get the Imagify attachment class name depending to a context
35
  *
36
  * @since 1.5
37
  * @source Jonathan Buttigieg
38
  *
39
- * @param string $context The context to determine the class name
40
- * @return string $class_name The Imagify attachment class name
41
  */
42
  function get_imagify_attachment_class_name( $context = 'wp' ) {
43
  $class_name = 'Imagify_';
44
  $class_name .= 'wp' !== $context ? $context . '_Attachment' : 'Attachment';
45
-
46
  return $class_name;
47
- }
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  /**
5
+ * Round UP to nearest half integer.
6
  *
7
  * @since 1.0
8
  * @source http://stackoverflow.com/a/13526408
9
  *
10
+ * @param int|float|string $number The number to round up.
11
+ * @return float The formatted number.
12
  */
13
  function imagify_round_half_five( $number ) {
14
+ $number = strval( $number );
15
+ $number = explode( '.', $number );
16
+
17
+ if ( ! isset( $number[1] ) ) {
18
+ return $number[0];
19
+ }
20
+
21
+ $decimal = floatval( '0.' . substr( $number[1], 0 , 2 ) ); // Cut only 2 numbers.
22
+
23
+ if ( $decimal > 0 ) {
24
+ if ( $decimal <= 0.5 ) {
25
+ return floatval( $number[0] ) + 0.5;
26
+ }
27
+ if ( $decimal <= 0.99 ) {
28
+ return floatval( $number[0] ) + 1;
29
+ }
30
+ return 1;
31
+ }
32
+
33
+ return floatval( $number );
34
  }
35
 
36
  /**
37
+ * Get the Imagify attachment class name depending to a context.
38
  *
39
  * @since 1.5
40
  * @source Jonathan Buttigieg
41
  *
42
+ * @param string $context The context to determine the class name.
43
+ * @return string $class_name The Imagify attachment class name.
44
  */
45
  function get_imagify_attachment_class_name( $context = 'wp' ) {
46
  $class_name = 'Imagify_';
47
  $class_name .= 'wp' !== $context ? $context . '_Attachment' : 'Attachment';
48
+
49
  return $class_name;
50
+ }
inc/functions/i18n.php CHANGED
@@ -1,111 +1,134 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  /**
5
- * Get all translations we can use with wp_localize_script()
6
  *
7
  * @since 1.5
8
  * @author Jonathan Buttigieg
9
  *
10
- * @param string $context The translation context
11
- * @return array $translations The translations
12
  */
13
  function get_imagify_localize_script_translations( $context ) {
14
  $translations = array();
15
 
16
- switch( $context ) {
17
  case 'admin':
18
  $translations = array(
19
  'labels' => array(
20
- 'signupTitle' => __( 'Let\'s get you started!', 'imagify' ),
21
- 'signupText' => __( 'Enter your email to get an API key:', 'imagify' ),
22
- 'signupConfirmButtonText' => __( 'Sign Up', 'imagify' ),
23
- 'signupErrorEmptyEmail' => __( 'You need to specify an email!', 'imagify' ),
24
- 'signupSuccessTitle' => __( 'Congratulations!', 'imagify' ),
25
- 'signupSuccessText' => __( 'Your account has been succesfully created. Please check your mailbox, you are going to receive an email with API key.', 'imagify' ),
26
- 'saveApiKeyTitle' => __( 'Connect to Imagify!', 'imagify' ),
27
- 'saveApiKeyText' => __( 'Paste your API key below:', 'imagify' ),
28
- 'saveApiKeyConfirmButtonText' => __( 'Connect me', 'imagify' ),
29
- 'waitApiKeyCheckText' => __( 'Check in progress...', 'imagify' ),
30
- 'ApiKeyErrorEmpty' => __( 'You need to specify your api key!', 'imagify' ),
31
- 'ApiKeyCheckSuccessTitle' => __( 'Congratulations!', 'imagify' ),
32
- 'ApiKeyCheckSuccessText' => __( 'Your API key is valid. You can now configure the Imagify settings to optimize your images.', 'imagify' ),
33
- 'ValidApiKeyText' => __( 'Your API key is valid.', 'imagify' ),
34
- 'swalCancel' => __( 'Cancel' ),
35
- 'errorPriceAPI' => __( 'Something went wrong with getting our updated offers. Please retry later.', 'imagify' ),
36
- 'errorCouponAPI' => __( 'Error with checking this coupon.', 'imagify' ),
37
- 'successCouponAPI' => sprintf( _x( '%s off with %s', 'coupon validated', 'imagify' ), '<span class="imagify-coupon-offer"></span>', '<strong class="imagify-coupon-word"></strong>' )
38
- )
 
 
 
 
39
  );
40
- break;
41
 
42
  case 'options':
43
  $translations = array(
44
- 'noBackupTitle' => __( 'Don\'t Need a Parachute?', 'imagify' ),
45
- 'noBackupText' => __( 'If you keep this option deactivated, you won\'t be able to re-optimize your images to another compression level and restore your original images in case of need.', 'imagify' )
46
  );
47
- break;
48
-
49
  case 'upload':
50
  $translations = array(
51
- 'bulkActionsLabels' => array(
52
  'optimize' => __( 'Optimize', 'imagify' ),
53
  'restore' => __( 'Restore Original', 'imagify' ),
54
  ),
55
  );
56
- break;
57
-
58
  case 'twentytwenty':
59
  $translations = array(
60
  'labels' => array(
61
- 'original_l' => esc_html__( 'Original Image', 'imagify' ),
62
- 'optimized_l' => esc_html__( 'Optimized Image', 'imagify' ),
63
- 'compare' => esc_html__( 'Compare Original VS Optimized', 'imagify' ),
64
- 'close' => esc_html__( 'Close', 'imagify' ),
65
- 'filesize' => esc_html__( 'File Size:', 'imagify' ),
66
- 'saving' => esc_html__( 'Original Saving:', 'imagify' ),
67
- 'optimize' => esc_html__( 'Optimize', 'imagify' )
68
- )
69
  );
70
- break;
71
-
72
  case 'bulk':
73
- $user = get_imagify_user();
74
  $translations = array(
75
  'labels' => array(
76
- 'waitTitle' => __( 'Please wait...', 'imagify' ),
77
- 'waitText' => __( 'We are trying to get your unoptimized images, it may take time depending on the number of images.', 'imagify' ),
78
- 'waitImageUrl' => IMAGIFY_ASSETS_IMG_URL . 'popin-loader.svg',
79
- 'getUnoptimizedImagesErrorTitle' => __( 'Oops, There is something wrong!', 'imagify' ),
80
- 'getUnoptimizedImagesErrorText' => __( 'An unknow error occurred when we tried to get all your unoptimized images. Try again and if the issue still persist, please contact us!', 'imagify' ),
81
- 'invalidAPIKeyTitle' => __( 'Your API key isn\'t valid!', 'imagify' ),
82
- 'overviewChartLabels' => array(
83
  'optimized' => __( 'Optimized', 'imagify' ),
84
  'unoptimized' => __( 'Unoptimized', 'imagify' ),
85
  'error' => __( 'Error', 'imagify' ),
86
  ),
87
- 'overQuotaTitle' => __( 'Oops, It\'s Over!', 'imagify' ),
88
- 'noAttachmentToOptimizeTitle' => __( 'Hold on!', 'imagify' ),
89
- 'noAttachmentToOptimizeText' => __( 'All your images have been optimized by Imagify. Congratulations!', 'imagify' ),
90
- 'pluginURL' => 'https://wordpress.org/plugins/imagify',
91
- 'textToShare' => __( 'Discover @imagify, the new compression tool to optimize your images for free. I saved %1$s out of %2$s!', 'imagify' ),
92
- 'totalOptimizedAttachments' => imagify_count_optimized_attachments(),
93
- 'totalUnoptimizedAttachments' => imagify_count_unoptimized_attachments(),
94
- 'totalErrorsAttachments' => imagify_count_error_attachments(),
95
- 'processing' => __( 'Imagify is still processing. Are you sure you want to leave this page?', 'imagify' )
96
- )
 
 
97
  );
98
-
99
  if ( imagify_valid_key() ) {
100
  if ( is_wp_error( $user ) ) {
101
- $translations['overQuotaText'] = sprintf( __( 'To continue to optimize your images, log in to your Imagify account to %sbuy a pack or subscribe to a plan%s.', 'imagify' ), '<a href="' . IMAGIFY_APP_MAIN . '/#/subscription' . '">', '</a>' );
 
 
 
 
 
102
  }
103
  else {
104
- $translations['overQuotaText'] = sprintf( __( 'You have consumed all your credit for this month. You will have <strong>%s back on %s</strong>.', 'imagify' ), size_format( $user->quota * 1048576 ), date_i18n( __( 'F j, Y' ), strtotime( $user->next_date_update ) ) ) . '<br/><br/>' . sprintf( __( 'To continue to optimize your images, log in to your Imagify account to %sbuy a pack or subscribe to a plan%s.', 'imagify' ), '<a href="' . IMAGIFY_APP_MAIN . '/#/subscription' . '">', '</a>' );
 
 
 
 
 
 
 
 
 
 
 
 
105
  }
106
  }
107
- break;
108
- }
109
 
110
  return $translations;
111
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  /**
5
+ * Get all translations we can use with wp_localize_script().
6
  *
7
  * @since 1.5
8
  * @author Jonathan Buttigieg
9
  *
10
+ * @param string $context The translation context.
11
+ * @return array $translations The translations.
12
  */
13
  function get_imagify_localize_script_translations( $context ) {
14
  $translations = array();
15
 
16
+ switch ( $context ) {
17
  case 'admin':
18
  $translations = array(
19
  'labels' => array(
20
+ /* translators: Don't use escaped HTML entities here (like &nbsp;). */
21
+ 'signupTitle' => __( 'Let\'s get you started!', 'imagify' ),
22
+ 'signupText' => __( 'Enter your email to get an API key:', 'imagify' ),
23
+ 'signupConfirmButtonText' => __( 'Sign Up', 'imagify' ),
24
+ 'signupErrorEmptyEmail' => __( 'You need to specify an email!', 'imagify' ),
25
+ /* translators: Don't use escaped HTML entities here (like &nbsp;). */
26
+ 'signupSuccessTitle' => __( 'Congratulations!', 'imagify' ),
27
+ 'signupSuccessText' => __( 'Your account has been succesfully created. Please check your mailbox, you are going to receive an email with API key.', 'imagify' ),
28
+ /* translators: Don't use escaped HTML entities here (like &nbsp;). */
29
+ 'saveApiKeyTitle' => __( 'Connect to Imagify!', 'imagify' ),
30
+ 'saveApiKeyText' => __( 'Paste your API key below:', 'imagify' ),
31
+ 'saveApiKeyConfirmButtonText' => __( 'Connect me', 'imagify' ),
32
+ 'waitApiKeyCheckText' => __( 'Check in progress...', 'imagify' ),
33
+ 'ApiKeyErrorEmpty' => __( 'You need to specify your api key!', 'imagify' ),
34
+ 'ApiKeyCheckSuccessTitle' => __( 'Congratulations!', 'imagify' ),
35
+ 'ApiKeyCheckSuccessText' => __( 'Your API key is valid. You can now configure the Imagify settings to optimize your images.', 'imagify' ),
36
+ 'ValidApiKeyText' => __( 'Your API key is valid.', 'imagify' ),
37
+ 'swalCancel' => __( 'Cancel' ),
38
+ 'errorPriceAPI' => __( 'Something went wrong with getting our updated offers. Please retry later.', 'imagify' ),
39
+ 'errorCouponAPI' => __( 'Error with checking this coupon.', 'imagify' ),
40
+ /* translators: 1 is a percentage, 2 is a coupon code. */
41
+ 'successCouponAPI' => sprintf( _x( '%1$s off with %2$s', 'coupon validated', 'imagify' ), '<span class="imagify-coupon-offer"></span>', '<strong class="imagify-coupon-word"></strong>' ),
42
+ ),
43
  );
44
+ break;
45
 
46
  case 'options':
47
  $translations = array(
48
+ 'noBackupTitle' => __( 'Don\'t Need a Parachute?', 'imagify' ),
49
+ 'noBackupText' => __( 'If you keep this option deactivated, you won\'t be able to re-optimize your images to another compression level and restore your original images in case of need.', 'imagify' ),
50
  );
51
+ break;
52
+
53
  case 'upload':
54
  $translations = array(
55
+ 'bulkActionsLabels' => array(
56
  'optimize' => __( 'Optimize', 'imagify' ),
57
  'restore' => __( 'Restore Original', 'imagify' ),
58
  ),
59
  );
60
+ break;
61
+
62
  case 'twentytwenty':
63
  $translations = array(
64
  'labels' => array(
65
+ 'original_l' => __( 'Original Image', 'imagify' ),
66
+ 'optimized_l' => __( 'Optimized Image', 'imagify' ),
67
+ 'compare' => __( 'Compare Original VS Optimized', 'imagify' ),
68
+ 'close' => __( 'Close', 'imagify' ),
69
+ 'filesize' => __( 'File Size:', 'imagify' ),
70
+ 'saving' => __( 'Original Saving:', 'imagify' ),
71
+ 'optimize' => __( 'Optimize', 'imagify' ),
72
+ ),
73
  );
74
+ break;
75
+
76
  case 'bulk':
77
+ $user = get_imagify_user();
78
  $translations = array(
79
  'labels' => array(
80
+ 'waitTitle' => __( 'Please wait...', 'imagify' ),
81
+ 'waitText' => __( 'We are trying to get your unoptimized images, it may take time depending on the number of images.', 'imagify' ),
82
+ 'waitImageUrl' => IMAGIFY_ASSETS_IMG_URL . 'popin-loader.svg',
83
+ 'getUnoptimizedImagesErrorTitle' => __( 'Oops, There is something wrong!', 'imagify' ),
84
+ 'getUnoptimizedImagesErrorText' => __( 'An unknown error occurred when we tried to get all your unoptimized images. Try again and if the issue still persists, please contact us!', 'imagify' ),
85
+ 'invalidAPIKeyTitle' => __( 'Your API key isn\'t valid!', 'imagify' ),
86
+ 'overviewChartLabels' => array(
87
  'optimized' => __( 'Optimized', 'imagify' ),
88
  'unoptimized' => __( 'Unoptimized', 'imagify' ),
89
  'error' => __( 'Error', 'imagify' ),
90
  ),
91
+ 'overQuotaTitle' => __( 'Oops, It\'s Over!', 'imagify' ),
92
+ 'noAttachmentToOptimizeTitle' => __( 'Hold on!', 'imagify' ),
93
+ 'noAttachmentToOptimizeText' => __( 'All your images have been optimized by Imagify. Congratulations!', 'imagify' ),
94
+ /* translators: Plugin URI of the plugin/theme */
95
+ 'pluginURL' => __( 'https://wordpress.org/plugins/imagify/', 'imagify' ),
96
+ /* translators: 1 and 2 are file sizes. */
97
+ 'textToShare' => __( 'Discover @imagify, the new compression tool to optimize your images for free. I saved %1$s out of %2$s!', 'imagify' ),
98
+ 'totalOptimizedAttachments' => imagify_count_optimized_attachments(),
99
+ 'totalUnoptimizedAttachments' => imagify_count_unoptimized_attachments(),
100
+ 'totalErrorsAttachments' => imagify_count_error_attachments(),
101
+ 'processing' => __( 'Imagify is still processing. Are you sure you want to leave this page?', 'imagify' ),
102
+ ),
103
  );
104
+
105
  if ( imagify_valid_key() ) {
106
  if ( is_wp_error( $user ) ) {
107
+ $translations['overQuotaText'] = sprintf(
108
+ /* translators: 1 is a link tag start, 2 is the link tag end. */
109
+ __( 'To continue to optimize your images, log in to your Imagify account to %1$sbuy a pack or subscribe to a plan%2$s.', 'imagify' ),
110
+ '<a href="' . IMAGIFY_APP_MAIN . '/#/subscription">',
111
+ '</a>'
112
+ );
113
  }
114
  else {
115
+ $translations['overQuotaText'] = sprintf(
116
+ /* translators: 1 is a data quota, 2 is a date. */
117
+ __( 'You have consumed all your credit for this month. You will have <strong>%1$s back on %2$s</strong>.', 'imagify' ),
118
+ size_format( $user->quota * 1048576 ),
119
+ date_i18n( __( 'F j, Y' ), strtotime( $user->next_date_update ) )
120
+ );
121
+ $translations['overQuotaText'] .= '<br/><br/>';
122
+ $translations['overQuotaText'] .= sprintf(
123
+ /* translators: 1 is a link tag start, 2 is the link tag end. */
124
+ __( 'To continue to optimize your images, log in to your Imagify account to %1$sbuy a pack or subscribe to a plan%2$s.', 'imagify' ),
125
+ '<a href="' . IMAGIFY_APP_MAIN . '/#/subscription">',
126
+ '</a>'
127
+ );
128
  }
129
  }
130
+ break;
131
+ } // End switch().
132
 
133
  return $translations;
134
+ }
inc/functions/options.php CHANGED
@@ -1,43 +1,50 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  /**
5
- * A wrapper to easily get imagify option
6
  *
7
  * @since 1.0
8
  *
9
- * @param string $option The option name
10
- * @param bool $default The default value of option
11
- * @return mixed The option value
12
  */
13
  function get_imagify_option( $option, $default = false ) {
 
14
  /**
15
- * Pre-filter any Imagify option before read
16
  *
17
  * @since 1.0
18
  *
19
- * @param variant $default The default value
20
- */
21
- $value = apply_filters( 'pre_get_imagify_option_' . $option, NULL, $default );
 
22
 
23
- if ( NULL !== $value ) {
24
  return $value;
25
  }
26
 
27
- $plugins = get_site_option( 'active_sitewide_plugins');
28
- $options = isset( $plugins[ IMAGIFY_SLUG . '/imagify.php' ] ) ? get_site_option( IMAGIFY_SETTINGS_SLUG ) : get_option( IMAGIFY_SETTINGS_SLUG );
29
- $value = isset( $options[ $option ] ) && $options[ $option ] !== '' ? $options[ $option ] : $default;
30
-
31
- if ( 'api_key' === $option && ( defined( 'IMAGIFY_API_KEY' ) && IMAGIFY_API_KEY ) ) {
 
 
 
 
32
  $value = IMAGIFY_API_KEY;
33
  }
34
-
35
  /**
36
- * Filter any Imagify option after read
37
  *
38
  * @since 1.0
39
  *
40
- * @param variant $default The default value
 
41
  */
42
  return apply_filters( 'get_imagify_option_' . $option, $value, $default );
43
  }
@@ -48,48 +55,48 @@ function get_imagify_option( $option, $default = false ) {
48
  * @since 1.6
49
  * @author Remy Perona
50
  *
51
- * @param string $key The option name
52
- * @param string $value The value of the option
53
  * @return void
54
  */
55
  function update_imagify_option( $key, $value ) {
56
  $options = get_option( IMAGIFY_SETTINGS_SLUG );
57
  $options[ $key ] = $value;
58
-
59
  update_option( IMAGIFY_SETTINGS_SLUG, $options );
60
  }
61
 
62
  /**
63
- * Determine if the Imagify API key is valid
64
  *
65
  * @since 1.0
66
  *
67
- * @return bool True if the API key is valid
68
  */
69
  function imagify_valid_key() {
70
- static $imagify_valid_key = null;
71
-
72
- if ( null !== $imagify_valid_key ) {
73
  return $imagify_valid_key;
74
  }
75
-
76
  if ( ! get_imagify_option( 'api_key', false ) ) {
77
  $imagify_valid_key = false;
78
  return false;
79
  }
80
-
81
  if ( get_site_transient( 'imagify_check_licence_1' ) ) {
82
  $imagify_valid_key = true;
83
  return true;
84
  }
85
-
86
  if ( is_wp_error( get_imagify_user() ) ) {
87
  $imagify_valid_key = false;
88
  return false;
89
  }
90
-
91
  $imagify_valid_key = true;
92
  set_site_transient( 'imagify_check_licence_1', true, YEAR_IN_SECONDS );
93
-
94
  return true;
95
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  /**
5
+ * A wrapper to easily get imagify option.
6
  *
7
  * @since 1.0
8
  *
9
+ * @param string $option The option name.
10
+ * @param bool $default The default value of option.
11
+ * @return mixed The option value.
12
  */
13
  function get_imagify_option( $option, $default = false ) {
14
+ static $basename;
15
  /**
16
+ * Pre-filter any Imagify option before read.
17
  *
18
  * @since 1.0
19
  *
20
+ * @param mixed $value Value to return instead of the option value. Default null to skip it.
21
+ * @param mixed $default The default value. Default false.
22
+ */
23
+ $value = apply_filters( 'pre_get_imagify_option_' . $option, null, $default );
24
 
25
+ if ( isset( $value ) ) {
26
  return $value;
27
  }
28
 
29
+ if ( ! isset( $basename ) ) {
30
+ $basename = plugin_basename( IMAGIFY_FILE );
31
+ }
32
+
33
+ $plugins = get_site_option( 'active_sitewide_plugins' );
34
+ $options = isset( $plugins[ $basename ] ) ? get_site_option( IMAGIFY_SETTINGS_SLUG ) : get_option( IMAGIFY_SETTINGS_SLUG );
35
+ $value = isset( $options[ $option ] ) && $default !== $options[ $option ] ? $options[ $option ] : $default;
36
+
37
+ if ( 'api_key' === $option && defined( 'IMAGIFY_API_KEY' ) && IMAGIFY_API_KEY ) {
38
  $value = IMAGIFY_API_KEY;
39
  }
40
+
41
  /**
42
+ * Filter any Imagify option after read.
43
  *
44
  * @since 1.0
45
  *
46
+ * @param mixed $value Value of the option.
47
+ * @param mixed $default The default value. Default false.
48
  */
49
  return apply_filters( 'get_imagify_option_' . $option, $value, $default );
50
  }
55
  * @since 1.6
56
  * @author Remy Perona
57
  *
58
+ * @param string $key The option name.
59
+ * @param string $value The value of the option.
60
  * @return void
61
  */
62
  function update_imagify_option( $key, $value ) {
63
  $options = get_option( IMAGIFY_SETTINGS_SLUG );
64
  $options[ $key ] = $value;
65
+
66
  update_option( IMAGIFY_SETTINGS_SLUG, $options );
67
  }
68
 
69
  /**
70
+ * Determine if the Imagify API key is valid.
71
  *
72
  * @since 1.0
73
  *
74
+ * @return bool True if the API key is valid.
75
  */
76
  function imagify_valid_key() {
77
+ static $imagify_valid_key;
78
+
79
+ if ( isset( $imagify_valid_key ) ) {
80
  return $imagify_valid_key;
81
  }
82
+
83
  if ( ! get_imagify_option( 'api_key', false ) ) {
84
  $imagify_valid_key = false;
85
  return false;
86
  }
87
+
88
  if ( get_site_transient( 'imagify_check_licence_1' ) ) {
89
  $imagify_valid_key = true;
90
  return true;
91
  }
92
+
93
  if ( is_wp_error( get_imagify_user() ) ) {
94
  $imagify_valid_key = false;
95
  return false;
96
  }
97
+
98
  $imagify_valid_key = true;
99
  set_site_transient( 'imagify_check_licence_1', true, YEAR_IN_SECONDS );
100
+
101
  return true;
102
+ }
inc/functions/process.php CHANGED
@@ -1,74 +1,78 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
 
4
  /**
5
  * Process an image with Imagify.
6
  *
7
  * @since 1.0
8
  *
9
- * @param string $file_path Absolute path to the image file.
10
- * @param bool $backup Force a backup of the original file.
11
- * @param int $optimization_level The optimization level (2=ultra, 1=aggressive, 0=normal).
12
- * @param bool $keep_exif To keep exif data or not
13
- * @return obj|array Error message | Optimized image data
 
14
  */
15
  function do_imagify( $file_path, $args = array() ) {
16
  $errors = new WP_Error();
17
- $args = array_merge(
18
- array(
19
- 'backup' => get_imagify_option( 'backup', false ),
20
- 'optimization_level' => get_imagify_option( 'optimization_level', 1 ),
21
- 'keep_exif' => get_imagify_option( 'exif', false ),
22
- 'context' => 'wp',
23
- 'resized' => false,
24
- 'original_size' => 0,
25
- ),
26
- $args
27
- );
28
-
29
  /**
30
- * Filter the attachment path
31
  *
32
  * @since 1.2
33
  *
34
- * @param string $file_path The attachment path
35
  */
36
  $file_path = apply_filters( 'imagify_file_path', $file_path );
37
-
38
- // Check if the Imagify servers & the API are accessible
39
  if ( ! is_imagify_servers_up() ) {
40
  $errors->add( 'api_server_down', __( 'Sorry, our servers are temporarily unaccessible. Please, try again in a couple of minutes.', 'imagify' ) );
41
- return $errors;
42
  }
43
-
44
  // Check if external HTTP requests are blocked.
45
  if ( is_imagify_blocked() ) {
46
  $errors->add( 'http_block_external', __( 'External HTTP requests are blocked', 'imagify' ) );
47
  return $errors;
48
  }
49
-
50
- // Check that file path isn't empty
51
  if ( empty( $file_path ) ) {
52
  $errors->add( 'empty_path', __( 'File path is empty', 'imagify' ) );
53
  return $errors;
54
  }
55
 
56
- // Check that the file exists
57
- if ( ! file_exists( $file_path ) || ! is_file( $file_path ) ) {
 
 
 
58
  $errors->add( 'file_not_found', sprintf( __( 'Could not find %s', 'imagify' ), $file_path ) );
 
59
  }
60
 
61
- // Check that the file is writable
62
- if ( ! is_writable( dirname( $file_path ) ) ) {
63
- $errors->add( 'not_writable', sprintf( __( "%s is not writable", 'imagify' ), dirname( $file_path ) ) );
 
64
  return $errors;
65
  }
66
 
67
- // Get file size
68
- $file_size = file_exists( $file_path ) ? filesize( $file_path ) : 0;
69
 
70
- // Check that file exists
71
- if ( 0 == $file_size ) {
 
72
  $errors->add( 'image_not_found', sprintf( __( 'Skipped (%s), image not found.', 'imagify' ), size_format( $file_size ) ) );
73
  return $errors;
74
  }
@@ -78,42 +82,38 @@ function do_imagify( $file_path, $args = array() ) {
78
  *
79
  * @since 1.0
80
  *
81
- * @param string $file_path Absolute path to the image file.
82
- * @param bool $backup Force a backup of the original file.
83
  */
84
  do_action( 'before_do_imagify', $file_path, $args['backup'] );
85
 
86
- // Send image for optimization and fetch the response
87
- $response = upload_imagify_image(
88
- array(
89
- 'image' => curl_file_create( $file_path ),
90
- 'data' => json_encode(
91
- array(
92
- 'aggressive' => ( 1 === (int) $args['optimization_level'] ) ? true : false,
93
- 'ultra' => ( 2 === (int) $args['optimization_level'] ) ? true : false,
94
- 'keep_exif' => $args['keep_exif'],
95
- 'context' => $args['context'],
96
- 'original_size' => $args['original_size']
97
- )
98
- )
99
- )
100
- );
101
-
102
- // Check status code
103
- if( is_wp_error( $response ) ) {
104
  $errors->add( 'api_error', $response->get_error_message() );
105
  return $errors;
106
  }
107
 
108
- // Create a backup file
109
- if ( 'wp' === $args['context'] && $args['backup'] && ! $args['resized'] ) {
110
  $backup_path = get_imagify_attachment_backup_path( $file_path );
111
  $backup_path_info = pathinfo( $backup_path );
112
 
113
  wp_mkdir_p( $backup_path_info['dirname'] );
114
 
115
- // TO DO - check and send a error message if the backup can't be created
116
- @copy( $file_path, $backup_path );
117
  imagify_chmod_file( $backup_path );
118
  }
119
 
@@ -128,12 +128,12 @@ function do_imagify( $file_path, $args = array() ) {
128
  return $errors;
129
  }
130
 
131
- @rename( $temp_file, $file_path );
132
  imagify_chmod_file( $file_path );
133
 
134
- // If temp file still exists, delete it
135
- if ( file_exists( $temp_file ) ) {
136
- unlink( $temp_file );
137
  }
138
 
139
  /**
@@ -141,8 +141,8 @@ function do_imagify( $file_path, $args = array() ) {
141
  *
142
  * @since 1.0
143
  *
144
- * @param string $file_path Absolute path to the image file.
145
- * @param bool $backup Force a backup of the original file.
146
  */
147
  do_action( 'after_do_imagify', $file_path, $args['backup'] );
148
 
@@ -150,12 +150,12 @@ function do_imagify( $file_path, $args = array() ) {
150
  }
151
 
152
  /**
153
- * Run an async job to optimize images in background
154
  *
155
- * @param $body (array) Contains the usual $_POST
156
  *
157
  * @since 1.4
158
- **/
159
  function imagify_do_async_job( $body ) {
160
  $args = array(
161
  'timeout' => 0.01,
@@ -166,4 +166,4 @@ function imagify_do_async_job( $body ) {
166
  );
167
 
168
  wp_remote_post( admin_url( 'admin-ajax.php' ), $args );
169
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
 
4
  /**
5
  * Process an image with Imagify.
6
  *
7
  * @since 1.0
8
  *
9
+ * @param string $file_path Absolute path to the image file.
10
+ * @param array $args An array that can contain:
11
+ * bool $backup Force a backup of the original file.
12
+ * int $optimization_level The optimization level (2=ultra, 1=aggressive, 0=normal).
13
+ * bool $keep_exif To keep exif data or not.
14
+ * @return obj|array Error message | Optimized image data.
15
  */
16
  function do_imagify( $file_path, $args = array() ) {
17
  $errors = new WP_Error();
18
+ $args = array_merge( array(
19
+ 'backup' => get_imagify_option( 'backup', false ),
20
+ 'optimization_level' => get_imagify_option( 'optimization_level', 1 ),
21
+ 'keep_exif' => get_imagify_option( 'exif', false ),
22
+ 'context' => 'wp',
23
+ 'resized' => false,
24
+ 'original_size' => 0,
25
+ ), $args );
26
+
 
 
 
27
  /**
28
+ * Filter the attachment path.
29
  *
30
  * @since 1.2
31
  *
32
+ * @param string $file_path The attachment path.
33
  */
34
  $file_path = apply_filters( 'imagify_file_path', $file_path );
35
+
36
+ // Check if the Imagify servers & the API are accessible.
37
  if ( ! is_imagify_servers_up() ) {
38
  $errors->add( 'api_server_down', __( 'Sorry, our servers are temporarily unaccessible. Please, try again in a couple of minutes.', 'imagify' ) );
39
+ return $errors;
40
  }
41
+
42
  // Check if external HTTP requests are blocked.
43
  if ( is_imagify_blocked() ) {
44
  $errors->add( 'http_block_external', __( 'External HTTP requests are blocked', 'imagify' ) );
45
  return $errors;
46
  }
47
+
48
+ // Check that file path isn't empty.
49
  if ( empty( $file_path ) ) {
50
  $errors->add( 'empty_path', __( 'File path is empty', 'imagify' ) );
51
  return $errors;
52
  }
53
 
54
+ $filesystem = imagify_get_filesystem();
55
+
56
+ // Check that the file exists.
57
+ if ( ! $filesystem->exists( $file_path ) || ! $filesystem->is_file( $file_path ) ) {
58
+ /* translators: %s is a file path. */
59
  $errors->add( 'file_not_found', sprintf( __( 'Could not find %s', 'imagify' ), $file_path ) );
60
+ return $errors;
61
  }
62
 
63
+ // Check that the file is writable.
64
+ if ( ! wp_is_writable( dirname( $file_path ) ) ) {
65
+ /* translators: %s is a file path. */
66
+ $errors->add( 'not_writable', sprintf( __( '%s is not writable', 'imagify' ), dirname( $file_path ) ) );
67
  return $errors;
68
  }
69
 
70
+ // Get file size.
71
+ $file_size = $filesystem->size( $file_path );
72
 
73
+ // Check that file exists.
74
+ if ( 0 === $file_size ) {
75
+ /* translators: %s is a file size. */
76
  $errors->add( 'image_not_found', sprintf( __( 'Skipped (%s), image not found.', 'imagify' ), size_format( $file_size ) ) );
77
  return $errors;
78
  }
82
  *
83
  * @since 1.0
84
  *
85
+ * @param string $file_path Absolute path to the image file.
86
+ * @param bool $backup Force a backup of the original file.
87
  */
88
  do_action( 'before_do_imagify', $file_path, $args['backup'] );
89
 
90
+ // Send image for optimization and fetch the response.
91
+ $response = upload_imagify_image( array(
92
+ 'image' => curl_file_create( $file_path ),
93
+ 'data' => wp_json_encode( array(
94
+ 'aggressive' => ( 1 === (int) $args['optimization_level'] ),
95
+ 'ultra' => ( 2 === (int) $args['optimization_level'] ),
96
+ 'keep_exif' => $args['keep_exif'],
97
+ 'context' => $args['context'],
98
+ 'original_size' => $args['original_size'],
99
+ ) ),
100
+ ) );
101
+
102
+ // Check status code.
103
+ if ( is_wp_error( $response ) ) {
 
 
 
 
104
  $errors->add( 'api_error', $response->get_error_message() );
105
  return $errors;
106
  }
107
 
108
+ // Create a backup file.
109
+ if ( 'wp' === $args['context'] && $args['backup'] && ! $args['resized'] ) {
110
  $backup_path = get_imagify_attachment_backup_path( $file_path );
111
  $backup_path_info = pathinfo( $backup_path );
112
 
113
  wp_mkdir_p( $backup_path_info['dirname'] );
114
 
115
+ // TO DO - check and send a error message if the backup can't be created.
116
+ $filesystem->copy( $file_path, $backup_path, true );
117
  imagify_chmod_file( $backup_path );
118
  }
119
 
128
  return $errors;
129
  }
130
 
131
+ $filesystem->move( $temp_file, $file_path, true );
132
  imagify_chmod_file( $file_path );
133
 
134
+ // If temp file still exists, delete it.
135
+ if ( $filesystem->exists( $temp_file ) ) {
136
+ $filesystem->delete( $temp_file );
137
  }
138
 
139
  /**
141
  *
142
  * @since 1.0
143
  *
144
+ * @param string $file_path Absolute path to the image file.
145
+ * @param bool $backup Force a backup of the original file.
146
  */
147
  do_action( 'after_do_imagify', $file_path, $args['backup'] );
148
 
150
  }
151
 
152
  /**
153
+ * Run an async job to optimize images in background.
154
  *
155
+ * @param array $body Contains the usual $_POST.
156
  *
157
  * @since 1.4
158
+ */
159
  function imagify_do_async_job( $body ) {
160
  $args = array(
161
  'timeout' => 0.01,
166
  );
167
 
168
  wp_remote_post( admin_url( 'admin-ajax.php' ), $args );
169
+ }
languages/imagify-de_DE.mo DELETED
Binary file
languages/imagify-de_DE.po DELETED
@@ -1,1203 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Imagify\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2016-09-23 11:03-0500\n"
6
- "PO-Revision-Date: 2016-09-23 11:13-0500\n"
7
- "Last-Translator: Rémy Perona <remperona@gmail.com>\n"
8
- "Language-Team: \n"
9
- "Language: de\n"
10
- "MIME-Version: 1.0\n"
11
- "Content-Type: text/plain; charset=UTF-8\n"
12
- "Content-Transfer-Encoding: 8bit\n"
13
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
14
- "X-Poedit-SourceCharset: UTF-8\n"
15
- "X-Poedit-Basepath: .\n"
16
- "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
17
- "__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
18
- "_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
19
- "esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
20
- "esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
21
- "X-Generator: Poedit 1.6.4\n"
22
- "X-Loco-Target-Locale: de_DE\n"
23
- "X-Poedit-SearchPath-0: ..\n"
24
-
25
- #: ../inc/3rd-party/nextgen-gallery/inc/admin/enqueue.php:20
26
- #: ../inc/admin/ajax.php:123 ../inc/admin/meta-boxes.php:34
27
- #: ../inc/functions/admin-ui.php:215 ../inc/functions/i18n.php:49
28
- #: ../inc/functions/i18n.php:64
29
- msgid "Optimize"
30
- msgstr "Optimieren"
31
-
32
- #: ../inc/3rd-party/nextgen-gallery/inc/admin/enqueue.php:21
33
- #: ../inc/functions/admin-ui.php:80 ../inc/functions/i18n.php:50
34
- msgid "Restore Original"
35
- msgstr "Original wiederherstellen"
36
-
37
- #: ../inc/3rd-party/nextgen-gallery/inc/admin/menu.php:16
38
- #: ../inc/admin/menu.php:24 ../inc/admin/plugins.php:13
39
- #: ../inc/admin/ui/bulk.php:81 ../inc/common/admin-bar.php:39
40
- msgid "Bulk Optimization"
41
- msgstr "Stapelverarbeitung"
42
-
43
- #: ../inc/admin/ajax.php:123 ../inc/admin/meta-boxes.php:29
44
- #: ../inc/functions/admin-ui.php:121 ../inc/functions/admin-ui.php:153
45
- #: ../inc/functions/admin-ui.php:159 ../inc/functions/admin-ui.php:165
46
- #: ../inc/functions/admin-ui.php:205 ../inc/functions/admin-ui.php:215
47
- msgid "Optimizing..."
48
- msgstr "Wird&#160;optimiert&#160;…"
49
-
50
- #: ../inc/admin/ajax.php:507
51
- msgid "Oops, It's almost over!"
52
- msgstr "Hoppla, es wird langsam eng."
53
-
54
- #: ../inc/admin/ajax.php:508
55
- #, php-format
56
- msgid ""
57
- "You have almost used all your credit.%sDon't forget to upgrade your "
58
- "subscription to continue optimizing your images."
59
- msgstr ""
60
- "In Kürze wirst du dein Guthaben verbraucht haben.%sAktualisiere dein Abo, um "
61
- "deine Bilder auch in Zukunft zu optimieren."
62
-
63
- #: ../inc/admin/ajax.php:509 ../inc/admin/ui/bulk.php:23
64
- msgid "View My Subscription"
65
- msgstr "Mein Abo ansehen"
66
-
67
- #: ../inc/admin/ajax.php:517 ../inc/admin/ui/notices.php:258
68
- #: ../inc/functions/i18n.php:84
69
- msgid "Oops, It's Over!"
70
- msgstr "Alles hat ein Ende…"
71
-
72
- #: ../inc/admin/ajax.php:518 ../inc/admin/ui/notices.php:260
73
- #: ../inc/functions/i18n.php:101
74
- #, php-format
75
- msgid ""
76
- "You have consumed all your credit for this month. You will have <strong>%s "
77
- "back on %s</strong>."
78
- msgstr ""
79
- "Du hast dein Guthaben für diesen Monat aufgebraucht. <strong>%s</strong> "
80
- "werden dir am <strong>%s</strong> wieder zur Verfügung stehen."
81
-
82
- #: ../inc/admin/ajax.php:519
83
- msgid "Upgrade My Subscription"
84
- msgstr "Mein Abo aktualisieren"
85
-
86
- #: ../inc/admin/ajax.php:538 ../inc/admin/ui/bulk.php:17
87
- msgid "Account status"
88
- msgstr "Kontostatus"
89
-
90
- #: ../inc/admin/ajax.php:539 ../inc/admin/ui/bulk.php:18
91
- msgid "Your subscription:"
92
- msgstr "Dein Abo:"
93
-
94
- #: ../inc/admin/ajax.php:547 ../inc/admin/ui/bulk.php:48
95
- #, php-format
96
- msgid "You have %s space credit left"
97
- msgstr "Du hast noch %s Guthaben"
98
-
99
- #: ../inc/admin/ajax.php:559
100
- msgid "View my subscription"
101
- msgstr "Mein Abo ansehen"
102
-
103
- #: ../inc/admin/media.php:63 ../inc/functions/i18n.php:60
104
- msgid "Compare Original VS Optimized"
105
- msgstr "Vergleiche Original mit optimiert"
106
-
107
- #: ../inc/admin/meta-boxes.php:17 ../inc/admin/meta-boxes.php:24
108
- #: ../inc/admin/upload.php:12
109
- msgid "Imagify"
110
- msgstr ""
111
-
112
- #: ../inc/admin/meta-boxes.php:19 ../inc/functions/admin-ui.php:195
113
- msgid "Invalid API key"
114
- msgstr "Ungültiger API-Schlüssel"
115
-
116
- #: ../inc/admin/meta-boxes.php:21 ../inc/functions/admin-ui.php:197
117
- msgid "Check your Settings"
118
- msgstr "Überprüfe deine Einstellungen"
119
-
120
- #: ../inc/admin/options.php:119
121
- msgid "Cheatin&#8217; uh?"
122
- msgstr "Ts, ts, ts&#160;…"
123
-
124
- #: ../inc/admin/options.php:127
125
- msgid "<strong>ERROR</strong>: options page not found."
126
- msgstr "<strong>Fehler</strong>: Einstellungsseite nicht gefunden."
127
-
128
- #: ../inc/admin/plugins.php:14 ../inc/admin/ui/options.php:74
129
- #: ../inc/common/admin-bar.php:30
130
- msgid "Settings"
131
- msgstr "Einstellungen"
132
-
133
- #: ../inc/admin/ui/bulk.php:60
134
- msgid "Upgrade your account to continue optimizing your images"
135
- msgstr "Aktualisiere dein Konto, um deine Bilder weiterhin zu optimieren"
136
-
137
- #: ../inc/admin/ui/bulk.php:64
138
- msgid "More info"
139
- msgstr "Weitere Informationen"
140
-
141
- #: ../inc/admin/ui/bulk.php:91
142
- msgid "Overview"
143
- msgstr "Übersicht"
144
-
145
- #: ../inc/admin/ui/bulk.php:99
146
- #, php-format
147
- msgid "You optimized %s images of your website"
148
- msgstr "Du hast %s Bilder deiner Website optimiert"
149
-
150
- #: ../inc/admin/ui/bulk.php:103
151
- msgid "Statistics"
152
- msgstr "Statistik"
153
-
154
- #: ../inc/admin/ui/bulk.php:115
155
- msgid "that's the number of images you optimized with Imagify"
156
- msgstr "Bilder mit Imagify optimiert"
157
-
158
- #: ../inc/admin/ui/bulk.php:120
159
- msgid "Original size"
160
- msgstr "Originalgröße"
161
-
162
- #: ../inc/admin/ui/bulk.php:125
163
- msgid "Optimized size"
164
- msgstr "Optimierte Größe"
165
-
166
- #: ../inc/admin/ui/bulk.php:136
167
- #, php-format
168
- msgid "that's the size you saved %sby using Imagify"
169
- msgstr "geringere Dateigröße dank Imagify"
170
-
171
- #: ../inc/admin/ui/bulk.php:142
172
- msgid "Information"
173
- msgstr "Informationen"
174
-
175
- #: ../inc/admin/ui/bulk.php:146
176
- msgid ""
177
- "Please be aware that optimizing a large number of images can take a while "
178
- "depending on your server and network speed."
179
- msgstr ""
180
- "Bitte beachte: Das Optimieren einer hohen Anzahl Bilder kann eine Weile "
181
- "dauern, abhängig von deinem Server und der Netzwerkgeschwindigkeit."
182
-
183
- #: ../inc/admin/ui/bulk.php:149
184
- #, php-format
185
- msgid ""
186
- "If you have more than %s images, you will need to launch the bulk "
187
- "optimization several times."
188
- msgstr ""
189
-
190
- #: ../inc/admin/ui/bulk.php:153
191
- msgid ""
192
- "You must keep this page open while the bulk optimizaton is processing. If "
193
- "you leave you can come back to continue where it left off."
194
- msgstr ""
195
- "Du musst diese Seite während der Stapelverarbeitung geöffnet lassen. Falls "
196
- "du sie doch schließt, wird die Stapelverarbeitung unterbrochen und später "
197
- "fortgesetzt, sobald du diese Seite erneut aufrufst."
198
-
199
- #: ../inc/admin/ui/bulk.php:164
200
- msgid "Select Your Compression Level"
201
- msgstr "Wähle deinen Komprimierungsstufen"
202
-
203
- #: ../inc/admin/ui/bulk.php:166 ../inc/admin/ui/bulk.php:192
204
- #: ../inc/admin/ui/options.php:136 ../inc/admin/ui/options.php:365
205
- #: ../inc/admin/ui/options.php:404 ../inc/admin/ui/options.php:421
206
- #: ../inc/admin/ui/options.php:481
207
- #: ../inc/classes/abstracts/abstract-attachment.php:114
208
- #: ../inc/functions/admin-ui.php:153
209
- msgid "Ultra"
210
- msgstr "Ultra"
211
-
212
- #: ../inc/admin/ui/bulk.php:169 ../inc/admin/ui/bulk.php:187
213
- #: ../inc/admin/ui/options.php:131 ../inc/admin/ui/options.php:352
214
- #: ../inc/admin/ui/options.php:403 ../inc/admin/ui/options.php:416
215
- #: ../inc/admin/ui/options.php:460
216
- #: ../inc/classes/abstracts/abstract-attachment.php:117
217
- #: ../inc/functions/admin-ui.php:159
218
- msgid "Aggressive"
219
- msgstr "Aggressiv"
220
-
221
- #: ../inc/admin/ui/bulk.php:172 ../inc/admin/ui/bulk.php:182
222
- #: ../inc/admin/ui/options.php:126 ../inc/admin/ui/options.php:339
223
- #: ../inc/admin/ui/options.php:402 ../inc/admin/ui/options.php:411
224
- #: ../inc/admin/ui/options.php:440
225
- #: ../inc/classes/abstracts/abstract-attachment.php:120
226
- #: ../inc/functions/admin-ui.php:165
227
- msgid "Normal"
228
- msgstr "Normal"
229
-
230
- #: ../inc/admin/ui/bulk.php:176
231
- #, php-format
232
- msgid "Your default setting: %s"
233
- msgstr "Deine Standardeinstellung: %s"
234
-
235
- #: ../inc/admin/ui/bulk.php:201
236
- #, php-format
237
- msgid "Don't forget to check %syour settings%s before bulk optimization."
238
- msgstr "Überprüfe deine %sEinstellungen%s vor der Stapelverarbeitung."
239
-
240
- #: ../inc/admin/ui/bulk.php:208
241
- msgid "Let's go!"
242
- msgstr "Los geht’s!"
243
-
244
- #: ../inc/admin/ui/bulk.php:215
245
- msgid "Imagif'em all"
246
- msgstr "Alle Bilder optimieren"
247
-
248
- #: ../inc/admin/ui/bulk.php:220
249
- #, php-format
250
- msgid "All images greater than %s will be optimized when using a paid plan."
251
- msgstr ""
252
- "Alle Bilder größer als %s werden optimiert, wenn du einen bezahlten Tarif "
253
- "nutzt."
254
-
255
- #: ../inc/admin/ui/bulk.php:239
256
- msgid "Well done!"
257
- msgstr "Klasse!"
258
-
259
- #: ../inc/admin/ui/bulk.php:240
260
- #, php-format
261
- msgid "you saved %1$s out of %2$s"
262
- msgstr "du hast %1$s von %2$s gespart"
263
-
264
- #: ../inc/admin/ui/bulk.php:245
265
- msgid "Share your awesome result"
266
- msgstr "Teile dein hervorragendes Ergebnis"
267
-
268
- #: ../inc/admin/ui/bulk.php:260
269
- msgid "Compression process results"
270
- msgstr "Ergebnisse der Komprimierung"
271
-
272
- #: ../inc/admin/ui/bulk.php:263
273
- msgid "Filename"
274
- msgstr "Dateiname"
275
-
276
- #: ../inc/admin/ui/bulk.php:264
277
- msgid "Status"
278
- msgstr "Status"
279
-
280
- #: ../inc/admin/ui/bulk.php:265 ../inc/admin/ui/options.php:401
281
- #: ../inc/admin/ui/options.php:406 ../inc/admin/ui/options.php:430
282
- msgid "Original"
283
- msgstr "Original"
284
-
285
- #: ../inc/admin/ui/bulk.php:266 ../inc/admin/upload.php:41
286
- #: ../inc/functions/i18n.php:80
287
- msgid "Optimized"
288
- msgstr "Optimiert"
289
-
290
- #: ../inc/admin/ui/bulk.php:267
291
- msgid "Percentage"
292
- msgstr "Prozent"
293
-
294
- #: ../inc/admin/ui/bulk.php:268
295
- msgid "Thumbnails optimized"
296
- msgstr "Vorschaubilder optimiert"
297
-
298
- #: ../inc/admin/ui/bulk.php:269
299
- msgid "Overall saving"
300
- msgstr "Gesamte Ersparnis"
301
-
302
- #: ../inc/admin/ui/bulk.php:274
303
- msgid "file"
304
- msgstr "Datei"
305
-
306
- #: ../inc/admin/ui/bulk.php:275
307
- msgid "error"
308
- msgstr "Fehler"
309
-
310
- #: ../inc/admin/ui/bulk.php:276
311
- msgid "Total:"
312
- msgstr "Gesamt:"
313
-
314
- #: ../inc/admin/ui/bulk.php:277
315
- msgid "Gain:"
316
- msgstr "Gewinn:"
317
-
318
- #: ../inc/admin/ui/bulk.php:294
319
- #, php-format
320
- msgid "%sStart the bulk optimization%s"
321
- msgstr "%sStapelverarbeitung starten%s"
322
-
323
- #: ../inc/admin/ui/notices.php:24
324
- msgid "Welcome to Imagify, the best way to easily optimize your images!"
325
- msgstr "Willkommen bei Imagify, der smarten Bildoptimierung!"
326
-
327
- #: ../inc/admin/ui/notices.php:26 ../inc/admin/ui/notices.php:92
328
- #: ../inc/admin/ui/notices.php:186 ../inc/admin/ui/notices.php:223
329
- #: ../inc/admin/ui/notices.php:263 ../inc/admin/ui/notices.php:370
330
- msgid "Dismiss this notice"
331
- msgstr "Diese Meldung verwerfen"
332
-
333
- #: ../inc/admin/ui/notices.php:33
334
- msgid "Create an Account"
335
- msgstr "Konto anlegen"
336
-
337
- #: ../inc/admin/ui/notices.php:34
338
- msgid ""
339
- "Don't have an Imagify account yet? Optimize your images by creating an "
340
- "account in a few seconds!"
341
- msgstr ""
342
- "Registriere dein Konto bei Imagify (kostenfrei, dauert nur ein paar "
343
- "Sekunden), um anschließend deine Bilder in WordPress zu optimieren."
344
-
345
- #: ../inc/admin/ui/notices.php:37
346
- msgid "Sign up, It's FREE!"
347
- msgstr "Mein Konto kostenfrei anlegen"
348
-
349
- #: ../inc/admin/ui/notices.php:43
350
- msgid "Enter your API Key"
351
- msgstr "API-Schlüssel eingeben"
352
-
353
- #: ../inc/admin/ui/notices.php:44
354
- #, php-format
355
- msgid ""
356
- "Save your API Key you have received by email or you can get it on your "
357
- "%sImagify account page%s."
358
- msgstr ""
359
- "Aktiviere Imagify mit deinem persönlichen API-Schlüssel, den du per E-Mail "
360
- "erhalten hast. Du kannst ihn auch jederzeit in deinen %sKontoeinstellungen%s "
361
- "abrufen."
362
-
363
- #: ../inc/admin/ui/notices.php:47
364
- msgid "I have my API key"
365
- msgstr "Meinen API-Schlüssel eingeben"
366
-
367
- #: ../inc/admin/ui/notices.php:53
368
- msgid "Configure it"
369
- msgstr "Einstellungen wählen"
370
-
371
- #: ../inc/admin/ui/notices.php:54
372
- msgid ""
373
- "It’s almost done! You have just to configure your optimization settings."
374
- msgstr ""
375
- "Fast fertig! Wähle nun deine Einstellungen für Imagify. Anschließend kannst "
376
- "du alle deine Bilder von Imagify automatisch optimieren lassen."
377
-
378
- #: ../inc/admin/ui/notices.php:55
379
- msgid "Go to Settings"
380
- msgstr "Meine Einstellungen wählen"
381
-
382
- #: ../inc/admin/ui/notices.php:87 ../inc/admin/ui/options.php:97
383
- #: ../inc/functions/i18n.php:78
384
- msgid "Your API key isn't valid!"
385
- msgstr "Dein API-Schlüssel ist ungültig."
386
-
387
- #: ../inc/admin/ui/notices.php:90
388
- #, php-format
389
- msgid ""
390
- "Go to your Imagify account page to get your API Key and specify it on "
391
- "%1$syour settings%3$s or %2$screate an account for free%3$s if you don't "
392
- "have one yet."
393
- msgstr ""
394
- "Du findest deinen API-Schlüssel in deinem Imagify-Konto. Sobald du ihn dort "
395
- "geholt hast, %1$shinterlege ihn in deinen Einstellungen%3$s. Oder %2$slege "
396
- "kostenfrei ein Konto an%3$s, um deinen API-Schlüssel zu erhalten."
397
-
398
- #: ../inc/admin/ui/notices.php:142
399
- msgid ""
400
- "The following plugins are not compatible with this plugin and may cause "
401
- "unexpected results:"
402
- msgstr ""
403
- "Die folgenden Plugins sind nicht kompatibel mit diesem Plugin und können "
404
- "unerwartete Ergebnisse verursachen:"
405
-
406
- #: ../inc/admin/ui/notices.php:148
407
- msgid "Deactivate"
408
- msgstr "Deaktivieren"
409
-
410
- #: ../inc/admin/ui/notices.php:178
411
- msgid "The external HTTP requests are blocked!"
412
- msgstr "Externe HTTP-Anfragen werden blockiert."
413
-
414
- #: ../inc/admin/ui/notices.php:179
415
- msgid ""
416
- "You defined the <code>WP_HTTP_BLOCK_EXTERNAL</code> constant in the <code>wp-"
417
- "config.php</code> to block all external HTTP requests."
418
- msgstr ""
419
- "Alle externen HTTP-Anfragen werden blockiert, weil in der Datei <em>wp-"
420
- "config.php</em> die PHP-Konstante <code>WP_HTTP_BLOCK_EXTERNAL</code> "
421
- "gesetzt ist.\n"
422
-
423
- #: ../inc/admin/ui/notices.php:181
424
- msgid ""
425
- "To optimize your images, you have to put the following code in your <code>wp-"
426
- "config.php</code> file so that it works correctly."
427
- msgstr ""
428
- "Um deine Bilder optimieren zu können, füge den folgenden Code zu deiner "
429
- "<em>wp-config.php</em> hinzu."
430
-
431
- #: ../inc/admin/ui/notices.php:182
432
- msgid "Click on the field and press Ctrl-A to select all."
433
- msgstr "Klicke auf das Feld und drücke ctrl+A (cmd+A) für Alles auswählen."
434
-
435
- #: ../inc/admin/ui/notices.php:219
436
- msgid "You're missing out!"
437
- msgstr "Du verpasst etwas!"
438
-
439
- #: ../inc/admin/ui/notices.php:220
440
- msgid "Use the List view to optimize images with Imagify."
441
- msgstr "In der Listenansicht kannst du deine Bilder direkt zu optimieren."
442
-
443
- #: ../inc/admin/ui/notices.php:221
444
- msgid "Switch to the List View"
445
- msgstr "Zur Listenansicht wechseln"
446
-
447
- #: ../inc/admin/ui/notices.php:260 ../inc/functions/i18n.php:98
448
- #: ../inc/functions/i18n.php:101
449
- #, php-format
450
- msgid ""
451
- "To continue to optimize your images, log in to your Imagify account to %sbuy "
452
- "a pack or subscribe to a plan%s."
453
- msgstr ""
454
- "Um deine Bilder auch in Zukunft zu optimieren, logge dich bei Imagify.io ein "
455
- "und %skaufe ein einmaliges Guthaben oder ein Abo%s."
456
-
457
- #: ../inc/admin/ui/notices.php:314 ../inc/admin/ui/options.php:28
458
- msgid "Discover the best caching plugin to speed up your website."
459
- msgstr ""
460
- "Entdecke das beste Caching-Plugin, um deine Website schneller zu machen."
461
-
462
- #: ../inc/admin/ui/notices.php:317 ../inc/admin/ui/options.php:36
463
- #, php-format
464
- msgid "%sGet %s off%s with this coupon code:%s"
465
- msgstr "%sErhalte %s Rabatt%s mit diesem Gutschein-Code:%s"
466
-
467
- #: ../inc/admin/ui/notices.php:326 ../inc/admin/ui/options.php:41
468
- msgid "Get WP Rocket now"
469
- msgstr "Hole dir WP Rocket jetzt"
470
-
471
- #: ../inc/admin/ui/notices.php:363
472
- #, php-format
473
- msgid ""
474
- "%1$sCongratulations%2$s, you have optimized %1$s%3$d images%2$s and improved "
475
- "your website's speed by reducing your images size."
476
- msgstr ""
477
-
478
- #: ../inc/admin/ui/notices.php:365 ../inc/admin/ui/options.php:59
479
- #, php-format
480
- msgid ""
481
- "%sDo you like this plugin?%s Please take a few seconds to %srate it on "
482
- "WordPress.org%s!"
483
- msgstr ""
484
- "%sBist du zufrieden mit diesem Plugin?%s Bitte nimm dir einen Moment Zeit "
485
- "für eine %sBewertung auf WordPress.org%s!"
486
-
487
- #: ../inc/admin/ui/options.php:22
488
- msgid "Is your website too slow?"
489
- msgstr "Ist deine Website zu langsam?"
490
-
491
- #: ../inc/admin/ui/options.php:84
492
- msgid "API Key"
493
- msgstr "API-Schlüssel"
494
-
495
- #: ../inc/admin/ui/options.php:91 ../inc/functions/i18n.php:33
496
- msgid "Your API key is valid."
497
- msgstr "Dein API-Schlüssel ist gültig."
498
-
499
- #: ../inc/admin/ui/options.php:104
500
- #, php-format
501
- msgid "Don't have an API Key yet? %sCreate one, it's FREE%s."
502
- msgstr "Noch keinen API-Schlüssel erhalten? %sJetzt kostenfrei Konto anlegen%s"
503
-
504
- #: ../inc/admin/ui/options.php:121
505
- msgid "Optimization Level"
506
- msgstr "Optimierungsgrad"
507
-
508
- #: ../inc/admin/ui/options.php:141
509
- msgid "More info?"
510
- msgstr "Was ist das?"
511
-
512
- #: ../inc/admin/ui/options.php:148
513
- #, php-format
514
- msgid "Need help to choose? %sTry the Visual Comparison%s"
515
- msgstr "Nicht sicher? %sVisuellen Vergleich ausprobieren%s"
516
-
517
- #: ../inc/admin/ui/options.php:157 ../inc/admin/ui/options.php:161
518
- msgid "Auto-Optimize images on upload"
519
- msgstr "Bilder beim Hochladen automatisch optimieren"
520
-
521
- #: ../inc/admin/ui/options.php:165
522
- msgid "Automatically optimize every image you upload to WordPress."
523
- msgstr ""
524
- "Lasse automatisch jedes Bild optimieren, das du in WordPress hochlädst."
525
-
526
- #: ../inc/admin/ui/options.php:170 ../inc/admin/ui/options.php:173
527
- msgid "Backup original images"
528
- msgstr "Originalbilder sichern"
529
-
530
- #: ../inc/admin/ui/options.php:177
531
- msgid ""
532
- "Keep your original images in a separate folder before optimization process."
533
- msgstr ""
534
- "Speichere Sicherungskopien deiner Originalbilder in einem separaten Ordner, "
535
- "bevor die Optimierung beginnt."
536
-
537
- #: ../inc/admin/ui/options.php:182 ../inc/admin/ui/options.php:185
538
- msgid "Resize larger images"
539
- msgstr "Große Bilder verkleinern"
540
-
541
- #: ../inc/admin/ui/options.php:191
542
- #, php-format
543
- msgid "to maximum %s pixels width"
544
- msgstr "auf maximal %s Pixel Breite"
545
-
546
- #: ../inc/admin/ui/options.php:202
547
- #, php-format
548
- msgid ""
549
- "This option is recommended to reduce larger images. You can save up to 80%% "
550
- "after resizing. The new width should not be less than your largest thumbnail "
551
- "width, which is actually %spx."
552
- msgstr ""
553
- "Diese Option ist empfehlenswert, um das Speichervolumen für größere Bilder "
554
- "zu reduzieren. Du kannst so bis zu 80%% Speicherplatz sparen. Die neue "
555
- "Breite sollte nicht geringer als deine größte Vorschaubildbreite sein, die "
556
- "übrigens %s Pixel beträgt."
557
-
558
- #: ../inc/admin/ui/options.php:209 ../inc/admin/ui/options.php:212
559
- msgid "EXIF Data"
560
- msgstr "EXIF-Daten"
561
-
562
- #: ../inc/admin/ui/options.php:216
563
- msgid ""
564
- "Keep all EXIF data from your images. EXIF are informations stored in your "
565
- "pictures like shutter speed, exposure compensation, ISO, etc..."
566
- msgstr ""
567
- "Behalte alle EXIF-Daten deiner Bilder. In den EXIF-Daten werden "
568
- "Informationen wie Verschlusszeit, Belichtungskorrektur, ISO-Wert usw. "
569
- "gespeichert."
570
-
571
- #: ../inc/admin/ui/options.php:217
572
- msgid "Learn more"
573
- msgstr "Weitere Informationen"
574
-
575
- #: ../inc/admin/ui/options.php:219
576
- msgid ""
577
- "If you are a photographer, you may be interested in this option if you are "
578
- "displaying on your pages some info like the model of your camera."
579
- msgstr ""
580
- "Aktiviere diese Option, wenn du auf deiner Site fototechnische "
581
- "Informationen, wie z.B. das Model deiner Kamera, anzeigen möchtest."
582
-
583
- #: ../inc/admin/ui/options.php:228
584
- msgid "Files optimization"
585
- msgstr "Dateioptimierung"
586
-
587
- #: ../inc/admin/ui/options.php:231
588
- msgid ""
589
- "You can choose to compress different image sizes created by WordPress here."
590
- msgstr ""
591
- "Hier kannst du die Komprimierung für die verschiedenen Bildgrößen "
592
- "kontrollieren, die dein WordPress generiert."
593
-
594
- #: ../inc/admin/ui/options.php:233
595
- #, php-format
596
- msgid "The %soriginal size%s is %sautomatically optimized%s by Imagify."
597
- msgstr "Die %sOriginalgröße%s wird von Imagify %sautomatisch optimiert%s."
598
-
599
- #: ../inc/admin/ui/options.php:236
600
- msgid ""
601
- "Remember each additional image size will affect your Imagify monthly usage!"
602
- msgstr ""
603
- "Bedenke, dass jede ausgewählte Bildgröße dein monatliches Nutzungsvolumen "
604
- "bei Imagify beeinflusst."
605
-
606
- #: ../inc/admin/ui/options.php:289
607
- msgid "Display options"
608
- msgstr "Optionen anzeigen"
609
-
610
- #: ../inc/admin/ui/options.php:294 ../inc/admin/ui/options.php:299
611
- msgid "Show Admin Bar menu"
612
- msgstr "Toolbar-Menü anzeigen"
613
-
614
- #: ../inc/admin/ui/options.php:300
615
- msgid "I want this awesome quick access menu on my admin bar."
616
- msgstr "Ich möchte dieses praktische Dropdown-Menü in meiner Toolbar."
617
-
618
- #: ../inc/admin/ui/options.php:319
619
- msgid "Save &amp; Go to Bulk Optimizer"
620
- msgstr "Speichern und zur Stapelverarbeitung gehen"
621
-
622
- #: ../inc/admin/ui/options.php:328
623
- #, php-format
624
- msgid ""
625
- "Once your settings saved, optimize all your images by using the %sImagify "
626
- "Bulk Optimization%s feature."
627
- msgstr ""
628
- "Sobald du deine Einstellungen gespeichert hast, kannst du mit der "
629
- "%sStapelverarbeitung%s alle deine Bilder optimieren."
630
-
631
- #: ../inc/admin/ui/options.php:336
632
- msgid "You can choose three levels of compression"
633
- msgstr "Du kannst zwischen drei Komprimierungsstufen wählen."
634
-
635
- #: ../inc/admin/ui/options.php:341
636
- msgid ""
637
- "This mode provides lossless optimization, your images will be optimized "
638
- "without any visible change."
639
- msgstr ""
640
- "Dieser Modus sorgt für verlustfreie Bildoptimierung. Deine Bilder werden "
641
- "ohne sichtbare Veränderungen optimiert."
642
-
643
- #: ../inc/admin/ui/options.php:344
644
- msgid ""
645
- "If you want the perfect quality for your images, we recommend you that mode."
646
- msgstr ""
647
- "Wähle diese Einstellung, wenn dir die perfekte Qualität deiner Bilder "
648
- "wichtig ist."
649
-
650
- #: ../inc/admin/ui/options.php:347
651
- msgid ""
652
- "Note: the file size reduction will be less, compared to aggressive mode."
653
- msgstr ""
654
- "Hinweis: Die Verringerung der Dateigröße fällt hier geringer aus, als im "
655
- "aggressiven Modus."
656
-
657
- #: ../inc/admin/ui/options.php:354
658
- msgid ""
659
- "This mode provides perfect optimization of your images without any "
660
- "significant quality loss."
661
- msgstr ""
662
- "Dieser Modus liefert hervorragende Optimierung ohne signifikante "
663
- "Qualitätsverluste."
664
-
665
- #: ../inc/admin/ui/options.php:357
666
- msgid ""
667
- "This will provide a drastic savings on the initial weight, with a small "
668
- "reduction in image quality. Most of the time it's not even noticeable."
669
- msgstr ""
670
- "Die drastische Verringerung der Dateigröße geht mit geringfügigen, meist "
671
- "kaum wahrnehmbaren Einbußen in der Qualität einher."
672
-
673
- #: ../inc/admin/ui/options.php:360
674
- msgid "If you want the maximum weight reduction, we recommend using this mode."
675
- msgstr ""
676
- "Wähle diese Einstellung, wenn du auf maximale Größenreduktion Wert legst."
677
-
678
- #: ../inc/admin/ui/options.php:367
679
- msgid ""
680
- "This mode will apply all available optimizations for maximum image "
681
- "compression."
682
- msgstr ""
683
- "Dieser Modus wendet alle verfügbaren Parameter für maximale Komprimierung an."
684
-
685
- #: ../inc/admin/ui/options.php:370
686
- msgid ""
687
- "This will provide a huge savings on the initial weight. Sometimes the image "
688
- "quality could be degraded a little."
689
- msgstr ""
690
- "Die Bildgröße wird erheblich verringert. In einigen Fällen kann es jedoch zu "
691
- "Verlusten bei der Qualität kommen."
692
-
693
- #: ../inc/admin/ui/options.php:373
694
- msgid ""
695
- "If you want the maximum weight reduction, and you agree to lose some quality "
696
- "on the images we recommend using this mode."
697
- msgstr ""
698
- "Wähle diese Einstellung, wenn du bereit bist, etwas Qualität zugunsten "
699
- "maximaler Reduktion der Dateigröße zu riskieren."
700
-
701
- #: ../inc/admin/ui/options.php:380 ../inc/admin/ui/options.php:502
702
- #: ../inc/functions/admin-ui.php:662 ../inc/functions/i18n.php:61
703
- msgid "Close"
704
- msgstr "Schließen"
705
-
706
- #: ../inc/admin/ui/options.php:392
707
- #, php-format
708
- msgid "I want to compare%s and%s"
709
- msgstr "Ich möchte %s und %s vergleichen."
710
-
711
- #: ../inc/admin/ui/options.php:409
712
- #, php-format
713
- msgid "Original photography about %s"
714
- msgstr "Originalbild ca. %s"
715
-
716
- #: ../inc/admin/ui/options.php:414 ../inc/admin/ui/options.php:419
717
- #: ../inc/admin/ui/options.php:424
718
- #, php-format
719
- msgid "Optimized photography about %s"
720
- msgstr "Optimiertes Bild ca. %s"
721
-
722
- #: ../inc/admin/ui/options.php:429 ../inc/admin/ui/options.php:439
723
- #: ../inc/admin/ui/options.php:459 ../inc/admin/ui/options.php:480
724
- #: ../inc/functions/admin-ui.php:59
725
- msgid "Level:"
726
- msgstr "Modus:"
727
-
728
- #: ../inc/admin/ui/options.php:433 ../inc/admin/ui/options.php:443
729
- #: ../inc/admin/ui/options.php:463 ../inc/admin/ui/options.php:484
730
- #: ../inc/functions/i18n.php:62
731
- msgid "File Size:"
732
- msgstr "Dateigröße:"
733
-
734
- #: ../inc/admin/ui/options.php:447 ../inc/admin/ui/options.php:467
735
- #: ../inc/admin/ui/options.php:488 ../inc/functions/admin-ui.php:45
736
- #: ../inc/functions/i18n.php:63
737
- msgid "Original Saving:"
738
- msgstr "Optimiert um:"
739
-
740
- #: ../inc/admin/upload.php:42 ../inc/functions/i18n.php:81
741
- msgid "Unoptimized"
742
- msgstr "Nicht Optimiert"
743
-
744
- #: ../inc/admin/upload.php:43
745
- msgid "Errors"
746
- msgstr "Fehler"
747
-
748
- #: ../inc/admin/upload.php:46
749
- msgid "Filter by status"
750
- msgstr "Filtere nach Status"
751
-
752
- #: ../inc/admin/upload.php:49
753
- msgid "All images"
754
- msgstr "Alle Bilder"
755
-
756
- #: ../inc/classes/class-attachment.php:297
757
- msgid ""
758
- "This size isn't authorized to be optimized. Update your Imagify settings if "
759
- "you want to optimize it."
760
- msgstr ""
761
- "Diese Bildgröße ist für die Optimierung nicht zugelassen. Aktualisiere deine "
762
- "Imagify-Einstellungen, wenn du sie optimieren möchtest."
763
-
764
- #: ../inc/common/admin-bar.php:48
765
- #, php-format
766
- msgid "Rate Imagify on %s"
767
- msgstr "Bewerte Imagify auf %s"
768
-
769
- #: ../inc/common/admin-bar.php:61
770
- msgid "Loading..."
771
- msgstr "Laden&#160;…"
772
-
773
- #: ../inc/functions/admin-ui.php:36
774
- msgid "New Filesize:"
775
- msgstr "Neue Dateigröße:"
776
-
777
- #: ../inc/functions/admin-ui.php:52
778
- msgid "Close details"
779
- msgstr "Details schließen"
780
-
781
- #: ../inc/functions/admin-ui.php:52
782
- msgid "View details"
783
- msgstr "Details anzeigen"
784
-
785
- #: ../inc/functions/admin-ui.php:56
786
- msgid "Original Filesize:"
787
- msgstr "Originale Dateigröße:"
788
-
789
- #: ../inc/functions/admin-ui.php:62
790
- msgid "Thumbnails Optimized:"
791
- msgstr "Optimierte Vorschaubilder:"
792
-
793
- #: ../inc/functions/admin-ui.php:63
794
- msgid "Overall Saving:"
795
- msgstr "Gesamte Ersparnis:"
796
-
797
- #: ../inc/functions/admin-ui.php:80
798
- msgid "Restoring..."
799
- msgstr "Wiederherstellen&#160;…"
800
-
801
- #: ../inc/functions/admin-ui.php:121
802
- msgid "Try again"
803
- msgstr "Erneut versuchen"
804
-
805
- #: ../inc/functions/admin-ui.php:153 ../inc/functions/admin-ui.php:159
806
- #: ../inc/functions/admin-ui.php:165
807
- #, php-format
808
- msgid "Re-Optimize to %s"
809
- msgstr "Erneut optimieren als %s"
810
-
811
- #: ../inc/functions/admin-ui.php:189
812
- #, php-format
813
- msgid "%s can't be optimized"
814
- msgstr "%s kann nicht optimiert werden."
815
-
816
- #: ../inc/functions/admin-ui.php:240
817
- msgid "What plan do I need?"
818
- msgstr ""
819
-
820
- #: ../inc/functions/admin-ui.php:244
821
- msgid "You're new to Imagify?"
822
- msgstr ""
823
-
824
- #: ../inc/functions/admin-ui.php:245
825
- msgid ""
826
- "Let us help you by analyzing your existing images and determinate the best "
827
- "plan for you"
828
- msgstr ""
829
-
830
- #: ../inc/functions/admin-ui.php:280
831
- msgid "Choose Plan"
832
- msgstr ""
833
-
834
- #: ../inc/functions/admin-ui.php:281
835
- msgid "Payment Info"
836
- msgstr ""
837
-
838
- #: ../inc/functions/admin-ui.php:286
839
- msgid "We analysed your images"
840
- msgstr ""
841
-
842
- #: ../inc/functions/admin-ui.php:292
843
- #, php-format
844
- msgid "You have %s images"
845
- msgstr ""
846
-
847
- #: ../inc/functions/admin-ui.php:298
848
- #, php-format
849
- msgid "You actually have %s of images in your library."
850
- msgstr ""
851
-
852
- #: ../inc/functions/admin-ui.php:302
853
- #, php-format
854
- msgid "You upload around %s of images per month."
855
- msgstr ""
856
-
857
- #: ../inc/functions/admin-ui.php:309
858
- msgid "We recommend you this plan"
859
- msgstr ""
860
-
861
- #: ../inc/functions/admin-ui.php:314
862
- msgid "Subscribe a monthly plan"
863
- msgstr ""
864
-
865
- #: ../inc/functions/admin-ui.php:315
866
- msgid "Subscribe a yearly plan"
867
- msgstr ""
868
-
869
- #: ../inc/functions/admin-ui.php:319 ../inc/functions/admin-ui.php:455
870
- #: ../inc/functions/admin-ui.php:623
871
- msgid "Monthly"
872
- msgstr ""
873
-
874
- #: ../inc/functions/admin-ui.php:322 ../inc/functions/admin-ui.php:458
875
- #: ../inc/functions/admin-ui.php:626
876
- msgid "Yearly"
877
- msgstr ""
878
-
879
- #: ../inc/functions/admin-ui.php:322 ../inc/functions/admin-ui.php:458
880
- #: ../inc/functions/admin-ui.php:626
881
- msgid "2 months free"
882
- msgstr ""
883
-
884
- #: ../inc/functions/admin-ui.php:333 ../inc/functions/admin-ui.php:352
885
- #: ../inc/functions/admin-ui.php:468 ../inc/functions/admin-ui.php:478
886
- msgid "/month"
887
- msgstr ""
888
-
889
- #: ../inc/functions/admin-ui.php:335 ../inc/functions/admin-ui.php:383
890
- #: ../inc/functions/admin-ui.php:470 ../inc/functions/admin-ui.php:521
891
- #, php-format
892
- msgid "approx: %s images"
893
- msgstr ""
894
-
895
- #: ../inc/functions/admin-ui.php:356 ../inc/functions/admin-ui.php:484
896
- #, php-format
897
- msgid ""
898
- "%s per<br>\n"
899
- "additionnal Gb"
900
- msgstr ""
901
-
902
- #: ../inc/functions/admin-ui.php:361 ../inc/functions/admin-ui.php:396
903
- #: ../inc/functions/admin-ui.php:580 ../inc/functions/admin-ui.php:601
904
- msgid "Choose another plan"
905
- msgstr ""
906
-
907
- #: ../inc/functions/admin-ui.php:371
908
- msgid "Optimize the images you already have, buy a one-time plan"
909
- msgstr ""
910
-
911
- #: ../inc/functions/admin-ui.php:407
912
- msgid "Checkout"
913
- msgstr ""
914
-
915
- #: ../inc/functions/admin-ui.php:411
916
- msgid ""
917
- "Monthly plans comes with credits which is renewed every months. The billing "
918
- "happens automatically each month or year depending the billing period you "
919
- "choose."
920
- msgstr ""
921
-
922
- #: ../inc/functions/admin-ui.php:435
923
- msgid "Monthly Plans"
924
- msgstr ""
925
-
926
- #: ../inc/functions/admin-ui.php:440
927
- msgid "One Time Plans"
928
- msgstr ""
929
-
930
- #: ../inc/functions/admin-ui.php:450
931
- msgid ""
932
- "Monthly plans come with credits which is renewed every months. The billing "
933
- "happens automatically each month or year depending the billing period you "
934
- "choose."
935
- msgstr ""
936
-
937
- #: ../inc/functions/admin-ui.php:482 ../inc/functions/admin-ui.php:529
938
- msgid "we recommend for you"
939
- msgstr ""
940
-
941
- #: ../inc/functions/admin-ui.php:490 ../inc/functions/admin-ui.php:533
942
- msgid "Choose plan"
943
- msgstr ""
944
-
945
- #: ../inc/functions/admin-ui.php:498
946
- msgid "Need more?"
947
- msgstr ""
948
-
949
- #: ../inc/functions/admin-ui.php:499
950
- msgid "for special needs"
951
- msgstr ""
952
-
953
- #: ../inc/functions/admin-ui.php:503
954
- msgid "Contact Us"
955
- msgstr ""
956
-
957
- #: ../inc/functions/admin-ui.php:510
958
- msgid ""
959
- "One time plans are useful if you have a lots of existing images which need "
960
- "to be optimized. You can use it for bulk optimizing all your past images. "
961
- "You will pay only once."
962
- msgstr ""
963
-
964
- #: ../inc/functions/admin-ui.php:563
965
- msgid "Your order"
966
- msgstr ""
967
-
968
- #: ../inc/functions/admin-ui.php:568
969
- #, php-format
970
- msgid "%scancel%sYou just removed %s"
971
- msgstr ""
972
-
973
- #: ../inc/functions/admin-ui.php:576 ../inc/functions/admin-ui.php:597
974
- msgid "Remove this item"
975
- msgstr ""
976
-
977
- #: ../inc/functions/admin-ui.php:583
978
- #, php-format
979
- msgid "%s per month"
980
- msgstr ""
981
-
982
- #: ../inc/functions/admin-ui.php:604
983
- #, php-format
984
- msgid "one time %s"
985
- msgstr ""
986
-
987
- #: ../inc/functions/admin-ui.php:617
988
- #, php-format
989
- msgid ""
990
- "Switch to yearly subscription and <br><strong class=\"imagify-dark\">save %s "
991
- "per year!</strong>"
992
- msgstr ""
993
-
994
- #: ../inc/functions/admin-ui.php:618
995
- #, php-format
996
- msgid ""
997
- "Perfect!<br>You're <strong class=\"imagify-dark\">saving %s per year!</"
998
- "strong>"
999
- msgstr ""
1000
-
1001
- #: ../inc/functions/admin-ui.php:657
1002
- msgid "Thank you for being awesome!"
1003
- msgstr ""
1004
-
1005
- #: ../inc/functions/admin-ui.php:668
1006
- msgid "What do our user think about Imagify"
1007
- msgstr ""
1008
-
1009
- #: ../inc/functions/admin-ui.php:702
1010
- msgid "Secure Credit Card Payment"
1011
- msgstr ""
1012
-
1013
- #: ../inc/functions/admin-ui.php:703
1014
- msgid "This is secure 128-bits SSL encrypted payment"
1015
- msgstr ""
1016
-
1017
- #: ../inc/functions/i18n.php:20
1018
- msgid "Let's get you started!"
1019
- msgstr "Los geht’s!"
1020
-
1021
- #: ../inc/functions/i18n.php:21
1022
- msgid "Enter your email to get an API key:"
1023
- msgstr "Gib deinen E-Mail-Adresse ein, um einen API-Schlüssel zu erhalten:"
1024
-
1025
- #: ../inc/functions/i18n.php:22
1026
- msgid "Sign Up"
1027
- msgstr "Konto anlegen"
1028
-
1029
- #: ../inc/functions/i18n.php:23
1030
- msgid "You need to specify an email!"
1031
- msgstr "Du musst eine E-Mail-Adresse angeben."
1032
-
1033
- #: ../inc/functions/i18n.php:24 ../inc/functions/i18n.php:31
1034
- msgid "Congratulations!"
1035
- msgstr "Glückwunsch!"
1036
-
1037
- #: ../inc/functions/i18n.php:25
1038
- msgid ""
1039
- "Your account has been succesfully created. Please check your mailbox, you "
1040
- "are going to receive an email with API key."
1041
- msgstr ""
1042
- "Dein Konto ist jetzt angelegt. Überprüfe dein E-Mail-Postfach, du erhältst "
1043
- "eine E-Mail mit deinem API-Schlüssel."
1044
-
1045
- #: ../inc/functions/i18n.php:26
1046
- msgid "Connect to Imagify!"
1047
- msgstr "Verbindung zu Imagify herstellen"
1048
-
1049
- #: ../inc/functions/i18n.php:27
1050
- msgid "Paste your API key below:"
1051
- msgstr "Füge deinen API-Schlüssel hier ein:"
1052
-
1053
- #: ../inc/functions/i18n.php:28
1054
- msgid "Connect me"
1055
- msgstr "Verbinden"
1056
-
1057
- #: ../inc/functions/i18n.php:29
1058
- msgid "Check in progress..."
1059
- msgstr "API-Schlüssel wird geprüft…"
1060
-
1061
- #: ../inc/functions/i18n.php:30
1062
- msgid "You need to specify your api key!"
1063
- msgstr "Du musst einen API-Schlüssel angeben!"
1064
-
1065
- #: ../inc/functions/i18n.php:32
1066
- msgid ""
1067
- "Your API key is valid. You can now configure the Imagify settings to "
1068
- "optimize your images."
1069
- msgstr ""
1070
- "Dein API-Schlüssel ist gültig. Du kannst jetzt deine Einstellungen für die "
1071
- "Bildoptimierung mit Imagify wählen."
1072
-
1073
- #: ../inc/functions/i18n.php:34
1074
- msgid "Cancel"
1075
- msgstr ""
1076
-
1077
- #: ../inc/functions/i18n.php:41
1078
- msgid "Don't Need a Parachute?"
1079
- msgstr "Du brauchst keinen Fallschirm?"
1080
-
1081
- #: ../inc/functions/i18n.php:42
1082
- msgid ""
1083
- "If you keep this option deactivated, you won't be able to re-optimize your "
1084
- "images to another compression level and restore your original images in case "
1085
- "of need."
1086
- msgstr ""
1087
- "Wenn du diese Option deaktiviert lässt, wirst du deine Bilder nicht erneut "
1088
- "mit einem anderen Level komprimieren, oder deren Originale wiederherstellen "
1089
- "können."
1090
-
1091
- #: ../inc/functions/i18n.php:58
1092
- msgid "Original Image"
1093
- msgstr "Originalbild"
1094
-
1095
- #: ../inc/functions/i18n.php:59
1096
- msgid "Optimized Image"
1097
- msgstr "Optimiertes Bild"
1098
-
1099
- #: ../inc/functions/i18n.php:73
1100
- msgid "Please wait..."
1101
- msgstr "Einen Moment bitte&#160;…"
1102
-
1103
- #: ../inc/functions/i18n.php:74
1104
- msgid ""
1105
- "We are trying to get your unoptimized images, it may take time depending on "
1106
- "the number of images."
1107
- msgstr ""
1108
- "Nicht optimierte Bilder werden gesammelt, dies kann einen Moment dauern&#160;"
1109
- "…"
1110
-
1111
- #: ../inc/functions/i18n.php:76
1112
- msgid "Oops, There is something wrong!"
1113
- msgstr "Hm, etwas ist schief gelaufen."
1114
-
1115
- #: ../inc/functions/i18n.php:77
1116
- msgid ""
1117
- "An unknow error occurred when we tried to get all your unoptimized images. "
1118
- "Try again and if the issue still persist, please contact us!"
1119
- msgstr ""
1120
- "Ein unbekannter Fehler ist beim Sammeln der nicht optimierten Bilder "
1121
- "aufgetreten. Versuche es noch einmal; falls der Fehler sich wiederholt, "
1122
- "kontaktiere bitte den Imagify-Support."
1123
-
1124
- #: ../inc/functions/i18n.php:82
1125
- msgid "Error"
1126
- msgstr "Fehler"
1127
-
1128
- #: ../inc/functions/i18n.php:85
1129
- msgid "Hold on!"
1130
- msgstr "Moment, bitte!"
1131
-
1132
- #: ../inc/functions/i18n.php:86
1133
- msgid "All your images have been optimized by Imagify. Congratulations!"
1134
- msgstr "Imagify hat alle deine Bilder optimiert. Glückwunsch!"
1135
-
1136
- #: ../inc/functions/i18n.php:88
1137
- #, php-format
1138
- msgid ""
1139
- "Discover @imagify, the new compression tool to optimize your images for "
1140
- "free. I saved %1$s out of %2$s!"
1141
- msgstr ""
1142
- "Freies #WordPress #Plugin zur Bildoptimierung für bessere #Performance: "
1143
- "Bilder mit @imagify komprimiert, %1$s von %2$s gespart!"
1144
-
1145
- #: ../inc/functions/i18n.php:92
1146
- msgid "Imagify is still processing. Are you sure you want to leave this page?"
1147
- msgstr ""
1148
- "Imagify arbeitet noch. Möchtest du diese Seite wirklich verlassen und den "
1149
- "Prozess abbrechen?"
1150
-
1151
- #: ../inc/functions/i18n.php:101
1152
- msgid "F j, Y"
1153
- msgstr "j. F Y"
1154
-
1155
- #: ../inc/functions/process.php:40
1156
- msgid ""
1157
- "Sorry, our servers are temporarily unaccessible. Please, try again in a "
1158
- "couple of minutes."
1159
- msgstr ""
1160
- "Unsere Server sind leider im Augenblick nicht erreichbar. Bitte versuche es "
1161
- "in ein paar Minuten noch einmal."
1162
-
1163
- #: ../inc/functions/process.php:46
1164
- msgid "External HTTP requests are blocked"
1165
- msgstr "Externe HTTP-Anfragen werden blockiert"
1166
-
1167
- #: ../inc/functions/process.php:52
1168
- msgid "File path is empty"
1169
- msgstr "Datei-Pfad ist leer"
1170
-
1171
- #: ../inc/functions/process.php:58
1172
- #, php-format
1173
- msgid "Could not find %s"
1174
- msgstr "%s wurde nicht gefunden"
1175
-
1176
- #: ../inc/functions/process.php:63
1177
- #, php-format
1178
- msgid "%s is not writable"
1179
- msgstr "%s ist nicht beschreibbar."
1180
-
1181
- #: ../inc/functions/process.php:72
1182
- #, php-format
1183
- msgid "Skipped (%s), image not found."
1184
- msgstr "Übersprungen (%s), Bild nicht gefunden."
1185
-
1186
- #~ msgid "https://wordpress.org/plugins/imagify"
1187
- #~ msgstr "https://de.wordpress.org/plugins/imagify"
1188
-
1189
- #~ msgid ""
1190
- #~ "Dramaticaly reduce image file sizes without loosing quality, make your "
1191
- #~ "website load faster, boost your SEO and save money on your bandwith using "
1192
- #~ "Imagify, the new most advanced image optimization tool."
1193
- #~ msgstr ""
1194
- #~ "Verlustfreie Bildoptimierung für WordPress. Imagify reduziert dramatisch "
1195
- #~ "die Dateigröße deiner Bilder, macht deine Website schneller, verbessert "
1196
- #~ "deine SEO und spart Bandbreite."
1197
-
1198
- #~ msgid "Your default setting:"
1199
- #~ msgstr "Deine Standard-Einstellung:"
1200
-
1201
- #~ msgid ""
1202
- #~ "All images which are over to %s could be optimized using the pro version."
1203
- #~ msgstr "Bilder größer als %s können mit der Pro-version optimiert werden."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/imagify-de_DE_formal.mo DELETED
Binary file
languages/imagify-de_DE_formal.po DELETED
@@ -1,1223 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Imagify\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2016-09-23 11:14-0500\n"
6
- "PO-Revision-Date: 2016-09-23 11:16-0500\n"
7
- "Last-Translator: Rémy Perona <remperona@gmail.com>\n"
8
- "Language-Team: \n"
9
- "Language: de\n"
10
- "MIME-Version: 1.0\n"
11
- "Content-Type: text/plain; charset=UTF-8\n"
12
- "Content-Transfer-Encoding: 8bit\n"
13
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
14
- "X-Poedit-SourceCharset: UTF-8\n"
15
- "X-Poedit-Basepath: .\n"
16
- "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
17
- "__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
18
- "_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
19
- "esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
20
- "esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
21
- "X-Generator: Poedit 1.6.4\n"
22
- "X-Loco-Target-Locale: de_DE\n"
23
- "X-Poedit-SearchPath-0: ..\n"
24
-
25
- #: ../inc/3rd-party/nextgen-gallery/inc/admin/enqueue.php:20
26
- #: ../inc/admin/ajax.php:123 ../inc/admin/meta-boxes.php:34
27
- #: ../inc/functions/admin-ui.php:215 ../inc/functions/i18n.php:49
28
- #: ../inc/functions/i18n.php:64
29
- msgid "Optimize"
30
- msgstr "Optimieren"
31
-
32
- #: ../inc/3rd-party/nextgen-gallery/inc/admin/enqueue.php:21
33
- #: ../inc/functions/admin-ui.php:80 ../inc/functions/i18n.php:50
34
- msgid "Restore Original"
35
- msgstr "Original wiederherstellen"
36
-
37
- #: ../inc/3rd-party/nextgen-gallery/inc/admin/menu.php:16
38
- #: ../inc/admin/menu.php:24 ../inc/admin/plugins.php:13
39
- #: ../inc/admin/ui/bulk.php:81 ../inc/common/admin-bar.php:39
40
- msgid "Bulk Optimization"
41
- msgstr "Stapelverarbeitung"
42
-
43
- #: ../inc/admin/ajax.php:123 ../inc/admin/meta-boxes.php:29
44
- #: ../inc/functions/admin-ui.php:121 ../inc/functions/admin-ui.php:153
45
- #: ../inc/functions/admin-ui.php:159 ../inc/functions/admin-ui.php:165
46
- #: ../inc/functions/admin-ui.php:205 ../inc/functions/admin-ui.php:215
47
- msgid "Optimizing..."
48
- msgstr "Wird&#160;optimiert&#160;…"
49
-
50
- #: ../inc/admin/ajax.php:507
51
- msgid "Oops, It's almost over!"
52
- msgstr "Hoppla, es wird langsam eng."
53
-
54
- #: ../inc/admin/ajax.php:508
55
- #, php-format
56
- msgid ""
57
- "You have almost used all your credit.%sDon't forget to upgrade your "
58
- "subscription to continue optimizing your images."
59
- msgstr ""
60
- "In Kürze werden Sie Ihr Guthaben verbraucht haben.%sAktualisieren Sie Ihr "
61
- "Abo, um Ihre Bilder auch in Zukunft zu optimieren."
62
-
63
- #: ../inc/admin/ajax.php:509 ../inc/admin/ui/bulk.php:23
64
- msgid "View My Subscription"
65
- msgstr "Mein Abo ansehen"
66
-
67
- #: ../inc/admin/ajax.php:517 ../inc/admin/ui/notices.php:258
68
- #: ../inc/functions/i18n.php:84
69
- msgid "Oops, It's Over!"
70
- msgstr "Alles hat ein Ende…"
71
-
72
- #: ../inc/admin/ajax.php:518 ../inc/admin/ui/notices.php:260
73
- #: ../inc/functions/i18n.php:101
74
- #, php-format
75
- msgid ""
76
- "You have consumed all your credit for this month. You will have <strong>%s "
77
- "back on %s</strong>."
78
- msgstr ""
79
- "Sie haben Ihr Guthaben für diesen Monat aufgebraucht. <strong>%s</strong> "
80
- "werden Ihnen am <strong>%s</strong> wieder zur Verfügung stehen."
81
-
82
- #: ../inc/admin/ajax.php:519
83
- msgid "Upgrade My Subscription"
84
- msgstr "Mein Abo aktualisieren"
85
-
86
- #: ../inc/admin/ajax.php:538 ../inc/admin/ui/bulk.php:17
87
- msgid "Account status"
88
- msgstr "Kontostatus"
89
-
90
- #: ../inc/admin/ajax.php:539 ../inc/admin/ui/bulk.php:18
91
- msgid "Your subscription:"
92
- msgstr "Ihr Abo:"
93
-
94
- #: ../inc/admin/ajax.php:547 ../inc/admin/ui/bulk.php:48
95
- #, php-format
96
- msgid "You have %s space credit left"
97
- msgstr "Sie haben noch %s Guthaben"
98
-
99
- #: ../inc/admin/ajax.php:559
100
- msgid "View my subscription"
101
- msgstr "Mein Abo ansehen"
102
-
103
- #: ../inc/admin/media.php:63 ../inc/functions/i18n.php:60
104
- msgid "Compare Original VS Optimized"
105
- msgstr "Vergleiche Original mit optimiert"
106
-
107
- #: ../inc/admin/meta-boxes.php:17 ../inc/admin/meta-boxes.php:24
108
- #: ../inc/admin/upload.php:12
109
- #, fuzzy
110
- msgid "Imagify"
111
- msgstr "Verbindung zu Imagify herstellen"
112
-
113
- #: ../inc/admin/meta-boxes.php:19 ../inc/functions/admin-ui.php:195
114
- msgid "Invalid API key"
115
- msgstr "Ungültiger API-Schlüssel"
116
-
117
- #: ../inc/admin/meta-boxes.php:21 ../inc/functions/admin-ui.php:197
118
- msgid "Check your Settings"
119
- msgstr "Überprüfen Sie Ihre Einstellungen"
120
-
121
- #: ../inc/admin/options.php:119
122
- msgid "Cheatin&#8217; uh?"
123
- msgstr "Ts, ts, ts&#160;…"
124
-
125
- #: ../inc/admin/options.php:127
126
- msgid "<strong>ERROR</strong>: options page not found."
127
- msgstr "<strong>Fehler</strong>: Einstellungsseite nicht gefunden."
128
-
129
- #: ../inc/admin/plugins.php:14 ../inc/admin/ui/options.php:74
130
- #: ../inc/common/admin-bar.php:30
131
- msgid "Settings"
132
- msgstr "Einstellungen"
133
-
134
- #: ../inc/admin/ui/bulk.php:60
135
- msgid "Upgrade your account to continue optimizing your images"
136
- msgstr "Aktualisiere dein Konto, um deine Bilder weiterhin zu optimieren"
137
-
138
- #: ../inc/admin/ui/bulk.php:64
139
- msgid "More info"
140
- msgstr "Weitere Informationen"
141
-
142
- #: ../inc/admin/ui/bulk.php:91
143
- msgid "Overview"
144
- msgstr "Übersicht"
145
-
146
- #: ../inc/admin/ui/bulk.php:99
147
- #, php-format
148
- msgid "You optimized %s images of your website"
149
- msgstr "Sie haben %s Bilder Ihrer Website optimiert"
150
-
151
- #: ../inc/admin/ui/bulk.php:103
152
- msgid "Statistics"
153
- msgstr "Statistik"
154
-
155
- #: ../inc/admin/ui/bulk.php:115
156
- msgid "that's the number of images you optimized with Imagify"
157
- msgstr "Bilder mit Imagify optimiert"
158
-
159
- #: ../inc/admin/ui/bulk.php:120
160
- msgid "Original size"
161
- msgstr "Originalgröße"
162
-
163
- #: ../inc/admin/ui/bulk.php:125
164
- msgid "Optimized size"
165
- msgstr "Optimierte Größe"
166
-
167
- #: ../inc/admin/ui/bulk.php:136
168
- #, php-format
169
- msgid "that's the size you saved %sby using Imagify"
170
- msgstr "geringere Dateigröße dank Imagify"
171
-
172
- #: ../inc/admin/ui/bulk.php:142
173
- msgid "Information"
174
- msgstr "Informationen"
175
-
176
- #: ../inc/admin/ui/bulk.php:146
177
- msgid ""
178
- "Please be aware that optimizing a large number of images can take a while "
179
- "depending on your server and network speed."
180
- msgstr ""
181
- "Bitte beachten: Das Optimieren einer hohen Anzahl Bilder kann eine Weile "
182
- "dauern, abhängig von Ihrem Server und der Netzwerkgeschwindigkeit."
183
-
184
- #: ../inc/admin/ui/bulk.php:149
185
- #, php-format
186
- msgid ""
187
- "If you have more than %s images, you will need to launch the bulk "
188
- "optimization several times."
189
- msgstr ""
190
-
191
- #: ../inc/admin/ui/bulk.php:153
192
- msgid ""
193
- "You must keep this page open while the bulk optimizaton is processing. If "
194
- "you leave you can come back to continue where it left off."
195
- msgstr ""
196
- "Sie müssen diese Seite während der Stapelverarbeitung geöffnet lassen. Falls "
197
- "Sie sie doch schließen, wird die Stapelverarbeitung unterbrochen und später "
198
- "fortgesetzt, sobald Sie diese Seite erneut aufrufen."
199
-
200
- #: ../inc/admin/ui/bulk.php:164
201
- msgid "Select Your Compression Level"
202
- msgstr "Wählen Sie Ihre Komprimierungsstufen"
203
-
204
- #: ../inc/admin/ui/bulk.php:166 ../inc/admin/ui/bulk.php:192
205
- #: ../inc/admin/ui/options.php:136 ../inc/admin/ui/options.php:365
206
- #: ../inc/admin/ui/options.php:404 ../inc/admin/ui/options.php:421
207
- #: ../inc/admin/ui/options.php:481
208
- #: ../inc/classes/abstracts/abstract-attachment.php:114
209
- #: ../inc/functions/admin-ui.php:153
210
- msgid "Ultra"
211
- msgstr "Ultra"
212
-
213
- #: ../inc/admin/ui/bulk.php:169 ../inc/admin/ui/bulk.php:187
214
- #: ../inc/admin/ui/options.php:131 ../inc/admin/ui/options.php:352
215
- #: ../inc/admin/ui/options.php:403 ../inc/admin/ui/options.php:416
216
- #: ../inc/admin/ui/options.php:460
217
- #: ../inc/classes/abstracts/abstract-attachment.php:117
218
- #: ../inc/functions/admin-ui.php:159
219
- msgid "Aggressive"
220
- msgstr "Aggressiv"
221
-
222
- #: ../inc/admin/ui/bulk.php:172 ../inc/admin/ui/bulk.php:182
223
- #: ../inc/admin/ui/options.php:126 ../inc/admin/ui/options.php:339
224
- #: ../inc/admin/ui/options.php:402 ../inc/admin/ui/options.php:411
225
- #: ../inc/admin/ui/options.php:440
226
- #: ../inc/classes/abstracts/abstract-attachment.php:120
227
- #: ../inc/functions/admin-ui.php:165
228
- msgid "Normal"
229
- msgstr "Normal"
230
-
231
- #: ../inc/admin/ui/bulk.php:176
232
- #, php-format
233
- msgid "Your default setting: %s"
234
- msgstr "Ihre Standardeinstellung: %s"
235
-
236
- #: ../inc/admin/ui/bulk.php:201
237
- #, php-format
238
- msgid "Don't forget to check %syour settings%s before bulk optimization."
239
- msgstr "Überprüfen Sie Ihre %sEinstellungen%s vor der Stapelverarbeitung."
240
-
241
- #: ../inc/admin/ui/bulk.php:208
242
- msgid "Let's go!"
243
- msgstr "Los geht’s!"
244
-
245
- #: ../inc/admin/ui/bulk.php:215
246
- msgid "Imagif'em all"
247
- msgstr "Alle Bilder optimieren"
248
-
249
- #: ../inc/admin/ui/bulk.php:220
250
- #, php-format
251
- msgid "All images greater than %s will be optimized when using a paid plan."
252
- msgstr ""
253
- "Alle Bilder größer als %s werden optimiert, wenn Sie einen bezahlten Tarif "
254
- "nutzen."
255
-
256
- #: ../inc/admin/ui/bulk.php:239
257
- msgid "Well done!"
258
- msgstr "Bravo!"
259
-
260
- #: ../inc/admin/ui/bulk.php:240
261
- #, php-format
262
- msgid "you saved %1$s out of %2$s"
263
- msgstr "Sie haben %1$s von %2$s gespart"
264
-
265
- #: ../inc/admin/ui/bulk.php:245
266
- msgid "Share your awesome result"
267
- msgstr "Teilen Sie Ihr hervorragendes Ergebnis"
268
-
269
- #: ../inc/admin/ui/bulk.php:260
270
- msgid "Compression process results"
271
- msgstr "Ergebnisse der Komprimierung"
272
-
273
- #: ../inc/admin/ui/bulk.php:263
274
- msgid "Filename"
275
- msgstr "Dateiname"
276
-
277
- #: ../inc/admin/ui/bulk.php:264
278
- msgid "Status"
279
- msgstr "Status"
280
-
281
- #: ../inc/admin/ui/bulk.php:265 ../inc/admin/ui/options.php:401
282
- #: ../inc/admin/ui/options.php:406 ../inc/admin/ui/options.php:430
283
- msgid "Original"
284
- msgstr "Original"
285
-
286
- #: ../inc/admin/ui/bulk.php:266 ../inc/admin/upload.php:41
287
- #: ../inc/functions/i18n.php:80
288
- msgid "Optimized"
289
- msgstr "Optimiert"
290
-
291
- #: ../inc/admin/ui/bulk.php:267
292
- msgid "Percentage"
293
- msgstr "Prozent"
294
-
295
- #: ../inc/admin/ui/bulk.php:268
296
- msgid "Thumbnails optimized"
297
- msgstr "Vorschaubilder optimiert"
298
-
299
- #: ../inc/admin/ui/bulk.php:269
300
- msgid "Overall saving"
301
- msgstr "Gesamte Ersparnis"
302
-
303
- #: ../inc/admin/ui/bulk.php:274
304
- msgid "file"
305
- msgstr "Datei"
306
-
307
- #: ../inc/admin/ui/bulk.php:275
308
- msgid "error"
309
- msgstr "Fehler"
310
-
311
- #: ../inc/admin/ui/bulk.php:276
312
- msgid "Total:"
313
- msgstr "Gesamt:"
314
-
315
- #: ../inc/admin/ui/bulk.php:277
316
- msgid "Gain:"
317
- msgstr "Gewinn:"
318
-
319
- #: ../inc/admin/ui/bulk.php:294
320
- #, php-format
321
- msgid "%sStart the bulk optimization%s"
322
- msgstr "%sStapelverarbeitung starten%s"
323
-
324
- #: ../inc/admin/ui/notices.php:24
325
- msgid "Welcome to Imagify, the best way to easily optimize your images!"
326
- msgstr "Willkommen bei Imagify, der smarten Bildoptimierung!"
327
-
328
- #: ../inc/admin/ui/notices.php:26 ../inc/admin/ui/notices.php:92
329
- #: ../inc/admin/ui/notices.php:186 ../inc/admin/ui/notices.php:223
330
- #: ../inc/admin/ui/notices.php:263 ../inc/admin/ui/notices.php:370
331
- msgid "Dismiss this notice"
332
- msgstr "Diese Meldung verwerfen"
333
-
334
- #: ../inc/admin/ui/notices.php:33
335
- msgid "Create an Account"
336
- msgstr "Konto anlegen"
337
-
338
- #: ../inc/admin/ui/notices.php:34
339
- msgid ""
340
- "Don't have an Imagify account yet? Optimize your images by creating an "
341
- "account in a few seconds!"
342
- msgstr ""
343
- "Registrieren Sie Ihr Konto bei Imagify (kostenfrei, dauert nur ein paar "
344
- "Sekunden), um anschließend Ihre Bilder in WordPress zu optimieren."
345
-
346
- #: ../inc/admin/ui/notices.php:37
347
- msgid "Sign up, It's FREE!"
348
- msgstr "Mein Konto kostenfrei anlegen"
349
-
350
- #: ../inc/admin/ui/notices.php:43
351
- msgid "Enter your API Key"
352
- msgstr "API-Schlüssel eingeben"
353
-
354
- #: ../inc/admin/ui/notices.php:44
355
- #, php-format
356
- msgid ""
357
- "Save your API Key you have received by email or you can get it on your "
358
- "%sImagify account page%s."
359
- msgstr ""
360
- "Aktivieren Sie Imagify mit Ihrem persönlichen API-Schlüssel, den Sie per E-"
361
- "Mail erhalten haben. Sie können ihn auch jederzeit in Ihren "
362
- "%sKontoeinstellungen%s abrufen."
363
-
364
- #: ../inc/admin/ui/notices.php:47
365
- msgid "I have my API key"
366
- msgstr "Meinen API-Schlüssel eingeben"
367
-
368
- #: ../inc/admin/ui/notices.php:53
369
- msgid "Configure it"
370
- msgstr "Einstellungen wählen"
371
-
372
- #: ../inc/admin/ui/notices.php:54
373
- msgid ""
374
- "It’s almost done! You have just to configure your optimization settings."
375
- msgstr ""
376
- "Fast fertig! Wählen Sie nun Ihre Einstellungen für Imagify. Anschließend "
377
- "können Sie alle Ihre Bilder von Imagify automatisch optimieren lassen."
378
-
379
- #: ../inc/admin/ui/notices.php:55
380
- msgid "Go to Settings"
381
- msgstr "Meine Einstellungen wählen"
382
-
383
- #: ../inc/admin/ui/notices.php:87 ../inc/admin/ui/options.php:97
384
- #: ../inc/functions/i18n.php:78
385
- msgid "Your API key isn't valid!"
386
- msgstr "Ihr API-Schlüssel ist ungültig."
387
-
388
- #: ../inc/admin/ui/notices.php:90
389
- #, php-format
390
- msgid ""
391
- "Go to your Imagify account page to get your API Key and specify it on "
392
- "%1$syour settings%3$s or %2$screate an account for free%3$s if you don't "
393
- "have one yet."
394
- msgstr ""
395
- "Sie finden Ihren API-Schlüssel in Ihrem Imagify-Konto. Sobald Sie ihn dort "
396
- "geholt haben, %1$shinterlegen Sie ihn in Ihren Einstellungen%3$s. Oder "
397
- "%2$slegen Sie kostenfrei ein Konto an%3$s, um einen API-Schlüssel zu "
398
- "erhalten."
399
-
400
- #: ../inc/admin/ui/notices.php:142
401
- msgid ""
402
- "The following plugins are not compatible with this plugin and may cause "
403
- "unexpected results:"
404
- msgstr ""
405
- "Die folgenden Plugins sind nicht kompatibel mit diesem Plugin und können "
406
- "unerwartete Ergebnisse verursachen:"
407
-
408
- #: ../inc/admin/ui/notices.php:148
409
- msgid "Deactivate"
410
- msgstr "Deaktivieren"
411
-
412
- #: ../inc/admin/ui/notices.php:178
413
- msgid "The external HTTP requests are blocked!"
414
- msgstr "Externe HTTP-Anfragen werden blockiert."
415
-
416
- #: ../inc/admin/ui/notices.php:179
417
- msgid ""
418
- "You defined the <code>WP_HTTP_BLOCK_EXTERNAL</code> constant in the <code>wp-"
419
- "config.php</code> to block all external HTTP requests."
420
- msgstr ""
421
- "Alle externen HTTP-Anfragen werden blockiert, weil in der Datei <em>wp-"
422
- "config.php</em> die PHP-Konstante <code>WP_HTTP_BLOCK_EXTERNAL</code> "
423
- "gesetzt ist.\n"
424
-
425
- #: ../inc/admin/ui/notices.php:181
426
- msgid ""
427
- "To optimize your images, you have to put the following code in your <code>wp-"
428
- "config.php</code> file so that it works correctly."
429
- msgstr ""
430
- "Um Ihre Bilder optimieren zu können, fügen Sie den folgenden Code zu Ihrer "
431
- "<em>wp-config.php</em> hinzu."
432
-
433
- #: ../inc/admin/ui/notices.php:182
434
- msgid "Click on the field and press Ctrl-A to select all."
435
- msgstr ""
436
- "Klicken Sie auf das Feld und drücken Sie ctrl+A (cmd+A) für Alles auswählen."
437
-
438
- #: ../inc/admin/ui/notices.php:219
439
- msgid "You're missing out!"
440
- msgstr "Sie verpassen etwas!"
441
-
442
- #: ../inc/admin/ui/notices.php:220
443
- msgid "Use the List view to optimize images with Imagify."
444
- msgstr "In der Listenansicht können Sie Ihre Bilder direkt zu optimieren."
445
-
446
- #: ../inc/admin/ui/notices.php:221
447
- msgid "Switch to the List View"
448
- msgstr "Zur Listenansicht wechseln"
449
-
450
- #: ../inc/admin/ui/notices.php:260 ../inc/functions/i18n.php:98
451
- #: ../inc/functions/i18n.php:101
452
- #, php-format
453
- msgid ""
454
- "To continue to optimize your images, log in to your Imagify account to %sbuy "
455
- "a pack or subscribe to a plan%s."
456
- msgstr ""
457
- "Um Ihre Bilder auch in Zukunft zu optimieren, loggen Sie sich bei Imagify.io "
458
- "ein und %skaufen Sie ein einmaliges Guthaben oder ein Abo%s."
459
-
460
- #: ../inc/admin/ui/notices.php:314 ../inc/admin/ui/options.php:28
461
- msgid "Discover the best caching plugin to speed up your website."
462
- msgstr ""
463
- "Entdecken Sie das beste Caching-Plugin, um Ihre Website schneller zu machen."
464
-
465
- #: ../inc/admin/ui/notices.php:317 ../inc/admin/ui/options.php:36
466
- #, php-format
467
- msgid "%sGet %s off%s with this coupon code:%s"
468
- msgstr "%sErhalten Sie %s Rabatt%s mit diesem Gutschein-Code:%s"
469
-
470
- #: ../inc/admin/ui/notices.php:326 ../inc/admin/ui/options.php:41
471
- msgid "Get WP Rocket now"
472
- msgstr "Holen Sie sich WP Rocket jetzt"
473
-
474
- #: ../inc/admin/ui/notices.php:363
475
- #, php-format
476
- msgid ""
477
- "%1$sCongratulations%2$s, you have optimized %1$s%3$d images%2$s and improved "
478
- "your website's speed by reducing your images size."
479
- msgstr ""
480
-
481
- #: ../inc/admin/ui/notices.php:365 ../inc/admin/ui/options.php:59
482
- #, php-format
483
- msgid ""
484
- "%sDo you like this plugin?%s Please take a few seconds to %srate it on "
485
- "WordPress.org%s!"
486
- msgstr ""
487
- "%sSind Sie zufrieden mit diesem Plugin?%s Bitte nehmen Sie sich einen Moment "
488
- "Zeit für eine %sBewertung auf WordPress.org%s!"
489
-
490
- #: ../inc/admin/ui/options.php:22
491
- msgid "Is your website too slow?"
492
- msgstr "Ist Ihre Website zu langsam?"
493
-
494
- #: ../inc/admin/ui/options.php:84
495
- msgid "API Key"
496
- msgstr "API-Schlüssel"
497
-
498
- #: ../inc/admin/ui/options.php:91 ../inc/functions/i18n.php:33
499
- msgid "Your API key is valid."
500
- msgstr "Ihr API-Schlüssel ist gültig."
501
-
502
- #: ../inc/admin/ui/options.php:104
503
- #, php-format
504
- msgid "Don't have an API Key yet? %sCreate one, it's FREE%s."
505
- msgstr "Noch keinen API-Schlüssel erhalten? %sJetzt kostenfrei Konto anlegen%s"
506
-
507
- #: ../inc/admin/ui/options.php:121
508
- msgid "Optimization Level"
509
- msgstr "Optimierungsgrad"
510
-
511
- #: ../inc/admin/ui/options.php:141
512
- msgid "More info?"
513
- msgstr "Was ist das?"
514
-
515
- #: ../inc/admin/ui/options.php:148
516
- #, php-format
517
- msgid "Need help to choose? %sTry the Visual Comparison%s"
518
- msgstr "Nicht sicher? %sVisuellen Vergleich ausprobieren%s"
519
-
520
- #: ../inc/admin/ui/options.php:157 ../inc/admin/ui/options.php:161
521
- msgid "Auto-Optimize images on upload"
522
- msgstr "Bilder beim Hochladen automatisch optimieren"
523
-
524
- #: ../inc/admin/ui/options.php:165
525
- msgid "Automatically optimize every image you upload to WordPress."
526
- msgstr ""
527
- "Lassen Sie jedes Bild automatisch optimieren, das Sie in WordPress hochladen."
528
-
529
- #: ../inc/admin/ui/options.php:170 ../inc/admin/ui/options.php:173
530
- msgid "Backup original images"
531
- msgstr "Originalbilder sichern"
532
-
533
- #: ../inc/admin/ui/options.php:177
534
- msgid ""
535
- "Keep your original images in a separate folder before optimization process."
536
- msgstr ""
537
- "Speichern Sie Sicherungskopien Ihrer Originalbilder in einem separaten "
538
- "Ordner, bevor die Optimierung beginnt."
539
-
540
- #: ../inc/admin/ui/options.php:182 ../inc/admin/ui/options.php:185
541
- msgid "Resize larger images"
542
- msgstr "Große Bilder verkleinern"
543
-
544
- #: ../inc/admin/ui/options.php:191
545
- #, php-format
546
- msgid "to maximum %s pixels width"
547
- msgstr "auf maximal %s Pixel Breite"
548
-
549
- #: ../inc/admin/ui/options.php:202
550
- #, php-format
551
- msgid ""
552
- "This option is recommended to reduce larger images. You can save up to 80%% "
553
- "after resizing. The new width should not be less than your largest thumbnail "
554
- "width, which is actually %spx."
555
- msgstr ""
556
- "Diese Option ist empfehlenswert, um das Speichervolumen für größere Bilder "
557
- "zu reduzieren. Sie könne so bis zu 80%% Speicherplatz sparen. Die neue "
558
- "Breite sollte nicht geringer als Ihre größte Vorschaubildbreite sein, die "
559
- "übrigens %s Pixel beträgt."
560
-
561
- #: ../inc/admin/ui/options.php:209 ../inc/admin/ui/options.php:212
562
- msgid "EXIF Data"
563
- msgstr "EXIF-Daten"
564
-
565
- #: ../inc/admin/ui/options.php:216
566
- msgid ""
567
- "Keep all EXIF data from your images. EXIF are informations stored in your "
568
- "pictures like shutter speed, exposure compensation, ISO, etc..."
569
- msgstr ""
570
- "Behalten Sie alle EXIF-Daten Ihrer Bilder. In den EXIF-Daten werden "
571
- "Informationen wie Verschlusszeit, Belichtungskorrektur, ISO-Wert usw. "
572
- "gespeichert."
573
-
574
- #: ../inc/admin/ui/options.php:217
575
- msgid "Learn more"
576
- msgstr "Weitere Informationen"
577
-
578
- #: ../inc/admin/ui/options.php:219
579
- msgid ""
580
- "If you are a photographer, you may be interested in this option if you are "
581
- "displaying on your pages some info like the model of your camera."
582
- msgstr ""
583
- "Aktiviere diese Option, wenn Sie auf Ihrer Site fototechnische "
584
- "Informationen, wie z.B. das Model Ihrer Kamera, anzeigen möchtest."
585
-
586
- #: ../inc/admin/ui/options.php:228
587
- msgid "Files optimization"
588
- msgstr "Dateioptimierung"
589
-
590
- #: ../inc/admin/ui/options.php:231
591
- msgid ""
592
- "You can choose to compress different image sizes created by WordPress here."
593
- msgstr ""
594
- "Hier können Sie die Komprimierung für die verschiedenen Bildgrößen "
595
- "kontrollieren, die Ihr WordPress generiert."
596
-
597
- #: ../inc/admin/ui/options.php:233
598
- #, php-format
599
- msgid "The %soriginal size%s is %sautomatically optimized%s by Imagify."
600
- msgstr "Die %sOriginalgröße%s wird von Imagify %sautomatisch optimiert%s."
601
-
602
- #: ../inc/admin/ui/options.php:236
603
- msgid ""
604
- "Remember each additional image size will affect your Imagify monthly usage!"
605
- msgstr ""
606
- "Bedenken Sie, dass jede ausgewählte Bildgröße Ihr monatliches "
607
- "Nutzungsvolumen bei Imagify beeinflusst."
608
-
609
- #: ../inc/admin/ui/options.php:289
610
- msgid "Display options"
611
- msgstr "Optionen anzeigen"
612
-
613
- #: ../inc/admin/ui/options.php:294 ../inc/admin/ui/options.php:299
614
- msgid "Show Admin Bar menu"
615
- msgstr "Toolbar-Menü anzeigen"
616
-
617
- #: ../inc/admin/ui/options.php:300
618
- msgid "I want this awesome quick access menu on my admin bar."
619
- msgstr "Ich möchte dieses praktische Dropdown-Menü in meiner Toolbar."
620
-
621
- #: ../inc/admin/ui/options.php:319
622
- msgid "Save &amp; Go to Bulk Optimizer"
623
- msgstr "Speichern und zur Stapelverarbeitung gehen"
624
-
625
- #: ../inc/admin/ui/options.php:328
626
- #, php-format
627
- msgid ""
628
- "Once your settings saved, optimize all your images by using the %sImagify "
629
- "Bulk Optimization%s feature."
630
- msgstr ""
631
- "Sobald Sie Ihre Einstellungen gespeichert haben, können Sie mit der "
632
- "%sStapelverarbeitung%s alle Ihre Bilder optimieren."
633
-
634
- #: ../inc/admin/ui/options.php:336
635
- msgid "You can choose three levels of compression"
636
- msgstr "Sie können zwischen drei Komprimierungsstufen wählen."
637
-
638
- #: ../inc/admin/ui/options.php:341
639
- msgid ""
640
- "This mode provides lossless optimization, your images will be optimized "
641
- "without any visible change."
642
- msgstr ""
643
- "Dieser Modus sorgt für verlustfreie Bildoptimierung. Ihre Bilder werden ohne "
644
- "sichtbare Veränderungen optimiert."
645
-
646
- #: ../inc/admin/ui/options.php:344
647
- msgid ""
648
- "If you want the perfect quality for your images, we recommend you that mode."
649
- msgstr ""
650
- "Wählen Sie diese Einstellung, wenn Ihnen die perfekte Qualität Ihrer Bilder "
651
- "wichtig ist."
652
-
653
- #: ../inc/admin/ui/options.php:347
654
- msgid ""
655
- "Note: the file size reduction will be less, compared to aggressive mode."
656
- msgstr ""
657
- "Hinweis: Die Verringerung der Dateigröße fällt hier geringer aus, als im "
658
- "aggressiven Modus."
659
-
660
- #: ../inc/admin/ui/options.php:354
661
- msgid ""
662
- "This mode provides perfect optimization of your images without any "
663
- "significant quality loss."
664
- msgstr ""
665
- "Dieser Modus liefert hervorragende Optimierung ohne signifikante "
666
- "Qualitätsverluste."
667
-
668
- #: ../inc/admin/ui/options.php:357
669
- msgid ""
670
- "This will provide a drastic savings on the initial weight, with a small "
671
- "reduction in image quality. Most of the time it's not even noticeable."
672
- msgstr ""
673
- "Die drastische Verringerung der Dateigröße geht mit geringfügigen, meist "
674
- "kaum wahrnehmbaren Einbußen in der Qualität einher."
675
-
676
- #: ../inc/admin/ui/options.php:360
677
- msgid "If you want the maximum weight reduction, we recommend using this mode."
678
- msgstr ""
679
- "Wählen Sie diese Einstellung, wenn Sie auf maximale Größenreduktion Wert "
680
- "legen."
681
-
682
- #: ../inc/admin/ui/options.php:367
683
- msgid ""
684
- "This mode will apply all available optimizations for maximum image "
685
- "compression."
686
- msgstr ""
687
- "Dieser Modus wendet alle verfügbaren Parameter für maximale Komprimierung an."
688
-
689
- #: ../inc/admin/ui/options.php:370
690
- msgid ""
691
- "This will provide a huge savings on the initial weight. Sometimes the image "
692
- "quality could be degraded a little."
693
- msgstr ""
694
- "Die Bildgröße wird erheblich verringert. In einigen Fällen kann es jedoch zu "
695
- "Verlusten bei der Qualität kommen."
696
-
697
- #: ../inc/admin/ui/options.php:373
698
- msgid ""
699
- "If you want the maximum weight reduction, and you agree to lose some quality "
700
- "on the images we recommend using this mode."
701
- msgstr ""
702
- "Wählen Sie diese Einstellung, wenn Sie bereit sind, etwas Qualität zugunsten "
703
- "maximaler Reduktion der Dateigröße zu riskieren."
704
-
705
- #: ../inc/admin/ui/options.php:380 ../inc/admin/ui/options.php:502
706
- #: ../inc/functions/admin-ui.php:662 ../inc/functions/i18n.php:61
707
- msgid "Close"
708
- msgstr "Schließen"
709
-
710
- #: ../inc/admin/ui/options.php:392
711
- #, php-format
712
- msgid "I want to compare%s and%s"
713
- msgstr "Ich möchte %s und %s vergleichen."
714
-
715
- #: ../inc/admin/ui/options.php:409
716
- #, php-format
717
- msgid "Original photography about %s"
718
- msgstr "Originalbild ca. %s"
719
-
720
- #: ../inc/admin/ui/options.php:414 ../inc/admin/ui/options.php:419
721
- #: ../inc/admin/ui/options.php:424
722
- #, php-format
723
- msgid "Optimized photography about %s"
724
- msgstr "Optimiertes Bild ca. %s"
725
-
726
- #: ../inc/admin/ui/options.php:429 ../inc/admin/ui/options.php:439
727
- #: ../inc/admin/ui/options.php:459 ../inc/admin/ui/options.php:480
728
- #: ../inc/functions/admin-ui.php:59
729
- msgid "Level:"
730
- msgstr "Modus:"
731
-
732
- #: ../inc/admin/ui/options.php:433 ../inc/admin/ui/options.php:443
733
- #: ../inc/admin/ui/options.php:463 ../inc/admin/ui/options.php:484
734
- #: ../inc/functions/i18n.php:62
735
- msgid "File Size:"
736
- msgstr "Dateigröße:"
737
-
738
- #: ../inc/admin/ui/options.php:447 ../inc/admin/ui/options.php:467
739
- #: ../inc/admin/ui/options.php:488 ../inc/functions/admin-ui.php:45
740
- #: ../inc/functions/i18n.php:63
741
- msgid "Original Saving:"
742
- msgstr "Optimiert um:"
743
-
744
- #: ../inc/admin/upload.php:42 ../inc/functions/i18n.php:81
745
- msgid "Unoptimized"
746
- msgstr "Nicht Optimiert"
747
-
748
- #: ../inc/admin/upload.php:43
749
- msgid "Errors"
750
- msgstr "Fehler"
751
-
752
- #: ../inc/admin/upload.php:46
753
- msgid "Filter by status"
754
- msgstr "Filtere nach Status"
755
-
756
- #: ../inc/admin/upload.php:49
757
- msgid "All images"
758
- msgstr "Alle Bilder"
759
-
760
- #: ../inc/classes/class-attachment.php:297
761
- msgid ""
762
- "This size isn't authorized to be optimized. Update your Imagify settings if "
763
- "you want to optimize it."
764
- msgstr ""
765
- "Diese Bildgröße ist für die Optimierung nicht zugelassen. Aktualisieren Sie "
766
- "Ihre Imagify-Einstellungen, wenn Sie sie optimieren möchten."
767
-
768
- #: ../inc/common/admin-bar.php:48
769
- #, php-format
770
- msgid "Rate Imagify on %s"
771
- msgstr "Bewerten Sie Imagify auf %s"
772
-
773
- #: ../inc/common/admin-bar.php:61
774
- msgid "Loading..."
775
- msgstr "Laden&#160;…"
776
-
777
- #: ../inc/functions/admin-ui.php:36
778
- msgid "New Filesize:"
779
- msgstr "Neue Dateigröße:"
780
-
781
- #: ../inc/functions/admin-ui.php:52
782
- msgid "Close details"
783
- msgstr "Details schließen"
784
-
785
- #: ../inc/functions/admin-ui.php:52
786
- msgid "View details"
787
- msgstr "Details anzeigen"
788
-
789
- #: ../inc/functions/admin-ui.php:56
790
- msgid "Original Filesize:"
791
- msgstr "Originale Dateigröße:"
792
-
793
- #: ../inc/functions/admin-ui.php:62
794
- msgid "Thumbnails Optimized:"
795
- msgstr "Optimierte Vorschaubilder:"
796
-
797
- #: ../inc/functions/admin-ui.php:63
798
- msgid "Overall Saving:"
799
- msgstr "Gesamte Ersparnis:"
800
-
801
- #: ../inc/functions/admin-ui.php:80
802
- msgid "Restoring..."
803
- msgstr "Wiederherstellen&#160;…"
804
-
805
- #: ../inc/functions/admin-ui.php:121
806
- msgid "Try again"
807
- msgstr "Erneut versuchen"
808
-
809
- #: ../inc/functions/admin-ui.php:153 ../inc/functions/admin-ui.php:159
810
- #: ../inc/functions/admin-ui.php:165
811
- #, php-format
812
- msgid "Re-Optimize to %s"
813
- msgstr "Erneut optimieren als %s"
814
-
815
- #: ../inc/functions/admin-ui.php:189
816
- #, php-format
817
- msgid "%s can't be optimized"
818
- msgstr "%s kann nicht optimiert werden."
819
-
820
- #: ../inc/functions/admin-ui.php:240
821
- msgid "What plan do I need?"
822
- msgstr ""
823
-
824
- #: ../inc/functions/admin-ui.php:244
825
- msgid "You're new to Imagify?"
826
- msgstr ""
827
-
828
- #: ../inc/functions/admin-ui.php:245
829
- msgid ""
830
- "Let us help you by analyzing your existing images and determinate the best "
831
- "plan for you"
832
- msgstr ""
833
-
834
- #: ../inc/functions/admin-ui.php:280
835
- msgid "Choose Plan"
836
- msgstr ""
837
-
838
- #: ../inc/functions/admin-ui.php:281
839
- #, fuzzy
840
- msgid "Payment Info"
841
- msgstr "Weitere Informationen"
842
-
843
- #: ../inc/functions/admin-ui.php:286
844
- msgid "We analysed your images"
845
- msgstr ""
846
-
847
- #: ../inc/functions/admin-ui.php:292
848
- #, fuzzy, php-format
849
- msgid "You have %s images"
850
- msgstr "Du hast noch %s Guthaben"
851
-
852
- #: ../inc/functions/admin-ui.php:298
853
- #, php-format
854
- msgid "You actually have %s of images in your library."
855
- msgstr ""
856
-
857
- #: ../inc/functions/admin-ui.php:302
858
- #, php-format
859
- msgid "You upload around %s of images per month."
860
- msgstr ""
861
-
862
- #: ../inc/functions/admin-ui.php:309
863
- msgid "We recommend you this plan"
864
- msgstr ""
865
-
866
- #: ../inc/functions/admin-ui.php:314
867
- msgid "Subscribe a monthly plan"
868
- msgstr ""
869
-
870
- #: ../inc/functions/admin-ui.php:315
871
- msgid "Subscribe a yearly plan"
872
- msgstr ""
873
-
874
- #: ../inc/functions/admin-ui.php:319 ../inc/functions/admin-ui.php:455
875
- #: ../inc/functions/admin-ui.php:623
876
- #, fuzzy
877
- msgid "Monthly"
878
- msgstr ""
879
- "Bedenke, dass jede ausgewählte Bildgröße dein monatliches Nutzungsvolumen "
880
- "bei Imagify beeinflusst."
881
-
882
- #: ../inc/functions/admin-ui.php:322 ../inc/functions/admin-ui.php:458
883
- #: ../inc/functions/admin-ui.php:626
884
- msgid "Yearly"
885
- msgstr ""
886
-
887
- #: ../inc/functions/admin-ui.php:322 ../inc/functions/admin-ui.php:458
888
- #: ../inc/functions/admin-ui.php:626
889
- msgid "2 months free"
890
- msgstr ""
891
-
892
- #: ../inc/functions/admin-ui.php:333 ../inc/functions/admin-ui.php:352
893
- #: ../inc/functions/admin-ui.php:468 ../inc/functions/admin-ui.php:478
894
- #, fuzzy
895
- msgid "/month"
896
- msgstr ""
897
- "Du hast dein Guthaben für diesen Monat aufgebraucht. <strong>%s</strong> "
898
- "werden dir am <strong>%s</strong> wieder zur Verfügung stehen."
899
-
900
- #: ../inc/functions/admin-ui.php:335 ../inc/functions/admin-ui.php:383
901
- #: ../inc/functions/admin-ui.php:470 ../inc/functions/admin-ui.php:521
902
- #, php-format
903
- msgid "approx: %s images"
904
- msgstr ""
905
-
906
- #: ../inc/functions/admin-ui.php:356 ../inc/functions/admin-ui.php:484
907
- #, php-format
908
- msgid ""
909
- "%s per<br>\n"
910
- "additionnal Gb"
911
- msgstr ""
912
-
913
- #: ../inc/functions/admin-ui.php:361 ../inc/functions/admin-ui.php:396
914
- #: ../inc/functions/admin-ui.php:580 ../inc/functions/admin-ui.php:601
915
- msgid "Choose another plan"
916
- msgstr ""
917
-
918
- #: ../inc/functions/admin-ui.php:371
919
- msgid "Optimize the images you already have, buy a one-time plan"
920
- msgstr ""
921
-
922
- #: ../inc/functions/admin-ui.php:407
923
- msgid "Checkout"
924
- msgstr ""
925
-
926
- #: ../inc/functions/admin-ui.php:411
927
- msgid ""
928
- "Monthly plans comes with credits which is renewed every months. The billing "
929
- "happens automatically each month or year depending the billing period you "
930
- "choose."
931
- msgstr ""
932
-
933
- #: ../inc/functions/admin-ui.php:435
934
- msgid "Monthly Plans"
935
- msgstr ""
936
-
937
- #: ../inc/functions/admin-ui.php:440
938
- msgid "One Time Plans"
939
- msgstr ""
940
-
941
- #: ../inc/functions/admin-ui.php:450
942
- msgid ""
943
- "Monthly plans come with credits which is renewed every months. The billing "
944
- "happens automatically each month or year depending the billing period you "
945
- "choose."
946
- msgstr ""
947
-
948
- #: ../inc/functions/admin-ui.php:482 ../inc/functions/admin-ui.php:529
949
- #, fuzzy
950
- msgid "we recommend for you"
951
- msgstr ""
952
- "Wähle diese Einstellung, wenn dir die perfekte Qualität deiner Bilder "
953
- "wichtig ist."
954
-
955
- #: ../inc/functions/admin-ui.php:490 ../inc/functions/admin-ui.php:533
956
- msgid "Choose plan"
957
- msgstr ""
958
-
959
- #: ../inc/functions/admin-ui.php:498
960
- #, fuzzy
961
- msgid "Need more?"
962
- msgstr "Weitere Informationen"
963
-
964
- #: ../inc/functions/admin-ui.php:499
965
- msgid "for special needs"
966
- msgstr ""
967
-
968
- #: ../inc/functions/admin-ui.php:503
969
- #, fuzzy
970
- msgid "Contact Us"
971
- msgstr ""
972
- "Ein unbekannter Fehler ist beim Sammeln der nicht optimierten Bilder "
973
- "aufgetreten. Versuche es noch einmal; falls der Fehler sich wiederholt, "
974
- "kontaktiere bitte den Imagify-Support."
975
-
976
- #: ../inc/functions/admin-ui.php:510
977
- msgid ""
978
- "One time plans are useful if you have a lots of existing images which need "
979
- "to be optimized. You can use it for bulk optimizing all your past images. "
980
- "You will pay only once."
981
- msgstr ""
982
-
983
- #: ../inc/functions/admin-ui.php:563
984
- #, fuzzy
985
- msgid "Your order"
986
- msgstr "Dein Abo:"
987
-
988
- #: ../inc/functions/admin-ui.php:568
989
- #, php-format
990
- msgid "%scancel%sYou just removed %s"
991
- msgstr ""
992
-
993
- #: ../inc/functions/admin-ui.php:576 ../inc/functions/admin-ui.php:597
994
- msgid "Remove this item"
995
- msgstr ""
996
-
997
- #: ../inc/functions/admin-ui.php:583
998
- #, php-format
999
- msgid "%s per month"
1000
- msgstr ""
1001
-
1002
- #: ../inc/functions/admin-ui.php:604
1003
- #, php-format
1004
- msgid "one time %s"
1005
- msgstr ""
1006
-
1007
- #: ../inc/functions/admin-ui.php:617
1008
- #, php-format
1009
- msgid ""
1010
- "Switch to yearly subscription and <br><strong class=\"imagify-dark\">save %s "
1011
- "per year!</strong>"
1012
- msgstr ""
1013
-
1014
- #: ../inc/functions/admin-ui.php:618
1015
- #, php-format
1016
- msgid ""
1017
- "Perfect!<br>You're <strong class=\"imagify-dark\">saving %s per year!</"
1018
- "strong>"
1019
- msgstr ""
1020
-
1021
- #: ../inc/functions/admin-ui.php:657
1022
- msgid "Thank you for being awesome!"
1023
- msgstr ""
1024
-
1025
- #: ../inc/functions/admin-ui.php:668
1026
- msgid "What do our user think about Imagify"
1027
- msgstr ""
1028
-
1029
- #: ../inc/functions/admin-ui.php:702
1030
- msgid "Secure Credit Card Payment"
1031
- msgstr ""
1032
-
1033
- #: ../inc/functions/admin-ui.php:703
1034
- msgid "This is secure 128-bits SSL encrypted payment"
1035
- msgstr ""
1036
-
1037
- #: ../inc/functions/i18n.php:20
1038
- msgid "Let's get you started!"
1039
- msgstr "Los geht’s!"
1040
-
1041
- #: ../inc/functions/i18n.php:21
1042
- msgid "Enter your email to get an API key:"
1043
- msgstr "Geben Sie Ihre E-Mail-Adresse ein, um einen API-Schlüssel zu erhalten:"
1044
-
1045
- #: ../inc/functions/i18n.php:22
1046
- msgid "Sign Up"
1047
- msgstr "Konto anlegen"
1048
-
1049
- #: ../inc/functions/i18n.php:23
1050
- msgid "You need to specify an email!"
1051
- msgstr "Sie müssen eine E-Mail-Adresse angeben."
1052
-
1053
- #: ../inc/functions/i18n.php:24 ../inc/functions/i18n.php:31
1054
- msgid "Congratulations!"
1055
- msgstr "Glückwunsch!"
1056
-
1057
- #: ../inc/functions/i18n.php:25
1058
- msgid ""
1059
- "Your account has been succesfully created. Please check your mailbox, you "
1060
- "are going to receive an email with API key."
1061
- msgstr ""
1062
- "Ihr Konto ist jetzt angelegt. Überprüfen Sie Ihr E-Mail-Postfach, Sie "
1063
- "erhalten eine E-Mail mit Ihrem API-Schlüssel."
1064
-
1065
- #: ../inc/functions/i18n.php:26
1066
- msgid "Connect to Imagify!"
1067
- msgstr "Verbindung zu Imagify herstellen"
1068
-
1069
- #: ../inc/functions/i18n.php:27
1070
- msgid "Paste your API key below:"
1071
- msgstr "Fügen Sie Ihren API-Schlüssel hier ein:"
1072
-
1073
- #: ../inc/functions/i18n.php:28
1074
- msgid "Connect me"
1075
- msgstr "Verbinden"
1076
-
1077
- #: ../inc/functions/i18n.php:29
1078
- msgid "Check in progress..."
1079
- msgstr "API-Schlüssel wird geprüft…"
1080
-
1081
- #: ../inc/functions/i18n.php:30
1082
- msgid "You need to specify your api key!"
1083
- msgstr "Sie müssen einen API-Schlüssel angeben!"
1084
-
1085
- #: ../inc/functions/i18n.php:32
1086
- msgid ""
1087
- "Your API key is valid. You can now configure the Imagify settings to "
1088
- "optimize your images."
1089
- msgstr ""
1090
- "Ihr API-Schlüssel ist gültig. Sie können jetzt Ihre Einstellungen für die "
1091
- "Bildoptimierung mit Imagify wählen."
1092
-
1093
- #: ../inc/functions/i18n.php:34
1094
- msgid "Cancel"
1095
- msgstr ""
1096
-
1097
- #: ../inc/functions/i18n.php:41
1098
- msgid "Don't Need a Parachute?"
1099
- msgstr "Sie brauchen keinen Fallschirm?"
1100
-
1101
- #: ../inc/functions/i18n.php:42
1102
- msgid ""
1103
- "If you keep this option deactivated, you won't be able to re-optimize your "
1104
- "images to another compression level and restore your original images in case "
1105
- "of need."
1106
- msgstr ""
1107
- "Wenn Sie diese Option deaktiviert lassen, werden Sie Ihre Bilder nicht "
1108
- "erneut mit einem anderen Level komprimieren, oder deren Originale "
1109
- "wiederherstellen können."
1110
-
1111
- #: ../inc/functions/i18n.php:58
1112
- msgid "Original Image"
1113
- msgstr "Originalbild"
1114
-
1115
- #: ../inc/functions/i18n.php:59
1116
- msgid "Optimized Image"
1117
- msgstr "Optimiertes Bild"
1118
-
1119
- #: ../inc/functions/i18n.php:73
1120
- msgid "Please wait..."
1121
- msgstr "Einen Moment bitte&#160;…"
1122
-
1123
- #: ../inc/functions/i18n.php:74
1124
- msgid ""
1125
- "We are trying to get your unoptimized images, it may take time depending on "
1126
- "the number of images."
1127
- msgstr ""
1128
- "Nicht optimierte Bilder werden gesammelt, dies kann einen Moment dauern&#160;"
1129
- "…"
1130
-
1131
- #: ../inc/functions/i18n.php:76
1132
- msgid "Oops, There is something wrong!"
1133
- msgstr "Hm, etwas ist schief gelaufen."
1134
-
1135
- #: ../inc/functions/i18n.php:77
1136
- msgid ""
1137
- "An unknow error occurred when we tried to get all your unoptimized images. "
1138
- "Try again and if the issue still persist, please contact us!"
1139
- msgstr ""
1140
- "Ein unbekannter Fehler ist beim Sammeln der nicht optimierten Bilder "
1141
- "aufgetreten. Versuchen Sie es noch einmal; falls der Fehler sich wiederholt, "
1142
- "kontaktieren Sie bitte den Imagify-Support."
1143
-
1144
- #: ../inc/functions/i18n.php:82
1145
- msgid "Error"
1146
- msgstr "Fehler"
1147
-
1148
- #: ../inc/functions/i18n.php:85
1149
- msgid "Hold on!"
1150
- msgstr "Moment, bitte!"
1151
-
1152
- #: ../inc/functions/i18n.php:86
1153
- msgid "All your images have been optimized by Imagify. Congratulations!"
1154
- msgstr "Imagify hat alle Ihre Bilder optimiert. Glückwunsch!"
1155
-
1156
- #: ../inc/functions/i18n.php:88
1157
- #, php-format
1158
- msgid ""
1159
- "Discover @imagify, the new compression tool to optimize your images for "
1160
- "free. I saved %1$s out of %2$s!"
1161
- msgstr ""
1162
- "Freies #WordPress #Plugin zur Bildoptimierung für bessere #Performance: "
1163
- "Bilder mit @imagify komprimiert, %1$s von %2$s gespart!"
1164
-
1165
- #: ../inc/functions/i18n.php:92
1166
- msgid "Imagify is still processing. Are you sure you want to leave this page?"
1167
- msgstr ""
1168
- "Imagify arbeitet noch. Möchten Sie diese Seite wirklich verlassen und den "
1169
- "Prozess abbrechen?"
1170
-
1171
- #: ../inc/functions/i18n.php:101
1172
- msgid "F j, Y"
1173
- msgstr "j. F Y"
1174
-
1175
- #: ../inc/functions/process.php:40
1176
- msgid ""
1177
- "Sorry, our servers are temporarily unaccessible. Please, try again in a "
1178
- "couple of minutes."
1179
- msgstr ""
1180
- "Unsere Server sind leider im Augenblick nicht erreichbar. Bitte versuchen "
1181
- "Sie es in ein paar Minuten noch einmal."
1182
-
1183
- #: ../inc/functions/process.php:46
1184
- msgid "External HTTP requests are blocked"
1185
- msgstr "Externe HTTP-Anfragen werden blockiert"
1186
-
1187
- #: ../inc/functions/process.php:52
1188
- msgid "File path is empty"
1189
- msgstr "Datei-Pfad ist leer"
1190
-
1191
- #: ../inc/functions/process.php:58
1192
- #, php-format
1193
- msgid "Could not find %s"
1194
- msgstr "%s wurde nicht gefunden"
1195
-
1196
- #: ../inc/functions/process.php:63
1197
- #, php-format
1198
- msgid "%s is not writable"
1199
- msgstr "%s ist nicht beschreibbar."
1200
-
1201
- #: ../inc/functions/process.php:72
1202
- #, php-format
1203
- msgid "Skipped (%s), image not found."
1204
- msgstr "Übersprungen (%s), Bild nicht gefunden."
1205
-
1206
- #~ msgid "https://wordpress.org/plugins/imagify"
1207
- #~ msgstr "https://de.wordpress.org/plugins/imagify"
1208
-
1209
- #~ msgid ""
1210
- #~ "Dramaticaly reduce image file sizes without loosing quality, make your "
1211
- #~ "website load faster, boost your SEO and save money on your bandwith using "
1212
- #~ "Imagify, the new most advanced image optimization tool."
1213
- #~ msgstr ""
1214
- #~ "Verlustfreie Bildoptimierung für WordPress. Imagify reduziert dramatisch "
1215
- #~ "die Dateigröße deiner Bilder, macht Ihre Website schneller, verbessert "
1216
- #~ "Ihre SEO und spart Bandbreite."
1217
-
1218
- #~ msgid "Your default setting:"
1219
- #~ msgstr "Ihre Standard-Einstellung:"
1220
-
1221
- #~ msgid ""
1222
- #~ "All images which are over to %s could be optimized using the pro version."
1223
- #~ msgstr "Bilder größer als %s können mit der Pro-version optimiert werden."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/imagify-es_ES.mo DELETED
Binary file
languages/imagify-es_ES.po DELETED
@@ -1,1228 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Imagify\n"
4
- "POT-Creation-Date: 2016-09-23 10:03-0500\n"
5
- "PO-Revision-Date: 2016-09-23 11:02-0500\n"
6
- "Last-Translator: Rémy Perona <remperona@gmail.com>\n"
7
- "Language-Team: \n"
8
- "Language: es\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.6.4\n"
13
- "X-Poedit-Basepath: ..\n"
14
- "X-Poedit-WPHeader: imagify.php\n"
15
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
- "X-Poedit-SourceCharset: UTF-8\n"
17
- "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
18
- "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
19
- "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
20
- "X-Poedit-SearchPathExcluded-0: *.js\n"
21
- "X-Poedit-SearchPath-0: .\n"
22
-
23
- #: inc/3rd-party/nextgen-gallery/inc/admin/enqueue.php:20
24
- #: inc/admin/ajax.php:123 inc/admin/meta-boxes.php:34
25
- #: inc/functions/admin-ui.php:215 inc/functions/i18n.php:49
26
- #: inc/functions/i18n.php:64
27
- msgid "Optimize"
28
- msgstr "Optimizar"
29
-
30
- #: inc/3rd-party/nextgen-gallery/inc/admin/enqueue.php:21
31
- #: inc/functions/admin-ui.php:80 inc/functions/i18n.php:50
32
- msgid "Restore Original"
33
- msgstr "Recuperar tamaño original"
34
-
35
- #: inc/3rd-party/nextgen-gallery/inc/admin/menu.php:16 inc/admin/menu.php:24
36
- #: inc/admin/plugins.php:13 inc/admin/ui/bulk.php:81
37
- #: inc/common/admin-bar.php:39
38
- msgid "Bulk Optimization"
39
- msgstr "Optimización masiva"
40
-
41
- #: inc/admin/ajax.php:123 inc/admin/meta-boxes.php:29
42
- #: inc/functions/admin-ui.php:121 inc/functions/admin-ui.php:153
43
- #: inc/functions/admin-ui.php:159 inc/functions/admin-ui.php:165
44
- #: inc/functions/admin-ui.php:205 inc/functions/admin-ui.php:215
45
- msgid "Optimizing..."
46
- msgstr "Optimizando…"
47
-
48
- #: inc/admin/ajax.php:507
49
- msgid "Oops, It's almost over!"
50
- msgstr "¡Ya casi está!"
51
-
52
- #: inc/admin/ajax.php:508
53
- #, php-format
54
- msgid ""
55
- "You have almost used all your credit.%sDon't forget to upgrade your "
56
- "subscription to continue optimizing your images."
57
- msgstr ""
58
- "Ya has utilizado casi todo tu crédito.%sNo olvides ampliar tu suscripción "
59
- "para poder seguir optimizando tus imágenes."
60
-
61
- #: inc/admin/ajax.php:509 inc/admin/ui/bulk.php:23
62
- msgid "View My Subscription"
63
- msgstr "Ver mi suscripción"
64
-
65
- #: inc/admin/ajax.php:517 inc/admin/ui/notices.php:258
66
- #: inc/functions/i18n.php:84
67
- msgid "Oops, It's Over!"
68
- msgstr "¡Ya está!"
69
-
70
- #: inc/admin/ajax.php:518 inc/admin/ui/notices.php:260
71
- #: inc/functions/i18n.php:101
72
- #, php-format
73
- msgid ""
74
- "You have consumed all your credit for this month. You will have <strong>%s "
75
- "back on %s</strong>."
76
- msgstr ""
77
- "Has consumido todo tu crédito para este mes. Volverás a tener <strong>%s el "
78
- "%s</strong>."
79
-
80
- #: inc/admin/ajax.php:519
81
- msgid "Upgrade My Subscription"
82
- msgstr "Actualizar mi suscripción"
83
-
84
- #: inc/admin/ajax.php:538 inc/admin/ui/bulk.php:17
85
- msgid "Account status"
86
- msgstr "Estado de mi cuenta"
87
-
88
- #: inc/admin/ajax.php:539 inc/admin/ui/bulk.php:18
89
- msgid "Your subscription:"
90
- msgstr "Tu suscripción:"
91
-
92
- #: inc/admin/ajax.php:547 inc/admin/ui/bulk.php:48
93
- #, php-format
94
- msgid "You have %s space credit left"
95
- msgstr "Te queda un saldo de %s"
96
-
97
- #: inc/admin/ajax.php:559
98
- msgid "View my subscription"
99
- msgstr "Ver mi suscripción"
100
-
101
- #: inc/admin/media.php:63 inc/functions/i18n.php:60
102
- msgid "Compare Original VS Optimized"
103
- msgstr "Compara original VS optimizada"
104
-
105
- #: inc/admin/meta-boxes.php:17 inc/admin/meta-boxes.php:24
106
- #: inc/admin/upload.php:12
107
- msgid "Imagify"
108
- msgstr "Imagify"
109
-
110
- #: inc/admin/meta-boxes.php:19 inc/functions/admin-ui.php:195
111
- msgid "Invalid API key"
112
- msgstr "Clave API no válida"
113
-
114
- #: inc/admin/meta-boxes.php:21 inc/functions/admin-ui.php:197
115
- msgid "Check your Settings"
116
- msgstr "Comprueba tu configuración"
117
-
118
- #: inc/admin/options.php:119
119
- msgid "Cheatin&#8217; uh?"
120
- msgstr "Haciendo trampa ¿Uh?"
121
-
122
- #: inc/admin/options.php:127
123
- msgid "<strong>ERROR</strong>: options page not found."
124
- msgstr "<strong>ERROR</strong>: página de opciones no encontrada."
125
-
126
- #: inc/admin/plugins.php:14 inc/admin/ui/options.php:74
127
- #: inc/common/admin-bar.php:30
128
- msgid "Settings"
129
- msgstr "Configuración"
130
-
131
- #: inc/admin/ui/bulk.php:60
132
- msgid "Upgrade your account to continue optimizing your images"
133
- msgstr "Actualiza tu cuenta para seguir optimizando tus imágenes"
134
-
135
- #: inc/admin/ui/bulk.php:64
136
- msgid "More info"
137
- msgstr "Más info"
138
-
139
- #: inc/admin/ui/bulk.php:91
140
- msgid "Overview"
141
- msgstr "Resumen"
142
-
143
- #: inc/admin/ui/bulk.php:99
144
- #, php-format
145
- msgid "You optimized %s images of your website"
146
- msgstr "Has optimizado el %s de imágenes de tu sitio"
147
-
148
- #: inc/admin/ui/bulk.php:103
149
- msgid "Statistics"
150
- msgstr "Estadísticas"
151
-
152
- #: inc/admin/ui/bulk.php:115
153
- msgid "that's the number of images you optimized with Imagify"
154
- msgstr "este es el número de imágenes que has optimizado con Imagify"
155
-
156
- #: inc/admin/ui/bulk.php:120
157
- msgid "Original size"
158
- msgstr "Tamaño original"
159
-
160
- #: inc/admin/ui/bulk.php:125
161
- msgid "Optimized size"
162
- msgstr "Tamaño optimizado"
163
-
164
- #: inc/admin/ui/bulk.php:136
165
- #, php-format
166
- msgid "that's the size you saved %sby using Imagify"
167
- msgstr "este es el tamaño que ahorraste %scon Imagify"
168
-
169
- #: inc/admin/ui/bulk.php:142
170
- msgid "Information"
171
- msgstr "Información"
172
-
173
- #: inc/admin/ui/bulk.php:146
174
- msgid ""
175
- "Please be aware that optimizing a large number of images can take a while "
176
- "depending on your server and network speed."
177
- msgstr ""
178
- "Por favor ten en cuenta que la optimización de un gran número de imágenes "
179
- "puede demorar un poco según tu servidor y la velocidad de tu red."
180
-
181
- #: inc/admin/ui/bulk.php:149
182
- #, php-format
183
- msgid ""
184
- "If you have more than %s images, you will need to launch the bulk "
185
- "optimization several times."
186
- msgstr ""
187
- "Si tienes más de %s imágenes, necesitarás lanzar el proceso de optimización "
188
- "masiva varias veces."
189
-
190
- #: inc/admin/ui/bulk.php:153
191
- msgid ""
192
- "You must keep this page open while the bulk optimizaton is processing. If "
193
- "you leave you can come back to continue where it left off."
194
- msgstr ""
195
- "Tienes que mantener esta página abierta durante la optimización masiva. Si "
196
- "la abandonas, siempre puedes volver y retomarla donde la hayas dejado."
197
-
198
- #: inc/admin/ui/bulk.php:164
199
- msgid "Select Your Compression Level"
200
- msgstr "Selecciona tu nivel de compresión"
201
-
202
- #: inc/admin/ui/bulk.php:166 inc/admin/ui/bulk.php:192
203
- #: inc/admin/ui/options.php:136 inc/admin/ui/options.php:365
204
- #: inc/admin/ui/options.php:404 inc/admin/ui/options.php:421
205
- #: inc/admin/ui/options.php:481
206
- #: inc/classes/abstracts/abstract-attachment.php:114
207
- #: inc/functions/admin-ui.php:153
208
- msgid "Ultra"
209
- msgstr "Ultra"
210
-
211
- #: inc/admin/ui/bulk.php:169 inc/admin/ui/bulk.php:187
212
- #: inc/admin/ui/options.php:131 inc/admin/ui/options.php:352
213
- #: inc/admin/ui/options.php:403 inc/admin/ui/options.php:416
214
- #: inc/admin/ui/options.php:460
215
- #: inc/classes/abstracts/abstract-attachment.php:117
216
- #: inc/functions/admin-ui.php:159
217
- msgid "Aggressive"
218
- msgstr "Agresivo"
219
-
220
- #: inc/admin/ui/bulk.php:172 inc/admin/ui/bulk.php:182
221
- #: inc/admin/ui/options.php:126 inc/admin/ui/options.php:339
222
- #: inc/admin/ui/options.php:402 inc/admin/ui/options.php:411
223
- #: inc/admin/ui/options.php:440
224
- #: inc/classes/abstracts/abstract-attachment.php:120
225
- #: inc/functions/admin-ui.php:165
226
- msgid "Normal"
227
- msgstr "Normal"
228
-
229
- #: inc/admin/ui/bulk.php:176
230
- #, php-format
231
- msgid "Your default setting: %s"
232
- msgstr "Tus ajustes por defecto: %s"
233
-
234
- #: inc/admin/ui/bulk.php:201
235
- #, php-format
236
- msgid "Don't forget to check %syour settings%s before bulk optimization."
237
- msgstr "No olvides revisar %stus ajustes%s antes de la optimización masiva."
238
-
239
- #: inc/admin/ui/bulk.php:208
240
- msgid "Let's go!"
241
- msgstr "¡Vamos!"
242
-
243
- #: inc/admin/ui/bulk.php:215
244
- msgid "Imagif'em all"
245
- msgstr "Imagíficalo todo"
246
-
247
- #: inc/admin/ui/bulk.php:220
248
- #, php-format
249
- msgid "All images greater than %s will be optimized when using a paid plan."
250
- msgstr ""
251
- "Todas las imágenes superiores a %s se pueden optimizar usando un plan de pago"
252
-
253
- #: inc/admin/ui/bulk.php:239
254
- msgid "Well done!"
255
- msgstr "¡Bien hecho!"
256
-
257
- #: inc/admin/ui/bulk.php:240
258
- #, php-format
259
- msgid "you saved %1$s out of %2$s"
260
- msgstr "has ahorrado %1$s de %2$s"
261
-
262
- #: inc/admin/ui/bulk.php:245
263
- msgid "Share your awesome result"
264
- msgstr "Comparte tus impresionantes resultados"
265
-
266
- #: inc/admin/ui/bulk.php:260
267
- msgid "Compression process results"
268
- msgstr "Resultados del proceso de compresión"
269
-
270
- #: inc/admin/ui/bulk.php:263
271
- msgid "Filename"
272
- msgstr "Nombre de archivo"
273
-
274
- #: inc/admin/ui/bulk.php:264
275
- msgid "Status"
276
- msgstr "Estado"
277
-
278
- #: inc/admin/ui/bulk.php:265 inc/admin/ui/options.php:401
279
- #: inc/admin/ui/options.php:406 inc/admin/ui/options.php:430
280
- msgid "Original"
281
- msgstr "Original"
282
-
283
- #: inc/admin/ui/bulk.php:266 inc/admin/upload.php:41 inc/functions/i18n.php:80
284
- msgid "Optimized"
285
- msgstr "Optimizado"
286
-
287
- #: inc/admin/ui/bulk.php:267
288
- msgid "Percentage"
289
- msgstr "Porcentaje"
290
-
291
- #: inc/admin/ui/bulk.php:268
292
- msgid "Thumbnails optimized"
293
- msgstr "Miniaturas optimizadas:"
294
-
295
- #: inc/admin/ui/bulk.php:269
296
- msgid "Overall saving"
297
- msgstr "Ahorro total"
298
-
299
- #: inc/admin/ui/bulk.php:274
300
- msgid "file"
301
- msgstr "archivo"
302
-
303
- #: inc/admin/ui/bulk.php:275
304
- msgid "error"
305
- msgstr "error"
306
-
307
- #: inc/admin/ui/bulk.php:276
308
- msgid "Total:"
309
- msgstr "Total:"
310
-
311
- #: inc/admin/ui/bulk.php:277
312
- msgid "Gain:"
313
- msgstr "Ganancia:"
314
-
315
- #: inc/admin/ui/bulk.php:294
316
- #, php-format
317
- msgid "%sStart the bulk optimization%s"
318
- msgstr "%sEmpieza la optimización masiva%s"
319
-
320
- #: inc/admin/ui/notices.php:24
321
- msgid "Welcome to Imagify, the best way to easily optimize your images!"
322
- msgstr ""
323
- "¡Bienvenido a Imagify, la mejor manera de optimizar fácilmente tus imágenes!"
324
-
325
- #: inc/admin/ui/notices.php:26 inc/admin/ui/notices.php:92
326
- #: inc/admin/ui/notices.php:186 inc/admin/ui/notices.php:223
327
- #: inc/admin/ui/notices.php:263 inc/admin/ui/notices.php:370
328
- msgid "Dismiss this notice"
329
- msgstr "Descarta este aviso"
330
-
331
- #: inc/admin/ui/notices.php:33
332
- msgid "Create an Account"
333
- msgstr "Crea una cuenta"
334
-
335
- #: inc/admin/ui/notices.php:34
336
- msgid ""
337
- "Don't have an Imagify account yet? Optimize your images by creating an "
338
- "account in a few seconds!"
339
- msgstr ""
340
- "¿Todavía no tienes una cuenta Imagify? Optimiza tus imágenes creando una "
341
- "cuenta en unos segundos!"
342
-
343
- #: inc/admin/ui/notices.php:37
344
- msgid "Sign up, It's FREE!"
345
- msgstr "Regístrate, ¡es GRATIS!"
346
-
347
- #: inc/admin/ui/notices.php:43
348
- msgid "Enter your API Key"
349
- msgstr "Ingresa tu clave API"
350
-
351
- #: inc/admin/ui/notices.php:44
352
- #, php-format
353
- msgid ""
354
- "Save your API Key you have received by email or you can get it on your "
355
- "%sImagify account page%s."
356
- msgstr ""
357
- "Guarda la clave API que has recibido por email, o consigue una en tu "
358
- "%spágina de cuenta Imagify%s."
359
-
360
- #: inc/admin/ui/notices.php:47
361
- msgid "I have my API key"
362
- msgstr "Tengo mi clave API"
363
-
364
- #: inc/admin/ui/notices.php:53
365
- msgid "Configure it"
366
- msgstr "Configuralo"
367
-
368
- #: inc/admin/ui/notices.php:54
369
- msgid ""
370
- "It’s almost done! You have just to configure your optimization settings."
371
- msgstr ""
372
- "¡Casi está listo! Sólo te queda configurar tus ajustes de optimización."
373
-
374
- #: inc/admin/ui/notices.php:55
375
- msgid "Go to Settings"
376
- msgstr "Ve a la configuración"
377
-
378
- #: inc/admin/ui/notices.php:87 inc/admin/ui/options.php:97
379
- #: inc/functions/i18n.php:78
380
- msgid "Your API key isn't valid!"
381
- msgstr "¡Tu clave API no es válida!"
382
-
383
- #: inc/admin/ui/notices.php:90
384
- #, php-format
385
- msgid ""
386
- "Go to your Imagify account page to get your API Key and specify it on "
387
- "%1$syour settings%3$s or %2$screate an account for free%3$s if you don't "
388
- "have one yet."
389
- msgstr ""
390
- "Ve a la página de tu cuenta Imagify para obtener la clave API y especifícala "
391
- "en %1$stu configuración%3$s; si todavía no la tienes, %2$screa ahora una "
392
- "cuenta gratuita%3$s."
393
-
394
- #: inc/admin/ui/notices.php:142
395
- msgid ""
396
- "The following plugins are not compatible with this plugin and may cause "
397
- "unexpected results:"
398
- msgstr ""
399
- "Los plugin siguientes no son compatibles con este plugin y pueden causar "
400
- "resultados inesperados:"
401
-
402
- #: inc/admin/ui/notices.php:148
403
- msgid "Deactivate"
404
- msgstr "Desactiva"
405
-
406
- #: inc/admin/ui/notices.php:178
407
- msgid "The external HTTP requests are blocked!"
408
- msgstr "¡Las solicitudes HTTP externas están bloqueadas!"
409
-
410
- #: inc/admin/ui/notices.php:179
411
- msgid ""
412
- "You defined the <code>WP_HTTP_BLOCK_EXTERNAL</code> constant in the <code>wp-"
413
- "config.php</code> to block all external HTTP requests."
414
- msgstr ""
415
- "Has definido la constante <code>WP_HTTP_BLOCK_EXTERNAL</code> en <code>wp-"
416
- "config.php</code> para bloquear las solicitudes HTTP externas."
417
-
418
- #: inc/admin/ui/notices.php:181
419
- msgid ""
420
- "To optimize your images, you have to put the following code in your <code>wp-"
421
- "config.php</code> file so that it works correctly."
422
- msgstr ""
423
- "Para optimizar tus imágenes, tienes que poner el siguiente código en tu "
424
- "archivo <code>wp-config.php</code> para que funcione correctamente."
425
-
426
- #: inc/admin/ui/notices.php:182
427
- msgid "Click on the field and press Ctrl-A to select all."
428
- msgstr "Haz clic en el campo y pulse Ctrl-A para seleccionar todo."
429
-
430
- #: inc/admin/ui/notices.php:219
431
- msgid "You're missing out!"
432
- msgstr "¡Te lo estás perdiendo!"
433
-
434
- #: inc/admin/ui/notices.php:220
435
- msgid "Use the List view to optimize images with Imagify."
436
- msgstr "Utiliza la vista de lista para optimizar imágenes con Imagify."
437
-
438
- #: inc/admin/ui/notices.php:221
439
- msgid "Switch to the List View"
440
- msgstr "Cambia a la vista de lista"
441
-
442
- #: inc/admin/ui/notices.php:260 inc/functions/i18n.php:98
443
- #: inc/functions/i18n.php:101
444
- #, php-format
445
- msgid ""
446
- "To continue to optimize your images, log in to your Imagify account to %sbuy "
447
- "a pack or subscribe to a plan%s."
448
- msgstr ""
449
- "Para seguir optimizando tus imágenes, inicia sesión en tu cuenta Imagify "
450
- "para %scomprar un paquete o subscribir un plan %s."
451
-
452
- #: inc/admin/ui/notices.php:314 inc/admin/ui/options.php:28
453
- msgid "Discover the best caching plugin to speed up your website."
454
- msgstr "Descubre el mejor plugin de caché para acelerar tu sitio Web."
455
-
456
- #: inc/admin/ui/notices.php:317 inc/admin/ui/options.php:36
457
- #, php-format
458
- msgid "%sGet %s off%s with this coupon code:%s"
459
- msgstr "Descuento del %s%s%s con este código de coupon:%s"
460
-
461
- #: inc/admin/ui/notices.php:326 inc/admin/ui/options.php:41
462
- msgid "Get WP Rocket now"
463
- msgstr "Obten WP Rocket, ¡ya!"
464
-
465
- #: inc/admin/ui/notices.php:363
466
- #, php-format
467
- msgid ""
468
- "%1$sCongratulations%2$s, you have optimized %1$s%3$d images%2$s and improved "
469
- "your website's speed by reducing your images size."
470
- msgstr ""
471
- "%1$s¡En hora buena!%2$s Has optimizado %1$s%3$d imágenes%2$s y ahora tu "
472
- "sitio web es más rápido."
473
-
474
- #: inc/admin/ui/notices.php:365 inc/admin/ui/options.php:59
475
- #, php-format
476
- msgid ""
477
- "%sDo you like this plugin?%s Please take a few seconds to %srate it on "
478
- "WordPress.org%s!"
479
- msgstr ""
480
- "%sTe gusta este plugin?%s Por favor tomate unos segundos para %svalorarlo en "
481
- "WordPress.org%s!"
482
-
483
- #: inc/admin/ui/options.php:22
484
- msgid "Is your website too slow?"
485
- msgstr "¿Tu sitio web es muy lento?"
486
-
487
- #: inc/admin/ui/options.php:84
488
- msgid "API Key"
489
- msgstr "Clave API"
490
-
491
- #: inc/admin/ui/options.php:91 inc/functions/i18n.php:33
492
- msgid "Your API key is valid."
493
- msgstr "Tu clave API es válida."
494
-
495
- #: inc/admin/ui/options.php:104
496
- #, php-format
497
- msgid "Don't have an API Key yet? %sCreate one, it's FREE%s."
498
- msgstr "¿Todavía no tienes una clave API? %sCréate una, es GRATIS%s."
499
-
500
- #: inc/admin/ui/options.php:121
501
- msgid "Optimization Level"
502
- msgstr "Nivel de optimización"
503
-
504
- #: inc/admin/ui/options.php:141
505
- msgid "More info?"
506
- msgstr "Más Info?"
507
-
508
- #: inc/admin/ui/options.php:148
509
- #, php-format
510
- msgid "Need help to choose? %sTry the Visual Comparison%s"
511
- msgstr "¿Necesita ayuda para elegir? %sPrueba la comparación visual%s"
512
-
513
- #: inc/admin/ui/options.php:157 inc/admin/ui/options.php:161
514
- msgid "Auto-Optimize images on upload"
515
- msgstr "Optimización automática de imágenes en carga"
516
-
517
- #: inc/admin/ui/options.php:165
518
- msgid "Automatically optimize every image you upload to WordPress."
519
- msgstr "Optimiza automáticamente cada imagen que subas a Wordpress."
520
-
521
- #: inc/admin/ui/options.php:170 inc/admin/ui/options.php:173
522
- msgid "Backup original images"
523
- msgstr "Backup de las imágenes originales"
524
-
525
- #: inc/admin/ui/options.php:177
526
- msgid ""
527
- "Keep your original images in a separate folder before optimization process."
528
- msgstr ""
529
- "Mantén tus imágenes originales en una carpeta separada antes del proceso de "
530
- "optimización."
531
-
532
- #: inc/admin/ui/options.php:182 inc/admin/ui/options.php:185
533
- msgid "Resize larger images"
534
- msgstr "Reduce las imágenes más grandes"
535
-
536
- #: inc/admin/ui/options.php:191
537
- #, php-format
538
- msgid "to maximum %s pixels width"
539
- msgstr "a una anchura máxima de %s pixel"
540
-
541
- #: inc/admin/ui/options.php:202
542
- #, php-format
543
- msgid ""
544
- "This option is recommended to reduce larger images. You can save up to 80%% "
545
- "after resizing. The new width should not be less than your largest thumbnail "
546
- "width, which is actually %spx."
547
- msgstr ""
548
- "Esta opción está recomendada para reducir las imágenes más grandes. Puedes "
549
- "ahorrar hasta el 80%% después de la reducción de tamaño. El nuevo ancho no "
550
- "debería ser menor que el ancho de tu miniatura más grande, que actualmente "
551
- "es de %spx."
552
-
553
- #: inc/admin/ui/options.php:209 inc/admin/ui/options.php:212
554
- msgid "EXIF Data"
555
- msgstr "Datos EXIF"
556
-
557
- #: inc/admin/ui/options.php:216
558
- msgid ""
559
- "Keep all EXIF data from your images. EXIF are informations stored in your "
560
- "pictures like shutter speed, exposure compensation, ISO, etc..."
561
- msgstr ""
562
- "Mantén todos los datos EXIF de tus imágenes. El EXIF es la información "
563
- "almacenada en tus imágenes, por ejemplo la velocidad de obturación, "
564
- "compensación de exposición, ISO, etc…."
565
-
566
- #: inc/admin/ui/options.php:217
567
- msgid "Learn more"
568
- msgstr "Descubre más"
569
-
570
- #: inc/admin/ui/options.php:219
571
- msgid ""
572
- "If you are a photographer, you may be interested in this option if you are "
573
- "displaying on your pages some info like the model of your camera."
574
- msgstr ""
575
- "Si eres un fotógrafo, puedes estar interesado en esta opción si quieres "
576
- "enseñar en tus páginas alguna info, por ejemplo el modelo de tu cámara."
577
-
578
- #: inc/admin/ui/options.php:228
579
- msgid "Files optimization"
580
- msgstr "Optimización de archivos"
581
-
582
- #: inc/admin/ui/options.php:231
583
- msgid ""
584
- "You can choose to compress different image sizes created by WordPress here."
585
- msgstr ""
586
- "Aquí puedes elegir de comprimir los diferentes tamaños de imagen creados por "
587
- "WordPress."
588
-
589
- #: inc/admin/ui/options.php:233
590
- #, php-format
591
- msgid "The %soriginal size%s is %sautomatically optimized%s by Imagify."
592
- msgstr "El %stamaño original%s es %soptimizado automáticamente%s por Imagify."
593
-
594
- #: inc/admin/ui/options.php:236
595
- msgid ""
596
- "Remember each additional image size will affect your Imagify monthly usage!"
597
- msgstr ""
598
- "Recuerda que cada tamaño adicional de imagen afectará tu consumo mensual de "
599
- "Imagify!"
600
-
601
- #: inc/admin/ui/options.php:289
602
- msgid "Display options"
603
- msgstr "Mostrar las opciones"
604
-
605
- #: inc/admin/ui/options.php:294 inc/admin/ui/options.php:299
606
- msgid "Show Admin Bar menu"
607
- msgstr "Mostrar la barra de administrador"
608
-
609
- #: inc/admin/ui/options.php:300
610
- msgid "I want this awesome quick access menu on my admin bar."
611
- msgstr ""
612
- "Quiero este fantástico menú de acceso rápido en mi barra de administrador."
613
-
614
- #: inc/admin/ui/options.php:319
615
- msgid "Save &amp; Go to Bulk Optimizer"
616
- msgstr "Guarda &amp; Ve a la optimización masiva"
617
-
618
- #: inc/admin/ui/options.php:328
619
- #, php-format
620
- msgid ""
621
- "Once your settings saved, optimize all your images by using the %sImagify "
622
- "Bulk Optimization%s feature."
623
- msgstr ""
624
- "Una vez guardada la configuración, optimiza tus imágenes usando la función "
625
- "de %soptimización masiva de Imagify%s."
626
-
627
- #: inc/admin/ui/options.php:336
628
- msgid "You can choose three levels of compression"
629
- msgstr "Puedes elegir entre tres niveles de compresión"
630
-
631
- #: inc/admin/ui/options.php:341
632
- msgid ""
633
- "This mode provides lossless optimization, your images will be optimized "
634
- "without any visible change."
635
- msgstr ""
636
- "Este modo proporciona una optimización sin pérdidas: tus imágenes serán "
637
- "optimizadas sin ningún cambio perceptible."
638
-
639
- #: inc/admin/ui/options.php:344
640
- msgid ""
641
- "If you want the perfect quality for your images, we recommend you that mode."
642
- msgstr ""
643
- "Si deseas calidad perfecta para tus imágenes, te recomendamos este modo."
644
-
645
- #: inc/admin/ui/options.php:347
646
- msgid ""
647
- "Note: the file size reduction will be less, compared to aggressive mode."
648
- msgstr ""
649
- "Nota: la reducción de tamaño del archivo será inferior, si comparado con el "
650
- "modo agresivo."
651
-
652
- #: inc/admin/ui/options.php:354
653
- msgid ""
654
- "This mode provides perfect optimization of your images without any "
655
- "significant quality loss."
656
- msgstr ""
657
- "Este modo proporciona la perfecta optimización de tus imágenes sin pérdida "
658
- "significativa de calidad."
659
-
660
- #: inc/admin/ui/options.php:357
661
- msgid ""
662
- "This will provide a drastic savings on the initial weight, with a small "
663
- "reduction in image quality. Most of the time it's not even noticeable."
664
- msgstr ""
665
- "Esto proporcionará un ahorro drástico en el peso inicial, y una pequeña "
666
- "reducción de la calidad de imagen. La mayoría de las veces no será ni "
667
- "perceptible."
668
-
669
- #: inc/admin/ui/options.php:360
670
- msgid "If you want the maximum weight reduction, we recommend using this mode."
671
- msgstr "Te recomendamos usar este modo si deseas la máxima reducción de peso."
672
-
673
- #: inc/admin/ui/options.php:367
674
- msgid ""
675
- "This mode will apply all available optimizations for maximum image "
676
- "compression."
677
- msgstr ""
678
- "Este modo aplicará todas las optimizaciones disponibles, para una máxima "
679
- "compresión de imagen."
680
-
681
- #: inc/admin/ui/options.php:370
682
- msgid ""
683
- "This will provide a huge savings on the initial weight. Sometimes the image "
684
- "quality could be degraded a little."
685
- msgstr ""
686
- "Esto proporcionará un gran ahorro en el peso inicial. A veces la calidad de "
687
- "la imagen podría disminuir un poco."
688
-
689
- #: inc/admin/ui/options.php:373
690
- msgid ""
691
- "If you want the maximum weight reduction, and you agree to lose some quality "
692
- "on the images we recommend using this mode."
693
- msgstr ""
694
- "Te recomendamos usar este modo si deseas la máxima reducción de peso y "
695
- "aceptas perder algo de calidad en las imágenes."
696
-
697
- #: inc/admin/ui/options.php:380 inc/admin/ui/options.php:502
698
- #: inc/functions/admin-ui.php:662 inc/functions/i18n.php:61
699
- msgid "Close"
700
- msgstr "Cierra"
701
-
702
- #: inc/admin/ui/options.php:392
703
- #, php-format
704
- msgid "I want to compare%s and%s"
705
- msgstr "Quiero comparar %s y %s"
706
-
707
- #: inc/admin/ui/options.php:409
708
- #, php-format
709
- msgid "Original photography about %s"
710
- msgstr "Fotografía original de %s"
711
-
712
- #: inc/admin/ui/options.php:414 inc/admin/ui/options.php:419
713
- #: inc/admin/ui/options.php:424
714
- #, php-format
715
- msgid "Optimized photography about %s"
716
- msgstr "Fotografía optimizada de %s"
717
-
718
- #: inc/admin/ui/options.php:429 inc/admin/ui/options.php:439
719
- #: inc/admin/ui/options.php:459 inc/admin/ui/options.php:480
720
- #: inc/functions/admin-ui.php:59
721
- msgid "Level:"
722
- msgstr "Nivel:"
723
-
724
- #: inc/admin/ui/options.php:433 inc/admin/ui/options.php:443
725
- #: inc/admin/ui/options.php:463 inc/admin/ui/options.php:484
726
- #: inc/functions/i18n.php:62
727
- msgid "File Size:"
728
- msgstr "Tamaño del archivo:"
729
-
730
- #: inc/admin/ui/options.php:447 inc/admin/ui/options.php:467
731
- #: inc/admin/ui/options.php:488 inc/functions/admin-ui.php:45
732
- #: inc/functions/i18n.php:63
733
- msgid "Original Saving:"
734
- msgstr "Ahorro inicial:"
735
-
736
- #: inc/admin/upload.php:42 inc/functions/i18n.php:81
737
- msgid "Unoptimized"
738
- msgstr "No optimizado"
739
-
740
- #: inc/admin/upload.php:43
741
- msgid "Errors"
742
- msgstr "Errores"
743
-
744
- #: inc/admin/upload.php:46
745
- msgid "Filter by status"
746
- msgstr "Filtrar por estado"
747
-
748
- #: inc/admin/upload.php:49
749
- msgid "All images"
750
- msgstr "Todas las imágenes"
751
-
752
- #: inc/classes/class-attachment.php:297
753
- msgid ""
754
- "This size isn't authorized to be optimized. Update your Imagify settings if "
755
- "you want to optimize it."
756
- msgstr ""
757
- "No tienes autorización para optimizar a este tamaño. Actualiza tu "
758
- "configuración de Imagify si quieres optimizarlo."
759
-
760
- #: inc/common/admin-bar.php:48
761
- #, php-format
762
- msgid "Rate Imagify on %s"
763
- msgstr "Valora Imagify en %s"
764
-
765
- #: inc/common/admin-bar.php:61
766
- msgid "Loading..."
767
- msgstr "Cargando…"
768
-
769
- #: inc/functions/admin-ui.php:36
770
- msgid "New Filesize:"
771
- msgstr "Nuevo tamaño del archivo:"
772
-
773
- #: inc/functions/admin-ui.php:52
774
- msgid "Close details"
775
- msgstr "Cerrar detalles"
776
-
777
- #: inc/functions/admin-ui.php:52
778
- msgid "View details"
779
- msgstr "Ver detalles"
780
-
781
- #: inc/functions/admin-ui.php:56
782
- msgid "Original Filesize:"
783
- msgstr "Tamaño inicial:"
784
-
785
- #: inc/functions/admin-ui.php:62
786
- msgid "Thumbnails Optimized:"
787
- msgstr "Miniaturas optimizadas:"
788
-
789
- #: inc/functions/admin-ui.php:63
790
- msgid "Overall Saving:"
791
- msgstr "Ahorro total:"
792
-
793
- #: inc/functions/admin-ui.php:80
794
- msgid "Restoring..."
795
- msgstr "Recuperando…"
796
-
797
- #: inc/functions/admin-ui.php:121
798
- msgid "Try again"
799
- msgstr "Intenta de nuevo"
800
-
801
- #: inc/functions/admin-ui.php:153 inc/functions/admin-ui.php:159
802
- #: inc/functions/admin-ui.php:165
803
- #, php-format
804
- msgid "Re-Optimize to %s"
805
- msgstr "Re-optimiza a %s"
806
-
807
- #: inc/functions/admin-ui.php:189
808
- #, php-format
809
- msgid "%s can't be optimized"
810
- msgstr "%s no puede ser optimizado"
811
-
812
- #: inc/functions/admin-ui.php:240
813
- msgid "What plan do I need?"
814
- msgstr ""
815
-
816
- #: inc/functions/admin-ui.php:244
817
- msgid "You're new to Imagify?"
818
- msgstr ""
819
-
820
- #: inc/functions/admin-ui.php:245
821
- msgid ""
822
- "Let us help you by analyzing your existing images and determinate the best "
823
- "plan for you"
824
- msgstr ""
825
-
826
- #: inc/functions/admin-ui.php:280
827
- msgid "Choose Plan"
828
- msgstr ""
829
-
830
- #: inc/functions/admin-ui.php:281
831
- msgid "Payment Info"
832
- msgstr ""
833
-
834
- #: inc/functions/admin-ui.php:286
835
- msgid "We analysed your images"
836
- msgstr ""
837
-
838
- #: inc/functions/admin-ui.php:292
839
- #, php-format
840
- msgid "You have %s images"
841
- msgstr ""
842
-
843
- #: inc/functions/admin-ui.php:298
844
- #, php-format
845
- msgid "You actually have %s of images in your library."
846
- msgstr ""
847
-
848
- #: inc/functions/admin-ui.php:302
849
- #, php-format
850
- msgid "You upload around %s of images per month."
851
- msgstr ""
852
-
853
- #: inc/functions/admin-ui.php:309
854
- msgid "We recommend you this plan"
855
- msgstr ""
856
-
857
- #: inc/functions/admin-ui.php:314
858
- msgid "Subscribe a monthly plan"
859
- msgstr ""
860
-
861
- #: inc/functions/admin-ui.php:315
862
- msgid "Subscribe a yearly plan"
863
- msgstr ""
864
-
865
- #: inc/functions/admin-ui.php:319 inc/functions/admin-ui.php:455
866
- #: inc/functions/admin-ui.php:623
867
- msgid "Monthly"
868
- msgstr ""
869
-
870
- #: inc/functions/admin-ui.php:322 inc/functions/admin-ui.php:458
871
- #: inc/functions/admin-ui.php:626
872
- msgid "Yearly"
873
- msgstr ""
874
-
875
- #: inc/functions/admin-ui.php:322 inc/functions/admin-ui.php:458
876
- #: inc/functions/admin-ui.php:626
877
- msgid "2 months free"
878
- msgstr ""
879
-
880
- #: inc/functions/admin-ui.php:333 inc/functions/admin-ui.php:352
881
- #: inc/functions/admin-ui.php:468 inc/functions/admin-ui.php:478
882
- msgid "/month"
883
- msgstr ""
884
-
885
- #: inc/functions/admin-ui.php:335 inc/functions/admin-ui.php:383
886
- #: inc/functions/admin-ui.php:470 inc/functions/admin-ui.php:521
887
- #, php-format
888
- msgid "approx: %s images"
889
- msgstr ""
890
-
891
- #: inc/functions/admin-ui.php:356 inc/functions/admin-ui.php:484
892
- #, php-format
893
- msgid ""
894
- "%s per<br>\n"
895
- "additionnal Gb"
896
- msgstr ""
897
-
898
- #: inc/functions/admin-ui.php:361 inc/functions/admin-ui.php:396
899
- #: inc/functions/admin-ui.php:580 inc/functions/admin-ui.php:601
900
- msgid "Choose another plan"
901
- msgstr ""
902
-
903
- #: inc/functions/admin-ui.php:371
904
- msgid "Optimize the images you already have, buy a one-time plan"
905
- msgstr ""
906
-
907
- #: inc/functions/admin-ui.php:407
908
- msgid "Checkout"
909
- msgstr ""
910
-
911
- #: inc/functions/admin-ui.php:411
912
- msgid ""
913
- "Monthly plans comes with credits which is renewed every months. The billing "
914
- "happens automatically each month or year depending the billing period you "
915
- "choose."
916
- msgstr ""
917
-
918
- #: inc/functions/admin-ui.php:435
919
- msgid "Monthly Plans"
920
- msgstr ""
921
-
922
- #: inc/functions/admin-ui.php:440
923
- msgid "One Time Plans"
924
- msgstr ""
925
-
926
- #: inc/functions/admin-ui.php:450
927
- msgid ""
928
- "Monthly plans come with credits which is renewed every months. The billing "
929
- "happens automatically each month or year depending the billing period you "
930
- "choose."
931
- msgstr ""
932
-
933
- #: inc/functions/admin-ui.php:482 inc/functions/admin-ui.php:529
934
- msgid "we recommend for you"
935
- msgstr ""
936
-
937
- #: inc/functions/admin-ui.php:490 inc/functions/admin-ui.php:533
938
- msgid "Choose plan"
939
- msgstr ""
940
-
941
- #: inc/functions/admin-ui.php:498
942
- msgid "Need more?"
943
- msgstr ""
944
-
945
- #: inc/functions/admin-ui.php:499
946
- msgid "for special needs"
947
- msgstr ""
948
-
949
- #: inc/functions/admin-ui.php:503
950
- msgid "Contact Us"
951
- msgstr ""
952
-
953
- #: inc/functions/admin-ui.php:510
954
- msgid ""
955
- "One time plans are useful if you have a lots of existing images which need "
956
- "to be optimized. You can use it for bulk optimizing all your past images. "
957
- "You will pay only once."
958
- msgstr ""
959
-
960
- #: inc/functions/admin-ui.php:563
961
- msgid "Your order"
962
- msgstr ""
963
-
964
- #: inc/functions/admin-ui.php:568
965
- #, php-format
966
- msgid "%scancel%sYou just removed %s"
967
- msgstr ""
968
-
969
- #: inc/functions/admin-ui.php:576 inc/functions/admin-ui.php:597
970
- msgid "Remove this item"
971
- msgstr ""
972
-
973
- #: inc/functions/admin-ui.php:583
974
- #, php-format
975
- msgid "%s per month"
976
- msgstr ""
977
-
978
- #: inc/functions/admin-ui.php:604
979
- #, php-format
980
- msgid "one time %s"
981
- msgstr ""
982
-
983
- #: inc/functions/admin-ui.php:617
984
- #, php-format
985
- msgid ""
986
- "Switch to yearly subscription and <br><strong class=\"imagify-dark\">save %s "
987
- "per year!</strong>"
988
- msgstr ""
989
-
990
- #: inc/functions/admin-ui.php:618
991
- #, php-format
992
- msgid ""
993
- "Perfect!<br>You're <strong class=\"imagify-dark\">saving %s per year!</"
994
- "strong>"
995
- msgstr ""
996
-
997
- #: inc/functions/admin-ui.php:657
998
- msgid "Thank you for being awesome!"
999
- msgstr ""
1000
-
1001
- #: inc/functions/admin-ui.php:668
1002
- msgid "What do our user think about Imagify"
1003
- msgstr ""
1004
-
1005
- #: inc/functions/admin-ui.php:702
1006
- msgid "Secure Credit Card Payment"
1007
- msgstr ""
1008
-
1009
- #: inc/functions/admin-ui.php:703
1010
- msgid "This is secure 128-bits SSL encrypted payment"
1011
- msgstr ""
1012
-
1013
- #: inc/functions/i18n.php:20
1014
- msgid "Let's get you started!"
1015
- msgstr "¡Vamos a comenzar!"
1016
-
1017
- #: inc/functions/i18n.php:21
1018
- msgid "Enter your email to get an API key:"
1019
- msgstr "Ingresa tu email para obtener un clave API:"
1020
-
1021
- #: inc/functions/i18n.php:22
1022
- msgid "Sign Up"
1023
- msgstr "Registrate"
1024
-
1025
- #: inc/functions/i18n.php:23
1026
- msgid "You need to specify an email!"
1027
- msgstr "¡Es necesario especificar una dirección email!"
1028
-
1029
- #: inc/functions/i18n.php:24 inc/functions/i18n.php:31
1030
- msgid "Congratulations!"
1031
- msgstr "¡Enhorabuena!"
1032
-
1033
- #: inc/functions/i18n.php:25
1034
- msgid ""
1035
- "Your account has been succesfully created. Please check your mailbox, you "
1036
- "are going to receive an email with API key."
1037
- msgstr ""
1038
- "Tu cuenta ha sido creada con éxito. Por favor, revisa tu buzón de correo, "
1039
- "recibirás un email con la clave API."
1040
-
1041
- #: inc/functions/i18n.php:26
1042
- msgid "Connect to Imagify!"
1043
- msgstr "¡Conéctate a Imagify!"
1044
-
1045
- #: inc/functions/i18n.php:27
1046
- msgid "Paste your API key below:"
1047
- msgstr "Pega aquí abajo tu clave API:"
1048
-
1049
- #: inc/functions/i18n.php:28
1050
- msgid "Connect me"
1051
- msgstr "Conéctame"
1052
-
1053
- #: inc/functions/i18n.php:29
1054
- msgid "Check in progress..."
1055
- msgstr "Control en curso…"
1056
-
1057
- #: inc/functions/i18n.php:30
1058
- msgid "You need to specify your api key!"
1059
- msgstr "¡Es necesario especificar una clave api!"
1060
-
1061
- #: inc/functions/i18n.php:32
1062
- msgid ""
1063
- "Your API key is valid. You can now configure the Imagify settings to "
1064
- "optimize your images."
1065
- msgstr ""
1066
- "Tu clave API es válida. Ahora puedes configurar los parámetros de Imagify "
1067
- "para optimizar tus imágenes."
1068
-
1069
- #: inc/functions/i18n.php:34
1070
- msgid "Cancel"
1071
- msgstr ""
1072
-
1073
- #: inc/functions/i18n.php:41
1074
- msgid "Don't Need a Parachute?"
1075
- msgstr "¿No necesitas un paracaídas?"
1076
-
1077
- #: inc/functions/i18n.php:42
1078
- msgid ""
1079
- "If you keep this option deactivated, you won't be able to re-optimize your "
1080
- "images to another compression level and restore your original images in case "
1081
- "of need."
1082
- msgstr ""
1083
- "Si mantienes esta opción desactivada, no podrás re-optimizar tus imágenes a "
1084
- "otro nivel de compresión ni restablecer la imagen original en caso de "
1085
- "necesidad."
1086
-
1087
- #: inc/functions/i18n.php:58
1088
- msgid "Original Image"
1089
- msgstr "Imagen original"
1090
-
1091
- #: inc/functions/i18n.php:59
1092
- msgid "Optimized Image"
1093
- msgstr "Imagen optimizada"
1094
-
1095
- #: inc/functions/i18n.php:73
1096
- msgid "Please wait..."
1097
- msgstr "Espera, por favor…"
1098
-
1099
- #: inc/functions/i18n.php:74
1100
- msgid ""
1101
- "We are trying to get your unoptimized images, it may take time depending on "
1102
- "the number of images."
1103
- msgstr ""
1104
- "Estamos tratando de obtener tus imágenes no optimizadas: esto puede tomar "
1105
- "tiempo, dependiendo del número de imágenes."
1106
-
1107
- #: inc/functions/i18n.php:76
1108
- msgid "Oops, There is something wrong!"
1109
- msgstr "Ups, algo no ha ido bien!"
1110
-
1111
- #: inc/functions/i18n.php:77
1112
- msgid ""
1113
- "An unknow error occurred when we tried to get all your unoptimized images. "
1114
- "Try again and if the issue still persist, please contact us!"
1115
- msgstr ""
1116
- "Un error inesperado ha ocurrido mientras tratábamos de obtener todas tus "
1117
- "imágenes no optimizadas. Inténtalo otra vez y, si el problema persiste, "
1118
- "contáctanos por favor!"
1119
-
1120
- #: inc/functions/i18n.php:82
1121
- msgid "Error"
1122
- msgstr "Error"
1123
-
1124
- #: inc/functions/i18n.php:85
1125
- msgid "Hold on!"
1126
- msgstr "¡Espera!"
1127
-
1128
- #: inc/functions/i18n.php:86
1129
- msgid "All your images have been optimized by Imagify. Congratulations!"
1130
- msgstr "Todas tus imágenes han sido optimizadas por Imagify. ¡Enhorabuena!"
1131
-
1132
- #: inc/functions/i18n.php:88
1133
- #, php-format
1134
- msgid ""
1135
- "Discover @imagify, the new compression tool to optimize your images for "
1136
- "free. I saved %1$s out of %2$s!"
1137
- msgstr ""
1138
- "Descubre @imagify, la nueva herramienta de compresión para optimizar tus "
1139
- "imágenes gratuitamente. Me ha ahorrado %1$s de %2$s!"
1140
-
1141
- #: inc/functions/i18n.php:92
1142
- msgid "Imagify is still processing. Are you sure you want to leave this page?"
1143
- msgstr "Imagify sigue procesando. Estás seguro que quieres dejar la página?"
1144
-
1145
- #: inc/functions/i18n.php:101
1146
- msgid "F j, Y"
1147
- msgstr "F j, Y"
1148
-
1149
- #: inc/functions/process.php:40
1150
- msgid ""
1151
- "Sorry, our servers are temporarily unaccessible. Please, try again in a "
1152
- "couple of minutes."
1153
- msgstr ""
1154
- "Lo sentimos, nuestros servidores están temporalmente inaccesibles. Por "
1155
- "favor, inténtalo de nuevo en un par de minutos."
1156
-
1157
- #: inc/functions/process.php:46
1158
- msgid "External HTTP requests are blocked"
1159
- msgstr "Las peticiones HTTP externas están bloqueadas"
1160
-
1161
- #: inc/functions/process.php:52
1162
- msgid "File path is empty"
1163
- msgstr "La ruta del archivo está vacía"
1164
-
1165
- #: inc/functions/process.php:58
1166
- #, php-format
1167
- msgid "Could not find %s"
1168
- msgstr "No se pudo encontrar %s"
1169
-
1170
- #: inc/functions/process.php:63
1171
- #, php-format
1172
- msgid "%s is not writable"
1173
- msgstr "%s no tiene permisos de escritura"
1174
-
1175
- #: inc/functions/process.php:72
1176
- #, php-format
1177
- msgid "Skipped (%s), image not found."
1178
- msgstr "Omitido (%s), imagen no encontrada."
1179
-
1180
- #~ msgid "Your default setting:"
1181
- #~ msgstr "Tu configuración por defecto:"
1182
-
1183
- #~ msgid ""
1184
- #~ "All images which are over to %s could be optimized using the pro version."
1185
- #~ msgstr ""
1186
- #~ "Todas las imágenes de tamaño superior a %s pueden optimizarse utilizando "
1187
- #~ "la versión pro."
1188
-
1189
- #~ msgid ""
1190
- #~ "%1$sCongratulations%2$s, you have optimized %1$s%3$d images%2$s and "
1191
- #~ "improved your website's by reducing your images size."
1192
- #~ msgstr ""
1193
- #~ "%1$s¡En hora buena!%2$s Has optimizado %1$s%3$d imágenes%2$s y ahora tu "
1194
- #~ "sitio web es más rápido."
1195
-
1196
- #~ msgid ""
1197
- #~ "%1$sCongratulations%2$s, you have optimized %1$s%3$d images%2$s and speed "
1198
- #~ "up your website by reducing your images size."
1199
- #~ msgstr ""
1200
- #~ "%1$s¡En hora buena!%2$s Has optimizado %1$s%3$d imágenes%2$s y ahora tu "
1201
- #~ "sitio web es más rápido."
1202
-
1203
- #~ msgid ""
1204
- #~ "Sorry, our servers are temporally unaccessible. Please, try again in a "
1205
- #~ "couple of minutes"
1206
- #~ msgstr ""
1207
- #~ "Lo sentimos, nuestros servidores están temporalmente inaccesibles. Por "
1208
- #~ "favor, inténtalo de nuevo en un par de minutos"
1209
-
1210
- #~ msgid "Rate Imagify on WordPress.org"
1211
- #~ msgstr "Valora Imagify en WordPress.org"
1212
-
1213
- #~ msgid "Discover our other products"
1214
- #~ msgstr "Descubre nuestros otros productos"
1215
-
1216
- #~ msgid "Is your WordPress website too slow?"
1217
- #~ msgstr "¿Tu sitio WordPress es demasiado lento?"
1218
-
1219
- #~ msgid "Checking in process..."
1220
- #~ msgstr "Control en curso…"
1221
-
1222
- #~ msgid ""
1223
- #~ "If you are a photographer, you may be interested in by this option if you "
1224
- #~ "are displaying some infos like your the model of your camera on your "
1225
- #~ "pages."
1226
- #~ msgstr ""
1227
- #~ "Si eres un fotógrafo, puedes estar interesado en esta opción si quieres "
1228
- #~ "enseñar en tus páginas alguna info, por ejemplo el modelo de tu cámara."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/imagify-fr_FR.mo DELETED
Binary file
languages/imagify-fr_FR.po DELETED
@@ -1,1574 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Imagify\n"
4
- "POT-Creation-Date: 2017-04-05 12:25+0200\n"
5
- "PO-Revision-Date: 2017-04-05 12:25+0200\n"
6
- "Last-Translator: Rémy Perona <remperona@gmail.com>\n"
7
- "Language-Team: \n"
8
- "Language: fr_FR\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 2.0\n"
13
- "X-Poedit-Basepath: ..\n"
14
- "X-Poedit-WPHeader: imagify.php\n"
15
- "Plural-Forms: nplurals=2; plural=(n > 1);\n"
16
- "X-Poedit-SourceCharset: UTF-8\n"
17
- "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
18
- "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
19
- "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
20
- "X-Poedit-SearchPath-0: .\n"
21
- "X-Poedit-SearchPathExcluded-0: *.js\n"
22
-
23
- #: inc/3rd-party/nextgen-gallery/inc/admin/enqueue.php:20 inc/admin/ajax.php:123
24
- #: inc/admin/meta-boxes.php:34 inc/functions/admin-ui.php:215
25
- #: inc/functions/i18n.php:52 inc/functions/i18n.php:67
26
- msgid "Optimize"
27
- msgstr "Optimiser"
28
-
29
- #: inc/3rd-party/nextgen-gallery/inc/admin/enqueue.php:21
30
- #: inc/functions/admin-ui.php:80 inc/functions/i18n.php:53
31
- msgid "Restore Original"
32
- msgstr "Restaurer l’original"
33
-
34
- #: inc/3rd-party/nextgen-gallery/inc/admin/menu.php:16 inc/admin/menu.php:24
35
- #: inc/admin/plugins.php:13 inc/admin/ui/bulk.php:81 inc/common/admin-bar.php:39
36
- msgid "Bulk Optimization"
37
- msgstr "Optimisation en masse"
38
-
39
- #: inc/admin/ajax.php:123 inc/admin/meta-boxes.php:29
40
- #: inc/functions/admin-ui.php:121 inc/functions/admin-ui.php:153
41
- #: inc/functions/admin-ui.php:159 inc/functions/admin-ui.php:165
42
- #: inc/functions/admin-ui.php:205 inc/functions/admin-ui.php:215
43
- msgid "Optimizing..."
44
- msgstr "En cours d’optimisation…"
45
-
46
- #: inc/admin/ajax.php:507
47
- msgid "Oops, It's almost over!"
48
- msgstr "Oups, c’est bientôt fini&nbsp;!"
49
-
50
- #: inc/admin/ajax.php:508
51
- #, php-format
52
- msgid ""
53
- "You have almost used all your credit.%sDon't forget to upgrade your "
54
- "subscription to continue optimizing your images."
55
- msgstr ""
56
- "Vous avez bientôt utilisé tout votre crédit.%sN’oubliez pas de mettre à niveau "
57
- "votre abonnement pour continuer à optimiser vos images."
58
-
59
- #: inc/admin/ajax.php:509 inc/admin/ui/bulk.php:23
60
- msgid "View My Subscription"
61
- msgstr "Voir mon abonnement"
62
-
63
- #: inc/admin/ajax.php:517 inc/admin/ui/notices.php:258 inc/functions/i18n.php:87
64
- msgid "Oops, It's Over!"
65
- msgstr "Oups, c’est fini !"
66
-
67
- #: inc/admin/ajax.php:518 inc/admin/ui/notices.php:260 inc/functions/i18n.php:104
68
- #, php-format
69
- msgid ""
70
- "You have consumed all your credit for this month. You will have <strong>%s "
71
- "back on %s</strong>."
72
- msgstr ""
73
- "Vous avez consommé tout votre crédit pour ce mois. Vous aurez à nouveau "
74
- "<strong>%s le %s</strong>."
75
-
76
- #: inc/admin/ajax.php:519
77
- msgid "Upgrade My Subscription"
78
- msgstr "Mettre à niveau mon abonnement"
79
-
80
- #: inc/admin/ajax.php:538 inc/admin/ui/bulk.php:17
81
- msgid "Account status"
82
- msgstr "Type de compte"
83
-
84
- #: inc/admin/ajax.php:539 inc/admin/ui/bulk.php:18
85
- msgid "Your subscription:"
86
- msgstr "Votre abonnement&nbsp;:"
87
-
88
- #: inc/admin/ajax.php:547 inc/admin/ui/bulk.php:48
89
- #, php-format
90
- msgid "You have %s space credit left"
91
- msgstr "Il vous reste %s de crédit"
92
-
93
- #: inc/admin/ajax.php:559
94
- msgid "View my subscription"
95
- msgstr "Voir mon abonnement"
96
-
97
- #: inc/admin/media.php:63 inc/functions/i18n.php:63
98
- msgid "Compare Original VS Optimized"
99
- msgstr "Comparer Originale VS Optimisée"
100
-
101
- #. Plugin Name of the plugin/theme
102
- #: inc/admin/meta-boxes.php:17 inc/admin/meta-boxes.php:24
103
- #: inc/admin/upload.php:12
104
- msgid "Imagify"
105
- msgstr "Imagify"
106
-
107
- #: inc/admin/meta-boxes.php:19 inc/functions/admin-ui.php:195
108
- msgid "Invalid API key"
109
- msgstr "Clé API invalide"
110
-
111
- #: inc/admin/meta-boxes.php:21 inc/functions/admin-ui.php:197
112
- msgid "Check your Settings"
113
- msgstr "Vérifiez vos réglages"
114
-
115
- #: inc/admin/options.php:127
116
- msgid "Cheatin&#8217; uh?"
117
- msgstr "Cheatin&#8217; uh?"
118
-
119
- #: inc/admin/options.php:135
120
- msgid "<strong>ERROR</strong>: options page not found."
121
- msgstr "<strong>Erreur</strong> : page d’options introuvable."
122
-
123
- #: inc/admin/plugins.php:14 inc/admin/ui/options.php:74
124
- #: inc/common/admin-bar.php:30
125
- msgid "Settings"
126
- msgstr "Réglages"
127
-
128
- #: inc/admin/ui/bulk.php:60
129
- msgid "Upgrade your account to continue optimizing your images"
130
- msgstr "Mettez à niveau votre compte pour continuer à optimiser vos images"
131
-
132
- #: inc/admin/ui/bulk.php:64
133
- msgid "More info"
134
- msgstr "Plus d’infos"
135
-
136
- #: inc/admin/ui/bulk.php:91
137
- msgid "Overview"
138
- msgstr "Vue d'ensemble"
139
-
140
- #: inc/admin/ui/bulk.php:99
141
- #, php-format
142
- msgid "You optimized %s images of your website"
143
- msgstr "Vous avez optimisé %s des images de votre site"
144
-
145
- #: inc/admin/ui/bulk.php:103
146
- msgid "Statistics"
147
- msgstr "Statistiques"
148
-
149
- #: inc/admin/ui/bulk.php:115
150
- msgid "that's the number of images you optimized with Imagify"
151
- msgstr "c’est le nombre d’images que %svous avez optimisé avec Imagify"
152
-
153
- #: inc/admin/ui/bulk.php:120
154
- msgid "Original size"
155
- msgstr "Poids de l’original"
156
-
157
- #: inc/admin/ui/bulk.php:125
158
- msgid "Optimized size"
159
- msgstr "Poids optimisé"
160
-
161
- #: inc/admin/ui/bulk.php:136
162
- #, php-format
163
- msgid "that's the size you saved %sby using Imagify"
164
- msgstr "c’est le poids que vous avez économisé %sen utilisant Imagify"
165
-
166
- #: inc/admin/ui/bulk.php:142
167
- msgid "Information"
168
- msgstr "Informations"
169
-
170
- #: inc/admin/ui/bulk.php:146
171
- msgid ""
172
- "Please be aware that optimizing a large number of images can take a while "
173
- "depending on your server and network speed."
174
- msgstr ""
175
- "Prenez conscience que l’optimisation d’un grand nombre d’images peut prendre "
176
- "du temps en fonction de la rapidité de votre serveur et de votre connexion."
177
-
178
- #: inc/admin/ui/bulk.php:149
179
- #, php-format
180
- msgid ""
181
- "If you have more than %s images, you will need to launch the bulk optimization "
182
- "several times."
183
- msgstr ""
184
- "Si vous avez plus de %s images, vous devrez lancer l’optimisation en masse "
185
- "plusieurs fois."
186
-
187
- #: inc/admin/ui/bulk.php:153
188
- msgid ""
189
- "You must keep this page open while the bulk optimizaton is processing. If you "
190
- "leave you can come back to continue where it left off."
191
- msgstr ""
192
- "Vous devez garder cette page ouverte pendant que l’optimisation en masse est "
193
- "en cours. Si vous la quittez, vous pouvez revenir pour continuer là où vous en "
194
- "étiez."
195
-
196
- #: inc/admin/ui/bulk.php:164
197
- msgid "Select Your Compression Level"
198
- msgstr "Sélectionnez votre niveau de compression"
199
-
200
- #: inc/admin/ui/bulk.php:166 inc/admin/ui/bulk.php:192
201
- #: inc/admin/ui/options.php:136 inc/admin/ui/options.php:342
202
- #: inc/admin/ui/options.php:381 inc/admin/ui/options.php:398
203
- #: inc/admin/ui/options.php:458 inc/classes/abstracts/abstract-attachment.php:114
204
- #: inc/functions/admin-ui.php:153
205
- msgid "Ultra"
206
- msgstr "Ultra"
207
-
208
- #: inc/admin/ui/bulk.php:169 inc/admin/ui/bulk.php:187
209
- #: inc/admin/ui/options.php:131 inc/admin/ui/options.php:329
210
- #: inc/admin/ui/options.php:380 inc/admin/ui/options.php:393
211
- #: inc/admin/ui/options.php:437 inc/classes/abstracts/abstract-attachment.php:117
212
- #: inc/functions/admin-ui.php:159
213
- msgid "Aggressive"
214
- msgstr "Agressif"
215
-
216
- #: inc/admin/ui/bulk.php:172 inc/admin/ui/bulk.php:182
217
- #: inc/admin/ui/options.php:126 inc/admin/ui/options.php:316
218
- #: inc/admin/ui/options.php:379 inc/admin/ui/options.php:388
219
- #: inc/admin/ui/options.php:417 inc/classes/abstracts/abstract-attachment.php:120
220
- #: inc/functions/admin-ui.php:165
221
- msgid "Normal"
222
- msgstr "Normal"
223
-
224
- #: inc/admin/ui/bulk.php:176
225
- #, php-format
226
- msgid "Your default setting: %s"
227
- msgstr "Votre réglage par défaut&nbsp;: %s"
228
-
229
- #: inc/admin/ui/bulk.php:201
230
- #, php-format
231
- msgid "Don't forget to check %syour settings%s before bulk optimization."
232
- msgstr ""
233
- "N’oubliez pas de vérifier %svos réglages%s avant l’optimisation en masse."
234
-
235
- #: inc/admin/ui/bulk.php:208
236
- msgid "Let's go!"
237
- msgstr "C’est parti&nbsp;!"
238
-
239
- #: inc/admin/ui/bulk.php:215
240
- msgid "Imagif'em all"
241
- msgstr "Imagif'em all"
242
-
243
- #: inc/admin/ui/bulk.php:220
244
- #, php-format
245
- msgid "All images greater than %s will be optimized when using a paid plan."
246
- msgstr ""
247
- "Toutes les images de plus de %s seront optimisées lors de l'utilisation d'un "
248
- "plan payant."
249
-
250
- #: inc/admin/ui/bulk.php:239
251
- msgid "Well done!"
252
- msgstr "Bien joué&nbsp;!"
253
-
254
- #: inc/admin/ui/bulk.php:240
255
- #, php-format
256
- msgid "you saved %1$s out of %2$s"
257
- msgstr "vous avez économisé %1$s sur %2$s"
258
-
259
- #: inc/admin/ui/bulk.php:245
260
- msgid "Share your awesome result"
261
- msgstr "Partagez votre résultat"
262
-
263
- #: inc/admin/ui/bulk.php:260
264
- msgid "Compression process results"
265
- msgstr "Résultats du processus de compression"
266
-
267
- #: inc/admin/ui/bulk.php:263
268
- msgid "Filename"
269
- msgstr "Nom du fichier"
270
-
271
- #: inc/admin/ui/bulk.php:264
272
- msgid "Status"
273
- msgstr "Statut"
274
-
275
- #: inc/admin/ui/bulk.php:265 inc/admin/ui/options.php:378
276
- #: inc/admin/ui/options.php:383 inc/admin/ui/options.php:407
277
- msgid "Original"
278
- msgstr "Original"
279
-
280
- #: inc/admin/ui/bulk.php:266 inc/admin/upload.php:41 inc/functions/i18n.php:83
281
- msgid "Optimized"
282
- msgstr "Optimisées"
283
-
284
- #: inc/admin/ui/bulk.php:267
285
- msgid "Percentage"
286
- msgstr "Pourcentage"
287
-
288
- #: inc/admin/ui/bulk.php:268
289
- msgid "Thumbnails optimized"
290
- msgstr "Miniatures optimisées"
291
-
292
- #: inc/admin/ui/bulk.php:269
293
- msgid "Overall saving"
294
- msgstr "Gain total"
295
-
296
- #: inc/admin/ui/bulk.php:274
297
- msgid "file"
298
- msgstr "fichier"
299
-
300
- #: inc/admin/ui/bulk.php:275
301
- msgid "error"
302
- msgstr "erreur"
303
-
304
- #: inc/admin/ui/bulk.php:276
305
- msgid "Total:"
306
- msgstr "Total&nbsp;:"
307
-
308
- #: inc/admin/ui/bulk.php:277
309
- msgid "Gain:"
310
- msgstr "Gain&nbsp;:"
311
-
312
- #: inc/admin/ui/bulk.php:294
313
- #, php-format
314
- msgid "%sStart the bulk optimization%s"
315
- msgstr "%sDémarrer l’optimisation en masse%s"
316
-
317
- #: inc/admin/ui/notices.php:24
318
- msgid "Welcome to Imagify, the best way to easily optimize your images!"
319
- msgstr ""
320
- "Bienvenue sur Imagify, la meilleure façon d'optimiser facilement vos "
321
- "images&nbsp;!"
322
-
323
- #: inc/admin/ui/notices.php:26 inc/admin/ui/notices.php:92
324
- #: inc/admin/ui/notices.php:186 inc/admin/ui/notices.php:223
325
- #: inc/admin/ui/notices.php:263 inc/admin/ui/notices.php:370
326
- msgid "Dismiss this notice"
327
- msgstr "Fermer ce message"
328
-
329
- #: inc/admin/ui/notices.php:33
330
- msgid "Create an Account"
331
- msgstr "Créer un compte"
332
-
333
- #: inc/admin/ui/notices.php:34
334
- msgid ""
335
- "Don't have an Imagify account yet? Optimize your images by creating an account "
336
- "in a few seconds!"
337
- msgstr ""
338
- "Vous n’avez pas encore de compte Imagify&nbsp;? Optimiser vos images en créant "
339
- "un compte en quelques secondes&nbsp;!"
340
-
341
- #: inc/admin/ui/notices.php:37
342
- msgid "Sign up, It's FREE!"
343
- msgstr "Inscrivez-vous, c’est GRATUIT&nbsp;!"
344
-
345
- #: inc/admin/ui/notices.php:43
346
- msgid "Enter your API Key"
347
- msgstr "Entrer la clé API"
348
-
349
- #: inc/admin/ui/notices.php:44
350
- #, php-format
351
- msgid ""
352
- "Save your API Key you have received by email or you can get it on your "
353
- "%sImagify account page%s."
354
- msgstr ""
355
- "Enregistrez la clé API que vous avez reçu par email ou que vous pouvez "
356
- "récupérer sur votre %spage de compte Imagify%s."
357
-
358
- #: inc/admin/ui/notices.php:47
359
- msgid "I have my API key"
360
- msgstr "J’ai récupéré ma clé API"
361
-
362
- #: inc/admin/ui/notices.php:53
363
- msgid "Configure it"
364
- msgstr "Configurer le"
365
-
366
- #: inc/admin/ui/notices.php:54
367
- msgid "It’s almost done! You have just to configure your optimization settings."
368
- msgstr ""
369
- "C’est bientôt terminé&nbsp;! Vous avez juste à configurer vos paramètres "
370
- "d'optimisation."
371
-
372
- #: inc/admin/ui/notices.php:55
373
- msgid "Go to Settings"
374
- msgstr "Aller aux réglages"
375
-
376
- #: inc/admin/ui/notices.php:87 inc/admin/ui/options.php:97
377
- #: inc/functions/i18n.php:81
378
- msgid "Your API key isn't valid!"
379
- msgstr "Votre clé API n’est pas valide&nbsp;!"
380
-
381
- #: inc/admin/ui/notices.php:90
382
- #, php-format
383
- msgid ""
384
- "Go to your Imagify account page to get your API Key and specify it on %1$syour "
385
- "settings%3$s or %2$screate an account for free%3$s if you don't have one yet."
386
- msgstr ""
387
- "Allez sur votre page de compte Imagify pour récupérer votre clé API et la "
388
- "renseigner dans %1$svos réglages%3$s ou %2$scréez un compte gratuitement%3$s "
389
- "si vous n’en avez pas encore un."
390
-
391
- #: inc/admin/ui/notices.php:142
392
- msgid ""
393
- "The following plugins are not compatible with this plugin and may cause "
394
- "unexpected results:"
395
- msgstr ""
396
- "Les extensions suivantes ne sont pas compatibles avec ce plugin et peuvent "
397
- "générer des résultats inattendus :"
398
-
399
- #: inc/admin/ui/notices.php:148
400
- msgid "Deactivate"
401
- msgstr "Désactiver"
402
-
403
- #: inc/admin/ui/notices.php:178
404
- msgid "The external HTTP requests are blocked!"
405
- msgstr "Les requêtes HTTP externes sont bloquées&nbsp;!"
406
-
407
- #: inc/admin/ui/notices.php:179
408
- msgid ""
409
- "You defined the <code>WP_HTTP_BLOCK_EXTERNAL</code> constant in the <code>wp-"
410
- "config.php</code> to block all external HTTP requests."
411
- msgstr ""
412
- "Vous avez défini la constante <code>WP_HTTP_BLOCK_EXTERNAL</code> dans le "
413
- "fichier <code>wp-config.php</code> pour bloquer toutes les requêtes HTTP "
414
- "externes."
415
-
416
- #: inc/admin/ui/notices.php:181
417
- msgid ""
418
- "To optimize your images, you have to put the following code in your <code>wp-"
419
- "config.php</code> file so that it works correctly."
420
- msgstr ""
421
- "Pour optimiser vos images, vous devez insérer le code suivant dans le fichier "
422
- "<code>wp-config.php</code> afin que cela fonctionne correctement."
423
-
424
- #: inc/admin/ui/notices.php:182
425
- msgid "Click on the field and press Ctrl-A to select all."
426
- msgstr "Cliquez sur le champ et appuyez sur Ctrl-A pour tout sélectionner."
427
-
428
- #: inc/admin/ui/notices.php:219
429
- msgid "You're missing out!"
430
- msgstr "Vous passez à côté de quelque chose !"
431
-
432
- #: inc/admin/ui/notices.php:220
433
- msgid "Use the List view to optimize images with Imagify."
434
- msgstr "Utilisez la vue liste pour optimiser vos images avec Imagify."
435
-
436
- #: inc/admin/ui/notices.php:221
437
- msgid "Switch to the List View"
438
- msgstr "Basculer en vue liste"
439
-
440
- #: inc/admin/ui/notices.php:260 inc/functions/i18n.php:101
441
- #: inc/functions/i18n.php:104
442
- #, php-format
443
- msgid ""
444
- "To continue to optimize your images, log in to your Imagify account to %sbuy a "
445
- "pack or subscribe to a plan%s."
446
- msgstr ""
447
- "Pour continuer à optimiser vos images, connectez-vous à votre compte Imagify "
448
- "pour %sacheter un pack ou souscrire à un plan%s."
449
-
450
- #: inc/admin/ui/notices.php:314 inc/admin/ui/options.php:28
451
- msgid "Discover the best caching plugin to speed up your website."
452
- msgstr "Découvrez le meilleur plugin de cache pour accélérer votre site."
453
-
454
- #: inc/admin/ui/notices.php:317 inc/admin/ui/options.php:36
455
- #, php-format
456
- msgid "%sGet %s off%s with this coupon code:%s"
457
- msgstr "Obtenez %s%s%s de réduction avec le code promo&nbsp;:%s"
458
-
459
- #: inc/admin/ui/notices.php:326 inc/admin/ui/options.php:41
460
- msgid "Get WP Rocket now"
461
- msgstr "Je veux WP Rocket&nbsp;!"
462
-
463
- #: inc/admin/ui/notices.php:363
464
- #, php-format
465
- msgid ""
466
- "%1$sCongratulations%2$s, you have optimized %1$s%3$d images%2$s and improved "
467
- "your website's speed by reducing your images size."
468
- msgstr ""
469
- "%1$sFélicitations%2$s ! Vous avez optimisé %1$s%3$d images%2$s et amélioré le "
470
- "temps de chargement de votre site en réduisant le poids de vos images."
471
-
472
- #: inc/admin/ui/notices.php:365 inc/admin/ui/options.php:59
473
- #, php-format
474
- msgid ""
475
- "%sDo you like this plugin?%s Please take a few seconds to %srate it on "
476
- "WordPress.org%s!"
477
- msgstr ""
478
- "%sVous aimez ce plugin&nbsp;?%s Prenez quelques secondes pour le %snoter sur "
479
- "WordPress.org%s&nbsp;!"
480
-
481
- #: inc/admin/ui/options.php:22
482
- msgid "Is your website too slow?"
483
- msgstr "Votre site est trop lent ?"
484
-
485
- #: inc/admin/ui/options.php:84
486
- msgid "API Key"
487
- msgstr "Clé API"
488
-
489
- #: inc/admin/ui/options.php:91 inc/functions/i18n.php:33
490
- msgid "Your API key is valid."
491
- msgstr "Votre clé API est valide."
492
-
493
- #: inc/admin/ui/options.php:104
494
- #, php-format
495
- msgid "Don't have an API Key yet? %sCreate one, it's FREE%s."
496
- msgstr "Vous n’avez pas encore de clé API ? %sCréez en une, c’est GRATUIT%s."
497
-
498
- #: inc/admin/ui/options.php:121
499
- msgid "Optimization Level"
500
- msgstr "Niveau d’optimisation"
501
-
502
- #: inc/admin/ui/options.php:141
503
- msgid "More info?"
504
- msgstr "Plus d’infos&nbsp;?"
505
-
506
- #: inc/admin/ui/options.php:148
507
- #, php-format
508
- msgid "Need help to choose? %sTry the Visual Comparison%s"
509
- msgstr "Besoin d’aide pour choisir? %sEssayer le comparateur visuel%s"
510
-
511
- #: inc/admin/ui/options.php:157 inc/admin/ui/options.php:161
512
- msgid "Auto-Optimize images on upload"
513
- msgstr "Optimiser automatiquement les images envoyées"
514
-
515
- #: inc/admin/ui/options.php:165
516
- msgid "Automatically optimize every image you upload to WordPress."
517
- msgstr "Optimiser automatiquement chaque image que vous enverrez à WordPress."
518
-
519
- #: inc/admin/ui/options.php:170 inc/admin/ui/options.php:173
520
- msgid "Backup original images"
521
- msgstr "​Conserver une copie des images d'origine"
522
-
523
- #: inc/admin/ui/options.php:177
524
- msgid ""
525
- "Keep your original images in a separate folder before optimization process."
526
- msgstr ""
527
- "Garder vos images d’origine dans un dossier séparé avant le processus "
528
- "d’optimisation."
529
-
530
- #: inc/admin/ui/options.php:182 inc/admin/ui/options.php:185
531
- msgid "Resize larger images"
532
- msgstr "Redimensionner les images trop grandes"
533
-
534
- #: inc/admin/ui/options.php:191
535
- #, php-format
536
- msgid "to maximum %s pixels width"
537
- msgstr "au maximum %s pixels de large"
538
-
539
- #: inc/admin/ui/options.php:202
540
- #, php-format
541
- msgid ""
542
- "This option is recommended to reduce larger images. You can save up to 80%% "
543
- "after resizing. The new width should not be less than your largest thumbnail "
544
- "width, which is actually %spx."
545
- msgstr ""
546
- "Cette option est recommendée pour réduire les images trop grandes. Vous pouvez "
547
- "économiser jusqu'à 80%% du poids après le redimensionnement. La nouvelle "
548
- "largeur ne doit pas être inférieure à la plus grande largeur de vos miniatures "
549
- "qui est actuellement de %spx."
550
-
551
- #: inc/admin/ui/options.php:209 inc/admin/ui/options.php:212
552
- msgid "EXIF Data"
553
- msgstr "Données EXIF"
554
-
555
- #: inc/admin/ui/options.php:216
556
- msgid ""
557
- "Keep all EXIF data from your images. EXIF are informations stored in your "
558
- "pictures like shutter speed, exposure compensation, ISO, etc..."
559
- msgstr ""
560
- "Garder toutes les données EXIF ​​de vos images. Les EXIF sont des informations "
561
- "stockées dans vos photos comme l’ouverture de l’objectif, l’exposition, ISO, "
562
- "etc …"
563
-
564
- #: inc/admin/ui/options.php:217
565
- msgid "Learn more"
566
- msgstr "En savoir plus"
567
-
568
- #: inc/admin/ui/options.php:219
569
- msgid ""
570
- "If you are a photographer, you may be interested in this option if you are "
571
- "displaying on your pages some info like the model of your camera."
572
- msgstr ""
573
- "Si vous êtes un photographe, vous pourriez être intéressé par cette option si "
574
- "vous affichez quelques infos comme votre le modèle de votre appareil photo sur "
575
- "vos pages."
576
-
577
- #: inc/admin/ui/options.php:228
578
- msgid "Files optimization"
579
- msgstr "Tailles à optimiser"
580
-
581
- #: inc/admin/ui/options.php:231
582
- msgid ""
583
- "You can choose to compress different image sizes created by WordPress here."
584
- msgstr ""
585
- "Vous pouvez choisir d’optimiser les différents formats générés par WordPress "
586
- "ici."
587
-
588
- #: inc/admin/ui/options.php:233
589
- #, php-format
590
- msgid "The %soriginal size%s is %sautomatically optimized%s by Imagify."
591
- msgstr "La %staille d’origine%s est %sautomatiquement optimisée%s par Imagify."
592
-
593
- #: inc/admin/ui/options.php:236
594
- msgid ""
595
- "Remember each additional image size will affect your Imagify monthly usage!"
596
-