PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 2.2.2
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v2.2.2
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 / views / part-settings-account.php

part-settings-account.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 2.2.2, at views/part-settings-account.php

92 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 Imagify\User\User;
4
5 defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
6
7 if ( defined( 'IMAGIFY_HIDDEN_ACCOUNT' ) && IMAGIFY_HIDDEN_ACCOUNT ) {
8 if ( ! defined( 'IMAGIFY_API_KEY' ) || ! IMAGIFY_API_KEY ) {
9 $options = Imagify_Options::get_instance();
10 ?>
11 <input type="hidden" value="<?php echo esc_attr( $options->get( 'api_key' ) ); ?>" name="<?php echo $options->get_option_name(); ?>[api_key]">
12 <?php
13 }
14 return;
15 }
16
17 if ( Imagify_Requirements::is_api_key_valid() ) {
18 $user = imagify_get_cached_user();
19
20 if ( ! $user ) {
21 // Lazyload user.
22 Imagify_Assets::get_instance()->localize_script( 'options', 'imagifyUser', array(
23 'action' => 'imagify_get_user_data',
24 '_wpnonce' => wp_create_nonce( 'imagify_get_user_data' ),
25 ) );
26 }
27 }
28 ?>
29 <div class="imagify-settings-section">
30 <?php $this->print_template( 'part-upsell' ); ?>
31
32 <?php
33 if ( ! defined( 'IMAGIFY_API_KEY' ) || ! IMAGIFY_API_KEY ) {
34 if ( Imagify_Requirements::is_api_key_valid() ) {
35 ?>
36 <h2 class="imagify-options-title">
37 <?php esc_html_e( 'API Key', 'imagify' ); ?>
38 </h2>
39 <?php
40 } else {
41 ?>
42 <h2 class="imagify-options-title"><?php esc_html_e( 'Your Account', 'imagify' ); ?></h2>
43 <p class="imagify-options-subtitle"><?php esc_html_e( 'Options page isn’t available until you enter your API Key', 'imagify' ); ?></p>
44 <?php
45 }
46 ?>
47
48 <?php
49 /**
50 * API key field.
51 */
52 $options = Imagify_Options::get_instance();
53
54 if ( ! $options->get( 'api_key' ) ) {
55 ?>
56 <p class="imagify-api-key-invite"><?php esc_html_e( 'Don\'t have an API Key yet?', 'imagify' ); ?></p>
57
58 <p><a id="imagify-signup" class="button imagify-button-secondary" href="<?php echo esc_url( imagify_get_external_url( 'register' ) ); ?>" target="_blank"><?php esc_html_e( 'Create a Free API Key', 'imagify' ); ?></a></p>
59 <?php
60 }
61 ?>
62
63 <div class="imagify-api-line">
64 <label for="api_key" class="screen-reader-text"><?php echo $options->get( 'api_key' ) ? esc_html__( 'API Key', 'imagify' ) : esc_html__( 'Enter Your API Key Below', 'imagify' ); ?></label>
65 <input type="text" size="35" value="<?php echo esc_attr( $options->get( 'api_key' ) ); ?>" name="<?php echo $options->get_option_name(); ?>[api_key]" id="api_key">
66 <?php
67 if ( Imagify_Requirements::is_api_key_valid() ) {
68 ?>
69
70 <span id="imagify-check-api-container" class="imagify-valid">
71 <span class="imagify-icon"></span> <?php esc_html_e( 'Your API key is valid.', 'imagify' ); ?>
72 </span>
73
74 <?php
75 } elseif ( ! Imagify_Requirements::is_api_key_valid() && $options->get( 'api_key' ) ) {
76 ?>
77
78 <span id="imagify-check-api-container">
79 <span class="dashicons dashicons-no"></span> <?php esc_html_e( 'Your API key isn\'t valid!', 'imagify' ); ?>
80 </span>
81
82 <?php
83 }
84 ?>
85 <input id="check_api_key" type="hidden" value="<?php echo esc_attr( $options->get( 'api_key' ) ); ?>" name="check_api_key">
86 </div><!-- .imagify-api-line -->
87 <?php
88 }
89 ?>
90 </div>
91 <?php
92