← All changes
|
modules/optimization/templates/details-view/error.php
+51
-13
1.0.0
→
1.7.7
View file →
| @@ -1,29 +1,37 @@ | ||
| 1 | 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 | + | |
| 2 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | 9 | exit; // Exit if accessed directly. |
| 4 | 10 | } |
| 11 | + | |
| 12 | +$error_type = isset( $args['optimization_error_type'] ) ? $args['optimization_error_type'] : ''; | |
| 5 | 13 | ?> |
| 6 | 14 | <div class="image-optimization-control image-optimization-control--details-view image-optimization-control--error" |
| 7 | 15 | data-image-optimization-context="details-view" |
| 8 | 16 | data-image-optimization-status="error" |
| 9 | - data-image-allow-retry="<?php echo esc_attr( $args['allow_retry'] ); ?>" | |
| 17 | + data-image-optimization-allow-retry="<?php echo esc_attr( $args['allow_retry'] ); ?>" | |
| 10 | 18 | data-image-optimization-action="<?php echo esc_attr( $args['action'] ); ?>" |
| 11 | 19 | data-image-optimization-image-id="<?php echo esc_attr( $args['image_id'] ); ?>" |
| 12 | 20 | data-image-optimization-can-be-restored="<?php echo esc_attr( $args['can_be_restored'] ); ?>"> |
| 13 | - <span class="setting image-optimizer-setting"> | |
| 21 | + <span class="setting image-optimization-setting"> | |
| 14 | 22 | <span class="name image-optimization-control__property"> |
| 15 | - <?php esc_html_e( 'Status', 'image-optimizer' ); ?>: | |
| 23 | + <?php esc_html_e( 'Status', 'image-optimization' ); ?>: | |
| 16 | 24 | </span> |
| 17 | 25 | |
| 18 | 26 | <span class="image-optimization-control__property-value"> |
| 19 | - <?php esc_html_e( 'Error', 'image-optimizer' ); ?> | |
| 27 | + <?php esc_html_e( 'Error', 'image-optimization' ); ?> | |
| 20 | 28 | </span> |
| 21 | 29 | </span> |
| 22 | 30 | |
| 23 | - <span class="setting image-optimizer-setting"> | |
| 31 | + <span class="setting image-optimization-setting"> | |
| 24 | 32 | <span class="name image-optimization-control__property"> |
| 25 | - <?php esc_html_e( 'Reason', 'image-optimizer' ); ?>: | |
| 33 | + <?php esc_html_e( 'Reason', 'image-optimization' ); ?>: | |
| 26 | 34 | </span> |
| 27 | 35 | |
| 28 | 36 | <span class="image-optimization-control__property-value"> |
| 29 | 37 | <?php echo esc_html( $args['message'] ); ?> |
| @@ -29,17 +37,47 @@ | ||
| 29 | 37 | <?php echo esc_html( $args['message'] ); ?> |
| 30 | 38 | </span> |
| 31 | 39 | </span> |
| 32 | 40 | |
| 33 | - <?php if ( $args['allow_retry'] ) { ?> | |
| 34 | - <span class="setting image-optimizer-setting"> | |
| 35 | - <span class="name image-optimization-control__property"></span> | |
| 41 | + <span class="setting image-optimization-setting"> | |
| 42 | + <span class="name image-optimization-control__property"></span> | |
| 36 | 43 | |
| 37 | - <span class="image-optimization-control__property-value image-optimization-control__property-value--button"> | |
| 44 | + <span class="image-optimization-control__property-value image-optimization-control__property-value--button"> | |
| 45 | + <?php | |
| 46 | + if ( Image_Optimization_Error_Type::AUTH_ERROR === $error_type ) { | |
| 47 | + ?> | |
| 48 | + <a class="button button-secondary button-large image-optimization-control__button" | |
| 49 | + href="<?php echo esc_url( admin_url( 'admin.php?page=' . Settings_Module::SETTING_BASE_SLUG . '&action=connect' ) ); ?>" | |
| 50 | + target="_blank" rel="noopener noreferrer"> | |
| 51 | + <?php esc_html_e( 'Connect', 'image-optimization' ); ?> | |
| 52 | + </a> | |
| 53 | + <?php | |
| 54 | + } if ( Image_Optimization_Error_Type::CONNECTION_ERROR === $error_type ) { | |
| 55 | + ?> | |
| 38 | 56 | <button class="button button-secondary button-large button-link-delete image-optimization-control__button image-optimization-control__button--try-again" |
| 39 | 57 | type="button"> |
| 40 | - <?php esc_html_e( 'Try again', 'image-optimizer' ); ?> | |
| 58 | + <?php esc_html_e( 'Try again', 'image-optimization' ); ?> | |
| 41 | 59 | </button> |
| 42 | - </span> | |
| 60 | + <?php | |
| 61 | + } elseif ( isset( $args['images_left'] ) && 0 === $args['images_left'] ) { | |
| 62 | + if ( Core_Module::is_elementor_one() ) { | |
| 63 | + return; | |
| 64 | + } | |
| 65 | + ?> | |
| 66 | + <a class="button button-secondary button-large image-optimization-control__button" | |
| 67 | + href="<?php echo esc_url( Utils::get_upgrade_link( 'https://go.elementor.com/io-panel-upgrade/' ) ); ?>" | |
| 68 | + target="_blank" rel="noopener noreferrer"> | |
| 69 | + <?php esc_html_e( 'Upgrade', 'image-optimization' ); ?> | |
| 70 | + </a> | |
| 71 | + <?php | |
| 72 | + } elseif ( $args['allow_retry'] ) { | |
| 73 | + ?> | |
| 74 | + <button class="button button-secondary button-large button-link-delete image-optimization-control__button image-optimization-control__button--try-again" | |
| 75 | + type="button"> | |
| 76 | + <?php esc_html_e( 'Try again', 'image-optimization' ); ?> | |
| 77 | + </button> | |
| 78 | + <?php | |
| 79 | + } | |
| 80 | + ?> | |
| 43 | 81 | </span> |
| 44 | - <?php } ?> | |
| 82 | + </span> | |
| 45 | 83 | </div> |