Version Description
- Fixed: Untranslatable strings in settings
- Fixed: Increased is_pro() API timeouts
- Fixed: Remove redundant _get_api_key() cache check
- Fixed: Some PHP notices on fresh installs
Download this release
Release Info
Developer | UmeshSingla |
Plugin | Smush Image Compression and Optimization |
Version | 2.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.7.1 to 2.1
- languages/wp-smushit.pot +102 -98
- lib/class-wp-smush-admin.php +78 -62
- lib/class-wp-smush.php +33 -39
- lib/nextgen-integration/class-wp-smush-nextgen-stats.php +23 -15
- readme.txt +8 -2
- wp-smush.php +2 -2
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.
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wp-smush\n"
|
7 |
-
"POT-Creation-Date: 2015-11-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -40,397 +40,401 @@ msgstr ""
|
|
40 |
msgid "Rate %s"
|
41 |
msgstr ""
|
42 |
|
43 |
-
#: lib/class-wp-smush-admin.php:
|
44 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:54
|
45 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:73
|
46 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:75
|
47 |
msgid "WP Smush"
|
48 |
msgstr ""
|
49 |
|
50 |
-
#: lib/class-wp-smush-admin.php:
|
51 |
-
#: lib/class-wp-smush-admin.php:
|
52 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:140
|
53 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:369
|
54 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:381
|
55 |
msgid "Bulk Smush Now"
|
56 |
msgstr ""
|
57 |
|
58 |
-
#: lib/class-wp-smush-admin.php:
|
59 |
msgid "Bulk Smush %d Attachments"
|
60 |
msgstr ""
|
61 |
|
62 |
-
#: lib/class-wp-smush-admin.php:
|
63 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:143
|
64 |
msgid "Smushing in Progress"
|
65 |
msgstr ""
|
66 |
|
67 |
-
#: lib/class-wp-smush-admin.php:
|
68 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:144
|
69 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:375
|
70 |
msgid "All Done!"
|
71 |
msgstr ""
|
72 |
|
73 |
-
#: lib/class-wp-smush-admin.php:
|
74 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:146
|
75 |
msgid "Ops!... something went wrong"
|
76 |
msgstr ""
|
77 |
|
78 |
-
#: lib/class-wp-smush-admin.php:
|
79 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:147
|
80 |
-
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:
|
81 |
msgid "Super-Smush"
|
82 |
msgstr ""
|
83 |
|
84 |
-
#: lib/class-wp-smush-admin.php:
|
85 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:148
|
86 |
msgid "Smush it"
|
87 |
msgstr ""
|
88 |
|
89 |
-
#: lib/class-wp-smush-admin.php:
|
90 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:149
|
91 |
msgid "Smush Now"
|
92 |
msgstr ""
|
93 |
|
94 |
-
#: lib/class-wp-smush-admin.php:
|
95 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:150
|
96 |
msgid "Sending ..."
|
97 |
msgstr ""
|
98 |
|
99 |
-
#: lib/class-wp-smush-admin.php:
|
100 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:151
|
101 |
msgid "{{errors}} image(s) were skipped due to an error."
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: lib/class-wp-smush-admin.php:
|
105 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:152
|
106 |
msgid "All images are Super-Smushed."
|
107 |
msgstr ""
|
108 |
|
109 |
-
#: lib/class-wp-smush-admin.php:
|
110 |
msgid "Smush all images, including originals."
|
111 |
msgstr ""
|
112 |
|
113 |
-
#: lib/class-wp-smush-admin.php:
|
114 |
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."
|
115 |
msgstr ""
|
116 |
|
117 |
-
#: lib/class-wp-smush-admin.php:
|
118 |
msgid "Smush images on upload"
|
119 |
msgstr ""
|
120 |
|
121 |
-
#: lib/class-wp-smush-admin.php:
|
122 |
msgid "Smush Original Image"
|
123 |
msgstr ""
|
124 |
|
125 |
-
#: lib/class-wp-smush-admin.php:
|
126 |
msgid "Super-Smush images"
|
127 |
msgstr ""
|
128 |
|
129 |
-
#: lib/class-wp-smush-admin.php:
|
130 |
msgid "Lossy Image Compression"
|
131 |
msgstr ""
|
132 |
|
133 |
-
#: lib/class-wp-smush-admin.php:
|
134 |
msgid "Backup Original Images"
|
135 |
msgstr ""
|
136 |
|
137 |
-
#: lib/class-wp-smush-admin.php:
|
138 |
msgid "Will nearly double the size of your Uploads Directory"
|
139 |
msgstr ""
|
140 |
|
141 |
-
#: lib/class-wp-smush-admin.php:
|
142 |
msgid "Enable NextGen Gallery integration"
|
143 |
msgstr ""
|
144 |
|
145 |
-
#: lib/class-wp-smush-admin.php:
|
146 |
msgid "WP Smush Pro"
|
147 |
msgstr ""
|
148 |
|
149 |
-
#: lib/class-wp-smush-admin.php:
|
150 |
msgid "Settings"
|
151 |
msgstr ""
|
152 |
|
153 |
-
#: lib/class-wp-smush-admin.php:
|
154 |
msgid "PRO FEATURES"
|
155 |
msgstr ""
|
156 |
|
157 |
-
#: lib/class-wp-smush-admin.php:
|
158 |
msgid "These features are available in Pro Version of the plugin."
|
159 |
msgstr ""
|
160 |
|
161 |
-
#: lib/class-wp-smush-admin.php:
|
162 |
msgid "Save Changes"
|
163 |
msgstr ""
|
164 |
|
165 |
-
#: lib/class-wp-smush-admin.php:
|
166 |
msgid "%d image is over 1MB so will be skipped using the free version of the plugin."
|
167 |
msgid_plural "%d images are over 1MB so will be skipped using the free version of the plugin."
|
168 |
msgstr[0] ""
|
169 |
msgstr[1] ""
|
170 |
|
171 |
-
#: lib/class-wp-smush-admin.php:
|
172 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:415
|
173 |
msgid "Smush in Bulk"
|
174 |
msgstr ""
|
175 |
|
176 |
-
#: lib/class-wp-smush-admin.php:
|
177 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:428
|
178 |
msgid "Congratulations, all your images are currently Smushed!"
|
179 |
msgstr ""
|
180 |
|
181 |
-
#: lib/class-wp-smush-admin.php:
|
182 |
msgid "%d attachment in your media library has not been smushed."
|
183 |
msgid_plural "%d image attachments in your media library have not been smushed yet."
|
184 |
msgstr[0] ""
|
185 |
msgstr[1] ""
|
186 |
|
187 |
-
#: lib/class-wp-smush-admin.php:
|
188 |
msgid "Remove size limit »"
|
189 |
msgstr ""
|
190 |
|
191 |
-
#: lib/class-wp-smush-admin.php:
|
192 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:434
|
193 |
msgid ""
|
194 |
"Please be aware, smushing a large number of images can take a while depending on your server and network speed.\n"
|
195 |
"\t\t\t\t\t\t<strong>You must keep this page open while the bulk smush is processing</strong>, but you can leave at any time and come back to continue where it left off."
|
196 |
msgstr ""
|
197 |
|
198 |
-
#: lib/class-wp-smush-admin.php:
|
199 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:439
|
200 |
msgid "Free accounts are limited to bulk smushing %d attachments per request. You will need to click to start a new bulk job after each %d attachments."
|
201 |
msgstr ""
|
202 |
|
203 |
-
#: lib/class-wp-smush-admin.php:
|
204 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:440
|
205 |
msgid "Remove limits »"
|
206 |
msgstr ""
|
207 |
|
208 |
-
#: lib/class-wp-smush-admin.php:
|
209 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:459
|
210 |
msgid "When you <a href=\"%s\">upload some images</a> they will be available to smush here."
|
211 |
msgstr ""
|
212 |
|
213 |
-
#: lib/class-wp-smush-admin.php:
|
214 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:465
|
215 |
msgid "You can also smush images individually from your <a href=\"%s\">Media Library</a>."
|
216 |
msgstr ""
|
217 |
|
218 |
-
#: lib/class-wp-smush-admin.php:
|
219 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:337
|
220 |
msgid "Reduced by "
|
221 |
msgstr ""
|
222 |
|
223 |
-
#: lib/class-wp-smush-admin.php:
|
224 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:347
|
225 |
msgid "<span class=\"done-count\">%d</span> of <span class=\"total-count\">%d</span> total attachments have been smushed"
|
226 |
msgstr ""
|
227 |
|
228 |
-
#: lib/class-wp-smush-admin.php:
|
229 |
msgid "Smush request timed out, You can try setting a higher value for `WP_SMUSH_API_TIMEOUT`."
|
230 |
msgstr ""
|
231 |
|
232 |
-
#: lib/class-wp-smush-admin.php:
|
233 |
msgid "You don't have permission to work with uploaded files."
|
234 |
msgstr ""
|
235 |
|
236 |
-
#: lib/class-wp-smush-admin.php:
|
237 |
msgid "No attachment ID was provided."
|
238 |
msgstr ""
|
239 |
|
240 |
-
#: lib/class-wp-smush-admin.php:
|
241 |
msgid "<p>Please <a href=\"%s\">upload some images</a>.</p>"
|
242 |
msgstr ""
|
243 |
|
244 |
-
#: lib/class-wp-smush-admin.php:
|
245 |
msgid "All your images are already smushed!"
|
246 |
msgstr ""
|
247 |
|
248 |
-
#: lib/class-wp-smush-admin.php:
|
249 |
msgid "<strong>%d of %d images</strong> were sent for smushing:"
|
250 |
msgstr ""
|
251 |
|
252 |
-
#: lib/class-wp-smush-admin.php:
|
253 |
msgid "Super-Smush Images"
|
254 |
msgstr ""
|
255 |
|
256 |
-
#: lib/class-wp-smush-admin.php:
|
257 |
msgid "We found attachments that were previously smushed losslessly. If desired you can Super-Smush them now for more savings with almost no noticeable quality loss."
|
258 |
msgstr ""
|
259 |
|
260 |
-
#: lib/class-wp-smush-admin.php:
|
261 |
msgid "<span class=\"remaining-count\">%d</span> attachment left to Super-Smush"
|
262 |
msgid_plural "<span class=\"remaining-count\">%d</span> attachments left to Super-Smush"
|
263 |
msgstr[0] ""
|
264 |
msgstr[1] ""
|
265 |
|
266 |
-
#: lib/class-wp-smush-admin.php:
|
267 |
msgid "Thanks for using WP Smush Pro! You now can:"
|
268 |
msgstr ""
|
269 |
|
270 |
-
#: lib/class-wp-smush-admin.php:
|
271 |
msgid "Smush the original Full image sizes that are normally skipped by default."
|
272 |
msgstr ""
|
273 |
|
274 |
-
#: lib/class-wp-smush-admin.php:
|
275 |
msgid "NextGen Gallery integration"
|
276 |
msgstr ""
|
277 |
|
278 |
-
#: lib/class-wp-smush-admin.php:
|
279 |
msgid "\"Super-Smush\" your images with our intelligent multi-pass lossy compression. Get 2× more compression than lossless with almost no noticeable quality loss!"
|
280 |
msgstr ""
|
281 |
|
282 |
-
#: lib/class-wp-smush-admin.php:
|
283 |
msgid "Get the best lossless compression. We try multiple methods to squeeze every last byte out of your images."
|
284 |
msgstr ""
|
285 |
|
286 |
-
#: lib/class-wp-smush-admin.php:
|
287 |
msgid "Smush images up to 32MB."
|
288 |
msgstr ""
|
289 |
|
290 |
-
#: lib/class-wp-smush-admin.php:
|
291 |
msgid "Bulk smush ALL your images with one click!"
|
292 |
msgstr ""
|
293 |
|
294 |
-
#: lib/class-wp-smush-admin.php:
|
295 |
msgid "Keep a backup of your original un-smushed images in case you want to restore later."
|
296 |
msgstr ""
|
297 |
|
298 |
-
#: lib/class-wp-smush-admin.php:
|
299 |
msgid "Upgrade to WP Smush Pro to:"
|
300 |
msgstr ""
|
301 |
|
302 |
-
#: lib/class-wp-smush-admin.php:
|
303 |
msgid "Smush images greater than 1MB."
|
304 |
msgstr ""
|
305 |
|
306 |
-
#: lib/class-wp-smush-admin.php:
|
307 |
msgid "Bulk smush ALL your images with one click! No more rate limiting."
|
308 |
msgstr ""
|
309 |
|
310 |
-
#: lib/class-wp-smush-admin.php:
|
311 |
msgid "Access 24/7/365 support from <a href=\"https://premium.wpmudev.org/support/?utm_source=wordpress.org&utm_medium=plugin&utm_campaign=WP%20Smush%20Upgrade\">the best WordPress support team on the planet</a>."
|
312 |
msgstr ""
|
313 |
|
314 |
-
#: lib/class-wp-smush-admin.php:
|
315 |
msgid "Download <a href=\"https://premium.wpmudev.org/?utm_source=wordpress.org&utm_medium=plugin&utm_campaign=WP%20Smush%20Upgrade\">350+ other premium plugins and themes</a> included in your membership."
|
316 |
msgstr ""
|
317 |
|
318 |
-
#: lib/class-wp-smush-admin.php:
|
319 |
msgid "Upgrade Now »"
|
320 |
msgstr ""
|
321 |
|
322 |
-
#: lib/class-wp-smush-admin.php:
|
323 |
msgid "Already upgraded to a WPMU DEV membership? Install and Login to our Dashboard plugin to enable Smush Pro features."
|
324 |
msgstr ""
|
325 |
|
326 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
|
|
|
|
|
|
327 |
msgid "Activate WPMU DEV Dashboard"
|
328 |
msgstr ""
|
329 |
|
330 |
-
#: lib/class-wp-smush-admin.php:
|
331 |
msgid "Install WPMU DEV Dashboard"
|
332 |
msgstr ""
|
333 |
|
334 |
-
#: lib/class-wp-smush-nextgen.php:193 lib/class-wp-smush.php:
|
335 |
msgid "Size '%s' not processed correctly"
|
336 |
msgstr ""
|
337 |
|
338 |
-
#: lib/class-wp-smush.php:
|
339 |
msgid "File path is empty"
|
340 |
msgstr ""
|
341 |
|
342 |
-
#: lib/class-wp-smush.php:
|
343 |
msgid "Could not find %s"
|
344 |
msgstr ""
|
345 |
|
346 |
-
#: lib/class-wp-smush.php:
|
347 |
msgid "%s is not writable"
|
348 |
msgstr ""
|
349 |
|
350 |
-
#: lib/class-wp-smush.php:
|
351 |
msgid "Skipped (%s), image not found."
|
352 |
msgstr ""
|
353 |
|
354 |
-
#: lib/class-wp-smush.php:
|
355 |
msgid "Skipped (%s), size limit exceeded."
|
356 |
msgstr ""
|
357 |
|
358 |
-
#: lib/class-wp-smush.php:
|
359 |
msgid "Unknown API error"
|
360 |
msgstr ""
|
361 |
|
362 |
-
#: lib/class-wp-smush.php:
|
363 |
msgid "Size 'full' not processed correctly"
|
364 |
msgstr ""
|
365 |
|
366 |
-
#: lib/class-wp-smush.php:
|
367 |
msgid "Error posting to API: %s"
|
368 |
msgstr ""
|
369 |
|
370 |
-
#: lib/class-wp-smush.php:
|
371 |
msgid "Error posting to API: %s %s"
|
372 |
msgstr ""
|
373 |
|
374 |
-
#: lib/class-wp-smush.php:
|
375 |
msgid "Smush data corrupted, try again."
|
376 |
msgstr ""
|
377 |
|
378 |
-
#: lib/class-wp-smush.php:
|
379 |
msgid "Image couldn't be smushed"
|
380 |
msgstr ""
|
381 |
|
382 |
-
#: lib/class-wp-smush.php:
|
383 |
-
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:
|
384 |
msgid "Error processing request"
|
385 |
msgstr ""
|
386 |
|
387 |
-
#: lib/class-wp-smush.php:
|
388 |
-
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:
|
389 |
msgid "Already Optimized"
|
390 |
msgstr ""
|
391 |
|
392 |
-
#: lib/class-wp-smush.php:
|
393 |
msgid "%d images reduced "
|
394 |
msgstr ""
|
395 |
|
396 |
-
#: lib/class-wp-smush.php:
|
397 |
msgid "Reduced "
|
398 |
msgstr ""
|
399 |
|
400 |
-
#: lib/class-wp-smush.php:
|
401 |
msgid "by %s ( %01.1f%% )"
|
402 |
msgstr ""
|
403 |
|
404 |
-
#: lib/class-wp-smush.php:
|
405 |
-
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:
|
406 |
msgid "Smush stats"
|
407 |
msgstr ""
|
408 |
|
409 |
-
#: lib/class-wp-smush.php:
|
410 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:246
|
411 |
msgid "Not processed"
|
412 |
msgstr ""
|
413 |
|
414 |
-
#: lib/class-wp-smush.php:
|
415 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:252
|
416 |
msgid "Smush Now!"
|
417 |
msgstr ""
|
418 |
|
419 |
-
#: lib/class-wp-smush.php:
|
420 |
msgid "Image couldn't be smushed as it exceeded the 1Mb size limit, Pro users can smush images with size upto 32Mb."
|
421 |
msgstr ""
|
422 |
|
423 |
-
#: lib/class-wp-smush.php:
|
424 |
msgid " Skipped"
|
425 |
msgstr ""
|
426 |
|
427 |
-
#: lib/class-wp-smush.php:
|
428 |
-
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:
|
429 |
msgid "Image size"
|
430 |
msgstr ""
|
431 |
|
432 |
-
#: lib/class-wp-smush.php:
|
433 |
-
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:
|
434 |
msgid "Savings"
|
435 |
msgstr ""
|
436 |
|
@@ -452,7 +456,7 @@ msgstr[1] ""
|
|
452 |
msgid "Smush request timed out, You can try setting a higher value ( > 60 ) for `WP_SMUSH_API_TIMEOUT`."
|
453 |
msgstr ""
|
454 |
|
455 |
-
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:
|
456 |
msgid "Reduced by %s ( %01.1f%% )"
|
457 |
msgstr ""
|
458 |
|
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.1\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wp-smush\n"
|
7 |
+
"POT-Creation-Date: 2015-11-03 18:29:00+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
40 |
msgid "Rate %s"
|
41 |
msgstr ""
|
42 |
|
43 |
+
#: lib/class-wp-smush-admin.php:125 lib/class-wp-smush-admin.php:346
|
44 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:54
|
45 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:73
|
46 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:75
|
47 |
msgid "WP Smush"
|
48 |
msgstr ""
|
49 |
|
50 |
+
#: lib/class-wp-smush-admin.php:256 lib/class-wp-smush-admin.php:1039
|
51 |
+
#: lib/class-wp-smush-admin.php:1055
|
52 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:140
|
53 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:369
|
54 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:381
|
55 |
msgid "Bulk Smush Now"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: lib/class-wp-smush-admin.php:258 lib/class-wp-smush-admin.php:1059
|
59 |
msgid "Bulk Smush %d Attachments"
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: lib/class-wp-smush-admin.php:262
|
63 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:143
|
64 |
msgid "Smushing in Progress"
|
65 |
msgstr ""
|
66 |
|
67 |
+
#: lib/class-wp-smush-admin.php:263 lib/class-wp-smush-admin.php:1049
|
68 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:144
|
69 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:375
|
70 |
msgid "All Done!"
|
71 |
msgstr ""
|
72 |
|
73 |
+
#: lib/class-wp-smush-admin.php:265
|
74 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:146
|
75 |
msgid "Ops!... something went wrong"
|
76 |
msgstr ""
|
77 |
|
78 |
+
#: lib/class-wp-smush-admin.php:266 lib/class-wp-smush.php:755
|
79 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:147
|
80 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:230
|
81 |
msgid "Super-Smush"
|
82 |
msgstr ""
|
83 |
|
84 |
+
#: lib/class-wp-smush-admin.php:267
|
85 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:148
|
86 |
msgid "Smush it"
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: lib/class-wp-smush-admin.php:268
|
90 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:149
|
91 |
msgid "Smush Now"
|
92 |
msgstr ""
|
93 |
|
94 |
+
#: lib/class-wp-smush-admin.php:269
|
95 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:150
|
96 |
msgid "Sending ..."
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: lib/class-wp-smush-admin.php:270
|
100 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:151
|
101 |
msgid "{{errors}} image(s) were skipped due to an error."
|
102 |
msgstr ""
|
103 |
|
104 |
+
#: lib/class-wp-smush-admin.php:271
|
105 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:152
|
106 |
msgid "All images are Super-Smushed."
|
107 |
msgstr ""
|
108 |
|
109 |
+
#: lib/class-wp-smush-admin.php:310
|
110 |
msgid "Smush all images, including originals."
|
111 |
msgstr ""
|
112 |
|
113 |
+
#: lib/class-wp-smush-admin.php:313 lib/class-wp-smush.php:1067
|
114 |
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."
|
115 |
msgstr ""
|
116 |
|
117 |
+
#: lib/class-wp-smush-admin.php:316
|
118 |
msgid "Smush images on upload"
|
119 |
msgstr ""
|
120 |
|
121 |
+
#: lib/class-wp-smush-admin.php:317
|
122 |
msgid "Smush Original Image"
|
123 |
msgstr ""
|
124 |
|
125 |
+
#: lib/class-wp-smush-admin.php:318
|
126 |
msgid "Super-Smush images"
|
127 |
msgstr ""
|
128 |
|
129 |
+
#: lib/class-wp-smush-admin.php:318
|
130 |
msgid "Lossy Image Compression"
|
131 |
msgstr ""
|
132 |
|
133 |
+
#: lib/class-wp-smush-admin.php:319
|
134 |
msgid "Backup Original Images"
|
135 |
msgstr ""
|
136 |
|
137 |
+
#: lib/class-wp-smush-admin.php:319
|
138 |
msgid "Will nearly double the size of your Uploads Directory"
|
139 |
msgstr ""
|
140 |
|
141 |
+
#: lib/class-wp-smush-admin.php:320
|
142 |
msgid "Enable NextGen Gallery integration"
|
143 |
msgstr ""
|
144 |
|
145 |
+
#: lib/class-wp-smush-admin.php:344
|
146 |
msgid "WP Smush Pro"
|
147 |
msgstr ""
|
148 |
|
149 |
+
#: lib/class-wp-smush-admin.php:354 lib/class-wp-smush-admin.php:1114
|
150 |
msgid "Settings"
|
151 |
msgstr ""
|
152 |
|
153 |
+
#: lib/class-wp-smush-admin.php:427
|
154 |
msgid "PRO FEATURES"
|
155 |
msgstr ""
|
156 |
|
157 |
+
#: lib/class-wp-smush-admin.php:433
|
158 |
msgid "These features are available in Pro Version of the plugin."
|
159 |
msgstr ""
|
160 |
|
161 |
+
#: lib/class-wp-smush-admin.php:460
|
162 |
msgid "Save Changes"
|
163 |
msgstr ""
|
164 |
|
165 |
+
#: lib/class-wp-smush-admin.php:549
|
166 |
msgid "%d image is over 1MB so will be skipped using the free version of the plugin."
|
167 |
msgid_plural "%d images are over 1MB so will be skipped using the free version of the plugin."
|
168 |
msgstr[0] ""
|
169 |
msgstr[1] ""
|
170 |
|
171 |
+
#: lib/class-wp-smush-admin.php:558
|
172 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:415
|
173 |
msgid "Smush in Bulk"
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: lib/class-wp-smush-admin.php:563
|
177 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:428
|
178 |
msgid "Congratulations, all your images are currently Smushed!"
|
179 |
msgstr ""
|
180 |
|
181 |
+
#: lib/class-wp-smush-admin.php:572
|
182 |
msgid "%d attachment in your media library has not been smushed."
|
183 |
msgid_plural "%d image attachments in your media library have not been smushed yet."
|
184 |
msgstr[0] ""
|
185 |
msgstr[1] ""
|
186 |
|
187 |
+
#: lib/class-wp-smush-admin.php:576
|
188 |
msgid "Remove size limit »"
|
189 |
msgstr ""
|
190 |
|
191 |
+
#: lib/class-wp-smush-admin.php:581
|
192 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:434
|
193 |
msgid ""
|
194 |
"Please be aware, smushing a large number of images can take a while depending on your server and network speed.\n"
|
195 |
"\t\t\t\t\t\t<strong>You must keep this page open while the bulk smush is processing</strong>, but you can leave at any time and come back to continue where it left off."
|
196 |
msgstr ""
|
197 |
|
198 |
+
#: lib/class-wp-smush-admin.php:586
|
199 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:439
|
200 |
msgid "Free accounts are limited to bulk smushing %d attachments per request. You will need to click to start a new bulk job after each %d attachments."
|
201 |
msgstr ""
|
202 |
|
203 |
+
#: lib/class-wp-smush-admin.php:587
|
204 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:440
|
205 |
msgid "Remove limits »"
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: lib/class-wp-smush-admin.php:607
|
209 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:459
|
210 |
msgid "When you <a href=\"%s\">upload some images</a> they will be available to smush here."
|
211 |
msgstr ""
|
212 |
|
213 |
+
#: lib/class-wp-smush-admin.php:613 lib/class-wp-smush-admin.php:853
|
214 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:465
|
215 |
msgid "You can also smush images individually from your <a href=\"%s\">Media Library</a>."
|
216 |
msgstr ""
|
217 |
|
218 |
+
#: lib/class-wp-smush-admin.php:668
|
219 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:337
|
220 |
msgid "Reduced by "
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: lib/class-wp-smush-admin.php:678
|
224 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:347
|
225 |
msgid "<span class=\"done-count\">%d</span> of <span class=\"total-count\">%d</span> total attachments have been smushed"
|
226 |
msgstr ""
|
227 |
|
228 |
+
#: lib/class-wp-smush-admin.php:734
|
229 |
msgid "Smush request timed out, You can try setting a higher value for `WP_SMUSH_API_TIMEOUT`."
|
230 |
msgstr ""
|
231 |
|
232 |
+
#: lib/class-wp-smush-admin.php:749 lib/class-wp-smush-nextgen.php:321
|
233 |
msgid "You don't have permission to work with uploaded files."
|
234 |
msgstr ""
|
235 |
|
236 |
+
#: lib/class-wp-smush-admin.php:753 lib/class-wp-smush-nextgen.php:325
|
237 |
msgid "No attachment ID was provided."
|
238 |
msgstr ""
|
239 |
|
240 |
+
#: lib/class-wp-smush-admin.php:823
|
241 |
msgid "<p>Please <a href=\"%s\">upload some images</a>.</p>"
|
242 |
msgstr ""
|
243 |
|
244 |
+
#: lib/class-wp-smush-admin.php:841
|
245 |
msgid "All your images are already smushed!"
|
246 |
msgstr ""
|
247 |
|
248 |
+
#: lib/class-wp-smush-admin.php:943
|
249 |
msgid "<strong>%d of %d images</strong> were sent for smushing:"
|
250 |
msgstr ""
|
251 |
|
252 |
+
#: lib/class-wp-smush-admin.php:1245
|
253 |
msgid "Super-Smush Images"
|
254 |
msgstr ""
|
255 |
|
256 |
+
#: lib/class-wp-smush-admin.php:1246
|
257 |
msgid "We found attachments that were previously smushed losslessly. If desired you can Super-Smush them now for more savings with almost no noticeable quality loss."
|
258 |
msgstr ""
|
259 |
|
260 |
+
#: lib/class-wp-smush-admin.php:1254
|
261 |
msgid "<span class=\"remaining-count\">%d</span> attachment left to Super-Smush"
|
262 |
msgid_plural "<span class=\"remaining-count\">%d</span> attachments left to Super-Smush"
|
263 |
msgstr[0] ""
|
264 |
msgstr[1] ""
|
265 |
|
266 |
+
#: lib/class-wp-smush-admin.php:1279
|
267 |
msgid "Thanks for using WP Smush Pro! You now can:"
|
268 |
msgstr ""
|
269 |
|
270 |
+
#: lib/class-wp-smush-admin.php:1281 lib/class-wp-smush-admin.php:1299
|
271 |
msgid "Smush the original Full image sizes that are normally skipped by default."
|
272 |
msgstr ""
|
273 |
|
274 |
+
#: lib/class-wp-smush-admin.php:1282 lib/class-wp-smush-admin.php:1300
|
275 |
msgid "NextGen Gallery integration"
|
276 |
msgstr ""
|
277 |
|
278 |
+
#: lib/class-wp-smush-admin.php:1283 lib/class-wp-smush-admin.php:1301
|
279 |
msgid "\"Super-Smush\" your images with our intelligent multi-pass lossy compression. Get 2× more compression than lossless with almost no noticeable quality loss!"
|
280 |
msgstr ""
|
281 |
|
282 |
+
#: lib/class-wp-smush-admin.php:1284 lib/class-wp-smush-admin.php:1302
|
283 |
msgid "Get the best lossless compression. We try multiple methods to squeeze every last byte out of your images."
|
284 |
msgstr ""
|
285 |
|
286 |
+
#: lib/class-wp-smush-admin.php:1285
|
287 |
msgid "Smush images up to 32MB."
|
288 |
msgstr ""
|
289 |
|
290 |
+
#: lib/class-wp-smush-admin.php:1286
|
291 |
msgid "Bulk smush ALL your images with one click!"
|
292 |
msgstr ""
|
293 |
|
294 |
+
#: lib/class-wp-smush-admin.php:1287 lib/class-wp-smush-admin.php:1305
|
295 |
msgid "Keep a backup of your original un-smushed images in case you want to restore later."
|
296 |
msgstr ""
|
297 |
|
298 |
+
#: lib/class-wp-smush-admin.php:1297
|
299 |
msgid "Upgrade to WP Smush Pro to:"
|
300 |
msgstr ""
|
301 |
|
302 |
+
#: lib/class-wp-smush-admin.php:1303
|
303 |
msgid "Smush images greater than 1MB."
|
304 |
msgstr ""
|
305 |
|
306 |
+
#: lib/class-wp-smush-admin.php:1304
|
307 |
msgid "Bulk smush ALL your images with one click! No more rate limiting."
|
308 |
msgstr ""
|
309 |
|
310 |
+
#: lib/class-wp-smush-admin.php:1306
|
311 |
msgid "Access 24/7/365 support from <a href=\"https://premium.wpmudev.org/support/?utm_source=wordpress.org&utm_medium=plugin&utm_campaign=WP%20Smush%20Upgrade\">the best WordPress support team on the planet</a>."
|
312 |
msgstr ""
|
313 |
|
314 |
+
#: lib/class-wp-smush-admin.php:1307
|
315 |
msgid "Download <a href=\"https://premium.wpmudev.org/?utm_source=wordpress.org&utm_medium=plugin&utm_campaign=WP%20Smush%20Upgrade\">350+ other premium plugins and themes</a> included in your membership."
|
316 |
msgstr ""
|
317 |
|
318 |
+
#: lib/class-wp-smush-admin.php:1310
|
319 |
msgid "Upgrade Now »"
|
320 |
msgstr ""
|
321 |
|
322 |
+
#: lib/class-wp-smush-admin.php:1313
|
323 |
msgid "Already upgraded to a WPMU DEV membership? Install and Login to our Dashboard plugin to enable Smush Pro features."
|
324 |
msgstr ""
|
325 |
|
326 |
+
#: lib/class-wp-smush-admin.php:1315
|
327 |
+
msgid "Unable to access Pro Features? <a href=\"%s\">Refresh Status</a>"
|
328 |
+
msgstr ""
|
329 |
+
|
330 |
+
#: lib/class-wp-smush-admin.php:1325
|
331 |
msgid "Activate WPMU DEV Dashboard"
|
332 |
msgstr ""
|
333 |
|
334 |
+
#: lib/class-wp-smush-admin.php:1328
|
335 |
msgid "Install WPMU DEV Dashboard"
|
336 |
msgstr ""
|
337 |
|
338 |
+
#: lib/class-wp-smush-nextgen.php:193 lib/class-wp-smush.php:330
|
339 |
msgid "Size '%s' not processed correctly"
|
340 |
msgstr ""
|
341 |
|
342 |
+
#: lib/class-wp-smush.php:101
|
343 |
msgid "File path is empty"
|
344 |
msgstr ""
|
345 |
|
346 |
+
#: lib/class-wp-smush.php:106
|
347 |
msgid "Could not find %s"
|
348 |
msgstr ""
|
349 |
|
350 |
+
#: lib/class-wp-smush.php:111
|
351 |
msgid "%s is not writable"
|
352 |
msgstr ""
|
353 |
|
354 |
+
#: lib/class-wp-smush.php:121
|
355 |
msgid "Skipped (%s), image not found."
|
356 |
msgstr ""
|
357 |
|
358 |
+
#: lib/class-wp-smush.php:126
|
359 |
msgid "Skipped (%s), size limit exceeded."
|
360 |
msgstr ""
|
361 |
|
362 |
+
#: lib/class-wp-smush.php:141
|
363 |
msgid "Unknown API error"
|
364 |
msgstr ""
|
365 |
|
366 |
+
#: lib/class-wp-smush.php:362 lib/class-wp-smush.php:370
|
367 |
msgid "Size 'full' not processed correctly"
|
368 |
msgstr ""
|
369 |
|
370 |
+
#: lib/class-wp-smush.php:505
|
371 |
msgid "Error posting to API: %s"
|
372 |
msgstr ""
|
373 |
|
374 |
+
#: lib/class-wp-smush.php:511
|
375 |
msgid "Error posting to API: %s %s"
|
376 |
msgstr ""
|
377 |
|
378 |
+
#: lib/class-wp-smush.php:528
|
379 |
msgid "Smush data corrupted, try again."
|
380 |
msgstr ""
|
381 |
|
382 |
+
#: lib/class-wp-smush.php:544
|
383 |
msgid "Image couldn't be smushed"
|
384 |
msgstr ""
|
385 |
|
386 |
+
#: lib/class-wp-smush.php:719
|
387 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:185
|
388 |
msgid "Error processing request"
|
389 |
msgstr ""
|
390 |
|
391 |
+
#: lib/class-wp-smush.php:723
|
392 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:189
|
393 |
msgid "Already Optimized"
|
394 |
msgstr ""
|
395 |
|
396 |
+
#: lib/class-wp-smush.php:725
|
397 |
msgid "%d images reduced "
|
398 |
msgstr ""
|
399 |
|
400 |
+
#: lib/class-wp-smush.php:725
|
401 |
msgid "Reduced "
|
402 |
msgstr ""
|
403 |
|
404 |
+
#: lib/class-wp-smush.php:726
|
405 |
msgid "by %s ( %01.1f%% )"
|
406 |
msgstr ""
|
407 |
|
408 |
+
#: lib/class-wp-smush.php:731
|
409 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:195
|
410 |
msgid "Smush stats"
|
411 |
msgstr ""
|
412 |
|
413 |
+
#: lib/class-wp-smush.php:761
|
414 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:246
|
415 |
msgid "Not processed"
|
416 |
msgstr ""
|
417 |
|
418 |
+
#: lib/class-wp-smush.php:767
|
419 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:252
|
420 |
msgid "Smush Now!"
|
421 |
msgstr ""
|
422 |
|
423 |
+
#: lib/class-wp-smush.php:1070
|
424 |
msgid "Image couldn't be smushed as it exceeded the 1Mb size limit, Pro users can smush images with size upto 32Mb."
|
425 |
msgstr ""
|
426 |
|
427 |
+
#: lib/class-wp-smush.php:1072
|
428 |
msgid " Skipped"
|
429 |
msgstr ""
|
430 |
|
431 |
+
#: lib/class-wp-smush.php:1090
|
432 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:329
|
433 |
msgid "Image size"
|
434 |
msgstr ""
|
435 |
|
436 |
+
#: lib/class-wp-smush.php:1091
|
437 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:330
|
438 |
msgid "Savings"
|
439 |
msgstr ""
|
440 |
|
456 |
msgid "Smush request timed out, You can try setting a higher value ( > 60 ) for `WP_SMUSH_API_TIMEOUT`."
|
457 |
msgstr ""
|
458 |
|
459 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:191
|
460 |
msgid "Reduced by %s ( %01.1f%% )"
|
461 |
msgstr ""
|
462 |
|
lib/class-wp-smush-admin.php
CHANGED
@@ -26,7 +26,6 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
26 |
class WpSmushitAdmin extends WpSmush {
|
27 |
|
28 |
/**
|
29 |
-
*
|
30 |
* @var array Settings
|
31 |
*/
|
32 |
public $settings;
|
@@ -66,13 +65,18 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
66 |
*/
|
67 |
public $exceeding_items_count = 0;
|
68 |
|
|
|
|
|
|
|
|
|
|
|
69 |
/**
|
70 |
* Constructor
|
71 |
*/
|
72 |
public function __construct() {
|
73 |
|
74 |
// Save Settings, Process Option, Need to process it early, so the pages are loaded accordingly, nextgen gallery integration is loaded at same action
|
75 |
-
add_action( 'plugins_loaded', array( $this, 'process_options' ) );
|
76 |
|
77 |
// hook scripts and styles
|
78 |
add_action( 'admin_init', array( $this, 'register' ) );
|
@@ -102,9 +106,6 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
102 |
|
103 |
/// Smush Upgrade
|
104 |
add_action( 'admin_notices', array( $this, 'smush_upgrade' ) );
|
105 |
-
|
106 |
-
$this->init_settings();
|
107 |
-
|
108 |
}
|
109 |
|
110 |
/**
|
@@ -251,7 +252,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
251 |
$bulk = new WpSmushitBulk();
|
252 |
$handle = 'wp-smushit-admin-js';
|
253 |
|
254 |
-
if ( $this->
|
255 |
$bulk_now = __( 'Bulk Smush Now', 'wp-smushit' );
|
256 |
} else {
|
257 |
$bulk_now = sprintf( __( 'Bulk Smush %d Attachments', 'wp-smushit' ), $this->max_free_bulk );
|
@@ -276,7 +277,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
276 |
$this->ids = ! empty( $_REQUEST['ids'] ) ? explode( ',', $_REQUEST['ids'] ) : $bulk->get_attachments();
|
277 |
|
278 |
//If premium, Super smush allowed, all images are smushed, localize lossless smushed ids for bulk compression
|
279 |
-
if ( $this->
|
280 |
( $this->total_count == $this->smushed_count && empty( $this->ids ) )
|
281 |
) {
|
282 |
|
@@ -305,11 +306,11 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
305 |
* Translation ready settings
|
306 |
*/
|
307 |
function init_settings() {
|
308 |
-
if( $this->
|
309 |
-
$smush_orgnl_txt = esc_html__('Smush all images, including originals.', 'wp_smushit');
|
310 |
-
}else{
|
311 |
-
$count
|
312 |
-
$smush_orgnl_txt = sprintf( esc_html__("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.", 'wp_smushit'), $count );
|
313 |
}
|
314 |
$this->settings = array(
|
315 |
'auto' => __( 'Smush images on upload', 'wp-smushit' ),
|
@@ -339,7 +340,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
339 |
|
340 |
<h2>
|
341 |
<?php
|
342 |
-
if ( $this->
|
343 |
_e( 'WP Smush Pro', 'wp-smushit' );
|
344 |
} else {
|
345 |
_e( 'WP Smush', 'wp-smushit' );
|
@@ -389,47 +390,33 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
389 |
$opt_original = WP_SMUSH_PREFIX . 'original';
|
390 |
//Auto value
|
391 |
$opt_original_val = get_option( $opt_original, false );
|
392 |
-
//For free version, show unchecked
|
393 |
-
if ( ! $this->is_pro() ) {
|
394 |
-
$opt_original_val = 0;
|
395 |
-
}
|
396 |
|
397 |
//Smush auto key
|
398 |
$opt_lossy = WP_SMUSH_PREFIX . 'lossy';
|
399 |
//Auto value
|
400 |
$opt_lossy_val = get_option( $opt_lossy, false );
|
401 |
|
402 |
-
//For free version, show unchecked
|
403 |
-
if ( ! $this->is_pro() ) {
|
404 |
-
$opt_lossy_val = 0;
|
405 |
-
}
|
406 |
-
|
407 |
//Smush auto key
|
408 |
$opt_backup = WP_SMUSH_PREFIX . 'backup';
|
409 |
//Auto value
|
410 |
$opt_backup_val = get_option( $opt_backup, false );
|
411 |
|
412 |
-
//For free version, show unchecked
|
413 |
-
if ( ! $this->is_pro() ) {
|
414 |
-
$opt_backup_val = 0;
|
415 |
-
}
|
416 |
-
|
417 |
//Smush NextGen key
|
418 |
$opt_nextgen = WP_SMUSH_PREFIX . 'nextgen';
|
419 |
//Auto value
|
420 |
$opt_nextgen_val = get_option( $opt_nextgen, 1 );
|
421 |
|
|
|
|
|
|
|
422 |
//For free version, show unchecked
|
423 |
-
if ( ! $this->
|
424 |
-
$
|
425 |
-
|
|
|
|
|
426 |
|
427 |
-
//disable lossy for non-premium members
|
428 |
-
$disabled = $class = $feature_class = '';
|
429 |
-
if ( ! $this->is_pro() ) {
|
430 |
$disabled = ' disabled';
|
431 |
-
$opt_lossy_val = $opt_backup_val = 0;
|
432 |
-
$class = ' inactive inactive-anim';
|
433 |
} ?>
|
434 |
<div class='wp-smush-setting-row'><?php
|
435 |
// return html
|
@@ -439,11 +426,13 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
439 |
<fieldset class="wp-smush-pro-features">
|
440 |
<legend><strong><?php esc_html_e( "PRO FEATURES", "wp-smushit" ); ?></strong></legend><?php
|
441 |
|
442 |
-
if ( ! $this->
|
443 |
?>
|
444 |
<div class="pro-note">
|
445 |
-
<div style="padding:14px 0 14px;"
|
446 |
-
<
|
|
|
|
|
447 |
</div>
|
448 |
</div>
|
449 |
<?php
|
@@ -479,6 +468,16 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
479 |
* @return null
|
480 |
*/
|
481 |
function process_options() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
// we aren't saving options
|
483 |
if ( ! isset( $_POST['wp_smush_options_nonce'] ) ) {
|
484 |
return;
|
@@ -513,8 +512,8 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
513 |
* @return int
|
514 |
*/
|
515 |
function get_exceeding_items_count( $force_update = false ) {
|
516 |
-
$count = wp_cache_get('exceeding_items', 'wp_smush');
|
517 |
-
if(
|
518 |
$count = 0;
|
519 |
$bulk = new WpSmushitBulk();
|
520 |
$attachments = $bulk->get_attachments();
|
@@ -540,7 +539,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
540 |
function bulk_preview() {
|
541 |
|
542 |
$exceed_mb = '';
|
543 |
-
if ( ! $this->
|
544 |
|
545 |
//Initialize exceeding item Count
|
546 |
$this->exceeding_items_count = $this->get_exceeding_items_count();
|
@@ -582,7 +581,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
582 |
<p><?php _e( "Please be aware, smushing a large number of images can take a while depending on your server and network speed.
|
583 |
<strong>You must keep this page open while the bulk smush is processing</strong>, but you can leave at any time and come back to continue where it left off.", 'wp-smushit' ); ?></p>
|
584 |
|
585 |
-
<?php if ( ! $this->
|
586 |
<p class="error">
|
587 |
<?php printf( __( "Free accounts are limited to bulk smushing %d attachments per request. You will need to click to start a new bulk job after each %d attachments.", 'wp-smushit' ), $this->max_free_bulk, $this->max_free_bulk ); ?>
|
588 |
<a href="<?php echo $this->upgrade_url; ?>"><?php _e( 'Remove limits »', 'wp-smushit' ); ?></a>
|
@@ -695,16 +694,12 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
695 |
global $WpSmush;
|
696 |
|
697 |
$should_continue = true;
|
698 |
-
$is_pro = false;
|
699 |
|
700 |
if ( empty( $_REQUEST['attachment_id'] ) ) {
|
701 |
wp_send_json_error( 'missing id' );
|
702 |
}
|
703 |
|
704 |
-
|
705 |
-
$is_pro = $WpSmush->is_pro();
|
706 |
-
|
707 |
-
if ( ! $is_pro ) {
|
708 |
//Free version bulk smush, check the transient counter value
|
709 |
$should_continue = $this->check_bulk_limit();
|
710 |
}
|
@@ -735,7 +730,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
735 |
if ( is_wp_error( $smush ) ) {
|
736 |
$error = $smush->get_error_message();
|
737 |
//Check for timeout error and suggest to filter timeout
|
738 |
-
if( strpos( $error, 'timed out') ) {
|
739 |
$msg = esc_html__( "Smush request timed out, You can try setting a higher value for `WP_SMUSH_API_TIMEOUT`.", "wp-smushit" );
|
740 |
}
|
741 |
wp_send_json_error( array( 'stats' => $stats, 'error_msg' => $msg ) );
|
@@ -992,8 +987,8 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
992 |
* Allows to set a limit of mysql query
|
993 |
* Default value is 2000
|
994 |
*/
|
995 |
-
$limit
|
996 |
-
$limit
|
997 |
$offset = 0;
|
998 |
|
999 |
while ( $global_data = $wpdb->get_col( $wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key=%s LIMIT $offset, $limit", "wp-smpro-smush-data" ) ) ) {
|
@@ -1012,7 +1007,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1012 |
$offset += $limit;
|
1013 |
}
|
1014 |
|
1015 |
-
if ( $smush_data['bytes'] < 0 ) {
|
1016 |
$smush_data['bytes'] = 0;
|
1017 |
}
|
1018 |
|
@@ -1039,7 +1034,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1039 |
'cancel' => false,
|
1040 |
);
|
1041 |
if ( $super_smush ) {
|
1042 |
-
if ( $this->
|
1043 |
|
1044 |
$button['text'] = __( 'Bulk Smush Now', 'wp-smushit' );
|
1045 |
$button['class'] = 'wp-smush-button wp-smush-send';
|
@@ -1055,7 +1050,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1055 |
$button['class'] = 'wp-smush-finished disabled wp-smush-finished';
|
1056 |
$button['disabled'] = 'disabled';
|
1057 |
|
1058 |
-
} else if ( $this->
|
1059 |
|
1060 |
$button['text'] = __( 'Bulk Smush Now', 'wp-smushit' );
|
1061 |
$button['class'] = 'wp-smush-button wp-smush-send';
|
@@ -1076,7 +1071,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1076 |
* @return array
|
1077 |
*/
|
1078 |
function get_smushed_image_ids() {
|
1079 |
-
$args
|
1080 |
'fields' => 'ids',
|
1081 |
'post_type' => 'attachment',
|
1082 |
'post_status' => 'any',
|
@@ -1127,6 +1122,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1127 |
* Shows Notice for free users, displays a discount coupon
|
1128 |
*/
|
1129 |
function smush_upgrade() {
|
|
|
1130 |
if ( ! current_user_can( 'edit_others_posts' ) || ! is_super_admin() ) {
|
1131 |
return;
|
1132 |
}
|
@@ -1139,7 +1135,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1139 |
update_option( 'dismiss_smush_upgrade', 1 );
|
1140 |
}
|
1141 |
|
1142 |
-
if ( get_option( 'dismiss_smush_upgrade' ) || $this->
|
1143 |
return;
|
1144 |
}
|
1145 |
?>
|
@@ -1278,7 +1274,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1278 |
if ( ! is_super_admin() || ! $show_features ) {
|
1279 |
return;
|
1280 |
}
|
1281 |
-
if ( $this->
|
1282 |
<div class="wp-smpushit-features updated">
|
1283 |
<h3><?php _e( 'Thanks for using WP Smush Pro! You now can:', 'wp-smushit' ) ?></h3>
|
1284 |
<ol>
|
@@ -1291,7 +1287,12 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1291 |
<li><?php _e( 'Keep a backup of your original un-smushed images in case you want to restore later.', 'wp-smushit' ); ?></li>
|
1292 |
</ol>
|
1293 |
</div>
|
1294 |
-
<?php } else {
|
|
|
|
|
|
|
|
|
|
|
1295 |
<div class="wp-smpushit-features error">
|
1296 |
<h3><?php _e( 'Upgrade to WP Smush Pro to:', 'wp-smushit' ) ?></h3>
|
1297 |
<ol>
|
@@ -1309,7 +1310,10 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1309 |
<a class="button-primary" href="<?php echo $this->upgrade_url; ?>"><?php _e( 'Upgrade Now »', 'wp-smushit' ); ?></a>
|
1310 |
</p>
|
1311 |
|
1312 |
-
<p><?php _e( 'Already upgraded to a WPMU DEV membership? Install and Login to our Dashboard plugin to enable Smush Pro features.', 'wp-smushit' ); ?></p
|
|
|
|
|
|
|
1313 |
|
1314 |
<p>
|
1315 |
<?php
|
@@ -1317,11 +1321,11 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1317 |
if ( file_exists( WP_PLUGIN_DIR . '/wpmudev-updates/update-notifications.php' ) ) {
|
1318 |
$function = is_multisite() ? 'network_admin_url' : 'admin_url';
|
1319 |
$url = wp_nonce_url( $function( 'plugins.php?action=activate&plugin=wpmudev-updates%2Fupdate-notifications.php' ), 'activate-plugin_wpmudev-updates/update-notifications.php' );
|
1320 |
-
|
1321 |
-
href="<?php echo $url; ?>"><?php _e( 'Activate WPMU DEV Dashboard', 'wp-smushit' ); ?></a><?php
|
1322 |
} else { //dashboard not installed at all
|
1323 |
-
|
1324 |
-
|
1325 |
}
|
1326 |
}
|
1327 |
?>
|
@@ -1329,6 +1333,18 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1329 |
</div>
|
1330 |
<?php }
|
1331 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1332 |
}
|
1333 |
|
1334 |
global $wpsmushit_admin;
|
26 |
class WpSmushitAdmin extends WpSmush {
|
27 |
|
28 |
/**
|
|
|
29 |
* @var array Settings
|
30 |
*/
|
31 |
public $settings;
|
65 |
*/
|
66 |
public $exceeding_items_count = 0;
|
67 |
|
68 |
+
/**
|
69 |
+
* @var If the plugin is a pro version or not
|
70 |
+
*/
|
71 |
+
private $is_pro_user;
|
72 |
+
|
73 |
/**
|
74 |
* Constructor
|
75 |
*/
|
76 |
public function __construct() {
|
77 |
|
78 |
// Save Settings, Process Option, Need to process it early, so the pages are loaded accordingly, nextgen gallery integration is loaded at same action
|
79 |
+
add_action( 'plugins_loaded', array( $this, 'process_options' ), 20 );
|
80 |
|
81 |
// hook scripts and styles
|
82 |
add_action( 'admin_init', array( $this, 'register' ) );
|
106 |
|
107 |
/// Smush Upgrade
|
108 |
add_action( 'admin_notices', array( $this, 'smush_upgrade' ) );
|
|
|
|
|
|
|
109 |
}
|
110 |
|
111 |
/**
|
252 |
$bulk = new WpSmushitBulk();
|
253 |
$handle = 'wp-smushit-admin-js';
|
254 |
|
255 |
+
if ( $this->is_pro_user || $this->remaining_count <= $this->max_free_bulk ) {
|
256 |
$bulk_now = __( 'Bulk Smush Now', 'wp-smushit' );
|
257 |
} else {
|
258 |
$bulk_now = sprintf( __( 'Bulk Smush %d Attachments', 'wp-smushit' ), $this->max_free_bulk );
|
277 |
$this->ids = ! empty( $_REQUEST['ids'] ) ? explode( ',', $_REQUEST['ids'] ) : $bulk->get_attachments();
|
278 |
|
279 |
//If premium, Super smush allowed, all images are smushed, localize lossless smushed ids for bulk compression
|
280 |
+
if ( $this->is_pro_user &&
|
281 |
( $this->total_count == $this->smushed_count && empty( $this->ids ) )
|
282 |
) {
|
283 |
|
306 |
* Translation ready settings
|
307 |
*/
|
308 |
function init_settings() {
|
309 |
+
if ( $this->is_pro_user ) {
|
310 |
+
$smush_orgnl_txt = esc_html__( 'Smush all images, including originals.', 'wp_smushit' );
|
311 |
+
} else {
|
312 |
+
$count = count( get_intermediate_image_sizes() );
|
313 |
+
$smush_orgnl_txt = sprintf( esc_html__( "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.", 'wp_smushit' ), $count );
|
314 |
}
|
315 |
$this->settings = array(
|
316 |
'auto' => __( 'Smush images on upload', 'wp-smushit' ),
|
340 |
|
341 |
<h2>
|
342 |
<?php
|
343 |
+
if ( $this->is_pro_user ) {
|
344 |
_e( 'WP Smush Pro', 'wp-smushit' );
|
345 |
} else {
|
346 |
_e( 'WP Smush', 'wp-smushit' );
|
390 |
$opt_original = WP_SMUSH_PREFIX . 'original';
|
391 |
//Auto value
|
392 |
$opt_original_val = get_option( $opt_original, false );
|
|
|
|
|
|
|
|
|
393 |
|
394 |
//Smush auto key
|
395 |
$opt_lossy = WP_SMUSH_PREFIX . 'lossy';
|
396 |
//Auto value
|
397 |
$opt_lossy_val = get_option( $opt_lossy, false );
|
398 |
|
|
|
|
|
|
|
|
|
|
|
399 |
//Smush auto key
|
400 |
$opt_backup = WP_SMUSH_PREFIX . 'backup';
|
401 |
//Auto value
|
402 |
$opt_backup_val = get_option( $opt_backup, false );
|
403 |
|
|
|
|
|
|
|
|
|
|
|
404 |
//Smush NextGen key
|
405 |
$opt_nextgen = WP_SMUSH_PREFIX . 'nextgen';
|
406 |
//Auto value
|
407 |
$opt_nextgen_val = get_option( $opt_nextgen, 1 );
|
408 |
|
409 |
+
//disable lossy for non-premium members
|
410 |
+
$disabled = $feature_class = '';
|
411 |
+
|
412 |
//For free version, show unchecked
|
413 |
+
if ( ! $this->is_pro_user ) {
|
414 |
+
$opt_original_val = 0;
|
415 |
+
$opt_lossy_val = 0;
|
416 |
+
$opt_backup_val = 0;
|
417 |
+
$opt_nextgen_val = 0;
|
418 |
|
|
|
|
|
|
|
419 |
$disabled = ' disabled';
|
|
|
|
|
420 |
} ?>
|
421 |
<div class='wp-smush-setting-row'><?php
|
422 |
// return html
|
426 |
<fieldset class="wp-smush-pro-features">
|
427 |
<legend><strong><?php esc_html_e( "PRO FEATURES", "wp-smushit" ); ?></strong></legend><?php
|
428 |
|
429 |
+
if ( ! $this->is_pro_user ) {
|
430 |
?>
|
431 |
<div class="pro-note">
|
432 |
+
<div style="padding:14px 0 14px;">
|
433 |
+
<span class="dashicons dashicons-info"></span><?php esc_html_e( "These features are available in Pro Version of the plugin.", "wp-smushit" ); ?>
|
434 |
+
<a href="<?php echo $this->upgrade_url; ?>" target="_blank" class="button find-out-link">Find
|
435 |
+
out more »</a>
|
436 |
</div>
|
437 |
</div>
|
438 |
<?php
|
468 |
* @return null
|
469 |
*/
|
470 |
function process_options() {
|
471 |
+
|
472 |
+
$this->is_pro_user = $this->is_pro();
|
473 |
+
|
474 |
+
$this->init_settings();
|
475 |
+
|
476 |
+
//If refresh is set in URL
|
477 |
+
if ( isset( $_GET['refresh'] ) && $_GET['refresh'] ) {
|
478 |
+
$this->refresh_status();
|
479 |
+
}
|
480 |
+
|
481 |
// we aren't saving options
|
482 |
if ( ! isset( $_POST['wp_smush_options_nonce'] ) ) {
|
483 |
return;
|
512 |
* @return int
|
513 |
*/
|
514 |
function get_exceeding_items_count( $force_update = false ) {
|
515 |
+
$count = wp_cache_get( 'exceeding_items', 'wp_smush' );
|
516 |
+
if ( ! $count || $force_update ) {
|
517 |
$count = 0;
|
518 |
$bulk = new WpSmushitBulk();
|
519 |
$attachments = $bulk->get_attachments();
|
539 |
function bulk_preview() {
|
540 |
|
541 |
$exceed_mb = '';
|
542 |
+
if ( ! $this->is_pro_user ) {
|
543 |
|
544 |
//Initialize exceeding item Count
|
545 |
$this->exceeding_items_count = $this->get_exceeding_items_count();
|
581 |
<p><?php _e( "Please be aware, smushing a large number of images can take a while depending on your server and network speed.
|
582 |
<strong>You must keep this page open while the bulk smush is processing</strong>, but you can leave at any time and come back to continue where it left off.", 'wp-smushit' ); ?></p>
|
583 |
|
584 |
+
<?php if ( ! $this->is_pro_user ) { ?>
|
585 |
<p class="error">
|
586 |
<?php printf( __( "Free accounts are limited to bulk smushing %d attachments per request. You will need to click to start a new bulk job after each %d attachments.", 'wp-smushit' ), $this->max_free_bulk, $this->max_free_bulk ); ?>
|
587 |
<a href="<?php echo $this->upgrade_url; ?>"><?php _e( 'Remove limits »', 'wp-smushit' ); ?></a>
|
694 |
global $WpSmush;
|
695 |
|
696 |
$should_continue = true;
|
|
|
697 |
|
698 |
if ( empty( $_REQUEST['attachment_id'] ) ) {
|
699 |
wp_send_json_error( 'missing id' );
|
700 |
}
|
701 |
|
702 |
+
if ( ! $this->is_pro_user ) {
|
|
|
|
|
|
|
703 |
//Free version bulk smush, check the transient counter value
|
704 |
$should_continue = $this->check_bulk_limit();
|
705 |
}
|
730 |
if ( is_wp_error( $smush ) ) {
|
731 |
$error = $smush->get_error_message();
|
732 |
//Check for timeout error and suggest to filter timeout
|
733 |
+
if ( strpos( $error, 'timed out' ) ) {
|
734 |
$msg = esc_html__( "Smush request timed out, You can try setting a higher value for `WP_SMUSH_API_TIMEOUT`.", "wp-smushit" );
|
735 |
}
|
736 |
wp_send_json_error( array( 'stats' => $stats, 'error_msg' => $msg ) );
|
987 |
* Allows to set a limit of mysql query
|
988 |
* Default value is 2000
|
989 |
*/
|
990 |
+
$limit = apply_filters( 'wp_smush_media_query_limit', 2000 );
|
991 |
+
$limit = intval( $limit );
|
992 |
$offset = 0;
|
993 |
|
994 |
while ( $global_data = $wpdb->get_col( $wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key=%s LIMIT $offset, $limit", "wp-smpro-smush-data" ) ) ) {
|
1007 |
$offset += $limit;
|
1008 |
}
|
1009 |
|
1010 |
+
if ( ! isset( $smush_data['bytes'] ) || $smush_data['bytes'] < 0 ) {
|
1011 |
$smush_data['bytes'] = 0;
|
1012 |
}
|
1013 |
|
1034 |
'cancel' => false,
|
1035 |
);
|
1036 |
if ( $super_smush ) {
|
1037 |
+
if ( $this->is_pro_user || $this->remaining_count <= $this->max_free_bulk ) { //if premium or under limit
|
1038 |
|
1039 |
$button['text'] = __( 'Bulk Smush Now', 'wp-smushit' );
|
1040 |
$button['class'] = 'wp-smush-button wp-smush-send';
|
1050 |
$button['class'] = 'wp-smush-finished disabled wp-smush-finished';
|
1051 |
$button['disabled'] = 'disabled';
|
1052 |
|
1053 |
+
} else if ( $this->is_pro_user || $this->remaining_count <= $this->max_free_bulk ) { //if premium or under limit
|
1054 |
|
1055 |
$button['text'] = __( 'Bulk Smush Now', 'wp-smushit' );
|
1056 |
$button['class'] = 'wp-smush-button wp-smush-send';
|
1071 |
* @return array
|
1072 |
*/
|
1073 |
function get_smushed_image_ids() {
|
1074 |
+
$args = array(
|
1075 |
'fields' => 'ids',
|
1076 |
'post_type' => 'attachment',
|
1077 |
'post_status' => 'any',
|
1122 |
* Shows Notice for free users, displays a discount coupon
|
1123 |
*/
|
1124 |
function smush_upgrade() {
|
1125 |
+
|
1126 |
if ( ! current_user_can( 'edit_others_posts' ) || ! is_super_admin() ) {
|
1127 |
return;
|
1128 |
}
|
1135 |
update_option( 'dismiss_smush_upgrade', 1 );
|
1136 |
}
|
1137 |
|
1138 |
+
if ( get_option( 'dismiss_smush_upgrade' ) || $this->is_pro_user ) {
|
1139 |
return;
|
1140 |
}
|
1141 |
?>
|
1274 |
if ( ! is_super_admin() || ! $show_features ) {
|
1275 |
return;
|
1276 |
}
|
1277 |
+
if ( $this->is_pro_user ) { ?>
|
1278 |
<div class="wp-smpushit-features updated">
|
1279 |
<h3><?php _e( 'Thanks for using WP Smush Pro! You now can:', 'wp-smushit' ) ?></h3>
|
1280 |
<ol>
|
1287 |
<li><?php _e( 'Keep a backup of your original un-smushed images in case you want to restore later.', 'wp-smushit' ); ?></li>
|
1288 |
</ol>
|
1289 |
</div>
|
1290 |
+
<?php } else {
|
1291 |
+
if( $this->_get_api_key() ) {
|
1292 |
+
$refresh_url = add_query_arg( array( 'refresh' => 1 ) );
|
1293 |
+
}else{
|
1294 |
+
$refresh_url = '';
|
1295 |
+
}?>
|
1296 |
<div class="wp-smpushit-features error">
|
1297 |
<h3><?php _e( 'Upgrade to WP Smush Pro to:', 'wp-smushit' ) ?></h3>
|
1298 |
<ol>
|
1310 |
<a class="button-primary" href="<?php echo $this->upgrade_url; ?>"><?php _e( 'Upgrade Now »', 'wp-smushit' ); ?></a>
|
1311 |
</p>
|
1312 |
|
1313 |
+
<p><?php _e( 'Already upgraded to a WPMU DEV membership? Install and Login to our Dashboard plugin to enable Smush Pro features.', 'wp-smushit' ); ?></p><?php
|
1314 |
+
if ( ! empty( $refresh_url ) ) {?>
|
1315 |
+
<p><?php echo sprintf( __( 'Unable to access Pro Features? <a href="%s">Refresh Status</a>', 'wp-smushit' ), $refresh_url ); ?></p><?php }
|
1316 |
+
?>
|
1317 |
|
1318 |
<p>
|
1319 |
<?php
|
1321 |
if ( file_exists( WP_PLUGIN_DIR . '/wpmudev-updates/update-notifications.php' ) ) {
|
1322 |
$function = is_multisite() ? 'network_admin_url' : 'admin_url';
|
1323 |
$url = wp_nonce_url( $function( 'plugins.php?action=activate&plugin=wpmudev-updates%2Fupdate-notifications.php' ), 'activate-plugin_wpmudev-updates/update-notifications.php' );
|
1324 |
+
?>
|
1325 |
+
<a class="button-secondary" href="<?php echo $url; ?>"><?php _e( 'Activate WPMU DEV Dashboard', 'wp-smushit' ); ?></a><?php
|
1326 |
} else { //dashboard not installed at all
|
1327 |
+
?>
|
1328 |
+
<a class="button-secondary" target="_blank" href="https://premium.wpmudev.org/project/wpmu-dev-dashboard/"><?php _e( 'Install WPMU DEV Dashboard', 'wp-smushit' ); ?></a><?php
|
1329 |
}
|
1330 |
}
|
1331 |
?>
|
1333 |
</div>
|
1334 |
<?php }
|
1335 |
}
|
1336 |
+
|
1337 |
+
/**
|
1338 |
+
* Delete Site transient, stored for api status
|
1339 |
+
*/
|
1340 |
+
function refresh_status() {
|
1341 |
+
global $WpSmush;
|
1342 |
+
|
1343 |
+
$api_key = $WpSmush->_get_api_key();
|
1344 |
+
$key = "wp-smush-premium-" . substr( $api_key, - 5, 5 );
|
1345 |
+
|
1346 |
+
delete_site_transient( $key );
|
1347 |
+
}
|
1348 |
}
|
1349 |
|
1350 |
global $wpsmushit_admin;
|
lib/class-wp-smush.php
CHANGED
@@ -6,32 +6,29 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
6 |
|
7 |
var $version = WP_SMUSH_VERSION;
|
8 |
|
9 |
-
var $is_pro;
|
10 |
-
|
11 |
/**
|
12 |
-
*
|
13 |
-
*
|
14 |
*/
|
15 |
-
|
16 |
|
17 |
/**
|
18 |
* Api server url to check api key validity
|
19 |
*
|
20 |
*/
|
21 |
-
|
22 |
|
23 |
/**
|
24 |
* Meta key to save smush result to db
|
25 |
*
|
26 |
*
|
27 |
*/
|
28 |
-
|
29 |
|
30 |
/**
|
31 |
* Meta key to save migrated version
|
32 |
*
|
33 |
*/
|
34 |
-
|
35 |
|
36 |
/**
|
37 |
* Constructor
|
@@ -72,13 +69,18 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
72 |
//Old Smush stats migration
|
73 |
add_action( "admin_init", array( $this, "migrate" ) );
|
74 |
|
|
|
|
|
|
|
75 |
//Load NextGen Gallery, if hooked too late or early, auto smush doesn't works, also Load after settings have been saved on init action
|
76 |
add_action( 'plugins_loaded', array( $this, 'load_nextgen' ), 90 );
|
|
|
77 |
|
|
|
|
|
78 |
}
|
79 |
|
80 |
function admin_init() {
|
81 |
-
load_plugin_textdomain( 'wp-smushit', false, WP_SMUSH_DIR . '/languages/' );
|
82 |
wp_enqueue_script( 'common' );
|
83 |
}
|
84 |
|
@@ -386,7 +388,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
386 |
//Set smush status for all the images, store it in wp-smpro-smush-data
|
387 |
if ( ! $has_errors ) {
|
388 |
|
389 |
-
$existing_stats = get_post_meta( $ID,
|
390 |
|
391 |
if ( ! empty( $existing_stats ) ) {
|
392 |
//Update total bytes saved, and compression percent
|
@@ -408,7 +410,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
408 |
}
|
409 |
}
|
410 |
}
|
411 |
-
update_post_meta( $ID,
|
412 |
}
|
413 |
|
414 |
return $meta;
|
@@ -420,7 +422,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
420 |
*
|
421 |
* Filters wp_generate_attachment_metadata
|
422 |
*
|
423 |
-
* @uses
|
424 |
*
|
425 |
* @param $meta
|
426 |
* @param null $ID
|
@@ -600,14 +602,14 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
600 |
return false;
|
601 |
}
|
602 |
|
603 |
-
$key = "wp-smush-premium-" . substr( $api_key, -
|
604 |
if ( false === ( $valid = get_site_transient( $key ) ) ) {
|
605 |
// call api
|
606 |
-
$url =
|
607 |
|
608 |
$request = wp_remote_get( $url, array(
|
609 |
"user-agent" => WP_SMUSH_UA,
|
610 |
-
"timeout" =>
|
611 |
)
|
612 |
);
|
613 |
|
@@ -618,12 +620,12 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
618 |
set_site_transient( $key, 1, 12 * HOUR_IN_SECONDS );
|
619 |
} else {
|
620 |
$valid = false;
|
621 |
-
set_site_transient( $key, 0,
|
622 |
}
|
623 |
|
624 |
} else {
|
625 |
$valid = false;
|
626 |
-
set_site_transient( $key, 0,
|
627 |
}
|
628 |
|
629 |
}
|
@@ -638,20 +640,12 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
638 |
*
|
639 |
* @return mixed
|
640 |
*/
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
if ( defined( 'WPMUDEV_APIKEY' ) ) {
|
648 |
-
$api_key = WPMUDEV_APIKEY;
|
649 |
-
} else {
|
650 |
-
$api_key = get_site_option( 'wpmudev_apikey' );
|
651 |
-
}
|
652 |
-
if ( $api_key ) {
|
653 |
-
wp_cache_add( "wpmudev_apikey", $api_key, 'smush', 6000 );
|
654 |
-
}
|
655 |
}
|
656 |
|
657 |
return $api_key;
|
@@ -709,7 +703,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
709 |
$status_txt = $button_txt = '';
|
710 |
$show_button = false;
|
711 |
|
712 |
-
$wp_smush_data = get_post_meta( $id,
|
713 |
$attachment_data = wp_get_attachment_metadata( $id );
|
714 |
//
|
715 |
// if the image is smushed
|
@@ -851,7 +845,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
851 |
return;
|
852 |
}
|
853 |
|
854 |
-
$migrated_version = get_option(
|
855 |
|
856 |
if ( $migrated_version === $this->version ) {
|
857 |
return;
|
@@ -870,11 +864,11 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
870 |
foreach ( $results as $attachment_meta ) {
|
871 |
$migrated_message = $migrator->migrate_api_message( maybe_unserialize( $attachment_meta->meta_value ) );
|
872 |
if ( $migrated_message !== array() ) {
|
873 |
-
update_post_meta( $attachment_meta->post_id,
|
874 |
}
|
875 |
}
|
876 |
|
877 |
-
update_option(
|
878 |
|
879 |
}
|
880 |
|
@@ -911,7 +905,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
911 |
$image_size = $image_size . '@2x';
|
912 |
$data = $smush_stats['data'];
|
913 |
//Get existing Stats
|
914 |
-
$stats = get_post_meta( $id,
|
915 |
//Update existing Stats
|
916 |
if ( ! empty( $stats ) ) {
|
917 |
//Update total bytes saved, and compression percent
|
@@ -952,7 +946,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
952 |
$stats['sizes'][ $image_size ] = (object) $this->_array_fill_placeholders( $this->_get_size_signature(), (array) $data );
|
953 |
}
|
954 |
//Calculate Percent
|
955 |
-
update_post_meta( $id,
|
956 |
|
957 |
}
|
958 |
|
@@ -1203,11 +1197,11 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
1203 |
$query->set( 'meta_query', array(
|
1204 |
'relation' => 'OR',
|
1205 |
array(
|
1206 |
-
'key' =>
|
1207 |
'compare' => 'EXISTS'
|
1208 |
),
|
1209 |
array(
|
1210 |
-
'key' =>
|
1211 |
'compare' => 'NOT EXISTS'
|
1212 |
)
|
1213 |
) );
|
6 |
|
7 |
var $version = WP_SMUSH_VERSION;
|
8 |
|
|
|
|
|
9 |
/**
|
10 |
+
* @var Stores the value of is_pro function
|
|
|
11 |
*/
|
12 |
+
private $is_pro;
|
13 |
|
14 |
/**
|
15 |
* Api server url to check api key validity
|
16 |
*
|
17 |
*/
|
18 |
+
var $api_server = 'https://premium.wpmudev.org/wdp-un.php?action=smushit_check';
|
19 |
|
20 |
/**
|
21 |
* Meta key to save smush result to db
|
22 |
*
|
23 |
*
|
24 |
*/
|
25 |
+
var $smushed_meta_key = 'wp-smpro-smush-data';
|
26 |
|
27 |
/**
|
28 |
* Meta key to save migrated version
|
29 |
*
|
30 |
*/
|
31 |
+
var $migrated_version_key = "wp-smush-migrated-version";
|
32 |
|
33 |
/**
|
34 |
* Constructor
|
69 |
//Old Smush stats migration
|
70 |
add_action( "admin_init", array( $this, "migrate" ) );
|
71 |
|
72 |
+
//Load Translation files
|
73 |
+
add_action( 'plugins_loaded', array( $this, 'i18n' ), 12 );
|
74 |
+
|
75 |
//Load NextGen Gallery, if hooked too late or early, auto smush doesn't works, also Load after settings have been saved on init action
|
76 |
add_action( 'plugins_loaded', array( $this, 'load_nextgen' ), 90 );
|
77 |
+
}
|
78 |
|
79 |
+
function i18n() {
|
80 |
+
load_plugin_textdomain( 'wp-smushit', false, WP_SMUSH_DIR . '/languages/' );
|
81 |
}
|
82 |
|
83 |
function admin_init() {
|
|
|
84 |
wp_enqueue_script( 'common' );
|
85 |
}
|
86 |
|
388 |
//Set smush status for all the images, store it in wp-smpro-smush-data
|
389 |
if ( ! $has_errors ) {
|
390 |
|
391 |
+
$existing_stats = get_post_meta( $ID, $this->smushed_meta_key, true );
|
392 |
|
393 |
if ( ! empty( $existing_stats ) ) {
|
394 |
//Update total bytes saved, and compression percent
|
410 |
}
|
411 |
}
|
412 |
}
|
413 |
+
update_post_meta( $ID, $this->smushed_meta_key, $stats );
|
414 |
}
|
415 |
|
416 |
return $meta;
|
422 |
*
|
423 |
* Filters wp_generate_attachment_metadata
|
424 |
*
|
425 |
+
* @uses resize_from_meta_data
|
426 |
*
|
427 |
* @param $meta
|
428 |
* @param null $ID
|
602 |
return false;
|
603 |
}
|
604 |
|
605 |
+
$key = "wp-smush-premium-" . substr( $api_key, - 5, 5 ); //add last 5 chars of apikey to transient key in case it changes
|
606 |
if ( false === ( $valid = get_site_transient( $key ) ) ) {
|
607 |
// call api
|
608 |
+
$url = $this->api_server . '&key=' . urlencode( $api_key );
|
609 |
|
610 |
$request = wp_remote_get( $url, array(
|
611 |
"user-agent" => WP_SMUSH_UA,
|
612 |
+
"timeout" => 10
|
613 |
)
|
614 |
);
|
615 |
|
620 |
set_site_transient( $key, 1, 12 * HOUR_IN_SECONDS );
|
621 |
} else {
|
622 |
$valid = false;
|
623 |
+
set_site_transient( $key, 0, 24 * HOUR_IN_SECONDS ); //cache failure much shorter
|
624 |
}
|
625 |
|
626 |
} else {
|
627 |
$valid = false;
|
628 |
+
set_site_transient( $key, 0, 30 * MINUTE_IN_SECONDS ); //cache network failure even shorter, we don't want a request every pageload
|
629 |
}
|
630 |
|
631 |
}
|
640 |
*
|
641 |
* @return mixed
|
642 |
*/
|
643 |
+
function _get_api_key() {
|
644 |
+
|
645 |
+
if ( defined( 'WPMUDEV_APIKEY' ) ) {
|
646 |
+
$api_key = WPMUDEV_APIKEY;
|
647 |
+
} else {
|
648 |
+
$api_key = get_site_option( 'wpmudev_apikey' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
649 |
}
|
650 |
|
651 |
return $api_key;
|
703 |
$status_txt = $button_txt = '';
|
704 |
$show_button = false;
|
705 |
|
706 |
+
$wp_smush_data = get_post_meta( $id, $this->smushed_meta_key, true );
|
707 |
$attachment_data = wp_get_attachment_metadata( $id );
|
708 |
//
|
709 |
// if the image is smushed
|
845 |
return;
|
846 |
}
|
847 |
|
848 |
+
$migrated_version = get_option( $this->migrated_version_key );
|
849 |
|
850 |
if ( $migrated_version === $this->version ) {
|
851 |
return;
|
864 |
foreach ( $results as $attachment_meta ) {
|
865 |
$migrated_message = $migrator->migrate_api_message( maybe_unserialize( $attachment_meta->meta_value ) );
|
866 |
if ( $migrated_message !== array() ) {
|
867 |
+
update_post_meta( $attachment_meta->post_id, $this->smushed_meta_key, $migrated_message );
|
868 |
}
|
869 |
}
|
870 |
|
871 |
+
update_option( $this->migrated_version_key, $this->version );
|
872 |
|
873 |
}
|
874 |
|
905 |
$image_size = $image_size . '@2x';
|
906 |
$data = $smush_stats['data'];
|
907 |
//Get existing Stats
|
908 |
+
$stats = get_post_meta( $id, $this->smushed_meta_key, true );
|
909 |
//Update existing Stats
|
910 |
if ( ! empty( $stats ) ) {
|
911 |
//Update total bytes saved, and compression percent
|
946 |
$stats['sizes'][ $image_size ] = (object) $this->_array_fill_placeholders( $this->_get_size_signature(), (array) $data );
|
947 |
}
|
948 |
//Calculate Percent
|
949 |
+
update_post_meta( $id, $this->smushed_meta_key, $stats );
|
950 |
|
951 |
}
|
952 |
|
1197 |
$query->set( 'meta_query', array(
|
1198 |
'relation' => 'OR',
|
1199 |
array(
|
1200 |
+
'key' => $this->smushed_meta_key,
|
1201 |
'compare' => 'EXISTS'
|
1202 |
),
|
1203 |
array(
|
1204 |
+
'key' => $this->smushed_meta_key,
|
1205 |
'compare' => 'NOT EXISTS'
|
1206 |
)
|
1207 |
) );
|
lib/nextgen-integration/class-wp-smush-nextgen-stats.php
CHANGED
@@ -19,9 +19,13 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
|
|
19 |
* @var array Contains the total Stats, for displaying it on bulk page
|
20 |
*/
|
21 |
var $stats = array();
|
|
|
22 |
|
23 |
function __construct() {
|
24 |
|
|
|
|
|
|
|
25 |
//Update Total Image count
|
26 |
add_action( 'ngg_added_new_image', array( $this, 'image_count' ), 10 );
|
27 |
|
@@ -92,8 +96,8 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
|
|
92 |
* Allows to set a limit of mysql query
|
93 |
* Default value is 2000
|
94 |
*/
|
95 |
-
$limit
|
96 |
-
$limit
|
97 |
$offset = 0;
|
98 |
|
99 |
//Check type of images being queried
|
@@ -105,9 +109,9 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
|
|
105 |
$images = wp_cache_get( 'wp_smush_images_' . $type, 'nextgen' );
|
106 |
|
107 |
// If nothing is found, build the object.
|
108 |
-
if (
|
109 |
// Query Attachments for meta key
|
110 |
-
while( $attachments = $wpdb->get_results( "SELECT pid, meta_data FROM $wpdb->nggpictures LIMIT $offset, $limit"
|
111 |
foreach ( $attachments as $attachment ) {
|
112 |
//Check if it has `wp_smush` key
|
113 |
if ( class_exists( 'Ngg_Serializable' ) ) {
|
@@ -126,10 +130,10 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
|
|
126 |
//Set the offset
|
127 |
$offset += $limit;
|
128 |
};
|
129 |
-
if( !empty( $smushed_images ) ) {
|
130 |
wp_cache_set( 'wp_smush_images_smushed', $smushed_images, 'nextgen', 300 );
|
131 |
}
|
132 |
-
if( !empty( $unsmushed_images ) ) {
|
133 |
wp_cache_set( 'wp_smush_images_unsmushed', $unsmushed_images, 'nextgen', 300 );
|
134 |
}
|
135 |
}
|
@@ -137,9 +141,9 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
|
|
137 |
if ( $type == 'smushed' ) {
|
138 |
$smushed_images = ! empty( $smushed_images ) ? $smushed_images : $images;
|
139 |
|
140 |
-
if(
|
141 |
return 0;
|
142 |
-
}else {
|
143 |
return $count ? count( $smushed_images ) : $smushed_images;
|
144 |
}
|
145 |
} else {
|
@@ -221,7 +225,7 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
|
|
221 |
$opt_lossy_val = get_option( $opt_lossy, false );
|
222 |
|
223 |
//Check if premium user, compression was lossless, and lossy compression is enabled
|
224 |
-
if ( $
|
225 |
// the button text
|
226 |
$button_txt = __( 'Super-Smush', 'wp-smushit' );
|
227 |
$show_button = true;
|
@@ -258,7 +262,7 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
|
|
258 |
$smush_stats['bytes'] = ! empty( $smush_stats['bytes'] ) ? ( $smush_stats['bytes'] + $stats['bytes'] ) : $stats['bytes'];
|
259 |
|
260 |
//Human Readable
|
261 |
-
$smush_stats['human'] = !empty( $smush_stats['bytes'] ) ? $WpSmush->format_bytes( $smush_stats['bytes'] )
|
262 |
|
263 |
//Size of images before the compression
|
264 |
$smush_stats['size_before'] = ! empty( $smush_stats['size_before'] ) ? ( $smush_stats['size_before'] + $stats['size_before'] ) : $stats['size_before'];
|
@@ -312,7 +316,7 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
|
|
312 |
* Updates the cache for Smushed and Unsmushed images
|
313 |
*/
|
314 |
function update_cache() {
|
315 |
-
$this->get_ngg_images('smushed', '', true );
|
316 |
}
|
317 |
|
318 |
function get_detailed_stats( $image_id, $wp_smush_data, $attachment_metadata, $full_image ) {
|
@@ -349,7 +353,7 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
|
|
349 |
}
|
350 |
//Show Sizes and their compression
|
351 |
foreach ( $size_stats as $size_key => $size_value ) {
|
352 |
-
$size_value = !is_object( $size_value ) ? (object) $size_value : $size_value;
|
353 |
if ( $size_value->bytes > 0 ) {
|
354 |
$stats .= '<tr>
|
355 |
<td>' . strtoupper( $size_key ) . '</td>
|
@@ -363,6 +367,7 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
|
|
363 |
|
364 |
return $stats;
|
365 |
}
|
|
|
366 |
/**
|
367 |
* Compare Values
|
368 |
*
|
@@ -378,8 +383,10 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
|
|
378 |
return $a['bytes'] < $b['bytes'];
|
379 |
}
|
380 |
}
|
|
|
381 |
/**
|
382 |
* Return a list of images not smushed and reason
|
|
|
383 |
* @param $image_id
|
384 |
* @param $size_stats
|
385 |
* @param $attachment_metadata
|
@@ -392,15 +399,15 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
|
|
392 |
//If full image was not smushed, reason 1. Large Size logic, 2. Free and greater than 1Mb
|
393 |
if ( ! array_key_exists( 'full', $size_stats ) ) {
|
394 |
//For free version, Check the image size
|
395 |
-
if ( ! $this->
|
396 |
//For free version, check if full size is greater than 1 Mb, show the skipped status
|
397 |
$file_size = file_exists( $full_image ) ? filesize( $full_image ) : '';
|
398 |
-
if ( !empty( $file_size ) && ( $file_size / WP_SMUSH_MAX_BYTES ) > 1 ) {
|
399 |
$skipped[] = array(
|
400 |
'size' => 'full',
|
401 |
'reason' => 'size_limit'
|
402 |
);
|
403 |
-
}else{
|
404 |
$skipped[] = array(
|
405 |
'size' => 'full',
|
406 |
'reason' => 'large_size'
|
@@ -417,6 +424,7 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
|
|
417 |
|
418 |
}
|
419 |
}
|
|
|
420 |
return $skipped;
|
421 |
}
|
422 |
|
19 |
* @var array Contains the total Stats, for displaying it on bulk page
|
20 |
*/
|
21 |
var $stats = array();
|
22 |
+
private $is_pro_user;
|
23 |
|
24 |
function __construct() {
|
25 |
|
26 |
+
global $WpSmush;
|
27 |
+
$this->is_pro_user = $WpSmush->is_pro();
|
28 |
+
|
29 |
//Update Total Image count
|
30 |
add_action( 'ngg_added_new_image', array( $this, 'image_count' ), 10 );
|
31 |
|
96 |
* Allows to set a limit of mysql query
|
97 |
* Default value is 2000
|
98 |
*/
|
99 |
+
$limit = apply_filters( 'wp_smush_nextgen_query_limit', 2000 );
|
100 |
+
$limit = intval( $limit );
|
101 |
$offset = 0;
|
102 |
|
103 |
//Check type of images being queried
|
109 |
$images = wp_cache_get( 'wp_smush_images_' . $type, 'nextgen' );
|
110 |
|
111 |
// If nothing is found, build the object.
|
112 |
+
if ( ! $images || $force_update ) {
|
113 |
// Query Attachments for meta key
|
114 |
+
while ( $attachments = $wpdb->get_results( "SELECT pid, meta_data FROM $wpdb->nggpictures LIMIT $offset, $limit" ) ) {
|
115 |
foreach ( $attachments as $attachment ) {
|
116 |
//Check if it has `wp_smush` key
|
117 |
if ( class_exists( 'Ngg_Serializable' ) ) {
|
130 |
//Set the offset
|
131 |
$offset += $limit;
|
132 |
};
|
133 |
+
if ( ! empty( $smushed_images ) ) {
|
134 |
wp_cache_set( 'wp_smush_images_smushed', $smushed_images, 'nextgen', 300 );
|
135 |
}
|
136 |
+
if ( ! empty( $unsmushed_images ) ) {
|
137 |
wp_cache_set( 'wp_smush_images_unsmushed', $unsmushed_images, 'nextgen', 300 );
|
138 |
}
|
139 |
}
|
141 |
if ( $type == 'smushed' ) {
|
142 |
$smushed_images = ! empty( $smushed_images ) ? $smushed_images : $images;
|
143 |
|
144 |
+
if ( ! $smushed_images ) {
|
145 |
return 0;
|
146 |
+
} else {
|
147 |
return $count ? count( $smushed_images ) : $smushed_images;
|
148 |
}
|
149 |
} else {
|
225 |
$opt_lossy_val = get_option( $opt_lossy, false );
|
226 |
|
227 |
//Check if premium user, compression was lossless, and lossy compression is enabled
|
228 |
+
if ( $this->is_pro_user && ! $is_lossy && $opt_lossy_val && $image_type != 'image/gif' && ! empty( $image_type ) ) {
|
229 |
// the button text
|
230 |
$button_txt = __( 'Super-Smush', 'wp-smushit' );
|
231 |
$show_button = true;
|
262 |
$smush_stats['bytes'] = ! empty( $smush_stats['bytes'] ) ? ( $smush_stats['bytes'] + $stats['bytes'] ) : $stats['bytes'];
|
263 |
|
264 |
//Human Readable
|
265 |
+
$smush_stats['human'] = ! empty( $smush_stats['bytes'] ) ? $WpSmush->format_bytes( $smush_stats['bytes'] ) : '';
|
266 |
|
267 |
//Size of images before the compression
|
268 |
$smush_stats['size_before'] = ! empty( $smush_stats['size_before'] ) ? ( $smush_stats['size_before'] + $stats['size_before'] ) : $stats['size_before'];
|
316 |
* Updates the cache for Smushed and Unsmushed images
|
317 |
*/
|
318 |
function update_cache() {
|
319 |
+
$this->get_ngg_images( 'smushed', '', true );
|
320 |
}
|
321 |
|
322 |
function get_detailed_stats( $image_id, $wp_smush_data, $attachment_metadata, $full_image ) {
|
353 |
}
|
354 |
//Show Sizes and their compression
|
355 |
foreach ( $size_stats as $size_key => $size_value ) {
|
356 |
+
$size_value = ! is_object( $size_value ) ? (object) $size_value : $size_value;
|
357 |
if ( $size_value->bytes > 0 ) {
|
358 |
$stats .= '<tr>
|
359 |
<td>' . strtoupper( $size_key ) . '</td>
|
367 |
|
368 |
return $stats;
|
369 |
}
|
370 |
+
|
371 |
/**
|
372 |
* Compare Values
|
373 |
*
|
383 |
return $a['bytes'] < $b['bytes'];
|
384 |
}
|
385 |
}
|
386 |
+
|
387 |
/**
|
388 |
* Return a list of images not smushed and reason
|
389 |
+
*
|
390 |
* @param $image_id
|
391 |
* @param $size_stats
|
392 |
* @param $attachment_metadata
|
399 |
//If full image was not smushed, reason 1. Large Size logic, 2. Free and greater than 1Mb
|
400 |
if ( ! array_key_exists( 'full', $size_stats ) ) {
|
401 |
//For free version, Check the image size
|
402 |
+
if ( ! $this->is_pro_user ) {
|
403 |
//For free version, check if full size is greater than 1 Mb, show the skipped status
|
404 |
$file_size = file_exists( $full_image ) ? filesize( $full_image ) : '';
|
405 |
+
if ( ! empty( $file_size ) && ( $file_size / WP_SMUSH_MAX_BYTES ) > 1 ) {
|
406 |
$skipped[] = array(
|
407 |
'size' => 'full',
|
408 |
'reason' => 'size_limit'
|
409 |
);
|
410 |
+
} else {
|
411 |
$skipped[] = array(
|
412 |
'size' => 'full',
|
413 |
'reason' => 'large_size'
|
424 |
|
425 |
}
|
426 |
}
|
427 |
+
|
428 |
return $skipped;
|
429 |
}
|
430 |
|
readme.txt
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
=== WP Smush ===
|
2 |
Plugin Name: WP Smush
|
3 |
-
Version: 2.
|
4 |
Author: WPMU DEV
|
5 |
Author URI: http://premium.wpmudev.org/
|
6 |
Contributors: WPMUDEV, alexdunae
|
7 |
Tags: 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.3.1
|
10 |
-
Stable tag: 2.
|
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.
|
@@ -81,6 +81,12 @@ Yahoo's Smush.it API is gone forever. So WPMU DEV built our own free API that is
|
|
81 |
|
82 |
== Changelog ==
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
= 2.0.7.1 =
|
85 |
|
86 |
* Fixed: Bulk Smush button keeps spinning after 50 images for free version
|
1 |
=== WP Smush ===
|
2 |
Plugin Name: WP Smush
|
3 |
+
Version: 2.1-beta1
|
4 |
Author: WPMU DEV
|
5 |
Author URI: http://premium.wpmudev.org/
|
6 |
Contributors: WPMUDEV, alexdunae
|
7 |
Tags: 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.3.1
|
10 |
+
Stable tag: 2.1
|
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.
|
81 |
|
82 |
== Changelog ==
|
83 |
|
84 |
+
= 2.1 =
|
85 |
+
* Fixed: Untranslatable strings in settings
|
86 |
+
* Fixed: Increased is_pro() API timeouts
|
87 |
+
* Fixed: Remove redundant _get_api_key() cache check
|
88 |
+
* Fixed: Some PHP notices on fresh installs
|
89 |
+
|
90 |
= 2.0.7.1 =
|
91 |
|
92 |
* Fixed: Bulk Smush button keeps spinning after 50 images for free version
|
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.
|
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.
|
39 |
|
40 |
/**
|
41 |
* Set the default timeout for API request and AJAX timeout
|
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.1
|
8 |
Author URI: http://premium.wpmudev.org/
|
9 |
Textdomain: wp-smushit
|
10 |
*/
|
35 |
* Constants
|
36 |
*/
|
37 |
$prefix = 'WP_SMUSH_';
|
38 |
+
$version = '2.1';
|
39 |
|
40 |
/**
|
41 |
* Set the default timeout for API request and AJAX timeout
|