PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 2.3.0
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v2.3.0
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 / classes / Media / Upload / Upload.php

Upload.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 2.3.0, at classes/Media/Upload/Upload.php

48 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 declare(strict_types=1);
3
4 namespace Imagify\Media\Upload;
5
6 /**
7 * Upload Media Class.
8 */
9 class Upload {
10 /**
11 * Adds a dropdown that allows filtering on the attachments Imagify status.
12 *
13 * @return void
14 */
15 public function add_imagify_filter_to_attachments_dropdown() {
16 $data = [];
17
18 /**
19 * Tell if imagify stats query should run.
20 *
21 * @param bool $boolean True if the query should be run. False otherwise.
22 */
23 if ( wpm_apply_filters_typed( 'boolean', 'imagify_display_library_stats', false ) ) {
24 $data['optimized'] = imagify_count_optimized_attachments();
25 $data['unoptimized'] = imagify_count_unoptimized_attachments();
26 $data['errors'] = imagify_count_error_attachments();
27
28 }
29
30 $status = isset( $_GET['imagify-status'] ) ? sanitize_text_field( wp_unslash( $_GET['imagify-status'] ) ) : 0;
31 $options = [
32 'optimized' => _x( 'Optimized', 'Media Files', 'imagify' ),
33 'unoptimized' => _x( 'Unoptimized', 'Media Files', 'imagify' ),
34 'errors' => _x( 'Errors', 'Media Files', 'imagify' ),
35 ];
36
37 echo '<label class="screen-reader-text" for="filter-by-optimization-status">' . esc_html__( 'Filter by status', 'imagify' ) . '</label>';
38 echo '<select id="filter-by-optimization-status" name="imagify-status">';
39 echo '<option value="0" selected="selected">' . esc_html__( 'All Media Files', 'imagify' ) . '</option>';
40
41 foreach ( $options as $value => $label ) {
42 $filter_value = isset( $data[ $value ] ) ? ' (' . $data[ $value ] . ')' : '';
43 echo '<option value="' . esc_attr( $value ) . '" ' . selected( $status, $value, false ) . '>' . esc_html( $label ) . esc_html( $filter_value ) . '</option>';
44 }
45 echo '</select>&nbsp;';
46 }
47 }
48