Smush Image Compression and Optimization - Version 2.7.5

Version Description

  • Updated:

    • UI/UX has been updated for Bulk Smush page
  • Fixed:

    • Start from latest image while Bulk Smushing
    • S3 config error if AWS keys are defined in wp-config.php
    • NextGen smush page not working properly
    • Do not redirect to settings page on activation if WP CLI is installed
Download this release

Release Info

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

Code changes from version 2.7.4.1 to 2.7.5

Files changed (45) hide show
  1. assets/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  2. assets/css/notice.css +8 -7
  3. assets/css/wp-smushit-admin.css +644 -251
  4. assets/images/application.png +0 -0
  5. assets/images/code.png +0 -0
  6. assets/images/css.png +0 -0
  7. assets/images/db.png +0 -0
  8. assets/images/dev-team.png +0 -0
  9. assets/images/flash.png +0 -0
  10. assets/images/hummingbird.png +0 -0
  11. assets/images/loading.gif +0 -0
  12. assets/images/pdf.png +0 -0
  13. assets/images/ppt.png +0 -0
  14. assets/images/psd.png +0 -0
  15. assets/images/ruby.png +0 -0
  16. assets/images/share-bg-small.png +0 -0
  17. assets/images/smush-no-media.png +0 -0
  18. assets/images/smush-promo.png +0 -0
  19. assets/images/smush-quicksetup.png +0 -0
  20. assets/images/welcome-notice.png +0 -0
  21. assets/images/xls.png +0 -0
  22. assets/js/notice.js +18 -10
  23. assets/js/ui.js +23 -0
  24. assets/js/wp-smushit-admin.js +178 -74
  25. assets/shared-ui/wdev-ui.css +14 -0
  26. assets/shared-ui/wdev-ui.js +9 -9
  27. extras/free-dashboard/admin.js +2 -2
  28. languages/wp-smushit.pot +451 -300
  29. lib/class-wp-smush-admin.php +188 -273
  30. lib/class-wp-smush-backup.php +1 -1
  31. lib/class-wp-smush-db.php +24 -4
  32. lib/class-wp-smush-dir.php +32 -24
  33. lib/class-wp-smush-helper.php +55 -0
  34. lib/class-wp-smush-nextgen.php +7 -1
  35. lib/class-wp-smush-png_jpg.php +2 -2
  36. lib/class-wp-smush-resize.php +7 -2
  37. lib/class-wp-smush-s3.php +101 -26
  38. lib/class-wp-smush-settings.php +121 -15
  39. lib/class-wp-smush-share.php +2 -1
  40. lib/class-wp-smush-ui.php +572 -297
  41. lib/class-wp-smush.php +79 -12
  42. lib/nextgen-integration/class-wp-smush-nextgen-admin.php +32 -88
  43. lib/nextgen-integration/class-wp-smush-nextgen-stats.php +21 -14
  44. readme.txt +20 -7
  45. wp-smush.php +8 -4
assets/css/images/ui-bg_glass_65_ffffff_1x400.png CHANGED
Binary file
assets/css/notice.css CHANGED
@@ -62,13 +62,13 @@
62
  }
63
 
64
  .smush-notice-message {
65
- width: 100%;
 
 
 
66
  padding: 10px 20px;
67
- color: #444;
68
- }
69
-
70
- .smush-notice-message strong {
71
- color: #000;
72
  }
73
 
74
  .smush-notice-cta {
@@ -99,7 +99,8 @@
99
  background: transparent;
100
  border: 0;
101
  cursor: pointer;
102
- color: #BBB;
 
103
  }
104
 
105
  .smush-notice-dismiss:hover {
62
  }
63
 
64
  .smush-notice-message {
65
+ color: #23282D;
66
+ font-size: 13px;
67
+ font-weight: normal;
68
+ line-height: 20px;
69
  padding: 10px 20px;
70
+ -webkit-font-smoothing: antialiased;
71
+ width: 100%;
 
 
 
72
  }
73
 
74
  .smush-notice-cta {
99
  background: transparent;
100
  border: 0;
101
  cursor: pointer;
102
+ color: #C5C5C5;
103
+ -webkit-font-smoothing: antialiased;
104
  }
105
 
106
  .smush-notice-dismiss:hover {
assets/css/wp-smushit-admin.css CHANGED
@@ -70,21 +70,61 @@ Smush button transformation
70
 
71
  /** Settings Page **/
72
 
73
- .wp-smush-setting-row {
74
- margin: 15px 20px 15px 0;
 
 
75
  }
76
 
77
- .wpmud .toggle .toggle-checkbox:focus + .toggle-label:before {
78
- background: #c1c1c1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
 
81
- .wpmud .wp-smush-setting-row .toggle-checkbox:checked:focus + .toggle-label {
82
- box-shadow: 0 1px 1px rgba(26, 188, 156, 0.75);
83
  }
84
 
85
  .wpmud .wp-smushit-container-wrap {
86
  display: inline-block;
87
- margin-top: 30px;
 
 
 
 
88
  }
89
 
90
  .wpmud .bulk-smush-wrapper.wp-smush-container:not(.wp-smush-pro-install) {
@@ -96,6 +136,16 @@ Smush button transformation
96
  width: 100%;
97
  }
98
 
 
 
 
 
 
 
 
 
 
 
99
  .wp-smush-setting-row .dashicons-info.smush-original {
100
  top: 2px;
101
  position: relative;
@@ -103,20 +153,30 @@ Smush button transformation
103
  }
104
 
105
  .wpmud .wp-smush-submit-wrap {
106
- margin-top: 17px;
 
107
  overflow: hidden;
108
  padding-top: 0;
109
  }
110
 
111
  .wp-smush-submit-wrap .spinner {
112
  float: right;
113
- margin: 1.5em 1em 0;
 
 
 
 
 
 
 
 
 
114
  }
115
 
116
  input#wp-smush-save-settings {
117
  background: #17A8E3;
118
  float: right;
119
- margin: 10px 0 5px;
120
  }
121
 
122
  input#wp-smush-save-settings:hover {
@@ -273,10 +333,6 @@ input#wp-smush-save-settings:hover {
273
  transition: opacity .3s;
274
  }
275
 
276
- .smush-stats-wrapper {
277
- font-size: 12px;
278
- }
279
-
280
  .smush-stats-wrapper .row {
281
  padding: 8px 0;
282
  }
@@ -300,6 +356,7 @@ div.row.smush-avg-pro-savings {
300
  padding-bottom: 8px;
301
  padding-top: 19px;
302
  }
 
303
  div.row.smush-avg-pro-savings span.wp-smush-stats-label strong, div.row.smush-avg-pro-savings span.wp-smush-stats {
304
  opacity: 0.5;
305
  }
@@ -317,52 +374,50 @@ div.row.smush-avg-pro-savings span.wp-smush-stats-label strong, div.row.smush-av
317
  margin: 7px 8px 0;
318
  }
319
 
320
- .smush-stats-wrapper .box-content {
321
- margin-top: 20px;
322
- padding-left: 30px;
323
- padding-right: 30px;
324
  }
325
 
326
  .wp-smush-count-total {
327
  display: inline-block;
 
328
  line-height: 1;
329
- margin-left: 15px;
330
  overflow: hidden;
331
  text-align: left;
 
332
  }
333
 
334
- .wp-smush-smush-stats-wrapper {
335
- color: #555555;
336
- font-size: 25px;
 
337
  }
338
 
339
- .total-stats-label {
340
- color: #b9b9b9;
341
- font-size: 12px;
342
  }
343
 
344
- .wpmud .smush-total-savings.smush-total-reduction-percent {
345
- margin-bottom: 18px;
346
- text-align: center;
347
  }
348
 
349
- .smush-total-savings.smush-total-reduction-percent .wp-smush-stats-wrap {
350
- display: inline-block;
351
- max-width: 200px;
352
- text-align: left;
353
- vertical-align: middle;
354
  }
355
 
356
- .wp-smush-current-progress {
357
- cursor: pointer;
358
- margin: 0 auto;
359
- width: 200px;
 
360
  }
361
 
362
- .wp-smushed-progress {
363
- display: inline-block;
364
  text-align: center;
365
- vertical-align: bottom;
366
  }
367
 
368
  table.wp-smush-stats-holder {
@@ -549,15 +604,16 @@ table.wp-smush-stats-holder tr td:first-child {
549
 
550
  /** End of Font Family Variations **/
551
 
552
- .wpmud .wp-smush-page-heading {
 
553
  float: left;
554
  font-size: 30px;
555
- font-weight: normal;
556
  }
557
 
558
  .wp-smush-auto-message {
 
559
  float: right;
560
- font-size: 15px;
561
  letter-spacing: -0.015em;
562
  line-height: 1.7;
563
  margin: 1.2em auto;
@@ -573,7 +629,7 @@ table.wp-smush-stats-holder tr td:first-child {
573
 
574
  .wp-smush-page-header {
575
  overflow: hidden;
576
- margin: 0 0 20px;
577
  width: 100%;
578
  }
579
 
@@ -630,43 +686,57 @@ table.wp-smush-stats-holder tr td:first-child {
630
  text-decoration: underline;
631
  }
632
 
633
- .wpmud .wp-smush-welcome.wp-smush-container {
634
- background-image: url(../images/welcome-notice.png);
635
- background-repeat: no-repeat;
636
- background-position: 30px bottom;
637
- padding-bottom: 0;
638
  }
639
 
640
- .wpmud .wp-smush-welcome.wp-smush-container .box-content {
641
- min-height: 149px;
642
  }
643
 
644
- .wpmud .box-container {
645
- letter-spacing: -0.015em;
 
 
 
 
 
 
 
 
 
646
  }
647
 
648
  .wpmud .smush-page-wrap .dev-box .box-title {
649
- height: 67px;
650
- margin: -25px 0px 28px;
651
  }
652
 
653
  .wpmud .dev-box .wp-smush-container-header.box-title h3 {
654
  color: #333333;
655
  display: inline-block;
656
  font-size: 15px;
 
 
657
  }
658
 
659
- .smush-container-subheading {
 
660
  display: inline-block;
661
  float: right;
662
- margin: 1.5em auto;
663
- max-width: 60%;
 
 
 
 
 
664
  }
665
 
666
  .wp-smush-premium .smush-container-subheading {
667
  font-size: 12px;
668
  line-height: 1.4;
669
- margin: 1.3em 10px;
670
  vertical-align: top;
671
  }
672
 
@@ -675,6 +745,10 @@ table.wp-smush-stats-holder tr td:first-child {
675
  color: #fff;
676
  }
677
 
 
 
 
 
678
 
679
  .wpmud .row .col-half.wp-smush-pro-for-free {
680
  padding-left: 0;
@@ -701,7 +775,14 @@ table.wp-smush-stats-holder tr td:first-child {
701
  }
702
 
703
  .wpmud .smush-stats-wrapper .smush-container-subheading button.wp-smush-scan:not(.wph-button):not(#collapse-button) {
 
 
 
 
 
 
704
  font-size: 12px;
 
705
  padding: 5px 16px 5px;
706
  }
707
 
@@ -714,43 +795,125 @@ table.wp-smush-stats-holder tr td:first-child {
714
  pointer-events: none;
715
  }
716
 
717
- .smush-dismiss-welcome {
718
- margin: 1.4em 0;
 
 
719
  }
720
 
721
- .wpmud .smush-dismiss-welcome a {
722
- color: #9b9b9b;
 
 
 
 
 
 
 
 
723
  }
724
 
725
- .wpmud .wp-smush-welcome-content {
726
- padding-bottom: 20px;
727
- display: inline-block;
728
- overflow: hidden;
729
- max-width: 68%;
730
- margin: 0 30px 0px 200px;
 
 
731
  }
732
 
733
- .wpmud .wp-smush-welcome-content .wp-smush-premium {
734
- box-shadow: none;
735
- margin-top: 30px;
736
- padding: 0
737
  }
738
 
739
- .wpmud .wp-smush-welcome-content .wp-smush-premium .wp-smush-container-header {
740
- margin: 0;
741
- padding: 0
742
  }
743
 
744
- .wpmud .wp-smush-welcome-content h4 {
745
- font-size: 30px;
746
- line-height: 1.4;
747
- text-align: left;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
748
  }
749
 
750
  .wpmud .wp-smush-welcome-message {
751
- line-height: 1.7;
752
- margin-top: 20px;
753
- margin-bottom: 30px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
754
  }
755
 
756
  .wp-smush-welcome-image {
@@ -801,6 +964,17 @@ table.wp-smush-stats-holder tr td:first-child {
801
  letter-spacing: -0.015em;
802
  }
803
 
 
 
 
 
 
 
 
 
 
 
 
804
  .wp-smush-resmush-message,
805
  .wp-smush-settings-updated,
806
  .wp-smush-re-check-message {
@@ -846,12 +1020,73 @@ table.wp-smush-stats-holder tr td:first-child {
846
  vertical-align: middle;
847
  }
848
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
849
  /** Image Remaining **/
850
  div.wp-smush-remaining,
851
  #wp-smush-invalid-member,
852
  div.wp-smush-dir-remaining,
853
  div.wp-smush-dir-limit,
854
- div.smush-s3-setup-error {
 
 
855
  background-color: #FFF5D5;
856
  border: none;
857
  color: #333333;
@@ -860,9 +1095,30 @@ div.smush-s3-setup-error {
860
  letter-spacing: -0.015em;
861
  }
862
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
863
  div.smush-s3-setup-error a {
864
  color: #333;
865
  cursor: pointer;
 
866
  text-decoration: underline;
867
  }
868
 
@@ -896,14 +1152,10 @@ div.wp-smush-dir-limit .wdv-icon-info-sign:before {
896
  padding: 10px 50px;
897
  }
898
 
899
- .wp-smush-remaining .dev-icon img {
900
- position: relative;
901
- top: 8px;
902
- width: 14px;
903
- }
904
-
905
- .wpmud .bulk-smush-wrapper .wp-smush-remaining .dev-icon {
906
- margin-right: 10px;
907
  line-height: 30px;
908
  vertical-align: top;
909
  }
@@ -917,10 +1169,6 @@ div.wp-smush-dir-limit .wdv-icon-info-sign:before {
917
  max-width: 88%;
918
  }
919
 
920
- .wpmud .bulk-smush-wrapper .wp-smush-all {
921
- margin: 22px 0 0 !important;
922
- }
923
-
924
  .wpmud .bulk-smush-wrapper .wp-smush-remaining button.wp-smush-skip-resmush:not(.wph-button):not(#collapse-button) {
925
  background-color: transparent;
926
  border: solid 2px #888888;
@@ -928,10 +1176,12 @@ div.wp-smush-dir-limit .wdv-icon-info-sign:before {
928
  display: block !important;
929
  font-size: 12px;
930
  font-weight: 600;
931
- margin-left: 27px !important;
 
932
  margin-top: 10px !important;
933
  padding: 5px 16px;
934
  }
 
935
  .wpmud .bulk-smush-wrapper .wp-smush-remaining button.wp-smush-skip-resmush:not(.wph-button):not(#collapse-button):not([tooltip]):hover {
936
  background-color: transparent !important;
937
  border: solid 2px #7d7d7d;
@@ -945,8 +1195,13 @@ div.wp-smush-dir-limit .wdv-icon-info-sign:before {
945
  /** Bulk Smush - Progress Bar **/
946
  .wp-smush-progress-wrap {
947
  border-radius: 5px;
948
- background-color: #fafafa;
949
- padding: 30px;
 
 
 
 
 
950
  }
951
 
952
  .wp-smush-progress-bar-wrap {
@@ -956,9 +1211,13 @@ div.wp-smush-dir-limit .wdv-icon-info-sign:before {
956
  box-sizing: border-box;
957
  -moz-box-sizing: border-box;
958
  -webkit-box-sizing: border-box;
959
- background: #14485F;
960
- padding: 5px;
961
- width: 100%;
 
 
 
 
962
  }
963
 
964
  .wp-smush-progress-bar {
@@ -971,15 +1230,8 @@ div.wp-smush-dir-limit .wdv-icon-info-sign:before {
971
 
972
  .wp-smush-progress-inner {
973
  width: 100%;
974
- height: 40px;
975
- border-radius: 4px;
976
- -moz-border-radius: 4px;
977
- -webkit-border-radius: 4px;
978
- box-shadow: 0 1px 0 rgba(0, 0, 0, 0.75);
979
- -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.75);
980
- -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.75);
981
- background: repeating-linear-gradient(-45deg, #FECF2F, #FECF2F 10px, #FEE696 10px, #FEE696 24px);
982
- background-size: 68px 68px;
983
  animation: movement 1s infinite linear;
984
  -ms-animation: movement 1s infinite linear;
985
  -moz-animation: movement 1s infinite linear;
@@ -1001,8 +1253,8 @@ div.wp-smush-dir-limit .wdv-icon-info-sign:before {
1001
  }
1002
 
1003
  .wp-smush-count {
1004
- color: #8b8b8b;
1005
- font-size: 11px;
1006
  line-height: 1.5;
1007
  margin-top: 15px;
1008
  }
@@ -1024,6 +1276,26 @@ div.wp-smush-dir-limit .wdv-icon-info-sign:before {
1024
  padding: 10px;
1025
  }
1026
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1027
  .wp-smush-ajax-error {
1028
  color: black;
1029
  font-size: 14px;
@@ -1032,16 +1304,44 @@ div.wp-smush-dir-limit .wdv-icon-info-sign:before {
1032
  }
1033
 
1034
  .wpmud .wp-smush-enable-lossy {
1035
- color: #adadad;
1036
  font-size: 13px;
 
1037
  margin-top: 20px;
1038
  }
1039
 
1040
  /** Settings Styling **/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1041
  .wpmud .wp-smush-setting-row label.inline-label {
1042
- color: #555555;
1043
  font-size: 15px;
1044
  font-family: "Roboto", sans-serif;
 
1045
  width: 85%;
1046
  }
1047
 
@@ -1049,6 +1349,7 @@ small.smush-setting-description {
1049
  color: #888888;
1050
  display: block;
1051
  font-size: 13px;
 
1052
  line-height: 22px;
1053
  margin-top: 10px;
1054
  }
@@ -1057,19 +1358,39 @@ small.smush-setting-description strong {
1057
  color: #5f5d5d
1058
  }
1059
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1060
  /** Stats Container **/
1061
  .wpmud .dev-box.smush-stats-wrapper {
1062
  color: #333333;
1063
  font-size: 13px;
1064
- font-family: 'Roboto Condensed', sans-serif;
1065
  font-weight: 700;
1066
- padding: 30px 0 24px 0;
1067
  }
1068
 
1069
  .wpmud .smush-stats-wrapper strong {
1070
  font-weight: 700;
1071
  }
1072
 
 
 
 
 
1073
  .wp-smush-lossy-disabled {
1074
  color: #adadad;
1075
  background: #fafafa;
@@ -1078,54 +1399,42 @@ small.smush-setting-description strong {
1078
  padding: 10px;
1079
  }
1080
 
1081
- .wpmud .wp-smush-stats .button-small.wp-smush-lossy-enable,
1082
- .wpmud .wp-smush-dir-link,
1083
- .wpmud .wp-smush-stats .button-small.wp-smush-resize-enable {
1084
- border-radius: 3px;
1085
- font: 500 12px/20px 'Roboto' !important;
1086
- padding: 4px 15px !important;
1087
- vertical-align: top;
1088
- }
1089
-
1090
- .wpmud .wp-smush-lossy-enable:hover,
1091
- .wpmud .wp-smush-lossy-enable:active,
1092
- .wpmud .wp-smush-lossy-enable:focus,
1093
- .wpmud .wp-smush-dir-link,
1094
- .wpmud .wp-smush-resize-enable:hover,
1095
- .wpmud .wp-smush-resize-enable:active,
1096
- .wpmud .wp-smush-resize-enable:focus {
1097
- background-color: #0093B1;
1098
- color: #FFF;
1099
- box-shadow: none;
1100
- transform: none;
1101
- -webkit-transform: none;
1102
- }
1103
-
1104
- .wpmud .wp-smush-stats, .wp-smush-stats-wrap {
1105
- color: #555555;
1106
  font-family: 'Roboto Condensed', sans-serif;
1107
- font-size: 20px;
1108
- font-weight: 400;
1109
  line-height: 1;
1110
  padding: 5px 0;
1111
  }
1112
 
1113
- .wp-smush-stats-wrap .wp-smush-progress-text {
1114
- color: #b9b9b9;
1115
- font-size: 12px;
1116
  }
1117
 
1118
- .wpmud .wp-smush-lossy-disabled-wrap {
 
 
 
 
 
 
1119
  padding: 0;
1120
  }
1121
 
 
 
 
 
1122
  .wpmud .row .col-third.wp-smushit-container-right {
1123
  padding-right: 0;
1124
  width: 38%;
1125
  }
1126
 
1127
  .wpmud .wp-smush-stats-label {
1128
- padding-top: 9px;
 
 
1129
  }
1130
 
1131
  .wp-smush-stats-label .wdv-icon.wdv-icon-question-sign {
@@ -1164,7 +1473,6 @@ small.smush-setting-description strong {
1164
  background-position: center bottom;
1165
  background-size: 90%;
1166
  height: 500px;
1167
- margin-top: 8px;
1168
  overflow: hidden;
1169
  }
1170
 
@@ -1204,7 +1512,7 @@ small.smush-setting-description strong {
1204
  }
1205
 
1206
  .wpmud .wp-smush-promo-content {
1207
- color: #555555;
1208
  line-height: 1.7;
1209
  margin: auto;
1210
  text-align: center;
@@ -1218,23 +1526,22 @@ small.smush-setting-description strong {
1218
  box-shadow: none !important;
1219
  }
1220
 
1221
- .wpmud .wp-smush-pro-cta .button.button-cta:hover {
1222
- background: #0A9BD6 !important;
 
 
1223
  }
1224
 
1225
  .wpmud .wp-smush-hb-cta .button.button-cta {
1226
- background-color: #FFEA00;
1227
  box-shadow: none;
1228
- color: #4e4b10;
1229
  width: 100%;
1230
  }
1231
 
1232
- .wpmud .box-content .wp-smush-hb-cta .button.button-cta.button-yellow:hover,
1233
- .wpmud .box-content .wp-smush-hb-cta .button.button-cta.button-yellow:active,
1234
- .wpmud .box-content .wp-smush-hb-cta .button.button-cta.button-yellow:focus {
 
1235
  box-shadow: none;
1236
- background: #f7e303 !important;
1237
- color: #4e4b10 !important;
1238
  }
1239
 
1240
  /** Re Smush **/
@@ -1259,6 +1566,7 @@ small.smush-setting-description strong {
1259
  /** No Caps for the tooltips **/
1260
  .wp-admin.wpmud [tooltip]:after {
1261
  text-transform: none !important;
 
1262
  }
1263
 
1264
  .compat-item .compat-field-wp_smush {
@@ -1387,11 +1695,15 @@ small.smush-setting-description strong {
1387
  /** Super Smush Content **/
1388
 
1389
  .wp-smush-super-smush-promo {
1390
- background-image: url(../images/welcome-notice.png);
1391
  background-repeat: no-repeat;
1392
- background-position: 0 bottom;
1393
- height: 180px;
1394
- margin-top: 8px;
 
 
 
 
1395
  overflow: hidden;
1396
  }
1397
 
@@ -1399,11 +1711,22 @@ small.smush-setting-description strong {
1399
  background: #dff6fa;
1400
  border-radius: 5px;
1401
  display: inline-block;
1402
- margin-left: 200px;
1403
- margin-top: 10px;
1404
- padding: 20px 30px;
1405
  position: relative;
1406
- width: 58%;
 
 
 
 
 
 
 
 
 
 
 
1407
  }
1408
 
1409
  /** Arrow **/
@@ -1429,26 +1752,31 @@ small.smush-setting-description strong {
1429
  text-decoration: underline;
1430
  }
1431
 
1432
- .wpmud .wp-smush-setting-row .toggle .toggle-checkbox {
1433
- display: inline-block;
1434
- opacity: 0;
1435
- }
1436
-
1437
  .wp-smush-resize-settings-wrap, .wp-smush-png_to_jpg-wrap, .wp-smush-image-size-list {
1438
- background: rgba(0, 0, 0, 0.05);
 
1439
  border-radius: 5px;
1440
  color: #555;
1441
  font-family: "Roboto", sans-serif;
1442
- margin: 1.5em 0;
1443
  overflow: auto;
1444
  padding: 30px;
1445
  vertical-align: middle;
1446
  }
1447
 
1448
  .wpmud .wp-smush-image-size-list label {
 
1449
  clear: left;
1450
  float: left;
1451
  font-size: 13px;
 
 
 
 
 
 
 
 
1452
  }
1453
 
1454
  .wpmud .wp-smush-resize-settings-wrap label {
@@ -1457,6 +1785,15 @@ small.smush-setting-description strong {
1457
  overflow: hidden;
1458
  }
1459
 
 
 
 
 
 
 
 
 
 
1460
  .wpmud .wp-smush-png_to_jpg-wrap label {
1461
  font-weight: 400;
1462
  }
@@ -1480,15 +1817,24 @@ small.smush-setting-description strong {
1480
  border-color: #fd8b8b;
1481
  }
1482
 
1483
- .wpmud .smush-s3-setup-error {
 
 
 
 
 
 
1484
  margin-top: 15px;
 
 
1485
  }
1486
 
1487
- .wpmud .smush-s3-setup-error p {
1488
  color: #333;
1489
  display: inline-block;
1490
  font-size: 15px;
1491
  margin-top: 0;
 
1492
  }
1493
 
1494
  .wp-smush-settings-info {
@@ -1514,51 +1860,25 @@ small.smush-setting-description strong {
1514
  margin: 10px 20px 0 2px;
1515
  }
1516
 
1517
- /** Circle Style **/
1518
- .wp-smush-stats-graph {
1519
- display: inline-block;
1520
- }
1521
-
1522
- .wp-smush-progress-circle {
1523
- border-radius: 100%;
1524
- display: block;
1525
- height: 50px;
1526
- position: relative;
1527
- width: 50px;
1528
- }
1529
-
1530
- .wp-smush-progress-circle .wp-smush-svg-circle {
1531
- stroke: #E5E5E5;
1532
- stroke-dashoffset: 80;
1533
- stroke-width: 5px;
1534
- -ms-transition: stroke-dashoffset 1s linear;
1535
- -moz-transition: stroke-dashoffset 1s linear;
1536
- -webkit-transition: stroke-dashoffset 1s linear;
1537
- transition: stroke-dashoffset 1s linear;
1538
- }
1539
-
1540
- .wp-smush-progress-circle .wp-smush-svg-circle-progress {
1541
- transform: rotate(-80deg) translateX(-45px) translateY(4px);
1542
- -moz-transform: rotate(-80deg) translateX(-45px) translateY(4px);
1543
- -webkit-transform: rotate(-80deg) translateX(-45px) translateY(4px);
1544
- }
1545
-
1546
- .wp-smush-optimisation-progress {
1547
- color: #28B576;
1548
- cursor: pointer;
1549
- position: relative;
1550
  }
1551
 
1552
- .wp-smush-optimisation-progress .wp-smush-progress-circle .wp-smush-svg-circle-progress {
1553
- stroke: #28B576;
1554
  }
1555
 
1556
  .wpmud #wp-smush-share-widget {
1557
  background-image: url(../images/share-bg-small.png);
1558
  background-repeat: no-repeat;
 
 
 
 
 
 
 
1559
  background-position: 30px 24px;
1560
- min-height: 144px;
1561
- padding: 21px;
1562
  }
1563
 
1564
  #wp-smush-share-widget .box-content {
@@ -1567,7 +1887,10 @@ small.smush-setting-description strong {
1567
  font-weight: 400;
1568
  letter-spacing: -0.015em;
1569
  line-height: 1.5;
1570
- margin-left: 158px;
 
 
 
1571
  }
1572
 
1573
  #wp-smush-twitter-share {
@@ -1608,10 +1931,6 @@ small.smush-setting-description strong {
1608
  margin-right: 12px;
1609
  }
1610
 
1611
- .wpmud .wp-smush-share-message {
1612
- font-weight: 500;
1613
- }
1614
-
1615
  /** Override WP Footer Styling, Hide it on WPMU pages only, if we really need to **/
1616
  .wp-admin #wpfooter {
1617
  display: block;
@@ -1630,7 +1949,7 @@ div.wp-smush-dir-desc {
1630
  }
1631
 
1632
  .wp-smush-dir-browser {
1633
- overflow: hidden;
1634
  }
1635
 
1636
  .wpmud .wp-smush-dir-browser input.wp-smush-dir-path {
@@ -1651,7 +1970,7 @@ div.wp-smush-dir-desc {
1651
  }
1652
 
1653
  .wpmud .dev-overlay.wp-smush-list-dialog .title h3 {
1654
- padding: 20px 0;
1655
  }
1656
 
1657
  .wp-smush-list-dialog .box-scroll {
@@ -1904,7 +2223,8 @@ div.wp-smush-scan-result div.wp-smush-notice {
1904
 
1905
  div.wp-smush-scan-result div.wp-smush-notice .wdv-icon,
1906
  div.wp-smush-scan-result div.wp-smush-notice .dev-icon,
1907
- div.smush-s3-setup-error i.dev-icon {
 
1908
  display: inline-block;
1909
  font-size: 22px;
1910
  margin-right: 5px;
@@ -1912,6 +2232,20 @@ div.smush-s3-setup-error i.dev-icon {
1912
  vertical-align: middle;
1913
  }
1914
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1915
  div.wp-smush-scan-result hr.primary-separator {
1916
  margin: 10px 0 28px;
1917
  }
@@ -2155,6 +2489,25 @@ div.wp-smush-info.notice {
2155
  background-color: #17A8E3;
2156
  }
2157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2158
  .wpmud div.smush-page-wrap button:hover:not(:focus):not(:active):not(.wph-button):not(#collapse-button):not([tooltip]),
2159
  .wpmud .div.smush-page-wrap button:hover:not(:focus):not(:active):not(.wph-button):not(#collapse-button):not([tooltip]),
2160
  .wpmud .smush-page-wrap .wp-smush-submit-wrap .button.button-grey:hover:not(:focus):not(:active):not(.wph-button):not(#collapse-button):not([tooltip]) {
@@ -2166,6 +2519,12 @@ div.wp-smush-info.notice {
2166
  }
2167
 
2168
  /** Media Queries **/
 
 
 
 
 
 
2169
  @media screen and (max-width: 1110px) {
2170
  .wpmud .row .col-half.wp-smushit-container-left,
2171
  .wpmud .row .col-half.wp-smushit-container-right {
@@ -2210,10 +2569,6 @@ div.wp-smush-info.notice {
2210
  }
2211
 
2212
  /** Stats Section **/
2213
- .wpmud .smush-stats-wrapper {
2214
- font-size: 12px;
2215
- }
2216
-
2217
  .smush-stats-wrapper h3 {
2218
  padding: 6px 0;
2219
  }
@@ -2222,13 +2577,9 @@ div.wp-smush-info.notice {
2222
  margin-top: 20px;
2223
  }
2224
 
2225
- .wpmud .wp-smush-stats, .wp-smush-stats-wrap {
2226
- font-size: 20px;
2227
- }
2228
-
2229
  /** Sub Heading **/
2230
  .wpmud .smush-container-subheading {
2231
- font-size: 12px;
2232
  }
2233
  }
2234
 
@@ -2266,13 +2617,6 @@ div.wp-smush-info.notice {
2266
  }
2267
  }
2268
 
2269
- @media only screen and (min-width: 1100px) and ( max-width: 1200px ) {
2270
- .wp-smush-super-smush-promo .wp-smush-super-smush-content {
2271
- margin-left: 170px;
2272
- padding: 10px 20px;
2273
- }
2274
- }
2275
-
2276
  @media only screen and (max-width: 960px) {
2277
  .wpmud .dev-overlay.wp-smush-list-dialog {
2278
  left: 35px;
@@ -2293,10 +2637,6 @@ div.wp-smush-info.notice {
2293
  .dev-box.bulk-smush-wrapper.wp-smush-container {
2294
  padding: 20px 10px;
2295
  }
2296
-
2297
- .wpmud .wp-smush-super-smush-content {
2298
- margin-left: 160px;
2299
- }
2300
  }
2301
 
2302
  @media only screen and (max-width: 782px) {
@@ -2311,6 +2651,13 @@ div.wp-smush-info.notice {
2311
  }
2312
  }
2313
 
 
 
 
 
 
 
 
2314
  /** For directory smush image listing **/
2315
  @media screen and (max-width: 672px) {
2316
  li.wp-smush-image-ul span.wp-smush-li-path {
@@ -2346,15 +2693,6 @@ div.wp-smush-info.notice {
2346
  }
2347
 
2348
  @media screen and (max-width: 600px) {
2349
- .wpmud .wp-smush-welcome.wp-smush-container {
2350
- background-position: 43% bottom;
2351
- padding-bottom: 148px;
2352
- }
2353
-
2354
- .wpmud .wp-smush-welcome-content {
2355
- margin: 0 30px 0px 0;
2356
- max-width: 100%;
2357
- }
2358
 
2359
  .wpmud .dev-overlay.wp-smush-list-dialog {
2360
  top: 0;
@@ -2379,4 +2717,59 @@ div.wp-smush-info.notice {
2379
  div.wp-smush-select-button-wrap-child span.spinner {
2380
  float: right;
2381
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2382
  }
70
 
71
  /** Settings Page **/
72
 
73
+ .wpmud hr {
74
+ background-color: #EEEEEE;
75
+ border: 0 none;
76
+ height: 1px;
77
  }
78
 
79
+ .wpmud .wp-smush-setting-row {
80
+ margin: 32px 0 0 0;
81
+ border-bottom: 1px solid #E6E6E6;
82
+ overflow: hidden;
83
+ padding-bottom: 32px;
84
+ padding-top: 0;
85
+ }
86
+
87
+ .wpmud .toggle, .wpmud .toggle .toggle-label {
88
+ width: 40px;
89
+ height: 18px;
90
+ }
91
+
92
+ .smush-settings-wrapper span.toggle.float-l,
93
+ .wp-smush-premium span.toggle.float-l {
94
+ margin-right: 10px;
95
+ }
96
+
97
+ .wpmud .toggle .toggle-label:after {
98
+ width: 16px;
99
+ height: 16px;
100
+ position: absolute;
101
+ top: 50%;
102
+ margin-top: -8px;
103
+ }
104
+
105
+ .wpmud .toggle .toggle-checkbox:checked + .toggle-label:after {
106
+ margin-left: 23px;
107
+ }
108
+
109
+ .wpmud .toggle .toggle-checkbox:checked + .toggle-label:before {
110
+ left: 23px;
111
+ }
112
+
113
+ .wpmud .toggle .toggle-checkbox:checked + .toggle-label {
114
+ background: #17A8E3;
115
  }
116
 
117
+ .wpmud .toggle .toggle-label:before {
118
+ background: #AAAAAA;
119
  }
120
 
121
  .wpmud .wp-smushit-container-wrap {
122
  display: inline-block;
123
+ margin-top: 10px;
124
+ }
125
+
126
+ .wpmud .row .col-half.wp-smushit-container-right {
127
+ padding-right: 0;
128
  }
129
 
130
  .wpmud .bulk-smush-wrapper.wp-smush-container:not(.wp-smush-pro-install) {
136
  width: 100%;
137
  }
138
 
139
+ .smush-settings-wrapper .column-right-content,
140
+ .wp-smush-premium .column-right-content {
141
+ display: inline-block;
142
+ min-width: 30%;
143
+ max-width: 94%;
144
+ flex: 1;
145
+ -webkit-flex: 1;
146
+ -ms-flex: 1;
147
+ }
148
+
149
  .wp-smush-setting-row .dashicons-info.smush-original {
150
  top: 2px;
151
  position: relative;
153
  }
154
 
155
  .wpmud .wp-smush-submit-wrap {
156
+ display: block;
157
+ margin-top: 30px;
158
  overflow: hidden;
159
  padding-top: 0;
160
  }
161
 
162
  .wp-smush-submit-wrap .spinner {
163
  float: right;
164
+ margin: 10px 1em 0;
165
+ }
166
+
167
+ .smush-submit-note {
168
+ color: #9B9B9B;
169
+ float: left;
170
+ font-family: Roboto;
171
+ font-size: 13px;
172
+ line-height: 22px;
173
+ margin-top: 10px;
174
  }
175
 
176
  input#wp-smush-save-settings {
177
  background: #17A8E3;
178
  float: right;
179
+ margin: 0;
180
  }
181
 
182
  input#wp-smush-save-settings:hover {
333
  transition: opacity .3s;
334
  }
335
 
 
 
 
 
336
  .smush-stats-wrapper .row {
337
  padding: 8px 0;
338
  }
356
  padding-bottom: 8px;
357
  padding-top: 19px;
358
  }
359
+
360
  div.row.smush-avg-pro-savings span.wp-smush-stats-label strong, div.row.smush-avg-pro-savings span.wp-smush-stats {
361
  opacity: 0.5;
362
  }
374
  margin: 7px 8px 0;
375
  }
376
 
377
+ .wpmud .smush-page-wrap .dev-box.smush-stats-wrapper .box-content {
378
+ padding: 0 30px 15px;
 
 
379
  }
380
 
381
  .wp-smush-count-total {
382
  display: inline-block;
383
+ float: left;
384
  line-height: 1;
385
+ margin-top: 20px;
386
  overflow: hidden;
387
  text-align: left;
388
+ width: 48%;
389
  }
390
 
391
+ .wp-smush-stats-other {
392
+ display: inline-block;
393
+ text-align: left;
394
+ width: 48%;
395
  }
396
 
397
+ .wp-smush-stats-other .total-stats-label {
398
+ font-size: 13px;
 
399
  }
400
 
401
+ .wp-smush-stats-other .wp-smush-total-optimised {
402
+ font-size: 15px;
 
403
  }
404
 
405
+ .wp-smush-smush-stats-wrapper {
406
+ color: #333;
407
+ font-size: 40px;
408
+ font-weight: normal;
 
409
  }
410
 
411
+ .total-stats-label {
412
+ color: #888;
413
+ font-size: 15px;
414
+ font-weight: normal;
415
+ line-height: 22px;
416
  }
417
 
418
+ .wpmud .smush-total-savings.smush-total-reduction-percent {
419
+ margin-bottom: 18px;
420
  text-align: center;
 
421
  }
422
 
423
  table.wp-smush-stats-holder {
604
 
605
  /** End of Font Family Variations **/
606
 
607
+ .wpmud #header .wp-smush-page-heading {
608
+ color: #333;
609
  float: left;
610
  font-size: 30px;
 
611
  }
612
 
613
  .wp-smush-auto-message {
614
+ color: #888888;
615
  float: right;
616
+ font-size: 13px;
617
  letter-spacing: -0.015em;
618
  line-height: 1.7;
619
  margin: 1.2em auto;
629
 
630
  .wp-smush-page-header {
631
  overflow: hidden;
632
+ margin: 0 0 10px;
633
  width: 100%;
634
  }
635
 
686
  text-decoration: underline;
687
  }
688
 
689
+ .wpmud .box-container {
690
+ letter-spacing: -0.015em;
 
 
 
691
  }
692
 
693
+ .wpmud .smush-page-wrap .dev-box {
694
+ padding: 0;
695
  }
696
 
697
+ .wpmud .smush-page-wrap .dev-box.bulk-smush-wrapper.wp-smush-pro-install {
698
+ padding: 0 0 30px;
699
+ }
700
+
701
+ .wpmud .smush-page-wrap .dev-box .box-container,
702
+ .wpmud .smush-page-wrap .dev-box .box-content {
703
+ padding: 0 30px 30px;
704
+ }
705
+
706
+ .wpmud .smush-page-wrap .dev-box.bulk-smush-wrapper .box-container {
707
+ padding: 0 30px;
708
  }
709
 
710
  .wpmud .smush-page-wrap .dev-box .box-title {
711
+ height: 60px;
712
+ margin: 0 0px 30px;
713
  }
714
 
715
  .wpmud .dev-box .wp-smush-container-header.box-title h3 {
716
  color: #333333;
717
  display: inline-block;
718
  font-size: 15px;
719
+ line-height: 30px;
720
+ margin-top: 18px;
721
  }
722
 
723
+ .wpmud .smush-container-subheading {
724
+ color: #888;
725
  display: inline-block;
726
  float: right;
727
+ font-weight: normal;
728
+ margin: 1.6em auto;
729
+ max-width: 64%;
730
+ }
731
+
732
+ .smush-page-wrap .wp-smush-premium.dev-box .wp-smush-container-header {
733
+ margin-bottom: 0;
734
  }
735
 
736
  .wp-smush-premium .smush-container-subheading {
737
  font-size: 12px;
738
  line-height: 1.4;
739
+ margin: 1.9em 10px;
740
  vertical-align: top;
741
  }
742
 
745
  color: #fff;
746
  }
747
 
748
+ .wpmud .smush-page-wrap .wp-smush-premium .box-content {
749
+ background: #f2f2f2;
750
+ padding-top: 20px;
751
+ }
752
 
753
  .wpmud .row .col-half.wp-smush-pro-for-free {
754
  padding-left: 0;
775
  }
776
 
777
  .wpmud .smush-stats-wrapper .smush-container-subheading button.wp-smush-scan:not(.wph-button):not(#collapse-button) {
778
+ background: transparent;
779
+ border: 2px solid #888;
780
+ -webkit-border-radius: 4px;
781
+ -moz-border-radius: 4px;
782
+ border-radius: 4px;
783
+ color: #666;
784
  font-size: 12px;
785
+ line-height: 16px;
786
  padding: 5px 16px 5px;
787
  }
788
 
795
  pointer-events: none;
796
  }
797
 
798
+ .wpmud .wp-smush-welcome-content .wp-smush-premium {
799
+ box-shadow: none;
800
+ margin-top: 30px;
801
+ padding: 0
802
  }
803
 
804
+ /**
805
+ Quick Setup Dialog
806
+ */
807
+
808
+ .wp-smush-overlay.no-close {
809
+ left: 0;
810
+ max-width: none;
811
+ margin: 0;
812
+ top: 0;
813
+ z-index: 9999;
814
  }
815
 
816
+ .wp-smush-overlay {
817
+ letter-spacing: -0.015em;
818
+ font-family: Roboto, sans-serif;
819
+ font-size: 15px;
820
+ font-weight: 400;
821
+ line-height: 30px;
822
+ margin: 30px 10px 0 8px;
823
+ -webkit-font-smoothing: antialiased !important;
824
  }
825
 
826
+ .wpmud .dev-overlay .back {
827
+ background: rgba(51, 51, 51, 0.95);
 
 
828
  }
829
 
830
+ .wpmud .dev-overlay .box-scroll {
831
+ padding: 30px;
 
832
  }
833
 
834
+ .wpmud .dev-overlay.small .box {
835
+ position: relative;
836
+ margin: 30px auto;
837
+ width: 100%;
838
+ left: 0;
839
+ max-width: 600px;
840
+ padding: 30px;
841
+ }
842
+
843
+ .wpmud .dev-overlay.small .box:after {
844
+ background: url(../images/smush-quicksetup.png) no-repeat 0 0;
845
+ bottom: 0;
846
+ content: "";
847
+ display: block;
848
+ height: 180px;
849
+ margin: 0 auto;
850
+ left: 0;
851
+ position: absolute;
852
+ right: 0;
853
+ width: 248px;
854
+ }
855
+
856
+ .wpmud .dev-overlay .box .title {
857
+ margin: -35px -30px 30px -30px;
858
+ padding: 0 30px;
859
+ }
860
+
861
+ .wpmud .dev-overlay .box .title h3 {
862
+ color: #333;
863
+ font-size: 15px;
864
+ }
865
+
866
+ .wpmud .dev-overlay .box .content {
867
+ padding-bottom: 180px;
868
  }
869
 
870
  .wpmud .wp-smush-welcome-message {
871
+ color: #444;
872
+ padding-bottom: 30px;
873
+ }
874
+
875
+ .wp-smush-overlay .end {
876
+ border-bottom: 1px solid #E6E6E6;
877
+ }
878
+
879
+ div.smush-quick-setup-settings div.columns.last {
880
+ margin-top: 25px;
881
+ }
882
+
883
+ div.smush-quick-setup-settings div.submit-button-wrap {
884
+ background: none;
885
+ overflow: hidden;
886
+ }
887
+
888
+ .wpmud div.smush-quick-setup-settings div.submit-button-wrap button {
889
+ background-color: #00AEEF !important;
890
+ float: right;
891
+ }
892
+
893
+ .wpmud div.smush-quick-setup-settings div.submit-button-wrap button:hover {
894
+ background-color: #0A9BD6 !important;
895
+ }
896
+
897
+ div.smush-quick-setup-settings div.submit-button-wrap span.spinner {
898
+ margin-top: 11px;
899
+ }
900
+
901
+ /**
902
+ Skip Button
903
+ */
904
+ .wpmud .box button.skip-button.button-small:not(.wph-button):not(#collapse-button) {
905
+ background: transparent;
906
+ border: 0;
907
+ box-shadow: 0 0 0 2px #666666 inset;
908
+ color: #666666;
909
+ display: inline-block;
910
+ font: 500 12px/20px Roboto, sans-serif;
911
+ margin: 0;
912
+ padding: 5px 27px;
913
+ }
914
+
915
+ .wpmud .box button.skip-button.button-small:hover {
916
+ background: #666666 !important;
917
  }
918
 
919
  .wp-smush-welcome-image {
964
  letter-spacing: -0.015em;
965
  }
966
 
967
+ div.smush-notice-cta a.smush-notice-act.button-primary {
968
+ background-color: #00B0DB;
969
+ box-shadow: none;
970
+ border: 1px solid #0087B9;
971
+ border-radius: 2px;
972
+ text-shadow: none;
973
+ font-weight: normal;
974
+ box-shadow: inset 0 1px 0 0 #4BC4E4, 0 1px 0 0 #DBDBDB;
975
+ -webkit-font-smoothing: antialiased;
976
+ }
977
+
978
  .wp-smush-resmush-message,
979
  .wp-smush-settings-updated,
980
  .wp-smush-re-check-message {
1020
  vertical-align: middle;
1021
  }
1022
 
1023
+ div.wp-smush-pagespeed-recommendation {
1024
+ background-color: #F8F8F8;
1025
+ margin: 0 -30px 20px;
1026
+ padding: 20px 30px;
1027
+ }
1028
+
1029
+ .wpmud span.smush-recommendation-title {
1030
+ color: #666666;
1031
+ font-size: 13px;
1032
+ line-height: 22px;
1033
+ }
1034
+
1035
+ ol.smush-recommendation-list {
1036
+ color: #888;
1037
+ font-size: 13px;
1038
+ margin-left: 13px;
1039
+ line-height: 16px;
1040
+ }
1041
+
1042
+ .wpmud ol.smush-recommendation-list a,
1043
+ section.bulk-smush-wrapper div.smush-container-subheading a,
1044
+ .wpmud .wp-smush-stats-human a,
1045
+ a.wp-smush-resize-enable,
1046
+ a.wp-smush-lossy-enable {
1047
+ color: #17A8E3;
1048
+ font-weight: 500;
1049
+ }
1050
+
1051
+ .wpmud ol.smush-recommendation-list a:hover,
1052
+ section.bulk-smush-wrapper div.smush-container-subheading a:hover,
1053
+ .wpmud .wp-smush-stats-human a:hover,
1054
+ a.wp-smush-resize-enable:hover,
1055
+ a.wp-smush-lossy-enable:hover {
1056
+ color: #0A9BD6;
1057
+ }
1058
+
1059
+ ol.smush-recommendation-list li {
1060
+ line-height: 1.5;
1061
+ }
1062
+
1063
+ .wpmud .dismiss-recommendation {
1064
+ color: #333;
1065
+ cursor: pointer;
1066
+ font-weight: 600;
1067
+ font-size: 12px;
1068
+ margin-left: -2px;
1069
+ opacity: 0.5;
1070
+ }
1071
+
1072
+ .wpmud .dev-icon {
1073
+ line-height: 1.5;
1074
+ margin-right: 5px;
1075
+ vertical-align: middle;
1076
+ }
1077
+
1078
+ .wp-smush-bulk-wrapper {
1079
+ overflow: hidden;
1080
+ }
1081
+
1082
  /** Image Remaining **/
1083
  div.wp-smush-remaining,
1084
  #wp-smush-invalid-member,
1085
  div.wp-smush-dir-remaining,
1086
  div.wp-smush-dir-limit,
1087
+ div.smush-s3-setup-error,
1088
+ div.smush-s3-setup-message,
1089
+ div.wp-smush-s3support-alert {
1090
  background-color: #FFF5D5;
1091
  border: none;
1092
  color: #333333;
1095
  letter-spacing: -0.015em;
1096
  }
1097
 
1098
+ div.smush-s3-setup-message {
1099
+ background-color: #DFF6FA;
1100
+ }
1101
+
1102
+ div.wp-smush-s3support-alert {
1103
+ margin-left: 0;
1104
+ margin-right: 0;
1105
+ }
1106
+
1107
+ div.wp-smush-s3support-alert span.notice-message {
1108
+ display: inline-block;
1109
+ max-width: 96%;
1110
+ }
1111
+
1112
+ div.wp-smush-s3support-alert .dev-icon-cross {
1113
+ cursor: pointer;
1114
+ float: right;
1115
+ line-height: 2;
1116
+ }
1117
+
1118
  div.smush-s3-setup-error a {
1119
  color: #333;
1120
  cursor: pointer;
1121
+ font-weight: 500;
1122
  text-decoration: underline;
1123
  }
1124
 
1152
  padding: 10px 50px;
1153
  }
1154
 
1155
+ .wpmud .bulk-smush-wrapper .wp-smush-remaining .wdv-icon {
1156
+ color: #fecf2f;
1157
+ font-size: 20px;
1158
+ margin-right: 8px;
 
 
 
 
1159
  line-height: 30px;
1160
  vertical-align: top;
1161
  }
1169
  max-width: 88%;
1170
  }
1171
 
 
 
 
 
1172
  .wpmud .bulk-smush-wrapper .wp-smush-remaining button.wp-smush-skip-resmush:not(.wph-button):not(#collapse-button) {
1173
  background-color: transparent;
1174
  border: solid 2px #888888;
1176
  display: block !important;
1177
  font-size: 12px;
1178
  font-weight: 600;
1179
+ line-height: 16px;
1180
+ margin-left: 37px !important;
1181
  margin-top: 10px !important;
1182
  padding: 5px 16px;
1183
  }
1184
+
1185
  .wpmud .bulk-smush-wrapper .wp-smush-remaining button.wp-smush-skip-resmush:not(.wph-button):not(#collapse-button):not([tooltip]):hover {
1186
  background-color: transparent !important;
1187
  border: solid 2px #7d7d7d;
1195
  /** Bulk Smush - Progress Bar **/
1196
  .wp-smush-progress-wrap {
1197
  border-radius: 5px;
1198
+ background-color: #f8f8f8;
1199
+ line-height: 2;
1200
+ padding: 20px 15px 20px 30px;
1201
+ }
1202
+
1203
+ .wp-smush-progress-wrap img {
1204
+ vertical-align: middle;
1205
  }
1206
 
1207
  .wp-smush-progress-bar-wrap {
1211
  box-sizing: border-box;
1212
  -moz-box-sizing: border-box;
1213
  -webkit-box-sizing: border-box;
1214
+ background-color: #E6E6E6;
1215
+ display: inline-block;
1216
+ height: 10px;
1217
+ margin-left: 15px;
1218
+ overflow: hidden;
1219
+ vertical-align: middle;
1220
+ width: 88%;
1221
  }
1222
 
1223
  .wp-smush-progress-bar {
1230
 
1231
  .wp-smush-progress-inner {
1232
  width: 100%;
1233
+ height: 10px;
1234
+ background-color: #17A8E3;
 
 
 
 
 
 
 
1235
  animation: movement 1s infinite linear;
1236
  -ms-animation: movement 1s infinite linear;
1237
  -moz-animation: movement 1s infinite linear;
1253
  }
1254
 
1255
  .wp-smush-count {
1256
+ color: #888888;
1257
+ font-size: 13px;
1258
  line-height: 1.5;
1259
  margin-top: 15px;
1260
  }
1276
  padding: 10px;
1277
  }
1278
 
1279
+ div.smush-cancel-button-wrapper {
1280
+ text-align: center;
1281
+ }
1282
+
1283
+ .wpmud div.smush-page-wrap button.wp-smush-cancel-bulk:not(.wph-button):not(#collapse-button) {
1284
+ border: 2px solid #888888;
1285
+ border-radius: 4px;
1286
+ background: transparent;
1287
+ color: #666;
1288
+ font-size: 12px;
1289
+ font-weight: 500;
1290
+ margin-top: 25px;
1291
+ padding: 3px 13px;
1292
+ }
1293
+
1294
+ .wpmud div.smush-page-wrap button.wp-smush-cancel-bulk:not(.wph-button):not(#collapse-button):hover:not(:focus):not(:active):not(.wph-button):not(#collapse-button):not([tooltip]) {
1295
+ background-color: transparent;
1296
+ color: #666;
1297
+ }
1298
+
1299
  .wp-smush-ajax-error {
1300
  color: black;
1301
  font-size: 14px;
1304
  }
1305
 
1306
  .wpmud .wp-smush-enable-lossy {
1307
+ color: #888888;
1308
  font-size: 13px;
1309
+ line-height: 22px;
1310
  margin-top: 20px;
1311
  }
1312
 
1313
  /** Settings Styling **/
1314
+
1315
+ .wpmud .wp-smush-setting-row .column {
1316
+ float: left;
1317
+ }
1318
+
1319
+ .wpmud .wp-smush-setting-row .column-left {
1320
+ width: 25%;
1321
+ }
1322
+
1323
+ .wpmud .wp-smush-setting-row .column-right {
1324
+ display: flex;
1325
+ flex-wrap: wrap;
1326
+ width: 75%;
1327
+ }
1328
+
1329
+ div.smush-sub-setting-wrapper {
1330
+ display: flex;
1331
+ }
1332
+
1333
+ .wpmud .column-right-content-description {
1334
+ color: #888;
1335
+ font-size: 13px;
1336
+ font-weight: normal;
1337
+ margin-top: 10px;
1338
+ }
1339
+
1340
  .wpmud .wp-smush-setting-row label.inline-label {
1341
+ color: #666666;
1342
  font-size: 15px;
1343
  font-family: "Roboto", sans-serif;
1344
+ font-weight: 500;
1345
  width: 85%;
1346
  }
1347
 
1349
  color: #888888;
1350
  display: block;
1351
  font-size: 13px;
1352
+ font-weight: normal;
1353
  line-height: 22px;
1354
  margin-top: 10px;
1355
  }
1358
  color: #5f5d5d
1359
  }
1360
 
1361
+ div.smush-sub-setting-wrapper {
1362
+ margin-bottom: 30px;
1363
+ }
1364
+
1365
+ div.smush-sub-setting-wrapper:last-child {
1366
+ margin-bottom: 0;
1367
+ }
1368
+
1369
+ div.smush-sub-setting-wrapper span.wp-smush-setting-desc {
1370
+ color: #888888;
1371
+ display: inline-block;
1372
+ font-size: 13px;
1373
+ line-height: 22px;
1374
+ margin-top: 10px;
1375
+ }
1376
+
1377
  /** Stats Container **/
1378
  .wpmud .dev-box.smush-stats-wrapper {
1379
  color: #333333;
1380
  font-size: 13px;
1381
+ font-family: 'Roboto', sans-serif;
1382
  font-weight: 700;
1383
+ padding: 0;
1384
  }
1385
 
1386
  .wpmud .smush-stats-wrapper strong {
1387
  font-weight: 700;
1388
  }
1389
 
1390
+ a.wp-smush-lossy-enable {
1391
+ cursor: pointer;
1392
+ }
1393
+
1394
  .wp-smush-lossy-disabled {
1395
  color: #adadad;
1396
  background: #fafafa;
1399
  padding: 10px;
1400
  }
1401
 
1402
+ .wpmud .wp-smush-stats {
1403
+ color: #666;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1404
  font-family: 'Roboto Condensed', sans-serif;
1405
+ font-size: 18px;
1406
+ font-weight: normal;
1407
  line-height: 1;
1408
  padding: 5px 0;
1409
  }
1410
 
1411
+ .wpmud .wp-smush-stats.float-l {
1412
+ clear: left;
 
1413
  }
1414
 
1415
+ .wpmud .wp-smush-lossy-disabled-wrap,
1416
+ .wp-smush-stats.settings-desc,
1417
+ .wp-smush-stats-human.settings-desc {
1418
+ color: #888888;
1419
+ font-family: Roboto;
1420
+ font-size: 13px;
1421
+ line-height: 22px;
1422
  padding: 0;
1423
  }
1424
 
1425
+ .wp-smush-stats-human.settings-desc {
1426
+ font-size: 13px;
1427
+ }
1428
+
1429
  .wpmud .row .col-third.wp-smushit-container-right {
1430
  padding-right: 0;
1431
  width: 38%;
1432
  }
1433
 
1434
  .wpmud .wp-smush-stats-label {
1435
+ color: #333333;
1436
+ font-weight: bold;
1437
+ line-height: 30px;
1438
  }
1439
 
1440
  .wp-smush-stats-label .wdv-icon.wdv-icon-question-sign {
1473
  background-position: center bottom;
1474
  background-size: 90%;
1475
  height: 500px;
 
1476
  overflow: hidden;
1477
  }
1478
 
1512
  }
1513
 
1514
  .wpmud .wp-smush-promo-content {
1515
+ color: #666666;
1516
  line-height: 1.7;
1517
  margin: auto;
1518
  text-align: center;
1526
  box-shadow: none !important;
1527
  }
1528
 
1529
+ .wpmud .wp-smush-pro-cta .button.button-cta:hover,
1530
+ .wpmud .wp-smush-pro-cta .button.button-cta:active,
1531
+ .wpmud .wp-smush-pro-cta .button.button-cta:focus {
1532
+ background: #17b394 !important;
1533
  }
1534
 
1535
  .wpmud .wp-smush-hb-cta .button.button-cta {
 
1536
  box-shadow: none;
 
1537
  width: 100%;
1538
  }
1539
 
1540
+ .wpmud .box-content .wp-smush-hb-cta .button.button-cta:hover,
1541
+ .wpmud .box-content .wp-smush-hb-cta .button.button-cta:active,
1542
+ .wpmud .box-content .wp-smush-hb-cta .button.button-cta:focus {
1543
+ background: #0A9BD6 !important;
1544
  box-shadow: none;
 
 
1545
  }
1546
 
1547
  /** Re Smush **/
1566
  /** No Caps for the tooltips **/
1567
  .wp-admin.wpmud [tooltip]:after {
1568
  text-transform: none !important;
1569
+ text-shadow: none;
1570
  }
1571
 
1572
  .compat-item .compat-field-wp_smush {
1695
  /** Super Smush Content **/
1696
 
1697
  .wp-smush-super-smush-promo {
1698
+ background-image: url(../images/smush-promo.png);
1699
  background-repeat: no-repeat;
1700
+ background-position: 0 0;
1701
+ margin-top: 30px;
1702
+ overflow: hidden;
1703
+ }
1704
+
1705
+ div.wp-smush-super-smush-content-wrapper {
1706
+ margin-bottom: 30px;
1707
  overflow: hidden;
1708
  }
1709
 
1711
  background: #dff6fa;
1712
  border-radius: 5px;
1713
  display: inline-block;
1714
+ float: right;
1715
+ margin-left: 146px;
1716
+ padding: 15px 20px;
1717
  position: relative;
1718
+ }
1719
+
1720
+ .dev-box.wp-smush-premium .wp-smush-super-smush-promo {
1721
+ background-image: url('../images/smush-promo.png');
1722
+ background-position: 30px 12px;
1723
+ background-repeat: no-repeat;
1724
+ margin-top: 0;
1725
+ }
1726
+
1727
+ .dev-box.wp-smush-premium .wp-smush-super-smush-content {
1728
+ margin: 30px 30px 30px 176px;
1729
+ width: auto;
1730
  }
1731
 
1732
  /** Arrow **/
1752
  text-decoration: underline;
1753
  }
1754
 
 
 
 
 
 
1755
  .wp-smush-resize-settings-wrap, .wp-smush-png_to_jpg-wrap, .wp-smush-image-size-list {
1756
+ background-color: #FFFFFF;
1757
+ border: 1px solid #E6E6E6;
1758
  border-radius: 5px;
1759
  color: #555;
1760
  font-family: "Roboto", sans-serif;
1761
+ margin: 1.5em 0 0;
1762
  overflow: auto;
1763
  padding: 30px;
1764
  vertical-align: middle;
1765
  }
1766
 
1767
  .wpmud .wp-smush-image-size-list label {
1768
+ color: #888888;
1769
  clear: left;
1770
  float: left;
1771
  font-size: 13px;
1772
+ line-height: 22px;
1773
+ }
1774
+
1775
+ .wpmud .wp-smush-image-size-list p {
1776
+ color: #888888;
1777
+ font-family: Roboto;
1778
+ font-size: 13px;
1779
+ line-height: 22px;
1780
  }
1781
 
1782
  .wpmud .wp-smush-resize-settings-wrap label {
1785
  overflow: hidden;
1786
  }
1787
 
1788
+ .wpmud .wp-smush-resize-settings-wrap label.resize-height-label {
1789
+ padding-left: 0;
1790
+ }
1791
+
1792
+ span.label-text {
1793
+ display: inline-block;
1794
+ width: 75px;
1795
+ }
1796
+
1797
  .wpmud .wp-smush-png_to_jpg-wrap label {
1798
  font-weight: 400;
1799
  }
1817
  border-color: #fd8b8b;
1818
  }
1819
 
1820
+ div.wp-smush-resize-note {
1821
+ color: #555;
1822
+ font-size: 13px;
1823
+ font-weight: 400;
1824
+ }
1825
+
1826
+ .wpmud .smush-s3-setup-error, .wpmud .smush-s3-setup-message {
1827
  margin-top: 15px;
1828
+ margin-left: 50px;
1829
+ width: 100%;
1830
  }
1831
 
1832
+ .wpmud .smush-s3-setup-error p, .wpmud .smush-s3-setup-message p {
1833
  color: #333;
1834
  display: inline-block;
1835
  font-size: 15px;
1836
  margin-top: 0;
1837
+ width: 90%;
1838
  }
1839
 
1840
  .wp-smush-settings-info {
1860
  margin: 10px 20px 0 2px;
1861
  }
1862
 
1863
+ .wpmud div.smush-page-wrap #header {
1864
+ margin-bottom: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1865
  }
1866
 
1867
+ .wpmud .row div.share-widget-wrapper {
1868
+ padding-left: 0;
1869
  }
1870
 
1871
  .wpmud #wp-smush-share-widget {
1872
  background-image: url(../images/share-bg-small.png);
1873
  background-repeat: no-repeat;
1874
+ background-position: 30px bottom;
1875
+ min-height: 130px;
1876
+ padding: 20px 30px 3px;
1877
+ }
1878
+
1879
+ .wpmud .share-widget-wrapper #wp-smush-share-widget {
1880
+ background-image: url(../images/smush-promo.png);
1881
  background-position: 30px 24px;
 
 
1882
  }
1883
 
1884
  #wp-smush-share-widget .box-content {
1887
  font-weight: 400;
1888
  letter-spacing: -0.015em;
1889
  line-height: 1.5;
1890
+ margin-left: 147px;
1891
+ padding-bottom: 18px;
1892
+ padding-left: 0;
1893
+ padding-right: 0;
1894
  }
1895
 
1896
  #wp-smush-twitter-share {
1931
  margin-right: 12px;
1932
  }
1933
 
 
 
 
 
1934
  /** Override WP Footer Styling, Hide it on WPMU pages only, if we really need to **/
1935
  .wp-admin #wpfooter {
1936
  display: block;
1949
  }
1950
 
1951
  .wp-smush-dir-browser {
1952
+ /*overflow: hidden;*/
1953
  }
1954
 
1955
  .wpmud .wp-smush-dir-browser input.wp-smush-dir-path {
1970
  }
1971
 
1972
  .wpmud .dev-overlay.wp-smush-list-dialog .title h3 {
1973
+ padding: 15px 0;
1974
  }
1975
 
1976
  .wp-smush-list-dialog .box-scroll {
2223
 
2224
  div.wp-smush-scan-result div.wp-smush-notice .wdv-icon,
2225
  div.wp-smush-scan-result div.wp-smush-notice .dev-icon,
2226
+ div.smush-s3-setup-error i.dev-icon,
2227
+ div.smush-s3-setup-message i.dev-icon {
2228
  display: inline-block;
2229
  font-size: 22px;
2230
  margin-right: 5px;
2232
  vertical-align: middle;
2233
  }
2234
 
2235
+ div.smush-s3-setup-error i.dev-icon,
2236
+ div.smush-s3-setup-message i.dev-icon {
2237
+ margin-top: -1px;
2238
+ vertical-align: top;
2239
+ }
2240
+
2241
+ div.smush-s3-setup-error i.dev-icon {
2242
+ margin-top: -2px;
2243
+ }
2244
+
2245
+ div.smush-s3-setup-message i.dev-icon:before {
2246
+ color: #17A8E3;
2247
+ }
2248
+
2249
  div.wp-smush-scan-result hr.primary-separator {
2250
  margin: 10px 0 28px;
2251
  }
2489
  background-color: #17A8E3;
2490
  }
2491
 
2492
+ .wpmud div.smush-page-wrap div.wp-smush-pro-for-free .button {
2493
+ background-color: #1ABC9C;
2494
+ border-radius: 4px;
2495
+ padding: 10px 20px
2496
+ }
2497
+
2498
+ /* Bulk Smush button*/
2499
+ button.wp-smush-all.wp-smush-button {
2500
+ float: right;
2501
+ }
2502
+
2503
+ .wpmud span.wp-smush-upload-images a.button {
2504
+ box-shadow: none;
2505
+ }
2506
+
2507
+ .wpmud span.wp-smush-upload-images a.button:hover:not(:focus):not(:active):not(.wph-button):not(#collapse-button):not([tooltip]) {
2508
+ background: #0A9BD6;
2509
+ }
2510
+
2511
  .wpmud div.smush-page-wrap button:hover:not(:focus):not(:active):not(.wph-button):not(#collapse-button):not([tooltip]),
2512
  .wpmud .div.smush-page-wrap button:hover:not(:focus):not(:active):not(.wph-button):not(#collapse-button):not([tooltip]),
2513
  .wpmud .smush-page-wrap .wp-smush-submit-wrap .button.button-grey:hover:not(:focus):not(:active):not(.wph-button):not(#collapse-button):not([tooltip]) {
2519
  }
2520
 
2521
  /** Media Queries **/
2522
+ @media screen and (min-width: 1425px) {
2523
+ .wpmud .wp-smush-super-smush-promo {
2524
+ background-position: -10px 0;
2525
+ }
2526
+ }
2527
+
2528
  @media screen and (max-width: 1110px) {
2529
  .wpmud .row .col-half.wp-smushit-container-left,
2530
  .wpmud .row .col-half.wp-smushit-container-right {
2569
  }
2570
 
2571
  /** Stats Section **/
 
 
 
 
2572
  .smush-stats-wrapper h3 {
2573
  padding: 6px 0;
2574
  }
2577
  margin-top: 20px;
2578
  }
2579
 
 
 
 
 
2580
  /** Sub Heading **/
2581
  .wpmud .smush-container-subheading {
2582
+ font-size: 13px;
2583
  }
2584
  }
2585
 
2617
  }
2618
  }
2619
 
 
 
 
 
 
 
 
2620
  @media only screen and (max-width: 960px) {
2621
  .wpmud .dev-overlay.wp-smush-list-dialog {
2622
  left: 35px;
2637
  .dev-box.bulk-smush-wrapper.wp-smush-container {
2638
  padding: 20px 10px;
2639
  }
 
 
 
 
2640
  }
2641
 
2642
  @media only screen and (max-width: 782px) {
2651
  }
2652
  }
2653
 
2654
+ @media screen and (max-width: 700px) {
2655
+ .wpmud .smush-submit-note {
2656
+ margin-top: 0;
2657
+ max-width: 50%;
2658
+ }
2659
+ }
2660
+
2661
  /** For directory smush image listing **/
2662
  @media screen and (max-width: 672px) {
2663
  li.wp-smush-image-ul span.wp-smush-li-path {
2693
  }
2694
 
2695
  @media screen and (max-width: 600px) {
 
 
 
 
 
 
 
 
 
2696
 
2697
  .wpmud .dev-overlay.wp-smush-list-dialog {
2698
  top: 0;
2717
  div.wp-smush-select-button-wrap-child span.spinner {
2718
  float: right;
2719
  }
2720
+
2721
+ .wp-smush-progress-bar-wrap {
2722
+ width: 84%;
2723
+ }
2724
+
2725
+ .wpmud .wp-smush-setting-row .column-left,
2726
+ .wpmud .wp-smush-setting-row .column-right {
2727
+ width: 100%;
2728
+ }
2729
+
2730
+ .wpmud .wp-smush-setting-row .column-right {
2731
+ margin-top: 20px;
2732
+ }
2733
+
2734
+ .wp-smush-resize-settings-wrap,
2735
+ .wp-smush-png_to_jpg-wrap,
2736
+ .wp-smush-image-size-list {
2737
+ padding: 20px;
2738
+ }
2739
+
2740
+ section.wp-smush-premium.dev-box div.wp-smush-super-smush-promo {
2741
+ background-position: 30px bottom;
2742
+ }
2743
+ }
2744
+
2745
+ @media screen and (max-width: 525px) {
2746
+ .wpmud .smush-submit-note {
2747
+ clear: left;
2748
+ float: right;
2749
+ margin-top: 20px;
2750
+ max-width: 100%;
2751
+ width: 100%;
2752
+ }
2753
+ }
2754
+ @media screen and (max-width: 480px) {
2755
+ div.wp-smush-super-smush-promo {
2756
+ background: none;
2757
+ }
2758
+
2759
+ .wpmud div.wp-smush-super-smush-content {
2760
+ margin-left: 0;
2761
+ width: 100%;
2762
+ }
2763
+
2764
+ .wpmud div.smush-page-wrap button.wp-smush-resume:not(.wph-button):not(#collapse-button) {
2765
+ clear: left;
2766
+ margin-left: 0 !important;
2767
+ margin-top: 10px;
2768
+ }
2769
+ }
2770
+
2771
+ @media screen and (max-width: 456px) {
2772
+ .bulk-smush-wrapper .wp-smush-notice-text {
2773
+ max-width: 85%;
2774
+ }
2775
  }
assets/images/application.png 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/flash.png CHANGED
Binary file
assets/images/hummingbird.png CHANGED
Binary file
assets/images/loading.gif ADDED
Binary file
assets/images/pdf.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/share-bg-small.png CHANGED
Binary file
assets/images/smush-no-media.png CHANGED
Binary file
assets/images/smush-promo.png ADDED
Binary file
assets/images/smush-quicksetup.png ADDED
Binary file
assets/images/welcome-notice.png CHANGED
Binary file
assets/images/xls.png CHANGED
Binary file
assets/js/notice.js CHANGED
@@ -37,19 +37,27 @@ jQuery(function () {
37
  jQuery.post(ajaxurl, param);
38
  }
39
 
40
- //Store the preference in db
41
- jQuery('.wp-smush-update-info').on('click', '.notice-dismiss', function (e) {
42
- e.preventDefault();
43
- var $el = jQuery(this);
44
- $el.fadeTo( 100, 0, function() {
45
- $el.slideUp( 100, function() {
46
- $el.remove();
47
- });
48
- });
49
  var param = {
50
- action: 'dismiss_update_info'
51
  };
52
  jQuery.post(ajaxurl, param);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  });
54
 
55
  });
37
  jQuery.post(ajaxurl, param);
38
  }
39
 
40
+ // Store the preference in db.
41
+ function send_dismiss_request( action ) {
 
 
 
 
 
 
 
42
  var param = {
43
+ action: action
44
  };
45
  jQuery.post(ajaxurl, param);
46
+ }
47
+
48
+ // Dismiss the update notice.
49
+ jQuery('.wp-smush-update-info').on('click', '.notice-dismiss', function (e) {
50
+ e.preventDefault();
51
+ el_notice = jQuery(this);
52
+ remove_notice();
53
+ send_dismiss_request( 'dismiss_update_info' );
54
+ });
55
+
56
+ // Dismiss S3 support alert.
57
+ jQuery('div.wp-smush-s3support-alert').on('click', '.dev-icon-cross', function (e) {
58
+ el_notice = jQuery(this);
59
+ remove_notice();
60
+ send_dismiss_request( 'dismiss_s3support_alert' );
61
  });
62
 
63
  });
assets/js/ui.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Bulk Page UI/UX
3
+ *
4
+ */
5
+ jQuery(function ($) {
6
+
7
+ /**
8
+ * Remove the quick setup dialog
9
+ */
10
+ function remove_dialog() {
11
+ $('dialog#smush-quick-setup').remove();
12
+ }
13
+
14
+ //Show the Quick Setup Dialog
15
+ if ($('#smush-quick-setup').size() > 0) {
16
+ WDP.showOverlay("#smush-quick-setup", {
17
+ title: wp_smush_msgs.quick_setup_title,
18
+ class: 'no-close wp-smush-overlay'
19
+ });
20
+ remove_dialog();
21
+ }
22
+ }
23
+ );
assets/js/wp-smushit-admin.js CHANGED
@@ -29,23 +29,6 @@ var progress_bar = function (cur_ele, txt, state) {
29
  }
30
  };
31
 
32
- var dash_offset = function (percent) {
33
- //Get the dasharray value
34
- var dasharray = jQuery('.wp-smush-svg-circle-progress').attr('stroke-dasharray');
35
- return dasharray - ( dasharray * percent );
36
- }
37
-
38
- var update_dashoffset = function () {
39
- var total = wp_smushit_data.count_total;
40
- if (total > 0) {
41
- var dashoffset = dash_offset(wp_smushit_data.count_smushed / total);
42
- var circle_progress = jQuery('.wp-smush-svg-circle-progress');
43
- if (typeof dashoffset != 'undefined' && circle_progress.length) {
44
- circle_progress.css({'stroke-dashoffset': dashoffset});
45
- }
46
- }
47
- };
48
-
49
  var membership_validity = function (data) {
50
  var member_validity_notice = jQuery('#wp-smush-invalid-member');
51
 
@@ -196,7 +179,7 @@ jQuery(function ($) {
196
  this.$button.prop("disabled", false);
197
  //For Bulk process, Enable other buttons
198
  $('button.wp-smush-all').removeAttr('disabled');
199
- $('button.wp-smush-scan, button.wp-smush-lossy-enable, button.wp-smush-resize-enable, input#wp-smush-save-settings').removeAttr('disabled');
200
  };
201
 
202
  this.show_loader = function () {
@@ -258,7 +241,7 @@ jQuery(function ($) {
258
 
259
  //Show Notice
260
  if (self.ids.length == 0) {
261
- $('.bulk-smush-wrapper .wp-smush-all-done').show();
262
  $('.wp-smush-bulk-wrapper').hide();
263
  } else {
264
  if ($('.bulk-smush-wrapper .wp-smush-resmush-notice').length > 0) {
@@ -289,7 +272,7 @@ jQuery(function ($) {
289
  //Show Bulk wrapper
290
  $('.wp-smush-bulk-wrapper ').show();
291
  } else {
292
- $('.wp-smush-notice.wp-smush-all-done').show();
293
  }
294
  };
295
 
@@ -305,7 +288,7 @@ jQuery(function ($) {
305
  $('.bulk-smush-wrapper .wp-smush-remaining-count').html(self.ids.length);
306
  }
307
  }
308
- }
309
 
310
  this.update_progress = function (_res) {
311
  //If not bulk
@@ -334,7 +317,7 @@ jQuery(function ($) {
334
  //If all images are resmushed, show the All Smushed message
335
 
336
  //Show All Smushed
337
- $('.bulk-resmush-wrapper .wp-smush-all-done').removeClass('hidden');
338
 
339
  //Hide Everything else
340
  $('.wp-smush-resmush-wrap, .wp-smush-bulk-progress-bar-wrapper').hide();
@@ -353,7 +336,7 @@ jQuery(function ($) {
353
  //Hide the bulk wrapper
354
  $('.wp-smush-bulk-wrapper').hide();
355
  //Show All done notice
356
- $('.wp-smush-notice.wp-smush-all-done').show();
357
  }
358
 
359
  //Update remaining count
@@ -422,7 +405,7 @@ jQuery(function ($) {
422
  self.increment_errors(self.current_id);
423
  }).done(function (res) {
424
  //Increase the error count if any
425
- if (typeof res.success === "undefined" || ( typeof res.success !== "undefined" && res.success === false && res.data.error !== 'bulk_request_image_limit_exceeded' )) {
426
  self.increment_errors(self.current_id);
427
  }
428
  //If no response or success is false, do not process further
@@ -444,7 +427,7 @@ jQuery(function ($) {
444
  self.free_exceeded();
445
 
446
  //Reinsert the current id
447
- wp_smushit_data.unsmushed.push(self.current_id);
448
 
449
  //Update the remaining count to length of remaining ids + 1 (Current id)
450
  self.update_remaining_count();
@@ -517,6 +500,7 @@ jQuery(function ($) {
517
  self.request.abort();
518
  self.enable_button();
519
  self.$button.removeClass('wp-smush-started');
 
520
  $('.wp-smush-bulk-wrapper').show();
521
 
522
  //Hide the Progress Bar
@@ -541,7 +525,7 @@ jQuery(function ($) {
541
  wp_smushit_data.resmush.splice(index, 1);
542
  }
543
  }
544
- }
545
 
546
  this.start();
547
  this.run();
@@ -564,7 +548,7 @@ jQuery(function ($) {
564
  $('.wp-smush-notice.wp-smush-settings-updated').remove();
565
 
566
  //Disable Resmush and scan button
567
- $('.wp-resmush.wp-smush-action, .wp-smush-scan, .wp-smush-button, button.wp-smush-lossy-enable, button.wp-smush-resize-enable, input#wp-smush-save-settings').attr('disabled', 'disabled');
568
 
569
  //Check for ids, if there is none (Unsmushed or lossless), don't call smush function
570
  if (typeof wp_smushit_data == 'undefined' ||
@@ -666,7 +650,7 @@ jQuery(function ($) {
666
  *
667
  */
668
  var validate_resize_settings = function (wrapper_div, width_only, height_only) {
669
- var resize_checkbox = wrapper_div.find('#wp-smush-resize');
670
  if (!height_only) {
671
  var width_input = wrapper_div.find('#wp-smush-resize_width');
672
  var width_error_note = wrapper_div.find('.wp-smush-size-info.wp-smush-update-width');
@@ -677,7 +661,7 @@ jQuery(function ($) {
677
  }
678
 
679
  var width_error = false;
680
- var height_error = false
681
 
682
  //If resize settings is not enabled, return true
683
  if (!resize_checkbox.is(':checked')) {
@@ -746,12 +730,14 @@ jQuery(function ($) {
746
  ++u;
747
  } while(Math.abs(a) >= thresh && u < units.length - 1);
748
  return a.toFixed(b)+' '+units[u];
749
- }
750
 
751
 
752
  //Stackoverflow: http://stackoverflow.com/questions/1726630/formatting-a-number-with-exactly-two-decimals-in-javascript
753
  var precise_round = function (num, decimals) {
754
  var sign = num >= 0 ? 1 : -1;
 
 
755
  return (Math.round((num * Math.pow(10, decimals)) + (sign * 0.001)) / Math.pow(10, decimals));
756
  };
757
 
@@ -848,6 +834,7 @@ jQuery(function ($) {
848
  var notices = $('.bulk-smush-wrapper .wp-smush-notice');
849
  if (notices.length > 0) {
850
  notices.hide();
 
851
  }
852
  //remove existing Re-Smush notices
853
  $('.wp-smush-resmush-notice').remove();
@@ -901,7 +888,7 @@ jQuery(function ($) {
901
  remove_element($('.wp-smush-re-check-message'));
902
  }
903
  });
904
- }
905
 
906
  /**
907
  * Get directory list using Ajax
@@ -924,7 +911,7 @@ jQuery(function ($) {
924
  async: false
925
  });
926
  return res;
927
- }
928
  /**
929
  * Hide the popup and reset the opacity for the button
930
  *
@@ -932,7 +919,7 @@ jQuery(function ($) {
932
  var close_dialog = function () {
933
  //Hide the dialog
934
  $('.wp-smush-list-dialog').hide();
935
- $('.wp-smush-select-dir, button.wp-smush-browse, button.wp-smush-resume').removeAttr('disabled');
936
 
937
  //Remove the spinner
938
  $('div.dir-smush-button-wrap span.spinner').removeClass('is-active');
@@ -940,7 +927,7 @@ jQuery(function ($) {
940
  //Reset the opacity for content and scan button
941
  $('.wp-smush-select-dir, .wp-smush-list-dialog .box .content').css({'opacity': '1'});
942
  $('.wp-smush-select-button-wrap .spinner').removeClass('is-active');
943
- }
944
 
945
  /**
946
  * Initialize accordion
@@ -963,7 +950,7 @@ jQuery(function ($) {
963
  }
964
  }
965
  }
966
- }
967
 
968
  /**
969
  * Check if all the elements in the directory are smushed or not
@@ -1055,7 +1042,7 @@ jQuery(function ($) {
1055
  parent.removeClass('active').find('.wp-smush-image-list-inner').removeClass("show");
1056
  }
1057
 
1058
- }
1059
 
1060
  /**
1061
  * Add choose directory button at the top
@@ -1202,6 +1189,9 @@ jQuery(function ($) {
1202
  //Add to Resize Savings
1203
  wp_smushit_data.savings_resize = 'undefined' != typeof image_stats.savings_resize.bytes ? parseInt(wp_smushit_data.savings_resize) + parseInt(image_stats.savings_resize.bytes) : parseInt(wp_smushit_data.savings_resize);
1204
 
 
 
 
1205
  //Add to Conversion Savings
1206
  wp_smushit_data.savings_conversion = 'undefined' != typeof image_stats.savings_conversion && 'undefined' != typeof image_stats.savings_conversion.bytes ? parseInt(wp_smushit_data.savings_conversion) + parseInt(image_stats.savings_conversion.bytes ) : parseInt(wp_smushit_data.savings_conversion);
1207
  } else if( 'directory_smush' == type ) {
@@ -1233,7 +1223,7 @@ jQuery(function ($) {
1233
  wp_smushit_data.size_before = 'undefined' != typeof image_stats.savings_conversion.size_before ? parseInt(wp_smushit_data.size_before) + parseInt(image_stats.savings_conversion.size_before) : parseInt(wp_smushit_data.size_before);
1234
  wp_smushit_data.size_after = 'undefined' != typeof image_stats.savings_conversion.size_after ? parseInt(wp_smushit_data.size_after) + parseInt(image_stats.savings_conversion.size_after) : parseInt(wp_smushit_data.size_after);
1235
  }
1236
- }
1237
 
1238
  /**
1239
  * Update all stats sections based on the response.
@@ -1242,8 +1232,7 @@ jQuery(function ($) {
1242
  */
1243
  var update_stats = function () {
1244
 
1245
- // Update Progress on Circle.
1246
- update_dashoffset();
1247
 
1248
  //Calculate updated savings in bytes
1249
  wp_smushit_data.savings_bytes = parseInt(wp_smushit_data.size_before) - parseInt(wp_smushit_data.size_after);
@@ -1261,12 +1250,26 @@ jQuery(function ($) {
1261
  wp_smushit_data.smush_percent = precise_round(( parseInt(wp_smushit_data.count_smushed) / parseInt(wp_smushit_data.count_total) ) * 100, 1);
1262
  $('span.wp-smush-images-percent').html(wp_smushit_data.smush_percent);
1263
 
 
 
 
 
 
 
 
 
1264
  //Update Image count
1265
  $('span.wp-smush-total-optimised').html(wp_smushit_data.count_images);
1266
 
1267
  //Update image count in share message
1268
  $('span.smush-share-image-count').html( wp_smushit_data.count_images );
1269
 
 
 
 
 
 
 
1270
  //Update image count in share message
1271
 
1272
  //Update supersmushed image count
@@ -1291,7 +1294,7 @@ jQuery(function ($) {
1291
  var resize_savings = smush_resize_savings.find('.wp-smush-stats');
1292
  // Replace only if value is grater than 0.
1293
  if (savings_value > 0 && resize_savings.length > 0) {
1294
- resize_savings.html(formatBytes(wp_smushit_data.savings_resize, 1));
1295
  }
1296
  }
1297
 
@@ -1343,7 +1346,7 @@ jQuery(function ($) {
1343
 
1344
  if( '' == notice_type ) {
1345
  //Get the Total and Optimised image count
1346
- var image_ele = $('li.wp-smush-image-ele')
1347
  var total = image_ele.length;
1348
  var remaning = image_ele.filter(':not(.optimised)').length;
1349
  var smushed = total - remaning;
@@ -1380,7 +1383,7 @@ jQuery(function ($) {
1380
  //Update Directory progress and remove any loaders still in there
1381
  update_smush_progress();
1382
 
1383
- }
1384
 
1385
  /**
1386
  * Start Optimising all the images listed in last directory scan
@@ -1460,7 +1463,12 @@ jQuery(function ($) {
1460
  // Update dir savings stats.
1461
  if ('undefined' != typeof (res.data.total.percent) && 'undefined' != typeof (res.data.total.human) && 'undefined' != typeof (res.data.total.bytes)) {
1462
  // Directory stats section.
1463
- var smush_dir_savings = $('.smush-dir-savings');
 
 
 
 
 
1464
  if (smush_dir_savings.length > 0 && res.data.total.bytes > 0) {
1465
  // Make separator visible if hidden.
1466
  smush_dir_savings.find('.wp-smush-stats-sep').show();
@@ -1470,7 +1478,7 @@ jQuery(function ($) {
1470
  dir_savings_percent.html(res.data.total.percent + '%');
1471
  }
1472
  if (dir_savings_human.length > 0) {
1473
- dir_savings_human.html(res.data.total.human);
1474
  }
1475
  }
1476
  }
@@ -1501,13 +1509,24 @@ jQuery(function ($) {
1501
  }
1502
 
1503
  });
 
 
 
 
 
 
 
 
 
 
 
1504
  }
1505
 
1506
  //Scroll the element to top of the page
1507
  var goToByScroll = function (selector) {
1508
  // Scroll
1509
  $('html,body').animate({
1510
- scrollTop: selector.offset().top
1511
  },
1512
  'slow');
1513
  };
@@ -1525,20 +1544,23 @@ jQuery(function ($) {
1525
 
1526
  // Do not replace if 0 savings.
1527
  if (stats.dir_smush.bytes > 0) {
1528
- // Show size and percentage separator.
1529
- $('div.smush-dir-savings span.wp-smush-stats span.wp-smush-stats-sep').show();
1530
  //Update Savings in bytes
1531
  if (stats_human.length > 0) {
1532
- stats_human.html(stats.dir_smush.human);
1533
  } else {
1534
  var span = '<span class="wp-smush-stats-human">' + stats.dir_smush.bytes + '</span>';
1535
  }
1536
 
1537
- //Update Optimisation percentage
1538
- if (stats_percent.length > 0) {
1539
- stats_percent.html(stats.dir_smush.percent + '%');
1540
- } else {
1541
- var span = '<span class="wp-smush-stats-percent">' + stats.dir_smush.percent + '%' + '</span>';
 
 
 
 
 
1542
  }
1543
  }
1544
  }
@@ -1550,10 +1572,6 @@ jQuery(function ($) {
1550
  var smush_percent = ( c_stats.smushed / c_stats.total_count ) * 100;
1551
  smush_percent = precise_round( smush_percent, 1 );
1552
 
1553
- //Update Circle Progress
1554
- if (c_stats.dash_offset) {
1555
- $('circle.wp-smush-svg-circle-progress').css({'stroke-dashoffset': c_stats.dash_offset});
1556
- }
1557
  //Smushed Percent
1558
  if (smush_percent) {
1559
  $('div.wp-smush-count-total span.wp-smush-images-percent').html(smush_percent);
@@ -1572,6 +1590,15 @@ jQuery(function ($) {
1572
  }
1573
  };
1574
 
 
 
 
 
 
 
 
 
 
1575
  /**
1576
  * Handle the Smush Stats link click
1577
  */
@@ -1668,6 +1695,7 @@ jQuery(function ($) {
1668
  });
1669
 
1670
  //Dismiss Welcome notice
 
1671
  $('#wp-smush-welcome-box .smush-dismiss-welcome').on('click', function (e) {
1672
  e.preventDefault();
1673
  var $el = $(this).parents().eq(1);
@@ -1790,7 +1818,7 @@ jQuery(function ($) {
1790
  if (wp_smushit_data.count_smushed == wp_smushit_data.count_total) {
1791
 
1792
  //Show all done notice
1793
- $('.wp-smush-notice.wp-smush-all-done').show();
1794
 
1795
  //Hide Smush button
1796
  $('.wp-smush-bulk-wrapper ').hide()
@@ -1802,7 +1830,7 @@ jQuery(function ($) {
1802
  var type = $('.wp-smush-scan').data('type');
1803
  type = 'undefined' == typeof type ? 'media' : type;
1804
 
1805
- var smushed_count = 'undefined' != typeof wp_smushit_data.count_smushed ? wp_smushit_data.count_smushed : 0
1806
 
1807
  var smush_percent = ( smushed_count / wp_smushit_data.count_total ) * 100;
1808
  smush_percent = precise_round( smush_percent, 1 );
@@ -1825,7 +1853,7 @@ jQuery(function ($) {
1825
  var params = {
1826
  action: 'delete_resmush_list',
1827
  type: type
1828
- }
1829
  //Delete resmush list, @todo: update stats from the ajax response
1830
  $.post(ajaxurl, params, function (res) {
1831
  //Remove the whole li element on success
@@ -1846,23 +1874,23 @@ jQuery(function ($) {
1846
  });
1847
 
1848
  //Enable Super Smush
1849
- $('button.wp-smush-lossy-enable').on('click', function (e) {
1850
  e.preventDefault();
1851
 
1852
  //Enable Super Smush
1853
  $('#wp-smush-lossy').prop('checked', true);
1854
- //Induce Setting button save click
1855
- $('#wp-smush-save-settings').click();
1856
  });
1857
 
1858
  //Enable Resize
1859
  $('.wp-smush-resize-enable').on('click', function (e) {
1860
  e.preventDefault();
1861
 
1862
- //Enable Super Smush
1863
  $('#wp-smush-resize').prop('checked', true);
1864
- //Induce Setting button save click
1865
- $('#wp-smush-save-settings').click();
 
1866
  });
1867
 
1868
  //Trigger Bulk
@@ -1885,7 +1913,7 @@ jQuery(function ($) {
1885
  });
1886
 
1887
  //Re-Validate Resize Width And Height
1888
- $('.wp-smush-resize-input').blur(function () {
1889
 
1890
  var self = $(this);
1891
 
@@ -1897,7 +1925,7 @@ jQuery(function ($) {
1897
  });
1898
 
1899
  //Handle Resize Checkbox toggle, to show/hide width, height settings
1900
- $('#wp-smush-resize').click(function () {
1901
  var self = $(this);
1902
  var settings_wrap = $('.wp-smush-resize-settings-wrap');
1903
 
@@ -1932,11 +1960,15 @@ jQuery(function ($) {
1932
  //Handle Twitter Share
1933
  $('#wp-smush-twitter-share').on('click', function (e) {
1934
  e.preventDefault();
 
 
 
 
1935
  var width = 550,
1936
  height = 420,
1937
  left = ($(window).width() - width) / 2,
1938
  top = ($(window).height() - height) / 2,
1939
- url = this.href,
1940
  opts = 'status=1' +
1941
  ',width=' + width +
1942
  ',height=' + height +
@@ -2007,6 +2039,13 @@ jQuery(function ($) {
2007
  run_re_check($('.wp-smush-scan'), false);
2008
  }
2009
 
 
 
 
 
 
 
 
2010
  //WP Smush all : Scan Images
2011
  $('div.row').on('click', 'button.wp-smush-browse', function (e) {
2012
 
@@ -2037,9 +2076,7 @@ jQuery(function ($) {
2037
 
2038
  $(".wp-smush-list-dialog .content").fileTree({
2039
  script: getDirectoryList,
2040
- //folderEvent: 'dblclick',
2041
  multiFolder: false
2042
- //onlyFolders: true
2043
  });
2044
 
2045
  });
@@ -2125,6 +2162,8 @@ jQuery(function ($) {
2125
  //Clone and add Smush button
2126
  add_smush_button();
2127
 
 
 
2128
  });
2129
  });
2130
 
@@ -2182,7 +2221,7 @@ jQuery(function ($) {
2182
  $('input[name="wp-smush-continue-ajax"]').val(0);
2183
 
2184
  //Enable the smush button, disable Pause button
2185
- pause_button.attr('disabled', 'disabled');
2186
 
2187
  //Enable the smush button, hide the spinner
2188
  $('button.wp-smush-start, button.wp-smush-browse').show().removeAttr('disabled');
@@ -2286,7 +2325,7 @@ jQuery(function ($) {
2286
  //Update Directory Smush, as soon as the page loads
2287
  var stats_param = {
2288
  action: 'get_dir_smush_stats'
2289
- }
2290
  $.get(ajaxurl, stats_param, function (r) {
2291
 
2292
  //Hide the spinner
@@ -2303,7 +2342,7 @@ jQuery(function ($) {
2303
  //Append the text
2304
  $('div.smush-dir-savings span.wp-smush-stats').append(wp_smush_msgs.ajax_error);
2305
  $('div.smush-dir-savings span.wp-smush-stats span').hide();
2306
- return;
2307
  } else {
2308
  //Update the stats
2309
  update_cummulative_stats(r.data);
@@ -2324,6 +2363,71 @@ jQuery(function ($) {
2324
  }
2325
  });
2326
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2327
  });
2328
  (function ($) {
2329
  var Smush = function (element, options) {
29
  }
30
  };
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  var membership_validity = function (data) {
33
  var member_validity_notice = jQuery('#wp-smush-invalid-member');
34
 
179
  this.$button.prop("disabled", false);
180
  //For Bulk process, Enable other buttons
181
  $('button.wp-smush-all').removeAttr('disabled');
182
+ $('button.wp-smush-scan, a.wp-smush-lossy-enable, button.wp-smush-resize-enable, input#wp-smush-save-settings').removeAttr('disabled');
183
  };
184
 
185
  this.show_loader = function () {
241
 
242
  //Show Notice
243
  if (self.ids.length == 0) {
244
+ $('.bulk-smush-wrapper .wp-smush-all-done, .wp-smush-pagespeed-recommendation').show();
245
  $('.wp-smush-bulk-wrapper').hide();
246
  } else {
247
  if ($('.bulk-smush-wrapper .wp-smush-resmush-notice').length > 0) {
272
  //Show Bulk wrapper
273
  $('.wp-smush-bulk-wrapper ').show();
274
  } else {
275
+ $('.wp-smush-notice.wp-smush-all-done, .wp-smush-pagespeed-recommendation').show();
276
  }
277
  };
278
 
288
  $('.bulk-smush-wrapper .wp-smush-remaining-count').html(self.ids.length);
289
  }
290
  }
291
+ };
292
 
293
  this.update_progress = function (_res) {
294
  //If not bulk
317
  //If all images are resmushed, show the All Smushed message
318
 
319
  //Show All Smushed
320
+ $('.bulk-resmush-wrapper .wp-smush-all-done, .wp-smush-pagespeed-recommendation').removeClass('hidden');
321
 
322
  //Hide Everything else
323
  $('.wp-smush-resmush-wrap, .wp-smush-bulk-progress-bar-wrapper').hide();
336
  //Hide the bulk wrapper
337
  $('.wp-smush-bulk-wrapper').hide();
338
  //Show All done notice
339
+ $('.wp-smush-notice.wp-smush-all-done, .wp-smush-pagespeed-recommendation').show();
340
  }
341
 
342
  //Update remaining count
405
  self.increment_errors(self.current_id);
406
  }).done(function (res) {
407
  //Increase the error count if any
408
+ if (typeof res.success === "undefined" || ( typeof res.success !== "undefined" && typeof res.success.data !== "undefined" && res.success === false && res.data.error !== 'bulk_request_image_limit_exceeded' )) {
409
  self.increment_errors(self.current_id);
410
  }
411
  //If no response or success is false, do not process further
427
  self.free_exceeded();
428
 
429
  //Reinsert the current id
430
+ wp_smushit_data.unsmushed.unshift(self.current_id);
431
 
432
  //Update the remaining count to length of remaining ids + 1 (Current id)
433
  self.update_remaining_count();
500
  self.request.abort();
501
  self.enable_button();
502
  self.$button.removeClass('wp-smush-started');
503
+ wp_smushit_data.unsmushed.unshift(self.current_id);
504
  $('.wp-smush-bulk-wrapper').show();
505
 
506
  //Hide the Progress Bar
525
  wp_smushit_data.resmush.splice(index, 1);
526
  }
527
  }
528
+ };
529
 
530
  this.start();
531
  this.run();
548
  $('.wp-smush-notice.wp-smush-settings-updated').remove();
549
 
550
  //Disable Resmush and scan button
551
+ $('.wp-resmush.wp-smush-action, .wp-smush-scan, .wp-smush-button, a.wp-smush-lossy-enable, button.wp-smush-resize-enable, input#wp-smush-save-settings').attr('disabled', 'disabled');
552
 
553
  //Check for ids, if there is none (Unsmushed or lossless), don't call smush function
554
  if (typeof wp_smushit_data == 'undefined' ||
650
  *
651
  */
652
  var validate_resize_settings = function (wrapper_div, width_only, height_only) {
653
+ var resize_checkbox = wrapper_div.parent().find('#wp-smush-resize, #wp-smush-resize-quick-setup');
654
  if (!height_only) {
655
  var width_input = wrapper_div.find('#wp-smush-resize_width');
656
  var width_error_note = wrapper_div.find('.wp-smush-size-info.wp-smush-update-width');
661
  }
662
 
663
  var width_error = false;
664
+ var height_error = false;
665
 
666
  //If resize settings is not enabled, return true
667
  if (!resize_checkbox.is(':checked')) {
730
  ++u;
731
  } while(Math.abs(a) >= thresh && u < units.length - 1);
732
  return a.toFixed(b)+' '+units[u];
733
+ };
734
 
735
 
736
  //Stackoverflow: http://stackoverflow.com/questions/1726630/formatting-a-number-with-exactly-two-decimals-in-javascript
737
  var precise_round = function (num, decimals) {
738
  var sign = num >= 0 ? 1 : -1;
739
+ //Keep the percentage below 100
740
+ num = num > 100 ? 100 : num;
741
  return (Math.round((num * Math.pow(10, decimals)) + (sign * 0.001)) / Math.pow(10, decimals));
742
  };
743
 
834
  var notices = $('.bulk-smush-wrapper .wp-smush-notice');
835
  if (notices.length > 0) {
836
  notices.hide();
837
+ $('.wp-smush-pagespeed-recommendation').hide();
838
  }
839
  //remove existing Re-Smush notices
840
  $('.wp-smush-resmush-notice').remove();
888
  remove_element($('.wp-smush-re-check-message'));
889
  }
890
  });
891
+ };
892
 
893
  /**
894
  * Get directory list using Ajax
911
  async: false
912
  });
913
  return res;
914
+ };
915
  /**
916
  * Hide the popup and reset the opacity for the button
917
  *
919
  var close_dialog = function () {
920
  //Hide the dialog
921
  $('.wp-smush-list-dialog').hide();
922
+ $('.wp-smush-select-dir, button.wp-smush-browse, button.wp-smush-resume, a.wp-smush-dir-link').removeAttr('disabled');
923
 
924
  //Remove the spinner
925
  $('div.dir-smush-button-wrap span.spinner').removeClass('is-active');
927
  //Reset the opacity for content and scan button
928
  $('.wp-smush-select-dir, .wp-smush-list-dialog .box .content').css({'opacity': '1'});
929
  $('.wp-smush-select-button-wrap .spinner').removeClass('is-active');
930
+ };
931
 
932
  /**
933
  * Initialize accordion
950
  }
951
  }
952
  }
953
+ };
954
 
955
  /**
956
  * Check if all the elements in the directory are smushed or not
1042
  parent.removeClass('active').find('.wp-smush-image-list-inner').removeClass("show");
1043
  }
1044
 
1045
+ };
1046
 
1047
  /**
1048
  * Add choose directory button at the top
1189
  //Add to Resize Savings
1190
  wp_smushit_data.savings_resize = 'undefined' != typeof image_stats.savings_resize.bytes ? parseInt(wp_smushit_data.savings_resize) + parseInt(image_stats.savings_resize.bytes) : parseInt(wp_smushit_data.savings_resize);
1191
 
1192
+ //Update Resize count
1193
+ wp_smushit_data.count_resize = 'undefined' != typeof image_stats.savings_resize.bytes ? parseInt(wp_smushit_data.count_resize) + 1 : wp_smushit_data.count_resize;
1194
+
1195
  //Add to Conversion Savings
1196
  wp_smushit_data.savings_conversion = 'undefined' != typeof image_stats.savings_conversion && 'undefined' != typeof image_stats.savings_conversion.bytes ? parseInt(wp_smushit_data.savings_conversion) + parseInt(image_stats.savings_conversion.bytes ) : parseInt(wp_smushit_data.savings_conversion);
1197
  } else if( 'directory_smush' == type ) {
1223
  wp_smushit_data.size_before = 'undefined' != typeof image_stats.savings_conversion.size_before ? parseInt(wp_smushit_data.size_before) + parseInt(image_stats.savings_conversion.size_before) : parseInt(wp_smushit_data.size_before);
1224
  wp_smushit_data.size_after = 'undefined' != typeof image_stats.savings_conversion.size_after ? parseInt(wp_smushit_data.size_after) + parseInt(image_stats.savings_conversion.size_after) : parseInt(wp_smushit_data.size_after);
1225
  }
1226
+ };
1227
 
1228
  /**
1229
  * Update all stats sections based on the response.
1232
  */
1233
  var update_stats = function () {
1234
 
1235
+ var super_savings = smushed_count = 0;
 
1236
 
1237
  //Calculate updated savings in bytes
1238
  wp_smushit_data.savings_bytes = parseInt(wp_smushit_data.size_before) - parseInt(wp_smushit_data.size_after);
1250
  wp_smushit_data.smush_percent = precise_round(( parseInt(wp_smushit_data.count_smushed) / parseInt(wp_smushit_data.count_total) ) * 100, 1);
1251
  $('span.wp-smush-images-percent').html(wp_smushit_data.smush_percent);
1252
 
1253
+ //Super-Smush Savings
1254
+ if ('undefined' != typeof wp_smushit_data.savings_bytes && 'undefined' != typeof wp_smushit_data.savings_resize) {
1255
+ super_savings = parseInt(wp_smushit_data.savings_bytes) - parseInt(wp_smushit_data.savings_resize);
1256
+ if (super_savings > 0) {
1257
+ $('div.super-smush-attachments span.smushed-savings').html(formatBytes(super_savings, 1));
1258
+ }
1259
+ }
1260
+
1261
  //Update Image count
1262
  $('span.wp-smush-total-optimised').html(wp_smushit_data.count_images);
1263
 
1264
  //Update image count in share message
1265
  $('span.smush-share-image-count').html( wp_smushit_data.count_images );
1266
 
1267
+ //Update Resize image count
1268
+ $('div.wp-smush-count-resize-total span.wp-smush-total-optimised').html( wp_smushit_data.count_resize );
1269
+
1270
+ //Update Attachment image count
1271
+ $('div.wp-smush-count-attachment-total span.wp-smush-total-optimised').html( wp_smushit_data.count_smushed );
1272
+
1273
  //Update image count in share message
1274
 
1275
  //Update supersmushed image count
1294
  var resize_savings = smush_resize_savings.find('.wp-smush-stats');
1295
  // Replace only if value is grater than 0.
1296
  if (savings_value > 0 && resize_savings.length > 0) {
1297
+ resize_savings.removeClass('settings-desc float-l').addClass('float-r').html(formatBytes(wp_smushit_data.savings_resize, 1));
1298
  }
1299
  }
1300
 
1346
 
1347
  if( '' == notice_type ) {
1348
  //Get the Total and Optimised image count
1349
+ var image_ele = $('li.wp-smush-image-ele');
1350
  var total = image_ele.length;
1351
  var remaning = image_ele.filter(':not(.optimised)').length;
1352
  var smushed = total - remaning;
1383
  //Update Directory progress and remove any loaders still in there
1384
  update_smush_progress();
1385
 
1386
+ };
1387
 
1388
  /**
1389
  * Start Optimising all the images listed in last directory scan
1463
  // Update dir savings stats.
1464
  if ('undefined' != typeof (res.data.total.percent) && 'undefined' != typeof (res.data.total.human) && 'undefined' != typeof (res.data.total.bytes)) {
1465
  // Directory stats section.
1466
+ var smush_dir_savings = $('div.smush-dir-savings');
1467
+ var stats_wrapper = smush_dir_savings.find('span.wp-smush-stats');
1468
+ if( stats_wrapper.hasClass('float-l') ) {
1469
+ //Right float the stats
1470
+ stats_wrapper.removeClass('float-l').addClass('float-r');
1471
+ }
1472
  if (smush_dir_savings.length > 0 && res.data.total.bytes > 0) {
1473
  // Make separator visible if hidden.
1474
  smush_dir_savings.find('.wp-smush-stats-sep').show();
1478
  dir_savings_percent.html(res.data.total.percent + '%');
1479
  }
1480
  if (dir_savings_human.length > 0) {
1481
+ dir_savings_human.html(res.data.total.human).removeClass('settings-desc');
1482
  }
1483
  }
1484
  }
1509
  }
1510
 
1511
  });
1512
+ };
1513
+
1514
+ //Finds y value of given object
1515
+ function findPos(obj) {
1516
+ var curtop = 0;
1517
+ if (obj.offsetParent) {
1518
+ do {
1519
+ curtop += obj.offsetTop;
1520
+ } while (obj = obj.offsetParent);
1521
+ return [curtop];
1522
+ }
1523
  }
1524
 
1525
  //Scroll the element to top of the page
1526
  var goToByScroll = function (selector) {
1527
  // Scroll
1528
  $('html,body').animate({
1529
+ scrollTop: $(selector).offset().top - 100
1530
  },
1531
  'slow');
1532
  };
1544
 
1545
  // Do not replace if 0 savings.
1546
  if (stats.dir_smush.bytes > 0) {
 
 
1547
  //Update Savings in bytes
1548
  if (stats_human.length > 0) {
1549
+ stats_human.html(stats.dir_smush.human).removeClass('settings-desc');
1550
  } else {
1551
  var span = '<span class="wp-smush-stats-human">' + stats.dir_smush.bytes + '</span>';
1552
  }
1553
 
1554
+ //Percentage section
1555
+ if (stats.dir_smush.percent > 0) {
1556
+ // Show size and percentage separator.
1557
+ $('div.smush-dir-savings span.wp-smush-stats span.wp-smush-stats-sep').show();
1558
+ //Update Optimisation percentage
1559
+ if (stats_percent.length > 0) {
1560
+ stats_percent.html(stats.dir_smush.percent + '%');
1561
+ } else {
1562
+ var span = '<span class="wp-smush-stats-percent">' + stats.dir_smush.percent + '%' + '</span>';
1563
+ }
1564
  }
1565
  }
1566
  }
1572
  var smush_percent = ( c_stats.smushed / c_stats.total_count ) * 100;
1573
  smush_percent = precise_round( smush_percent, 1 );
1574
 
 
 
 
 
1575
  //Smushed Percent
1576
  if (smush_percent) {
1577
  $('div.wp-smush-count-total span.wp-smush-images-percent').html(smush_percent);
1590
  }
1591
  };
1592
 
1593
+ //Remove span tag from URL
1594
+ function removeSpan(url) {
1595
+ var url = url.slice(url.indexOf('?') + 1).split('&');
1596
+ for (var i = 0; i < url.length; i++) {
1597
+ var urlparam = decodeURI( url[i] ).split(/=(.+)/)[1];
1598
+ return urlparam.replace(/<(?:.|\n)*?>/gm, '');
1599
+ }
1600
+ }
1601
+
1602
  /**
1603
  * Handle the Smush Stats link click
1604
  */
1695
  });
1696
 
1697
  //Dismiss Welcome notice
1698
+ //@todo: Use it for popup
1699
  $('#wp-smush-welcome-box .smush-dismiss-welcome').on('click', function (e) {
1700
  e.preventDefault();
1701
  var $el = $(this).parents().eq(1);
1818
  if (wp_smushit_data.count_smushed == wp_smushit_data.count_total) {
1819
 
1820
  //Show all done notice
1821
+ $('.wp-smush-notice.wp-smush-all-done, .wp-smush-pagespeed-recommendation').show();
1822
 
1823
  //Hide Smush button
1824
  $('.wp-smush-bulk-wrapper ').hide()
1830
  var type = $('.wp-smush-scan').data('type');
1831
  type = 'undefined' == typeof type ? 'media' : type;
1832
 
1833
+ var smushed_count = 'undefined' != typeof wp_smushit_data.count_smushed ? wp_smushit_data.count_smushed : 0;
1834
 
1835
  var smush_percent = ( smushed_count / wp_smushit_data.count_total ) * 100;
1836
  smush_percent = precise_round( smush_percent, 1 );
1853
  var params = {
1854
  action: 'delete_resmush_list',
1855
  type: type
1856
+ };
1857
  //Delete resmush list, @todo: update stats from the ajax response
1858
  $.post(ajaxurl, params, function (res) {
1859
  //Remove the whole li element on success
1874
  });
1875
 
1876
  //Enable Super Smush
1877
+ $('a.wp-smush-lossy-enable').on('click', function (e) {
1878
  e.preventDefault();
1879
 
1880
  //Enable Super Smush
1881
  $('#wp-smush-lossy').prop('checked', true);
1882
+ goToByScroll(".wp-smush-lossy-label");
 
1883
  });
1884
 
1885
  //Enable Resize
1886
  $('.wp-smush-resize-enable').on('click', function (e) {
1887
  e.preventDefault();
1888
 
1889
+ //Enable Resize, Show resize settings
1890
  $('#wp-smush-resize').prop('checked', true);
1891
+ $('div.wp-smush-resize-settings-wrap').show();
1892
+ //Scroll down to settings area
1893
+ goToByScroll(".wp-smush-resize-label");
1894
  });
1895
 
1896
  //Trigger Bulk
1913
  });
1914
 
1915
  //Re-Validate Resize Width And Height
1916
+ $('body').on('blur', '.wp-smush-resize-input', function () {
1917
 
1918
  var self = $(this);
1919
 
1925
  });
1926
 
1927
  //Handle Resize Checkbox toggle, to show/hide width, height settings
1928
+ $('body').on('click', '#wp-smush-resize, #wp-smush-resize-quick-setup', function () {
1929
  var self = $(this);
1930
  var settings_wrap = $('.wp-smush-resize-settings-wrap');
1931
 
1960
  //Handle Twitter Share
1961
  $('#wp-smush-twitter-share').on('click', function (e) {
1962
  e.preventDefault();
1963
+ var url = this.href;
1964
+ var text = removeSpan(url);
1965
+ //Update text in URL
1966
+ url = url.replace(/(text=)[^\&]+/, '$1' + text);
1967
  var width = 550,
1968
  height = 420,
1969
  left = ($(window).width() - width) / 2,
1970
  top = ($(window).height() - height) / 2,
1971
+ url = url,
1972
  opts = 'status=1' +
1973
  ',width=' + width +
1974
  ',height=' + height +
2039
  run_re_check($('.wp-smush-scan'), false);
2040
  }
2041
 
2042
+ //Stats Section Choose Directory Link
2043
+ $('body').on('click', 'a.wp-smush-dir-link', function(e) {
2044
+ e.preventDefault();
2045
+ goToByScroll('#wp-smush-dir-browser');
2046
+ $('div.row button.wp-smush-browse').click();
2047
+ });
2048
+
2049
  //WP Smush all : Scan Images
2050
  $('div.row').on('click', 'button.wp-smush-browse', function (e) {
2051
 
2076
 
2077
  $(".wp-smush-list-dialog .content").fileTree({
2078
  script: getDirectoryList,
 
2079
  multiFolder: false
 
2080
  });
2081
 
2082
  });
2162
  //Clone and add Smush button
2163
  add_smush_button();
2164
 
2165
+ window.location.hash = '#wp-smush-dir-browser';
2166
+
2167
  });
2168
  });
2169
 
2221
  $('input[name="wp-smush-continue-ajax"]').val(0);
2222
 
2223
  //Enable the smush button, disable Pause button
2224
+ pause_button.hide().attr('disabled', 'disabled');
2225
 
2226
  //Enable the smush button, hide the spinner
2227
  $('button.wp-smush-start, button.wp-smush-browse').show().removeAttr('disabled');
2325
  //Update Directory Smush, as soon as the page loads
2326
  var stats_param = {
2327
  action: 'get_dir_smush_stats'
2328
+ };
2329
  $.get(ajaxurl, stats_param, function (r) {
2330
 
2331
  //Hide the spinner
2342
  //Append the text
2343
  $('div.smush-dir-savings span.wp-smush-stats').append(wp_smush_msgs.ajax_error);
2344
  $('div.smush-dir-savings span.wp-smush-stats span').hide();
2345
+
2346
  } else {
2347
  //Update the stats
2348
  update_cummulative_stats(r.data);
2363
  }
2364
  });
2365
 
2366
+ //Quick Setup - Form Submit
2367
+ $('body').on('submit', '.smush-quick-setup-settings form', function () {
2368
+ var self = $(this);
2369
+ var submit_button = self.find('button[type="submit"]');
2370
+ $.ajax({
2371
+ type: 'POST',
2372
+ url: ajaxurl,
2373
+ data: self.serialize(),
2374
+ beforeSend: function () {
2375
+ //Show loader
2376
+
2377
+ //Disable the button
2378
+ submit_button.attr('disabled', 'disabled');
2379
+
2380
+ //Show loader
2381
+ $('<span class="spinner is-active"></span>').insertAfter( submit_button );
2382
+ },
2383
+ success: function (data) {
2384
+ //Enable the button
2385
+ submit_button.removeAttr('disabled');
2386
+ //Remove the loader
2387
+ submit_button.parent(). find('span.spinner').remove();
2388
+
2389
+ if (data.success == 1) {
2390
+ //remove skip button
2391
+ $('.smush-skip-setup').hide();
2392
+ }
2393
+ //Reload the Page
2394
+ location.reload();
2395
+ }
2396
+ });
2397
+ return false;
2398
+ });
2399
+ //Quick Setup - Skip button
2400
+ $('body').on('submit', '.smush-skip-setup', function () {
2401
+ var self = $(this);
2402
+ $.ajax({
2403
+ type: 'POST',
2404
+ url: ajaxurl,
2405
+ data: self.serialize(),
2406
+ beforeSend: function () {
2407
+ self.find('.button').attr('disabled', 'disabled');
2408
+ },
2409
+ success: function (data) {
2410
+ location.reload();
2411
+ }
2412
+ });
2413
+ return false;
2414
+ });
2415
+
2416
+ //Dismiss Smush recommendation
2417
+ $('span.dismiss-recommendation').on('click', function(e) {
2418
+ e.preventDefault();
2419
+ var parent = $(this).parent();
2420
+ //remove div and save preference in db
2421
+ parent.hide('slow', function(){ parent.remove(); });
2422
+ $.ajax({
2423
+ type: 'POST',
2424
+ url: ajaxurl,
2425
+ data: {
2426
+ 'action' : 'hide_pagespeed_suggestion'
2427
+ }
2428
+ });
2429
+ })
2430
+
2431
  });
2432
  (function ($) {
2433
  var Smush = function (element, options) {
assets/shared-ui/wdev-ui.css CHANGED
@@ -32,6 +32,7 @@
32
  * 23. FONTAWESOME
33
  * 24. WPMUDEV ICONFONT
34
  * 25. CUSTOM ANIMATIONS
 
35
  *
36
  * -----------------------------------------------------------------------------
37
  */
@@ -2587,3 +2588,16 @@
2587
  overflow: hidden;
2588
  animation: collapse 0.5s linear;
2589
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  * 23. FONTAWESOME
33
  * 24. WPMUDEV ICONFONT
34
  * 25. CUSTOM ANIMATIONS
35
+ * 26. ACCESSIBILITY
36
  *
37
  * -----------------------------------------------------------------------------
38
  */
2588
  overflow: hidden;
2589
  animation: collapse 0.5s linear;
2590
  }
2591
+
2592
+ /* ****************************************************************************
2593
+ * 26. ACCESSIBILITY
2594
+ */
2595
+ body .wpdui-sr-only {
2596
+ clip: rect(1px, 1px, 1px, 1px);
2597
+ clip-path: polygon(0px 0px, 0px 0px,0px 0px, 0px 0px);
2598
+ position: absolute !important;
2599
+ white-space: nowrap;
2600
+ height: 1px;
2601
+ width: 1px;
2602
+ overflow: hidden;
2603
+ }
assets/shared-ui/wdev-ui.js CHANGED
@@ -419,7 +419,7 @@ WDP.prepareOverlay = function() {
419
  WDP.overlay.box = jQuery('<div class="box"></div>');
420
  WDP.overlay.box_title = jQuery('<div class="title"><h3></h3></div>');
421
  WDP.overlay.box_content = jQuery('<div class="content"></div>');
422
- WDP.overlay.close = jQuery('<div class="close" aria-label="Close">&times;</div>');
423
 
424
  WDP.overlay.back.appendTo(WDP.overlay.wrapper);
425
  WDP.overlay.scroll.appendTo(WDP.overlay.wrapper);
@@ -640,7 +640,7 @@ WDP.wpmuSelect = function(el) {
640
  jq.hide();
641
 
642
  wrap = jq.parent();
643
- handle = jQuery("<span class='dropdown-handle'><i class='wdv-icon wdv-icon-reorder'></i></span>").prependTo(wrap);
644
  list = jQuery("<div class='select-list-container'></div>").appendTo(wrap);
645
  value = jQuery("<div class='list-value'>&nbsp;</div>").appendTo(list);
646
  items = jQuery("<ul class='list-results'></ul>").appendTo(list);
@@ -815,7 +815,7 @@ WDP.wpmuSearchfield = function(el) {
815
 
816
  jq.wrap('<div class="input-box">');
817
  inpbox = jq.parent();
818
- inpbox.append('<i class="search-icon dev-icon dev-icon-search"></i>');
819
 
820
  curitem = jQuery('<div class="current-item"></div>');
821
  curitem.appendTo(inpbox);
@@ -890,10 +890,10 @@ WDP.wpmuSearchfield = function(el) {
890
  item = items[i];
891
 
892
  if (! item.label) { continue; }
893
- li.html('<span class="item-label">' + item.label + '</span>');
894
 
895
  if (item.thumb) {
896
- li.prepend('<span class="thumb" style="background-image:url(' + item.thumb + ')">');
897
  }
898
  if (item.id) {
899
  li.attr('data-id', item.id);
@@ -1109,19 +1109,19 @@ WDP.showMessage = function(action) {
1109
 
1110
  jQuery("body").append(
1111
  '<div class="update-notice ok" id="wdp-success" style="display:none">' +
1112
- '<span class="the-msg-icon check-animation"></span>' +
1113
  '<p><span class="default-text">' + WDP.lang.default_msg_ok + '</span>' +
1114
  '<span class="extra-text" style="display:none"></span></p>' +
1115
- '<span class="close" aria-label="Close">&times;</span>' +
1116
  '</div>'
1117
  )
1118
 
1119
  jQuery("body").append(
1120
  '<div class="update-notice err" id="wdp-error" style="display:none">' +
1121
- '<i class="the-msg-icon wdv-icon wdv-icon-warning-sign"></i>' +
1122
  '<p><span class="default-text">' + WDP.lang.default_msg_err + '</span>' +
1123
  '<span class="extra-text" style="display:none"></span></p>' +
1124
- '<span class="close" aria-label="Close">&times;</span>' +
1125
  '</div>'
1126
  );
1127
 
419
  WDP.overlay.box = jQuery('<div class="box"></div>');
420
  WDP.overlay.box_title = jQuery('<div class="title"><h3></h3></div>');
421
  WDP.overlay.box_content = jQuery('<div class="content"></div>');
422
+ WDP.overlay.close = jQuery('<div aria-hidden="true" class="close">&times;</div><button class="wpdui-sr-only"><span class="wpdui-sr-only">Close</span></button>');
423
 
424
  WDP.overlay.back.appendTo(WDP.overlay.wrapper);
425
  WDP.overlay.scroll.appendTo(WDP.overlay.wrapper);
640
  jq.hide();
641
 
642
  wrap = jq.parent();
643
+ handle = jQuery("<span class='dropdown-handle'><i aria-hidden='true' class='wdv-icon wdv-icon-reorder'></i></span>").prependTo(wrap);
644
  list = jQuery("<div class='select-list-container'></div>").appendTo(wrap);
645
  value = jQuery("<div class='list-value'>&nbsp;</div>").appendTo(list);
646
  items = jQuery("<ul class='list-results'></ul>").appendTo(list);
815
 
816
  jq.wrap('<div class="input-box">');
817
  inpbox = jq.parent();
818
+ inpbox.append('<i aria-hidden="true" class="search-icon dev-icon dev-icon-search"></i><button class="wpdui-sr-only search-icon"><span class="wpdui-sr-only">Search</span></button>');
819
 
820
  curitem = jQuery('<div class="current-item"></div>');
821
  curitem.appendTo(inpbox);
890
  item = items[i];
891
 
892
  if (! item.label) { continue; }
893
+ li.html('<span aria-hidden="true" class="item-label">' + item.label + '</span><a class="wpdui-sr-only item-label"><span class="wpdui-sr-only">' + item.label + '</span></a>');
894
 
895
  if (item.thumb) {
896
+ li.prepend('<span aria-hidden="true" class="thumb" style="background-image:url(' + item.thumb + ')">');
897
  }
898
  if (item.id) {
899
  li.attr('data-id', item.id);
1109
 
1110
  jQuery("body").append(
1111
  '<div class="update-notice ok" id="wdp-success" style="display:none">' +
1112
+ '<span aria-hidden="true" class="the-msg-icon check-animation"></span>' +
1113
  '<p><span class="default-text">' + WDP.lang.default_msg_ok + '</span>' +
1114
  '<span class="extra-text" style="display:none"></span></p>' +
1115
+ '<span aria-hidden="true" class="close">&times;</span><button class="wpdui-sr-only"><span class="wpdui-sr-only">Close</span></button>' +
1116
  '</div>'
1117
  )
1118
 
1119
  jQuery("body").append(
1120
  '<div class="update-notice err" id="wdp-error" style="display:none">' +
1121
+ '<i aria-hidden="true" class="the-msg-icon wdv-icon wdv-icon-warning-sign"></i>' +
1122
  '<p><span class="default-text">' + WDP.lang.default_msg_err + '</span>' +
1123
  '<span class="extra-text" style="display:none"></span></p>' +
1124
+ '<span aria-hidden="true" class="close">&times;</span><button class="wpdui-sr-only"><span class="wpdui-sr-only">Close</span></button>' +
1125
  '</div>'
1126
  );
1127
 
extras/free-dashboard/admin.js CHANGED
@@ -4,9 +4,9 @@ jQuery(function() {
4
  plugin_id = el_notice.find( "input[name=plugin_id]" ).val(),
5
  url_wp = el_notice.find( "input[name=url_wp]" ).val(),
6
  drip_plugin = el_notice.find( "input[name=drip_plugin]" ).val(),
7
- inp_email = el_notice.find( "input[name=email]" )
8
  btn_act = el_notice.find( ".frash-notice-act" ),
9
- btn_dismiss = el_notice.find( ".frash-notice-dismiss" )
10
  ajax_data = {};
11
 
12
  ajax_data.plugin_id = plugin_id;
4
  plugin_id = el_notice.find( "input[name=plugin_id]" ).val(),
5
  url_wp = el_notice.find( "input[name=url_wp]" ).val(),
6
  drip_plugin = el_notice.find( "input[name=drip_plugin]" ).val(),
7
+ inp_email = el_notice.find( "input[name=email]" );
8
  btn_act = el_notice.find( ".frash-notice-act" ),
9
+ btn_dismiss = el_notice.find( ".frash-notice-dismiss" );
10
  ajax_data = {};
11
 
12
  ajax_data.plugin_id = plugin_id;
languages/wp-smushit.pot CHANGED
@@ -1,9 +1,11 @@
1
  #, fuzzy
2
  msgid ""
3
  msgstr ""
4
- "Project-Id-Version: WP Smush 2.7.4\n"
5
- "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wp-smushit\n"
6
- "POT-Creation-Date: 2017-07-18 04:14:20+00:00\n"
 
 
7
  "MIME-Version: 1.0\n"
8
  "Content-Type: text/plain; charset=UTF-8\n"
9
  "Content-Transfer-Encoding: 8bit\n"
@@ -30,14 +32,14 @@ msgid "Oops, we could not do this..."
30
  msgstr ""
31
 
32
  #: assets/shared-ui/plugin-ui.php:272 extras/free-dashboard/module.php:395
33
- #: extras/free-dashboard/module.php:434 lib/class-wp-smush-ui.php:890
34
  msgid "Saving"
35
  msgstr ""
36
 
37
  #: assets/shared-ui/plugin-ui.php:301
38
  #: extras/dash-notice/wpmudev-dash-notification.php:248
39
  #: extras/dash-notice/wpmudev-dash-notification.php:289
40
- #: lib/class-wp-smush-ui.php:890
41
  msgid "Dismiss"
42
  msgstr ""
43
 
@@ -178,746 +180,819 @@ msgstr ""
178
  msgid "Rate %s"
179
  msgstr ""
180
 
181
- #: lib/class-wp-smush-admin.php:209
182
- msgid "Enable Network wide settings"
 
 
 
 
183
  msgstr ""
184
 
185
- #: lib/class-wp-smush-admin.php:210
186
- msgid "If disabled sub sites can override the individual Smush settings."
 
 
187
  msgstr ""
188
 
189
- #: lib/class-wp-smush-admin.php:213
190
  msgid "Automatically smush my images on upload"
191
  msgstr ""
192
 
193
- #: lib/class-wp-smush-admin.php:214
 
 
 
 
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:217
200
- msgid "Preserve image EXIF data"
201
  msgstr ""
202
 
203
- #: lib/class-wp-smush-admin.php:218
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:221
211
- msgid "Resize original images"
 
212
  msgstr ""
213
 
214
- #: lib/class-wp-smush-admin.php:222
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:225
222
- msgid "Super-smush my images"
223
  msgstr ""
224
 
225
- #: lib/class-wp-smush-admin.php:226
 
 
 
 
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:229
232
- msgid "Include my original full-size images"
233
  msgstr ""
234
 
235
- #: lib/class-wp-smush-admin.php:230
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:233
245
- msgid "Make a copy of my original images"
246
  msgstr ""
247
 
248
- #: lib/class-wp-smush-admin.php:234
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:237
256
- msgid "Convert PNG to JPEG (lossy)"
257
  msgstr ""
258
 
259
- #: lib/class-wp-smush-admin.php:238
260
- #, php-format
 
 
 
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
  #. Plugin Name of the plugin/theme
270
- #: lib/class-wp-smush-admin.php:266 lib/class-wp-smush-ui.php:823
271
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:71
272
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:90
273
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:92
274
  msgid "WP Smush"
275
  msgstr ""
276
 
277
- #: lib/class-wp-smush-admin.php:394 lib/class-wp-smush.php:1058
278
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:159
279
- #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:275
280
  msgid "Super-Smush"
281
  msgstr ""
282
 
283
- #: lib/class-wp-smush-admin.php:395
284
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:160
285
  msgid "Smush Now"
286
  msgstr ""
287
 
288
- #: lib/class-wp-smush-admin.php:396
289
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:161
290
  msgid "{{errors}} image(s) were skipped due to an error."
291
  msgstr ""
292
 
293
- #: lib/class-wp-smush-admin.php:397
294
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:162
295
  msgid "All images are fully optimized."
296
  msgstr ""
297
 
298
- #: lib/class-wp-smush-admin.php:398
299
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:163
300
  msgid "Restoring image.."
301
  msgstr ""
302
 
303
- #: lib/class-wp-smush-admin.php:399
304
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:164
305
  msgid "Smushing image.."
306
  msgstr ""
307
 
308
- #: lib/class-wp-smush-admin.php:400
309
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:165
310
  msgid "Checking images.."
311
  msgstr ""
312
 
313
- #: lib/class-wp-smush-admin.php:401
314
  msgid ""
315
  "We successfully verified your membership, all the Pro features should work "
316
  "completely. "
317
  msgstr ""
318
 
319
- #: lib/class-wp-smush-admin.php:402
320
  msgid "Your membership couldn't be verified."
321
  msgstr ""
322
 
323
- #: lib/class-wp-smush-admin.php:403
324
  msgid "Missing file path."
325
  msgstr ""
326
 
327
- #: lib/class-wp-smush-admin.php:405
328
  msgid "image could not be smushed."
329
  msgstr ""
330
 
331
- #: lib/class-wp-smush-admin.php:406
332
  msgid "images could not be smushed."
333
  msgstr ""
334
 
335
- #: lib/class-wp-smush-admin.php:407 lib/class-wp-smush.php:974
336
- #: lib/class-wp-smush.php:978
337
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:193
338
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:196
339
  msgid "Already Optimized"
340
  msgstr ""
341
 
342
- #: lib/class-wp-smush-admin.php:408
343
  msgid "Ajax Error"
344
  msgstr ""
345
 
346
- #: lib/class-wp-smush-admin.php:409 lib/class-wp-smush-admin.php:410
347
- #: lib/class-wp-smush-admin.php:1270
348
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:354
349
  msgid "All Done!"
350
  msgstr ""
351
 
352
- #: lib/class-wp-smush-admin.php:691
 
 
 
 
 
 
 
 
353
  msgid ""
354
- "Smush request timed out, You can try setting a higher value for "
355
- "`WP_SMUSH_API_TIMEOUT`."
 
356
  msgstr ""
357
 
358
- #: lib/class-wp-smush-admin.php:745 lib/class-wp-smush-nextgen.php:432
359
  msgid "You don't have permission to work with uploaded files."
360
  msgstr ""
361
 
362
- #: lib/class-wp-smush-admin.php:749 lib/class-wp-smush-nextgen.php:436
363
  msgid "No attachment ID was provided."
364
  msgstr ""
365
 
366
- #: lib/class-wp-smush-admin.php:761
367
  msgid "Attachment Skipped - Check `wp_smush_image` filter."
368
  msgstr ""
369
 
370
- #: lib/class-wp-smush-admin.php:948
371
  #, php-format
372
  msgid "<strong>%d of %d images</strong> were sent for smushing:"
373
  msgstr ""
374
 
375
- #: lib/class-wp-smush-admin.php:1263 lib/class-wp-smush-admin.php:1276
376
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:350
377
- msgid "Bulk Smush Now"
378
- msgstr ""
379
-
380
- #: lib/class-wp-smush-admin.php:1298 lib/class-wp-smush.php:1064
381
  msgid "Smushing in progress.."
382
  msgstr ""
383
 
384
- #: lib/class-wp-smush-admin.php:1304 lib/class-wp-smush.php:1083
385
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:269
386
  msgid "Smush Now!"
387
  msgstr ""
388
 
389
- #: lib/class-wp-smush-admin.php:1325
390
  msgid "Settings"
391
  msgstr ""
392
 
393
- #: lib/class-wp-smush-admin.php:1476
394
  msgid "Image not smushed, fields empty."
395
  msgstr ""
396
 
397
- #: lib/class-wp-smush-admin.php:1483 lib/class-wp-smush-nextgen.php:619
398
  msgid ""
399
  "Image couldn't be smushed as the nonce verification failed, try reloading "
400
  "the page."
401
  msgstr ""
402
 
403
- #: lib/class-wp-smush-admin.php:1500
404
  msgid "Unable to smush image"
405
  msgstr ""
406
 
407
- #: lib/class-wp-smush-admin.php:1525
408
  msgid ""
409
  "We haven’t found any images in your media library yet so there’s no smushing "
410
- "to be done!"
411
  msgstr ""
412
 
413
- #: lib/class-wp-smush-admin.php:1541
414
  msgid "Yay! All images are optimized as per your current settings."
415
  msgstr ""
416
 
417
- #: lib/class-wp-smush-admin.php:1745 lib/class-wp-smush-ui.php:798
418
  #, php-format
419
  msgid "You have images that need smushing. %sBulk smush now!%s"
420
  msgstr ""
421
 
422
- #: lib/class-wp-smush-admin.php:2122
423
  msgid "Review your setting now."
424
  msgstr ""
425
 
426
- #: lib/class-wp-smush-admin.php:2123 lib/class-wp-smush-dir.php:249
427
- #: lib/class-wp-smush-dir.php:275 lib/class-wp-smush-ui.php:686
428
- #: lib/class-wp-smush-ui.php:823
429
  msgid "WP Smush Pro"
430
  msgstr ""
431
 
432
- #: lib/class-wp-smush-admin.php:2124
433
  msgid ""
434
  "Welcome to the newest version of WP Smush! In this update we've added the "
435
  "ability to bulk smush images in directories outside your uploads folder."
436
  msgstr ""
437
 
438
- #: lib/class-wp-smush-admin.php:2127
439
  #, php-format
440
  msgid ""
441
  " And as a multisite user, you can manage %sSmush settings%s globally across "
442
  "all sites!"
443
  msgstr ""
444
 
445
- #: lib/class-wp-smush-admin.php:2130
446
  #, php-format
447
  msgid " %sFind out more here >>%s"
448
  msgstr ""
449
 
450
- #: lib/class-wp-smush-backup.php:148 lib/class-wp-smush-nextgen.php:519
451
  msgid "Error in processing restore action, Fields empty."
452
  msgstr ""
453
 
454
- #: lib/class-wp-smush-backup.php:155 lib/class-wp-smush-nextgen.php:526
455
  msgid "Image not restored, Nonce verification failed."
456
  msgstr ""
457
 
458
- #: lib/class-wp-smush-backup.php:282 lib/class-wp-smush-nextgen.php:601
459
  msgid "Unable to restore image"
460
  msgstr ""
461
 
462
  #: lib/class-wp-smush-dir.php:88
463
- msgid "DIRECTORY SMUSH SAVINGS"
464
  msgstr ""
465
 
466
  #: lib/class-wp-smush-dir.php:90
467
  msgid "Updating Stats"
468
  msgstr ""
469
 
470
- #: lib/class-wp-smush-dir.php:104
471
- msgid "SMUSH DIRECTORY"
 
 
 
 
472
  msgstr ""
473
 
474
- #: lib/class-wp-smush-dir.php:219
475
  msgid "RESUME LAST SCAN"
476
  msgstr ""
477
 
478
- #: lib/class-wp-smush-dir.php:251
479
  msgid "DIRECTORY SMUSH"
480
  msgstr ""
481
 
482
- #: lib/class-wp-smush-dir.php:256
483
  msgid ""
484
  "In addition to smushing your media uploads, you may want to also smush "
485
  "images living outside your uploads directory. Simply add any directories you "
486
  "wish to smush and bulk smush away!"
487
  msgstr ""
488
 
489
- #: lib/class-wp-smush-dir.php:269
490
  msgid ""
491
  "All images for the selected directory are smushed and up to date. Awesome!"
492
  msgstr ""
493
 
494
- #: lib/class-wp-smush-dir.php:272
495
  #, php-format
496
  msgid ""
497
  "%s/%s image(s) were successfully smushed, however %s image(s) could not be "
498
  "smushed due to an error."
499
  msgstr ""
500
 
501
- #: lib/class-wp-smush-dir.php:275
502
  #, php-format
503
  msgid ""
504
  " %sUpgrade to pro%s to bulk smush all your directory images with one click. "
505
  "Free users can smush 50 images with each click."
506
  msgstr ""
507
 
508
- #: lib/class-wp-smush-dir.php:279 lib/class-wp-smush-ui.php:90
509
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:496
 
 
510
  msgid "BULK SMUSH"
511
  msgstr ""
512
 
513
- #: lib/class-wp-smush-dir.php:281
514
  msgid "Click to stop the directory smushing process."
515
  msgstr ""
516
 
517
- #: lib/class-wp-smush-dir.php:282 lib/class-wp-smush-ui.php:734
518
  msgid "CANCEL"
519
  msgstr ""
520
 
521
- #: lib/class-wp-smush-dir.php:290
522
  msgid "CHOOSE DIRECTORY"
523
  msgstr ""
524
 
525
- #: lib/class-wp-smush-dir.php:299
526
  msgid "Directory list"
527
  msgstr ""
528
 
529
- #: lib/class-wp-smush-dir.php:302
530
  msgid "Choose the folder you wish to smush."
531
  msgstr ""
532
 
533
- #: lib/class-wp-smush-dir.php:306
534
  msgid ""
535
  "Smush will also include any images in sub folders of your selected folder."
536
  msgstr ""
537
 
538
- #: lib/class-wp-smush-dir.php:309
539
  msgid "ADD DIRECTORY"
540
  msgstr ""
541
 
542
- #: lib/class-wp-smush-dir.php:472
543
  msgid "Exclude directory from Smush List"
544
  msgstr ""
545
 
546
- #: lib/class-wp-smush-dir.php:606
547
  msgid "We could not find any images in the selected directory."
548
  msgstr ""
549
 
550
- #: lib/class-wp-smush-dir.php:916
551
  #, php-format
552
  msgid "%d images"
553
  msgstr ""
554
 
555
- #: lib/class-wp-smush-dir.php:945
556
  msgid "Waiting.."
557
  msgstr ""
558
 
559
- #: lib/class-wp-smush-dir.php:1067
560
  msgid "Incorrect image id"
561
  msgstr ""
562
 
563
- #: lib/class-wp-smush-dir.php:1101
564
  msgid "Could not find image id in last scanned images"
565
  msgstr ""
566
 
567
- #: lib/class-wp-smush-dir.php:1114
568
  msgid "Image couldn't be optimized"
569
  msgstr ""
570
 
571
- #: lib/class-wp-smush-dir.php:1158 lib/class-wp-smush-dir.php:1291
572
  #, php-format
573
  msgid "You've smushed %d images in total."
574
  msgstr ""
575
 
576
- #: lib/class-wp-smush-dir.php:1235
577
  msgid ""
578
  "We were unable to retrieve the image list from last scan, please continue "
579
  "with a latest scan"
580
  msgstr ""
581
 
582
- #: lib/class-wp-smush-nextgen.php:66
583
  msgid "Enable NextGen Gallery integration"
584
  msgstr ""
585
 
586
- #: lib/class-wp-smush-nextgen.php:67
 
 
 
 
587
  msgid "Allow smushing images directly through NextGen Gallery settings."
588
  msgstr ""
589
 
590
- #: lib/class-wp-smush-nextgen.php:373
591
  msgid ""
592
  "We couldn't find the metadata for the image, possibly the image has been "
593
  "deleted."
594
  msgstr ""
595
 
596
- #: lib/class-wp-smush-nextgen.php:612
597
  msgid "We couldn't process the image, fields empty."
598
  msgstr ""
599
 
600
- #: lib/class-wp-smush-nextgen.php:636
601
  #, php-format
602
  msgid "Unable to smush image, %s"
603
  msgstr ""
604
 
605
- #: lib/class-wp-smush-s3.php:56
606
- msgid "Amazon S3 support"
 
 
 
 
607
  msgstr ""
608
 
609
- #: lib/class-wp-smush-s3.php:57
610
  #, php-format
611
  msgid ""
612
- "Optimize your images stored on Amazon S3. This feature uses the %sWP Offload "
613
- "S3%s plugin and is needed if the option %sRemove Files From Server%s is "
614
- "enabled. Images will be smushed as per your current settings."
615
  msgstr ""
616
 
617
- #: lib/class-wp-smush-s3.php:101
618
  #, php-format
619
  msgid ""
620
  "We are having trouble interacting with WP S3 Offload, make sure the plugin "
621
  "is activated. Or you can %sreport a bug%s."
622
  msgstr ""
623
 
624
- #: lib/class-wp-smush-s3.php:108
625
  #, php-format
626
  msgid ""
627
- "It seems you haven't finished setting up WP S3 Offload yet, %sConfigure%s it "
628
  "now to enable Amazon S3 support."
629
  msgstr ""
630
 
631
- #: lib/class-wp-smush-share.php:24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
632
  #, php-format
633
  msgid ""
634
  "%s, you've smushed %s%d%s images and saved %s%s%s in total. Help your "
635
  "friends save bandwidth easily, and help me in my quest to Smush the internet!"
636
  msgstr ""
637
 
638
- #: lib/class-wp-smush-share.php:25
639
  #, php-format
640
  msgid ""
641
  "I saved %s%s%s on my site with WP Smush ( %s ) - wanna make your website "
642
  "light and faster?"
643
  msgstr ""
644
 
645
- #: lib/class-wp-smush-share.php:33
646
  msgid "TWEET"
647
  msgstr ""
648
 
649
- #: lib/class-wp-smush-share.php:37
650
  msgid "SHARE"
651
  msgstr ""
652
 
653
- #: lib/class-wp-smush-share.php:41
654
  msgid "WhatsApp"
655
  msgstr ""
656
 
657
- #: lib/class-wp-smush-ui.php:46
658
  msgid "Dismiss Welcome notice"
659
  msgstr ""
660
 
661
- #: lib/class-wp-smush-ui.php:62
662
- msgid "WELCOME"
 
 
 
663
  msgstr ""
664
 
665
- #: lib/class-wp-smush-ui.php:70
666
- msgid "OH YEAH, IT'S COMPRESSION TIME!"
667
  msgstr ""
668
 
669
- #: lib/class-wp-smush-ui.php:71
670
- #, php-format
671
- msgid ""
672
- "You've just installed %3$s, the most popular image compression plugin for "
673
- "WordPress! %1$sChoose your desired settings%2$s and get smushing!"
674
- msgstr ""
675
-
676
- #: lib/class-wp-smush-ui.php:85
677
  #, php-format
678
  msgid "Smush individual images via your %sMedia Library%s"
679
  msgstr ""
680
 
681
- #: lib/class-wp-smush-ui.php:85
682
  msgid "Media Library"
683
  msgstr ""
684
 
685
- #: lib/class-wp-smush-ui.php:104
686
  msgid "SETTINGS"
687
  msgstr ""
688
 
689
- #: lib/class-wp-smush-ui.php:117
690
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:513
691
  msgid ""
692
  "Lets you check if any images can be further optimized. Useful after changing "
693
  "settings."
694
  msgstr ""
695
 
696
- #: lib/class-wp-smush-ui.php:117
697
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:513
698
  msgid "RE-CHECK IMAGES"
699
  msgstr ""
700
 
701
- #: lib/class-wp-smush-ui.php:118
702
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:514
703
  msgid "STATS"
704
  msgstr ""
705
 
706
- #: lib/class-wp-smush-ui.php:121
707
  #, php-format
708
  msgid "You've smushed %d images in total"
709
  msgstr ""
710
 
711
- #: lib/class-wp-smush-ui.php:146
712
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:542
713
- msgid "IMAGES SMUSHED"
714
  msgstr ""
715
 
716
- #: lib/class-wp-smush-ui.php:152
717
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:548
718
- msgid "TOTAL SAVINGS"
719
  msgstr ""
720
 
721
- #: lib/class-wp-smush-ui.php:168
722
- msgid "ATTACHMENTS SUPER-SMUSHED"
723
  msgstr ""
724
 
725
- #: lib/class-wp-smush-ui.php:176 lib/class-wp-smush-ui.php:179
726
- #, php-format
727
- msgid "%sENABLE SUPER-SMUSH%s"
728
  msgstr ""
729
 
730
- #: lib/class-wp-smush-ui.php:187
731
- msgid "RESIZE SAVINGS"
732
  msgstr ""
733
 
734
- #: lib/class-wp-smush-ui.php:195 lib/class-wp-smush-ui.php:198
735
  #, php-format
736
- msgid "%sENABLE IMAGE RESIZING%s"
 
 
737
  msgstr ""
738
 
739
- #: lib/class-wp-smush-ui.php:201
 
 
 
 
740
  #, php-format
741
- msgid "%sNO RESIZE SAVINGS AVAILABLE%s"
 
 
742
  msgstr ""
743
 
744
- #: lib/class-wp-smush-ui.php:210
745
- msgid "PNG TO JPEG SAVINGS"
 
 
 
 
746
  msgstr ""
747
 
748
- #: lib/class-wp-smush-ui.php:241 lib/class-wp-smush-ui.php:285
749
  #, php-format
750
  msgid "%sPRO FEATURE%s"
751
  msgstr ""
752
 
753
- #: lib/class-wp-smush-ui.php:241 lib/class-wp-smush-ui.php:285
754
  msgid "Join WPMU DEV to try Smush Pro for free."
755
  msgstr ""
756
 
757
- #: lib/class-wp-smush-ui.php:245
758
  msgid "BASED ON AVERAGE SAVINGS IF YOU UPGRADE TO PRO"
759
  msgstr ""
760
 
761
- #: lib/class-wp-smush-ui.php:245
762
  msgid "PRO SAVINGS ESTIMATE"
763
  msgstr ""
764
 
765
- #: lib/class-wp-smush-ui.php:287
766
  msgid "ADVANCED SETTINGS"
767
  msgstr ""
768
 
769
- #: lib/class-wp-smush-ui.php:437
770
- msgid "The following image sizes will be optimized by WP Smush:"
 
 
771
  msgstr ""
772
 
773
- #: lib/class-wp-smush-ui.php:487
774
- msgid "Max width"
775
  msgstr ""
776
 
777
- #: lib/class-wp-smush-ui.php:490
778
- msgid "Max height"
779
  msgstr ""
780
 
781
- #: lib/class-wp-smush-ui.php:493
782
- #, php-format
783
- msgid "Currently, your largest image size is set at %s%dpx wide x %dpx high%s."
784
  msgstr ""
785
 
786
- #: lib/class-wp-smush-ui.php:494
 
787
  msgid ""
788
- "Just to let you know, the width you've entered is less than your largest "
789
- "image and may result in pixelation."
 
790
  msgstr ""
791
 
792
- #: lib/class-wp-smush-ui.php:495
793
- msgid ""
794
- "Just to let you know, the height you’ve entered is less than your largest "
795
- "image and may result in pixelation."
796
  msgstr ""
797
 
798
- #: lib/class-wp-smush-ui.php:623
799
- msgid "BOOST YOUR PERFORMANCE - HUMMINGBIRD"
 
800
  msgstr ""
801
 
802
- #: lib/class-wp-smush-ui.php:650
803
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:437
804
- msgid "No attachments found - Upload some images"
805
  msgstr ""
806
 
807
- #: lib/class-wp-smush-ui.php:652
 
 
 
 
 
808
  #, php-format
809
  msgid ""
810
- "We haven’t found any images in your %smedia library%s yet so there’s no "
811
- "smushing to be done! Once you upload images, reload this page and start "
812
- "playing!"
813
  msgstr ""
814
 
815
- #: lib/class-wp-smush-ui.php:655
816
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:442
817
- msgid "UPLOAD IMAGES"
 
818
  msgstr ""
819
 
820
- #: lib/class-wp-smush-ui.php:660
821
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:447
822
- msgid "All images are smushed and up to date. Awesome!"
 
 
823
  msgstr ""
824
 
825
- #: lib/class-wp-smush-ui.php:665
826
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:452
827
- msgid "BULK SMUSH NOW"
828
  msgstr ""
829
 
830
- #: lib/class-wp-smush-ui.php:684
831
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:460
832
  #, php-format
833
  msgid "%s, you have %s%s%d%s attachment%s that needs smushing!"
834
  msgid_plural "%s, you have %s%s%d%s attachments%s that need smushing!"
835
  msgstr[0] ""
836
  msgstr[1] ""
837
 
838
- #: lib/class-wp-smush-ui.php:686
839
  #, php-format
840
  msgid " %sUpgrade to Pro%s to bulk smush all your images with one click."
841
  msgstr ""
842
 
843
- #: lib/class-wp-smush-ui.php:687
844
  msgid " Free users can smush 50 images with each click."
845
  msgstr ""
846
 
847
- #: lib/class-wp-smush-ui.php:696
848
  msgid ""
849
- "Enable Super-smush in the Settings area to get even more savings with almost "
850
- "no noticeable quality loss."
851
  msgstr ""
852
 
853
- #: lib/class-wp-smush-ui.php:719
854
  #, php-format
855
  msgid ""
856
  "%sBulk smush is currently running.%s You need to keep this page open for the "
857
  "process to complete."
858
  msgstr ""
859
 
860
- #: lib/class-wp-smush-ui.php:729
 
 
 
 
861
  #, php-format
862
  msgid "%s%d%s of your media attachments have been smushed."
863
  msgstr ""
864
 
865
- #: lib/class-wp-smush-ui.php:770
 
 
 
 
866
  #, php-format
867
  msgid "%s, you have %s%s%d%s attachment%s that needs re-compressing!"
868
  msgid_plural "%s, you have %s%s%d%s attachments%s that need re-compressing!"
869
  msgstr[0] ""
870
  msgstr[1] ""
871
 
872
- #: lib/class-wp-smush-ui.php:771
873
- msgid "Skip"
874
- msgstr ""
875
-
876
- #: lib/class-wp-smush-ui.php:791
877
  msgid "Your settings have been updated!"
878
  msgstr ""
879
 
880
- #: lib/class-wp-smush-ui.php:825
881
  #, php-format
882
  msgid ""
883
  "Automatic smushing is %senabled%s. Newly uploaded images will be "
884
  "automagically compressed."
885
  msgstr ""
886
 
887
- #: lib/class-wp-smush-ui.php:825
888
  #, php-format
889
  msgid ""
890
  "Automatic smushing is %sdisabled%s. Newly uploaded images will need to be "
891
  "manually smushed."
892
  msgstr ""
893
 
894
- #: lib/class-wp-smush-ui.php:863
895
  msgid "Thanks for installing Smush. We hope you like it!"
896
  msgstr ""
897
 
898
- #: lib/class-wp-smush-ui.php:864
899
  msgid ""
900
- "And hey, if you do, you can now try out Smush Pro for double the smushy "
901
- "goodness (benchmarked), entirely for free!"
902
  msgstr ""
903
 
904
- #: lib/class-wp-smush-ui.php:865 lib/class-wp-smush-ui.php:869
905
- msgid "Try Smush Pro for Free"
906
  msgstr ""
907
 
908
- #: lib/class-wp-smush-ui.php:867
909
- msgid ""
910
- "Thanks for updating Smush. Did you know that you can now try the Smush Pro "
911
- "for FREE?!"
912
  msgstr ""
913
 
914
- #: lib/class-wp-smush-ui.php:868
915
- msgid ""
916
- "Yep, Super Smush your images for double the savings, save originals and "
917
- "batch Smush thousands of images all at once.... no charge!"
918
- msgstr ""
919
-
920
- #: lib/class-wp-smush-ui.php:917
921
  #, php-format
922
  msgid ""
923
  "Did you know WP Smush Pro delivers up to 2x better compression, allows you "
@@ -925,32 +1000,101 @@ msgid ""
925
  "absolutely FREE%s"
926
  msgstr ""
927
 
928
- #: lib/class-wp-smush-ui.php:917
929
  msgid "Try WP Smush Pro for FREE"
930
  msgstr ""
931
 
932
- #: lib/class-wp-smush-ui.php:940
 
 
 
 
 
 
 
 
 
933
  msgid "Validating.."
934
  msgstr ""
935
 
936
- #: lib/class-wp-smush-ui.php:942
937
  #, php-format
938
  msgid ""
939
  "It looks like Smush couldn’t verify your WPMU DEV membership so Pro features "
940
- "like Super-Smush may not work correctly. If you think this is an error, run "
941
- "a %sre-check%s or get in touch with our %ssupport team%s."
942
  msgstr ""
943
 
944
- #: lib/class-wp-smush-ui.php:964
945
  msgid "UPDATE SETTINGS"
946
  msgstr ""
947
 
948
- #: lib/class-wp-smush-ui.php:994
 
 
 
 
949
  msgid ""
950
  "Smush settings were updated, performing a quick scan to check if any of the "
951
  "images need to be Smushed again."
952
  msgstr ""
953
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
954
  #: lib/class-wp-smush.php:198
955
  msgid "File path is empty"
956
  msgstr ""
@@ -979,58 +1123,65 @@ msgstr ""
979
  msgid "Unknown API error"
980
  msgstr ""
981
 
982
- #: lib/class-wp-smush.php:708
 
 
 
 
 
 
 
983
  #, php-format
984
  msgid "Error posting to API: %s"
985
  msgstr ""
986
 
987
- #: lib/class-wp-smush.php:714
988
  #, php-format
989
  msgid "Error posting to API: %s %s"
990
  msgstr ""
991
 
992
- #: lib/class-wp-smush.php:731
993
  msgid "Smush data corrupted, try again."
994
  msgstr ""
995
 
996
- #: lib/class-wp-smush.php:751
997
  msgid "Image couldn't be smushed"
998
  msgstr ""
999
 
1000
- #: lib/class-wp-smush.php:987
1001
  #, php-format
1002
  msgid "%d images reduced "
1003
  msgstr ""
1004
 
1005
- #: lib/class-wp-smush.php:987
1006
  msgid "Reduced "
1007
  msgstr ""
1008
 
1009
- #: lib/class-wp-smush.php:991
1010
  #, php-format
1011
  msgid "by %s %s"
1012
  msgstr ""
1013
 
1014
- #: lib/class-wp-smush.php:997
1015
  #, php-format
1016
  msgid "<br /> Image Size: %s"
1017
  msgstr ""
1018
 
1019
- #: lib/class-wp-smush.php:1033
1020
  msgid "Detailed stats for all the image sizes"
1021
  msgstr ""
1022
 
1023
- #: lib/class-wp-smush.php:1033
1024
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:236
1025
  msgid "Smush stats"
1026
  msgstr ""
1027
 
1028
- #: lib/class-wp-smush.php:1077
1029
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:263
1030
  msgid "Not processed"
1031
  msgstr ""
1032
 
1033
- #: lib/class-wp-smush.php:1391
1034
  #, php-format
1035
  msgid ""
1036
  "When you upload an image to WordPress it automatically creates %s thumbnail "
@@ -1039,39 +1190,39 @@ msgid ""
1039
  "site we don’t Smush them. Pro users can override this."
1040
  msgstr ""
1041
 
1042
- #: lib/class-wp-smush.php:1394
1043
  msgid ""
1044
  "Image couldn't be smushed as it exceeded the 1Mb size limit, Pro users can "
1045
  "smush images with size upto 32Mb."
1046
  msgstr ""
1047
 
1048
- #: lib/class-wp-smush.php:1396
1049
  msgid " Skipped"
1050
  msgstr ""
1051
 
1052
- #: lib/class-wp-smush.php:1418
1053
- #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:432
1054
  msgid "Image size"
1055
  msgstr ""
1056
 
1057
- #: lib/class-wp-smush.php:1419
1058
- #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:433
1059
  msgid "Savings"
1060
  msgstr ""
1061
 
1062
- #: lib/class-wp-smush.php:1666
1063
  msgid "Restore original image."
1064
  msgstr ""
1065
 
1066
- #: lib/class-wp-smush.php:1666
1067
  msgid "Restore image"
1068
  msgstr ""
1069
 
1070
- #: lib/class-wp-smush.php:1714
1071
  msgid "Smush image including original file."
1072
  msgstr ""
1073
 
1074
- #: lib/class-wp-smush.php:1714
1075
  msgid "Resmush image"
1076
  msgstr ""
1077
 
@@ -1079,34 +1230,34 @@ msgstr ""
1079
  msgid "Bulk WP Smush"
1080
  msgstr ""
1081
 
1082
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:439
1083
  #, php-format
1084
  msgid ""
1085
  "We haven’t found any images in your %sgallery%s yet, so there’s no smushing "
1086
  "to be done! Once you upload images, reload this page and start playing!"
1087
  msgstr ""
1088
 
1089
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:476
1090
  #, php-format
1091
  msgid ""
1092
  "Enable Super-smush in the %sSettings%s area to get even more savings with "
1093
  "almost no noticeable quality loss."
1094
  msgstr ""
1095
 
1096
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:491
1097
  #, php-format
1098
  msgid "Smush individual images via your %sManage Galleries%s section"
1099
  msgstr ""
1100
 
1101
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:491
1102
  msgid "Manage Galleries"
1103
  msgstr ""
1104
 
1105
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:564
1106
- msgid "IMAGES SUPER-SMUSHED"
1107
  msgstr ""
1108
 
1109
- #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:572
1110
  #, php-format
1111
  msgid "%sDISABLED%s"
1112
  msgstr ""
1
  #, fuzzy
2
  msgid ""
3
  msgstr ""
4
+ "Project-Id-Version: WP Smush\n"
5
+ "POT-Creation-Date: 2017-09-28 12:43+0530\n"
6
+ "PO-Revision-Date: 2017-09-28 12:43+0530\n"
7
+ "Last-Translator: Umesh <umeshsingla05@gmail.com>\n"
8
+ "Language-Team: Umesh <umeshsingla05@gmail.com>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
32
  msgstr ""
33
 
34
  #: assets/shared-ui/plugin-ui.php:272 extras/free-dashboard/module.php:395
35
+ #: extras/free-dashboard/module.php:434 lib/class-wp-smush-ui.php:1000
36
  msgid "Saving"
37
  msgstr ""
38
 
39
  #: assets/shared-ui/plugin-ui.php:301
40
  #: extras/dash-notice/wpmudev-dash-notification.php:248
41
  #: extras/dash-notice/wpmudev-dash-notification.php:289
42
+ #: lib/class-wp-smush-ui.php:1000
43
  msgid "Dismiss"
44
  msgstr ""
45
 
180
  msgid "Rate %s"
181
  msgstr ""
182
 
183
+ #: lib/class-wp-smush-admin.php:225
184
+ msgid "Use network settings for all the sub-sites."
185
+ msgstr ""
186
+
187
+ #: lib/class-wp-smush-admin.php:226
188
+ msgid "Multisite Control"
189
  msgstr ""
190
 
191
+ #: lib/class-wp-smush-admin.php:227
192
+ msgid ""
193
+ "Choose whether you want to use network settings for all sub-sites or whether "
194
+ "sub-site admins can control Smush’s settings."
195
  msgstr ""
196
 
197
+ #: lib/class-wp-smush-admin.php:230
198
  msgid "Automatically smush my images on upload"
199
  msgstr ""
200
 
201
+ #: lib/class-wp-smush-admin.php:231
202
+ msgid "Automatic Smush"
203
+ msgstr ""
204
+
205
+ #: lib/class-wp-smush-admin.php:232
206
  msgid ""
207
+ "When you upload images to your site, Smush will automatically optimize them "
208
+ "for you."
209
+ msgstr ""
210
+
211
+ #: lib/class-wp-smush-admin.php:235
212
+ msgid "Super-smush my images"
213
  msgstr ""
214
 
215
+ #: lib/class-wp-smush-admin.php:236
216
+ msgid "Super-smush"
217
  msgstr ""
218
 
219
+ #: lib/class-wp-smush-admin.php:237
220
  msgid ""
221
+ "Compress images up to 2x more than regular smush with almost no visible drop "
222
+ "in quality."
223
+ msgstr ""
224
+
225
+ #: lib/class-wp-smush-admin.php:240
226
+ msgid "Smush my original full-size images"
227
  msgstr ""
228
 
229
+ #: lib/class-wp-smush-admin.php:241 lib/class-wp-smush-admin.php:251
230
+ #: lib/class-wp-smush-admin.php:256
231
+ msgid "Full size images"
232
  msgstr ""
233
 
234
+ #: lib/class-wp-smush-admin.php:242
235
  msgid ""
236
+ "Every time you upload an image to your site, WordPress generates a resized "
237
+ "version of that image for every image size that your theme has registered. "
238
+ "This means there are multiple versions of your images in your media library. "
239
+ "By default, Smush only compresses these generated image. Activate this "
240
+ "setting to also smush your original images. Note: Activating this setting "
241
+ "doesn’t usually improve page speed."
242
  msgstr ""
243
 
244
+ #: lib/class-wp-smush-admin.php:245
245
+ msgid "Preserve my image EXIF data"
246
  msgstr ""
247
 
248
+ #: lib/class-wp-smush-admin.php:246
249
+ msgid "EXIF data"
250
+ msgstr ""
251
+
252
+ #: lib/class-wp-smush-admin.php:247
253
  msgid ""
254
+ "EXIF data stores camera settings, focal length, date, time and location "
255
+ "information in image files. EXIF data makes image files larger but if you "
256
+ "are a photographer you may want to preserve this information."
257
  msgstr ""
258
 
259
+ #: lib/class-wp-smush-admin.php:250
260
+ msgid "Resize my full size images"
261
  msgstr ""
262
 
263
+ #: lib/class-wp-smush-admin.php:252
264
  msgid ""
265
+ "Set a maximum height and width for all images uploaded to your site so that "
266
+ "any unnecessarily large images are automatically resized before they are "
267
+ "added to the media gallery. This setting does not apply to images smushed "
268
+ "using Directory Smush feature."
 
269
  msgstr ""
270
 
271
+ #: lib/class-wp-smush-admin.php:255
272
+ msgid "Make a copy of my full size images"
273
  msgstr ""
274
 
275
+ #: lib/class-wp-smush-admin.php:257
276
  msgid ""
277
+ "Save your original full-size images separately so you can restore them at "
278
+ "any point. Note: Keeping a copy of your original files can significantly "
279
+ "increase the size of your uploads folder by nearly twice as much."
280
  msgstr ""
281
 
282
+ #: lib/class-wp-smush-admin.php:260
283
+ msgid "Auto-convert PNGs to JPEGs (lossy)"
284
  msgstr ""
285
 
286
+ #: lib/class-wp-smush-admin.php:261
287
+ msgid "PNG to JPEG conversion"
288
+ msgstr ""
289
+
290
+ #: lib/class-wp-smush-admin.php:262
291
  msgid ""
292
  "When you compress a PNG file, Smush will check if converting the file to "
293
+ "JPEG will further reduce its size."
 
 
 
294
  msgstr ""
295
 
296
  #. Plugin Name of the plugin/theme
297
+ #: lib/class-wp-smush-admin.php:292 lib/class-wp-smush-ui.php:928
298
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:71
299
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:90
300
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:92
301
  msgid "WP Smush"
302
  msgstr ""
303
 
304
+ #: lib/class-wp-smush-admin.php:424 lib/class-wp-smush.php:1069
305
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:159
306
+ #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:274
307
  msgid "Super-Smush"
308
  msgstr ""
309
 
310
+ #: lib/class-wp-smush-admin.php:425
311
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:160
312
  msgid "Smush Now"
313
  msgstr ""
314
 
315
+ #: lib/class-wp-smush-admin.php:426
316
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:161
317
  msgid "{{errors}} image(s) were skipped due to an error."
318
  msgstr ""
319
 
320
+ #: lib/class-wp-smush-admin.php:427
321
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:162
322
  msgid "All images are fully optimized."
323
  msgstr ""
324
 
325
+ #: lib/class-wp-smush-admin.php:428
326
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:163
327
  msgid "Restoring image.."
328
  msgstr ""
329
 
330
+ #: lib/class-wp-smush-admin.php:429
331
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:164
332
  msgid "Smushing image.."
333
  msgstr ""
334
 
335
+ #: lib/class-wp-smush-admin.php:430
336
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:165
337
  msgid "Checking images.."
338
  msgstr ""
339
 
340
+ #: lib/class-wp-smush-admin.php:431
341
  msgid ""
342
  "We successfully verified your membership, all the Pro features should work "
343
  "completely. "
344
  msgstr ""
345
 
346
+ #: lib/class-wp-smush-admin.php:432
347
  msgid "Your membership couldn't be verified."
348
  msgstr ""
349
 
350
+ #: lib/class-wp-smush-admin.php:433
351
  msgid "Missing file path."
352
  msgstr ""
353
 
354
+ #: lib/class-wp-smush-admin.php:435
355
  msgid "image could not be smushed."
356
  msgstr ""
357
 
358
+ #: lib/class-wp-smush-admin.php:436
359
  msgid "images could not be smushed."
360
  msgstr ""
361
 
362
+ #: lib/class-wp-smush-admin.php:437 lib/class-wp-smush.php:985
363
+ #: lib/class-wp-smush.php:989
364
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:193
365
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:196
366
  msgid "Already Optimized"
367
  msgstr ""
368
 
369
+ #: lib/class-wp-smush-admin.php:438
370
  msgid "Ajax Error"
371
  msgstr ""
372
 
373
+ #: lib/class-wp-smush-admin.php:439 lib/class-wp-smush-admin.php:440
 
 
374
  msgid "All Done!"
375
  msgstr ""
376
 
377
+ #: lib/class-wp-smush-admin.php:441 lib/class-wp-smush-ui.php:72
378
+ msgid "QUICK SETUP"
379
+ msgstr ""
380
+
381
+ #: lib/class-wp-smush-admin.php:441 lib/class-wp-smush-ui.php:875
382
+ msgid "Skip"
383
+ msgstr ""
384
+
385
+ #: lib/class-wp-smush-admin.php:717
386
  msgid ""
387
+ "Skipped due to a timeout error, You can increase the request timeout to make "
388
+ "sure Smush has enough time to process larger files. "
389
+ "`define('WP_SMUSH_API_TIMEOUT', 150);`"
390
  msgstr ""
391
 
392
+ #: lib/class-wp-smush-admin.php:771 lib/class-wp-smush-nextgen.php:438
393
  msgid "You don't have permission to work with uploaded files."
394
  msgstr ""
395
 
396
+ #: lib/class-wp-smush-admin.php:775 lib/class-wp-smush-nextgen.php:442
397
  msgid "No attachment ID was provided."
398
  msgstr ""
399
 
400
+ #: lib/class-wp-smush-admin.php:787
401
  msgid "Attachment Skipped - Check `wp_smush_image` filter."
402
  msgstr ""
403
 
404
+ #: lib/class-wp-smush-admin.php:976
405
  #, php-format
406
  msgid "<strong>%d of %d images</strong> were sent for smushing:"
407
  msgstr ""
408
 
409
+ #: lib/class-wp-smush-admin.php:1165 lib/class-wp-smush.php:1075
 
 
 
 
 
410
  msgid "Smushing in progress.."
411
  msgstr ""
412
 
413
+ #: lib/class-wp-smush-admin.php:1171 lib/class-wp-smush.php:1094
414
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:269
415
  msgid "Smush Now!"
416
  msgstr ""
417
 
418
+ #: lib/class-wp-smush-admin.php:1192
419
  msgid "Settings"
420
  msgstr ""
421
 
422
+ #: lib/class-wp-smush-admin.php:1355
423
  msgid "Image not smushed, fields empty."
424
  msgstr ""
425
 
426
+ #: lib/class-wp-smush-admin.php:1362 lib/class-wp-smush-nextgen.php:625
427
  msgid ""
428
  "Image couldn't be smushed as the nonce verification failed, try reloading "
429
  "the page."
430
  msgstr ""
431
 
432
+ #: lib/class-wp-smush-admin.php:1379
433
  msgid "Unable to smush image"
434
  msgstr ""
435
 
436
+ #: lib/class-wp-smush-admin.php:1404
437
  msgid ""
438
  "We haven’t found any images in your media library yet so there’s no smushing "
439
+ "to be done! Once you upload images, reload this page and start playing!"
440
  msgstr ""
441
 
442
+ #: lib/class-wp-smush-admin.php:1419
443
  msgid "Yay! All images are optimized as per your current settings."
444
  msgstr ""
445
 
446
+ #: lib/class-wp-smush-admin.php:1622 lib/class-wp-smush-ui.php:902
447
  #, php-format
448
  msgid "You have images that need smushing. %sBulk smush now!%s"
449
  msgstr ""
450
 
451
+ #: lib/class-wp-smush-admin.php:1997
452
  msgid "Review your setting now."
453
  msgstr ""
454
 
455
+ #: lib/class-wp-smush-admin.php:1998 lib/class-wp-smush-dir.php:270
456
+ #: lib/class-wp-smush-ui.php:789 lib/class-wp-smush-ui.php:928
 
457
  msgid "WP Smush Pro"
458
  msgstr ""
459
 
460
+ #: lib/class-wp-smush-admin.php:1999
461
  msgid ""
462
  "Welcome to the newest version of WP Smush! In this update we've added the "
463
  "ability to bulk smush images in directories outside your uploads folder."
464
  msgstr ""
465
 
466
+ #: lib/class-wp-smush-admin.php:2002
467
  #, php-format
468
  msgid ""
469
  " And as a multisite user, you can manage %sSmush settings%s globally across "
470
  "all sites!"
471
  msgstr ""
472
 
473
+ #: lib/class-wp-smush-admin.php:2005
474
  #, php-format
475
  msgid " %sFind out more here >>%s"
476
  msgstr ""
477
 
478
+ #: lib/class-wp-smush-backup.php:148 lib/class-wp-smush-nextgen.php:525
479
  msgid "Error in processing restore action, Fields empty."
480
  msgstr ""
481
 
482
+ #: lib/class-wp-smush-backup.php:155 lib/class-wp-smush-nextgen.php:532
483
  msgid "Image not restored, Nonce verification failed."
484
  msgstr ""
485
 
486
+ #: lib/class-wp-smush-backup.php:282 lib/class-wp-smush-nextgen.php:607
487
  msgid "Unable to restore image"
488
  msgstr ""
489
 
490
  #: lib/class-wp-smush-dir.php:88
491
+ msgid "Directory-smush savings"
492
  msgstr ""
493
 
494
  #: lib/class-wp-smush-dir.php:90
495
  msgid "Updating Stats"
496
  msgstr ""
497
 
498
+ #: lib/class-wp-smush-dir.php:100
499
+ msgid "Smush images that aren't located in your uploads folder."
500
+ msgstr ""
501
+
502
+ #: lib/class-wp-smush-dir.php:101
503
+ msgid "Choose directory"
504
  msgstr ""
505
 
506
+ #: lib/class-wp-smush-dir.php:215
507
  msgid "RESUME LAST SCAN"
508
  msgstr ""
509
 
510
+ #: lib/class-wp-smush-dir.php:246
511
  msgid "DIRECTORY SMUSH"
512
  msgstr ""
513
 
514
+ #: lib/class-wp-smush-dir.php:251
515
  msgid ""
516
  "In addition to smushing your media uploads, you may want to also smush "
517
  "images living outside your uploads directory. Simply add any directories you "
518
  "wish to smush and bulk smush away!"
519
  msgstr ""
520
 
521
+ #: lib/class-wp-smush-dir.php:264
522
  msgid ""
523
  "All images for the selected directory are smushed and up to date. Awesome!"
524
  msgstr ""
525
 
526
+ #: lib/class-wp-smush-dir.php:267
527
  #, php-format
528
  msgid ""
529
  "%s/%s image(s) were successfully smushed, however %s image(s) could not be "
530
  "smushed due to an error."
531
  msgstr ""
532
 
533
+ #: lib/class-wp-smush-dir.php:270
534
  #, php-format
535
  msgid ""
536
  " %sUpgrade to pro%s to bulk smush all your directory images with one click. "
537
  "Free users can smush 50 images with each click."
538
  msgstr ""
539
 
540
+ #: lib/class-wp-smush-dir.php:274 lib/class-wp-smush-ui.php:143
541
+ #: lib/class-wp-smush-ui.php:770
542
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:404
543
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:445
544
  msgid "BULK SMUSH"
545
  msgstr ""
546
 
547
+ #: lib/class-wp-smush-dir.php:276
548
  msgid "Click to stop the directory smushing process."
549
  msgstr ""
550
 
551
+ #: lib/class-wp-smush-dir.php:277 lib/class-wp-smush-ui.php:837
552
  msgid "CANCEL"
553
  msgstr ""
554
 
555
+ #: lib/class-wp-smush-dir.php:285
556
  msgid "CHOOSE DIRECTORY"
557
  msgstr ""
558
 
559
+ #: lib/class-wp-smush-dir.php:294
560
  msgid "Directory list"
561
  msgstr ""
562
 
563
+ #: lib/class-wp-smush-dir.php:297
564
  msgid "Choose the folder you wish to smush."
565
  msgstr ""
566
 
567
+ #: lib/class-wp-smush-dir.php:301
568
  msgid ""
569
  "Smush will also include any images in sub folders of your selected folder."
570
  msgstr ""
571
 
572
+ #: lib/class-wp-smush-dir.php:304
573
  msgid "ADD DIRECTORY"
574
  msgstr ""
575
 
576
+ #: lib/class-wp-smush-dir.php:463
577
  msgid "Exclude directory from Smush List"
578
  msgstr ""
579
 
580
+ #: lib/class-wp-smush-dir.php:599
581
  msgid "We could not find any images in the selected directory."
582
  msgstr ""
583
 
584
+ #: lib/class-wp-smush-dir.php:920
585
  #, php-format
586
  msgid "%d images"
587
  msgstr ""
588
 
589
+ #: lib/class-wp-smush-dir.php:953
590
  msgid "Waiting.."
591
  msgstr ""
592
 
593
+ #: lib/class-wp-smush-dir.php:1075
594
  msgid "Incorrect image id"
595
  msgstr ""
596
 
597
+ #: lib/class-wp-smush-dir.php:1109
598
  msgid "Could not find image id in last scanned images"
599
  msgstr ""
600
 
601
+ #: lib/class-wp-smush-dir.php:1122
602
  msgid "Image couldn't be optimized"
603
  msgstr ""
604
 
605
+ #: lib/class-wp-smush-dir.php:1166 lib/class-wp-smush-dir.php:1299
606
  #, php-format
607
  msgid "You've smushed %d images in total."
608
  msgstr ""
609
 
610
+ #: lib/class-wp-smush-dir.php:1243
611
  msgid ""
612
  "We were unable to retrieve the image list from last scan, please continue "
613
  "with a latest scan"
614
  msgstr ""
615
 
616
+ #: lib/class-wp-smush-nextgen.php:71
617
  msgid "Enable NextGen Gallery integration"
618
  msgstr ""
619
 
620
+ #: lib/class-wp-smush-nextgen.php:72
621
+ msgid "NextGen Gallery"
622
+ msgstr ""
623
+
624
+ #: lib/class-wp-smush-nextgen.php:73
625
  msgid "Allow smushing images directly through NextGen Gallery settings."
626
  msgstr ""
627
 
628
+ #: lib/class-wp-smush-nextgen.php:379
629
  msgid ""
630
  "We couldn't find the metadata for the image, possibly the image has been "
631
  "deleted."
632
  msgstr ""
633
 
634
+ #: lib/class-wp-smush-nextgen.php:618
635
  msgid "We couldn't process the image, fields empty."
636
  msgstr ""
637
 
638
+ #: lib/class-wp-smush-nextgen.php:642
639
  #, php-format
640
  msgid "Unable to smush image, %s"
641
  msgstr ""
642
 
643
+ #: lib/class-wp-smush-s3.php:60
644
+ msgid "Enable Amazon S3 support"
645
+ msgstr ""
646
+
647
+ #: lib/class-wp-smush-s3.php:61
648
+ msgid "Amazon S3"
649
  msgstr ""
650
 
651
+ #: lib/class-wp-smush-s3.php:62
652
  #, php-format
653
  msgid ""
654
+ "Storing your image on S3 buckets using %sWP Offload S3%s? Smush can detect "
655
+ "and smush those assets for you, including when you\\re removing files from "
656
+ "your host server."
657
  msgstr ""
658
 
659
+ #: lib/class-wp-smush-s3.php:113
660
  #, php-format
661
  msgid ""
662
  "We are having trouble interacting with WP S3 Offload, make sure the plugin "
663
  "is activated. Or you can %sreport a bug%s."
664
  msgstr ""
665
 
666
+ #: lib/class-wp-smush-s3.php:120
667
  #, php-format
668
  msgid ""
669
+ "It seems you haven't finished setting up WP S3 Offload yet. %sConfigure%s it "
670
  "now to enable Amazon S3 support."
671
  msgstr ""
672
 
673
+ #: lib/class-wp-smush-s3.php:124
674
+ msgid "Amazon S3 support is active."
675
+ msgstr ""
676
+
677
+ #: lib/class-wp-smush-s3.php:178
678
+ #, php-format
679
+ msgid ""
680
+ "We can see you have WP S3 Offload installed with the <strong>Remove Files "
681
+ "From Server</strong> option activated. If you want to optimize your S3 "
682
+ "images you'll need to enable the <a href='%s'><strong>Amazon S3 Support</"
683
+ "strong></a> feature in Smush's settings."
684
+ msgstr ""
685
+
686
+ #: lib/class-wp-smush-s3.php:181
687
+ #, php-format
688
+ msgid ""
689
+ "We can see you have WP S3 Offload installed with the <strong>Remove Files "
690
+ "From Server</strong> option activated. If you want to optimize your S3 "
691
+ "images you'll need to <a href='%s'><strong>upgrade to Smush Pro</strong></a>"
692
+ msgstr ""
693
+
694
+ #: lib/class-wp-smush-share.php:25
695
  #, php-format
696
  msgid ""
697
  "%s, you've smushed %s%d%s images and saved %s%s%s in total. Help your "
698
  "friends save bandwidth easily, and help me in my quest to Smush the internet!"
699
  msgstr ""
700
 
701
+ #: lib/class-wp-smush-share.php:26
702
  #, php-format
703
  msgid ""
704
  "I saved %s%s%s on my site with WP Smush ( %s ) - wanna make your website "
705
  "light and faster?"
706
  msgstr ""
707
 
708
+ #: lib/class-wp-smush-share.php:34
709
  msgid "TWEET"
710
  msgstr ""
711
 
712
+ #: lib/class-wp-smush-share.php:38
713
  msgid "SHARE"
714
  msgstr ""
715
 
716
+ #: lib/class-wp-smush-share.php:42
717
  msgid "WhatsApp"
718
  msgstr ""
719
 
720
+ #: lib/class-wp-smush-ui.php:56
721
  msgid "Dismiss Welcome notice"
722
  msgstr ""
723
 
724
+ #: lib/class-wp-smush-ui.php:73
725
+ msgid ""
726
+ "Welcome to Smush - Winner of Torque Plugin Madness 2017! Let's quickly set "
727
+ "up the basics for you, then you can fine tweak each setting as you go - our "
728
+ "recommendations are on by default."
729
  msgstr ""
730
 
731
+ #: lib/class-wp-smush-ui.php:123
732
+ msgid "Get Started"
733
  msgstr ""
734
 
735
+ #: lib/class-wp-smush-ui.php:138
 
 
 
 
 
 
 
736
  #, php-format
737
  msgid "Smush individual images via your %sMedia Library%s"
738
  msgstr ""
739
 
740
+ #: lib/class-wp-smush-ui.php:138
741
  msgid "Media Library"
742
  msgstr ""
743
 
744
+ #: lib/class-wp-smush-ui.php:157
745
  msgid "SETTINGS"
746
  msgstr ""
747
 
748
+ #: lib/class-wp-smush-ui.php:172
749
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:462
750
  msgid ""
751
  "Lets you check if any images can be further optimized. Useful after changing "
752
  "settings."
753
  msgstr ""
754
 
755
+ #: lib/class-wp-smush-ui.php:172
756
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:462
757
  msgid "RE-CHECK IMAGES"
758
  msgstr ""
759
 
760
+ #: lib/class-wp-smush-ui.php:173
761
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:463
762
  msgid "STATS"
763
  msgstr ""
764
 
765
+ #: lib/class-wp-smush-ui.php:184
766
  #, php-format
767
  msgid "You've smushed %d images in total"
768
  msgstr ""
769
 
770
+ #: lib/class-wp-smush-ui.php:194
771
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:474
772
+ msgid "Images smushed"
773
  msgstr ""
774
 
775
+ #: lib/class-wp-smush-ui.php:203
776
+ msgid "Attachments smushed"
 
777
  msgstr ""
778
 
779
+ #: lib/class-wp-smush-ui.php:210
780
+ msgid "Images resized"
781
  msgstr ""
782
 
783
+ #: lib/class-wp-smush-ui.php:218
784
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:480
785
+ msgid "Total savings"
786
  msgstr ""
787
 
788
+ #: lib/class-wp-smush-ui.php:234
789
+ msgid "Super-smushed savings"
790
  msgstr ""
791
 
792
+ #: lib/class-wp-smush-ui.php:241 lib/class-wp-smush-ui.php:244
793
  #, php-format
794
+ msgid ""
795
+ "Compress images up to 2x more than regular smush with almost no visible drop "
796
+ "in quality. %sEnable Super-smush%s"
797
  msgstr ""
798
 
799
+ #: lib/class-wp-smush-ui.php:260
800
+ msgid "Resize savings"
801
+ msgstr ""
802
+
803
+ #: lib/class-wp-smush-ui.php:268 lib/class-wp-smush-ui.php:271
804
  #, php-format
805
+ msgid ""
806
+ "Save storage space by resizing your full sized uploads down to a maximum "
807
+ "size. %sEnable image resizing%s"
808
  msgstr ""
809
 
810
+ #: lib/class-wp-smush-ui.php:274
811
+ msgid "No resize savings available"
812
+ msgstr ""
813
+
814
+ #: lib/class-wp-smush-ui.php:283
815
+ msgid "PNG to JPEG savings"
816
  msgstr ""
817
 
818
+ #: lib/class-wp-smush-ui.php:314 lib/class-wp-smush-ui.php:366
819
  #, php-format
820
  msgid "%sPRO FEATURE%s"
821
  msgstr ""
822
 
823
+ #: lib/class-wp-smush-ui.php:314 lib/class-wp-smush-ui.php:366
824
  msgid "Join WPMU DEV to try Smush Pro for free."
825
  msgstr ""
826
 
827
+ #: lib/class-wp-smush-ui.php:318
828
  msgid "BASED ON AVERAGE SAVINGS IF YOU UPGRADE TO PRO"
829
  msgstr ""
830
 
831
+ #: lib/class-wp-smush-ui.php:318
832
  msgid "PRO SAVINGS ESTIMATE"
833
  msgstr ""
834
 
835
+ #: lib/class-wp-smush-ui.php:368
836
  msgid "ADVANCED SETTINGS"
837
  msgstr ""
838
 
839
+ #: lib/class-wp-smush-ui.php:394
840
+ msgid ""
841
+ "By default, Smush only compresses your cropped image sizes, not your "
842
+ "original full-size images."
843
  msgstr ""
844
 
845
+ #: lib/class-wp-smush-ui.php:538
846
+ msgid "Save a ton of space by not storing over-sized images on your server."
847
  msgstr ""
848
 
849
+ #: lib/class-wp-smush-ui.php:698
850
+ msgid "BOOST YOUR PERFORMANCE - HUMMINGBIRD"
851
  msgstr ""
852
 
853
+ #: lib/class-wp-smush-ui.php:736
854
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:389
855
+ msgid "No attachments found - Upload some images"
856
  msgstr ""
857
 
858
+ #: lib/class-wp-smush-ui.php:738
859
+ #, php-format
860
  msgid ""
861
+ "We haven’t found any images in your %smedia library%s yet so there’s no "
862
+ "smushing to be done! Once you upload images, reload this page and start "
863
+ "playing!"
864
  msgstr ""
865
 
866
+ #: lib/class-wp-smush-ui.php:741
867
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:394
868
+ msgid "UPLOAD IMAGES"
 
869
  msgstr ""
870
 
871
+ #: lib/class-wp-smush-ui.php:746
872
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:399
873
+ msgid "All images are smushed and up to date. Awesome!"
874
  msgstr ""
875
 
876
+ #: lib/class-wp-smush-ui.php:750
877
+ msgid "Still having trouble with PageSpeed tests? Give these a go…"
 
878
  msgstr ""
879
 
880
+ #: lib/class-wp-smush-ui.php:753
881
+ #, php-format
882
+ msgid "Upgrade to Smush Pro for advanced lossy compression. %sTry pro free%s."
883
+ msgstr ""
884
+
885
+ #: lib/class-wp-smush-ui.php:755
886
  #, php-format
887
  msgid ""
888
+ "Enable %sSuper-smush%s for advanced lossy compression to optimise images "
889
+ "further with almost no visible drop in quality."
 
890
  msgstr ""
891
 
892
+ #: lib/class-wp-smush-ui.php:757
893
+ #, php-format
894
+ msgid ""
895
+ "Make sure your images are the right size for your theme. %sLearn more%s."
896
  msgstr ""
897
 
898
+ #: lib/class-wp-smush-ui.php:760
899
+ #, php-format
900
+ msgid ""
901
+ "Enable %sResize Original Images%s to scale big images down to a reasonable "
902
+ "size and save a ton of space."
903
  msgstr ""
904
 
905
+ #: lib/class-wp-smush-ui.php:764
906
+ msgid "DISMISS"
 
907
  msgstr ""
908
 
909
+ #: lib/class-wp-smush-ui.php:787
910
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:410
911
  #, php-format
912
  msgid "%s, you have %s%s%d%s attachment%s that needs smushing!"
913
  msgid_plural "%s, you have %s%s%d%s attachments%s that need smushing!"
914
  msgstr[0] ""
915
  msgstr[1] ""
916
 
917
+ #: lib/class-wp-smush-ui.php:789
918
  #, php-format
919
  msgid " %sUpgrade to Pro%s to bulk smush all your images with one click."
920
  msgstr ""
921
 
922
+ #: lib/class-wp-smush-ui.php:790
923
  msgid " Free users can smush 50 images with each click."
924
  msgstr ""
925
 
926
+ #: lib/class-wp-smush-ui.php:800
927
  msgid ""
928
+ "Tip: Enable Super-smush in the Settings area to get even more savings with "
929
+ "almost no noticeable quality loss."
930
  msgstr ""
931
 
932
+ #: lib/class-wp-smush-ui.php:822
933
  #, php-format
934
  msgid ""
935
  "%sBulk smush is currently running.%s You need to keep this page open for the "
936
  "process to complete."
937
  msgstr ""
938
 
939
+ #: lib/class-wp-smush-ui.php:824
940
+ msgid "Working.."
941
+ msgstr ""
942
+
943
+ #: lib/class-wp-smush-ui.php:833
944
  #, php-format
945
  msgid "%s%d%s of your media attachments have been smushed."
946
  msgstr ""
947
 
948
+ #: lib/class-wp-smush-ui.php:837
949
+ msgid "Stop current bulk smush process."
950
+ msgstr ""
951
+
952
+ #: lib/class-wp-smush-ui.php:874
953
  #, php-format
954
  msgid "%s, you have %s%s%d%s attachment%s that needs re-compressing!"
955
  msgid_plural "%s, you have %s%s%d%s attachments%s that need re-compressing!"
956
  msgstr[0] ""
957
  msgstr[1] ""
958
 
959
+ #: lib/class-wp-smush-ui.php:895
 
 
 
 
960
  msgid "Your settings have been updated!"
961
  msgstr ""
962
 
963
+ #: lib/class-wp-smush-ui.php:930
964
  #, php-format
965
  msgid ""
966
  "Automatic smushing is %senabled%s. Newly uploaded images will be "
967
  "automagically compressed."
968
  msgstr ""
969
 
970
+ #: lib/class-wp-smush-ui.php:930
971
  #, php-format
972
  msgid ""
973
  "Automatic smushing is %sdisabled%s. Newly uploaded images will need to be "
974
  "manually smushed."
975
  msgstr ""
976
 
977
+ #: lib/class-wp-smush-ui.php:973
978
  msgid "Thanks for installing Smush. We hope you like it!"
979
  msgstr ""
980
 
981
+ #: lib/class-wp-smush-ui.php:974
982
  msgid ""
983
+ "And hey, if you do, you can join WPMU DEV for a free 30 day trial and get "
984
+ "access to even more features!"
985
  msgstr ""
986
 
987
+ #: lib/class-wp-smush-ui.php:975 lib/class-wp-smush-ui.php:979
988
+ msgid "Try Smush Pro Free"
989
  msgstr ""
990
 
991
+ #: lib/class-wp-smush-ui.php:977
992
+ msgid "Thanks for upgrading Smush!"
 
 
993
  msgstr ""
994
 
995
+ #: lib/class-wp-smush-ui.php:1028
 
 
 
 
 
 
996
  #, php-format
997
  msgid ""
998
  "Did you know WP Smush Pro delivers up to 2x better compression, allows you "
1000
  "absolutely FREE%s"
1001
  msgstr ""
1002
 
1003
+ #: lib/class-wp-smush-ui.php:1028 lib/class-wp-smush-ui.php:1053
1004
  msgid "Try WP Smush Pro for FREE"
1005
  msgstr ""
1006
 
1007
+ #: lib/class-wp-smush-ui.php:1053
1008
+ #, php-format
1009
+ msgid ""
1010
+ "Smush Pro gives you all these extra settings and absolutely no limits on "
1011
+ "smushing your images! Did we mention Smush Pro also gives you up to 2x "
1012
+ "better compression too? – %sTry it all free with a WPMU DEV membership today!"
1013
+ "%s"
1014
+ msgstr ""
1015
+
1016
+ #: lib/class-wp-smush-ui.php:1076
1017
  msgid "Validating.."
1018
  msgstr ""
1019
 
1020
+ #: lib/class-wp-smush-ui.php:1078
1021
  #, php-format
1022
  msgid ""
1023
  "It looks like Smush couldn’t verify your WPMU DEV membership so Pro features "
1024
+ "have been disabled for now. If you think this is an error, run a %sre-check"
1025
+ "%s or get in touch with our %ssupport team%s."
1026
  msgstr ""
1027
 
1028
+ #: lib/class-wp-smush-ui.php:1100
1029
  msgid "UPDATE SETTINGS"
1030
  msgstr ""
1031
 
1032
+ #: lib/class-wp-smush-ui.php:1102
1033
+ msgid "Smush will automatically check for any images that need re-smushing."
1034
+ msgstr ""
1035
+
1036
+ #: lib/class-wp-smush-ui.php:1128
1037
  msgid ""
1038
  "Smush settings were updated, performing a quick scan to check if any of the "
1039
  "images need to be Smushed again."
1040
  msgstr ""
1041
 
1042
+ #: lib/class-wp-smush-ui.php:1149
1043
+ #, php-format
1044
+ msgid ""
1045
+ "Every time you upload an image to your site, WordPress generates a resized "
1046
+ "version of that image for every default and/or custom image size that your "
1047
+ "theme has registered. This means there are multiple versions of your images "
1048
+ "in your media library.%sChoose the images size/s below that you would like "
1049
+ "optimized:%s"
1050
+ msgstr ""
1051
+
1052
+ #: lib/class-wp-smush-ui.php:1190
1053
+ msgid "Max width"
1054
+ msgstr ""
1055
+
1056
+ #: lib/class-wp-smush-ui.php:1193
1057
+ msgid "Max height"
1058
+ msgstr ""
1059
+
1060
+ #: lib/class-wp-smush-ui.php:1196
1061
+ #, php-format
1062
+ msgid "Currently, your largest image size is set at %s%dpx wide x %dpx high%s."
1063
+ msgstr ""
1064
+
1065
+ #: lib/class-wp-smush-ui.php:1197
1066
+ msgid ""
1067
+ "Just to let you know, the width you've entered is less than your largest "
1068
+ "image and may result in pixelation."
1069
+ msgstr ""
1070
+
1071
+ #: lib/class-wp-smush-ui.php:1198
1072
+ msgid ""
1073
+ "Just to let you know, the height you’ve entered is less than your largest "
1074
+ "image and may result in pixelation."
1075
+ msgstr ""
1076
+
1077
+ #: lib/class-wp-smush-ui.php:1258
1078
+ msgid ""
1079
+ "Note: This data, called EXIF, adds to the size of the image. While this "
1080
+ "information might be important to photographers, it’s unnecessary for most "
1081
+ "users and safe to remove."
1082
+ msgstr ""
1083
+
1084
+ #: lib/class-wp-smush-ui.php:1261
1085
+ msgid ""
1086
+ "Note: Any PNGs with transparency will be ignored. Smush will only convert "
1087
+ "PNGs if it results in a smaller file size. The resulting file will have a "
1088
+ "new filename and extension (JPEG), and any hard-coded URLs on your site that "
1089
+ "contain the original PNG filename will need to be updated."
1090
+ msgstr ""
1091
+
1092
+ #: lib/class-wp-smush-ui.php:1264
1093
+ msgid ""
1094
+ "Note: For this process to happen automatically you need automatic smushing "
1095
+ "enabled."
1096
+ msgstr ""
1097
+
1098
  #: lib/class-wp-smush.php:198
1099
  msgid "File path is empty"
1100
  msgstr ""
1123
  msgid "Unknown API error"
1124
  msgstr ""
1125
 
1126
+ #: lib/class-wp-smush.php:710
1127
+ msgid ""
1128
+ "Skipped due to a timeout error, You can increase the request timeout to make "
1129
+ "sure Smush has enough time to process larger files. "
1130
+ "`define('WP_SMUSH_API_TIMEOUT', 150);`."
1131
+ msgstr ""
1132
+
1133
+ #: lib/class-wp-smush.php:713
1134
  #, php-format
1135
  msgid "Error posting to API: %s"
1136
  msgstr ""
1137
 
1138
+ #: lib/class-wp-smush.php:720
1139
  #, php-format
1140
  msgid "Error posting to API: %s %s"
1141
  msgstr ""
1142
 
1143
+ #: lib/class-wp-smush.php:737
1144
  msgid "Smush data corrupted, try again."
1145
  msgstr ""
1146
 
1147
+ #: lib/class-wp-smush.php:757
1148
  msgid "Image couldn't be smushed"
1149
  msgstr ""
1150
 
1151
+ #: lib/class-wp-smush.php:998
1152
  #, php-format
1153
  msgid "%d images reduced "
1154
  msgstr ""
1155
 
1156
+ #: lib/class-wp-smush.php:998
1157
  msgid "Reduced "
1158
  msgstr ""
1159
 
1160
+ #: lib/class-wp-smush.php:1002
1161
  #, php-format
1162
  msgid "by %s %s"
1163
  msgstr ""
1164
 
1165
+ #: lib/class-wp-smush.php:1008
1166
  #, php-format
1167
  msgid "<br /> Image Size: %s"
1168
  msgstr ""
1169
 
1170
+ #: lib/class-wp-smush.php:1044
1171
  msgid "Detailed stats for all the image sizes"
1172
  msgstr ""
1173
 
1174
+ #: lib/class-wp-smush.php:1044
1175
  #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:236
1176
  msgid "Smush stats"
1177
  msgstr ""
1178
 
1179
+ #: lib/class-wp-smush.php:1088
1180
  #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:263
1181
  msgid "Not processed"
1182
  msgstr ""
1183
 
1184
+ #: lib/class-wp-smush.php:1402
1185
  #, php-format
1186
  msgid ""
1187
  "When you upload an image to WordPress it automatically creates %s thumbnail "
1190
  "site we don’t Smush them. Pro users can override this."
1191
  msgstr ""
1192
 
1193
+ #: lib/class-wp-smush.php:1405
1194
  msgid ""
1195
  "Image couldn't be smushed as it exceeded the 1Mb size limit, Pro users can "
1196
  "smush images with size upto 32Mb."
1197
  msgstr ""
1198
 
1199
+ #: lib/class-wp-smush.php:1407
1200
  msgid " Skipped"
1201
  msgstr ""
1202
 
1203
+ #: lib/class-wp-smush.php:1429
1204
+ #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:439
1205
  msgid "Image size"
1206
  msgstr ""
1207
 
1208
+ #: lib/class-wp-smush.php:1430
1209
+ #: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:440
1210
  msgid "Savings"
1211
  msgstr ""
1212
 
1213
+ #: lib/class-wp-smush.php:1678
1214
  msgid "Restore original image."
1215
  msgstr ""
1216
 
1217
+ #: lib/class-wp-smush.php:1678
1218
  msgid "Restore image"
1219
  msgstr ""
1220
 
1221
+ #: lib/class-wp-smush.php:1726
1222
  msgid "Smush image including original file."
1223
  msgstr ""
1224
 
1225
+ #: lib/class-wp-smush.php:1726
1226
  msgid "Resmush image"
1227
  msgstr ""
1228
 
1230
  msgid "Bulk WP Smush"
1231
  msgstr ""
1232
 
1233
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:391
1234
  #, php-format
1235
  msgid ""
1236
  "We haven’t found any images in your %sgallery%s yet, so there’s no smushing "
1237
  "to be done! Once you upload images, reload this page and start playing!"
1238
  msgstr ""
1239
 
1240
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:425
1241
  #, php-format
1242
  msgid ""
1243
  "Enable Super-smush in the %sSettings%s area to get even more savings with "
1244
  "almost no noticeable quality loss."
1245
  msgstr ""
1246
 
1247
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:440
1248
  #, php-format
1249
  msgid "Smush individual images via your %sManage Galleries%s section"
1250
  msgstr ""
1251
 
1252
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:440
1253
  msgid "Manage Galleries"
1254
  msgstr ""
1255
 
1256
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:496
1257
+ msgid "Super-smushed images"
1258
  msgstr ""
1259
 
1260
+ #: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:504
1261
  #, php-format
1262
  msgid "%sDISABLED%s"
1263
  msgstr ""
lib/class-wp-smush-admin.php CHANGED
@@ -92,8 +92,6 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
92
  */
93
  public $stats;
94
 
95
- public $bulk_ui = '';
96
-
97
  /**
98
  * @var int Limit for allowed number of images per bulk request
99
  */
@@ -130,6 +128,13 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
130
  'media_page_wp-smush-all'
131
  );
132
 
 
 
 
 
 
 
 
133
  /**
134
  * Constructor
135
  */
@@ -156,9 +161,6 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
156
  //Scan images as per the latest settings
157
  add_action( 'wp_ajax_scan_for_resmush', array( $this, 'scan_images' ) );
158
 
159
- //Save Settings
160
- add_action( 'wp_ajax_save_settings', array( $this, 'save_settings' ) );
161
-
162
  add_filter( 'plugin_action_links_' . WP_SMUSH_BASENAME, array(
163
  $this,
164
  'settings_link'
@@ -186,6 +188,12 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
186
  //Handle the smush pro dismiss features notice ajax
187
  add_action( 'wp_ajax_dismiss_update_info', array( $this, 'dismiss_update_info' ) );
188
 
 
 
 
 
 
 
189
  //Update the Super Smush count, after the smushing
190
  add_action( 'wp_smush_image_optimised', array( $this, 'update_lists' ), '', 2 );
191
 
@@ -199,49 +207,67 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
199
  */
200
  add_action( 'admin_notices', array( $this, 'media_library_membership_notice' ) );
201
 
202
- $this->bulk_ui = new WpSmushBulkUi();
 
 
 
 
 
 
 
 
203
 
204
  }
205
 
206
  function init_settings() {
207
  $this->settings = array(
208
  'networkwide' => array(
209
- 'label' => esc_html__( 'Enable Network wide settings', 'wp-smushit' ),
210
- 'desc' => esc_html__( 'If disabled sub sites can override the individual Smush settings.', 'wp-smushit' )
 
211
  ),
212
  'auto' => array(
213
- 'label' => esc_html__( 'Automatically smush my images on upload', 'wp-smushit' ),
214
- 'desc' => esc_html__( 'When you upload images to the media library, we’ll automatically optimize them.', 'wp-smushit' )
215
- ),
216
- 'keep_exif' => array(
217
- 'label' => esc_html__( 'Preserve image EXIF data', 'wp-smushit' ),
218
- 'desc' => esc_html__( '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.', 'wp-smushit' )
219
- ),
220
- 'resize' => array(
221
- 'label' => esc_html__( 'Resize original images', 'wp-smushit' ),
222
- 'desc' => esc_html__( '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.', 'wp-smushit' )
223
  ),
224
  'lossy' => array(
225
- 'label' => esc_html__( 'Super-smush my images', 'wp-smushit' ),
226
- 'desc' => esc_html__( 'Compress images up to 2x more than regular smush with almost no visible drop in quality.', 'wp-smushit' )
 
227
  ),
228
  'original' => array(
229
- 'label' => esc_html__( 'Include my original full-size images', 'wp-smushit' ),
230
- 'desc' => esc_html__( '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.', 'wp-smushit' )
 
 
 
 
 
 
 
 
 
 
 
231
  ),
232
  'backup' => array(
233
- 'label' => esc_html__( 'Make a copy of my original images', 'wp-smushit' ),
234
- 'desc' => esc_html__( '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.', 'wp-smushit' )
 
235
  ),
236
  'png_to_jpg' => array(
237
- 'label' => esc_html__( 'Convert PNG to JPEG (lossy)', 'wp-smushit' ),
238
- 'desc' => sprintf( esc_html__( "When you compress a PNG file, Smush will check if converting the file to JPEG will further reduce its size. %s Note: PNGs with transparency will be ignored and Smush will only convert the file format if it results in a smaller file size. This will change the file’s name and extension, and any hard-coded URLs will need to be updated.%s", 'wp-smushit' ), "<br /><strong>", "</strong>" )
 
239
  )
240
  );
241
 
242
  /**
243
  * Allow to add other settings via filtering the variable
244
- *
 
 
245
  */
246
  $this->settings = apply_filters('wp_smush_settings', $this->settings );
247
 
@@ -277,11 +303,11 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
277
  * Add Bulk option settings page
278
  */
279
  function screen() {
280
- global $admin_page_suffix;
281
 
282
  //Bulk Smush Page for each site
283
  $admin_page_suffix = add_media_page( 'Bulk WP Smush', 'WP Smush', 'edit_others_posts', 'wp-smush-bulk', array(
284
- $this->bulk_ui,
285
  'ui'
286
  ) );
287
 
@@ -290,7 +316,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
290
  $cap = 'manage_network_options';
291
 
292
  add_submenu_page( $page, 'WP Smush', 'WP Smush', $cap, 'wp-smush', array(
293
- $this->bulk_ui,
294
  'ui'
295
  ) );
296
 
@@ -314,6 +340,11 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
314
  'jquery'
315
  ), WP_SMUSH_VERSION );
316
 
 
 
 
 
 
317
  /* Register Style */
318
  wp_register_style( 'wp-smushit-admin-css', WP_SMUSH_URL . 'assets/css/wp-smushit-admin.css', array(), WP_SMUSH_VERSION );
319
  //Notice CSS
@@ -353,14 +384,13 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
353
  return;
354
  }
355
  }
356
-
357
  wp_enqueue_script( 'wp-smushit-admin-js' );
 
358
 
359
  //Style
360
  wp_enqueue_style( 'wp-smushit-admin-css' );
361
 
362
- $this->load_shared_ui( $current_page );
363
-
364
  //Enqueue Google Fonts for Tooltip On Media Pages, These are loaded by shared UI, but we
365
  // aren't loading shared UI on media library pages
366
  if ( ! wp_style_is( 'wdev-plugin-google_fonts', 'enqueued' ) ) {
@@ -408,6 +438,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
408
  'ajax_error' => esc_html__( "Ajax Error", "wp-smushit" ),
409
  'all_done' => esc_html__( "All Done!", "wp-smushit" ),
410
  'all_done' => esc_html__( "All Done!", "wp-smushit" ),
 
411
  );
412
 
413
  wp_localize_script( $handle, 'wp_smush_msgs', $wp_smush_msgs );
@@ -439,6 +470,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
439
  'count_smushed' => $this->smushed_count,
440
  'count_total' => $this->total_count,
441
  'count_images' => $this->stats['total_images'],
 
442
  'unsmushed' => $this->unsmushed_attachments,
443
  'resmush' => $this->resmush_ids,
444
  'size_before' => $this->stats['size_before'],
@@ -472,15 +504,9 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
472
  wp_localize_script( 'wp-smushit-admin-js', 'wp_smushit_data', $data );
473
 
474
  //Check if settings were changed for a multisite, and localize whether to run re-check on page load
475
- if ( is_multisite() && get_site_option( WP_SMUSH_PREFIX . 'networkwide' ) && ! is_network_admin() ) {
476
- //Check the last settings stored in db
477
- $settings = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'last_settings', '' );
478
-
479
- //Get current settings
480
- $c_settings = $this->get_serialised_settings();
481
-
482
  //If not same, Set a variable to run re-check on page load
483
- if( $settings != $c_settings ) {
484
  wp_localize_script( 'wp-smushit-admin-js', 'wp_smush_run_re_check', array( 1 ) );
485
  }
486
  }
@@ -688,7 +714,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
688
  $error = $smush->get_error_message();
689
  //Check for timeout error and suggest to filter timeout
690
  if ( strpos( $error, 'timed out' ) ) {
691
- $error = esc_html__( "Smush request timed out, You can try setting a higher value for `WP_SMUSH_API_TIMEOUT`.", "wp-smushit" );
692
  }
693
  } else {
694
  //Check if a resmush request, update the resmush list
@@ -844,6 +870,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
844
  ) );
845
  }
846
  } else {
 
847
  if ( $return ) {
848
  return $status;
849
  } else {
@@ -921,11 +948,12 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
921
 
922
  //Check if the resmush count is equal to remaining count
923
  $resmush_count = count( $this->resmush_ids );
 
924
  if ( $resmush_count > 0 && $resmush_count == $this->smushed_count ) {
925
- return $resmush_count;
926
  }
927
 
928
- return ( $this->total_count - $this->smushed_count );
929
  }
930
 
931
  /**
@@ -963,44 +991,21 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
963
  <?php
964
  }
965
 
966
- /**
967
- * Display the bulk smushing button
968
- *
969
- * @param bool $resmush
970
- *
971
- * @param bool $return Whether to return the button content or print it
972
- *
973
- * @return Returns or Echo the content
974
- */
975
- function setup_button( $resmush = false, $return = false ) {
976
- $button = $this->button_state( $resmush );
977
- $disabled = ! empty( $button['disabled'] ) ? ' disabled="disabled"' : '';
978
- $content = '<button class="button button-primary ' . $button['class'] . '"
979
- name="smush-all" ' . $disabled . '>
980
- <span>' . $button['text'] . '</span>
981
- </button>';
982
-
983
- //If We need to return the content
984
- if ( $return ) {
985
- return $content;
986
- }
987
-
988
- echo $content;
989
- }
990
-
991
  /**
992
  * Get all the attachment meta, sum up the stats and return
993
  *
994
  * @param bool $force_update , Whether to forcefully update the Cache
995
  *
 
 
996
  * @return array|bool|mixed
997
  *
998
  * @todo: remove id from global stats stored in db
999
  *
1000
  */
1001
- function global_stats( $force_update = false ) {
1002
 
1003
- if ( ! $force_update && $stats = get_option( 'smush_global_stats' ) ) {
1004
  if ( ! empty( $stats ) && ! empty( $stats['size_before'] ) ) {
1005
  if ( isset( $stats['id'] ) ) {
1006
  unset( $stats['id'] );
@@ -1038,7 +1043,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
1038
  foreach ( $global_data as $data ) {
1039
 
1040
  //Skip attachment, if in re-smush list
1041
- if ( ! empty( $this->resmush_ids ) && in_array( $data->post_id, $this->resmush_ids ) ) {
1042
  continue;
1043
  }
1044
 
@@ -1053,7 +1058,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
1053
  }
1054
 
1055
  //If the image was optimised
1056
- if ( !empty( $meta['stats'] ) && $meta['stats']['size_before'] > $meta['stats']['size_after'] ) {
1057
  //Total Image Smushed
1058
  $smush_data['total_images'] += ! empty( $meta['sizes'] ) ? count( $meta['sizes'] ) : 0;
1059
 
@@ -1100,6 +1105,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
1100
  //Resize Savings
1101
  $resize_savings = $wpsmush_db->resize_savings( false );
1102
  $smush_data['resize_savings'] = ! empty( $resize_savings['bytes'] ) ? $resize_savings['bytes'] : 0;
 
1103
 
1104
  //Conversion Savings
1105
  $conversion_savings = $wpsmush_db->conversion_savings( false );
@@ -1143,145 +1149,6 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
1143
  return $smush_data;
1144
  }
1145
 
1146
- /**
1147
- * Get all the attachment meta, sum up the stats and return
1148
- *
1149
- * @param bool $force_update , Whether to forcefully update the Cache
1150
- *
1151
- * @return array|bool|mixed Stats
1152
- */
1153
- function global_stats_from_ids( $force_update = false ) {
1154
-
1155
- if ( ! $force_update && $stats = get_option( 'smush_global_stats' ) ) {
1156
- if ( ! empty( $stats ) ) {
1157
- return $stats;
1158
- }
1159
- }
1160
-
1161
- global $wpsmush_db, $wpsmush_helper;
1162
- if ( empty( $this->smushed_attachments ) ) {
1163
- $this->smushed_attachments = $wpsmush_db->smushed_count( true );
1164
- }
1165
-
1166
- $smush_data = array(
1167
- 'size_before' => 0,
1168
- 'size_after' => 0,
1169
- 'percent' => 0,
1170
- 'human' => 0
1171
- );
1172
- $smush_data['count'] = 0;
1173
- $smush_data['total_images'] = 0;
1174
-
1175
- if ( ! empty( $this->smushed_attachments ) && is_array( $this->smushed_attachments ) ) {
1176
- //Iterate over all the attachments
1177
- foreach ( $this->smushed_attachments as $attachment ) {
1178
- //Get all the Savings for each image
1179
- $smush_stats = get_post_meta( $attachment, 'wp-smpro-smush-data', true );
1180
- $resize_savings = get_post_meta( $attachment, WP_SMUSH_PREFIX . 'resize_savings', true );
1181
- $conversion_savings = $wpsmush_helper->get_pngjpg_savings( $attachment );
1182
-
1183
- $smush_data['count'] += 1;
1184
- $smush_data['total_images'] += ! empty( $smush_stats['sizes'] ) ? count( $smush_stats['sizes'] ) : 0;
1185
-
1186
- //Sum up all the stats
1187
- if ( ! empty( $smush_stats['sizes'] ) ) {
1188
- foreach ( $smush_stats['sizes'] as $size_k => $size_savings ) {
1189
- //size_before from optimisation stats
1190
- $size_before = $size_savings->size_before;
1191
- $size_after = $size_savings->size_after;
1192
- if ( 'full' == $size_k ) {
1193
- //Check for savings from resizing for the original image
1194
- if ( ! empty( $resize_savings['size_before'] ) && $resize_savings['size_before'] > $size_before ) {
1195
- $size_before = $resize_savings['size_before'];
1196
- }
1197
- //Check for savings from resizing for the original image
1198
- if ( ! empty( $resize_savings['size_after'] ) && $resize_savings['size_after'] < $size_after ) {
1199
- $size_after = $resize_savings['size_after'];
1200
- }
1201
- }
1202
-
1203
- //Add conversion savings, if available
1204
- if ( ! empty( $conversion_savings['bytes'] ) ) {
1205
- $smush_data['size_before'] += $conversion_savings['size_before'];
1206
- $smush_data['size_after'] += $conversion_savings['size_after'];
1207
- }
1208
- }
1209
-
1210
- //Resize Savings: If full image wasn't optimised, but resized, combine the stats
1211
- if ( empty( $smush_stats['sizes']['full'] ) && ! empty( $resize_savings ) && $resize_savings['bytes'] > 0 ) {
1212
- $smush_data['size_before'] += $resize_savings['size_before'];
1213
- $smush_data['size_after'] += $resize_savings['size_after'];
1214
- }
1215
-
1216
- //Conversion Savings: If full image wasn't optimised, but Conversion saved few bytes
1217
- if ( empty( $smush_stats['sizes']['full'] ) && ! empty( $conversion_savings['full'] ) && $conversion_savings['full']['bytes'] > 0 ) {
1218
- $smush_data['size_before'] += $conversion_savings['full']['size_before'];
1219
- $smush_data['size_after'] += $conversion_savings['full']['size_after'];
1220
- }
1221
- }
1222
- }
1223
- $smush_data['bytes'] = $smush_data['size_before'] - $smush_data['size_after'];
1224
-
1225
- //Resize Savings
1226
- $resize_savings = $wpsmush_db->resize_savings( false );
1227
- $smush_data['resize_savings'] = ! empty( $resize_savings['bytes'] ) ? $resize_savings['bytes'] : 0;
1228
-
1229
- //Conversion Savings
1230
- $conversion_savings = $wpsmush_db->conversion_savings( false );
1231
- $smush_data['conversion_savings'] = ! empty( $conversion_savings['bytes'] ) ? $conversion_savings['bytes'] : 0;
1232
-
1233
- if ( $smush_data['size_before'] > 0 ) {
1234
- $smush_data['percent'] = ( $smush_data['bytes'] / $smush_data['size_before'] ) * 100;
1235
- }
1236
-
1237
- //Round off precentage
1238
- $smush_data['percent'] = round( $smush_data['percent'], 1 );
1239
-
1240
- $smush_data['human'] = size_format( $smush_data['bytes'], 1 );
1241
-
1242
- }
1243
- //Update Cache
1244
- update_option( 'smush_global_stats', $smush_data, false );
1245
-
1246
- return $smush_data;
1247
- }
1248
-
1249
- /**
1250
- * Returns Bulk smush button id and other details, as per if bulk request is already sent or not
1251
- *
1252
- * @param $resmush
1253
- *
1254
- * @return array
1255
- */
1256
-
1257
- private function button_state( $resmush ) {
1258
- $button = array(
1259
- 'cancel' => false,
1260
- );
1261
- if ( $this->validate_install() && $resmush ) {
1262
-
1263
- $button['text'] = __( 'Bulk Smush Now', 'wp-smushit' );
1264
- $button['class'] = 'wp-smush-button wp-smush-resmush wp-smush-all';
1265
-
1266
- } else {
1267
-
1268
- // if we have nothing left to smush, disable the buttons
1269
- if ( $this->smushed_count === $this->total_count ) {
1270
- $button['text'] = __( 'All Done!', 'wp-smushit' );
1271
- $button['class'] = 'wp-smush-finished disabled wp-smush-finished';
1272
- $button['disabled'] = 'disabled';
1273
-
1274
- } else {
1275
-
1276
- $button['text'] = __( 'Bulk Smush Now', 'wp-smushit' );
1277
- $button['class'] = 'wp-smush-button';
1278
-
1279
- }
1280
- }
1281
-
1282
- return $button;
1283
- }
1284
-
1285
  /**
1286
  * Get the smush button text for attachment
1287
  *
@@ -1343,6 +1210,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
1343
  * Shows Notice for free users, displays a discount coupon
1344
  */
1345
  function smush_upgrade() {
 
1346
 
1347
  //Return, If a pro user, or not super admin, or don't have the admin privilleges
1348
  if ( $this->validate_install() || ! current_user_can( 'edit_others_posts' ) || ! is_super_admin() ) {
@@ -1371,7 +1239,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
1371
  }
1372
 
1373
  //Container Header
1374
- echo $this->bulk_ui->installation_notice();
1375
  }
1376
 
1377
  /**
@@ -1461,6 +1329,17 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
1461
 
1462
  }
1463
 
 
 
 
 
 
 
 
 
 
 
 
1464
  /**
1465
  * Resmush the image
1466
  *
@@ -1508,7 +1387,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
1508
  */
1509
  function scan_images() {
1510
 
1511
- global $WpSmush, $wpsmushnextgenadmin, $wpsmush_db, $wpsmush_settings, $wpsmush_helper, $wpsmush_resize, $wpsmushit_admin;
1512
 
1513
  check_ajax_referer( 'save_wp_smush_options', 'wp_smush_options_nonce' );
1514
 
@@ -1522,18 +1401,17 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
1522
 
1523
  //If there aren't any images in the library, return the notice
1524
  if ( 0 == $wpsmush_db->get_media_attachments( true ) ) {
1525
- $notice = esc_html__( "We haven’t found any images in your media library yet so there’s no smushing to be done!", "wp-smushit" );
1526
  $resp = '<div class="wp-smush-notice wp-smush-resmush-message" tabindex="0"><i class="dev-icon dev-icon-tick"></i> ' . $notice . '
1527
  <i class="dev-icon dev-icon-cross"></i>
1528
  </div>';
1529
 
1530
- //Save serialized settings
1531
- $this->save_serialized_settings();
1532
-
1533
  wp_send_json_success( array(
1534
  'notice' => $resp,
1535
  'super_smush' => $WpSmush->lossy_enabled
1536
  ) );
 
1537
  }
1538
 
1539
  //Default Notice, to be displayed at the top of page
@@ -1573,8 +1451,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
1573
 
1574
  if ( 0 == $remaining_count && ! $WpSmush->lossy_enabled && ! $WpSmush->smush_original && $WpSmush->keep_exif && ! $upfront_active ) {
1575
  delete_option( $key );
1576
- //Save serialized settings
1577
- $this->save_serialized_settings();
1578
  wp_send_json_success( array( 'notice' => $resp ) );
1579
  }
1580
 
@@ -1736,7 +1613,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
1736
 
1737
  $count += 'nextgen' == $type ? $wpsmushnextgenadmin->remaining_count : $this->remaining_count;
1738
 
1739
- $ajax_response = $this->bulk_ui->bulk_resmush_content( $count, $show );
1740
  }
1741
  }
1742
  }
@@ -1789,9 +1666,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
1789
  $return['super_smush_stats'] = sprintf( '<strong><span class="smushed-count">%d</span>/%d</strong>', $ss_count, $wpsmushnextgenadmin->total_count );
1790
  }
1791
 
1792
- //Save serialized settings
1793
- $this->save_serialized_settings();
1794
-
1795
  wp_send_json_success( $return );
1796
 
1797
  }
@@ -2209,6 +2084,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
2209
  *
2210
  */
2211
  function media_library_membership_notice() {
 
2212
 
2213
  //No need to print it for free version
2214
  if( !$this->validate_install() ) {
@@ -2222,55 +2098,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
2222
  return;
2223
  }
2224
 
2225
- echo $this->bulk_ui->get_user_validation_message( $notice = true );
2226
- }
2227
-
2228
- /**
2229
- * Save settings, Used for networkwide option
2230
- */
2231
- function save_settings() {
2232
- //Validate Ajax request
2233
- check_ajax_referer( 'save_wp_smush_options', 'nonce' );
2234
-
2235
- global $wpsmush_settings;
2236
- //Save Settings
2237
- $wpsmush_settings->process_options();
2238
- wp_send_json_success();
2239
-
2240
- }
2241
-
2242
- /**
2243
- * Returns a serialised string of current settings
2244
- *
2245
- * @return Serialised string of settings
2246
- *
2247
- */
2248
- function get_serialised_settings() {
2249
- global $wpsmush_settings;
2250
- $settings = array();
2251
- foreach ( $this->settings as $key => $val ) {
2252
- $settings[ $key ] = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . $key );
2253
- }
2254
- $settings = maybe_serialize( $settings );
2255
-
2256
- return $settings;
2257
- }
2258
-
2259
- /**
2260
- * Stores the latest settings in serialised form in DB For the current settings
2261
- *
2262
- * No need to store the serialised settings, if network wide settings is disabled
2263
- * because the site would run the scan when settings are saved
2264
- *
2265
- */
2266
- function save_serialized_settings() {
2267
- //Return -> Single Site | If network settings page | Networkwide Settings Disabled
2268
- if ( ! is_multisite() || is_network_admin() || ! get_site_option( WP_SMUSH_PREFIX . 'networkwide' ) ) {
2269
- return;
2270
- }
2271
- global $wpsmush_settings;
2272
- $c_settings = $this->get_serialised_settings();
2273
- $wpsmush_settings->update_setting( WP_SMUSH_PREFIX . 'last_settings', $c_settings );
2274
  }
2275
 
2276
  /**
@@ -2294,6 +2122,93 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
2294
  return $error;
2295
  }
2296
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2297
  }
2298
 
2299
  global $wpsmushit_admin;
92
  */
93
  public $stats;
94
 
 
 
95
  /**
96
  * @var int Limit for allowed number of images per bulk request
97
  */
128
  'media_page_wp-smush-all'
129
  );
130
 
131
+ public $basic_features = array(
132
+ 'networkwide',
133
+ 'auto',
134
+ 'keep_exif',
135
+ 'resize',
136
+ );
137
+
138
  /**
139
  * Constructor
140
  */
161
  //Scan images as per the latest settings
162
  add_action( 'wp_ajax_scan_for_resmush', array( $this, 'scan_images' ) );
163
 
 
 
 
164
  add_filter( 'plugin_action_links_' . WP_SMUSH_BASENAME, array(
165
  $this,
166
  'settings_link'
188
  //Handle the smush pro dismiss features notice ajax
189
  add_action( 'wp_ajax_dismiss_update_info', array( $this, 'dismiss_update_info' ) );
190
 
191
+ // Handle ajax request to dismiss the s3 warning.
192
+ add_action( 'wp_ajax_dismiss_s3support_alert', array( $this, 'dismiss_s3support_alert' ) );
193
+
194
+ // Ajax request for quick Setup
195
+ add_action( 'wp_ajax_setupSmush', array( $this, 'setupSmush' ) );
196
+
197
  //Update the Super Smush count, after the smushing
198
  add_action( 'wp_smush_image_optimised', array( $this, 'update_lists' ), '', 2 );
199
 
207
  */
208
  add_action( 'admin_notices', array( $this, 'media_library_membership_notice' ) );
209
 
210
+ /**
211
+ * Handle Skip Quick Setup action
212
+ */
213
+ add_action( 'wp_ajax_skipSmushSetup', array( $this, 'skipSmushSetup' ) );
214
+
215
+ /**
216
+ * Hide Pagespeed Suggestion
217
+ */
218
+ add_action( 'wp_ajax_hide_pagespeed_suggestion', array( $this, 'hide_pagespeed_suggestion' ) );
219
 
220
  }
221
 
222
  function init_settings() {
223
  $this->settings = array(
224
  'networkwide' => array(
225
+ 'label' => esc_html__( 'Use network settings for all the sub-sites.', 'wp-smushit' ),
226
+ 'short_label' => esc_html__( 'Multisite Control', 'wp-smushit' ),
227
+ 'desc' => esc_html__( 'Choose whether you want to use network settings for all sub-sites or whether sub-site admins can control Smush’s settings.', 'wp-smushit' )
228
  ),
229
  'auto' => array(
230
+ 'label' => esc_html__( 'Automatically smush my images on upload', 'wp-smushit' ),
231
+ 'short_label' => esc_html__( 'Automatic Smush', 'wp-smushit' ),
232
+ 'desc' => esc_html__( 'When you upload images to your site, Smush will automatically optimize them for you.', 'wp-smushit' )
 
 
 
 
 
 
 
233
  ),
234
  'lossy' => array(
235
+ 'label' => esc_html__( 'Super-smush my images', 'wp-smushit' ),
236
+ 'short_label' => esc_html__( 'Super-smush', 'wp-smushit' ),
237
+ 'desc' => esc_html__( 'Compress images up to 2x more than regular smush with almost no visible drop in quality.', 'wp-smushit' )
238
  ),
239
  'original' => array(
240
+ 'label' => esc_html__( 'Smush my original full-size images', 'wp-smushit' ),
241
+ 'short_label' => esc_html__( 'Full size images', 'wp-smushit' ),
242
+ 'desc' => esc_html__( 'Every time you upload an image to your site, WordPress generates a resized version of that image for every image size that your theme has registered. This means there are multiple versions of your images in your media library. By default, Smush only compresses these generated image. Activate this setting to also smush your original images. Note: Activating this setting doesn’t usually improve page speed.', 'wp-smushit' )
243
+ ),
244
+ 'keep_exif' => array(
245
+ 'label' => esc_html__( 'Preserve my image EXIF data', 'wp-smushit' ),
246
+ 'short_label' => esc_html__( 'EXIF data', 'wp-smushit' ),
247
+ 'desc' => esc_html__( '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.', 'wp-smushit' )
248
+ ),
249
+ 'resize' => array(
250
+ 'label' => esc_html__( 'Resize my full size images', 'wp-smushit' ),
251
+ 'short_label' => esc_html__( 'Full size images', 'wp-smushit' ),
252
+ 'desc' => esc_html__( 'Set a maximum height and width for all images uploaded to your site so that any unnecessarily large images are automatically resized before they are added to the media gallery. This setting does not apply to images smushed using Directory Smush feature.', 'wp-smushit' )
253
  ),
254
  'backup' => array(
255
+ 'label' => esc_html__( 'Make a copy of my full size images', 'wp-smushit' ),
256
+ 'short_label' => esc_html__( 'Full size images', 'wp-smushit' ),
257
+ 'desc' => esc_html__( 'Save your original full-size images separately so you can restore them at any point. Note: Keeping a copy of your original files can significantly increase the size of your uploads folder by nearly twice as much.', 'wp-smushit' )
258
  ),
259
  'png_to_jpg' => array(
260
+ 'label' => esc_html__( 'Auto-convert PNGs to JPEGs (lossy)', 'wp-smushit' ),
261
+ 'short_label' => esc_html__( 'PNG to JPEG conversion', 'wp-smushit' ),
262
+ 'desc' => esc_html__( "When you compress a PNG file, Smush will check if converting the file to JPEG will further reduce its size.", 'wp-smushit' )
263
  )
264
  );
265
 
266
  /**
267
  * Allow to add other settings via filtering the variable
268
+ *
269
+ * Like Nextgen and S3 integration
270
+ *
271
  */
272
  $this->settings = apply_filters('wp_smush_settings', $this->settings );
273
 
303
  * Add Bulk option settings page
304
  */
305
  function screen() {
306
+ global $admin_page_suffix, $wpsmush_bulkui;
307
 
308
  //Bulk Smush Page for each site
309
  $admin_page_suffix = add_media_page( 'Bulk WP Smush', 'WP Smush', 'edit_others_posts', 'wp-smush-bulk', array(
310
+ $wpsmush_bulkui,
311
  'ui'
312
  ) );
313
 
316
  $cap = 'manage_network_options';
317
 
318
  add_submenu_page( $page, 'WP Smush', 'WP Smush', $cap, 'wp-smush', array(
319
+ $wpsmush_bulkui,
320
  'ui'
321
  ) );
322
 
340
  'jquery'
341
  ), WP_SMUSH_VERSION );
342
 
343
+ //UI JS
344
+ wp_register_script( 'wp-smushit-ui-js', WP_SMUSH_URL . 'assets/js/ui.js', array(
345
+ 'jquery'
346
+ ), WP_SMUSH_VERSION );
347
+
348
  /* Register Style */
349
  wp_register_style( 'wp-smushit-admin-css', WP_SMUSH_URL . 'assets/css/wp-smushit-admin.css', array(), WP_SMUSH_VERSION );
350
  //Notice CSS
384
  return;
385
  }
386
  }
387
+ $this->load_shared_ui( $current_page );
388
  wp_enqueue_script( 'wp-smushit-admin-js' );
389
+ wp_enqueue_script( 'wp-smushit-ui-js' );
390
 
391
  //Style
392
  wp_enqueue_style( 'wp-smushit-admin-css' );
393
 
 
 
394
  //Enqueue Google Fonts for Tooltip On Media Pages, These are loaded by shared UI, but we
395
  // aren't loading shared UI on media library pages
396
  if ( ! wp_style_is( 'wdev-plugin-google_fonts', 'enqueued' ) ) {
438
  'ajax_error' => esc_html__( "Ajax Error", "wp-smushit" ),
439
  'all_done' => esc_html__( "All Done!", "wp-smushit" ),
440
  'all_done' => esc_html__( "All Done!", "wp-smushit" ),
441
+ 'quick_setup_title' => __( "QUICK SETUP", "wp-smushit" ) . '<form method="post" class="smush-skip-setup float-r"><input type="hidden" name="action" value="skipSmushSetup"/>' . wp_nonce_field( 'skipSmushSetup', '_wpnonce', true, false ) . '<button type="submit" class="button button-small button-secondary skip-button">' . __( "Skip", "wp-smushit" ) . '</button></form>',
442
  );
443
 
444
  wp_localize_script( $handle, 'wp_smush_msgs', $wp_smush_msgs );
470
  'count_smushed' => $this->smushed_count,
471
  'count_total' => $this->total_count,
472
  'count_images' => $this->stats['total_images'],
473
+ 'count_resize' => $this->stats['resize_count'],
474
  'unsmushed' => $this->unsmushed_attachments,
475
  'resmush' => $this->resmush_ids,
476
  'size_before' => $this->stats['size_before'],
504
  wp_localize_script( 'wp-smushit-admin-js', 'wp_smushit_data', $data );
505
 
506
  //Check if settings were changed for a multisite, and localize whether to run re-check on page load
507
+ if ( is_multisite() && $wpsmush_settings->settings['networkwide'] && ! is_network_admin() ) {
 
 
 
 
 
 
508
  //If not same, Set a variable to run re-check on page load
509
+ if( get_site_option( WP_SMUSH_PREFIX . 'run_recheck', false ) ) {
510
  wp_localize_script( 'wp-smushit-admin-js', 'wp_smush_run_re_check', array( 1 ) );
511
  }
512
  }
714
  $error = $smush->get_error_message();
715
  //Check for timeout error and suggest to filter timeout
716
  if ( strpos( $error, 'timed out' ) ) {
717
+ $error = esc_html__( "Skipped due to a timeout error, You can increase the request timeout to make sure Smush has enough time to process larger files. `define('WP_SMUSH_API_TIMEOUT', 150);`", "wp-smushit" );
718
  }
719
  } else {
720
  //Check if a resmush request, update the resmush list
870
  ) );
871
  }
872
  } else {
873
+ $this->update_resmush_list( $attachment_id );
874
  if ( $return ) {
875
  return $status;
876
  } else {
948
 
949
  //Check if the resmush count is equal to remaining count
950
  $resmush_count = count( $this->resmush_ids );
951
+ $remaining_count = $this->total_count - $this->smushed_count;
952
  if ( $resmush_count > 0 && $resmush_count == $this->smushed_count ) {
953
+ return $resmush_count + $remaining_count ;
954
  }
955
 
956
+ return $remaining_count;
957
  }
958
 
959
  /**
991
  <?php
992
  }
993
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
994
  /**
995
  * Get all the attachment meta, sum up the stats and return
996
  *
997
  * @param bool $force_update , Whether to forcefully update the Cache
998
  *
999
+ * @param bool $exclude_resmush , Whether to exclude the resmush ids or not, if set to false cache won't be updated
1000
+ *
1001
  * @return array|bool|mixed
1002
  *
1003
  * @todo: remove id from global stats stored in db
1004
  *
1005
  */
1006
+ function global_stats( $force_update = false, $exclude_resmush = true ) {
1007
 
1008
+ if ( $exclude_resmush && ! $force_update && $stats = get_option( 'smush_global_stats' ) ) {
1009
  if ( ! empty( $stats ) && ! empty( $stats['size_before'] ) ) {
1010
  if ( isset( $stats['id'] ) ) {
1011
  unset( $stats['id'] );
1043
  foreach ( $global_data as $data ) {
1044
 
1045
  //Skip attachment, if in re-smush list
1046
+ if ( $exclude_resmush && ! empty( $this->resmush_ids ) && in_array( $data->post_id, $this->resmush_ids ) ) {
1047
  continue;
1048
  }
1049
 
1058
  }
1059
 
1060
  //If the image was optimised
1061
+ if ( !empty( $meta['stats'] ) && $meta['stats']['size_before'] >= $meta['stats']['size_after'] ) {
1062
  //Total Image Smushed
1063
  $smush_data['total_images'] += ! empty( $meta['sizes'] ) ? count( $meta['sizes'] ) : 0;
1064
 
1105
  //Resize Savings
1106
  $resize_savings = $wpsmush_db->resize_savings( false );
1107
  $smush_data['resize_savings'] = ! empty( $resize_savings['bytes'] ) ? $resize_savings['bytes'] : 0;
1108
+ $smush_data['resize_count'] = $wpsmush_db->resize_savings( false, false, true );
1109
 
1110
  //Conversion Savings
1111
  $conversion_savings = $wpsmush_db->conversion_savings( false );
1149
  return $smush_data;
1150
  }
1151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1152
  /**
1153
  * Get the smush button text for attachment
1154
  *
1210
  * Shows Notice for free users, displays a discount coupon
1211
  */
1212
  function smush_upgrade() {
1213
+ global $wpsmush_bulkui;
1214
 
1215
  //Return, If a pro user, or not super admin, or don't have the admin privilleges
1216
  if ( $this->validate_install() || ! current_user_can( 'edit_others_posts' ) || ! is_super_admin() ) {
1239
  }
1240
 
1241
  //Container Header
1242
+ echo $wpsmush_bulkui->installation_notice();
1243
  }
1244
 
1245
  /**
1329
 
1330
  }
1331
 
1332
+ /**
1333
+ * Hide S3 support alert by setting a flag.
1334
+ */
1335
+ function dismiss_s3support_alert() {
1336
+
1337
+ // Just set a flag.
1338
+ update_site_option( 'wp-smush-hide_s3support_alert', 1 );
1339
+
1340
+ wp_send_json_success();
1341
+ }
1342
+
1343
  /**
1344
  * Resmush the image
1345
  *
1387
  */
1388
  function scan_images() {
1389
 
1390
+ global $WpSmush, $wpsmushnextgenadmin, $wpsmush_db, $wpsmush_settings, $wpsmush_helper, $wpsmush_resize, $wpsmushit_admin, $wpsmush_bulkui;
1391
 
1392
  check_ajax_referer( 'save_wp_smush_options', 'wp_smush_options_nonce' );
1393
 
1401
 
1402
  //If there aren't any images in the library, return the notice
1403
  if ( 0 == $wpsmush_db->get_media_attachments( true ) ) {
1404
+ $notice = esc_html__( "We haven’t found any images in your media library yet so there’s no smushing to be done! Once you upload images, reload this page and start playing!", "wp-smushit" );
1405
  $resp = '<div class="wp-smush-notice wp-smush-resmush-message" tabindex="0"><i class="dev-icon dev-icon-tick"></i> ' . $notice . '
1406
  <i class="dev-icon dev-icon-cross"></i>
1407
  </div>';
1408
 
1409
+ delete_site_option( WP_SMUSH_PREFIX . 'run_recheck');
 
 
1410
  wp_send_json_success( array(
1411
  'notice' => $resp,
1412
  'super_smush' => $WpSmush->lossy_enabled
1413
  ) );
1414
+
1415
  }
1416
 
1417
  //Default Notice, to be displayed at the top of page
1451
 
1452
  if ( 0 == $remaining_count && ! $WpSmush->lossy_enabled && ! $WpSmush->smush_original && $WpSmush->keep_exif && ! $upfront_active ) {
1453
  delete_option( $key );
1454
+ delete_site_option( WP_SMUSH_PREFIX . 'run_recheck');
 
1455
  wp_send_json_success( array( 'notice' => $resp ) );
1456
  }
1457
 
1613
 
1614
  $count += 'nextgen' == $type ? $wpsmushnextgenadmin->remaining_count : $this->remaining_count;
1615
 
1616
+ $ajax_response = $wpsmush_bulkui->bulk_resmush_content( $count, $show );
1617
  }
1618
  }
1619
  }
1666
  $return['super_smush_stats'] = sprintf( '<strong><span class="smushed-count">%d</span>/%d</strong>', $ss_count, $wpsmushnextgenadmin->total_count );
1667
  }
1668
 
1669
+ delete_site_option( WP_SMUSH_PREFIX . 'run_recheck');
 
 
1670
  wp_send_json_success( $return );
1671
 
1672
  }
2084
  *
2085
  */
2086
  function media_library_membership_notice() {
2087
+ global $wpsmush_bulkui;
2088
 
2089
  //No need to print it for free version
2090
  if( !$this->validate_install() ) {
2098
  return;
2099
  }
2100
 
2101
+ echo $wpsmush_bulkui->get_user_validation_message( $notice = true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2102
  }
2103
 
2104
  /**
2122
  return $error;
2123
  }
2124
 
2125
+ /**
2126
+ * Process ajax action for Skipping Smush setup
2127
+ */
2128
+ public function skipSmushSetup() {
2129
+
2130
+ //Check for nonce
2131
+ if ( ! empty( $_POST['_wpnonce'] ) && ! wp_verify_nonce( $_POST['_wpnonce'], 'skipSmushSetup' ) ) {
2132
+ return;
2133
+ }
2134
+
2135
+ update_site_option( 'skip-smush-setup', 1 );
2136
+ wp_send_json_success();
2137
+ }
2138
+
2139
+ /**
2140
+ * Ajax action to save settings from quick setup
2141
+ *
2142
+ */
2143
+ function setupSmush() {
2144
+
2145
+ if ( ! empty( $_POST['_wpnonce'] ) && ! wp_verify_nonce( $_POST['_wpnonce'], 'setupSmush' ) ) {
2146
+ wp_send_json_error("Nonce verification failed");
2147
+ }
2148
+
2149
+ global $wpsmush_settings, $wpsmushit_admin, $WpSmush;
2150
+
2151
+ $quick_settings = array();
2152
+ //Get the settings from $_POST
2153
+ if ( ! empty( $_POST['smush_settings'] ) && is_array( $_POST['smush_settings'] ) ) {
2154
+ $quick_settings = $_POST['smush_settings'];
2155
+ }
2156
+
2157
+ //Check the last settings stored in db
2158
+ $settings = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'last_settings', array() );
2159
+
2160
+ //Available settings for free/pro version
2161
+ $exclude = array(
2162
+ 'networkwide',
2163
+ 'backup',
2164
+ 'png_to_jpg',
2165
+ 'nextgen',
2166
+ 's3'
2167
+ );
2168
+
2169
+ foreach( $wpsmushit_admin->settings as $name => $values ) {
2170
+
2171
+ //Update only specified settings
2172
+ if( in_array( $name, $exclude ) ) {
2173
+ continue;
2174
+ }
2175
+
2176
+ //Skip premium features if not a member
2177
+ if ( ! in_array( $name, $wpsmushit_admin->basic_features ) && ! $WpSmush->validate_install() ) {
2178
+ continue;
2179
+ }
2180
+
2181
+ //Update value in settings
2182
+ if( in_array( WP_SMUSH_PREFIX . $name , $quick_settings ) ) {
2183
+ $settings[$name] = 1;
2184
+ }else{
2185
+ $settings[$name] = 0;
2186
+ }
2187
+ }
2188
+
2189
+ //Update Resize width and height settings if set
2190
+ $resize_sizes['width'] = isset( $_POST['wp-smush-resize_width'] ) ? intval( $_POST['wp-smush-resize_width'] ) : 0;
2191
+ $resize_sizes['height'] = isset( $_POST['wp-smush-resize_height'] ) ? intval( $_POST['wp-smush-resize_height'] ) : 0;
2192
+
2193
+ // update the resize sizes
2194
+ $wpsmush_settings->update_setting( WP_SMUSH_PREFIX . 'resize_sizes', $resize_sizes );
2195
+
2196
+ $wpsmush_settings->update_setting( WP_SMUSH_PREFIX . 'last_settings', $settings );
2197
+
2198
+ update_site_option('skip-smush-setup', 1 );
2199
+
2200
+ wp_send_json_success();
2201
+
2202
+ }
2203
+
2204
+ /**
2205
+ * Store user preference for Pagespeed suggestions
2206
+ */
2207
+ function hide_pagespeed_suggestion() {
2208
+ update_network_option( get_current_network_id(), WP_SMUSH_PREFIX . 'hide_pagespeed_suggestion', true );
2209
+ wp_send_json_success();
2210
+ }
2211
+
2212
  }
2213
 
2214
  global $wpsmushit_admin;
lib/class-wp-smush-backup.php CHANGED
@@ -39,7 +39,7 @@ if ( ! class_exists( 'WpSmushBackup' ) ) {
39
  global $wpsmush_settings;
40
 
41
  //Whether backup is enabled or not
42
- $this->backup_enabled = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'backup' );
43
  }
44
 
45
  /**
39
  global $wpsmush_settings;
40
 
41
  //Whether backup is enabled or not
42
+ $this->backup_enabled = isset( $wpsmush_settings->settings['backup'] ) ? $wpsmush_settings->settings['backup'] : 0;
43
  }
44
 
45
  /**
lib/class-wp-smush-db.php CHANGED
@@ -193,7 +193,7 @@ if ( ! class_exists( 'WpSmushDB' ) ) {
193
  $limit = $wpsmushit_admin->query_limit();
194
 
195
  $mime = implode( "', '", $wpsmushit_admin->mime_types );
196
- $query = "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_mime_type IN ('$mime') LIMIT %d, %d";
197
  //Remove the Filters added by WP Media Folder
198
  $this->remove_filters();
199
 
@@ -251,7 +251,7 @@ if ( ! class_exists( 'WpSmushDB' ) ) {
251
 
252
  //Remove the Filters added by WP Media Folder
253
  $this->remove_filters();
254
- while ( $query_next && $results = $wpdb->get_col( $wpdb->prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key=%s LIMIT $offset, $limit", "wp-smpro-smush-data" ) ) ) {
255
  if ( ! is_wp_error( $results ) && sizeof( $results ) > 0 ) {
256
 
257
  $posts = array_merge( $posts, $results );
@@ -282,11 +282,19 @@ if ( ! class_exists( 'WpSmushDB' ) ) {
282
  */
283
  function super_smushed_count( $type = 'media', $attachments = array() ) {
284
 
 
 
285
  if ( 'media' == $type ) {
286
  $count = $this->get_super_smushed_attachments();
287
  } else {
288
  $key = 'wp-smush-super_smushed_nextgen';
289
 
 
 
 
 
 
 
290
  //Flag to check if we need to re-evaluate the count
291
  $revaluate = false;
292
 
@@ -441,6 +449,8 @@ if ( ! class_exists( 'WpSmushDB' ) ) {
441
  *
442
  * @param bool $format Format the Bytes in readable format
443
  *
 
 
444
  * @return array|bool|mixed|string Array of {
445
  * 'bytes',
446
  * 'before_size',
@@ -448,13 +458,21 @@ if ( ! class_exists( 'WpSmushDB' ) ) {
448
  * }
449
  *
450
  */
451
- function resize_savings( $force_update = true, $format = false ) {
452
  $savings = '';
453
 
454
  if ( ! $force_update ) {
455
  $savings = wp_cache_get( WP_SMUSH_PREFIX . 'resize_savings', 'wp-smush' );
456
  }
457
 
 
 
 
 
 
 
 
 
458
  global $wpsmushit_admin;
459
 
460
  //If nothing in cache, Calculate it
@@ -488,6 +506,7 @@ if ( ! class_exists( 'WpSmushDB' ) ) {
488
  $savings['size_after'] += $meta['size_after'];
489
  }
490
  }
 
491
  }
492
  }
493
  //Update the offset
@@ -507,9 +526,10 @@ if ( ! class_exists( 'WpSmushDB' ) ) {
507
  }
508
 
509
  wp_cache_set( WP_SMUSH_PREFIX . 'resize_savings', $savings, 'wp-smush' );
 
510
  }
511
 
512
- return $savings;
513
  }
514
 
515
  /**
193
  $limit = $wpsmushit_admin->query_limit();
194
 
195
  $mime = implode( "', '", $wpsmushit_admin->mime_types );
196
+ $query = "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_mime_type IN ('$mime') ORDER BY `ID` DESC LIMIT %d, %d";
197
  //Remove the Filters added by WP Media Folder
198
  $this->remove_filters();
199
 
251
 
252
  //Remove the Filters added by WP Media Folder
253
  $this->remove_filters();
254
+ while ( $query_next && $results = $wpdb->get_col( $wpdb->prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key=%s ORDER BY `post_id` DESC LIMIT $offset, $limit", "wp-smpro-smush-data" ) ) ) {
255
  if ( ! is_wp_error( $results ) && sizeof( $results ) > 0 ) {
256
 
257
  $posts = array_merge( $posts, $results );
282
  */
283
  function super_smushed_count( $type = 'media', $attachments = array() ) {
284
 
285
+ global $wpsmushnextgenstats;
286
+
287
  if ( 'media' == $type ) {
288
  $count = $this->get_super_smushed_attachments();
289
  } else {
290
  $key = 'wp-smush-super_smushed_nextgen';
291
 
292
+ //Clear up the stats, if there are no images
293
+ if( is_object( $wpsmushnextgenstats ) && method_exists( $wpsmushnextgenstats, 'total_count') && 0 == $wpsmushnextgenstats->total_count() ) {
294
+ delete_option($key);
295
+ }
296
+
297
+
298
  //Flag to check if we need to re-evaluate the count
299
  $revaluate = false;
300
 
449
  *
450
  * @param bool $format Format the Bytes in readable format
451
  *
452
+ * @param bool $return_count Return the resized image count, Set to false by default
453
+ *
454
  * @return array|bool|mixed|string Array of {
455
  * 'bytes',
456
  * 'before_size',
458
  * }
459
  *
460
  */
461
+ function resize_savings( $force_update = true, $format = false, $return_count = false ) {
462
  $savings = '';
463
 
464
  if ( ! $force_update ) {
465
  $savings = wp_cache_get( WP_SMUSH_PREFIX . 'resize_savings', 'wp-smush' );
466
  }
467
 
468
+ $count = wp_cache_get( WP_SMUSH_PREFIX . 'resize_count', 'wp-smush' );
469
+
470
+ //If resize image count is not stored in db, recalculate
471
+ if( $return_count && !$count ) {
472
+ $count = 0;
473
+ $force_update = true;
474
+ }
475
+
476
  global $wpsmushit_admin;
477
 
478
  //If nothing in cache, Calculate it
506
  $savings['size_after'] += $meta['size_after'];
507
  }
508
  }
509
+ $count++;
510
  }
511
  }
512
  //Update the offset
526
  }
527
 
528
  wp_cache_set( WP_SMUSH_PREFIX . 'resize_savings', $savings, 'wp-smush' );
529
+ wp_cache_set( WP_SMUSH_PREFIX . 'resize_count', $count, 'wp-smush' );
530
  }
531
 
532
+ return $return_count ? $count : $savings;
533
  }
534
 
535
  /**
lib/class-wp-smush-dir.php CHANGED
@@ -80,29 +80,25 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
80
  $dir_smush_stats = get_option( 'dir_smush_stats' );
81
  $human = $percent = 0;
82
  if ( ! empty( $dir_smush_stats ) && ! empty( $dir_smush_stats['dir_smush'] ) ) {
83
- $human = ! empty( $dir_smush_stats['dir_smush']['percent'] ) && ! $dir_smush_stats['dir_smush']['percent'] > 0 ? $dir_smush_stats['dir_smush']['bytes'] : 0;
84
  $percent = ! empty( $dir_smush_stats['dir_smush']['percent'] ) && $dir_smush_stats['dir_smush']['percent'] > 0 ? number_format_i18n( $dir_smush_stats['dir_smush']['percent'], 1, '.', '' ) : 0;
85
- } ?>
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>
@@ -223,7 +219,7 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
223
  * Output the required UI for WP Smush All page
224
  */
225
  function ui() {
226
- global $WpSmush, $wpsmushit_admin;
227
 
228
  //Print Directory Smush UI, if not a network site
229
  if ( is_network_admin() ) {
@@ -246,9 +242,8 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
246
  wp_nonce_field( 'smush_get_dir_list', 'list_nonce' );
247
  wp_nonce_field( 'smush_get_image_list', 'image_list_nonce' );
248
 
249
- $upgrade_link = '<a href="' . esc_url( $wpsmushit_admin->upgrade_url ) . '" title="' . esc_html__( "WP Smush Pro", "wp-smushit" ) . '">';
250
  /** Directory Browser and Image List **/
251
- $wpsmushit_admin->bulk_ui->container_header( 'wp-smush-dir-browser', 'wp-smush-dir-browser', esc_html__( "DIRECTORY SMUSH", "wp-smushit" ) ); ?>
252
  <div class="box-content">
253
  <div class="row">
254
  <div class="wp-smush-dir-desc roboto-regular">
@@ -365,10 +360,6 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
365
 
366
  $list = '';
367
 
368
- // set checkbox if multiSelect set to true
369
- $onlyFolders = ( '/' == $_GET['dir'] || isset( $_GET['onlyFolders'] ) && $_GET['onlyFolders'] == 'true' ) ? true : false;
370
- $onlyFiles = ( isset( $_GET['onlyFiles'] ) && $_GET['onlyFiles'] == 'true' ) ? true : false;
371
-
372
  if ( file_exists( $postDir ) ) {
373
 
374
  $files = scandir( $postDir );
@@ -385,10 +376,10 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
385
  $ext = preg_replace( '/^.*\./', '', $file );
386
 
387
  if ( file_exists( $postDir . $file ) && $file != '.' && $file != '..' ) {
388
- if ( is_dir( $postDir . $file ) && ( ! $onlyFiles || $onlyFolders ) && ! $this->skip_dir( $postDir . $file ) ) {
389
  //Skip Uploads folder - Media Files
390
  $list .= "<li class='directory collapsed'><a rel='" . $htmlRel . "/'>" . $htmlName . "</a></li><br />";
391
- } else if ( ( ! $onlyFolders || $onlyFiles ) && in_array( $ext, $supported_image ) && ! $this->is_media_library_file( $postDir . $file ) ) {
392
  $list .= "<li class='file ext_{$ext}'><a rel='" . $htmlRel . "'>" . $htmlName . "</a></li><br />";
393
  }
394
  }
@@ -511,6 +502,8 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
511
  $count = 0;
512
  $timestamp = gmdate( 'Y-m-d H:i:s' );
513
  $values = array();
 
 
514
  foreach ( $iterator as $path ) {
515
 
516
  //Used in place of Skip Dots, For php 5.2 compatability
@@ -549,8 +542,8 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
549
 
550
  //Store the Images in db at an interval of 5k
551
  if ( $count >= 5000 ) {
552
- $count = 0;
553
- $query = $this->build_query( $values, $images );
554
  $images = $values = array();
555
  $wpdb->query( $query );
556
  }
@@ -882,6 +875,8 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
882
  */
883
  function generate_markup( $images ) {
884
 
 
 
885
  if ( empty( $images ) || empty( $images['files_arr'] ) || empty( $images['image_items'] ) ) {
886
  return null;
887
  }
@@ -896,6 +891,11 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
896
  $index = 1;
897
  $files_arr = $images['files_arr'];
898
 
 
 
 
 
 
899
  foreach ( $files_arr as $image_path => $image ) {
900
  $count = sizeof( $image );
901
  $wrapper_class = '';
@@ -907,6 +907,10 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
907
  if ( $optimised_count > 0 ) {
908
  $wrapper_class = $count == $optimised_count ? 'complete' : 'partial';
909
  }
 
 
 
 
910
 
911
  $div .= "<li class='wp-smush-image-ul {$wrapper_class}'>";
912
  if ( $hr && $index > 1 ) {
@@ -919,6 +923,10 @@ if ( ! class_exists( 'WpSmushDir' ) ) {
919
  foreach ( $image as $item ) {
920
  //Check if the image is already in optimised list
921
  $class = is_array( $this->optimised_images ) && array_key_exists( $item, $this->optimised_images ) ? ' optimised' : '';
 
 
 
 
922
 
923
  $image_id = $this->get_image_id( $item, $images['image_items'] );
924
  $div .= "<li class='wp-smush-image-ele{$class}' id='{$image_id}'><span class='wp-smush-image-ele-status'></span><span class='wp-smush-image-path'>{$item}</span>";
80
  $dir_smush_stats = get_option( 'dir_smush_stats' );
81
  $human = $percent = 0;
82
  if ( ! empty( $dir_smush_stats ) && ! empty( $dir_smush_stats['dir_smush'] ) ) {
83
+ $human = ! empty( $dir_smush_stats['dir_smush']['bytes'] ) && $dir_smush_stats['dir_smush']['bytes'] > 0 ? $dir_smush_stats['dir_smush']['bytes'] : 0;
84
  $percent = ! empty( $dir_smush_stats['dir_smush']['percent'] ) && $dir_smush_stats['dir_smush']['percent'] > 0 ? number_format_i18n( $dir_smush_stats['dir_smush']['percent'], 1, '.', '' ) : 0;
85
+ }?>
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="wp-smush-stats<?php echo $human > 0 ? ' float-r' : ' float-l'?>">
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 size_format( $human,1 ); ?></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 : ''; ?>%</span><?php
 
98
  }
99
  } else { ?>
100
+ <span class="wp-smush-stats-human settings-desc"><?php esc_html_e("Smush images that aren't located in your uploads folder.", "wp-smushit"); ?>
101
+ <a href="#wp-smush-dir-browser" class="wp-smush-dir-link"><?php esc_html_e( "Choose directory", "wp-smushit" ); ?></a>
 
 
 
102
  </span>
103
  <span class="wp-smush-stats-sep hidden">/</span>
104
  <span class="wp-smush-stats-percent"></span>
219
  * Output the required UI for WP Smush All page
220
  */
221
  function ui() {
222
+ global $WpSmush, $wpsmushit_admin, $wpsmush_bulkui;
223
 
224
  //Print Directory Smush UI, if not a network site
225
  if ( is_network_admin() ) {
242
  wp_nonce_field( 'smush_get_dir_list', 'list_nonce' );
243
  wp_nonce_field( 'smush_get_image_list', 'image_list_nonce' );
244
 
 
245
  /** Directory Browser and Image List **/
246
+ $wpsmush_bulkui->container_header( 'wp-smush-dir-browser', 'wp-smush-dir-browser', esc_html__( "DIRECTORY SMUSH", "wp-smushit" ) ); ?>
247
  <div class="box-content">
248
  <div class="row">
249
  <div class="wp-smush-dir-desc roboto-regular">
360
 
361
  $list = '';
362
 
 
 
 
 
363
  if ( file_exists( $postDir ) ) {
364
 
365
  $files = scandir( $postDir );
376
  $ext = preg_replace( '/^.*\./', '', $file );
377
 
378
  if ( file_exists( $postDir . $file ) && $file != '.' && $file != '..' ) {
379
+ if ( is_dir( $postDir . $file ) && ! $this->skip_dir( $postDir . $file ) ) {
380
  //Skip Uploads folder - Media Files
381
  $list .= "<li class='directory collapsed'><a rel='" . $htmlRel . "/'>" . $htmlName . "</a></li><br />";
382
+ } else if ( in_array( $ext, $supported_image ) && ! $this->is_media_library_file( $postDir . $file ) ) {
383
  $list .= "<li class='file ext_{$ext}'><a rel='" . $htmlRel . "'>" . $htmlName . "</a></li><br />";
384
  }
385
  }
502
  $count = 0;
503
  $timestamp = gmdate( 'Y-m-d H:i:s' );
504
  $values = array();
505
+ //Temporary Increase the limit
506
+ @ini_set('memory_limit','256M');
507
  foreach ( $iterator as $path ) {
508
 
509
  //Used in place of Skip Dots, For php 5.2 compatability
542
 
543
  //Store the Images in db at an interval of 5k
544
  if ( $count >= 5000 ) {
545
+ $count = 0;
546
+ $query = $this->build_query( $values, $images );
547
  $images = $values = array();
548
  $wpdb->query( $query );
549
  }
875
  */
876
  function generate_markup( $images ) {
877
 
878
+ global $wpsmush_helper;
879
+
880
  if ( empty( $images ) || empty( $images['files_arr'] ) || empty( $images['image_items'] ) ) {
881
  return null;
882
  }
891
  $index = 1;
892
  $files_arr = $images['files_arr'];
893
 
894
+ $plugin_path = array(
895
+ path_join( WP_PLUGIN_DIR, 'wp-smushit' ),
896
+ path_join( WP_PLUGIN_DIR, 'wp-smush-pro' ),
897
+ );
898
+
899
  foreach ( $files_arr as $image_path => $image ) {
900
  $count = sizeof( $image );
901
  $wrapper_class = '';
907
  if ( $optimised_count > 0 ) {
908
  $wrapper_class = $count == $optimised_count ? 'complete' : 'partial';
909
  }
910
+ //Mark Smush plugin images optimised
911
+ if ( false !== $wpsmush_helper->strposa( $image_path, $plugin_path ) ) {
912
+ $wrapper_class = 'complete';
913
+ }
914
 
915
  $div .= "<li class='wp-smush-image-ul {$wrapper_class}'>";
916
  if ( $hr && $index > 1 ) {
923
  foreach ( $image as $item ) {
924
  //Check if the image is already in optimised list
925
  $class = is_array( $this->optimised_images ) && array_key_exists( $item, $this->optimised_images ) ? ' optimised' : '';
926
+ //Mark Smush images optimised
927
+ if ( false !== $wpsmush_helper->strposa( $item, $plugin_path ) ) {
928
+ $class = ' optimised';
929
+ }
930
 
931
  $image_id = $this->get_image_id( $item, $images['image_items'] );
932
  $div .= "<li class='wp-smush-image-ele{$class}' id='{$image_id}'><span class='wp-smush-image-ele-status'></span><span class='wp-smush-image-path'>{$item}</span>";
lib/class-wp-smush-helper.php CHANGED
@@ -78,6 +78,61 @@ if ( ! class_exists( 'WpSmushHelper' ) ) {
78
 
79
  return $savings;
80
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  }
82
 
83
  global $wpsmush_helper;
78
 
79
  return $savings;
80
  }
81
+
82
+ /**
83
+ * Multiple Needles in an array
84
+ *
85
+ * @param $haystack
86
+ * @param $needle
87
+ * @param int $offset
88
+ *
89
+ * @return bool
90
+ */
91
+ function strposa( $haystack, $needle, $offset = 0 ) {
92
+ if ( ! is_array( $needle ) ) {
93
+ $needle = array( $needle );
94
+ }
95
+ foreach ( $needle as $query ) {
96
+ if ( strpos( $haystack, $query, $offset ) !== false ) {
97
+ return true;
98
+ } // stop on first true result
99
+ }
100
+
101
+ return false;
102
+ }
103
+
104
+
105
+ /**
106
+ * Checks if file for given attachment id exists on s3, otherwise looks for local path
107
+ *
108
+ * @param $id
109
+ * @param $file_path
110
+ *
111
+ * @return bool
112
+ */
113
+ function file_exists( $id, $file_path ) {
114
+
115
+ //If not attachment id is given return false
116
+ if ( empty( $id ) ) {
117
+ return false;
118
+ }
119
+
120
+ //Get file path, if not provided
121
+ if ( empty( $file_path ) ) {
122
+ $file_path = $this->get_attached_file( $id );
123
+ }
124
+
125
+ global $wpsmush_s3;
126
+
127
+ //If S3 is enabled
128
+ if ( is_object( $wpsmush_s3 ) && method_exists( $wpsmush_s3, 'is_image_on_s3' ) && $wpsmush_s3->is_image_on_s3( $id ) ) {
129
+ $file_exists = true;
130
+ } else {
131
+ $file_exists = file_exists( $file_path );
132
+ }
133
+
134
+ return $file_exists;
135
+ }
136
  }
137
 
138
  global $wpsmush_helper;
lib/class-wp-smush-nextgen.php CHANGED
@@ -17,7 +17,12 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
17
  /**
18
  * @var array Contains the total Stats, for displaying it on bulk page
19
  */
20
- var $stats = array();
 
 
 
 
 
21
 
22
  var $is_nextgen_active = false;
23
 
@@ -64,6 +69,7 @@ if ( ! class_exists( 'WpSmushNextGen' ) ) {
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
 
17
  /**
18
  * @var array Contains the total Stats, for displaying it on bulk page
19
  */
20
+ var $stats = array(
21
+ 'savings_bytes' => 0,
22
+ 'size_before' => 0,
23
+ 'size_after' => 0,
24
+ 'savings_percent' => 0
25
+ );
26
 
27
  var $is_nextgen_active = false;
28
 
69
  function register( $settings ) {
70
  $settings['nextgen'] = array(
71
  'label' => esc_html__( 'Enable NextGen Gallery integration', 'wp-smushit' ),
72
+ 'short_label' => esc_html__( 'NextGen Gallery', 'wp-smushit' ),
73
  'desc' => esc_html__( 'Allow smushing images directly through NextGen Gallery settings.', 'wp-smushit' )
74
  );
75
 
lib/class-wp-smush-png_jpg.php CHANGED
@@ -127,7 +127,7 @@ if ( ! class_exists( 'WpSmushPngtoJpg' ) ) {
127
  $should_convert = false;
128
 
129
  //Get the Transparency conversion settings
130
- $convert_png = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'png_to_jpg', false );
131
 
132
  if ( ! $convert_png ) {
133
  return $should_convert;
@@ -304,7 +304,7 @@ if ( ! class_exists( 'WpSmushPngtoJpg' ) ) {
304
  $wpdb->query( $query );
305
 
306
  //Delete the Original files if backup not enabled
307
- if ( 'conversion' == $o_type && ! $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'backup' ) ) {
308
  @unlink( $o_file );
309
  }
310
 
127
  $should_convert = false;
128
 
129
  //Get the Transparency conversion settings
130
+ $convert_png = $wpsmush_settings->settings['png_to_jpg'];
131
 
132
  if ( ! $convert_png ) {
133
  return $should_convert;
304
  $wpdb->query( $query );
305
 
306
  //Delete the Original files if backup not enabled
307
+ if ( 'conversion' == $o_type && ! $wpsmush_settings->settings['backup'] ) {
308
  @unlink( $o_file );
309
  }
310
 
lib/class-wp-smush-resize.php CHANGED
@@ -54,6 +54,8 @@ if ( ! class_exists( 'WpSmushResize' ) ) {
54
 
55
  global $wpsmush_settings, $wpsmushit_admin;
56
 
 
 
57
  // Make sure the screen function exists.
58
  $current_screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
59
 
@@ -66,7 +68,7 @@ if ( ! class_exists( 'WpSmushResize' ) ) {
66
  }
67
 
68
  //If resizing is enabled
69
- $this->resize_enabled = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'resize' );
70
 
71
  $resize_sizes = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'resize_sizes', array() );
72
 
@@ -101,8 +103,11 @@ if ( ! class_exists( 'WpSmushResize' ) ) {
101
  return false;
102
  }
103
 
 
 
104
  //If file doesn't exists, return
105
- if ( ! file_exists( $file_path ) ) {
 
106
  return false;
107
  }
108
 
54
 
55
  global $wpsmush_settings, $wpsmushit_admin;
56
 
57
+ $settings = $wpsmush_settings->settings;
58
+
59
  // Make sure the screen function exists.
60
  $current_screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
61
 
68
  }
69
 
70
  //If resizing is enabled
71
+ $this->resize_enabled = $settings['resize'];
72
 
73
  $resize_sizes = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'resize_sizes', array() );
74
 
103
  return false;
104
  }
105
 
106
+ $file_exists = $wpsmush_helper->file_exists( $id, $file_path );
107
+
108
  //If file doesn't exists, return
109
+ if ( ! $file_exists ) {
110
+
111
  return false;
112
  }
113
 
lib/class-wp-smush-s3.php CHANGED
@@ -12,10 +12,15 @@ 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() {
@@ -32,7 +37,6 @@ if ( ! class_exists( 'WpSmushS3' ) ) {
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 );
@@ -53,8 +57,9 @@ if ( ! class_exists( 'WpSmushS3' ) ) {
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__( 'Optimize 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;
@@ -77,17 +82,24 @@ if ( ! class_exists( 'WpSmushS3' ) ) {
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;
@@ -96,36 +108,98 @@ if ( ! class_exists( 'WpSmushS3' ) ) {
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
  /**
@@ -170,7 +244,7 @@ if ( ! class_exists( 'WpSmushS3' ) ) {
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
 
@@ -276,6 +350,7 @@ if ( ! class_exists( 'WpSmushS3' ) ) {
276
  $s3client = $as3cf->get_s3client( $region );
277
 
278
  $file_exists = $s3client->doesObjectExist( $bucket, $s3_object['key'] );
 
279
  return $file_exists;
280
  }
281
 
@@ -348,7 +423,7 @@ if ( class_exists( 'AS3CF_Plugin_Compatibility' ) && ! class_exists( 'wp_smush_s
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 $url;
353
  }
354
 
12
 
13
  class WpSmushS3 {
14
 
15
+ private $setup_notice = '';
16
+ private $message_type = 'error';
17
 
18
  function __construct() {
19
  $this->init();
20
+
21
+ //Hook at the end of setting row to output a error div
22
+ add_action( 'smush_setting_column_right_end', array( $this, 's3_setup_message' ) );
23
+
24
  }
25
 
26
  function init() {
37
  if ( ! $WpSmush->validate_install() ) {
38
  return;
39
  }
 
40
 
41
  //Check if the file exists for the given path and download
42
  add_action( 'smush_file_exists', array( $this, 'maybe_download_file' ), 10, 3 );
57
  function register( $settings ) {
58
  $plugin_url = esc_url( "https://wordpress.org/plugins/amazon-s3-and-cloudfront/" );
59
  $settings['s3'] = array(
60
+ 'label' => esc_html__( 'Enable Amazon S3 support', 'wp-smushit' ),
61
+ 'short_label' => esc_html__( 'Amazon S3', 'wp-smushit' ),
62
+ 'desc' => sprintf( esc_html__( 'Storing your image on S3 buckets using %sWP Offload S3%s? Smush can detect and smush those assets for you, including when you\re removing files from your host server.', 'wp-smushit' ), "<a href='" . $plugin_url . "' target = '_blank'>", "</a>", "<b>", "</b>" )
63
  );
64
 
65
  return $settings;
82
  }
83
 
84
  /**
85
+ * Prints the message for S3 setup
86
  *
87
+ * @param $setting_key
88
+ *
89
+ * @return null
90
  */
91
+ function s3_setup_message( $setting_key ) {
92
+
93
+ //Return if not S3
94
+ if( 's3' != $setting_key ) {
95
+ return;
96
+ }
97
 
98
  global $as3cf, $WpSmush, $wpsmush_settings;
99
  $show_error = false;
100
+
101
  //If S3 integration is not enabled, return
102
+ $setting_val = $WpSmush->validate_install() ? $wpsmush_settings->settings['s3'] : 0;
 
103
 
104
  if ( ! $setting_val ) {
105
  return;
108
  //Check if plugin is setup or not
109
  //In case for some reason, we couldn't find the function
110
  if ( ! is_object( $as3cf ) || ! method_exists( $as3cf, 'is_plugin_setup' ) ) {
111
+ $show_error = true;
112
+ $support_url = esc_url( "https://premium.wpmudev.org/contact" );
113
+ $this->setup_notice = 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>' );
114
  }
115
 
116
  //Plugin is not setup, or some information is missing
117
  if ( ! $as3cf->is_plugin_setup() ) {
118
+ $show_error = true;
119
+ $configure_url = $as3cf->get_plugin_page_url();
120
+ $this->setup_notice = 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>" );
121
+ } else {
122
+
123
+ $this->message_type = 'notice';
124
+ $this->setup_notice = esc_html__( "Amazon S3 support is active.", "wp-smushit" );
125
+
126
  }
127
+
128
  //Return Early if we don't need to do anything
129
+ if ( empty( $this->setup_notice ) ) {
130
  return;
131
  }
 
 
132
 
133
+ $class = 'error' == $this->message_type ? ' smush-s3-setup-error' : ' smush-s3-setup-message';
134
+ $icon_class = 'error' == $this->message_type ? ' dev-icon wdv-icon wdv-icon-fw wdv-icon-exclamation-sign' : ' dev-icon dev-icon-tick';
135
+ echo "<div class='wp-smush-notice" . $class . "'><i class='" . $icon_class . "'></i><p>$this->setup_notice</p></div>";
136
  }
137
 
138
  /**
139
+ * Error message to show when S3 support is required.
140
  *
141
+ * Show a error message to admins, if they need to enable S3 support. If "remove files from
142
+ * server" option is enabled in WP S3 Offload plugin, we need WP Smush Pro to enable S3 support.
143
+ *
144
+ * @return mixed
145
+ */
146
+ function s3_support_required_notice() {
147
+
148
+ global $wpsmushit_admin, $wpsmush_settings;
149
+
150
+ // Do not display it for other users.
151
+ // Do not display on network screens, if networkwide option is disabled.
152
+ if ( ! current_user_can( 'manage_options' ) || ( is_network_admin() && ! $wpsmush_settings->settings['networkwide'] ) ) {
153
+ return true;
154
+ }
155
+
156
+ // Do not display the notice on Bulk Smush Screen.
157
+ global $current_screen;
158
+ if ( ! empty( $current_screen->base ) && 'media_page_wp-smush-bulk' != $current_screen->base && 'gallery_page_wp-smush-nextgen-bulk' != $current_screen->base && 'settings_page_wp-smush-network' != $current_screen->base ) {
159
+ return true;
160
+ }
161
+
162
+ // If already dismissed, do not show.
163
+ if ( 1 == get_site_option( 'wp-smush-hide_s3support_alert' ) ) {
164
+ return true;
165
+ }
166
+
167
+ // Return early, if support is not required.
168
+ if ( ! $this->s3_support_required() ) {
169
+ return true;
170
+ }
171
+
172
+ wp_enqueue_script( 'wp-smushit-notice-js' );
173
+ // Settings link.
174
+ $settings_link = is_multisite() && $wpsmush_settings->settings['networkwide'] ? network_admin_url( 'settings.php?page=wp-smush' ) : admin_url( 'upload.php?page=wp-smush-bulk' );
175
+
176
+ if ( $wpsmushit_admin->validate_install() ) {
177
+ // If premium user, but S3 support is not enabled.
178
+ $message = sprintf( __( "We can see you have WP S3 Offload installed with the <strong>Remove Files From Server</strong> option activated. If you want to optimize your S3 images you'll need to enable the <a href='%s'><strong>Amazon S3 Support</strong></a> feature in Smush's settings.", 'wp-smushit' ), $settings_link );
179
+ } else {
180
+ // If not a premium user.
181
+ $message = sprintf( __( "We can see you have WP S3 Offload installed with the <strong>Remove Files From Server</strong> option activated. If you want to optimize your S3 images you'll need to <a href='%s'><strong>upgrade to Smush Pro</strong></a>", 'wp-smushit' ), esc_url( 'https://premium.wpmudev.org/project/wp-smush-pro' ) );
182
+ }
183
+
184
+ echo '<div class="wp-smush-notice wp-smush-s3support-alert notice"><span class="notice-message">' . $message . '</span><i class="dev-icon dev-icon-cross"></i></div>';
185
+ }
186
+
187
+ /**
188
+ * Check if S3 support is required for Smush.
189
+ *
190
+ * @return bool
191
  */
192
+ function s3_support_required() {
193
+
194
+ global $wpsmush_settings, $wpsmushit_admin, $as3cf;
195
+
196
+ // Check if S3 offload plugin is active and delete file from server option is enabled.
197
+ if ( ! is_object( $as3cf ) || ! method_exists( $as3cf, 'get_setting' ) || ! $as3cf->get_setting( 'remove-local-file' ) ) {
198
+ return false;
199
  }
200
+
201
+ // If not Pro user or S3 support is disabled.
202
+ return ( ! $wpsmushit_admin->validate_install() || ! $wpsmush_settings->settings['s3'] );
203
  }
204
 
205
  /**
244
  */
245
  function download_file( $attachment_id, $size_details = array(), $uf_file_path = '' ) {
246
  global $WpSmush, $wpsmush_settings;
247
+ if ( empty( $attachment_id ) || ! $wpsmush_settings->settings['s3'] || ! $WpSmush->validate_install() ) {
248
  return false;
249
  }
250
 
350
  $s3client = $as3cf->get_s3client( $region );
351
 
352
  $file_exists = $s3client->doesObjectExist( $bucket, $s3_object['key'] );
353
+
354
  return $file_exists;
355
  }
356
 
423
  global $as3cf, $wpsmush_settings, $WpSmush;
424
 
425
  //Return if integration is disabled, or not a pro user
426
+ if ( ! $wpsmush_settings->settings['s3'] || ! $WpSmush->validate_install() ) {
427
  return $url;
428
  }
429
 
lib/class-wp-smush-settings.php CHANGED
@@ -3,7 +3,93 @@
3
  if ( ! class_exists( 'WpSmushSettings' ) ) {
4
  class WpSmushSettings {
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  function __construct() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  }
8
 
9
  /**
@@ -17,7 +103,7 @@ if ( ! class_exists( 'WpSmushSettings' ) ) {
17
  return false;
18
  }
19
 
20
- global $wpsmushit_admin, $wpsmush_settings;
21
 
22
  //Store that we need not redirect again on plugin activation
23
  update_site_option( 'wp-smush-hide_smush_welcome', true );
@@ -25,20 +111,34 @@ if ( ! class_exists( 'WpSmushSettings' ) ) {
25
  // var to temporarily assign the option value
26
  $setting = null;
27
 
28
- //Store Option Name and their values in an array
29
- $settings = array();
 
 
 
 
 
 
 
30
 
31
  //Save whether to use the settings networkwide or not ( Only if in network admin )
32
  if ( ! empty( $_POST['action'] ) && 'save_settings' == $_POST['action'] ) {
33
  if ( ! isset( $_POST['wp-smush-networkwide'] ) ) {
 
34
  //Save the option to disable nwtwork wide settings and return
35
  update_site_option( WP_SMUSH_PREFIX . 'networkwide', 0 );
36
  } else {
 
37
  //Save the option to disable nwtwork wide settings and return
38
  update_site_option( WP_SMUSH_PREFIX . 'networkwide', 1 );
39
  }
40
  }
41
 
 
 
 
 
 
42
  // process each setting and update options
43
  foreach ( $wpsmushit_admin->settings as $name => $text ) {
44
 
@@ -48,29 +148,40 @@ if ( ! class_exists( 'WpSmushSettings' ) ) {
48
  // get the value to be saved
49
  $setting = isset( $_POST[ $opt_name ] ) ? 1 : 0;
50
 
51
- $settings[ $opt_name ] = $setting;
52
 
53
  // update the new value
54
- $wpsmush_settings->update_setting( $opt_name, $setting );
55
 
56
  // unset the var for next loop
57
  unset( $setting );
58
  }
59
 
 
 
 
 
 
 
60
  //Save the selected image sizes
61
  $image_sizes = ! empty( $_POST['wp-smush-image_sizes'] ) ? $_POST['wp-smush-image_sizes'] : array();
62
  $image_sizes = array_filter( array_map( "sanitize_text_field", $image_sizes ) );
63
- $wpsmush_settings->update_setting( WP_SMUSH_PREFIX . 'image_sizes', $image_sizes );
64
 
65
  //Update Resize width and height settings if set
66
  $resize_sizes['width'] = isset( $_POST['wp-smush-resize_width'] ) ? intval( $_POST['wp-smush-resize_width'] ) : 0;
67
  $resize_sizes['height'] = isset( $_POST['wp-smush-resize_height'] ) ? intval( $_POST['wp-smush-resize_height'] ) : 0;
68
 
69
  // update the resize sizes
70
- $wpsmush_settings->update_setting( WP_SMUSH_PREFIX . 'resize_sizes', $resize_sizes );
71
 
72
  //Store the option in table
73
- $wpsmush_settings->update_setting( 'wp-smush-settings_updated', 1 );
 
 
 
 
 
74
 
75
  //Delete Show Resmush option
76
  if ( isset( $_POST['wp-smush-keep_exif'] ) && ! isset( $_POST['wp-smush-original'] ) && ! isset( $_POST['wp-smush-lossy'] ) ) {
@@ -89,13 +200,8 @@ if ( ! class_exists( 'WpSmushSettings' ) ) {
89
  return true;
90
  }
91
 
92
- //Check if the settings are network wide or site wise
93
- $networkwide = get_site_option( WP_SMUSH_PREFIX . 'networkwide', true );
94
- if ( $networkwide ) {
95
- return true;
96
- }
97
-
98
- return false;
99
  }
100
 
101
  /**
3
  if ( ! class_exists( 'WpSmushSettings' ) ) {
4
  class WpSmushSettings {
5
 
6
+ /**
7
+ * List of all the features enabled/disabled
8
+ *
9
+ * @var array
10
+ */
11
+ var $settings = array(
12
+ 'networkwide' => 0,
13
+ 'auto' => 1,
14
+ 'lossy' => 0,
15
+ 'original' => 0,
16
+ 'keep_exif' => 0,
17
+ 'resize' => 0,
18
+ 'backup' => 0,
19
+ 'png_to_jpg' => 0,
20
+ 'nextgen' => 0,
21
+ 's3' => 0
22
+ );
23
+
24
  function __construct() {
25
+
26
+ //Save Settings
27
+ add_action( 'wp_ajax_save_settings', array( $this, 'save_settings' ) );
28
+
29
+ $this->init_settings();
30
+ }
31
+
32
+ /**
33
+ * Initialize settings
34
+ *
35
+ * @return array|mixed
36
+ */
37
+ function init_settings() {
38
+
39
+ $last_settings = $this->get_setting( WP_SMUSH_PREFIX . 'last_settings', array() );
40
+ if( empty( $last_settings ) ) {
41
+ $last_settings = $this->get_serialised_settings();
42
+ }
43
+ $last_settings = maybe_unserialize( $last_settings );
44
+ //Merge with the existing settings
45
+ $this->settings = array_merge( $this->settings, $last_settings );
46
+ return $this->settings;
47
+
48
+ }
49
+
50
+ /**
51
+ * Save settings, Used for networkwide option
52
+ */
53
+ function save_settings() {
54
+ //Validate Ajax request
55
+ check_ajax_referer( 'save_wp_smush_options', 'nonce' );
56
+
57
+ //Save Settings
58
+ $this->process_options();
59
+ wp_send_json_success();
60
+
61
+ }
62
+
63
+ /**
64
+ * Returns a serialised string of current settings
65
+ *
66
+ * @return Serialised string of settings
67
+ *
68
+ */
69
+ function get_serialised_settings() {
70
+ $settings = array();
71
+ foreach ( $this->settings as $key => $val ) {
72
+ $settings[ $key ] = $this->get_setting( WP_SMUSH_PREFIX . $key );
73
+ }
74
+ $settings = maybe_serialize( $settings );
75
+
76
+ return $settings;
77
+ }
78
+
79
+ /**
80
+ * Stores the latest settings in serialised form in DB For the current settings
81
+ *
82
+ * No need to store the serialised settings, if network wide settings is disabled
83
+ * because the site would run the scan when settings are saved
84
+ *
85
+ */
86
+ function save_serialized_settings() {
87
+ //Return -> Single Site | If network settings page | Networkwide Settings Disabled
88
+ if ( ! is_multisite() || is_network_admin() || ! $this->settings['networkwide'] ) {
89
+ return;
90
+ }
91
+ $c_settings = $this->get_serialised_settings();
92
+ $this->update_setting( WP_SMUSH_PREFIX . 'last_settings', $c_settings );
93
  }
94
 
95
  /**
103
  return false;
104
  }
105
 
106
+ global $wpsmushit_admin;
107
 
108
  //Store that we need not redirect again on plugin activation
109
  update_site_option( 'wp-smush-hide_smush_welcome', true );
111
  // var to temporarily assign the option value
112
  $setting = null;
113
 
114
+ //Check the last settings stored in db
115
+ $settings = $this->get_setting( WP_SMUSH_PREFIX . 'last_settings', array() );
116
+
117
+ //If not saved earlier, get it from stored options
118
+ if ( empty( $settings ) || 0 == sizeof( $settings ) ) {
119
+ $settings = $this->get_serialised_settings();
120
+ }
121
+
122
+ $settings = !is_array( $settings ) ? maybe_unserialize( $settings ) : $settings ;
123
 
124
  //Save whether to use the settings networkwide or not ( Only if in network admin )
125
  if ( ! empty( $_POST['action'] ) && 'save_settings' == $_POST['action'] ) {
126
  if ( ! isset( $_POST['wp-smush-networkwide'] ) ) {
127
+ $settings['networkwide'] = 0;
128
  //Save the option to disable nwtwork wide settings and return
129
  update_site_option( WP_SMUSH_PREFIX . 'networkwide', 0 );
130
  } else {
131
+ $settings['networkwide'] = 1;
132
  //Save the option to disable nwtwork wide settings and return
133
  update_site_option( WP_SMUSH_PREFIX . 'networkwide', 1 );
134
  }
135
  }
136
 
137
+ // Delete S3 alert flag, if S3 option is disabled again.
138
+ if ( ! isset( $_POST['wp-smush-s3'] ) && isset( $this->settings['s3'] ) && $this->settings['s3'] ) {
139
+ delete_site_option( 'wp-smush-hide_s3support_alert' );
140
+ }
141
+
142
  // process each setting and update options
143
  foreach ( $wpsmushit_admin->settings as $name => $text ) {
144
 
148
  // get the value to be saved
149
  $setting = isset( $_POST[ $opt_name ] ) ? 1 : 0;
150
 
151
+ $settings[ $name ] = $setting;
152
 
153
  // update the new value
154
+ $this->update_setting( $opt_name, $setting );
155
 
156
  // unset the var for next loop
157
  unset( $setting );
158
  }
159
 
160
+ //Save serialised settings
161
+ $resp = $this->update_setting( WP_SMUSH_PREFIX . 'last_settings', $settings );
162
+
163
+ //Update initialised settings
164
+ $this->settings = $settings;
165
+
166
  //Save the selected image sizes
167
  $image_sizes = ! empty( $_POST['wp-smush-image_sizes'] ) ? $_POST['wp-smush-image_sizes'] : array();
168
  $image_sizes = array_filter( array_map( "sanitize_text_field", $image_sizes ) );
169
+ $this->update_setting( WP_SMUSH_PREFIX . 'image_sizes', $image_sizes );
170
 
171
  //Update Resize width and height settings if set
172
  $resize_sizes['width'] = isset( $_POST['wp-smush-resize_width'] ) ? intval( $_POST['wp-smush-resize_width'] ) : 0;
173
  $resize_sizes['height'] = isset( $_POST['wp-smush-resize_height'] ) ? intval( $_POST['wp-smush-resize_height'] ) : 0;
174
 
175
  // update the resize sizes
176
+ $this->update_setting( WP_SMUSH_PREFIX . 'resize_sizes', $resize_sizes );
177
 
178
  //Store the option in table
179
+ $this->update_setting( 'wp-smush-settings_updated', 1 );
180
+
181
+ if( $resp ) {
182
+ //Run a re-check on next page load
183
+ update_site_option( WP_SMUSH_PREFIX . 'run_recheck', 1 );
184
+ }
185
 
186
  //Delete Show Resmush option
187
  if ( isset( $_POST['wp-smush-keep_exif'] ) && ! isset( $_POST['wp-smush-original'] ) && ! isset( $_POST['wp-smush-lossy'] ) ) {
200
  return true;
201
  }
202
 
203
+ //Get directly from db
204
+ return get_site_option(WP_SMUSH_PREFIX . 'networkwide' );
 
 
 
 
 
205
  }
206
 
207
  /**
lib/class-wp-smush-share.php CHANGED
@@ -14,13 +14,14 @@ if ( ! class_exists( 'WpSmushShare' ) ) {
14
  function __construct() {}
15
 
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 %s%d%s images and saved %s%s%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(), '<span class="smush-share-image-count">', $savings['total_images'], '</span>', '<span class="smush-share-savings">', $savings['human'], '</span>' );
25
  $share_msg = sprintf( esc_html__( 'I saved %s%s%s on my site with WP Smush ( %s ) - wanna make your website light and faster?', "wp-smushit" ) , '<span class="smush-share-savings">', $savings['human'], '</span>', urlencode( "https://wordpress.org/plugins/wp-smushit/" ) ); ?>
26
  <section class="dev-box" id="wp-smush-share-widget">
14
  function __construct() {}
15
 
16
  function share_widget() {
17
+ global $WpSmush, $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
+
25
  $message = sprintf( esc_html__( "%s, you've smushed %s%d%s images and saved %s%s%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(), '<span class="smush-share-image-count">', $savings['total_images'], '</span>', '<span class="smush-share-savings">', $savings['human'], '</span>' );
26
  $share_msg = sprintf( esc_html__( 'I saved %s%s%s on my site with WP Smush ( %s ) - wanna make your website light and faster?', "wp-smushit" ) , '<span class="smush-share-savings">', $savings['human'], '</span>', urlencode( "https://wordpress.org/plugins/wp-smushit/" ) ); ?>
27
  <section class="dev-box" id="wp-smush-share-widget">
lib/class-wp-smush-ui.php CHANGED
@@ -19,6 +19,16 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
19
  */
20
  class WpSmushBulkUi {
21
 
 
 
 
 
 
 
 
 
 
 
22
  /**
23
  * Prints the Header Section for a container as per the Shared UI
24
  *
@@ -55,24 +65,67 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
55
  * Prints the content of WelCome Screen for New Installation
56
  * Dismissible by default
57
  */
58
- function welcome_screen() {
59
- global $WpSmush;
60
 
61
- //Header Of the Box
62
- $this->container_header( 'wp-smush-welcome', 'wp-smush-welcome-box', esc_html__( "WELCOME", "wp-smushit" ), '', true );
63
- //Settings Page heading
64
- $plugin_name = $WpSmush->validate_install() ? "WP Smush Pro" : "WP Smush";
65
- ?>
66
- <!-- Content -->
67
- <div class="box-content">
68
- <div class="row">
69
- <div class="wp-smush-welcome-content">
70
- <h4 class="roboto-condensed-regular"><?php esc_html_e( "OH YEAH, IT'S COMPRESSION TIME!", "wp-smushit" ); ?></h4>
71
- <p class="wp-smush-welcome-message roboto-medium"><?php printf( esc_html__( 'You\'ve just installed %3$s, the most popular image compression plugin for WordPress! %1$sChoose your desired settings%2$s and get smushing!', "wp-smushit" ), '<strong>', '</strong>', $plugin_name ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  </div>
73
- </div>
74
- </div><?php
75
- echo "</section>";
76
  }
77
 
78
  /**
@@ -112,44 +165,57 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
112
  *
113
  */
114
  function smush_stats_container() {
115
- global $WpSmush, $wpsmushit_admin, $wpsmush_db, $wpsmush_settings;
 
 
116
 
117
  $button = '<span class="spinner"></span><button tooltip="' . esc_html__( "Lets you check if any images can be further optimized. Useful after changing settings.", "wp-smushit" ) . '" class="wp-smush-title button button-grey button-small wp-smush-scan">' . esc_html__( "RE-CHECK IMAGES", "wp-smushit" ) . '</button>';
118
  $this->container_header( 'smush-stats-wrapper', 'wp-smush-stats-box', esc_html__( "STATS", "wp-smushit" ), $button );
119
- $dasharray = 125.663706144;
120
- $dash_offset = $wpsmushit_admin->total_count > 0 ? $dasharray - ( $dasharray * ( $wpsmushit_admin->smushed_count / $wpsmushit_admin->total_count) ) : $dasharray;
 
 
 
 
 
 
 
 
121
  $tooltip = $wpsmushit_admin->stats['total_images'] > 0 ? 'tooltip="' . sprintf( esc_html__("You've smushed %d images in total", "wp-smushit"), $wpsmushit_admin->stats['total_images'] ) . '"' : ''; ?>
122
  <div class="box-content">
123
  <div class="row smush-total-savings smush-total-reduction-percent">
124
 
125
- <div class="wp-smush-current-progress" >
126
- <div class="wp-smushed-progress">
127
- <div class="wp-smush-score inside">
128
- <div class="tooltip-box">
129
- <div class="wp-smush-optimisation-progress">
130
- <div class="wp-smush-progress-circle">
131
- <svg class="wp-smush-svg" xmlns="http://www.w3.org/2000/svg" width="50" height="50">
132
- <circle class="wp-smush-svg-circle" r="20" cx="25" cy="25" fill="transparent" stroke-dasharray="0" stroke-dashoffset="0"></circle>
133
- <!-- Stroke Dasharray is 2 PI r -->
134
- <circle class="wp-smush-svg-circle wp-smush-svg-circle-progress" r="20" cx="25" cy="25" fill="transparent" stroke-dasharray="<?php echo $dasharray; ?>" style="stroke-dashoffset: <?php echo $dash_offset; ?>px;"></circle>
135
- </svg>
136
- </div>
137
- </div>
138
- </div><!-- end tooltip-box -->
139
- </div>
140
- </div>
141
-
142
- <div class="wp-smush-count-total">
143
- <div class="wp-smush-smush-stats-wrapper">
144
- <span class="wp-smush-total-optimised"><?php echo $wpsmushit_admin->stats['total_images']; ?></span>
145
- </div>
146
- <span class="total-stats-label"><strong><?php esc_html_e( "IMAGES SMUSHED", "wp-smushit" ); ?></strong></span>
147
- </div>
148
- </div>
 
 
 
149
  </div>
150
  <hr />
151
  <div class="row wp-smush-savings">
152
- <span class="float-l wp-smush-stats-label"><strong><?php esc_html_e("TOTAL SAVINGS", "wp-smushit");?></strong></span>
153
  <span class="float-r wp-smush-stats">
154
  <span class="wp-smush-stats-human">
155
  <?php echo $wpsmushit_admin->stats['human'] > 0 ? $wpsmushit_admin->stats['human'] : "0MB"; ?>
@@ -165,40 +231,47 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
165
  $wpsmushit_admin->super_smushed = $wpsmush_db->super_smushed_count();?>
166
  <hr />
167
  <div class="row super-smush-attachments">
168
- <span class="float-l wp-smush-stats-label"><strong><?php esc_html_e( "ATTACHMENTS SUPER-SMUSHED", "wp-smushit" ); ?></strong></span>
169
- <span class="float-r wp-smush-stats<?php echo $WpSmush->lossy_enabled ? '' : ' wp-smush-lossy-disabled-wrap' ?>"><?php
170
  if ( $WpSmush->lossy_enabled ) {
171
- echo '<span class="smushed-count">' . intval( $wpsmushit_admin->super_smushed ) . '</span>/' . $wpsmushit_admin->total_count;
172
  } else {
173
  //Output a button/link to enable respective setting
174
- if( !is_multisite() || !get_site_option( WP_SMUSH_PREFIX . 'networkwide', 1 ) ) {
175
- //@todo:Print a link to settings page for network sites
176
- printf( esc_html__( "%sENABLE SUPER-SMUSH%s", "wp-smushit" ), '<button class="wp-smush-lossy-enable button button-small">', '</button>' );
177
  }else {
178
  $settings_link = $wpsmushit_admin->settings_link( array(), true );
179
- printf( esc_html__( "%sENABLE SUPER-SMUSH%s", "wp-smushit" ), '<a href="' . $settings_link .'" class="wp-smush-lossy-enable button button-small">', '</a>' );
180
  }
181
  } ?>
182
  </span>
183
  </div><?php
184
  } ?>
185
- <hr />
 
 
 
 
 
 
 
 
186
  <div class="row smush-resize-savings">
187
- <span class="float-l wp-smush-stats-label"><strong><?php esc_html_e( "RESIZE SAVINGS", "wp-smushit" ); ?></strong></span>
188
- <span class="float-r wp-smush-stats"><?php
189
  if( !empty( $wpsmushit_admin->stats['resize_savings'] ) && $wpsmushit_admin->stats['resize_savings'] > 0 ) {
190
  echo size_format( $wpsmushit_admin->stats['resize_savings'], 1 );
191
  }else{
192
- if( !$wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'resize' ) ) {
193
- //Output a button/link to enable respective setting
194
- if( !is_multisite() || !get_site_option( WP_SMUSH_PREFIX . 'networkwide', 1 ) ) {
195
- printf( esc_html__( "%sENABLE IMAGE RESIZING%s", "wp-smushit" ), '<button class="wp-smush-resize-enable button button-small">', '</button>' );
196
  }else {
197
  $settings_link = $wpsmushit_admin->settings_link( array(), true );
198
- printf( esc_html__( "%sENABLE IMAGE RESIZING%s", "wp-smushit" ), '<a href="' . $settings_link .'" class="wp-smush-lossy-enable button button-small">', '</a>' );
199
  }
200
  }else{
201
- printf( esc_html__( "%sNO RESIZE SAVINGS AVAILABLE%s", "wp-smushit" ), '<span class="total-stats-label"><strong>', '</strong></span>' );
202
  }
203
  } ?>
204
  </span>
@@ -207,7 +280,7 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
207
  if( $WpSmush->validate_install() && !empty( $wpsmushit_admin->stats['conversion_savings'] ) && $wpsmushit_admin->stats['conversion_savings'] > 0 ) { ?>
208
  <hr />
209
  <div class="row smush-conversion-savings">
210
- <span class="float-l wp-smush-stats-label"><strong><?php esc_html_e( "PNG TO JPEG SAVINGS", "wp-smushit" ); ?></strong></span>
211
  <span class="float-r wp-smush-stats"><?php echo $wpsmushit_admin->stats['conversion_savings'] > 0 ? size_format( $wpsmushit_admin->stats['conversion_savings'], 1 ) : "0MB"; ?></span>
212
  </div><?php
213
  }
@@ -265,13 +338,21 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
265
  //Content for the End of box container
266
  $div_end = $this->save_button( $configure_screen );
267
 
 
 
 
 
 
 
 
 
268
  //For Basic User, Show advanced settings in a separate box
269
  if ( ! $WpSmush->validate_install() ) {
270
  echo $div_end;
271
  do_action('wp_smush_before_advanced_settings');
272
  //Network settings wrapper
273
  if( is_multisite() && is_network_admin() ) {
274
- $class = get_site_option( WP_SMUSH_PREFIX . 'networkwide', 1 ) ? '' : ' hidden'; ?>
275
  <div class="network-settings-wrapper<?php echo $class; ?>"><?php
276
  }
277
  $upgrade_url = add_query_arg(
@@ -286,58 +367,75 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
286
 
287
  $this->container_header( 'wp-smush-premium', 'wp-smush-pro-settings-box', esc_html__( "ADVANCED SETTINGS", "wp-smushit" ), $pro_only, false ); ?>
288
  <div class="box-content"><?php
289
- }
290
 
291
- //Available advanced settings
292
- $pro_settings = array(
293
- 'lossy',
294
- 'original',
295
- 'backup',
296
- 'png_to_jpg'
297
- );
298
-
299
- $pro_settings = apply_filters( 'wp_smush_pro_settings', $pro_settings );
300
-
301
- if ( $WpSmush->validate_install() ) {
302
- echo "<hr />";
303
- }
304
 
305
- //Iterate Over all the available settings, and print a row for each of them
306
- foreach ( $pro_settings as $setting_key ) {
307
- if ( isset( $wpsmushit_admin->settings[ $setting_key ] ) ) {
308
- $setting_m_key = WP_SMUSH_PREFIX . $setting_key;
309
- $setting_val = $WpSmush->validate_install() ? $wpsmush_settings->get_setting( $setting_m_key, false ) : 0; ?>
310
- <div class='wp-smush-setting-row wp-smush-advanced'>
311
- <label class="inline-label" for="<?php echo $setting_m_key; ?>" tabindex="0">
312
- <span
313
- class="wp-smush-setting-label"><?php echo $wpsmushit_admin->settings[ $setting_key ]['label']; ?></span>
314
- <br/>
315
- <small class="smush-setting-description">
316
- <?php echo $wpsmushit_admin->settings[ $setting_key ]['desc']; ?>
317
- </small>
318
- </label>
319
- <span class="toggle float-r">
320
- <input type="checkbox" class="toggle-checkbox"
321
- id="<?php echo $setting_m_key; ?>" <?php checked( $setting_val, 1, true ); ?>
322
- value="1"
323
- name="<?php echo $setting_m_key; ?>" tabindex= "0">
324
- <label class="toggle-label" for="<?php echo $setting_m_key; ?>"></label>
325
- </span>
326
- <?php
327
- /**
328
- * Perform a action after setting row content
329
- */
330
- do_action('smush_setting_row_end', $setting_key );?>
331
- </div>
332
- <hr><?php
333
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  }
335
  //Output Form end and Submit button for pro version
336
  if ( $WpSmush->validate_install() ) {
337
  echo $div_end;
338
  } else {
339
- echo "</div><!-- Box Content -->
340
- </section><!-- Main Section -->";
 
341
  }
342
  //Close wrapper div
343
  if( is_multisite() && is_network_admin() && !$WpSmush->validate_install() ) {
@@ -346,156 +444,127 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
346
  }
347
 
348
  /**
349
- * Process and display the options form
 
 
 
 
 
350
  */
351
  function options_ui( $configure_screen = false ) {
352
- global $wpsmushit_admin, $wpsmush_settings;
353
- echo '<div class="box-container">
354
- <form id="wp-smush-settings-form" method="post">';
355
 
356
- //Get max. dimesnions
357
- $max_sizes = $wpsmushit_admin->get_max_image_dimensions();
358
 
359
- //Placeholder width and Height
360
- $p_width = $p_height = 2048;
361
 
362
  //Use settings networkwide,@uses get_site_option() and not get_option
363
  $opt_networkwide = WP_SMUSH_PREFIX . 'networkwide';
364
- $opt_networkwide_val = get_site_option( $opt_networkwide, true );
365
-
366
- //Smush auto key
367
- $opt_auto = WP_SMUSH_PREFIX . 'auto';
368
- //Auto value
369
- $opt_auto_val = $wpsmush_settings->get_setting( $opt_auto, false );
370
-
371
- //If value is not set for auto smushing set it to 1
372
- if ( $opt_auto_val === false ) {
373
- //default to checked
374
- $opt_auto_val = 1;
375
- }
376
-
377
- //Keep Exif
378
- $opt_keep_exif = WP_SMUSH_PREFIX . 'keep_exif';
379
- $opt_keep_exif_val = $wpsmush_settings->get_setting( $opt_keep_exif, false );
380
-
381
- //Resize images
382
- $opt_resize = WP_SMUSH_PREFIX . 'resize';
383
- $opt_resize_val = $wpsmush_settings->get_setting( $opt_resize, false );
384
-
385
- //Dimensions
386
- $resize_sizes = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'resize_sizes', array( 'width' => '', 'height' => '' ) );
387
-
388
- //Additional Image sizes
389
- $image_sizes = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'image_sizes', false );
390
- $sizes = $wpsmushit_admin->image_dimensions();
391
 
392
  //Option to enable/disable networkwide settings
393
  if( is_multisite() && is_network_admin() ) {
394
- $class = get_site_option( WP_SMUSH_PREFIX . 'networkwide', 1 ) ? '' : ' hidden'; ?>
395
  <!-- A tab index of 0 keeps the element in tab flow with other elements with an unspecified tab index which are still tabbable.) -->
396
  <div class='wp-smush-setting-row wp-smush-basic'>
397
- <label class="inline-label" for="<?php echo $opt_networkwide; ?>" tabindex="0">
398
- <span class="wp-smush-setting-label">
399
- <?php echo $wpsmushit_admin->settings['networkwide']['label']; ?>
400
- </span><br/>
401
- <small class="smush-setting-description">
402
- <?php echo $wpsmushit_admin->settings['networkwide']['desc']; ?>
403
- </small>
404
- </label>
405
- <span class="toggle float-r">
406
- <input type="checkbox" class="toggle-checkbox"
407
- id="<?php echo $opt_networkwide; ?>"
408
- name="<?php echo $opt_networkwide; ?>" <?php checked( $opt_networkwide_val, 1, true ); ?> value="1" tabindex="0">
409
- <label class="toggle-label" for="<?php echo $opt_networkwide; ?>"></label>
410
- </span>
 
 
 
 
 
 
 
 
 
411
  </div>
412
  <input type="hidden" name="setting-type" value="network">
413
- <hr />
414
  <div class="network-settings-wrapper<?php echo $class; ?>"><?php
415
  }
416
 
417
  //Do not print settings in network page if networkwide settings are disabled
418
- if( ! is_multisite() || ( ! get_site_option( WP_SMUSH_PREFIX . 'networkwide', 1 ) && !is_network_admin() ) || is_network_admin() ) { ?>
419
- <div class='wp-smush-setting-row wp-smush-basic'>
420
- <label class="inline-label" for="<?php echo $opt_auto; ?>" tabindex="0">
421
- <span class="wp-smush-setting-label">
422
- <?php echo $wpsmushit_admin->settings['auto']['label']; ?>
423
- </span><br/>
424
- <small class="smush-setting-description">
425
- <?php echo $wpsmushit_admin->settings['auto']['desc']; ?>
426
- </small>
427
- </label>
428
- <span class="toggle float-r">
429
- <input type="checkbox" class="toggle-checkbox"
430
- id="<?php echo $opt_auto; ?>"
431
- name="<?php echo $opt_auto; ?>" <?php checked( $opt_auto_val, 1, true ); ?> value="1" tabindex="0">
432
- <label class="toggle-label" for="<?php echo $opt_auto; ?>"></label>
433
- </span><?php
434
- if( !empty( $sizes ) ) { ?>
435
- <!-- List of image sizes recognised by WP Smush -->
436
- <div class="wp-smush-image-size-list">
437
- <p><?php esc_html_e("The following image sizes will be optimized by WP Smush:", "wp-smushit"); ?></p><?php
438
- foreach ( $sizes as $size_k => $size ) {
439
- //If image sizes array isn't set, mark all checked ( Default Values )
440
- if ( false === $image_sizes ) {
441
- $checked = true;
442
- }else{
443
- $checked = is_array( $image_sizes ) ? in_array( $size_k, $image_sizes ) : false;
444
- } ?>
445
- <label>
446
- <input type="checkbox" id="wp-smush-size-<?php echo $size_k; ?>" <?php checked( $checked, true ); ?> name="wp-smush-image_sizes[]" value="<?php echo $size_k; ?>"><?php
447
- if( isset( $size['width'], $size['height'] ) ) {
448
- echo $size_k . " (" . $size['width'] . "x" . $size['height'] . ") ";
449
- } ?>
450
- </label><?php
451
- } ?>
452
- </div><?php
453
- } ?>
454
- </div>
455
- <hr/>
456
- <div class='wp-smush-setting-row wp-smush-basic'>
457
- <label class="inline-label" for="<?php echo $opt_keep_exif; ?>" tabindex="0">
458
- <span class="wp-smush-setting-label"><?php echo $wpsmushit_admin->settings['keep_exif']['label']; ?></span>
459
- <br/>
460
- <small class="smush-setting-description">
461
- <?php echo $wpsmushit_admin->settings['keep_exif']['desc']; ?>
462
- </small>
463
- </label>
464
- <span class="toggle float-r">
465
- <input type="checkbox" class="toggle-checkbox"
466
- id="<?php echo $opt_keep_exif; ?>" <?php checked( $opt_keep_exif_val, 1, true ); ?>
467
- value="1" name="<?php echo $opt_keep_exif; ?>" tabindex="0">
468
- <label class="toggle-label" for="<?php echo $opt_keep_exif; ?>"></label>
469
- </span>
470
- </div>
471
- <hr/>
472
- <div class='wp-smush-setting-row wp-smush-basic'>
473
- <label class="inline-label" for="<?php echo $opt_resize; ?>" tabindex="0">
474
- <span class="wp-smush-setting-label"><?php echo $wpsmushit_admin->settings['resize']['label']; ?></span>
475
- <br/>
476
- <small class="smush-setting-description">
477
- <?php echo $wpsmushit_admin->settings['resize']['desc']; ?>
478
- </small>
479
- </label>
480
- <span class="toggle float-r">
481
- <input type="checkbox" class="toggle-checkbox"
482
- id="<?php echo $opt_resize; ?>" <?php echo $resize_checked = checked( $opt_resize_val, 1, false ); ?>
483
- value="1" name="<?php echo $opt_resize; ?>" tabindex="0">
484
- <label class="toggle-label" for="<?php echo $opt_resize; ?>"></label>
485
- </span>
486
- <div class="wp-smush-resize-settings-wrap<?php echo $resize_checked ? '' : ' hidden'?>">
487
- <label for="<?php echo $opt_resize . '_width'; ?>"><?php esc_html_e("Max width", "wp-smushit"); ?>
488
- <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
489
- </label>
490
- <label for"<?php echo $opt_resize . '_height'; ?>"><?php esc_html_e("Max height", "wp-smushit"); ?>
491
- <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
492
- </label>
493
- <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>
494
- <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>
495
- <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>
496
- </div>
497
- </div><!-- End of Basic Settings --><?php
498
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
499
  do_action( 'wp_smush_after_basic_settings' );
500
  $this->advanced_settings( $configure_screen );
501
  } else{
@@ -511,7 +580,7 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
511
  */
512
  function ui() {
513
 
514
- global $WpSmush, $wpsmushit_admin;
515
 
516
  if( !$WpSmush->validate_install() ) {
517
  //Reset Transient
@@ -523,9 +592,9 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
523
 
524
  if( !$is_network ) {
525
  //Show Configure screen for only a new installation and for only network admins
526
- if ( ( 1 != get_site_option( 'wp-smush-hide_smush_welcome' ) && 1 != get_option( 'wp-smush-hide_smush_welcome' ) ) && 1 != get_option( 'hide_smush_features' ) && 0 >= $wpsmushit_admin->smushed_count && is_super_admin() ) {
527
- echo '<div class="block float-l smush-welcome-wrapper">';
528
- $this->welcome_screen();
529
  echo '</div>';
530
  } ?>
531
 
@@ -533,7 +602,13 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
533
  <div class="wp-smushit-container-left col-half float-l"><?php
534
  //Bulk Smush Container
535
  $this->bulk_smush_container();
536
- ?>
 
 
 
 
 
 
537
  </div>
538
 
539
  <!-- Stats -->
@@ -547,14 +622,14 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
547
  */
548
  do_action( 'wp_smush_after_stats_box' );
549
  } ?>
550
- </div><!-- End Of Smushit Container right -->
551
-
552
- <!-- Stats Share Widget -->
553
- <div class="row"><?php
554
- global $wpsmush_share;
555
- $wpsmush_share->share_widget(); ?>
556
- </div>
557
- <?php
558
  //End of "!is_network()' check
559
  }?>
560
 
@@ -562,7 +637,7 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
562
  <div class="row"><?php
563
  wp_nonce_field( 'save_wp_smush_options', 'wp_smush_options_nonce', '', true );
564
  //Check if a network site and networkwide settings is enabled
565
- if( ! is_multisite() || ( is_multisite() && ! get_site_option( WP_SMUSH_PREFIX . 'networkwide', true ) ) || ( is_multisite() && is_network_admin() ) ) {
566
  $this->settings_ui();
567
  }
568
 
@@ -597,7 +672,7 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
597
  );
598
  ?>
599
  <div class="box-content">
600
- <p class="wp-smush-promo-content wp-smush-promo-content-2 roboto-medium">Create amazing websites, automate your workflow, and run your business like a well-oiled machine.
601
  Get access to the tools that will win you more clients and help you spend less time working.
602
  Start a free WPMU DEV trial today.</p>
603
  <span class="wp-smush-pro-cta tc">
@@ -622,11 +697,11 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
622
  <img src="<?php echo WP_SMUSH_URL . 'assets/images/hummingbird.png'; ?>"
623
  alt="<?php esc_html_e( "BOOST YOUR PERFORMANCE - HUMMINGBIRD", "wp-smushit" ); ?>">
624
  </span>
625
- <p class="wp-smush-promo-content tc roboto-medium">Hummingbird goes beyond Smush compression with
626
  minification, caching, performance monitoring and more - every millisecond counts!</p>
627
  <span class="wp-smush-hb-cta tc roboto-medium">
628
  <a href="<?php echo esc_url( "https://premium.wpmudev.org/project/wp-hummingbird/" ); ?>"
629
- class="button button-cta button-yellow" target="_blank">TRY HUMMINGBIRD FOR FREE</a>
630
  </span>
631
  </div><?php
632
  echo "</section>";
@@ -637,11 +712,22 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
637
  */
638
  function bulk_smush_content() {
639
 
640
- global $WpSmush, $wpsmushit_admin;
641
 
642
  $all_done = ( $wpsmushit_admin->smushed_count == $wpsmushit_admin->total_count ) && 0 == count( $wpsmushit_admin->resmush_ids );
643
 
644
  echo $this->bulk_resmush_content();
 
 
 
 
 
 
 
 
 
 
 
645
 
646
  //If there are no images in Media Library
647
  if ( 0 >= $wpsmushit_admin->total_count ) { ?>
@@ -658,11 +744,30 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
658
  <!-- Hide All done div if there are images pending -->
659
  <div class="wp-smush-notice wp-smush-all-done<?php echo $all_done ? '' : ' hidden' ?>" tabindex="0">
660
  <i class="dev-icon dev-icon-tick"></i><?php esc_html_e( "All images are smushed and up to date. Awesome!", "wp-smushit" ); ?>
661
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
662
  <div class="wp-smush-bulk-wrapper <?php echo $all_done ? ' hidden' : ''; ?>"><?php
663
  //If all the images in media library are smushed
664
  //Button Text
665
- $button_content = esc_html__( "BULK SMUSH NOW", "wp-smushit" );
666
 
667
  //Show the notice only if there are remaining images and if we aren't showing a notice for resmush
668
  if ( $wpsmushit_admin->remaining_count > 0 ) {
@@ -677,9 +782,7 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
677
  );
678
  ?>
679
  <div class="wp-smush-notice wp-smush-remaining<?php echo $class; ?>" tabindex="0">
680
- <i class="dev-icon">
681
- <img src="<?php echo WP_SMUSH_URL . 'assets/images/icon-gzip.svg'; ?>" width="14px">
682
- </i>
683
  <span class="wp-smush-notice-text"><?php
684
  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>' );
685
  if( !$WpSmush->validate_install() && $wpsmushit_admin->remaining_count > 50 ) {
@@ -689,14 +792,13 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
689
  </span>
690
  </div><?php
691
  } ?>
692
- <hr>
693
- <button type="button" class="wp-smush-all wp-smush-button"><?php echo $button_content; ?></button><?php
694
- //Enable Super Smush
695
- if ( $WpSmush->validate_install() && ! $WpSmush->lossy_enabled ) { ?>
696
- <p class="wp-smush-enable-lossy"><?php esc_html_e( "Enable Super-smush in the Settings area to get even more savings with almost no noticeable quality loss.", "wp-smushit" ); ?></p><?php
697
- } ?>
698
  </div><?php
699
  $this->progress_bar( $wpsmushit_admin );
 
 
 
 
700
  $this->super_smush_promo();
701
  }
702
  }
@@ -709,29 +811,31 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
709
  //If we have resmush list, smushed_count = totalcount - resmush count, else smushed_count
710
  // $smushed_count = ( $resmush_count = count( $count->resmush_ids ) ) > 0 ? ( $count->total_count - ( $count->remaining_count + $resmush_count ) ) : $count->smushed_count;
711
  // calculate %ages, avoid divide by zero error with no attachments
 
712
  if ( $count->total_count > 0 && $count->smushed_count > 0 ) {
713
  $smushed_pc = $count->smushed_count / $count->total_count * 100;
714
  } else {
715
  $smushed_pc = 0;
716
- } ?>
 
717
  <div class="wp-smush-bulk-progress-bar-wrapper hidden">
718
- <p class="wp-smush-bulk-active roboto-medium"><span
719
- class="spinner is-active"></span><?php printf( esc_html__( "%sBulk smush is currently running.%s You need to keep this page open for the process to complete.", "wp-smushit" ), '<strong>', '</strong>' ); ?>
720
- </p>
721
  <div class="wp-smush-progress-wrap">
 
722
  <div class="wp-smush-progress-bar-wrap">
723
  <div class="wp-smush-progress-bar">
724
  <div class="wp-smush-progress-inner" style="width: <?php echo $smushed_pc; ?>%;">
725
  </div>
726
  </div>
727
  </div>
728
- <div class="wp-smush-count tc">
729
- <?php printf( esc_html__( "%s%d%s of your media attachments have been smushed." ), '<span class="wp-smush-images-percent">', $smushed_pc, '</span>%' ); ?>
730
- </div>
731
  </div>
732
- <hr class="wp-smush-sep">
733
- <button type="button"
734
- class="button button-grey wp-smush-cancel-bulk"><?php esc_html_e( "CANCEL", "wp-smushit" ); ?></button>
 
 
 
 
735
  </div>
736
  <div class="smush-final-log notice notice-warning inline hidden"></div><?php
737
  }
@@ -766,7 +870,7 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
766
  //Show only if we have any images to ber resmushed
767
  if ( $show ) {
768
  return '<div class="wp-smush-notice wp-smush-resmush-notice wp-smush-remaining" tabindex="0">
769
- <i class="dev-icon"><img src="' . WP_SMUSH_URL . 'assets/images/icon-gzip.svg" width="14px"></i>
770
  <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>
771
  <button class="button button-grey button-small wp-smush-skip-resmush">' . esc_html__( "Skip", "wp-smushit" ) . '</button>
772
  </div>';
@@ -780,7 +884,7 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
780
  global $wpsmushit_admin, $wpsmush_settings;
781
 
782
  //Check if Networkwide settings are enabled, Do not show settings updated message
783
- if( is_multisite() && get_site_option( WP_SMUSH_PREFIX . 'networkwide', 1 ) && !is_network_admin() ) {
784
  return;
785
  }
786
 
@@ -810,7 +914,8 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
810
  * Prints out the page header for Bulk Smush Page
811
  */
812
  function smush_page_header() {
813
- global $WpSmush, $wpsmushit_admin;
 
814
  //Include Shared UI
815
  require_once WP_SMUSH_DIR . 'assets/shared-ui/plugin-ui.php';
816
 
@@ -842,6 +947,11 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
842
  //Check if settings were updated and shoe a notice
843
  $this->settings_updated();
844
 
 
 
 
 
 
845
  echo '<div class="row wp-smushit-container-wrap">';
846
  }
847
 
@@ -861,12 +971,12 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
861
 
862
  if ( 'new' == $install_type ) {
863
  $notice_heading = esc_html__( "Thanks for installing Smush. We hope you like it!", "wp-smushit" );
864
- $notice_content = esc_html__( "And hey, if you do, you can now try out Smush Pro for double the smushy goodness (benchmarked), entirely for free!", "wp-smushit" );
865
- $button_content = esc_html__( "Try Smush Pro for Free", "wp-smushit" );
866
  } else {
867
- $notice_heading = esc_html__( "Thanks for updating Smush. Did you know that you can now try the Smush Pro for FREE?!", "wp-smushit" );
868
- $notice_content = '<br />' . esc_html__( "Yep, Super Smush your images for double the savings, save originals and batch Smush thousands of images all at once.... no charge!", "wp-smushit" );
869
- $button_content = esc_html__( "Try Smush Pro for Free", "wp-smushit" );
870
  }
871
  $upgrade_url = add_query_arg(
872
  array(
@@ -900,6 +1010,32 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
900
  * Super Smush promo content
901
  */
902
  function super_smush_promo() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
903
  global $WpSmush, $wpsmushit_admin;
904
  if ( $WpSmush->validate_install() ) {
905
  return;
@@ -914,7 +1050,7 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
914
  ); ?>
915
  <div class="wp-smush-super-smush-promo">
916
  <div class="wp-smush-super-smush-content"><?php
917
- printf( esc_html__("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", "wp-smushit"), '<a href="' . esc_url( $upgrade_url ). '" target="_blank" title="' . esc_html__("Try WP Smush Pro for FREE", "wp-smushit") . '">', '</a>' ); ?>
918
  </div>
919
  </div>
920
  <?php
@@ -939,7 +1075,7 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
939
  $wpmu_contact = sprintf( '<a href="%s" target="_blank">', esc_url("https://premium.wpmudev.org/contact") );
940
  $attr_message = esc_html__("Validating..", "wp-smushit");
941
  $recheck_link = '<a href="#" id="wp-smush-revalidate-member" data-message="%s">';
942
- $message = sprintf( esc_html__( "It looks like Smush couldn’t verify your WPMU DEV membership so Pro features like Super-Smush may not work correctly. If you think this is an error, run a %sre-check%s or get in touch with our %ssupport team%s.", "wp-smushit"), $recheck_link, '</a>', $wpmu_contact, '</a>' ) ;
943
  $content = sprintf( '<div id="wp-smush-invalid-member" data-message="%s" class="hidden' . $notice_class . '"><div class="message">%s</div></div>', $attr_message, $message );
944
  return $content;
945
  }
@@ -959,11 +1095,12 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
959
  }
960
 
961
  $div_end .=
962
- '<div class="wp-smush-submit-wrap">
963
  <input type="submit" id="wp-smush-save-settings" class="button button-grey"
964
  value="' . esc_html__( 'UPDATE SETTINGS', 'wp-smushit' ) . '">
965
  <span class="spinner"></span>
966
- </div>
 
967
  </form>';
968
 
969
  //For Configuration screen we need to show the advanced settings in single box
@@ -975,25 +1112,163 @@ if ( ! class_exists( 'WpSmushBulkUi' ) ) {
975
  }
976
 
977
  function get_recheck_message() {
 
978
  //Return if not multisite, or on network settings page, Netowrkwide settings is disabled
979
- if( ! is_multisite() || is_network_admin() || ! get_site_option( WP_SMUSH_PREFIX . 'networkwide' ) ) {
980
  return;
981
  }
982
- global $wpsmush_settings, $wpsmushit_admin;
983
 
984
  //Check the last settings stored in db
985
- $settings = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'last_settings', '' );
986
-
987
- //Get current settings
988
- $c_settings = $wpsmushit_admin->get_serialised_settings();
989
 
990
  //If not same, Display notice
991
- if( $settings == $c_settings ) {
992
  return;
993
  }
994
  $message = '<div class="wp-smush-notice wp-smush-re-check-message">' . esc_html__( "Smush settings were updated, performing a quick scan to check if any of the images need to be Smushed again.", "wp-smushit") . '<i class="dev-icon dev-icon-cross"></i></div>';
995
 
996
  return $message;
997
  }
998
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
999
  }
19
  */
20
  class WpSmushBulkUi {
21
 
22
+ public $setting_group = array(
23
+ 'resize',
24
+ 'original',
25
+ 'backup'
26
+ );
27
+
28
+ function __construct() {
29
+ add_action('smush_setting_column_right_end', array( $this, 'full_size_options' ), '', 2 );
30
+ }
31
+
32
  /**
33
  * Prints the Header Section for a container as per the Shared UI
34
  *
65
  * Prints the content of WelCome Screen for New Installation
66
  * Dismissible by default
67
  */
68
+ function quick_setup() {
69
+ global $WpSmush, $wpsmushit_admin, $wpsmush_settings;
70
 
71
+ //Header Of the Box ?>
72
+ <dialog id="smush-quick-setup" title="<?php esc_html_e( "QUICK SETUP", "wp-smushit" ); ?>" class="small">
73
+ <p class="wp-smush-welcome-message end"><?php esc_html_e( 'Welcome to Smush - Winner of Torque Plugin Madness 2017! Let\'s quickly set up the basics for you, then you can fine tweak each setting as you go - our recommendations are on by default.', "wp-smushit" ); ?></p>
74
+ <div class="smush-quick-setup-settings">
75
+ <form method="post">
76
+ <input type="hidden" value="setupSmush" name="action"/><?php
77
+ wp_nonce_field( 'setupSmush' );
78
+ $exclude = array(
79
+ 'backup',
80
+ 'png_to_jpg',
81
+ 'nextgen',
82
+ 's3'
83
+ );
84
+ //Settings for free and pro version
85
+ foreach( $wpsmushit_admin->settings as $name => $values ) {
86
+ //Skip networkwide settings, we already printed it
87
+ if( 'networkwide' == $name ) {
88
+ continue;
89
+ }
90
+ //Skip premium features if not a member
91
+ if( !in_array( $name, $wpsmushit_admin->basic_features ) && !$WpSmush->validate_install() ) {
92
+ continue;
93
+ }
94
+ //Do not output settings listed in exclude array list
95
+ if( in_array($name, $exclude ) ) {
96
+ continue;
97
+ }
98
+ $setting_m_key = WP_SMUSH_PREFIX . $name;
99
+ $setting_val = $WpSmush->validate_install() ? $wpsmush_settings->get_setting( $setting_m_key, false ) : false;
100
+ //Set the default value 1 for auto smush
101
+ if( 'auto' == $name && false === $setting_val ) {
102
+ $setting_val = 1;
103
+ } ?>
104
+ <div class='wp-smush-setting-row wp-smush-basic'>
105
+ <label class="inline-label" for="<?php echo $setting_m_key; ?>" tabindex="0">
106
+ <span class="wp-smush-setting-label"><?php echo $wpsmushit_admin->settings[ $name ]['label']; ?></span><br/>
107
+ <small class="smush-setting-description">
108
+ <?php echo $wpsmushit_admin->settings[ $name ]['desc']; ?>
109
+ </small>
110
+ <?php $this->resize_settings($name ); ?>
111
+ </label>
112
+ <span class="toggle float-r">
113
+ <input type="checkbox" class="toggle-checkbox"
114
+ id="<?php echo $setting_m_key . '-quick-setup'; ?>"
115
+ name="smush_settings[]" <?php checked( $setting_val, 1, true ); ?> value="<?php echo $setting_m_key; ?>" tabindex="0">
116
+ <label class="toggle-label" for="<?php echo $setting_m_key . '-quick-setup'; ?>"></label>
117
+ </span>
118
+ </div><?php
119
+ }
120
+ ?>
121
+ <div class="columns last">
122
+ <div class="column is-3 tr submit-button-wrap">
123
+ <button type="submit" class="button"><?php _e( "Get Started", "wp-smushit" ) ?></button>
124
+ </div>
125
+ </div>
126
+ </form>
127
  </div>
128
+ </dialog><?php
 
 
129
  }
130
 
131
  /**
165
  *
166
  */
167
  function smush_stats_container() {
168
+ global $WpSmush, $wpsmushit_admin, $wpsmush_db, $wpsmush_settings, $wpsmush_dir;
169
+
170
+ $settings = $wpsmush_settings->settings;
171
 
172
  $button = '<span class="spinner"></span><button tooltip="' . esc_html__( "Lets you check if any images can be further optimized. Useful after changing settings.", "wp-smushit" ) . '" class="wp-smush-title button button-grey button-small wp-smush-scan">' . esc_html__( "RE-CHECK IMAGES", "wp-smushit" ) . '</button>';
173
  $this->container_header( 'smush-stats-wrapper', 'wp-smush-stats-box', esc_html__( "STATS", "wp-smushit" ), $button );
174
+
175
+ $resize_count = $wpsmush_db->resize_savings( false, false, true );
176
+ $resize_count = !$resize_count ? 0 : $resize_count;
177
+
178
+ $compression_savings = 0;
179
+
180
+ if( !empty( $wpsmushit_admin->stats ) && !empty( $wpsmushit_admin->stats['bytes'] ) ) {
181
+ $compression_savings = $wpsmushit_admin->stats['bytes'] - $wpsmushit_admin->stats['resize_savings'];
182
+ }
183
+
184
  $tooltip = $wpsmushit_admin->stats['total_images'] > 0 ? 'tooltip="' . sprintf( esc_html__("You've smushed %d images in total", "wp-smushit"), $wpsmushit_admin->stats['total_images'] ) . '"' : ''; ?>
185
  <div class="box-content">
186
  <div class="row smush-total-savings smush-total-reduction-percent">
187
 
188
+ <div class="wp-smush-current-progress" >
189
+ <!-- Total Images Smushed -->
190
+ <div class="wp-smush-count-total">
191
+ <div class="wp-smush-smush-stats-wrapper">
192
+ <span class="wp-smush-total-optimised"><?php echo $wpsmushit_admin->stats['total_images']; ?></span>
193
+ </div>
194
+ <span class="total-stats-label"><?php esc_html_e( "Images smushed", "wp-smushit" ); ?></span>
195
+ </div>
196
+ <!-- Attachments And Resized Images -->
197
+ <div class="wp-smush-stats-other">
198
+ <!-- Attachment count -->
199
+ <div class="wp-smush-count-attachment-total">
200
+ <div class="wp-smush-smush-stats-wrapper">
201
+ <span class="wp-smush-total-optimised"><?php echo $wpsmushit_admin->smushed_count; ?></span>
202
+ </div>
203
+ <span class="total-stats-label"><?php esc_html_e( "Attachments smushed", "wp-smushit" ); ?></span>
204
+ </div>
205
+ <!-- Resized Image count -->
206
+ <div class="wp-smush-count-resize-total">
207
+ <div class="wp-smush-smush-stats-wrapper">
208
+ <span class="wp-smush-total-optimised"><?php echo $resize_count; ?></span>
209
+ </div>
210
+ <span class="total-stats-label"><?php esc_html_e( "Images resized", "wp-smushit" ); ?></span>
211
+ </div>
212
+ </div>
213
+
214
+ </div>
215
  </div>
216
  <hr />
217
  <div class="row wp-smush-savings">
218
+ <span class="float-l wp-smush-stats-label"><?php esc_html_e("Total savings", "wp-smushit");?></span>
219
  <span class="float-r wp-smush-stats">
220
  <span class="wp-smush-stats-human">
221
  <?php echo $wpsmushit_admin->stats['human'] > 0 ? $wpsmushit_admin->stats['human'] : "0MB"; ?>
231
  $wpsmushit_admin->super_smushed = $wpsmush_db->super_smushed_count();?>
232
  <hr />
233
  <div class="row super-smush-attachments">
234
+ <span class="float-l wp-smush-stats-label"><strong><?php esc_html_e( "Super-smushed savings", "wp-smushit" ); ?></strong></span>
235
+ <span class="wp-smush-stats<?php echo $WpSmush->lossy_enabled ? ' float-r' : ' float-l wp-smush-lossy-disabled-wrap' ?>"><?php
236
  if ( $WpSmush->lossy_enabled ) {
237
+ echo '<span class="smushed-savings">' . size_format( $compression_savings, 1 ) . '</span>';
238
  } else {
239
  //Output a button/link to enable respective setting
240
+ if( !is_multisite() || !$settings['networkwide'] ) {
241
+ printf( esc_html__( "Compress images up to 2x more than regular smush with almost no visible drop in quality. %sEnable Super-smush%s", "wp-smushit" ), '<a class="wp-smush-lossy-enable" href="#">', '</a>' );
 
242
  }else {
243
  $settings_link = $wpsmushit_admin->settings_link( array(), true );
244
+ printf( esc_html__( "Compress images up to 2x more than regular smush with almost no visible drop in quality. %sEnable Super-smush%s", "wp-smushit" ), '<a class="wp-smush-lossy-enable-network" href="'. $settings_link .'">', '</a>' );
245
  }
246
  } ?>
247
  </span>
248
  </div><?php
249
  } ?>
250
+ <hr /><?php
251
+ if( !$settings['resize'] ) {
252
+ $class = ' settings-desc float-l';
253
+ }elseif ( empty( $wpsmushit_admin->stats['resize_savings'] ) ) {
254
+ $class = ' settings-desc float-r';
255
+ }else{
256
+ $class = ' float-r';
257
+ }
258
+ ?>
259
  <div class="row smush-resize-savings">
260
+ <span class="float-l wp-smush-stats-label"><strong><?php esc_html_e( "Resize savings", "wp-smushit" ); ?></strong></span>
261
+ <span class="wp-smush-stats<?php echo $class; ?>"><?php
262
  if( !empty( $wpsmushit_admin->stats['resize_savings'] ) && $wpsmushit_admin->stats['resize_savings'] > 0 ) {
263
  echo size_format( $wpsmushit_admin->stats['resize_savings'], 1 );
264
  }else{
265
+ if( !$settings['resize'] ) {
266
+ //Output a button/link to enable respective setting
267
+ if( !is_multisite() || !$settings['networkwide'] ) {
268
+ printf( esc_html__( "Save storage space by resizing your full sized uploads down to a maximum size. %sEnable image resizing%s", "wp-smushit" ), '<a class="wp-smush-resize-enable" href="#">', '</a>' );
269
  }else {
270
  $settings_link = $wpsmushit_admin->settings_link( array(), true );
271
+ printf( esc_html__( "Save storage space by resizing your full sized uploads down to a maximum size. %sEnable image resizing%s", "wp-smushit" ), '<a href="' . $settings_link .'" class="wp-smush-resize-enable">', '</a>' );
272
  }
273
  }else{
274
+ printf( esc_html__( "No resize savings available", "wp-smushit" ), '<span class="total-stats-label"><strong>', '</strong></span>' );
275
  }
276
  } ?>
277
  </span>
280
  if( $WpSmush->validate_install() && !empty( $wpsmushit_admin->stats['conversion_savings'] ) && $wpsmushit_admin->stats['conversion_savings'] > 0 ) { ?>
281
  <hr />
282
  <div class="row smush-conversion-savings">
283
+ <span class="float-l wp-smush-stats-label"><strong><?php esc_html_e( "PNG to JPEG savings", "wp-smushit" ); ?></strong></span>
284
  <span class="float-r wp-smush-stats"><?php echo $wpsmushit_admin->stats['conversion_savings'] > 0 ? size_format( $wpsmushit_admin->stats['conversion_savings'], 1 ) : "0MB"; ?></span>
285
  </div><?php
286
  }
338
  //Content for the End of box container
339
  $div_end = $this->save_button( $configure_screen );
340
 
341
+ //Available advanced settings
342
+ $pro_settings = array(
343
+ 'lossy',
344
+ 'original',
345
+ 'backup',
346
+ 'png_to_jpg'
347
+ );
348
+
349
  //For Basic User, Show advanced settings in a separate box
350
  if ( ! $WpSmush->validate_install() ) {
351
  echo $div_end;
352
  do_action('wp_smush_before_advanced_settings');
353
  //Network settings wrapper
354
  if( is_multisite() && is_network_admin() ) {
355
+ $class = $wpsmush_settings->settings['networkwide'] ? '' : ' hidden'; ?>
356
  <div class="network-settings-wrapper<?php echo $class; ?>"><?php
357
  }
358
  $upgrade_url = add_query_arg(
367
 
368
  $this->container_header( 'wp-smush-premium', 'wp-smush-pro-settings-box', esc_html__( "ADVANCED SETTINGS", "wp-smushit" ), $pro_only, false ); ?>
369
  <div class="box-content"><?php
 
370
 
371
+ $pro_settings = apply_filters( 'wp_smush_pro_settings', $pro_settings );
372
+ //Iterate Over all the available settings, and print a row for each of them
373
+ foreach ( $pro_settings as $setting_key ) {
374
+ //Output the Full size setting option only once
375
+ if( in_array( $setting_key, $this->setting_group ) ) {
376
+ if( ( 'original' != $setting_key ) ) {
377
+ continue;
378
+ }
379
+ }
 
 
 
 
380
 
381
+ if ( isset( $wpsmushit_admin->settings[ $setting_key ] ) ) {
382
+ $setting_m_key = WP_SMUSH_PREFIX . $setting_key;
383
+ $label = !empty( $wpsmushit_admin->settings[ $setting_key ]['short_label'] ) ? $wpsmushit_admin->settings[ $setting_key ]['short_label'] : $wpsmushit_admin->settings[ $setting_key ]['label'];
384
+ $setting_val = $WpSmush->validate_install() ? $wpsmush_settings->get_setting( $setting_m_key, false ) : 0;?>
385
+ <div class='wp-smush-setting-row wp-smush-advanced'>
386
+ <div class="column column-left">
387
+ <label class="inline-label" for="<?php echo $setting_m_key; ?>" tabindex="0">
388
+ <span class="wp-smush-setting-label"><?php echo $label; ?></span>
389
+ <br/>
390
+ <small class="smush-setting-description"><?php
391
+ if( 'original' != $setting_key ) {
392
+ echo $wpsmushit_admin->settings[ $setting_key ]['desc'];
393
+ }else{
394
+ esc_html_e("By default, Smush only compresses your cropped image sizes, not your original full-size images.", "wp-smushit");
395
+ }
396
+ ?>
397
+ </small>
398
+ </label>
399
+ </div>
400
+ <div class="column column-right"><?php
401
+ //Do not print for Resize, Smush Original, Backup
402
+ if( !in_array( $setting_key, $this->setting_group ) ) { ?>
403
+ <span class="toggle float-l">
404
+ <input type="checkbox" class="toggle-checkbox"
405
+ id="<?php echo $setting_m_key; ?>" <?php checked( $setting_val, 1, true ); ?>
406
+ value="1"
407
+ name="<?php echo $setting_m_key; ?>" tabindex= "0">
408
+ <label class="toggle-label <?php echo $setting_m_key . '-label'; ?>" for="<?php echo $setting_m_key; ?>"></label>
409
+ </span>
410
+ <div class="column-right-content">
411
+ <label class="inline-label" for="<?php echo $setting_m_key; ?>" tabindex="0">
412
+ <span class="wp-smush-setting-label"><?php echo $wpsmushit_admin->settings[ $setting_key ]['label']; ?></span><br/><?php
413
+ $this->settings_desc( $setting_key );
414
+ do_action('smush_setting_label_end', $setting_key);
415
+ ?>
416
+ </label>
417
+ </div><?php
418
+ }
419
+ do_action( 'smush_setting_column_right_end', $setting_key, 'advanced' );
420
+ ?>
421
+
422
+ </div>
423
+ <?php
424
+ /**
425
+ * Perform a action after setting row content
426
+ */
427
+ do_action('smush_setting_row_end', $setting_key );?>
428
+ </div><?php
429
+ }
430
+ }
431
  }
432
  //Output Form end and Submit button for pro version
433
  if ( $WpSmush->validate_install() ) {
434
  echo $div_end;
435
  } else {
436
+ echo "</div><!-- Box Content -->";
437
+ $this->super_smush_promo_post_settings();
438
+ echo "</section><!-- Main Section -->";
439
  }
440
  //Close wrapper div
441
  if( is_multisite() && is_network_admin() && !$WpSmush->validate_install() ) {
444
  }
445
 
446
  /**
447
+ * Process and display the Settings
448
+ * Since Free and Pro version have different sequence of settings, we've a separate method advanced_settings(),
449
+ * Which prints out pro settings fro free version, otherwise all settings are printed via the current function
450
+ *
451
+ * To print Full size smush, resize and backup in group, we hook at `smush_setting_column_right_end`
452
+ *
453
  */
454
  function options_ui( $configure_screen = false ) {
455
+ global $WpSmush, $wpsmushit_admin, $wpsmush_settings;
 
 
456
 
457
+ $settings = !empty( $wpsmush_settings->settings ) ? $wpsmush_settings->settings : $wpsmush_settings->init_settings();
 
458
 
459
+ echo '<div class="box-container">
460
+ <form id="wp-smush-settings-form" method="post">';
461
 
462
  //Use settings networkwide,@uses get_site_option() and not get_option
463
  $opt_networkwide = WP_SMUSH_PREFIX . 'networkwide';
464
+ $opt_networkwide_val = $wpsmush_settings->settings['networkwide'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
 
466
  //Option to enable/disable networkwide settings
467
  if( is_multisite() && is_network_admin() ) {
468
+ $class = $wpsmush_settings->settings['networkwide'] ? '' : ' hidden'; ?>
469
  <!-- A tab index of 0 keeps the element in tab flow with other elements with an unspecified tab index which are still tabbable.) -->
470
  <div class='wp-smush-setting-row wp-smush-basic'>
471
+ <div class="column column-left"">
472
+ <label class="inline-label" for="<?php echo $opt_networkwide; ?>" tabindex="0">
473
+ <span class="wp-smush-setting-label">
474
+ <?php echo $wpsmushit_admin->settings['networkwide']['short_label']; ?>
475
+ </span><br/>
476
+ <small class="smush-setting-description">
477
+ <?php echo $wpsmushit_admin->settings['networkwide']['desc']; ?>
478
+ </small>
479
+ </label>
480
+ </div>
481
+ <div class="column column-right">
482
+ <span class="toggle float-l">
483
+ <input type="checkbox" class="toggle-checkbox"
484
+ id="<?php echo $opt_networkwide; ?>"
485
+ name="<?php echo $opt_networkwide; ?>" <?php checked( $opt_networkwide_val, 1, true ); ?> value="1" tabindex="0">
486
+ <label class="toggle-label" for="<?php echo $opt_networkwide; ?>"></label>
487
+ </span>
488
+ <div class="column-right-content">
489
+ <label class="inline-label" for="<?php echo $opt_networkwide; ?>" tabindex="0">
490
+ <span class="wp-smush-setting-label"><?php echo $wpsmushit_admin->settings['networkwide']['label']; ?></span><br/>
491
+ </label>
492
+ </div>
493
+ </div>
494
  </div>
495
  <input type="hidden" name="setting-type" value="network">
 
496
  <div class="network-settings-wrapper<?php echo $class; ?>"><?php
497
  }
498
 
499
  //Do not print settings in network page if networkwide settings are disabled
500
+ if( ! is_multisite() || ( ! $wpsmush_settings->settings['networkwide'] && !is_network_admin() ) || is_network_admin() ) {
501
+ foreach( $wpsmushit_admin->settings as $name => $values ) {
502
+
503
+ //Skip networkwide settings, we already printed it
504
+ if( 'networkwide' == $name ) {
505
+ continue;
506
+ }
507
+
508
+ //Skip premium features if not a member
509
+ if( !in_array( $name, $wpsmushit_admin->basic_features ) && !$WpSmush->validate_install() ) {
510
+ continue;
511
+ }
512
+
513
+ $setting_m_key = WP_SMUSH_PREFIX . $name;
514
+ $setting_val = !empty( $settings[$name] ) ? $settings[$name] : 0;
515
+
516
+ //Set the default value 1 for auto smush
517
+ if( 'auto' == $name && ( false === $setting_val || !isset( $setting_val ) ) ) {
518
+ $setting_val = 1;
519
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
 
521
+ //Group Original, Resize and Backup for pro users
522
+ if( in_array( $name, $this->setting_group ) ) {
523
+ if( ( 'original' != $name && $WpSmush->validate_install() ) || ( !$WpSmush->validate_install() && 'resize' != $name ) ) {
524
+ continue;
525
+ }
526
+ }
527
+
528
+ $label = !empty( $wpsmushit_admin->settings[ $name ]['short_label'] ) ? $wpsmushit_admin->settings[ $name ]['short_label'] : $wpsmushit_admin->settings[ $name ]['label']; ?>
529
+ <div class='wp-smush-setting-row wp-smush-basic'>
530
+ <div class="column column-left">
531
+ <label class="inline-label" for="<?php echo $setting_m_key; ?>" tabindex="0">
532
+ <span class="wp-smush-setting-label"><?php echo $label; ?></span><br/>
533
+ <small class="smush-setting-description"><?php
534
+ //For pro settings, print a different description for group setting
535
+ if( 'original' != $name && 'resize' != $name ) {
536
+ echo $wpsmushit_admin->settings[ $name ]['desc'];
537
+ }else{
538
+ esc_html_e("Save a ton of space by not storing over-sized images on your server.", "wp-smushit");
539
+ }?>
540
+ </small>
541
+ </label>
542
+ </div>
543
+ <div class="column column-right"><?php
544
+ //Do not print for Resize, Smush Original, Backup
545
+ if( !in_array( $name, $this->setting_group ) ) { ?>
546
+ <span class="toggle float-l">
547
+ <input type="checkbox" class="toggle-checkbox"
548
+ id="<?php echo $setting_m_key; ?>"
549
+ name="<?php echo $setting_m_key; ?>" <?php checked( $setting_val, 1, true ); ?> value="1" tabindex="0">
550
+ <label class="toggle-label <?php echo $setting_m_key . '-label'; ?>" for="<?php echo $setting_m_key; ?>"></label>
551
+ </span>
552
+ <div class="column-right-content">
553
+ <label class="inline-label" for="<?php echo $setting_m_key; ?>" tabindex="0">
554
+ <span class="wp-smush-setting-label"><?php echo $wpsmushit_admin->settings[ $name ]['label']; ?></span><br/>
555
+ </label><?php
556
+ $this->settings_desc( $name );
557
+ $this->image_sizes( $name ); ?>
558
+ </div><?php
559
+ }
560
+ /**
561
+ * Print/Perform action in right setting column, Used to group Pro settings
562
+ */
563
+ do_action('smush_setting_column_right_end', $name); ?>
564
+ </div>
565
+ </div>
566
+ <?php
567
+ }
568
  do_action( 'wp_smush_after_basic_settings' );
569
  $this->advanced_settings( $configure_screen );
570
  } else{
580
  */
581
  function ui() {
582
 
583
+ global $WpSmush, $wpsmushit_admin, $wpsmush_settings, $wpsmush_dir;
584
 
585
  if( !$WpSmush->validate_install() ) {
586
  //Reset Transient
592
 
593
  if( !$is_network ) {
594
  //Show Configure screen for only a new installation and for only network admins
595
+ if ( ( 1 != get_site_option( 'skip-smush-setup' ) && 1 != get_site_option( 'wp-smush-hide_smush_welcome' ) && 1 != get_option( 'wp-smush-hide_smush_welcome' ) ) && 1 != get_option( 'hide_smush_features' ) && is_super_admin() ) {
596
+ echo '<div class="block float-l">';
597
+ $this->quick_setup();
598
  echo '</div>';
599
  } ?>
600
 
602
  <div class="wp-smushit-container-left col-half float-l"><?php
603
  //Bulk Smush Container
604
  $this->bulk_smush_container();
605
+ if( $WpSmush->validate_install() ) { ?>
606
+ <!-- Stats Share Widget -->
607
+ <div class="col-half share-widget-wrapper"><?php
608
+ global $wpsmush_share;
609
+ $wpsmush_share->share_widget(); ?>
610
+ </div><?php
611
+ } ?>
612
  </div>
613
 
614
  <!-- Stats -->
622
  */
623
  do_action( 'wp_smush_after_stats_box' );
624
  } ?>
625
+ </div><!-- End Of Smushit Container right --><?php
626
+ if( !$WpSmush->validate_install() ) {?>
627
+ <!-- Stats Share Widget -->
628
+ <div class="row"><?php
629
+ global $wpsmush_share;
630
+ $wpsmush_share->share_widget(); ?>
631
+ </div><?php
632
+ }
633
  //End of "!is_network()' check
634
  }?>
635
 
637
  <div class="row"><?php
638
  wp_nonce_field( 'save_wp_smush_options', 'wp_smush_options_nonce', '', true );
639
  //Check if a network site and networkwide settings is enabled
640
+ if( ! is_multisite() || ( is_multisite() && ! $wpsmush_settings->settings['networkwide'] ) || ( is_multisite() && is_network_admin() ) ) {
641
  $this->settings_ui();
642
  }
643
 
672
  );
673
  ?>
674
  <div class="box-content">
675
+ <p class="wp-smush-promo-content wp-smush-promo-content-2 roboto">Create amazing websites, automate your workflow, and run your business like a well-oiled machine.
676
  Get access to the tools that will win you more clients and help you spend less time working.
677
  Start a free WPMU DEV trial today.</p>
678
  <span class="wp-smush-pro-cta tc">
697
  <img src="<?php echo WP_SMUSH_URL . 'assets/images/hummingbird.png'; ?>"
698
  alt="<?php esc_html_e( "BOOST YOUR PERFORMANCE - HUMMINGBIRD", "wp-smushit" ); ?>">
699
  </span>
700
+ <p class="wp-smush-promo-content tc roboto">Hummingbird goes beyond Smush compression with
701
  minification, caching, performance monitoring and more - every millisecond counts!</p>
702
  <span class="wp-smush-hb-cta tc roboto-medium">
703
  <a href="<?php echo esc_url( "https://premium.wpmudev.org/project/wp-hummingbird/" ); ?>"
704
+ class="button button-cta" target="_blank">TRY HUMMINGBIRD FOR FREE</a>
705
  </span>
706
  </div><?php
707
  echo "</section>";
712
  */
713
  function bulk_smush_content() {
714
 
715
+ global $WpSmush, $wpsmushit_admin, $wpsmush_settings;
716
 
717
  $all_done = ( $wpsmushit_admin->smushed_count == $wpsmushit_admin->total_count ) && 0 == count( $wpsmushit_admin->resmush_ids );
718
 
719
  echo $this->bulk_resmush_content();
720
+ $upgrade_url = add_query_arg(
721
+ array(
722
+ 'utm_source' => 'Smush-Free',
723
+ 'utm_medium' => 'Banner',
724
+ 'utm_campaign' => 'try-pro-free'
725
+ ),
726
+ $wpsmushit_admin->upgrade_url
727
+ );
728
+
729
+ //Check whether to show pagespeed recommendation or not
730
+ $hide_pagespeed = get_network_option(get_current_network_id(), WP_SMUSH_PREFIX . 'hide_pagespeed_suggestion');
731
 
732
  //If there are no images in Media Library
733
  if ( 0 >= $wpsmushit_admin->total_count ) { ?>
744
  <!-- Hide All done div if there are images pending -->
745
  <div class="wp-smush-notice wp-smush-all-done<?php echo $all_done ? '' : ' hidden' ?>" tabindex="0">
746
  <i class="dev-icon dev-icon-tick"></i><?php esc_html_e( "All images are smushed and up to date. Awesome!", "wp-smushit" ); ?>
747
+ </div><?php
748
+ if( !$hide_pagespeed ) {?>
749
+ <div class="wp-smush-pagespeed-recommendation<?php echo $all_done ? '' : ' hidden' ?>">
750
+ <span class="smush-recommendation-title roboto-medium"><?php esc_html_e("Still having trouble with PageSpeed tests? Give these a go…", "wp-smsuhit"); ?></span>
751
+ <ol class="smush-recommendation-list"><?php
752
+ if( !$WpSmush->validate_install() ) { ?>
753
+ <li class="smush-recommendation-lossy"><?php printf( esc_html__("Upgrade to Smush Pro for advanced lossy compression. %sTry pro free%s.", "wp-smushit"), '<a href="' . $upgrade_url .'" target="_blank">', '</a>' ); ?></li><?php
754
+ }elseif ( !$wpsmush_settings->settings['lossy'] ) {?>
755
+ <li class="smush-recommendation-lossy"><?php printf( esc_html__("Enable %sSuper-smush%s for advanced lossy compression to optimise images further with almost no visible drop in quality.", "wp-smushit"), '<a href="#" class="wp-smush-lossy-enable">', "</a>" ); ?></li><?php
756
+ }?>
757
+ <li class="smush-recommendation-resize"><?php printf( esc_html__("Make sure your images are the right size for your theme. %sLearn more%s.", "wp-smushit"), '<a href="'. esc_url("https://goo.gl/kCqWxS") .'" target="_blank">', '</a>' ); ?></li><?php
758
+ if( !$wpsmush_settings->settings['resize'] ) {
759
+ //Check if resize original is disabled ?>
760
+ <li class="smush-recommendation-resize-original"><?php printf( esc_html__("Enable %sResize Original Images%s to scale big images down to a reasonable size and save a ton of space.", "wp-smushit"), '<a href="#" class="wp-smush-resize-enable">', "</a>"); ?></li><?php
761
+ }
762
+ ?>
763
+ </ol>
764
+ <span class="dismiss-recommendation"><i class="dev-icon dev-icon-cross"></i><?php esc_html_e("DISMISS", "wp-smushit"); ?></span>
765
+ </div><?php
766
+ } ?>
767
  <div class="wp-smush-bulk-wrapper <?php echo $all_done ? ' hidden' : ''; ?>"><?php
768
  //If all the images in media library are smushed
769
  //Button Text
770
+ $button_content = esc_html__( "BULK SMUSH", "wp-smushit" );
771
 
772
  //Show the notice only if there are remaining images and if we aren't showing a notice for resmush
773
  if ( $wpsmushit_admin->remaining_count > 0 ) {
782
  );
783
  ?>
784
  <div class="wp-smush-notice wp-smush-remaining<?php echo $class; ?>" tabindex="0">
785
+ <i class="wdv-icon wdv-icon-fw wdv-icon-exclamation-sign"></i>
 
 
786
  <span class="wp-smush-notice-text"><?php
787
  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>' );
788
  if( !$WpSmush->validate_install() && $wpsmushit_admin->remaining_count > 50 ) {
792
  </span>
793
  </div><?php
794
  } ?>
795
+ <button type="button" class="wp-smush-all wp-smush-button"><?php echo $button_content; ?></button>
 
 
 
 
 
796
  </div><?php
797
  $this->progress_bar( $wpsmushit_admin );
798
+ //Enable Super Smush
799
+ if ( $WpSmush->validate_install() && ! $WpSmush->lossy_enabled ) { ?>
800
+ <p class="wp-smush-enable-lossy hidden"><?php esc_html_e( "Tip: Enable Super-smush in the Settings area to get even more savings with almost no noticeable quality loss.", "wp-smushit" ); ?></p><?php
801
+ }
802
  $this->super_smush_promo();
803
  }
804
  }
811
  //If we have resmush list, smushed_count = totalcount - resmush count, else smushed_count
812
  // $smushed_count = ( $resmush_count = count( $count->resmush_ids ) ) > 0 ? ( $count->total_count - ( $count->remaining_count + $resmush_count ) ) : $count->smushed_count;
813
  // calculate %ages, avoid divide by zero error with no attachments
814
+
815
  if ( $count->total_count > 0 && $count->smushed_count > 0 ) {
816
  $smushed_pc = $count->smushed_count / $count->total_count * 100;
817
  } else {
818
  $smushed_pc = 0;
819
+ }
820
+ ?>
821
  <div class="wp-smush-bulk-progress-bar-wrapper hidden">
822
+ <p class="wp-smush-bulk-active roboto-medium"><?php printf( esc_html__( "%sBulk smush is currently running.%s You need to keep this page open for the process to complete.", "wp-smushit" ), '<strong>', '</strong>' ); ?></p>
 
 
823
  <div class="wp-smush-progress-wrap">
824
+ <img src="<?php echo WP_SMUSH_URL . 'assets/images/loading.gif'; ?>" alt="<?php esc_html_e("Working..", "wp-smushit"); ?>" width="20px">
825
  <div class="wp-smush-progress-bar-wrap">
826
  <div class="wp-smush-progress-bar">
827
  <div class="wp-smush-progress-inner" style="width: <?php echo $smushed_pc; ?>%;">
828
  </div>
829
  </div>
830
  </div>
 
 
 
831
  </div>
832
+ <div class="wp-smush-count tc">
833
+ <?php printf( esc_html__( "%s%d%s of your media attachments have been smushed." ), '<span class="wp-smush-images-percent">', $smushed_pc, '</span>%' ); ?>
834
+ </div>
835
+ <div class="smush-cancel-button-wrapper">
836
+ <button type="button"
837
+ class="button button-grey wp-smush-cancel-bulk" tooltip="<?php esc_html_e( "Stop current bulk smush process.", "wp-smushit"); ?>"><?php esc_html_e( "CANCEL", "wp-smushit" ); ?></button>
838
+ </div>
839
  </div>
840
  <div class="smush-final-log notice notice-warning inline hidden"></div><?php
841
  }
870
  //Show only if we have any images to ber resmushed
871
  if ( $show ) {
872
  return '<div class="wp-smush-notice wp-smush-resmush-notice wp-smush-remaining" tabindex="0">
873
+ <i class="wdv-icon wdv-icon-fw wdv-icon-exclamation-sign"></i>
874
  <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>
875
  <button class="button button-grey button-small wp-smush-skip-resmush">' . esc_html__( "Skip", "wp-smushit" ) . '</button>
876
  </div>';
884
  global $wpsmushit_admin, $wpsmush_settings;
885
 
886
  //Check if Networkwide settings are enabled, Do not show settings updated message
887
+ if( is_multisite() && $wpsmush_settings->settings['networkwide'] && !is_network_admin() ) {
888
  return;
889
  }
890
 
914
  * Prints out the page header for Bulk Smush Page
915
  */
916
  function smush_page_header() {
917
+ global $WpSmush, $wpsmushit_admin, $wpsmush_s3;
918
+
919
  //Include Shared UI
920
  require_once WP_SMUSH_DIR . 'assets/shared-ui/plugin-ui.php';
921
 
947
  //Check if settings were updated and shoe a notice
948
  $this->settings_updated();
949
 
950
+ //Show S3 integration message, if user hasn't enabled it
951
+ if( is_object( $wpsmush_s3 ) && method_exists( $wpsmush_s3, 's3_support_required_notice') ) {
952
+ $wpsmush_s3->s3_support_required_notice();
953
+ }
954
+
955
  echo '<div class="row wp-smushit-container-wrap">';
956
  }
957
 
971
 
972
  if ( 'new' == $install_type ) {
973
  $notice_heading = esc_html__( "Thanks for installing Smush. We hope you like it!", "wp-smushit" );
974
+ $notice_content = esc_html__( "And hey, if you do, you can join WPMU DEV for a free 30 day trial and get access to even more features!", "wp-smushit" );
975
+ $button_content = esc_html__( "Try Smush Pro Free", "wp-smushit" );
976
  } else {
977
+ $notice_heading = esc_html__( "Thanks for upgrading Smush!", "wp-smushit" );
978
+ $notice_content = 'Did you know she has secret super powers? Yes, she can super-smush images for double the savings, store original images, and bulk smush thousands of images in one go. Get started with a free WPMU DEV trial to access these advanced features.';
979
+ $button_content = esc_html__( "Try Smush Pro Free", "wp-smushit" );
980
  }
981
  $upgrade_url = add_query_arg(
982
  array(
1010
  * Super Smush promo content
1011
  */
1012
  function super_smush_promo() {
1013
+ global $WpSmush, $wpsmushit_admin;
1014
+ if ( $WpSmush->validate_install() ) {
1015
+ return;
1016
+ }
1017
+ $upgrade_url = add_query_arg(
1018
+ array(
1019
+ 'utm_source' => 'Smush-Free',
1020
+ 'utm_medium' => 'Banner',
1021
+ 'utm_campaign' => 'smush-lady-upgrade'
1022
+ ),
1023
+ $wpsmushit_admin->upgrade_url
1024
+ ); ?>
1025
+ <div class="wp-smush-super-smush-promo">
1026
+ <div class="wp-smush-super-smush-content-wrapper">
1027
+ <div class="wp-smush-super-smush-content"><?php
1028
+ printf( esc_html__("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", "wp-smushit"), '<a href="' . esc_url( $upgrade_url ). '" target="_blank" title="' . esc_html__("Try WP Smush Pro for FREE", "wp-smushit") . '">', '</a>' ); ?>
1029
+ </div>
1030
+ </div>
1031
+ </div>
1032
+ <?php
1033
+ }
1034
+
1035
+ /**
1036
+ * Super Smush promo content
1037
+ */
1038
+ function super_smush_promo_post_settings() {
1039
  global $WpSmush, $wpsmushit_admin;
1040
  if ( $WpSmush->validate_install() ) {
1041
  return;
1050
  ); ?>
1051
  <div class="wp-smush-super-smush-promo">
1052
  <div class="wp-smush-super-smush-content"><?php
1053
+ printf( esc_html__("Smush Pro gives you all these extra settings and absolutely no limits on smushing your images! Did we mention Smush Pro also gives you up to 2x better compression too? – %sTry it all free with a WPMU DEV membership today!%s", "wp-smushit"), '<a href="' . esc_url( $upgrade_url ). '" target="_blank" title="' . esc_html__("Try WP Smush Pro for FREE", "wp-smushit") . '">', '</a>' ); ?>
1054
  </div>
1055
  </div>
1056
  <?php
1075
  $wpmu_contact = sprintf( '<a href="%s" target="_blank">', esc_url("https://premium.wpmudev.org/contact") );
1076
  $attr_message = esc_html__("Validating..", "wp-smushit");
1077
  $recheck_link = '<a href="#" id="wp-smush-revalidate-member" data-message="%s">';
1078
+ $message = sprintf( esc_html__( "It looks like Smush couldn’t verify your WPMU DEV membership so Pro features have been disabled for now. If you think this is an error, run a %sre-check%s or get in touch with our %ssupport team%s.", "wp-smushit"), $recheck_link, '</a>', $wpmu_contact, '</a>' ) ;
1079
  $content = sprintf( '<div id="wp-smush-invalid-member" data-message="%s" class="hidden' . $notice_class . '"><div class="message">%s</div></div>', $attr_message, $message );
1080
  return $content;
1081
  }
1095
  }
1096
 
1097
  $div_end .=
1098
+ '<span class="wp-smush-submit-wrap">
1099
  <input type="submit" id="wp-smush-save-settings" class="button button-grey"
1100
  value="' . esc_html__( 'UPDATE SETTINGS', 'wp-smushit' ) . '">
1101
  <span class="spinner"></span>
1102
+ <span class="smush-submit-note">' . esc_html__( "Smush will automatically check for any images that need re-smushing.", "wp-smsuhit") . '</span>
1103
+ </span>
1104
  </form>';
1105
 
1106
  //For Configuration screen we need to show the advanced settings in single box
1112
  }
1113
 
1114
  function get_recheck_message() {
1115
+ global $wpsmush_settings;
1116
  //Return if not multisite, or on network settings page, Netowrkwide settings is disabled
1117
+ if( ! is_multisite() || is_network_admin() || ! $wpsmush_settings->settings['networkwide'] ) {
1118
  return;
1119
  }
 
1120
 
1121
  //Check the last settings stored in db
1122
+ $run_recheck = get_site_option( WP_SMUSH_PREFIX . 'run_recheck', false );
 
 
 
1123
 
1124
  //If not same, Display notice
1125
+ if( !$run_recheck ) {
1126
  return;
1127
  }
1128
  $message = '<div class="wp-smush-notice wp-smush-re-check-message">' . esc_html__( "Smush settings were updated, performing a quick scan to check if any of the images need to be Smushed again.", "wp-smushit") . '<i class="dev-icon dev-icon-cross"></i></div>';
1129
 
1130
  return $message;
1131
  }
1132
+
1133
+ /**
1134
+ * Prints all the registererd image sizes, to be selected/unselected for smushing
1135
+ *
1136
+ * @param string $name
1137
+ */
1138
+ function image_sizes( $name = '' ) {
1139
+ if( empty( $name ) || 'auto' != $name ) {
1140
+ return;
1141
+ }
1142
+ global $wpsmushit_admin, $wpsmush_settings;
1143
+ //Additional Image sizes
1144
+ $image_sizes = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'image_sizes', false );
1145
+ $sizes = $wpsmushit_admin->image_dimensions();
1146
+ if( !empty( $sizes ) ) { ?>
1147
+ <!-- List of image sizes recognised by WP Smush -->
1148
+ <div class="wp-smush-image-size-list">
1149
+ <p><?php printf( esc_html__("Every time you upload an image to your site, WordPress generates a resized version of that image for every default and/or custom image size that your theme has registered. This means there are multiple versions of your images in your media library.%sChoose the images size/s below that you would like optimized:%s", "wp-smushit"), "<br /> <br />", "<br />"); ?></p><?php
1150
+ foreach ( $sizes as $size_k => $size ) {
1151
+ //If image sizes array isn't set, mark all checked ( Default Values )
1152
+ if ( false === $image_sizes ) {
1153
+ $checked = true;
1154
+ }else{
1155
+ $checked = is_array( $image_sizes ) ? in_array( $size_k, $image_sizes ) : false;
1156
+ } ?>
1157
+ <label>
1158
+ <input type="checkbox" id="wp-smush-size-<?php echo $size_k; ?>" <?php checked( $checked, true ); ?> name="wp-smush-image_sizes[]" value="<?php echo $size_k; ?>"><?php
1159
+ if( isset( $size['width'], $size['height'] ) ) {
1160
+ echo $size_k . " (" . $size['width'] . "x" . $size['height'] . ") ";
1161
+ } ?>
1162
+ </label><?php
1163
+ } ?>
1164
+ </div><?php
1165
+ }
1166
+
1167
+ }
1168
+
1169
+ /**
1170
+ * Prints Dimensions required for Resizing
1171
+ *
1172
+ * @param string $name
1173
+ * @param int $setting_status
1174
+ */
1175
+ function resize_settings( $name = '' ) {
1176
+ if( empty( $name ) || 'resize' != $name ) {
1177
+ return;
1178
+ }
1179
+ global $wpsmush_settings, $wpsmushit_admin;
1180
+ //Dimensions
1181
+ $resize_sizes = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'resize_sizes', array( 'width' => '', 'height' => '' ) );
1182
+ //Get max. dimesnions
1183
+ $max_sizes = $wpsmushit_admin->get_max_image_dimensions();
1184
+
1185
+ $setting_status = !empty( $wpsmush_settings->settings['resize'] ) ? $wpsmush_settings->settings['resize'] : 0;
1186
+
1187
+ //Placeholder width and Height
1188
+ $p_width = $p_height = 2048; ?>
1189
+ <div class="wp-smush-resize-settings-wrap<?php echo $setting_status ? '' : ' hidden'?>">
1190
+ <label class="resize-width-label" for="<?php echo WP_SMUSH_PREFIX . $name . '_width'; ?>"><span class = "label-text"><?php esc_html_e("Max width", "wp-smushit"); ?></span>
1191
+ <input type="text" id="<?php echo WP_SMUSH_PREFIX . $name . '_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 WP_SMUSH_PREFIX . $name . '_width'; ?>" tabindex="0" width=100 /> px
1192
+ </label>
1193
+ <label class="resize-height-label" for"<?php echo WP_SMUSH_PREFIX . $name . '_height'; ?>"><span class = "label-text"><?php esc_html_e("Max height", "wp-smushit"); ?></span>
1194
+ <input type="text" id="<?php echo WP_SMUSH_PREFIX . $name . '_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 WP_SMUSH_PREFIX . $name . '_height'; ?>" tabindex="0" width=100 /> px
1195
+ </label>
1196
+ <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>
1197
+ <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>
1198
+ <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>
1199
+ </div><?php
1200
+ }
1201
+
1202
+ /**
1203
+ * Prints Resize, Smush Original, and Backup Settings
1204
+ *
1205
+ * @param string $name Name of the current setting being processed
1206
+ */
1207
+ function full_size_options( $name = '', $section = '' ) {
1208
+ if( 'original' != $name && 'resize' != $name ) {
1209
+ return;
1210
+ }
1211
+ global $WpSmush, $wpsmushit_admin, $wpsmush_settings;
1212
+ foreach( $this->setting_group as $name ) {
1213
+ //Do not print Smush Original, Backup for free users
1214
+ if( !$WpSmush->validate_install() ) {
1215
+ if( 'resize' == $name && !empty( $section ) ) {
1216
+ continue;
1217
+ }elseif( empty( $section ) && 'resize' != $name ) {
1218
+ continue;
1219
+ }
1220
+ }
1221
+ $setting_val = $wpsmush_settings->settings[$name];
1222
+ //Turn off settings for free users
1223
+ if( !in_array( $name, $wpsmushit_admin->basic_features ) && !$WpSmush->validate_install() ) {
1224
+ $setting_val = 0;
1225
+ }
1226
+ ?>
1227
+ <div class="smush-sub-setting-wrapper">
1228
+ <span class="toggle float-l">
1229
+ <input type="checkbox" class="toggle-checkbox"
1230
+ id="<?php echo WP_SMUSH_PREFIX . $name ; ?>" <?php checked( $setting_val, 1, true ); ?>
1231
+ value="1"
1232
+ name="<?php echo WP_SMUSH_PREFIX . $name; ?>" tabindex= "0">
1233
+ <label class="toggle-label <?php echo WP_SMUSH_PREFIX . $name ; ?>-label" for="<?php echo WP_SMUSH_PREFIX . $name; ?>"></label>
1234
+ </span>
1235
+ <div class="column-right-content">
1236
+ <label class="inline-label" for="<?php echo WP_SMUSH_PREFIX . $name; ?>" tabindex="0">
1237
+ <span class="wp-smush-setting-label"><?php echo $wpsmushit_admin->settings[ $name ]['label']; ?></span><br/>
1238
+ </label>
1239
+ <span class="wp-smush-setting-desc"><?php echo $wpsmushit_admin->settings[ $name ]['desc']; ?></span><br/><?php
1240
+ $this->resize_settings( $name );?>
1241
+ </div>
1242
+ </div><?php
1243
+ }
1244
+ }
1245
+
1246
+ /**
1247
+ *
1248
+ * @param string $setting_key
1249
+ */
1250
+ function settings_desc( $setting_key = '' ) {
1251
+ if( empty( $setting_key ) ) {
1252
+ return;
1253
+ } ?>
1254
+ <div class="column-right-content-description"><?php
1255
+ switch ( $setting_key ) {
1256
+
1257
+ case 'keep_exif':
1258
+ esc_html_e("Note: This data, called EXIF, adds to the size of the image. While this information might be important to photographers, it’s unnecessary for most users and safe to remove.", "wp-smushit");
1259
+ break;
1260
+ case 'png_to_jpg':
1261
+ esc_html_e("Note: Any PNGs with transparency will be ignored. Smush will only convert PNGs if it results in a smaller file size. The resulting file will have a new filename and extension (JPEG), and any hard-coded URLs on your site that contain the original PNG filename will need to be updated.", "wp-smushit");
1262
+ break;
1263
+ case 's3':
1264
+ esc_html_e("Note: For this process to happen automatically you need automatic smushing enabled.", "wp-smushit");
1265
+ break;
1266
+ case 'default':
1267
+ break;
1268
+ } ?>
1269
+ </div><?php
1270
+ }
1271
+ }
1272
+ global $wpsmush_bulkui;
1273
+ $wpsmush_bulkui = new WpSmushBulkUi();
1274
  }
lib/class-wp-smush.php CHANGED
@@ -139,6 +139,9 @@ if ( ! class_exists( 'WpSmush' ) ) {
139
  //Handle the Async optimisation
140
  add_action( 'wp_async_wp_save_image_editor_file', array( $this, 'wp_smush_handle_editor_async' ), '', 2 );
141
 
 
 
 
142
  }
143
 
144
  /**
@@ -149,16 +152,13 @@ if ( ! class_exists( 'WpSmush' ) ) {
149
  global $wpsmush_settings;
150
 
151
  //Check if Lossy enabled
152
- $opt_lossy = WP_SMUSH_PREFIX . 'lossy';
153
- $this->lossy_enabled = $this->validate_install() && $wpsmush_settings->get_setting( $opt_lossy, false );
154
 
155
  //Check if Smush Original enabled
156
- $opt_original = WP_SMUSH_PREFIX . 'original';
157
- $this->smush_original = $this->validate_install() && $wpsmush_settings->get_setting( $opt_original, false );
158
 
159
  //Check Whether to keep exif or not
160
- $opt_keep_exif = WP_SMUSH_PREFIX . 'keep_exif';
161
- $this->keep_exif = $wpsmush_settings->get_setting( $opt_keep_exif, false );
162
  }
163
 
164
  function admin_init() {
@@ -325,8 +325,9 @@ if ( ! class_exists( 'WpSmush' ) ) {
325
 
326
  global $wpsmush_settings, $wpsmush_helper, $wpsmushit_admin;
327
 
 
328
  //Flag to check, if original size image should be smushed or not
329
- $original = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'original', false );
330
  $smush_full = ( $this->validate_install() && $original == 1 ) ? true : false;
331
 
332
  $errors = new WP_Error();
@@ -671,7 +672,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
671
 
672
  //Check if premium member, add API key
673
  $api_key = $this->_get_api_key();
674
- if ( ! empty( $api_key ) ) {
675
  $headers['apikey'] = $api_key;
676
  }
677
 
@@ -704,8 +705,13 @@ if ( ! class_exists( 'WpSmush' ) ) {
704
  //Update DB for using http protocol
705
  $wpsmush_settings->update_setting( WP_SMUSH_PREFIX . 'use_http', 1 );
706
  }
707
- //Handle error
708
- $data['message'] = sprintf( __( 'Error posting to API: %s', 'wp-smushit' ), $result->get_error_message() );
 
 
 
 
 
709
  $data['success'] = false;
710
  unset( $result ); //free memory
711
  return $data;
@@ -949,6 +955,11 @@ if ( ! class_exists( 'WpSmush' ) ) {
949
  $status_txt = $button_txt = $stats = '';
950
  $show_button = $show_resmush = false;
951
 
 
 
 
 
 
952
  $wp_smush_data = get_post_meta( $id, $this->smushed_meta_key, true );
953
  $wp_resize_savings = get_post_meta( $id, WP_SMUSH_PREFIX . 'resize_savings', true );
954
  $conversion_savings = get_post_meta( $id, WP_SMUSH_PREFIX . 'pngjpg_savings', true );
@@ -1487,6 +1498,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
1487
  add_action( 'aws_init', array( $this, 'load_s3' ), 120 );
1488
  }
1489
  }
 
1490
  /**
1491
  * Check if NextGen is active or not
1492
  * Include and instantiate classes
@@ -1684,10 +1696,10 @@ if ( ! class_exists( 'WpSmush' ) ) {
1684
 
1685
  global $wpsmush_settings;
1686
 
1687
- $auto_smush = $wpsmush_settings->get_setting( WP_SMUSH_PREFIX . 'auto', false );
1688
 
1689
  //Keep the auto smush on by default
1690
- if ( $auto_smush === false ) {
1691
  $auto_smush = 1;
1692
  }
1693
 
@@ -1775,6 +1787,10 @@ if ( ! class_exists( 'WpSmush' ) ) {
1775
  /**
1776
  * Return Global stats
1777
  *
 
 
 
 
1778
  * @return array|bool|mixed
1779
  */
1780
  function send_smush_stats() {
@@ -1782,6 +1798,10 @@ if ( ! class_exists( 'WpSmush' ) ) {
1782
 
1783
  $stats = $wpsmushit_admin->global_stats();
1784
 
 
 
 
 
1785
  return $stats;
1786
 
1787
  }
@@ -1946,6 +1966,11 @@ if ( ! class_exists( 'WpSmush' ) ) {
1946
  return true;
1947
  }
1948
 
 
 
 
 
 
1949
  //Skip if bulk activation, Or if we have to skip redirection
1950
  if ( isset( $_GET['activate-multi'] ) || get_site_option( 'wp-smush-skip-redirect' ) ) {
1951
  return false;
@@ -2272,6 +2297,48 @@ if ( ! class_exists( 'WpSmush' ) ) {
2272
  //Update Stats
2273
  update_post_meta( $post_data['postid'], $this->smushed_meta_key, $smush_stats );
2274
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2275
  }
2276
 
2277
  global $WpSmush;
139
  //Handle the Async optimisation
140
  add_action( 'wp_async_wp_save_image_editor_file', array( $this, 'wp_smush_handle_editor_async' ), '', 2 );
141
 
142
+ //Register Function for sending unsmushed image count to hub
143
+ add_filter( 'wdp_register_hub_action', array( $this, 'smush_stats' ) );
144
+
145
  }
146
 
147
  /**
152
  global $wpsmush_settings;
153
 
154
  //Check if Lossy enabled
155
+ $this->lossy_enabled = $this->validate_install() && $wpsmush_settings->settings['lossy'];
 
156
 
157
  //Check if Smush Original enabled
158
+ $this->smush_original = $this->validate_install() && $wpsmush_settings->settings['original'];
 
159
 
160
  //Check Whether to keep exif or not
161
+ $this->keep_exif = $wpsmush_settings->settings['keep_exif'];
 
162
  }
163
 
164
  function admin_init() {
325
 
326
  global $wpsmush_settings, $wpsmush_helper, $wpsmushit_admin;
327
 
328
+ $settings = $wpsmush_settings->settings;
329
  //Flag to check, if original size image should be smushed or not
330
+ $original = $settings['original'];
331
  $smush_full = ( $this->validate_install() && $original == 1 ) ? true : false;
332
 
333
  $errors = new WP_Error();
672
 
673
  //Check if premium member, add API key
674
  $api_key = $this->_get_api_key();
675
+ if ( ! empty( $api_key ) && $this->validate_install() ) {
676
  $headers['apikey'] = $api_key;
677
  }
678
 
705
  //Update DB for using http protocol
706
  $wpsmush_settings->update_setting( WP_SMUSH_PREFIX . 'use_http', 1 );
707
  }
708
+ //Check for timeout error and suggest to filter timeout
709
+ if ( strpos( $er_msg, 'timed out' ) ) {
710
+ $data['message'] = esc_html__( "Skipped due to a timeout error, You can increase the request timeout to make sure Smush has enough time to process larger files. `define('WP_SMUSH_API_TIMEOUT', 150);`.", "wp-smushit" );
711
+ }else {
712
+ //Handle error
713
+ $data['message'] = sprintf( __( 'Error posting to API: %s', 'wp-smushit' ), $result->get_error_message() );
714
+ }
715
  $data['success'] = false;
716
  unset( $result ); //free memory
717
  return $data;
955
  $status_txt = $button_txt = $stats = '';
956
  $show_button = $show_resmush = false;
957
 
958
+ // If variables are not initialized properly, initialize it.
959
+ if ( ! has_action( 'admin_init', array( $this, 'admin_init' ) ) ) {
960
+ $this->initialise();
961
+ }
962
+
963
  $wp_smush_data = get_post_meta( $id, $this->smushed_meta_key, true );
964
  $wp_resize_savings = get_post_meta( $id, WP_SMUSH_PREFIX . 'resize_savings', true );
965
  $conversion_savings = get_post_meta( $id, WP_SMUSH_PREFIX . 'pngjpg_savings', true );
1498
  add_action( 'aws_init', array( $this, 'load_s3' ), 120 );
1499
  }
1500
  }
1501
+
1502
  /**
1503
  * Check if NextGen is active or not
1504
  * Include and instantiate classes
1696
 
1697
  global $wpsmush_settings;
1698
 
1699
+ $auto_smush = $wpsmush_settings->settings['auto'];
1700
 
1701
  //Keep the auto smush on by default
1702
+ if ( $auto_smush === false || !isset( $auto_smush ) ) {
1703
  $auto_smush = 1;
1704
  }
1705
 
1787
  /**
1788
  * Return Global stats
1789
  *
1790
+ * Stats sent
1791
+ *
1792
+ * array( 'total_images','bytes', 'human', 'percent')
1793
+ *
1794
  * @return array|bool|mixed
1795
  */
1796
  function send_smush_stats() {
1798
 
1799
  $stats = $wpsmushit_admin->global_stats();
1800
 
1801
+ $required_stats = array( 'total_images', 'bytes', 'human', 'percent' );
1802
+
1803
+ $stats = is_array( $stats ) ? array_intersect_key( $stats, array_flip( $required_stats ) ) : array();
1804
+
1805
  return $stats;
1806
 
1807
  }
1966
  return true;
1967
  }
1968
 
1969
+ //Do not perform redirect if WP ClI is there, as it generates warning and causes issue
1970
+ if ( defined( 'WP_CLI' ) && WP_CLI ) {
1971
+ return true;
1972
+ }
1973
+
1974
  //Skip if bulk activation, Or if we have to skip redirection
1975
  if ( isset( $_GET['activate-multi'] ) || get_site_option( 'wp-smush-skip-redirect' ) ) {
1976
  return false;
2297
  //Update Stats
2298
  update_post_meta( $post_data['postid'], $this->smushed_meta_key, $smush_stats );
2299
  }
2300
+
2301
+ /**
2302
+ * Registers smush action for HUB API
2303
+ *
2304
+ * @param $actions
2305
+ *
2306
+ * @return mixed
2307
+ */
2308
+ function smush_stats( $actions ) {
2309
+ $actions['smush_get_stats'] = array( $this, 'smush_attachment_count');
2310
+
2311
+ return $actions; //always return at least the original array so we don't mess up other integrations
2312
+ }
2313
+
2314
+ /**
2315
+ * Send stats to Hub
2316
+ *
2317
+ * @return array An array containing Total, Smushed, Unsmushed Images count and savings if images are alreay smushed
2318
+ */
2319
+ function smush_attachment_count( $params, $action, $request ) {
2320
+
2321
+ $stats = array(
2322
+ 'count_total' => 0,
2323
+ 'count_smushed' => 0,
2324
+ 'count_unsmushed' => 0,
2325
+ 'savings' => array()
2326
+ );
2327
+
2328
+ global $wpsmushit_admin;
2329
+ if ( ! isset( $wpsmushit_admin->stats ) ) {
2330
+ //Setup stats, if not set already
2331
+ $wpsmushit_admin->setup_global_stats();
2332
+ }
2333
+ // Total, Smushed, Unsmushed, Savings
2334
+ $stats['count_total'] = $wpsmushit_admin->total_count;
2335
+ $stats['count_smushed'] = $wpsmushit_admin->smushed_count;
2336
+ //Considering the images to be resmushed
2337
+ $stats['count_unsmushed'] = $wpsmushit_admin->remaining_count;
2338
+ $stats['savings'] = $wpsmushit_admin->stats;
2339
+
2340
+ $request->send_json_success( $stats );
2341
+ }
2342
  }
2343
 
2344
  global $WpSmush;
lib/nextgen-integration/class-wp-smush-nextgen-admin.php CHANGED
@@ -21,7 +21,6 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
21
  var $remaining_count = 0;
22
  var $super_smushed = 0;
23
  var $bulk_page_handle;
24
- var $bulk_ui = '';
25
 
26
  //Stores all lossless smushed ids
27
  public $resmush_ids = array();
@@ -46,11 +45,12 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
46
  //Update Stats, if a NextGen image is deleted
47
  add_action( 'ngg_delete_picture', array( $this, 'update_nextgen_stats' ) );
48
 
 
 
 
49
  //Update the Super Smush count, after the smushing
50
  add_action( 'wp_smush_image_optimised_nextgen', array( $this, 'update_lists' ), '', 2 );
51
 
52
- $this->bulk_ui = new WpSmushBulkUi();
53
-
54
  }
55
 
56
  /**
@@ -336,61 +336,13 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
336
  }
337
  }
338
 
339
- /**
340
- * Returns Bulk smush button id and other details, as per if bulk request is already sent or not
341
- *
342
- * @return array
343
- */
344
-
345
- private function button_state( $resmush ) {
346
- $button = array(
347
- 'cancel' => false,
348
- );
349
-
350
- $button['text'] = __( 'Bulk Smush Now', 'wp-smushit' );
351
-
352
- //If not resmush and All the images are already smushed
353
- if ( ! $resmush && $this->smushed_count === $this->total_count ) {
354
- $button['text'] = __( 'All Done!', 'wp-smushit' );
355
- $button['class'] = 'wp-smush-finished disabled wp-smush-finished';
356
- $button['disabled'] = 'disabled';
357
- } elseif ( $resmush ) {
358
- $button['class'] = 'wp-smush-button wp-smush-resmush wp-smush-nextgen-bulk';
359
- } else {
360
- $button['class'] = 'wp-smush-button wp-smush-nextgen-bulk';
361
- }
362
-
363
- return $button;
364
- }
365
-
366
- /**
367
- * Display the bulk smushing button
368
- *
369
- * @param bool $resmush
370
- * @param bool $return Whether to echo the button content or echo it
371
- *
372
- * @return string If return is set to true, return the button content,
373
- * else echo it
374
- *
375
- */
376
- function setup_button( $resmush = false, $return = false ) {
377
- $button = $this->button_state( $resmush );
378
- $disabled = ! empty( $button['disabled'] ) ? ' disabled="disabled"' : '';
379
- $content = '<button class="button button-primary ' . $button['class'] . '" name="smush-all-nextgen" ' . $disabled . '>
380
- <span>' . $button['text'] . '</span>
381
- </button>';
382
- if ( $return ) {
383
- return $content;
384
- }
385
- echo $content;
386
- }
387
-
388
  /**
389
  *
390
  */
391
  function bulk_smush_ui() {
 
392
  //Page Header
393
- $this->bulk_ui->smush_page_header(); ?>
394
  <!-- Bulk Smush Progress Bar -->
395
  <div class="wp-smushit-container-left col-half float-l"><?php
396
  //Bulk Smush Container
@@ -404,14 +356,14 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
404
  $this->smush_stats_container(); ?>
405
  </div><!-- End Of Smushit Container right -->
406
  </div><?php
407
- $this->bulk_ui->smush_page_footer();
408
  }
409
 
410
  /**
411
  * Outputs the Content for Bulk Smush Div
412
  */
413
  function bulk_smush_content() {
414
- global $wpsmushit_admin, $WpSmush;
415
 
416
  //If all the images are smushed
417
  $all_done = ( $this->smushed_count == $this->total_count ) && 0 == count( $this->resmush_ids );
@@ -426,7 +378,7 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
426
  $count += $this->remaining_count;
427
 
428
  //Get the counts
429
- echo $this->bulk_ui->bulk_resmush_content( $count, $show );
430
 
431
  /** End Of Re-Smush Notice */
432
 
@@ -449,20 +401,17 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
449
  <div class="wp-smush-bulk-wrapper <?php echo $all_done ? ' hidden' : ''; ?>"><?php
450
  //If all the images in media library are smushed
451
  //Button Text
452
- $button_content = esc_html__( "BULK SMUSH NOW", "wp-smushit" );
453
  // DO not show the remaining notice if we have resmush ids
454
  ?>
455
  <div class="wp-smush-notice wp-smush-remaining <?php echo count( $this->resmush_ids ) > 0 ? ' hidden' : ''; ?>">
456
- <i class="dev-icon">
457
- <img src="<?php echo WP_SMUSH_URL . 'assets/images/icon-gzip.svg'; ?>" width="14px">
458
- </i>
459
  <span class="wp-smush-notice-text">
460
  <?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>' ); ?>
461
  </span>
462
  </div>
463
- <hr class="wp-smush-sep">
464
  <button type="button"
465
- class="wp-smush-button wp-smush-nextgen-bulk"><?php echo $button_content; ?></button><?php
466
 
467
  //Enable Super Smush
468
  if ( ! $WpSmush->lossy_enabled ) {
@@ -476,7 +425,7 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
476
  <p class="wp-smush-enable-lossy"><?php printf( esc_html__( "Enable Super-smush in the %sSettings%s area to get even more savings with almost no noticeable quality loss.", "wp-smushit" ), '<a href="' . $url .'" target="_blank">', "</a>"); ?></p><?php
477
  } ?>
478
  </div><?php
479
- $this->bulk_ui->progress_bar( $this );
480
  }
481
  }
482
 
@@ -485,7 +434,7 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
485
  */
486
  function bulk_smush_container() {
487
 
488
- global $WpSmush;
489
 
490
  //Subheading Content
491
  $smush_individual_msg = sprintf( esc_html__( "Smush individual images via your %sManage Galleries%s section", "wp-smushit" ), '<a href="' . esc_url( admin_url() . 'admin.php?page=nggallery-manage-gallery' ) . '" title="' . esc_html__( 'Manage Galleries', 'wp-smushit' ) . '">', '</a>' );
@@ -493,7 +442,7 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
493
  $class = $WpSmush->validate_install() ? 'bulk-smush-wrapper wp-smush-pro-install' : 'bulk-smush-wrapper';
494
 
495
  //Container Header
496
- $this->bulk_ui->container_header( $class, 'wp-smush-bulk-wrap-box', esc_html__( "BULK SMUSH", "wp-smushit" ), $smush_individual_msg ); ?>
497
 
498
  <div class="box-container"><?php
499
  $this->bulk_smush_content(); ?>
@@ -505,47 +454,30 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
505
  * Outputs the Smush stats for the site
506
  */
507
  function smush_stats_container() {
508
- global $WpSmush, $wpsmushnextgenstats, $wpsmushit_admin, $wpsmush_db;
509
 
510
  //If we have resmush list, smushed_count = totalcount - resmush count, else smushed_count
511
  $smushed_count = ( $resmush_count = count( $this->resmush_ids ) ) > 0 ? ( $this->total_count - ( $resmush_count + $this->remaining_count ) ) : $this->smushed_count;
512
 
513
  $button = '<span class="spinner"></span><button tooltip="' . esc_html__( "Lets you check if any images can be further optimized. Useful after changing settings.", "wp-smushit" ) . '" data-type="nextgen" class="wp-smush-title button button-grey button-small wp-smush-scan">' . esc_html__( "RE-CHECK IMAGES", "wp-smushit" ) . '</button>';
514
- $this->bulk_ui->container_header( 'smush-stats-wrapper', 'wp-smush-stats-box', esc_html__( "STATS", "wp-smushit" ), $button );
515
- $dasharray = 125.663706144;
516
- $dash_offset = $this->total_count > 0 ? $dasharray - ( $dasharray * ( $smushed_count / $this->total_count ) ) : $dasharray; ?>
517
 
518
  <div class="box-content">
519
  <div class="row smush-total-savings smush-total-reduction-percent">
520
 
521
  <div class="wp-smush-current-progress">
522
- <div class="wp-smushed-progress">
523
- <div class="wp-smush-score inside">
524
- <div class="tooltip-box">
525
- <div class="wp-smush-optimisation-progress">
526
- <div class="wp-smush-progress-circle">
527
- <svg class="wp-smush-svg" xmlns="http://www.w3.org/2000/svg" width="50" height="50">
528
- <circle class="wp-smush-svg-circle" r="20" cx="25" cy="25" fill="transparent" stroke-dasharray="0" stroke-dashoffset="0"></circle>
529
- <!-- Stroke Dasharray is 2 PI r -->
530
- <circle class="wp-smush-svg-circle wp-smush-svg-circle-progress" r="20" cx="25" cy="25" fill="transparent" stroke-dasharray="<?php echo $dasharray; ?>" style="stroke-dashoffset: <?php echo $dash_offset; ?>px;"></circle>
531
- </svg>
532
- </div>
533
- </div>
534
- </div><!-- end tooltip-box -->
535
- </div>
536
- </div>
537
 
538
  <div class="wp-smush-count-total">
539
  <div class="wp-smush-smush-stats-wrapper">
540
  <span class="wp-smush-total-optimised"><?php echo $this->image_count; ?></span>
541
  </div>
542
- <span class="total-stats-label"><strong><?php esc_html_e( "IMAGES SMUSHED", "wp-smushit" ); ?></strong></span>
543
  </div>
544
  </div>
545
  </div>
546
  <hr />
547
  <div class="row wp-smush-savings">
548
- <span class="float-l wp-smush-stats-label"><strong><?php esc_html_e("TOTAL SAVINGS", "wp-smushit");?></strong></span>
549
  <span class="float-r wp-smush-stats">
550
  <span class="wp-smush-stats-percent"><?php echo $this->stats['percent'] > 0 ? number_format_i18n( $this->stats['percent'], 1, '.', '' ) : 0; ?></span>%
551
  <span class="wp-smush-stats-sep">/</span>
@@ -561,7 +493,7 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
561
  <hr>
562
  <div class="row super-smush-attachments">
563
  <span class="float-l wp-smush-stats-label">
564
- <strong><?php esc_html_e( "IMAGES SUPER-SMUSHED", "wp-smushit" ); ?></strong>
565
  </span>
566
  <span class="float-r wp-smush-stats">
567
  <?php
@@ -667,7 +599,7 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
667
  //Set the counts
668
  $this->total_count = $wpsmushnextgenstats->total_count();
669
  $this->image_count = $this->get_image_count( $smushed_images );
670
- $this->smushed_count = count( $smushed_images );
671
  $this->remaining_count = $wpsmushnextgenstats->get_ngg_images( 'unsmushed', true );
672
  }
673
 
@@ -741,6 +673,18 @@ if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
741
 
742
  }
743
 
 
 
 
 
 
 
 
 
 
 
 
 
744
  }//End of Class
745
 
746
  }//End Of if class not exists
21
  var $remaining_count = 0;
22
  var $super_smushed = 0;
23
  var $bulk_page_handle;
 
24
 
25
  //Stores all lossless smushed ids
26
  public $resmush_ids = array();
45
  //Update Stats, if a NextGen image is deleted
46
  add_action( 'ngg_delete_picture', array( $this, 'update_nextgen_stats' ) );
47
 
48
+ //Update Stats, Lists - if a NextGen Gallery is deleted
49
+ // add_action( 'ngg_delete_gallery', array( $this, 'update_stats' ) );
50
+
51
  //Update the Super Smush count, after the smushing
52
  add_action( 'wp_smush_image_optimised_nextgen', array( $this, 'update_lists' ), '', 2 );
53
 
 
 
54
  }
55
 
56
  /**
336
  }
337
  }
338
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  /**
340
  *
341
  */
342
  function bulk_smush_ui() {
343
+ global $wpsmush_bulkui;
344
  //Page Header
345
+ $wpsmush_bulkui->smush_page_header(); ?>
346
  <!-- Bulk Smush Progress Bar -->
347
  <div class="wp-smushit-container-left col-half float-l"><?php
348
  //Bulk Smush Container
356
  $this->smush_stats_container(); ?>
357
  </div><!-- End Of Smushit Container right -->
358
  </div><?php
359
+ $wpsmush_bulkui->smush_page_footer();
360
  }
361
 
362
  /**
363
  * Outputs the Content for Bulk Smush Div
364
  */
365
  function bulk_smush_content() {
366
+ global $wpsmushit_admin, $WpSmush, $wpsmush_bulkui;
367
 
368
  //If all the images are smushed
369
  $all_done = ( $this->smushed_count == $this->total_count ) && 0 == count( $this->resmush_ids );
378
  $count += $this->remaining_count;
379
 
380
  //Get the counts
381
+ echo $wpsmush_bulkui->bulk_resmush_content( $count, $show );
382
 
383
  /** End Of Re-Smush Notice */
384
 
401
  <div class="wp-smush-bulk-wrapper <?php echo $all_done ? ' hidden' : ''; ?>"><?php
402
  //If all the images in media library are smushed
403
  //Button Text
404
+ $button_content = esc_html__( "BULK SMUSH", "wp-smushit" );
405
  // DO not show the remaining notice if we have resmush ids
406
  ?>
407
  <div class="wp-smush-notice wp-smush-remaining <?php echo count( $this->resmush_ids ) > 0 ? ' hidden' : ''; ?>">
408
+ <i class="wdv-icon wdv-icon-fw wdv-icon-exclamation-sign"></i>
 
 
409
  <span class="wp-smush-notice-text">
410
  <?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>' ); ?>
411
  </span>
412
  </div>
 
413
  <button type="button"
414
+ class="wp-smush-button wp-smush-nextgen-bulk float-r"><?php echo $button_content; ?></button><?php
415
 
416
  //Enable Super Smush
417
  if ( ! $WpSmush->lossy_enabled ) {
425
  <p class="wp-smush-enable-lossy"><?php printf( esc_html__( "Enable Super-smush in the %sSettings%s area to get even more savings with almost no noticeable quality loss.", "wp-smushit" ), '<a href="' . $url .'" target="_blank">', "</a>"); ?></p><?php
426
  } ?>
427
  </div><?php
428
+ $wpsmush_bulkui->progress_bar( $this );
429
  }
430
  }
431
 
434
  */
435
  function bulk_smush_container() {
436
 
437
+ global $WpSmush, $wpsmush_bulkui;
438
 
439
  //Subheading Content
440
  $smush_individual_msg = sprintf( esc_html__( "Smush individual images via your %sManage Galleries%s section", "wp-smushit" ), '<a href="' . esc_url( admin_url() . 'admin.php?page=nggallery-manage-gallery' ) . '" title="' . esc_html__( 'Manage Galleries', 'wp-smushit' ) . '">', '</a>' );
442
  $class = $WpSmush->validate_install() ? 'bulk-smush-wrapper wp-smush-pro-install' : 'bulk-smush-wrapper';
443
 
444
  //Container Header
445
+ $wpsmush_bulkui->container_header( $class, 'wp-smush-bulk-wrap-box', esc_html__( "BULK SMUSH", "wp-smushit" ), $smush_individual_msg ); ?>
446
 
447
  <div class="box-container"><?php
448
  $this->bulk_smush_content(); ?>
454
  * Outputs the Smush stats for the site
455
  */
456
  function smush_stats_container() {
457
+ global $WpSmush, $wpsmushnextgenstats, $wpsmush_bulkui, $wpsmush_db;
458
 
459
  //If we have resmush list, smushed_count = totalcount - resmush count, else smushed_count
460
  $smushed_count = ( $resmush_count = count( $this->resmush_ids ) ) > 0 ? ( $this->total_count - ( $resmush_count + $this->remaining_count ) ) : $this->smushed_count;
461
 
462
  $button = '<span class="spinner"></span><button tooltip="' . esc_html__( "Lets you check if any images can be further optimized. Useful after changing settings.", "wp-smushit" ) . '" data-type="nextgen" class="wp-smush-title button button-grey button-small wp-smush-scan">' . esc_html__( "RE-CHECK IMAGES", "wp-smushit" ) . '</button>';
463
+ $wpsmush_bulkui->container_header( 'smush-stats-wrapper', 'wp-smush-stats-box', esc_html__( "STATS", "wp-smushit" ), $button );?>
 
 
464
 
465
  <div class="box-content">
466
  <div class="row smush-total-savings smush-total-reduction-percent">
467
 
468
  <div class="wp-smush-current-progress">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
469
 
470
  <div class="wp-smush-count-total">
471
  <div class="wp-smush-smush-stats-wrapper">
472
  <span class="wp-smush-total-optimised"><?php echo $this->image_count; ?></span>
473
  </div>
474
+ <span class="total-stats-label"><?php esc_html_e( "Images smushed", "wp-smushit" ); ?></span>
475
  </div>
476
  </div>
477
  </div>
478
  <hr />
479
  <div class="row wp-smush-savings">
480
+ <span class="float-l wp-smush-stats-label"><?php esc_html_e("Total savings", "wp-smushit");?></span>
481
  <span class="float-r wp-smush-stats">
482
  <span class="wp-smush-stats-percent"><?php echo $this->stats['percent'] > 0 ? number_format_i18n( $this->stats['percent'], 1, '.', '' ) : 0; ?></span>%
483
  <span class="wp-smush-stats-sep">/</span>
493
  <hr>
494
  <div class="row super-smush-attachments">
495
  <span class="float-l wp-smush-stats-label">
496
+ <strong><?php esc_html_e( "Super-smushed images", "wp-smushit" ); ?></strong>
497
  </span>
498
  <span class="float-r wp-smush-stats">
499
  <?php
599
  //Set the counts
600
  $this->total_count = $wpsmushnextgenstats->total_count();
601
  $this->image_count = $this->get_image_count( $smushed_images );
602
+ $this->smushed_count = $smushed_images && is_array( $smushed_images ) ? count( $smushed_images ) : $smushed_images;
603
  $this->remaining_count = $wpsmushnextgenstats->get_ngg_images( 'unsmushed', true );
604
  }
605
 
673
 
674
  }
675
 
676
+ function update_stats( $id = '' ) {
677
+ if ( empty( $id ) ) {
678
+ return;
679
+ }
680
+ //Get the list of images for Gallery
681
+ if ( class_exists( 'C_Image_Mapper' ) ) {
682
+ $image_mapper = C_Image_Mapper::get_instance();
683
+ $images = $image_mapper->find_all_for_gallery( $id );
684
+ }
685
+ exit;
686
+ }
687
+
688
  }//End of Class
689
 
690
  }//End Of if class not exists
lib/nextgen-integration/class-wp-smush-nextgen-stats.php CHANGED
@@ -266,8 +266,7 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
266
  }
267
 
268
  //Check if Lossy enabled
269
- $opt_lossy = WP_SMUSH_PREFIX . 'lossy';
270
- $opt_lossy_val = $wpsmush_settings->get_setting( $opt_lossy, false );
271
 
272
  //Check if premium user, compression was lossless, and lossy compression is enabled
273
  if ( !$show_resmush && $this->is_pro_user && ! $is_lossy && $opt_lossy_val && ! empty( $image_type ) && $image_type != 'image/gif' ) {
@@ -369,7 +368,13 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
369
  * @return bool|mixed|void
370
  */
371
  function get_smush_stats() {
372
- global $WpSmush;
 
 
 
 
 
 
373
 
374
  //Clear up the stats
375
  if( 0 == $this->total_count() ) {
@@ -378,30 +383,32 @@ if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
378
  }
379
 
380
  // Check for the wp_smush_images_smushed in the 'nextgen' group.
381
- $smushed_stats = wp_cache_get( 'wp_smush_stats_nextgen', 'nextgen' );
382
 
383
  // If nothing is found, build the object.
384
- if ( false === $smushed_stats ) {
385
  // Check for the wp_smush_images in the 'nextgen' group.
386
- $smushed_stats = get_option( 'wp_smush_stats_nextgen', array() );
387
 
388
- if ( ! is_wp_error( $smushed_stats ) ) {
389
  // In this case we don't need a timed cache expiration.
390
- wp_cache_set( 'wp_smush_stats_nextgen', $smushed_stats, 'nextgen' );
391
  }
392
  }
393
- if ( empty( $smushed_stats['bytes'] ) || $smushed_stats['bytes'] < 0 ) {
394
- $smushed_stats['bytes'] = 0;
395
  }
396
 
397
- if ( ! empty( $smushed_stats['size_before'] ) && $smushed_stats['size_before'] > 0 ) {
398
- $smushed_stats['percent'] = ( $smushed_stats['bytes'] / $smushed_stats['size_before'] ) * 100;
399
  }
400
 
401
  //Round off precentage
402
- $smushed_stats['percent'] = ! empty( $smushed_stats['percent'] ) ? round( $smushed_stats['percent'], 1 ) : 0;
 
 
403
 
404
- $smushed_stats['human'] = size_format( $smushed_stats['bytes'], 1 );
405
 
406
  return $smushed_stats;
407
  }
266
  }
267
 
268
  //Check if Lossy enabled
269
+ $opt_lossy_val = $wpsmush_settings->settings['lossy'];
 
270
 
271
  //Check if premium user, compression was lossless, and lossy compression is enabled
272
  if ( !$show_resmush && $this->is_pro_user && ! $is_lossy && $opt_lossy_val && ! empty( $image_type ) && $image_type != 'image/gif' ) {
368
  * @return bool|mixed|void
369
  */
370
  function get_smush_stats() {
371
+
372
+ $smushed_stats = array(
373
+ 'savings_bytes' => 0,
374
+ 'size_before' => 0,
375
+ 'size_after' => 0,
376
+ 'savings_percent' => 0
377
+ );
378
 
379
  //Clear up the stats
380
  if( 0 == $this->total_count() ) {
383
  }
384
 
385
  // Check for the wp_smush_images_smushed in the 'nextgen' group.
386
+ $stats = wp_cache_get( 'wp_smush_stats_nextgen', 'nextgen' );
387
 
388
  // If nothing is found, build the object.
389
+ if ( false === $stats ) {
390
  // Check for the wp_smush_images in the 'nextgen' group.
391
+ $stats = get_option( 'wp_smush_stats_nextgen', array() );
392
 
393
+ if ( ! is_wp_error( $stats ) ) {
394
  // In this case we don't need a timed cache expiration.
395
+ wp_cache_set( 'wp_smush_stats_nextgen', $stats, 'nextgen' );
396
  }
397
  }
398
+ if ( empty( $stats['bytes'] ) || $stats['bytes'] < 0 ) {
399
+ $stats['bytes'] = 0;
400
  }
401
 
402
+ if ( ! empty( $stats['size_before'] ) && $stats['size_before'] > 0 ) {
403
+ $stats['percent'] = ( $stats['bytes'] / $stats['size_before'] ) * 100;
404
  }
405
 
406
  //Round off precentage
407
+ $stats['percent'] = ! empty( $stats['percent'] ) ? round( $stats['percent'], 1 ) : 0;
408
+
409
+ $stats['human'] = size_format( $stats['bytes'], 1 );
410
 
411
+ $smushed_stats = array_merge( $smushed_stats, $stats );
412
 
413
  return $smushed_stats;
414
  }
readme.txt CHANGED
@@ -1,13 +1,14 @@
1
  === Smush Image Compression and Optimization ===
2
  Plugin Name: Smush Image Compression and Optimization
3
- Version: 2.7.4.1
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.8
10
- Stable tag: 2.7.4.1
 
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.
@@ -130,9 +131,10 @@ Smush automatically handles optimizing all your images no matter where they come
130
 
131
  == Screenshots ==
132
 
133
- 1. Watch as your image library is processed up to 50 images at a time.
134
- 2. Set automatic smush to resize and optomize every image as it is uploaded.
135
- 3. Smush will find and optimize images for you.
 
136
 
137
  == Installation ==
138
 
@@ -148,6 +150,17 @@ Yahoo's Smush.it API is gone forever. So WPMU DEV built our own free API that is
148
 
149
  == Changelog ==
150
 
 
 
 
 
 
 
 
 
 
 
 
151
  = 2.7.4.1 =
152
 
153
  * Fixed:
@@ -168,7 +181,7 @@ Yahoo's Smush.it API is gone forever. So WPMU DEV built our own free API that is
168
 
169
  = 2.7.3 =
170
 
171
- * Fixed:
172
  * Manual Smush not working
173
  * Bulk Smush broken for few sites
174
 
1
  === Smush Image Compression and Optimization ===
2
  Plugin Name: Smush Image Compression and Optimization
3
+ Version: 2.7.5
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.8.2
10
+ Stable tag: 2.7.5
11
+ Requires PHP: 5.2.4
12
  License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
13
 
14
  Compress and optimize image files, improve performance and boost your SEO rank using Smush WordPress image compression and optimization.
131
 
132
  == Screenshots ==
133
 
134
+ 1. Optimize images with Smush to save space and speed up your sites.
135
+ 2. Watch as your image library is processed up to 50 images at a time.
136
+ 3. Set automatic smush to resize and optomize every image as it is uploaded.
137
+ 4. Smush will find and optimize images for you.
138
 
139
  == Installation ==
140
 
150
 
151
  == Changelog ==
152
 
153
+ = 2.7.5 =
154
+
155
+ * Updated:
156
+ * UI/UX has been updated for Bulk Smush page
157
+
158
+ * Fixed:
159
+ * Start from latest image while Bulk Smushing
160
+ * S3 config error if AWS keys are defined in wp-config.php
161
+ * NextGen smush page not working properly
162
+ * Do not redirect to settings page on activation if WP CLI is installed
163
+
164
  = 2.7.4.1 =
165
 
166
  * Fixed:
181
 
182
  = 2.7.3 =
183
 
184
+ *Fixed:
185
  * Manual Smush not working
186
  * Bulk Smush broken for few sites
187
 
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.7.4.1
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.7.4.1';
39
 
40
  //Deactivate the .org version, if pro version is active
41
  add_action( 'admin_init', 'deactivate_smush_org' );
@@ -216,10 +216,14 @@ if ( ! function_exists( 'smush_deactivated' ) ) {
216
  }
217
 
218
  if ( ! function_exists( 'smush_activated' ) ) {
219
- //Check if a existing install or new
 
 
220
  function smush_activated() {
 
221
 
222
  $version = get_site_option( WP_SMUSH_PREFIX . 'version' );
 
223
 
224
  //If the version is not saved or if the version is not same as the current version,
225
  if ( ! $version || WP_SMUSH_VERSION != $version ) {
@@ -232,7 +236,7 @@ if ( ! function_exists( 'smush_activated' ) ) {
232
  update_site_option( 'wp-smush-install-type', 'existing' );
233
  } else {
234
  //Check for existing settings
235
- if ( false !== get_site_option( WP_SMUSH_PREFIX . 'auto' ) || false !== get_option( WP_SMUSH_PREFIX . 'auto' ) ) {
236
  update_site_option( 'wp-smush-install-type', 'existing' );
237
  }
238
  }
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.5
8
  Author URI: http://premium.wpmudev.org/
9
  Text Domain: wp-smushit
10
  */
35
  * Constants
36
  */
37
  $prefix = 'WP_SMUSH_';
38
+ $version = '2.7.5';
39
 
40
  //Deactivate the .org version, if pro version is active
41
  add_action( 'admin_init', 'deactivate_smush_org' );
216
  }
217
 
218
  if ( ! function_exists( 'smush_activated' ) ) {
219
+ /**
220
+ * Check if a existing install or new
221
+ */
222
  function smush_activated() {
223
+ global $wpsmush_settings;
224
 
225
  $version = get_site_option( WP_SMUSH_PREFIX . 'version' );
226
+ $settings = !empty( $wpsmush_settings->settings ) ? $wpsmush_settings->settings : $wpsmush_settings->init_settings();
227
 
228
  //If the version is not saved or if the version is not same as the current version,
229
  if ( ! $version || WP_SMUSH_VERSION != $version ) {
236
  update_site_option( 'wp-smush-install-type', 'existing' );
237
  } else {
238
  //Check for existing settings
239
+ if ( false !== $settings['auto'] ) {
240
  update_site_option( 'wp-smush-install-type', 'existing' );
241
  }
242
  }