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

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