Smush Image Compression and Optimization - Version 2.4.4

Version Description

  • Fixed:
    • PNG to JPEG conversion not working for Multisite
    • Stats Calculation, Use custom query to retrieve data
    • Fixed warning and notices
    • Added check for invalid membership ( Pro Users )
    • thumbnails not being converted for PNG to JPEG conversion
  • Removed option to convert Transparent PNGs to JPEGs ( Pro Users )
Download this release

Release Info

Developer UmeshSingla
Plugin Icon 128x128 Smush Image Compression and Optimization
Version 2.4.4
Comparing to
See all releases

Code changes from version 2.4.3 to 2.4.4

assets/css/wp-smushit-admin.css CHANGED
@@ -99,6 +99,10 @@ Smush button transformation
99
  margin-top: 30px;
100
  }
101
 
 
 
 
 
102
  .wp-smush-pro.smush-settings-wrapper {
103
  width: 100%;
104
  }
@@ -557,6 +561,59 @@ table.wp-smush-stats-holder tr td:first-child {
557
  width: 100%;
558
  }
559
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
560
  .wpmud .wp-smush-welcome.wp-smush-container {
561
  background-image: url(../images/welcome-notice.png);
562
  background-repeat: no-repeat;
@@ -675,7 +732,7 @@ table.wp-smush-stats-holder tr td:first-child {
675
  .wp-smush-upload-images {
676
  display: block;
677
  overflow: hidden;
678
- padding: 10px 0;
679
  }
680
 
681
  /** Ongoing Bulk Smush **/
@@ -734,8 +791,9 @@ table.wp-smush-stats-holder tr td:first-child {
734
  }
735
 
736
  /** Image Remaining **/
737
- .wp-smush-remaining {
738
  background-color: #fee696;
 
739
  color: #514a30;
740
  line-height: 1.7;
741
  }
@@ -856,6 +914,7 @@ table.wp-smush-stats-holder tr td:first-child {
856
  }
857
 
858
  .smush-final-log {
 
859
  padding: 10px;
860
  }
861
 
@@ -1149,7 +1208,7 @@ small.smush-setting-description {
1149
  .wpmud .wp-smush-super-smush-content {
1150
  font-size: 11px;
1151
  margin-left: 160px;
1152
- padding: 15px 20px;
1153
  }
1154
  }
1155
 
99
  margin-top: 30px;
100
  }
101
 
102
+ .wpmud .bulk-smush-wrapper.wp-smush-container:not(.wp-smush-pro-install) {
103
+ padding-bottom: 0;
104
+ }
105
+
106
  .wp-smush-pro.smush-settings-wrapper {
107
  width: 100%;
108
  }
561
  width: 100%;
562
  }
563
 
564
+ #wp-smush-invalid-member {
565
+ border-radius: 5px;
566
+ font-family: 'Roboto', sans-serif;
567
+ font-size: 15px;
568
+ -webkit-font-smoothing: antialiased;
569
+ font-weight: 500;
570
+ margin-bottom: 20px;
571
+ overflow: hidden;
572
+ padding: 15px 30px;
573
+ position: relative;
574
+ }
575
+
576
+ #wp-smush-invalid-member.loading-notice:before {
577
+ content: attr(data-message);
578
+ position: absolute;
579
+ left: 0;
580
+ right: 0;
581
+ top: 0;
582
+ bottom: 0;
583
+ background-color: rgba(255, 255, 255, 0.7);
584
+ z-index: 5;
585
+ text-align: center;
586
+ line-height: 80px;
587
+ font-size: 18px;
588
+ }
589
+
590
+ #wp-smush-invalid-member.loaded-notice:before {
591
+ content: attr(data-message);
592
+ position: absolute;
593
+ left: 0;
594
+ right: 0;
595
+ top: 0;
596
+ bottom: 0;
597
+ background-color: rgba(255, 255, 255, 0.7);
598
+ z-index: 5;
599
+ text-align: center;
600
+ line-height: 80px;
601
+ font-size: 18px;
602
+ }
603
+
604
+ #wp-smush-invalid-member.loading-notice > div, #wp-smush-invalid-member.loaded-notice > div {
605
+ -webkit-filter: blur(2px);
606
+ -moz-filter: blur(2px);
607
+ -o-filter: blur(2px);
608
+ -ms-filter: blur(2px);
609
+ filter: blur(2px);
610
+ }
611
+
612
+ #wp-smush-invalid-member a {
613
+ color: #514a30;
614
+ text-decoration: underline;
615
+ }
616
+
617
  .wpmud .wp-smush-welcome.wp-smush-container {
618
  background-image: url(../images/welcome-notice.png);
619
  background-repeat: no-repeat;
732
  .wp-smush-upload-images {
733
  display: block;
734
  overflow: hidden;
735
+ padding: 10px 0 40px;
736
  }
737
 
738
  /** Ongoing Bulk Smush **/
791
  }
792
 
793
  /** Image Remaining **/
794
+ .wp-smush-remaining, #wp-smush-invalid-member {
795
  background-color: #fee696;
796
+ border: none;
797
  color: #514a30;
798
  line-height: 1.7;
799
  }
914
  }
915
 
916
  .smush-final-log {
917
+ margin-left: 0;
918
  padding: 10px;
919
  }
920
 
1208
  .wpmud .wp-smush-super-smush-content {
1209
  font-size: 11px;
1210
  margin-left: 160px;
1211
+ /*padding: 15px 20px;*/
1212
  }
1213
  }
1214
 
assets/js/wp-smushit-admin.js CHANGED
@@ -42,7 +42,20 @@ var update_dashoffset = function (stats) {
42
  circle_progress.css({'stroke-dashoffset': dashoffset});
43
  }
44
  }
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * Resize Background width
48
  */
@@ -53,7 +66,18 @@ var resize_width = function () {
53
  } else {
54
  jQuery('.wpmud .wp-smush-pro-adv').css({'background-size': '90%'});
55
  }
