PluginProbe
Image Optimizer – Compress Images and Convert to WebP or AVIF / 1.7.4
Image Optimizer – Compress Images and Convert to WebP or AVIF v1.7.4
1.7.7 1.7.6 1.7.5 1.7.4 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 All 33 releases
image-optimization / modules / optimization / templates / list-view / error.php

error.php in Image Optimizer – Compress Images and Convert to WebP or AVIF 1.7.4, at modules/optimization/templates/list-view/error.php

76 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use ImageOptimization\Classes\Image\Image_Optimization_Error_Type;
4 use ImageOptimization\Classes\Utils;
5 use ImageOptimization\Modules\Settings\Module as Settings_Module;
6 use ImageOptimization\Modules\Core\Module as Core_Module;
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly.
10 }
11 ?>
12 <div class="image-optimization-control image-optimization-control--list-view image-optimization-control--error"
13 data-image-optimization-context="list-view"
14 data-image-optimization-status="error"
15 data-image-optimization-allow-retry="<?php echo esc_attr( $args['allow_retry'] ); ?>"
16 data-image-optimization-action="<?php echo esc_attr( $args['action'] ); ?>"
17 data-image-optimization-image-id="<?php echo esc_attr( $args['image_id'] ); ?>"
18 data-image-optimization-can-be-restored="<?php echo esc_attr( $args['can_be_restored'] ); ?>">
19
20 <?php
21 $error_type = isset( $args['optimization_error_type'] ) ? $args['optimization_error_type'] : '';
22 $message = esc_html( $args['message'] );
23
24 if ( false === $args['allow_retry'] ) {
25 $message_chunks = explode( '. ', $message, 2 );
26
27 $message = "<span class='image-optimization-control__error-title'>{$message_chunks[0]}</span>";
28
29 if ( isset( $message_chunks[1] ) ) {
30 $message .= "<span class='image-optimization-control__error-subtitle'>{$message_chunks[1]}</span>";
31 }
32 }
33 ?>
34
35 <span class='image-optimization-control__error-message'>
36 <?php echo wp_kses_post( $message ); ?>
37 </span>
38
39 <?php
40 if ( Image_Optimization_Error_Type::AUTH_ERROR === $error_type ) {
41 ?>
42 <a class="button button-secondary button-large image-optimization-control__button"
43 href="<?php echo esc_url( admin_url( 'admin.php?page=' . Settings_Module::SETTING_BASE_SLUG . '&action=connect' ) ); ?>"
44 target="_blank" rel="noopener noreferrer">
45 <?php esc_html_e( 'Connect', 'image-optimization' ); ?>
46 </a>
47 <?php
48 } if ( Image_Optimization_Error_Type::CONNECTION_ERROR === $error_type ) {
49 ?>
50 <button class="button button-secondary button-large button-link-delete image-optimization-control__button image-optimization-control__button--try-again"
51 type="button">
52 <?php esc_html_e( 'Try again', 'image-optimization' ); ?>
53 </button>
54 <?php
55 } elseif ( isset( $args['images_left'] ) && 0 === $args['images_left'] ) {
56 if ( Core_Module::is_elementor_one() ) {
57 return;
58 }
59 ?>
60 <a class="button button-secondary button-large image-optimization-control__button"
61 href="<?php echo esc_url( Utils::get_upgrade_link( 'https://go.elementor.com/io-panel-upgrade/' ) ); ?>"
62 target="_blank" rel="noopener noreferrer">
63 <?php esc_html_e( 'Upgrade', 'image-optimization' ); ?>
64 </a>
65 <?php
66 } elseif ( $args['allow_retry'] ) {
67 ?>
68 <button class="button button-secondary button-large button-link-delete image-optimization-control__button image-optimization-control__button--try-again"
69 type="button">
70 <?php esc_html_e( 'Try again', 'image-optimization' ); ?>
71 </button>
72 <?php
73 }
74 ?>
75 </div>
76