Version Description
- Fixed: Invalid header issue
- Fixed: Warnings in file functions
- Updated: Added limit on query results, for sites with higher image count, Use filter
wp_smush_media_query_limit
to adjust values - Added: Sortable WP Smush column in Media Library
- Added: Filters
wp_smush_media_image
for Media Gallery,wp_smush_nextgen_image
For NextGen gallery, allows to skip a particular image size from smushing - Added: NextGen Gallery support (Pro feature)
Download this release
Release Info
Developer | UmeshSingla |
Plugin | Smush Image Compression and Optimization |
Version | 2.0.7 |
Comparing to | |
See all releases |
Code changes from version 2.0.6.5 to 2.0.7
- assets/css/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- assets/css/jquery-ui.css +1225 -0
- assets/css/wp-smushit-admin.css +29 -1
- assets/images/help.png +0 -0
- assets/js/wp-smushit-admin-media.js +68 -62
- assets/js/wp-smushit-admin.js +68 -11
- languages/wp-smushit.pot +165 -98
- lib/class-wp-smush-admin.php +152 -43
- lib/class-wp-smush-bulk.php +35 -2
- lib/class-wp-smush-nextgen.php +435 -0
- lib/class-wp-smush.php +155 -25
- lib/nextgen-integration/class-wp-smush-nextgen-admin.php +474 -0
- lib/nextgen-integration/class-wp-smush-nextgen-bulk.php +41 -0
- lib/nextgen-integration/class-wp-smush-nextgen-stats.php +426 -0
- readme.txt +13 -3
- uninstall.php +32 -5
- wp-smush.php +48 -40
assets/css/images/ui-bg_flat_75_ffffff_40x100.png
ADDED
Binary file
|
assets/css/jquery-ui.css
ADDED
@@ -0,0 +1,1225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*! jQuery UI - v1.11.4 - 2015-03-11
|
2 |
+
* http://jqueryui.com
|
3 |
+
* Includes: core.css, accordion.css, autocomplete.css, button.css, datepicker.css, dialog.css, draggable.css, menu.css, progressbar.css, resizable.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
|
4 |
+
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
|
5 |
+
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
|
6 |
+
|
7 |
+
/* Layout helpers
|
8 |
+
----------------------------------*/
|
9 |
+
.ui-helper-hidden {
|
10 |
+
display: none;
|
11 |
+
}
|
12 |
+
.ui-helper-hidden-accessible {
|
13 |
+
border: 0;
|
14 |
+
clip: rect(0 0 0 0);
|
15 |
+
height: 1px;
|
16 |
+
margin: -1px;
|
17 |
+
overflow: hidden;
|
18 |
+
padding: 0;
|
19 |
+
position: absolute;
|
20 |
+
width: 1px;
|
21 |
+
}
|
22 |
+
.ui-helper-reset {
|
23 |
+
margin: 0;
|
24 |
+
padding: 0;
|
25 |
+
border: 0;
|
26 |
+
outline: 0;
|
27 |
+
line-height: 1.3;
|
28 |
+
text-decoration: none;
|
29 |
+
font-size: 100%;
|
30 |
+
list-style: none;
|
31 |
+
}
|
32 |
+
.ui-helper-clearfix:before,
|
33 |
+
.ui-helper-clearfix:after {
|
34 |
+
content: "";
|
35 |
+
display: table;
|
36 |
+
border-collapse: collapse;
|
37 |
+
}
|
38 |
+
.ui-helper-clearfix:after {
|
39 |
+
clear: both;
|
40 |
+
}
|
41 |
+
.ui-helper-clearfix {
|
42 |
+
min-height: 0; /* support: IE7 */
|
43 |
+
}
|
44 |
+
.ui-helper-zfix {
|
45 |
+
width: 100%;
|
46 |
+
height: 100%;
|
47 |
+
top: 0;
|
48 |
+
left: 0;
|
49 |
+
position: absolute;
|
50 |
+
opacity: 0;
|
51 |
+
filter:Alpha(Opacity=0); /* support: IE8 */
|
52 |
+
}
|
53 |
+
|
54 |
+
.ui-front {
|
55 |
+
z-index: 100;
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
/* Interaction Cues
|
60 |
+
----------------------------------*/
|
61 |
+
.ui-state-disabled {
|
62 |
+
cursor: default !important;
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
/* Icons
|
67 |
+
----------------------------------*/
|
68 |
+
|
69 |
+
/* states and images */
|
70 |
+
.ui-icon {
|
71 |
+
display: block;
|
72 |
+
text-indent: -99999px;
|
73 |
+
overflow: hidden;
|
74 |
+
background-repeat: no-repeat;
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
/* Misc visuals
|
79 |
+
----------------------------------*/
|
80 |
+
|
81 |
+
/* Overlays */
|
82 |
+
.ui-widget-overlay {
|
83 |
+
position: fixed;
|
84 |
+
top: 0;
|
85 |
+
left: 0;
|
86 |
+
width: 100%;
|
87 |
+
height: 100%;
|
88 |
+
}
|
89 |
+
.ui-accordion .ui-accordion-header {
|
90 |
+
display: block;
|
91 |
+
cursor: pointer;
|
92 |
+
position: relative;
|
93 |
+
margin: 2px 0 0 0;
|
94 |
+
padding: .5em .5em .5em .7em;
|
95 |
+
min-height: 0; /* support: IE7 */
|
96 |
+
font-size: 100%;
|
97 |
+
}
|
98 |
+
.ui-accordion .ui-accordion-icons {
|
99 |
+
padding-left: 2.2em;
|
100 |
+
}
|
101 |
+
.ui-accordion .ui-accordion-icons .ui-accordion-icons {
|
102 |
+
padding-left: 2.2em;
|
103 |
+
}
|
104 |
+
.ui-accordion .ui-accordion-header .ui-accordion-header-icon {
|
105 |
+
position: absolute;
|
106 |
+
left: .5em;
|
107 |
+
top: 50%;
|
108 |
+
margin-top: -8px;
|
109 |
+
}
|
110 |
+
.ui-accordion .ui-accordion-content {
|
111 |
+
padding: 1em 2.2em;
|
112 |
+
border-top: 0;
|
113 |
+
overflow: auto;
|
114 |
+
}
|
115 |
+
.ui-autocomplete {
|
116 |
+
position: absolute;
|
117 |
+
top: 0;
|
118 |
+
left: 0;
|
119 |
+
cursor: default;
|
120 |
+
}
|
121 |
+
.ui-button {
|
122 |
+
display: inline-block;
|
123 |
+
position: relative;
|
124 |
+
padding: 0;
|
125 |
+
line-height: normal;
|
126 |
+
margin-right: .1em;
|
127 |
+
cursor: pointer;
|
128 |
+
vertical-align: middle;
|
129 |
+
text-align: center;
|
130 |
+
overflow: visible; /* removes extra width in IE */
|
131 |
+
}
|
132 |
+
.ui-button,
|
133 |
+
.ui-button:link,
|
134 |
+
.ui-button:visited,
|
135 |
+
.ui-button:hover,
|
136 |
+
.ui-button:active {
|
137 |
+
text-decoration: none;
|
138 |
+
}
|
139 |
+
/* to make room for the icon, a width needs to be set here */
|
140 |
+
.ui-button-icon-only {
|
141 |
+
width: 2.2em;
|
142 |
+
}
|
143 |
+
/* button elements seem to need a little more width */
|
144 |
+
button.ui-button-icon-only {
|
145 |
+
width: 2.4em;
|
146 |
+
}
|
147 |
+
.ui-button-icons-only {
|
148 |
+
width: 3.4em;
|
149 |
+
}
|
150 |
+
button.ui-button-icons-only {
|
151 |
+
width: 3.7em;
|
152 |
+
}
|
153 |
+
|
154 |
+
/* button text element */
|
155 |
+
.ui-button .ui-button-text {
|
156 |
+
display: block;
|
157 |
+
line-height: normal;
|
158 |
+
}
|
159 |
+
.ui-button-text-only .ui-button-text {
|
160 |
+
padding: .4em 1em;
|
161 |
+
}
|
162 |
+
.ui-button-icon-only .ui-button-text,
|
163 |
+
.ui-button-icons-only .ui-button-text {
|
164 |
+
padding: .4em;
|
165 |
+
text-indent: -9999999px;
|
166 |
+
}
|
167 |
+
.ui-button-text-icon-primary .ui-button-text,
|
168 |
+
.ui-button-text-icons .ui-button-text {
|
169 |
+
padding: .4em 1em .4em 2.1em;
|
170 |
+
}
|
171 |
+
.ui-button-text-icon-secondary .ui-button-text,
|
172 |
+
.ui-button-text-icons .ui-button-text {
|
173 |
+
padding: .4em 2.1em .4em 1em;
|
174 |
+
}
|
175 |
+
.ui-button-text-icons .ui-button-text {
|
176 |
+
padding-left: 2.1em;
|
177 |
+
padding-right: 2.1em;
|
178 |
+
}
|
179 |
+
/* no icon support for input elements, provide padding by default */
|
180 |
+
input.ui-button {
|
181 |
+
padding: .4em 1em;
|
182 |
+
}
|
183 |
+
|
184 |
+
/* button icon element(s) */
|
185 |
+
.ui-button-icon-only .ui-icon,
|
186 |
+
.ui-button-text-icon-primary .ui-icon,
|
187 |
+
.ui-button-text-icon-secondary .ui-icon,
|
188 |
+
.ui-button-text-icons .ui-icon,
|
189 |
+
.ui-button-icons-only .ui-icon {
|
190 |
+
position: absolute;
|
191 |
+
top: 50%;
|
192 |
+
margin-top: -8px;
|
193 |
+
}
|
194 |
+
.ui-button-icon-only .ui-icon {
|
195 |
+
left: 50%;
|
196 |
+
margin-left: -8px;
|
197 |
+
}
|
198 |
+
.ui-button-text-icon-primary .ui-button-icon-primary,
|
199 |
+
.ui-button-text-icons .ui-button-icon-primary,
|
200 |
+
.ui-button-icons-only .ui-button-icon-primary {
|
201 |
+
left: .5em;
|
202 |
+
}
|
203 |
+
.ui-button-text-icon-secondary .ui-button-icon-secondary,
|
204 |
+
.ui-button-text-icons .ui-button-icon-secondary,
|
205 |
+
.ui-button-icons-only .ui-button-icon-secondary {
|
206 |
+
right: .5em;
|
207 |
+
}
|
208 |
+
|
209 |
+
/* button sets */
|
210 |
+
.ui-buttonset {
|
211 |
+
margin-right: 7px;
|
212 |
+
}
|
213 |
+
.ui-buttonset .ui-button {
|
214 |
+
margin-left: 0;
|
215 |
+
margin-right: -.3em;
|
216 |
+
}
|
217 |
+
|
218 |
+
/* workarounds */
|
219 |
+
/* reset extra padding in Firefox, see h5bp.com/l */
|
220 |
+
input.ui-button::-moz-focus-inner,
|
221 |
+
button.ui-button::-moz-focus-inner {
|
222 |
+
border: 0;
|
223 |
+
padding: 0;
|
224 |
+
}
|
225 |
+
.ui-datepicker {
|
226 |
+
width: 17em;
|
227 |
+
padding: .2em .2em 0;
|
228 |
+
display: none;
|
229 |
+
}
|
230 |
+
.ui-datepicker .ui-datepicker-header {
|
231 |
+
position: relative;
|
232 |
+
padding: .2em 0;
|
233 |
+
}
|
234 |
+
.ui-datepicker .ui-datepicker-prev,
|
235 |
+
.ui-datepicker .ui-datepicker-next {
|
236 |
+
position: absolute;
|
237 |
+
top: 2px;
|
238 |
+
width: 1.8em;
|
239 |
+
height: 1.8em;
|
240 |
+
}
|
241 |
+
.ui-datepicker .ui-datepicker-prev-hover,
|
242 |
+
.ui-datepicker .ui-datepicker-next-hover {
|
243 |
+
top: 1px;
|
244 |
+
}
|
245 |
+
.ui-datepicker .ui-datepicker-prev {
|
246 |
+
left: 2px;
|
247 |
+
}
|
248 |
+
.ui-datepicker .ui-datepicker-next {
|
249 |
+
right: 2px;
|
250 |
+
}
|
251 |
+
.ui-datepicker .ui-datepicker-prev-hover {
|
252 |
+
left: 1px;
|
253 |
+
}
|
254 |
+
.ui-datepicker .ui-datepicker-next-hover {
|
255 |
+
right: 1px;
|
256 |
+
}
|
257 |
+
.ui-datepicker .ui-datepicker-prev span,
|
258 |
+
.ui-datepicker .ui-datepicker-next span {
|
259 |
+
display: block;
|
260 |
+
position: absolute;
|
261 |
+
left: 50%;
|
262 |
+
margin-left: -8px;
|
263 |
+
top: 50%;
|
264 |
+
margin-top: -8px;
|
265 |
+
}
|
266 |
+
.ui-datepicker .ui-datepicker-title {
|
267 |
+
margin: 0 2.3em;
|
268 |
+
line-height: 1.8em;
|
269 |
+
text-align: center;
|
270 |
+
}
|
271 |
+
.ui-datepicker .ui-datepicker-title select {
|
272 |
+
font-size: 1em;
|
273 |
+
margin: 1px 0;
|
274 |
+
}
|
275 |
+
.ui-datepicker select.ui-datepicker-month,
|
276 |
+
.ui-datepicker select.ui-datepicker-year {
|
277 |
+
width: 45%;
|
278 |
+
}
|
279 |
+
.ui-datepicker table {
|
280 |
+
width: 100%;
|
281 |
+
font-size: .9em;
|
282 |
+
border-collapse: collapse;
|
283 |
+
margin: 0 0 .4em;
|
284 |
+
}
|
285 |
+
.ui-datepicker th {
|
286 |
+
padding: .7em .3em;
|
287 |
+
text-align: center;
|
288 |
+
font-weight: bold;
|
289 |
+
border: 0;
|
290 |
+
}
|
291 |
+
.ui-datepicker td {
|
292 |
+
border: 0;
|
293 |
+
padding: 1px;
|
294 |
+
}
|
295 |
+
.ui-datepicker td span,
|
296 |
+
.ui-datepicker td a {
|
297 |
+
display: block;
|
298 |
+
padding: .2em;
|
299 |
+
text-align: right;
|
300 |
+
text-decoration: none;
|
301 |
+
}
|
302 |
+
.ui-datepicker .ui-datepicker-buttonpane {
|
303 |
+
background-image: none;
|
304 |
+
margin: .7em 0 0 0;
|
305 |
+
padding: 0 .2em;
|
306 |
+
border-left: 0;
|
307 |
+
border-right: 0;
|
308 |
+
border-bottom: 0;
|
309 |
+
}
|
310 |
+
.ui-datepicker .ui-datepicker-buttonpane button {
|
311 |
+
float: right;
|
312 |
+
margin: .5em .2em .4em;
|
313 |
+
cursor: pointer;
|
314 |
+
padding: .2em .6em .3em .6em;
|
315 |
+
width: auto;
|
316 |
+
overflow: visible;
|
317 |
+
}
|
318 |
+
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
|
319 |
+
float: left;
|
320 |
+
}
|
321 |
+
|
322 |
+
/* with multiple calendars */
|
323 |
+
.ui-datepicker.ui-datepicker-multi {
|
324 |
+
width: auto;
|
325 |
+
}
|
326 |
+
.ui-datepicker-multi .ui-datepicker-group {
|
327 |
+
float: left;
|
328 |
+
}
|
329 |
+
.ui-datepicker-multi .ui-datepicker-group table {
|
330 |
+
width: 95%;
|
331 |
+
margin: 0 auto .4em;
|
332 |
+
}
|
333 |
+
.ui-datepicker-multi-2 .ui-datepicker-group {
|
334 |
+
width: 50%;
|
335 |
+
}
|
336 |
+
.ui-datepicker-multi-3 .ui-datepicker-group {
|
337 |
+
width: 33.3%;
|
338 |
+
}
|
339 |
+
.ui-datepicker-multi-4 .ui-datepicker-group {
|
340 |
+
width: 25%;
|
341 |
+
}
|
342 |
+
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
|
343 |
+
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
|
344 |
+
border-left-width: 0;
|
345 |
+
}
|
346 |
+
.ui-datepicker-multi .ui-datepicker-buttonpane {
|
347 |
+
clear: left;
|
348 |
+
}
|
349 |
+
.ui-datepicker-row-break {
|
350 |
+
clear: both;
|
351 |
+
width: 100%;
|
352 |
+
font-size: 0;
|
353 |
+
}
|
354 |
+
|
355 |
+
/* RTL support */
|
356 |
+
.ui-datepicker-rtl {
|
357 |
+
direction: rtl;
|
358 |
+
}
|
359 |
+
.ui-datepicker-rtl .ui-datepicker-prev {
|
360 |
+
right: 2px;
|
361 |
+
left: auto;
|
362 |
+
}
|
363 |
+
.ui-datepicker-rtl .ui-datepicker-next {
|
364 |
+
left: 2px;
|
365 |
+
right: auto;
|
366 |
+
}
|
367 |
+
.ui-datepicker-rtl .ui-datepicker-prev:hover {
|
368 |
+
right: 1px;
|
369 |
+
left: auto;
|
370 |
+
}
|
371 |
+
.ui-datepicker-rtl .ui-datepicker-next:hover {
|
372 |
+
left: 1px;
|
373 |
+
right: auto;
|
374 |
+
}
|
375 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane {
|
376 |
+
clear: right;
|
377 |
+
}
|
378 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane button {
|
379 |
+
float: left;
|
380 |
+
}
|
381 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
|
382 |
+
.ui-datepicker-rtl .ui-datepicker-group {
|
383 |
+
float: right;
|
384 |
+
}
|
385 |
+
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
|
386 |
+
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
|
387 |
+
border-right-width: 0;
|
388 |
+
border-left-width: 1px;
|
389 |
+
}
|
390 |
+
.ui-dialog {
|
391 |
+
overflow: hidden;
|
392 |
+
position: absolute;
|
393 |
+
top: 0;
|
394 |
+
left: 0;
|
395 |
+
padding: .2em;
|
396 |
+
outline: 0;
|
397 |
+
}
|
398 |
+
.ui-dialog .ui-dialog-titlebar {
|
399 |
+
padding: .4em 1em;
|
400 |
+
position: relative;
|
401 |
+
}
|
402 |
+
.ui-dialog .ui-dialog-title {
|
403 |
+
float: left;
|
404 |
+
margin: .1em 0;
|
405 |
+
white-space: nowrap;
|
406 |
+
width: 90%;
|
407 |
+
overflow: hidden;
|
408 |
+
text-overflow: ellipsis;
|
409 |
+
}
|
410 |
+
.ui-dialog .ui-dialog-titlebar-close {
|
411 |
+
position: absolute;
|
412 |
+
right: .3em;
|
413 |
+
top: 50%;
|
414 |
+
width: 20px;
|
415 |
+
margin: -10px 0 0 0;
|
416 |
+
padding: 1px;
|
417 |
+
height: 20px;
|
418 |
+
}
|
419 |
+
.ui-dialog .ui-dialog-content {
|
420 |
+
position: relative;
|
421 |
+
border: 0;
|
422 |
+
padding: .5em 1em;
|
423 |
+
background: none;
|
424 |
+
overflow: auto;
|
425 |
+
}
|
426 |
+
.ui-dialog .ui-dialog-buttonpane {
|
427 |
+
text-align: left;
|
428 |
+
border-width: 1px 0 0 0;
|
429 |
+
background-image: none;
|
430 |
+
margin-top: .5em;
|
431 |
+
padding: .3em 1em .5em .4em;
|
432 |
+
}
|
433 |
+
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
|
434 |
+
float: right;
|
435 |
+
}
|
436 |
+
.ui-dialog .ui-dialog-buttonpane button {
|
437 |
+
margin: .5em .4em .5em 0;
|
438 |
+
cursor: pointer;
|
439 |
+
}
|
440 |
+
.ui-dialog .ui-resizable-se {
|
441 |
+
width: 12px;
|
442 |
+
height: 12px;
|
443 |
+
right: -5px;
|
444 |
+
bottom: -5px;
|
445 |
+
background-position: 16px 16px;
|
446 |
+
}
|
447 |
+
.ui-draggable .ui-dialog-titlebar {
|
448 |
+
cursor: move;
|
449 |
+
}
|
450 |
+
.ui-draggable-handle {
|
451 |
+
-ms-touch-action: none;
|
452 |
+
touch-action: none;
|
453 |
+
}
|
454 |
+
.ui-menu {
|
455 |
+
list-style: none;
|
456 |
+
padding: 0;
|
457 |
+
margin: 0;
|
458 |
+
display: block;
|
459 |
+
outline: none;
|
460 |
+
}
|
461 |
+
.ui-menu .ui-menu {
|
462 |
+
position: absolute;
|
463 |
+
}
|
464 |
+
.ui-menu .ui-menu-item {
|
465 |
+
position: relative;
|
466 |
+
margin: 0;
|
467 |
+
padding: 3px 1em 3px .4em;
|
468 |
+
cursor: pointer;
|
469 |
+
min-height: 0; /* support: IE7 */
|
470 |
+
/* support: IE10, see #8844 */
|
471 |
+
list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");
|
472 |
+
}
|
473 |
+
.ui-menu .ui-menu-divider {
|
474 |
+
margin: 5px 0;
|
475 |
+
height: 0;
|
476 |
+
font-size: 0;
|
477 |
+
line-height: 0;
|
478 |
+
border-width: 1px 0 0 0;
|
479 |
+
}
|
480 |
+
.ui-menu .ui-state-focus,
|
481 |
+
.ui-menu .ui-state-active {
|
482 |
+
margin: -1px;
|
483 |
+
}
|
484 |
+
|
485 |
+
/* icon support */
|
486 |
+
.ui-menu-icons {
|
487 |
+
position: relative;
|
488 |
+
}
|
489 |
+
.ui-menu-icons .ui-menu-item {
|
490 |
+
padding-left: 2em;
|
491 |
+
}
|
492 |
+
|
493 |
+
/* left-aligned */
|
494 |
+
.ui-menu .ui-icon {
|
495 |
+
position: absolute;
|
496 |
+
top: 0;
|
497 |
+
bottom: 0;
|
498 |
+
left: .2em;
|
499 |
+
margin: auto 0;
|
500 |
+
}
|
501 |
+
|
502 |
+
/* right-aligned */
|
503 |
+
.ui-menu .ui-menu-icon {
|
504 |
+
left: auto;
|
505 |
+
right: 0;
|
506 |
+
}
|
507 |
+
.ui-progressbar {
|
508 |
+
height: 2em;
|
509 |
+
text-align: left;
|
510 |
+
overflow: hidden;
|
511 |
+
}
|
512 |
+
.ui-progressbar .ui-progressbar-value {
|
513 |
+
margin: -1px;
|
514 |
+
height: 100%;
|
515 |
+
}
|
516 |
+
.ui-progressbar .ui-progressbar-overlay {
|
517 |
+
background: url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");
|
518 |
+
height: 100%;
|
519 |
+
filter: alpha(opacity=25); /* support: IE8 */
|
520 |
+
opacity: 0.25;
|
521 |
+
}
|
522 |
+
.ui-progressbar-indeterminate .ui-progressbar-value {
|
523 |
+
background-image: none;
|
524 |
+
}
|
525 |
+
.ui-resizable {
|
526 |
+
position: relative;
|
527 |
+
}
|
528 |
+
.ui-resizable-handle {
|
529 |
+
position: absolute;
|
530 |
+
font-size: 0.1px;
|
531 |
+
display: block;
|
532 |
+
-ms-touch-action: none;
|
533 |
+
touch-action: none;
|
534 |
+
}
|
535 |
+
.ui-resizable-disabled .ui-resizable-handle,
|
536 |
+
.ui-resizable-autohide .ui-resizable-handle {
|
537 |
+
display: none;
|
538 |
+
}
|
539 |
+
.ui-resizable-n {
|
540 |
+
cursor: n-resize;
|
541 |
+
height: 7px;
|
542 |
+
width: 100%;
|
543 |
+
top: -5px;
|
544 |
+
left: 0;
|
545 |
+
}
|
546 |
+
.ui-resizable-s {
|
547 |
+
cursor: s-resize;
|
548 |
+
height: 7px;
|
549 |
+
width: 100%;
|
550 |
+
bottom: -5px;
|
551 |
+
left: 0;
|
552 |
+
}
|
553 |
+
.ui-resizable-e {
|
554 |
+
cursor: e-resize;
|
555 |
+
width: 7px;
|
556 |
+
right: -5px;
|
557 |
+
top: 0;
|
558 |
+
height: 100%;
|
559 |
+
}
|
560 |
+
.ui-resizable-w {
|
561 |
+
cursor: w-resize;
|
562 |
+
width: 7px;
|
563 |
+
left: -5px;
|
564 |
+
top: 0;
|
565 |
+
height: 100%;
|
566 |
+
}
|
567 |
+
.ui-resizable-se {
|
568 |
+
cursor: se-resize;
|
569 |
+
width: 12px;
|
570 |
+
height: 12px;
|
571 |
+
right: 1px;
|
572 |
+
bottom: 1px;
|
573 |
+
}
|
574 |
+
.ui-resizable-sw {
|
575 |
+
cursor: sw-resize;
|
576 |
+
width: 9px;
|
577 |
+
height: 9px;
|
578 |
+
left: -5px;
|
579 |
+
bottom: -5px;
|
580 |
+
}
|
581 |
+
.ui-resizable-nw {
|
582 |
+
cursor: nw-resize;
|
583 |
+
width: 9px;
|
584 |
+
height: 9px;
|
585 |
+
left: -5px;
|
586 |
+
top: -5px;
|
587 |
+
}
|
588 |
+
.ui-resizable-ne {
|
589 |
+
cursor: ne-resize;
|
590 |
+
width: 9px;
|
591 |
+
height: 9px;
|
592 |
+
right: -5px;
|
593 |
+
top: -5px;
|
594 |
+
}
|
595 |
+
.ui-selectable {
|
596 |
+
-ms-touch-action: none;
|
597 |
+
touch-action: none;
|
598 |
+
}
|
599 |
+
.ui-selectable-helper {
|
600 |
+
position: absolute;
|
601 |
+
z-index: 100;
|
602 |
+
border: 1px dotted black;
|
603 |
+
}
|
604 |
+
.ui-selectmenu-menu {
|
605 |
+
padding: 0;
|
606 |
+
margin: 0;
|
607 |
+
position: absolute;
|
608 |
+
top: 0;
|
609 |
+
left: 0;
|
610 |
+
display: none;
|
611 |
+
}
|
612 |
+
.ui-selectmenu-menu .ui-menu {
|
613 |
+
overflow: auto;
|
614 |
+
/* Support: IE7 */
|
615 |
+
overflow-x: hidden;
|
616 |
+
padding-bottom: 1px;
|
617 |
+
}
|
618 |
+
.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup {
|
619 |
+
font-size: 1em;
|
620 |
+
font-weight: bold;
|
621 |
+
line-height: 1.5;
|
622 |
+
padding: 2px 0.4em;
|
623 |
+
margin: 0.5em 0 0 0;
|
624 |
+
height: auto;
|
625 |
+
border: 0;
|
626 |
+
}
|
627 |
+
.ui-selectmenu-open {
|
628 |
+
display: block;
|
629 |
+
}
|
630 |
+
.ui-selectmenu-button {
|
631 |
+
display: inline-block;
|
632 |
+
overflow: hidden;
|
633 |
+
position: relative;
|
634 |
+
text-decoration: none;
|
635 |
+
cursor: pointer;
|
636 |
+
}
|
637 |
+
.ui-selectmenu-button span.ui-icon {
|
638 |
+
right: 0.5em;
|
639 |
+
left: auto;
|
640 |
+
margin-top: -8px;
|
641 |
+
position: absolute;
|
642 |
+
top: 50%;
|
643 |
+
}
|
644 |
+
.ui-selectmenu-button span.ui-selectmenu-text {
|
645 |
+
text-align: left;
|
646 |
+
padding: 0.4em 2.1em 0.4em 1em;
|
647 |
+
display: block;
|
648 |
+
line-height: 1.4;
|
649 |
+
overflow: hidden;
|
650 |
+
text-overflow: ellipsis;
|
651 |
+
white-space: nowrap;
|
652 |
+
}
|
653 |
+
.ui-slider {
|
654 |
+
position: relative;
|
655 |
+
text-align: left;
|
656 |
+
}
|
657 |
+
.ui-slider .ui-slider-handle {
|
658 |
+
position: absolute;
|
659 |
+
z-index: 2;
|
660 |
+
width: 1.2em;
|
661 |
+
height: 1.2em;
|
662 |
+
cursor: default;
|
663 |
+
-ms-touch-action: none;
|
664 |
+
touch-action: none;
|
665 |
+
}
|
666 |
+
.ui-slider .ui-slider-range {
|
667 |
+
position: absolute;
|
668 |
+
z-index: 1;
|
669 |
+
font-size: .7em;
|
670 |
+
display: block;
|
671 |
+
border: 0;
|
672 |
+
background-position: 0 0;
|
673 |
+
}
|
674 |
+
|
675 |
+
/* support: IE8 - See #6727 */
|
676 |
+
.ui-slider.ui-state-disabled .ui-slider-handle,
|
677 |
+
.ui-slider.ui-state-disabled .ui-slider-range {
|
678 |
+
filter: inherit;
|
679 |
+
}
|
680 |
+
|
681 |
+
.ui-slider-horizontal {
|
682 |
+
height: .8em;
|
683 |
+
}
|
684 |
+
.ui-slider-horizontal .ui-slider-handle {
|
685 |
+
top: -.3em;
|
686 |
+
margin-left: -.6em;
|
687 |
+
}
|
688 |
+
.ui-slider-horizontal .ui-slider-range {
|
689 |
+
top: 0;
|
690 |
+
height: 100%;
|
691 |
+
}
|
692 |
+
.ui-slider-horizontal .ui-slider-range-min {
|
693 |
+
left: 0;
|
694 |
+
}
|
695 |
+
.ui-slider-horizontal .ui-slider-range-max {
|
696 |
+
right: 0;
|
697 |
+
}
|
698 |
+
|
699 |
+
.ui-slider-vertical {
|
700 |
+
width: .8em;
|
701 |
+
height: 100px;
|
702 |
+
}
|
703 |
+
.ui-slider-vertical .ui-slider-handle {
|
704 |
+
left: -.3em;
|
705 |
+
margin-left: 0;
|
706 |
+
margin-bottom: -.6em;
|
707 |
+
}
|
708 |
+
.ui-slider-vertical .ui-slider-range {
|
709 |
+
left: 0;
|
710 |
+
width: 100%;
|
711 |
+
}
|
712 |
+
.ui-slider-vertical .ui-slider-range-min {
|
713 |
+
bottom: 0;
|
714 |
+
}
|
715 |
+
.ui-slider-vertical .ui-slider-range-max {
|
716 |
+
top: 0;
|
717 |
+
}
|
718 |
+
.ui-sortable-handle {
|
719 |
+
-ms-touch-action: none;
|
720 |
+
touch-action: none;
|
721 |
+
}
|
722 |
+
.ui-spinner {
|
723 |
+
position: relative;
|
724 |
+
display: inline-block;
|
725 |
+
overflow: hidden;
|
726 |
+
padding: 0;
|
727 |
+
vertical-align: middle;
|
728 |
+
}
|
729 |
+
.ui-spinner-input {
|
730 |
+
border: none;
|
731 |
+
background: none;
|
732 |
+
color: inherit;
|
733 |
+
padding: 0;
|
734 |
+
margin: .2em 0;
|
735 |
+
vertical-align: middle;
|
736 |
+
margin-left: .4em;
|
737 |
+
margin-right: 22px;
|
738 |
+
}
|
739 |
+
.ui-spinner-button {
|
740 |
+
width: 16px;
|
741 |
+
height: 50%;
|
742 |
+
font-size: .5em;
|
743 |
+
padding: 0;
|
744 |
+
margin: 0;
|
745 |
+
text-align: center;
|
746 |
+
position: absolute;
|
747 |
+
cursor: default;
|
748 |
+
display: block;
|
749 |
+
overflow: hidden;
|
750 |
+
right: 0;
|
751 |
+
}
|
752 |
+
/* more specificity required here to override default borders */
|
753 |
+
.ui-spinner a.ui-spinner-button {
|
754 |
+
border-top: none;
|
755 |
+
border-bottom: none;
|
756 |
+
border-right: none;
|
757 |
+
}
|
758 |
+
/* vertically center icon */
|
759 |
+
.ui-spinner .ui-icon {
|
760 |
+
position: absolute;
|
761 |
+
margin-top: -8px;
|
762 |
+
top: 50%;
|
763 |
+
left: 0;
|
764 |
+
}
|
765 |
+
.ui-spinner-up {
|
766 |
+
top: 0;
|
767 |
+
}
|
768 |
+
.ui-spinner-down {
|
769 |
+
bottom: 0;
|
770 |
+
}
|
771 |
+
|
772 |
+
/* TR overrides */
|
773 |
+
.ui-spinner .ui-icon-triangle-1-s {
|
774 |
+
/* need to fix icons sprite */
|
775 |
+
background-position: -65px -16px;
|
776 |
+
}
|
777 |
+
.ui-tabs {
|
778 |
+
position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
|
779 |
+
padding: .2em;
|
780 |
+
}
|
781 |
+
.ui-tabs .ui-tabs-nav {
|
782 |
+
margin: 0;
|
783 |
+
padding: .2em .2em 0;
|
784 |
+
}
|
785 |
+
.ui-tabs .ui-tabs-nav li {
|
786 |
+
list-style: none;
|
787 |
+
float: left;
|
788 |
+
position: relative;
|
789 |
+
top: 0;
|
790 |
+
margin: 1px .2em 0 0;
|
791 |
+
border-bottom-width: 0;
|
792 |
+
padding: 0;
|
793 |
+
white-space: nowrap;
|
794 |
+
}
|
795 |
+
.ui-tabs .ui-tabs-nav .ui-tabs-anchor {
|
796 |
+
float: left;
|
797 |
+
padding: .5em 1em;
|
798 |
+
text-decoration: none;
|
799 |
+
}
|
800 |
+
.ui-tabs .ui-tabs-nav li.ui-tabs-active {
|
801 |
+
margin-bottom: -1px;
|
802 |
+
padding-bottom: 1px;
|
803 |
+
}
|
804 |
+
.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,
|
805 |
+
.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,
|
806 |
+
.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor {
|
807 |
+
cursor: text;
|
808 |
+
}
|
809 |
+
.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor {
|
810 |
+
cursor: pointer;
|
811 |
+
}
|
812 |
+
.ui-tabs .ui-tabs-panel {
|
813 |
+
display: block;
|
814 |
+
border-width: 0;
|
815 |
+
padding: 1em 1.4em;
|
816 |
+
background: none;
|
817 |
+
}
|
818 |
+
.ui-tooltip {
|
819 |
+
padding: 8px;
|
820 |
+
position: absolute;
|
821 |
+
z-index: 9999;
|
822 |
+
max-width: 300px;
|
823 |
+
-webkit-box-shadow: 0 0 5px #aaa;
|
824 |
+
box-shadow: 0 0 5px #aaa;
|
825 |
+
}
|
826 |
+
body .ui-tooltip {
|
827 |
+
border-width: 2px;
|
828 |
+
}
|
829 |
+
|
830 |
+
/* Component containers
|
831 |
+
----------------------------------*/
|
832 |
+
.ui-widget {
|
833 |
+
font-family: Verdana,Arial,sans-serif;
|
834 |
+
font-size: 1.1em;
|
835 |
+
}
|
836 |
+
.ui-widget .ui-widget {
|
837 |
+
font-size: 1em;
|
838 |
+
}
|
839 |
+
.ui-widget input,
|
840 |
+
.ui-widget select,
|
841 |
+
.ui-widget textarea,
|
842 |
+
.ui-widget button {
|
843 |
+
font-family: Verdana,Arial,sans-serif;
|
844 |
+
font-size: 1em;
|
845 |
+
}
|
846 |
+
.ui-widget-content {
|
847 |
+
border: 1px solid #aaaaaa;
|
848 |
+
background: #ffffff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x;
|
849 |
+
color: #222222;
|
850 |
+
}
|
851 |
+
.ui-widget-content a {
|
852 |
+
color: #222222;
|
853 |
+
}
|
854 |
+
.ui-widget-header {
|
855 |
+
border: 1px solid #aaaaaa;
|
856 |
+
background: #cccccc url("images/ui-bg_highlight-soft_75_cccccc_1x100.png") 50% 50% repeat-x;
|
857 |
+
color: #222222;
|
858 |
+
font-weight: bold;
|
859 |
+
}
|
860 |
+
.ui-widget-header a {
|
861 |
+
color: #222222;
|
862 |
+
}
|
863 |
+
|
864 |
+
/* Interaction states
|
865 |
+
----------------------------------*/
|
866 |
+
.ui-state-default,
|
867 |
+
.ui-widget-content .ui-state-default,
|
868 |
+
.ui-widget-header .ui-state-default {
|
869 |
+
border: 1px solid #d3d3d3;
|
870 |
+
background: #e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") 50% 50% repeat-x;
|
871 |
+
font-weight: normal;
|
872 |
+
color: #555555;
|
873 |
+
}
|
874 |
+
.ui-state-default a,
|
875 |
+
.ui-state-default a:link,
|
876 |
+
.ui-state-default a:visited {
|
877 |
+
color: #555555;
|
878 |
+
text-decoration: none;
|
879 |
+
}
|
880 |
+
.ui-state-hover,
|
881 |
+
.ui-widget-content .ui-state-hover,
|
882 |
+
.ui-widget-header .ui-state-hover,
|
883 |
+
.ui-state-focus,
|
884 |
+
.ui-widget-content .ui-state-focus,
|
885 |
+
.ui-widget-header .ui-state-focus {
|
886 |
+
border: 1px solid #999999;
|
887 |
+
background: #dadada url("images/ui-bg_glass_75_dadada_1x400.png") 50% 50% repeat-x;
|
888 |
+
font-weight: normal;
|
889 |
+
color: #212121;
|
890 |
+
}
|
891 |
+
.ui-state-hover a,
|
892 |
+
.ui-state-hover a:hover,
|
893 |
+
.ui-state-hover a:link,
|
894 |
+
.ui-state-hover a:visited,
|
895 |
+
.ui-state-focus a,
|
896 |
+
.ui-state-focus a:hover,
|
897 |
+
.ui-state-focus a:link,
|
898 |
+
.ui-state-focus a:visited {
|
899 |
+
color: #212121;
|
900 |
+
text-decoration: none;
|
901 |
+
}
|
902 |
+
.ui-state-active,
|
903 |
+
.ui-widget-content .ui-state-active,
|
904 |
+
.ui-widget-header .ui-state-active {
|
905 |
+
border: 1px solid #aaaaaa;
|
906 |
+
background: #ffffff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;
|
907 |
+
font-weight: normal;
|
908 |
+
color: #212121;
|
909 |
+
}
|
910 |
+
.ui-state-active a,
|
911 |
+
.ui-state-active a:link,
|
912 |
+
.ui-state-active a:visited {
|
913 |
+
color: #212121;
|
914 |
+
text-decoration: none;
|
915 |
+
}
|
916 |
+
|
917 |
+
/* Interaction Cues
|
918 |
+
----------------------------------*/
|
919 |
+
.ui-state-highlight,
|
920 |
+
.ui-widget-content .ui-state-highlight,
|
921 |
+
.ui-widget-header .ui-state-highlight {
|
922 |
+
border: 1px solid #fcefa1;
|
923 |
+
background: #fbf9ee url("images/ui-bg_glass_55_fbf9ee_1x400.png") 50% 50% repeat-x;
|
924 |
+
color: #363636;
|
925 |
+
}
|
926 |
+
.ui-state-highlight a,
|
927 |
+
.ui-widget-content .ui-state-highlight a,
|
928 |
+
.ui-widget-header .ui-state-highlight a {
|
929 |
+
color: #363636;
|
930 |
+
}
|
931 |
+
.ui-state-error,
|
932 |
+
.ui-widget-content .ui-state-error,
|
933 |
+
.ui-widget-header .ui-state-error {
|
934 |
+
border: 1px solid #cd0a0a;
|
935 |
+
background: #fef1ec url("images/ui-bg_glass_95_fef1ec_1x400.png") 50% 50% repeat-x;
|
936 |
+
color: #cd0a0a;
|
937 |
+
}
|
938 |
+
.ui-state-error a,
|
939 |
+
.ui-widget-content .ui-state-error a,
|
940 |
+
.ui-widget-header .ui-state-error a {
|
941 |
+
color: #cd0a0a;
|
942 |
+
}
|
943 |
+
.ui-state-error-text,
|
944 |
+
.ui-widget-content .ui-state-error-text,
|
945 |
+
.ui-widget-header .ui-state-error-text {
|
946 |
+
color: #cd0a0a;
|
947 |
+
}
|
948 |
+
.ui-priority-primary,
|
949 |
+
.ui-widget-content .ui-priority-primary,
|
950 |
+
.ui-widget-header .ui-priority-primary {
|
951 |
+
font-weight: bold;
|
952 |
+
}
|
953 |
+
.ui-priority-secondary,
|
954 |
+
.ui-widget-content .ui-priority-secondary,
|
955 |
+
.ui-widget-header .ui-priority-secondary {
|
956 |
+
opacity: .7;
|
957 |
+
filter:Alpha(Opacity=70); /* support: IE8 */
|
958 |
+
font-weight: normal;
|
959 |
+
}
|
960 |
+
.ui-state-disabled,
|
961 |
+
.ui-widget-content .ui-state-disabled,
|
962 |
+
.ui-widget-header .ui-state-disabled {
|
963 |
+
opacity: .35;
|
964 |
+
filter:Alpha(Opacity=35); /* support: IE8 */
|
965 |
+
background-image: none;
|
966 |
+
}
|
967 |
+
.ui-state-disabled .ui-icon {
|
968 |
+
filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */
|
969 |
+
}
|
970 |
+
|
971 |
+
/* Icons
|
972 |
+
----------------------------------*/
|
973 |
+
|
974 |
+
/* states and images */
|
975 |
+
.ui-icon {
|
976 |
+
width: 16px;
|
977 |
+
height: 16px;
|
978 |
+
}
|
979 |
+
.ui-icon,
|
980 |
+
.ui-widget-content .ui-icon {
|
981 |
+
background-image: url("images/ui-icons_222222_256x240.png");
|
982 |
+
}
|
983 |
+
.ui-widget-header .ui-icon {
|
984 |
+
background-image: url("images/ui-icons_222222_256x240.png");
|
985 |
+
}
|
986 |
+
.ui-state-default .ui-icon {
|
987 |
+
background-image: url("images/ui-icons_888888_256x240.png");
|
988 |
+
}
|
989 |
+
.ui-state-hover .ui-icon,
|
990 |
+
.ui-state-focus .ui-icon {
|
991 |
+
background-image: url("images/ui-icons_454545_256x240.png");
|
992 |
+
}
|
993 |
+
.ui-state-active .ui-icon {
|
994 |
+
background-image: url("images/ui-icons_454545_256x240.png");
|
995 |
+
}
|
996 |
+
.ui-state-highlight .ui-icon {
|
997 |
+
background-image: url("images/ui-icons_2e83ff_256x240.png");
|
998 |
+
}
|
999 |
+
.ui-state-error .ui-icon,
|
1000 |
+
.ui-state-error-text .ui-icon {
|
1001 |
+
background-image: url("images/ui-icons_cd0a0a_256x240.png");
|
1002 |
+
}
|
1003 |
+
|
1004 |
+
/* positioning */
|
1005 |
+
.ui-icon-blank { background-position: 16px 16px; }
|
1006 |
+
.ui-icon-carat-1-n { background-position: 0 0; }
|
1007 |
+
.ui-icon-carat-1-ne { background-position: -16px 0; }
|
1008 |
+
.ui-icon-carat-1-e { background-position: -32px 0; }
|
1009 |
+
.ui-icon-carat-1-se { background-position: -48px 0; }
|
1010 |
+
.ui-icon-carat-1-s { background-position: -64px 0; }
|
1011 |
+
.ui-icon-carat-1-sw { background-position: -80px 0; }
|
1012 |
+
.ui-icon-carat-1-w { background-position: -96px 0; }
|
1013 |
+
.ui-icon-carat-1-nw { background-position: -112px 0; }
|
1014 |
+
.ui-icon-carat-2-n-s { background-position: -128px 0; }
|
1015 |
+
.ui-icon-carat-2-e-w { background-position: -144px 0; }
|
1016 |
+
.ui-icon-triangle-1-n { background-position: 0 -16px; }
|
1017 |
+
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
|
1018 |
+
.ui-icon-triangle-1-e { background-position: -32px -16px; }
|
1019 |
+
.ui-icon-triangle-1-se { background-position: -48px -16px; }
|
1020 |
+
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
1021 |
+
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
|
1022 |
+
.ui-icon-triangle-1-w { background-position: -96px -16px; }
|
1023 |
+
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
|
1024 |
+
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
|
1025 |
+
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
|
1026 |
+
.ui-icon-arrow-1-n { background-position: 0 -32px; }
|
1027 |
+
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
|
1028 |
+
.ui-icon-arrow-1-e { background-position: -32px -32px; }
|
1029 |
+
.ui-icon-arrow-1-se { background-position: -48px -32px; }
|
1030 |
+
.ui-icon-arrow-1-s { background-position: -64px -32px; }
|
1031 |
+
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
|
1032 |
+
.ui-icon-arrow-1-w { background-position: -96px -32px; }
|
1033 |
+
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
|
1034 |
+
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
|
1035 |
+
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
|
1036 |
+
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
|
1037 |
+
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
|
1038 |
+
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
|
1039 |
+
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
|
1040 |
+
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
|
1041 |
+
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
|
1042 |
+
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
|
1043 |
+
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
|
1044 |
+
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
|
1045 |
+
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
|
1046 |
+
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
|
1047 |
+
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
|
1048 |
+
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
|
1049 |
+
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
|
1050 |
+
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
|
1051 |
+
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
|
1052 |
+
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
|
1053 |
+
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
|
1054 |
+
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
|
1055 |
+
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
|
1056 |
+
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
|
1057 |
+
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
|
1058 |
+
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
|
1059 |
+
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
|
1060 |
+
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
|
1061 |
+
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
|
1062 |
+
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
|
1063 |
+
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
|
1064 |
+
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
|
1065 |
+
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
|
1066 |
+
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
|
1067 |
+
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
|
1068 |
+
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
|
1069 |
+
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
|
1070 |
+
.ui-icon-arrow-4 { background-position: 0 -80px; }
|
1071 |
+
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
|
1072 |
+
.ui-icon-extlink { background-position: -32px -80px; }
|
1073 |
+
.ui-icon-newwin { background-position: -48px -80px; }
|
1074 |
+
.ui-icon-refresh { background-position: -64px -80px; }
|
1075 |
+
.ui-icon-shuffle { background-position: -80px -80px; }
|
1076 |
+
.ui-icon-transfer-e-w { background-position: -96px -80px; }
|
1077 |
+
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
|
1078 |
+
.ui-icon-folder-collapsed { background-position: 0 -96px; }
|
1079 |
+
.ui-icon-folder-open { background-position: -16px -96px; }
|
1080 |
+
.ui-icon-document { background-position: -32px -96px; }
|
1081 |
+
.ui-icon-document-b { background-position: -48px -96px; }
|
1082 |
+
.ui-icon-note { background-position: -64px -96px; }
|
1083 |
+
.ui-icon-mail-closed { background-position: -80px -96px; }
|
1084 |
+
.ui-icon-mail-open { background-position: -96px -96px; }
|
1085 |
+
.ui-icon-suitcase { background-position: -112px -96px; }
|
1086 |
+
.ui-icon-comment { background-position: -128px -96px; }
|
1087 |
+
.ui-icon-person { background-position: -144px -96px; }
|
1088 |
+
.ui-icon-print { background-position: -160px -96px; }
|
1089 |
+
.ui-icon-trash { background-position: -176px -96px; }
|
1090 |
+
.ui-icon-locked { background-position: -192px -96px; }
|
1091 |
+
.ui-icon-unlocked { background-position: -208px -96px; }
|
1092 |
+
.ui-icon-bookmark { background-position: -224px -96px; }
|
1093 |
+
.ui-icon-tag { background-position: -240px -96px; }
|
1094 |
+
.ui-icon-home { background-position: 0 -112px; }
|
1095 |
+
.ui-icon-flag { background-position: -16px -112px; }
|
1096 |
+
.ui-icon-calendar { background-position: -32px -112px; }
|
1097 |
+
.ui-icon-cart { background-position: -48px -112px; }
|
1098 |
+
.ui-icon-pencil { background-position: -64px -112px; }
|
1099 |
+
.ui-icon-clock { background-position: -80px -112px; }
|
1100 |
+
.ui-icon-disk { background-position: -96px -112px; }
|
1101 |
+
.ui-icon-calculator { background-position: -112px -112px; }
|
1102 |
+
.ui-icon-zoomin { background-position: -128px -112px; }
|
1103 |
+
.ui-icon-zoomout { background-position: -144px -112px; }
|
1104 |
+
.ui-icon-search { background-position: -160px -112px; }
|
1105 |
+
.ui-icon-wrench { background-position: -176px -112px; }
|
1106 |
+
.ui-icon-gear { background-position: -192px -112px; }
|
1107 |
+
.ui-icon-heart { background-position: -208px -112px; }
|
1108 |
+
.ui-icon-star { background-position: -224px -112px; }
|
1109 |
+
.ui-icon-link { background-position: -240px -112px; }
|
1110 |
+
.ui-icon-cancel { background-position: 0 -128px; }
|
1111 |
+
.ui-icon-plus { background-position: -16px -128px; }
|
1112 |
+
.ui-icon-plusthick { background-position: -32px -128px; }
|
1113 |
+
.ui-icon-minus { background-position: -48px -128px; }
|
1114 |
+
.ui-icon-minusthick { background-position: -64px -128px; }
|
1115 |
+
.ui-icon-close { background-position: -80px -128px; }
|
1116 |
+
.ui-icon-closethick { background-position: -96px -128px; }
|
1117 |
+
.ui-icon-key { background-position: -112px -128px; }
|
1118 |
+
.ui-icon-lightbulb { background-position: -128px -128px; }
|
1119 |
+
.ui-icon-scissors { background-position: -144px -128px; }
|
1120 |
+
.ui-icon-clipboard { background-position: -160px -128px; }
|
1121 |
+
.ui-icon-copy { background-position: -176px -128px; }
|
1122 |
+
.ui-icon-contact { background-position: -192px -128px; }
|
1123 |
+
.ui-icon-image { background-position: -208px -128px; }
|
1124 |
+
.ui-icon-video { background-position: -224px -128px; }
|
1125 |
+
.ui-icon-script { background-position: -240px -128px; }
|
1126 |
+
.ui-icon-alert { background-position: 0 -144px; }
|
1127 |
+
.ui-icon-info { background-position: -16px -144px; }
|
1128 |
+
.ui-icon-notice { background-position: -32px -144px; }
|
1129 |
+
.ui-icon-help { background-position: -48px -144px; }
|
1130 |
+
.ui-icon-check { background-position: -64px -144px; }
|
1131 |
+
.ui-icon-bullet { background-position: -80px -144px; }
|
1132 |
+
.ui-icon-radio-on { background-position: -96px -144px; }
|
1133 |
+
.ui-icon-radio-off { background-position: -112px -144px; }
|
1134 |
+
.ui-icon-pin-w { background-position: -128px -144px; }
|
1135 |
+
.ui-icon-pin-s { background-position: -144px -144px; }
|
1136 |
+
.ui-icon-play { background-position: 0 -160px; }
|
1137 |
+
.ui-icon-pause { background-position: -16px -160px; }
|
1138 |
+
.ui-icon-seek-next { background-position: -32px -160px; }
|
1139 |
+
.ui-icon-seek-prev { background-position: -48px -160px; }
|
1140 |
+
.ui-icon-seek-end { background-position: -64px -160px; }
|
1141 |
+
.ui-icon-seek-start { background-position: -80px -160px; }
|
1142 |
+
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
|
1143 |
+
.ui-icon-seek-first { background-position: -80px -160px; }
|
1144 |
+
.ui-icon-stop { background-position: -96px -160px; }
|
1145 |
+
.ui-icon-eject { background-position: -112px -160px; }
|
1146 |
+
.ui-icon-volume-off { background-position: -128px -160px; }
|
1147 |
+
.ui-icon-volume-on { background-position: -144px -160px; }
|
1148 |
+
.ui-icon-power { background-position: 0 -176px; }
|
1149 |
+
.ui-icon-signal-diag { background-position: -16px -176px; }
|
1150 |
+
.ui-icon-signal { background-position: -32px -176px; }
|
1151 |
+
.ui-icon-battery-0 { background-position: -48px -176px; }
|
1152 |
+
.ui-icon-battery-1 { background-position: -64px -176px; }
|
1153 |
+
.ui-icon-battery-2 { background-position: -80px -176px; }
|
1154 |
+
.ui-icon-battery-3 { background-position: -96px -176px; }
|
1155 |
+
.ui-icon-circle-plus { background-position: 0 -192px; }
|
1156 |
+
.ui-icon-circle-minus { background-position: -16px -192px; }
|
1157 |
+
.ui-icon-circle-close { background-position: -32px -192px; }
|
1158 |
+
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
|
1159 |
+
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
|
1160 |
+
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
|
1161 |
+
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
|
1162 |
+
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
|
1163 |
+
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
|
1164 |
+
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
|
1165 |
+
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
|
1166 |
+
.ui-icon-circle-zoomin { background-position: -176px -192px; }
|
1167 |
+
.ui-icon-circle-zoomout { background-position: -192px -192px; }
|
1168 |
+
.ui-icon-circle-check { background-position: -208px -192px; }
|
1169 |
+
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
|
1170 |
+
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
|
1171 |
+
.ui-icon-circlesmall-close { background-position: -32px -208px; }
|
1172 |
+
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
|
1173 |
+
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
|
1174 |
+
.ui-icon-squaresmall-close { background-position: -80px -208px; }
|
1175 |
+
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
|
1176 |
+
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
|
1177 |
+
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
|
1178 |
+
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
|
1179 |
+
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
1180 |
+
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
|
1181 |
+
|
1182 |
+
|
1183 |
+
/* Misc visuals
|
1184 |
+
----------------------------------*/
|
1185 |
+
|
1186 |
+
/* Corner radius */
|
1187 |
+
.ui-corner-all,
|
1188 |
+
.ui-corner-top,
|
1189 |
+
.ui-corner-left,
|
1190 |
+
.ui-corner-tl {
|
1191 |
+
border-top-left-radius: 4px;
|
1192 |
+
}
|
1193 |
+
.ui-corner-all,
|
1194 |
+
.ui-corner-top,
|
1195 |
+
.ui-corner-right,
|
1196 |
+
.ui-corner-tr {
|
1197 |
+
border-top-right-radius: 4px;
|
1198 |
+
}
|
1199 |
+
.ui-corner-all,
|
1200 |
+
.ui-corner-bottom,
|
1201 |
+
.ui-corner-left,
|
1202 |
+
.ui-corner-bl {
|
1203 |
+
border-bottom-left-radius: 4px;
|
1204 |
+
}
|
1205 |
+
.ui-corner-all,
|
1206 |
+
.ui-corner-bottom,
|
1207 |
+
.ui-corner-right,
|
1208 |
+
.ui-corner-br {
|
1209 |
+
border-bottom-right-radius: 4px;
|
1210 |
+
}
|
1211 |
+
|
1212 |
+
/* Overlays */
|
1213 |
+
.ui-widget-overlay {
|
1214 |
+
background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;
|
1215 |
+
opacity: .3;
|
1216 |
+
filter: Alpha(Opacity=30); /* support: IE8 */
|
1217 |
+
}
|
1218 |
+
.ui-widget-shadow {
|
1219 |
+
margin: -8px 0 0 -8px;
|
1220 |
+
padding: 8px;
|
1221 |
+
background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;
|
1222 |
+
opacity: .3;
|
1223 |
+
filter: Alpha(Opacity=30); /* support: IE8 */
|
1224 |
+
border-radius: 8px;
|
1225 |
+
}
|
assets/css/wp-smushit-admin.css
CHANGED
@@ -375,6 +375,7 @@ button .wp-smush-loader-wrap {
|
|
375 |
float: left;
|
376 |
margin: 5px 20px 5px 0;
|
377 |
padding: 5px 5px 5px 0;
|
|
|
378 |
}
|
379 |
|
380 |
/*Pro rows*/
|
@@ -385,7 +386,8 @@ button .wp-smush-loader-wrap {
|
|
385 |
#wp-smush-options-wrap .wp-smush-pro-features .pro-note {
|
386 |
margin: 0 0 0 25px;
|
387 |
}
|
388 |
-
|
|
|
389 |
top: 2px;
|
390 |
position: relative;
|
391 |
color: gray;
|
@@ -579,43 +581,69 @@ input#wp-smush-save-settings {
|
|
579 |
.smush-stats-wrapper {
|
580 |
border: 1px solid lightgray;
|
581 |
}
|
|
|
582 |
table.wp-smush-stats-holder {
|
583 |
border-collapse: collapse;
|
584 |
width: 100%;
|
585 |
}
|
|
|
586 |
table.wp-smush-stats-holder th {
|
587 |
background-color: #E4E4E4;
|
588 |
}
|
|
|
589 |
table.wp-smush-stats-holder td, table.wp-smush-stats-holder th {
|
590 |
border: 1px solid #CECECE;
|
591 |
}
|
|
|
592 |
table.wp-smush-stats-holder tr:first-child th {
|
593 |
border-top: 0;
|
594 |
}
|
|
|
595 |
table.wp-smush-stats-holder tr:last-child td {
|
596 |
border-bottom: 0;
|
597 |
}
|
|
|
598 |
table.wp-smush-stats-holder tr td:first-child,
|
599 |
table.wp-smush-stats-holder tr th:first-child {
|
600 |
border-left: 0;
|
601 |
}
|
|
|
602 |
table.wp-smush-stats-holder tr td:last-child,
|
603 |
table.wp-smush-stats-holder tr th:last-child {
|
604 |
border-right: 0;
|
605 |
}
|
|
|
606 |
table.wp-smush-stats-holder tr td:first-child {
|
607 |
text-align: right;
|
608 |
}
|
|
|
609 |
.smush-skipped.error {
|
610 |
color: #C41921;
|
611 |
}
|
|
|
612 |
.smush-skipped .dashicons-editor-help {
|
613 |
cursor: pointer;
|
614 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
615 |
/*Media Modal Styling*/
|
616 |
.compat-field-wp_smush .wp-smush-stats-holder tr {
|
617 |
display: table-row;
|
618 |
}
|
|
|
619 |
.compat-field-wp_smush .wp-smush-stats-holder td {
|
620 |
padding: 8px 10px
|
|
|
|
|
|
|
|
|
|
|
621 |
}
|
375 |
float: left;
|
376 |
margin: 5px 20px 5px 0;
|
377 |
padding: 5px 5px 5px 0;
|
378 |
+
min-width: 323px;
|
379 |
}
|
380 |
|
381 |
/*Pro rows*/
|
386 |
#wp-smush-options-wrap .wp-smush-pro-features .pro-note {
|
387 |
margin: 0 0 0 25px;
|
388 |
}
|
389 |
+
|
390 |
+
.wp-smush-setting-row .dashicons-info.smush-original {
|
391 |
top: 2px;
|
392 |
position: relative;
|
393 |
color: gray;
|
581 |
.smush-stats-wrapper {
|
582 |
border: 1px solid lightgray;
|
583 |
}
|
584 |
+
|
585 |
table.wp-smush-stats-holder {
|
586 |
border-collapse: collapse;
|
587 |
width: 100%;
|
588 |
}
|
589 |
+
|
590 |
table.wp-smush-stats-holder th {
|
591 |
background-color: #E4E4E4;
|
592 |
}
|
593 |
+
|
594 |
table.wp-smush-stats-holder td, table.wp-smush-stats-holder th {
|
595 |
border: 1px solid #CECECE;
|
596 |
}
|
597 |
+
|
598 |
table.wp-smush-stats-holder tr:first-child th {
|
599 |
border-top: 0;
|
600 |
}
|
601 |
+
|
602 |
table.wp-smush-stats-holder tr:last-child td {
|
603 |
border-bottom: 0;
|
604 |
}
|
605 |
+
|
606 |
table.wp-smush-stats-holder tr td:first-child,
|
607 |
table.wp-smush-stats-holder tr th:first-child {
|
608 |
border-left: 0;
|
609 |
}
|
610 |
+
|
611 |
table.wp-smush-stats-holder tr td:last-child,
|
612 |
table.wp-smush-stats-holder tr th:last-child {
|
613 |
border-right: 0;
|
614 |
}
|
615 |
+
|
616 |
table.wp-smush-stats-holder tr td:first-child {
|
617 |
text-align: right;
|
618 |
}
|
619 |
+
|
620 |
.smush-skipped.error {
|
621 |
color: #C41921;
|
622 |
}
|
623 |
+
|
624 |
.smush-skipped .dashicons-editor-help {
|
625 |
cursor: pointer;
|
626 |
}
|
627 |
+
|
628 |
+
/*NextGen Gallery stats*/
|
629 |
+
#ngg-listimages table.wp-smush-stats-holder {
|
630 |
+
table-layout: fixed;
|
631 |
+
}
|
632 |
+
|
633 |
+
#ngg-listimages table.wp-smush-stats-holder td {
|
634 |
+
font-size: 12px;
|
635 |
+
}
|
636 |
+
|
637 |
/*Media Modal Styling*/
|
638 |
.compat-field-wp_smush .wp-smush-stats-holder tr {
|
639 |
display: table-row;
|
640 |
}
|
641 |
+
|
642 |
.compat-field-wp_smush .wp-smush-stats-holder td {
|
643 |
padding: 8px 10px
|
644 |
+
}
|
645 |
+
|
646 |
+
/** Help Tip **/
|
647 |
+
.ui-tooltip-content {
|
648 |
+
font-size: 12px;
|
649 |
}
|
assets/images/help.png
ADDED
Binary file
|
assets/js/wp-smushit-admin-media.js
CHANGED
@@ -1,78 +1,84 @@
|
|
|
|
|
|
|
|
|
|
1 |
var WP_Smush = WP_Smush || {};
|
2 |
jQuery(function ($) {
|
3 |
-
|
4 |
-
|
5 |
|
6 |
-
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
|
26 |
|
27 |
-
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
|
66 |
-
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
});
|
1 |
+
/**
|
2 |
+
* Adds a smush button in grid view, Show the stats
|
3 |
+
* @type {WP_Smush|*|{}}
|
4 |
+
*/
|
5 |
var WP_Smush = WP_Smush || {};
|
6 |
jQuery(function ($) {
|
7 |
+
"use strict";
|
8 |
+
if (!wp.media) return;
|
9 |
|
10 |
+
var manualUrl = ajaxurl + '?action=wp_smushit_manual';
|
11 |
|
12 |
+
var SmushButton = Backbone.View.extend({
|
13 |
+
className: "media-lib-wp-smush-el",
|
14 |
+
tagName: "div",
|
15 |
+
events: {
|
16 |
+
"click .media-lib-wp-smush-icon": "click"
|
17 |
+
},
|
18 |
+
template: _.template('<span class="dashicons dashicons-media-archive media-lib-wp-smush-icon"></span>'),
|
19 |
+
initialize: function () {
|
20 |
+
this.render();
|
21 |
+
},
|
22 |
+
is_smushed: function () {
|
23 |
+
var self = this,
|
24 |
+
arr = _.filter(wp_smushit_data.smushed, function (id) {
|
25 |
+
return id == self.model.get("id").toString();
|
26 |
+
});
|
27 |
+
return typeof arr == "object" ? arr.length : false;
|
28 |
+
},
|
29 |
+
render: function () {
|
30 |
+
var data = this.model.toJSON();
|
31 |
|
32 |
|
33 |
+
this.$el.html(this.template());
|
34 |
+
this.$button = this.$(".media-lib-wp-smush-icon");
|
35 |
|
36 |
+
if (this.is_smushed()) {
|
37 |
+
this.$el.addClass("is_smushed");
|
38 |
+
} else {
|
39 |
+
this.$el.addClass("active");
|
40 |
+
this.$button.prop("title", wp_smush_msgs.smush_now)
|
41 |
+
}
|
42 |
|
43 |
+
this.$button.data("id", data.id);
|
44 |
+
},
|
45 |
+
click: function (e) {
|
46 |
+
var ajax = WP_Smush.ajax(this.model.get("id"), manualUrl, 0),
|
47 |
+
self = this;
|
48 |
|
49 |
+
e.preventDefault();
|
50 |
+
e.stopPropagation();
|
51 |
|
52 |
+
this.$button.css({display: "block"});
|
53 |
+
this.$button.prop("disabled", true);
|
54 |
+
this.$button.addClass("active spinner");
|
55 |
+
ajax.complete(function (res) {
|
56 |
+
self.$button.prop("disabled", false);
|
57 |
+
self.$button.removeClass("spinner");
|
58 |
+
self.$button.removeClass("active");
|
59 |
+
self.$el.removeClass("active");
|
60 |
+
self.$el.addClass("is_smushed");
|
61 |
+
});
|
62 |
+
}
|
63 |
+
});
|
64 |
|
65 |
|
66 |
+
/**
|
67 |
+
* Add smush it button to the image thumb
|
68 |
+
*/
|
69 |
+
WP_Smush.Attachments = wp.media.view.Attachments.extend({
|
70 |
+
createAttachmentView: function (attachment) {
|
71 |
|
72 |
+
var view = wp.media.view.Attachments.__super__.createAttachmentView.apply(this, arguments);
|
73 |
|
74 |
+
_.defer(function () {
|
75 |
+
var smush_button = new SmushButton({model: view.model});
|
76 |
+
view.$el.append(smush_button.el);
|
77 |
+
view.$el.addClass("has-smush-button");
|
78 |
+
});
|
79 |
|
80 |
+
return view;
|
81 |
+
}
|
82 |
+
});
|
83 |
+
//wp.media.view.Attachments = WP_Smush.Attachments;
|
84 |
});
|
assets/js/wp-smushit-admin.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
* Processes bulk smushing
|
3 |
*
|
4 |
* @author Saurabh Shukla <saurabh@incsub.com>
|
5 |
-
* @author Umesh Kumar
|
6 |
*
|
7 |
*/
|
8 |
var WP_Smush = WP_Smush || {};
|
@@ -27,25 +27,24 @@ jQuery(function ($) {
|
|
27 |
}
|
28 |
};
|
29 |
|
30 |
-
WP_Smush.ajax = function ($id, $send_url, $getnxt) {
|
31 |
"use strict";
|
32 |
return $.ajax({
|
33 |
type: "GET",
|
34 |
-
data: {attachment_id: $id, get_next: $getnxt},
|
35 |
url: $send_url,
|
36 |
timeout: WP_Smush.timeout,
|
37 |
dataType: 'json'
|
38 |
});
|
39 |
};
|
40 |
|
41 |
-
WP_Smush.Smush = function ($button, bulk) {
|
42 |
var self = this;
|
43 |
|
44 |
this.init = function (arguments) {
|
45 |
this.$button = $($button[0]);
|
46 |
this.is_bulk = typeof bulk ? bulk : false;
|
47 |
this.url = ajaxurl;
|
48 |
-
this.url += this.is_bulk ? '?action=wp_smushit_bulk' : '?action=wp_smushit_manual';
|
49 |
this.button_text = this.is_bulk ? wp_smush_msgs.bulk_now : wp_smush_msgs.smush_now;
|
50 |
this.$log = $(".smush-final-log");
|
51 |
this.$button_span = this.$button.find("span");
|
@@ -56,6 +55,11 @@ jQuery(function ($) {
|
|
56 |
this.is_bulk_super_smush = wp_smushit_data.unsmushed.length > 0 ? false : true;
|
57 |
this.lossless_count = wp_smushit_data.lossless.length;
|
58 |
this.$status = this.$button.parent().find('.smush-status');
|
|
|
|
|
|
|
|
|
|
|
59 |
};
|
60 |
|
61 |
//Show loader in button for single and bulk smush
|
@@ -171,10 +175,15 @@ jQuery(function ($) {
|
|
171 |
this.$button.find('span').html(wp_smush_msgs.bulk_now);
|
172 |
};
|
173 |
|
174 |
-
this.update_progress = function (
|
|
|
|
|
|
|
|
|
|
|
175 |
if (!this.is_bulk_super_smush) {
|
176 |
//handle progress for normal bulk smush
|
177 |
-
var progress = (
|
178 |
} else {
|
179 |
//Handle progress for Super smush progress bar
|
180 |
if (wp_smushit_data.lossless.length > 0) {
|
@@ -186,11 +195,11 @@ jQuery(function ($) {
|
|
186 |
}
|
187 |
|
188 |
//Update stats
|
189 |
-
$('#wp-smush-compression #human').html(
|
190 |
-
$('#wp-smush-compression #percent').html(
|
191 |
|
192 |
// increase the progress bar
|
193 |
-
this._update_progress(
|
194 |
};
|
195 |
|
196 |
this._update_progress = function (count, width) {
|
@@ -235,9 +244,15 @@ jQuery(function ($) {
|
|
235 |
//Send ajax request for smushing single and bulk, call update_progress on ajax response
|
236 |
this.call_ajax = function () {
|
237 |
|
|
|
|
|
238 |
this.current_id = this.is_bulk ? this.ids.shift() : this.$button.data("id"); //remove from array while processing so we can continue where left off
|
|
|
|
|
|
|
|
|
239 |
|
240 |
-
this.request = WP_Smush.ajax(this.current_id, this.url, 0)
|
241 |
.complete(function () {
|
242 |
if (!self.continue() || !self.is_bulk) {
|
243 |
self.deferred.resolve();
|
@@ -246,6 +261,18 @@ jQuery(function ($) {
|
|
246 |
.error(function () {
|
247 |
self.increment_errors();
|
248 |
}).done(function (res) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
self.update_progress(res);
|
250 |
|
251 |
if (typeof res.success === "undefined" || ( typeof res.success !== "undefined" && res.success === false && res.data.error !== 'bulk_request_image_limit_exceeded' )) {
|
@@ -347,6 +374,36 @@ jQuery(function ($) {
|
|
347 |
//Stats Button Click
|
348 |
|
349 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
});
|
351 |
(function ($) {
|
352 |
var Smush = function (element, options) {
|
2 |
* Processes bulk smushing
|
3 |
*
|
4 |
* @author Saurabh Shukla <saurabh@incsub.com>
|
5 |
+
* @author Umesh Kumar <umeshsingla05@gmail.com>
|
6 |
*
|
7 |
*/
|
8 |
var WP_Smush = WP_Smush || {};
|
27 |
}
|
28 |
};
|
29 |
|
30 |
+
WP_Smush.ajax = function ($id, $send_url, $getnxt, nonce ) {
|
31 |
"use strict";
|
32 |
return $.ajax({
|
33 |
type: "GET",
|
34 |
+
data: {attachment_id: $id, get_next: $getnxt, _nonce: nonce },
|
35 |
url: $send_url,
|
36 |
timeout: WP_Smush.timeout,
|
37 |
dataType: 'json'
|
38 |
});
|
39 |
};
|
40 |
|
41 |
+
WP_Smush.Smush = function ($button, bulk, smush_type) {
|
42 |
var self = this;
|
43 |
|
44 |
this.init = function (arguments) {
|
45 |
this.$button = $($button[0]);
|
46 |
this.is_bulk = typeof bulk ? bulk : false;
|
47 |
this.url = ajaxurl;
|
|
|
48 |
this.button_text = this.is_bulk ? wp_smush_msgs.bulk_now : wp_smush_msgs.smush_now;
|
49 |
this.$log = $(".smush-final-log");
|
50 |
this.$button_span = this.$button.find("span");
|
55 |
this.is_bulk_super_smush = wp_smushit_data.unsmushed.length > 0 ? false : true;
|
56 |
this.lossless_count = wp_smushit_data.lossless.length;
|
57 |
this.$status = this.$button.parent().find('.smush-status');
|
58 |
+
//Added for NextGen support
|
59 |
+
this.smush_type = typeof smush_type ? smush_type : false;
|
60 |
+
this.single_ajax_suffix = this.smush_type ? 'smush_manual_nextgen' : 'wp_smushit_manual';
|
61 |
+
this.bulk_ajax_suffix = this.smush_type ? 'wp_smushit_nextgen_bulk' : 'wp_smushit_bulk';
|
62 |
+
this.url += this.is_bulk ? '?action=' + this.bulk_ajax_suffix : '?action=' + this.single_ajax_suffix;
|
63 |
};
|
64 |
|
65 |
//Show loader in button for single and bulk smush
|
175 |
this.$button.find('span').html(wp_smush_msgs.bulk_now);
|
176 |
};
|
177 |
|
178 |
+
this.update_progress = function (_res) {
|
179 |
+
//If not bulk
|
180 |
+
if( !this.is_bulk_super_smush && !this.is_bulk ) {
|
181 |
+
return;
|
182 |
+
}
|
183 |
+
|
184 |
if (!this.is_bulk_super_smush) {
|
185 |
//handle progress for normal bulk smush
|
186 |
+
var progress = ( _res.data.stats.smushed / _res.data.stats.total) * 100;
|
187 |
} else {
|
188 |
//Handle progress for Super smush progress bar
|
189 |
if (wp_smushit_data.lossless.length > 0) {
|
195 |
}
|
196 |
|
197 |
//Update stats
|
198 |
+
$('#wp-smush-compression #human').html(_res.data.stats.human);
|
199 |
+
$('#wp-smush-compression #percent').html(_res.data.stats.percent);
|
200 |
|
201 |
// increase the progress bar
|
202 |
+
this._update_progress(_res.data.stats.smushed, progress);
|
203 |
};
|
204 |
|
205 |
this._update_progress = function (count, width) {
|
244 |
//Send ajax request for smushing single and bulk, call update_progress on ajax response
|
245 |
this.call_ajax = function () {
|
246 |
|
247 |
+
var nonce_field = false;
|
248 |
+
var nonce_value = '';
|
249 |
this.current_id = this.is_bulk ? this.ids.shift() : this.$button.data("id"); //remove from array while processing so we can continue where left off
|
250 |
+
nonce_field = this.$button.parent().find('#_wp_smush_nonce');
|
251 |
+
if (nonce_field) {
|
252 |
+
nonce_value = nonce_field.val();
|
253 |
+
}
|
254 |
|
255 |
+
this.request = WP_Smush.ajax(this.current_id, this.url, 0, nonce_value)
|
256 |
.complete(function () {
|
257 |
if (!self.continue() || !self.is_bulk) {
|
258 |
self.deferred.resolve();
|
261 |
.error(function () {
|
262 |
self.increment_errors();
|
263 |
}).done(function (res) {
|
264 |
+
//If no response or success is false, do not process further
|
265 |
+
if (typeof res == 'undefined' || !res || !res.success ) {
|
266 |
+
if( typeof res.data.error_msg !== 'undefined' ) {
|
267 |
+
//Print the error on screen
|
268 |
+
self.$log.append(res.data.error_msg);
|
269 |
+
//We can proceed to next image
|
270 |
+
if (self.continue()) {
|
271 |
+
self.call_ajax();
|
272 |
+
}
|
273 |
+
}
|
274 |
+
return false;
|
275 |
+
}
|
276 |
self.update_progress(res);
|
277 |
|
278 |
if (typeof res.success === "undefined" || ( typeof res.success !== "undefined" && res.success === false && res.data.error !== 'bulk_request_image_limit_exceeded' )) {
|
374 |
//Stats Button Click
|
375 |
|
376 |
|
377 |
+
//Handle NextGen Gallery smush button click
|
378 |
+
$('body').on('click', '.wp-smush-nextgen-send', function (e) {
|
379 |
+
|
380 |
+
// prevent the default action
|
381 |
+
e.preventDefault();
|
382 |
+
new WP_Smush.Smush($(this), false, 'nextgen');
|
383 |
+
});
|
384 |
+
|
385 |
+
//Handle NextGen Gallery Bulk smush button click
|
386 |
+
$('body').on('click', '.wp-smush-nextgen-bulk', function (e) {
|
387 |
+
|
388 |
+
// prevent the default action
|
389 |
+
e.preventDefault();
|
390 |
+
|
391 |
+
//Check for ids, if there is none (Unsmushed or lossless), don't call smush function
|
392 |
+
if (typeof wp_smushit_data == 'undefined' ||
|
393 |
+
( wp_smushit_data.unsmushed.length == 0 && wp_smushit_data.lossless.length == 0 )
|
394 |
+
) {
|
395 |
+
|
396 |
+
return false;
|
397 |
+
|
398 |
+
}
|
399 |
+
|
400 |
+
$(".smush-remaining-images-notice").remove();
|
401 |
+
new WP_Smush.Smush($(this), true, 'nextgen');
|
402 |
+
return;
|
403 |
+
});
|
404 |
+
/** Show help text on help image hover **/
|
405 |
+
$( document ).tooltip();
|
406 |
+
|
407 |
});
|
408 |
(function ($) {
|
409 |
var Smush = function (element, options) {
|
languages/wp-smushit.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the same license as the WP Smush package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WP Smush 2.0.
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wp-smush\n"
|
7 |
-
"POT-Creation-Date: 2015-10-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -40,356 +40,423 @@ msgstr ""
|
|
40 |
msgid "Rate %s"
|
41 |
msgstr ""
|
42 |
|
43 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
|
|
|
|
44 |
msgid "WP Smush"
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: lib/class-wp-smush-admin.php:
|
48 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
|
|
|
|
49 |
msgid "Bulk Smush Now"
|
50 |
msgstr ""
|
51 |
|
52 |
-
#: lib/class-wp-smush-admin.php:
|
53 |
msgid "Bulk Smush %d Attachments"
|
54 |
msgstr ""
|
55 |
|
56 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
57 |
msgid "Smushing in Progress"
|
58 |
msgstr ""
|
59 |
|
60 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
|
|
61 |
msgid "All Done!"
|
62 |
msgstr ""
|
63 |
|
64 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
65 |
msgid "Ops!... something went wrong"
|
66 |
msgstr ""
|
67 |
|
68 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
|
|
69 |
msgid "Super-Smush"
|
70 |
msgstr ""
|
71 |
|
72 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
73 |
msgid "Smush it"
|
74 |
msgstr ""
|
75 |
|
76 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
77 |
msgid "Smush Now"
|
78 |
msgstr ""
|
79 |
|
80 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
81 |
msgid "Sending ..."
|
82 |
msgstr ""
|
83 |
|
84 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
85 |
msgid "{{errors}} image(s) were skipped due to an error."
|
86 |
msgstr ""
|
87 |
|
88 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
89 |
msgid "All images are Super-Smushed."
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: lib/class-wp-smush-admin.php:
|
93 |
-
msgid "Smush images
|
94 |
msgstr ""
|
95 |
|
96 |
-
#: lib/class-wp-smush-admin.php:
|
97 |
-
msgid "Smush
|
|
|
|
|
|
|
|
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: lib/class-wp-smush-admin.php:
|
101 |
-
msgid "
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: lib/class-wp-smush-admin.php:
|
105 |
msgid "Super-Smush images"
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: lib/class-wp-smush-admin.php:
|
109 |
msgid "Lossy Image Compression"
|
110 |
msgstr ""
|
111 |
|
112 |
-
#: lib/class-wp-smush-admin.php:
|
113 |
msgid "Backup Original Images"
|
114 |
msgstr ""
|
115 |
|
116 |
-
#: lib/class-wp-smush-admin.php:
|
117 |
msgid "Will nearly double the size of your Uploads Directory"
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
|
|
|
|
|
|
121 |
msgid "WP Smush Pro"
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: lib/class-wp-smush-admin.php:
|
125 |
msgid "Settings"
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: lib/class-wp-smush-admin.php:
|
129 |
msgid "PRO FEATURES"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: lib/class-wp-smush-admin.php:
|
133 |
msgid "These features are available in Pro Version of the plugin."
|
134 |
msgstr ""
|
135 |
|
136 |
-
#: lib/class-wp-smush-admin.php:
|
137 |
msgid "Save Changes"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: lib/class-wp-smush-admin.php:
|
141 |
msgid "%d image is over 1MB so will be skipped using the free version of the plugin."
|
142 |
msgid_plural "%d images are over 1MB so will be skipped using the free version of the plugin."
|
143 |
msgstr[0] ""
|
144 |
msgstr[1] ""
|
145 |
|
146 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
147 |
msgid "Smush in Bulk"
|
148 |
msgstr ""
|
149 |
|
150 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
151 |
msgid "Congratulations, all your images are currently Smushed!"
|
152 |
msgstr ""
|
153 |
|
154 |
-
#: lib/class-wp-smush-admin.php:
|
155 |
msgid "%d attachment in your media library has not been smushed."
|
156 |
msgid_plural "%d image attachments in your media library have not been smushed yet."
|
157 |
msgstr[0] ""
|
158 |
msgstr[1] ""
|
159 |
|
160 |
-
#: lib/class-wp-smush-admin.php:
|
161 |
msgid "Remove size limit »"
|
162 |
msgstr ""
|
163 |
|
164 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
165 |
msgid ""
|
166 |
"Please be aware, smushing a large number of images can take a while depending on your server and network speed.\n"
|
167 |
"\t\t\t\t\t\t<strong>You must keep this page open while the bulk smush is processing</strong>, but you can leave at any time and come back to continue where it left off."
|
168 |
msgstr ""
|
169 |
|
170 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
171 |
msgid "Free accounts are limited to bulk smushing %d attachments per request. You will need to click to start a new bulk job after each %d attachments."
|
172 |
msgstr ""
|
173 |
|
174 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
175 |
msgid "Remove limits »"
|
176 |
msgstr ""
|
177 |
|
178 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
179 |
msgid "When you <a href=\"%s\">upload some images</a> they will be available to smush here."
|
180 |
msgstr ""
|
181 |
|
182 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
183 |
msgid "You can also smush images individually from your <a href=\"%s\">Media Library</a>."
|
184 |
msgstr ""
|
185 |
|
186 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
187 |
msgid "Reduced by "
|
188 |
msgstr ""
|
189 |
|
190 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
191 |
msgid "<span class=\"done-count\">%d</span> of <span class=\"total-count\">%d</span> total attachments have been smushed"
|
192 |
msgstr ""
|
193 |
|
194 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
|
|
|
|
|
|
195 |
msgid "You don't have permission to work with uploaded files."
|
196 |
msgstr ""
|
197 |
|
198 |
-
#: lib/class-wp-smush-admin.php:
|
199 |
msgid "No attachment ID was provided."
|
200 |
msgstr ""
|
201 |
|
202 |
-
#: lib/class-wp-smush-admin.php:
|
203 |
msgid "<p>Please <a href=\"%s\">upload some images</a>.</p>"
|
204 |
msgstr ""
|
205 |
|
206 |
-
#: lib/class-wp-smush-admin.php:
|
207 |
msgid "All your images are already smushed!"
|
208 |
msgstr ""
|
209 |
|
210 |
-
#: lib/class-wp-smush-admin.php:
|
211 |
msgid "<strong>%d of %d images</strong> were sent for smushing:"
|
212 |
msgstr ""
|
213 |
|
214 |
-
#: lib/class-wp-smush-admin.php:
|
215 |
msgid "Super-Smush Images"
|
216 |
msgstr ""
|
217 |
|
218 |
-
#: lib/class-wp-smush-admin.php:
|
219 |
msgid "We found attachments that were previously smushed losslessly. If desired you can Super-Smush them now for more savings with almost no noticeable quality loss."
|
220 |
msgstr ""
|
221 |
|
222 |
-
#: lib/class-wp-smush-admin.php:
|
223 |
msgid "<span class=\"remaining-count\">%d</span> attachment left to Super-Smush"
|
224 |
msgid_plural "<span class=\"remaining-count\">%d</span> attachments left to Super-Smush"
|
225 |
msgstr[0] ""
|
226 |
msgstr[1] ""
|
227 |
|
228 |
-
#: lib/class-wp-smush-admin.php:
|
229 |
msgid "Thanks for using WP Smush Pro! You now can:"
|
230 |
msgstr ""
|
231 |
|
232 |
-
#: lib/class-wp-smush-admin.php:
|
233 |
msgid "Smush the original Full image sizes that are normally skipped by default."
|
234 |
msgstr ""
|
235 |
|
236 |
-
#: lib/class-wp-smush-admin.php:
|
|
|
|
|
|
|
|
|
237 |
msgid "\"Super-Smush\" your images with our intelligent multi-pass lossy compression. Get 2× more compression than lossless with almost no noticeable quality loss!"
|
238 |
msgstr ""
|
239 |
|
240 |
-
#: lib/class-wp-smush-admin.php:
|
241 |
msgid "Get the best lossless compression. We try multiple methods to squeeze every last byte out of your images."
|
242 |
msgstr ""
|
243 |
|
244 |
-
#: lib/class-wp-smush-admin.php:
|
245 |
msgid "Smush images up to 32MB."
|
246 |
msgstr ""
|
247 |
|
248 |
-
#: lib/class-wp-smush-admin.php:
|
249 |
msgid "Bulk smush ALL your images with one click!"
|
250 |
msgstr ""
|
251 |
|
252 |
-
#: lib/class-wp-smush-admin.php:
|
253 |
msgid "Keep a backup of your original un-smushed images in case you want to restore later."
|
254 |
msgstr ""
|
255 |
|
256 |
-
#: lib/class-wp-smush-admin.php:
|
257 |
msgid "Upgrade to WP Smush Pro to:"
|
258 |
msgstr ""
|
259 |
|
260 |
-
#: lib/class-wp-smush-admin.php:
|
261 |
msgid "Smush images greater than 1MB."
|
262 |
msgstr ""
|
263 |
|
264 |
-
#: lib/class-wp-smush-admin.php:
|
265 |
msgid "Bulk smush ALL your images with one click! No more rate limiting."
|
266 |
msgstr ""
|
267 |
|
268 |
-
#: lib/class-wp-smush-admin.php:
|
269 |
msgid "Access 24/7/365 support from <a href=\"https://premium.wpmudev.org/support/?utm_source=wordpress.org&utm_medium=plugin&utm_campaign=WP%20Smush%20Upgrade\">the best WordPress support team on the planet</a>."
|
270 |
msgstr ""
|
271 |
|
272 |
-
#: lib/class-wp-smush-admin.php:
|
273 |
msgid "Download <a href=\"https://premium.wpmudev.org/?utm_source=wordpress.org&utm_medium=plugin&utm_campaign=WP%20Smush%20Upgrade\">350+ other premium plugins and themes</a> included in your membership."
|
274 |
msgstr ""
|
275 |
|
276 |
-
#: lib/class-wp-smush-admin.php:
|
277 |
msgid "Upgrade Now »"
|
278 |
msgstr ""
|
279 |
|
280 |
-
#: lib/class-wp-smush-admin.php:
|
281 |
msgid "Already upgraded to a WPMU DEV membership? Install and Login to our Dashboard plugin to enable Smush Pro features."
|
282 |
msgstr ""
|
283 |
|
284 |
-
#: lib/class-wp-smush-admin.php:
|
285 |
msgid "Activate WPMU DEV Dashboard"
|
286 |
msgstr ""
|
287 |
|
288 |
-
#: lib/class-wp-smush-admin.php:
|
289 |
msgid "Install WPMU DEV Dashboard"
|
290 |
msgstr ""
|
291 |
|
292 |
-
#: lib/class-wp-smush.php:
|
|
|
|
|
|
|
|
|
293 |
msgid "File path is empty"
|
294 |
msgstr ""
|
295 |
|
296 |
-
#: lib/class-wp-smush.php:
|
297 |
msgid "Could not find %s"
|
298 |
msgstr ""
|
299 |
|
300 |
-
#: lib/class-wp-smush.php:
|
301 |
msgid "%s is not writable"
|
302 |
msgstr ""
|
303 |
|
304 |
-
#: lib/class-wp-smush.php:
|
305 |
msgid "Skipped (%s), image not found."
|
306 |
msgstr ""
|
307 |
|
308 |
-
#: lib/class-wp-smush.php:
|
309 |
msgid "Skipped (%s), size limit exceeded."
|
310 |
msgstr ""
|
311 |
|
312 |
-
#: lib/class-wp-smush.php:
|
313 |
msgid "Unknown API error"
|
314 |
msgstr ""
|
315 |
|
316 |
-
#: lib/class-wp-smush.php:
|
317 |
-
msgid "Size '%s' not processed correctly"
|
318 |
-
msgstr ""
|
319 |
-
|
320 |
-
#: lib/class-wp-smush.php:334 lib/class-wp-smush.php:342
|
321 |
msgid "Size 'full' not processed correctly"
|
322 |
msgstr ""
|
323 |
|
324 |
-
#: lib/class-wp-smush.php:
|
325 |
msgid "Error posting to API: %s"
|
326 |
msgstr ""
|
327 |
|
328 |
-
#: lib/class-wp-smush.php:
|
329 |
msgid "Error posting to API: %s %s"
|
330 |
msgstr ""
|
331 |
|
332 |
-
#: lib/class-wp-smush.php:
|
333 |
msgid "Smush data corrupted, try again."
|
334 |
msgstr ""
|
335 |
|
336 |
-
#: lib/class-wp-smush.php:
|
337 |
msgid "Image couldn't be smushed"
|
338 |
msgstr ""
|
339 |
|
340 |
-
#: lib/class-wp-smush.php:
|
|
|
341 |
msgid "Error processing request"
|
342 |
msgstr ""
|
343 |
|
344 |
-
#: lib/class-wp-smush.php:
|
|
|
345 |
msgid "Already Optimized"
|
346 |
msgstr ""
|
347 |
|
348 |
-
#: lib/class-wp-smush.php:
|
349 |
msgid "%d images reduced "
|
350 |
msgstr ""
|
351 |
|
352 |
-
#: lib/class-wp-smush.php:
|
353 |
msgid "Reduced "
|
354 |
msgstr ""
|
355 |
|
356 |
-
#: lib/class-wp-smush.php:
|
357 |
msgid "by %s ( %01.1f%% )"
|
358 |
msgstr ""
|
359 |
|
360 |
-
#: lib/class-wp-smush.php:
|
|
|
361 |
msgid "Smush stats"
|
362 |
msgstr ""
|
363 |
|
364 |
-
#: lib/class-wp-smush.php:
|
|
|
365 |
msgid "Not processed"
|
366 |
msgstr ""
|
367 |
|
368 |
-
#: lib/class-wp-smush.php:
|
|
|
369 |
msgid "Smush Now!"
|
370 |
msgstr ""
|
371 |
|
372 |
-
#: lib/class-wp-smush.php:
|
373 |
-
msgid "For very large dimension images like those taken with a digital camera, the original full size image is almost never embedded (and really shouldn't be). Because of this WP Smush preserves it unaltered by default. Pro users can change this setting."
|
374 |
-
msgstr ""
|
375 |
-
|
376 |
-
#: lib/class-wp-smush.php:1018
|
377 |
msgid "Image couldn't be smushed as it exceeded the 1Mb size limit, Pro users can smush images with size upto 32Mb."
|
378 |
msgstr ""
|
379 |
|
380 |
-
#: lib/class-wp-smush.php:
|
381 |
msgid " Skipped"
|
382 |
msgstr ""
|
383 |
|
384 |
-
#: lib/class-wp-smush.php:
|
|
|
385 |
msgid "Image size"
|
386 |
msgstr ""
|
387 |
|
388 |
-
#: lib/class-wp-smush.php:
|
|
|
389 |
msgid "Savings"
|
390 |
msgstr ""
|
391 |
|
392 |
-
#: wp-smush.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
msgid "Get Fast"
|
394 |
msgstr ""
|
395 |
#. Plugin Name of the plugin/theme
|
2 |
# This file is distributed under the same license as the WP Smush package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WP Smush 2.0.7\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wp-smush\n"
|
7 |
+
"POT-Creation-Date: 2015-10-27 05:58:47+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
40 |
msgid "Rate %s"
|
41 |
msgstr ""
|
42 |
|
43 |
+
#: lib/class-wp-smush-admin.php:124 lib/class-wp-smush-admin.php:345
|
44 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:54
|
45 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:73
|
46 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:75
|
47 |
msgid "WP Smush"
|
48 |
msgstr ""
|
49 |
|
50 |
+
#: lib/class-wp-smush-admin.php:255 lib/class-wp-smush-admin.php:1044
|
51 |
+
#: lib/class-wp-smush-admin.php:1060
|
52 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:140
|
53 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:369
|
54 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:381
|
55 |
msgid "Bulk Smush Now"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: lib/class-wp-smush-admin.php:257 lib/class-wp-smush-admin.php:1064
|
59 |
msgid "Bulk Smush %d Attachments"
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: lib/class-wp-smush-admin.php:261
|
63 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:143
|
64 |
msgid "Smushing in Progress"
|
65 |
msgstr ""
|
66 |
|
67 |
+
#: lib/class-wp-smush-admin.php:262 lib/class-wp-smush-admin.php:1054
|
68 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:144
|
69 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:375
|
70 |
msgid "All Done!"
|
71 |
msgstr ""
|
72 |
|
73 |
+
#: lib/class-wp-smush-admin.php:264
|
74 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:146
|
75 |
msgid "Ops!... something went wrong"
|
76 |
msgstr ""
|
77 |
|
78 |
+
#: lib/class-wp-smush-admin.php:265 lib/class-wp-smush.php:761
|
79 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:147
|
80 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:227
|
81 |
msgid "Super-Smush"
|
82 |
msgstr ""
|
83 |
|
84 |
+
#: lib/class-wp-smush-admin.php:266
|
85 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:148
|
86 |
msgid "Smush it"
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: lib/class-wp-smush-admin.php:267
|
90 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:149
|
91 |
msgid "Smush Now"
|
92 |
msgstr ""
|
93 |
|
94 |
+
#: lib/class-wp-smush-admin.php:268
|
95 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:150
|
96 |
msgid "Sending ..."
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: lib/class-wp-smush-admin.php:269
|
100 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:151
|
101 |
msgid "{{errors}} image(s) were skipped due to an error."
|
102 |
msgstr ""
|
103 |
|
104 |
+
#: lib/class-wp-smush-admin.php:270
|
105 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:152
|
106 |
msgid "All images are Super-Smushed."
|
107 |
msgstr ""
|
108 |
|
109 |
+
#: lib/class-wp-smush-admin.php:309
|
110 |
+
msgid "Smush all images, including originals."
|
111 |
msgstr ""
|
112 |
|
113 |
+
#: lib/class-wp-smush-admin.php:312 lib/class-wp-smush.php:1073
|
114 |
+
msgid "When you upload an image to WordPress it automatically creates %s thumbnail sizes that are commonly used in your pages. WordPress also stores the original full-size image, but because these are not usually embedded on your site we don’t Smush them. Pro users can override this."
|
115 |
+
msgstr ""
|
116 |
+
|
117 |
+
#: lib/class-wp-smush-admin.php:315
|
118 |
+
msgid "Smush images on upload"
|
119 |
msgstr ""
|
120 |
|
121 |
+
#: lib/class-wp-smush-admin.php:316
|
122 |
+
msgid "Smush Original Image"
|
123 |
msgstr ""
|
124 |
|
125 |
+
#: lib/class-wp-smush-admin.php:317
|
126 |
msgid "Super-Smush images"
|
127 |
msgstr ""
|
128 |
|
129 |
+
#: lib/class-wp-smush-admin.php:317
|
130 |
msgid "Lossy Image Compression"
|
131 |
msgstr ""
|
132 |
|
133 |
+
#: lib/class-wp-smush-admin.php:318
|
134 |
msgid "Backup Original Images"
|
135 |
msgstr ""
|
136 |
|
137 |
+
#: lib/class-wp-smush-admin.php:318
|
138 |
msgid "Will nearly double the size of your Uploads Directory"
|
139 |
msgstr ""
|
140 |
|
141 |
+
#: lib/class-wp-smush-admin.php:319
|
142 |
+
msgid "Enable NextGen Gallery integration"
|
143 |
+
msgstr ""
|
144 |
+
|
145 |
+
#: lib/class-wp-smush-admin.php:343
|
146 |
msgid "WP Smush Pro"
|
147 |
msgstr ""
|
148 |
|
149 |
+
#: lib/class-wp-smush-admin.php:353 lib/class-wp-smush-admin.php:1119
|
150 |
msgid "Settings"
|
151 |
msgstr ""
|
152 |
|
153 |
+
#: lib/class-wp-smush-admin.php:440
|
154 |
msgid "PRO FEATURES"
|
155 |
msgstr ""
|
156 |
|
157 |
+
#: lib/class-wp-smush-admin.php:445
|
158 |
msgid "These features are available in Pro Version of the plugin."
|
159 |
msgstr ""
|
160 |
|
161 |
+
#: lib/class-wp-smush-admin.php:471
|
162 |
msgid "Save Changes"
|
163 |
msgstr ""
|
164 |
|
165 |
+
#: lib/class-wp-smush-admin.php:550
|
166 |
msgid "%d image is over 1MB so will be skipped using the free version of the plugin."
|
167 |
msgid_plural "%d images are over 1MB so will be skipped using the free version of the plugin."
|
168 |
msgstr[0] ""
|
169 |
msgstr[1] ""
|
170 |
|
171 |
+
#: lib/class-wp-smush-admin.php:559
|
172 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:415
|
173 |
msgid "Smush in Bulk"
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: lib/class-wp-smush-admin.php:564
|
177 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:428
|
178 |
msgid "Congratulations, all your images are currently Smushed!"
|
179 |
msgstr ""
|
180 |
|
181 |
+
#: lib/class-wp-smush-admin.php:573
|
182 |
msgid "%d attachment in your media library has not been smushed."
|
183 |
msgid_plural "%d image attachments in your media library have not been smushed yet."
|
184 |
msgstr[0] ""
|
185 |
msgstr[1] ""
|
186 |
|
187 |
+
#: lib/class-wp-smush-admin.php:577
|
188 |
msgid "Remove size limit »"
|
189 |
msgstr ""
|
190 |
|
191 |
+
#: lib/class-wp-smush-admin.php:582
|
192 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:434
|
193 |
msgid ""
|
194 |
"Please be aware, smushing a large number of images can take a while depending on your server and network speed.\n"
|
195 |
"\t\t\t\t\t\t<strong>You must keep this page open while the bulk smush is processing</strong>, but you can leave at any time and come back to continue where it left off."
|
196 |
msgstr ""
|
197 |
|
198 |
+
#: lib/class-wp-smush-admin.php:587
|
199 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:439
|
200 |
msgid "Free accounts are limited to bulk smushing %d attachments per request. You will need to click to start a new bulk job after each %d attachments."
|
201 |
msgstr ""
|
202 |
|
203 |
+
#: lib/class-wp-smush-admin.php:588
|
204 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:440
|
205 |
msgid "Remove limits »"
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: lib/class-wp-smush-admin.php:608
|
209 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:459
|
210 |
msgid "When you <a href=\"%s\">upload some images</a> they will be available to smush here."
|
211 |
msgstr ""
|
212 |
|
213 |
+
#: lib/class-wp-smush-admin.php:614 lib/class-wp-smush-admin.php:858
|
214 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:465
|
215 |
msgid "You can also smush images individually from your <a href=\"%s\">Media Library</a>."
|
216 |
msgstr ""
|
217 |
|
218 |
+
#: lib/class-wp-smush-admin.php:669
|
219 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:337
|
220 |
msgid "Reduced by "
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: lib/class-wp-smush-admin.php:679
|
224 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:347
|
225 |
msgid "<span class=\"done-count\">%d</span> of <span class=\"total-count\">%d</span> total attachments have been smushed"
|
226 |
msgstr ""
|
227 |
|
228 |
+
#: lib/class-wp-smush-admin.php:739
|
229 |
+
msgid "Smush request timed out, You can try setting a higher value for `WP_SMUSH_API_TIMEOUT`."
|
230 |
+
msgstr ""
|
231 |
+
|
232 |
+
#: lib/class-wp-smush-admin.php:754 lib/class-wp-smush-nextgen.php:321
|
233 |
msgid "You don't have permission to work with uploaded files."
|
234 |
msgstr ""
|
235 |
|
236 |
+
#: lib/class-wp-smush-admin.php:758 lib/class-wp-smush-nextgen.php:325
|
237 |
msgid "No attachment ID was provided."
|
238 |
msgstr ""
|
239 |
|
240 |
+
#: lib/class-wp-smush-admin.php:828
|
241 |
msgid "<p>Please <a href=\"%s\">upload some images</a>.</p>"
|
242 |
msgstr ""
|
243 |
|
244 |
+
#: lib/class-wp-smush-admin.php:846
|
245 |
msgid "All your images are already smushed!"
|
246 |
msgstr ""
|
247 |
|
248 |
+
#: lib/class-wp-smush-admin.php:948
|
249 |
msgid "<strong>%d of %d images</strong> were sent for smushing:"
|
250 |
msgstr ""
|
251 |
|
252 |
+
#: lib/class-wp-smush-admin.php:1249
|
253 |
msgid "Super-Smush Images"
|
254 |
msgstr ""
|
255 |
|
256 |
+
#: lib/class-wp-smush-admin.php:1250
|
257 |
msgid "We found attachments that were previously smushed losslessly. If desired you can Super-Smush them now for more savings with almost no noticeable quality loss."
|
258 |
msgstr ""
|
259 |
|
260 |
+
#: lib/class-wp-smush-admin.php:1258
|
261 |
msgid "<span class=\"remaining-count\">%d</span> attachment left to Super-Smush"
|
262 |
msgid_plural "<span class=\"remaining-count\">%d</span> attachments left to Super-Smush"
|
263 |
msgstr[0] ""
|
264 |
msgstr[1] ""
|
265 |
|
266 |
+
#: lib/class-wp-smush-admin.php:1283
|
267 |
msgid "Thanks for using WP Smush Pro! You now can:"
|
268 |
msgstr ""
|
269 |
|
270 |
+
#: lib/class-wp-smush-admin.php:1285 lib/class-wp-smush-admin.php:1298
|
271 |
msgid "Smush the original Full image sizes that are normally skipped by default."
|
272 |
msgstr ""
|
273 |
|
274 |
+
#: lib/class-wp-smush-admin.php:1286 lib/class-wp-smush-admin.php:1299
|
275 |
+
msgid "NextGen Gallery integration"
|
276 |
+
msgstr ""
|
277 |
+
|
278 |
+
#: lib/class-wp-smush-admin.php:1287 lib/class-wp-smush-admin.php:1300
|
279 |
msgid "\"Super-Smush\" your images with our intelligent multi-pass lossy compression. Get 2× more compression than lossless with almost no noticeable quality loss!"
|
280 |
msgstr ""
|
281 |
|
282 |
+
#: lib/class-wp-smush-admin.php:1288 lib/class-wp-smush-admin.php:1301
|
283 |
msgid "Get the best lossless compression. We try multiple methods to squeeze every last byte out of your images."
|
284 |
msgstr ""
|
285 |
|
286 |
+
#: lib/class-wp-smush-admin.php:1289
|
287 |
msgid "Smush images up to 32MB."
|
288 |
msgstr ""
|
289 |
|
290 |
+
#: lib/class-wp-smush-admin.php:1290
|
291 |
msgid "Bulk smush ALL your images with one click!"
|
292 |
msgstr ""
|
293 |
|
294 |
+
#: lib/class-wp-smush-admin.php:1291 lib/class-wp-smush-admin.php:1304
|
295 |
msgid "Keep a backup of your original un-smushed images in case you want to restore later."
|
296 |
msgstr ""
|
297 |
|
298 |
+
#: lib/class-wp-smush-admin.php:1296
|
299 |
msgid "Upgrade to WP Smush Pro to:"
|
300 |
msgstr ""
|
301 |
|
302 |
+
#: lib/class-wp-smush-admin.php:1302
|
303 |
msgid "Smush images greater than 1MB."
|
304 |
msgstr ""
|
305 |
|
306 |
+
#: lib/class-wp-smush-admin.php:1303
|
307 |
msgid "Bulk smush ALL your images with one click! No more rate limiting."
|
308 |
msgstr ""
|
309 |
|
310 |
+
#: lib/class-wp-smush-admin.php:1305
|
311 |
msgid "Access 24/7/365 support from <a href=\"https://premium.wpmudev.org/support/?utm_source=wordpress.org&utm_medium=plugin&utm_campaign=WP%20Smush%20Upgrade\">the best WordPress support team on the planet</a>."
|
312 |
msgstr ""
|
313 |
|
314 |
+
#: lib/class-wp-smush-admin.php:1306
|
315 |
msgid "Download <a href=\"https://premium.wpmudev.org/?utm_source=wordpress.org&utm_medium=plugin&utm_campaign=WP%20Smush%20Upgrade\">350+ other premium plugins and themes</a> included in your membership."
|
316 |
msgstr ""
|
317 |
|
318 |
+
#: lib/class-wp-smush-admin.php:1309
|
319 |
msgid "Upgrade Now »"
|
320 |
msgstr ""
|
321 |
|
322 |
+
#: lib/class-wp-smush-admin.php:1312
|
323 |
msgid "Already upgraded to a WPMU DEV membership? Install and Login to our Dashboard plugin to enable Smush Pro features."
|
324 |
msgstr ""
|
325 |
|
326 |
+
#: lib/class-wp-smush-admin.php:1321
|
327 |
msgid "Activate WPMU DEV Dashboard"
|
328 |
msgstr ""
|
329 |
|
330 |
+
#: lib/class-wp-smush-admin.php:1324
|
331 |
msgid "Install WPMU DEV Dashboard"
|
332 |
msgstr ""
|
333 |
|
334 |
+
#: lib/class-wp-smush-nextgen.php:193 lib/class-wp-smush.php:328
|
335 |
+
msgid "Size '%s' not processed correctly"
|
336 |
+
msgstr ""
|
337 |
+
|
338 |
+
#: lib/class-wp-smush.php:99
|
339 |
msgid "File path is empty"
|
340 |
msgstr ""
|
341 |
|
342 |
+
#: lib/class-wp-smush.php:104
|
343 |
msgid "Could not find %s"
|
344 |
msgstr ""
|
345 |
|
346 |
+
#: lib/class-wp-smush.php:109
|
347 |
msgid "%s is not writable"
|
348 |
msgstr ""
|
349 |
|
350 |
+
#: lib/class-wp-smush.php:119
|
351 |
msgid "Skipped (%s), image not found."
|
352 |
msgstr ""
|
353 |
|
354 |
+
#: lib/class-wp-smush.php:124
|
355 |
msgid "Skipped (%s), size limit exceeded."
|
356 |
msgstr ""
|
357 |
|
358 |
+
#: lib/class-wp-smush.php:139
|
359 |
msgid "Unknown API error"
|
360 |
msgstr ""
|
361 |
|
362 |
+
#: lib/class-wp-smush.php:360 lib/class-wp-smush.php:368
|
|
|
|
|
|
|
|
|
363 |
msgid "Size 'full' not processed correctly"
|
364 |
msgstr ""
|
365 |
|
366 |
+
#: lib/class-wp-smush.php:503
|
367 |
msgid "Error posting to API: %s"
|
368 |
msgstr ""
|
369 |
|
370 |
+
#: lib/class-wp-smush.php:509
|
371 |
msgid "Error posting to API: %s %s"
|
372 |
msgstr ""
|
373 |
|
374 |
+
#: lib/class-wp-smush.php:526
|
375 |
msgid "Smush data corrupted, try again."
|
376 |
msgstr ""
|
377 |
|
378 |
+
#: lib/class-wp-smush.php:542
|
379 |
msgid "Image couldn't be smushed"
|
380 |
msgstr ""
|
381 |
|
382 |
+
#: lib/class-wp-smush.php:725
|
383 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:182
|
384 |
msgid "Error processing request"
|
385 |
msgstr ""
|
386 |
|
387 |
+
#: lib/class-wp-smush.php:729
|
388 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:186
|
389 |
msgid "Already Optimized"
|
390 |
msgstr ""
|
391 |
|
392 |
+
#: lib/class-wp-smush.php:731
|
393 |
msgid "%d images reduced "
|
394 |
msgstr ""
|
395 |
|
396 |
+
#: lib/class-wp-smush.php:731
|
397 |
msgid "Reduced "
|
398 |
msgstr ""
|
399 |
|
400 |
+
#: lib/class-wp-smush.php:732
|
401 |
msgid "by %s ( %01.1f%% )"
|
402 |
msgstr ""
|
403 |
|
404 |
+
#: lib/class-wp-smush.php:737
|
405 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:192
|
406 |
msgid "Smush stats"
|
407 |
msgstr ""
|
408 |
|
409 |
+
#: lib/class-wp-smush.php:767
|
410 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:246
|
411 |
msgid "Not processed"
|
412 |
msgstr ""
|
413 |
|
414 |
+
#: lib/class-wp-smush.php:773
|
415 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:252
|
416 |
msgid "Smush Now!"
|
417 |
msgstr ""
|
418 |
|
419 |
+
#: lib/class-wp-smush.php:1076
|
|
|
|
|
|
|
|
|
420 |
msgid "Image couldn't be smushed as it exceeded the 1Mb size limit, Pro users can smush images with size upto 32Mb."
|
421 |
msgstr ""
|
422 |
|
423 |
+
#: lib/class-wp-smush.php:1078
|
424 |
msgid " Skipped"
|
425 |
msgstr ""
|
426 |
|
427 |
+
#: lib/class-wp-smush.php:1096
|
428 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:326
|
429 |
msgid "Image size"
|
430 |
msgstr ""
|
431 |
|
432 |
+
#: lib/class-wp-smush.php:1097
|
433 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:327
|
434 |
msgid "Savings"
|
435 |
msgstr ""
|
436 |
|
437 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:54
|
438 |
+
msgid "WP Bulk Smush"
|
439 |
+
msgstr ""
|
440 |
+
|
441 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:422
|
442 |
+
msgid "We didn't find any images in NextGen gallery, please upload some images."
|
443 |
+
msgstr ""
|
444 |
+
|
445 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-admin.php:433
|
446 |
+
msgid "%d attachment in NextGen Gallery has not been smushed yet."
|
447 |
+
msgid_plural "%d image attachments in NextGen Gallery have not been smushed yet."
|
448 |
+
msgstr[0] ""
|
449 |
+
msgstr[1] ""
|
450 |
+
|
451 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-bulk.php:32
|
452 |
+
msgid "Smush request timed out, You can try setting a higher value ( > 60 ) for `WP_SMUSH_API_TIMEOUT`."
|
453 |
+
msgstr ""
|
454 |
+
|
455 |
+
#: lib/nextgen-integration/class-wp-smush-nextgen-stats.php:188
|
456 |
+
msgid "Reduced by %s ( %01.1f%% )"
|
457 |
+
msgstr ""
|
458 |
+
|
459 |
+
#: wp-smush.php:124
|
460 |
msgid "Get Fast"
|
461 |
msgstr ""
|
462 |
#. Plugin Name of the plugin/theme
|
lib/class-wp-smush-admin.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author Saurabh Shukla <saurabh@incsub.com>
|
8 |
* @author Umesh Kumar <umesh@incsub.com>
|
9 |
*
|
10 |
-
* @copyright (c)
|
11 |
*/
|
12 |
if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
13 |
/**
|
@@ -33,12 +33,24 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
33 |
|
34 |
public $bulk;
|
35 |
|
|
|
|
|
|
|
36 |
public $total_count;
|
37 |
|
|
|
|
|
|
|
38 |
public $smushed_count;
|
39 |
|
|
|
|
|
|
|
40 |
public $stats;
|
41 |
|
|
|
|
|
|
|
42 |
public $max_free_bulk = 50; //this is enforced at api level too
|
43 |
|
44 |
public $upgrade_url = 'https://premium.wpmudev.org/project/wp-smush-pro/?utm_source=wordpress.org&utm_medium=plugin&utm_campaign=WP%20Smush%20Upgrade';
|
@@ -49,11 +61,19 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
49 |
//Stores all lossless smushed ids
|
50 |
private $lossless_ids = '';
|
51 |
|
|
|
|
|
|
|
|
|
|
|
52 |
/**
|
53 |
* Constructor
|
54 |
*/
|
55 |
public function __construct() {
|
56 |
|
|
|
|
|
|
|
57 |
// hook scripts and styles
|
58 |
add_action( 'admin_init', array( $this, 'register' ) );
|
59 |
|
@@ -63,7 +83,6 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
63 |
//Handle Smush Bulk Ajax
|
64 |
add_action( 'wp_ajax_wp_smushit_bulk', array( $this, 'process_smush_request' ) );
|
65 |
|
66 |
-
|
67 |
//Handle Smush Single Ajax
|
68 |
add_action( 'wp_ajax_wp_smushit_manual', array( $this, 'smush_single' ) );
|
69 |
|
@@ -144,6 +163,9 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
144 |
|
145 |
// Enqueue js on Post screen (Edit screen for media )
|
146 |
add_action( 'admin_print_scripts-post-new.php', array( $this, 'enqueue' ) );
|
|
|
|
|
|
|
147 |
}
|
148 |
|
149 |
/**
|
@@ -153,9 +175,6 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
153 |
|
154 |
global $WpSmush;
|
155 |
|
156 |
-
// Save settings, if needed
|
157 |
-
$this->process_options();
|
158 |
-
|
159 |
// Register js for smush utton in grid view
|
160 |
$current_blog_id = get_current_blog_id();
|
161 |
$meta_key = $current_blog_id == 1 ? 'wp_media_library_mode' : 'wp_' . $current_blog_id . '_media_library_mode';
|
@@ -180,6 +199,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
180 |
|
181 |
/* Register Style. */
|
182 |
wp_register_style( 'wp-smushit-admin-css', WP_SMUSH_URL . 'assets/css/wp-smushit-admin.css', array(), $WpSmush->version );
|
|
|
183 |
|
184 |
}
|
185 |
|
@@ -188,6 +208,14 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
188 |
*/
|
189 |
function enqueue() {
|
190 |
global $pagenow;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
if ( $pagenow == 'post.php' ) {
|
192 |
//Do not load any style or js on post types other than attachment
|
193 |
$post_type = get_post_type();
|
@@ -197,16 +225,23 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
197 |
}
|
198 |
|
199 |
wp_enqueue_script( 'wp-smushit-admin-js' );
|
200 |
-
wp_enqueue_script( '
|
|
|
|
|
|
|
|
|
201 |
|
202 |
//Style
|
203 |
wp_enqueue_style( 'wp-smushit-admin-css' );
|
|
|
204 |
|
205 |
// localize translatable strings for js
|
206 |
$this->localize();
|
207 |
}
|
208 |
|
209 |
-
|
|
|
|
|
210 |
function localize() {
|
211 |
global $pagenow;
|
212 |
if ( ! isset( $pagenow ) || ! in_array( $pagenow, array( "post.php", "upload.php", "post-new.php" ) ) ) {
|
@@ -270,11 +305,18 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
270 |
* Translation ready settings
|
271 |
*/
|
272 |
function init_settings() {
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
$this->settings = array(
|
274 |
'auto' => __( 'Smush images on upload', 'wp-smushit' ),
|
275 |
-
'original' => __( 'Smush Original Image', 'wp-smushit' ) . '<span class="dashicons dashicons-info smush-original" title="' .
|
276 |
'lossy' => __( 'Super-Smush images', 'wp-smushit' ) . ' <small>(' . __( 'Lossy Image Compression', 'wp-smushit' ) . ')</small>',
|
277 |
-
'backup' => __( 'Backup Original Images', 'wp-smushit' ) . ' <small>(' . __( 'Will nearly double the size of your Uploads Directory', 'wp-smushit' ) . ')</small>'
|
|
|
278 |
);
|
279 |
}
|
280 |
|
@@ -347,17 +389,41 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
347 |
$opt_original = WP_SMUSH_PREFIX . 'original';
|
348 |
//Auto value
|
349 |
$opt_original_val = get_option( $opt_original, false );
|
|
|
|
|
|
|
|
|
350 |
|
351 |
//Smush auto key
|
352 |
$opt_lossy = WP_SMUSH_PREFIX . 'lossy';
|
353 |
//Auto value
|
354 |
$opt_lossy_val = get_option( $opt_lossy, false );
|
355 |
|
|
|
|
|
|
|
|
|
|
|
356 |
//Smush auto key
|
357 |
$opt_backup = WP_SMUSH_PREFIX . 'backup';
|
358 |
//Auto value
|
359 |
$opt_backup_val = get_option( $opt_backup, false );
|
360 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
//disable lossy for non-premium members
|
362 |
$disabled = $class = $feature_class = '';
|
363 |
if ( ! $this->is_pro() ) {
|
@@ -390,6 +456,9 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
390 |
//Lossy
|
391 |
printf( "<div class='wp-smush-setting-row%5\$s'><label><input type='checkbox' name='%1\$s' id='%1\$s' value='1' %2\$s %3\$s>%4\$s</label></div>", esc_attr( $opt_lossy ), checked( $opt_lossy_val, 1, false ), $disabled, $this->settings['lossy'], $feature_class );
|
392 |
|
|
|
|
|
|
|
393 |
//Backup
|
394 |
printf( "<div class='wp-smush-setting-row%5\$s'><label><input type='checkbox' name='%1\$s' id='%1\$s' value='1' %2\$s %3\$s>%4\$s</label></div>", esc_attr( $opt_backup ), checked( $opt_backup_val, 1, false ), $disabled, $this->settings['backup'], $feature_class ); ?>
|
395 |
<!-- End of pro-only -->
|
@@ -443,19 +512,23 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
443 |
*
|
444 |
* @return int
|
445 |
*/
|
446 |
-
function get_exceeding_items_count() {
|
447 |
-
$count
|
448 |
-
$
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
|
|
|
|
|
|
|
|
457 |
}
|
458 |
-
$count
|
459 |
}
|
460 |
|
461 |
return $count;
|
@@ -469,7 +542,10 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
469 |
$exceed_mb = '';
|
470 |
if ( ! $this->is_pro() ) {
|
471 |
|
472 |
-
|
|
|
|
|
|
|
473 |
$exceed_mb = sprintf(
|
474 |
_n( "%d image is over 1MB so will be skipped using the free version of the plugin.",
|
475 |
"%d images are over 1MB so will be skipped using the free version of the plugin.", $this->exceeding_items_count, 'wp-smushit' ),
|
@@ -544,6 +620,9 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
544 |
<?php
|
545 |
}
|
546 |
|
|
|
|
|
|
|
547 |
function print_loader() {
|
548 |
?>
|
549 |
<div class="wp-smush-loader-wrap hidden">
|
@@ -640,7 +719,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
640 |
);
|
641 |
}
|
642 |
|
643 |
-
$attachment_id = $_REQUEST['attachment_id'];
|
644 |
|
645 |
$original_meta = wp_get_attachment_metadata( $attachment_id, true );
|
646 |
|
@@ -654,9 +733,14 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
654 |
$stats['total'] = $this->total_count;
|
655 |
|
656 |
if ( is_wp_error( $smush ) ) {
|
657 |
-
|
|
|
|
|
|
|
|
|
|
|
658 |
} else {
|
659 |
-
wp_send_json_success( $stats );
|
660 |
}
|
661 |
}
|
662 |
|
@@ -799,7 +883,8 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
799 |
'post_status' => 'any',
|
800 |
'post_mime_type' => array( 'image/jpeg', 'image/gif', 'image/png' ),
|
801 |
'order' => 'ASC',
|
802 |
-
'posts_per_page' => - 1
|
|
|
803 |
);
|
804 |
$results = new WP_Query( $query );
|
805 |
$count = ! empty( $results->post_count ) ? $results->post_count : 0;
|
@@ -823,7 +908,8 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
823 |
'post_mime_type' => array( 'image/jpeg', 'image/gif', 'image/png' ),
|
824 |
'order' => 'ASC',
|
825 |
'posts_per_page' => - 1,
|
826 |
-
'meta_key' => 'wp-smpro-smush-data'
|
|
|
827 |
);
|
828 |
|
829 |
$results = new WP_Query( $query );
|
@@ -880,8 +966,6 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
880 |
|
881 |
/**
|
882 |
* Display the bulk smushing button
|
883 |
-
*
|
884 |
-
* @todo Add the API status here, next to the button
|
885 |
*/
|
886 |
function setup_button( $super_smush = false ) {
|
887 |
$button = $this->button_state( $super_smush );
|
@@ -897,10 +981,6 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
897 |
|
898 |
global $wpdb, $WpSmush;
|
899 |
|
900 |
-
$sql = "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key=%s";
|
901 |
-
|
902 |
-
$global_data = $wpdb->get_col( $wpdb->prepare( $sql, "wp-smpro-smush-data" ) );
|
903 |
-
|
904 |
$smush_data = array(
|
905 |
'size_before' => 0,
|
906 |
'size_after' => 0,
|
@@ -908,17 +988,29 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
908 |
'human' => 0
|
909 |
);
|
910 |
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
917 |
}
|
918 |
}
|
919 |
-
}
|
920 |
|
921 |
-
|
|
|
|
|
922 |
|
923 |
if ( $smush_data['bytes'] < 0 ) {
|
924 |
$smush_data['bytes'] = 0;
|
@@ -978,8 +1070,13 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
978 |
return $button;
|
979 |
}
|
980 |
|
|
|
|
|
|
|
|
|
|
|
981 |
function get_smushed_image_ids() {
|
982 |
-
$args
|
983 |
'fields' => 'ids',
|
984 |
'post_type' => 'attachment',
|
985 |
'post_status' => 'any',
|
@@ -992,6 +1089,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
992 |
'value' => '1',
|
993 |
)
|
994 |
),
|
|
|
995 |
);
|
996 |
$query = new WP_Query( $args );
|
997 |
|
@@ -1025,6 +1123,9 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1025 |
return $links;
|
1026 |
}
|
1027 |
|
|
|
|
|
|
|
1028 |
function smush_upgrade() {
|
1029 |
if ( ! current_user_can( 'edit_others_posts' ) || ! is_super_admin() ) {
|
1030 |
return;
|
@@ -1169,7 +1270,12 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1169 |
* Displays the features available in Smush pro
|
1170 |
*/
|
1171 |
function smush_pro_features() {
|
1172 |
-
|
|
|
|
|
|
|
|
|
|
|
1173 |
return;
|
1174 |
}
|
1175 |
if ( $this->is_pro() ) { ?>
|
@@ -1177,6 +1283,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1177 |
<h3><?php _e( 'Thanks for using WP Smush Pro! You now can:', 'wp-smushit' ) ?></h3>
|
1178 |
<ol>
|
1179 |
<li><?php _e( 'Smush the original Full image sizes that are normally skipped by default.', 'wp-smushit' ); ?></li>
|
|
|
1180 |
<li><?php _e( '"Super-Smush" your images with our intelligent multi-pass lossy compression. Get 2× more compression than lossless with almost no noticeable quality loss!', 'wp-smushit' ); ?></li>
|
1181 |
<li><?php _e( 'Get the best lossless compression. We try multiple methods to squeeze every last byte out of your images.', 'wp-smushit' ); ?></li>
|
1182 |
<li><?php _e( 'Smush images up to 32MB.', 'wp-smushit' ); ?></li>
|
@@ -1189,6 +1296,7 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1189 |
<h3><?php _e( 'Upgrade to WP Smush Pro to:', 'wp-smushit' ) ?></h3>
|
1190 |
<ol>
|
1191 |
<li><?php _e( 'Smush the original Full image sizes that are normally skipped by default.', 'wp-smushit' ); ?></li>
|
|
|
1192 |
<li><?php _e( '"Super-Smush" your images with our intelligent multi-pass lossy compression. Get 2× more compression than lossless with almost no noticeable quality loss!', 'wp-smushit' ); ?></li>
|
1193 |
<li><?php _e( 'Get the best lossless compression. We try multiple methods to squeeze every last byte out of your images.', 'wp-smushit' ); ?></li>
|
1194 |
<li><?php _e( 'Smush images greater than 1MB.', 'wp-smushit' ); ?></li>
|
@@ -1223,5 +1331,6 @@ if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
|
1223 |
}
|
1224 |
}
|
1225 |
|
|
|
1226 |
$wpsmushit_admin = new WpSmushitAdmin();
|
1227 |
}
|
7 |
* @author Saurabh Shukla <saurabh@incsub.com>
|
8 |
* @author Umesh Kumar <umesh@incsub.com>
|
9 |
*
|
10 |
+
* @copyright (c) 2015, Incsub (http://incsub.com)
|
11 |
*/
|
12 |
if ( ! class_exists( 'WpSmushitAdmin' ) ) {
|
13 |
/**
|
33 |
|
34 |
public $bulk;
|
35 |
|
36 |
+
/**
|
37 |
+
* @var Total count of Attachments for Smushing
|
38 |
+
*/
|
39 |
public $total_count;
|
40 |
|
41 |
+
/**
|
42 |
+
* @var Smushed attachments out of total attachments
|
43 |
+
*/
|
44 |
public $smushed_count;
|
45 |
|
46 |
+
/**
|
47 |
+
* @array Stores the stats for all the images
|
48 |
+
*/
|
49 |
public $stats;
|
50 |
|
51 |
+
/**
|
52 |
+
* @var int Limit for allowed number of images per bulk request
|
53 |
+
*/
|
54 |
public $max_free_bulk = 50; //this is enforced at api level too
|
55 |
|
56 |
public $upgrade_url = 'https://premium.wpmudev.org/project/wp-smush-pro/?utm_source=wordpress.org&utm_medium=plugin&utm_campaign=WP%20Smush%20Upgrade';
|
61 |
//Stores all lossless smushed ids
|
62 |
private $lossless_ids = '';
|
63 |
|
64 |
+
/**
|
65 |
+
* @var int Number of attachments exceeding free limit
|
66 |
+
*/
|
67 |
+
public $exceeding_items_count = 0;
|
68 |
+
|
69 |
/**
|
70 |
* Constructor
|
71 |
*/
|
72 |
public function __construct() {
|
73 |
|
74 |
+
// Save Settings, Process Option, Need to process it early, so the pages are loaded accordingly, nextgen gallery integration is loaded at same action
|
75 |
+
add_action( 'plugins_loaded', array( $this, 'process_options' ) );
|
76 |
+
|
77 |
// hook scripts and styles
|
78 |
add_action( 'admin_init', array( $this, 'register' ) );
|
79 |
|
83 |
//Handle Smush Bulk Ajax
|
84 |
add_action( 'wp_ajax_wp_smushit_bulk', array( $this, 'process_smush_request' ) );
|
85 |
|
|
|
86 |
//Handle Smush Single Ajax
|
87 |
add_action( 'wp_ajax_wp_smushit_manual', array( $this, 'smush_single' ) );
|
88 |
|
163 |
|
164 |
// Enqueue js on Post screen (Edit screen for media )
|
165 |
add_action( 'admin_print_scripts-post-new.php', array( $this, 'enqueue' ) );
|
166 |
+
|
167 |
+
//For Nextgen gallery Pages, check later in enqueue function
|
168 |
+
add_action( 'admin_print_scripts', array( $this, 'enqueue' ) );
|
169 |
}
|
170 |
|
171 |
/**
|
175 |
|
176 |
global $WpSmush;
|
177 |
|
|
|
|
|
|
|
178 |
// Register js for smush utton in grid view
|
179 |
$current_blog_id = get_current_blog_id();
|
180 |
$meta_key = $current_blog_id == 1 ? 'wp_media_library_mode' : 'wp_' . $current_blog_id . '_media_library_mode';
|
199 |
|
200 |
/* Register Style. */
|
201 |
wp_register_style( 'wp-smushit-admin-css', WP_SMUSH_URL . 'assets/css/wp-smushit-admin.css', array(), $WpSmush->version );
|
202 |
+
wp_register_style( 'jquery-ui', WP_SMUSH_URL . 'assets/css/jquery-ui.css', array() );
|
203 |
|
204 |
}
|
205 |
|
208 |
*/
|
209 |
function enqueue() {
|
210 |
global $pagenow;
|
211 |
+
$current_screen = get_current_screen();
|
212 |
+
$current_page = $current_screen->base;
|
213 |
+
|
214 |
+
//Do not enqueue, unless it is one of the required screen
|
215 |
+
if ( $current_page != 'nggallery-manage-images' && $current_page != 'gallery_page_wp-smush-nextgen-bulk' && $pagenow != 'post.php' && $pagenow != 'upload.php' ) {
|
216 |
+
return;
|
217 |
+
}
|
218 |
+
|
219 |
if ( $pagenow == 'post.php' ) {
|
220 |
//Do not load any style or js on post types other than attachment
|
221 |
$post_type = get_post_type();
|
225 |
}
|
226 |
|
227 |
wp_enqueue_script( 'wp-smushit-admin-js' );
|
228 |
+
wp_enqueue_script( 'jquery-ui-tooltip' );
|
229 |
+
if ( $pagenow == 'post.php' || $pagenow == 'upload.php' ) {
|
230 |
+
//For grid view, Need not load it anywhere else
|
231 |
+
wp_enqueue_script( 'wp-smushit-admin-media-js' );
|
232 |
+
}
|
233 |
|
234 |
//Style
|
235 |
wp_enqueue_style( 'wp-smushit-admin-css' );
|
236 |
+
wp_enqueue_style( 'jquery-ui' );
|
237 |
|
238 |
// localize translatable strings for js
|
239 |
$this->localize();
|
240 |
}
|
241 |
|
242 |
+
/**
|
243 |
+
* Localize Translations
|
244 |
+
*/
|
245 |
function localize() {
|
246 |
global $pagenow;
|
247 |
if ( ! isset( $pagenow ) || ! in_array( $pagenow, array( "post.php", "upload.php", "post-new.php" ) ) ) {
|
305 |
* Translation ready settings
|
306 |
*/
|
307 |
function init_settings() {
|
308 |
+
if( $this->is_pro() ) {
|
309 |
+
$smush_orgnl_txt = esc_html__('Smush all images, including originals.', 'wp_smushit');
|
310 |
+
}else{
|
311 |
+
$count = count( get_intermediate_image_sizes() );
|
312 |
+
$smush_orgnl_txt = sprintf( esc_html__("When you upload an image to WordPress it automatically creates %s thumbnail sizes that are commonly used in your pages. WordPress also stores the original full-size image, but because these are not usually embedded on your site we don’t Smush them. Pro users can override this.", 'wp_smushit'), $count );
|
313 |
+
}
|
314 |
$this->settings = array(
|
315 |
'auto' => __( 'Smush images on upload', 'wp-smushit' ),
|
316 |
+
'original' => __( 'Smush Original Image', 'wp-smushit' ) . '<span class="dashicons dashicons-info smush-original" title="' . $smush_orgnl_txt . '"></span>',
|
317 |
'lossy' => __( 'Super-Smush images', 'wp-smushit' ) . ' <small>(' . __( 'Lossy Image Compression', 'wp-smushit' ) . ')</small>',
|
318 |
+
'backup' => __( 'Backup Original Images', 'wp-smushit' ) . ' <small>(' . __( 'Will nearly double the size of your Uploads Directory', 'wp-smushit' ) . ')</small>',
|
319 |
+
'nextgen' => __( 'Enable NextGen Gallery integration', 'wp-smushit' )
|
320 |
);
|
321 |
}
|
322 |
|
389 |
$opt_original = WP_SMUSH_PREFIX . 'original';
|
390 |
//Auto value
|
391 |
$opt_original_val = get_option( $opt_original, false );
|
392 |
+
//For free version, show unchecked
|
393 |
+
if ( ! $this->is_pro() ) {
|
394 |
+
$opt_original_val = 0;
|
395 |
+
}
|
396 |
|
397 |
//Smush auto key
|
398 |
$opt_lossy = WP_SMUSH_PREFIX . 'lossy';
|
399 |
//Auto value
|
400 |
$opt_lossy_val = get_option( $opt_lossy, false );
|
401 |
|
402 |
+
//For free version, show unchecked
|
403 |
+
if ( ! $this->is_pro() ) {
|
404 |
+
$opt_lossy_val = 0;
|
405 |
+
}
|
406 |
+
|
407 |
//Smush auto key
|
408 |
$opt_backup = WP_SMUSH_PREFIX . 'backup';
|
409 |
//Auto value
|
410 |
$opt_backup_val = get_option( $opt_backup, false );
|
411 |
|
412 |
+
//For free version, show unchecked
|
413 |
+
if ( ! $this->is_pro() ) {
|
414 |
+
$opt_backup_val = 0;
|
415 |
+
}
|
416 |
+
|
417 |
+
//Smush NextGen key
|
418 |
+
$opt_nextgen = WP_SMUSH_PREFIX . 'nextgen';
|
419 |
+
//Auto value
|
420 |
+
$opt_nextgen_val = get_option( $opt_nextgen, 1 );
|
421 |
+
|
422 |
+
//For free version, show unchecked
|
423 |
+
if ( ! $this->is_pro() ) {
|
424 |
+
$opt_nextgen_val = 0;
|
425 |
+
}
|
426 |
+
|
427 |
//disable lossy for non-premium members
|
428 |
$disabled = $class = $feature_class = '';
|
429 |
if ( ! $this->is_pro() ) {
|
456 |
//Lossy
|
457 |
printf( "<div class='wp-smush-setting-row%5\$s'><label><input type='checkbox' name='%1\$s' id='%1\$s' value='1' %2\$s %3\$s>%4\$s</label></div>", esc_attr( $opt_lossy ), checked( $opt_lossy_val, 1, false ), $disabled, $this->settings['lossy'], $feature_class );
|
458 |
|
459 |
+
//NextGen Gallery
|
460 |
+
printf( "<div class='wp-smush-setting-row%5\$s'><label><input type='checkbox' name='%1\$s' id='%1\$s' value='1' %2\$s %3\$s>%4\$s</label></div>", esc_attr( $opt_nextgen ), checked( $opt_nextgen_val, 1, false ), $disabled, $this->settings['nextgen'], $feature_class );
|
461 |
+
|
462 |
//Backup
|
463 |
printf( "<div class='wp-smush-setting-row%5\$s'><label><input type='checkbox' name='%1\$s' id='%1\$s' value='1' %2\$s %3\$s>%4\$s</label></div>", esc_attr( $opt_backup ), checked( $opt_backup_val, 1, false ), $disabled, $this->settings['backup'], $feature_class ); ?>
|
464 |
<!-- End of pro-only -->
|
512 |
*
|
513 |
* @return int
|
514 |
*/
|
515 |
+
function get_exceeding_items_count( $force_update = false ) {
|
516 |
+
$count = wp_cache_get('exceeding_items', 'wp_smush');
|
517 |
+
if( !$count || $force_update ) {
|
518 |
+
$count = 0;
|
519 |
+
$bulk = new WpSmushitBulk();
|
520 |
+
$attachments = $bulk->get_attachments();
|
521 |
+
//Check images bigger than 1Mb, used to display the count of images that can't be smushed
|
522 |
+
foreach ( $attachments as $attachment ) {
|
523 |
+
if ( file_exists( get_attached_file( $attachment ) ) ) {
|
524 |
+
$size = filesize( get_attached_file( $attachment ) );
|
525 |
+
}
|
526 |
+
if ( empty( $size ) || ! ( ( $size / WP_SMUSH_MAX_BYTES ) > 1 ) ) {
|
527 |
+
continue;
|
528 |
+
}
|
529 |
+
$count ++;
|
530 |
}
|
531 |
+
wp_cache_set( 'exceeding_items', $count, 'wp_smush', 3000 );
|
532 |
}
|
533 |
|
534 |
return $count;
|
542 |
$exceed_mb = '';
|
543 |
if ( ! $this->is_pro() ) {
|
544 |
|
545 |
+
//Initialize exceeding item Count
|
546 |
+
$this->exceeding_items_count = $this->get_exceeding_items_count();
|
547 |
+
|
548 |
+
if ( $this->exceeding_items_count && $this->exceeding_items_count !== 0 ) {
|
549 |
$exceed_mb = sprintf(
|
550 |
_n( "%d image is over 1MB so will be skipped using the free version of the plugin.",
|
551 |
"%d images are over 1MB so will be skipped using the free version of the plugin.", $this->exceeding_items_count, 'wp-smushit' ),
|
620 |
<?php
|
621 |
}
|
622 |
|
623 |
+
/**
|
624 |
+
* Loading Image
|
625 |
+
*/
|
626 |
function print_loader() {
|
627 |
?>
|
628 |
<div class="wp-smush-loader-wrap hidden">
|
719 |
);
|
720 |
}
|
721 |
|
722 |
+
$attachment_id = sanitize_key( $_REQUEST['attachment_id'] );
|
723 |
|
724 |
$original_meta = wp_get_attachment_metadata( $attachment_id, true );
|
725 |
|
733 |
$stats['total'] = $this->total_count;
|
734 |
|
735 |
if ( is_wp_error( $smush ) ) {
|
736 |
+
$error = $smush->get_error_message();
|
737 |
+
//Check for timeout error and suggest to filter timeout
|
738 |
+
if( strpos( $error, 'timed out') ) {
|
739 |
+
$msg = esc_html__( "Smush request timed out, You can try setting a higher value for `WP_SMUSH_API_TIMEOUT`.", "wp-smushit" );
|
740 |
+
}
|
741 |
+
wp_send_json_error( array( 'stats' => $stats, 'error_msg' => $msg ) );
|
742 |
} else {
|
743 |
+
wp_send_json_success( array( 'stats' => $stats ) );
|
744 |
}
|
745 |
}
|
746 |
|
883 |
'post_status' => 'any',
|
884 |
'post_mime_type' => array( 'image/jpeg', 'image/gif', 'image/png' ),
|
885 |
'order' => 'ASC',
|
886 |
+
'posts_per_page' => - 1,
|
887 |
+
'no_found_rows' => true
|
888 |
);
|
889 |
$results = new WP_Query( $query );
|
890 |
$count = ! empty( $results->post_count ) ? $results->post_count : 0;
|
908 |
'post_mime_type' => array( 'image/jpeg', 'image/gif', 'image/png' ),
|
909 |
'order' => 'ASC',
|
910 |
'posts_per_page' => - 1,
|
911 |
+
'meta_key' => 'wp-smpro-smush-data',
|
912 |
+
'no_found_rows' => true
|
913 |
);
|
914 |
|
915 |
$results = new WP_Query( $query );
|
966 |
|
967 |
/**
|
968 |
* Display the bulk smushing button
|
|
|
|
|
969 |
*/
|
970 |
function setup_button( $super_smush = false ) {
|
971 |
$button = $this->button_state( $super_smush );
|
981 |
|
982 |
global $wpdb, $WpSmush;
|
983 |
|
|
|
|
|
|
|
|
|
984 |
$smush_data = array(
|
985 |
'size_before' => 0,
|
986 |
'size_after' => 0,
|
988 |
'human' => 0
|
989 |
);
|
990 |
|
991 |
+
/**
|
992 |
+
* Allows to set a limit of mysql query
|
993 |
+
* Default value is 2000
|
994 |
+
*/
|
995 |
+
$limit = apply_filters('wp_smush_media_query_limit', 2000 );
|
996 |
+
$limit = intval( $limit );
|
997 |
+
$offset = 0;
|
998 |
+
|
999 |
+
while ( $global_data = $wpdb->get_col( $wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key=%s LIMIT $offset, $limit", "wp-smpro-smush-data" ) ) ) {
|
1000 |
+
|
1001 |
+
if ( ! empty( $global_data ) ) {
|
1002 |
+
foreach ( $global_data as $data ) {
|
1003 |
+
$data = maybe_unserialize( $data );
|
1004 |
+
if ( ! empty( $data['stats'] ) ) {
|
1005 |
+
$smush_data['size_before'] += ! empty( $data['stats']['size_before'] ) ? (int) $data['stats']['size_before'] : 0;
|
1006 |
+
$smush_data['size_after'] += ! empty( $data['stats']['size_after'] ) ? (int) $data['stats']['size_after'] : 0;
|
1007 |
+
}
|
1008 |
}
|
1009 |
}
|
|
|
1010 |
|
1011 |
+
$smush_data['bytes'] = $smush_data['size_before'] - $smush_data['size_after'];
|
1012 |
+
$offset += $limit;
|
1013 |
+
}
|
1014 |
|
1015 |
if ( $smush_data['bytes'] < 0 ) {
|
1016 |
$smush_data['bytes'] = 0;
|
1070 |
return $button;
|
1071 |
}
|
1072 |
|
1073 |
+
/**
|
1074 |
+
* Queries all the attachments which have smushe meta
|
1075 |
+
*
|
1076 |
+
* @return array
|
1077 |
+
*/
|
1078 |
function get_smushed_image_ids() {
|
1079 |
+
$args = array(
|
1080 |
'fields' => 'ids',
|
1081 |
'post_type' => 'attachment',
|
1082 |
'post_status' => 'any',
|
1089 |
'value' => '1',
|
1090 |
)
|
1091 |
),
|
1092 |
+
'no_found_rows' => true
|
1093 |
);
|
1094 |
$query = new WP_Query( $args );
|
1095 |
|
1123 |
return $links;
|
1124 |
}
|
1125 |
|
1126 |
+
/**
|
1127 |
+
* Shows Notice for free users, displays a discount coupon
|
1128 |
+
*/
|
1129 |
function smush_upgrade() {
|
1130 |
if ( ! current_user_can( 'edit_others_posts' ) || ! is_super_admin() ) {
|
1131 |
return;
|
1270 |
* Displays the features available in Smush pro
|
1271 |
*/
|
1272 |
function smush_pro_features() {
|
1273 |
+
/**
|
1274 |
+
* Allows to filter whether to display or not, features divison
|
1275 |
+
*/
|
1276 |
+
$show_features = apply_filters( 'smush_pro_features', true );
|
1277 |
+
|
1278 |
+
if ( ! is_super_admin() || ! $show_features ) {
|
1279 |
return;
|
1280 |
}
|
1281 |
if ( $this->is_pro() ) { ?>
|
1283 |
<h3><?php _e( 'Thanks for using WP Smush Pro! You now can:', 'wp-smushit' ) ?></h3>
|
1284 |
<ol>
|
1285 |
<li><?php _e( 'Smush the original Full image sizes that are normally skipped by default.', 'wp-smushit' ); ?></li>
|
1286 |
+
<li><?php _e( 'NextGen Gallery integration', 'wp-smushit' ); ?></li>
|
1287 |
<li><?php _e( '"Super-Smush" your images with our intelligent multi-pass lossy compression. Get 2× more compression than lossless with almost no noticeable quality loss!', 'wp-smushit' ); ?></li>
|
1288 |
<li><?php _e( 'Get the best lossless compression. We try multiple methods to squeeze every last byte out of your images.', 'wp-smushit' ); ?></li>
|
1289 |
<li><?php _e( 'Smush images up to 32MB.', 'wp-smushit' ); ?></li>
|
1296 |
<h3><?php _e( 'Upgrade to WP Smush Pro to:', 'wp-smushit' ) ?></h3>
|
1297 |
<ol>
|
1298 |
<li><?php _e( 'Smush the original Full image sizes that are normally skipped by default.', 'wp-smushit' ); ?></li>
|
1299 |
+
<li><?php _e( 'NextGen Gallery integration', 'wp-smushit' ); ?></li>
|
1300 |
<li><?php _e( '"Super-Smush" your images with our intelligent multi-pass lossy compression. Get 2× more compression than lossless with almost no noticeable quality loss!', 'wp-smushit' ); ?></li>
|
1301 |
<li><?php _e( 'Get the best lossless compression. We try multiple methods to squeeze every last byte out of your images.', 'wp-smushit' ); ?></li>
|
1302 |
<li><?php _e( 'Smush images greater than 1MB.', 'wp-smushit' ); ?></li>
|
1331 |
}
|
1332 |
}
|
1333 |
|
1334 |
+
global $wpsmushit_admin;
|
1335 |
$wpsmushit_admin = new WpSmushitAdmin();
|
1336 |
}
|
lib/class-wp-smush-bulk.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* @author Saurabh Shukla <saurabh@incsub.com>
|
9 |
* @author Umesh Kumar <umesh@incsub.com>
|
10 |
*
|
11 |
-
* @copyright (c)
|
12 |
*/
|
13 |
if ( ! class_exists( 'WpSmushitBulk' ) ) {
|
14 |
|
@@ -36,7 +36,40 @@ if ( ! class_exists( 'WpSmushitBulk' ) ) {
|
|
36 |
'key' => 'wp-smpro-smush-data',
|
37 |
'compare' => 'NOT EXISTS'
|
38 |
)
|
39 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
);
|
41 |
$query = new WP_Query( $args );
|
42 |
$unsmushed_posts = $query->posts;
|
8 |
* @author Saurabh Shukla <saurabh@incsub.com>
|
9 |
* @author Umesh Kumar <umesh@incsub.com>
|
10 |
*
|
11 |
+
* @copyright (c) 2015, Incsub (http://incsub.com)
|
12 |
*/
|
13 |
if ( ! class_exists( 'WpSmushitBulk' ) ) {
|
14 |
|
36 |
'key' => 'wp-smpro-smush-data',
|
37 |
'compare' => 'NOT EXISTS'
|
38 |
)
|
39 |
+
),
|
40 |
+
'update_post_term_cache' => false,
|
41 |
+
'no_found_rows' => true
|
42 |
+
);
|
43 |
+
$query = new WP_Query( $args );
|
44 |
+
$unsmushed_posts = $query->posts;
|
45 |
+
} else {
|
46 |
+
return explode( ',', $_REQUEST['ids'] );
|
47 |
+
}
|
48 |
+
|
49 |
+
return $unsmushed_posts;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Fetches the ids of unsmushed images for NextGen Gallery
|
54 |
+
* @return array
|
55 |
+
*/
|
56 |
+
function get_nextgen_attachments() {
|
57 |
+
if ( ! isset( $_REQUEST['ids'] ) ) {
|
58 |
+
$args = array(
|
59 |
+
'fields' => 'ids',
|
60 |
+
'post_type' => 'attachment',
|
61 |
+
'post_status' => 'any',
|
62 |
+
'post_mime_type' => array( 'image/jpeg', 'image/gif', 'image/png' ),
|
63 |
+
'orderby' => 'ID',
|
64 |
+
'order' => 'DESC',
|
65 |
+
'posts_per_page' => - 1,
|
66 |
+
'meta_query' => array(
|
67 |
+
array(
|
68 |
+
'key' => 'wp-smpro-smush-data',
|
69 |
+
'compare' => 'NOT EXISTS'
|
70 |
+
)
|
71 |
+
),
|
72 |
+
'no_found_rows' => true
|
73 |
);
|
74 |
$query = new WP_Query( $args );
|
75 |
$unsmushed_posts = $query->posts;
|
lib/class-wp-smush-nextgen.php
ADDED
@@ -0,0 +1,435 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @package WP Smush
|
5 |
+
* @subpackage NextGen Gallery
|
6 |
+
* @version 1.0
|
7 |
+
*
|
8 |
+
* @author Umesh Kumar <umesh@incsub.com>
|
9 |
+
*
|
10 |
+
* @copyright (c) 2015, Incsub (http://incsub.com)
|
11 |
+
*/
|
12 |
+
if ( ! class_exists( 'WpSmushNextGen' ) ) {
|
13 |
+
|
14 |
+
|
15 |
+
class WpSmushNextGen {
|
16 |
+
|
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 |
+
|
24 |
+
function __construct() {
|
25 |
+
|
26 |
+
//Auto Smush image, if enabled, runs after Nextgen is finished uploading the image
|
27 |
+
//Check if auto is enabled
|
28 |
+
if ( $this->is_auto_smush_enabled() ) {
|
29 |
+
add_action( 'ngg_added_new_image', array( &$this, 'auto_smush' ) );
|
30 |
+
}
|
31 |
+
|
32 |
+
//Handle Manual Smush request for Nextgen gallery images
|
33 |
+
add_action( 'wp_ajax_smush_manual_nextgen', array( $this, 'manual_nextgen' ) );
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* If auto smush is set to true or not, default is true
|
39 |
+
*
|
40 |
+
* @return int|mixed|void
|
41 |
+
*/
|
42 |
+
function is_auto_smush_enabled() {
|
43 |
+
$auto_smush = get_option( WP_SMUSH_PREFIX . 'auto' );
|
44 |
+
|
45 |
+
//Keep the auto smush on by default
|
46 |
+
if ( $auto_smush === false ) {
|
47 |
+
$auto_smush = 1;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Allows to filter the Auto Smush status for NextGen galery
|
52 |
+
*/
|
53 |
+
$auto_smush = apply_filters('smush_nextgen_auto', $auto_smush );
|
54 |
+
|
55 |
+
return $auto_smush;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Queries Nextgen table for a list of image ids
|
60 |
+
* @return mixed Array of ids
|
61 |
+
*/
|
62 |
+
function get_nextgen_attachments() {
|
63 |
+
global $wpdb;
|
64 |
+
|
65 |
+
//Query images from the nextgen table
|
66 |
+
$images = $wpdb->get_col( "SELECT pid FROM $wpdb->nggpictures ORDER BY pid ASC" );
|
67 |
+
|
68 |
+
//Return empty array, if there was error querying the images
|
69 |
+
if ( empty( $images ) || is_wp_error( $images ) ) {
|
70 |
+
$images = array();
|
71 |
+
}
|
72 |
+
|
73 |
+
return $images;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Get image mime type
|
78 |
+
*
|
79 |
+
* @param $file_path
|
80 |
+
*
|
81 |
+
* @return bool|string
|
82 |
+
*/
|
83 |
+
function get_file_type( $file_path ) {
|
84 |
+
if ( empty( $file_path ) ) {
|
85 |
+
return false;
|
86 |
+
}
|
87 |
+
if ( function_exists( 'exif_imagetype' ) ) {
|
88 |
+
$image_type = exif_imagetype( $file_path );
|
89 |
+
if ( ! empty( $image_type ) ) {
|
90 |
+
$image_mime = image_type_to_mime_type( $image_type );
|
91 |
+
}
|
92 |
+
} else {
|
93 |
+
$image_details = getimagesize( $file_path );
|
94 |
+
$image_mime = ! empty( $image_details ) && is_array( $image_details ) ? $image_details['mime'] : '';
|
95 |
+
}
|
96 |
+
|
97 |
+
return $image_mime;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Read the image paths from an attachment's meta data and process each image
|
102 |
+
* with wp_smushit().
|
103 |
+
*
|
104 |
+
* This method also adds a `wp_smushit` meta key for use in the media library.
|
105 |
+
* Called after `wp_generate_attachment_metadata` is completed.
|
106 |
+
*
|
107 |
+
* @param $meta
|
108 |
+
* @param null $ID
|
109 |
+
*
|
110 |
+
* @return mixed
|
111 |
+
*/
|
112 |
+
function resize_from_meta_data( $storage, $image ) {
|
113 |
+
global $WpSmush;
|
114 |
+
|
115 |
+
$errors = new WP_Error();
|
116 |
+
$stats = array(
|
117 |
+
"stats" => array_merge( $WpSmush->_get_size_signature(), array(
|
118 |
+
'api_version' => - 1,
|
119 |
+
'lossy' => - 1
|
120 |
+
)
|
121 |
+
),
|
122 |
+
'sizes' => array()
|
123 |
+
);
|
124 |
+
|
125 |
+
$size_before = $size_after = $compression = $total_time = $bytes_saved = 0;
|
126 |
+
|
127 |
+
//File path and URL for original image
|
128 |
+
// get an array of sizes available for the $image
|
129 |
+
$sizes = $storage->get_image_sizes();
|
130 |
+
|
131 |
+
// If images has other registered size, smush them first
|
132 |
+
if ( ! empty( $sizes ) ) {
|
133 |
+
|
134 |
+
if( class_exists('finfo') ) {
|
135 |
+
$finfo = new finfo( FILEINFO_MIME_TYPE );
|
136 |
+
}else{
|
137 |
+
$finfo = false;
|
138 |
+
}
|
139 |
+
|
140 |
+
foreach ( $sizes as $size ) {
|
141 |
+
|
142 |
+
// We take the original image. Get the absolute path using the storage object
|
143 |
+
|
144 |
+
$attachment_file_path_size = $storage->get_image_abspath( $image, $size );
|
145 |
+
|
146 |
+
if ( $finfo ) {
|
147 |
+
$ext = file_exists( $attachment_file_path_size ) ? $finfo->file( $attachment_file_path_size ) : '';
|
148 |
+
} elseif ( function_exists( 'mime_content_type' ) ) {
|
149 |
+
$ext = mime_content_type( $attachment_file_path_size );
|
150 |
+
} else {
|
151 |
+
$ext = false;
|
152 |
+
}
|
153 |
+
if( $ext ) {
|
154 |
+
$valid_mime = array_search(
|
155 |
+
$ext,
|
156 |
+
array(
|
157 |
+
'jpg' => 'image/jpeg',
|
158 |
+
'png' => 'image/png',
|
159 |
+
'gif' => 'image/gif',
|
160 |
+
),
|
161 |
+
true
|
162 |
+
);
|
163 |
+
if ( false === $valid_mime ) {
|
164 |
+
continue;
|
165 |
+
}
|
166 |
+
}
|
167 |
+
/**
|
168 |
+
* Allows to skip a image from smushing
|
169 |
+
*
|
170 |
+
* @param bool , Smush image or not
|
171 |
+
* @$size string, Size of image being smushed
|
172 |
+
*/
|
173 |
+
$smush_image = apply_filters( 'wp_smush_nextgen_image', true, $size );
|
174 |
+
if ( ! $smush_image ) {
|
175 |
+
continue;
|
176 |
+
}
|
177 |
+
//Store details for each size key
|
178 |
+
$response = $WpSmush->do_smushit( $attachment_file_path_size, $image->pid, 'nextgen' );
|
179 |
+
|
180 |
+
if ( is_wp_error( $response ) ) {
|
181 |
+
return $response;
|
182 |
+
}
|
183 |
+
|
184 |
+
if ( ! empty( $response['data'] ) ) {
|
185 |
+
$stats['sizes'][ $size ] = (object) $WpSmush->_array_fill_placeholders( $WpSmush->_get_size_signature(), (array) $response['data'] );
|
186 |
+
}
|
187 |
+
|
188 |
+
//Total Stats, store all data in bytes
|
189 |
+
if ( isset( $response['data'] ) ) {
|
190 |
+
list( $size_before, $size_after, $total_time, $compression, $bytes_saved )
|
191 |
+
= $WpSmush->_update_stats_data( $response['data'], $size_before, $size_after, $total_time, $bytes_saved );
|
192 |
+
} else {
|
193 |
+
$errors->add( "image_size_error" . $size, sprintf( __( "Size '%s' not processed correctly", 'wp-smushit' ), $size ) );
|
194 |
+
}
|
195 |
+
|
196 |
+
if ( empty( $stats['stats']['api_version'] ) || $stats['stats']['api_version'] == - 1 ) {
|
197 |
+
$stats['stats']['api_version'] = $response['data']->api_version;
|
198 |
+
$stats['stats']['lossy'] = $response['data']->lossy;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
$has_errors = (bool) count( $errors->get_error_messages() );
|
204 |
+
|
205 |
+
list( $stats['stats']['size_before'], $stats['stats']['size_after'], $stats['stats']['time'], $stats['stats']['percent'], $stats['stats']['bytes'] ) =
|
206 |
+
array( $size_before, $size_after, $total_time, $compression, $bytes_saved );
|
207 |
+
|
208 |
+
//Set smush status for all the images, store it in wp-smpro-smush-data
|
209 |
+
if ( ! $has_errors ) {
|
210 |
+
|
211 |
+
$existing_stats = ( ! empty( $image->meta_data ) && ! empty( $image->meta_data['wp_smush'] ) ) ? $image->meta_data['wp_smush'] : '';
|
212 |
+
|
213 |
+
if ( ! empty( $existing_stats ) ) {
|
214 |
+
//Update total bytes saved, and compression percent
|
215 |
+
$stats['stats']['bytes'] = isset( $existing_stats['stats']['bytes'] ) ? $existing_stats['stats']['bytes'] + $stats['stats']['bytes'] : $stats['stats']['bytes'];
|
216 |
+
$stats['stats']['percent'] = isset( $existing_stats['stats']['percent'] ) ? $existing_stats['stats']['percent'] + $stats['stats']['percent'] : $stats['stats']['percent'];
|
217 |
+
|
218 |
+
//Update stats for each size
|
219 |
+
if ( ! empty( $existing_stats['sizes'] ) && ! empty( $stats['sizes'] ) ) {
|
220 |
+
|
221 |
+
foreach ( $existing_stats['sizes'] as $size_name => $size_stats ) {
|
222 |
+
//if stats for a particular size doesn't exists
|
223 |
+
if ( empty( $stats['sizes'] ) || empty( $stats['sizes'][$size_name] ) ) {
|
224 |
+
$stats = empty( $stats ) ? array() : $stats;
|
225 |
+
if ( empty( $stats['sizes'] ) ) {
|
226 |
+
$stats['sizes'] = array();
|
227 |
+
}
|
228 |
+
$stats['sizes'][$size_name] = $existing_stats['sizes'][ $size_name ];
|
229 |
+
} else {
|
230 |
+
//Update compression percent and bytes saved for each size
|
231 |
+
$stats['sizes'][$size_name]->bytes = $stats['sizes'][$size_name]->bytes + $existing_stats['sizes'][ $size_name ]->bytes;
|
232 |
+
$stats['sizes'][$size_name]->percent = $stats['sizes'][$size_name]->bytes + $existing_stats['sizes'][ $size_name ]->percent;
|
233 |
+
}
|
234 |
+
}
|
235 |
+
}
|
236 |
+
}
|
237 |
+
$image->meta_data['wp_smush'] = $stats;
|
238 |
+
nggdb::update_image_meta( $image->pid, $image->meta_data );
|
239 |
+
|
240 |
+
//Allows To get the stats for each image, after the image is smushed
|
241 |
+
do_action( 'wp_smush_nextgen_image_stats', $image->pid, $stats );
|
242 |
+
}
|
243 |
+
|
244 |
+
return $image->meta_data['wp_smush'];
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Performs the actual smush process
|
249 |
+
*
|
250 |
+
* @usedby: `manual_nextgen`, `auto_smush`, `smush_bulk`
|
251 |
+
*
|
252 |
+
* @param string $pid , NextGen Gallery Image id
|
253 |
+
* @param string $image , Nextgen gallery image object
|
254 |
+
* @param bool|true $echo, Whether to echo the stats or not, false for auto smush
|
255 |
+
*/
|
256 |
+
function smush_image( $pid = '', $image = '', $echo = true ) {
|
257 |
+
global $wpsmushnextgenstats;
|
258 |
+
|
259 |
+
//Get metadata For the image
|
260 |
+
// Registry Object for NextGen Gallery
|
261 |
+
$registry = C_Component_Registry::get_instance();
|
262 |
+
|
263 |
+
//Gallery Storage Object
|
264 |
+
$storage = $registry->get_utility( 'I_Gallery_Storage' );
|
265 |
+
|
266 |
+
//Get image, if we have image id
|
267 |
+
if ( ! empty( $pid ) ) {
|
268 |
+
$image = $storage->object->_image_mapper->find( $pid );
|
269 |
+
} elseif ( ! empty( $image ) ) {
|
270 |
+
$pid = $storage->object->_get_image_id( $image );
|
271 |
+
}
|
272 |
+
|
273 |
+
$metadata = ! empty( $image ) ? $image->meta_data : '';
|
274 |
+
|
275 |
+
if ( empty( $metadata ) ) {
|
276 |
+
wp_send_json_error( array( 'error' => "missing_metadata" ) );
|
277 |
+
}
|
278 |
+
|
279 |
+
//smush the main image and its sizes
|
280 |
+
$smush = $this->resize_from_meta_data( $storage, $image, $pid );
|
281 |
+
|
282 |
+
if( !is_wp_error( $smush ) ) {
|
283 |
+
$status = $wpsmushnextgenstats->show_stats( $pid, $smush, false, true );
|
284 |
+
}
|
285 |
+
|
286 |
+
//If we are suppose to send the stats, not required for auto smush
|
287 |
+
if ( $echo ) {
|
288 |
+
/** Send stats **/
|
289 |
+
if ( is_wp_error( $smush ) ) {
|
290 |
+
/**
|
291 |
+
* @param WP_Error $smush
|
292 |
+
*/
|
293 |
+
wp_send_json_error( $smush->get_error_message() );
|
294 |
+
} else {
|
295 |
+
wp_send_json_success( $status );
|
296 |
+
}
|
297 |
+
}else{
|
298 |
+
if ( is_wp_error( $smush ) ) {
|
299 |
+
return $smush;
|
300 |
+
}else{
|
301 |
+
return true;
|
302 |
+
}
|
303 |
+
}
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Handles the smushing of each image and its registered sizes
|
308 |
+
* Calls the function to update the compression stats
|
309 |
+
*/
|
310 |
+
function manual_nextgen() {
|
311 |
+
$pid = ! empty( $_GET['attachment_id'] ) ? $_GET['attachment_id'] : '';
|
312 |
+
$nonce = ! empty( $_GET['_nonce'] ) ? $_GET['_nonce'] : '';
|
313 |
+
|
314 |
+
//Verify Nonce
|
315 |
+
if ( ! wp_verify_nonce( $nonce, 'wp_smush_nextgen' ) ) {
|
316 |
+
wp_send_json_error( array( 'error' => 'nonce_verification_failed' ) );
|
317 |
+
}
|
318 |
+
|
319 |
+
//Check for media upload permission
|
320 |
+
if ( ! current_user_can( 'upload_files' ) ) {
|
321 |
+
wp_die( __( "You don't have permission to work with uploaded files.", 'wp-smushit' ) );
|
322 |
+
}
|
323 |
+
|
324 |
+
if ( empty( $pid ) ) {
|
325 |
+
wp_die( __( 'No attachment ID was provided.', 'wp-smushit' ) );
|
326 |
+
}
|
327 |
+
|
328 |
+
$this->smush_image( $pid, '' );
|
329 |
+
|
330 |
+
}
|
331 |
+
|
332 |
+
/**
|
333 |
+
* Process auto smush request for nextgen gallery images
|
334 |
+
*
|
335 |
+
* @param $image
|
336 |
+
*/
|
337 |
+
function auto_smush( $image ) {
|
338 |
+
|
339 |
+
$this->smush_image( '', $image, false );
|
340 |
+
|
341 |
+
}
|
342 |
+
|
343 |
+
}//End of Class
|
344 |
+
}//End Of if class not exists
|
345 |
+
|
346 |
+
//Extend NextGen Mixin class to smush dynamic images
|
347 |
+
if( class_exists('WpSmushNextGen') ) {
|
348 |
+
$wpsmushnextgen = new WpSmushNextGen();
|
349 |
+
|
350 |
+
//Extend Nextgen Mixin class and override the generate_image_size, to optimize dynamic thumbnails, generated by nextgen, check for auto smush
|
351 |
+
if ( ! class_exists( 'WpSmushNextGenDynamicThumbs' ) && class_exists( 'Mixin' ) && $wpsmushnextgen->is_auto_smush_enabled() ) {
|
352 |
+
|
353 |
+
class WpSmushNextGenDynamicThumbs extends Mixin {
|
354 |
+
|
355 |
+
/**
|
356 |
+
* Overrides the NextGen Gallery function, to smush the dynamic images and thumbnails created by gallery
|
357 |
+
* @param C_Image|int|stdClass $image
|
358 |
+
* @param $size
|
359 |
+
* @param null $params
|
360 |
+
* @param bool|false $skip_defaults
|
361 |
+
*
|
362 |
+
* @return bool|object
|
363 |
+
*/
|
364 |
+
function generate_image_size( $image, $size, $params = null, $skip_defaults = false ) {
|
365 |
+
global $WpSmush;
|
366 |
+
$image_id = !empty( $image->pid ) ? $image->pid : '';
|
367 |
+
//Get image from storage object if we don't have it already
|
368 |
+
if( empty( $image_id ) ) {
|
369 |
+
//Get metadata For the image
|
370 |
+
// Registry Object for NextGen Gallery
|
371 |
+
$registry = C_Component_Registry::get_instance();
|
372 |
+
|
373 |
+
//Gallery Storage Object
|
374 |
+
$storage = $registry->get_utility( 'I_Gallery_Storage' );
|
375 |
+
|
376 |
+
$image_id = $storage->object->_get_image_id( $image );
|
377 |
+
}
|
378 |
+
//Call the actual function to generate the image, and pass the image to smush
|
379 |
+
$success = $this->call_parent( 'generate_image_size', $image, $size, $params, $skip_defaults );
|
380 |
+
if ( $success ) {
|
381 |
+
$filename = $success->fileName;
|
382 |
+
//Smush it, if it exists
|
383 |
+
if ( file_exists( $filename ) ) {
|
384 |
+
$response = $WpSmush->do_smushit( $filename, $image->pid, 'nextgen' );
|
385 |
+
|
386 |
+
//If the image was smushed
|
387 |
+
if ( ! is_wp_error( $response ) && ! empty( $response['data'] ) ) {
|
388 |
+
//Check for existing stats
|
389 |
+
if ( ! empty( $image->meta_data ) && ! empty( $image->meta_data['wp_smush'] ) ) {
|
390 |
+
$stats = $image->meta_data['wp_smush'];
|
391 |
+
} else {
|
392 |
+
//Initialize stats array
|
393 |
+
$stats = array(
|
394 |
+
"stats" => array_merge( $WpSmush->_get_size_signature(), array(
|
395 |
+
'api_version' => - 1,
|
396 |
+
'lossy' => - 1
|
397 |
+
)
|
398 |
+
),
|
399 |
+
'sizes' => array()
|
400 |
+
);
|
401 |
+
$stats['bytes'] = $response['data']->bytes_saved;
|
402 |
+
$stats['percent'] = $response['data']->compression;
|
403 |
+
$stats['size_after'] = $response['data']->after_size;
|
404 |
+
$stats['size_before'] = $response['data']->before_size;
|
405 |
+
$stats['time'] = $response['data']->time;
|
406 |
+
}
|
407 |
+
$stats['sizes'][ $size ] = (object) $WpSmush->_array_fill_placeholders( $WpSmush->_get_size_signature(), (array) $response['data'] );
|
408 |
+
$image->meta_data['wp_smush'] = $stats;
|
409 |
+
nggdb::update_image_meta( $image->pid, $image->meta_data );
|
410 |
+
|
411 |
+
//Allows To get the stats for each image, after the image is smushed
|
412 |
+
do_action( 'wp_smush_nextgen_image_stats', $image->pid, $stats );
|
413 |
+
}
|
414 |
+
}
|
415 |
+
}
|
416 |
+
|
417 |
+
return $success;
|
418 |
+
}
|
419 |
+
function update_stats( $smush_stats, $image ) {
|
420 |
+
global $WpSmush;
|
421 |
+
if ( is_wp_error( $smush_stats ) ) {
|
422 |
+
return $smush_stats;
|
423 |
+
}
|
424 |
+
|
425 |
+
if ( ! empty( $smush_stats['data'] ) ) {
|
426 |
+
$image['sizes'][ $size ] = (object) $WpSmush->_array_fill_placeholders( $WpSmush->_get_size_signature(), (array) $smush_stats['data'] );
|
427 |
+
}
|
428 |
+
}
|
429 |
+
}
|
430 |
+
|
431 |
+
//Add
|
432 |
+
$storage = C_Gallery_Storage::get_instance();
|
433 |
+
$storage->get_wrapped_instance()->add_mixin( 'WpSmushNextGenDynamicThumbs' );
|
434 |
+
}
|
435 |
+
}
|
lib/class-wp-smush.php
CHANGED
@@ -62,6 +62,9 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
62 |
//Add Smush Columns
|
63 |
add_filter( 'manage_media_columns', array( $this, 'columns' ) );
|
64 |
add_action( 'manage_media_custom_column', array( $this, 'custom_column' ), 10, 2 );
|
|
|
|
|
|
|
65 |
|
66 |
//Enqueue Scripts
|
67 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
@@ -69,10 +72,13 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
69 |
//Old Smush stats migration
|
70 |
add_action( "admin_init", array( $this, "migrate" ) );
|
71 |
|
|
|
|
|
|
|
72 |
}
|
73 |
|
74 |
function admin_init() {
|
75 |
-
load_plugin_textdomain( 'wp-smushit', false,
|
76 |
wp_enqueue_script( 'common' );
|
77 |
}
|
78 |
|
@@ -88,6 +94,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
88 |
*/
|
89 |
function do_smushit( $file_path = '' ) {
|
90 |
$errors = new WP_Error();
|
|
|
91 |
if ( empty( $file_path ) ) {
|
92 |
$errors->add( "empty_path", __( "File path is empty", 'wp-smushit' ) );
|
93 |
}
|
@@ -98,11 +105,11 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
98 |
}
|
99 |
|
100 |
// check that the file is writable
|
101 |
-
if ( ! is_writable(
|
102 |
-
$errors->add( "not_writable", sprintf( __( "%s is not writable", 'wp-smushit' ),
|
103 |
}
|
104 |
|
105 |
-
$file_size = filesize( $file_path );
|
106 |
|
107 |
//Check if premium user
|
108 |
$max_size = $this->is_pro() ? WP_SMUSH_PREMIUM_MAX_BYTES : WP_SMUSH_MAX_BYTES;
|
@@ -183,7 +190,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
183 |
*
|
184 |
* @return array
|
185 |
*/
|
186 |
-
|
187 |
$placeholders['percent'] = $data['compression'];
|
188 |
$placeholders['bytes'] = $data['bytes_saved'];
|
189 |
$placeholders['size_before'] = $data['before_size'];
|
@@ -198,7 +205,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
198 |
*
|
199 |
* @return array
|
200 |
*/
|
201 |
-
|
202 |
return array(
|
203 |
'percent' => - 1,
|
204 |
'bytes' => - 1,
|
@@ -263,14 +270,15 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
263 |
}else{
|
264 |
$finfo = false;
|
265 |
}
|
|
|
266 |
foreach ( $meta['sizes'] as $size_key => $size_data ) {
|
267 |
|
268 |
// We take the original image. The 'sizes' will all match the same URL and
|
269 |
// path. So just get the dirname and replace the filename.
|
270 |
-
$attachment_file_path_size =
|
271 |
|
272 |
if ( $finfo ) {
|
273 |
-
$ext = $finfo->file( $attachment_file_path_size );
|
274 |
} elseif ( function_exists( 'mime_content_type' ) ) {
|
275 |
$ext = mime_content_type( $attachment_file_path_size );
|
276 |
} else {
|
@@ -290,6 +298,16 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
290 |
continue;
|
291 |
}
|
292 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
|
294 |
//Store details for each size key
|
295 |
$response = $this->do_smushit( $attachment_file_path_size );
|
@@ -319,8 +337,16 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
319 |
$smush_full = true;
|
320 |
}
|
321 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
//If original size is supposed to be smushed
|
323 |
-
if ( $smush_full ) {
|
324 |
|
325 |
$full_image_response = $this->do_smushit( $attachment_file_path );
|
326 |
|
@@ -683,9 +709,6 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
683 |
$status_txt = $button_txt = '';
|
684 |
$show_button = false;
|
685 |
|
686 |
-
//Stats are not received properly, otherwise
|
687 |
-
// wp_cache_delete( $id, 'post_meta' );
|
688 |
-
|
689 |
$wp_smush_data = get_post_meta( $id, self::SMUSHED_META_KEY, true );
|
690 |
$attachment_data = wp_get_attachment_metadata( $id );
|
691 |
//
|
@@ -864,7 +887,7 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
864 |
*
|
865 |
* @return array
|
866 |
*/
|
867 |
-
|
868 |
$size_before += ! empty( $response_data->before_size ) ? (int) $response_data->before_size : 0;
|
869 |
$size_after += ( ! empty( $response_data->after_size ) && $response_data->after_size > 0 ) ? (int) $response_data->after_size : (int) $response_data->before_size;
|
870 |
$total_time += ! empty( $response_data->time ) ? (float) $response_data->time : 0;
|
@@ -933,11 +956,43 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
933 |
|
934 |
}
|
935 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
936 |
function smush_retina_image( $id, $retina_file, $image_size ) {
|
937 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
938 |
$stats = $this->do_smushit( $retina_file );
|
939 |
//If we squeezed out something, Update stats
|
940 |
-
if ( ! empty( $stats['data'] ) && isset( $stats['data'] ) && $stats['data']->bytes_saved > 0 ) {
|
941 |
$this->update_smush_stats_single( $id, $stats, $image_size );
|
942 |
}
|
943 |
}
|
@@ -964,8 +1019,8 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
964 |
//For free version, Check the image size
|
965 |
if ( ! $this->is_pro() ) {
|
966 |
//For free version, check if full size is greater than 1 Mb, show the skipped status
|
967 |
-
$file_size = filesize( $full_image );
|
968 |
-
if ( ( $file_size / WP_SMUSH_MAX_BYTES ) > 1 ) {
|
969 |
$skipped[] = array(
|
970 |
'size' => 'full',
|
971 |
'reason' => 'size_limit'
|
@@ -989,12 +1044,13 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
989 |
}
|
990 |
//For other sizes, check if the image was generated and not available in stats
|
991 |
if ( is_array( $media_size ) ) {
|
|
|
992 |
foreach ( $media_size as $size ) {
|
993 |
-
if ( array_key_exists( $size, $attachment_metadata['sizes'] ) && ! array_key_exists( $size, $size_stats ) ) {
|
994 |
//Image Path
|
995 |
-
$img_path =
|
996 |
-
$image_size = filesize( $img_path );
|
997 |
-
if ( ( $image_size / WP_SMUSH_MAX_BYTES ) > 1 ) {
|
998 |
$skipped[] = array(
|
999 |
'size' => 'full',
|
1000 |
'reason' => 'size_limit'
|
@@ -1013,8 +1069,10 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
1013 |
* @return bool
|
1014 |
*/
|
1015 |
function skip_reason( $msg_id ) {
|
|
|
|
|
1016 |
$skip_msg = array(
|
1017 |
-
'large_size' =>
|
1018 |
'size_limit' => esc_html__( "Image couldn't be smushed as it exceeded the 1Mb size limit, Pro users can smush images with size upto 32Mb.", "wp-smushit" )
|
1019 |
);
|
1020 |
$skip_rsn = !empty( $skip_msg[$msg_id ] ) ? esc_html__(" Skipped", 'wp-smushit', 'wp-smushit'): '';
|
@@ -1061,11 +1119,11 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
1061 |
}
|
1062 |
}
|
1063 |
//Show Sizes and their compression
|
1064 |
-
foreach ( $size_stats as $size_key => $
|
1065 |
-
if ( $
|
1066 |
$stats .= '<tr>
|
1067 |
<td>' . strtoupper( $size_key ) . '</td>
|
1068 |
-
<td>' . $this->format_bytes( $
|
1069 |
</tr>';
|
1070 |
}
|
1071 |
}
|
@@ -1078,14 +1136,86 @@ if ( ! class_exists( 'WpSmush' ) ) {
|
|
1078 |
|
1079 |
/**
|
1080 |
* Compare Values
|
|
|
1081 |
* @param $a
|
1082 |
* @param $b
|
1083 |
*
|
1084 |
* @return int
|
1085 |
*/
|
1086 |
-
function cmp($a, $b) {
|
1087 |
return $a->bytes < $b->bytes;
|
1088 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1089 |
}
|
1090 |
|
1091 |
global $WpSmush;
|
62 |
//Add Smush Columns
|
63 |
add_filter( 'manage_media_columns', array( $this, 'columns' ) );
|
64 |
add_action( 'manage_media_custom_column', array( $this, 'custom_column' ), 10, 2 );
|
65 |
+
add_filter( 'manage_upload_sortable_columns', array( $this, 'sortable_column' ) );
|
66 |
+
//Manage column sorting
|
67 |
+
add_action( 'pre_get_posts', array( $this, 'smushit_orderby' ) );
|
68 |
|
69 |
//Enqueue Scripts
|
70 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
72 |
//Old Smush stats migration
|
73 |
add_action( "admin_init", array( $this, "migrate" ) );
|
74 |
|
75 |
+
//Load NextGen Gallery, if hooked too late or early, auto smush doesn't works, also Load after settings have been saved on init action
|
76 |
+
add_action( 'plugins_loaded', array( $this, 'load_nextgen' ), 90 );
|
77 |
+
|
78 |
}
|
79 |
|
80 |
function admin_init() {
|
81 |
+
load_plugin_textdomain( 'wp-smushit', false, WP_SMUSH_DIR . '/languages/' );
|
82 |
wp_enqueue_script( 'common' );
|
83 |
}
|
84 |
|
94 |
*/
|
95 |
function do_smushit( $file_path = '' ) {
|
96 |
$errors = new WP_Error();
|
97 |
+
$dir_name = dirname( $file_path );
|
98 |
if ( empty( $file_path ) ) {
|
99 |
$errors->add( "empty_path", __( "File path is empty", 'wp-smushit' ) );
|
100 |
}
|
105 |
}
|
106 |
|
107 |
// check that the file is writable
|
108 |
+
if ( ! is_writable( $dir_name ) ) {
|
109 |
+
$errors->add( "not_writable", sprintf( __( "%s is not writable", 'wp-smushit' ), $dir_name ) );
|
110 |
}
|
111 |
|
112 |
+
$file_size = file_exists( $file_path ) ? filesize( $file_path ) : '';
|
113 |
|
114 |
//Check if premium user
|
115 |
$max_size = $this->is_pro() ? WP_SMUSH_PREMIUM_MAX_BYTES : WP_SMUSH_MAX_BYTES;
|
190 |
*
|
191 |
* @return array
|
192 |
*/
|
193 |
+
function _array_fill_placeholders( array $placeholders, array $data ) {
|
194 |
$placeholders['percent'] = $data['compression'];
|
195 |
$placeholders['bytes'] = $data['bytes_saved'];
|
196 |
$placeholders['size_before'] = $data['before_size'];
|
205 |
*
|
206 |
* @return array
|
207 |
*/
|
208 |
+
function _get_size_signature() {
|
209 |
return array(
|
210 |
'percent' => - 1,
|
211 |
'bytes' => - 1,
|
270 |
}else{
|
271 |
$finfo = false;
|
272 |
}
|
273 |
+
$image_path = trailingslashit( dirname( $attachment_file_path ) );
|
274 |
foreach ( $meta['sizes'] as $size_key => $size_data ) {
|
275 |
|
276 |
// We take the original image. The 'sizes' will all match the same URL and
|
277 |
// path. So just get the dirname and replace the filename.
|
278 |
+
$attachment_file_path_size = $image_path . $size_data['file'];
|
279 |
|
280 |
if ( $finfo ) {
|
281 |
+
$ext = file_exists( $attachment_file_path_size ) ? $finfo->file( $attachment_file_path_size ) : '';
|
282 |
} elseif ( function_exists( 'mime_content_type' ) ) {
|
283 |
$ext = mime_content_type( $attachment_file_path_size );
|
284 |
} else {
|
298 |
continue;
|
299 |
}
|
300 |
}
|
301 |
+
/**
|
302 |
+
* Allows to skip a image from smushing
|
303 |
+
*
|
304 |
+
* @param bool , Smush image or not
|
305 |
+
* @$size string, Size of image being smushed
|
306 |
+
*/
|
307 |
+
$smush_image = apply_filters( 'wp_smush_media_image', true, $size_key );
|
308 |
+
if ( ! $smush_image ) {
|
309 |
+
continue;
|
310 |
+
}
|
311 |
|
312 |
//Store details for each size key
|
313 |
$response = $this->do_smushit( $attachment_file_path_size );
|
337 |
$smush_full = true;
|
338 |
}
|
339 |
|
340 |
+
/**
|
341 |
+
* Allows to skip a image from smushing
|
342 |
+
*
|
343 |
+
* @param bool , Smush image or not
|
344 |
+
* @$size string, Size of image being smushed
|
345 |
+
*/
|
346 |
+
$smush_full_image = apply_filters( 'wp_smush_media_image', true, 'full' );
|
347 |
+
|
348 |
//If original size is supposed to be smushed
|
349 |
+
if ( $smush_full && $smush_full_image ) {
|
350 |
|
351 |
$full_image_response = $this->do_smushit( $attachment_file_path );
|
352 |
|
709 |
$status_txt = $button_txt = '';
|
710 |
$show_button = false;
|
711 |
|
|
|
|
|
|
|
712 |
$wp_smush_data = get_post_meta( $id, self::SMUSHED_META_KEY, true );
|
713 |
$attachment_data = wp_get_attachment_metadata( $id );
|
714 |
//
|
887 |
*
|
888 |
* @return array
|
889 |
*/
|
890 |
+
function _update_stats_data( $response_data, $size_before, $size_after, $total_time, $bytes_saved ) {
|
891 |
$size_before += ! empty( $response_data->before_size ) ? (int) $response_data->before_size : 0;
|
892 |
$size_after += ( ! empty( $response_data->after_size ) && $response_data->after_size > 0 ) ? (int) $response_data->after_size : (int) $response_data->before_size;
|
893 |
$total_time += ! empty( $response_data->time ) ? (float) $response_data->time : 0;
|
956 |
|
957 |
}
|
958 |
|
959 |
+
/**
|
960 |
+
* Smush Retina images for WP Retina 2x, Update Stats
|
961 |
+
*
|
962 |
+
* @param $id
|
963 |
+
* @param $retina_file
|
964 |
+
* @param $image_size
|
965 |
+
*/
|
966 |
function smush_retina_image( $id, $retina_file, $image_size ) {
|
967 |
|
968 |
+
/**
|
969 |
+
* Allows to Enable/Disable WP Retina 2x Integration
|
970 |
+
*/
|
971 |
+
$smush_retina_images = apply_filters( 'smush_retina_images', true );
|
972 |
+
|
973 |
+
//Check if Smush retina images is enbled
|
974 |
+
if ( ! $smush_retina_images ) {
|
975 |
+
return;
|
976 |
+
}
|
977 |
+
//Check for Empty fields
|
978 |
+
if ( empty( $id ) || empty( $retina_file ) || empty( $image_size ) ) {
|
979 |
+
return;
|
980 |
+
}
|
981 |
+
|
982 |
+
/**
|
983 |
+
* Allows to skip a image from smushing
|
984 |
+
*
|
985 |
+
* @param bool , Smush image or not
|
986 |
+
* @$size string, Size of image being smushed
|
987 |
+
*/
|
988 |
+
$smush_image = apply_filters( 'wp_smush_media_image', true, $image_size );
|
989 |
+
if ( ! $smush_image ) {
|
990 |
+
return;
|
991 |
+
}
|
992 |
+
|
993 |
$stats = $this->do_smushit( $retina_file );
|
994 |
//If we squeezed out something, Update stats
|
995 |
+
if ( !is_wp_error( $stats ) && ! empty( $stats['data'] ) && isset( $stats['data'] ) && $stats['data']->bytes_saved > 0 ) {
|
996 |
$this->update_smush_stats_single( $id, $stats, $image_size );
|
997 |
}
|
998 |
}
|
1019 |
//For free version, Check the image size
|
1020 |
if ( ! $this->is_pro() ) {
|
1021 |
//For free version, check if full size is greater than 1 Mb, show the skipped status
|
1022 |
+
$file_size = file_exists( $full_image ) ? filesize( $full_image ) : '';
|
1023 |
+
if ( !empty( $file_size ) && ( $file_size / WP_SMUSH_MAX_BYTES ) > 1 ) {
|
1024 |
$skipped[] = array(
|
1025 |
'size' => 'full',
|
1026 |
'reason' => 'size_limit'
|
1044 |
}
|
1045 |
//For other sizes, check if the image was generated and not available in stats
|
1046 |
if ( is_array( $media_size ) ) {
|
1047 |
+
$dir_path = trailingslashit( dirname( $full_image ) );
|
1048 |
foreach ( $media_size as $size ) {
|
1049 |
+
if ( array_key_exists( $size, $attachment_metadata['sizes'] ) && ! array_key_exists( $size, $size_stats ) && ! empty( $size['file'] ) ) {
|
1050 |
//Image Path
|
1051 |
+
$img_path = $dir_path . $size['file'];
|
1052 |
+
$image_size = file_exists( $img_path ) ? filesize( $img_path ) : '';
|
1053 |
+
if ( ! empty( $image_size ) && ( $image_size / WP_SMUSH_MAX_BYTES ) > 1 ) {
|
1054 |
$skipped[] = array(
|
1055 |
'size' => 'full',
|
1056 |
'reason' => 'size_limit'
|
1069 |
* @return bool
|
1070 |
*/
|
1071 |
function skip_reason( $msg_id ) {
|
1072 |
+
$count = count( get_intermediate_image_sizes() );
|
1073 |
+
$smush_orgnl_txt = sprintf( esc_html__("When you upload an image to WordPress it automatically creates %s thumbnail sizes that are commonly used in your pages. WordPress also stores the original full-size image, but because these are not usually embedded on your site we don’t Smush them. Pro users can override this.", 'wp_smushit'), $count );
|
1074 |
$skip_msg = array(
|
1075 |
+
'large_size' => $smush_orgnl_txt,
|
1076 |
'size_limit' => esc_html__( "Image couldn't be smushed as it exceeded the 1Mb size limit, Pro users can smush images with size upto 32Mb.", "wp-smushit" )
|
1077 |
);
|
1078 |
$skip_rsn = !empty( $skip_msg[$msg_id ] ) ? esc_html__(" Skipped", 'wp-smushit', 'wp-smushit'): '';
|
1119 |
}
|
1120 |
}
|
1121 |
//Show Sizes and their compression
|
1122 |
+
foreach ( $size_stats as $size_key => $size_value ) {
|
1123 |
+
if ( $size_value->bytes > 0 ) {
|
1124 |
$stats .= '<tr>
|
1125 |
<td>' . strtoupper( $size_key ) . '</td>
|
1126 |
+
<td>' . $this->format_bytes( $size_value->bytes ) . ' ( ' . $size_value->percent . '% )</td>
|
1127 |
</tr>';
|
1128 |
}
|
1129 |
}
|
1136 |
|
1137 |
/**
|
1138 |
* Compare Values
|
1139 |
+
*
|
1140 |
* @param $a
|
1141 |
* @param $b
|
1142 |
*
|
1143 |
* @return int
|
1144 |
*/
|
1145 |
+
function cmp( $a, $b ) {
|
1146 |
return $a->bytes < $b->bytes;
|
1147 |
}
|
1148 |
+
|
1149 |
+
/**
|
1150 |
+
* Check if NextGen is active or not
|
1151 |
+
* Include and instantiate classes
|
1152 |
+
*/
|
1153 |
+
function load_nextgen() {
|
1154 |
+
if ( ! class_exists( 'C_NextGEN_Bootstrap' ) || ! $this->is_pro() ) {
|
1155 |
+
return;
|
1156 |
+
}
|
1157 |
+
//Check if integration is Enabled or not
|
1158 |
+
//Smush NextGen key
|
1159 |
+
$opt_nextgen = WP_SMUSH_PREFIX . 'nextgen';
|
1160 |
+
$opt_nextgen_val = get_option( $opt_nextgen, 1 );
|
1161 |
+
if ( ! $opt_nextgen_val ) {
|
1162 |
+
return;
|
1163 |
+
}
|
1164 |
+
|
1165 |
+
require_once( WP_SMUSH_DIR . '/lib/class-wp-smush-nextgen.php' );
|
1166 |
+
require_once( WP_SMUSH_DIR . '/lib/nextgen-integration/class-wp-smush-nextgen-admin.php' );
|
1167 |
+
require_once( WP_SMUSH_DIR . '/lib/nextgen-integration/class-wp-smush-nextgen-stats.php' );
|
1168 |
+
require_once( WP_SMUSH_DIR . '/lib/nextgen-integration/class-wp-smush-nextgen-bulk.php' );
|
1169 |
+
|
1170 |
+
global $wpsmushnextgen, $wpsmushnextgenadmin, $wpsmushnextgenstats;
|
1171 |
+
//Initialize Nextgen support
|
1172 |
+
$wpsmushnextgen = new WpSmushNextGen();
|
1173 |
+
$wpsmushnextgenadmin = new WpSmushNextGenAdmin();
|
1174 |
+
$wpsmushnextgenstats = new WpSmushNextGenStats();
|
1175 |
+
new WPSmushNextGenBulk();
|
1176 |
+
}
|
1177 |
+
|
1178 |
+
/**
|
1179 |
+
* Add the Smushit Column to sortable list
|
1180 |
+
* @param $columns
|
1181 |
+
*
|
1182 |
+
* @return mixed
|
1183 |
+
*/
|
1184 |
+
function sortable_column( $columns ) {
|
1185 |
+
$columns['smushit'] = 'smushit';
|
1186 |
+
return $columns;
|
1187 |
+
}
|
1188 |
+
/**
|
1189 |
+
* Orderby query for smush columns
|
1190 |
+
*/
|
1191 |
+
function smushit_orderby( $query ) {
|
1192 |
+
|
1193 |
+
global $current_screen, $wpdb;
|
1194 |
+
|
1195 |
+
//Filter only media screen
|
1196 |
+
if ( ! is_admin() || ( !empty( $current_screen) && $current_screen->base != 'upload' ) ) {
|
1197 |
+
return;
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
$orderby = $query->get( 'orderby' );
|
1201 |
+
|
1202 |
+
if ( isset( $orderby ) && 'smushit' == $orderby ) {
|
1203 |
+
$query->set( 'meta_query', array(
|
1204 |
+
'relation' => 'OR',
|
1205 |
+
array(
|
1206 |
+
'key' => self::SMUSHED_META_KEY,
|
1207 |
+
'compare' => 'EXISTS'
|
1208 |
+
),
|
1209 |
+
array(
|
1210 |
+
'key' => self::SMUSHED_META_KEY,
|
1211 |
+
'compare' => 'NOT EXISTS'
|
1212 |
+
)
|
1213 |
+
) );
|
1214 |
+
$query->set( 'orderby', 'meta_value_num' );
|
1215 |
+
}
|
1216 |
+
return $query;
|
1217 |
+
|
1218 |
+
}
|
1219 |
}
|
1220 |
|
1221 |
global $WpSmush;
|
lib/nextgen-integration/class-wp-smush-nextgen-admin.php
ADDED
@@ -0,0 +1,474 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Adds the Bulk Page and Smush Column to NextGen Gallery
|
5 |
+
*
|
6 |
+
* @package WP Smush
|
7 |
+
* @subpackage NextGen Gallery
|
8 |
+
* @version 1.0
|
9 |
+
*
|
10 |
+
* @author Umesh Kumar <umesh@incsub.com>
|
11 |
+
*
|
12 |
+
* @copyright (c) 2015, Incsub (http://incsub.com)
|
13 |
+
*/
|
14 |
+
if ( ! class_exists( 'WpSmushNextGenAdmin' ) ) {
|
15 |
+
|
16 |
+
class WpSmushNextGenAdmin extends WpSmushNextGen {
|
17 |
+
|
18 |
+
var $total_count = 0;
|
19 |
+
var $smushed_count = 0;
|
20 |
+
var $remaining_count = 0;
|
21 |
+
var $bulk_page_handle;
|
22 |
+
|
23 |
+
function __construct() {
|
24 |
+
|
25 |
+
//Update the number of columns
|
26 |
+
add_filter( 'ngg_manage_images_number_of_columns', array(
|
27 |
+
&$this,
|
28 |
+
'wp_smush_manage_images_number_of_columns'
|
29 |
+
) );
|
30 |
+
|
31 |
+
//Add a bulk smush option for NextGen gallery
|
32 |
+
add_action( 'admin_menu', array( &$this, 'wp_smush_bulk_menu' ) );
|
33 |
+
|
34 |
+
//Localize variables for NextGen Mnaeg gallery page
|
35 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Enqueue Scripts on Manage Gallery page
|
41 |
+
*/
|
42 |
+
function enqueue() {
|
43 |
+
$current_screen = get_current_screen();
|
44 |
+
if ( ! empty( $current_screen ) && $current_screen->base == 'nggallery-manage-images' ) {
|
45 |
+
$this->localize();
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Add a WP Smush page for bulk smush and settings related to Nextgen gallery
|
51 |
+
*/
|
52 |
+
function wp_smush_bulk_menu() {
|
53 |
+
if ( defined( 'NGGFOLDER' ) ) {
|
54 |
+
$this->bulk_page_handle = add_submenu_page( NGGFOLDER, esc_html__( 'WP Bulk Smush', 'wp-smushit' ), esc_html__( 'WP Smush', 'wp-smushit' ), 'NextGEN Manage gallery', 'wp-smush-nextgen-bulk', array(
|
55 |
+
&$this,
|
56 |
+
'wp_smush_bulk'
|
57 |
+
) );
|
58 |
+
// Enqueue js on Post screen (Edit screen for media )
|
59 |
+
add_action( 'admin_print_scripts-' . $this->bulk_page_handle, array( $this, 'localize' ) );
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Returns a column name for WP Smush
|
65 |
+
*
|
66 |
+
* @param $columns
|
67 |
+
*
|
68 |
+
* @return mixed
|
69 |
+
*/
|
70 |
+
function wp_smush_image_column_name( $columns ) {
|
71 |
+
//Latest next gen takes string, while the earlier WP Smush plugin shows there use to be a array
|
72 |
+
if ( is_array( $columns ) ) {
|
73 |
+
$columns['wp_smush_image'] = esc_html__( 'WP Smush', 'wp-smushit' );
|
74 |
+
} else {
|
75 |
+
$columns = esc_html__( 'WP Smush', 'wp-smushit' );
|
76 |
+
}
|
77 |
+
|
78 |
+
return $columns;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Returns Smush option / Stats, depending if image is already smushed or not
|
83 |
+
*
|
84 |
+
* @param $column_name
|
85 |
+
* @param $id
|
86 |
+
*/
|
87 |
+
function wp_smush_column_options( $column_name, $id ) {
|
88 |
+
global $wpsmushnextgenstats;
|
89 |
+
|
90 |
+
//NExtGen Doesn't returns Column name, weird? yeah, right, it is proper because hook is called for the particular column
|
91 |
+
if ( $column_name == 'wp_smush_image' || $column_name == '' ) {
|
92 |
+
$supported_image = array( 'image/jpeg', 'image/gif', 'image/png', 'image/jpg' );
|
93 |
+
|
94 |
+
// Registry Object for NextGen Gallery
|
95 |
+
$registry = C_Component_Registry::get_instance();
|
96 |
+
|
97 |
+
//Gallery Storage Object
|
98 |
+
$storage = $registry->get_utility( 'I_Gallery_Storage' );
|
99 |
+
|
100 |
+
//We'll get the image object in $id itself, else fetch it using Gallery Storage
|
101 |
+
if ( is_object( $id ) ) {
|
102 |
+
$image = $id;
|
103 |
+
} else {
|
104 |
+
// get an image object
|
105 |
+
$image = $storage->object->_image_mapper->find( $id );
|
106 |
+
}
|
107 |
+
|
108 |
+
//Check if it is supported image format, get image type to do that
|
109 |
+
// get the absolute path
|
110 |
+
$file_path = $storage->get_image_abspath( $image, 'full' );
|
111 |
+
|
112 |
+
//Get image type from file path
|
113 |
+
$image_type = $this->get_file_type( $file_path );
|
114 |
+
|
115 |
+
//If image type not supported
|
116 |
+
if ( ! in_array( $image_type, $supported_image ) ) {
|
117 |
+
return;
|
118 |
+
}
|
119 |
+
|
120 |
+
//Check Image metadata, if smushed, print the stats or super smush button
|
121 |
+
if ( ! empty( $image->meta_data['wp_smush'] ) ) {
|
122 |
+
//Echo the smush stats
|
123 |
+
$wpsmushnextgenstats->show_stats( $image->pid, $image->meta_data['wp_smush'], $image_type, false, true );
|
124 |
+
|
125 |
+
return;
|
126 |
+
}
|
127 |
+
|
128 |
+
//Print the status of image, if Not smushed
|
129 |
+
$this->set_status( $image->pid, true, false );
|
130 |
+
|
131 |
+
}
|
132 |
+
}
|
133 |
+
/**
|
134 |
+
* Localize Translations And Stats
|
135 |
+
*/
|
136 |
+
function localize() {
|
137 |
+
global $wpsmushnextgenstats;
|
138 |
+
$handle = 'wp-smushit-admin-js';
|
139 |
+
|
140 |
+
$bulk_now = __( 'Bulk Smush Now', 'wp-smushit' );
|
141 |
+
|
142 |
+
$wp_smush_msgs = array(
|
143 |
+
'progress' => __( 'Smushing in Progress', 'wp-smushit' ),
|
144 |
+
'done' => __( 'All Done!', 'wp-smushit' ),
|
145 |
+
'bulk_now' => $bulk_now,
|
146 |
+
'something_went_wrong' => __( 'Ops!... something went wrong', 'wp-smushit' ),
|
147 |
+
'resmush' => __( 'Super-Smush', 'wp-smushit' ),
|
148 |
+
'smush_it' => __( 'Smush it', 'wp-smushit' ),
|
149 |
+
'smush_now' => __( 'Smush Now', 'wp-smushit' ),
|
150 |
+
'sending' => __( 'Sending ...', 'wp-smushit' ),
|
151 |
+
"error_in_bulk" => __( '{{errors}} image(s) were skipped due to an error.', 'wp-smushit' ),
|
152 |
+
"all_supersmushed" => __( 'All images are Super-Smushed.', 'wp-smushit' )
|
153 |
+
);
|
154 |
+
|
155 |
+
wp_localize_script( $handle, 'wp_smush_msgs', $wp_smush_msgs );
|
156 |
+
|
157 |
+
//Get the unsmushed ids, used for localized stats as well as normal localization
|
158 |
+
$unsmushed = $wpsmushnextgenstats->get_ngg_images( 'unsmushed' );
|
159 |
+
$unsmushed = ( ! empty( $unsmushed ) && is_array( $unsmushed ) ) ? array_keys( $unsmushed ) : '';
|
160 |
+
|
161 |
+
$smushed = $wpsmushnextgenstats->get_ngg_images();
|
162 |
+
$smushed = ( ! empty( $smushed ) && is_array( $smushed ) ) ? array_keys( $smushed ) : '';
|
163 |
+
|
164 |
+
if ( ! empty( $_REQUEST['ids'] ) ) {
|
165 |
+
$this->ids = explode( ',', $_REQUEST['ids'] );
|
166 |
+
} else {
|
167 |
+
$this->ids = $unsmushed;
|
168 |
+
}
|
169 |
+
//If premium, Super smush allowed, all images are smushed, localize lossless smushed ids for bulk compression
|
170 |
+
if ( ( $this->total_count == $this->smushed_count && empty( $this->ids ) ) ) {
|
171 |
+
|
172 |
+
//Check if Super smush enabled
|
173 |
+
$super_smush = get_option( WP_SMUSH_PREFIX . 'lossy', false );
|
174 |
+
|
175 |
+
if ( $super_smush ) {
|
176 |
+
//get the attachments, and get lossless count
|
177 |
+
echo "Supersmush pending";
|
178 |
+
// $this->lossless_ids = $this->get_lossless_attachments();
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
//Array of all smushed, unsmushed and lossless ids
|
183 |
+
$data = array(
|
184 |
+
'smushed' => $smushed,
|
185 |
+
'unsmushed' => $unsmushed,
|
186 |
+
'lossless' => 0
|
187 |
+
);
|
188 |
+
|
189 |
+
wp_localize_script( 'wp-smushit-admin-js', 'wp_smushit_data', $data );
|
190 |
+
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Bulk Smush Page
|
195 |
+
*/
|
196 |
+
function wp_smush_bulk() {
|
197 |
+
|
198 |
+
global $wpsmushit_admin;
|
199 |
+
?>
|
200 |
+
<div class="wrap"><?php
|
201 |
+
//Promotional Text
|
202 |
+
$wpsmushit_admin->smush_pro_features();
|
203 |
+
|
204 |
+
//Bulk Smush UI, calls progress UI, Super Smush UI
|
205 |
+
$this->bulk_smush_ui(); ?>
|
206 |
+
</div><?php
|
207 |
+
|
208 |
+
return;
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Increase the count of columns for Nextgen Gallery Manage page
|
213 |
+
*
|
214 |
+
* @param $count
|
215 |
+
*
|
216 |
+
* @return mixed
|
217 |
+
*/
|
218 |
+
function wp_smush_manage_images_number_of_columns( $count ) {
|
219 |
+
$count ++;
|
220 |
+
|
221 |
+
//Add column Heading
|
222 |
+
add_filter( "ngg_manage_images_column_{$count}_header", array( &$this, 'wp_smush_image_column_name' ) );
|
223 |
+
|
224 |
+
//Add Column data
|
225 |
+
add_filter( "ngg_manage_images_column_{$count}_content", array(
|
226 |
+
&$this,
|
227 |
+
'wp_smush_column_options'
|
228 |
+
), 10, 2 );
|
229 |
+
|
230 |
+
return $count;
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Set send button status
|
235 |
+
*
|
236 |
+
* @param $id
|
237 |
+
* @param bool $echo
|
238 |
+
* @param bool $text_only
|
239 |
+
*
|
240 |
+
* @return string|void
|
241 |
+
*/
|
242 |
+
function set_status( $pid, $echo = true, $text_only = false ) {
|
243 |
+
$button_txt = '';
|
244 |
+
|
245 |
+
// the status
|
246 |
+
$status_txt = __( 'Not processed', 'wp-smushit' );
|
247 |
+
|
248 |
+
// we need to show the smush button
|
249 |
+
$show_button = true;
|
250 |
+
|
251 |
+
// the button text
|
252 |
+
$button_txt = __( 'Smush Now!', 'wp-smushit' );
|
253 |
+
if ( $text_only ) {
|
254 |
+
return $status_txt;
|
255 |
+
}
|
256 |
+
|
257 |
+
$text = $this->column_html( $pid, $status_txt, $button_txt, $show_button, false, $echo );
|
258 |
+
if ( ! $echo ) {
|
259 |
+
return $text;
|
260 |
+
}
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Print the column html
|
265 |
+
*
|
266 |
+
* @param string $id Media id
|
267 |
+
* @param string $status_txt Status text
|
268 |
+
* @param string $button_txt Button label
|
269 |
+
* @param boolean $show_button Whether to shoe the button
|
270 |
+
*
|
271 |
+
* @return null
|
272 |
+
*/
|
273 |
+
function column_html( $pid, $status_txt = "", $button_txt = "", $show_button = true, $smushed = false, $echo = true ) {
|
274 |
+
|
275 |
+
$class = $smushed ? '' : ' hidden';
|
276 |
+
$html = '<p class="smush-status' . $class . '">' . $status_txt . '</p>';
|
277 |
+
$html .= wp_nonce_field( 'wp_smush_nextgen', '_wp_smush_nonce', '', false );
|
278 |
+
// if we aren't showing the button
|
279 |
+
if ( ! $show_button ) {
|
280 |
+
if ( $echo ) {
|
281 |
+
echo $html;
|
282 |
+
|
283 |
+
return;
|
284 |
+
} else {
|
285 |
+
if ( ! $smushed ) {
|
286 |
+
$class = ' currently-smushing';
|
287 |
+
} else {
|
288 |
+
$class = ' smushed';
|
289 |
+
}
|
290 |
+
|
291 |
+
return '<div class="smush-wrap' . $class . '">' . $html . '</div>';
|
292 |
+
}
|
293 |
+
}
|
294 |
+
if ( ! $echo ) {
|
295 |
+
$html .= '
|
296 |
+
<button class="button button-primary wp-smush-nextgen-send" data-id="' . $pid . '">
|
297 |
+
<span>' . $button_txt . '</span>
|
298 |
+
</button>';
|
299 |
+
if ( ! $smushed ) {
|
300 |
+
$class = ' unsmushed';
|
301 |
+
} else {
|
302 |
+
$class = ' smushed';
|
303 |
+
}
|
304 |
+
|
305 |
+
return '<div class="smush-wrap' . $class . '">' . $html . '</div>';
|
306 |
+
} else {
|
307 |
+
$html .= '<button class="button wp-smush-nextgen-send" data-id="' . $pid . '">
|
308 |
+
<span>' . $button_txt . '</span>
|
309 |
+
</button>';
|
310 |
+
echo $html;
|
311 |
+
}
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* Print out the progress bar
|
316 |
+
*/
|
317 |
+
function progress_ui() {
|
318 |
+
global $WpSmush, $wpsmushnextgenstats;
|
319 |
+
$this->stats = $wpsmushnextgenstats->get_smush_stats();
|
320 |
+
|
321 |
+
// calculate %ages, avoid divide by zero error with no attachments
|
322 |
+
if ( $this->total_count > 0 ) {
|
323 |
+
$smushed_pc = $this->smushed_count / $this->total_count * 100;
|
324 |
+
} else {
|
325 |
+
$smushed_pc = 0;
|
326 |
+
}
|
327 |
+
$bytes = ! empty( $this->stats['bytes'] ) ? $this->stats['bytes'] : 0;
|
328 |
+
$human = ! empty( $this->stats['human'] ) ? $this->stats['human'] : $WpSmush->format_bytes( $bytes );
|
329 |
+
$percent = ! empty( $this->stats['percent'] ) ? number_format_i18n( $this->stats['percent'], 2, '.', '' ) : '';
|
330 |
+
|
331 |
+
$progress_ui = '<div id="progress-ui">';
|
332 |
+
|
333 |
+
// display the progress bars
|
334 |
+
$progress_ui .= '<div id="wp-smush-progress-wrap">
|
335 |
+
<div id="wp-smush-fetched-progress" class="wp-smush-progressbar"><div style="width:' . $smushed_pc . '%"></div></div>
|
336 |
+
<p id="wp-smush-compression">'
|
337 |
+
. __( "Reduced by ", 'wp-smushit' )
|
338 |
+
. '<span id="human">' . $human . '</span> ( <span id="percent">' . $percent . '</span>% )
|
339 |
+
</p>
|
340 |
+
</div>';
|
341 |
+
|
342 |
+
// status divs to show completed count/ total count
|
343 |
+
$progress_ui .= '<div id="wp-smush-progress-status">
|
344 |
+
|
345 |
+
<p id="fetched-status">' .
|
346 |
+
sprintf(
|
347 |
+
__(
|
348 |
+
'<span class="done-count">%d</span> of <span class="total-count">%d</span> total attachments have been smushed', 'wp-smushit'
|
349 |
+
), $this->smushed_count, $this->total_count
|
350 |
+
) .
|
351 |
+
'</p>
|
352 |
+
</div>
|
353 |
+
</div>';
|
354 |
+
// print it out
|
355 |
+
echo $progress_ui;
|
356 |
+
wp_nonce_field( 'wp_smush_nextgen', '_wp_smush_nonce', '', true );
|
357 |
+
}
|
358 |
+
/**
|
359 |
+
* Returns Bulk smush button id and other details, as per if bulk request is already sent or not
|
360 |
+
*
|
361 |
+
* @return array
|
362 |
+
*/
|
363 |
+
|
364 |
+
private function button_state( $super_smush ) {
|
365 |
+
$button = array(
|
366 |
+
'cancel' => false,
|
367 |
+
);
|
368 |
+
if ( $super_smush ) {
|
369 |
+
$button['text'] = __( 'Bulk Smush Now', 'wp-smushit' );
|
370 |
+
$button['class'] = 'wp-smush-button wp-smush-nextgen-bulk';
|
371 |
+
} else {
|
372 |
+
|
373 |
+
// if we have nothing left to smush, disable the buttons
|
374 |
+
if ( $this->smushed_count === $this->total_count ) {
|
375 |
+
$button['text'] = __( 'All Done!', 'wp-smushit' );
|
376 |
+
$button['class'] = 'wp-smush-finished disabled wp-smush-finished';
|
377 |
+
$button['disabled'] = 'disabled';
|
378 |
+
|
379 |
+
} else {
|
380 |
+
|
381 |
+
$button['text'] = __( 'Bulk Smush Now', 'wp-smushit' );
|
382 |
+
$button['class'] = 'wp-smush-button wp-smush-nextgen-bulk';
|
383 |
+
}
|
384 |
+
}
|
385 |
+
|
386 |
+
return $button;
|
387 |
+
}
|
388 |
+
|
389 |
+
/**
|
390 |
+
* Display the bulk smushing button
|
391 |
+
*/
|
392 |
+
function setup_button( $super_smush = false ) {
|
393 |
+
$button = $this->button_state( $super_smush );
|
394 |
+
$disabled = ! empty( $button['disabled'] ) ? ' disabled="disabled"' : '';
|
395 |
+
?>
|
396 |
+
<button class="button button-primary<?php echo ' ' . $button['class']; ?>" name="smush-all-nextgen" <?php echo $disabled; ?>>
|
397 |
+
<span><?php echo $button['text'] ?></span>
|
398 |
+
</button>
|
399 |
+
<?php
|
400 |
+
}
|
401 |
+
|
402 |
+
/**
|
403 |
+
*
|
404 |
+
*/
|
405 |
+
function bulk_smush_ui() {
|
406 |
+
global $WpSmush, $wpsmushnextgenstats;
|
407 |
+
|
408 |
+
//Set the counts
|
409 |
+
$this->total_count = $wpsmushnextgenstats->total_count();
|
410 |
+
$this->smushed_count = $wpsmushnextgenstats->get_ngg_images( 'smushed', true );
|
411 |
+
$this->remaining_count = $wpsmushnextgenstats->get_ngg_images( 'unsmushed', true );
|
412 |
+
|
413 |
+
?>
|
414 |
+
<div class="bulk-smush">
|
415 |
+
<h3><?php _e( 'Smush in Bulk', 'wp-smushit' ) ?></h3>
|
416 |
+
<?php
|
417 |
+
$this->get_nextgen_attachments();
|
418 |
+
|
419 |
+
//Nothing to smush
|
420 |
+
if ( $this->total_count == 0 ) {
|
421 |
+
// if there are no images in the media library ?>
|
422 |
+
<p><?php _e( "We didn't find any images in NextGen gallery, please upload some images.", 'wp-smushit'); ?></p><?php
|
423 |
+
|
424 |
+
// no need to print out the rest of the UI
|
425 |
+
return;
|
426 |
+
}else if ( $this->remaining_count == 0 ) {
|
427 |
+
?>
|
428 |
+
<p><?php _e( "Congratulations, all your images are currently Smushed!", 'wp-smushit' ); ?></p><?php
|
429 |
+
$this->progress_ui();
|
430 |
+
} else {
|
431 |
+
?>
|
432 |
+
<div class="smush-instructions">
|
433 |
+
<h4 class="smush-remaining-images-notice"><?php printf( _n( "%d attachment in NextGen Gallery has not been smushed yet.", "%d image attachments in NextGen Gallery have not been smushed yet.", $this->remaining_count, 'wp-smushit' ), $this->remaining_count ); ?></h4>
|
434 |
+
<p><?php _e( "Please be aware, smushing a large number of images can take a while depending on your server and network speed.
|
435 |
+
<strong>You must keep this page open while the bulk smush is processing</strong>, but you can leave at any time and come back to continue where it left off.", 'wp-smushit' ); ?></p>
|
436 |
+
|
437 |
+
<?php if ( ! $WpSmush->is_pro() ) { ?>
|
438 |
+
<p class="error">
|
439 |
+
<?php printf( __( "Free accounts are limited to bulk smushing %d attachments per request. You will need to click to start a new bulk job after each %d attachments.", 'wp-smushit' ), $this->max_free_bulk, $this->max_free_bulk ); ?>
|
440 |
+
<a href="<?php echo $this->upgrade_url; ?>"><?php _e( 'Remove limits »', 'wp-smushit' ); ?></a>
|
441 |
+
</p>
|
442 |
+
<?php } ?>
|
443 |
+
|
444 |
+
</div>
|
445 |
+
|
446 |
+
<!-- Bulk Smushing -->
|
447 |
+
<?php wp_nonce_field( 'wp-smush-bulk', '_wpnonce' ); ?>
|
448 |
+
<br/><?php
|
449 |
+
$this->progress_ui();
|
450 |
+
?>
|
451 |
+
<p class="smush-final-log"></p>
|
452 |
+
<?php
|
453 |
+
$this->setup_button();
|
454 |
+
}
|
455 |
+
|
456 |
+
$auto_smush = get_site_option( WP_SMUSH_PREFIX . 'auto' );
|
457 |
+
if ( ! $auto_smush && $this->remaining_count == 0 ) {
|
458 |
+
?>
|
459 |
+
<p><?php printf( __( 'When you <a href="%s">upload some images</a> they will be available to smush here.', 'wp-smushit' ), admin_url( 'media-new.php' ) ); ?></p>
|
460 |
+
<?php
|
461 |
+
} else { ?>
|
462 |
+
<p>
|
463 |
+
<?php
|
464 |
+
// let the user know that there's an alternative
|
465 |
+
printf( __( 'You can also smush images individually from your <a href="%s">Media Library</a>.', 'wp-smushit' ), admin_url( 'upload.php' ) );
|
466 |
+
?>
|
467 |
+
</p><?php
|
468 |
+
}
|
469 |
+
?>
|
470 |
+
</div><?php
|
471 |
+
}
|
472 |
+
}//End of Class
|
473 |
+
|
474 |
+
}//End Of if class not exists
|
lib/nextgen-integration/class-wp-smush-nextgen-bulk.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! class_exists( 'WPSmushNextGenBulk' ) ) {
|
3 |
+
class WPSmushNextGenBulk extends WpSmushNextGen {
|
4 |
+
|
5 |
+
function __construct() {
|
6 |
+
add_action( 'wp_ajax_wp_smushit_nextgen_bulk', array( $this, 'smush_bulk' ) );
|
7 |
+
}
|
8 |
+
|
9 |
+
function smush_bulk() {
|
10 |
+
|
11 |
+
global $wpsmushnextgenstats;
|
12 |
+
|
13 |
+
$stats = array();
|
14 |
+
|
15 |
+
if ( empty( $_GET['attachment_id'] ) ) {
|
16 |
+
wp_send_json_error( 'missing id' );
|
17 |
+
}
|
18 |
+
|
19 |
+
$atchmnt_id = sanitize_key( $_GET['attachment_id'] );
|
20 |
+
|
21 |
+
$smush = $this->smush_image( $atchmnt_id, '', false );
|
22 |
+
|
23 |
+
$stats = $wpsmushnextgenstats->get_smush_stats();
|
24 |
+
|
25 |
+
$stats['smushed'] = $wpsmushnextgenstats->get_ngg_images('smushed', true );
|
26 |
+
$stats['total'] = $wpsmushnextgenstats->total_count();
|
27 |
+
|
28 |
+
if ( is_wp_error( $smush ) ) {
|
29 |
+
$error = $smush->get_error_message();
|
30 |
+
//Check for timeout error and suggest to filter timeout
|
31 |
+
if( strpos( $error, 'timed out') ) {
|
32 |
+
$msg = esc_html__( "Smush request timed out, You can try setting a higher value ( > 60 ) for `WP_SMUSH_API_TIMEOUT`.", "wp-smushit" );
|
33 |
+
}
|
34 |
+
wp_send_json_error( array( 'stats' => $stats, 'error_msg' => $msg ) );
|
35 |
+
} else {
|
36 |
+
wp_send_json_success( array( 'stats' => $stats ) );
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
}
|
41 |
+
}
|
lib/nextgen-integration/class-wp-smush-nextgen-stats.php
ADDED
@@ -0,0 +1,426 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Handles all the stats related functions
|
5 |
+
*
|
6 |
+
* @package WP Smush
|
7 |
+
* @subpackage NextGen Gallery
|
8 |
+
* @version 1.0
|
9 |
+
*
|
10 |
+
* @author Umesh Kumar <umesh@incsub.com>
|
11 |
+
*
|
12 |
+
* @copyright (c) 2015, Incsub (http://incsub.com)
|
13 |
+
*/
|
14 |
+
if ( ! class_exists( 'WpSmushNextGenStats' ) ) {
|
15 |
+
|
16 |
+
class WpSmushNextGenStats extends WpSmushNextGen {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var array Contains the total Stats, for displaying it on bulk page
|
20 |
+
*/
|
21 |
+
var $stats = array();
|
22 |
+
|
23 |
+
function __construct() {
|
24 |
+
|
25 |
+
//Update Total Image count
|
26 |
+
add_action( 'ngg_added_new_image', array( $this, 'image_count' ), 10 );
|
27 |
+
|
28 |
+
//Update images list in cache
|
29 |
+
add_action( 'wp_smush_nextgen_image_stats', array( $this, 'update_cache' ) );
|
30 |
+
|
31 |
+
//Get the stats for single image, update the global stats
|
32 |
+
add_action( 'wp_smush_nextgen_image_stats', array( $this, 'update_stats' ), '', 2 );
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Refreshes the total image count when a new image is added to nextgen gallery
|
37 |
+
* Should be called only if image count need to be updated, use total_count(), otherwise
|
38 |
+
*
|
39 |
+
*/
|
40 |
+
function image_count() {
|
41 |
+
// Force the cache refresh for top-commented posts.
|
42 |
+
$this->total_count( $force_refresh = true );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Get the images id for nextgen gallery
|
47 |
+
*
|
48 |
+
* @param bool $force_refresh Optional. Whether to force the cache to be refreshed.
|
49 |
+
* Default false.
|
50 |
+
*
|
51 |
+
* @return int|WP_Error Total Image count,
|
52 |
+
* WP_Error object otherwise.
|
53 |
+
*/
|
54 |
+
function total_count( $force_refresh = false, $return_ids = false ) {
|
55 |
+
// Check for the wp_smush_images in the 'nextgen' group.
|
56 |
+
$attachment_ids = wp_cache_get( 'wp_smush_images', 'nextgen' );
|
57 |
+
|
58 |
+
// If nothing is found, build the object.
|
59 |
+
if ( true === $force_refresh || false === $attachment_ids ) {
|
60 |
+
//Get the nextgen image ids
|
61 |
+
$attachment_ids = $this->get_nextgen_attachments();
|
62 |
+
|
63 |
+
if ( ! is_wp_error( $attachment_ids ) ) {
|
64 |
+
// In this case we don't need a timed cache expiration.
|
65 |
+
wp_cache_set( 'wp_smush_images', $attachment_ids, 'nextgen' );
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
return $return_ids ? $attachment_ids : count( $attachment_ids );
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
*
|
74 |
+
*
|
75 |
+
* @param bool $return_ids Whether to return the ids array, set to false by default
|
76 |
+
*
|
77 |
+
* @return int|mixed|void Returns the images ids or the count
|
78 |
+
*/
|
79 |
+
/**
|
80 |
+
* Returns the ngg images list(id and meta ) or count
|
81 |
+
*
|
82 |
+
* @param string $type Whether to return smushed images or unsmushed images
|
83 |
+
* @param bool|false $count Return count only
|
84 |
+
* @param bool|false $force_update true/false to update the cache or not
|
85 |
+
*
|
86 |
+
* @return bool|mixed Returns assoc array of image ids and meta or Image count
|
87 |
+
*/
|
88 |
+
function get_ngg_images( $type = 'smushed', $count = false, $force_update = false ) {
|
89 |
+
|
90 |
+
global $wpdb;
|
91 |
+
/**
|
92 |
+
* Allows to set a limit of mysql query
|
93 |
+
* Default value is 2000
|
94 |
+
*/
|
95 |
+
$limit = apply_filters('wp_smush_nextgen_query_limit', 2000 );
|
96 |
+
$limit = intval( $limit );
|
97 |
+
$offset = 0;
|
98 |
+
|
99 |
+
//Check type of images being queried
|
100 |
+
if ( ! in_array( $type, array( 'smushed', 'unsmushed' ) ) ) {
|
101 |
+
return false;
|
102 |
+
}
|
103 |
+
|
104 |
+
// Check for the wp_smush_images_smushed in the 'nextgen' group.
|
105 |
+
$images = wp_cache_get( 'wp_smush_images_' . $type, 'nextgen' );
|
106 |
+
|
107 |
+
// If nothing is found, build the object.
|
108 |
+
if ( !$images || $force_update ) {
|
109 |
+
// Query Attachments for meta key
|
110 |
+
while( $attachments = $wpdb->get_results( "SELECT pid, meta_data FROM $wpdb->nggpictures LIMIT $offset, $limit" ) ) {
|
111 |
+
foreach ( $attachments as $attachment ) {
|
112 |
+
//Check if it has `wp_smush` key
|
113 |
+
if ( class_exists( 'Ngg_Serializable' ) ) {
|
114 |
+
$serializer = new Ngg_Serializable();
|
115 |
+
$meta = $serializer->unserialize( $attachment->meta_data );
|
116 |
+
} else {
|
117 |
+
$meta = unserialize( $attachment->meta_data );
|
118 |
+
}
|
119 |
+
//Check meta for wp_smush
|
120 |
+
if ( ! is_array( $meta ) || empty( $meta['wp_smush'] ) ) {
|
121 |
+
$unsmushed_images[ $attachment->pid ] = $meta;
|
122 |
+
continue;
|
123 |
+
}
|
124 |
+
$smushed_images[ $attachment->pid ] = $meta;
|
125 |
+
}
|
126 |
+
//Set the offset
|
127 |
+
$offset += $limit;
|
128 |
+
};
|
129 |
+
if( !empty( $smushed_images ) ) {
|
130 |
+
wp_cache_set( 'wp_smush_images_smushed', $smushed_images, 'nextgen', 300 );
|
131 |
+
}
|
132 |
+
if( !empty( $unsmushed_images ) ) {
|
133 |
+
wp_cache_set( 'wp_smush_images_unsmushed', $unsmushed_images, 'nextgen', 300 );
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
if ( $type == 'smushed' ) {
|
138 |
+
$smushed_images = ! empty( $smushed_images ) ? $smushed_images : $images;
|
139 |
+
|
140 |
+
if( !$smushed_images ) {
|
141 |
+
return 0;
|
142 |
+
}else {
|
143 |
+
return $count ? count( $smushed_images ) : $smushed_images;
|
144 |
+
}
|
145 |
+
} else {
|
146 |
+
|
147 |
+
if( !$unsmushed_images ) {
|
148 |
+
return 0;
|
149 |
+
}else {
|
150 |
+
$unsmushed_images = ! empty( $unsmushed_images ) ? $unsmushed_images : $images;
|
151 |
+
|
152 |
+
return $count ? count( $unsmushed_images ) : $unsmushed_images;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Display the smush stats for the image
|
159 |
+
*
|
160 |
+
* @param $pid Image Id stored in nextgen table
|
161 |
+
* @param bool $wp_smush_data Stats, stored after smushing the image
|
162 |
+
* @param string $image_type Used for determining if not gif, to show the Super Smush button
|
163 |
+
* @param bool $text_only Return only text instead of button (Useful for Ajax)
|
164 |
+
* @param bool $echo Whether to echo the stats or not
|
165 |
+
*
|
166 |
+
* @return bool|null|string|void
|
167 |
+
*/
|
168 |
+
function show_stats( $pid, $wp_smush_data = false, $image_type = '', $text_only = false, $echo = true ) {
|
169 |
+
global $WpSmush, $wpsmushnextgenadmin;
|
170 |
+
if ( empty( $wp_smush_data ) ) {
|
171 |
+
return false;
|
172 |
+
}
|
173 |
+
$button_txt = '';
|
174 |
+
$show_button = false;
|
175 |
+
|
176 |
+
$bytes = isset( $wp_smush_data['stats']['bytes'] ) ? $wp_smush_data['stats']['bytes'] : 0;
|
177 |
+
$bytes_readable = ! empty( $bytes ) ? $WpSmush->format_bytes( $bytes ) : '';
|
178 |
+
$percent = isset( $wp_smush_data['stats']['percent'] ) ? $wp_smush_data['stats']['percent'] : 0;
|
179 |
+
$percent = $percent < 0 ? 0 : $percent;
|
180 |
+
|
181 |
+
if ( isset( $wp_smush_data['stats']['size_before'] ) && $wp_smush_data['stats']['size_before'] == 0 && ! empty( $wp_smush_data['sizes'] ) ) {
|
182 |
+
$status_txt = __( 'Error processing request', 'wp-smushit' );
|
183 |
+
$show_button = true;
|
184 |
+
} else {
|
185 |
+
if ( $bytes == 0 || $percent == 0 ) {
|
186 |
+
$status_txt = __( 'Already Optimized', 'wp-smushit' );
|
187 |
+
} elseif ( ! empty( $percent ) && ! empty( $bytes_readable ) ) {
|
188 |
+
$status_txt = sprintf( __( "Reduced by %s ( %01.1f%% )", 'wp-smushit' ), $bytes_readable, number_format_i18n( $percent, 2, '.', '' ) );
|
189 |
+
//Show detailed stats if available
|
190 |
+
if ( ! empty( $wp_smush_data['sizes'] ) ) {
|
191 |
+
//Detailed Stats Link
|
192 |
+
$status_txt .= '<br /><a href="#" class="smush-stats-details">' . esc_html__( "Smush stats", 'wp-smushit' ) . ' [<span class="stats-toggle">+</span>]</a>';
|
193 |
+
|
194 |
+
//Get metadata For the image
|
195 |
+
// Registry Object for NextGen Gallery
|
196 |
+
$registry = C_Component_Registry::get_instance();
|
197 |
+
|
198 |
+
//Gallery Storage Object
|
199 |
+
$storage = $registry->get_utility( 'I_Gallery_Storage' );
|
200 |
+
|
201 |
+
// get an array of sizes available for the $image
|
202 |
+
$sizes = $storage->get_image_sizes();
|
203 |
+
|
204 |
+
$image = $storage->object->_image_mapper->find( $pid );
|
205 |
+
|
206 |
+
$full_image = $storage->get_image_abspath( $image, 'full' );
|
207 |
+
|
208 |
+
//Stats
|
209 |
+
$status_txt .= $this->get_detailed_stats( $pid, $wp_smush_data, array( 'sizes' => $sizes ), $full_image );
|
210 |
+
}
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
//IF current compression is lossy
|
215 |
+
if ( ! empty( $wp_smush_data ) && ! empty( $wp_smush_data['stats'] ) ) {
|
216 |
+
$lossy = ! empty( $wp_smush_data['stats']['lossy'] ) ? $wp_smush_data['stats']['lossy'] : '';
|
217 |
+
$is_lossy = $lossy == 1 ? true : false;
|
218 |
+
}
|
219 |
+
|
220 |
+
//Check if Lossy enabled
|
221 |
+
$opt_lossy = WP_SMUSH_PREFIX . 'lossy';
|
222 |
+
$opt_lossy_val = get_option( $opt_lossy, false );
|
223 |
+
|
224 |
+
//Check if premium user, compression was lossless, and lossy compression is enabled
|
225 |
+
if ( $WpSmush->is_pro() && ! $is_lossy && $opt_lossy_val && $image_type != 'image/gif' && ! empty( $image_type ) ) {
|
226 |
+
// the button text
|
227 |
+
$button_txt = __( 'Super-Smush', 'wp-smushit' );
|
228 |
+
$show_button = true;
|
229 |
+
}
|
230 |
+
if ( $text_only ) {
|
231 |
+
return $status_txt;
|
232 |
+
}
|
233 |
+
|
234 |
+
//If show button is true for some reason, column html can print out the button for us
|
235 |
+
$text = $wpsmushnextgenadmin->column_html( $pid, $status_txt, $button_txt, $show_button, true, $echo );
|
236 |
+
if ( ! $echo ) {
|
237 |
+
return $text;
|
238 |
+
}
|
239 |
+
}
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Updated the global smush stats for NextGen gallery
|
243 |
+
*
|
244 |
+
* @param $stats Compression stats fo respective image
|
245 |
+
*
|
246 |
+
*/
|
247 |
+
function update_stats( $image_id, $stats ) {
|
248 |
+
global $WpSmush;
|
249 |
+
|
250 |
+
$stats = ! empty( $stats['stats'] ) ? $stats['stats'] : '';
|
251 |
+
|
252 |
+
$smush_stats = get_option( 'wp_smush_stats_nextgen', array() );
|
253 |
+
|
254 |
+
if ( ! empty( $stats ) ) {
|
255 |
+
//Compression Percentage
|
256 |
+
$smush_stats['percent'] = ! empty( $smush_stats['percent'] ) ? ( $smush_stats['percent'] + $stats['percent'] ) : $stats['percent'];
|
257 |
+
|
258 |
+
//Compression Bytes
|
259 |
+
$smush_stats['bytes'] = ! empty( $smush_stats['bytes'] ) ? ( $smush_stats['bytes'] + $stats['bytes'] ) : $stats['bytes'];
|
260 |
+
|
261 |
+
//Human Readable
|
262 |
+
$smush_stats['human'] = !empty( $smush_stats['bytes'] ) ? $WpSmush->format_bytes( $smush_stats['bytes'] ) : '';
|
263 |
+
|
264 |
+
//Size of images before the compression
|
265 |
+
$smush_stats['size_before'] = ! empty( $smush_stats['size_before'] ) ? ( $smush_stats['size_before'] + $stats['size_before'] ) : $stats['size_before'];
|
266 |
+
|
267 |
+
//Size of image after compression
|
268 |
+
$smush_stats['size_after'] = ! empty( $smush_stats['size_after'] ) ? ( $smush_stats['size_after'] + $stats['size_after'] ) : $stats['size_after'];
|
269 |
+
}
|
270 |
+
update_option( 'wp_smush_stats_nextgen', $smush_stats );
|
271 |
+
|
272 |
+
//Cahce the results, we don't need a timed cache expiration.
|
273 |
+
wp_cache_set( 'wp_smush_stats_nextgen', $smush_stats, 'nextgen' );
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Get the Nextgen Smush stats
|
278 |
+
* @return bool|mixed|void
|
279 |
+
*/
|
280 |
+
function get_smush_stats() {
|
281 |
+
global $WpSmush;
|
282 |
+
|
283 |
+
// Check for the wp_smush_images_smushed in the 'nextgen' group.
|
284 |
+
$smushed_stats = wp_cache_get( 'wp_smush_stats_nextgen', 'nextgen' );
|
285 |
+
|
286 |
+
// If nothing is found, build the object.
|
287 |
+
if ( false === $smushed_stats ) {
|
288 |
+
// Check for the wp_smush_images in the 'nextgen' group.
|
289 |
+
$smushed_stats = get_option( 'wp_smush_stats_nextgen', array() );
|
290 |
+
|
291 |
+
if ( ! is_wp_error( $smushed_stats ) ) {
|
292 |
+
// In this case we don't need a timed cache expiration.
|
293 |
+
wp_cache_set( 'wp_smush_stats_nextgen', $smushed_stats, 'nextgen' );
|
294 |
+
}
|
295 |
+
}
|
296 |
+
if ( empty( $smushed_stats['bytes'] ) || $smushed_stats['bytes'] < 0 ) {
|
297 |
+
$smushed_stats['bytes'] = 0;
|
298 |
+
}
|
299 |
+
|
300 |
+
if ( ! empty( $smushed_stats['size_before'] ) && $smushed_stats['size_before'] > 0 ) {
|
301 |
+
$smushed_stats['percent'] = ( $smushed_stats['bytes'] / $smushed_stats['size_before'] ) * 100;
|
302 |
+
}
|
303 |
+
|
304 |
+
//Round off precentage
|
305 |
+
$smushed_stats['percent'] = ! empty( $smushed_stats['percent'] ) ? round( $smushed_stats['percent'], 2 ) : 0;
|
306 |
+
|
307 |
+
$smushed_stats['human'] = $WpSmush->format_bytes( $smushed_stats['bytes'] );
|
308 |
+
|
309 |
+
return $smushed_stats;
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Updates the cache for Smushed and Unsmushed images
|
314 |
+
*/
|
315 |
+
function update_cache() {
|
316 |
+
$this->get_ngg_images('smushed', '', true );
|
317 |
+
}
|
318 |
+
|
319 |
+
function get_detailed_stats( $image_id, $wp_smush_data, $attachment_metadata, $full_image ) {
|
320 |
+
global $WpSmush;
|
321 |
+
|
322 |
+
$stats = '<div id="smush-stats-' . $image_id . '" class="smush-stats-wrapper hidden">
|
323 |
+
<table class="wp-smush-stats-holder">
|
324 |
+
<thead>
|
325 |
+
<tr>
|
326 |
+
<th><strong>' . esc_html__( 'Image size', 'wp-smushit' ) . '</strong></th>
|
327 |
+
<th><strong>' . esc_html__( 'Savings', 'wp-smushit' ) . '</strong></th>
|
328 |
+
</tr>
|
329 |
+
</thead>
|
330 |
+
<tbody>';
|
331 |
+
$size_stats = $wp_smush_data['sizes'];
|
332 |
+
|
333 |
+
//Reorder Sizes as per the maximum savings
|
334 |
+
uasort( $size_stats, array( $this, "cmp" ) );
|
335 |
+
|
336 |
+
if ( ! empty( $attachment_metadata['sizes'] ) ) {
|
337 |
+
//Get skipped images
|
338 |
+
$skipped = $this->get_skipped_images( $size_stats, $full_image );
|
339 |
+
|
340 |
+
if ( ! empty( $skipped ) ) {
|
341 |
+
foreach ( $skipped as $img_data ) {
|
342 |
+
$skip_class = $img_data['reason'] == 'size_limit' ? ' error' : '';
|
343 |
+
$stats .= '<tr>
|
344 |
+
<td>' . strtoupper( $img_data['size'] ) . '</td>
|
345 |
+
<td class="smush-skipped' . $skip_class . '">' . $WpSmush->skip_reason( $img_data['reason'] ) . '</td>
|
346 |
+
</tr>';
|
347 |
+
}
|
348 |
+
|
349 |
+
}
|
350 |
+
}
|
351 |
+
//Show Sizes and their compression
|
352 |
+
foreach ( $size_stats as $size_key => $size_value ) {
|
353 |
+
$size_value = !is_object( $size_value ) ? (object) $size_value : $size_value;
|
354 |
+
if ( $size_value->bytes > 0 ) {
|
355 |
+
$stats .= '<tr>
|
356 |
+
<td>' . strtoupper( $size_key ) . '</td>
|
357 |
+
<td>' . $WpSmush->format_bytes( $size_value->bytes ) . ' ( ' . $size_value->percent . '% )</td>
|
358 |
+
</tr>';
|
359 |
+
}
|
360 |
+
}
|
361 |
+
$stats .= '</tbody>
|
362 |
+
</table>
|
363 |
+
</div>';
|
364 |
+
|
365 |
+
return $stats;
|
366 |
+
}
|
367 |
+
/**
|
368 |
+
* Compare Values
|
369 |
+
*
|
370 |
+
* @param $a
|
371 |
+
* @param $b
|
372 |
+
*
|
373 |
+
* @return int
|
374 |
+
*/
|
375 |
+
function cmp( $a, $b ) {
|
376 |
+
if ( is_object( $a ) ) {
|
377 |
+
return $a->bytes < $b->bytes;
|
378 |
+
} else if ( is_array( $a ) ) {
|
379 |
+
return $a['bytes'] < $b['bytes'];
|
380 |
+
}
|
381 |
+
}
|
382 |
+
/**
|
383 |
+
* Return a list of images not smushed and reason
|
384 |
+
* @param $image_id
|
385 |
+
* @param $size_stats
|
386 |
+
* @param $attachment_metadata
|
387 |
+
*
|
388 |
+
* @return array
|
389 |
+
*/
|
390 |
+
function get_skipped_images( $size_stats, $full_image ) {
|
391 |
+
$skipped = array();
|
392 |
+
|
393 |
+
//If full image was not smushed, reason 1. Large Size logic, 2. Free and greater than 1Mb
|
394 |
+
if ( ! array_key_exists( 'full', $size_stats ) ) {
|
395 |
+
//For free version, Check the image size
|
396 |
+
if ( ! $this->is_pro() ) {
|
397 |
+
//For free version, check if full size is greater than 1 Mb, show the skipped status
|
398 |
+
$file_size = file_exists( $full_image ) ? filesize( $full_image ) : '';
|
399 |
+
if ( !empty( $file_size ) && ( $file_size / WP_SMUSH_MAX_BYTES ) > 1 ) {
|
400 |
+
$skipped[] = array(
|
401 |
+
'size' => 'full',
|
402 |
+
'reason' => 'size_limit'
|
403 |
+
);
|
404 |
+
}else{
|
405 |
+
$skipped[] = array(
|
406 |
+
'size' => 'full',
|
407 |
+
'reason' => 'large_size'
|
408 |
+
);
|
409 |
+
}
|
410 |
+
} else {
|
411 |
+
//Paid version, Check if we have large size
|
412 |
+
if ( array_key_exists( 'large', $size_stats ) ) {
|
413 |
+
$skipped[] = array(
|
414 |
+
'size' => 'full',
|
415 |
+
'reason' => 'large_size'
|
416 |
+
);
|
417 |
+
}
|
418 |
+
|
419 |
+
}
|
420 |
+
}
|
421 |
+
return $skipped;
|
422 |
+
}
|
423 |
+
|
424 |
+
}//End of Class
|
425 |
+
|
426 |
+
}//End Of if class not exists
|
readme.txt
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
=== WP Smush ===
|
2 |
Plugin Name: WP Smush
|
3 |
-
Version: 2.0.
|
4 |
Author: WPMU DEV
|
5 |
Author URI: http://premium.wpmudev.org/
|
6 |
Contributors: WPMUDEV, alexdunae
|
7 |
Tags: Attachment,Attachments,Compress,Compress Image File,Compress Image Size,Compress JPG,Compressed JPG, Compression Image,Image,Images,JPG,Optimise,Optimize,Photo,Photos,Pictures,PNG,Reduce Image Size,Smush,Smush.it,Upload,WordPress Compression,WordPress Image Tool,Yahoo, Yahoo Smush.it
|
8 |
Requires at least: 3.5
|
9 |
Tested up to: 4.3.1
|
10 |
-
Stable tag: 2.0.
|
11 |
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
12 |
|
13 |
Reduce image file sizes, improve performance and boost your SEO using the free <a href="https://premium.wpmudev.org/">WPMU DEV</a> WordPress Smush API.
|
@@ -59,7 +59,7 @@ Features available to both WP Smush and Pro users include:
|
|
59 |
<li>Use of WPMU DEV's fast and reliable Smush API service.</li>
|
60 |
<li>View advanced compression stats per-attachment and library totals.</li>
|
61 |
</ul>
|
62 |
-
Discover for yourself why WP Smush is the most popular free image optimization plugin with more than
|
63 |
|
64 |
|
65 |
== Screenshots ==
|
@@ -81,6 +81,16 @@ Yahoo's Smush.it API is gone forever. So WPMU DEV built our own free API that is
|
|
81 |
|
82 |
== Changelog ==
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
= 2.0.6.5 =
|
85 |
|
86 |
* Updated: Skip webp images ( causing ajax error for few sites )
|
1 |
=== WP Smush ===
|
2 |
Plugin Name: WP Smush
|
3 |
+
Version: 2.0.7
|
4 |
Author: WPMU DEV
|
5 |
Author URI: http://premium.wpmudev.org/
|
6 |
Contributors: WPMUDEV, alexdunae
|
7 |
Tags: Attachment,Attachments,Compress,Compress Image File,Compress Image Size,Compress JPG,Compressed JPG, Compression Image,Image,Images,JPG,Optimise,Optimize,Photo,Photos,Pictures,PNG,Reduce Image Size,Smush,Smush.it,Upload,WordPress Compression,WordPress Image Tool,Yahoo, Yahoo Smush.it
|
8 |
Requires at least: 3.5
|
9 |
Tested up to: 4.3.1
|
10 |
+
Stable tag: 2.0.7
|
11 |
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
12 |
|
13 |
Reduce image file sizes, improve performance and boost your SEO using the free <a href="https://premium.wpmudev.org/">WPMU DEV</a> WordPress Smush API.
|
59 |
<li>Use of WPMU DEV's fast and reliable Smush API service.</li>
|
60 |
<li>View advanced compression stats per-attachment and library totals.</li>
|
61 |
</ul>
|
62 |
+
Discover for yourself why WP Smush is the most popular free image optimization plugin with more than two million downloads.
|
63 |
|
64 |
|
65 |
== Screenshots ==
|
81 |
|
82 |
== Changelog ==
|
83 |
|
84 |
+
= 2.0.7 =
|
85 |
+
|
86 |
+
* Fixed: Invalid header issue
|
87 |
+
* Fixed: Warnings in file functions
|
88 |
+
* Updated: Added limit on query results, for sites with higher image count, Use filter `wp_smush_media_query_limit` to adjust values
|
89 |
+
* Added: Sortable WP Smush column in Media Library
|
90 |
+
* Added: Filters `wp_smush_media_image` for Media Gallery, `wp_smush_nextgen_image` For NextGen gallery,
|
91 |
+
allows to skip a particular image size from smushing
|
92 |
+
* Added: NextGen Gallery support (Pro feature)
|
93 |
+
|
94 |
= 2.0.6.5 =
|
95 |
|
96 |
* Updated: Skip webp images ( causing ajax error for few sites )
|
uninstall.php
CHANGED
@@ -19,17 +19,44 @@ $smushit_keys = array(
|
|
19 |
foreach ( $smushit_keys as $key ) {
|
20 |
$key = 'wp-smush-' . $key;
|
21 |
if ( is_multisite() ) {
|
22 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
if ( $blogs ) {
|
24 |
foreach ( $blogs as $blog ) {
|
25 |
switch_to_blog( $blog['blog_id'] );
|
26 |
-
|
27 |
-
delete_site_option( $key );
|
28 |
}
|
29 |
restore_current_blog();
|
30 |
}
|
31 |
-
|
32 |
-
delete_option( $key );
|
33 |
}
|
|
|
|
|
34 |
}
|
35 |
?>
|
19 |
foreach ( $smushit_keys as $key ) {
|
20 |
$key = 'wp-smush-' . $key;
|
21 |
if ( is_multisite() ) {
|
22 |
+
$offset = 0;
|
23 |
+
$limit = 100;
|
24 |
+
while( $blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs} LIMIT $offset, $limit", ARRAY_A ) ) {
|
25 |
+
if ( $blogs ) {
|
26 |
+
foreach ( $blogs as $blog ) {
|
27 |
+
switch_to_blog( $blog['blog_id'] );
|
28 |
+
delete_option( $key );
|
29 |
+
delete_site_option( $key );
|
30 |
+
}
|
31 |
+
restore_current_blog();
|
32 |
+
}
|
33 |
+
$offset += $limit;
|
34 |
+
}
|
35 |
+
} else {
|
36 |
+
delete_option( $key );
|
37 |
+
}
|
38 |
+
}
|
39 |
+
//Delete Post meta
|
40 |
+
$meta_type = 'post';
|
41 |
+
$user_id = 0;
|
42 |
+
$meta_key = 'wp-smpro-smush-data';
|
43 |
+
$meta_value = '';
|
44 |
+
$delete_all = true;
|
45 |
+
|
46 |
+
if ( is_multisite() ) {
|
47 |
+
$offset = 0;
|
48 |
+
$limit = 100;
|
49 |
+
while( $blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs} LIMIT $offset, $limit", ARRAY_A ) ) {
|
50 |
if ( $blogs ) {
|
51 |
foreach ( $blogs as $blog ) {
|
52 |
switch_to_blog( $blog['blog_id'] );
|
53 |
+
delete_metadata( $meta_type, $user_id, $meta_key, $meta_value, $delete_all );
|
|
|
54 |
}
|
55 |
restore_current_blog();
|
56 |
}
|
57 |
+
$offset += $limit;
|
|
|
58 |
}
|
59 |
+
} else {
|
60 |
+
delete_metadata( $meta_type, $user_id, $meta_key, $meta_value, $delete_all );
|
61 |
}
|
62 |
?>
|
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.0.
|
8 |
Author URI: http://premium.wpmudev.org/
|
9 |
Textdomain: wp-smushit
|
10 |
*/
|
@@ -31,12 +31,11 @@ along with this program; if not, write to the Free Software
|
|
31 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
32 |
*/
|
33 |
|
34 |
-
|
35 |
/**
|
36 |
* Constants
|
37 |
*/
|
38 |
$prefix = 'WP_SMUSH_';
|
39 |
-
$version = '2.0.
|
40 |
|
41 |
/**
|
42 |
* Set the default timeout for API request and AJAX timeout
|
@@ -64,9 +63,52 @@ foreach ( $smush_constants as $const_name => $constant_val ) {
|
|
64 |
//Include main class
|
65 |
require_once WP_SMUSH_DIR . 'lib/class-wp-smush.php';
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
//Only for wordpress.org members
|
68 |
-
$
|
69 |
-
|
|
|
70 |
require_once( WP_SMUSH_DIR . 'extras/free-dashboard/module.php' );
|
71 |
|
72 |
// Register the current plugin.
|
@@ -90,46 +132,12 @@ if ( $plugin == 'wp-smushit' ) {
|
|
90 |
'wp_smush_rating_message'
|
91 |
);
|
92 |
|
93 |
-
/**
|
94 |
-
* Filters the rating message, include stats if greater than 1Mb
|
95 |
-
*
|
96 |
-
* @param $message
|
97 |
-
*
|
98 |
-
* @return string
|
99 |
-
*/
|
100 |
-
function wp_smush_rating_message( $message ) {
|
101 |
-
global $wpsmushit_admin;
|
102 |
-
$savings = $wpsmushit_admin->global_stats();
|
103 |
-
$image_count = $wpsmushit_admin->total_count();
|
104 |
-
$show_stats = false;
|
105 |
-
|
106 |
-
//If there is any saving, greater than 1Mb, show stats
|
107 |
-
if ( ! empty( $savings ) && ! empty( $savings['bytes'] ) && $savings['bytes'] > 1048576 ) {
|
108 |
-
$show_stats = true;
|
109 |
-
}
|
110 |
-
|
111 |
-
$message = "Hey %s, you've been using %s for a while now, and we hope you're happy with it.";
|
112 |
-
|
113 |
-
//Conditionally Show stats in rating message
|
114 |
-
if ( $show_stats ) {
|
115 |
-
$message .= sprintf( " You've smushed <strong>%s</strong> from %d images already, improving the speed and SEO ranking of this site!", $savings['human'], $image_count );
|
116 |
-
}
|
117 |
-
$message .= " We've spent countless hours developing this free plugin for you, and we would really appreciate it if you dropped us a quick rating!";
|
118 |
-
|
119 |
-
return $message;
|
120 |
-
}
|
121 |
-
|
122 |
// The email message contains 1 variable: plugin-name
|
123 |
add_filter(
|
124 |
'wdev-email-message-' . plugin_basename( __FILE__ ),
|
125 |
'wp_smush_email_message'
|
126 |
);
|
127 |
-
|
128 |
-
$message = "You're awesome for installing %s! Site speed isn't all image optimization though, so we've collected all the best speed resources we know in a single email - just for users of WP Smush!";
|
129 |
-
|
130 |
-
return $message;
|
131 |
-
}
|
132 |
-
} elseif ( $plugin == 'wp-smush-pro' ) {
|
133 |
|
134 |
//Only for WPMU DEV Members
|
135 |
require_once( WP_SMUSH_DIR . 'extras/dash-notice/wpmudev-dash-notification.php' );
|
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.0.7
|
8 |
Author URI: http://premium.wpmudev.org/
|
9 |
Textdomain: wp-smushit
|
10 |
*/
|
31 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
32 |
*/
|
33 |
|
|
|
34 |
/**
|
35 |
* Constants
|
36 |
*/
|
37 |
$prefix = 'WP_SMUSH_';
|
38 |
+
$version = '2.0.7';
|
39 |
|
40 |
/**
|
41 |
* Set the default timeout for API request and AJAX timeout
|
63 |
//Include main class
|
64 |
require_once WP_SMUSH_DIR . 'lib/class-wp-smush.php';
|
65 |
|
66 |
+
/**
|
67 |
+
* Filters the rating message, include stats if greater than 1Mb
|
68 |
+
*
|
69 |
+
* @param $message
|
70 |
+
*
|
71 |
+
* @return string
|
72 |
+
*/
|
73 |
+
function wp_smush_rating_message( $message ) {
|
74 |
+
global $wpsmushit_admin;
|
75 |
+
$savings = $wpsmushit_admin->global_stats();
|
76 |
+
$image_count = $wpsmushit_admin->total_count();
|
77 |
+
$show_stats = false;
|
78 |
+
|
79 |
+
//If there is any saving, greater than 1Mb, show stats
|
80 |
+
if ( ! empty( $savings ) && ! empty( $savings['bytes'] ) && $savings['bytes'] > 1048576 ) {
|
81 |
+
$show_stats = true;
|
82 |
+
}
|
83 |
+
|
84 |
+
$message = "Hey %s, you've been using %s for a while now, and we hope you're happy with it.";
|
85 |
+
|
86 |
+
//Conditionally Show stats in rating message
|
87 |
+
if ( $show_stats ) {
|
88 |
+
$message .= sprintf( " You've smushed <strong>%s</strong> from %d images already, improving the speed and SEO ranking of this site!", $savings['human'], $image_count );
|
89 |
+
}
|
90 |
+
$message .= " We've spent countless hours developing this free plugin for you, and we would really appreciate it if you dropped us a quick rating!";
|
91 |
+
|
92 |
+
return $message;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* NewsLetter
|
97 |
+
*
|
98 |
+
* @param $message
|
99 |
+
*
|
100 |
+
* @return string
|
101 |
+
*/
|
102 |
+
function wp_smush_email_message( $message ) {
|
103 |
+
$message = "You're awesome for installing %s! Site speed isn't all image optimization though, so we've collected all the best speed resources we know in a single email - just for users of WP Smush!";
|
104 |
+
|
105 |
+
return $message;
|
106 |
+
}
|
107 |
+
|
108 |
//Only for wordpress.org members
|
109 |
+
$dir_path = plugin_dir_path( __FILE__ );
|
110 |
+
|
111 |
+
if ( strpos( $dir_path, 'wp-smushit' ) !== false ) {
|
112 |
require_once( WP_SMUSH_DIR . 'extras/free-dashboard/module.php' );
|
113 |
|
114 |
// Register the current plugin.
|
132 |
'wp_smush_rating_message'
|
133 |
);
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
// The email message contains 1 variable: plugin-name
|
136 |
add_filter(
|
137 |
'wdev-email-message-' . plugin_basename( __FILE__ ),
|
138 |
'wp_smush_email_message'
|
139 |
);
|
140 |
+
} elseif ( strpos( $dir_path, 'wp-smush-pro' ) !== false ) {
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
//Only for WPMU DEV Members
|
143 |
require_once( WP_SMUSH_DIR . 'extras/dash-notice/wpmudev-dash-notification.php' );
|