Skip to content

Commit

Permalink
fix codacy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
wordpressfan committed Dec 20, 2024
1 parent 427ca36 commit 62249e7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions classes/Media/Upload/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ class Upload {
* @return void
*/
public function add_imagify_filter_to_attachments_dropdown() {
$data = [];

/**
* Tell if imagify stats query should run.
*
* @param bool $boolean True if the query should be run. False otherwise.
*/
if ( apply_filters( 'imagify_display_library_stats', false ) ) {
$optimized = imagify_count_optimized_attachments();
$unoptimized = imagify_count_unoptimized_attachments();
$errors = imagify_count_error_attachments();
$data['optimized'] = imagify_count_optimized_attachments();
$data['unoptimized'] = imagify_count_unoptimized_attachments();
$data['errors'] = imagify_count_error_attachments();

}

$status = isset( $_GET['imagify-status'] ) ? wp_unslash( $_GET['imagify-status'] ) : 0; // WPCS: CSRF ok.
Expand All @@ -34,11 +37,9 @@ public function add_imagify_filter_to_attachments_dropdown() {
echo '<label class="screen-reader-text" for="filter-by-optimization-status">' . __( 'Filter by status', 'imagify' ) . '</label>';
echo '<select id="filter-by-optimization-status" name="imagify-status">';
echo '<option value="0" selected="selected">' . __( 'All Media Files', 'imagify' ) . '</option>';
$filter_value = '';

foreach ( $options as $value => $label ) {
if ( isset( ${$value} ) ) {
$filter_value = ' (' . ${$value} . ')';
}
$filter_value = isset( $data[$value] ) ? ' (' . $data[$value] . ')' : '';
echo '<option value="' . $value . '" ' . selected( $status, $value, false ) . '>' . $label . $filter_value . '</option>';
}
echo '</select>&nbsp;';
Expand Down

0 comments on commit 62249e7

Please sign in to comment.