Version Description
- Fixed: Preserve file permission after smushing ( Fix for Images disappearing in Media library on some hosts )
- Fixed: Styles plugin compatibility
- Fixed: Append URL params considering the existing arguments ( WPML Compatibility )
- Fixed: Warning: For settings link in Network admin, Warning: https://goo.gl/HAfhaF ( Thank you @Maks3w for suggestions )
- Fixed: Fatal error if both pro version and free version are activated
- Fixed: NextGen-Smush conflict on plugin activation on a fresh install
Download this release
Release Info
Developer | UmeshSingla |
Plugin | Smush Image Compression and Optimization |
Version | 2.1.4 |
Comparing to | |
See all releases |
Code changes from version 2.1.3 to 2.1.4
- assets/js/wp-smushit-admin.js +20 -12
- languages/wp-smushit.pot +50 -46
- lib/class-wp-smush-admin.php +6 -5
- lib/class-wp-smush-nextgen.php +17 -9
- lib/class-wp-smush.php +6 -2
- readme.txt +14 -6
- wp-smush.php +107 -72
assets/js/wp-smushit-admin.js
CHANGED
@@ -7,17 +7,24 @@
|
|
7 |
*/
|
8 |
var WP_Smush = WP_Smush || {};
|
9 |
jQuery(function ($) {
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
for (var i = 0; i < $sURLVariables.length; i++) {
|
23 |
var $sParameterName = $sURLVariables[i].split('=');
|
@@ -59,7 +66,7 @@ jQuery(function ($) {
|
|
59 |
this.smush_type = typeof smush_type ? smush_type : false;
|
60 |
this.single_ajax_suffix = this.smush_type ? 'smush_manual_nextgen' : 'wp_smushit_manual';
|
61 |
this.bulk_ajax_suffix = this.smush_type ? 'wp_smushit_nextgen_bulk' : 'wp_smushit_bulk';
|
62 |
-
|
63 |
};
|
64 |
|
65 |
//Show loader in button for single and bulk smush
|
@@ -436,3 +443,4 @@ jQuery(function ($) {
|
|
436 |
};
|
437 |
|
438 |
})(jQuery);
|
|
7 |
*/
|
8 |
var WP_Smush = WP_Smush || {};
|
9 |
jQuery(function ($) {
|
10 |
+
var smushAddParams = function (url, data) {
|
11 |
+
if (!$.isEmptyObject(data)) {
|
12 |
+
url += ( url.indexOf('?') >= 0 ? '&' : '?' ) + $.param(data);
|
13 |
+
}
|
14 |
+
|
15 |
+
return url;
|
16 |
+
}
|
17 |
+
// url for smushing
|
18 |
+
WP_Smush.errors = [];
|
19 |
+
WP_Smush.timeout = wp_smushit_data.timeout;
|
20 |
+
/**
|
21 |
+
* Checks for the specified param in URL
|
22 |
+
* @param sParam
|
23 |
+
* @returns {*}
|
24 |
+
*/
|
25 |
+
WP_Smush.geturlparam = function(arg) {
|
26 |
+
var $sPageURL = window.location.search.substring(1);
|
27 |
+
var $sURLVariables = $sPageURL.split('&');
|
28 |
|
29 |
for (var i = 0; i < $sURLVariables.length; i++) {
|
30 |
var $sParameterName = $sURLVariables[i].split('=');
|
66 |
this.smush_type = typeof smush_type ? smush_type : false;
|
67 |
this.single_ajax_suffix = this.smush_type ? 'smush_manual_nextgen' : 'wp_smushit_manual';
|
68 |
this.bulk_ajax_suffix = this.smush_type ? 'wp_smushit_nextgen_bulk' : 'wp_smushit_bulk';
|
69 |
+
this.url = this.is_bulk ? smushAddParams(this.url, {action: this.bulk_ajax_suffix}) : smushAddParams(this.url, {action: this.single_ajax_suffix});
|
70 |
};
|
71 |
|
72 |
//Show loader in button for single and bulk smush
|
443 |
};
|
444 |
|
445 |
})(jQuery);
|
446 |
+
|
languages/wp-smushit.pot
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
# Copyright (C)
|
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.
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wp-smushit\n"
|
7 |
-
"POT-Creation-Date:
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"PO-Revision-Date:
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
@@ -75,7 +75,7 @@ msgstr ""
|
|
75 |
msgid "Ops!... something went wrong"
|
76 |
msgstr ""
|
77 |
|
78 |
-
#: lib/class-wp-smush-admin.php:266 lib/class-wp-smush.php:
|
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"
|
@@ -110,7 +110,7 @@ msgstr ""
|
|
110 |
msgid "Smush all images, including originals."
|
111 |
msgstr ""
|
112 |
|
113 |
-
#: lib/class-wp-smush-admin.php:313 lib/class-wp-smush.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 |
|
@@ -249,93 +249,93 @@ msgstr ""
|
|
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 "Unable to access Pro Features? <a href=\"%s\">Refresh Status</a>"
|
328 |
msgstr ""
|
329 |
|
330 |
-
#: lib/class-wp-smush-admin.php:
|
331 |
msgid "Activate WPMU DEV Dashboard"
|
332 |
msgstr ""
|
333 |
|
334 |
-
#: lib/class-wp-smush-admin.php:
|
335 |
msgid "Install WPMU DEV Dashboard"
|
336 |
msgstr ""
|
337 |
|
338 |
-
#: lib/class-wp-smush-nextgen.php:193 lib/class-wp-smush.php:
|
339 |
msgid "Size '%s' not processed correctly"
|
340 |
msgstr ""
|
341 |
|
@@ -363,77 +363,77 @@ msgstr ""
|
|
363 |
msgid "Unknown API error"
|
364 |
msgstr ""
|
365 |
|
366 |
-
#: lib/class-wp-smush.php:
|
367 |
msgid "Size 'full' not processed correctly"
|
368 |
msgstr ""
|
369 |
|
370 |
-
#: lib/class-wp-smush.php:
|
371 |
msgid "Error posting to API: %s"
|
372 |
msgstr ""
|
373 |
|
374 |
-
#: lib/class-wp-smush.php:
|
375 |
msgid "Error posting to API: %s %s"
|
376 |
msgstr ""
|
377 |
|
378 |
-
#: lib/class-wp-smush.php:
|
379 |
msgid "Smush data corrupted, try again."
|
380 |
msgstr ""
|
381 |
|
382 |
-
#: lib/class-wp-smush.php:
|
383 |
msgid "Image couldn't be smushed"
|
384 |
msgstr ""
|
385 |
|
386 |
-
#: lib/class-wp-smush.php:
|
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:
|
392 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:189
|
393 |
msgid "Already Optimized"
|
394 |
msgstr ""
|
395 |
|
396 |
-
#: lib/class-wp-smush.php:
|
397 |
msgid "%d images reduced "
|
398 |
msgstr ""
|
399 |
|
400 |
-
#: lib/class-wp-smush.php:
|
401 |
msgid "Reduced "
|
402 |
msgstr ""
|
403 |
|
404 |
-
#: lib/class-wp-smush.php:
|
405 |
msgid "by %s ( %01.1f%% )"
|
406 |
msgstr ""
|
407 |
|
408 |
-
#: lib/class-wp-smush.php:
|
409 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:195
|
410 |
msgid "Smush stats"
|
411 |
msgstr ""
|
412 |
|
413 |
-
#: lib/class-wp-smush.php:
|
414 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:246
|
415 |
msgid "Not processed"
|
416 |
msgstr ""
|
417 |
|
418 |
-
#: lib/class-wp-smush.php:
|
419 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:252
|
420 |
msgid "Smush Now!"
|
421 |
msgstr ""
|
422 |
|
423 |
-
#: lib/class-wp-smush.php:
|
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:
|
428 |
msgid " Skipped"
|
429 |
msgstr ""
|
430 |
|
431 |
-
#: lib/class-wp-smush.php:
|
432 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:329
|
433 |
msgid "Image size"
|
434 |
msgstr ""
|
435 |
|
436 |
-
#: lib/class-wp-smush.php:
|
437 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:330
|
438 |
msgid "Savings"
|
439 |
msgstr ""
|
@@ -460,9 +460,13 @@ msgstr ""
|
|
460 |
msgid "Reduced by %s ( %01.1f%% )"
|
461 |
msgstr ""
|
462 |
|
463 |
-
#: wp-smush.php:
|
464 |
msgid "Get Fast"
|
465 |
msgstr ""
|
|
|
|
|
|
|
|
|
466 |
#. Plugin Name of the plugin/theme
|
467 |
msgid "WP Smush"
|
468 |
msgstr ""
|
1 |
+
# Copyright (C) 2016 WP Smush
|
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.4\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wp-smushit\n"
|
7 |
+
"POT-Creation-Date: 2016-02-25 07:02:08+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
75 |
msgid "Ops!... something went wrong"
|
76 |
msgstr ""
|
77 |
|
78 |
+
#: lib/class-wp-smush-admin.php:266 lib/class-wp-smush.php:808
|
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"
|
110 |
msgid "Smush all images, including originals."
|
111 |
msgstr ""
|
112 |
|
113 |
+
#: lib/class-wp-smush-admin.php:313 lib/class-wp-smush.php:1120
|
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 |
|
249 |
msgid "<strong>%d of %d images</strong> were sent for smushing:"
|
250 |
msgstr ""
|
251 |
|
252 |
+
#: lib/class-wp-smush-admin.php:1246
|
253 |
msgid "Super-Smush Images"
|
254 |
msgstr ""
|
255 |
|
256 |
+
#: lib/class-wp-smush-admin.php:1247
|
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:1255
|
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:1280
|
267 |
msgid "Thanks for using WP Smush Pro! You now can:"
|
268 |
msgstr ""
|
269 |
|
270 |
+
#: lib/class-wp-smush-admin.php:1282 lib/class-wp-smush-admin.php:1300
|
271 |
msgid "Smush the original Full image sizes that are normally skipped by default."
|
272 |
msgstr ""
|
273 |
|
274 |
+
#: lib/class-wp-smush-admin.php:1283 lib/class-wp-smush-admin.php:1301
|
275 |
msgid "NextGen Gallery integration"
|
276 |
msgstr ""
|
277 |
|
278 |
+
#: lib/class-wp-smush-admin.php:1284 lib/class-wp-smush-admin.php:1302
|
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:1285 lib/class-wp-smush-admin.php:1303
|
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:1286
|
287 |
msgid "Smush images up to 32MB."
|
288 |
msgstr ""
|
289 |
|
290 |
+
#: lib/class-wp-smush-admin.php:1287
|
291 |
msgid "Bulk smush ALL your images with one click!"
|
292 |
msgstr ""
|
293 |
|
294 |
+
#: lib/class-wp-smush-admin.php:1288 lib/class-wp-smush-admin.php:1306
|
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:1298
|
299 |
msgid "Upgrade to WP Smush Pro to:"
|
300 |
msgstr ""
|
301 |
|
302 |
+
#: lib/class-wp-smush-admin.php:1304
|
303 |
msgid "Smush images greater than 1MB."
|
304 |
msgstr ""
|
305 |
|
306 |
+
#: lib/class-wp-smush-admin.php:1305
|
307 |
msgid "Bulk smush ALL your images with one click! No more rate limiting."
|
308 |
msgstr ""
|
309 |
|
310 |
+
#: lib/class-wp-smush-admin.php:1307
|
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:1308
|
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:1311
|
319 |
msgid "Upgrade Now »"
|
320 |
msgstr ""
|
321 |
|
322 |
+
#: lib/class-wp-smush-admin.php:1314
|
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:1316
|
327 |
msgid "Unable to access Pro Features? <a href=\"%s\">Refresh Status</a>"
|
328 |
msgstr ""
|
329 |
|
330 |
+
#: lib/class-wp-smush-admin.php:1326
|
331 |
msgid "Activate WPMU DEV Dashboard"
|
332 |
msgstr ""
|
333 |
|
334 |
+
#: lib/class-wp-smush-admin.php:1329
|
335 |
msgid "Install WPMU DEV Dashboard"
|
336 |
msgstr ""
|
337 |
|
338 |
+
#: lib/class-wp-smush-nextgen.php:193 lib/class-wp-smush.php:334
|
339 |
msgid "Size '%s' not processed correctly"
|
340 |
msgstr ""
|
341 |
|
363 |
msgid "Unknown API error"
|
364 |
msgstr ""
|
365 |
|
366 |
+
#: lib/class-wp-smush.php:366 lib/class-wp-smush.php:374
|
367 |
msgid "Size 'full' not processed correctly"
|
368 |
msgstr ""
|
369 |
|
370 |
+
#: lib/class-wp-smush.php:509
|
371 |
msgid "Error posting to API: %s"
|
372 |
msgstr ""
|
373 |
|
374 |
+
#: lib/class-wp-smush.php:515
|
375 |
msgid "Error posting to API: %s %s"
|
376 |
msgstr ""
|
377 |
|
378 |
+
#: lib/class-wp-smush.php:532
|
379 |
msgid "Smush data corrupted, try again."
|
380 |
msgstr ""
|
381 |
|
382 |
+
#: lib/class-wp-smush.php:548
|
383 |
msgid "Image couldn't be smushed"
|
384 |
msgstr ""
|
385 |
|
386 |
+
#: lib/class-wp-smush.php:772
|
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:776
|
392 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:189
|
393 |
msgid "Already Optimized"
|
394 |
msgstr ""
|
395 |
|
396 |
+
#: lib/class-wp-smush.php:778
|
397 |
msgid "%d images reduced "
|
398 |
msgstr ""
|
399 |
|
400 |
+
#: lib/class-wp-smush.php:778
|
401 |
msgid "Reduced "
|
402 |
msgstr ""
|
403 |
|
404 |
+
#: lib/class-wp-smush.php:779
|
405 |
msgid "by %s ( %01.1f%% )"
|
406 |
msgstr ""
|
407 |
|
408 |
+
#: lib/class-wp-smush.php:784
|
409 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:195
|
410 |
msgid "Smush stats"
|
411 |
msgstr ""
|
412 |
|
413 |
+
#: lib/class-wp-smush.php:814
|
414 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:246
|
415 |
msgid "Not processed"
|
416 |
msgstr ""
|
417 |
|
418 |
+
#: lib/class-wp-smush.php:820
|
419 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:252
|
420 |
msgid "Smush Now!"
|
421 |
msgstr ""
|
422 |
|
423 |
+
#: lib/class-wp-smush.php:1123
|
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:1125
|
428 |
msgid " Skipped"
|
429 |
msgstr ""
|
430 |
|
431 |
+
#: lib/class-wp-smush.php:1143
|
432 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:329
|
433 |
msgid "Image size"
|
434 |
msgstr ""
|
435 |
|
436 |
+
#: lib/class-wp-smush.php:1144
|
437 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:330
|
438 |
msgid "Savings"
|
439 |
msgstr ""
|
460 |
msgid "Reduced by %s ( %01.1f%% )"
|
461 |
msgstr ""
|
462 |
|
463 |
+
#: wp-smush.php:130
|
464 |
msgid "Get Fast"
|
465 |
msgstr ""
|
466 |
+
|
467 |
+
#: wp-smush.php:184
|
468 |
+
msgid "WP Smush Free was deactivated. You have WP Smush Pro active!"
|
469 |
+
msgstr ""
|
470 |
#. Plugin Name of the plugin/theme
|
471 |
msgid "WP Smush"
|
472 |
msgstr ""
|
lib/class-wp-smush-admin.php
CHANGED
@@ -50,7 +50,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
50 |
/**
|
51 |
* @var int Limit for allowed number of images per bulk request
|
52 |
*/
|
53 |
-
|
54 |
|
55 |
public $upgrade_url = 'https://premium.wpmudev.org/project/wp-smush-pro/?utm_source=wordpress.org&utm_medium=plugin&utm_campaign=WP%20Smush%20Upgrade';
|
56 |
|
@@ -76,7 +76,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
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' ),
|
80 |
|
81 |
// hook scripts and styles
|
82 |
add_action( 'admin_init', array( $this, 'register' ) );
|
@@ -731,9 +731,9 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
731 |
$error = $smush->get_error_message();
|
732 |
//Check for timeout error and suggest to filter timeout
|
733 |
if ( strpos( $error, 'timed out' ) ) {
|
734 |
-
$
|
735 |
}
|
736 |
-
wp_send_json_error( array( 'stats' => $stats, 'error_msg' => $
|
737 |
} else {
|
738 |
wp_send_json_success( array( 'stats' => $stats ) );
|
739 |
}
|
@@ -1113,7 +1113,8 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1113 |
$settings_page = admin_url( 'upload.php?page=wp-smush-bulk' );
|
1114 |
$settings = '<a href="' . $settings_page . '">' . __( 'Settings', 'wp-smushit' ) . '</a>';
|
1115 |
|
1116 |
-
array_unshift(
|
|
|
1117 |
|
1118 |
return $links;
|
1119 |
}
|
50 |
/**
|
51 |
* @var int Limit for allowed number of images per bulk request
|
52 |
*/
|
53 |
+
private $max_free_bulk = 50; //this is enforced at api level too
|
54 |
|
55 |
public $upgrade_url = 'https://premium.wpmudev.org/project/wp-smush-pro/?utm_source=wordpress.org&utm_medium=plugin&utm_campaign=WP%20Smush%20Upgrade';
|
56 |
|
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' ), 16 );
|
80 |
|
81 |
// hook scripts and styles
|
82 |
add_action( 'admin_init', array( $this, 'register' ) );
|
731 |
$error = $smush->get_error_message();
|
732 |
//Check for timeout error and suggest to filter timeout
|
733 |
if ( strpos( $error, 'timed out' ) ) {
|
734 |
+
$error = 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' => $error ) );
|
737 |
} else {
|
738 |
wp_send_json_success( array( 'stats' => $stats ) );
|
739 |
}
|
1113 |
$settings_page = admin_url( 'upload.php?page=wp-smush-bulk' );
|
1114 |
$settings = '<a href="' . $settings_page . '">' . __( 'Settings', 'wp-smushit' ) . '</a>';
|
1115 |
|
1116 |
+
//Added a fix for weird warning in multisite, "array_unshift() expects parameter 1 to be array, null given"
|
1117 |
+
+ !empty( $links ) ? array_unshift( $links, $settings ) : array_push( $settings );
|
1118 |
|
1119 |
return $links;
|
1120 |
}
|
lib/class-wp-smush-nextgen.php
CHANGED
@@ -344,7 +344,7 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
|
|
344 |
}//End Of if class not exists
|
345 |
|
346 |
//Extend NextGen Mixin class to smush dynamic images
|
347 |
-
if( class_exists('WpSmushNextGen') ) {
|
348 |
$wpsmushnextgen = new WpSmushNextGen();
|
349 |
|
350 |
//Extend Nextgen Mixin class and override the generate_image_size, to optimize dynamic thumbnails, generated by nextgen, check for auto smush
|
@@ -354,6 +354,7 @@ if( class_exists('WpSmushNextGen') ) {
|
|
354 |
|
355 |
/**
|
356 |
* Overrides the NextGen Gallery function, to smush the dynamic images and thumbnails created by gallery
|
|
|
357 |
* @param C_Image|int|stdClass $image
|
358 |
* @param $size
|
359 |
* @param null $params
|
@@ -381,7 +382,7 @@ if( class_exists('WpSmushNextGen') ) {
|
|
381 |
$filename = $success->fileName;
|
382 |
//Smush it, if it exists
|
383 |
if ( file_exists( $filename ) ) {
|
384 |
-
$response = $WpSmush->do_smushit( $filename, $
|
385 |
|
386 |
//If the image was smushed
|
387 |
if ( ! is_wp_error( $response ) && ! empty( $response['data'] ) ) {
|
@@ -405,17 +406,21 @@ if( class_exists('WpSmushNextGen') ) {
|
|
405 |
$stats['time'] = $response['data']->time;
|
406 |
}
|
407 |
$stats['sizes'][ $size ] = (object) $WpSmush->_array_fill_placeholders( $WpSmush->_get_size_signature(), (array) $response['data'] );
|
408 |
-
|
409 |
-
|
|
|
|
|
|
|
410 |
|
411 |
//Allows To get the stats for each image, after the image is smushed
|
412 |
-
do_action( 'wp_smush_nextgen_image_stats', $
|
413 |
}
|
414 |
}
|
415 |
}
|
416 |
|
417 |
return $success;
|
418 |
}
|
|
|
419 |
function update_stats( $smush_stats, $image ) {
|
420 |
global $WpSmush;
|
421 |
if ( is_wp_error( $smush_stats ) ) {
|
@@ -427,9 +432,12 @@ if( class_exists('WpSmushNextGen') ) {
|
|
427 |
}
|
428 |
}
|
429 |
}
|
430 |
-
|
431 |
-
//Add
|
432 |
-
$storage = C_Gallery_Storage::get_instance();
|
433 |
-
$storage->get_wrapped_instance()->add_mixin( 'WpSmushNextGenDynamicThumbs' );
|
434 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
}
|
344 |
}//End Of if class not exists
|
345 |
|
346 |
//Extend NextGen Mixin class to smush dynamic images
|
347 |
+
if ( class_exists( 'WpSmushNextGen' ) ) {
|
348 |
$wpsmushnextgen = new WpSmushNextGen();
|
349 |
|
350 |
//Extend Nextgen Mixin class and override the generate_image_size, to optimize dynamic thumbnails, generated by nextgen, check for auto smush
|
354 |
|
355 |
/**
|
356 |
* Overrides the NextGen Gallery function, to smush the dynamic images and thumbnails created by gallery
|
357 |
+
*
|
358 |
* @param C_Image|int|stdClass $image
|
359 |
* @param $size
|
360 |
* @param null $params
|
382 |
$filename = $success->fileName;
|
383 |
//Smush it, if it exists
|
384 |
if ( file_exists( $filename ) ) {
|
385 |
+
$response = $WpSmush->do_smushit( $filename, $image_id, 'nextgen' );
|
386 |
|
387 |
//If the image was smushed
|
388 |
if ( ! is_wp_error( $response ) && ! empty( $response['data'] ) ) {
|
406 |
$stats['time'] = $response['data']->time;
|
407 |
}
|
408 |
$stats['sizes'][ $size ] = (object) $WpSmush->_array_fill_placeholders( $WpSmush->_get_size_signature(), (array) $response['data'] );
|
409 |
+
|
410 |
+
if ( isset( $image->metadata ) ) {
|
411 |
+
$image->meta_data['wp_smush'] = $stats;
|
412 |
+
nggdb::update_image_meta( $image->pid, $image->meta_data );
|
413 |
+
}
|
414 |
|
415 |
//Allows To get the stats for each image, after the image is smushed
|
416 |
+
do_action( 'wp_smush_nextgen_image_stats', $image_id, $stats );
|
417 |
}
|
418 |
}
|
419 |
}
|
420 |
|
421 |
return $success;
|
422 |
}
|
423 |
+
|
424 |
function update_stats( $smush_stats, $image ) {
|
425 |
global $WpSmush;
|
426 |
if ( is_wp_error( $smush_stats ) ) {
|
432 |
}
|
433 |
}
|
434 |
}
|
|
|
|
|
|
|
|
|
435 |
}
|
436 |
+
}
|
437 |
+
if ( class_exists('WpSmushNextGenDynamicThumbs') ) {
|
438 |
+
if(! get_option('ngg_options') ) {
|
439 |
+
return;
|
440 |
+
}
|
441 |
+
$storage = C_Gallery_Storage::get_instance();
|
442 |
+
$storage->get_wrapped_instance()->add_mixin( 'WpSmushNextGenDynamicThumbs' );
|
443 |
}
|
lib/class-wp-smush.php
CHANGED
@@ -174,12 +174,16 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
174 |
|
175 |
//If file renaming failed
|
176 |
if ( ! $success ) {
|
177 |
-
copy( $tempfile, $file_path );
|
178 |
unlink( $tempfile );
|
179 |
}
|
180 |
|
181 |
//Some servers are having issue with file permission, this should fix it
|
182 |
-
|
|
|
|
|
|
|
|
|
183 |
|
184 |
return $response;
|
185 |
}
|
174 |
|
175 |
//If file renaming failed
|
176 |
if ( ! $success ) {
|
177 |
+
@copy( $tempfile, $file_path );
|
178 |
unlink( $tempfile );
|
179 |
}
|
180 |
|
181 |
//Some servers are having issue with file permission, this should fix it
|
182 |
+
//Source: WordPress Core
|
183 |
+
$stat = stat( dirname( $file_path ) );
|
184 |
+
$perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits
|
185 |
+
@ chmod( $file_path, $perms );
|
186 |
+
|
187 |
|
188 |
return $response;
|
189 |
}
|
readme.txt
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
=== WP Smush ===
|
2 |
Plugin Name: WP Smush
|
3 |
-
Version: 2.1.
|
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.4.
|
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.
|
@@ -16,7 +16,7 @@ Reduce image file sizes, improve performance and boost your SEO using the free <
|
|
16 |
|
17 |
<strong>Optimize unlimited images</strong> with our <strong>incredibly powerful</strong> and <strong>100% free image Smusher</strong>, brought to you by the superheroes at WPMU DEV!
|
18 |
|
19 |
-
We'll do all the heavy lifting with our superhero servers, your site will be loading quicker in no time at all, leaving you to concentrate on making your content great!
|
20 |
|
21 |
WP Smush strips hidden, bulky information from your images, reducing the file size without losing quality. The faster your site loads, the more Google, Bing, Yahoo and other search engines will like it.
|
22 |
|
@@ -42,7 +42,7 @@ Install WP Smush and find out why it's the most popular image optimization plugi
|
|
42 |
<li>Bulk smush ALL your images with one click! No more rate limiting.</li>
|
43 |
<li>Keep a backup of your original un-smushed images in case you want to restore later.</li>
|
44 |
<li>24/7/365 support from <a href="https://premium.wpmudev.org/support/?utm_source=wordpress.org&utm_medium=readme">the best WordPress support team on the planet</a>.</li>
|
45 |
-
<li><a href="https://premium.wpmudev.org/?utm_source=wordpress.org&utm_medium=readme">
|
46 |
</ul>
|
47 |
|
48 |
Upgrade to <a href="https://premium.wpmudev.org/project/wp-smush-pro/?utm_source=wordpress.org&utm_medium=readme">WP Smush Pro</a> and optimize more and larger image files faster to increase your site’s performance.
|
@@ -80,11 +80,19 @@ Yahoo's Smush.it API is gone forever. So WPMU DEV built our own free API that is
|
|
80 |
|
81 |
== Changelog ==
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
= 2.1.3 =
|
84 |
* Fixed: Compatibility with WPMU DEV Dashboard plugin v4.0, was not detecting pro status
|
85 |
|
86 |
= 2.1.2 =
|
87 |
-
* Fixed: Important fix for transient issue leading to
|
88 |
|
89 |
= 2.1.1 =
|
90 |
* Fixed: Workaround for terrible bug in W3TC file based object caching
|
1 |
=== WP Smush ===
|
2 |
Plugin Name: WP Smush
|
3 |
+
Version: 2.1.4
|
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.4.2
|
10 |
+
Stable tag: 2.1.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.
|
16 |
|
17 |
<strong>Optimize unlimited images</strong> with our <strong>incredibly powerful</strong> and <strong>100% free image Smusher</strong>, brought to you by the superheroes at WPMU DEV!
|
18 |
|
19 |
+
We'll do all the heavy lifting with our superhero servers, your site will be loading quicker in no time at all, leaving you to concentrate on making your content great!
|
20 |
|
21 |
WP Smush strips hidden, bulky information from your images, reducing the file size without losing quality. The faster your site loads, the more Google, Bing, Yahoo and other search engines will like it.
|
22 |
|
42 |
<li>Bulk smush ALL your images with one click! No more rate limiting.</li>
|
43 |
<li>Keep a backup of your original un-smushed images in case you want to restore later.</li>
|
44 |
<li>24/7/365 support from <a href="https://premium.wpmudev.org/support/?utm_source=wordpress.org&utm_medium=readme">the best WordPress support team on the planet</a>.</li>
|
45 |
+
<li><a href="https://premium.wpmudev.org/?utm_source=wordpress.org&utm_medium=readme">100+ other premium plugins and themes</a> included in your membership.</li>
|
46 |
</ul>
|
47 |
|
48 |
Upgrade to <a href="https://premium.wpmudev.org/project/wp-smush-pro/?utm_source=wordpress.org&utm_medium=readme">WP Smush Pro</a> and optimize more and larger image files faster to increase your site’s performance.
|
80 |
|
81 |
== Changelog ==
|
82 |
|
83 |
+
= 2.1.4 =
|
84 |
+
* Fixed: Preserve file permission after smushing ( Fix for Images disappearing in Media library on some hosts )
|
85 |
+
* Fixed: Styles plugin compatibility
|
86 |
+
* Fixed: Append URL params considering the existing arguments ( WPML Compatibility )
|
87 |
+
* Fixed: Warning: For settings link in Network admin, Warning: https://goo.gl/HAfhaF ( Thank you @Maks3w for suggestions )
|
88 |
+
* Fixed: Fatal error if both pro version and free version are activated
|
89 |
+
* Fixed: NextGen-Smush conflict on plugin activation on a fresh install
|
90 |
+
|
91 |
= 2.1.3 =
|
92 |
* Fixed: Compatibility with WPMU DEV Dashboard plugin v4.0, was not detecting pro status
|
93 |
|
94 |
= 2.1.2 =
|
95 |
+
* Fixed: Important fix for transient issue leading to multiple api requests
|
96 |
|
97 |
= 2.1.1 =
|
98 |
* Fixed: Workaround for terrible bug in W3TC file based object caching
|
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.1.
|
8 |
Author URI: http://premium.wpmudev.org/
|
9 |
Textdomain: wp-smushit
|
10 |
*/
|
@@ -15,7 +15,7 @@ http://dialect.ca/
|
|
15 |
*/
|
16 |
|
17 |
/*
|
18 |
-
Copyright 2007-
|
19 |
|
20 |
This program is free software; you can redistribute it and/or modify
|
21 |
it under the terms of the GNU General Public License (Version 2 - GPLv2) as published by
|
@@ -34,8 +34,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
34 |
/**
|
35 |
* Constants
|
36 |
*/
|
37 |
-
$prefix
|
38 |
-
$version
|
39 |
|
40 |
/**
|
41 |
* Set the default timeout for API request and AJAX timeout
|
@@ -60,6 +60,7 @@ foreach ( $smush_constants as $const_name => $constant_val ) {
|
|
60 |
define( $prefix . $const_name, $constant_val );
|
61 |
}
|
62 |
}
|
|
|
63 |
//Include main class
|
64 |
require_once WP_SMUSH_DIR . 'lib/class-wp-smush.php';
|
65 |
|
@@ -70,26 +71,28 @@ require_once WP_SMUSH_DIR . 'lib/class-wp-smush.php';
|
|
70 |
*
|
71 |
* @return string
|
72 |
*/
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
$
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
-
$message .= " We've spent countless hours developing this free plugin for you, and we would really appreciate it if you dropped us a quick rating!";
|
91 |
-
|
92 |
-
return $message;
|
93 |
}
|
94 |
|
95 |
/**
|
@@ -99,56 +102,88 @@ function wp_smush_rating_message( $message ) {
|
|
99 |
*
|
100 |
* @return string
|
101 |
*/
|
102 |
-
|
103 |
-
$message
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
}
|
107 |
|
108 |
-
//
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
/* 3 https://wordpress.org */
|
122 |
-
'/plugins/wp-smushit/',
|
123 |
-
/* 4 Email Button CTA */
|
124 |
-
__( 'Get Fast', 'wp-smushit' ),
|
125 |
-
/* 5 getdrip Plugin param */
|
126 |
-
'Smush'
|
127 |
-
);
|
128 |
-
|
129 |
-
// The rating message contains 2 variables: user-name, plugin-name
|
130 |
-
add_filter(
|
131 |
-
'wdev-rating-message-' . plugin_basename( __FILE__ ),
|
132 |
-
'wp_smush_rating_message'
|
133 |
-
);
|
134 |
-
|
135 |
-
// The email message contains 1 variable: plugin-name
|
136 |
-
add_filter(
|
137 |
-
'wdev-email-message-' . plugin_basename( __FILE__ ),
|
138 |
-
'wp_smush_email_message'
|
139 |
-
);
|
140 |
-
} elseif ( strpos( $dir_path, 'wp-smush-pro' ) !== false ) {
|
141 |
-
|
142 |
-
//Only for WPMU DEV Members
|
143 |
-
require_once( WP_SMUSH_DIR . 'extras/dash-notice/wpmudev-dash-notification.php' );
|
144 |
-
//register items for the dashboard plugin
|
145 |
-
global $wpmudev_notices;
|
146 |
-
$wpmudev_notices[] = array(
|
147 |
-
'id' => 912164,
|
148 |
-
'name' => 'WP Smush Pro',
|
149 |
-
'screens' => array(
|
150 |
-
'media_page_wp-smush-bulk',
|
151 |
-
'upload'
|
152 |
-
)
|
153 |
-
);
|
154 |
}
|
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.4
|
8 |
Author URI: http://premium.wpmudev.org/
|
9 |
Textdomain: wp-smushit
|
10 |
*/
|
15 |
*/
|
16 |
|
17 |
/*
|
18 |
+
Copyright 2007-2016 Incsub (http://incsub.com)
|
19 |
|
20 |
This program is free software; you can redistribute it and/or modify
|
21 |
it under the terms of the GNU General Public License (Version 2 - GPLv2) as published by
|
34 |
/**
|
35 |
* Constants
|
36 |
*/
|
37 |
+
$prefix = 'WP_SMUSH_';
|
38 |
+
$version = '2.1.4';
|
39 |
|
40 |
/**
|
41 |
* Set the default timeout for API request and AJAX timeout
|
60 |
define( $prefix . $const_name, $constant_val );
|
61 |
}
|
62 |
}
|
63 |
+
|
64 |
//Include main class
|
65 |
require_once WP_SMUSH_DIR . 'lib/class-wp-smush.php';
|
66 |
|
71 |
*
|
72 |
* @return string
|
73 |
*/
|
74 |
+
if ( ! function_exists( 'wp_smush_rating_message' ) ) {
|
75 |
+
function wp_smush_rating_message( $message ) {
|
76 |
+
global $wpsmushit_admin;
|
77 |
+
$savings = $wpsmushit_admin->global_stats();
|
78 |
+
$image_count = $wpsmushit_admin->total_count();
|
79 |
+
$show_stats = false;
|
80 |
+
|
81 |
+
//If there is any saving, greater than 1Mb, show stats
|
82 |
+
if ( ! empty( $savings ) && ! empty( $savings['bytes'] ) && $savings['bytes'] > 1048576 ) {
|
83 |
+
$show_stats = true;
|
84 |
+
}
|
85 |
+
|
86 |
+
$message = "Hey %s, you've been using %s for a while now, and we hope you're happy with it.";
|
87 |
+
|
88 |
+
//Conditionally Show stats in rating message
|
89 |
+
if ( $show_stats ) {
|
90 |
+
$message .= sprintf( " You've smushed <strong>%s</strong> from %d images already, improving the speed and SEO ranking of this site!", $savings['human'], $image_count );
|
91 |
+
}
|
92 |
+
$message .= " We've spent countless hours developing this free plugin for you, and we would really appreciate it if you dropped us a quick rating!";
|
93 |
+
|
94 |
+
return $message;
|
95 |
}
|
|
|
|
|
|
|
96 |
}
|
97 |
|
98 |
/**
|
102 |
*
|
103 |
* @return string
|
104 |
*/
|
105 |
+
if ( ! function_exists( 'wp_smush_email_message' ) ) {
|
106 |
+
function wp_smush_email_message( $message ) {
|
107 |
+
$message = "You're awesome for installing %s! Site speed isn't all image optimization though, so we've collected all the best speed resources we know in a single email - just for users of WP Smush!";
|
108 |
+
|
109 |
+
return $message;
|
110 |
+
}
|
111 |
+
}
|
112 |
|
113 |
+
if ( is_admin() ) {
|
114 |
+
|
115 |
+
$dir_path = plugin_dir_path( __FILE__ );
|
116 |
+
//Only for wordpress.org members
|
117 |
+
if ( strpos( $dir_path, 'wp-smushit' ) !== false ) {
|
118 |
+
require_once( WP_SMUSH_DIR . 'extras/free-dashboard/module.php' );
|
119 |
+
|
120 |
+
// Register the current plugin.
|
121 |
+
do_action(
|
122 |
+
'wdev-register-plugin',
|
123 |
+
/* 1 Plugin ID */
|
124 |
+
plugin_basename( __FILE__ ), /* Plugin ID */
|
125 |
+
/* 2 Plugin Title */
|
126 |
+
'WP Smush',
|
127 |
+
/* 3 https://wordpress.org */
|
128 |
+
'/plugins/wp-smushit/',
|
129 |
+
/* 4 Email Button CTA */
|
130 |
+
__( 'Get Fast', 'wp-smushit' ),
|
131 |
+
/* 5 getdrip Plugin param */
|
132 |
+
'Smush'
|
133 |
+
);
|
134 |
+
|
135 |
+
// The rating message contains 2 variables: user-name, plugin-name
|
136 |
+
add_filter(
|
137 |
+
'wdev-rating-message-' . plugin_basename( __FILE__ ),
|
138 |
+
'wp_smush_rating_message'
|
139 |
+
);
|
140 |
+
|
141 |
+
// The email message contains 1 variable: plugin-name
|
142 |
+
add_filter(
|
143 |
+
'wdev-email-message-' . plugin_basename( __FILE__ ),
|
144 |
+
'wp_smush_email_message'
|
145 |
+
);
|
146 |
+
} elseif ( strpos( $dir_path, 'wp-smush-pro' ) !== false ) {
|
147 |
+
|
148 |
+
//Only for WPMU DEV Members
|
149 |
+
require_once( WP_SMUSH_DIR . 'extras/dash-notice/wpmudev-dash-notification.php' );
|
150 |
+
|
151 |
+
//register items for the dashboard plugin
|
152 |
+
global $wpmudev_notices;
|
153 |
+
$wpmudev_notices[] = array(
|
154 |
+
'id' => 912164,
|
155 |
+
'name' => 'WP Smush Pro',
|
156 |
+
'screens' => array(
|
157 |
+
'media_page_wp-smush-bulk',
|
158 |
+
'upload'
|
159 |
+
)
|
160 |
+
);
|
161 |
+
}
|
162 |
+
}
|
163 |
+
//Deactivate the .org version, if pro version is active
|
164 |
+
add_action( 'admin_init', 'deactivate_smush_org' );
|
165 |
+
|
166 |
+
if ( ! function_exists( 'deactivate_smush_org' ) ) {
|
167 |
+
function deactivate_smush_org() {
|
168 |
+
if ( is_plugin_active( 'wp-smush-pro/wp-smush.php' ) && is_plugin_active( 'wp-smushit/wp-smush.php' ) ) {
|
169 |
+
deactivate_plugins( 'wp-smushit/wp-smush.php' );
|
170 |
+
//Store in database, in order to show a notice on page load
|
171 |
+
update_option( 'smush_deactivated', 1 );
|
172 |
+
}
|
173 |
+
}
|
174 |
}
|
175 |
|
176 |
+
//Show the required notice
|
177 |
+
add_action( 'network_admin_notices', 'smush_deactivated' );
|
178 |
+
add_action( 'admin_notices', 'smush_deactivated' );
|
179 |
+
//Display a admin Notice about plugin deactivation
|
180 |
+
if ( ! function_exists( 'smush_deactivated' ) ) {
|
181 |
+
function smush_deactivated() {
|
182 |
+
if ( get_option( 'smush_deactivated' ) && is_admin() ) { ?>
|
183 |
+
<div class="updated">
|
184 |
+
<p><?php esc_html_e( 'WP Smush Free was deactivated. You have WP Smush Pro active!', 'wp-smushit' ); ?></p>
|
185 |
+
</div> <?php
|
186 |
+
delete_option( 'smush_deactivated' );
|
187 |
+
}
|
188 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
}
|