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( 'attachment_fields_to_edit', '_imagify_attachment_fields_to_edit', IMAGIFY_INT_MAX, 2 ); /** * Add "Imagify" column in the Media Uploader * * @since 1.2 * @author Jonathan Buttigieg * * @param array $form_fields An array of attachment form fields. * @param object $post The WP_Post attachment object. * @return array */ function _imagify_attachment_fields_to_edit( $form_fields, $post ) { global $pagenow; if ( 'post.php' === $pagenow ) { return $form_fields; } if ( ! imagify_get_context( 'wp' )->current_user_can( 'manual-optimize', $post->ID ) ) { return $form_fields; } $process = imagify_get_optimization_process( $post->ID, 'wp' ); $form_fields['imagify'] = array( 'label' => 'Imagify', 'input' => 'html', 'html' => get_imagify_media_column_content( $process ), 'show_in_edit' => true, 'show_in_modal' => true, ); return $form_fields; } add_filter( 'media_row_actions', '_imagify_add_actions_to_media_list_row', IMAGIFY_INT_MAX, 2 ); /** * Add "Compare Original VS Optimized" link to the media row action * * @since 1.4.3 * @author Geoffrey Crofte * @param array $actions An array of action links for each attachment. * Default 'Edit', 'Delete Permanently', 'View'. * @param object $post WP_Post object for the current attachment. * @return array */ function _imagify_add_actions_to_media_list_row( $actions, $post ) { if ( ! imagify_get_context( 'wp' )->current_user_can( 'manual-optimize', $post->ID ) ) { return $actions; } $process = imagify_get_optimization_process( $post->ID, 'wp' ); if ( ! $process->is_valid() ) { return $actions; } $media = $process->get_media(); // If this media is not an image, do nothing. if ( ! $media->is_supported() || ! $media->is_image() ) { return $actions; } $data = $process->get_data(); // If Imagify license not valid, or image is not optimized, do nothing. if ( ! Imagify_Requirements::is_api_key_valid() || ! $data->is_optimized() ) { return $actions; } // If no backup, do nothing. if ( ! $media->has_backup() ) { return $actions; } $dimensions = $media->get_dimensions(); // If full image is too small. See get_imagify_localize_script_translations(). if ( $dimensions['width'] < 360 ) { return $actions; } // Else, add action link for comparison (JS triggered). $actions['imagify-compare'] = Imagify_Views::get_instance()->get_template( 'button/compare-images', [ 'url' => get_edit_post_link( $media->get_id() ) . '#imagify-compare', 'backup_url' => $media->get_backup_url(), 'original_url' => $media->get_fullsize_url(), 'media_id' => $media->get_id(), 'width' => $dimensions['width'], 'height' => $dimensions['height'], ] ); return $actions; }