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

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