PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 2.2.2
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v2.2.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 / views / part-bulk-optimization-table.php

part-bulk-optimization-table.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 2.2.2, at views/part-bulk-optimization-table.php

114 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 use Imagify\Bulk\Bulk;
3
4 defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
5 ?>
6
7 <div class="imagify-bulk-table">
8 <div class="imagify-table-header imagify-flex imagify-vcenter imagify-resting">
9 <div class="imagify-th-titles imagify-flex imagify-vcenter">
10 <span class="dashicons dashicons-<?php echo $data['icon']; ?>"></span>
11 <div class="imagify-th-titles">
12 <p class="imagify-th-title"><?php echo $data['title']; ?></p>
13 </div>
14 </div>
15 </div>
16
17 <?php
18 $types = [];
19 $total = 0;
20 $remaining = 0;
21 $percentage = 0;
22
23 foreach ( $data['groups'] as $group ) {
24 $types[ $group['group_id'] . '|' . $group['context'] ] = true;
25
26 $transient = get_transient( "imagify_{$group['context']}_optimize_running" );
27
28 if ( false !== $transient ) {
29 $total += $transient['total'];
30 $remaining += $transient['remaining'];
31 }
32 }
33
34 if ( 0 !== $total ) {
35 $percentage = ( $total - $remaining ) / $total * 100;
36 }
37
38 $bulk = Bulk::get_instance();
39 $aria_hidden = 'aria-hidden="true"';
40 $hidden = 'hidden';
41 $style = '';
42 $display = '';
43
44 if (
45 0 !== $percentage
46 &&
47 100 !== $percentage
48 ) {
49 $percentage = round( $percentage );
50 $aria_hidden = '';
51 $hidden = '';
52 $style = 'style="width:' . $percentage . '%;"';
53 $display = 'style="display:block;"';
54 }
55 ?>
56
57 <div class="imagify-bulk-table-content">
58 <div class="imagify-bulk-table-container">
59 <div <?php echo $aria_hidden; ?> class="imagify-row-progress <?php echo $hidden; ?>" <?php echo $display; ?>>
60 <div class="media-item">
61 <div class="progress">
62 <div class="bar" <?php echo $style; ?>><div class="percent"><?php echo $percentage; ?>%</div></div>
63 </div>
64 </div>
65 </div>
66
67 <table>
68 <thead>
69 <tr class="screen-reader-text">
70 <th class="imagify-cell-checkbox"><?php esc_html_e( 'Group selection', 'imagify' ); ?></th>
71 <th class="imagify-cell-title"><?php esc_html_e( 'Group name', 'imagify' ); ?></th>
72 <th class="imagify-cell-count-optimized"><?php esc_html_e( 'Number of images optimized', 'imagify' ); ?></th>
73 <th class="imagify-cell-count-errors"><?php esc_html_e( 'Errors', 'imagify' ); ?></th>
74 <th class="imagify-cell-optimized-size-size"><?php esc_html_e( 'Optimized Size', 'imagify' ); ?></th>
75 <th class="imagify-cell-original-size-size"><?php esc_html_e( 'Original Size', 'imagify' ); ?></th>
76 <th class="imagify-cell-level"><?php esc_html_e( 'Level Selection', 'imagify' ); ?></th>
77 </tr>
78 </thead>
79 <tbody>
80 <?php
81 foreach ( $data['groups'] as $group ) {
82 $context_data = $bulk->get_bulk_instance( $group['context'] )->get_context_data();
83 $group = array_merge( $group, $context_data );
84 $default_level = Imagify_Options::get_instance()->get( 'optimization_level' );
85
86 if ( Imagify_Options::get_instance()->get( 'lossless' ) ) {
87 $default_level = 0;
88 }
89
90 $group['level'] = $default_level;
91
92 $running = get_transient( "imagify_{$group['context']}_optimize_running" );
93
94 $group['spinner_class'] = 'hidden';
95 $group['spinner_aria'] = 'aria-hidden="true"';
96 $group['checkbox_class'] = '';
97 $group['checkbox_aria'] = 'aria-hidden="false"';
98
99 if ( false !== $running ) {
100 $group['spinner_class'] = '';
101 $group['spinner_aria'] = 'aria-hidden="false"';
102 $group['checkbox_class'] = 'hidden';
103 $group['checkbox_aria'] = 'aria-hidden="true"';
104 }
105
106 $this->print_template( 'part-bulk-optimization-table-row-folder-type', $group );
107 }
108 ?>
109 </tbody>
110 </table>
111 </div><!-- .imagify-bulk-table-container -->
112 </div><!-- .imagify-bulk-table-content -->
113 </div>
114