PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 1.4.4
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v1.4.4
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.4, at inc/admin/ui/bulk.php

300 lines 14.5 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>
92 <?php
93 if ( get_transient( IMAGIFY_SLUG . '_large_library' ) ) {
94 printf( __( 'If you have more than %s images, you will need to launch the bulk optimization several times.' , 'imagify' ), number_format_i18n( apply_filters( 'imagify_unoptimized_attachment_limit', 10000 ) ) );
95 }
96 ?>
97 </li>
98 <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>
99 </ul>
100
101 <div class="imagify-bulk-submit">
102
103 <?php if ( get_imagify_option( 'backup', 0 ) == "1" ) { ?>
104
105 <p>
106 <strong><?php _e( 'Select Your Compression Level', 'imagify' ); ?></strong>
107 <br>
108 <?php
109 $default_set = __( 'Ultra', 'imagify' );
110 switch( get_imagify_option( 'optimization_level' ) ) {
111 case '1':
112 $default_set = __( 'Aggressive', 'imagify' );
113 break;
114 case '0':
115 $default_set = __( 'Normal', 'imagify' );
116 break;
117 }
118
119 _e( 'Your default setting:', 'imagify' );
120 echo '&nbsp;<strong class="imagify-primary">' . $default_set . '</strong>';
121 ?>
122 </p>
123
124 <p class="imagify-inline-options">
125 <input type="radio" id="imagify-optimization_level_normal" name="optimization_level" value="0" <?php checked( get_imagify_option( 'optimization_level' ), 0 ); ?>>
126 <label for="imagify-optimization_level_normal">
127 <?php _e( 'Normal', 'imagify' ); ?>
128 </label>
129
130 <input type="radio" id="imagify-optimization_level_aggro" name="optimization_level" value="1" <?php checked( get_imagify_option( 'optimization_level' ), 1 ); ?>>
131 <label for="imagify-optimization_level_aggro">
132 <?php _e( 'Aggressive', 'imagify' ); ?>
133 </label>
134
135 <input type="radio" id="imagify-optimization_level_ultra" name="optimization_level" value="2" <?php checked( get_imagify_option( 'optimization_level' ), 2 ); ?>>
136 <label for="imagify-optimization_level_ultra">
137 <?php _e( 'Ultra', 'imagify' ); ?>
138 </label>
139 </p>
140
141 <?php
142 }
143 else {
144 ?>
145 <p>
146 <strong><?php printf( __( 'Don\'t forget to check %syour settings%s before bulk optimization.', 'imagify' ), '<a href="' . get_imagify_admin_url() . '">', '</a>' ); ?></strong>
147 </p>
148 <?php
149 }
150 ?>
151
152 <p>
153 <?php wp_nonce_field( 'imagify-bulk-upload', 'imagifybulkuploadnonce' ); ?>
154 <button id="imagify-bulk-action" type="button" class="button button-primary">
155 <span class="dashicons dashicons-admin-generic"></span>
156 <span class="button-text"><?php _e( 'Imagif\'em all', 'imagify'); ?></span>
157 </button>
158 <?php
159 if ( $user->is_free() ) { ?>
160 <span class="imagify-tooltips right">
161 <span class="tooltip-content">
162 <span class="icon icon-round" aria-hidden="true">i</span>
163 <?php printf( __( 'All images which are over to %s could be optimized using the pro version.', 'imagify' ), size_format( IMAGIFY_MAX_BYTES , 0 ) ); ?>
164 </span>
165 </span>
166 <?php
167 }
168 ?>
169 </p>
170 </div>
171 </div>
172
173 <div class="col-1-3">
174 <h3><?php _e( 'Overview', 'imagify' ); ?></h3>
175
176 <div class="imagify-chart-container">
177 <canvas id="imagify-overview-chart" width="180" height="180"></canvas>
178 <div id="imagify-overview-chart-percent" class="imagify-chart-percent"><?php echo imagify_percent_optimized_attachments(); ?><span>%</span></div>
179 </div>
180 <div id="imagify-overview-chart-legend"></div>
181 </div>
182
183 <div class="col-1-3 col-statistics">
184 <h3><?php _e( 'Statistics', 'imagify' ); ?></h3>
185
186 <?php
187 $total_saving_data = imagify_count_saving_data();
188 $optimized_percent = $total_saving_data['percent'];
189 $optimized_nb = $total_saving_data['optimized_size'];
190 $original_nb = $total_saving_data['original_size'];
191 ?>
192
193 <div class="imagify-number-you-optimized">
194 <p>
195 <span id="imagify-total-optimized-attachments" class="number"><?php echo number_format_i18n( $total_saving_data['count'] ); ?></span>
196 <span class="text"><?php printf( __( 'that\'s the number of images you optimized with Imagify', 'imagify' ), '<br>' ); ?></span>
197 </p>
198 </div>
199
200 <div class="imagify-bars">
201 <p><?php _e( 'Original size', 'imagify' ); ?></p>
202 <div class="imagify-bar-negative base-transparent right-outside-number">
203 <div id="imagify-original-bar" class="imagify-progress" style="width: 100%"><span class="imagify-barnb"><?php echo size_format( $original_nb, 1 ); ?></span></div>
204 </div>
205
206 <p><?php _e( 'Optimized size', 'imagify' ); ?></p>
207 <div class="imagify-bar-positive base-transparent right-outside-number">
208
209 <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>
210 </div>
211
212 </div>
213
214 <div class="imagify-number-you-optimized">
215 <p>
216 <span id="imagify-total-optimized-attachments-pct" class="number"><?php echo number_format_i18n( $optimized_percent ); ?>%</span>
217 <span class="text"><?php printf( __( 'that\'s the size you saved %sby using Imagify', 'imagify' ), '<br>' ); ?></span>
218 </p>
219 </div>
220 </div>
221
222 </div>
223 </div><!-- .imagify-settings-section -->
224
225 <!-- The Success/Complete bar -->
226 <div class="imagify-row-complete hidden" aria-hidden="true">
227 <div class="imagify-all-complete">
228 <div class="imagify-ac-report">
229 <div class="imagify-ac-chart" data-percent="0">
230 <span class="imagify-chart">
231 <span class="imagify-chart-container">
232 <canvas width="46" height="46"></canvas>
233 </span>
234 </span>
235 </div>
236 <div class="imagify-ac-report-text">
237 <p class="imagify-ac-rt-big"><?php _e( 'Well done!', 'imagify' ); ?></p>
238 <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>
239 </div>
240 </div>
241 <div class="imagify-ac-share">
242 <div class="imagify-ac-share-content">
243 <p><?php _e( 'Share your awesome result', 'imagify' ); ?></p>
244 <ul class="imagify-share-networks">
245 <li>
246 <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>
247 </li>
248 <li>
249 <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>
250 </li>
251 </ul>
252 </div>
253 </div>
254 </div>
255 </div>
256
257 <div class="imagify-bulk-table">
258 <table summary="<?php _e( 'Compression process results', 'imagify' ); ?>">
259 <thead>
260 <tr>
261 <th class="imagify-cell-filename"><?php _e( 'Filename', 'imagify' ); ?></th>
262 <th class="imagify-cell-status"><?php _e( 'Status', 'imagify' ); ?></th>
263 <th class="imagify-cell-original"><?php _e( 'Original', 'imagify' ); ?></th>
264 <th class="imagify-cell-optimized"><?php _e( 'Optimized', 'imagify' ); ?></th>
265 <th class="imagify-cell-percentage"><?php _e( 'Percentage', 'imagify' ); ?></th>
266 <th class="imagify-cell-thumbnails"><?php _e( 'Thumbnails optimized', 'imagify' ); ?></th>
267 <th class="imagify-cell-savings"><?php _e( 'Overall saving', 'imagify' ); ?></th>
268 </tr>
269 </thead>
270 <tfoot>
271 <tr>
272 <td class="imagify-cell-nb-files"><span class="imagify-nb-files">0</span> <?php _e( 'file', 'imagify' ); ?></td>
273 <td class="imagify-cell-errors"><span class="imagify-nb-errors">0</span> <?php _e( 'error', 'imagify' ); ?></td>
274 <td class="imagify-cell-totaloriginal" colspan="4"><?php _e( 'Total:', 'imagify' ); ?> <strong><span class="imagify-total-original">0Mb</span></strong></td>
275 <td class="imagify-cell-totalgain"><?php _e( 'Gain:', 'imagify' ); ?> <strong><span class="imagify-total-gain">0Mb</span></strong></td>
276 </tr>
277 </tfoot>
278 <tbody>
279 <!-- The progress bar -->
280 <tr aria-hidden="true" class="imagify-row-progress hidden">
281 <td colspan="7">
282 <div class="media-item">
283 <div class="progress">
284 <div id="imagify-progress-bar" class="bar"><div class="percent">0%</div></div>
285 </div>
286 </div>
287 </td>
288 </tr>
289 <!-- No image uploaded yet -->
290 <tr class="imagify-no-uploaded-yet">
291 <td colspan="7">
292 <p><?php printf( __( '%sStart the bulk optimization%s', 'imagify' ), '<a id="imagify-simulate-bulk-action" href="#">', '</a>' ); ?></p>
293 </td>
294 </tr>
295 </tbody>
296 </table>
297 </div>
298 </div>
299 <?php
300 }