PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 1.4.2
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v1.4.2
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / inc / admin / ui / bulk.php

bulk.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 1.4.2, at inc/admin/ui/bulk.php

294 lines 14.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
4 /**
5 * The main settings page construtor using the required functions from WP
6 *
7 * @since 1.0
8 */
9 function _imagify_display_bulk_page() {
10 $user = new Imagify_User();
11 ?>
12 <div class="wrap imagify-settings imagify-bulk">
13 <div class="imagify-title">
14 <?php if ( ! defined( 'IMAGIFY_HIDDEN_ACCOUNT' ) || false === IMAGIFY_HIDDEN_ACCOUNT ) { ?>
15 <div class="imagify-title-right">
16 <div class="imagify-account">
17 <p class="imagify-meteo-title"><?php _e( 'Account status', 'imagify' ); ?></p>
18 <p class="imagify-meteo-subs"><?php _e( 'Your subscription:', 'imagify' ); ?>&nbsp;<strong class="imagify-user-plan"><?php echo $user->plan_label; ?></strong></p>
19 </div>
20 <div class="imagify-account-link">
21 <a href="<?php echo IMAGIFY_APP_MAIN; ?>/#/subscription" class="button button-ghost" target="_blank">
22 <span class="dashicons dashicons-admin-users"></span>
23 <span class="button-text"><?php _e( 'View My Subscription', 'imagify' ); ?></span>
24 </a>
25 </div>
26
27 <?php if ( 1 === $user->plan_id ) { ?>
28 <div class="imagify-sep-v"></div>
29 <div class="imagify-credit-left">
30 <?php
31 $unconsumed_quota = $user->get_percent_unconsumed_quota();
32 $meteo_icon = '<img src="' . IMAGIFY_ASSETS_IMG_URL . 'sun.svg" width="37" height="38" alt="" />';
33 $bar_class = 'positive';
34 $is_display_bubble = false;
35
36 if( $unconsumed_quota >= 21 && $unconsumed_quota <= 50 ) {
37 $bar_class = 'neutral';
38 $meteo_icon = '<img src="' . IMAGIFY_ASSETS_IMG_URL . 'cloudy-sun.svg" width="37" height="38" alt="" />';
39 } elseif( $unconsumed_quota <= 20 ) {
40 $bar_class = 'negative';
41 $is_display_bubble = true;
42 $meteo_icon = '<img src="' . IMAGIFY_ASSETS_IMG_URL . 'stormy.svg" width="38" height="36" alt="" />';
43 }
44 ?>
45 <span class="imagify-meteo-icon"><?php echo $meteo_icon; ?></span>
46 <div class="imagify-space-left">
47
48 <p><?php printf( __( 'You have %s space credit left' , 'imagify' ), '<span class="imagify-unconsumed-percent">' . $unconsumed_quota . '%</span>' ); ?></p>
49
50 <div class="imagify-bar-<?php echo $bar_class; ?>">
51 <div class="imagify-unconsumed-bar imagify-progress" style="width: <?php echo $unconsumed_quota . '%'; ?>;"></div>
52 </div>
53 </div>
54 <div class="imagify-space-tooltips imagify-tooltips <?php echo ( ! $is_display_bubble ) ? 'hidden' : ''; ?>">
55 <div class="tooltip-content tooltip-table">
56 <div class="cell-icon">
57 <span aria-hidden="true" class="icon icon-round">i</span>
58 </div>
59 <div class="cell-text">
60 <?php _e( 'Upgrade your account to continue optimizing your images', 'imagify' ); ?>
61 </div>
62 <div class="cell-sep"></div>
63 <div class="cell-cta">
64 <a href="<?php echo IMAGIFY_APP_MAIN; ?>/#/subscription" target="_blank"><?php _e( 'More info', 'imagify' ); ?></a>
65 </div>
66 </div>
67 </div>
68 </div>
69 <?php } ?>
70 </div>
71 <?php } ?>
72
73 <img width="225" height="26" alt="Imagify" src="<?php echo IMAGIFY_ASSETS_IMG_URL; ?>imagify-logo.png" class="imagify-logo" />
74 </div>
75
76 <div class="imagify-sub-title">
77 <svg class="icon icon-bulk" viewBox="0 0 38 36" width="38" height="36" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="m233.09 177.21l-5.52 10.248c-.08.145-.018.272-.023.388-.074.193-.033.4-.033.619v21.615c0 .952.601 1.429 1.552 1.429h33.897c.952 0 1.962-.478 1.962-1.429v-21.615c0-.487-.323-.925-.649-1.24l-5.623-9.976c-.405-.726-1.202-1.179-2.034-1.182l-21.486-.068c-.849 0-1.64.464-2.043 1.211m30.424 32.869c0 .173-.378.018-.551.018h-33.897c-.172 0-.14.155-.14-.018v-21.576l33.961-.281c.066.008.186.09.263.128.054.027.205.049.258.073.002.014.106.027.106.041v21.615m-6.153-32.11l4.91 8.835h-14.992v-9.354l9.306.045c.322.001.619.192.776.474m-11.494-.523v9.358h-16.306l4.773-8.892c.155-.289.456-.484.787-.484l10.746.018m7.06 17.12c0 .39-.316.706-.706.706h-12.706c-.39 0-.706-.316-.706-.706 0-.39.316-.706.706-.706h12.706c.39 0 .706.316.706.706" transform="translate(-227-176)" fill="#7a8996"/></g></svg>
78 <span class="title-text">
79 <?php _e( 'Bulk Optimization', 'imagify' ); ?>
80 <small><sup><?php echo IMAGIFY_VERSION; ?></sup></small>
81 </span>
82 </div>
83
84 <div class="imagify-settings-section">
85
86 <div class="imagify-columns">
87
88 <div class="col-1-3 col-informations">
89 <h3><?php _e( 'Information', 'imagify' ); ?></h3>
90 <ul class="imagify-list-dash">
91 <li><strong><?php _e( 'Please be aware that optimizing a large number of images can take a while depending on your server and network speed.', 'imagify' ); ?></strong></li>
92 <li><?php _e( 'You must keep this page open while the bulk optimizaton is processing. If you leave you can come back to continue where it left off.', 'imagify' ); ?></li>
93 </ul>
94
95 <div class="imagify-bulk-submit">
96
97 <?php if ( get_imagify_option( 'backup', 0 ) == "1" ) { ?>
98
99 <p>
100 <strong><?php _e( 'Select Your Compression Level', 'imagify' ); ?></strong>
101 <br>
102 <?php
103 $default_set = __( 'Ultra', 'imagify' );
104 switch( get_imagify_option( 'optimization_level' ) ) {
105 case '1':
106 $default_set = __( 'Aggressive', 'imagify' );
107 break;
108 case '0':
109 $default_set = __( 'Normal', 'imagify' );
110 break;
111 }
112
113 _e( 'Your default setting:', 'imagify' );
114 echo '&nbsp;<strong class="imagify-primary">' . $default_set . '</strong>';
115 ?>
116 </p>
117
118 <p class="imagify-inline-options">
119 <input type="radio" id="imagify-optimization_level_normal" name="optimization_level" value="0" <?php checked( get_imagify_option( 'optimization_level' ), 0 ); ?>>
120 <label for="imagify-optimization_level_normal">
121 <?php _e( 'Normal', 'imagify' ); ?>
122 </label>
123
124 <input type="radio" id="imagify-optimization_level_aggro" name="optimization_level" value="1" <?php checked( get_imagify_option( 'optimization_level' ), 1 ); ?>>
125 <label for="imagify-optimization_level_aggro">
126 <?php _e( 'Aggressive', 'imagify' ); ?>
127 </label>
128
129 <input type="radio" id="imagify-optimization_level_ultra" name="optimization_level" value="2" <?php checked( get_imagify_option( 'optimization_level' ), 2 ); ?>>
130 <label for="imagify-optimization_level_ultra">
131 <?php _e( 'Ultra', 'imagify' ); ?>
132 </label>
133 </p>
134
135 <?php
136 }
137 else {
138 ?>
139 <p>
140 <strong><?php printf( __( 'Don\'t forget to check %syour settings%s before bulk optimization.', 'imagify' ), '<a href="' . get_imagify_admin_url() . '">', '</a>' ); ?></strong>
141 </p>
142 <?php
143 }
144 ?>
145
146 <p>
147 <?php wp_nonce_field( 'imagify-bulk-upload', 'imagifybulkuploadnonce' ); ?>
148 <button id="imagify-bulk-action" type="button" class="button button-primary">
149 <span class="dashicons dashicons-admin-generic"></span>
150 <span class="button-text"><?php _e( 'Imagif\'em all', 'imagify'); ?></span>
151 </button>
152 <?php
153 if ( $user->is_free() ) { ?>
154 <span class="imagify-tooltips right">
155 <span class="tooltip-content">
156 <span class="icon icon-round" aria-hidden="true">i</span>
157 <?php printf( __( 'All images which are over to %s could be optimized using the pro version.', 'imagify' ), size_format( IMAGIFY_MAX_BYTES , 0 ) ); ?>
158 </span>
159 </span>
160 <?php
161 }
162 ?>
163 </p>
164 </div>
165 </div>
166
167 <div class="col-1-3">
168 <h3><?php _e( 'Overview', 'imagify' ); ?></h3>
169
170 <div class="imagify-chart-container">
171 <canvas id="imagify-overview-chart" width="180" height="180"></canvas>
172 <div id="imagify-overview-chart-percent" class="imagify-chart-percent"><?php echo imagify_percent_optimized_attachments(); ?><span>%</span></div>
173 </div>
174 <div id="imagify-overview-chart-legend"></div>
175 </div>
176
177 <div class="col-1-3 col-statistics">
178 <h3><?php _e( 'Statistics', 'imagify' ); ?></h3>
179
180 <?php
181 $total_saving_data = imagify_count_saving_data();
182 $optimized_percent = $total_saving_data['percent'];
183 $optimized_nb = $total_saving_data['optimized_size'];
184 $original_nb = $total_saving_data['original_size'];
185 ?>
186
187 <div class="imagify-number-you-optimized">
188 <p>
189 <span id="imagify-total-optimized-attachments" class="number"><?php echo number_format_i18n( $total_saving_data['count'] ); ?></span>
190 <span class="text"><?php printf( __( 'that\'s the number of images you optimized with Imagify', 'imagify' ), '<br>' ); ?></span>
191 </p>
192 </div>
193
194 <div class="imagify-bars">
195 <p><?php _e( 'Original size', 'imagify' ); ?></p>
196 <div class="imagify-bar-negative base-transparent right-outside-number">
197 <div id="imagify-original-bar" class="imagify-progress" style="width: 100%"><span class="imagify-barnb"><?php echo size_format( $original_nb, 1 ); ?></span></div>
198 </div>
199
200 <p><?php _e( 'Optimized size', 'imagify' ); ?></p>
201 <div class="imagify-bar-positive base-transparent right-outside-number">
202
203 <div id="imagify-optimized-bar" class="imagify-progress" style="width: <?php echo $optimized_percent; ?>%"><span class="imagify-barnb"><?php echo size_format( $optimized_nb, 1 ); ?></span></div>
204 </div>
205
206 </div>
207
208 <div class="imagify-number-you-optimized">
209 <p>
210 <span id="imagify-total-optimized-attachments-pct" class="number"><?php echo number_format_i18n( imagify_count_saving_data('percent') ); ?>%</span>
211 <span class="text"><?php printf( __( 'that\'s the size you saved %sby using Imagify', 'imagify' ), '<br>' ); ?></span>
212 </p>
213 </div>
214 </div>
215
216 </div>
217 </div><!-- .imagify-settings-section -->
218
219 <!-- The Success/Complete bar -->
220 <div class="imagify-row-complete hidden" aria-hidden="true">
221 <div class="imagify-all-complete">
222 <div class="imagify-ac-report">
223 <div class="imagify-ac-chart" data-percent="0">
224 <span class="imagify-chart">
225 <span class="imagify-chart-container">
226 <canvas width="46" height="46"></canvas>
227 </span>
228 </span>
229 </div>
230 <div class="imagify-ac-report-text">
231 <p class="imagify-ac-rt-big"><?php _e( 'Well done!', 'imagify' ); ?></p>
232 <p><?php printf( __( 'you saved %1$s out of %2$s', 'imagify' ), '<strong class="imagify-ac-rt-total-gain"></strong>', '<strong class="imagify-ac-rt-total-original"></strong>' ); ?></p>
233 </div>
234 </div>
235 <div class="imagify-ac-share">
236 <div class="imagify-ac-share-content">
237 <p><?php _e( 'Share your awesome result', 'imagify' ); ?></p>
238 <ul class="imagify-share-networks">
239 <li>
240 <a target="_blank" class="imagify-sn-twitter" href=""><svg viewBox="0 0 23 18" width="23" height="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><title>Twitter</title><path d="m244.15 12.13c-.815.361-1.691.606-2.61.716.939-.563 1.659-1.453 1.998-2.514-.878.521-1.851.898-2.886 1.103-.829-.883-2.01-1.435-3.317-1.435-2.51 0-4.544 2.034-4.544 4.544 0 .356.04.703.118 1.035-3.777-.19-7.125-1.999-9.367-4.748-.391.671-.615 1.452-.615 2.285 0 1.576.802 2.967 2.02 3.782-.745-.024-1.445-.228-2.058-.568-.001.019-.001.038-.001.057 0 2.202 1.566 4.04 3.646 4.456-.381.104-.783.159-1.197.159-.293 0-.577-.028-.855-.081.578 1.805 2.256 3.119 4.245 3.156-1.555 1.219-3.515 1.945-5.644 1.945-.367 0-.728-.021-1.084-.063 2.01 1.289 4.399 2.041 6.966 2.041 8.359 0 12.929-6.925 12.929-12.929 0-.197-.004-.393-.013-.588.888-.64 1.658-1.44 2.268-2.352" transform="translate(-222-10)" fill="#fff"/></g></svg></a>
241 </li>
242 <li>
243 <a target="_blank" class="imagify-sn-twitter-facebook" href="<?php echo esc_url('https://www.facebook.com/sharer/sharer.php?u=https://wordpress.org/plugins/imagify' ); ?>"><svg viewBox="0 0 18 18" width="18" height="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><title>Facebook</title><path d="m203.25 10h-16.5c-.415 0-.75.336-.75.75v16.5c0 .414.336.75.75.75h8.812v-6.75h-2.25v-2.813h2.25v-2.25c0-2.325 1.472-3.469 3.546-3.469.993 0 1.847.074 2.096.107v2.43h-1.438c-1.128 0-1.391.536-1.391 1.322v1.859h2.813l-.563 2.813h-2.25l.045 6.75h4.83c.414 0 .75-.336.75-.75v-16.5c0-.414-.336-.75-.75-.75" transform="translate(-186-10)" fill="#fff"/></g></svg></a>
244 </li>
245 </ul>
246 </div>
247 </div>
248 </div>
249 </div>
250
251 <div class="imagify-bulk-table">
252 <table summary="<?php _e( 'Compression process results', 'imagify' ); ?>">
253 <thead>
254 <tr>
255 <th class="imagify-cell-filename"><?php _e( 'Filename', 'imagify' ); ?></th>
256 <th class="imagify-cell-status"><?php _e( 'Status', 'imagify' ); ?></th>
257 <th class="imagify-cell-original"><?php _e( 'Original', 'imagify' ); ?></th>
258 <th class="imagify-cell-optimized"><?php _e( 'Optimized', 'imagify' ); ?></th>
259 <th class="imagify-cell-percentage"><?php _e( 'Percentage', 'imagify' ); ?></th>
260 <th class="imagify-cell-thumbnails"><?php _e( 'Thumbnails optimized', 'imagify' ); ?></th>
261 <th class="imagify-cell-savings"><?php _e( 'Overall saving', 'imagify' ); ?></th>
262 </tr>
263 </thead>
264 <tfoot>
265 <tr>
266 <td class="imagify-cell-nb-files"><span class="imagify-nb-files">0</span> <?php _e( 'file', 'imagify' ); ?></td>
267 <td class="imagify-cell-errors"><span class="imagify-nb-errors">0</span> <?php _e( 'error', 'imagify' ); ?></td>
268 <td class="imagify-cell-totaloriginal" colspan="4"><?php _e( 'Total:', 'imagify' ); ?> <strong><span class="imagify-total-original">0Mb</span></strong></td>
269 <td class="imagify-cell-totalgain"><?php _e( 'Gain:', 'imagify' ); ?> <strong><span class="imagify-total-gain">0Mb</span></strong></td>
270 </tr>
271 </tfoot>
272 <tbody>
273 <!-- The progress bar -->
274 <tr aria-hidden="true" class="imagify-row-progress hidden">
275 <td colspan="7">
276 <div class="media-item">
277 <div class="progress">
278 <div id="imagify-progress-bar" class="bar"><div class="percent">0%</div></div>
279 </div>
280 </div>
281 </td>
282 </tr>
283 <!-- No image uploaded yet -->
284 <tr class="imagify-no-uploaded-yet">
285 <td colspan="7">
286 <p><?php printf( __( '%sStart the bulk optimization%s', 'imagify' ), '<a id="imagify-simulate-bulk-action" href="#">', '</a>' ); ?></p>
287 </td>
288 </tr>
289 </tbody>
290 </table>
291 </div>
292 </div>
293 <?php
294 }