PluginProbe ʕ •ᴥ•ʔ
TinyPNG – JPEG, PNG & WebP image compression / 3.8.0
TinyPNG – JPEG, PNG & WebP image compression v3.8.0
3.8.0 3.7.0 3.6.14 trunk 1.0.0 1.1.0 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.4.0 1.5.0 1.6.0 1.7.0 1.7.1 1.7.2 2.0.0 2.0.1 2.0.2 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.0.0 3.0.1 3.1.0 3.2.0 3.2.1 3.3 3.4 3.4.1 3.4.2 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.5.2 3.6.0 3.6.1 3.6.10 3.6.11 3.6.12 3.6.13 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9
tiny-compress-images / src / views / bulk-optimization.php
tiny-compress-images / src / views Last commit date
account-status-connected.php 2 months ago account-status-create-advanced.php 2 months ago account-status-create-simple.php 2 months ago account-status-loading.php 4 years ago bulk-optimization-form.php 7 months ago bulk-optimization-upgrade-notice.php 2 months ago bulk-optimization.php 2 months ago compress-details-processing.php 2 months ago compress-details.php 2 months ago dashboard-widget.php 2 months ago notice-feedback.php 2 months ago optimization-chart.php 2 months ago request-review.php 4 months ago settings-conversion-delivery.php 4 months ago settings-conversion-enabled.php 4 months ago settings-conversion-output.php 4 months ago settings-conversion.php 4 months ago settings-diagnostics.php 7 months ago settings-original-image-original.php 4 months ago settings-original-image-preserve.php 4 months ago settings-original-image.php 1 week ago settings.php 4 months ago
bulk-optimization.php
347 lines
1 <?php
2 /**
3 * Bulk optimization view.
4 *
5 * @var array $admin_colors
6 * @var array $stats
7 * @var array $active_tinify_sizes
8 * @var float $estimated_costs
9 * @var string $email_address
10 * @var bool $is_on_free_plan
11 * @var int $remaining_credits
12 * @var Tiny_Plugin $this
13 */
14
15 $total_sizes = $stats['optimized-image-sizes'] + $stats['available-unoptimized-sizes'];
16 $settings_url = admin_url( 'options-general.php?page=tinify' );
17 $friendly_name = $this->friendly_user_name();
18 ?>
19 <style>
20
21 /* Admin color scheme colors */
22
23 div.tiny-bulk-optimization div.available div.tooltip span.dashicons {
24 color: <?php echo esc_attr( $admin_colors[3] ); ?>;
25 }
26 div.tiny-bulk-optimization div.savings div.tiny-optimization-chart div.value {
27 color: <?php echo esc_attr( $admin_colors[2] ); ?>;
28 }
29 div.tiny-bulk-optimization div.savings div.tiny-optimization-chart svg circle.main {
30 stroke: <?php echo esc_attr( $admin_colors[2] ); ?>;
31 }
32 div.tiny-bulk-optimization div.savings table td.emphasize {
33 color: <?php echo esc_attr( $admin_colors[2] ); ?>;
34 }
35 div.tiny-bulk-optimization div.dashboard div.optimize div.progressbar div.progress {
36 background-color: <?php echo esc_attr( $admin_colors[0] ); ?>;
37 background-image: linear-gradient(
38 -63deg,
39 <?php echo esc_attr( $admin_colors[0] ); ?> 0%,
40 <?php echo esc_attr( $admin_colors[0] ); ?> 25%,
41 <?php echo esc_attr( $admin_colors[1] ); ?> 25%,
42 <?php echo esc_attr( $admin_colors[1] ); ?> 50%,
43 <?php echo esc_attr( $admin_colors[0] ); ?> 50%,
44 <?php echo esc_attr( $admin_colors[0] ); ?> 75%,
45 <?php echo esc_attr( $admin_colors[1] ); ?> 75%,
46 <?php echo esc_attr( $admin_colors[1] ); ?> 100%
47 );
48 }
49
50 </style>
51
52 <div class="wrap tiny-bulk-optimization tiny-compress-images" id="tiny-bulk-optimization">
53 <div class="icon32" id="icon-upload"><br></div>
54 <h2><?php esc_html_e( 'Bulk Optimization', 'tiny-compress-images' ); ?></h2>
55 <div class="dashboard">
56 <div class="statistics">
57 <div class="available">
58 <div class="inner">
59 <h3><?php esc_html_e( 'Available Images', 'tiny-compress-images' ); ?></h3>
60 <p>
61 <?php
62 if ( 0 == $total_sizes ) {
63 $percentage = 0;
64 } else {
65 $percentage_of_files = round( $stats['optimized-image-sizes'] / $total_sizes * 100, 2 );
66 }
67 if ( 0 == $stats['uploaded-images'] + $stats['available-unoptimized-sizes'] ) {
68 esc_html_e( 'This page is designed to bulk optimize all your images.', 'tiny-compress-images' );
69 echo ' ';
70 esc_html_e( 'You do not seem to have uploaded any JPEG, PNG or WebP images yet.', 'tiny-compress-images' );
71 } elseif ( 0 == count( $active_tinify_sizes ) ) {
72 esc_html_e( 'Based on your current settings, nothing will be optimized. There are no active sizes selected for optimization.', 'tiny-compress-images' );
73 } elseif ( 0 == $stats['available-unoptimized-sizes'] ) {
74 /* translators: %s: friendly user name */
75 printf( esc_html__( '%s, this is great! Your entire library is optimized!', 'tiny-compress-images' ), esc_html( $friendly_name ) );
76 echo '<br />';
77 require __DIR__ . '/request-review.php';
78 } elseif ( $stats['optimized-image-sizes'] > 0 ) {
79 if ( $percentage_of_files > 75 ) {
80 /* translators: %s: friendly user name */
81 printf( esc_html__( '%s, you are doing great!', 'tiny-compress-images' ), esc_html( $friendly_name ) );
82 } else {
83 /* translators: %s: friendly user name */
84 printf( esc_html__( '%s, you are doing good.', 'tiny-compress-images' ), esc_html( $friendly_name ) );
85 }
86 echo ' ';
87 /* translators: %1$d%2$s: percentage optimised */
88 printf( esc_html__( '%1$d%2$s of your image library is optimized.', 'tiny-compress-images' ), absint( $percentage_of_files ), '%' );
89 echo ' ';
90 /* translators: %s: bulk optimization title */
91 printf( esc_html__( 'Start the %s to optimize the remainder of your library.', 'tiny-compress-images' ), esc_html__( 'bulk optimization', 'tiny-compress-images' ) );
92 } else {
93 esc_html_e( 'Here you can start optimizing your entire library. Press the big button to start improving your website speed instantly!', 'tiny-compress-images' );
94 }
95 ?>
96 </p>
97 <?php if ( Tiny_Settings::wr2x_active() ) { ?>
98 <p>
99 <?php esc_html_e( 'Notice that the WP Retina 2x sizes will not be compressed using this page. You will need to bulk generate the retina sizes separately from the WP Retina 2x page.', 'tiny-compress-images' ); ?>
100 </p>
101 <?php } ?>
102 <table class="totals">
103 <tr>
104 <td class="item">
105 <h3>
106 <?php
107 echo wp_kses(
108 __( 'Uploaded <br> images', 'tiny-compress-images' ),
109 array(
110 'br' => array(),
111 )
112 )
113 ?>
114 </h3>
115 <span id="uploaded-images">
116 <?php echo esc_html( $stats['uploaded-images'] ); ?>
117 </span>
118 </td>
119 <td class="item">
120 <h3>
121 <?php
122 echo wp_kses(
123 __( 'Unoptimized <br> image sizes', 'tiny-compress-images' ),
124 array(
125 'br' => array(),
126 )
127 )
128 ?>
129 </h3>
130 <span id="optimizable-image-sizes">
131 <?php echo esc_html( $stats['available-unoptimized-sizes'] ); ?>
132 </span>
133 <div class="tooltip">
134 <span class="dashicons dashicons-info"></span>
135 <div class="tip">
136 <?php if ( $stats['uploaded-images'] > 0 && count( $active_tinify_sizes ) > 0 && $stats['available-unoptimized-sizes'] > 0 ) { ?>
137 <p>
138 <?php
139 printf(
140 /* translators: %1$s: number of sizes that can be optimised, %2$s number of images */
141 esc_html__(
142 'With your current settings you can still optimize %1$s image sizes from your %2$s uploaded JPEG, PNG, and WebP images.',
143 'tiny-compress-images'
144 ),
145 esc_html( $stats['available-unoptimized-sizes'] ),
146 esc_html( $stats['uploaded-images'] )
147 );
148 ?>
149 </p>
150 <?php } ?>
151 <p>
152 <?php
153 if ( 0 == count( $active_tinify_sizes ) ) {
154 esc_html_e( 'Based on your current settings, nothing will be optimized. There are no active sizes selected for optimization.', 'tiny-compress-images' );
155 } else {
156 esc_html_e( 'These sizes are currently activated for optimization:', 'tiny-compress-images' );
157 echo '<ul>';
158 $active_tinify_sizes_count = count( $active_tinify_sizes );
159 for ( $i = 0; $i < $active_tinify_sizes_count; ++$i ) {
160 $name = $active_tinify_sizes[ $i ];
161 if ( '0' == $name ) {
162 echo '<li>- ' . esc_html__( 'Original image', 'tiny-compress-images' ) . '</li>';
163 } else {
164 echo '<li>- ' . esc_html( ucfirst( $name ) ) . '</li>';
165 }
166 }
167 echo '</ul>';
168 }
169 ?>
170 </p>
171 <p>
172 <?php if ( count( $active_tinify_sizes ) > 0 ) { ?>
173 <?php
174 printf(
175 wp_kses(
176 /* translators: %d: number of sizes to be compressed */
177 _n( 'For each uploaded image <strong>%d size</strong> is optimized.', 'For each uploaded image <strong>%d sizes</strong> are optimized.', count( $active_tinify_sizes ), 'tiny-compress-images' ),
178 array(
179 'strong' => array(),
180 )
181 ),
182 count( $active_tinify_sizes )
183 )
184 ?>
185 <?php } ?>
186 <?php
187 printf(
188 wp_kses(
189 /* translators: %s: link to settings page saying here */
190 __( 'You can change these settings %s.', 'tiny-compress-images' ),
191 array(
192 'a' => array(
193 'href' => array(),
194 ),
195 )
196 ),
197 '<a href="' . esc_url( $settings_url ) . '">' . esc_html__( 'here', 'tiny-compress-images' ) . '</a>'
198 )
199 ?>
200 </p>
201 </div>
202 </div>
203 </td>
204 <td class="item costs">
205 <h3>
206 <?php
207 echo wp_kses(
208 __( 'Estimated <br> cost', 'tiny-compress-images' ),
209 array(
210 'br' => array(),
211 )
212 )
213 ?>
214 </h3>
215 <span id="estimated-cost">$ <?php echo number_format( $estimated_costs, 2 ); ?></span>
216 USD
217 <?php if ( $estimated_costs > 0 ) { ?>
218 <div class="tooltip">
219 <span class="dashicons dashicons-info"></span>
220 <div class="tip">
221 <p>
222 <?php
223 printf(
224 wp_kses(
225 /* translators: %1$d %2$s: number of image sizes, %3$s: link saying upgrade here */
226 __( 'If you wish to compress more than <strong>%1$d %2$s</strong> a month and you are still on a free account %3$s.', 'tiny-compress-images' ),
227 array(
228 'strong' => array(),
229 'a' => array(
230 'href' => array(),
231 ),
232 )
233 ),
234 (int) Tiny_Config::MONTHLY_FREE_COMPRESSIONS,
235 esc_html__( 'image sizes', 'tiny-compress-images' ),
236 '<a target="_blank" href="' . esc_url( 'https://tinypng.com/dashboard/api?type=upgrade&mail=' . str_replace( '%20', '%2B', rawurlencode( $email_address ) ) ) . '">' . esc_html__( ' upgrade here', 'tiny-compress-images' ) . '</a>'
237 );
238 ?>
239 </p>
240 </div>
241 </div>
242 <?php } ?>
243 </td>
244 </tr>
245 </table>
246 <div class="notes">
247 <?php
248 printf(
249 wp_kses(
250 /* translators: %s: link to settings page saying here */
251 __( 'Configure compression settings %s.', 'tiny-compress-images' ),
252 array(
253 'a' => array(
254 'href' => array(),
255 ),
256 )
257 ),
258 '<a href="' . esc_url( $settings_url ) . '">' . esc_html__( 'here', 'tiny-compress-images' ) . '</a>'
259 )
260 ?>
261 </div>
262 </div>
263 </div>
264 <div class="savings">
265 <div class="inner">
266 <h3><?php esc_html_e( 'Total Savings', 'tiny-compress-images' ); ?></h3>
267 <p>
268 <?php esc_html_e( 'Statistics based on all available JPEG, PNG, and WebP images in your media library.', 'tiny-compress-images' ); ?>
269 </p>
270 <?php
271 require_once __DIR__ . '/optimization-chart.php';
272 ?>
273 <div class="legend">
274 <table>
275 <tr>
276 <td id="optimized-image-sizes" class="value emphasize">
277 <?php echo esc_html( $stats['optimized-image-sizes'] ); ?>
278 </td>
279 <td class="description">
280 <?php echo esc_html( _n( 'image size optimized', 'image sizes optimized', $stats['optimized-image-sizes'], 'tiny-compress-images' ) ); ?>
281 </td>
282 </tr>
283 <tr>
284 <td id="unoptimized-library-size" class="value" data-bytes="<?php echo esc_attr( $stats['unoptimized-library-size'] ); ?>" >
285 <?php echo esc_html( $stats['unoptimized-library-size'] ? size_format( $stats['unoptimized-library-size'], 2 ) : '-' ); ?>
286 </td>
287 <td class="description">
288 <?php esc_html_e( 'initial size', 'tiny-compress-images' ); ?>
289 </td>
290 </tr>
291 <tr>
292 <td id="optimized-library-size" class="value emphasize" data-bytes="<?php echo esc_attr( $stats['optimized-library-size'] ); ?>" class="green">
293 <?php echo esc_html( $stats['optimized-library-size'] ? size_format( $stats['optimized-library-size'], 2 ) : '-' ); ?>
294 </td>
295 <td class="description">
296 <?php esc_html_e( 'current size', 'tiny-compress-images' ); ?>
297 </td>
298 </tr>
299 </table>
300 </div>
301 </div>
302 </div>
303 </div>
304 <?php $show_notice = $is_on_free_plan && $stats['available-unoptimized-sizes'] > $remaining_credits; ?>
305 <div class="optimize">
306 <div class="progressbar" id="compression-progress-bar" data-number-to-optimize="<?php echo esc_attr( $total_sizes ); ?>" data-amount-optimized="0" style="<?php echo $show_notice ? 'display:none;' : ''; ?>">
307 <div id="progress-size" class="progress">
308 </div>
309 <div class="numbers" >
310 <span id="optimized-so-far"><?php echo esc_html( $stats['optimized-image-sizes'] ); ?></span>
311 /
312 <span><?php echo esc_html( $total_sizes ); ?></span>
313 <span id="percentage"></span>
314 </div>
315 </div>
316 <?php
317 if ( $stats['available-unoptimized-sizes'] > 0 ) {
318 require_once __DIR__ . '/bulk-optimization-form.php';
319 }
320 ?>
321 </div>
322 <?php
323 if ( $show_notice ) {
324 require_once __DIR__ . '/bulk-optimization-upgrade-notice.php';
325 }
326 ?>
327 </div>
328 <script type="text/javascript">
329 <?php echo 'jQuery(function() { bulkOptimization(' . json_encode( $stats['available-for-optimization'] ) . ')})'; ?>
330 </script>
331 <table class="wp-list-table widefat fixed striped media whitebox" id="optimization-items" >
332 <thead>
333 <tr>
334 <?php // column-author WP 3.8-4.2 mobile view ?>
335 <th class="thumbnail"></th>
336 <th class="column-primary" ><?php esc_html_e( 'File', 'tiny-compress-images' ); ?></th>
337 <th class="column-author"><?php esc_html_e( 'Initial Size', 'tiny-compress-images' ); ?></th>
338 <th class="column-author"><?php esc_html_e( 'Current Size', 'tiny-compress-images' ); ?></th>
339 <th class="column-author savings"><?php esc_html_e( 'Savings', 'tiny-compress-images' ); ?></th>
340 <th class="column-author status"><?php esc_html_e( 'Status', 'tiny-compress-images' ); ?></th>
341 </tr>
342 </thead>
343 <tbody>
344 </tbody>
345 </table>
346 </div>
347