Server : Apache System : Linux pod-100823:apache2_74:v0.5.7 5.4.0-1138-gcp #147~18.04.1-Ubuntu SMP Mon Oct 7 21:46:26 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33.7 Disable Function : apache_child_terminate,apache_get_modules,apache_get_version,apache_getenv,apache_note,apache_setenv,disk_free_space,disk_total_space,diskfreespace,dl,exec,fastcgi_finish_request,link,opcache_compile_file,opcache_get_configuration,opcache_invalidate,opcache_is_script_cached,opcache_reset,passthru,pclose,pcntl_exec,popen,posix_getpid,posix_getppid,posix_getpwuid,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,realpath_cache_get,shell_exec,show_source,symlink,system Directory : /nas/content/live/attorneyexperi/wp-content/plugins/imagify/inc/admin/ |
<?php defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); add_filter( 'manage_media_columns', '_imagify_manage_media_columns' ); /** * Add "Imagify" column in upload.php. * * @since 1.0 * @author Jonathan Buttigieg * * @param array $columns An array of columns displayed in the Media list table. * @return array */ function _imagify_manage_media_columns( $columns ) { if ( imagify_get_context( 'wp' )->current_user_can( 'optimize' ) ) { $columns['imagify_optimized_file'] = __( 'Imagify', 'imagify' ); } return $columns; } add_action( 'manage_media_custom_column', '_imagify_manage_media_custom_column', 10, 2 ); /** * Add content to the "Imagify" columns in upload.php. * * @since 1.0 * @author Jonathan Buttigieg * * @param string $column_name Name of the custom column. * @param int $attachment_id Attachment ID. */ function _imagify_manage_media_custom_column( $column_name, $attachment_id ) { if ( 'imagify_optimized_file' !== $column_name ) { return; } $process = imagify_get_optimization_process( $attachment_id, 'wp' ); echo get_imagify_media_column_content( $process ); } add_action( 'restrict_manage_posts', '_imagify_attachments_filter_dropdown' ); /** * Adds a dropdown that allows filtering on the attachments Imagify status. * * @since 1.0 * @author Jonathan Buttigieg */ function _imagify_attachments_filter_dropdown() { if ( ! Imagify_Views::get_instance()->is_wp_library_page() ) { return; } $optimized = imagify_count_optimized_attachments(); $unoptimized = imagify_count_unoptimized_attachments(); $errors = imagify_count_error_attachments(); $status = isset( $_GET['imagify-status'] ) ? wp_unslash( $_GET['imagify-status'] ) : 0; // WPCS: CSRF ok. $options = array( 'optimized' => _x( 'Optimized', 'Media Files', 'imagify' ), 'unoptimized' => _x( 'Unoptimized', 'Media Files', 'imagify' ), 'errors' => _x( 'Errors', 'Media Files', 'imagify' ), ); 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>'; foreach ( $options as $value => $label ) { echo '<option value="' . $value . '" ' . selected( $status, $value, false ) . '>' . $label . ' (' . ${$value} . ')</option>'; } echo '</select> '; } add_filter( 'request', '_imagify_sort_attachments_by_status' ); /** * Modify the query based on the imagify-status variable in $_GET. * * @since 1.0 * @author Jonathan Buttigieg * * @param array $vars The array of requested query variables. * @return array */ function _imagify_sort_attachments_by_status( $vars ) { if ( empty( $_GET['imagify-status'] ) || ! Imagify_Views::get_instance()->is_wp_library_page() ) { // WPCS: CSRF ok. return $vars; } $status = wp_unslash( $_GET['imagify-status'] ); // WPCS: CSRF ok. $meta_key = '_imagify_status'; $meta_compare = '='; $relation = array(); switch ( $status ) { case 'unoptimized': $meta_key = '_imagify_data'; $meta_compare = 'NOT EXISTS'; break; case 'optimized': $status = 'success'; $relation = array( 'key' => $meta_key, 'value' => 'already_optimized', 'compare' => $meta_compare, ); break; case 'errors': $status = 'error'; break; default: return $vars; } $vars = array_merge( $vars, array( 'meta_query' => array( 'relation' => 'or', array( 'key' => $meta_key, 'value' => $status, 'compare' => $meta_compare, ), $relation, ), ) ); if ( ! key_exists( 'post_mime_type', $vars ) ) { $vars['post_mime_type'] = imagify_get_mime_types(); } return $vars; }