forked from BoldGrid/w3-total-cache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtension_ImageService_Page_View.php
230 lines (208 loc) · 7.12 KB
/
Extension_ImageService_Page_View.php
1
2
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<?php
/**
* File: Extension_ImageService_Page_View.php
*
* View for the Image Service extension settings, tools, and statistics page.
*
* @since 2.2.0
*
* @package W3TC
*
* @uses Config $c Configuration object.
* @uses array $counts Image Service media counts.
* @uses array|false $usage API usage statistics.
*/
namespace W3TC;
if ( ! defined( 'W3TC' ) ) {
die();
}
?>
<div class="wrap" id="w3tc">
<?php
// Upgrade banner.
if ( ! Util_Environment::is_w3tc_pro( $c ) ) {
require W3TC_INC_DIR . '/options/parts/dashboard_banner.php';
}
?>
<p>
Total Cache Image Service is currently
<?php
if ( $c->is_extension_active( 'imageservice' ) ) {
?>
<span class="w3tc-enabled">enabled</span>
<?php
} else {
?>
<span class="w3tc-disabled">disabled</span>
<?php
}
?>
.
</p>
<form id="w3tc-imageservice-settings" action="upload.php?page=w3tc_extension_page_imageservice" method="post">
<div class="metabox-holder">
<?php Util_Ui::postbox_header( esc_html__( 'Configuration', 'w3-total-cache' ), '', '' ); ?>
<table class="form-table" id="w3tc-imageservice-config">
<?php
Util_Ui::config_item(
array(
'key' => array(
'imageservice',
'compression',
),
'label' => esc_html__( 'Compression type:', 'w3-total-cache' ),
'control' => 'radiogroup',
'radiogroup_values' => array(
'lossy' => 'Lossy',
'lossless' => 'Lossless',
),
'description' => esc_html__( 'Image compression type.', 'w3-total-cache' ),
'disabled' => false,
)
);
Util_Ui::config_item(
array(
'key' => array(
'imageservice',
'auto',
),
'label' => esc_html__( 'Auto-convert:', 'w3-total-cache' ),
'control' => 'radiogroup',
'radiogroup_values' => array(
'enabled' => 'Enabled',
'disabled' => 'Disabled',
),
'description' => esc_html__( 'Auto-convert images on upload.', 'w3-total-cache' ),
'disabled' => false,
)
);
Util_Ui::config_item(
array(
'key' => array(
'imageservice',
'visibility',
),
'label' => esc_html__( 'Visibility:', 'w3-total-cache' ),
'control' => 'selectbox',
'selectbox_values' => array(
'never' => array( 'label' => __( 'Never', 'w3-total-cache' ) ),
'extension' => array( 'label' => __( 'If extension is active', 'w3-total-cache' ) ),
'always' => array( 'label' => __( 'Always', 'w3-total-cache' ) ),
),
'description' => esc_html__( 'Show converted image attachments in the Media Library.', 'w3-total-cache' ),
'disabled' => false,
)
);
?>
</table>
<?php
Util_Ui::button_config_save( 'extension_imageservice_configuration' );
Util_Ui::postbox_footer();
Util_Ui::postbox_header( esc_html__( 'Tools', 'w3-total-cache' ), '', '' );
?>
<table class="form-table" id="w3tc-imageservice-tools">
<?php
Util_Ui::config_item(
array(
'key' => null,
'label' => esc_html__( 'Convert all images:', 'w3-total-cache' ),
'label_class' => 'w3tc-imageservice-all',
'control' => 'button',
'none_label' => 'Convert All',
'description' => esc_html__( 'Convert all images in the media library.', 'w3-total-cache' ),
)
);
Util_Ui::config_item(
array(
'key' => null,
'label' => esc_html__( 'Revert all images:', 'w3-total-cache' ),
'label_class' => 'w3tc-imageservice-revertall',
'control' => 'button',
'none_label' => 'Revert All',
'description' => esc_html__( 'Revert all converted images in the media library.', 'w3-total-cache' ),
)
);
?>
</table>
<?php
Util_Ui::postbox_footer();
Util_Ui::postbox_header(
esc_html__( 'Statistics', 'w3-total-cache' ),
'',
'w3tc-imageservice-statistics'
);
?>
<table class="form-table" id="w3tc-imageservice-stats">
<tr>
<th><?php esc_html_e( 'Counts and filesizes by status:', 'w3-total-cache' ); ?></th>
<td>
<table id="w3tc-imageservice-counts">
<tr>
<td><?php esc_html_e( 'Total:', 'w3-total-cache' ); ?></td>
<td id="w3tc-imageservice-total"><?php echo esc_html( $counts['total'] ); ?></td>
<td id="w3tc-imageservice-totalbytes"><?php echo esc_html( size_format( $counts['totalbytes'], 2 ) ); ?></td>
</tr>
<tr>
<td><?php esc_html_e( 'Converted:', 'w3-total-cache' ); ?></td>
<td id="w3tc-imageservice-converted"><?php echo esc_html( $counts['converted'] ); ?></td>
<td id="w3tc-imageservice-convertedbytes"><?php echo esc_html( size_format( $counts['convertedbytes'], 2 ) ); ?></td>
</tr>
<tr>
<td><?php esc_html_e( 'Sending:', 'w3-total-cache' ); ?></td>
<td id="w3tc-imageservice-sending"><?php echo esc_html( $counts['sending'] ); ?></td>
<td id="w3tc-imageservice-sendingbytes"><?php echo esc_html( size_format( $counts['sendingbytes'], 2 ) ); ?></td>
</tr>
<tr>
<td><?php esc_html_e( 'Processing:', 'w3-total-cache' ); ?></td>
<td id="w3tc-imageservice-processing"><?php echo esc_html( $counts['processing'] ); ?></td>
<td id="w3tc-imageservice-processingbytes"><?php echo esc_html( size_format( $counts['processingbytes'], 2 ) ); ?></td>
</tr>
<tr>
<td><?php esc_html_e( 'Not converted:', 'w3-total-cache' ); ?></td>
<td id="w3tc-imageservice-notconverted"><?php echo esc_html( $counts['notconverted'] ); ?></td>
<td id="w3tc-imageservice-notconvertedbytes"><?php echo esc_html( size_format( $counts['notconvertedbytes'], 2 ) ); ?></td>
</tr>
<tr>
<td><?php esc_html_e( 'Unconverted:', 'w3-total-cache' ); ?></td>
<td id="w3tc-imageservice-unconverted"><?php echo esc_html( $counts['unconverted'] ); ?></td>
<td id="w3tc-imageservice-unconvertedbytes"><?php echo esc_html( size_format( $counts['unconvertedbytes'], 2 ) ); ?></td>
</tr>
<tr><td height="10"></td></tr>
<tr>
<td colspan="3"><input id="w3tc-imageservice-refresh-counts" class="button" type="button" value="<?php esc_attr_e( 'Refresh', 'w3-total-cache' ); ?>" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<th><?php esc_html_e( 'Image Service API usage:', 'w3-total-cache' ); ?></th>
<td>
<table id="w3tc-imageservice-usage">
<tr>
<td><?php esc_html_e( 'Hourly requests:', 'w3-total-cache' ); ?></td>
<td id="w3tc-imageservice-usage-hourly"><?php echo esc_html( $usage['usage_hourly'] ); ?></td>
</tr>
<tr>
<td><?php esc_html_e( 'Hourly limit:', 'w3-total-cache' ); ?></td>
<td id="w3tc-imageservice-limit-hourly"><?php echo esc_html( $usage['limit_hourly'] ); ?></td>
</tr>
<tr>
<td><?php esc_html_e( 'Monthly requests:', 'w3-total-cache' ); ?></td>
<td id="w3tc-imageservice-usage-monthly"><?php echo esc_html( $usage['usage_monthly'] ); ?></td>
</tr>
<tr>
<td><?php esc_html_e( 'Monthly limit:', 'w3-total-cache' ); ?></td>
<td id="w3tc-imageservice-limit-monthly"><?php echo esc_html( $usage['limit_monthly'] ); ?></td>
</tr>
<tr><td height="10"></td></tr>
<tr>
<td colspan="3"><input id="w3tc-imageservice-refresh-usage" class="button" type="button" value="<?php esc_attr_e( 'Refresh', 'w3-total-cache' ); ?>" /></td>
</tr>
</table>
</td>
</tr>
</table>
<?php Util_Ui::postbox_footer(); ?>
</div>
</form>
</div>