Version Description
-
Updated:
- Faster image uploads: Set async request timeout to 0, if you're having trouble with Auto Smush, set timeout using filter
smush_async_time_out
- Faster image uploads: Set async request timeout to 0, if you're having trouble with Auto Smush, set timeout using filter
-
Fixed:
- Issue with WP Smush Pro membership check
- Stats: Rating message shows incorrect image count
- Stats: Include directory smush stats in media stats
- Directory Smush: UI improvement
- Directory Smush: Allow re-smushing directory images, if the lossy feature is turned on
- Directory Smush: Fixed empty query warning if there are more than 5k images
- Site Ground Staging - Disable Async smush for staging sites, admin URL for async request is incorrect because of the Apache module
- Image appearing in Re-Smush list even after smushing, if resize settings are kept on.
- Performance: Updated query for smushed images count
-
Added:
- WP S3 Offload - Plugin Compatibility for Remove files from server feature ( Pro Version )
- WP RSS Aggregator compatibility for Auto Smush
- WordPress mobile app Auto smush compatibility
Download this release
Release Info
Developer | UmeshSingla |
Plugin | Smush Image Compression and Optimization |
Version | 2.7 |
Comparing to | |
See all releases |
Code changes from version 2.6.3 to 2.7
- assets/css/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- assets/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- assets/css/wp-smushit-admin.css +43 -20
- assets/images/ajax-loader.gif +0 -0
- assets/images/code.png +0 -0
- assets/images/css.png +0 -0
- assets/images/db.png +0 -0
- assets/images/dev-team.png +0 -0
- assets/images/directory-lock.png +0 -0
- assets/images/doc.png +0 -0
- assets/images/file-lock.png +0 -0
- assets/images/film.png +0 -0
- assets/images/flash.png +0 -0
- assets/images/folder_open.png +0 -0
- assets/images/html.png +0 -0
- assets/images/hummingbird.png +0 -0
- assets/images/java.png +0 -0
- assets/images/linux.png +0 -0
- assets/images/pdf.png +0 -0
- assets/images/php.png +0 -0
- assets/images/ppt.png +0 -0
- assets/images/psd.png +0 -0
- assets/images/ruby.png +0 -0
- assets/images/script.png +0 -0
- assets/images/share-bg-small.png +0 -0
- assets/images/smush-no-media.png +0 -0
- assets/images/spinner.gif +0 -0
- assets/images/welcome-notice.png +0 -0
- assets/images/whatsapp-button-14px.png +0 -0
- assets/images/whatsapp-button-16px.png +0 -0
- assets/images/xls.png +0 -0
- assets/js/wp-smushit-admin.js +130 -58
- assets/shared-ui/img/spin-grey.gif +0 -0
- assets/shared-ui/img/spin.gif +0 -0
- assets/shared-ui/wdev-ui.js +0 -0
- languages/wp-smushit.pot +244 -382
- lib/class-wp-smush-admin.php +99 -48
- lib/class-wp-smush-backup.php +175 -44
- lib/class-wp-smush-db.php +71 -33
- lib/class-wp-smush-dir.php +76 -33
- lib/class-wp-smush-helper.php +49 -0
- lib/class-wp-smush-nextgen.php +56 -10
- lib/class-wp-smush-png_jpg.php +25 -18
- lib/class-wp-smush-resize.php +17 -10
- lib/class-wp-smush-s3.php +377 -0
- lib/class-wp-smush-share.php +2 -3
- lib/class-wp-smush-ui.php +45 -45
- lib/class-wp-smush.php +109 -42
- lib/nextgen-integration/class-wp-smush-nextgen-admin.php +3 -3
- lib/wp-async-task-smush.php +2 -2
- readme.txt +23 -2
- wp-smush.php +16 -5
assets/css/images/ui-bg_flat_75_ffffff_40x100.png
CHANGED
Binary file
|
assets/css/images/ui-bg_glass_65_ffffff_1x400.png
CHANGED
Binary file
|
assets/css/wp-smushit-admin.css
CHANGED
@@ -816,7 +816,8 @@ table.wp-smush-stats-holder tr td:first-child {
|
|
816 |
div.wp-smush-remaining,
|
817 |
#wp-smush-invalid-member,
|
818 |
div.wp-smush-dir-remaining,
|
819 |
-
div.wp-smush-dir-limit
|
|
|
820 |
background-color: #FFF5D5;
|
821 |
border: none;
|
822 |
color: #333333;
|
@@ -825,6 +826,12 @@ div.wp-smush-dir-limit {
|
|
825 |
letter-spacing: -0.015em;
|
826 |
}
|
827 |
|
|
|
|
|
|
|
|
|
|
|
|
|
828 |
div.wp-smush-dir-limit {
|
829 |
background-color: #dff6fa;
|
830 |
}
|
@@ -842,7 +849,8 @@ div.wp-smush-dir-all-done .dev-icon-tick:before {
|
|
842 |
text-decoration: underline;
|
843 |
}
|
844 |
|
845 |
-
div.wp-smush-dir-remaining .wdv-icon-exclamation-sign:before
|
|
|
846 |
color: #FECF2F;
|
847 |
}
|
848 |
|
@@ -1027,15 +1035,22 @@ small.smush-setting-description strong {
|
|
1027 |
padding: 10px;
|
1028 |
}
|
1029 |
|
1030 |
-
.wpmud .wp-smush-stats .button-small.wp-smush-lossy-enable,
|
|
|
|
|
1031 |
border-radius: 3px;
|
1032 |
font: 500 12px/20px 'Roboto' !important;
|
1033 |
padding: 5px 16px !important;
|
1034 |
vertical-align: top;
|
1035 |
}
|
1036 |
|
1037 |
-
.wpmud .wp-smush-lossy-enable:hover,
|
1038 |
-
.wpmud .wp-smush-
|
|
|
|
|
|
|
|
|
|
|
1039 |
background-color: #0093B1;
|
1040 |
color: #FFF;
|
1041 |
box-shadow: none;
|
@@ -1421,6 +1436,17 @@ small.smush-setting-description strong {
|
|
1421 |
border-color: #fd8b8b;
|
1422 |
}
|
1423 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1424 |
.wp-smush-settings-info {
|
1425 |
background: #e0f6fa;
|
1426 |
border-radius: 5px;
|
@@ -1833,10 +1859,11 @@ div.wp-smush-scan-result div.wp-smush-notice {
|
|
1833 |
}
|
1834 |
|
1835 |
div.wp-smush-scan-result div.wp-smush-notice .wdv-icon,
|
1836 |
-
div.wp-smush-scan-result div.wp-smush-notice .dev-icon
|
|
|
1837 |
display: inline-block;
|
1838 |
font-size: 22px;
|
1839 |
-
margin-right:
|
1840 |
margin-top: -3px;
|
1841 |
vertical-align: middle;
|
1842 |
}
|
@@ -2091,6 +2118,15 @@ div.wp-smush-info.notice {
|
|
2091 |
}
|
2092 |
|
2093 |
/** Media Queries **/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2094 |
@media screen and (max-width: 1100px) {
|
2095 |
li.wp-smush-image-ul span.wp-smush-li-path {
|
2096 |
max-width: 75%;
|
@@ -2182,19 +2218,6 @@ div.wp-smush-info.notice {
|
|
2182 |
}
|
2183 |
}
|
2184 |
|
2185 |
-
@media only screen and (min-width: 800px) and ( max-width: 1100px ) {
|
2186 |
-
.wp-smush-super-smush-promo {
|
2187 |
-
background-size: 120px;
|
2188 |
-
}
|
2189 |
-
|
2190 |
-
.wp-smush-super-smush-promo .wp-smush-super-smush-content {
|
2191 |
-
font-size: 10px;
|
2192 |
-
margin-left: 45%;
|
2193 |
-
padding: 10px 20px;
|
2194 |
-
width: 55%;
|
2195 |
-
}
|
2196 |
-
}
|
2197 |
-
|
2198 |
@media only screen and (min-width: 1100px) and ( max-width: 1200px ) {
|
2199 |
.wp-smush-super-smush-promo .wp-smush-super-smush-content {
|
2200 |
margin-left: 170px;
|
816 |
div.wp-smush-remaining,
|
817 |
#wp-smush-invalid-member,
|
818 |
div.wp-smush-dir-remaining,
|
819 |
+
div.wp-smush-dir-limit,
|
820 |
+
div.smush-s3-setup-error {
|
821 |
background-color: #FFF5D5;
|
822 |
border: none;
|
823 |
color: #333333;
|
826 |
letter-spacing: -0.015em;
|
827 |
}
|
828 |
|
829 |
+
div.smush-s3-setup-error a {
|
830 |
+
color: #333;
|
831 |
+
cursor: pointer;
|
832 |
+
text-decoration: underline;
|
833 |
+
}
|
834 |
+
|
835 |
div.wp-smush-dir-limit {
|
836 |
background-color: #dff6fa;
|
837 |
}
|
849 |
text-decoration: underline;
|
850 |
}
|
851 |
|
852 |
+
div.wp-smush-dir-remaining .wdv-icon-exclamation-sign:before,
|
853 |
+
div.smush-s3-setup-error .wdv-icon-exclamation-sign:before {
|
854 |
color: #FECF2F;
|
855 |
}
|
856 |
|
1035 |
padding: 10px;
|
1036 |
}
|
1037 |
|
1038 |
+
.wpmud .wp-smush-stats .button-small.wp-smush-lossy-enable,
|
1039 |
+
.wpmud .wp-smush-dir-link,
|
1040 |
+
.wpmud .wp-smush-stats .button-small.wp-smush-resize-enable {
|
1041 |
border-radius: 3px;
|
1042 |
font: 500 12px/20px 'Roboto' !important;
|
1043 |
padding: 5px 16px !important;
|
1044 |
vertical-align: top;
|
1045 |
}
|
1046 |
|
1047 |
+
.wpmud .wp-smush-lossy-enable:hover,
|
1048 |
+
.wpmud .wp-smush-lossy-enable:active,
|
1049 |
+
.wpmud .wp-smush-lossy-enable:focus,
|
1050 |
+
.wpmud .wp-smush-dir-link,
|
1051 |
+
.wpmud .wp-smush-resize-enable:hover,
|
1052 |
+
.wpmud .wp-smush-resize-enable:active,
|
1053 |
+
.wpmud .wp-smush-resize-enable:focus {
|
1054 |
background-color: #0093B1;
|
1055 |
color: #FFF;
|
1056 |
box-shadow: none;
|
1436 |
border-color: #fd8b8b;
|
1437 |
}
|
1438 |
|
1439 |
+
.wpmud .smush-s3-setup-error {
|
1440 |
+
margin-top: 15px;
|
1441 |
+
}
|
1442 |
+
|
1443 |
+
.wpmud .smush-s3-setup-error p {
|
1444 |
+
color: #333;
|
1445 |
+
display: inline-block;
|
1446 |
+
font-size: 15px;
|
1447 |
+
margin-top: 0;
|
1448 |
+
}
|
1449 |
+
|
1450 |
.wp-smush-settings-info {
|
1451 |
background: #e0f6fa;
|
1452 |
border-radius: 5px;
|
1859 |
}
|
1860 |
|
1861 |
div.wp-smush-scan-result div.wp-smush-notice .wdv-icon,
|
1862 |
+
div.wp-smush-scan-result div.wp-smush-notice .dev-icon,
|
1863 |
+
div.smush-s3-setup-error i.dev-icon {
|
1864 |
display: inline-block;
|
1865 |
font-size: 22px;
|
1866 |
+
margin-right: 5px;
|
1867 |
margin-top: -3px;
|
1868 |
vertical-align: middle;
|
1869 |
}
|
2118 |
}
|
2119 |
|
2120 |
/** Media Queries **/
|
2121 |
+
@media screen and (max-width: 1110px) {
|
2122 |
+
.wpmud .row .col-half.wp-smushit-container-left,
|
2123 |
+
.wpmud .row .col-half.wp-smushit-container-right {
|
2124 |
+
padding-left: 0;
|
2125 |
+
padding-right: 0;
|
2126 |
+
width: 100%;
|
2127 |
+
}
|
2128 |
+
}
|
2129 |
+
|
2130 |
@media screen and (max-width: 1100px) {
|
2131 |
li.wp-smush-image-ul span.wp-smush-li-path {
|
2132 |
max-width: 75%;
|
2218 |
}
|
2219 |
}
|
2220 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2221 |
@media only screen and (min-width: 1100px) and ( max-width: 1200px ) {
|
2222 |
.wp-smush-super-smush-promo .wp-smush-super-smush-content {
|
2223 |
margin-left: 170px;
|
assets/images/ajax-loader.gif
CHANGED
Binary file
|
assets/images/code.png
CHANGED
Binary file
|
assets/images/css.png
CHANGED
Binary file
|
assets/images/db.png
CHANGED
Binary file
|
assets/images/dev-team.png
CHANGED
Binary file
|
assets/images/directory-lock.png
CHANGED
Binary file
|
assets/images/doc.png
CHANGED
Binary file
|
assets/images/file-lock.png
CHANGED
Binary file
|
assets/images/film.png
CHANGED
Binary file
|
assets/images/flash.png
CHANGED
Binary file
|
assets/images/folder_open.png
CHANGED
Binary file
|
assets/images/html.png
CHANGED
Binary file
|
assets/images/hummingbird.png
CHANGED
Binary file
|
assets/images/java.png
CHANGED
Binary file
|
assets/images/linux.png
CHANGED
Binary file
|
assets/images/pdf.png
CHANGED
Binary file
|
assets/images/php.png
CHANGED
Binary file
|
assets/images/ppt.png
CHANGED
Binary file
|
assets/images/psd.png
CHANGED
Binary file
|
assets/images/ruby.png
CHANGED
Binary file
|
assets/images/script.png
CHANGED
Binary file
|
assets/images/share-bg-small.png
CHANGED
Binary file
|
assets/images/smush-no-media.png
CHANGED
Binary file
|
assets/images/spinner.gif
CHANGED
Binary file
|
assets/images/welcome-notice.png
CHANGED
Binary file
|
assets/images/whatsapp-button-14px.png
CHANGED
Binary file
|
assets/images/whatsapp-button-16px.png
CHANGED
Binary file
|
assets/images/xls.png
CHANGED
Binary file
|
assets/js/wp-smushit-admin.js
CHANGED
@@ -36,7 +36,7 @@ var dash_offset = function (percent) {
|
|
36 |
}
|
37 |
|
38 |
var update_dashoffset = function (stats) {
|
39 |
-
var total = stats.total
|
40 |
if (total > 0) {
|
41 |
var dashoffset = dash_offset(stats.smushed / total);
|
42 |
var circle_progress = jQuery('.wp-smush-svg-circle-progress');
|
@@ -347,48 +347,18 @@ jQuery(function ($) {
|
|
347 |
$('.wp-smush-notice.wp-smush-all-done').show();
|
348 |
}
|
349 |
|
350 |
-
//Update Total Images Tooltip
|
351 |
-
if ('undefined' !== typeof _res.data.stats.tooltip_text && '' != _res.data.stats.tooltip_text) {
|
352 |
-
$('.wp-smush-current-progress').attr('tooltip', _res.data.stats.tooltip_text);
|
353 |
-
}
|
354 |
-
|
355 |
//Update remaining count
|
356 |
self.update_remaining_count();
|
357 |
|
358 |
//if we have received the progress data, update the stats else skip
|
359 |
if ('undefined' != typeof _res.data.stats) {
|
360 |
|
361 |
-
//Update Progress on Circle
|
362 |
-
update_dashoffset(_res.data.stats);
|
363 |
-
|
364 |
-
//Update stats
|
365 |
-
$('.wp-smush-savings .wp-smush-stats-percent').html(_res.data.stats.percent);
|
366 |
-
$('.wp-smush-savings .wp-smush-stats-human').html(_res.data.stats.human);
|
367 |
-
|
368 |
-
$('.wp-smush-images-smushed, .wp-smush-optimised').html(_res.data.stats.smushed);
|
369 |
-
if ($('.super-smush-attachments .smushed-count').length && 'undefined' != typeof _res.data.stats.super_smushed) {
|
370 |
-
$('.super-smush-attachments .smushed-count').html(_res.data.stats.super_smushed);
|
371 |
-
}
|
372 |
-
|
373 |
-
var smush_conversion_savings = $('.smush-conversion-savings');
|
374 |
-
//Update Conversion Savings
|
375 |
-
if (smush_conversion_savings.length > 0 && 'undefined' != typeof ( _res.data.stats.conversion_savings ) && _res.data.stats.conversion_savings != '') {
|
376 |
-
var conversion_savings = smush_conversion_savings.find('.wp-smush-stats');
|
377 |
-
if (conversion_savings.length > 0) {
|
378 |
-
conversion_savings.html(_res.data.stats.conversion_savings);
|
379 |
-
}
|
380 |
-
}
|
381 |
-
var smush_resize_savings = $('.smush-resize-savings');
|
382 |
-
//Update Resize Savings
|
383 |
-
if (smush_resize_savings.length > 0 && 'undefined' != typeof ( _res.data.stats.resize_savings ) && _res.data.stats.resize_savings != '') {
|
384 |
-
var resize_savings = smush_resize_savings.find('.wp-smush-stats');
|
385 |
-
if (resize_savings.length > 0) {
|
386 |
-
resize_savings.html(_res.data.stats.resize_savings);
|
387 |
-
}
|
388 |
-
}
|
389 |
// increase the progress bar
|
390 |
this._update_progress(_res.data.stats.smushed, progress);
|
391 |
}
|
|
|
|
|
|
|
392 |
};
|
393 |
|
394 |
this._update_progress = function (count, width) {
|
@@ -829,9 +799,11 @@ jQuery(function ($) {
|
|
829 |
|
830 |
//Get the Smushed image count
|
831 |
var smushed_count = wp_smushit_data.count_smushed - r.data.resmush_ids.length;
|
|
|
|
|
832 |
|
833 |
//Update it in stats bar
|
834 |
-
$('.wp-smush-images-
|
835 |
|
836 |
//Hide the Existing wrapper
|
837 |
var notices = $('.bulk-smush-wrapper .wp-smush-notice');
|
@@ -1181,6 +1153,73 @@ jQuery(function ($) {
|
|
1181 |
}
|
1182 |
};
|
1183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1184 |
/**
|
1185 |
* Update the progress and show notice when smush completes
|
1186 |
*/
|
@@ -1224,6 +1263,10 @@ jQuery(function ($) {
|
|
1224 |
//Show notice on top if required
|
1225 |
add_smush_dir_notice();
|
1226 |
} else {
|
|
|
|
|
|
|
|
|
1227 |
//Show All done notice
|
1228 |
$('.wp-smush-notice.wp-smush-dir-all-done').show();
|
1229 |
|
@@ -1250,8 +1293,9 @@ jQuery(function ($) {
|
|
1250 |
|
1251 |
var spinner = $('div.smush-page-wrap span.spinner:first').clone();
|
1252 |
spinner.addClass('is-active');
|
|
|
1253 |
//Update the Optimising status for the image
|
1254 |
-
var first_child =
|
1255 |
|
1256 |
var parent = first_child.parents('li.wp-smush-image-ul');
|
1257 |
|
@@ -1280,6 +1324,7 @@ jQuery(function ($) {
|
|
1280 |
var param = {
|
1281 |
action: 'optimise',
|
1282 |
image_id: first_child.attr('id'),
|
|
|
1283 |
nonce: $('#wp-smush-all').val()
|
1284 |
};
|
1285 |
|
@@ -1314,12 +1359,33 @@ jQuery(function ($) {
|
|
1314 |
|
1315 |
//Update Directory progress
|
1316 |
update_dir_progress(ele);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1317 |
} else {
|
1318 |
//If there was an error optimising the image
|
1319 |
ele.addClass('error');
|
1320 |
//Update Directory progress
|
1321 |
update_dir_progress(ele);
|
1322 |
}
|
|
|
|
|
|
|
1323 |
}
|
1324 |
|
1325 |
//If user haven't paused the Smushing
|
@@ -1354,18 +1420,23 @@ jQuery(function ($) {
|
|
1354 |
var stats_human = $('div.smush-dir-savings span.wp-smush-stats span.wp-smush-stats-human');
|
1355 |
var stats_percent = $('div.smush-dir-savings span.wp-smush-stats span.wp-smush-stats-percent');
|
1356 |
|
1357 |
-
//
|
1358 |
-
if (
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
|
|
|
|
|
|
|
|
1363 |
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
|
|
1369 |
}
|
1370 |
}
|
1371 |
|
@@ -1373,17 +1444,16 @@ jQuery(function ($) {
|
|
1373 |
if ('undefined' != typeof ( stats.combined_stats ) && stats.combined_stats.length > 0) {
|
1374 |
var c_stats = stats.combined_stats;
|
1375 |
|
|
|
|
|
|
|
1376 |
//Update Circle Progress
|
1377 |
if (c_stats.dash_offset) {
|
1378 |
$('circle.wp-smush-svg-circle-progress').css({'stroke-dashoffset': c_stats.dash_offset});
|
1379 |
}
|
1380 |
-
//
|
1381 |
-
if (
|
1382 |
-
$('div.wp-smush-
|
1383 |
-
}
|
1384 |
-
//Update Smushed count
|
1385 |
-
if (c_stats.smushed_count) {
|
1386 |
-
$('div.wp-smush-count-total span.wp-smush-optimised').html(c_stats.smushed_count);
|
1387 |
}
|
1388 |
//Update Total Attachment Count
|
1389 |
if (c_stats.total_count) {
|
@@ -1626,7 +1696,11 @@ jQuery(function ($) {
|
|
1626 |
type = 'undefined' == typeof type ? 'media' : type;
|
1627 |
|
1628 |
var smushed_count = 'undefined' != typeof wp_smushit_data.count_smushed ? wp_smushit_data.count_smushed : 0
|
1629 |
-
|
|
|
|
|
|
|
|
|
1630 |
|
1631 |
//Update the Progress Bar Width
|
1632 |
// get the progress bar
|
@@ -1635,10 +1709,8 @@ jQuery(function ($) {
|
|
1635 |
return;
|
1636 |
}
|
1637 |
|
1638 |
-
var width = ( smushed_count / wp_smushit_data.count_total ) * 100;
|
1639 |
-
|
1640 |
// increase progress
|
1641 |
-
$progress_bar.css('width',
|
1642 |
|
1643 |
//Show the default bulk smush notice
|
1644 |
$('.wp-smush-bulk-wrapper .wp-smush-notice').show();
|
36 |
}
|
37 |
|
38 |
var update_dashoffset = function (stats) {
|
39 |
+
var total = stats.total;
|
40 |
if (total > 0) {
|
41 |
var dashoffset = dash_offset(stats.smushed / total);
|
42 |
var circle_progress = jQuery('.wp-smush-svg-circle-progress');
|
347 |
$('.wp-smush-notice.wp-smush-all-done').show();
|
348 |
}
|
349 |
|
|
|
|
|
|
|
|
|
|
|
350 |
//Update remaining count
|
351 |
self.update_remaining_count();
|
352 |
|
353 |
//if we have received the progress data, update the stats else skip
|
354 |
if ('undefined' != typeof _res.data.stats) {
|
355 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
// increase the progress bar
|
357 |
this._update_progress(_res.data.stats.smushed, progress);
|
358 |
}
|
359 |
+
|
360 |
+
// Update stats and counts.
|
361 |
+
update_stats(_res);
|
362 |
};
|
363 |
|
364 |
this._update_progress = function (count, width) {
|
799 |
|
800 |
//Get the Smushed image count
|
801 |
var smushed_count = wp_smushit_data.count_smushed - r.data.resmush_ids.length;
|
802 |
+
var smush_percent = ( smushed_count / wp_smushit_data.count_total ) * 100;
|
803 |
+
smush_percent = precise_round( smush_percent, 1 );
|
804 |
|
805 |
//Update it in stats bar
|
806 |
+
$('.wp-smush-images-percent').html(smush_percent);
|
807 |
|
808 |
//Hide the Existing wrapper
|
809 |
var notices = $('.bulk-smush-wrapper .wp-smush-notice');
|
1153 |
}
|
1154 |
};
|
1155 |
|
1156 |
+
/**
|
1157 |
+
* Update all stats sections based on the response.
|
1158 |
+
*
|
1159 |
+
* @param _res Ajax response data.
|
1160 |
+
*/
|
1161 |
+
var update_stats = function (_res) {
|
1162 |
+
|
1163 |
+
// If we have received the stats data, procced.
|
1164 |
+
if ('undefined' != typeof _res.data.stats) {
|
1165 |
+
|
1166 |
+
var stats = _res.data.stats;
|
1167 |
+
// Update Progress on Circle.
|
1168 |
+
update_dashoffset(_res.data.stats);
|
1169 |
+
|
1170 |
+
// Update main stats.
|
1171 |
+
$('.wp-smush-savings .wp-smush-stats-percent').html(stats.percent);
|
1172 |
+
$('.wp-smush-savings .wp-smush-stats-human').html(stats.human);
|
1173 |
+
|
1174 |
+
var smush_percent = ( stats.smushed / stats.total ) * 100;
|
1175 |
+
smush_percent = precise_round( smush_percent, 1 );
|
1176 |
+
|
1177 |
+
$('span.wp-smush-images-percent').html(smush_percent);
|
1178 |
+
$('.wp-smush-total-optimised').html(stats.total_images);
|
1179 |
+
if ($('.super-smush-attachments .smushed-count').length && 'undefined' != typeof stats.super_smushed) {
|
1180 |
+
$('.super-smush-attachments .smushed-count').html(stats.super_smushed);
|
1181 |
+
}
|
1182 |
+
|
1183 |
+
var smush_conversion_savings = $('.smush-conversion-savings');
|
1184 |
+
//Update Conversion Savings
|
1185 |
+
if (smush_conversion_savings.length > 0 && 'undefined' != typeof ( stats.conversion_savings ) && stats.conversion_savings != '') {
|
1186 |
+
var conversion_savings = smush_conversion_savings.find('.wp-smush-stats');
|
1187 |
+
if (conversion_savings.length > 0) {
|
1188 |
+
conversion_savings.html(stats.conversion_savings);
|
1189 |
+
}
|
1190 |
+
}
|
1191 |
+
var smush_resize_savings = $('.smush-resize-savings');
|
1192 |
+
//Update Resize Savings
|
1193 |
+
if (smush_resize_savings.length > 0 && 'undefined' != typeof ( stats.resize_savings ) && stats.resize_savings != '') {
|
1194 |
+
// Get the resize savings in number.
|
1195 |
+
var savings_value = parseInt(stats.resize_savings);
|
1196 |
+
var resize_savings = smush_resize_savings.find('.wp-smush-stats');
|
1197 |
+
// Replace only if value is grater than 0.
|
1198 |
+
if (savings_value > 0 && resize_savings.length > 0) {
|
1199 |
+
resize_savings.html(stats.resize_savings);
|
1200 |
+
}
|
1201 |
+
}
|
1202 |
+
|
1203 |
+
// Updating pro savings stats.
|
1204 |
+
if ('undefined' != typeof (stats.pro_savings)) {
|
1205 |
+
// Make pro savings div visible if hidden.
|
1206 |
+
$('#smush-avg-pro-savings').show();
|
1207 |
+
// Pro stats section.
|
1208 |
+
var smush_pro_savings = $('.smush-avg-pro-savings');
|
1209 |
+
if (smush_pro_savings.length > 0) {
|
1210 |
+
var pro_savings_percent = smush_pro_savings.find('.wp-smush-stats-percent');
|
1211 |
+
var pro_savings_bytes = smush_pro_savings.find('.wp-smush-stats-human');
|
1212 |
+
if (pro_savings_percent.length > 0 && 'undefined' != typeof (stats.pro_savings.percent) && stats.pro_savings.percent != '') {
|
1213 |
+
pro_savings_percent.html(_res.data.stats.pro_savings.percent);
|
1214 |
+
}
|
1215 |
+
if (pro_savings_bytes.length > 0 && 'undefined' != typeof (stats.pro_savings.savings) && stats.pro_savings.savings != '') {
|
1216 |
+
pro_savings_bytes.html(stats.pro_savings.savings);
|
1217 |
+
}
|
1218 |
+
}
|
1219 |
+
}
|
1220 |
+
}
|
1221 |
+
}
|
1222 |
+
|
1223 |
/**
|
1224 |
* Update the progress and show notice when smush completes
|
1225 |
*/
|
1263 |
//Show notice on top if required
|
1264 |
add_smush_dir_notice();
|
1265 |
} else {
|
1266 |
+
// Hide images list.
|
1267 |
+
$('ul.wp-smush-image-list').hide();
|
1268 |
+
$('div.dir-smush-button-wrap.top').hide();
|
1269 |
+
|
1270 |
//Show All done notice
|
1271 |
$('.wp-smush-notice.wp-smush-dir-all-done').show();
|
1272 |
|
1293 |
|
1294 |
var spinner = $('div.smush-page-wrap span.spinner:first').clone();
|
1295 |
spinner.addClass('is-active');
|
1296 |
+
var unprocessed_child = jQuery('ul.wp-smush-image-list li.wp-smush-image-ele:not(".optimised, .processed")');
|
1297 |
//Update the Optimising status for the image
|
1298 |
+
var first_child = unprocessed_child.first();
|
1299 |
|
1300 |
var parent = first_child.parents('li.wp-smush-image-ul');
|
1301 |
|
1324 |
var param = {
|
1325 |
action: 'optimise',
|
1326 |
image_id: first_child.attr('id'),
|
1327 |
+
get_stats: unprocessed_child.length > 1 ? 0: 1,
|
1328 |
nonce: $('#wp-smush-all').val()
|
1329 |
};
|
1330 |
|
1359 |
|
1360 |
//Update Directory progress
|
1361 |
update_dir_progress(ele);
|
1362 |
+
|
1363 |
+
// Update dir savings stats.
|
1364 |
+
if ('undefined' != typeof (res.data.total.percent) && 'undefined' != typeof (res.data.total.human) && 'undefined' != typeof (res.data.total.bytes)) {
|
1365 |
+
// Directory stats section.
|
1366 |
+
var smush_dir_savings = $('.smush-dir-savings');
|
1367 |
+
if (smush_dir_savings.length > 0 && res.data.total.bytes > 0) {
|
1368 |
+
// Make separator visible if hidden.
|
1369 |
+
smush_dir_savings.find('.wp-smush-stats-sep').show();
|
1370 |
+
var dir_savings_percent = smush_dir_savings.find('.wp-smush-stats-percent');
|
1371 |
+
var dir_savings_human = smush_dir_savings.find('.wp-smush-stats-human');
|
1372 |
+
if (dir_savings_percent.length > 0) {
|
1373 |
+
dir_savings_percent.html(res.data.total.percent + '%');
|
1374 |
+
}
|
1375 |
+
if (dir_savings_human.length > 0) {
|
1376 |
+
dir_savings_human.html(res.data.total.human);
|
1377 |
+
}
|
1378 |
+
}
|
1379 |
+
}
|
1380 |
} else {
|
1381 |
//If there was an error optimising the image
|
1382 |
ele.addClass('error');
|
1383 |
//Update Directory progress
|
1384 |
update_dir_progress(ele);
|
1385 |
}
|
1386 |
+
|
1387 |
+
// Update stats.
|
1388 |
+
update_stats(res);
|
1389 |
}
|
1390 |
|
1391 |
//If user haven't paused the Smushing
|
1420 |
var stats_human = $('div.smush-dir-savings span.wp-smush-stats span.wp-smush-stats-human');
|
1421 |
var stats_percent = $('div.smush-dir-savings span.wp-smush-stats span.wp-smush-stats-percent');
|
1422 |
|
1423 |
+
// Do not replace if 0 savings.
|
1424 |
+
if (stats.dir_smush.bytes > 0) {
|
1425 |
+
// Show size and percentage separator.
|
1426 |
+
$('div.smush-dir-savings span.wp-smush-stats span.wp-smush-stats-sep').show();
|
1427 |
+
//Update Savings in bytes
|
1428 |
+
if (stats_human.length > 0) {
|
1429 |
+
stats_human.html(stats.dir_smush.human);
|
1430 |
+
} else {
|
1431 |
+
var span = '<span class="wp-smush-stats-human">' + stats.dir_smush.bytes + '</span>';
|
1432 |
+
}
|
1433 |
|
1434 |
+
//Update Optimisation percentage
|
1435 |
+
if (stats_percent.length > 0) {
|
1436 |
+
stats_percent.html(stats.dir_smush.percent + '%');
|
1437 |
+
} else {
|
1438 |
+
var span = '<span class="wp-smush-stats-percent">' + stats.dir_smush.percent + '%' + '</span>';
|
1439 |
+
}
|
1440 |
}
|
1441 |
}
|
1442 |
|
1444 |
if ('undefined' != typeof ( stats.combined_stats ) && stats.combined_stats.length > 0) {
|
1445 |
var c_stats = stats.combined_stats;
|
1446 |
|
1447 |
+
var smush_percent = ( c_stats.smushed / c_stats.total_count ) * 100;
|
1448 |
+
smush_percent = precise_round( smush_percent, 1 );
|
1449 |
+
|
1450 |
//Update Circle Progress
|
1451 |
if (c_stats.dash_offset) {
|
1452 |
$('circle.wp-smush-svg-circle-progress').css({'stroke-dashoffset': c_stats.dash_offset});
|
1453 |
}
|
1454 |
+
//Smushed Percent
|
1455 |
+
if (smush_percent) {
|
1456 |
+
$('div.wp-smush-count-total span.wp-smush-images-percent').html(smush_percent);
|
|
|
|
|
|
|
|
|
1457 |
}
|
1458 |
//Update Total Attachment Count
|
1459 |
if (c_stats.total_count) {
|
1696 |
type = 'undefined' == typeof type ? 'media' : type;
|
1697 |
|
1698 |
var smushed_count = 'undefined' != typeof wp_smushit_data.count_smushed ? wp_smushit_data.count_smushed : 0
|
1699 |
+
|
1700 |
+
var smush_percent = ( smushed_count / wp_smushit_data.count_total ) * 100;
|
1701 |
+
smush_percent = precise_round( smush_percent, 1 );
|
1702 |
+
|
1703 |
+
$('.wp-smush-images-percent').html(smush_percent);
|
1704 |
|
1705 |
//Update the Progress Bar Width
|
1706 |
// get the progress bar
|
1709 |
return;
|
1710 |
}
|
1711 |
|
|
|
|
|
1712 |
// increase progress
|
1713 |
+
$progress_bar.css('width', smush_percent + '%');
|
1714 |
|
1715 |
//Show the default bulk smush notice
|
1716 |
$('.wp-smush-bulk-wrapper .wp-smush-notice').show();
|
assets/shared-ui/img/spin-grey.gif
CHANGED
Binary file
|
assets/shared-ui/img/spin.gif
CHANGED
Binary file
|
assets/shared-ui/wdev-ui.js
CHANGED
File without changes
|
languages/wp-smushit.pot
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
-
|
|
|
2 |
msgid ""
|
3 |
msgstr ""
|
4 |
-
"Project-Id-Version: WP Smush 2.
|
5 |
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wp-smushit\n"
|
6 |
-
"POT-Creation-Date: 2017-
|
7 |
"MIME-Version: 1.0\n"
|
8 |
"Content-Type: text/plain; charset=UTF-8\n"
|
9 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -46,29 +47,19 @@ msgid "install"
|
|
46 |
msgstr ""
|
47 |
|
48 |
#: extras/dash-notice/wpmudev-dash-notification.php:230
|
49 |
-
|
50 |
-
msgid ""
|
51 |
-
"Important updates are available for <strong>%s</strong>. Install the free "
|
52 |
-
"WPMU DEV Dashboard plugin now for updates and support!"
|
53 |
msgstr ""
|
54 |
|
55 |
#: extras/dash-notice/wpmudev-dash-notification.php:232
|
56 |
-
|
57 |
-
msgid ""
|
58 |
-
"<strong>%s</strong> is almost ready - install the free WPMU DEV Dashboard "
|
59 |
-
"plugin for updates and support!"
|
60 |
msgstr ""
|
61 |
|
62 |
#: extras/dash-notice/wpmudev-dash-notification.php:236
|
63 |
-
msgid ""
|
64 |
-
"Important updates are available for your WPMU DEV plugins/themes. Install "
|
65 |
-
"the free WPMU DEV Dashboard plugin now for updates and support!"
|
66 |
msgstr ""
|
67 |
|
68 |
#: extras/dash-notice/wpmudev-dash-notification.php:238
|
69 |
-
msgid ""
|
70 |
-
"Almost ready - install the free WPMU DEV Dashboard plugin for updates and "
|
71 |
-
"support!"
|
72 |
msgstr ""
|
73 |
|
74 |
#: extras/dash-notice/wpmudev-dash-notification.php:244
|
@@ -85,28 +76,19 @@ msgid "activate"
|
|
85 |
msgstr ""
|
86 |
|
87 |
#: extras/dash-notice/wpmudev-dash-notification.php:271
|
88 |
-
|
89 |
-
msgid ""
|
90 |
-
"Important updates are available for <strong>%s</strong>. Activate the WPMU "
|
91 |
-
"DEV Dashboard to update now!"
|
92 |
msgstr ""
|
93 |
|
94 |
#: extras/dash-notice/wpmudev-dash-notification.php:273
|
95 |
-
|
96 |
-
msgid ""
|
97 |
-
"Just one more step to enable updates and support for <strong>%s</strong>!"
|
98 |
msgstr ""
|
99 |
|
100 |
#: extras/dash-notice/wpmudev-dash-notification.php:277
|
101 |
-
msgid ""
|
102 |
-
"Important updates are available for your WPMU DEV plugins/themes. Activate "
|
103 |
-
"the WPMU DEV Dashboard to update now!"
|
104 |
msgstr ""
|
105 |
|
106 |
#: extras/dash-notice/wpmudev-dash-notification.php:279
|
107 |
-
msgid ""
|
108 |
-
"Just one more step - activate the WPMU DEV Dashboard plugin and you're all "
|
109 |
-
"done!"
|
110 |
msgstr ""
|
111 |
|
112 |
#: extras/dash-notice/wpmudev-dash-notification.php:285
|
@@ -118,7 +100,6 @@ msgid "We did not find any data for this plugin or theme..."
|
|
118 |
msgstr ""
|
119 |
|
120 |
#: extras/dash-notice/wpmudev-dash-notification.php:1131
|
121 |
-
#, php-format
|
122 |
msgid "%s changelog"
|
123 |
msgstr ""
|
124 |
|
@@ -131,7 +112,6 @@ msgid "New"
|
|
131 |
msgstr ""
|
132 |
|
133 |
#: extras/dash-notice/wpmudev-dash-notification.php:1184
|
134 |
-
#, php-format
|
135 |
msgid "Version %s"
|
136 |
msgstr ""
|
137 |
|
@@ -144,12 +124,7 @@ msgid "Hide details"
|
|
144 |
msgstr ""
|
145 |
|
146 |
#: extras/free-dashboard/module.php:377
|
147 |
-
|
148 |
-
msgid ""
|
149 |
-
"We're happy that you've chosen to install %s! Are you interested in how to "
|
150 |
-
"make the most of this plugin? How would you like a quick 5 day email crash "
|
151 |
-
"course with actionable advice on building your membership site? Only the "
|
152 |
-
"info you want, no subscription!"
|
153 |
msgstr ""
|
154 |
|
155 |
#: extras/free-dashboard/module.php:392 extras/free-dashboard/module.php:427
|
@@ -161,463 +136,413 @@ msgid "No thanks"
|
|
161 |
msgstr ""
|
162 |
|
163 |
#: extras/free-dashboard/module.php:412
|
164 |
-
|
165 |
-
msgid ""
|
166 |
-
"Hey %s, you've been using %s for a while now, and we hope you're happy with "
|
167 |
-
"it."
|
168 |
msgstr ""
|
169 |
|
170 |
#: extras/free-dashboard/module.php:412
|
171 |
-
msgid ""
|
172 |
-
"We've spent countless hours developing this free plugin for you, and we "
|
173 |
-
"would really appreciate it if you dropped us a quick rating!"
|
174 |
msgstr ""
|
175 |
|
176 |
#: extras/free-dashboard/module.php:430
|
177 |
-
#, php-format
|
178 |
msgid "Rate %s"
|
179 |
msgstr ""
|
180 |
|
181 |
-
#: lib/class-wp-smush-admin.php:
|
182 |
msgid "Enable Network wide settings"
|
183 |
msgstr ""
|
184 |
|
185 |
-
#: lib/class-wp-smush-admin.php:
|
186 |
msgid "If disabled sub sites can override the individual Smush settings."
|
187 |
msgstr ""
|
188 |
|
189 |
-
#: lib/class-wp-smush-admin.php:
|
190 |
msgid "Automatically smush my images on upload"
|
191 |
msgstr ""
|
192 |
|
193 |
-
#: lib/class-wp-smush-admin.php:
|
194 |
-
msgid ""
|
195 |
-
"When you upload images to the media library, we’ll automatically optimize "
|
196 |
-
"them."
|
197 |
msgstr ""
|
198 |
|
199 |
-
#: lib/class-wp-smush-admin.php:
|
200 |
msgid "Preserve image EXIF data"
|
201 |
msgstr ""
|
202 |
|
203 |
-
#: lib/class-wp-smush-admin.php:
|
204 |
-
msgid ""
|
205 |
-
"EXIF data stores camera settings, focal length, date, time and location "
|
206 |
-
"information in image files. EXIF data makes image files larger but if you "
|
207 |
-
"are a photographer you may want to preserve this information."
|
208 |
msgstr ""
|
209 |
|
210 |
-
#: lib/class-wp-smush-admin.php:
|
211 |
msgid "Resize original images"
|
212 |
msgstr ""
|
213 |
|
214 |
-
#: lib/class-wp-smush-admin.php:
|
215 |
-
msgid ""
|
216 |
-
"Save a ton of space by not storing over-sized images on your server. Set "
|
217 |
-
"image maximum width and height and large images will be automatically scaled "
|
218 |
-
"before being added to the media library."
|
219 |
msgstr ""
|
220 |
|
221 |
-
#: lib/class-wp-smush-admin.php:
|
222 |
msgid "Super-smush my images"
|
223 |
msgstr ""
|
224 |
|
225 |
-
#: lib/class-wp-smush-admin.php:
|
226 |
-
msgid ""
|
227 |
-
"Compress images up to 2x more than regular smush with almost no visible drop "
|
228 |
-
"in quality."
|
229 |
msgstr ""
|
230 |
|
231 |
-
#: lib/class-wp-smush-admin.php:
|
232 |
msgid "Include my original full-size images"
|
233 |
msgstr ""
|
234 |
|
235 |
-
#: lib/class-wp-smush-admin.php:
|
236 |
-
msgid ""
|
237 |
-
"WordPress crops and resizes every image you upload for embedding on your "
|
238 |
-
"site. By default, Smush only compresses these cropped and resized images, "
|
239 |
-
"not your original full-size images. To save space on your server, activate "
|
240 |
-
"this setting to smush your original images, too. Note: This doesn’t usually "
|
241 |
-
"improve page speed."
|
242 |
msgstr ""
|
243 |
|
244 |
-
#: lib/class-wp-smush-admin.php:
|
245 |
msgid "Make a copy of my original images"
|
246 |
msgstr ""
|
247 |
|
248 |
-
#: lib/class-wp-smush-admin.php:
|
249 |
-
msgid ""
|
250 |
-
"Save your original full-size images so you can restore them at any point. "
|
251 |
-
"Note: Activating this setting will significantly increase the size of your "
|
252 |
-
"uploads folder by nearly twice as much."
|
253 |
msgstr ""
|
254 |
|
255 |
-
#: lib/class-wp-smush-admin.php:
|
256 |
msgid "Convert PNG to JPEG (lossy)"
|
257 |
msgstr ""
|
258 |
|
259 |
-
#: lib/class-wp-smush-admin.php:
|
260 |
-
|
261 |
-
msgid ""
|
262 |
-
"When you compress a PNG file, Smush will check if converting the file to "
|
263 |
-
"JPEG will further reduce its size. %s Note: PNGs with transparency will be "
|
264 |
-
"ignored and Smush will only convert the file format if it results in a "
|
265 |
-
"smaller file size. This will change the file’s name and extension, and any "
|
266 |
-
"hard-coded URLs will need to be updated.%s"
|
267 |
msgstr ""
|
268 |
|
269 |
-
#: lib/class-wp-smush-admin.php:
|
270 |
-
msgid "Enable NextGen Gallery integration"
|
271 |
-
msgstr ""
|
272 |
-
|
273 |
-
#: lib/class-wp-smush-admin.php:247
|
274 |
-
msgid "Allow smushing images directly through NextGen Gallery settings."
|
275 |
-
msgstr ""
|
276 |
-
|
277 |
-
#. Plugin Name of the plugin/theme
|
278 |
-
#: lib/class-wp-smush-admin.php:269 lib/class-wp-smush-ui.php:817
|
279 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:70
|
280 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:89
|
281 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:91
|
282 |
msgid "WP Smush"
|
283 |
msgstr ""
|
284 |
|
285 |
-
#: lib/class-wp-smush-admin.php:
|
286 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:158
|
287 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:275
|
288 |
msgid "Super-Smush"
|
289 |
msgstr ""
|
290 |
|
291 |
-
#: lib/class-wp-smush-admin.php:
|
292 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:159
|
293 |
msgid "Smush Now"
|
294 |
msgstr ""
|
295 |
|
296 |
-
#: lib/class-wp-smush-admin.php:
|
297 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:160
|
298 |
msgid "{{errors}} image(s) were skipped due to an error."
|
299 |
msgstr ""
|
300 |
|
301 |
-
#: lib/class-wp-smush-admin.php:
|
302 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:161
|
303 |
msgid "All images are fully optimised."
|
304 |
msgstr ""
|
305 |
|
306 |
-
#: lib/class-wp-smush-admin.php:
|
307 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:162
|
308 |
msgid "Restoring image.."
|
309 |
msgstr ""
|
310 |
|
311 |
-
#: lib/class-wp-smush-admin.php:
|
312 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:163
|
313 |
msgid "Smushing image.."
|
314 |
msgstr ""
|
315 |
|
316 |
-
#: lib/class-wp-smush-admin.php:
|
317 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:164
|
318 |
msgid "Checking images.."
|
319 |
msgstr ""
|
320 |
|
321 |
-
#: lib/class-wp-smush-admin.php:
|
322 |
-
msgid ""
|
323 |
-
"We successfully verified your membership, all the Pro features should work "
|
324 |
-
"completely. "
|
325 |
msgstr ""
|
326 |
|
327 |
-
#: lib/class-wp-smush-admin.php:
|
328 |
msgid "Your membership couldn't be verified."
|
329 |
msgstr ""
|
330 |
|
331 |
-
#: lib/class-wp-smush-admin.php:
|
332 |
msgid "Missing file path."
|
333 |
msgstr ""
|
334 |
|
335 |
-
#: lib/class-wp-smush-admin.php:
|
336 |
msgid "image could not be smushed."
|
337 |
msgstr ""
|
338 |
|
339 |
-
#: lib/class-wp-smush-admin.php:
|
340 |
msgid "images could not be smushed."
|
341 |
msgstr ""
|
342 |
|
343 |
-
#: lib/class-wp-smush-admin.php:
|
344 |
msgid "Already Optimised"
|
345 |
msgstr ""
|
346 |
|
347 |
-
#: lib/class-wp-smush-admin.php:
|
348 |
msgid "Ajax Error"
|
349 |
msgstr ""
|
350 |
|
351 |
-
#: lib/class-wp-smush-admin.php:
|
352 |
-
#: lib/class-wp-smush-admin.php:
|
353 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:340
|
354 |
msgid "All Done!"
|
355 |
msgstr ""
|
356 |
|
357 |
-
#: lib/class-wp-smush-admin.php:
|
358 |
-
msgid ""
|
359 |
-
"Smush request timed out, You can try setting a higher value for "
|
360 |
-
"`WP_SMUSH_API_TIMEOUT`."
|
361 |
msgstr ""
|
362 |
|
363 |
-
#: lib/class-wp-smush-admin.php:
|
364 |
-
|
365 |
msgid "You've smushed %d images in total."
|
366 |
msgstr ""
|
367 |
|
368 |
-
#: lib/class-wp-smush-admin.php:
|
369 |
msgid "You don't have permission to work with uploaded files."
|
370 |
msgstr ""
|
371 |
|
372 |
-
#: lib/class-wp-smush-admin.php:
|
373 |
msgid "No attachment ID was provided."
|
374 |
msgstr ""
|
375 |
|
376 |
-
#: lib/class-wp-smush-admin.php:
|
377 |
msgid "Attachment Skipped - Check `wp_smush_image` filter."
|
378 |
msgstr ""
|
379 |
|
380 |
-
#: lib/class-wp-smush-admin.php:
|
381 |
-
#, php-format
|
382 |
msgid "<strong>%d of %d images</strong> were sent for smushing:"
|
383 |
msgstr ""
|
384 |
|
385 |
-
#: lib/class-wp-smush-admin.php:
|
386 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:336
|
387 |
msgid "Bulk Smush Now"
|
388 |
msgstr ""
|
389 |
|
390 |
-
#: lib/class-wp-smush-admin.php:
|
391 |
msgid "Smushing in progress.."
|
392 |
msgstr ""
|
393 |
|
394 |
-
#: lib/class-wp-smush-admin.php:
|
395 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:255
|
396 |
msgid "Smush Now!"
|
397 |
msgstr ""
|
398 |
|
399 |
-
#: lib/class-wp-smush-admin.php:
|
400 |
msgid "Settings"
|
401 |
msgstr ""
|
402 |
|
403 |
-
#: lib/class-wp-smush-admin.php:
|
404 |
msgid "Image not smushed, fields empty."
|
405 |
msgstr ""
|
406 |
|
407 |
-
#: lib/class-wp-smush-admin.php:
|
408 |
-
msgid ""
|
409 |
-
"Image couldn't be smushed as the nonce verification failed, try reloading "
|
410 |
-
"the page."
|
411 |
msgstr ""
|
412 |
|
413 |
-
#: lib/class-wp-smush-admin.php:
|
414 |
msgid "Unable to smush image"
|
415 |
msgstr ""
|
416 |
|
417 |
-
#: lib/class-wp-smush-admin.php:
|
418 |
-
msgid ""
|
419 |
-
"We haven’t found any images in your media library yet so there’s no smushing "
|
420 |
-
"to be done!"
|
421 |
msgstr ""
|
422 |
|
423 |
-
#: lib/class-wp-smush-admin.php:
|
424 |
msgid "Yay! All images are optimised as per your current settings."
|
425 |
msgstr ""
|
426 |
|
427 |
-
#: lib/class-wp-smush-admin.php:
|
428 |
-
#, php-format
|
429 |
msgid "You have images that need smushing. %sBulk smush now!%s"
|
430 |
msgstr ""
|
431 |
|
432 |
-
#: lib/class-wp-smush-admin.php:
|
433 |
msgid "Review your setting now."
|
434 |
msgstr ""
|
435 |
|
436 |
-
#: lib/class-wp-smush-admin.php:
|
437 |
-
#: lib/class-wp-smush-dir.php:
|
438 |
#: lib/class-wp-smush-ui.php:817
|
439 |
msgid "WP Smush Pro"
|
440 |
msgstr ""
|
441 |
|
442 |
-
#: lib/class-wp-smush-admin.php:
|
443 |
-
msgid ""
|
444 |
-
"Welcome to the newest version of WP Smush! In this update we've added the "
|
445 |
-
"ability to bulk smush images in directories outside your uploads folder."
|
446 |
msgstr ""
|
447 |
|
448 |
-
#: lib/class-wp-smush-admin.php:
|
449 |
-
|
450 |
-
msgid ""
|
451 |
-
" And as a multisite user, you can manage %sSmush settings%s globally across "
|
452 |
-
"all sites!"
|
453 |
msgstr ""
|
454 |
|
455 |
-
#: lib/class-wp-smush-admin.php:
|
456 |
-
#, php-format
|
457 |
msgid " %sFind out more here >>%s"
|
458 |
msgstr ""
|
459 |
|
460 |
-
#: lib/class-wp-smush-backup.php:
|
461 |
msgid "Error in processing restore action, Fields empty."
|
462 |
msgstr ""
|
463 |
|
464 |
-
#: lib/class-wp-smush-backup.php:
|
465 |
msgid "Image not restored, Nonce verification failed."
|
466 |
msgstr ""
|
467 |
|
468 |
-
#: lib/class-wp-smush-backup.php:
|
469 |
msgid "Unable to restore image"
|
470 |
msgstr ""
|
471 |
|
472 |
-
#: lib/class-wp-smush-dir.php:
|
473 |
msgid "DIRECTORY SMUSH SAVINGS"
|
474 |
msgstr ""
|
475 |
|
476 |
-
#: lib/class-wp-smush-dir.php:
|
477 |
msgid "Updating Stats"
|
478 |
msgstr ""
|
479 |
|
480 |
-
#: lib/class-wp-smush-dir.php:
|
|
|
|
|
|
|
|
|
481 |
msgid "RESUME LAST SCAN"
|
482 |
msgstr ""
|
483 |
|
484 |
-
#: lib/class-wp-smush-dir.php:
|
485 |
msgid "DIRECTORY SMUSH"
|
486 |
msgstr ""
|
487 |
|
488 |
-
#: lib/class-wp-smush-dir.php:
|
489 |
-
msgid ""
|
490 |
-
"In addition to smushing your media uploads, you may want to also smush "
|
491 |
-
"images living outside your uploads directory. Simply add any directories you "
|
492 |
-
"wish to smush and bulk smush away!"
|
493 |
msgstr ""
|
494 |
|
495 |
-
#: lib/class-wp-smush-dir.php:
|
496 |
-
|
497 |
-
msgid "All images are smushed and up to date. Awesome!"
|
498 |
msgstr ""
|
499 |
|
500 |
-
#: lib/class-wp-smush-dir.php:
|
501 |
-
|
502 |
-
msgid ""
|
503 |
-
"%s/%s image(s) were successfully smushed, however %s image(s) could not be "
|
504 |
-
"smushed due to an error."
|
505 |
msgstr ""
|
506 |
|
507 |
-
#: lib/class-wp-smush-dir.php:
|
508 |
-
|
509 |
-
msgid ""
|
510 |
-
" %sUpgrade to pro%s to bulk smush all your directory images with one click. "
|
511 |
-
"Free users can smush 50 images with each click."
|
512 |
msgstr ""
|
513 |
|
514 |
-
#: lib/class-wp-smush-dir.php:
|
515 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:482
|
516 |
msgid "BULK SMUSH"
|
517 |
msgstr ""
|
518 |
|
519 |
-
#: lib/class-wp-smush-dir.php:
|
520 |
msgid "Click to stop the directory smushing process."
|
521 |
msgstr ""
|
522 |
|
523 |
-
#: lib/class-wp-smush-dir.php:
|
524 |
msgid "CANCEL"
|
525 |
msgstr ""
|
526 |
|
527 |
-
#: lib/class-wp-smush-dir.php:
|
528 |
msgid "CHOOSE DIRECTORY"
|
529 |
msgstr ""
|
530 |
|
531 |
-
#: lib/class-wp-smush-dir.php:
|
532 |
msgid "Directory list"
|
533 |
msgstr ""
|
534 |
|
535 |
-
#: lib/class-wp-smush-dir.php:
|
536 |
msgid "Choose the folder you wish to smush."
|
537 |
msgstr ""
|
538 |
|
539 |
-
#: lib/class-wp-smush-dir.php:
|
540 |
-
msgid ""
|
541 |
-
"Smush will also include any images in sub folders of your selected folder."
|
542 |
msgstr ""
|
543 |
|
544 |
-
#: lib/class-wp-smush-dir.php:
|
545 |
msgid "ADD DIRECTORY"
|
546 |
msgstr ""
|
547 |
|
548 |
-
#: lib/class-wp-smush-dir.php:
|
549 |
msgid "Exclude directory from Smush List"
|
550 |
msgstr ""
|
551 |
|
552 |
-
#: lib/class-wp-smush-dir.php:
|
553 |
msgid "We could not find any images in the selected directory."
|
554 |
msgstr ""
|
555 |
|
556 |
-
#: lib/class-wp-smush-dir.php:
|
557 |
-
#, php-format
|
558 |
msgid "%d images"
|
559 |
msgstr ""
|
560 |
|
561 |
-
#: lib/class-wp-smush-dir.php:
|
562 |
msgid "Waiting.."
|
563 |
msgstr ""
|
564 |
|
565 |
-
#: lib/class-wp-smush-dir.php:
|
566 |
msgid "Incorrect image id"
|
567 |
msgstr ""
|
568 |
|
569 |
-
#: lib/class-wp-smush-dir.php:
|
570 |
msgid "Could not find image id in last scanned images"
|
571 |
msgstr ""
|
572 |
|
573 |
-
#: lib/class-wp-smush-dir.php:
|
574 |
msgid "Image couldn't be optimised"
|
575 |
msgstr ""
|
576 |
|
577 |
-
#: lib/class-wp-smush-dir.php:
|
578 |
-
msgid ""
|
579 |
-
"We were unable to retrieve the image list from last scan, please continue "
|
580 |
-
"with a latest scan"
|
581 |
msgstr ""
|
582 |
|
583 |
-
#: lib/class-wp-smush-nextgen.php:
|
584 |
-
msgid ""
|
585 |
-
|
586 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
587 |
msgstr ""
|
588 |
|
589 |
-
#: lib/class-wp-smush-nextgen.php:
|
590 |
msgid "We couldn't process the image, fields empty."
|
591 |
msgstr ""
|
592 |
|
593 |
-
#: lib/class-wp-smush-nextgen.php:
|
594 |
-
#, php-format
|
595 |
msgid "Unable to smush image, %s"
|
596 |
msgstr ""
|
597 |
|
598 |
-
#: lib/class-wp-smush-
|
599 |
-
|
600 |
-
msgid ""
|
601 |
-
"%s, you've smushed %d images and saved %s in total. Help your friends save "
|
602 |
-
"bandwidth easily, and help me in my quest to Smush the internet!"
|
603 |
msgstr ""
|
604 |
|
605 |
-
#: lib/class-wp-smush-
|
606 |
-
|
607 |
-
msgid ""
|
608 |
-
"I saved %s on my site with WP Smush ( %s ) - wanna make your website smaller "
|
609 |
-
"and faster?"
|
610 |
msgstr ""
|
611 |
|
612 |
-
#: lib/class-wp-smush-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
613 |
msgid "TWEET"
|
614 |
msgstr ""
|
615 |
|
616 |
-
#: lib/class-wp-smush-share.php:
|
617 |
msgid "SHARE"
|
618 |
msgstr ""
|
619 |
|
620 |
-
#: lib/class-wp-smush-share.php:
|
621 |
msgid "WhatsApp"
|
622 |
msgstr ""
|
623 |
|
@@ -634,14 +559,10 @@ msgid "OH YEAH, IT'S COMPRESSION TIME!"
|
|
634 |
msgstr ""
|
635 |
|
636 |
#: lib/class-wp-smush-ui.php:71
|
637 |
-
|
638 |
-
msgid ""
|
639 |
-
"You've just installed %3$s, the most popular image compression plugin for "
|
640 |
-
"WordPress! %1$sChoose your desired settings%2$s and get smushing!"
|
641 |
msgstr ""
|
642 |
|
643 |
#: lib/class-wp-smush-ui.php:85
|
644 |
-
#, php-format
|
645 |
msgid "Smush individual images via your %sMedia Library%s"
|
646 |
msgstr ""
|
647 |
|
@@ -655,9 +576,7 @@ msgstr ""
|
|
655 |
|
656 |
#: lib/class-wp-smush-ui.php:122
|
657 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:502
|
658 |
-
msgid ""
|
659 |
-
"Lets you check if any images can be further optimised. Useful after changing "
|
660 |
-
"settings."
|
661 |
msgstr ""
|
662 |
|
663 |
#: lib/class-wp-smush-ui.php:122
|
@@ -671,13 +590,12 @@ msgid "STATS"
|
|
671 |
msgstr ""
|
672 |
|
673 |
#: lib/class-wp-smush-ui.php:126
|
674 |
-
#, php-format
|
675 |
msgid "You've smushed %d images in total"
|
676 |
msgstr ""
|
677 |
|
678 |
#: lib/class-wp-smush-ui.php:151
|
679 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:531
|
680 |
-
msgid "
|
681 |
msgstr ""
|
682 |
|
683 |
#: lib/class-wp-smush-ui.php:157
|
@@ -686,42 +604,46 @@ msgid "TOTAL SAVINGS"
|
|
686 |
msgstr ""
|
687 |
|
688 |
#: lib/class-wp-smush-ui.php:173
|
689 |
-
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:553
|
690 |
msgid "ATTACHMENTS SUPER-SMUSHED"
|
691 |
msgstr ""
|
692 |
|
693 |
-
#: lib/class-wp-smush-ui.php:178
|
694 |
-
|
695 |
-
msgid "%sENABLE%s"
|
696 |
msgstr ""
|
697 |
|
698 |
#: lib/class-wp-smush-ui.php:185
|
699 |
msgid "RESIZE SAVINGS"
|
700 |
msgstr ""
|
701 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
702 |
#: lib/class-wp-smush-ui.php:203
|
703 |
msgid "PNG TO JPEG SAVINGS"
|
704 |
msgstr ""
|
705 |
|
706 |
-
#: lib/class-wp-smush-ui.php:
|
707 |
-
#, php-format
|
708 |
msgid "%sTRY PRO FREE%s"
|
709 |
msgstr ""
|
710 |
|
711 |
-
#: lib/class-wp-smush-ui.php:
|
712 |
msgid "BASED ON AVERAGE SAVINGS IF YOU UPGRADE TO PRO"
|
713 |
msgstr ""
|
714 |
|
715 |
-
#: lib/class-wp-smush-ui.php:
|
716 |
msgid "PRO SAVINGS ESTIMATE"
|
717 |
msgstr ""
|
718 |
|
719 |
-
#: lib/class-wp-smush-ui.php:
|
720 |
-
#, php-format
|
721 |
msgid "%sTRY PRO FEATURES FREE%s"
|
722 |
msgstr ""
|
723 |
|
724 |
-
#: lib/class-wp-smush-ui.php:
|
725 |
msgid "ADVANCED SETTINGS"
|
726 |
msgstr ""
|
727 |
|
@@ -730,30 +652,23 @@ msgid "The following image sizes will be optimised by WP Smush:"
|
|
730 |
msgstr ""
|
731 |
|
732 |
#: lib/class-wp-smush-ui.php:480
|
733 |
-
msgid "
|
734 |
msgstr ""
|
735 |
|
736 |
#: lib/class-wp-smush-ui.php:483
|
737 |
-
msgid "
|
738 |
msgstr ""
|
739 |
|
740 |
#: lib/class-wp-smush-ui.php:486
|
741 |
-
|
742 |
-
msgid ""
|
743 |
-
"Currently, your largest thumbnail size is set at %s%dpx wide x %dpx high%s. "
|
744 |
-
"Anything above 2048px in width or height is huge and not recommended."
|
745 |
msgstr ""
|
746 |
|
747 |
#: lib/class-wp-smush-ui.php:487
|
748 |
-
msgid ""
|
749 |
-
"Just to let you know, the width you've entered is less than your largest "
|
750 |
-
"thumbnail and may result in pixelation."
|
751 |
msgstr ""
|
752 |
|
753 |
#: lib/class-wp-smush-ui.php:488
|
754 |
-
msgid ""
|
755 |
-
"Just to let you know, the height you’ve entered is less than your largest "
|
756 |
-
"thumbnail and may result in pixelation."
|
757 |
msgstr ""
|
758 |
|
759 |
#: lib/class-wp-smush-ui.php:617
|
@@ -766,11 +681,7 @@ msgid "No attachments found - Upload some images"
|
|
766 |
msgstr ""
|
767 |
|
768 |
#: lib/class-wp-smush-ui.php:646
|
769 |
-
|
770 |
-
msgid ""
|
771 |
-
"We haven’t found any images in your %smedia library%s yet so there’s no "
|
772 |
-
"smushing to be done! Once you upload images, reload this page and start "
|
773 |
-
"playing!"
|
774 |
msgstr ""
|
775 |
|
776 |
#: lib/class-wp-smush-ui.php:649
|
@@ -778,6 +689,11 @@ msgstr ""
|
|
778 |
msgid "UPLOAD IMAGES"
|
779 |
msgstr ""
|
780 |
|
|
|
|
|
|
|
|
|
|
|
781 |
#: lib/class-wp-smush-ui.php:659
|
782 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:438
|
783 |
msgid "BULK SMUSH NOW"
|
@@ -785,43 +701,34 @@ msgstr ""
|
|
785 |
|
786 |
#: lib/class-wp-smush-ui.php:678
|
787 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:446
|
788 |
-
|
789 |
-
|
790 |
-
msgid_plural "%s, you have %s%s%d%s images%s that need smushing!"
|
791 |
msgstr[0] ""
|
792 |
msgstr[1] ""
|
793 |
|
794 |
#: lib/class-wp-smush-ui.php:680
|
795 |
-
|
796 |
-
msgid "%sUpgrade to Pro%s to bulk smush all your images with one click."
|
797 |
msgstr ""
|
798 |
|
799 |
#: lib/class-wp-smush-ui.php:681
|
800 |
-
msgid "Free users can smush 50 images with each click."
|
801 |
msgstr ""
|
802 |
|
803 |
#: lib/class-wp-smush-ui.php:690
|
804 |
-
msgid ""
|
805 |
-
"Enable Super-smush in the Settings area to get even more savings with almost "
|
806 |
-
"no noticeable quality loss."
|
807 |
msgstr ""
|
808 |
|
809 |
#: lib/class-wp-smush-ui.php:713
|
810 |
-
|
811 |
-
msgid ""
|
812 |
-
"%sBulk smush is currently running.%s You need to keep this page open for the "
|
813 |
-
"process to complete."
|
814 |
msgstr ""
|
815 |
|
816 |
#: lib/class-wp-smush-ui.php:723
|
817 |
-
|
818 |
-
msgid "%s%d%s of %d attachments have been smushed."
|
819 |
msgstr ""
|
820 |
|
821 |
#: lib/class-wp-smush-ui.php:764
|
822 |
-
|
823 |
-
|
824 |
-
msgid_plural "%s, you have %s%s%d%s images%s that need re-compressing!"
|
825 |
msgstr[0] ""
|
826 |
msgstr[1] ""
|
827 |
|
@@ -834,17 +741,11 @@ msgid "Your settings have been updated!"
|
|
834 |
msgstr ""
|
835 |
|
836 |
#: lib/class-wp-smush-ui.php:819
|
837 |
-
|
838 |
-
msgid ""
|
839 |
-
"Automatic smushing is %senabled%s. Newly uploaded images will be "
|
840 |
-
"automagically compressed."
|
841 |
msgstr ""
|
842 |
|
843 |
#: lib/class-wp-smush-ui.php:819
|
844 |
-
|
845 |
-
msgid ""
|
846 |
-
"Automatic smushing is %sdisabled%s. Newly uploaded images will need to be "
|
847 |
-
"manually smushed."
|
848 |
msgstr ""
|
849 |
|
850 |
#: lib/class-wp-smush-ui.php:857
|
@@ -852,9 +753,7 @@ msgid "Thanks for installing Smush. We hope you like it!"
|
|
852 |
msgstr ""
|
853 |
|
854 |
#: lib/class-wp-smush-ui.php:858
|
855 |
-
msgid ""
|
856 |
-
"And hey, if you do, you can now try out Smush Pro for double the smushy "
|
857 |
-
"goodness (benchmarked), entirely for free!"
|
858 |
msgstr ""
|
859 |
|
860 |
#: lib/class-wp-smush-ui.php:859 lib/class-wp-smush-ui.php:863
|
@@ -862,23 +761,15 @@ msgid "Try Smush Pro for Free"
|
|
862 |
msgstr ""
|
863 |
|
864 |
#: lib/class-wp-smush-ui.php:861
|
865 |
-
msgid ""
|
866 |
-
"Thanks for updating Smush. Did you know that you can now try the Smush Pro "
|
867 |
-
"for FREE?!"
|
868 |
msgstr ""
|
869 |
|
870 |
#: lib/class-wp-smush-ui.php:862
|
871 |
-
msgid ""
|
872 |
-
"Yep, Super Smush your images for double the savings, save originals and "
|
873 |
-
"batch Smush thousands of images all at once.... no charge!"
|
874 |
msgstr ""
|
875 |
|
876 |
#: lib/class-wp-smush-ui.php:911
|
877 |
-
|
878 |
-
msgid ""
|
879 |
-
"Did you know WP Smush Pro delivers up to 2x better compression, allows you "
|
880 |
-
"to smush your originals and removes any bulk smushing limits? – %sTry it "
|
881 |
-
"absolutely FREE%s"
|
882 |
msgstr ""
|
883 |
|
884 |
#: lib/class-wp-smush-ui.php:911
|
@@ -890,11 +781,7 @@ msgid "Validating.."
|
|
890 |
msgstr ""
|
891 |
|
892 |
#: lib/class-wp-smush-ui.php:936
|
893 |
-
|
894 |
-
msgid ""
|
895 |
-
"It looks like Smush couldn’t verify your WPMU DEV membership so Pro features "
|
896 |
-
"like Super-Smush may not work correctly. If you think this is an error, run "
|
897 |
-
"a %sre-check%s or get in touch with our %ssupport team%s."
|
898 |
msgstr ""
|
899 |
|
900 |
#: lib/class-wp-smush-ui.php:958
|
@@ -902,138 +789,120 @@ msgid "UPDATE SETTINGS"
|
|
902 |
msgstr ""
|
903 |
|
904 |
#: lib/class-wp-smush-ui.php:988
|
905 |
-
msgid ""
|
906 |
-
"Smush settings were updated, performing a quick scan to check if any of the "
|
907 |
-
"images need to be Smushed again."
|
908 |
msgstr ""
|
909 |
|
910 |
-
#: lib/class-wp-smush.php:
|
911 |
msgid "File path is empty"
|
912 |
msgstr ""
|
913 |
|
914 |
-
#: lib/class-wp-smush.php:
|
915 |
-
#, php-format
|
916 |
msgid "Could not find %s"
|
917 |
msgstr ""
|
918 |
|
919 |
-
#: lib/class-wp-smush.php:
|
920 |
-
#, php-format
|
921 |
msgid "%s is not writable"
|
922 |
msgstr ""
|
923 |
|
924 |
-
#: lib/class-wp-smush.php:
|
925 |
-
#, php-format
|
926 |
msgid "Skipped (%s), image not found. Attachment: %s"
|
927 |
msgstr ""
|
928 |
|
929 |
-
#: lib/class-wp-smush.php:
|
930 |
-
#, php-format
|
931 |
msgid "Skipped (%s), size limit exceeded. Attachment: %s"
|
932 |
msgstr ""
|
933 |
|
934 |
-
#: lib/class-wp-smush.php:
|
935 |
msgid "Unknown API error"
|
936 |
msgstr ""
|
937 |
|
938 |
-
#: lib/class-wp-smush.php:
|
939 |
-
#, php-format
|
940 |
msgid "Error posting to API: %s"
|
941 |
msgstr ""
|
942 |
|
943 |
-
#: lib/class-wp-smush.php:
|
944 |
-
#, php-format
|
945 |
msgid "Error posting to API: %s %s"
|
946 |
msgstr ""
|
947 |
|
948 |
-
#: lib/class-wp-smush.php:
|
949 |
msgid "Smush data corrupted, try again."
|
950 |
msgstr ""
|
951 |
|
952 |
-
#: lib/class-wp-smush.php:
|
953 |
msgid "Image couldn't be smushed"
|
954 |
msgstr ""
|
955 |
|
956 |
-
#: lib/class-wp-smush.php:
|
957 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:193
|
958 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:196
|
959 |
msgid "Already Optimized"
|
960 |
msgstr ""
|
961 |
|
962 |
-
#: lib/class-wp-smush.php:
|
963 |
-
#, php-format
|
964 |
msgid "%d images reduced "
|
965 |
msgstr ""
|
966 |
|
967 |
-
#: lib/class-wp-smush.php:
|
968 |
msgid "Reduced "
|
969 |
msgstr ""
|
970 |
|
971 |
-
#: lib/class-wp-smush.php:
|
972 |
-
#, php-format
|
973 |
msgid "by %s %s"
|
974 |
msgstr ""
|
975 |
|
976 |
-
#: lib/class-wp-smush.php:
|
977 |
-
#, php-format
|
978 |
msgid "<br /> Image Size: %s"
|
979 |
msgstr ""
|
980 |
|
981 |
-
#: lib/class-wp-smush.php:
|
982 |
msgid "Detailed stats for all the image sizes"
|
983 |
msgstr ""
|
984 |
|
985 |
-
#: lib/class-wp-smush.php:
|
986 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:236
|
987 |
msgid "Smush stats"
|
988 |
msgstr ""
|
989 |
|
990 |
-
#: lib/class-wp-smush.php:
|
991 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:249
|
992 |
msgid "Not processed"
|
993 |
msgstr ""
|
994 |
|
995 |
-
#: lib/class-wp-smush.php:
|
996 |
-
|
997 |
-
msgid ""
|
998 |
-
"When you upload an image to WordPress it automatically creates %s thumbnail "
|
999 |
-
"sizes that are commonly used in your pages. WordPress also stores the "
|
1000 |
-
"original full-size image, but because these are not usually embedded on your "
|
1001 |
-
"site we don’t Smush them. Pro users can override this."
|
1002 |
msgstr ""
|
1003 |
|
1004 |
-
#: lib/class-wp-smush.php:
|
1005 |
-
msgid ""
|
1006 |
-
"Image couldn't be smushed as it exceeded the 1Mb size limit, Pro users can "
|
1007 |
-
"smush images with size upto 32Mb."
|
1008 |
msgstr ""
|
1009 |
|
1010 |
-
#: lib/class-wp-smush.php:
|
1011 |
msgid " Skipped"
|
1012 |
msgstr ""
|
1013 |
|
1014 |
-
#: lib/class-wp-smush.php:
|
1015 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:432
|
1016 |
msgid "Image size"
|
1017 |
msgstr ""
|
1018 |
|
1019 |
-
#: lib/class-wp-smush.php:
|
1020 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:433
|
1021 |
msgid "Savings"
|
1022 |
msgstr ""
|
1023 |
|
1024 |
-
#: lib/class-wp-smush.php:
|
1025 |
msgid "Restore original image."
|
1026 |
msgstr ""
|
1027 |
|
1028 |
-
#: lib/class-wp-smush.php:
|
1029 |
msgid "Restore image"
|
1030 |
msgstr ""
|
1031 |
|
1032 |
-
#: lib/class-wp-smush.php:
|
1033 |
msgid "Smush image including original file."
|
1034 |
msgstr ""
|
1035 |
|
1036 |
-
#: lib/class-wp-smush.php:
|
1037 |
msgid "Resmush image"
|
1038 |
msgstr ""
|
1039 |
|
@@ -1042,21 +911,14 @@ msgid "Bulk WP Smush"
|
|
1042 |
msgstr ""
|
1043 |
|
1044 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:425
|
1045 |
-
|
1046 |
-
msgid ""
|
1047 |
-
"We haven’t found any images in your %sgallery%s yet, so there’s no smushing "
|
1048 |
-
"to be done! Once you upload images, reload this page and start playing!"
|
1049 |
msgstr ""
|
1050 |
|
1051 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:462
|
1052 |
-
|
1053 |
-
msgid ""
|
1054 |
-
"Enable Super-smush in the %sSettings%s area to get even more savings with "
|
1055 |
-
"almost no noticeable quality loss."
|
1056 |
msgstr ""
|
1057 |
|
1058 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:477
|
1059 |
-
#, php-format
|
1060 |
msgid "Smush individual images via your %sManage Galleries%s section"
|
1061 |
msgstr ""
|
1062 |
|
@@ -1064,39 +926,39 @@ msgstr ""
|
|
1064 |
msgid "Manage Galleries"
|
1065 |
msgstr ""
|
1066 |
|
|
|
|
|
|
|
|
|
1067 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:561
|
1068 |
-
#, php-format
|
1069 |
msgid "%sDISABLED%s"
|
1070 |
msgstr ""
|
1071 |
|
1072 |
#: lib/nextgen-integration/class-wp-smush-nextgen-bulk.php:31
|
1073 |
-
msgid ""
|
1074 |
-
"Smush request timed out, You can try setting a higher value ( > 60 ) for "
|
1075 |
-
"`WP_SMUSH_API_TIMEOUT`."
|
1076 |
msgstr ""
|
1077 |
|
1078 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:205
|
1079 |
-
#, php-format
|
1080 |
msgid "Reduced by %s ( %01.1f%% )"
|
1081 |
msgstr ""
|
1082 |
|
1083 |
-
#: wp-smush.php:
|
1084 |
msgid "Get Fast"
|
1085 |
msgstr ""
|
1086 |
|
1087 |
-
#: wp-smush.php:
|
1088 |
msgid "WP Smush Free was deactivated. You have WP Smush Pro active!"
|
1089 |
msgstr ""
|
|
|
|
|
|
|
1090 |
|
1091 |
#. Plugin URI of the plugin/theme
|
1092 |
msgid "http://wordpress.org/extend/plugins/wp-smushit/"
|
1093 |
msgstr ""
|
1094 |
|
1095 |
#. Description of the plugin/theme
|
1096 |
-
msgid ""
|
1097 |
-
"Reduce image file sizes, improve performance and boost your SEO using the "
|
1098 |
-
"free <a href=\"https://premium.wpmudev.org/\">WPMU DEV</a> WordPress Smush "
|
1099 |
-
"API."
|
1100 |
msgstr ""
|
1101 |
|
1102 |
#. Author of the plugin/theme
|
1 |
+
# Copyright (C) 2017 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.7\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wp-smushit\n"
|
7 |
+
"POT-Creation-Date: 2017-05-22 04:14:20+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
47 |
msgstr ""
|
48 |
|
49 |
#: extras/dash-notice/wpmudev-dash-notification.php:230
|
50 |
+
msgid "Important updates are available for <strong>%s</strong>. Install the free WPMU DEV Dashboard plugin now for updates and support!"
|
|
|
|
|
|
|
51 |
msgstr ""
|
52 |
|
53 |
#: extras/dash-notice/wpmudev-dash-notification.php:232
|
54 |
+
msgid "<strong>%s</strong> is almost ready - install the free WPMU DEV Dashboard plugin for updates and support!"
|
|
|
|
|
|
|
55 |
msgstr ""
|
56 |
|
57 |
#: extras/dash-notice/wpmudev-dash-notification.php:236
|
58 |
+
msgid "Important updates are available for your WPMU DEV plugins/themes. Install the free WPMU DEV Dashboard plugin now for updates and support!"
|
|
|
|
|
59 |
msgstr ""
|
60 |
|
61 |
#: extras/dash-notice/wpmudev-dash-notification.php:238
|
62 |
+
msgid "Almost ready - install the free WPMU DEV Dashboard plugin for updates and support!"
|
|
|
|
|
63 |
msgstr ""
|
64 |
|
65 |
#: extras/dash-notice/wpmudev-dash-notification.php:244
|
76 |
msgstr ""
|
77 |
|
78 |
#: extras/dash-notice/wpmudev-dash-notification.php:271
|
79 |
+
msgid "Important updates are available for <strong>%s</strong>. Activate the WPMU DEV Dashboard to update now!"
|
|
|
|
|
|
|
80 |
msgstr ""
|
81 |
|
82 |
#: extras/dash-notice/wpmudev-dash-notification.php:273
|
83 |
+
msgid "Just one more step to enable updates and support for <strong>%s</strong>!"
|
|
|
|
|
84 |
msgstr ""
|
85 |
|
86 |
#: extras/dash-notice/wpmudev-dash-notification.php:277
|
87 |
+
msgid "Important updates are available for your WPMU DEV plugins/themes. Activate the WPMU DEV Dashboard to update now!"
|
|
|
|
|
88 |
msgstr ""
|
89 |
|
90 |
#: extras/dash-notice/wpmudev-dash-notification.php:279
|
91 |
+
msgid "Just one more step - activate the WPMU DEV Dashboard plugin and you're all done!"
|
|
|
|
|
92 |
msgstr ""
|
93 |
|
94 |
#: extras/dash-notice/wpmudev-dash-notification.php:285
|
100 |
msgstr ""
|
101 |
|
102 |
#: extras/dash-notice/wpmudev-dash-notification.php:1131
|
|
|
103 |
msgid "%s changelog"
|
104 |
msgstr ""
|
105 |
|
112 |
msgstr ""
|
113 |
|
114 |
#: extras/dash-notice/wpmudev-dash-notification.php:1184
|
|
|
115 |
msgid "Version %s"
|
116 |
msgstr ""
|
117 |
|
124 |
msgstr ""
|
125 |
|
126 |
#: extras/free-dashboard/module.php:377
|
127 |
+
msgid "We're happy that you've chosen to install %s! Are you interested in how to make the most of this plugin? How would you like a quick 5 day email crash course with actionable advice on building your membership site? Only the info you want, no subscription!"
|
|
|
|
|
|
|
|
|
|
|
128 |
msgstr ""
|
129 |
|
130 |
#: extras/free-dashboard/module.php:392 extras/free-dashboard/module.php:427
|
136 |
msgstr ""
|
137 |
|
138 |
#: extras/free-dashboard/module.php:412
|
139 |
+
msgid "Hey %s, you've been using %s for a while now, and we hope you're happy with it."
|
|
|
|
|
|
|
140 |
msgstr ""
|
141 |
|
142 |
#: extras/free-dashboard/module.php:412
|
143 |
+
msgid "We've spent countless hours developing this free plugin for you, and we would really appreciate it if you dropped us a quick rating!"
|
|
|
|
|
144 |
msgstr ""
|
145 |
|
146 |
#: extras/free-dashboard/module.php:430
|
|
|
147 |
msgid "Rate %s"
|
148 |
msgstr ""
|
149 |
|
150 |
+
#: lib/class-wp-smush-admin.php:215
|
151 |
msgid "Enable Network wide settings"
|
152 |
msgstr ""
|
153 |
|
154 |
+
#: lib/class-wp-smush-admin.php:216
|
155 |
msgid "If disabled sub sites can override the individual Smush settings."
|
156 |
msgstr ""
|
157 |
|
158 |
+
#: lib/class-wp-smush-admin.php:219
|
159 |
msgid "Automatically smush my images on upload"
|
160 |
msgstr ""
|
161 |
|
162 |
+
#: lib/class-wp-smush-admin.php:220
|
163 |
+
msgid "When you upload images to the media library, we’ll automatically optimize them."
|
|
|
|
|
164 |
msgstr ""
|
165 |
|
166 |
+
#: lib/class-wp-smush-admin.php:223
|
167 |
msgid "Preserve image EXIF data"
|
168 |
msgstr ""
|
169 |
|
170 |
+
#: lib/class-wp-smush-admin.php:224
|
171 |
+
msgid "EXIF data stores camera settings, focal length, date, time and location information in image files. EXIF data makes image files larger but if you are a photographer you may want to preserve this information."
|
|
|
|
|
|
|
172 |
msgstr ""
|
173 |
|
174 |
+
#: lib/class-wp-smush-admin.php:227
|
175 |
msgid "Resize original images"
|
176 |
msgstr ""
|
177 |
|
178 |
+
#: lib/class-wp-smush-admin.php:228
|
179 |
+
msgid "Save a ton of space by not storing over-sized images on your server. Set image maximum width and height and large images will be automatically scaled before being added to the media library."
|
|
|
|
|
|
|
180 |
msgstr ""
|
181 |
|
182 |
+
#: lib/class-wp-smush-admin.php:231
|
183 |
msgid "Super-smush my images"
|
184 |
msgstr ""
|
185 |
|
186 |
+
#: lib/class-wp-smush-admin.php:232
|
187 |
+
msgid "Compress images up to 2x more than regular smush with almost no visible drop in quality."
|
|
|
|
|
188 |
msgstr ""
|
189 |
|
190 |
+
#: lib/class-wp-smush-admin.php:235
|
191 |
msgid "Include my original full-size images"
|
192 |
msgstr ""
|
193 |
|
194 |
+
#: lib/class-wp-smush-admin.php:236
|
195 |
+
msgid "WordPress crops and resizes every image you upload for embedding on your site. By default, Smush only compresses these cropped and resized images, not your original full-size images. To save space on your server, activate this setting to smush your original images, too. Note: This doesn’t usually improve page speed."
|
|
|
|
|
|
|
|
|
|
|
196 |
msgstr ""
|
197 |
|
198 |
+
#: lib/class-wp-smush-admin.php:239
|
199 |
msgid "Make a copy of my original images"
|
200 |
msgstr ""
|
201 |
|
202 |
+
#: lib/class-wp-smush-admin.php:240
|
203 |
+
msgid "Save your original full-size images so you can restore them at any point. Note: Activating this setting will significantly increase the size of your uploads folder by nearly twice as much."
|
|
|
|
|
|
|
204 |
msgstr ""
|
205 |
|
206 |
+
#: lib/class-wp-smush-admin.php:243
|
207 |
msgid "Convert PNG to JPEG (lossy)"
|
208 |
msgstr ""
|
209 |
|
210 |
+
#: lib/class-wp-smush-admin.php:244
|
211 |
+
msgid "When you compress a PNG file, Smush will check if converting the file to JPEG will further reduce its size. %s Note: PNGs with transparency will be ignored and Smush will only convert the file format if it results in a smaller file size. This will change the file’s name and extension, and any hard-coded URLs will need to be updated.%s"
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
msgstr ""
|
213 |
|
214 |
+
#: lib/class-wp-smush-admin.php:272 lib/class-wp-smush-ui.php:817
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:70
|
216 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:89
|
217 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:91
|
218 |
msgid "WP Smush"
|
219 |
msgstr ""
|
220 |
|
221 |
+
#: lib/class-wp-smush-admin.php:400 lib/class-wp-smush.php:1051
|
222 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:158
|
223 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:275
|
224 |
msgid "Super-Smush"
|
225 |
msgstr ""
|
226 |
|
227 |
+
#: lib/class-wp-smush-admin.php:401
|
228 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:159
|
229 |
msgid "Smush Now"
|
230 |
msgstr ""
|
231 |
|
232 |
+
#: lib/class-wp-smush-admin.php:402
|
233 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:160
|
234 |
msgid "{{errors}} image(s) were skipped due to an error."
|
235 |
msgstr ""
|
236 |
|
237 |
+
#: lib/class-wp-smush-admin.php:403
|
238 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:161
|
239 |
msgid "All images are fully optimised."
|
240 |
msgstr ""
|
241 |
|
242 |
+
#: lib/class-wp-smush-admin.php:404
|
243 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:162
|
244 |
msgid "Restoring image.."
|
245 |
msgstr ""
|
246 |
|
247 |
+
#: lib/class-wp-smush-admin.php:405
|
248 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:163
|
249 |
msgid "Smushing image.."
|
250 |
msgstr ""
|
251 |
|
252 |
+
#: lib/class-wp-smush-admin.php:406
|
253 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:164
|
254 |
msgid "Checking images.."
|
255 |
msgstr ""
|
256 |
|
257 |
+
#: lib/class-wp-smush-admin.php:407
|
258 |
+
msgid "We successfully verified your membership, all the Pro features should work completely. "
|
|
|
|
|
259 |
msgstr ""
|
260 |
|
261 |
+
#: lib/class-wp-smush-admin.php:408
|
262 |
msgid "Your membership couldn't be verified."
|
263 |
msgstr ""
|
264 |
|
265 |
+
#: lib/class-wp-smush-admin.php:409
|
266 |
msgid "Missing file path."
|
267 |
msgstr ""
|
268 |
|
269 |
+
#: lib/class-wp-smush-admin.php:411
|
270 |
msgid "image could not be smushed."
|
271 |
msgstr ""
|
272 |
|
273 |
+
#: lib/class-wp-smush-admin.php:412
|
274 |
msgid "images could not be smushed."
|
275 |
msgstr ""
|
276 |
|
277 |
+
#: lib/class-wp-smush-admin.php:413
|
278 |
msgid "Already Optimised"
|
279 |
msgstr ""
|
280 |
|
281 |
+
#: lib/class-wp-smush-admin.php:414
|
282 |
msgid "Ajax Error"
|
283 |
msgstr ""
|
284 |
|
285 |
+
#: lib/class-wp-smush-admin.php:415 lib/class-wp-smush-admin.php:416
|
286 |
+
#: lib/class-wp-smush-admin.php:1240
|
287 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:340
|
288 |
msgid "All Done!"
|
289 |
msgstr ""
|
290 |
|
291 |
+
#: lib/class-wp-smush-admin.php:666
|
292 |
+
msgid "Smush request timed out, You can try setting a higher value for `WP_SMUSH_API_TIMEOUT`."
|
|
|
|
|
293 |
msgstr ""
|
294 |
|
295 |
+
#: lib/class-wp-smush-admin.php:683 lib/class-wp-smush-dir.php:1157
|
296 |
+
#: lib/class-wp-smush-dir.php:1294
|
297 |
msgid "You've smushed %d images in total."
|
298 |
msgstr ""
|
299 |
|
300 |
+
#: lib/class-wp-smush-admin.php:723 lib/class-wp-smush-nextgen.php:425
|
301 |
msgid "You don't have permission to work with uploaded files."
|
302 |
msgstr ""
|
303 |
|
304 |
+
#: lib/class-wp-smush-admin.php:727 lib/class-wp-smush-nextgen.php:429
|
305 |
msgid "No attachment ID was provided."
|
306 |
msgstr ""
|
307 |
|
308 |
+
#: lib/class-wp-smush-admin.php:739
|
309 |
msgid "Attachment Skipped - Check `wp_smush_image` filter."
|
310 |
msgstr ""
|
311 |
|
312 |
+
#: lib/class-wp-smush-admin.php:919
|
|
|
313 |
msgid "<strong>%d of %d images</strong> were sent for smushing:"
|
314 |
msgstr ""
|
315 |
|
316 |
+
#: lib/class-wp-smush-admin.php:1233 lib/class-wp-smush-admin.php:1246
|
317 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:336
|
318 |
msgid "Bulk Smush Now"
|
319 |
msgstr ""
|
320 |
|
321 |
+
#: lib/class-wp-smush-admin.php:1268 lib/class-wp-smush.php:1057
|
322 |
msgid "Smushing in progress.."
|
323 |
msgstr ""
|
324 |
|
325 |
+
#: lib/class-wp-smush-admin.php:1274 lib/class-wp-smush.php:1076
|
326 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:255
|
327 |
msgid "Smush Now!"
|
328 |
msgstr ""
|
329 |
|
330 |
+
#: lib/class-wp-smush-admin.php:1295
|
331 |
msgid "Settings"
|
332 |
msgstr ""
|
333 |
|
334 |
+
#: lib/class-wp-smush-admin.php:1441
|
335 |
msgid "Image not smushed, fields empty."
|
336 |
msgstr ""
|
337 |
|
338 |
+
#: lib/class-wp-smush-admin.php:1448 lib/class-wp-smush-nextgen.php:612
|
339 |
+
msgid "Image couldn't be smushed as the nonce verification failed, try reloading the page."
|
|
|
|
|
340 |
msgstr ""
|
341 |
|
342 |
+
#: lib/class-wp-smush-admin.php:1465
|
343 |
msgid "Unable to smush image"
|
344 |
msgstr ""
|
345 |
|
346 |
+
#: lib/class-wp-smush-admin.php:1490
|
347 |
+
msgid "We haven’t found any images in your media library yet so there’s no smushing to be done!"
|
|
|
|
|
348 |
msgstr ""
|
349 |
|
350 |
+
#: lib/class-wp-smush-admin.php:1506
|
351 |
msgid "Yay! All images are optimised as per your current settings."
|
352 |
msgstr ""
|
353 |
|
354 |
+
#: lib/class-wp-smush-admin.php:1680 lib/class-wp-smush-ui.php:792
|
|
|
355 |
msgid "You have images that need smushing. %sBulk smush now!%s"
|
356 |
msgstr ""
|
357 |
|
358 |
+
#: lib/class-wp-smush-admin.php:2021
|
359 |
msgid "Review your setting now."
|
360 |
msgstr ""
|
361 |
|
362 |
+
#: lib/class-wp-smush-admin.php:2022 lib/class-wp-smush-dir.php:249
|
363 |
+
#: lib/class-wp-smush-dir.php:275 lib/class-wp-smush-ui.php:680
|
364 |
#: lib/class-wp-smush-ui.php:817
|
365 |
msgid "WP Smush Pro"
|
366 |
msgstr ""
|
367 |
|
368 |
+
#: lib/class-wp-smush-admin.php:2023
|
369 |
+
msgid "Welcome to the newest version of WP Smush! In this update we've added the ability to bulk smush images in directories outside your uploads folder."
|
|
|
|
|
370 |
msgstr ""
|
371 |
|
372 |
+
#: lib/class-wp-smush-admin.php:2026
|
373 |
+
msgid " And as a multisite user, you can manage %sSmush settings%s globally across all sites!"
|
|
|
|
|
|
|
374 |
msgstr ""
|
375 |
|
376 |
+
#: lib/class-wp-smush-admin.php:2029
|
|
|
377 |
msgid " %sFind out more here >>%s"
|
378 |
msgstr ""
|
379 |
|
380 |
+
#: lib/class-wp-smush-backup.php:144 lib/class-wp-smush-nextgen.php:512
|
381 |
msgid "Error in processing restore action, Fields empty."
|
382 |
msgstr ""
|
383 |
|
384 |
+
#: lib/class-wp-smush-backup.php:151 lib/class-wp-smush-nextgen.php:519
|
385 |
msgid "Image not restored, Nonce verification failed."
|
386 |
msgstr ""
|
387 |
|
388 |
+
#: lib/class-wp-smush-backup.php:278 lib/class-wp-smush-nextgen.php:594
|
389 |
msgid "Unable to restore image"
|
390 |
msgstr ""
|
391 |
|
392 |
+
#: lib/class-wp-smush-dir.php:88
|
393 |
msgid "DIRECTORY SMUSH SAVINGS"
|
394 |
msgstr ""
|
395 |
|
396 |
+
#: lib/class-wp-smush-dir.php:90
|
397 |
msgid "Updating Stats"
|
398 |
msgstr ""
|
399 |
|
400 |
+
#: lib/class-wp-smush-dir.php:104
|
401 |
+
msgid "SMUSH DIRECTORY"
|
402 |
+
msgstr ""
|
403 |
+
|
404 |
+
#: lib/class-wp-smush-dir.php:219
|
405 |
msgid "RESUME LAST SCAN"
|
406 |
msgstr ""
|
407 |
|
408 |
+
#: lib/class-wp-smush-dir.php:251
|
409 |
msgid "DIRECTORY SMUSH"
|
410 |
msgstr ""
|
411 |
|
412 |
+
#: lib/class-wp-smush-dir.php:256
|
413 |
+
msgid "In addition to smushing your media uploads, you may want to also smush images living outside your uploads directory. Simply add any directories you wish to smush and bulk smush away!"
|
|
|
|
|
|
|
414 |
msgstr ""
|
415 |
|
416 |
+
#: lib/class-wp-smush-dir.php:269
|
417 |
+
msgid "All images for the selected directory are smushed and up to date. Awesome!"
|
|
|
418 |
msgstr ""
|
419 |
|
420 |
+
#: lib/class-wp-smush-dir.php:272
|
421 |
+
msgid "%s/%s image(s) were successfully smushed, however %s image(s) could not be smushed due to an error."
|
|
|
|
|
|
|
422 |
msgstr ""
|
423 |
|
424 |
+
#: lib/class-wp-smush-dir.php:275
|
425 |
+
msgid " %sUpgrade to pro%s to bulk smush all your directory images with one click. Free users can smush 50 images with each click."
|
|
|
|
|
|
|
426 |
msgstr ""
|
427 |
|
428 |
+
#: lib/class-wp-smush-dir.php:279 lib/class-wp-smush-ui.php:90
|
429 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:482
|
430 |
msgid "BULK SMUSH"
|
431 |
msgstr ""
|
432 |
|
433 |
+
#: lib/class-wp-smush-dir.php:281
|
434 |
msgid "Click to stop the directory smushing process."
|
435 |
msgstr ""
|
436 |
|
437 |
+
#: lib/class-wp-smush-dir.php:282 lib/class-wp-smush-ui.php:728
|
438 |
msgid "CANCEL"
|
439 |
msgstr ""
|
440 |
|
441 |
+
#: lib/class-wp-smush-dir.php:290
|
442 |
msgid "CHOOSE DIRECTORY"
|
443 |
msgstr ""
|
444 |
|
445 |
+
#: lib/class-wp-smush-dir.php:299
|
446 |
msgid "Directory list"
|
447 |
msgstr ""
|
448 |
|
449 |
+
#: lib/class-wp-smush-dir.php:302
|
450 |
msgid "Choose the folder you wish to smush."
|
451 |
msgstr ""
|
452 |
|
453 |
+
#: lib/class-wp-smush-dir.php:306
|
454 |
+
msgid "Smush will also include any images in sub folders of your selected folder."
|
|
|
455 |
msgstr ""
|
456 |
|
457 |
+
#: lib/class-wp-smush-dir.php:309
|
458 |
msgid "ADD DIRECTORY"
|
459 |
msgstr ""
|
460 |
|
461 |
+
#: lib/class-wp-smush-dir.php:472
|
462 |
msgid "Exclude directory from Smush List"
|
463 |
msgstr ""
|
464 |
|
465 |
+
#: lib/class-wp-smush-dir.php:606
|
466 |
msgid "We could not find any images in the selected directory."
|
467 |
msgstr ""
|
468 |
|
469 |
+
#: lib/class-wp-smush-dir.php:916
|
|
|
470 |
msgid "%d images"
|
471 |
msgstr ""
|
472 |
|
473 |
+
#: lib/class-wp-smush-dir.php:945
|
474 |
msgid "Waiting.."
|
475 |
msgstr ""
|
476 |
|
477 |
+
#: lib/class-wp-smush-dir.php:1067
|
478 |
msgid "Incorrect image id"
|
479 |
msgstr ""
|
480 |
|
481 |
+
#: lib/class-wp-smush-dir.php:1101
|
482 |
msgid "Could not find image id in last scanned images"
|
483 |
msgstr ""
|
484 |
|
485 |
+
#: lib/class-wp-smush-dir.php:1114
|
486 |
msgid "Image couldn't be optimised"
|
487 |
msgstr ""
|
488 |
|
489 |
+
#: lib/class-wp-smush-dir.php:1234
|
490 |
+
msgid "We were unable to retrieve the image list from last scan, please continue with a latest scan"
|
|
|
|
|
491 |
msgstr ""
|
492 |
|
493 |
+
#: lib/class-wp-smush-nextgen.php:66
|
494 |
+
msgid "Enable NextGen Gallery integration"
|
495 |
+
msgstr ""
|
496 |
+
|
497 |
+
#: lib/class-wp-smush-nextgen.php:67
|
498 |
+
msgid "Allow smushing images directly through NextGen Gallery settings."
|
499 |
+
msgstr ""
|
500 |
+
|
501 |
+
#: lib/class-wp-smush-nextgen.php:370
|
502 |
+
msgid "We couldn't find the metadata for the image, possibly the image has been deleted."
|
503 |
msgstr ""
|
504 |
|
505 |
+
#: lib/class-wp-smush-nextgen.php:605
|
506 |
msgid "We couldn't process the image, fields empty."
|
507 |
msgstr ""
|
508 |
|
509 |
+
#: lib/class-wp-smush-nextgen.php:629
|
|
|
510 |
msgid "Unable to smush image, %s"
|
511 |
msgstr ""
|
512 |
|
513 |
+
#: lib/class-wp-smush-s3.php:56
|
514 |
+
msgid "Amazon S3 support"
|
|
|
|
|
|
|
515 |
msgstr ""
|
516 |
|
517 |
+
#: lib/class-wp-smush-s3.php:57
|
518 |
+
msgid "Optimise your images stored on Amazon S3. This feature uses the %sWP Offload S3%s plugin and is needed if the option %sRemove Files From Server%s is enabled. Images will be smushed as per your current settings."
|
|
|
|
|
|
|
519 |
msgstr ""
|
520 |
|
521 |
+
#: lib/class-wp-smush-s3.php:101
|
522 |
+
msgid "We are having trouble interacting with WP S3 Offload, make sure the plugin is activated. Or you can %sreport a bug%s."
|
523 |
+
msgstr ""
|
524 |
+
|
525 |
+
#: lib/class-wp-smush-s3.php:108
|
526 |
+
msgid "It seems you haven't finished setting up WP S3 Offload yet, %sConfigure%s it now to enable Amazon S3 support."
|
527 |
+
msgstr ""
|
528 |
+
|
529 |
+
#: lib/class-wp-smush-share.php:24
|
530 |
+
msgid "%s, you've smushed %d images and saved %s in total. Help your friends save bandwidth easily, and help me in my quest to Smush the internet!"
|
531 |
+
msgstr ""
|
532 |
+
|
533 |
+
#: lib/class-wp-smush-share.php:25
|
534 |
+
msgid "I saved %s on my site with WP Smush ( %s ) - wanna make your website smaller and faster?"
|
535 |
+
msgstr ""
|
536 |
+
|
537 |
+
#: lib/class-wp-smush-share.php:33
|
538 |
msgid "TWEET"
|
539 |
msgstr ""
|
540 |
|
541 |
+
#: lib/class-wp-smush-share.php:37
|
542 |
msgid "SHARE"
|
543 |
msgstr ""
|
544 |
|
545 |
+
#: lib/class-wp-smush-share.php:41
|
546 |
msgid "WhatsApp"
|
547 |
msgstr ""
|
548 |
|
559 |
msgstr ""
|
560 |
|
561 |
#: lib/class-wp-smush-ui.php:71
|
562 |
+
msgid "You've just installed %3$s, the most popular image compression plugin for WordPress! %1$sChoose your desired settings%2$s and get smushing!"
|
|
|
|
|
|
|
563 |
msgstr ""
|
564 |
|
565 |
#: lib/class-wp-smush-ui.php:85
|
|
|
566 |
msgid "Smush individual images via your %sMedia Library%s"
|
567 |
msgstr ""
|
568 |
|
576 |
|
577 |
#: lib/class-wp-smush-ui.php:122
|
578 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:502
|
579 |
+
msgid "Lets you check if any images can be further optimised. Useful after changing settings."
|
|
|
|
|
580 |
msgstr ""
|
581 |
|
582 |
#: lib/class-wp-smush-ui.php:122
|
590 |
msgstr ""
|
591 |
|
592 |
#: lib/class-wp-smush-ui.php:126
|
|
|
593 |
msgid "You've smushed %d images in total"
|
594 |
msgstr ""
|
595 |
|
596 |
#: lib/class-wp-smush-ui.php:151
|
597 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:531
|
598 |
+
msgid "IMAGES SMUSHED"
|
599 |
msgstr ""
|
600 |
|
601 |
#: lib/class-wp-smush-ui.php:157
|
604 |
msgstr ""
|
605 |
|
606 |
#: lib/class-wp-smush-ui.php:173
|
|
|
607 |
msgid "ATTACHMENTS SUPER-SMUSHED"
|
608 |
msgstr ""
|
609 |
|
610 |
+
#: lib/class-wp-smush-ui.php:178
|
611 |
+
msgid "%sENABLE SUPER-SMUSH%s"
|
|
|
612 |
msgstr ""
|
613 |
|
614 |
#: lib/class-wp-smush-ui.php:185
|
615 |
msgid "RESIZE SAVINGS"
|
616 |
msgstr ""
|
617 |
|
618 |
+
#: lib/class-wp-smush-ui.php:192
|
619 |
+
msgid "%sENABLE IMAGE RESIZING%s"
|
620 |
+
msgstr ""
|
621 |
+
|
622 |
+
#: lib/class-wp-smush-ui.php:194
|
623 |
+
msgid "%sNO RESIZE SAVINGS AVAILABLE%s"
|
624 |
+
msgstr ""
|
625 |
+
|
626 |
#: lib/class-wp-smush-ui.php:203
|
627 |
msgid "PNG TO JPEG SAVINGS"
|
628 |
msgstr ""
|
629 |
|
630 |
+
#: lib/class-wp-smush-ui.php:229
|
|
|
631 |
msgid "%sTRY PRO FREE%s"
|
632 |
msgstr ""
|
633 |
|
634 |
+
#: lib/class-wp-smush-ui.php:233
|
635 |
msgid "BASED ON AVERAGE SAVINGS IF YOU UPGRADE TO PRO"
|
636 |
msgstr ""
|
637 |
|
638 |
+
#: lib/class-wp-smush-ui.php:234
|
639 |
msgid "PRO SAVINGS ESTIMATE"
|
640 |
msgstr ""
|
641 |
|
642 |
+
#: lib/class-wp-smush-ui.php:278
|
|
|
643 |
msgid "%sTRY PRO FEATURES FREE%s"
|
644 |
msgstr ""
|
645 |
|
646 |
+
#: lib/class-wp-smush-ui.php:280
|
647 |
msgid "ADVANCED SETTINGS"
|
648 |
msgstr ""
|
649 |
|
652 |
msgstr ""
|
653 |
|
654 |
#: lib/class-wp-smush-ui.php:480
|
655 |
+
msgid "Max width"
|
656 |
msgstr ""
|
657 |
|
658 |
#: lib/class-wp-smush-ui.php:483
|
659 |
+
msgid "Max height"
|
660 |
msgstr ""
|
661 |
|
662 |
#: lib/class-wp-smush-ui.php:486
|
663 |
+
msgid "Currently, your largest image size is set at %s%dpx wide x %dpx high%s."
|
|
|
|
|
|
|
664 |
msgstr ""
|
665 |
|
666 |
#: lib/class-wp-smush-ui.php:487
|
667 |
+
msgid "Just to let you know, the width you've entered is less than your largest image and may result in pixelation."
|
|
|
|
|
668 |
msgstr ""
|
669 |
|
670 |
#: lib/class-wp-smush-ui.php:488
|
671 |
+
msgid "Just to let you know, the height you’ve entered is less than your largest image and may result in pixelation."
|
|
|
|
|
672 |
msgstr ""
|
673 |
|
674 |
#: lib/class-wp-smush-ui.php:617
|
681 |
msgstr ""
|
682 |
|
683 |
#: lib/class-wp-smush-ui.php:646
|
684 |
+
msgid "We haven’t found any images in your %smedia library%s yet so there’s no smushing to be done! Once you upload images, reload this page and start playing!"
|
|
|
|
|
|
|
|
|
685 |
msgstr ""
|
686 |
|
687 |
#: lib/class-wp-smush-ui.php:649
|
689 |
msgid "UPLOAD IMAGES"
|
690 |
msgstr ""
|
691 |
|
692 |
+
#: lib/class-wp-smush-ui.php:654
|
693 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:433
|
694 |
+
msgid "All images are smushed and up to date. Awesome!"
|
695 |
+
msgstr ""
|
696 |
+
|
697 |
#: lib/class-wp-smush-ui.php:659
|
698 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:438
|
699 |
msgid "BULK SMUSH NOW"
|
701 |
|
702 |
#: lib/class-wp-smush-ui.php:678
|
703 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:446
|
704 |
+
msgid "%s, you have %s%s%d%s attachment%s that needs smushing!"
|
705 |
+
msgid_plural "%s, you have %s%s%d%s attachments%s that need smushing!"
|
|
|
706 |
msgstr[0] ""
|
707 |
msgstr[1] ""
|
708 |
|
709 |
#: lib/class-wp-smush-ui.php:680
|
710 |
+
msgid " %sUpgrade to Pro%s to bulk smush all your images with one click."
|
|
|
711 |
msgstr ""
|
712 |
|
713 |
#: lib/class-wp-smush-ui.php:681
|
714 |
+
msgid " Free users can smush 50 images with each click."
|
715 |
msgstr ""
|
716 |
|
717 |
#: lib/class-wp-smush-ui.php:690
|
718 |
+
msgid "Enable Super-smush in the Settings area to get even more savings with almost no noticeable quality loss."
|
|
|
|
|
719 |
msgstr ""
|
720 |
|
721 |
#: lib/class-wp-smush-ui.php:713
|
722 |
+
msgid "%sBulk smush is currently running.%s You need to keep this page open for the process to complete."
|
|
|
|
|
|
|
723 |
msgstr ""
|
724 |
|
725 |
#: lib/class-wp-smush-ui.php:723
|
726 |
+
msgid "%s%d%s of your media attachments has been smushed."
|
|
|
727 |
msgstr ""
|
728 |
|
729 |
#: lib/class-wp-smush-ui.php:764
|
730 |
+
msgid "%s, you have %s%s%d%s attachment%s that needs re-compressing!"
|
731 |
+
msgid_plural "%s, you have %s%s%d%s attachments%s that need re-compressing!"
|
|
|
732 |
msgstr[0] ""
|
733 |
msgstr[1] ""
|
734 |
|
741 |
msgstr ""
|
742 |
|
743 |
#: lib/class-wp-smush-ui.php:819
|
744 |
+
msgid "Automatic smushing is %senabled%s. Newly uploaded images will be automagically compressed."
|
|
|
|
|
|
|
745 |
msgstr ""
|
746 |
|
747 |
#: lib/class-wp-smush-ui.php:819
|
748 |
+
msgid "Automatic smushing is %sdisabled%s. Newly uploaded images will need to be manually smushed."
|
|
|
|
|
|
|
749 |
msgstr ""
|
750 |
|
751 |
#: lib/class-wp-smush-ui.php:857
|
753 |
msgstr ""
|
754 |
|
755 |
#: lib/class-wp-smush-ui.php:858
|
756 |
+
msgid "And hey, if you do, you can now try out Smush Pro for double the smushy goodness (benchmarked), entirely for free!"
|
|
|
|
|
757 |
msgstr ""
|
758 |
|
759 |
#: lib/class-wp-smush-ui.php:859 lib/class-wp-smush-ui.php:863
|
761 |
msgstr ""
|
762 |
|
763 |
#: lib/class-wp-smush-ui.php:861
|
764 |
+
msgid "Thanks for updating Smush. Did you know that you can now try the Smush Pro for FREE?!"
|
|
|
|
|
765 |
msgstr ""
|
766 |
|
767 |
#: lib/class-wp-smush-ui.php:862
|
768 |
+
msgid "Yep, Super Smush your images for double the savings, save originals and batch Smush thousands of images all at once.... no charge!"
|
|
|
|
|
769 |
msgstr ""
|
770 |
|
771 |
#: lib/class-wp-smush-ui.php:911
|
772 |
+
msgid "Did you know WP Smush Pro delivers up to 2x better compression, allows you to smush your originals and removes any bulk smushing limits? – %sTry it absolutely FREE%s"
|
|
|
|
|
|
|
|
|
773 |
msgstr ""
|
774 |
|
775 |
#: lib/class-wp-smush-ui.php:911
|
781 |
msgstr ""
|
782 |
|
783 |
#: lib/class-wp-smush-ui.php:936
|
784 |
+
msgid "It looks like Smush couldn’t verify your WPMU DEV membership so Pro features like Super-Smush may not work correctly. If you think this is an error, run a %sre-check%s or get in touch with our %ssupport team%s."
|
|
|
|
|
|
|
|
|
785 |
msgstr ""
|
786 |
|
787 |
#: lib/class-wp-smush-ui.php:958
|
789 |
msgstr ""
|
790 |
|
791 |
#: lib/class-wp-smush-ui.php:988
|
792 |
+
msgid "Smush settings were updated, performing a quick scan to check if any of the images need to be Smushed again."
|
|
|
|
|
793 |
msgstr ""
|
794 |
|
795 |
+
#: lib/class-wp-smush.php:202
|
796 |
msgid "File path is empty"
|
797 |
msgstr ""
|
798 |
|
799 |
+
#: lib/class-wp-smush.php:205
|
|
|
800 |
msgid "Could not find %s"
|
801 |
msgstr ""
|
802 |
|
803 |
+
#: lib/class-wp-smush.php:208
|
|
|
804 |
msgid "%s is not writable"
|
805 |
msgstr ""
|
806 |
|
807 |
+
#: lib/class-wp-smush.php:218
|
|
|
808 |
msgid "Skipped (%s), image not found. Attachment: %s"
|
809 |
msgstr ""
|
810 |
|
811 |
+
#: lib/class-wp-smush.php:221
|
|
|
812 |
msgid "Skipped (%s), size limit exceeded. Attachment: %s"
|
813 |
msgstr ""
|
814 |
|
815 |
+
#: lib/class-wp-smush.php:239
|
816 |
msgid "Unknown API error"
|
817 |
msgstr ""
|
818 |
|
819 |
+
#: lib/class-wp-smush.php:704
|
|
|
820 |
msgid "Error posting to API: %s"
|
821 |
msgstr ""
|
822 |
|
823 |
+
#: lib/class-wp-smush.php:710
|
|
|
824 |
msgid "Error posting to API: %s %s"
|
825 |
msgstr ""
|
826 |
|
827 |
+
#: lib/class-wp-smush.php:727
|
828 |
msgid "Smush data corrupted, try again."
|
829 |
msgstr ""
|
830 |
|
831 |
+
#: lib/class-wp-smush.php:747
|
832 |
msgid "Image couldn't be smushed"
|
833 |
msgstr ""
|
834 |
|
835 |
+
#: lib/class-wp-smush.php:967 lib/class-wp-smush.php:971
|
836 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:193
|
837 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:196
|
838 |
msgid "Already Optimized"
|
839 |
msgstr ""
|
840 |
|
841 |
+
#: lib/class-wp-smush.php:980
|
|
|
842 |
msgid "%d images reduced "
|
843 |
msgstr ""
|
844 |
|
845 |
+
#: lib/class-wp-smush.php:980
|
846 |
msgid "Reduced "
|
847 |
msgstr ""
|
848 |
|
849 |
+
#: lib/class-wp-smush.php:984
|
|
|
850 |
msgid "by %s %s"
|
851 |
msgstr ""
|
852 |
|
853 |
+
#: lib/class-wp-smush.php:990
|
|
|
854 |
msgid "<br /> Image Size: %s"
|
855 |
msgstr ""
|
856 |
|
857 |
+
#: lib/class-wp-smush.php:1026
|
858 |
msgid "Detailed stats for all the image sizes"
|
859 |
msgstr ""
|
860 |
|
861 |
+
#: lib/class-wp-smush.php:1026
|
862 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:236
|
863 |
msgid "Smush stats"
|
864 |
msgstr ""
|
865 |
|
866 |
+
#: lib/class-wp-smush.php:1070
|
867 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:249
|
868 |
msgid "Not processed"
|
869 |
msgstr ""
|
870 |
|
871 |
+
#: lib/class-wp-smush.php:1384
|
872 |
+
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."
|
|
|
|
|
|
|
|
|
|
|
873 |
msgstr ""
|
874 |
|
875 |
+
#: lib/class-wp-smush.php:1387
|
876 |
+
msgid "Image couldn't be smushed as it exceeded the 1Mb size limit, Pro users can smush images with size upto 32Mb."
|
|
|
|
|
877 |
msgstr ""
|
878 |
|
879 |
+
#: lib/class-wp-smush.php:1389
|
880 |
msgid " Skipped"
|
881 |
msgstr ""
|
882 |
|
883 |
+
#: lib/class-wp-smush.php:1411
|
884 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:432
|
885 |
msgid "Image size"
|
886 |
msgstr ""
|
887 |
|
888 |
+
#: lib/class-wp-smush.php:1412
|
889 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:433
|
890 |
msgid "Savings"
|
891 |
msgstr ""
|
892 |
|
893 |
+
#: lib/class-wp-smush.php:1658
|
894 |
msgid "Restore original image."
|
895 |
msgstr ""
|
896 |
|
897 |
+
#: lib/class-wp-smush.php:1658
|
898 |
msgid "Restore image"
|
899 |
msgstr ""
|
900 |
|
901 |
+
#: lib/class-wp-smush.php:1706
|
902 |
msgid "Smush image including original file."
|
903 |
msgstr ""
|
904 |
|
905 |
+
#: lib/class-wp-smush.php:1706
|
906 |
msgid "Resmush image"
|
907 |
msgstr ""
|
908 |
|
911 |
msgstr ""
|
912 |
|
913 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:425
|
914 |
+
msgid "We haven’t found any images in your %sgallery%s yet, so there’s no smushing to be done! Once you upload images, reload this page and start playing!"
|
|
|
|
|
|
|
915 |
msgstr ""
|
916 |
|
917 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:462
|
918 |
+
msgid "Enable Super-smush in the %sSettings%s area to get even more savings with almost no noticeable quality loss."
|
|
|
|
|
|
|
919 |
msgstr ""
|
920 |
|
921 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:477
|
|
|
922 |
msgid "Smush individual images via your %sManage Galleries%s section"
|
923 |
msgstr ""
|
924 |
|
926 |
msgid "Manage Galleries"
|
927 |
msgstr ""
|
928 |
|
929 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:553
|
930 |
+
msgid "IMAGES SUPER-SMUSHED"
|
931 |
+
msgstr ""
|
932 |
+
|
933 |
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:561
|
|
|
934 |
msgid "%sDISABLED%s"
|
935 |
msgstr ""
|
936 |
|
937 |
#: lib/nextgen-integration/class-wp-smush-nextgen-bulk.php:31
|
938 |
+
msgid "Smush request timed out, You can try setting a higher value ( > 60 ) for `WP_SMUSH_API_TIMEOUT`."
|
|
|
|
|
939 |
msgstr ""
|
940 |
|
941 |
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:205
|
|
|
942 |
msgid "Reduced by %s ( %01.1f%% )"
|
943 |
msgstr ""
|
944 |
|
945 |
+
#: wp-smush.php:169
|
946 |
msgid "Get Fast"
|
947 |
msgstr ""
|
948 |
|
949 |
+
#: wp-smush.php:211
|
950 |
msgid "WP Smush Free was deactivated. You have WP Smush Pro active!"
|
951 |
msgstr ""
|
952 |
+
#. Plugin Name of the plugin/theme
|
953 |
+
msgid "WP Smush"
|
954 |
+
msgstr ""
|
955 |
|
956 |
#. Plugin URI of the plugin/theme
|
957 |
msgid "http://wordpress.org/extend/plugins/wp-smushit/"
|
958 |
msgstr ""
|
959 |
|
960 |
#. Description of the plugin/theme
|
961 |
+
msgid "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."
|
|
|
|
|
|
|
962 |
msgstr ""
|
963 |
|
964 |
#. Author of the plugin/theme
|
lib/class-wp-smush-admin.php
CHANGED
@@ -50,6 +50,11 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
50 |
*/
|
51 |
public $smushed_count;
|
52 |
|
|
|
|
|
|
|
|
|
|
|
53 |
/**
|
54 |
* @var Smushed attachments out of total attachments
|
55 |
*/
|
@@ -175,8 +180,8 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
175 |
add_action( 'admin_notices', array( $this, 'smush_upgrade' ) );
|
176 |
|
177 |
// New Features Notice
|
178 |
-
add_action( 'admin_notices', array( $this, 'smush_updated' ) );
|
179 |
-
add_action( 'network_admin_notices', array( $this, 'smush_updated' ) );
|
180 |
|
181 |
//Handle the smush pro dismiss features notice ajax
|
182 |
add_action( 'wp_ajax_dismiss_upgrade_notice', array( $this, 'dismiss_upgrade_notice' ) );
|
@@ -240,13 +245,11 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
240 |
)
|
241 |
);
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
);
|
249 |
-
}
|
250 |
|
251 |
//Initialize Image dimensions
|
252 |
$this->image_sizes = $this->image_dimensions();
|
@@ -307,8 +310,6 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
307 |
*/
|
308 |
function register() {
|
309 |
|
310 |
-
global $WpSmush;
|
311 |
-
|
312 |
//Main JS
|
313 |
wp_register_script( 'wp-smushit-admin-js', WP_SMUSH_URL . 'assets/js/wp-smushit-admin.js', array(
|
314 |
'jquery'
|
@@ -485,41 +486,65 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
485 |
*
|
486 |
*/
|
487 |
function setup_global_stats( $force_update = false ) {
|
488 |
-
global $wpsmush_db;
|
|
|
|
|
|
|
|
|
489 |
//Setup Attachments and total count
|
490 |
$wpsmush_db->total_count( true );
|
491 |
|
492 |
-
$this->stats
|
493 |
-
|
494 |
-
|
|
|
|
|
|
|
|
|
495 |
$this->remaining_count = $this->remaining_count();
|
496 |
}
|
497 |
|
498 |
/**
|
499 |
-
*
|
500 |
-
*
|
501 |
-
* @param bool $force_update Whether to Force update the Global Stats or not
|
502 |
*
|
503 |
-
*
|
|
|
504 |
*/
|
505 |
-
function
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
}
|
521 |
|
522 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
523 |
}
|
524 |
|
525 |
/**
|
@@ -530,7 +555,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
530 |
*/
|
531 |
function process_smush_request() {
|
532 |
|
533 |
-
global $WpSmush, $wpsmush_db;
|
534 |
|
535 |
// turn off errors for ajax result
|
536 |
@error_reporting( 0 );
|
@@ -577,18 +602,21 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
577 |
}
|
578 |
|
579 |
//Get the file path for backup
|
580 |
-
$attachment_file_path = get_attached_file( $attachment_id );
|
|
|
|
|
|
|
581 |
|
582 |
//Take Backup
|
583 |
global $wpsmush_backup;
|
584 |
-
$wpsmush_backup->create_backup( $attachment_file_path );
|
585 |
|
586 |
if ( ! $send_error ) {
|
587 |
//Proceed only if Smushing Transient is not set for the given attachment id
|
588 |
if ( ! get_transient( 'smush-in-progress-' . $attachment_id ) ) {
|
589 |
|
590 |
//Set a transient to avoid multiple request
|
591 |
-
set_transient( 'smush-in-progress-' . $attachment_id, true,
|
592 |
|
593 |
$original_meta = wp_get_attachment_metadata( $attachment_id, true );
|
594 |
|
@@ -626,7 +654,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
626 |
|
627 |
$stats = $this->stats;
|
628 |
|
629 |
-
$stats['total'] = $
|
630 |
|
631 |
if ( isset( $smush ) && is_wp_error( $smush ) ) {
|
632 |
|
@@ -730,7 +758,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
730 |
function smush_single( $attachment_id, $return = false ) {
|
731 |
|
732 |
//If the smushing transient is already set, return the status
|
733 |
-
if ( get_transient( 'smush-in-progress-' . $attachment_id ) ) {
|
734 |
//Get the button status
|
735 |
$status = $this->set_status( $attachment_id, false, true );
|
736 |
if ( $return ) {
|
@@ -741,21 +769,24 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
741 |
}
|
742 |
|
743 |
//Set a transient to avoid multiple request
|
744 |
-
set_transient( 'smush-in-progress-' . $attachment_id, true,
|
745 |
|
746 |
-
global $WpSmush, $wpsmush_pngjpg;
|
747 |
|
748 |
$attachment_id = absint( (int) ( $attachment_id ) );
|
749 |
|
750 |
//Get the file path for backup
|
751 |
-
$attachment_file_path = get_attached_file( $attachment_id );
|
|
|
|
|
|
|
752 |
|
753 |
//Take Backup
|
754 |
global $wpsmush_backup;
|
755 |
-
$wpsmush_backup->create_backup( $attachment_file_path );
|
756 |
|
757 |
//Get the image metadata from $_POST
|
758 |
-
$original_meta = !empty( $_POST['metadata'] ) ? $_POST['metadata'] : '';
|
759 |
|
760 |
$original_meta = empty( $original_meta ) ? wp_get_attachment_metadata( $attachment_id ) : $original_meta;
|
761 |
|
@@ -865,6 +896,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
865 |
* @return int
|
866 |
*/
|
867 |
function remaining_count() {
|
|
|
868 |
return ( $this->total_count - $this->smushed_count );
|
869 |
}
|
870 |
|
@@ -1003,6 +1035,23 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1003 |
|
1004 |
}
|
1005 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1006 |
//Resize Savings
|
1007 |
$resize_savings = $wpsmush_db->resize_savings( false );
|
1008 |
$smush_data['resize_savings'] = ! empty( $resize_savings['bytes'] ) ? $resize_savings['bytes'] : 0;
|
@@ -1214,7 +1263,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1214 |
global $WpSmush;
|
1215 |
|
1216 |
//Show Temporary Status, For Async Optimisation, No Good workaround
|
1217 |
-
if ( ! empty( $_POST['action'] ) && 'upload-attachment' == $_POST['action'] && $WpSmush->is_auto_smush_enabled() ) {
|
1218 |
// the status
|
1219 |
$status_txt = __( 'Smushing in progress..', 'wp-smushit' );
|
1220 |
|
@@ -1437,7 +1486,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1437 |
}
|
1438 |
|
1439 |
//If there aren't any images in the library, return the notice
|
1440 |
-
if ( 0 == $wpsmush_db->
|
1441 |
$notice = esc_html__( "We haven’t found any images in your media library yet so there’s no smushing to be done!", "wp-smushit" );
|
1442 |
$resp = '<div class="wp-smush-notice wp-smush-resmush-message" tabindex="0"><i class="dev-icon dev-icon-tick"></i> ' . $notice . '
|
1443 |
<i class="dev-icon dev-icon-cross"></i>
|
@@ -1547,6 +1596,8 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1547 |
*
|
1548 |
*/
|
1549 |
global $wpsmush_resize;
|
|
|
|
|
1550 |
$should_resmush = $wpsmush_resize->should_resize( $attachment );
|
1551 |
}
|
1552 |
|
50 |
*/
|
51 |
public $smushed_count;
|
52 |
|
53 |
+
/**
|
54 |
+
* @var Smushed attachments from selected directories.
|
55 |
+
*/
|
56 |
+
public $dir_stats;
|
57 |
+
|
58 |
/**
|
59 |
* @var Smushed attachments out of total attachments
|
60 |
*/
|
180 |
add_action( 'admin_notices', array( $this, 'smush_upgrade' ) );
|
181 |
|
182 |
// New Features Notice
|
183 |
+
// add_action( 'admin_notices', array( $this, 'smush_updated' ) );
|
184 |
+
// add_action( 'network_admin_notices', array( $this, 'smush_updated' ) );
|
185 |
|
186 |
//Handle the smush pro dismiss features notice ajax
|
187 |
add_action( 'wp_ajax_dismiss_upgrade_notice', array( $this, 'dismiss_upgrade_notice' ) );
|
245 |
)
|
246 |
);
|
247 |
|
248 |
+
/**
|
249 |
+
* Allow to add other settings via filtering the variable
|
250 |
+
*
|
251 |
+
*/
|
252 |
+
$this->settings = apply_filters('wp_smush_settings', $this->settings );
|
|
|
|
|
253 |
|
254 |
//Initialize Image dimensions
|
255 |
$this->image_sizes = $this->image_dimensions();
|
310 |
*/
|
311 |
function register() {
|
312 |
|
|
|
|
|
313 |
//Main JS
|
314 |
wp_register_script( 'wp-smushit-admin-js', WP_SMUSH_URL . 'assets/js/wp-smushit-admin.js', array(
|
315 |
'jquery'
|
486 |
*
|
487 |
*/
|
488 |
function setup_global_stats( $force_update = false ) {
|
489 |
+
global $wpsmush_db, $wpsmush_dir;
|
490 |
+
|
491 |
+
// Set directory smush status.
|
492 |
+
$this->dir_stats = $wpsmush_dir->total_stats();
|
493 |
+
|
494 |
//Setup Attachments and total count
|
495 |
$wpsmush_db->total_count( true );
|
496 |
|
497 |
+
$this->stats = $this->global_stats( $force_update );
|
498 |
+
|
499 |
+
// Set pro savings.
|
500 |
+
$this->set_pro_savings();
|
501 |
+
|
502 |
+
// Set smushed count
|
503 |
+
$this->smushed_count = ! empty( $this->smushed_attachments ) ? count( $this->smushed_attachments ) : 0;
|
504 |
$this->remaining_count = $this->remaining_count();
|
505 |
}
|
506 |
|
507 |
/**
|
508 |
+
* Set pro savings stats if not premium user.
|
|
|
|
|
509 |
*
|
510 |
+
* For non-premium users, show expected avarage savings based
|
511 |
+
* on the free version savings.
|
512 |
*/
|
513 |
+
function set_pro_savings() {
|
514 |
+
|
515 |
+
global $WpSmush;
|
516 |
+
|
517 |
+
// No need this already premium.
|
518 |
+
if ( $WpSmush->validate_install() ) {
|
519 |
+
return;
|
520 |
+
}
|
521 |
+
|
522 |
+
//Initialize
|
523 |
+
$this->stats['pro_savings'] = array(
|
524 |
+
'percent' => 0,
|
525 |
+
'savings' => 0,
|
526 |
+
);
|
527 |
+
|
528 |
+
// Default values.
|
529 |
+
$savings = $this->stats['percent'] > 0 ? $this->stats['percent'] : 0;
|
530 |
+
$savings_bytes = $this->stats['human'] > 0 ? $this->stats['bytes'] : "0";
|
531 |
+
$orig_diff = 2.22058824;
|
532 |
+
if ( ! empty( $savings ) && $savings > 49 ) {
|
533 |
+
$orig_diff = 1.22054412;
|
534 |
+
}
|
535 |
+
//Calculate Pro savings
|
536 |
+
if( !empty( $savings ) ) {
|
537 |
+
$savings = $orig_diff * $savings;
|
538 |
+
$savings_bytes = $orig_diff * $savings_bytes;
|
539 |
}
|
540 |
|
541 |
+
// Set pro savings in global stats.
|
542 |
+
if ( $savings > 0 ) {
|
543 |
+
$this->stats['pro_savings'] = array(
|
544 |
+
'percent' => number_format_i18n( $savings, 1 ),
|
545 |
+
'savings' => size_format( $savings_bytes, 1 ),
|
546 |
+
);
|
547 |
+
}
|
548 |
}
|
549 |
|
550 |
/**
|
555 |
*/
|
556 |
function process_smush_request() {
|
557 |
|
558 |
+
global $WpSmush, $wpsmush_db, $wpsmush_helper;
|
559 |
|
560 |
// turn off errors for ajax result
|
561 |
@error_reporting( 0 );
|
602 |
}
|
603 |
|
604 |
//Get the file path for backup
|
605 |
+
$attachment_file_path = $wpsmush_helper->get_attached_file( $attachment_id );
|
606 |
+
|
607 |
+
//Download if not exists
|
608 |
+
do_action('smush_file_exists', $attachment_file_path, $attachment_id );
|
609 |
|
610 |
//Take Backup
|
611 |
global $wpsmush_backup;
|
612 |
+
$wpsmush_backup->create_backup( $attachment_file_path, '', $attachment_id );
|
613 |
|
614 |
if ( ! $send_error ) {
|
615 |
//Proceed only if Smushing Transient is not set for the given attachment id
|
616 |
if ( ! get_transient( 'smush-in-progress-' . $attachment_id ) ) {
|
617 |
|
618 |
//Set a transient to avoid multiple request
|
619 |
+
set_transient( 'smush-in-progress-' . $attachment_id, true, WP_SMUSH_TIMEOUT );
|
620 |
|
621 |
$original_meta = wp_get_attachment_metadata( $attachment_id, true );
|
622 |
|
654 |
|
655 |
$stats = $this->stats;
|
656 |
|
657 |
+
$stats['total'] = $this->total_count;
|
658 |
|
659 |
if ( isset( $smush ) && is_wp_error( $smush ) ) {
|
660 |
|
758 |
function smush_single( $attachment_id, $return = false ) {
|
759 |
|
760 |
//If the smushing transient is already set, return the status
|
761 |
+
if ( get_transient( 'smush-in-progress-' . $attachment_id ) || get_transient( "wp-smush-restore-$attachment_id" ) ) {
|
762 |
//Get the button status
|
763 |
$status = $this->set_status( $attachment_id, false, true );
|
764 |
if ( $return ) {
|
769 |
}
|
770 |
|
771 |
//Set a transient to avoid multiple request
|
772 |
+
set_transient( 'smush-in-progress-' . $attachment_id, true, WP_SMUSH_TIMEOUT );
|
773 |
|
774 |
+
global $WpSmush, $wpsmush_pngjpg, $wpsmush_helper;
|
775 |
|
776 |
$attachment_id = absint( (int) ( $attachment_id ) );
|
777 |
|
778 |
//Get the file path for backup
|
779 |
+
$attachment_file_path = $wpsmush_helper->get_attached_file( $attachment_id );
|
780 |
+
|
781 |
+
//Download file if not exists
|
782 |
+
do_action('smush_file_exists', $attachment_file_path, $attachment_id );
|
783 |
|
784 |
//Take Backup
|
785 |
global $wpsmush_backup;
|
786 |
+
$wpsmush_backup->create_backup( $attachment_file_path, '', $attachment_id );
|
787 |
|
788 |
//Get the image metadata from $_POST
|
789 |
+
$original_meta = ! empty( $_POST['metadata'] ) ? $_POST['metadata'] : '';
|
790 |
|
791 |
$original_meta = empty( $original_meta ) ? wp_get_attachment_metadata( $attachment_id ) : $original_meta;
|
792 |
|
896 |
* @return int
|
897 |
*/
|
898 |
function remaining_count() {
|
899 |
+
|
900 |
return ( $this->total_count - $this->smushed_count );
|
901 |
}
|
902 |
|
1035 |
|
1036 |
}
|
1037 |
|
1038 |
+
// Add directory smush image bytes.
|
1039 |
+
if ( ! empty( $this->dir_stats['bytes'] ) && $this->dir_stats['bytes'] > 0 ) {
|
1040 |
+
$smush_data['bytes'] += $this->dir_stats['bytes'];
|
1041 |
+
}
|
1042 |
+
// Add directory smush image total size.
|
1043 |
+
if ( ! empty( $this->dir_stats['orig_size'] ) && $this->dir_stats['orig_size'] > 0 ) {
|
1044 |
+
$smush_data['size_before'] += $this->dir_stats['orig_size'];
|
1045 |
+
}
|
1046 |
+
// Add directory smush saved size.
|
1047 |
+
if ( ! empty( $this->dir_stats['image_size'] ) && $this->dir_stats['image_size'] > 0 ) {
|
1048 |
+
$smush_data['size_after'] += $this->dir_stats['image_size'];
|
1049 |
+
}
|
1050 |
+
// Add directory smushed images.
|
1051 |
+
if ( ! empty( $this->dir_stats['optimised'] ) && $this->dir_stats['optimised'] > 0 ) {
|
1052 |
+
$smush_data['total_images'] += $this->dir_stats['optimised'];
|
1053 |
+
}
|
1054 |
+
|
1055 |
//Resize Savings
|
1056 |
$resize_savings = $wpsmush_db->resize_savings( false );
|
1057 |
$smush_data['resize_savings'] = ! empty( $resize_savings['bytes'] ) ? $resize_savings['bytes'] : 0;
|
1263 |
global $WpSmush;
|
1264 |
|
1265 |
//Show Temporary Status, For Async Optimisation, No Good workaround
|
1266 |
+
if ( ! get_transient( "wp-smush-restore-$id" ) && ! empty( $_POST['action'] ) && 'upload-attachment' == $_POST['action'] && $WpSmush->is_auto_smush_enabled() ) {
|
1267 |
// the status
|
1268 |
$status_txt = __( 'Smushing in progress..', 'wp-smushit' );
|
1269 |
|
1486 |
}
|
1487 |
|
1488 |
//If there aren't any images in the library, return the notice
|
1489 |
+
if ( 0 == $wpsmush_db->get_media_attachments( true ) ) {
|
1490 |
$notice = esc_html__( "We haven’t found any images in your media library yet so there’s no smushing to be done!", "wp-smushit" );
|
1491 |
$resp = '<div class="wp-smush-notice wp-smush-resmush-message" tabindex="0"><i class="dev-icon dev-icon-tick"></i> ' . $notice . '
|
1492 |
<i class="dev-icon dev-icon-cross"></i>
|
1596 |
*
|
1597 |
*/
|
1598 |
global $wpsmush_resize;
|
1599 |
+
// Initialize resize class.
|
1600 |
+
$wpsmush_resize->initialize();
|
1601 |
$should_resmush = $wpsmush_resize->should_resize( $attachment );
|
1602 |
}
|
1603 |
|
lib/class-wp-smush-backup.php
CHANGED
@@ -10,6 +10,13 @@ if ( ! class_exists( 'WpSmushBackup' ) ) {
|
|
10 |
*/
|
11 |
var $backup_enabled = false;
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
/**
|
14 |
* Constructor
|
15 |
*/
|
@@ -42,12 +49,15 @@ if ( ! class_exists( 'WpSmushBackup' ) ) {
|
|
42 |
*
|
43 |
* @param string $file_path
|
44 |
* @param string $backup_path
|
|
|
45 |
*
|
46 |
* @return string
|
47 |
*/
|
48 |
-
function create_backup( $file_path = '', $backup_path = '' ) {
|
49 |
global $WpSmush, $wpsmush_pngjpg;
|
50 |
|
|
|
|
|
51 |
if ( empty( $file_path ) ) {
|
52 |
return '';
|
53 |
}
|
@@ -67,16 +77,52 @@ if ( ! class_exists( 'WpSmushBackup' ) ) {
|
|
67 |
return $file_path;
|
68 |
}
|
69 |
|
70 |
-
|
|
|
71 |
//No need to create a backup, we already have one if enabled
|
72 |
return $file_path;
|
73 |
}
|
74 |
|
75 |
//Check for backup from other plugins, like nextgen, if it doesn't exists, create our own
|
76 |
if ( ! file_exists( $backup_path ) ) {
|
77 |
-
@copy( $file_path, $backup_path );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
|
|
80 |
}
|
81 |
|
82 |
/**
|
@@ -88,7 +134,7 @@ if ( ! class_exists( 'WpSmushBackup' ) ) {
|
|
88 |
* @return bool
|
89 |
*/
|
90 |
function restore_image( $attachment = '', $resp = true ) {
|
91 |
-
global $WpSmush;
|
92 |
//If no attachment id is provided, check $_POST variable for attachment_id
|
93 |
if ( empty( $attachment ) ) {
|
94 |
//Check Empty fields
|
@@ -108,69 +154,117 @@ if ( ! class_exists( 'WpSmushBackup' ) ) {
|
|
108 |
}
|
109 |
|
110 |
//Store the restore success/failure for Full size image
|
111 |
-
$restored = false;
|
112 |
|
113 |
//Process Now
|
114 |
-
$
|
|
|
|
|
|
|
115 |
|
116 |
//Restore Full size -> get other image sizes -> restore other images
|
117 |
|
118 |
//Get the Original Path
|
119 |
-
$file_path = get_attached_file( $
|
120 |
|
121 |
//Get the backup path
|
122 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
$restored = $this->restore_png( $image_id, $original_file, $file_path );
|
134 |
-
} elseif ( file_exists( $backup_name ) ) {
|
135 |
-
//If file exists, corresponding to our backup path
|
136 |
-
//Restore
|
137 |
-
$restored = @copy( $backup_name, $file_path );
|
138 |
|
139 |
-
|
140 |
-
|
|
|
|
|
141 |
} elseif ( file_exists( $file_path . '_backup' ) ) {
|
142 |
-
//
|
143 |
$restored = @copy( $file_path . '_backup', $file_path );
|
144 |
}
|
145 |
|
146 |
-
//Set a transient to avoid the smush-restore-smush loop
|
147 |
-
set_transient("wp-smush-restore-$image_id", true, 90 );
|
148 |
-
|
149 |
//Generate all other image size, and update attachment metadata
|
150 |
-
$metadata =
|
151 |
-
|
152 |
-
//Remove the transient
|
153 |
-
delete_transient( "wp-smush-restore-$image_id");
|
154 |
|
155 |
//Update metadata to db if it was successfully generated
|
156 |
if ( ! empty( $metadata ) && ! is_wp_error( $metadata ) ) {
|
157 |
-
wp_update_attachment_metadata( $
|
158 |
}
|
159 |
|
160 |
//If any of the image is restored, we count it as success
|
161 |
if ( $restored ) {
|
162 |
|
163 |
//Remove the Meta, And send json success
|
164 |
-
delete_post_meta( $
|
165 |
|
166 |
//Remove PNG to JPG conversion savings
|
167 |
-
delete_post_meta( $
|
168 |
|
169 |
//Remove Original File
|
170 |
-
delete_post_meta( $
|
171 |
|
172 |
//Get the Button html without wrapper
|
173 |
-
$button_html = $WpSmush->set_status( $
|
|
|
|
|
|
|
174 |
|
175 |
if ( $resp ) {
|
176 |
wp_send_json_success( array( 'button' => $button_html ) );
|
@@ -178,6 +272,8 @@ if ( ! class_exists( 'WpSmushBackup' ) ) {
|
|
178 |
return true;
|
179 |
}
|
180 |
}
|
|
|
|
|
181 |
if ( $resp ) {
|
182 |
wp_send_json_error( array( 'message' => '<div class="wp-smush-error">' . __( "Unable to restore image", "wp-smushit" ) . '</div>' ) );
|
183 |
}
|
@@ -220,34 +316,69 @@ if ( ! class_exists( 'WpSmushBackup' ) ) {
|
|
220 |
$original_file_path = $WpSmush->original_file( $original_file );
|
221 |
if ( file_exists( $original_file_path ) ) {
|
222 |
//Update the path details in meta and attached file, replace the image
|
223 |
-
$meta = $wpsmush_pngjpg->update_image_path( $image_id, $file_path, $original_file_path, $meta,
|
224 |
-
|
|
|
225 |
if ( ! empty( $meta['file'] ) && $original_file == $meta['file'] ) {
|
226 |
@unlink( $file_path );
|
227 |
}
|
228 |
-
//Generate all other image size, and update attachment metadata
|
229 |
-
$metadata = wp_generate_attachment_metadata( $image_id, $original_file_path );
|
230 |
|
231 |
-
|
232 |
-
if ( ! empty( $metadata ) && ! is_wp_error( $metadata ) ) {
|
233 |
-
wp_update_attachment_metadata( $image_id, $metadata );
|
234 |
-
}
|
235 |
|
236 |
/**
|
237 |
* Perform a action after the image URL is updated in post content
|
238 |
*/
|
239 |
-
do_action( 'wp_smush_image_url_updated', $image_id, $file_path, $original_file
|
240 |
}
|
241 |
//Update Meta
|
242 |
if ( ! empty( $meta ) ) {
|
243 |
//Remove Smushing, while attachment data is updated for the image
|
244 |
remove_filter( 'wp_update_attachment_metadata', array( $WpSmush, 'smush_image' ), 15 );
|
245 |
wp_update_attachment_metadata( $image_id, $meta );
|
|
|
246 |
return true;
|
247 |
}
|
|
|
248 |
return false;
|
249 |
|
250 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
}
|
252 |
|
253 |
global $wpsmush_backup;
|
10 |
*/
|
11 |
var $backup_enabled = false;
|
12 |
|
13 |
+
/**
|
14 |
+
* Key for storing file path for image backup
|
15 |
+
*
|
16 |
+
* @var string
|
17 |
+
*/
|
18 |
+
var $backup_key = 'smush-full';
|
19 |
+
|
20 |
/**
|
21 |
* Constructor
|
22 |
*/
|
49 |
*
|
50 |
* @param string $file_path
|
51 |
* @param string $backup_path
|
52 |
+
* @param string $attachment_id
|
53 |
*
|
54 |
* @return string
|
55 |
*/
|
56 |
+
function create_backup( $file_path = '', $backup_path = '', $attachment_id = '' ) {
|
57 |
global $WpSmush, $wpsmush_pngjpg;
|
58 |
|
59 |
+
$copied = false;
|
60 |
+
|
61 |
if ( empty( $file_path ) ) {
|
62 |
return '';
|
63 |
}
|
77 |
return $file_path;
|
78 |
}
|
79 |
|
80 |
+
$attachment_id = ! empty( $WpSmush->attachment_id ) ? $WpSmush->attachment_id : $attachment_id;
|
81 |
+
if ( ! empty( $attachment_id ) && $wpsmush_pngjpg->is_converted( $attachment_id ) ) {
|
82 |
//No need to create a backup, we already have one if enabled
|
83 |
return $file_path;
|
84 |
}
|
85 |
|
86 |
//Check for backup from other plugins, like nextgen, if it doesn't exists, create our own
|
87 |
if ( ! file_exists( $backup_path ) ) {
|
88 |
+
$copied = @copy( $file_path, $backup_path );
|
89 |
+
}
|
90 |
+
//Store the backup path in image backup sizes
|
91 |
+
if ( $copied ) {
|
92 |
+
$this->add_to_image_backup_sizes( $attachment_id, $backup_path );
|
93 |
+
}
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Store new backup path for the image
|
99 |
+
*
|
100 |
+
* @param string $attachment_id
|
101 |
+
* @param string $backup_path
|
102 |
+
* @param string $backup_key
|
103 |
+
*
|
104 |
+
* @return bool|int|void
|
105 |
+
*/
|
106 |
+
function add_to_image_backup_sizes( $attachment_id = '', $backup_path = '', $backup_key = '' ) {
|
107 |
+
if ( empty( $attachment_id ) || empty( $backup_path ) ) {
|
108 |
+
return;
|
109 |
}
|
110 |
+
//Get the Existing backup sizes
|
111 |
+
$backup_sizes = get_post_meta( $attachment_id, '_wp_attachment_backup_sizes', true );
|
112 |
+
if ( empty( $backup_sizes ) ) {
|
113 |
+
$backup_sizes = array();
|
114 |
+
}
|
115 |
+
|
116 |
+
list( $width, $height ) = getimagesize( $backup_path );
|
117 |
+
//Store our backup Path
|
118 |
+
$backup_key = empty( $backup_key ) ? $this->backup_key : $backup_key;
|
119 |
+
$backup_sizes[ $backup_key ] = array(
|
120 |
+
'file' => wp_basename( $backup_path ),
|
121 |
+
'width' => $width,
|
122 |
+
'height' => $height
|
123 |
+
);
|
124 |
|
125 |
+
return update_post_meta( $attachment_id, '_wp_attachment_backup_sizes', $backup_sizes );
|
126 |
}
|
127 |
|
128 |
/**
|
134 |
* @return bool
|
135 |
*/
|
136 |
function restore_image( $attachment = '', $resp = true ) {
|
137 |
+
global $WpSmush, $wpsmush_helper;
|
138 |
//If no attachment id is provided, check $_POST variable for attachment_id
|
139 |
if ( empty( $attachment ) ) {
|
140 |
//Check Empty fields
|
154 |
}
|
155 |
|
156 |
//Store the restore success/failure for Full size image
|
157 |
+
$restored = $restore_png = false;
|
158 |
|
159 |
//Process Now
|
160 |
+
$attachment_id = empty( $attachment ) ? absint( (int) $_POST['attachment_id'] ) : $attachment;
|
161 |
+
|
162 |
+
//Set a transient to avoid the smush-restore-smush loop
|
163 |
+
set_transient( "wp-smush-restore-$attachment_id", true, 60 );
|
164 |
|
165 |
//Restore Full size -> get other image sizes -> restore other images
|
166 |
|
167 |
//Get the Original Path
|
168 |
+
$file_path = $wpsmush_helper->get_attached_file( $attachment_id );
|
169 |
|
170 |
//Get the backup path
|
171 |
+
$backup_sizes = get_post_meta( $attachment_id, '_wp_attachment_backup_sizes', true );
|
172 |
+
|
173 |
+
//If there are
|
174 |
+
if ( ! empty( $backup_sizes ) ) {
|
175 |
+
|
176 |
+
// 1. Check if the image was converted from PNG->JPG, Get the corresponding backup path
|
177 |
+
if ( ! empty( $backup_sizes['smush_png_path'] ) ) {
|
178 |
+
$backup_path = $backup_sizes['smush_png_path'];
|
179 |
+
//If we don't have the backup path in backup sizes, Check for legacy original file path
|
180 |
+
if ( empty( $backup_path ) ) {
|
181 |
+
//Check if it's a jpg converted from png, and restore the jpg to png
|
182 |
+
$original_file = get_post_meta( $attachment_id, WP_SMUSH_PREFIX . 'original_file', true );
|
183 |
+
$backup_path = $WpSmush->original_file( $original_file );
|
184 |
+
}
|
185 |
+
|
186 |
+
//If we have a backup path for PNG file, use restore_png()
|
187 |
+
if ( ! empty( $backup_path ) ) {
|
188 |
+
$restore_png = true;
|
189 |
+
}
|
190 |
+
}
|
191 |
|
192 |
+
// 2. If we don't have a backup path from PNG->JPG, check for normal smush backup path
|
193 |
+
if ( empty( $backup_path ) ) {
|
194 |
+
|
195 |
+
if ( ! empty( $backup_sizes[ $this->backup_key ] ) ) {
|
196 |
+
$backup_path = $backup_sizes[ $this->backup_key ];
|
197 |
+
} else {
|
198 |
+
//If we don't have a backup path, check for legacy backup naming convention
|
199 |
+
$backup_path = $WpSmush->get_image_backup_path( $file_path );
|
200 |
+
}
|
201 |
+
}
|
202 |
+
$backup_path = is_array( $backup_path ) && !empty( $backup_path['file'] ) ? $backup_path['file'] : $backup_path;
|
203 |
+
}
|
204 |
+
|
205 |
+
$backup_full_path = str_replace( wp_basename( $file_path ), wp_basename( $backup_path ), $file_path );
|
206 |
+
|
207 |
+
//Finally, if we have the backup path, perform the restore operation
|
208 |
+
if ( ! empty( $backup_full_path ) ) {
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Allows S3 to hook, check and download the file
|
212 |
+
*/
|
213 |
+
do_action('smush_file_exists', $backup_full_path, $attachment_id, array() );
|
214 |
+
|
215 |
+
if ( $restore_png ) {
|
216 |
+
//restore PNG full size and all other image sizes
|
217 |
+
$restored = $this->restore_png( $attachment_id, $backup_full_path, $file_path );
|
218 |
|
219 |
+
//JPG file is already deleted, Update backup sizes
|
220 |
+
if ( $restored ) {
|
221 |
+
$this->remove_from_backup_sizes( $attachment_id, 'smush_png_path', $backup_sizes );
|
222 |
+
}
|
223 |
+
} else {
|
224 |
+
//If file exists, corresponding to our backup path
|
225 |
+
//Restore
|
226 |
+
$restored = @copy( $backup_full_path, $file_path );
|
227 |
+
|
228 |
+
//Remove the backup, if we were able to restore the image
|
229 |
+
if ( $restored ) {
|
230 |
|
231 |
+
//Update backup sizes
|
232 |
+
$this->remove_from_backup_sizes( $attachment_id, '', $backup_sizes );
|
|
|
|
|
|
|
|
|
|
|
233 |
|
234 |
+
//Delete the backup
|
235 |
+
$this->remove_backup( $attachment_id, $backup_full_path );
|
236 |
+
}
|
237 |
+
}
|
238 |
} elseif ( file_exists( $file_path . '_backup' ) ) {
|
239 |
+
// Try to restore from other backups, if any
|
240 |
$restored = @copy( $file_path . '_backup', $file_path );
|
241 |
}
|
242 |
|
|
|
|
|
|
|
243 |
//Generate all other image size, and update attachment metadata
|
244 |
+
$metadata = wp_generate_attachment_metadata( $attachment_id, $file_path );
|
|
|
|
|
|
|
245 |
|
246 |
//Update metadata to db if it was successfully generated
|
247 |
if ( ! empty( $metadata ) && ! is_wp_error( $metadata ) ) {
|
248 |
+
wp_update_attachment_metadata( $attachment_id, $metadata );
|
249 |
}
|
250 |
|
251 |
//If any of the image is restored, we count it as success
|
252 |
if ( $restored ) {
|
253 |
|
254 |
//Remove the Meta, And send json success
|
255 |
+
delete_post_meta( $attachment_id, $WpSmush->smushed_meta_key );
|
256 |
|
257 |
//Remove PNG to JPG conversion savings
|
258 |
+
delete_post_meta( $attachment_id, WP_SMUSH_PREFIX . 'pngjpg_savings' );
|
259 |
|
260 |
//Remove Original File
|
261 |
+
delete_post_meta( $attachment_id, WP_SMUSH_PREFIX . 'original_file' );
|
262 |
|
263 |
//Get the Button html without wrapper
|
264 |
+
$button_html = $WpSmush->set_status( $attachment_id, false, false, false );
|
265 |
+
|
266 |
+
//Remove the transient
|
267 |
+
delete_transient( "wp-smush-restore-$attachment_id" );
|
268 |
|
269 |
if ( $resp ) {
|
270 |
wp_send_json_success( array( 'button' => $button_html ) );
|
272 |
return true;
|
273 |
}
|
274 |
}
|
275 |
+
//Remove the transient
|
276 |
+
delete_transient( "wp-smush-restore-$attachment_id" );
|
277 |
if ( $resp ) {
|
278 |
wp_send_json_error( array( 'message' => '<div class="wp-smush-error">' . __( "Unable to restore image", "wp-smushit" ) . '</div>' ) );
|
279 |
}
|
316 |
$original_file_path = $WpSmush->original_file( $original_file );
|
317 |
if ( file_exists( $original_file_path ) ) {
|
318 |
//Update the path details in meta and attached file, replace the image
|
319 |
+
$meta = $wpsmush_pngjpg->update_image_path( $image_id, $file_path, $original_file_path, $meta, 'full', 'restore' );
|
320 |
+
|
321 |
+
//Unlink JPG
|
322 |
if ( ! empty( $meta['file'] ) && $original_file == $meta['file'] ) {
|
323 |
@unlink( $file_path );
|
324 |
}
|
|
|
|
|
325 |
|
326 |
+
$meta = wp_generate_attachment_metadata( $image_id, $original_file_path );
|
|
|
|
|
|
|
327 |
|
328 |
/**
|
329 |
* Perform a action after the image URL is updated in post content
|
330 |
*/
|
331 |
+
do_action( 'wp_smush_image_url_updated', $image_id, $file_path, $original_file );
|
332 |
}
|
333 |
//Update Meta
|
334 |
if ( ! empty( $meta ) ) {
|
335 |
//Remove Smushing, while attachment data is updated for the image
|
336 |
remove_filter( 'wp_update_attachment_metadata', array( $WpSmush, 'smush_image' ), 15 );
|
337 |
wp_update_attachment_metadata( $image_id, $meta );
|
338 |
+
|
339 |
return true;
|
340 |
}
|
341 |
+
|
342 |
return false;
|
343 |
|
344 |
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Remove the backup path for a give attachment id and path
|
348 |
+
*
|
349 |
+
* @param string $attachment_id
|
350 |
+
*
|
351 |
+
* @param string $path
|
352 |
+
*
|
353 |
+
*
|
354 |
+
*/
|
355 |
+
function remove_backup( $attachment_id = '', $path = '' ) {
|
356 |
+
@unlink( $path );
|
357 |
+
}
|
358 |
+
|
359 |
+
/**
|
360 |
+
* Remove a specific backup key from Backup Size array
|
361 |
+
*
|
362 |
+
* @param string $attachment_id
|
363 |
+
* @param string $backup_key
|
364 |
+
* @param array $backup_sizes
|
365 |
+
*/
|
366 |
+
function remove_from_backup_sizes( $attachment_id = '', $backup_key = '', $backup_sizes = array() ) {
|
367 |
+
//Get backup sizes
|
368 |
+
$backup_sizes = empty( $backup_sizes ) ? get_post_meta( $attachment_id, '_wp_attachment_backup_sizes', true ) : $backup_sizes;
|
369 |
+
$backup_key = empty( $backup_key ) ? $this->backup_key : $backup_key;
|
370 |
+
|
371 |
+
//If we don't have any backup sizes list or if the particular key is not set, return
|
372 |
+
if ( empty( $backup_sizes ) || ! isset( $backup_sizes[ $backup_key ] ) ) {
|
373 |
+
return;
|
374 |
+
}
|
375 |
+
|
376 |
+
unset( $backup_sizes[ $backup_key ] );
|
377 |
+
|
378 |
+
//Store it in attachment meta
|
379 |
+
update_post_meta( $attachment_id, '_wp_attachment_backup_sizes', $backup_sizes );
|
380 |
+
|
381 |
+
}
|
382 |
}
|
383 |
|
384 |
global $wpsmush_backup;
|
lib/class-wp-smush-db.php
CHANGED
@@ -134,14 +134,57 @@ if ( ! class_exists( 'WpSmushDB' ) ) {
|
|
134 |
* @return bool|int|mixed
|
135 |
*/
|
136 |
function total_count( $force_update = false ) {
|
137 |
-
global $wpsmushit_admin
|
138 |
|
139 |
//Retrieve from Cache
|
140 |
if ( ! $force_update && $count = wp_cache_get( 'total_count', 'wp-smush' ) ) {
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
}
|
143 |
|
144 |
$posts = array();
|
|
|
|
|
145 |
$offset = 0;
|
146 |
$limit = $wpsmushit_admin->query_limit();
|
147 |
|
@@ -167,16 +210,13 @@ if ( ! class_exists( 'WpSmushDB' ) ) {
|
|
167 |
}
|
168 |
}
|
169 |
|
170 |
-
//
|
171 |
-
|
172 |
-
wp_cache_add( 'smush_attachments', $posts, 'wp-smush' );
|
173 |
-
}
|
174 |
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
|
179 |
-
// send the count
|
180 |
return $posts;
|
181 |
}
|
182 |
|
@@ -188,42 +228,40 @@ if ( ! class_exists( 'WpSmushDB' ) ) {
|
|
188 |
* @return array|int
|
189 |
*/
|
190 |
function smushed_count( $return_ids = false ) {
|
191 |
-
global $wpsmushit_admin;
|
192 |
|
193 |
//Don't query again, if the variable is already set
|
194 |
if ( ! $return_ids && ! empty( $wpsmushit_admin->smushed_count ) && $wpsmushit_admin->smushed_count > 0 ) {
|
195 |
return $wpsmushit_admin->smushed_count;
|
196 |
}
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
);
|
207 |
|
208 |
//Remove the Filters added by WP Media Folder
|
209 |
$this->remove_filters();
|
|
|
|
|
210 |
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
$posts = $this->filter_by_mime( $results->posts );
|
216 |
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
} else {
|
221 |
-
//Return post ids
|
222 |
-
return $posts;
|
223 |
}
|
224 |
-
} else {
|
225 |
-
return false;
|
226 |
}
|
|
|
|
|
227 |
}
|
228 |
|
229 |
/**
|
134 |
* @return bool|int|mixed
|
135 |
*/
|
136 |
function total_count( $force_update = false ) {
|
137 |
+
global $wpsmushit_admin;
|
138 |
|
139 |
//Retrieve from Cache
|
140 |
if ( ! $force_update && $count = wp_cache_get( 'total_count', 'wp-smush' ) ) {
|
141 |
+
if( $count ) {
|
142 |
+
return $count;
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
//Set Attachment ids, and total count
|
147 |
+
$posts = $this->get_media_attachments( '', $force_update );
|
148 |
+
$wpsmushit_admin->attachments = $posts;
|
149 |
+
|
150 |
+
//Get total count from attachments
|
151 |
+
$total_count = ! empty( $posts ) && is_array( $posts ) ? sizeof( $posts ) : 0;
|
152 |
+
|
153 |
+
// Set total count.
|
154 |
+
$wpsmushit_admin->total_count = $total_count;
|
155 |
+
|
156 |
+
wp_cache_add( 'total_count', $total_count, 'wp-smush' );
|
157 |
+
|
158 |
+
// send the count
|
159 |
+
return $total_count;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Get the media attachment Id/Count
|
164 |
+
*
|
165 |
+
* @param bool $return_count
|
166 |
+
* @param bool $force_update
|
167 |
+
*
|
168 |
+
* @return array|bool|int|mixed
|
169 |
+
*/
|
170 |
+
function get_media_attachments( $return_count = false, $force_update = false ) {
|
171 |
+
global $wpsmushit_admin, $wpdb;
|
172 |
+
|
173 |
+
//Return results from cache
|
174 |
+
if ( ! $force_update ) {
|
175 |
+
$posts = wp_cache_get( 'media_attachments', 'wp-smush' );
|
176 |
+
$count = ! empty( $posts ) ? sizeof( $posts ) : 0;
|
177 |
+
|
178 |
+
//Return results only if we've got any
|
179 |
+
if( $count ) {
|
180 |
+
return $return_count ? $count : $posts;
|
181 |
+
}
|
182 |
+
|
183 |
}
|
184 |
|
185 |
$posts = array();
|
186 |
+
|
187 |
+
//Else Get it Fresh!!
|
188 |
$offset = 0;
|
189 |
$limit = $wpsmushit_admin->query_limit();
|
190 |
|
210 |
}
|
211 |
}
|
212 |
|
213 |
+
//Add the attachments to cache
|
214 |
+
wp_cache_add( 'media_attachments', $posts, 'wp-smushit' );
|
|
|
|
|
215 |
|
216 |
+
if ( $return_count ) {
|
217 |
+
return sizeof( $posts );
|
218 |
+
}
|
219 |
|
|
|
220 |
return $posts;
|
221 |
}
|
222 |
|
228 |
* @return array|int
|
229 |
*/
|
230 |
function smushed_count( $return_ids = false ) {
|
231 |
+
global $wpsmushit_admin, $wpdb;
|
232 |
|
233 |
//Don't query again, if the variable is already set
|
234 |
if ( ! $return_ids && ! empty( $wpsmushit_admin->smushed_count ) && $wpsmushit_admin->smushed_count > 0 ) {
|
235 |
return $wpsmushit_admin->smushed_count;
|
236 |
}
|
237 |
|
238 |
+
/**
|
239 |
+
* Allows to set a limit of mysql query
|
240 |
+
* Default value is 2000
|
241 |
+
*/
|
242 |
+
$limit = $wpsmushit_admin->query_limit();
|
243 |
+
$offset = 0;
|
244 |
+
$query_next = true;
|
245 |
+
|
246 |
+
$posts = array();
|
247 |
|
248 |
//Remove the Filters added by WP Media Folder
|
249 |
$this->remove_filters();
|
250 |
+
while ( $query_next && $results = $wpdb->get_col( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key=%s LIMIT $offset, $limit", "wp-smpro-smush-data" ) ) ) {
|
251 |
+
if ( ! is_wp_error( $results ) && sizeof( $results ) > 0 ) {
|
252 |
|
253 |
+
$posts = array_merge( $posts, $results );
|
254 |
+
}
|
255 |
+
//Update the offset
|
256 |
+
$offset += $limit;
|
|
|
257 |
|
258 |
+
//Compare the Offset value to total images
|
259 |
+
if ( ! empty( $wpsmushit_admin->total_count ) && $wpsmushit_admin->total_count <= $offset ) {
|
260 |
+
$query_next = false;
|
|
|
|
|
|
|
261 |
}
|
|
|
|
|
262 |
}
|
263 |
+
|
264 |
+
return $return_ids ? $posts : count( $posts );
|
265 |
}
|
266 |
|
267 |
/**
|
lib/class-wp-smush-dir.php
CHANGED
@@ -30,9 +30,6 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
|
|
30 |
return;
|
31 |
}
|
32 |
|
33 |
-
global $WpSmush;
|
34 |
-
|
35 |
-
|
36 |
//Hook early for free version, in order to display it before the advanced settings
|
37 |
add_action( 'wp_smush_before_advanced_settings', array( $this, 'ui' ) );
|
38 |
|
@@ -89,19 +86,27 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
|
|
89 |
<!-- Savings from Directory Smush -->
|
90 |
<div class="row smush-dir-savings">
|
91 |
<span class="float-l wp-smush-stats-label"><strong><?php esc_html_e( "DIRECTORY SMUSH SAVINGS", "wp-smushit" ); ?></strong></span>
|
92 |
-
<span class="float-r wp-smush-stats"
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
<span class="wp-smush-stats-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
</span>
|
106 |
</div><?php
|
107 |
}
|
@@ -123,6 +128,7 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
|
|
123 |
* id -> Auto Increment ID
|
124 |
* path -> Absolute path to the image file
|
125 |
* resize -> Whether the image was resized or not
|
|
|
126 |
* image_size -> Current image size post optimisation
|
127 |
* orig_size -> Original image size before optimisation
|
128 |
* file_time -> Unix time for the file creation, to match it against the current creation time,
|
@@ -136,6 +142,7 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
|
|
136 |
id mediumint(9) NOT NULL AUTO_INCREMENT,
|
137 |
path text NOT NULL,
|
138 |
resize varchar(55),
|
|
|
139 |
error varchar(55) DEFAULT NULL,
|
140 |
image_size int(10) unsigned,
|
141 |
orig_size int(10) unsigned,
|
@@ -180,8 +187,12 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
|
|
180 |
*
|
181 |
*/
|
182 |
function get_unsmushed_image() {
|
183 |
-
global $wpdb;
|
184 |
-
|
|
|
|
|
|
|
|
|
185 |
$results = $wpdb->get_col( $query );
|
186 |
|
187 |
//If The query went through
|
@@ -255,7 +266,7 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
|
|
255 |
</div>
|
256 |
<!-- Notices -->
|
257 |
<div class="wp-smush-notice wp-smush-dir-all-done hidden" tabindex="0">
|
258 |
-
<i class="dev-icon dev-icon-tick"></i><?php esc_html_e( "All images are smushed and up to date. Awesome!", "wp-smushit" ); ?>
|
259 |
</div>
|
260 |
<div class="wp-smush-notice wp-smush-dir-remaining hidden" tabindex="0">
|
261 |
<i class="dev-icon wdv-icon wdv-icon-fw wdv-icon-exclamation-sign"></i><?php printf( esc_html__( "%s/%s image(s) were successfully smushed, however %s image(s) could not be smushed due to an error.", "wp-smushit" ), '<span class="wp-smush-dir-smushed"></span>', '<span class="wp-smush-dir-total"></span>', '<span class="wp-smush-dir-remaining"></span>' ); ?>
|
@@ -540,8 +551,8 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
|
|
540 |
if ( $count >= 5000 ) {
|
541 |
$count = 0;
|
542 |
$query = $this->build_query( $values, $images );
|
|
|
543 |
$wpdb->query( $query );
|
544 |
-
$images = array();
|
545 |
}
|
546 |
}
|
547 |
|
@@ -944,7 +955,7 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
|
|
944 |
*
|
945 |
*/
|
946 |
function total_stats() {
|
947 |
-
global $wpdb;
|
948 |
|
949 |
$offset = 0;
|
950 |
$optimised = 0;
|
@@ -955,11 +966,19 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
|
|
955 |
|
956 |
$total = ! empty( $total ) && is_array( $total ) ? $total[0] : 0;
|
957 |
|
958 |
-
|
|
|
|
|
|
|
|
|
959 |
if ( ! empty( $results ) ) {
|
960 |
$images = array_merge( $images, $results );
|
961 |
}
|
962 |
$offset += $limit;
|
|
|
|
|
|
|
|
|
963 |
}
|
964 |
|
965 |
//Iterate over stats, Return Count and savings
|
@@ -981,7 +1000,7 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
|
|
981 |
}
|
982 |
|
983 |
//Get the savings in bytes and percent
|
984 |
-
if ( ! empty( $this->stats ) ) {
|
985 |
$this->stats['bytes'] = ( $this->stats['orig_size'] > $this->stats['image_size'] ) ? $this->stats['orig_size'] - $this->stats['image_size'] : 0;
|
986 |
$this->stats['percent'] = number_format_i18n( ( ( $this->stats['bytes'] / $this->stats['orig_size'] ) * 100 ), 1 );
|
987 |
//Convert to human readable form
|
@@ -1049,6 +1068,10 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
|
|
1049 |
wp_send_json_error( $error_msg );
|
1050 |
}
|
1051 |
|
|
|
|
|
|
|
|
|
1052 |
//Check smush limit for free users
|
1053 |
if ( ! $WpSmush->validate_install() ) {
|
1054 |
|
@@ -1111,17 +1134,32 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
|
|
1111 |
//Get file time
|
1112 |
$file_time = @filectime( $path );
|
1113 |
|
1114 |
-
//
|
1115 |
-
$
|
1116 |
-
$query = $wpdb->prepare( $query, $smush_results['data']->after_size, $file_time, $id );
|
1117 |
-
$wpdb->query( $query );
|
1118 |
|
1119 |
-
//
|
1120 |
-
$
|
|
|
|
|
1121 |
|
1122 |
-
//Get the
|
1123 |
-
$
|
1124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1125 |
|
1126 |
//Show the image wise stats
|
1127 |
$image = array(
|
@@ -1137,9 +1175,14 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
|
|
1137 |
$data = array(
|
1138 |
'image' => $image,
|
1139 |
'total' => $total,
|
1140 |
-
'latest_scan' => $last_scan
|
1141 |
);
|
1142 |
|
|
|
|
|
|
|
|
|
|
|
1143 |
//Update Bulk Limit Transient
|
1144 |
$wpsmushit_admin->update_smush_count( 'dir_sent_count' );
|
1145 |
|
30 |
return;
|
31 |
}
|
32 |
|
|
|
|
|
|
|
33 |
//Hook early for free version, in order to display it before the advanced settings
|
34 |
add_action( 'wp_smush_before_advanced_settings', array( $this, 'ui' ) );
|
35 |
|
86 |
<!-- Savings from Directory Smush -->
|
87 |
<div class="row smush-dir-savings">
|
88 |
<span class="float-l wp-smush-stats-label"><strong><?php esc_html_e( "DIRECTORY SMUSH SAVINGS", "wp-smushit" ); ?></strong></span>
|
89 |
+
<span class="float-r wp-smush-stats">
|
90 |
+
<span class="spinner" style="visibility: visible" title="<?php esc_html_e( "Updating Stats", "wp-smushit" ); ?>"></span>
|
91 |
+
<?php
|
92 |
+
if ( $human > 0 ) { ?>
|
93 |
+
<span class="wp-smush-stats-human"> <?php echo $human; ?></span><?php
|
94 |
+
//Output percentage only if > 1
|
95 |
+
if ( $percent > 1 ) { ?>
|
96 |
+
<span class="wp-smush-stats-sep">/</span>
|
97 |
+
<span class="wp-smush-stats-percent"><?php echo ! empty( $percent ) ? $percent : ''; ?>
|
98 |
+
%</span><?php
|
99 |
+
}
|
100 |
+
} else { ?>
|
101 |
+
<span class="wp-smush-stats-human">
|
102 |
+
<a href="#wp-smush-dir-browser">
|
103 |
+
<button class="button button-small wp-smush-dir-link"
|
104 |
+
type="button"><?php esc_html_e( "SMUSH DIRECTORY", "wp-smushit" ); ?></button>
|
105 |
+
</a>
|
106 |
+
</span>
|
107 |
+
<span class="wp-smush-stats-sep hidden">/</span>
|
108 |
+
<span class="wp-smush-stats-percent"></span>
|
109 |
+
<?php } ?>
|
110 |
</span>
|
111 |
</div><?php
|
112 |
}
|
128 |
* id -> Auto Increment ID
|
129 |
* path -> Absolute path to the image file
|
130 |
* resize -> Whether the image was resized or not
|
131 |
+
* lossy -> Whether the image was super-smushed/lossy or not
|
132 |
* image_size -> Current image size post optimisation
|
133 |
* orig_size -> Original image size before optimisation
|
134 |
* file_time -> Unix time for the file creation, to match it against the current creation time,
|
142 |
id mediumint(9) NOT NULL AUTO_INCREMENT,
|
143 |
path text NOT NULL,
|
144 |
resize varchar(55),
|
145 |
+
lossy varchar(55),
|
146 |
error varchar(55) DEFAULT NULL,
|
147 |
image_size int(10) unsigned,
|
148 |
orig_size int(10) unsigned,
|
187 |
*
|
188 |
*/
|
189 |
function get_unsmushed_image() {
|
190 |
+
global $wpdb, $WpSmush;
|
191 |
+
|
192 |
+
// If super-smush enabled, add lossy check.
|
193 |
+
$lossy_condition = $WpSmush->lossy_enabled ? '(image_size IS NULL OR lossy <> 1)' : 'image_size IS NULL';
|
194 |
+
|
195 |
+
$query = $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}smush_dir_images WHERE $lossy_condition && last_scan = (SELECT MAX(last_scan) FROM {$wpdb->prefix}smush_dir_images t2 ) GROUP BY id ORDER BY id LIMIT %d", 1 );
|
196 |
$results = $wpdb->get_col( $query );
|
197 |
|
198 |
//If The query went through
|
266 |
</div>
|
267 |
<!-- Notices -->
|
268 |
<div class="wp-smush-notice wp-smush-dir-all-done hidden" tabindex="0">
|
269 |
+
<i class="dev-icon dev-icon-tick"></i><?php esc_html_e( "All images for the selected directory are smushed and up to date. Awesome!", "wp-smushit" ); ?>
|
270 |
</div>
|
271 |
<div class="wp-smush-notice wp-smush-dir-remaining hidden" tabindex="0">
|
272 |
<i class="dev-icon wdv-icon wdv-icon-fw wdv-icon-exclamation-sign"></i><?php printf( esc_html__( "%s/%s image(s) were successfully smushed, however %s image(s) could not be smushed due to an error.", "wp-smushit" ), '<span class="wp-smush-dir-smushed"></span>', '<span class="wp-smush-dir-total"></span>', '<span class="wp-smush-dir-remaining"></span>' ); ?>
|
551 |
if ( $count >= 5000 ) {
|
552 |
$count = 0;
|
553 |
$query = $this->build_query( $values, $images );
|
554 |
+
$images = $values = array();
|
555 |
$wpdb->query( $query );
|
|
|
556 |
}
|
557 |
}
|
558 |
|
955 |
*
|
956 |
*/
|
957 |
function total_stats() {
|
958 |
+
global $wpdb, $WpSmush;
|
959 |
|
960 |
$offset = 0;
|
961 |
$optimised = 0;
|
966 |
|
967 |
$total = ! empty( $total ) && is_array( $total ) ? $total[0] : 0;
|
968 |
|
969 |
+
// If super-smush enabled, add meta condition.
|
970 |
+
$lossy_condition = $WpSmush->lossy_enabled ? 'AND lossy = 1' : '';
|
971 |
+
|
972 |
+
$continue = true;
|
973 |
+
while ( $continue && $results = $wpdb->get_results( "SELECT path, image_size, orig_size FROM {$wpdb->prefix}smush_dir_images WHERE image_size IS NOT NULL $lossy_condition ORDER BY `id` LIMIT $offset, $limit", ARRAY_A ) ) {
|
974 |
if ( ! empty( $results ) ) {
|
975 |
$images = array_merge( $images, $results );
|
976 |
}
|
977 |
$offset += $limit;
|
978 |
+
//If offset is above total number, do not query
|
979 |
+
if( $offset > $total ) {
|
980 |
+
$continue = false;
|
981 |
+
}
|
982 |
}
|
983 |
|
984 |
//Iterate over stats, Return Count and savings
|
1000 |
}
|
1001 |
|
1002 |
//Get the savings in bytes and percent
|
1003 |
+
if ( ! empty( $this->stats ) && ! empty( $this->stats['orig_size'] ) ) {
|
1004 |
$this->stats['bytes'] = ( $this->stats['orig_size'] > $this->stats['image_size'] ) ? $this->stats['orig_size'] - $this->stats['image_size'] : 0;
|
1005 |
$this->stats['percent'] = number_format_i18n( ( ( $this->stats['bytes'] / $this->stats['orig_size'] ) * 100 ), 1 );
|
1006 |
//Convert to human readable form
|
1068 |
wp_send_json_error( $error_msg );
|
1069 |
}
|
1070 |
|
1071 |
+
// Get the last scan stats.
|
1072 |
+
$last_scan = $this->last_scan_stats();
|
1073 |
+
$stats = array();
|
1074 |
+
|
1075 |
//Check smush limit for free users
|
1076 |
if ( ! $WpSmush->validate_install() ) {
|
1077 |
|
1134 |
//Get file time
|
1135 |
$file_time = @filectime( $path );
|
1136 |
|
1137 |
+
// If super-smush enabled, update supersmushed meta value also.
|
1138 |
+
$lossy = $WpSmush->lossy_enabled ? 1 : 0;
|
|
|
|
|
1139 |
|
1140 |
+
// All good, Update the stats.
|
1141 |
+
$query = "UPDATE {$wpdb->prefix}smush_dir_images SET image_size=%d, file_time=%d, lossy=%s WHERE id=%d LIMIT 1";
|
1142 |
+
$query = $wpdb->prepare( $query, $smush_results['data']->after_size, $file_time, $lossy, $id );
|
1143 |
+
$wpdb->query( $query );
|
1144 |
|
1145 |
+
// Get the global stats if current dir smush completed.
|
1146 |
+
if ( isset( $_GET['get_stats'] ) && 1 == $_GET['get_stats'] ) {
|
1147 |
+
// This will setup directory smush stats too.
|
1148 |
+
$wpsmushit_admin->setup_global_stats();
|
1149 |
+
$stats = $wpsmushit_admin->stats;
|
1150 |
+
$stats['total'] = $wpsmushit_admin->total_count;
|
1151 |
+
$resmush_count = empty( $wpsmushit_admin->resmush_ids ) ? count( $wpsmushit_admin->resmush_ids = get_option( "wp-smush-resmush-list" ) ) : count( $wpsmushit_admin->resmush_ids );
|
1152 |
+
$stats['smushed'] = ! empty( $wpsmushit_admin->resmush_ids ) ? $wpsmushit_admin->smushed_count - $resmush_count : $wpsmushit_admin->smushed_count;
|
1153 |
+
if ( $lossy == 1 ) {
|
1154 |
+
$stats['super_smushed'] = $wpsmushit_admin->super_smushed;
|
1155 |
+
}
|
1156 |
+
// Set tootltip text to update.
|
1157 |
+
$stats['tooltip_text'] = ! empty( $stats['total_images'] ) ? sprintf( __( "You've smushed %d images in total.", "wp-smushit" ), $stats['total_images'] ) : '';
|
1158 |
+
// Get the total dir smush stats.
|
1159 |
+
$total = $wpsmushit_admin->dir_stats;
|
1160 |
+
} else {
|
1161 |
+
$total = $this->total_stats();
|
1162 |
+
}
|
1163 |
|
1164 |
//Show the image wise stats
|
1165 |
$image = array(
|
1175 |
$data = array(
|
1176 |
'image' => $image,
|
1177 |
'total' => $total,
|
1178 |
+
'latest_scan' => $last_scan,
|
1179 |
);
|
1180 |
|
1181 |
+
// If current dir smush completed, include global stats.
|
1182 |
+
if ( ! empty( $stats ) ) {
|
1183 |
+
$data['stats'] = $stats;
|
1184 |
+
}
|
1185 |
+
|
1186 |
//Update Bulk Limit Transient
|
1187 |
$wpsmushit_admin->update_smush_count( 'dir_sent_count' );
|
1188 |
|
lib/class-wp-smush-helper.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package WP Smush
|
4 |
+
* @subpackage Admin
|
5 |
+
* @version 1.0
|
6 |
+
*
|
7 |
+
* @author Umesh Kumar <umesh@incsub.com>
|
8 |
+
*
|
9 |
+
* @copyright (c) 2017, Incsub (http://incsub.com)
|
10 |
+
*/
|
11 |
+
|
12 |
+
|
13 |
+
if ( ! class_exists( 'WpSmushHelper' ) ) {
|
14 |
+
|
15 |
+
class WpSmushHelper {
|
16 |
+
|
17 |
+
function __construct() {
|
18 |
+
$this->init();
|
19 |
+
}
|
20 |
+
|
21 |
+
function init() {
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Return unfiltered file path
|
27 |
+
*
|
28 |
+
* @param $attachment_id
|
29 |
+
*
|
30 |
+
* @return bool
|
31 |
+
*/
|
32 |
+
function get_attached_file( $attachment_id ) {
|
33 |
+
if ( empty( $attachment_id ) ) {
|
34 |
+
return false;
|
35 |
+
}
|
36 |
+
|
37 |
+
$file_path = get_attached_file( $attachment_id );
|
38 |
+
if ( ! empty( $file_path ) && strpos( $file_path, 's3' ) !== false ) {
|
39 |
+
$file_path = get_attached_file( $attachment_id, true );
|
40 |
+
}
|
41 |
+
|
42 |
+
return $file_path;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
global $wpsmush_helper;
|
47 |
+
$wpsmush_helper = new WpSmushHelper();
|
48 |
+
|
49 |
+
}
|
lib/class-wp-smush-nextgen.php
CHANGED
@@ -22,7 +22,21 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
|
|
22 |
var $is_nextgen_active = false;
|
23 |
|
24 |
function __construct() {
|
|
|
|
|
|
|
|
|
25 |
global $WpSmush;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
//Auto Smush image, if enabled, runs after Nextgen is finished uploading the image
|
28 |
//Allows to override whether to auto smush nextgen image or not
|
@@ -38,7 +52,37 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
|
|
38 |
|
39 |
//Resmush Image: Handles the single/Manual resmush image request for NextGen Gallery
|
40 |
add_action( 'wp_ajax_smush_resmush_nextgen_image', array( $this, 'resmush_image' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
43 |
|
44 |
/**
|
@@ -175,7 +219,7 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
|
|
175 |
|
176 |
//Check if registered size is supposed to be converted or not
|
177 |
global $wpsmushit_admin;
|
178 |
-
if( 'full' != $size && $wpsmushit_admin->skip_image_size( $size ) ) {
|
179 |
return false;
|
180 |
}
|
181 |
|
@@ -274,8 +318,8 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
|
|
274 |
}
|
275 |
}
|
276 |
//Total Stats
|
277 |
-
$stats
|
278 |
-
$stats['total_images'] = !empty( $stats['sizes'] ) ? count( $stats['sizes'] ) : 0;
|
279 |
|
280 |
//If there was any compression and there was no error in smushing
|
281 |
if ( isset( $stats['stats']['bytes'] ) && $stats['stats']['bytes'] >= 0 && ! $has_errors ) {
|
@@ -687,7 +731,7 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
|
|
687 |
$resized = $wpsmush_resize->perform_resize( $file_path, $original_file_size, $attachment_id, '', false );
|
688 |
|
689 |
//If resize wasn't successful
|
690 |
-
if ( ! $resized ) {
|
691 |
//Unlink Image, if other size path is not similar
|
692 |
$this->maybe_unlink( $file_path, $sizes, $image, $storage );
|
693 |
|
@@ -703,7 +747,7 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
|
|
703 |
//Updated File size
|
704 |
$u_file_size = filesize( $file_path );
|
705 |
|
706 |
-
$savings['bytes']
|
707 |
$savings['size_before'] = $original_file_size;
|
708 |
$savings['size_after'] = $u_file_size;
|
709 |
|
@@ -720,13 +764,13 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
|
|
720 |
$meta['full']['height'] = ! empty( $resized['height'] ) ? $resized['height'] : $meta['height'];
|
721 |
|
722 |
/**
|
723 |
-
* Called after the image
|
724 |
* Can be used to update the stored stats
|
725 |
*/
|
726 |
do_action( 'wp_smush_image_nextgen_resized', $attachment_id, array( 'stats' => $savings ) );
|
727 |
|
728 |
/**
|
729 |
-
* Called after the image
|
730 |
* Can be used to update the stored stats
|
731 |
*/
|
732 |
do_action( 'wp_smush_image_resized', $attachment_id, $savings );
|
@@ -762,7 +806,7 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
|
|
762 |
//Check if the file name is similar to one of the image sizes
|
763 |
$path_parts = pathinfo( $path );
|
764 |
|
765 |
-
$filename
|
766 |
foreach ( $sizes as $image_size ) {
|
767 |
$file_path_size = $storage->get_image_abspath( $image, $image_size );
|
768 |
if ( false === strpos( $file_path_size, $filename ) ) {
|
@@ -785,8 +829,10 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
|
|
785 |
|
786 |
//Extend NextGen Mixin class to smush dynamic images
|
787 |
if ( class_exists( 'WpSmushNextGen' ) ) {
|
788 |
-
global $WpSmush;
|
789 |
-
$wpsmushnextgen
|
|
|
|
|
790 |
|
791 |
//Extend Nextgen Mixin class and override the generate_image_size, to optimize dynamic thumbnails, generated by nextgen, check for auto smush
|
792 |
if ( ! class_exists( 'WpSmushNextGenDynamicThumbs' ) && class_exists( 'Mixin' ) && $WpSmush->is_auto_smush_enabled() ) {
|
22 |
var $is_nextgen_active = false;
|
23 |
|
24 |
function __construct() {
|
25 |
+
$this->init();
|
26 |
+
}
|
27 |
+
|
28 |
+
function init() {
|
29 |
global $WpSmush;
|
30 |
+
//Filters the setting variable to add S3 setting title and description
|
31 |
+
add_filter( 'wp_smush_settings', array( $this, 'register' ), 5 );
|
32 |
+
|
33 |
+
//Filters the setting variable to add S3 setting in premium features
|
34 |
+
add_filter( 'wp_smush_pro_settings', array( $this, 'add_setting' ), 5 );
|
35 |
+
|
36 |
+
//return if not a pro user
|
37 |
+
if( !$WpSmush->validate_install() ) {
|
38 |
+
return;
|
39 |
+
}
|
40 |
|
41 |
//Auto Smush image, if enabled, runs after Nextgen is finished uploading the image
|
42 |
//Allows to override whether to auto smush nextgen image or not
|
52 |
|
53 |
//Resmush Image: Handles the single/Manual resmush image request for NextGen Gallery
|
54 |
add_action( 'wp_ajax_smush_resmush_nextgen_image', array( $this, 'resmush_image' ) );
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Filters the setting variable to add S3 setting title and description
|
59 |
+
*
|
60 |
+
* @param $settings
|
61 |
+
*
|
62 |
+
* @return mixed
|
63 |
+
*/
|
64 |
+
function register( $settings ) {
|
65 |
+
$settings['nextgen'] = array(
|
66 |
+
'label' => esc_html__( 'Enable NextGen Gallery integration', 'wp-smushit' ),
|
67 |
+
'desc' => esc_html__( 'Allow smushing images directly through NextGen Gallery settings.', 'wp-smushit' )
|
68 |
+
);
|
69 |
|
70 |
+
return $settings;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Append S3 in pro feature list
|
75 |
+
*
|
76 |
+
* @param $pro_settings
|
77 |
+
*
|
78 |
+
* @return array
|
79 |
+
*/
|
80 |
+
function add_setting( $pro_settings ) {
|
81 |
+
if ( ! isset( $pro_settings['nextgen'] ) ) {
|
82 |
+
$pro_settings[] = 'nextgen';
|
83 |
+
}
|
84 |
+
|
85 |
+
return $pro_settings;
|
86 |
}
|
87 |
|
88 |
/**
|
219 |
|
220 |
//Check if registered size is supposed to be converted or not
|
221 |
global $wpsmushit_admin;
|
222 |
+
if ( 'full' != $size && $wpsmushit_admin->skip_image_size( $size ) ) {
|
223 |
return false;
|
224 |
}
|
225 |
|
318 |
}
|
319 |
}
|
320 |
//Total Stats
|
321 |
+
$stats = $WpSmush->total_compression( $stats );
|
322 |
+
$stats['total_images'] = ! empty( $stats['sizes'] ) ? count( $stats['sizes'] ) : 0;
|
323 |
|
324 |
//If there was any compression and there was no error in smushing
|
325 |
if ( isset( $stats['stats']['bytes'] ) && $stats['stats']['bytes'] >= 0 && ! $has_errors ) {
|
731 |
$resized = $wpsmush_resize->perform_resize( $file_path, $original_file_size, $attachment_id, '', false );
|
732 |
|
733 |
//If resize wasn't successful
|
734 |
+
if ( ! $resized || $resized['filesize'] == $original_file_size ) {
|
735 |
//Unlink Image, if other size path is not similar
|
736 |
$this->maybe_unlink( $file_path, $sizes, $image, $storage );
|
737 |
|
747 |
//Updated File size
|
748 |
$u_file_size = filesize( $file_path );
|
749 |
|
750 |
+
$savings['bytes'] = $original_file_size > $u_file_size ? $original_file_size - $u_file_size : 0;
|
751 |
$savings['size_before'] = $original_file_size;
|
752 |
$savings['size_after'] = $u_file_size;
|
753 |
|
764 |
$meta['full']['height'] = ! empty( $resized['height'] ) ? $resized['height'] : $meta['height'];
|
765 |
|
766 |
/**
|
767 |
+
* Called after the image has been successfully resized
|
768 |
* Can be used to update the stored stats
|
769 |
*/
|
770 |
do_action( 'wp_smush_image_nextgen_resized', $attachment_id, array( 'stats' => $savings ) );
|
771 |
|
772 |
/**
|
773 |
+
* Called after the image has been successfully resized
|
774 |
* Can be used to update the stored stats
|
775 |
*/
|
776 |
do_action( 'wp_smush_image_resized', $attachment_id, $savings );
|
806 |
//Check if the file name is similar to one of the image sizes
|
807 |
$path_parts = pathinfo( $path );
|
808 |
|
809 |
+
$filename = ! empty( $path_parts['basename'] ) ? $path_parts['basename'] : $path_parts['filename'];
|
810 |
foreach ( $sizes as $image_size ) {
|
811 |
$file_path_size = $storage->get_image_abspath( $image, $image_size );
|
812 |
if ( false === strpos( $file_path_size, $filename ) ) {
|
829 |
|
830 |
//Extend NextGen Mixin class to smush dynamic images
|
831 |
if ( class_exists( 'WpSmushNextGen' ) ) {
|
832 |
+
global $WpSmush, $wpsmushnextgen;
|
833 |
+
if ( ! is_object( $wpsmushnextgen ) ) {
|
834 |
+
$wpsmushnextgen = new WpSmushNextGen();
|
835 |
+
}
|
836 |
|
837 |
//Extend Nextgen Mixin class and override the generate_image_size, to optimize dynamic thumbnails, generated by nextgen, check for auto smush
|
838 |
if ( ! class_exists( 'WpSmushNextGenDynamicThumbs' ) && class_exists( 'Mixin' ) && $WpSmush->is_auto_smush_enabled() ) {
|
lib/class-wp-smush-png_jpg.php
CHANGED
@@ -52,13 +52,15 @@ if ( ! class_exists( 'WpSmushPngtoJpg' ) ) {
|
|
52 |
*/
|
53 |
function is_transparent( $id = '', $file = '' ) {
|
54 |
|
|
|
|
|
55 |
//No attachment id/ file path, return
|
56 |
if ( empty( $id ) && empty( $file ) ) {
|
57 |
return false;
|
58 |
}
|
59 |
|
60 |
if ( empty( $file ) ) {
|
61 |
-
$file = get_attached_file( $id );
|
62 |
}
|
63 |
|
64 |
//Check if File exists
|
@@ -140,13 +142,8 @@ if ( ! class_exists( 'WpSmushPngtoJpg' ) ) {
|
|
140 |
$this->is_transparent = $this->is_transparent( $id, $file );
|
141 |
|
142 |
//If we are suppose to convert transaprent images, skip is transparent check
|
143 |
-
if ( $convert_transparent ) {
|
144 |
$should_convert = true;
|
145 |
-
} else {
|
146 |
-
if ( ! $this->is_transparent ) {
|
147 |
-
//If image is not transparent
|
148 |
-
$should_convert = true;
|
149 |
-
}
|
150 |
}
|
151 |
|
152 |
return $should_convert;
|
@@ -157,8 +154,12 @@ if ( ! class_exists( 'WpSmushPngtoJpg' ) ) {
|
|
157 |
*
|
158 |
* @param string $id Atachment id
|
159 |
*
|
160 |
-
* @
|
|
|
|
|
|
|
161 |
*
|
|
|
162 |
*/
|
163 |
function can_be_converted( $id = '', $size = 'full', $mime = '', $file = '' ) {
|
164 |
|
@@ -178,18 +179,18 @@ if ( ! class_exists( 'WpSmushPngtoJpg' ) ) {
|
|
178 |
}
|
179 |
|
180 |
//If already tried the conversion
|
181 |
-
if ( get_post_meta( $id, WP_SMUSH_PREFIX . 'pngjpg_savings',
|
182 |
return false;
|
183 |
}
|
184 |
|
185 |
//Check if registered size is supposed to be converted or not
|
186 |
-
global $wpsmushit_admin;
|
187 |
if ( 'full' != $size && $wpsmushit_admin->skip_image_size( $size ) ) {
|
188 |
return false;
|
189 |
}
|
190 |
|
191 |
if ( empty( $file ) ) {
|
192 |
-
$file = get_attached_file( $id );
|
193 |
}
|
194 |
|
195 |
/** Whether to convert to jpg or not **/
|
@@ -440,20 +441,26 @@ if ( ! class_exists( 'WpSmushPngtoJpg' ) ) {
|
|
440 |
}
|
441 |
|
442 |
/**
|
443 |
-
* Convert a PNG to JPG Lossless
|
444 |
*
|
445 |
-
* @param $id
|
|
|
446 |
*
|
447 |
-
* @
|
|
|
|
|
448 |
*/
|
449 |
function png_to_jpg( $id = '', $meta = '' ) {
|
|
|
450 |
|
451 |
//If we don't have meta or ID
|
452 |
if ( empty( $id ) || empty( $meta ) ) {
|
453 |
return $meta;
|
454 |
}
|
455 |
|
456 |
-
|
|
|
|
|
457 |
|
458 |
/** Whether to convert to jpg or not **/
|
459 |
$should_convert = $this->can_be_converted( $id );
|
@@ -484,7 +491,7 @@ if ( ! class_exists( 'WpSmushPngtoJpg' ) ) {
|
|
484 |
$should_convert = $this->can_be_converted( $id, $size_k, 'image/png', $s_file );
|
485 |
|
486 |
//Perform the conversion
|
487 |
-
if ( ! $should_convert
|
488 |
continue;
|
489 |
}
|
490 |
|
@@ -502,8 +509,8 @@ if ( ! class_exists( 'WpSmushPngtoJpg' ) ) {
|
|
502 |
}
|
503 |
|
504 |
//Save the original File URL
|
505 |
-
$o_file = ! empty( $
|
506 |
-
|
507 |
|
508 |
/**
|
509 |
* Do action, if the PNG to JPG conversion was successful
|
52 |
*/
|
53 |
function is_transparent( $id = '', $file = '' ) {
|
54 |
|
55 |
+
global $wpsmush_helper;
|
56 |
+
|
57 |
//No attachment id/ file path, return
|
58 |
if ( empty( $id ) && empty( $file ) ) {
|
59 |
return false;
|
60 |
}
|
61 |
|
62 |
if ( empty( $file ) ) {
|
63 |
+
$file = $wpsmush_helper->get_attached_file( $id );
|
64 |
}
|
65 |
|
66 |
//Check if File exists
|
142 |
$this->is_transparent = $this->is_transparent( $id, $file );
|
143 |
|
144 |
//If we are suppose to convert transaprent images, skip is transparent check
|
145 |
+
if ( $convert_transparent || !$this->is_transparent ) {
|
146 |
$should_convert = true;
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
|
149 |
return $should_convert;
|
154 |
*
|
155 |
* @param string $id Atachment id
|
156 |
*
|
157 |
+
* @param string $id
|
158 |
+
* @param string $size
|
159 |
+
* @param string $mime
|
160 |
+
* @param string $file
|
161 |
*
|
162 |
+
* @return bool True/False Can be converted or not
|
163 |
*/
|
164 |
function can_be_converted( $id = '', $size = 'full', $mime = '', $file = '' ) {
|
165 |
|
179 |
}
|
180 |
|
181 |
//If already tried the conversion
|
182 |
+
if ( get_post_meta( $id, WP_SMUSH_PREFIX . 'pngjpg_savings', true ) ) {
|
183 |
return false;
|
184 |
}
|
185 |
|
186 |
//Check if registered size is supposed to be converted or not
|
187 |
+
global $wpsmushit_admin, $wpsmush_helper;
|
188 |
if ( 'full' != $size && $wpsmushit_admin->skip_image_size( $size ) ) {
|
189 |
return false;
|
190 |
}
|
191 |
|
192 |
if ( empty( $file ) ) {
|
193 |
+
$file = $wpsmush_helper->get_attached_file( $id );
|
194 |
}
|
195 |
|
196 |
/** Whether to convert to jpg or not **/
|
441 |
}
|
442 |
|
443 |
/**
|
444 |
+
* Convert a PNG to JPG, Lossless Conversion, if we have any savings
|
445 |
*
|
446 |
+
* @param string $id
|
447 |
+
* @param string $meta
|
448 |
*
|
449 |
+
* @uses WpSmushBackup::add_to_image_backup_sizes()
|
450 |
+
*
|
451 |
+
* @return mixed|string
|
452 |
*/
|
453 |
function png_to_jpg( $id = '', $meta = '' ) {
|
454 |
+
global $wpsmush_backup;
|
455 |
|
456 |
//If we don't have meta or ID
|
457 |
if ( empty( $id ) || empty( $meta ) ) {
|
458 |
return $meta;
|
459 |
}
|
460 |
|
461 |
+
global $wpsmush_helper;
|
462 |
+
|
463 |
+
$file = $wpsmush_helper->get_attached_file( $id );
|
464 |
|
465 |
/** Whether to convert to jpg or not **/
|
466 |
$should_convert = $this->can_be_converted( $id );
|
491 |
$should_convert = $this->can_be_converted( $id, $size_k, 'image/png', $s_file );
|
492 |
|
493 |
//Perform the conversion
|
494 |
+
if ( ! $should_convert ) {
|
495 |
continue;
|
496 |
}
|
497 |
|
509 |
}
|
510 |
|
511 |
//Save the original File URL
|
512 |
+
$o_file = ! empty( $file ) ? $file : get_post_meta( $id, '_wp_attached_file', true );
|
513 |
+
$wpsmush_backup->add_to_image_backup_sizes( $id, $o_file, 'smush_png_path' );
|
514 |
|
515 |
/**
|
516 |
* Do action, if the PNG to JPG conversion was successful
|
lib/class-wp-smush-resize.php
CHANGED
@@ -80,12 +80,14 @@ if ( ! class_exists( 'WpSmushResize' ) ) {
|
|
80 |
*/
|
81 |
public function should_resize( $id = '', $meta = '' ) {
|
82 |
|
|
|
|
|
83 |
//If resizing not enabled, or if both max width and height is set to 0, return
|
84 |
if ( ! $this->resize_enabled || ( $this->max_w == 0 && $this->max_h == 0 ) ) {
|
85 |
return false;
|
86 |
}
|
87 |
|
88 |
-
$file_path = get_attached_file( $id );
|
89 |
|
90 |
if ( ! empty( $file_path ) ) {
|
91 |
|
@@ -159,6 +161,14 @@ if ( ! class_exists( 'WpSmushResize' ) ) {
|
|
159 |
return $meta;
|
160 |
}
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
//Check if the image should be resized or not
|
163 |
$should_resize = $this->should_resize( $id, $meta );
|
164 |
|
@@ -185,14 +195,15 @@ if ( ! class_exists( 'WpSmushResize' ) ) {
|
|
185 |
}
|
186 |
|
187 |
//Good to go
|
188 |
-
$file_path = get_attached_file( $id );
|
189 |
|
190 |
$original_file_size = filesize( $file_path );
|
191 |
|
192 |
$resize = $this->perform_resize( $file_path, $original_file_size, $id, $meta );
|
193 |
|
194 |
//If resize wasn't successful
|
195 |
-
if ( ! $resize ) {
|
|
|
196 |
return $meta;
|
197 |
}
|
198 |
|
@@ -219,7 +230,7 @@ if ( ! class_exists( 'WpSmushResize' ) ) {
|
|
219 |
$meta['height'] = ! empty( $resize['height'] ) ? $resize['height'] : $meta['height'];
|
220 |
|
221 |
/**
|
222 |
-
* Called after the image
|
223 |
* Can be used to update the stored stats
|
224 |
*/
|
225 |
do_action( 'wp_smush_image_resized', $id, $savings );
|
@@ -287,19 +298,15 @@ if ( ! class_exists( 'WpSmushResize' ) ) {
|
|
287 |
|
288 |
$data['file_path'] = $resize_path;
|
289 |
|
290 |
-
$file_size
|
|
|
291 |
if ( $file_size > $original_file_size ) {
|
292 |
//Don't Unlink for nextgen images
|
293 |
if ( $unlink ) {
|
294 |
$this->maybe_unlink( $resize_path, $meta );
|
295 |
}
|
296 |
-
|
297 |
-
return false;
|
298 |
}
|
299 |
|
300 |
-
//Store filesize
|
301 |
-
$data['filesize'] = $file_size;
|
302 |
-
|
303 |
return $data;
|
304 |
}
|
305 |
|
80 |
*/
|
81 |
public function should_resize( $id = '', $meta = '' ) {
|
82 |
|
83 |
+
global $wpsmush_helper;
|
84 |
+
|
85 |
//If resizing not enabled, or if both max width and height is set to 0, return
|
86 |
if ( ! $this->resize_enabled || ( $this->max_w == 0 && $this->max_h == 0 ) ) {
|
87 |
return false;
|
88 |
}
|
89 |
|
90 |
+
$file_path = $wpsmush_helper->get_attached_file( $id );
|
91 |
|
92 |
if ( ! empty( $file_path ) ) {
|
93 |
|
161 |
return $meta;
|
162 |
}
|
163 |
|
164 |
+
global $wpsmush_helper;
|
165 |
+
|
166 |
+
$savings = array(
|
167 |
+
'bytes' => 0,
|
168 |
+
'size_before' => 0,
|
169 |
+
'size_after' => 0
|
170 |
+
);
|
171 |
+
|
172 |
//Check if the image should be resized or not
|
173 |
$should_resize = $this->should_resize( $id, $meta );
|
174 |
|
195 |
}
|
196 |
|
197 |
//Good to go
|
198 |
+
$file_path = $wpsmush_helper->get_attached_file( $id );
|
199 |
|
200 |
$original_file_size = filesize( $file_path );
|
201 |
|
202 |
$resize = $this->perform_resize( $file_path, $original_file_size, $id, $meta );
|
203 |
|
204 |
//If resize wasn't successful
|
205 |
+
if ( ! $resize || $resize['filesize'] == $original_file_size ) {
|
206 |
+
update_post_meta( $id, WP_SMUSH_PREFIX . 'resize_savings', $savings );
|
207 |
return $meta;
|
208 |
}
|
209 |
|
230 |
$meta['height'] = ! empty( $resize['height'] ) ? $resize['height'] : $meta['height'];
|
231 |
|
232 |
/**
|
233 |
+
* Called after the image has been successfully resized
|
234 |
* Can be used to update the stored stats
|
235 |
*/
|
236 |
do_action( 'wp_smush_image_resized', $id, $savings );
|
298 |
|
299 |
$data['file_path'] = $resize_path;
|
300 |
|
301 |
+
$file_size = filesize( $resize_path );
|
302 |
+
$data['filesize'] = $file_size;
|
303 |
if ( $file_size > $original_file_size ) {
|
304 |
//Don't Unlink for nextgen images
|
305 |
if ( $unlink ) {
|
306 |
$this->maybe_unlink( $resize_path, $meta );
|
307 |
}
|
|
|
|
|
308 |
}
|
309 |
|
|
|
|
|
|
|
310 |
return $data;
|
311 |
}
|
312 |
|
lib/class-wp-smush-s3.php
ADDED
@@ -0,0 +1,377 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package WP Smush
|
4 |
+
* @subpackage S3
|
5 |
+
* @version 2.7
|
6 |
+
*
|
7 |
+
* @author Umesh Kumar <umesh@incsub.com>
|
8 |
+
*
|
9 |
+
* @copyright (c) 2017, Incsub (http://incsub.com)
|
10 |
+
*/
|
11 |
+
if ( ! class_exists( 'WpSmushS3' ) ) {
|
12 |
+
|
13 |
+
class WpSmushS3 {
|
14 |
+
|
15 |
+
private $setup_error = '';
|
16 |
+
|
17 |
+
function __construct() {
|
18 |
+
$this->init();
|
19 |
+
}
|
20 |
+
|
21 |
+
function init() {
|
22 |
+
|
23 |
+
global $WpSmush;
|
24 |
+
|
25 |
+
//Filters the setting variable to add S3 setting title and description
|
26 |
+
add_filter( 'wp_smush_settings', array( $this, 'register' ), 6 );
|
27 |
+
|
28 |
+
//Filters the setting variable to add S3 setting in premium features
|
29 |
+
add_filter( 'wp_smush_pro_settings', array( $this, 'add_setting' ), 6 );
|
30 |
+
|
31 |
+
//return if not a pro user
|
32 |
+
if ( ! $WpSmush->validate_install() ) {
|
33 |
+
return;
|
34 |
+
}
|
35 |
+
$this->check_client();
|
36 |
+
|
37 |
+
//Check if the file exists for the given path and download
|
38 |
+
add_action( 'smush_file_exists', array( $this, 'maybe_download_file' ), 10, 3 );
|
39 |
+
|
40 |
+
//Check if the backup file exists
|
41 |
+
add_filter( 'smush_backup_exists', array( $this, 'backup_exists_on_s3' ), 10, 3 );
|
42 |
+
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Filters the setting variable to add S3 setting title and description
|
48 |
+
*
|
49 |
+
* @param $settings
|
50 |
+
*
|
51 |
+
* @return mixed
|
52 |
+
*/
|
53 |
+
function register( $settings ) {
|
54 |
+
$plugin_url = esc_url( "https://wordpress.org/plugins/amazon-s3-and-cloudfront/" );
|
55 |
+
$settings['s3'] = array(
|
56 |
+
'label' => esc_html__( 'Amazon S3 support', 'wp-smushit' ),
|
57 |
+
'desc' => sprintf( esc_html__( 'Optimise your images stored on Amazon S3. This feature uses the %sWP Offload S3%s plugin and is needed if the option %sRemove Files From Server%s is enabled. Images will be smushed as per your current settings.', 'wp-smushit' ), "<a href='" . $plugin_url . "' target = '_blank'>", "</a>", "<b>", "</b>" )
|
58 |
+
);
|
59 |
+
|
60 |
+
return $settings;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Append S3 in pro feature list
|
65 |
+
*
|
66 |
+
* @param $pro_settings
|
67 |
+
*
|
68 |
+
* @return array
|
69 |
+
*/
|
70 |
+
function add_setting( $pro_settings ) {
|
71 |
+
|
72 |
+
if ( ! isset( $pro_settings['s3'] ) ) {
|
73 |
+
$pro_settings[] = 's3';
|
74 |
+
}
|
75 |
+
|
76 |
+
return $pro_settings;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Check if WP S3 Offload is configured properly or not
|
81 |
+
*
|
82 |
+
* If not, hook at the end of setting row to show a error message
|
83 |
+
*/
|
84 |
+
function check_client() {
|
85 |
+
|
86 |
+
global $as3cf, $WpSmush, $wpsmush_settings;
|
87 |
+
$show_error = false;
|
88 |
+
//If S3 integration is not enabled, return
|
89 |
+
$setting_m_key = WP_SMUSH_PREFIX . 's3';
|
90 |
+
$setting_val = $WpSmush->validate_install() ? $wpsmush_settings->get_setting( $setting_m_key, false ) : 0;
|
91 |
+
|
92 |
+
if ( ! $setting_val ) {
|
93 |
+
return;
|
94 |
+
}
|
95 |
+
|
96 |
+
//Check if plugin is setup or not
|
97 |
+
//In case for some reason, we couldn't find the function
|
98 |
+
if ( ! is_object( $as3cf ) || ! method_exists( $as3cf, 'is_plugin_setup' ) ) {
|
99 |
+
$show_error = true;
|
100 |
+
$support_url = esc_url( "https://premium.wpmudev.org/contact" );
|
101 |
+
$this->setup_error = sprintf( esc_html__( "We are having trouble interacting with WP S3 Offload, make sure the plugin is activated. Or you can %sreport a bug%s.", "wp-smushit" ), '<a href="' . $support_url . '" target="_blank">', '</a>' );
|
102 |
+
}
|
103 |
+
|
104 |
+
//Plugin is not setup, or some information is missing
|
105 |
+
if ( ! $as3cf->is_plugin_setup() ) {
|
106 |
+
$show_error = true;
|
107 |
+
$configure_url = $as3cf->get_plugin_page_url();
|
108 |
+
$this->setup_error = sprintf( esc_html__( "It seems you haven't finished setting up WP S3 Offload yet, %sConfigure%s it now to enable Amazon S3 support.", "wp-smushit" ), "<a href='" . $configure_url . "' target='_blank'>", "</a>" );
|
109 |
+
}
|
110 |
+
//Return Early if we don't need to do anything
|
111 |
+
if ( ! $show_error ) {
|
112 |
+
return;
|
113 |
+
}
|
114 |
+
//Hook at the end of setting row to output a error div
|
115 |
+
add_action( 'smush_setting_row_end', array( $this, 's3_setup_error' ) );
|
116 |
+
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Prints the error message if any
|
121 |
+
*
|
122 |
+
* @return null
|
123 |
+
*/
|
124 |
+
function s3_setup_error( $setting_key ) {
|
125 |
+
if ( empty( $this->setup_error ) || 's3' != $setting_key ) {
|
126 |
+
return null;
|
127 |
+
}
|
128 |
+
echo "<div class='wp-smush-notice smush-s3-setup-error'><i class='dev-icon wdv-icon wdv-icon-fw wdv-icon-exclamation-sign'></i><p>$this->setup_error</p></div>";
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Checks if the given attachment is on S3 or not, Returns S3 URL or WP Error
|
133 |
+
*
|
134 |
+
* @param $attachment_id
|
135 |
+
*
|
136 |
+
* @return bool|false|string
|
137 |
+
*
|
138 |
+
*/
|
139 |
+
function is_image_on_s3( $attachment_id = '' ) {
|
140 |
+
global $as3cf;
|
141 |
+
if ( empty( $attachment_id ) ) {
|
142 |
+
return false;
|
143 |
+
}
|
144 |
+
|
145 |
+
//If we only have the attachment id
|
146 |
+
$full_url = $as3cf->is_attachment_served_by_s3( $attachment_id );
|
147 |
+
//If the filepath contains S3, get the s3 URL for the file
|
148 |
+
if ( ! empty( $full_url ) ) {
|
149 |
+
$full_url = $as3cf->get_attachment_url( $attachment_id );
|
150 |
+
} else {
|
151 |
+
$full_url = false;
|
152 |
+
}
|
153 |
+
|
154 |
+
return $full_url;
|
155 |
+
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Download a specified file to local server with respect to provided attachment id
|
160 |
+
* and/or Attachment path
|
161 |
+
*
|
162 |
+
* @param $attachment_id
|
163 |
+
*
|
164 |
+
* @param array $size_details
|
165 |
+
*
|
166 |
+
* @param string $uf_file_path
|
167 |
+
*
|
168 |
+
* @return string|bool Returns file path or false
|
169 |
+
*
|
170 |
+
*/
|
171 |
+
function download_file( $attachment_id, $size_details = array(), $uf_file_path = '' ) {
|
172 |
+
global $WpSmush, $wpsmush_settings;
|
173 |
+
if ( empty( $attachment_id ) || ! $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 's3', false ) || ! $WpSmush->validate_install() ) {
|
174 |
+
return false;
|
175 |
+
}
|
176 |
+
|
177 |
+
global $as3cf;
|
178 |
+
$renamed = $s3_object = $s3_url = $file = false;
|
179 |
+
|
180 |
+
//If file path wasn't specified in argument
|
181 |
+
$uf_file_path = empty( $uf_file_path ) ? get_attached_file( $attachment_id, true ) : $uf_file_path;
|
182 |
+
|
183 |
+
//If we have plugin method available, us that otherwise check it ourselves
|
184 |
+
if ( method_exists( $as3cf, 'is_attachment_served_by_s3' ) ) {
|
185 |
+
$s3_object = $as3cf->is_attachment_served_by_s3( $attachment_id );
|
186 |
+
$size_prefix = dirname( $s3_object['key'] );
|
187 |
+
$size_file_prefix = ( '.' === $size_prefix ) ? '' : $size_prefix . '/';
|
188 |
+
if ( ! empty( $size_details ) && is_array( $size_details ) ) {
|
189 |
+
$s3_object['key'] = path_join( $size_file_prefix, $size_details['file'] );
|
190 |
+
} elseif ( ! empty( $uf_file_path ) ) {
|
191 |
+
//Get the File path using basename for given attachment path
|
192 |
+
$s3_object['key'] = path_join( $size_file_prefix, wp_basename( $uf_file_path ) );
|
193 |
+
}
|
194 |
+
|
195 |
+
//Try to download the attachment
|
196 |
+
if ( $s3_object && is_object( $as3cf->plugin_compat ) && method_exists( $as3cf->plugin_compat, 'copy_s3_file_to_server' ) ) {
|
197 |
+
//Download file
|
198 |
+
$file = $as3cf->plugin_compat->copy_s3_file_to_server( $s3_object, $uf_file_path );
|
199 |
+
}
|
200 |
+
|
201 |
+
if ( $file ) {
|
202 |
+
return $file;
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
//If we don't have the file, Try it the basic way
|
207 |
+
if ( ! $file ) {
|
208 |
+
$s3_url = $this->is_image_on_s3( $attachment_id );
|
209 |
+
|
210 |
+
//If we couldn't get the image URL, return false
|
211 |
+
if ( is_wp_error( $s3_url ) || empty( $s3_url ) || ! $s3_url ) {
|
212 |
+
return false;
|
213 |
+
}
|
214 |
+
|
215 |
+
if ( ! empty( $size_details ) ) {
|
216 |
+
//If size details are available, Update the URL to get the image for the specified size
|
217 |
+
$s3_url = str_replace( wp_basename( $s3_url ), $size_details['file'], $s3_url );
|
218 |
+
} elseif ( ! empty( $uf_file_path ) ) {
|
219 |
+
//Get the File path using basename for given attachment path
|
220 |
+
$s3_url = str_replace( wp_basename( $s3_url ), wp_basename( $uf_file_path ), $s3_url );
|
221 |
+
}
|
222 |
+
|
223 |
+
//Download the file
|
224 |
+
$temp_file = download_url( $s3_url );
|
225 |
+
if ( ! is_wp_error( $temp_file ) ) {
|
226 |
+
$renamed = @copy( $temp_file, $uf_file_path );
|
227 |
+
unlink( $temp_file );
|
228 |
+
}
|
229 |
+
|
230 |
+
//If we were able to successfully rename the file, return file path
|
231 |
+
if ( $renamed ) {
|
232 |
+
|
233 |
+
return $uf_file_path;
|
234 |
+
}
|
235 |
+
}
|
236 |
+
|
237 |
+
return false;
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Check if file exists for the given path
|
242 |
+
*
|
243 |
+
* @param string $attachment_id
|
244 |
+
* @param string $file_path
|
245 |
+
*
|
246 |
+
* @return bool
|
247 |
+
*/
|
248 |
+
function does_image_exists( $attachment_id = '', $file_path = '' ) {
|
249 |
+
global $as3cf;
|
250 |
+
if ( empty( $attachment_id ) || empty( $file_path ) ) {
|
251 |
+
return false;
|
252 |
+
}
|
253 |
+
//Return if method doesn't exists
|
254 |
+
if ( ! method_exists( $as3cf, 'is_attachment_served_by_s3' ) ) {
|
255 |
+
error_log( "Couldn't find method is_attachment_served_by_s3." );
|
256 |
+
|
257 |
+
return false;
|
258 |
+
}
|
259 |
+
//Get s3 object for the file
|
260 |
+
$s3_object = $as3cf->is_attachment_served_by_s3( $attachment_id );
|
261 |
+
|
262 |
+
$size_prefix = dirname( $s3_object['key'] );
|
263 |
+
$size_file_prefix = ( '.' === $size_prefix ) ? '' : $size_prefix . '/';
|
264 |
+
|
265 |
+
//Get the File path using basename for given attachment path
|
266 |
+
$s3_object['key'] = path_join( $size_file_prefix, wp_basename( $file_path ) );
|
267 |
+
|
268 |
+
//Get bucket details
|
269 |
+
$bucket = $as3cf->get_setting( 'bucket' );
|
270 |
+
$region = $as3cf->get_setting( 'region' );
|
271 |
+
|
272 |
+
if ( is_wp_error( $region ) ) {
|
273 |
+
return false;
|
274 |
+
}
|
275 |
+
|
276 |
+
$s3client = $as3cf->get_s3client( $region );
|
277 |
+
|
278 |
+
$file_exists = $s3client->doesObjectExist( $bucket, $s3_object['key'] );
|
279 |
+
return $file_exists;
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Check if the file is served by S3 and download the file for given path
|
284 |
+
*
|
285 |
+
* @param string $file_path Full file path
|
286 |
+
* @param string $attachment_id
|
287 |
+
* @param array $size_details Array of width and height for the image
|
288 |
+
*
|
289 |
+
* @return bool|string False/ File Path
|
290 |
+
*/
|
291 |
+
function maybe_download_file( $file_path = '', $attachment_id = '', $size_details = array() ) {
|
292 |
+
if ( empty( $file_path ) || empty( $attachment_id ) ) {
|
293 |
+
return false;
|
294 |
+
}
|
295 |
+
//Download if file not exists and served by S3
|
296 |
+
if ( ! file_exists( $file_path ) && $this->is_image_on_s3( $attachment_id ) ) {
|
297 |
+
return $this->download_file( $attachment_id, $size_details, $file_path );
|
298 |
+
}
|
299 |
+
|
300 |
+
return false;
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Checks if we've backup on S3 for the given attachment id and backup path
|
305 |
+
*
|
306 |
+
* @param string $attachment_id
|
307 |
+
* @param string $backup_path
|
308 |
+
*
|
309 |
+
* @return bool
|
310 |
+
*/
|
311 |
+
function backup_exists_on_s3( $exists, $attachment_id = '', $backup_path = '' ) {
|
312 |
+
//If the file is on S3, Check if backup image object exists
|
313 |
+
if ( $this->is_image_on_s3( $attachment_id ) ) {
|
314 |
+
return $this->does_image_exists( $attachment_id, $backup_path );
|
315 |
+
}
|
316 |
+
|
317 |
+
return $exists;
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
global $wpsmush_s3;
|
322 |
+
$wpsmush_s3 = new WpSmushS3();
|
323 |
+
|
324 |
+
}
|
325 |
+
|
326 |
+
if ( class_exists( 'AS3CF_Plugin_Compatibility' ) && ! class_exists( 'wp_smush_s3_compat' ) ) {
|
327 |
+
class wp_smush_s3_compat extends AS3CF_Plugin_Compatibility {
|
328 |
+
|
329 |
+
function __construct() {
|
330 |
+
$this->init();
|
331 |
+
}
|
332 |
+
|
333 |
+
function init() {
|
334 |
+
//Plugin Compatibility with Amazon S3
|
335 |
+
add_filter( 'as3cf_get_attached_file', array( $this, 'smush_download_file' ), 11, 4 );
|
336 |
+
}
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Download the attached file from S3 to local server
|
340 |
+
*
|
341 |
+
* @param $url
|
342 |
+
* @param $file
|
343 |
+
* @param $attachment_id
|
344 |
+
* @param $s3_object
|
345 |
+
*/
|
346 |
+
function smush_download_file( $url, $file, $attachment_id, $s3_object ) {
|
347 |
+
|
348 |
+
global $as3cf, $wpsmush_settings, $WpSmush;
|
349 |
+
|
350 |
+
//Return if integration is disabled, or not a pro user
|
351 |
+
if ( ! $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 's3', false ) || ! $WpSmush->validate_install() ) {
|
352 |
+
return;
|
353 |
+
}
|
354 |
+
|
355 |
+
//If we already have the local file at specified path
|
356 |
+
if ( file_exists( $file ) ) {
|
357 |
+
return;
|
358 |
+
}
|
359 |
+
|
360 |
+
//Download image for Manual and Bulk Smush
|
361 |
+
$action = ! empty( $_GET['action'] ) ? $_GET['action'] : '';
|
362 |
+
if ( empty( $action ) || ! in_array( $action, array( 'wp_smushit_manual', 'wp_smushit_bulk' ) ) ) {
|
363 |
+
return;
|
364 |
+
}
|
365 |
+
|
366 |
+
//If the plugin compat object is not available, or the method has been updated
|
367 |
+
if ( ! is_object( $as3cf->plugin_compat ) || ! method_exists( $as3cf->plugin_compat, 'copy_image_to_server_on_action' ) ) {
|
368 |
+
return;
|
369 |
+
}
|
370 |
+
|
371 |
+
$as3cf->plugin_compat->copy_image_to_server_on_action( $action, true, $url, $file, $s3_object );
|
372 |
+
}
|
373 |
+
}
|
374 |
+
|
375 |
+
global $wpsmush_s3_compat;
|
376 |
+
$wpsmush_s3_compat = new wp_smush_s3_compat();
|
377 |
+
}
|
lib/class-wp-smush-share.php
CHANGED
@@ -16,13 +16,12 @@ if ( ! class_exists( 'WpSmushShare' ) ) {
|
|
16 |
function share_widget() {
|
17 |
global $wpsmushit_admin;
|
18 |
$savings = $wpsmushit_admin->stats;
|
19 |
-
$image_count = $wpsmushit_admin->smushed_count;
|
20 |
|
21 |
//If there is any saving, greater than 1Mb, show stats
|
22 |
-
if ( empty( $savings ) || empty( $savings['bytes'] ) || $savings['bytes'] <= 1048576 || $
|
23 |
return false;
|
24 |
}
|
25 |
-
$message = sprintf( esc_html__( "%s, you've smushed %d images and saved %s in total. Help your friends save bandwidth easily, and help me in my quest to Smush the internet!", "wp-smushit" ), $wpsmushit_admin->get_user_name(), $
|
26 |
$share_msg = sprintf( esc_html__( 'I saved %s on my site with WP Smush ( %s ) - wanna make your website smaller and faster?', "wp-smushit" ) , $savings['human'], urlencode( "https://wordpress.org/plugins/wp-smushit/" ) ); ?>
|
27 |
<section class="dev-box" id="wp-smush-share-widget">
|
28 |
<div class="box-content roboto-medium">
|
16 |
function share_widget() {
|
17 |
global $wpsmushit_admin;
|
18 |
$savings = $wpsmushit_admin->stats;
|
|
|
19 |
|
20 |
//If there is any saving, greater than 1Mb, show stats
|
21 |
+
if ( empty( $savings ) || empty( $savings['bytes'] ) || $savings['bytes'] <= 1048576 || $savings['total_images'] <= 1 || ! is_super_admin() ) {
|
22 |
return false;
|
23 |
}
|
24 |
+
$message = sprintf( esc_html__( "%s, you've smushed %d images and saved %s in total. Help your friends save bandwidth easily, and help me in my quest to Smush the internet!", "wp-smushit" ), $wpsmushit_admin->get_user_name(), $savings['total_images'], $savings['human'] );
|
25 |
$share_msg = sprintf( esc_html__( 'I saved %s on my site with WP Smush ( %s ) - wanna make your website smaller and faster?', "wp-smushit" ) , $savings['human'], urlencode( "https://wordpress.org/plugins/wp-smushit/" ) ); ?>
|
26 |
<section class="dev-box" id="wp-smush-share-widget">
|
27 |
<div class="box-content roboto-medium">
|
lib/class-wp-smush-ui.php
CHANGED
@@ -127,7 +127,7 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
|
|
127 |
<div class="box-content">
|
128 |
<div class="row smush-total-savings smush-total-reduction-percent">
|
129 |
|
130 |
-
<div class="wp-smush-current-progress"
|
131 |
<div class="wp-smushed-progress">
|
132 |
<div class="wp-smush-score inside">
|
133 |
<div class="tooltip-box">
|
@@ -146,9 +146,9 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
|
|
146 |
|
147 |
<div class="wp-smush-count-total">
|
148 |
<div class="wp-smush-smush-stats-wrapper">
|
149 |
-
<span class="wp-smush-optimised"><?php echo $
|
150 |
</div>
|
151 |
-
<span class="total-stats-label"><strong><?php esc_html_e( "
|
152 |
</div>
|
153 |
</div>
|
154 |
</div>
|
@@ -175,7 +175,7 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
|
|
175 |
if ( $WpSmush->lossy_enabled ) {
|
176 |
echo '<span class="smushed-count">' . intval( $wpsmushit_admin->super_smushed ) . '</span>/' . $wpsmushit_admin->total_count;
|
177 |
} else {
|
178 |
-
printf( esc_html__( "%sENABLE%s", "wp-smushit" ), '<button class="wp-smush-lossy-enable button button-small">', '</button>' );
|
179 |
} ?>
|
180 |
</span>
|
181 |
</div><?php
|
@@ -189,9 +189,9 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
|
|
189 |
}else{
|
190 |
if( !$wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'resize' ) ) {
|
191 |
//If Not enabled, Add a enable button
|
192 |
-
printf( esc_html__( "%sENABLE%s", "wp-smushit" ), '<button class="wp-smush-resize-enable button button-small">', '</button>' );
|
193 |
}else{
|
194 |
-
|
195 |
}
|
196 |
} ?>
|
197 |
</span>
|
@@ -210,43 +210,37 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
|
|
210 |
do_action('stats_ui_after_resize_savings');
|
211 |
//Pro Savings Expected: For free Version
|
212 |
if ( ! $WpSmush->validate_install() ) {
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
$savings_bytes = 2 * $savings_bytes;
|
220 |
-
$show_pro_savings = true;
|
221 |
-
}elseif( !empty( $savings ) && $savings < 80 ){
|
222 |
-
$savings = 1.1 * $savings;
|
223 |
-
$savings_bytes = 1.1 * $savings_bytes;
|
224 |
-
$show_pro_savings = true;
|
225 |
-
}
|
226 |
|
227 |
//If we have any savings
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
|
|
238 |
<hr />
|
239 |
<div class="row smush-avg-pro-savings" tooltip="<?php esc_html_e("BASED ON AVERAGE SAVINGS IF YOU UPGRADE TO PRO", "wp-smushit"); ?>">
|
240 |
<span class="float-l wp-smush-stats-label"><strong><?php esc_html_e( "PRO SAVINGS ESTIMATE", "wp-smushit" ); ?></strong><span class="wp-smush-stats-try-pro roboto-regular"><?php echo $pro_only; ?></span></span>
|
241 |
<span class="float-r wp-smush-stats">
|
242 |
<span class="wp-smush-stats-human">
|
243 |
-
<?php echo
|
244 |
</span>
|
245 |
<span class="wp-smush-stats-sep">/</span>
|
246 |
-
<span class="wp-smush-stats-percent"><?php echo
|
247 |
</span>
|
248 |
-
</div
|
249 |
-
|
250 |
}
|
251 |
/**
|
252 |
* Allows you to output any content within the stats box at the end
|
@@ -292,10 +286,11 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
|
|
292 |
'lossy',
|
293 |
'original',
|
294 |
'backup',
|
295 |
-
'png_to_jpg'
|
296 |
-
'nextgen'
|
297 |
);
|
298 |
|
|
|
|
|
299 |
if ( $WpSmush->validate_install() ) {
|
300 |
echo "<hr />";
|
301 |
}
|
@@ -321,6 +316,11 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
|
|
321 |
name="<?php echo $setting_m_key; ?>" tabindex= "0">
|
322 |
<label class="toggle-label" for="<?php echo $setting_m_key; ?>"></label>
|
323 |
</span>
|
|
|
|
|
|
|
|
|
|
|
324 |
</div>
|
325 |
<hr><?php
|
326 |
}
|
@@ -477,15 +477,15 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
|
|
477 |
<label class="toggle-label" for="<?php echo $opt_resize; ?>"></label>
|
478 |
</span>
|
479 |
<div class="wp-smush-resize-settings-wrap<?php echo $resize_checked ? '' : ' hidden'?>">
|
480 |
-
<label for="<?php echo $opt_resize . '_width'; ?>"><?php esc_html_e("
|
481 |
<input type="text" id="<?php echo $opt_resize . '_width'; ?>" class="wp-smush-resize-input" value="<?php echo isset( $resize_sizes['width'] ) && '' != $resize_sizes['width'] ? $resize_sizes['width'] : $p_width; ?>" placeholder="<?php echo $p_width; ?>" name="<?php echo $opt_resize . '_width'; ?>" tabindex="0" width=100 /> px
|
482 |
</label>
|
483 |
-
<label for"<?php echo $opt_resize . '_height'; ?>"><?php esc_html_e("
|
484 |
<input type="text" id="<?php echo $opt_resize . '_height'; ?>" class="wp-smush-resize-input" value="<?php echo isset( $resize_sizes['height'] ) && '' != $resize_sizes['height'] ? $resize_sizes['height'] : $p_height; ?>" placeholder="<?php echo $p_height; ?>" name="<?php echo $opt_resize . '_height'; ?>" tabindex="0" width=100 /> px
|
485 |
</label>
|
486 |
-
<div class="wp-smush-resize-note"><?php printf( esc_html__("Currently, your largest
|
487 |
-
<div class="wp-smush-settings-info wp-smush-size-info wp-smush-update-width hidden"><?php esc_html_e( "Just to let you know, the width you've entered is less than your largest
|
488 |
-
<div class="wp-smush-settings-info wp-smush-size-info wp-smush-update-height hidden"><?php esc_html_e( "Just to let you know, the height you’ve entered is less than your largest
|
489 |
</div>
|
490 |
</div><!-- End of Basic Settings --><?php
|
491 |
|
@@ -675,10 +675,10 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
|
|
675 |
<img src="<?php echo WP_SMUSH_URL . 'assets/images/icon-gzip.svg'; ?>" width="14px">
|
676 |
</i>
|
677 |
<span class="wp-smush-notice-text"><?php
|
678 |
-
printf( _n( "%s, you have %s%s%d%s
|
679 |
if( !$WpSmush->validate_install() ) {
|
680 |
-
printf(
|
681 |
-
esc_html_e("Free users can smush 50 images with each click.", "wp-smushit");
|
682 |
}?>
|
683 |
</span>
|
684 |
</div><?php
|
@@ -720,7 +720,7 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
|
|
720 |
</div>
|
721 |
</div>
|
722 |
<div class="wp-smush-count tc">
|
723 |
-
<?php printf( esc_html__( "%s%d%s of
|
724 |
</div>
|
725 |
</div>
|
726 |
<hr class="wp-smush-sep">
|
@@ -761,7 +761,7 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
|
|
761 |
if ( $show ) {
|
762 |
return '<div class="wp-smush-notice wp-smush-resmush-notice wp-smush-remaining" tabindex="0">
|
763 |
<i class="dev-icon"><img src="' . WP_SMUSH_URL . 'assets/images/icon-gzip.svg" width="14px"></i>
|
764 |
-
<span class="wp-smush-notice-text">' . sprintf( _n( "%s, you have %s%s%d%s
|
765 |
<button class="button button-grey button-small wp-smush-skip-resmush">' . esc_html__( "Skip", "wp-smushit" ) . '</button>
|
766 |
</div>';
|
767 |
}
|
127 |
<div class="box-content">
|
128 |
<div class="row smush-total-savings smush-total-reduction-percent">
|
129 |
|
130 |
+
<div class="wp-smush-current-progress" >
|
131 |
<div class="wp-smushed-progress">
|
132 |
<div class="wp-smush-score inside">
|
133 |
<div class="tooltip-box">
|
146 |
|
147 |
<div class="wp-smush-count-total">
|
148 |
<div class="wp-smush-smush-stats-wrapper">
|
149 |
+
<span class="wp-smush-total-optimised"><?php echo $wpsmushit_admin->stats['total_images']; ?></span>
|
150 |
</div>
|
151 |
+
<span class="total-stats-label"><strong><?php esc_html_e( "IMAGES SMUSHED", "wp-smushit" ); ?></strong></span>
|
152 |
</div>
|
153 |
</div>
|
154 |
</div>
|
175 |
if ( $WpSmush->lossy_enabled ) {
|
176 |
echo '<span class="smushed-count">' . intval( $wpsmushit_admin->super_smushed ) . '</span>/' . $wpsmushit_admin->total_count;
|
177 |
} else {
|
178 |
+
printf( esc_html__( "%sENABLE SUPER-SMUSH%s", "wp-smushit" ), '<button class="wp-smush-lossy-enable button button-small">', '</button>' );
|
179 |
} ?>
|
180 |
</span>
|
181 |
</div><?php
|
189 |
}else{
|
190 |
if( !$wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'resize' ) ) {
|
191 |
//If Not enabled, Add a enable button
|
192 |
+
printf( esc_html__( "%sENABLE IMAGE RESIZING%s", "wp-smushit" ), '<button class="wp-smush-resize-enable button button-small">', '</button>' );
|
193 |
}else{
|
194 |
+
printf( esc_html__( "%sNO RESIZE SAVINGS AVAILABLE%s", "wp-smushit" ), '<span class="total-stats-label"><strong>', '</strong></span>' );
|
195 |
}
|
196 |
} ?>
|
197 |
</span>
|
210 |
do_action('stats_ui_after_resize_savings');
|
211 |
//Pro Savings Expected: For free Version
|
212 |
if ( ! $WpSmush->validate_install() ) {
|
213 |
+
//Initialize pro savings if not set already
|
214 |
+
if( empty( $wpsmushit_admin->stats) || empty( $wpsmushit_admin->stats['pro_savings'] ) ) {
|
215 |
+
$wpsmushit_admin->set_pro_savings();
|
216 |
+
}
|
217 |
+
$pro_savings = $wpsmushit_admin->stats['pro_savings'];
|
218 |
+
$show_pro_savings = $pro_savings['savings'] > 0 ? true : false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
|
220 |
//If we have any savings
|
221 |
+
$upgrade_url = add_query_arg(
|
222 |
+
array(
|
223 |
+
'utm_source' => 'Smush-Free',
|
224 |
+
'utm_medium' => 'Banner',
|
225 |
+
'utm_campaign'=> 'pro-only-stats'
|
226 |
+
),
|
227 |
+
$wpsmushit_admin->upgrade_url
|
228 |
+
);
|
229 |
+
$pro_only = sprintf( esc_html__( '%sTRY PRO FREE%s', 'wp-smushit' ), '<a href="' . esc_url( $upgrade_url ) . '" target="_blank">', '</a>' ); ?>
|
230 |
+
<!-- Make a hidden div if not stats found -->
|
231 |
+
<div id="smush-avg-pro-savings" <?php echo $show_pro_savings ? '' : 'style="display: none;"'; ?>>
|
232 |
<hr />
|
233 |
<div class="row smush-avg-pro-savings" tooltip="<?php esc_html_e("BASED ON AVERAGE SAVINGS IF YOU UPGRADE TO PRO", "wp-smushit"); ?>">
|
234 |
<span class="float-l wp-smush-stats-label"><strong><?php esc_html_e( "PRO SAVINGS ESTIMATE", "wp-smushit" ); ?></strong><span class="wp-smush-stats-try-pro roboto-regular"><?php echo $pro_only; ?></span></span>
|
235 |
<span class="float-r wp-smush-stats">
|
236 |
<span class="wp-smush-stats-human">
|
237 |
+
<?php echo $show_pro_savings ? $pro_savings['savings']: '0.0 B'; ?>
|
238 |
</span>
|
239 |
<span class="wp-smush-stats-sep">/</span>
|
240 |
+
<span class="wp-smush-stats-percent"><?php echo $show_pro_savings ? $pro_savings['percent'] : 0; ?></span>%
|
241 |
</span>
|
242 |
+
</div>
|
243 |
+
</div><?php
|
244 |
}
|
245 |
/**
|
246 |
* Allows you to output any content within the stats box at the end
|
286 |
'lossy',
|
287 |
'original',
|
288 |
'backup',
|
289 |
+
'png_to_jpg'
|
|
|
290 |
);
|
291 |
|
292 |
+
$pro_settings = apply_filters( 'wp_smush_pro_settings', $pro_settings );
|
293 |
+
|
294 |
if ( $WpSmush->validate_install() ) {
|
295 |
echo "<hr />";
|
296 |
}
|
316 |
name="<?php echo $setting_m_key; ?>" tabindex= "0">
|
317 |
<label class="toggle-label" for="<?php echo $setting_m_key; ?>"></label>
|
318 |
</span>
|
319 |
+
<?php
|
320 |
+
/**
|
321 |
+
* Perform a action after setting row content
|
322 |
+
*/
|
323 |
+
do_action('smush_setting_row_end', $setting_key );?>
|
324 |
</div>
|
325 |
<hr><?php
|
326 |
}
|
477 |
<label class="toggle-label" for="<?php echo $opt_resize; ?>"></label>
|
478 |
</span>
|
479 |
<div class="wp-smush-resize-settings-wrap<?php echo $resize_checked ? '' : ' hidden'?>">
|
480 |
+
<label for="<?php echo $opt_resize . '_width'; ?>"><?php esc_html_e("Max width", "wp-smushit"); ?>
|
481 |
<input type="text" id="<?php echo $opt_resize . '_width'; ?>" class="wp-smush-resize-input" value="<?php echo isset( $resize_sizes['width'] ) && '' != $resize_sizes['width'] ? $resize_sizes['width'] : $p_width; ?>" placeholder="<?php echo $p_width; ?>" name="<?php echo $opt_resize . '_width'; ?>" tabindex="0" width=100 /> px
|
482 |
</label>
|
483 |
+
<label for"<?php echo $opt_resize . '_height'; ?>"><?php esc_html_e("Max height", "wp-smushit"); ?>
|
484 |
<input type="text" id="<?php echo $opt_resize . '_height'; ?>" class="wp-smush-resize-input" value="<?php echo isset( $resize_sizes['height'] ) && '' != $resize_sizes['height'] ? $resize_sizes['height'] : $p_height; ?>" placeholder="<?php echo $p_height; ?>" name="<?php echo $opt_resize . '_height'; ?>" tabindex="0" width=100 /> px
|
485 |
</label>
|
486 |
+
<div class="wp-smush-resize-note"><?php printf( esc_html__("Currently, your largest image size is set at %s%dpx wide x %dpx high%s.", "wp-smushit"), '<strong>', $max_sizes['width'], $max_sizes['height'], '</strong>' ); ?></div>
|
487 |
+
<div class="wp-smush-settings-info wp-smush-size-info wp-smush-update-width hidden"><?php esc_html_e( "Just to let you know, the width you've entered is less than your largest image and may result in pixelation.", "wp-smushit" ); ?></div>
|
488 |
+
<div class="wp-smush-settings-info wp-smush-size-info wp-smush-update-height hidden"><?php esc_html_e( "Just to let you know, the height you’ve entered is less than your largest image and may result in pixelation.", "wp-smushit" ); ?></div>
|
489 |
</div>
|
490 |
</div><!-- End of Basic Settings --><?php
|
491 |
|
675 |
<img src="<?php echo WP_SMUSH_URL . 'assets/images/icon-gzip.svg'; ?>" width="14px">
|
676 |
</i>
|
677 |
<span class="wp-smush-notice-text"><?php
|
678 |
+
printf( _n( "%s, you have %s%s%d%s attachment%s that needs smushing!", "%s, you have %s%s%d%s attachments%s that need smushing!", $wpsmushit_admin->remaining_count, "wp-smushit" ), $wpsmushit_admin->get_user_name(), '<strong>', '<span class="wp-smush-remaining-count">', $wpsmushit_admin->remaining_count, '</span>', '</strong>' );
|
679 |
if( !$WpSmush->validate_install() ) {
|
680 |
+
printf( esc_html__(" %sUpgrade to Pro%s to bulk smush all your images with one click.", "wp-smushit") , '<a href="' . esc_url( $upgrade_url ). '" target="_blank" title="' . esc_html__("WP Smush Pro", "wp-smushit") . '">', '</a>' );
|
681 |
+
esc_html_e(" Free users can smush 50 images with each click.", "wp-smushit");
|
682 |
}?>
|
683 |
</span>
|
684 |
</div><?php
|
720 |
</div>
|
721 |
</div>
|
722 |
<div class="wp-smush-count tc">
|
723 |
+
<?php printf( esc_html__( "%s%d%s of your media attachments has been smushed." ), '<span class="wp-smush-images-percent">', $smushed_pc, '</span>%' ); ?>
|
724 |
</div>
|
725 |
</div>
|
726 |
<hr class="wp-smush-sep">
|
761 |
if ( $show ) {
|
762 |
return '<div class="wp-smush-notice wp-smush-resmush-notice wp-smush-remaining" tabindex="0">
|
763 |
<i class="dev-icon"><img src="' . WP_SMUSH_URL . 'assets/images/icon-gzip.svg" width="14px"></i>
|
764 |
+
<span class="wp-smush-notice-text">' . sprintf( _n( "%s, you have %s%s%d%s attachment%s that needs re-compressing!", "%s, you have %s%s%d%s attachments%s that need re-compressing!", $count, "wp-smushit" ), $wpsmushit_admin->get_user_name(), '<strong>', '<span class="wp-smush-remaining-count">', $count, '</span>', '</strong>' ) . '</span>
|
765 |
<button class="button button-grey button-small wp-smush-skip-resmush">' . esc_html__( "Skip", "wp-smushit" ) . '</button>
|
766 |
</div>';
|
767 |
}
|
lib/class-wp-smush.php
CHANGED
@@ -1,4 +1,8 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
2 |
//Settings Class
|
3 |
require_once WP_SMUSH_DIR . "lib/class-wp-smush-settings.php";
|
4 |
|
@@ -23,6 +27,7 @@ require_once WP_SMUSH_DIR . 'lib/class-wp-smush-backup.php';
|
|
23 |
//Include Smush Async class
|
24 |
require_once WP_SMUSH_DIR . 'lib/class-wp-smush-async.php';
|
25 |
|
|
|
26 |
if ( ! class_exists( 'WpSmush' ) ) {
|
27 |
|
28 |
class WpSmush {
|
@@ -116,8 +121,9 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
116 |
//Enqueue Scripts, And Initialize variables
|
117 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
118 |
|
119 |
-
//Load NextGen Gallery, if hooked too late or early, auto smush doesn't works, also Load after settings have been saved on init action
|
120 |
-
add_action( 'plugins_loaded', array( $this, '
|
|
|
121 |
|
122 |
//Send Smush Stats for pro members
|
123 |
add_filter( 'wpmudev_api_project_extra_data-912164', array( $this, 'send_smush_stats' ) );
|
@@ -134,6 +140,9 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
134 |
//Handle the Async optimisation
|
135 |
add_action( 'wp_async_wp_save_image_editor_file', array( $this, 'wp_smush_handle_editor_async' ), '', 2 );
|
136 |
|
|
|
|
|
|
|
137 |
}
|
138 |
|
139 |
/**
|
@@ -318,7 +327,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
318 |
*/
|
319 |
function resize_from_meta_data( $meta, $ID = null ) {
|
320 |
|
321 |
-
global $wpsmush_settings;
|
322 |
|
323 |
//Flag to check, if original size image should be smushed or not
|
324 |
$original = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'original', false );
|
@@ -346,7 +355,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
346 |
$this->media_type = "wp";
|
347 |
|
348 |
//File path and URL for original image
|
349 |
-
$attachment_file_path = get_attached_file( $ID );
|
350 |
|
351 |
// If images has other registered size, smush them first
|
352 |
if ( ! empty( $meta['sizes'] ) ) {
|
@@ -367,7 +376,6 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
367 |
$finfo = false;
|
368 |
}
|
369 |
|
370 |
-
global $wpsmushit_admin;
|
371 |
foreach ( $meta['sizes'] as $size_key => $size_data ) {
|
372 |
|
373 |
//Check if registered size is supposed to be Smushed or not
|
@@ -379,8 +387,13 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
379 |
// path. So just get the dirname and replace the filename.
|
380 |
$attachment_file_path_size = path_join( dirname( $attachment_file_path ), $size_data['file'] );
|
381 |
|
|
|
|
|
|
|
|
|
|
|
382 |
if ( $finfo ) {
|
383 |
-
$ext =
|
384 |
} elseif ( function_exists( 'mime_content_type' ) ) {
|
385 |
$ext = mime_content_type( $attachment_file_path_size );
|
386 |
} else {
|
@@ -570,8 +583,8 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
570 |
return $meta;
|
571 |
}
|
572 |
|
573 |
-
//Check if we're restoring the image
|
574 |
-
if ( get_transient( "wp-smush-restore-$ID" ) ) {
|
575 |
return $meta;
|
576 |
}
|
577 |
|
@@ -589,13 +602,8 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
589 |
return false;
|
590 |
}
|
591 |
|
592 |
-
//If the smushing transient is already set, return the status
|
593 |
-
if ( get_transient( 'smush-in-progress-' . $ID ) ) {
|
594 |
-
return $meta;
|
595 |
-
}
|
596 |
-
|
597 |
//Set a transient to avoid multiple request
|
598 |
-
set_transient( 'smush-in-progress-' . $ID, true,
|
599 |
|
600 |
global $wpsmush_resize, $wpsmush_pngjpg, $wpsmush_settings;
|
601 |
|
@@ -809,7 +817,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
809 |
$last_checked = $api_auth[ $api_key ]['timestamp'];
|
810 |
$valid = $api_auth[ $api_key ]['validity'];
|
811 |
|
812 |
-
$diff =
|
813 |
|
814 |
//Difference in hours
|
815 |
$diff_h = $diff / 3600;
|
@@ -1461,15 +1469,26 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
1461 |
return $a->bytes < $b->bytes;
|
1462 |
}
|
1463 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1464 |
/**
|
1465 |
* Check if NextGen is active or not
|
1466 |
* Include and instantiate classes
|
1467 |
*/
|
1468 |
function load_nextgen() {
|
1469 |
-
|
|
|
1470 |
return;
|
1471 |
}
|
1472 |
-
|
1473 |
global $wpsmush_settings;
|
1474 |
|
1475 |
//Check if integration is Enabled or not
|
@@ -1487,12 +1506,28 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
1487 |
|
1488 |
global $wpsmushnextgen, $wpsmushnextgenadmin, $wpsmushnextgenstats;
|
1489 |
//Initialize Nextgen support
|
1490 |
-
$wpsmushnextgen
|
|
|
|
|
1491 |
$wpsmushnextgenstats = new WpSmushNextGenStats();
|
1492 |
$wpsmushnextgenadmin = new WpSmushNextGenAdmin();
|
1493 |
new WPSmushNextGenBulk();
|
1494 |
}
|
1495 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1496 |
/**
|
1497 |
* Add the Smushit Column to sortable list
|
1498 |
*
|
@@ -1556,38 +1591,50 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
1556 |
|
1557 |
//Get the image path for all sizes
|
1558 |
$file = get_attached_file( $image_id );
|
|
|
1559 |
|
1560 |
-
//
|
1561 |
-
$
|
1562 |
|
1563 |
-
//Check
|
1564 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1565 |
return true;
|
1566 |
}
|
1567 |
|
1568 |
//Additional Backup Check for JPEGs converted from PNG
|
1569 |
$pngjpg_savings = get_post_meta( $image_id, WP_SMUSH_PREFIX . 'pngjpg_savings', true );
|
1570 |
if ( ! empty( $pngjpg_savings ) ) {
|
|
|
1571 |
//Get the original File path and check if it exists
|
1572 |
$backup = get_post_meta( $image_id, WP_SMUSH_PREFIX . 'original_file', true );
|
1573 |
$backup = $this->original_file( $backup );
|
1574 |
|
1575 |
-
if ( ! empty( $backup ) &&
|
1576 |
return true;
|
1577 |
}
|
1578 |
}
|
1579 |
|
1580 |
-
if ( ! empty( $attachment_data['sizes'] ) ) {
|
1581 |
-
//Check for backup of image sizes
|
1582 |
-
foreach ( $attachment_data['sizes'] as $image_size ) {
|
1583 |
-
$size_path = path_join( dirname( $file ), $image_size['file'] );
|
1584 |
-
$size_backup_path = $wpsmushit_admin->get_image_backup_path( $size_path );
|
1585 |
-
if ( file_exists( $size_backup_path ) ) {
|
1586 |
-
return true;
|
1587 |
-
}
|
1588 |
-
}
|
1589 |
-
}
|
1590 |
-
|
1591 |
return false;
|
1592 |
}
|
1593 |
|
@@ -1791,7 +1838,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
1791 |
/**
|
1792 |
* Checks the current settings and returns the value whether to enable or not the resmush option
|
1793 |
*
|
1794 |
-
* @param $
|
1795 |
* @param $wp_smush_data
|
1796 |
*
|
1797 |
* @return bool
|
@@ -2118,7 +2165,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
2118 |
function wp_smush_handle_async( $id ) {
|
2119 |
|
2120 |
//If we don't have image id, or the smush is already in progress for the image, return
|
2121 |
-
if ( empty( $id ) || get_transient( 'smush-in-progress-' . $id ) ) {
|
2122 |
return;
|
2123 |
}
|
2124 |
|
@@ -2127,11 +2174,6 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
2127 |
return;
|
2128 |
}
|
2129 |
|
2130 |
-
//Check if we're restoring the image
|
2131 |
-
if ( get_transient( "wp-smush-restore-$id" ) ) {
|
2132 |
-
return;
|
2133 |
-
}
|
2134 |
-
|
2135 |
/**
|
2136 |
* Filter: wp_smush_image
|
2137 |
*
|
@@ -2159,7 +2201,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
2159 |
function wp_smush_handle_editor_async( $id, $post_data ) {
|
2160 |
|
2161 |
//If we don't have image id, or the smush is already in progress for the image, return
|
2162 |
-
if ( empty( $id ) || get_transient(
|
2163 |
return;
|
2164 |
}
|
2165 |
|
@@ -2222,6 +2264,31 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
2222 |
//Update Stats
|
2223 |
update_post_meta( $post_data['postid'], $this->smushed_meta_key, $smush_stats );
|
2224 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2225 |
}
|
2226 |
|
2227 |
global $WpSmush;
|
1 |
<?php
|
2 |
+
|
3 |
+
//Helper Class
|
4 |
+
require_once WP_SMUSH_DIR . "lib/class-wp-smush-helper.php";
|
5 |
+
|
6 |
//Settings Class
|
7 |
require_once WP_SMUSH_DIR . "lib/class-wp-smush-settings.php";
|
8 |
|
27 |
//Include Smush Async class
|
28 |
require_once WP_SMUSH_DIR . 'lib/class-wp-smush-async.php';
|
29 |
|
30 |
+
|
31 |
if ( ! class_exists( 'WpSmush' ) ) {
|
32 |
|
33 |
class WpSmush {
|
121 |
//Enqueue Scripts, And Initialize variables
|
122 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
123 |
|
124 |
+
//Load NextGen Gallery, S3, if hooked too late or early, auto smush doesn't works, also Load after settings have been saved on init action
|
125 |
+
add_action( 'plugins_loaded', array( $this, 'load_modules' ), 90 );
|
126 |
+
|
127 |
|
128 |
//Send Smush Stats for pro members
|
129 |
add_filter( 'wpmudev_api_project_extra_data-912164', array( $this, 'send_smush_stats' ) );
|
140 |
//Handle the Async optimisation
|
141 |
add_action( 'wp_async_wp_save_image_editor_file', array( $this, 'wp_smush_handle_editor_async' ), '', 2 );
|
142 |
|
143 |
+
// Handle other file uploads optimisation
|
144 |
+
add_action( 'add_attachment', array( $this, 'wp_smush_handle_other_uploads' ) );
|
145 |
+
|
146 |
}
|
147 |
|
148 |
/**
|
327 |
*/
|
328 |
function resize_from_meta_data( $meta, $ID = null ) {
|
329 |
|
330 |
+
global $wpsmush_settings, $wpsmush_helper, $wpsmushit_admin;
|
331 |
|
332 |
//Flag to check, if original size image should be smushed or not
|
333 |
$original = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'original', false );
|
355 |
$this->media_type = "wp";
|
356 |
|
357 |
//File path and URL for original image
|
358 |
+
$attachment_file_path = $wpsmush_helper->get_attached_file( $ID );
|
359 |
|
360 |
// If images has other registered size, smush them first
|
361 |
if ( ! empty( $meta['sizes'] ) ) {
|
376 |
$finfo = false;
|
377 |
}
|
378 |
|
|
|
379 |
foreach ( $meta['sizes'] as $size_key => $size_data ) {
|
380 |
|
381 |
//Check if registered size is supposed to be Smushed or not
|
387 |
// path. So just get the dirname and replace the filename.
|
388 |
$attachment_file_path_size = path_join( dirname( $attachment_file_path ), $size_data['file'] );
|
389 |
|
390 |
+
/**
|
391 |
+
* Allows S3 to hook over here and check if the given file path exists else download the file
|
392 |
+
*/
|
393 |
+
do_action('smush_file_exists', $attachment_file_path_size, $ID, $size_data );
|
394 |
+
|
395 |
if ( $finfo ) {
|
396 |
+
$ext = is_file( $attachment_file_path_size ) ? $finfo->file( $attachment_file_path_size ) : '';
|
397 |
} elseif ( function_exists( 'mime_content_type' ) ) {
|
398 |
$ext = mime_content_type( $attachment_file_path_size );
|
399 |
} else {
|
583 |
return $meta;
|
584 |
}
|
585 |
|
586 |
+
//Check if we're restoring the image Or already smushing the image
|
587 |
+
if ( get_transient( "wp-smush-restore-$ID" ) || get_transient( "smush-in-progress-$ID" ) || get_transient( "wp-smush-restore-$ID" ) ) {
|
588 |
return $meta;
|
589 |
}
|
590 |
|
602 |
return false;
|
603 |
}
|
604 |
|
|
|
|
|
|
|
|
|
|
|
605 |
//Set a transient to avoid multiple request
|
606 |
+
set_transient( 'smush-in-progress-' . $ID, true, WP_SMUSH_TIMEOUT );
|
607 |
|
608 |
global $wpsmush_resize, $wpsmush_pngjpg, $wpsmush_settings;
|
609 |
|
817 |
$last_checked = $api_auth[ $api_key ]['timestamp'];
|
818 |
$valid = $api_auth[ $api_key ]['validity'];
|
819 |
|
820 |
+
$diff = current_time( 'timestamp' ) - $last_checked;
|
821 |
|
822 |
//Difference in hours
|
823 |
$diff_h = $diff / 3600;
|
1469 |
return $a->bytes < $b->bytes;
|
1470 |
}
|
1471 |
|
1472 |
+
/**
|
1473 |
+
* Load Plugin Modules
|
1474 |
+
*
|
1475 |
+
*/
|
1476 |
+
function load_modules() {
|
1477 |
+
$this->load_nextgen();
|
1478 |
+
//Load S3
|
1479 |
+
if( has_action('aws_init') ) {
|
1480 |
+
add_action( 'aws_init', array( $this, 'load_s3' ), 120 );
|
1481 |
+
}
|
1482 |
+
}
|
1483 |
/**
|
1484 |
* Check if NextGen is active or not
|
1485 |
* Include and instantiate classes
|
1486 |
*/
|
1487 |
function load_nextgen() {
|
1488 |
+
|
1489 |
+
if ( ! class_exists( 'C_NextGEN_Bootstrap' ) ) {
|
1490 |
return;
|
1491 |
}
|
|
|
1492 |
global $wpsmush_settings;
|
1493 |
|
1494 |
//Check if integration is Enabled or not
|
1506 |
|
1507 |
global $wpsmushnextgen, $wpsmushnextgenadmin, $wpsmushnextgenstats;
|
1508 |
//Initialize Nextgen support
|
1509 |
+
if( !is_object( $wpsmushnextgen ) ) {
|
1510 |
+
$wpsmushnextgen = new WpSmushNextGen();
|
1511 |
+
}
|
1512 |
$wpsmushnextgenstats = new WpSmushNextGenStats();
|
1513 |
$wpsmushnextgenadmin = new WpSmushNextGenAdmin();
|
1514 |
new WPSmushNextGenBulk();
|
1515 |
}
|
1516 |
|
1517 |
+
/**
|
1518 |
+
* Load S3 module if the respective plugin is active
|
1519 |
+
*/
|
1520 |
+
function load_s3() {
|
1521 |
+
|
1522 |
+
//If we don't have free or pro verison for WP S3 Offload, return
|
1523 |
+
if ( ! class_exists( 'Amazon_S3_And_CloudFront' ) && ! class_exists( 'Amazon_S3_And_CloudFront_Pro' ) ) {
|
1524 |
+
return;
|
1525 |
+
}
|
1526 |
+
|
1527 |
+
//Include Smush Async class
|
1528 |
+
require_once WP_SMUSH_DIR . 'lib/class-wp-smush-s3.php';
|
1529 |
+
}
|
1530 |
+
|
1531 |
/**
|
1532 |
* Add the Smushit Column to sortable list
|
1533 |
*
|
1591 |
|
1592 |
//Get the image path for all sizes
|
1593 |
$file = get_attached_file( $image_id );
|
1594 |
+
$uf_file = get_attached_file( $image_id, true );
|
1595 |
|
1596 |
+
//Get stored backup path, if any
|
1597 |
+
$backup_sizes = get_post_meta( $image_id, '_wp_attachment_backup_sizes', true );
|
1598 |
|
1599 |
+
//Check if we've a backup path
|
1600 |
+
if( !empty( $backup_sizes ) && ( !empty( $backup_sizes['smush-full']) || !empty( $backup_sizes['smush_png_path']) ) ) {
|
1601 |
+
//Check for PNG backup
|
1602 |
+
$backup = !empty( $backup_sizes['smush_png_path'] ) ? $backup_sizes['smush_png_path'] : '';
|
1603 |
+
|
1604 |
+
//Check for original full size image backup
|
1605 |
+
$backup = empty( $backup ) && !empty( $backup_sizes['smush-full'] ) ? $backup_sizes['smush-full'] : $backup;
|
1606 |
+
|
1607 |
+
$backup = !empty( $backup['file'] ) ? $backup['file'] : '';
|
1608 |
+
}
|
1609 |
+
|
1610 |
+
//If we still don't have a backup path, use traditional method to get it
|
1611 |
+
if( empty( $backup ) ) {
|
1612 |
+
//Check backup for Full size
|
1613 |
+
$backup = $wpsmushit_admin->get_image_backup_path( $file );
|
1614 |
+
}else{
|
1615 |
+
//Get the full path for file backup
|
1616 |
+
$backup = str_replace( wp_basename( $file ), wp_basename( $backup ), $file );
|
1617 |
+
}
|
1618 |
+
|
1619 |
+
$file_exists = apply_filters( 'smush_backup_exists', file_exists( $backup ), $image_id, $backup );
|
1620 |
+
|
1621 |
+
if( $file_exists ) {
|
1622 |
return true;
|
1623 |
}
|
1624 |
|
1625 |
//Additional Backup Check for JPEGs converted from PNG
|
1626 |
$pngjpg_savings = get_post_meta( $image_id, WP_SMUSH_PREFIX . 'pngjpg_savings', true );
|
1627 |
if ( ! empty( $pngjpg_savings ) ) {
|
1628 |
+
|
1629 |
//Get the original File path and check if it exists
|
1630 |
$backup = get_post_meta( $image_id, WP_SMUSH_PREFIX . 'original_file', true );
|
1631 |
$backup = $this->original_file( $backup );
|
1632 |
|
1633 |
+
if ( ! empty( $backup ) && is_file( $backup ) ) {
|
1634 |
return true;
|
1635 |
}
|
1636 |
}
|
1637 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1638 |
return false;
|
1639 |
}
|
1640 |
|
1838 |
/**
|
1839 |
* Checks the current settings and returns the value whether to enable or not the resmush option
|
1840 |
*
|
1841 |
+
* @param $id
|
1842 |
* @param $wp_smush_data
|
1843 |
*
|
1844 |
* @return bool
|
2165 |
function wp_smush_handle_async( $id ) {
|
2166 |
|
2167 |
//If we don't have image id, or the smush is already in progress for the image, return
|
2168 |
+
if ( empty( $id ) || get_transient( 'smush-in-progress-' . $id ) || get_transient( "wp-smush-restore-$id" ) ) {
|
2169 |
return;
|
2170 |
}
|
2171 |
|
2174 |
return;
|
2175 |
}
|
2176 |
|
|
|
|
|
|
|
|
|
|
|
2177 |
/**
|
2178 |
* Filter: wp_smush_image
|
2179 |
*
|
2201 |
function wp_smush_handle_editor_async( $id, $post_data ) {
|
2202 |
|
2203 |
//If we don't have image id, or the smush is already in progress for the image, return
|
2204 |
+
if ( empty( $id ) || get_transient( "smush-in-progress-$id" ) || get_transient( "wp-smush-restore-$id" ) ) {
|
2205 |
return;
|
2206 |
}
|
2207 |
|
2264 |
//Update Stats
|
2265 |
update_post_meta( $post_data['postid'], $this->smushed_meta_key, $smush_stats );
|
2266 |
}
|
2267 |
+
|
2268 |
+
/**
|
2269 |
+
* Support uploads/import through other methods.
|
2270 |
+
*
|
2271 |
+
* Handle image optimization for other upload sources, using
|
2272 |
+
* WP upload functions. For eg: WP RSS Aggregator importing images.
|
2273 |
+
* Note: This is not an async task.
|
2274 |
+
*
|
2275 |
+
* @param $id Attchment ID.
|
2276 |
+
*/
|
2277 |
+
function wp_smush_handle_other_uploads( $id ) {
|
2278 |
+
|
2279 |
+
// Our async task runs when action is upload-attachment and post_id found. So do not run on these conditions.
|
2280 |
+
if ( empty( $id ) || ( ! empty( $_POST['action'] ) && 'upload-attachment' == $_POST['action'] ) || ( ! empty( $_POST ) && isset( $_POST['post_id'] ) ) ) {
|
2281 |
+
return;
|
2282 |
+
}
|
2283 |
+
|
2284 |
+
// Do not continue if attachment is not an image.
|
2285 |
+
if ( ! wp_attachment_is_image( $id ) ) {
|
2286 |
+
return;
|
2287 |
+
}
|
2288 |
+
|
2289 |
+
// Run additional checks then smush.
|
2290 |
+
$this->wp_smush_handle_async( $id );
|
2291 |
+
}
|
2292 |
}
|
2293 |
|
2294 |
global $WpSmush;
|
lib/nextgen-integration/class-wp-smush-nextgen-admin.php
CHANGED
@@ -443,7 +443,7 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
|
|
443 |
<img src="<?php echo WP_SMUSH_URL . 'assets/images/icon-gzip.svg'; ?>" width="14px">
|
444 |
</i>
|
445 |
<span class="wp-smush-notice-text">
|
446 |
-
<?php printf( _n( "%s, you have %s%s%d%s
|
447 |
</span>
|
448 |
</div>
|
449 |
<hr class="wp-smush-sep">
|
@@ -528,7 +528,7 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
|
|
528 |
<div class="wp-smush-smush-stats-wrapper">
|
529 |
<span class="wp-smush-optimised"><?php echo $smushed_count; ?></span>/<span><?php echo $this->total_count; ?></span>
|
530 |
</div>
|
531 |
-
<span class="total-stats-label"><strong><?php esc_html_e( "
|
532 |
</div>
|
533 |
</div>
|
534 |
</div>
|
@@ -550,7 +550,7 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
|
|
550 |
<hr>
|
551 |
<div class="row super-smush-attachments">
|
552 |
<span class="float-l wp-smush-stats-label">
|
553 |
-
<strong><?php esc_html_e( "
|
554 |
</span>
|
555 |
<span class="float-r wp-smush-stats">
|
556 |
<?php
|
443 |
<img src="<?php echo WP_SMUSH_URL . 'assets/images/icon-gzip.svg'; ?>" width="14px">
|
444 |
</i>
|
445 |
<span class="wp-smush-notice-text">
|
446 |
+
<?php printf( _n( "%s, you have %s%s%d%s attachment%s that needs smushing!", "%s, you have %s%s%d%s attachments%s that need smushing!", $this->remaining_count, "wp-smushit" ), $wpsmushit_admin->get_user_name(), '<strong>', '<span class="wp-smush-remaining-count">', $this->remaining_count, '</span>', '</strong>' ); ?>
|
447 |
</span>
|
448 |
</div>
|
449 |
<hr class="wp-smush-sep">
|
528 |
<div class="wp-smush-smush-stats-wrapper">
|
529 |
<span class="wp-smush-optimised"><?php echo $smushed_count; ?></span>/<span><?php echo $this->total_count; ?></span>
|
530 |
</div>
|
531 |
+
<span class="total-stats-label"><strong><?php esc_html_e( "IMAGES SMUSHED", "wp-smushit" ); ?></strong></span>
|
532 |
</div>
|
533 |
</div>
|
534 |
</div>
|
550 |
<hr>
|
551 |
<div class="row super-smush-attachments">
|
552 |
<span class="float-l wp-smush-stats-label">
|
553 |
+
<strong><?php esc_html_e( "IMAGES SUPER-SMUSHED", "wp-smushit" ); ?></strong>
|
554 |
</span>
|
555 |
<span class="float-r wp-smush-stats">
|
556 |
<?php
|
lib/wp-async-task-smush.php
CHANGED
@@ -109,7 +109,7 @@ if ( ! class_exists( 'WP_Async_Task_Smush' ) ) {
|
|
109 |
//Do not use this, as in case of importing, only the last image gets processed
|
110 |
//It's very important that all the Media uploads, are handled via shutdown action, else, sometimes the image meta updated
|
111 |
// by smush is earlier, and then original meta update causes discrepancy
|
112 |
-
if ( ( 'upload-attachment' == $_POST['action'] || ( ! empty( $_POST ) && isset( $_POST['post_id'] ) ) ) && ! $shutdown_action ) {
|
113 |
add_action( 'shutdown', array( $this, 'process_request' ) );
|
114 |
} else {
|
115 |
//Send a ajax request to process image and return image metadata, added for compatibility with plugins like
|
@@ -147,7 +147,7 @@ if ( ! class_exists( 'WP_Async_Task_Smush' ) ) {
|
|
147 |
|
148 |
//@todo: We've set sslverify to false
|
149 |
$request_args = array(
|
150 |
-
'timeout' =>
|
151 |
'blocking' => false,
|
152 |
'sslverify' => false,
|
153 |
'body' => $this->_body_data,
|
109 |
//Do not use this, as in case of importing, only the last image gets processed
|
110 |
//It's very important that all the Media uploads, are handled via shutdown action, else, sometimes the image meta updated
|
111 |
// by smush is earlier, and then original meta update causes discrepancy
|
112 |
+
if ( ( ( !empty( $_POST['action'] ) && 'upload-attachment' == $_POST['action'] ) || ( ! empty( $_POST ) && isset( $_POST['post_id'] ) ) ) && ! $shutdown_action ) {
|
113 |
add_action( 'shutdown', array( $this, 'process_request' ) );
|
114 |
} else {
|
115 |
//Send a ajax request to process image and return image metadata, added for compatibility with plugins like
|
147 |
|
148 |
//@todo: We've set sslverify to false
|
149 |
$request_args = array(
|
150 |
+
'timeout' => apply_filters( 'smush_async_time_out', 0 ),
|
151 |
'blocking' => false,
|
152 |
'sslverify' => false,
|
153 |
'body' => $this->_body_data,
|
readme.txt
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
=== Smush Image Compression and Optimization ===
|
2 |
Plugin Name: Smush Image Compression and Optimization
|
3 |
-
Version: 2.
|
4 |
Author: WPMU DEV
|
5 |
Author URI: http://premium.wpmudev.org/
|
6 |
Contributors: WPMUDEV, alexdunae
|
7 |
Tags: image, resize, optimize, compress, performance, lossless, lossy, photo, pictures, optimize JPG, compress PNG, Smush WordPress Compression, Smush.it
|
8 |
Requires at least: 3.5
|
9 |
Tested up to: 4.7.3
|
10 |
-
Stable tag: 2.
|
11 |
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
12 |
|
13 |
Compress and optimize image files, improve performance and boost your SEO rank using Smush WordPress image compression and optimization.
|
@@ -134,6 +134,27 @@ Yahoo's Smush.it API is gone forever. So WPMU DEV built our own free API that is
|
|
134 |
|
135 |
== Changelog ==
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
= 2.6.3 =
|
138 |
|
139 |
* Fixed:
|
1 |
=== Smush Image Compression and Optimization ===
|
2 |
Plugin Name: Smush Image Compression and Optimization
|
3 |
+
Version: 2.7
|
4 |
Author: WPMU DEV
|
5 |
Author URI: http://premium.wpmudev.org/
|
6 |
Contributors: WPMUDEV, alexdunae
|
7 |
Tags: image, resize, optimize, compress, performance, lossless, lossy, photo, pictures, optimize JPG, compress PNG, Smush WordPress Compression, Smush.it
|
8 |
Requires at least: 3.5
|
9 |
Tested up to: 4.7.3
|
10 |
+
Stable tag: 2.7
|
11 |
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
12 |
|
13 |
Compress and optimize image files, improve performance and boost your SEO rank using Smush WordPress image compression and optimization.
|
134 |
|
135 |
== Changelog ==
|
136 |
|
137 |
+
= 2.7 =
|
138 |
+
|
139 |
+
* Updated:
|
140 |
+
* Faster image uploads: Set async request timeout to 0, if you're having trouble with Auto Smush, set timeout using filter `smush_async_time_out`
|
141 |
+
|
142 |
+
* Fixed:
|
143 |
+
|
144 |
+
* Issue with WP Smush Pro membership check
|
145 |
+
* Stats: Rating message shows incorrect image count
|
146 |
+
* Stats: Include directory smush stats in media stats
|
147 |
+
* Directory Smush: UI improvement
|
148 |
+
* Directory Smush: Allow re-smushing directory images, if the lossy feature is turned on
|
149 |
+
* Directory Smush: Fixed empty query warning if there are more than 5k images
|
150 |
+
* Site Ground Staging - Disable Async smush for staging sites, admin URL for async request is incorrect because of the Apache module
|
151 |
+
* Image appearing in Re-Smush list even after smushing, if resize settings are kept on.
|
152 |
+
* Performance: Updated query for smushed images count
|
153 |
+
* Added:
|
154 |
+
* WP S3 Offload - Plugin Compatibility for Remove files from server feature ( Pro Version )
|
155 |
+
* WP RSS Aggregator compatibility for Auto Smush
|
156 |
+
* WordPress mobile app Auto smush compatibility
|
157 |
+
|
158 |
= 2.6.3 =
|
159 |
|
160 |
* Fixed:
|
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 |
Text Domain: 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 |
//Deactivate the .org version, if pro version is active
|
41 |
add_action( 'admin_init', 'deactivate_smush_org' );
|
@@ -55,6 +55,15 @@ if ( ! function_exists( 'deactivate_smush_org' ) ) {
|
|
55 |
*/
|
56 |
$timeout = apply_filters( 'WP_SMUSH_API_TIMEOUT', 90 );
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
$smush_constants = array(
|
59 |
'VERSION' => $version,
|
60 |
'BASENAME' => plugin_basename( __FILE__ ),
|
@@ -89,8 +98,10 @@ require_once WP_SMUSH_DIR . 'lib/class-wp-smush.php';
|
|
89 |
if ( ! function_exists( 'wp_smush_rating_message' ) ) {
|
90 |
function wp_smush_rating_message( $message ) {
|
91 |
global $wpsmushit_admin, $wpsmush_db;
|
92 |
-
|
93 |
-
|
|
|
|
|
94 |
$show_stats = false;
|
95 |
|
96 |
//If there is any saving, greater than 1Mb, show stats
|
@@ -102,7 +113,7 @@ if ( ! function_exists( 'wp_smush_rating_message' ) ) {
|
|
102 |
|
103 |
//Conditionally Show stats in rating message
|
104 |
if ( $show_stats ) {
|
105 |
-
$message .= sprintf( " You've smushed <strong>%s</strong> from %d images already, improving the speed and SEO ranking of this site!", $savings['human'], $
|
106 |
}
|
107 |
$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!";
|
108 |
|
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.7
|
8 |
Author URI: http://premium.wpmudev.org/
|
9 |
Text Domain: wp-smushit
|
10 |
*/
|
35 |
* Constants
|
36 |
*/
|
37 |
$prefix = 'WP_SMUSH_';
|
38 |
+
$version = '2.7';
|
39 |
|
40 |
//Deactivate the .org version, if pro version is active
|
41 |
add_action( 'admin_init', 'deactivate_smush_org' );
|
55 |
*/
|
56 |
$timeout = apply_filters( 'WP_SMUSH_API_TIMEOUT', 90 );
|
57 |
|
58 |
+
// To support smushing on staging sites like SiteGround staging where
|
59 |
+
// staging site urls are different but redirects to main site url.
|
60 |
+
// Remove the protocols and www, and get the domain name.
|
61 |
+
$site_url = str_replace( array( 'http://', 'https://', 'www.' ), '', site_url() );
|
62 |
+
// If current site's url is different from site_url, disable Async.
|
63 |
+
if ( ( 0 !== strpos( $_SERVER['SERVER_NAME'], $site_url ) ) && ! defined( $prefix . 'ASYNC' ) ) {
|
64 |
+
define( $prefix . 'ASYNC', false );
|
65 |
+
}
|
66 |
+
|
67 |
$smush_constants = array(
|
68 |
'VERSION' => $version,
|
69 |
'BASENAME' => plugin_basename( __FILE__ ),
|
98 |
if ( ! function_exists( 'wp_smush_rating_message' ) ) {
|
99 |
function wp_smush_rating_message( $message ) {
|
100 |
global $wpsmushit_admin, $wpsmush_db;
|
101 |
+
if ( empty( $wpsmushit_admin->stats ) ) {
|
102 |
+
$wpsmushit_admin->setup_global_stats();
|
103 |
+
}
|
104 |
+
$savings = $wpsmushit_admin->stats;
|
105 |
$show_stats = false;
|
106 |
|
107 |
//If there is any saving, greater than 1Mb, show stats
|
113 |
|
114 |
//Conditionally Show stats in rating message
|
115 |
if ( $show_stats ) {
|
116 |
+
$message .= sprintf( " You've smushed <strong>%s</strong> from %d images already, improving the speed and SEO ranking of this site!", $savings['human'], $savings['total_images'] );
|
117 |
}
|
118 |
$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!";
|
119 |
|