PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 1.4
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v1.4
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 / inc / admin / meta-boxes.php

meta-boxes.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 1.4, at inc/admin/meta-boxes.php

42 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
4 /**
5 * Add a "Optimize It" button or the Imagify optimization data in the attachment submit area
6 *
7 * @since 1.0
8 */
9 add_action( 'attachment_submitbox_misc_actions', '_imagify_attachment_submitbox_misc_actions', PHP_INT_MAX );
10 function _imagify_attachment_submitbox_misc_actions() {
11 /** This filter is documented in inc/admin/options.php */
12 if ( current_user_can( apply_filters( 'imagify_capacity', 'manage_options' ) ) ) {
13 global $post;
14 $attachment = new Imagify_Attachment();
15
16 if ( ! imagify_valid_key() && ! $attachment->is_optimized() ) {
17 echo '<div class="misc-pub-section misc-pub-imagify"><h4>' . __( 'Imagify', 'imagify' ) . '</h4></div>';
18 echo '<div class="misc-pub-section misc-pub-imagify">';
19 echo __( 'Invalid API key', 'imagify' );
20 echo '<br/>';
21 echo '<a href="' . get_imagify_admin_url( 'options-general' ) . '">' . __( 'Check your Settings', 'imagify' ) . '</a>';
22 echo '</div>';
23 } elseif ( $attachment->is_optimized() || $attachment->has_error() ) {
24 echo '<div class="misc-pub-section misc-pub-imagify"><h4>' . __( 'Imagify', 'imagify' ) . '</h4></div>';
25 echo get_imagify_attachment_optimization_text( $post->ID );
26 } elseif ( false !== get_transient( 'imagify-async-in-progress-' . $post->ID ) ) {
27 echo '<div class="misc-pub-section misc-pub-imagify">';
28 echo '<div class="button"><span class="imagify-spinner"></span>';
29 _e( 'Optimizing...', 'imagify' );
30 echo '</div>';
31 echo '</div>';
32 } else {
33 $url = get_imagify_admin_url( 'manual-upload', $post->ID );
34 printf( '<div class="misc-pub-section misc-pub-imagify"><a class="button-primary" href="%s">%s</a></div>', $url, __( 'Optimize', 'imagify' ) );
35 }
36
37 if ( $attachment->is_optimized() ) {
38 echo '<input id="imagify-full-original" type="hidden" value="' . $attachment->get_backup_url() . '">';
39 echo '<input id="imagify-full-original-size" type="hidden" value="' . $attachment->get_original_size() . '">';
40 }
41 }
42 }