56
- }
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  jQuery(function ($) {
59
  var smushAddParams = function (url, data) {
@@ -182,6 +206,10 @@ jQuery(function ($) {
182
  if (typeof response.data != 'undefined') {
183
  //Append the smush stats or error
184
  self.$status.html(response.data);
 
 
 
 
185
  if (response.success && response.data !== "Not processed") {
186
  self.$status.removeClass('hidden');
187
  self.$button.parent().removeClass('unsmushed').addClass('smushed');
@@ -328,6 +356,7 @@ jQuery(function ($) {
328
  //if we have received the progress data, update the stats else skip
329
  if ('undefined' != typeof _res.data.stats) {
330
 
 
331
  update_dashoffset(_res.data.stats);
332
 
333
  //Update stats
@@ -425,6 +454,9 @@ jQuery(function ($) {
425
  }
426
  }
427
 
 
 
 
428
  if (typeof res.data !== "undefined" && res.data.error == 'bulk_request_image_limit_exceeded' && !self.is_resolved()) {
429
  //Add a data attribute to the smush button, to stop sending ajax
430
  self.$button.attr('continue_smush', false);
@@ -941,11 +973,8 @@ jQuery(function ($) {
941
  $('#wp-smush-welcome-box .smush-dismiss-welcome').on('click', function (e) {
942
  e.preventDefault();
943
  var $el = $(this).parents().eq(1);
944
- $el.fadeTo(100, 0, function () {
945
- $el.slideUp(100, function () {
946
- $el.remove();
947
- });
948
- });
949
  //Send a ajax request to save the dismissed notice option
950
  var param = {
951
  action: 'dismiss_welcome_notice'
@@ -957,11 +986,7 @@ jQuery(function ($) {
957
  $('body').on('click', '.wp-smush-notice .dev-icon-cross', function (e) {
958
  e.preventDefault();
959
  var $el = $(this).parent();
960
- $el.fadeTo(100, 0, function () {
961
- $el.slideUp(100, function () {
962
- $el.remove();
963
- });
964
- });
965
  });
966
 
967
  //On Click Update Settings. Check for change in settings
@@ -986,17 +1011,6 @@ jQuery(function ($) {
986
  if (keep_exif.checked && !super_smush.checked && !smush_original.checked && !resize_images.checked && !smush_pngjpg.checked) {
987
  update_button_txt = false;
988
  }
989
- //If PNG to JPEG conversion is enabled
990
- if (smush_pngjpg.checked && document.getElementById('png_to_jpg_transparent').checked ) {
991
- var jpg_bg = $('[name="wp-smush-png_to_jpg_background"]');
992
- //Check the length of hex code
993
- if (jpg_bg.val().length < 6) {
994
- $('.wp-smush-hex-notice').show();
995
- //Return false and add error class
996
- jpg_bg.addClass('error');
997
- return false;
998
- }
999
- }
1000
 
1001
  //Update text
1002
  self.attr('disabled', 'disabled').addClass('button-grey');
@@ -1034,11 +1048,7 @@ jQuery(function ($) {
1034
 
1035
  //Remove Parent div
1036
  var $el = self.parent();
1037
- $el.fadeTo(100, 0, function () {
1038
- $el.slideUp(100, function () {
1039
- $el.remove();
1040
- });
1041
- });
1042
 
1043
  //Remove Settings Notice
1044
  $('.wp-smush-notice.wp-smush-settings-updated').remove();
@@ -1164,11 +1174,6 @@ jQuery(function ($) {
1164
  }
1165
  });
1166
 
1167
- //On background input remove class error
1168
- $('#png_to_jpg_background').on('mouseup', function (e) {
1169
- $(this).removeClass('error');
1170
- });
1171
-
1172
  //Handle Twitter Share
1173
  $('#wp-smush-twitter-share').on('click', function (e) {
1174
  e.preventDefault();
@@ -1214,6 +1219,30 @@ jQuery(function ($) {
1214
  resize_width();
1215
  });
1216
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1217
 
1218
  });
1219
  (function ($) {
42
  circle_progress.css({'stroke-dashoffset': dashoffset});
43
  }
44
  }
45
+ };
46
+
47
+ var membership_validity = function( data ) {
48
+ var member_validity_notice = jQuery('#wp-smush-invalid-member');
49
+
50
+ //Check for Membership warning
51
+ if( 'undefined' != typeof ( data.show_warning ) && member_validity_notice.length > 0 ) {
52
+ if( data.show_warning ) {
53
+ member_validity_notice.show();
54
+ }else{
55
+ member_validity_notice.hide();
56
+ }
57
+ }
58
+ };
59
  /**
60
  * Resize Background width
61
  */
66
  } else {
67
  jQuery('.wpmud .wp-smush-pro-adv').css({'background-size': '90%'});
68
  }
69
+ };
70
+
71
+ var remove_element = function( el, timeout ) {
72
+ if( typeof timeout == 'undefined' ) {
73
+ timeout = 100;
74
+ }
75
+ el.fadeTo(timeout, 0, function () {
76
+ el.slideUp(timeout, function () {
77
+ el.remove();
78
+ });
79
+ });
80
+ };
81
 
82
  jQuery(function ($) {
83
  var smushAddParams = function (url, data) {
206
  if (typeof response.data != 'undefined') {
207
  //Append the smush stats or error
208
  self.$status.html(response.data);
209
+
210
+ //Check whether to show membership validity notice or not
211
+ membership_validity( response.data );
212
+
213
  if (response.success && response.data !== "Not processed") {
214
  self.$status.removeClass('hidden');
215
  self.$button.parent().removeClass('unsmushed').addClass('smushed');
356
  //if we have received the progress data, update the stats else skip
357
  if ('undefined' != typeof _res.data.stats) {
358
 
359
+ //Update Progress on Circle
360
  update_dashoffset(_res.data.stats);
361
 
362
  //Update stats
454
  }
455
  }
456
 
457
+ //Check whether to show the warning notice or not
458
+ membership_validity( res.data );
459
+
460
  if (typeof res.data !== "undefined" && res.data.error == 'bulk_request_image_limit_exceeded' && !self.is_resolved()) {
461
  //Add a data attribute to the smush button, to stop sending ajax
462
  self.$button.attr('continue_smush', false);
973
  $('#wp-smush-welcome-box .smush-dismiss-welcome').on('click', function (e) {
974
  e.preventDefault();
975
  var $el = $(this).parents().eq(1);
976
+ remove_element( $el );
977
+
 
 
 
978
  //Send a ajax request to save the dismissed notice option
979
  var param = {
980
  action: 'dismiss_welcome_notice'
986
  $('body').on('click', '.wp-smush-notice .dev-icon-cross', function (e) {
987
  e.preventDefault();
988
  var $el = $(this).parent();
989
+ remove_element( $el );
 
 
 
 
990
  });
991
 
992
  //On Click Update Settings. Check for change in settings
1011
  if (keep_exif.checked && !super_smush.checked && !smush_original.checked && !resize_images.checked && !smush_pngjpg.checked) {
1012
  update_button_txt = false;
1013
  }
 
 
 
 
 
 
 
 
 
 
 
1014
 
1015
  //Update text
1016
  self.attr('disabled', 'disabled').addClass('button-grey');
1048
 
1049
  //Remove Parent div
1050
  var $el = self.parent();
1051
+ remove_element( $el );
 
 
 
 
1052
 
1053
  //Remove Settings Notice
1054
  $('.wp-smush-notice.wp-smush-settings-updated').remove();
1174
  }
1175
  });
1176
 
 
 
 
 
 
1177
  //Handle Twitter Share
1178
  $('#wp-smush-twitter-share').on('click', function (e) {
1179
  e.preventDefault();
1219
  resize_width();
1220
  });
1221
  }
1222
+ //Handle Re-check button functionality
1223
+ $("#wp-smush-revalidate-member").on( 'click', function( e ) {
1224
+ e.preventDefault();
1225
+ //Ajax Params
1226
+ var params = {
1227
+ action: 'smush_show_warning',
1228
+ };
1229
+ var link = $(this);
1230
+ var parent = link.parents().eq(1);
1231
+ parent.addClass('loading-notice');
1232
+ $.get(ajaxurl, params, function ( r ) {
1233
+ //remove the warning
1234
+ parent.removeClass('loading-notice').addClass("loaded-notice");
1235
+ if( 0 == r ) {
1236
+ parent.attr('data-message', wp_smush_msgs.membership_valid );
1237
+ remove_element( parent, 1000 );
1238
+ }else{
1239
+ parent.attr( 'data-message', wp_smush_msgs.membership_invalid );
1240
+ setTimeout(function remove_loader() {
1241
+ parent.removeClass('loaded-notice');
1242
+ }, 1000)
1243
+ }
1244
+ });
1245
+ });
1246
 
1247
  });
1248
  (function ($) {
languages/wp-smushit.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the WP Smush package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WP Smush 2.4.3\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wp-smushit\n"
7
- "POT-Creation-Date: 2016-07-28 11:46:46+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -25,11 +25,11 @@ msgid "Oops, we could not do this..."
25
  msgstr ""
26
 
27
  #: assets/shared-ui/plugin-ui.php:272 extras/free-dashboard/module.php:395
28
- #: extras/free-dashboard/module.php:434 lib/class-wp-smush-ui.php:835
29
  msgid "Saving"
30
  msgstr ""
31
 
32
- #: assets/shared-ui/plugin-ui.php:301 lib/class-wp-smush-ui.php:835
33
  msgid "Dismiss"
34
  msgstr ""
35
 
@@ -57,197 +57,205 @@ msgstr ""
57
  msgid "Rate %s"
58
  msgstr ""
59
 
60
- #: lib/class-wp-smush-admin.php:162
61
  msgid "Automatically smush my images on upload"
62
  msgstr ""
63
 
64
- #: lib/class-wp-smush-admin.php:163
65
  msgid "When you upload images to the media library, we’ll automatically optimize them."
66
  msgstr ""
67
 
68
- #: lib/class-wp-smush-admin.php:166
69
  msgid "Preserve image EXIF data"
70
  msgstr ""
71
 
72
- #: lib/class-wp-smush-admin.php:167
73
  msgid "EXIF data stores camera settings, focal length, date, time and location information in image files. EXIF data makes image files larger but if you are a photographer you may want to preserve this information."
74
  msgstr ""
75
 
76
- #: lib/class-wp-smush-admin.php:170
77
  msgid "Resize original images"
78
  msgstr ""
79
 
80
- #: lib/class-wp-smush-admin.php:171
81
  msgid "Save a ton of space by not storing over-sized images on your server. Set image maximum width and height and large images will be automatically scaled before being added to the media library."
82
  msgstr ""
83
 
84
- #: lib/class-wp-smush-admin.php:174
85
  msgid "Super-smush my images"
86
  msgstr ""
87
 
88
- #: lib/class-wp-smush-admin.php:175
89
  msgid "Compress images up to 2x more than regular smush with almost no visible drop in quality."
90
  msgstr ""
91
 
92
- #: lib/class-wp-smush-admin.php:178
93
  msgid "Include my original full-size images"
94
  msgstr ""
95
 
96
- #: lib/class-wp-smush-admin.php:179
97
  msgid "WordPress crops and resizes every image you upload for embedding on your site. By default, Smush only compresses these cropped and resized images, not your original full-size images. To save space on your server, activate this setting to smush your original images, too. Note: This doesn’t usually improve page speed."
98
  msgstr ""
99
 
100
- #: lib/class-wp-smush-admin.php:182
101
  msgid "Make a copy of my original images"
102
  msgstr ""
103
 
104
- #: lib/class-wp-smush-admin.php:183
105
  msgid "Save your original full-size images so you can restore them at any point. Note: Activating this setting will significantly increase the size of your uploads folder by nearly twice as much."
106
  msgstr ""
107
 
108
- #: lib/class-wp-smush-admin.php:186
109
  msgid "Convert PNG to JPEG (lossy)"
110
  msgstr ""
111
 
112
- #: lib/class-wp-smush-admin.php:187
113
- msgid "When you optimise a PNG, Smush will check if converting it to a JPEG will reduce the file size, and if so it will automatically convert it. Note: Smush will only convert the file format if it results in smaller file size. This will change the file's name, any hardcoded URLs will need updating."
114
  msgstr ""
115
 
116
- #: lib/class-wp-smush-admin.php:194
117
  msgid "Enable NextGen Gallery integration"
118
  msgstr ""
119
 
120
- #: lib/class-wp-smush-admin.php:195
121
  msgid "Allow smushing images directly through NextGen Gallery settings."
122
  msgstr ""
123
 
124
- #: lib/class-wp-smush-admin.php:217 lib/class-wp-smush-ui.php:774
125
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:70
126
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:89
127
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:91
128
  msgid "WP Smush"
129
  msgstr ""
130
 
131
- #: lib/class-wp-smush-admin.php:316 lib/class-wp-smush.php:990
132
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:158
133
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:275
134
  msgid "Super-Smush"
135
  msgstr ""
136
 
137
- #: lib/class-wp-smush-admin.php:317
138
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:159
139
  msgid "Smush Now"
140
  msgstr ""
141
 
142
- #: lib/class-wp-smush-admin.php:318
143
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:160
144
  msgid "{{errors}} image(s) were skipped due to an error."
145
  msgstr ""
146
 
147
- #: lib/class-wp-smush-admin.php:319
148
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:161
149
  msgid "All images are fully optimised."
150
  msgstr ""
151
 
152
- #: lib/class-wp-smush-admin.php:320
153
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:162
154
  msgid "Restoring image.."
155
  msgstr ""
156
 
157
- #: lib/class-wp-smush-admin.php:321
158
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:163
159
  msgid "Smushing image.."
160
  msgstr ""
161
 
162
- #: lib/class-wp-smush-admin.php:322
163
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:164
164
  msgid "Checking images.."
165
  msgstr ""
166
 
167
- #: lib/class-wp-smush-admin.php:575
 
 
 
 
 
 
 
 
168
  msgid "Smush request timed out, You can try setting a higher value for `WP_SMUSH_API_TIMEOUT`."
169
  msgstr ""
170
 
171
- #: lib/class-wp-smush-admin.php:592
172
  msgid "You've smushed %d images in total."
173
  msgstr ""
174
 
175
- #: lib/class-wp-smush-admin.php:612 lib/class-wp-smush-nextgen.php:384
176
  msgid "You don't have permission to work with uploaded files."
177
  msgstr ""
178
 
179
- #: lib/class-wp-smush-admin.php:616 lib/class-wp-smush-nextgen.php:388
180
  msgid "No attachment ID was provided."
181
  msgstr ""
182
 
183
- #: lib/class-wp-smush-admin.php:743
184
  msgid "<strong>%d of %d images</strong> were sent for smushing:"
185
  msgstr ""
186
 
187
- #: lib/class-wp-smush-admin.php:1024 lib/class-wp-smush-admin.php:1037
188
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:336
189
  msgid "Bulk Smush Now"
190
  msgstr ""
191
 
192
- #: lib/class-wp-smush-admin.php:1031
193
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:340
194
  msgid "All Done!"
195
  msgstr ""
196
 
197
- #: lib/class-wp-smush-admin.php:1070 lib/class-wp-smush-admin.php:1821
198
  msgid "Settings"
199
  msgstr ""
200
 
201
- #: lib/class-wp-smush-admin.php:1216
202
  msgid "Image not smushed, fields empty."
203
  msgstr ""
204
 
205
- #: lib/class-wp-smush-admin.php:1223 lib/class-wp-smush-nextgen.php:571
206
  msgid "Image couldn't be smushed as the nonce verification failed, try reloading the page."
207
  msgstr ""
208
 
209
- #: lib/class-wp-smush-admin.php:1240
210
  msgid "Unable to smush image"
211
  msgstr ""
212
 
213
- #: lib/class-wp-smush-admin.php:1259
214
  msgid "Yay! All images are optimised as per your current settings."
215
  msgstr ""
216
 
217
- #: lib/class-wp-smush-admin.php:1432 lib/class-wp-smush-ui.php:749
218
  msgid "You have images that need smushing. %sBulk smush now!%s"
219
  msgstr ""
220
 
221
- #: lib/class-wp-smush-admin.php:1822 lib/class-wp-smush-ui.php:643
222
- #: lib/class-wp-smush-ui.php:774
223
  msgid "WP Smush Pro"
224
  msgstr ""
225
 
226
- #: lib/class-wp-smush-admin.php:1825
227
  msgid "Woohoo! Your latest Smush update %s allows you to %sauto resize%s all your images, how cool is that! %sFind out more here >>%s"
228
  msgstr ""
229
 
230
- #: lib/class-wp-smush-backup.php:81 lib/class-wp-smush-nextgen.php:471
231
  msgid "Error in processing restore action, Fields empty."
232
  msgstr ""
233
 
234
- #: lib/class-wp-smush-backup.php:88 lib/class-wp-smush-nextgen.php:478
235
  msgid "Image not restored, Nonce verification failed."
236
  msgstr ""
237
 
238
- #: lib/class-wp-smush-backup.php:182 lib/class-wp-smush-nextgen.php:553
239
  msgid "Unable to restore image"
240
  msgstr ""
241
 
242
- #: lib/class-wp-smush-nextgen.php:330
243
  msgid "We couldn't find the metadata for the image, possibly the image has been deleted."
244
  msgstr ""
245
 
246
- #: lib/class-wp-smush-nextgen.php:564
247
  msgid "We couldn't process the image, fields empty."
248
  msgstr ""
249
 
250
- #: lib/class-wp-smush-nextgen.php:588
251
  msgid "Unable to smush image, %s"
252
  msgstr ""
253
 
@@ -374,267 +382,263 @@ msgstr ""
374
  msgid "ADVANCED SETTINGS"
375
  msgstr ""
376
 
377
- #: lib/class-wp-smush-ui.php:327
378
- msgid "Enter 6 character Hexcode"
379
- msgstr ""
380
-
381
- #: lib/class-wp-smush-ui.php:332
382
- msgid "Convert transparent images and use background color %s"
383
- msgstr ""
384
-
385
- #: lib/class-wp-smush-ui.php:334
386
- msgid "Color hexcode should be 6 characters."
387
- msgstr ""
388
-
389
- #: lib/class-wp-smush-ui.php:411
390
  msgid "The Following image sizes will be optimised by WP Smush:"
391
  msgstr ""
392
 
393
- #: lib/class-wp-smush-ui.php:462
394
  msgid "Width"
395
  msgstr ""
396
 
397
- #: lib/class-wp-smush-ui.php:465
398
  msgid "Height"
399
  msgstr ""
400
 
401
- #: lib/class-wp-smush-ui.php:468
402
  msgid "Currently, your largest thumbnail size is set at %s%dpx wide x %dpx high%s. Anything above 2048px in width or height is huge and not recommended."
403
  msgstr ""
404
 
405
- #: lib/class-wp-smush-ui.php:469
406
  msgid "Just to let you know, the width you've entered is less than your largest thumbnail and may result in pixelation."
407
  msgstr ""
408
 
409
- #: lib/class-wp-smush-ui.php:470
410
  msgid "Just to let you know, the height you’ve entered is less than your largest thumbnail and may result in pixelation."
411
  msgstr ""
412
 
413
- #: lib/class-wp-smush-ui.php:580
414
  msgid "BOOST YOUR PERFORMANCE - HUMMINGBIRD"
415
  msgstr ""
416
 
417
- #: lib/class-wp-smush-ui.php:607
418
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:423
419
  msgid "No attachments found - Upload some images"
420
  msgstr ""
421
 
422
- #: lib/class-wp-smush-ui.php:609
423
  msgid "We haven’t found any images in your %smedia library%s yet so there’s no smushing to be done! Once you upload images, reload this page and start playing!"
424
  msgstr ""
425
 
426
- #: lib/class-wp-smush-ui.php:612
427
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:428
428
  msgid "UPLOAD IMAGES"
429
  msgstr ""
430
 
431
- #: lib/class-wp-smush-ui.php:617
432
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:433
433
  msgid "All images are smushed and up to date. Awesome!"
434
  msgstr ""
435
 
436
- #: lib/class-wp-smush-ui.php:622
437
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:438
438
  msgid "BULK SMUSH NOW"
439
  msgstr ""
440
 
441
- #: lib/class-wp-smush-ui.php:641
442
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:446
443
  msgid "%s, you have %s%s%d%s image%s that needs smushing!"
444
  msgid_plural "%s, you have %s%s%d%s images%s that need smushing!"
445
  msgstr[0] ""
446
  msgstr[1] ""
447
 
448
- #: lib/class-wp-smush-ui.php:643
449
  msgid "You can %sUpgrade to Pro%s to bulk smush all your images with one click."
450
  msgstr ""
451
 
452
- #: lib/class-wp-smush-ui.php:644
453
  msgid "Free users can smush 50 images with each click."
454
  msgstr ""
455
 
456
- #: lib/class-wp-smush-ui.php:653
457
  msgid "Enable Super-smush in the Settings area to get even more savings with almost no noticeable quality loss."
458
  msgstr ""
459
 
460
- #: lib/class-wp-smush-ui.php:676
461
  msgid "%sBulk smush is currently running.%s You need to keep this page open for the process to complete."
462
  msgstr ""
463
 
464
- #: lib/class-wp-smush-ui.php:686
465
  msgid "%s%d%s of %d attachments have been smushed."
466
  msgstr ""
467
 
468
- #: lib/class-wp-smush-ui.php:691
469
  msgid "CANCEL"
470
  msgstr ""
471
 
472
- #: lib/class-wp-smush-ui.php:727
473
  msgid "%s, you have %s%s%d%s image%s that needs re-compressing!"
474
  msgid_plural "%s, you have %s%s%d%s images%s that need re-compressing!"
475
  msgstr[0] ""
476
  msgstr[1] ""
477
 
478
- #: lib/class-wp-smush-ui.php:728
479
  msgid "Skip"
480
  msgstr ""
481
 
482
- #: lib/class-wp-smush-ui.php:742
483
  msgid "Your settings have been updated!"
484
  msgstr ""
485
 
486
- #: lib/class-wp-smush-ui.php:776
487
  msgid "Automatic smushing is %senabled%s. Newly uploaded images will be automagically compressed."
488
  msgstr ""
489
 
490
- #: lib/class-wp-smush-ui.php:776
491
  msgid "Automatic smushing is %sdisabled%s. Newly uploaded images will need to be manually smushed."
492
  msgstr ""
493
 
494
- #: lib/class-wp-smush-ui.php:807
495
  msgid "Thanks for installing Smush. We hope you like it!"
496
  msgstr ""
497
 
498
- #: lib/class-wp-smush-ui.php:808
499
  msgid "And hey, if you do, you can now try out Smush Pro for double the smushy goodness (benchmarked), entirely for free!"
500
  msgstr ""
501
 
502
- #: lib/class-wp-smush-ui.php:809 lib/class-wp-smush-ui.php:813
503
  msgid "Try Smush Pro for Free"
504
  msgstr ""
505
 
506
- #: lib/class-wp-smush-ui.php:811
507
  msgid "Thanks for updating Smush. Did you know that you can now try the Smush Pro for FREE?!"
508
  msgstr ""
509
 
510
- #: lib/class-wp-smush-ui.php:812
511
  msgid "Yep, Super Smush your images for double the savings, save originals and batch Smush thousands of images all at once.... no charge!"
512
  msgstr ""
513
 
514
- #: lib/class-wp-smush-ui.php:859
515
  msgid "Did you know WP Smush Pro delivers up to 2x better compression, allows you to smush your originals and removes any bulk smushing limits? – %sTry it absolutely FREE%s"
516
  msgstr ""
517
 
518
- #: lib/class-wp-smush-ui.php:859
519
  msgid "Try WP Smush Pro for FREE"
520
  msgstr ""
521
 
522
- #: lib/class-wp-smush.php:172
 
 
 
 
 
 
 
 
523
  msgid "File path is empty"
524
  msgstr ""
525
 
526
- #: lib/class-wp-smush.php:177
527
  msgid "Could not find %s"
528
  msgstr ""
529
 
530
- #: lib/class-wp-smush.php:182
531
  msgid "%s is not writable"
532
  msgstr ""
533
 
534
- #: lib/class-wp-smush.php:192
535
  msgid "Skipped (%s), image not found. Attachment: %s"
536
  msgstr ""
537
 
538
- #: lib/class-wp-smush.php:197
539
  msgid "Skipped (%s), size limit exceeded. Attachment: %s"
540
  msgstr ""
541
 
542
- #: lib/class-wp-smush.php:216
543
  msgid "Unknown API error"
544
  msgstr ""
545
 
546
- #: lib/class-wp-smush.php:646
547
  msgid "Error posting to API: %s"
548
  msgstr ""
549
 
550
- #: lib/class-wp-smush.php:652
551
  msgid "Error posting to API: %s %s"
552
  msgstr ""
553
 
554
- #: lib/class-wp-smush.php:669
555
  msgid "Smush data corrupted, try again."
556
  msgstr ""
557
 
558
- #: lib/class-wp-smush.php:685
559
  msgid "Image couldn't be smushed"
560
  msgstr ""
561
 
562
- #: lib/class-wp-smush.php:906 lib/class-wp-smush.php:910
563
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:193
564
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:196
565
  msgid "Already Optimized"
566
  msgstr ""
567
 
568
- #: lib/class-wp-smush.php:919
569
  msgid "%d images reduced "
570
  msgstr ""
571
 
572
- #: lib/class-wp-smush.php:919
573
  msgid "Reduced "
574
  msgstr ""
575
 
576
- #: lib/class-wp-smush.php:923
577
  msgid "by %s %s"
578
  msgstr ""
579
 
580
- #: lib/class-wp-smush.php:929
581
  msgid "<br /> Image Size: %s"
582
  msgstr ""
583
 
584
- #: lib/class-wp-smush.php:965
585
  msgid "Detailed stats for all the image sizes"
586
  msgstr ""
587
 
588
- #: lib/class-wp-smush.php:965
589
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:236
590
  msgid "Smush stats"
591
  msgstr ""
592
 
593
- #: lib/class-wp-smush.php:997
594
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:249
595
  msgid "Not processed"
596
  msgstr ""
597
 
598
- #: lib/class-wp-smush.php:1003
599
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:255
600
  msgid "Smush Now!"
601
  msgstr ""
602
 
603
- #: lib/class-wp-smush.php:1305
604
  msgid "When you upload an image to WordPress it automatically creates %s thumbnail sizes that are commonly used in your pages. WordPress also stores the original full-size image, but because these are not usually embedded on your site we don’t Smush them. Pro users can override this."
605
  msgstr ""
606
 
607
- #: lib/class-wp-smush.php:1308
608
  msgid "Image couldn't be smushed as it exceeded the 1Mb size limit, Pro users can smush images with size upto 32Mb."
609
  msgstr ""
610
 
611
- #: lib/class-wp-smush.php:1310
612
  msgid " Skipped"
613
  msgstr ""
614
 
615
- #: lib/class-wp-smush.php:1332
616
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:432
617
  msgid "Image size"
618
  msgstr ""
619
 
620
- #: lib/class-wp-smush.php:1333
621
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:433
622
  msgid "Savings"
623
  msgstr ""
624
 
625
- #: lib/class-wp-smush.php:1535
626
  msgid "Restore original image."
627
  msgstr ""
628
 
629
- #: lib/class-wp-smush.php:1535
630
  msgid "Restore image"
631
  msgstr ""
632
 
633
- #: lib/class-wp-smush.php:1580
634
  msgid "Smush image including original file."
635
  msgstr ""
636
 
637
- #: lib/class-wp-smush.php:1580
638
  msgid "Resmush image"
639
  msgstr ""
640
 
2
  # This file is distributed under the same license as the WP Smush package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WP Smush 2.4.4\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wp-smushit\n"
7
+ "POT-Creation-Date: 2016-08-16 05:15:22+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
25
  msgstr ""
26
 
27
  #: assets/shared-ui/plugin-ui.php:272 extras/free-dashboard/module.php:395
28
+ #: extras/free-dashboard/module.php:434 lib/class-wp-smush-ui.php:828
29
  msgid "Saving"
30
  msgstr ""
31
 
32
+ #: assets/shared-ui/plugin-ui.php:301 lib/class-wp-smush-ui.php:828
33
  msgid "Dismiss"
34
  msgstr ""
35
 
57
  msgid "Rate %s"
58
  msgstr ""
59
 
60
+ #: lib/class-wp-smush-admin.php:173
61
  msgid "Automatically smush my images on upload"
62
  msgstr ""
63
 
64
+ #: lib/class-wp-smush-admin.php:174
65
  msgid "When you upload images to the media library, we’ll automatically optimize them."
66
  msgstr ""
67
 
68
+ #: lib/class-wp-smush-admin.php:177
69
  msgid "Preserve image EXIF data"
70
  msgstr ""
71
 
72
+ #: lib/class-wp-smush-admin.php:178
73
  msgid "EXIF data stores camera settings, focal length, date, time and location information in image files. EXIF data makes image files larger but if you are a photographer you may want to preserve this information."
74
  msgstr ""
75
 
76
+ #: lib/class-wp-smush-admin.php:181
77
  msgid "Resize original images"
78
  msgstr ""
79
 
80
+ #: lib/class-wp-smush-admin.php:182
81
  msgid "Save a ton of space by not storing over-sized images on your server. Set image maximum width and height and large images will be automatically scaled before being added to the media library."
82
  msgstr ""
83
 
84
+ #: lib/class-wp-smush-admin.php:185
85
  msgid "Super-smush my images"
86
  msgstr ""
87
 
88
+ #: lib/class-wp-smush-admin.php:186
89
  msgid "Compress images up to 2x more than regular smush with almost no visible drop in quality."
90
  msgstr ""
91
 
92
+ #: lib/class-wp-smush-admin.php:189
93
  msgid "Include my original full-size images"
94
  msgstr ""
95
 
96
+ #: lib/class-wp-smush-admin.php:190
97
  msgid "WordPress crops and resizes every image you upload for embedding on your site. By default, Smush only compresses these cropped and resized images, not your original full-size images. To save space on your server, activate this setting to smush your original images, too. Note: This doesn’t usually improve page speed."
98
  msgstr ""
99
 
100
+ #: lib/class-wp-smush-admin.php:193
101
  msgid "Make a copy of my original images"
102
  msgstr ""
103
 
104
+ #: lib/class-wp-smush-admin.php:194
105
  msgid "Save your original full-size images so you can restore them at any point. Note: Activating this setting will significantly increase the size of your uploads folder by nearly twice as much."
106
  msgstr ""
107
 
108
+ #: lib/class-wp-smush-admin.php:197
109
  msgid "Convert PNG to JPEG (lossy)"
110
  msgstr ""
111
 
112
+ #: lib/class-wp-smush-admin.php:198
113
+ msgid "When you compress a PNG file, Smush will check if converting the file to JPEG will further reduce its size. %s Note: PNGs with transparency will be ignored and Smush will only convert the file format if it results in a smaller file size. This will change the files name and extension, and any hard-coded URLs will need to be updated."
114
  msgstr ""
115
 
116
+ #: lib/class-wp-smush-admin.php:205
117
  msgid "Enable NextGen Gallery integration"
118
  msgstr ""
119
 
120
+ #: lib/class-wp-smush-admin.php:206
121
  msgid "Allow smushing images directly through NextGen Gallery settings."
122
  msgstr ""
123
 
124
+ #: lib/class-wp-smush-admin.php:228 lib/class-wp-smush-ui.php:762
125
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:70
126
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:89
127
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:91
128
  msgid "WP Smush"
129
  msgstr ""
130
 
131
+ #: lib/class-wp-smush-admin.php:327 lib/class-wp-smush.php:998
132
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:158
133
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:275
134
  msgid "Super-Smush"
135
  msgstr ""
136
 
137
+ #: lib/class-wp-smush-admin.php:328
138
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:159
139
  msgid "Smush Now"
140
  msgstr ""
141
 
142
+ #: lib/class-wp-smush-admin.php:329
143
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:160
144
  msgid "{{errors}} image(s) were skipped due to an error."
145
  msgstr ""
146
 
147
+ #: lib/class-wp-smush-admin.php:330
148
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:161
149
  msgid "All images are fully optimised."
150
  msgstr ""
151
 
152
+ #: lib/class-wp-smush-admin.php:331
153
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:162
154
  msgid "Restoring image.."
155
  msgstr ""
156
 
157
+ #: lib/class-wp-smush-admin.php:332
158
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:163
159
  msgid "Smushing image.."
160
  msgstr ""
161
 
162
+ #: lib/class-wp-smush-admin.php:333
163
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:164
164
  msgid "Checking images.."
165
  msgstr ""
166
 
167
+ #: lib/class-wp-smush-admin.php:334
168
+ msgid "We successfully verified your membership, all the Pro features should work completely. "
169
+ msgstr ""
170
+
171
+ #: lib/class-wp-smush-admin.php:335
172
+ msgid "Your membership couldn't be verified."
173
+ msgstr ""
174
+
175
+ #: lib/class-wp-smush-admin.php:586
176
  msgid "Smush request timed out, You can try setting a higher value for `WP_SMUSH_API_TIMEOUT`."
177
  msgstr ""
178
 
179
+ #: lib/class-wp-smush-admin.php:603
180
  msgid "You've smushed %d images in total."
181
  msgstr ""
182
 
183
+ #: lib/class-wp-smush-admin.php:629 lib/class-wp-smush-nextgen.php:381
184
  msgid "You don't have permission to work with uploaded files."
185
  msgstr ""
186
 
187
+ #: lib/class-wp-smush-admin.php:633 lib/class-wp-smush-nextgen.php:385
188
  msgid "No attachment ID was provided."
189
  msgstr ""
190
 
191
+ #: lib/class-wp-smush-admin.php:760
192
  msgid "<strong>%d of %d images</strong> were sent for smushing:"
193
  msgstr ""
194
 
195
+ #: lib/class-wp-smush-admin.php:1057 lib/class-wp-smush-admin.php:1070
196
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:336
197
  msgid "Bulk Smush Now"
198
  msgstr ""
199
 
200
+ #: lib/class-wp-smush-admin.php:1064
201
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:340
202
  msgid "All Done!"
203
  msgstr ""
204
 
205
+ #: lib/class-wp-smush-admin.php:1103 lib/class-wp-smush-admin.php:1854
206
  msgid "Settings"
207
  msgstr ""
208
 
209
+ #: lib/class-wp-smush-admin.php:1249
210
  msgid "Image not smushed, fields empty."
211
  msgstr ""
212
 
213
+ #: lib/class-wp-smush-admin.php:1256 lib/class-wp-smush-nextgen.php:568
214
  msgid "Image couldn't be smushed as the nonce verification failed, try reloading the page."
215
  msgstr ""
216
 
217
+ #: lib/class-wp-smush-admin.php:1273
218
  msgid "Unable to smush image"
219
  msgstr ""
220
 
221
+ #: lib/class-wp-smush-admin.php:1292
222
  msgid "Yay! All images are optimised as per your current settings."
223
  msgstr ""
224
 
225
+ #: lib/class-wp-smush-admin.php:1465 lib/class-wp-smush-ui.php:737
226
  msgid "You have images that need smushing. %sBulk smush now!%s"
227
  msgstr ""
228
 
229
+ #: lib/class-wp-smush-admin.php:1855 lib/class-wp-smush-ui.php:631
230
+ #: lib/class-wp-smush-ui.php:762
231
  msgid "WP Smush Pro"
232
  msgstr ""
233
 
234
+ #: lib/class-wp-smush-admin.php:1858
235
  msgid "Woohoo! Your latest Smush update %s allows you to %sauto resize%s all your images, how cool is that! %sFind out more here >>%s"
236
  msgstr ""
237
 
238
+ #: lib/class-wp-smush-backup.php:81 lib/class-wp-smush-nextgen.php:468
239
  msgid "Error in processing restore action, Fields empty."
240
  msgstr ""
241
 
242
+ #: lib/class-wp-smush-backup.php:88 lib/class-wp-smush-nextgen.php:475
243
  msgid "Image not restored, Nonce verification failed."
244
  msgstr ""
245
 
246
+ #: lib/class-wp-smush-backup.php:182 lib/class-wp-smush-nextgen.php:550
247
  msgid "Unable to restore image"
248
  msgstr ""
249
 
250
+ #: lib/class-wp-smush-nextgen.php:326
251
  msgid "We couldn't find the metadata for the image, possibly the image has been deleted."
252
  msgstr ""
253
 
254
+ #: lib/class-wp-smush-nextgen.php:561
255
  msgid "We couldn't process the image, fields empty."
256
  msgstr ""
257
 
258
+ #: lib/class-wp-smush-nextgen.php:585
259
  msgid "Unable to smush image, %s"
260
  msgstr ""
261
 
382
  msgid "ADVANCED SETTINGS"
383
  msgstr ""
384
 
385
+ #: lib/class-wp-smush-ui.php:399
 
 
 
 
 
 
 
 
 
 
 
 
386
  msgid "The Following image sizes will be optimised by WP Smush:"
387
  msgstr ""
388
 
389
+ #: lib/class-wp-smush-ui.php:450
390
  msgid "Width"
391
  msgstr ""
392
 
393
+ #: lib/class-wp-smush-ui.php:453
394
  msgid "Height"
395
  msgstr ""
396
 
397
+ #: lib/class-wp-smush-ui.php:456
398
  msgid "Currently, your largest thumbnail size is set at %s%dpx wide x %dpx high%s. Anything above 2048px in width or height is huge and not recommended."
399
  msgstr ""
400
 
401
+ #: lib/class-wp-smush-ui.php:457
402
  msgid "Just to let you know, the width you've entered is less than your largest thumbnail and may result in pixelation."
403
  msgstr ""
404
 
405
+ #: lib/class-wp-smush-ui.php:458
406
  msgid "Just to let you know, the height you’ve entered is less than your largest thumbnail and may result in pixelation."
407
  msgstr ""
408
 
409
+ #: lib/class-wp-smush-ui.php:568
410
  msgid "BOOST YOUR PERFORMANCE - HUMMINGBIRD"
411
  msgstr ""
412
 
413
+ #: lib/class-wp-smush-ui.php:595
414
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:423
415
  msgid "No attachments found - Upload some images"
416
  msgstr ""
417
 
418
+ #: lib/class-wp-smush-ui.php:597
419
  msgid "We haven’t found any images in your %smedia library%s yet so there’s no smushing to be done! Once you upload images, reload this page and start playing!"
420
  msgstr ""
421
 
422
+ #: lib/class-wp-smush-ui.php:600
423
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:428
424
  msgid "UPLOAD IMAGES"
425
  msgstr ""
426
 
427
+ #: lib/class-wp-smush-ui.php:605
428
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:433
429
  msgid "All images are smushed and up to date. Awesome!"
430
  msgstr ""
431
 
432
+ #: lib/class-wp-smush-ui.php:610
433
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:438
434
  msgid "BULK SMUSH NOW"
435
  msgstr ""
436
 
437
+ #: lib/class-wp-smush-ui.php:629
438
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:446
439
  msgid "%s, you have %s%s%d%s image%s that needs smushing!"
440
  msgid_plural "%s, you have %s%s%d%s images%s that need smushing!"
441
  msgstr[0] ""
442
  msgstr[1] ""
443
 
444
+ #: lib/class-wp-smush-ui.php:631
445
  msgid "You can %sUpgrade to Pro%s to bulk smush all your images with one click."
446
  msgstr ""
447
 
448
+ #: lib/class-wp-smush-ui.php:632
449
  msgid "Free users can smush 50 images with each click."
450
  msgstr ""
451
 
452
+ #: lib/class-wp-smush-ui.php:641
453
  msgid "Enable Super-smush in the Settings area to get even more savings with almost no noticeable quality loss."
454
  msgstr ""
455
 
456
+ #: lib/class-wp-smush-ui.php:664
457
  msgid "%sBulk smush is currently running.%s You need to keep this page open for the process to complete."
458
  msgstr ""
459
 
460
+ #: lib/class-wp-smush-ui.php:674
461
  msgid "%s%d%s of %d attachments have been smushed."
462
  msgstr ""
463
 
464
+ #: lib/class-wp-smush-ui.php:679
465
  msgid "CANCEL"
466
  msgstr ""
467
 
468
+ #: lib/class-wp-smush-ui.php:715
469
  msgid "%s, you have %s%s%d%s image%s that needs re-compressing!"
470
  msgid_plural "%s, you have %s%s%d%s images%s that need re-compressing!"
471
  msgstr[0] ""
472
  msgstr[1] ""
473
 
474
+ #: lib/class-wp-smush-ui.php:716
475
  msgid "Skip"
476
  msgstr ""
477
 
478
+ #: lib/class-wp-smush-ui.php:730
479
  msgid "Your settings have been updated!"
480
  msgstr ""
481
 
482
+ #: lib/class-wp-smush-ui.php:764
483
  msgid "Automatic smushing is %senabled%s. Newly uploaded images will be automagically compressed."
484
  msgstr ""
485
 
486
+ #: lib/class-wp-smush-ui.php:764
487
  msgid "Automatic smushing is %sdisabled%s. Newly uploaded images will need to be manually smushed."
488
  msgstr ""
489
 
490
+ #: lib/class-wp-smush-ui.php:800
491
  msgid "Thanks for installing Smush. We hope you like it!"
492
  msgstr ""
493
 
494
+ #: lib/class-wp-smush-ui.php:801
495
  msgid "And hey, if you do, you can now try out Smush Pro for double the smushy goodness (benchmarked), entirely for free!"
496
  msgstr ""
497
 
498
+ #: lib/class-wp-smush-ui.php:802 lib/class-wp-smush-ui.php:806
499
  msgid "Try Smush Pro for Free"
500
  msgstr ""
501
 
502
+ #: lib/class-wp-smush-ui.php:804
503
  msgid "Thanks for updating Smush. Did you know that you can now try the Smush Pro for FREE?!"
504
  msgstr ""
505
 
506
+ #: lib/class-wp-smush-ui.php:805
507
  msgid "Yep, Super Smush your images for double the savings, save originals and batch Smush thousands of images all at once.... no charge!"
508
  msgstr ""
509
 
510
+ #: lib/class-wp-smush-ui.php:852
511
  msgid "Did you know WP Smush Pro delivers up to 2x better compression, allows you to smush your originals and removes any bulk smushing limits? – %sTry it absolutely FREE%s"
512
  msgstr ""
513
 
514
+ #: lib/class-wp-smush-ui.php:852
515
  msgid "Try WP Smush Pro for FREE"
516
  msgstr ""
517
 
518
+ #: lib/class-wp-smush-ui.php:875
519
+ msgid "Validating.."
520
+ msgstr ""
521
+
522
+ #: lib/class-wp-smush-ui.php:877
523
+ msgid "It looks like Smush couldn’t verify your WPMU DEV membership so Pro features like Super-Smush may not work correctly. If you think this is an error, run a %sre-check%s or get in touch with our %ssupport team%s."
524
+ msgstr ""
525
+
526
+ #: lib/class-wp-smush.php:175
527
  msgid "File path is empty"
528
  msgstr ""
529
 
530
+ #: lib/class-wp-smush.php:180
531
  msgid "Could not find %s"
532
  msgstr ""
533
 
534
+ #: lib/class-wp-smush.php:185
535
  msgid "%s is not writable"
536
  msgstr ""
537
 
538
+ #: lib/class-wp-smush.php:195
539
  msgid "Skipped (%s), image not found. Attachment: %s"
540
  msgstr ""
541
 
542
+ #: lib/class-wp-smush.php:200
543
  msgid "Skipped (%s), size limit exceeded. Attachment: %s"
544
  msgstr ""
545
 
546
+ #: lib/class-wp-smush.php:219
547
  msgid "Unknown API error"
548
  msgstr ""
549
 
550
+ #: lib/class-wp-smush.php:650
551
  msgid "Error posting to API: %s"
552
  msgstr ""
553
 
554
+ #: lib/class-wp-smush.php:656
555
  msgid "Error posting to API: %s %s"
556
  msgstr ""
557
 
558
+ #: lib/class-wp-smush.php:673
559
  msgid "Smush data corrupted, try again."
560
  msgstr ""
561
 
562
+ #: lib/class-wp-smush.php:693
563
  msgid "Image couldn't be smushed"
564
  msgstr ""
565
 
566
+ #: lib/class-wp-smush.php:914 lib/class-wp-smush.php:918
567
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:193
568
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:196
569
  msgid "Already Optimized"
570
  msgstr ""
571
 
572
+ #: lib/class-wp-smush.php:927
573
  msgid "%d images reduced "
574
  msgstr ""
575
 
576
+ #: lib/class-wp-smush.php:927
577
  msgid "Reduced "
578
  msgstr ""
579
 
580
+ #: lib/class-wp-smush.php:931
581
  msgid "by %s %s"
582
  msgstr ""
583
 
584
+ #: lib/class-wp-smush.php:937
585
  msgid "<br /> Image Size: %s"
586
  msgstr ""
587
 
588
+ #: lib/class-wp-smush.php:973
589
  msgid "Detailed stats for all the image sizes"
590
  msgstr ""
591
 
592
+ #: lib/class-wp-smush.php:973
593
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:236
594
  msgid "Smush stats"
595
  msgstr ""
596
 
597
+ #: lib/class-wp-smush.php:1005
598
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:249
599
  msgid "Not processed"
600
  msgstr ""
601
 
602
+ #: lib/class-wp-smush.php:1011
603
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:255
604
  msgid "Smush Now!"
605
  msgstr ""
606
 
607
+ #: lib/class-wp-smush.php:1314
608
  msgid "When you upload an image to WordPress it automatically creates %s thumbnail sizes that are commonly used in your pages. WordPress also stores the original full-size image, but because these are not usually embedded on your site we don’t Smush them. Pro users can override this."
609
  msgstr ""
610
 
611
+ #: lib/class-wp-smush.php:1317
612
  msgid "Image couldn't be smushed as it exceeded the 1Mb size limit, Pro users can smush images with size upto 32Mb."
613
  msgstr ""
614
 
615
+ #: lib/class-wp-smush.php:1319
616
  msgid " Skipped"
617
  msgstr ""
618
 
619
+ #: lib/class-wp-smush.php:1341
620
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:432
621
  msgid "Image size"
622
  msgstr ""
623
 
624
+ #: lib/class-wp-smush.php:1342
625
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:433
626
  msgid "Savings"
627
  msgstr ""
628
 
629
+ #: lib/class-wp-smush.php:1546
630
  msgid "Restore original image."
631
  msgstr ""
632
 
633
+ #: lib/class-wp-smush.php:1546
634
  msgid "Restore image"
635
  msgstr ""
636
 
637
+ #: lib/class-wp-smush.php:1591
638
  msgid "Smush image including original file."
639
  msgstr ""
640
 
641
+ #: lib/class-wp-smush.php:1591
642
  msgid "Resmush image"
643
  msgstr ""
644
 
lib/class-wp-smush-admin.php CHANGED
@@ -95,6 +95,12 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
95
 
96
  public $image_sizes = array();
97
 
 
 
 
 
 
 
98
  /**
99
  * Constructor
100
  */
@@ -152,6 +158,11 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
152
 
153
  add_action( 'admin_init', array( $this, 'init_settings' ) );
154
 
 
 
 
 
 
155
  $this->bulk_ui = new WpSmushBulkUi();
156
 
157
  }
@@ -184,7 +195,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
184
  ),
185
  'png_to_jpg' => array(
186
  'label' => esc_html__( 'Convert PNG to JPEG (lossy)', 'wp-smushit' ),
187
- 'desc' => esc_html__( "When you optimise a PNG, Smush will check if converting it to a JPEG will reduce the file size, and if so it will automatically convert it. Note: Smush will only convert the file format if it results in smaller file size. This will change the file's name, any hardcoded URLs will need updating.", 'wp-smushit' )
188
  )
189
  );
190
 
@@ -313,13 +324,15 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
313
  $handle = 'wp-smushit-admin-js';
314
 
315
  $wp_smush_msgs = array(
316
- 'resmush' => esc_html__( 'Super-Smush', 'wp-smushit' ),
317
- 'smush_now' => esc_html__( 'Smush Now', 'wp-smushit' ),
318
- 'error_in_bulk' => esc_html__( '{{errors}} image(s) were skipped due to an error.', 'wp-smushit' ),
319
- 'all_resmushed' => esc_html__( 'All images are fully optimised.', 'wp-smushit' ),
320
- 'restore' => esc_html__( "Restoring image..", "wp-smushit" ),
321
- 'smushing' => esc_html__( "Smushing image..", "wp-smushit" ),
322
- 'checking' => esc_html__( "Checking images..", "wp-smushit" ),
 
 
323
  );
324
 
325
  wp_localize_script( $handle, 'wp_smush_msgs', $wp_smush_msgs );
@@ -379,11 +392,9 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
379
  function setup_global_stats( $force_update = false ) {
380
  global $wpsmush_stats;
381
  $this->total_count = $wpsmush_stats->total_count();
382
- $this->smushed_attachments = $wpsmush_stats->smushed_count( true );
383
  $this->smushed_count = ! empty( $this->smushed_attachments ) ? count( $this->smushed_attachments ) : 0;
384
  $this->remaining_count = $this->remaining_count();
385
- $this->stats = $this->global_stats_from_ids( $force_update );
386
- // $this->stats = $this->global_stats( $force_update );
387
  }
388
 
389
  /**
@@ -586,15 +597,21 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
586
  $stats['smushed'] = ! empty( $this->resmush_ids ) ? $this->smushed_count - $resmush_count : $this->smushed_count;
587
 
588
  if ( $WpSmush->lossy_enabled ) {
589
- $stats['super_smushed'] = $wpsmush_stats->super_smushed_count();
590
  }
591
 
592
  $stats['tooltip_text'] = ! empty( $stats['total_images'] ) ? sprintf( esc_html__( "You've smushed %d images in total.", "wp-smushit" ), $stats['total_images'] ) : '';
593
 
594
  //Send ajax response
595
- $send_error ? wp_send_json_error( array( 'stats' => $stats,
596
- 'error_msg' => $error
597
- ) ) : wp_send_json_success( array( 'stats' => $stats ) );
 
 
 
 
 
 
598
 
599
  }
600
 
@@ -660,7 +677,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
660
  if ( $return ) {
661
  return array( 'error' => $smush->get_error_message() );
662
  } else {
663
- wp_send_json_error( array( 'error_msg' => '<p class="wp-smush-error-message">' . $smush->get_error_message() . '</p>' ) );
664
  }
665
  } else {
666
  if ( $return ) {
@@ -799,7 +816,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
799
  }
800
  }
801
 
802
- global $wpdb, $WpSmush, $wpsmush_stats;
803
 
804
  $smush_data = array(
805
  'size_before' => 0,
@@ -816,20 +833,30 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
816
  $offset = 0;
817
  $query_next = true;
818
 
819
- while ( $query_next ) {
 
 
820
 
821
- $global_data = $wpdb->get_col( $wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key=%s LIMIT $offset, $limit", "wp-smpro-smush-data" ) );
822
 
 
823
  if ( ! empty( $global_data ) ) {
824
- $smush_data['count'] = 0;
825
- $smush_data['total_images'] = 0;
826
  foreach ( $global_data as $data ) {
827
- $data = maybe_unserialize( $data );
828
- if ( ! empty( $data['stats'] ) ) {
829
- $smush_data['count'] += 1;
830
- $smush_data['total_images'] += ! empty( $data['sizes'] ) ? count( $data['sizes'] ) : 0;
831
- $smush_data['size_before'] += ! empty( $data['stats']['size_before'] ) ? (int) $data['stats']['size_before'] : 0;
832
- $smush_data['size_after'] += ! empty( $data['stats']['size_after'] ) ? (int) $data['stats']['size_after'] : 0;
 
 
 
 
 
 
 
 
 
833
  }
834
  }
835
  }
@@ -872,10 +899,10 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
872
  $smush_data['size_after'] += $conversion_savings['size_after'];
873
 
874
  //Add the size before and after
875
- $smush_data['resize_savings'] = $this->format_bytes( $smush_data['resize_savings'] );
876
 
877
  //Conversion Savings
878
- $smush_data['conversion_savings'] = $this->format_bytes( $smush_data['conversion_savings'] );
879
 
880
  if ( $smush_data['size_before'] > 0 ) {
881
  $smush_data['percent'] = ( $smush_data['bytes'] / $smush_data['size_before'] ) * 100;
@@ -884,7 +911,13 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
884
  //Round off precentage
885
  $smush_data['percent'] = round( $smush_data['percent'], 1 );
886
 
887
- $smush_data['human'] = $WpSmush->format_bytes( $smush_data['bytes'] );
 
 
 
 
 
 
888
 
889
  //Update Cache
890
  wp_cache_set( 'smush_global_stats', $smush_data, '', DAY_IN_SECONDS );
@@ -986,10 +1019,10 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
986
  $smush_data['conversion_savings'] = ! empty( $conversion_savings['bytes'] ) ? $conversion_savings['bytes'] : 0;
987
 
988
  //Add the size before and after
989
- $smush_data['resize_savings'] = $this->format_bytes( $smush_data['resize_savings'] );
990
 
991
  //Conversion Savings
992
- $smush_data['conversion_savings'] = $this->format_bytes( $smush_data['conversion_savings'] );
993
 
994
  if ( $smush_data['size_before'] > 0 ) {
995
  $smush_data['percent'] = ( $smush_data['bytes'] / $smush_data['size_before'] ) * 100;
@@ -998,7 +1031,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
998
  //Round off precentage
999
  $smush_data['percent'] = round( $smush_data['percent'], 1 );
1000
 
1001
- $smush_data['human'] = $WpSmush->format_bytes( $smush_data['bytes'] );
1002
 
1003
  }
1004
  //Update Cache
@@ -1895,6 +1928,27 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
1895
 
1896
  }
1897
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1898
  }
1899
 
1900
  global $wpsmushit_admin;
95
 
96
  public $image_sizes = array();
97
 
98
+ /**
99
+ * @var string Stores the headers returned by the latest API call
100
+ *
101
+ */
102
+ public $api_headers = array();
103
+
104
  /**
105
  * Constructor
106
  */
158
 
159
  add_action( 'admin_init', array( $this, 'init_settings' ) );
160
 
161
+ /**
162
+ * Prints a membership validation issue notice in Media Library
163
+ */
164
+ add_action( 'admin_notices', array( $this, 'media_library_membership_notice' ) );
165
+
166
  $this->bulk_ui = new WpSmushBulkUi();
167
 
168
  }
195
  ),
196
  'png_to_jpg' => array(
197
  'label' => esc_html__( 'Convert PNG to JPEG (lossy)', 'wp-smushit' ),
198
+ 'desc' => sprintf( esc_html__( "When you compress a PNG file, Smush will check if converting the file to JPEG will further reduce its size. %s Note: PNGs with transparency will be ignored and Smush will only convert the file format if it results in a smaller file size. This will change the files name and extension, and any hard-coded URLs will need to be updated.", 'wp-smushit' ), "<br />" )
199
  )
200
  );
201
 
324
  $handle = 'wp-smushit-admin-js';
325
 
326
  $wp_smush_msgs = array(
327
+ 'resmush' => esc_html__( 'Super-Smush', 'wp-smushit' ),
328
+ 'smush_now' => esc_html__( 'Smush Now', 'wp-smushit' ),
329
+ 'error_in_bulk' => esc_html__( '{{errors}} image(s) were skipped due to an error.', 'wp-smushit' ),
330
+ 'all_resmushed' => esc_html__( 'All images are fully optimised.', 'wp-smushit' ),
331
+ 'restore' => esc_html__( "Restoring image..", "wp-smushit" ),
332
+ 'smushing' => esc_html__( "Smushing image..", "wp-smushit" ),
333
+ 'checking' => esc_html__( "Checking images..", "wp-smushit" ),
334
+ 'membership_valid' => esc_html__( "We successfully verified your membership, all the Pro features should work completely. ", "wp-smushit" ),
335
+ 'membership_invalid' => esc_html__( "Your membership couldn't be verified.", "wp-smushit" ),
336
  );
337
 
338
  wp_localize_script( $handle, 'wp_smush_msgs', $wp_smush_msgs );
392
  function setup_global_stats( $force_update = false ) {
393
  global $wpsmush_stats;
394
  $this->total_count = $wpsmush_stats->total_count();
395
+ $this->stats = $this->global_stats( $force_update );
396
  $this->smushed_count = ! empty( $this->smushed_attachments ) ? count( $this->smushed_attachments ) : 0;
397
  $this->remaining_count = $this->remaining_count();
 
 
398
  }
399
 
400
  /**
597
  $stats['smushed'] = ! empty( $this->resmush_ids ) ? $this->smushed_count - $resmush_count : $this->smushed_count;
598
 
599
  if ( $WpSmush->lossy_enabled ) {
600
+ $stats['super_smushed'] = $this->super_smushed;
601
  }
602
 
603
  $stats['tooltip_text'] = ! empty( $stats['total_images'] ) ? sprintf( esc_html__( "You've smushed %d images in total.", "wp-smushit" ), $stats['total_images'] ) : '';
604
 
605
  //Send ajax response
606
+ $send_error ? wp_send_json_error( array(
607
+ 'stats' => $stats,
608
+ 'error_msg' => $error,
609
+ 'show_warning' => intval( $this->show_warning() )
610
+
611
+ ) ) : wp_send_json_success( array(
612
+ 'stats' => $stats,
613
+ 'show_warning' => intval( $this->show_warning() )
614
+ ) );
615
 
616
  }
617
 
677
  if ( $return ) {
678
  return array( 'error' => $smush->get_error_message() );
679
  } else {
680
+ wp_send_json_error( array( 'error_msg' => '<p class="wp-smush-error-message">' . $smush->get_error_message() . '</p>', 'show_warning' => intval( $this->show_warning() ) ) );
681
  }
682
  } else {
683
  if ( $return ) {
816
  }
817
  }
818
 
819
+ global $wpdb, $wpsmush_stats;
820
 
821
  $smush_data = array(
822
  'size_before' => 0,
833
  $offset = 0;
834
  $query_next = true;
835
 
836
+ $supersmushed_count = 0;
837
+ $smush_data['total_images'] = 0;
838
+ $smush_data['id'] = array();
839
 
840
+ while ( $query_next ) {
841
 
842
+ $global_data = $wpdb->get_results( $wpdb->prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key=%s LIMIT $offset, $limit", "wp-smpro-smush-data" ) );
843
  if ( ! empty( $global_data ) ) {
 
 
844
  foreach ( $global_data as $data ) {
845
+ $smush_data['id'][] = $data->post_id;
846
+ if( !empty( $data->meta_value ) ) {
847
+ $meta = maybe_unserialize( $data->meta_value );
848
+ if ( ! empty( $meta['stats'] ) ) {
849
+
850
+ //Check for lossy Compression
851
+ if( 1 == $meta['stats']['lossy'] ) {
852
+ $supersmushed_count += 1;
853
+ }
854
+ //Total Image Smushed
855
+ $smush_data['total_images'] += ! empty( $meta['sizes'] ) ? count( $meta['sizes'] ) : 0;
856
+
857
+ $smush_data['size_before'] += ! empty( $meta['stats']['size_before'] ) ? (int) $meta['stats']['size_before'] : 0;
858
+ $smush_data['size_after'] += ! empty( $meta['stats']['size_after'] ) ? (int) $meta['stats']['size_after'] : 0;
859
+ }
860
  }
861
  }
862
  }
899
  $smush_data['size_after'] += $conversion_savings['size_after'];
900
 
901
  //Add the size before and after
902
+ $smush_data['resize_savings'] = size_format( $smush_data['resize_savings'], 1 );
903
 
904
  //Conversion Savings
905
+ $smush_data['conversion_savings'] = size_format( $smush_data['conversion_savings'], 1 );
906
 
907
  if ( $smush_data['size_before'] > 0 ) {
908
  $smush_data['percent'] = ( $smush_data['bytes'] / $smush_data['size_before'] ) * 100;
911
  //Round off precentage
912
  $smush_data['percent'] = round( $smush_data['percent'], 1 );
913
 
914
+ $smush_data['human'] = size_format( $smush_data['bytes'], 1 );
915
+
916
+ //Setup Smushed attachment ids
917
+ $this->smushed_attachments = !empty( $smush_data['id'] ) ? $smush_data['id'] : '';
918
+
919
+ //Super Smushed attachment count
920
+ $this->super_smushed = $supersmushed_count;
921
 
922
  //Update Cache
923
  wp_cache_set( 'smush_global_stats', $smush_data, '', DAY_IN_SECONDS );
1019
  $smush_data['conversion_savings'] = ! empty( $conversion_savings['bytes'] ) ? $conversion_savings['bytes'] : 0;
1020
 
1021
  //Add the size before and after
1022
+ $smush_data['resize_savings'] = size_format( $smush_data['resize_savings'], 1 );
1023
 
1024
  //Conversion Savings
1025
+ $smush_data['conversion_savings'] = size_format( $smush_data['conversion_savings'], 1 );
1026
 
1027
  if ( $smush_data['size_before'] > 0 ) {
1028
  $smush_data['percent'] = ( $smush_data['bytes'] / $smush_data['size_before'] ) * 100;
1031
  //Round off precentage
1032
  $smush_data['percent'] = round( $smush_data['percent'], 1 );
1033
 
1034
+ $smush_data['human'] = size_format( $smush_data['bytes'], 1 );
1035
 
1036
  }
1037
  //Update Cache
1928
 
1929
  }
1930
 
1931
+ /**
1932
+ * Prints the Membership Validation issue notice
1933
+ *
1934
+ */
1935
+ function media_library_membership_notice() {
1936
+
1937
+ //No need to print it for free version
1938
+ if( !$this->validate_install() ) {
1939
+ return;
1940
+ }
1941
+ //Show it on Media Library page only
1942
+ $screen = get_current_screen();
1943
+ $screen_id = !empty( $screen ) ? $screen->id : '';
1944
+ //Do not show notice anywhere else
1945
+ if( empty( $screen ) || 'upload' != $screen_id ) {
1946
+ return;
1947
+ }
1948
+
1949
+ echo $this->bulk_ui->get_user_validation_message( $notice = true );
1950
+ }
1951
+
1952
  }
1953
 
1954
  global $wpsmushit_admin;
lib/class-wp-smush-nextgen.php CHANGED
@@ -179,12 +179,6 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
179
  return false;
180
  }
181
 
182
- //Check if registered size is supposed to be converted or not
183
- global $wpsmushit_admin;
184
- if( 'full' != $size && $wpsmushit_admin->skip_image_size( $size ) ) {
185
- return false;
186
- }
187
-
188
  // We take the original image. Get the absolute path using the storage object
189
  $attachment_file_path_size = $storage->get_image_abspath( $image, $size );
190
 
@@ -315,7 +309,9 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
315
  * @param bool|true $echo , Whether to echo the stats or not, false for auto smush
316
  */
317
  function smush_image( $pid = '', $image = '', $echo = true ) {
318
- global $wpsmushnextgenstats;
 
 
319
 
320
  //Get image, if we have image id
321
  if ( ! empty( $pid ) ) {
@@ -333,6 +329,7 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
333
  $registry = C_Component_Registry::get_instance();
334
  $storage = $registry->get_utility( 'I_Gallery_Storage' );
335
 
 
336
  $metadata = $this->resize_image( $pid, $image, $metadata, $storage );
337
 
338
  //Store Meta
@@ -636,6 +633,9 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
636
  return $meta;
637
  }
638
 
 
 
 
639
  //If resizing not enabled, or if both max width and height is set to 0, return
640
  if ( ! $wpsmush_resize->resize_enabled || ( $wpsmush_resize->max_w == 0 && $wpsmush_resize->max_h == 0 ) ) {
641
  return $meta;
179
  return false;
180
  }
181
 
 
 
 
 
 
 
182
  // We take the original image. Get the absolute path using the storage object
183
  $attachment_file_path_size = $storage->get_image_abspath( $image, $size );
184
 
309
  * @param bool|true $echo , Whether to echo the stats or not, false for auto smush
310
  */
311
  function smush_image( $pid = '', $image = '', $echo = true ) {
312
+ global $wpsmushnextgenstats, $WpSmush;
313
+
314
+ $WpSmush->initialise();
315
 
316
  //Get image, if we have image id
317
  if ( ! empty( $pid ) ) {
329
  $registry = C_Component_Registry::get_instance();
330
  $storage = $registry->get_utility( 'I_Gallery_Storage' );
331
 
332
+ //Perform Resizing
333
  $metadata = $this->resize_image( $pid, $image, $metadata, $storage );
334
 
335
  //Store Meta
633
  return $meta;
634
  }
635
 
636
+ //Initialize resize class
637
+ $wpsmush_resize->initialize();
638
+
639
  //If resizing not enabled, or if both max width and height is set to 0, return
640
  if ( ! $wpsmush_resize->resize_enabled || ( $wpsmush_resize->max_w == 0 && $wpsmush_resize->max_h == 0 ) ) {
641
  return $meta;
lib/class-wp-smush-png_jpg.php CHANGED
@@ -123,7 +123,7 @@ if ( ! class_exists( 'WpSmushPngtoJpg' ) ) {
123
  $should_convert = false;
124
 
125
  //Get the Transparency conversion settings
126
- $convert_png = get_site_option( WP_SMUSH_PREFIX . 'png_to_jpg', false );
127
  if ( ! $convert_png ) {
128
  return $should_convert;
129
  }
@@ -157,7 +157,7 @@ if ( ! class_exists( 'WpSmushPngtoJpg' ) ) {
157
  * @return bool True/False Can be converted or not
158
  *
159
  */
160
- function can_be_converted( $id = '', $size = 'full', $mime = '' ) {
161
 
162
  if ( empty( $id ) ) {
163
  return false;
@@ -185,7 +185,9 @@ if ( ! class_exists( 'WpSmushPngtoJpg' ) ) {
185
  return false;
186
  }
187
 
188
- $file = get_attached_file( $id );
 
 
189
 
190
  /** Whether to convert to jpg or not **/
191
  $should_convert = $this->should_convert( $id, $file );
@@ -433,6 +435,8 @@ if ( ! class_exists( 'WpSmushPngtoJpg' ) ) {
433
  return $meta;
434
  }
435
 
 
 
436
  /** Whether to convert to jpg or not **/
437
  $should_convert = $this->can_be_converted( $id );
438
 
@@ -440,8 +444,6 @@ if ( ! class_exists( 'WpSmushPngtoJpg' ) ) {
440
  return $meta;
441
  }
442
 
443
- $file = get_attached_file( $id );
444
-
445
  $result['meta'] = $meta;
446
 
447
  if ( ! $this->is_transparent ) {
@@ -458,14 +460,15 @@ if ( ! class_exists( 'WpSmushPngtoJpg' ) ) {
458
  if ( ! empty( $meta['sizes'] ) ) {
459
  foreach ( $meta['sizes'] as $size_k => $data ) {
460
 
 
 
461
  /** Whether to convert to jpg or not **/
462
- $should_convert = $this->can_be_converted( $id, $size_k, 'image/png' );
463
 
464
  //Perform the conversion
465
  if ( ! $should_convert = apply_filters( 'wp_smush_convert_to_jpg', $should_convert, $id, $file, $size_k ) ) {
466
  continue;
467
  }
468
- $s_file = path_join( dirname( $file ), $data['file'] );
469
 
470
  //Perform the conversion, and update path
471
  if ( ! $this->is_transparent ) {
123
  $should_convert = false;
124
 
125
  //Get the Transparency conversion settings
126
+ $convert_png = get_option( WP_SMUSH_PREFIX . 'png_to_jpg', false );
127
  if ( ! $convert_png ) {
128
  return $should_convert;
129
  }
157
  * @return bool True/False Can be converted or not
158
  *
159
  */
160
+ function can_be_converted( $id = '', $size = 'full', $mime = '', $file = '' ) {
161
 
162
  if ( empty( $id ) ) {
163
  return false;
185
  return false;
186
  }
187
 
188
+ if ( empty( $file ) ) {
189
+ $file = get_attached_file( $id );
190
+ }
191
 
192
  /** Whether to convert to jpg or not **/
193
  $should_convert = $this->should_convert( $id, $file );
435
  return $meta;
436
  }
437
 
438
+ $file = get_attached_file( $id );
439
+
440
  /** Whether to convert to jpg or not **/
441
  $should_convert = $this->can_be_converted( $id );
442
 
444
  return $meta;
445
  }
446
 
 
 
447
  $result['meta'] = $meta;
448
 
449
  if ( ! $this->is_transparent ) {
460
  if ( ! empty( $meta['sizes'] ) ) {
461
  foreach ( $meta['sizes'] as $size_k => $data ) {
462
 
463
+ $s_file = path_join( dirname( $file ), $data['file'] );
464
+
465
  /** Whether to convert to jpg or not **/
466
+ $should_convert = $this->can_be_converted( $id, $size_k, 'image/png', $s_file );
467
 
468
  //Perform the conversion
469
  if ( ! $should_convert = apply_filters( 'wp_smush_convert_to_jpg', $should_convert, $id, $file, $size_k ) ) {
470
  continue;
471
  }
 
472
 
473
  //Perform the conversion, and update path
474
  if ( ! $this->is_transparent ) {
lib/class-wp-smush-stats.php CHANGED
@@ -279,30 +279,53 @@ if ( ! class_exists( 'WpSmushStats' ) ) {
279
  if ( ! $force_update ) {
280
  $savings = wp_cache_get( WP_SMUSH_PREFIX . 'resize_savings', 'wp-smush' );
281
  }
 
 
 
282
  //If nothing in cache, Calculate it
283
  if ( empty( $savings ) || $force_update ) {
284
- global $wpsmushit_admin;
285
  $savings = array(
286
  'bytes' => 0,
287
  'size_before' => 0,
288
  'size_after' => 0,
289
  );
290
 
291
- //Get the List of resized images
292
- $resized_images = $this->resize_images();
 
 
 
 
 
 
293
 
294
- //Iterate over them
295
- foreach ( $resized_images as $id ) {
296
- $meta = get_post_meta( $id, WP_SMUSH_PREFIX . 'resize_savings', true );
297
- if ( ! empty( $meta ) && ! empty( $meta['bytes'] ) ) {
298
- $savings['bytes'] += $meta['bytes'];
299
- $savings['size_before'] += $meta['size_before'];
300
- $savings['size_after'] += $meta['size_after'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  }
302
  }
303
 
304
  if ( $format ) {
305
- $savings['bytes'] = $wpsmushit_admin->format_bytes( $savings['bytes'] );
306
  }
307
 
308
  wp_cache_set( WP_SMUSH_PREFIX . 'resize_savings', $savings, 'wp-smush' );
@@ -334,30 +357,47 @@ if ( ! class_exists( 'WpSmushStats' ) ) {
334
  'size_after' => 0,
335
  );
336
 
337
- //Get the List of resized images
338
- $png_jpg_images = $this->converted_images();
339
-
340
- //Iterate over them
341
- foreach ( $png_jpg_images as $id ) {
342
- $meta = get_post_meta( $id, WP_SMUSH_PREFIX . 'pngjpg_savings', true );
343
- if ( ! empty( $meta ) ) {
344
- //Iterate Over
345
- foreach ( $meta as $size_savings ) {
346
- if ( ! is_array( $size_savings ) ) {
347
- continue;
348
- }
349
- //If we have savings, add all the stats
350
- if( !empty( $size_savings['bytes'])) {
351
- $savings['bytes'] += $size_savings['bytes'];
352
- $savings['size_before'] += $size_savings['size_before'];
353
- $savings['size_after'] += $size_savings['size_after'];
 
 
 
 
 
 
 
354
  }
355
  }
356
  }
 
 
 
 
 
 
 
 
 
 
357
  }
358
 
359
  if ( $format ) {
360
- $savings['bytes'] = $wpsmushit_admin->format_bytes( $savings['bytes'] );
361
  }
362
 
363
  wp_cache_set( WP_SMUSH_PREFIX . 'pngjpg_savings', $savings, 'wp-smush' );
@@ -427,11 +467,11 @@ if ( ! class_exists( 'WpSmushStats' ) ) {
427
  */
428
  function converted_images() {
429
  global $wpsmushit_admin;
430
- $limit = $wpsmushit_admin->query_limit();
431
- $limit = ! empty( $wpsmushit_admin->total_count ) && $wpsmushit_admin->total_count < $limit ? $wpsmushit_admin->total_count : $limit;
432
- $get_posts = true;
433
  $converted_images = array();
434
- $args = array(
435
  'fields' => 'ids',
436
  'post_type' => 'attachment',
437
  'post_status' => 'inherit',
279
  if ( ! $force_update ) {
280
  $savings = wp_cache_get( WP_SMUSH_PREFIX . 'resize_savings', 'wp-smush' );
281
  }
282
+
283
+ global $wpsmushit_admin;
284
+
285
  //If nothing in cache, Calculate it
286
  if ( empty( $savings ) || $force_update ) {
 
287
  $savings = array(
288
  'bytes' => 0,
289
  'size_before' => 0,
290
  'size_after' => 0,
291
  );
292
 
293
+ $limit = $wpsmushit_admin->query_limit();
294
+ $offset = 0;
295
+ $query_next = true;
296
+ global $wpdb;
297
+
298
+ while ( $query_next ) {
299
+
300
+ $resize_data = $wpdb->get_col( $wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key=%s LIMIT $offset, $limit", WP_SMUSH_PREFIX . 'resize_savings' ) );
301
 
302
+ if ( ! empty( $resize_data ) ) {
303
+ foreach ( $resize_data as $data ) {
304
+
305
+ if ( ! empty( $data ) ) {
306
+ $meta = maybe_unserialize( $data );
307
+ if ( ! empty( $meta ) && ! empty( $meta['bytes'] ) ) {
308
+ $savings['bytes'] += $meta['bytes'];
309
+ $savings['size_before'] += $meta['size_before'];
310
+ $savings['size_after'] += $meta['size_after'];
311
+ }
312
+ }
313
+ }
314
+ }
315
+ //Update the offset
316
+ $offset += $limit;
317
+
318
+ //Compare the Offset value to total images
319
+ if ( ! empty( $wpsmushit_admin->total_count ) && $wpsmushit_admin->total_count < $offset ) {
320
+ $query_next = false;
321
+ } elseif ( ! $resize_data ) {
322
+ //If we didn' got any results
323
+ $query_next = false;
324
  }
325
  }
326
 
327
  if ( $format ) {
328
+ $savings['bytes'] = size_format( $savings['bytes'], 1 );
329
  }
330
 
331
  wp_cache_set( WP_SMUSH_PREFIX . 'resize_savings', $savings, 'wp-smush' );
357
  'size_after' => 0,
358
  );
359
 
360
+ $limit = $wpsmushit_admin->query_limit();
361
+ $offset = 0;
362
+ $query_next = true;
363
+ global $wpdb;
364
+
365
+ while ( $query_next ) {
366
+
367
+ $conversion_savings = $wpdb->get_col( $wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key=%s LIMIT $offset, $limit", WP_SMUSH_PREFIX . 'pngjpg_savings' ) );
368
+
369
+ if ( ! empty( $conversion_savings ) ) {
370
+ foreach ( $conversion_savings as $data ) {
371
+
372
+ if ( ! empty( $data ) ) {
373
+ $meta = maybe_unserialize( $data );
374
+
375
+ if( is_array( $meta ) ) {
376
+ foreach ( $meta as $size ) {
377
+ if ( ! empty( $size ) && is_array( $size ) ) {
378
+ $savings['bytes'] += $size['bytes'];
379
+ $savings['size_before'] += $size['size_before'];
380
+ $savings['size_after'] += $size['size_after'];
381
+ }
382
+ }
383
+ }
384
  }
385
  }
386
  }
387
+ //Update the offset
388
+ $offset += $limit;
389
+
390
+ //Compare the Offset value to total images
391
+ if ( ! empty( $wpsmushit_admin->total_count ) && $wpsmushit_admin->total_count < $offset ) {
392
+ $query_next = false;
393
+ } elseif ( ! $conversion_savings ) {
394
+ //If we didn' got any results
395
+ $query_next = false;
396
+ }
397
  }
398
 
399
  if ( $format ) {
400
+ $savings['bytes'] = size_format( $savings['bytes'], 1 );
401
  }
402
 
403
  wp_cache_set( WP_SMUSH_PREFIX . 'pngjpg_savings', $savings, 'wp-smush' );
467
  */
468
  function converted_images() {
469
  global $wpsmushit_admin;
470
+ $limit = $wpsmushit_admin->query_limit();
471
+ $limit = ! empty( $wpsmushit_admin->total_count ) && $wpsmushit_admin->total_count < $limit ? $wpsmushit_admin->total_count : $limit;
472
+ $get_posts = true;
473
  $converted_images = array();
474
+ $args = array(
475
  'fields' => 'ids',
476
  'post_type' => 'attachment',
477
  'post_status' => 'inherit',
lib/class-wp-smush-ui.php CHANGED
@@ -232,7 +232,7 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
232
  <span class="float-l wp-smush-stats-label"><strong><?php esc_html_e( "PRO SAVINGS ESTIMATE", "wp-smushit" ); ?></strong><span class="wp-smush-stats-try-pro roboto-regular"><?php echo $pro_only; ?></span></span>
233
  <span class="float-r wp-smush-stats">
234
  <span class="wp-smush-stats-human">
235
- <?php echo $wpsmushit_admin->format_bytes( round( $savings_bytes, 1 ) ); ?>
236
  </span>
237
  <span class="wp-smush-stats-sep">/</span>
238
  <span class="wp-smush-stats-percent"><?php echo number_format_i18n( $savings, 1, '.', '' ); ?></span>%
@@ -322,19 +322,7 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
322
  value="1"
323
  name="<?php echo $setting_m_key; ?>" tabindex= "0">
324
  <label class="toggle-label" for="<?php echo $setting_m_key; ?>"></label>
325
- </span><?php
326
- if( 'png_to_jpg' == $setting_key ) {
327
- $bg_color = '#<input type="text" pattern=".{6,}" id="png_to_jpg_background" class="wp-smush-png_to_jpg_background" value="' . $transparent_png['background'] . '" placeholder="ffffff" name="' . $setting_m_key . '_background" tabindex="0" width="50px" maxlength="6" title="' . esc_html__("Enter 6 character Hexcode", "wp-smushit") . '" />';
328
- ?>
329
- <div class="wp-smush-png_to_jpg-wrap<?php echo $setting_val ? '' : ' hidden'?>">
330
- <label for="png_to_jpg_transparent">
331
- <input type="checkbox" id="png_to_jpg_transparent" class="wp-smush-png_to_jpg_transparent" name="<?php echo $setting_m_key; ?>_transparent" tabindex="0" <?php checked( $transparent_png['convert'] ); ?>/>
332
- <?php printf( esc_html__("Convert transparent images and use background color %s", "wp-smushit"), $bg_color ); ?>
333
- </label>
334
- <div class="wp-smush-settings-info wp-smush-hex-notice hidden"><?php esc_html_e("Color hexcode should be 6 characters.", "wp-smushit"); ?></div>
335
- </div><?php
336
- }
337
- ?>
338
  </div>
339
  <hr><?php
340
  }
@@ -774,13 +762,18 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
774
  $page_heading = $WpSmush->validate_install() ? esc_html__( 'WP Smush Pro', 'wp-smushit' ) : esc_html__( 'WP Smush', 'wp-smushit' );
775
 
776
  $auto_smush_message = $WpSmush->is_auto_smush_enabled() ? sprintf( esc_html__( "Automatic smushing is %senabled%s. Newly uploaded images will be automagically compressed." ), '<span class="wp-smush-auto-enabled">', '</span>' ) : sprintf( esc_html__( "Automatic smushing is %sdisabled%s. Newly uploaded images will need to be manually smushed." ), '<span class="wp-smush-auto-disabled">', '</span>' );
 
 
 
 
777
  echo '<div class="smush-page-wrap">
778
  <section id="header">
779
  <div class="wp-smush-page-header">
780
  <h1 class="wp-smush-page-heading">' . $page_heading . '</h1>
781
  <div class="wp-smush-auto-message roboto-regular">' . $auto_smush_message . '</div>
782
- </div>
783
- </section>';
 
784
  //Check if settings were updated and shoe a notice
785
  $this->settings_updated();
786
 
@@ -869,5 +862,21 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
869
  echo '</div><!-- End of Container wrap -->
870
  </div> <!-- End of div wrap -->';
871
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
872
  }
873
  }
232
  <span class="float-l wp-smush-stats-label"><strong><?php esc_html_e( "PRO SAVINGS ESTIMATE", "wp-smushit" ); ?></strong><span class="wp-smush-stats-try-pro roboto-regular"><?php echo $pro_only; ?></span></span>
233
  <span class="float-r wp-smush-stats">
234
  <span class="wp-smush-stats-human">
235
+ <?php echo size_format( $savings_bytes, 1 ); ?>
236
  </span>
237
  <span class="wp-smush-stats-sep">/</span>
238
  <span class="wp-smush-stats-percent"><?php echo number_format_i18n( $savings, 1, '.', '' ); ?></span>%
322
  value="1"
323
  name="<?php echo $setting_m_key; ?>" tabindex= "0">
324
  <label class="toggle-label" for="<?php echo $setting_m_key; ?>"></label>
325
+ </span>
 
 
 
 
 
 
 
 
 
 
 
 
326
  </div>
327
  <hr><?php
328
  }
762
  $page_heading = $WpSmush->validate_install() ? esc_html__( 'WP Smush Pro', 'wp-smushit' ) : esc_html__( 'WP Smush', 'wp-smushit' );
763
 
764
  $auto_smush_message = $WpSmush->is_auto_smush_enabled() ? sprintf( esc_html__( "Automatic smushing is %senabled%s. Newly uploaded images will be automagically compressed." ), '<span class="wp-smush-auto-enabled">', '</span>' ) : sprintf( esc_html__( "Automatic smushing is %sdisabled%s. Newly uploaded images will need to be manually smushed." ), '<span class="wp-smush-auto-disabled">', '</span>' );
765
+
766
+ //User API check, and display a message if not valid
767
+ $user_validation = $this->get_user_validation_message();
768
+
769
  echo '<div class="smush-page-wrap">
770
  <section id="header">
771
  <div class="wp-smush-page-header">
772
  <h1 class="wp-smush-page-heading">' . $page_heading . '</h1>
773
  <div class="wp-smush-auto-message roboto-regular">' . $auto_smush_message . '</div>
774
+ </div>' .
775
+ $user_validation .
776
+ '</section>';
777
  //Check if settings were updated and shoe a notice
778
  $this->settings_updated();
779
 
862
  echo '</div><!-- End of Container wrap -->
863
  </div> <!-- End of div wrap -->';
864
  }
865
+
866
+ /**
867
+ * Returns a Warning message if API key is not validated
868
+ *
869
+ * @return string Warning Message to be displayed on Bulk Smush Page
870
+ *
871
+ */
872
+ function get_user_validation_message( $notice = false ) {
873
+ $notice_class = $notice ? ' notice' : '';
874
+ $wpmu_contact = sprintf( '<a href="%s" target="_blank">', esc_url("https://premium.wpmudev.org/contact") );
875
+ $attr_message = esc_html__("Validating..", "wp-smushit");
876
+ $recheck_link = '<a href="#" id="wp-smush-revalidate-member" data-message="%s">';
877
+ $message = sprintf( esc_html__( "It looks like Smush couldn’t verify your WPMU DEV membership so Pro features like Super-Smush may not work correctly. If you think this is an error, run a %sre-check%s or get in touch with our %ssupport team%s.", "wp-smushit"), $recheck_link, '</a>', $wpmu_contact, '</a>' ) ;
878
+ $content = sprintf( '<div id="wp-smush-invalid-member" data-message="%s" class="hidden' . $notice_class . '"><div class="message">%s</div></div>', $attr_message, $message );
879
+ return $content;
880
+ }
881
  }
882
  }
lib/class-wp-smush.php CHANGED
@@ -119,6 +119,9 @@ if ( ! class_exists( 'WpSmush' ) ) {
119
  //Send Smush Stats for pro members
120
  add_filter( 'wpmudev_api_project_extra_data-912164', array( $this, 'send_smush_stats') );
121
 
 
 
 
122
  }
123
 
124
  function i18n() {
@@ -189,12 +192,12 @@ if ( ! class_exists( 'WpSmush' ) ) {
189
 
190
  //Check if file exists
191
  if ( $file_size == 0 ) {
192
- $errors->add( "image_not_found", '<p>' . sprintf( __( 'Skipped (%s), image not found. Attachment: %s', 'wp-smushit' ), $this->format_bytes( $file_size ), basename( $file_path ) ) . '</p>' );
193
  }
194
 
195
  //Check size limit
196
  if ( $file_size > $max_size ) {
197
- $errors->add( "size_limit", '<p>' . sprintf( __( 'Skipped (%s), size limit exceeded. Attachment: %s', 'wp-smushit' ), $this->format_bytes( $file_size ), basename( $file_path ) ) . '</p>' );
198
  }
199
 
200
  if ( count( $errors->get_error_messages() ) ) {
@@ -597,6 +600,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
597
  * @return bool|array array containing success status, and stats
598
  */
599
  function _post( $file_path, $file_size ) {
 
600
 
601
  $data = false;
602
 
@@ -680,6 +684,10 @@ if ( ! class_exists( 'WpSmush' ) ) {
680
  $data['success'] = true;
681
  $data['data'] = $response->data;
682
  }
 
 
 
 
683
  } else {
684
  //Server side error, get message from response
685
  $data['message'] = ! empty( $response->data ) ? $response->data : __( "Image couldn't be smushed", 'wp-smushit' );
@@ -898,7 +906,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
898
 
899
  $image_count = count( $wp_smush_data['sizes'] );
900
  $bytes = isset( $combined_stats['stats']['bytes'] ) ? $combined_stats['stats']['bytes'] : 0;
901
- $bytes_readable = ! empty( $bytes ) ? $this->format_bytes( $bytes ) : '';
902
  $percent = isset( $combined_stats['stats']['percent'] ) ? $combined_stats['stats']['percent'] : 0;
903
  $percent = $percent < 0 ? 0 : $percent;
904
 
@@ -925,7 +933,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
925
  $file_path = get_attached_file( $id );
926
  $size = file_exists( $file_path ) ? filesize( $file_path ) : 0;
927
  if( $size > 0 ) {
928
- $size = $this->format_bytes( $size );
929
  $image_size = sprintf( __( "<br /> Image Size: %s", "wp-smushit"), $size );
930
  $status_txt .= $image_size;
931
  }
@@ -1005,8 +1013,9 @@ if ( ! class_exists( 'WpSmush' ) ) {
1005
  if ( $text_only ) {
1006
  //For ajax response
1007
  return array(
1008
- 'status' => $status_txt,
1009
- 'stats' => $stats
 
1010
  );
1011
  }
1012
 
@@ -1367,7 +1376,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
1367
  $percent = $percent > 0 ? ' ( ' . $percent . '% )' : '';
1368
  $stats .= '<tr>
1369
  <td>' . strtoupper( $size_key ) . $dimensions . '</td>
1370
- <td>' . $this->format_bytes( $size_value->bytes ) . $percent . '</td>
1371
  </tr>';
1372
  }
1373
  }
@@ -1503,12 +1512,14 @@ if ( ! class_exists( 'WpSmush' ) ) {
1503
  }
1504
  }
1505
 
1506
- //Check for backup of image sizes
1507
- foreach ( $attachment_data['sizes'] as $image_size ) {
1508
- $size_path = path_join( dirname( $file ), $image_size['file'] );
1509
- $size_backup_path = $wpsmushit_admin->get_image_backup_path( $size_path );
1510
- if ( file_exists( $size_backup_path ) ) {
1511
- return true;
 
 
1512
  }
1513
  }
1514
 
@@ -1864,6 +1875,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
1864
  *
1865
  */
1866
  function total_compression( $stats ) {
 
1867
  foreach ( $stats['sizes'] as $size_stats ) {
1868
  $stats['stats']['size_before'] += !empty( $size_stats->size_before ) ? $size_stats->size_before : 0;
1869
  $stats['stats']['size_after'] += !empty( $size_stats->size_after) ? $size_stats->size_after : 0;
@@ -1942,6 +1954,41 @@ if ( ! class_exists( 'WpSmush' ) ) {
1942
 
1943
  return path_join( $upload_path, $original_file );
1944
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1945
  }
1946
 
1947
  global $WpSmush;
119
  //Send Smush Stats for pro members
120
  add_filter( 'wpmudev_api_project_extra_data-912164', array( $this, 'send_smush_stats') );
121
 
122
+ //Send Smush Stats for pro members
123
+ add_action( 'wp_ajax_smush_show_warning', array( $this, 'show_warning_ajax') );
124
+
125
  }
126
 
127
  function i18n() {
192
 
193
  //Check if file exists
194
  if ( $file_size == 0 ) {
195
+ $errors->add( "image_not_found", '<p>' . sprintf( __( 'Skipped (%s), image not found. Attachment: %s', 'wp-smushit' ), size_format( $file_size, 1 ), basename( $file_path ) ) . '</p>' );
196
  }
197
 
198
  //Check size limit
199
  if ( $file_size > $max_size ) {
200
+ $errors->add( "size_limit", '<p>' . sprintf( __( 'Skipped (%s), size limit exceeded. Attachment: %s', 'wp-smushit' ), size_format( $file_size, 1 ), basename( $file_path ) ) . '</p>' );
201
  }
202
 
203
  if ( count( $errors->get_error_messages() ) ) {
600
  * @return bool|array array containing success status, and stats
601
  */
602
  function _post( $file_path, $file_size ) {
603
+ global $wpsmushit_admin;
604
 
605
  $data = false;
606
 
684
  $data['success'] = true;
685
  $data['data'] = $response->data;
686
  }
687
+ //If is_premium is set in response, send it over to check for member validity
688
+ if( !empty( $response->data ) && isset( $response->data->is_premium ) ) {
689
+ $wpsmushit_admin->api_headers['is_premium'] = $response->data->is_premium;
690
+ }
691
  } else {
692
  //Server side error, get message from response
693
  $data['message'] = ! empty( $response->data ) ? $response->data : __( "Image couldn't be smushed", 'wp-smushit' );
906
 
907
  $image_count = count( $wp_smush_data['sizes'] );
908
  $bytes = isset( $combined_stats['stats']['bytes'] ) ? $combined_stats['stats']['bytes'] : 0;
909
+ $bytes_readable = ! empty( $bytes ) ? size_format( $bytes, 1 ) : '';
910
  $percent = isset( $combined_stats['stats']['percent'] ) ? $combined_stats['stats']['percent'] : 0;
911
  $percent = $percent < 0 ? 0 : $percent;
912
 
933
  $file_path = get_attached_file( $id );
934
  $size = file_exists( $file_path ) ? filesize( $file_path ) : 0;
935
  if( $size > 0 ) {
936
+ $size = size_format( $size, 1 );
937
  $image_size = sprintf( __( "<br /> Image Size: %s", "wp-smushit"), $size );
938
  $status_txt .= $image_size;
939
  }
1013
  if ( $text_only ) {
1014
  //For ajax response
1015
  return array(
1016
+ 'status' => $status_txt,
1017
+ 'stats' => $stats,
1018
+ 'show_warning' => intval( $this->show_warning() )
1019
  );
1020
  }
1021
 
1376
  $percent = $percent > 0 ? ' ( ' . $percent . '% )' : '';
1377
  $stats .= '<tr>
1378
  <td>' . strtoupper( $size_key ) . $dimensions . '</td>
1379
+ <td>' . size_format( $size_value->bytes, 1 ) . $percent . '</td>
1380
  </tr>';
1381
  }
1382
  }
1512
  }
1513
  }
1514
 
1515
+ if( !empty( $attachment_data['sizes'] ) ) {
1516
+ //Check for backup of image sizes
1517
+ foreach ( $attachment_data['sizes'] as $image_size ) {
1518
+ $size_path = path_join( dirname( $file ), $image_size['file'] );
1519
+ $size_backup_path = $wpsmushit_admin->get_image_backup_path( $size_path );
1520
+ if ( file_exists( $size_backup_path ) ) {
1521
+ return true;
1522
+ }
1523
  }
1524
  }
1525
 
1875
  *
1876
  */
1877
  function total_compression( $stats ) {
1878
+ $stats['stats']['size_before'] = $stats['stats']['size_after'] = $stats['stats']['time'] = '';
1879
  foreach ( $stats['sizes'] as $size_stats ) {
1880
  $stats['stats']['size_before'] += !empty( $size_stats->size_before ) ? $size_stats->size_before : 0;
1881
  $stats['stats']['size_after'] += !empty( $size_stats->size_after) ? $size_stats->size_after : 0;
1954
 
1955
  return path_join( $upload_path, $original_file );
1956
  }
1957
+
1958
+ /**
1959
+ * Check whether to show warning or not for Pro users, if they don't have a valid install
1960
+ *
1961
+ * @return bool
1962
+ *
1963
+ */
1964
+ function show_warning() {
1965
+ //If it's a free setup, Go back right away!
1966
+ if ( ! $this->validate_install() ) {
1967
+ return false;
1968
+ }
1969
+
1970
+ global $wpsmushit_admin;
1971
+ // Return. If we don't have any headers
1972
+ if( !isset( $wpsmushit_admin->api_headers ) ) {
1973
+ return false;
1974
+ }
1975
+
1976
+ //Show warning, if function says it's premium and api says not premium
1977
+ if( isset( $wpsmushit_admin->api_headers['is_premium'] ) && ! intval( $wpsmushit_admin->api_headers['is_premium'] ) ) {
1978
+ return true;
1979
+ }
1980
+
1981
+ return false;
1982
+
1983
+ }
1984
+
1985
+ /**
1986
+ * Send JSON response whether to show or not the warning
1987
+ */
1988
+ function show_warning_ajax() {
1989
+ $show = $this->show_warning();
1990
+ wp_send_json( intval( $show ) );
1991
+ }
1992
  }
1993
 
1994
  global $WpSmush;
lib/nextgen-integration/class-wp-smush-nextgen-admin.php CHANGED
@@ -618,7 +618,7 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
618
  $nextgen_stats['size_after'] = $nextgen_stats['size_after'] - $smush_stats['stats']['size_after'];
619
  $nextgen_stats['bytes'] = $nextgen_stats['size_before'] - $nextgen_stats['size_after'];
620
  $nextgen_stats['percent'] = ( $nextgen_stats['bytes'] / $nextgen_stats['size_before'] ) * 100;
621
- $nextgen_stats['human'] = $WpSmush->format_bytes( $nextgen_stats['bytes'] );
622
  }
623
 
624
  //Update Stats
@@ -681,13 +681,17 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
681
  //Round off
682
  $smush_stats['stats']['percent'] = round( $smush_stats['stats']['percent'], 2 );
683
 
684
- //Full Image
685
- $smush_stats['sizes']['full']['bytes'] = ! empty( $resize_savings['bytes'] ) ? $smush_stats['sizes']['full']['bytes'] + $resize_savings['bytes'] : $smush_stats['stats']['bytes'];
686
- $smush_stats['sizes']['full']['size_before'] = ! empty( $resize_savings['size_before'] ) ? $smush_stats['sizes']['full']['size_before'] + $resize_savings['size_before'] : $smush_stats['sizes']['full']['size_before'];
687
- $smush_stats['sizes']['full']['size_after'] = ! empty( $resize_savings['size_after'] ) ? $smush_stats['sizes']['full']['size_after'] + $resize_savings['size_after'] : $smush_stats['sizes']['full']['size_after'];
688
- $smush_stats['sizes']['full']['percent'] = ! empty( $smush_stats['sizes']['full']['bytes'] ) && $smush_stats['sizes']['full']['size_before'] > 0 ? ( $smush_stats['sizes']['full']['bytes'] / $smush_stats['sizes']['full']['size_before'] ) * 100 : $smush_stats['sizes']['full']['percent'];
 
689
 
690
- $smush_stats['sizes']['full']['percent'] = round( $smush_stats['sizes']['full']['percent'], 2 );
 
 
 
691
 
692
  $metadata['wp_smush'] = $smush_stats;
693
  return $metadata;
618
  $nextgen_stats['size_after'] = $nextgen_stats['size_after'] - $smush_stats['stats']['size_after'];
619
  $nextgen_stats['bytes'] = $nextgen_stats['size_before'] - $nextgen_stats['size_after'];
620
  $nextgen_stats['percent'] = ( $nextgen_stats['bytes'] / $nextgen_stats['size_before'] ) * 100;
621
+ $nextgen_stats['human'] = size_format( $nextgen_stats['bytes'], 1 );
622
  }
623
 
624
  //Update Stats
681
  //Round off
682
  $smush_stats['stats']['percent'] = round( $smush_stats['stats']['percent'], 2 );
683
 
684
+ if( !empty( $smush_stats['sizes']['full'] ) ) {
685
+ //Full Image
686
+ $smush_stats['sizes']['full']['bytes'] = ! empty( $resize_savings['bytes'] ) ? $smush_stats['sizes']['full']['bytes'] + $resize_savings['bytes'] : $smush_stats['sizes']['full']['bytes'];
687
+ $smush_stats['sizes']['full']['size_before'] = ! empty( $resize_savings['size_before'] ) ? $smush_stats['sizes']['full']['size_before'] + $resize_savings['size_before'] : $smush_stats['sizes']['full']['size_before'];
688
+ $smush_stats['sizes']['full']['size_after'] = ! empty( $resize_savings['size_after'] ) ? $smush_stats['sizes']['full']['size_after'] + $resize_savings['size_after'] : $smush_stats['sizes']['full']['size_after'];
689
+ $smush_stats['sizes']['full']['percent'] = ! empty( $smush_stats['sizes']['full']['bytes'] ) && $smush_stats['sizes']['full']['size_before'] > 0 ? ( $smush_stats['sizes']['full']['bytes'] / $smush_stats['sizes']['full']['size_before'] ) * 100 : $smush_stats['sizes']['full']['percent'];
690
 
691
+ $smush_stats['sizes']['full']['percent'] = round( $smush_stats['sizes']['full']['percent'], 2 );
692
+ }else{
693
+ $smush_stats['sizes']['full'] = $resize_savings;
694
+ }
695
 
696
  $metadata['wp_smush'] = $smush_stats;
697
  return $metadata;
lib/nextgen-integration/class-wp-smush-nextgen-stats.php CHANGED
@@ -185,7 +185,7 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
185
  $show_button = $show_resmush = $show_restore = false;
186
 
187
  $bytes = isset( $wp_smush_data['stats']['bytes'] ) ? $wp_smush_data['stats']['bytes'] : 0;
188
- $bytes_readable = ! empty( $bytes ) ? $WpSmush->format_bytes( $bytes ) : '';
189
  $percent = isset( $wp_smush_data['stats']['percent'] ) ? $wp_smush_data['stats']['percent'] : 0;
190
  $percent = $percent < 0 ? 0 : $percent;
191
 
@@ -310,7 +310,7 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
310
  $smush_stats['bytes'] = ! empty( $smush_stats['bytes'] ) ? ( $smush_stats['bytes'] + $stats['bytes'] ) : $stats['bytes'];
311
 
312
  //Human Readable
313
- $smush_stats['human'] = ! empty( $smush_stats['bytes'] ) ? $WpSmush->format_bytes( $smush_stats['bytes'] ) : '';
314
 
315
  //Size of images before the compression
316
  $smush_stats['size_before'] = ! empty( $smush_stats['size_before'] ) ? ( $smush_stats['size_before'] + $stats['size_before'] ) : $stats['size_before'];
@@ -347,7 +347,7 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
347
  $smush_stats['bytes'] = ! empty( $smush_stats['bytes'] ) ? ( $smush_stats['bytes'] + $stats['bytes'] ) : $stats['bytes'];
348
 
349
  //Human Readable
350
- $smush_stats['human'] = ! empty( $smush_stats['bytes'] ) ? $WpSmush->format_bytes( $smush_stats['bytes'] ) : '';
351
 
352
  //Size of images before the compression
353
  $smush_stats['size_before'] = ! empty( $smush_stats['size_before'] ) ? ( $smush_stats['size_before'] + $stats['size_before'] ) : $stats['size_before'];
@@ -401,7 +401,7 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
401
  //Round off precentage
402
  $smushed_stats['percent'] = ! empty( $smushed_stats['percent'] ) ? round( $smushed_stats['percent'], 1 ) : 0;
403
 
404
- $smushed_stats['human'] = $WpSmush->format_bytes( $smushed_stats['bytes'] );
405
 
406
  return $smushed_stats;
407
  }
@@ -460,7 +460,7 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
460
  if ( $size_value->bytes > 0 ) {
461
  $stats .= '<tr>
462
  <td>' . strtoupper( $size_key ) . '</td>
463
- <td>' . $WpSmush->format_bytes( $size_value->bytes ) . ' ( ' . $size_value->percent . '% )</td>
464
  </tr>';
465
  }
466
  }
185
  $show_button = $show_resmush = $show_restore = false;
186
 
187
  $bytes = isset( $wp_smush_data['stats']['bytes'] ) ? $wp_smush_data['stats']['bytes'] : 0;
188
+ $bytes_readable = ! empty( $bytes ) ? size_format( $bytes, 1 ) : '';
189
  $percent = isset( $wp_smush_data['stats']['percent'] ) ? $wp_smush_data['stats']['percent'] : 0;
190
  $percent = $percent < 0 ? 0 : $percent;
191
 
310
  $smush_stats['bytes'] = ! empty( $smush_stats['bytes'] ) ? ( $smush_stats['bytes'] + $stats['bytes'] ) : $stats['bytes'];
311
 
312
  //Human Readable
313
+ $smush_stats['human'] = ! empty( $smush_stats['bytes'] ) ? size_format( $smush_stats['bytes'], 1 ) : '';
314
 
315
  //Size of images before the compression
316
  $smush_stats['size_before'] = ! empty( $smush_stats['size_before'] ) ? ( $smush_stats['size_before'] + $stats['size_before'] ) : $stats['size_before'];
347
  $smush_stats['bytes'] = ! empty( $smush_stats['bytes'] ) ? ( $smush_stats['bytes'] + $stats['bytes'] ) : $stats['bytes'];
348
 
349
  //Human Readable
350
+ $smush_stats['human'] = ! empty( $smush_stats['bytes'] ) ? size_format( $smush_stats['bytes'], 1 ) : '';
351
 
352
  //Size of images before the compression
353
  $smush_stats['size_before'] = ! empty( $smush_stats['size_before'] ) ? ( $smush_stats['size_before'] + $stats['size_before'] ) : $stats['size_before'];
401
  //Round off precentage
402
  $smushed_stats['percent'] = ! empty( $smushed_stats['percent'] ) ? round( $smushed_stats['percent'], 1 ) : 0;
403
 
404
+ $smushed_stats['human'] = size_format( $smushed_stats['bytes'], 1 );
405
 
406
  return $smushed_stats;
407
  }
460
  if ( $size_value->bytes > 0 ) {
461
  $stats .= '<tr>
462
  <td>' . strtoupper( $size_key ) . '</td>
463
+ <td>' . size_format( $size_value->bytes, 1 ) . ' ( ' . $size_value->percent . '% )</td>
464
  </tr>';
465
  }
466
  }
readme.txt CHANGED
@@ -1,13 +1,13 @@
1
  === WP Smush - Image Optimization ===
2
  Plugin Name: WP Smush - Image Optimization
3
- Version: 2.4.3
4
  Author: WPMU DEV
5
  Author URI: http://premium.wpmudev.org/
6
  Contributors: WPMUDEV, alexdunae
7
  Tags: image optimization, image compression, attachment,Attachments,compress,Compress Image File,Compress Image Size,Compress JPG,Compressed JPG, Compression Image,Image,Images,JPG,Optimise,Optimize,Photo,Photos,Pictures,PNG,Reduce Image Size,Smush,Smush.it,Upload,WordPress Compression,WordPress Image Tool,Yahoo, Yahoo Smush.it
8
  Requires at least: 3.5
9
- Tested up to: 4.5.3
10
- Stable tag: 2.4.3
11
  License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
12
 
13
  Reduce image file sizes, improve performance and boost your SEO using the free <a href="https://premium.wpmudev.org/">WPMU DEV</a> WordPress Smush API.
@@ -92,19 +92,27 @@ Yahoo's Smush.it API is gone forever. So WPMU DEV built our own free API that is
92
 
93
  == Changelog ==
94
 
 
 
 
 
 
 
 
 
 
 
95
  = 2.4.3 =
96
 
97
- * Fixed:
98
- * Image resizing not working on image upload
99
 
100
  = 2.4.2 =
101
 
102
- * Fixed:
103
- * PHP 5.2 compatibility
104
 
105
  = 2.4.1 =
106
 
107
- * Fixed: Conflict with Customizer
108
 
109
  = 2.4 =
110
 
1
  === WP Smush - Image Optimization ===
2
  Plugin Name: WP Smush - Image Optimization
3
+ Version: 2.4.4
4
  Author: WPMU DEV
5
  Author URI: http://premium.wpmudev.org/
6
  Contributors: WPMUDEV, alexdunae
7
  Tags: image optimization, image compression, attachment,Attachments,compress,Compress Image File,Compress Image Size,Compress JPG,Compressed JPG, Compression Image,Image,Images,JPG,Optimise,Optimize,Photo,Photos,Pictures,PNG,Reduce Image Size,Smush,Smush.it,Upload,WordPress Compression,WordPress Image Tool,Yahoo, Yahoo Smush.it
8
  Requires at least: 3.5
9
+ Tested up to: 4.6
10
+ Stable tag: 2.4.4
11
  License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
12
 
13
  Reduce image file sizes, improve performance and boost your SEO using the free <a href="https://premium.wpmudev.org/">WPMU DEV</a> WordPress Smush API.
92
 
93
  == Changelog ==
94
 
95
+ = 2.4.4 =
96
+
97
+ * Fixed:
98
+ * PNG to JPEG conversion not working for Multisite
99
+ * Stats Calculation, Use custom query to retrieve data
100
+ * Fixed warning and notices
101
+ * Added check for invalid membership ( Pro Users )
102
+ * thumbnails not being converted for PNG to JPEG conversion
103
+ * Removed option to convert Transparent PNGs to JPEGs ( Pro Users )
104
+
105
  = 2.4.3 =
106
 
107
+ * Fixed: Image resizing not working on image upload
 
108
 
109
  = 2.4.2 =
110
 
111
+ * Fixed: PHP 5.2 compatibility
 
112
 
113
  = 2.4.1 =
114
 
115
+ * Fixed: Conflict with Customizer
116
 
117
  = 2.4 =
118
 
wp-smush.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Smush
4
  Plugin URI: http://wordpress.org/extend/plugins/wp-smushit/
5
  Description: Reduce image file sizes, improve performance and boost your SEO using the free <a href="https://premium.wpmudev.org/">WPMU DEV</a> WordPress Smush API.
6
  Author: WPMU DEV
7
- Version: 2.4.3
8
  Author URI: http://premium.wpmudev.org/
9
  Textdomain: wp-smushit
10
  */
@@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
35
  * Constants
36
  */
37
  $prefix = 'WP_SMUSH_';
38
- $version = '2.4.3';
39
 
40
  //Deactivate the .org version, if pro version is active
41
  add_action( 'admin_init', 'deactivate_smush_org' );
4
  Plugin URI: http://wordpress.org/extend/plugins/wp-smushit/
5
  Description: Reduce image file sizes, improve performance and boost your SEO using the free <a href="https://premium.wpmudev.org/">WPMU DEV</a> WordPress Smush API.
6
  Author: WPMU DEV
7
+ Version: 2.4.4
8
  Author URI: http://premium.wpmudev.org/
9
  Textdomain: wp-smushit
10
  */
35
  * Constants
36
  */
37
  $prefix = 'WP_SMUSH_';
38
+ $version = '2.4.4';
39
 
40
  //Deactivate the .org version, if pro version is active
41
  add_action( 'admin_init', 'deactivate_smush_org' );