account-status-connected.php
5 months ago
account-status-create-advanced.php
5 months ago
account-status-create-simple.php
5 months ago
account-status-loading.php
3 years ago
bulk-optimization-form.php
5 months ago
bulk-optimization-upgrade-notice.php
5 months ago
bulk-optimization.php
2 months ago
compress-details-processing.php
5 months ago
compress-details.php
5 months ago
dashboard-widget.php
2 months ago
notice-feedback.php
2 months ago
optimization-chart.php
5 months ago
request-review.php
2 months ago
settings-conversion-delivery.php
2 months ago
settings-conversion-enabled.php
2 months ago
settings-conversion-output.php
2 months ago
settings-conversion.php
2 months ago
settings-diagnostics.php
5 months ago
settings-original-image-original.php
2 months ago
settings-original-image-preserve.php
2 months ago
settings-original-image.php
2 months ago
settings.php
2 months ago
account-status-connected.php
136 lines
| 1 | <div class="tiny-account-status" id="tiny-account-status" data-state="complete"> |
| 2 | <div class="status <?php echo $status->ok ? ( $status->pending ? 'status-pending' : 'status-success' ) : 'status-failure'; ?>"> |
| 3 | <p class="status"><span> |
| 4 | <?php |
| 5 | if ( $status->ok ) { |
| 6 | if ( isset( $status->message ) ) { |
| 7 | echo esc_html( $status->message, 'tiny-compress-images' ); |
| 8 | } else { |
| 9 | esc_html_e( 'Your account is connected', 'tiny-compress-images' ); |
| 10 | } |
| 11 | } else { |
| 12 | esc_html_e( 'Connection unsuccessful', 'tiny-compress-images' ); |
| 13 | } |
| 14 | ?> |
| 15 | </span> |
| 16 | <?php |
| 17 | if ( ! defined( 'TINY_API_KEY' ) ) { |
| 18 | echo '<a href="#" id="change-key">'; |
| 19 | esc_html_e( 'Change API key', 'tiny-compress-images' ); |
| 20 | echo '</a>'; |
| 21 | } |
| 22 | ?> |
| 23 | </p> |
| 24 | <p> |
| 25 | <?php |
| 26 | if ( $status->ok ) { |
| 27 | $strong = array( |
| 28 | 'strong' => array(), |
| 29 | ); |
| 30 | $compressions = self::get_compression_count(); |
| 31 | $remaining_credits = self::get_remaining_credits(); |
| 32 | if ( self::is_on_free_plan() ) { |
| 33 | printf( |
| 34 | wp_kses( |
| 35 | /* translators: %s: number of remaining credits */ |
| 36 | __( |
| 37 | 'You are on a <strong>free plan</strong> with <strong>%s compressions left</strong> this month.', // WPCS: Needed for proper translation. |
| 38 | 'tiny-compress-images' |
| 39 | ), |
| 40 | $strong |
| 41 | ), |
| 42 | $remaining_credits |
| 43 | ); |
| 44 | } elseif ( ! $status->pending ) { |
| 45 | printf( |
| 46 | /* translators: %s: number of compressions */ |
| 47 | esc_html__( |
| 48 | 'You have made %s compressions this month.', |
| 49 | 'tiny-compress-images' |
| 50 | ), |
| 51 | $compressions |
| 52 | ); |
| 53 | } |
| 54 | } else { |
| 55 | if ( isset( $status->message ) ) { |
| 56 | echo esc_html__( 'Error', 'tiny-compress-images' ) . ': '; |
| 57 | echo esc_html( $status->message, 'tiny-compress-images' ); |
| 58 | } else { |
| 59 | esc_html_e( |
| 60 | 'API status could not be checked, enable cURL for more information', |
| 61 | 'tiny-compress-images' |
| 62 | ); |
| 63 | } |
| 64 | } // End if(). |
| 65 | ?> |
| 66 | </p> |
| 67 | <p> |
| 68 | <?php |
| 69 | if ( defined( 'TINY_API_KEY' ) ) { |
| 70 | echo sprintf( |
| 71 | /* translators: %s: wp-config.php */ |
| 72 | esc_html__( |
| 73 | 'The API key has been configured in %s', |
| 74 | 'tiny-compress-images' |
| 75 | ), |
| 76 | 'wp-config.php' |
| 77 | ); |
| 78 | } |
| 79 | ?> |
| 80 | </p> |
| 81 | </div> |
| 82 | |
| 83 | <div class="update" style="display: none"> |
| 84 | <h4><?php esc_html_e( 'Change your API key', 'tiny-compress-images' ); ?></h4> |
| 85 | <p class="introduction"> |
| 86 | <?php |
| 87 | $link = sprintf( |
| 88 | '<a href="https://tinypng.com/dashboard/api" target="_blank">%s</a>', |
| 89 | esc_html__( 'API dashboard', 'tiny-compress-images' ) |
| 90 | ); |
| 91 | printf( |
| 92 | /* translators: %s: link saying API dashboard */ |
| 93 | esc_html__( |
| 94 | 'Enter your API key. If you have lost your key, go to your %s to retrieve it.', |
| 95 | 'tiny-compress-images' |
| 96 | ), |
| 97 | $link |
| 98 | ); |
| 99 | ?> |
| 100 | </p> |
| 101 | <input type="text" id="tinypng_api_key" |
| 102 | name="tinypng_api_key" size="35" spellcheck="false" |
| 103 | value="<?php echo esc_attr( $key ); ?>"> |
| 104 | <button class="button button-primary" data-tiny-action="update-key"> |
| 105 | <?php |
| 106 | esc_html_e( 'Save', 'tiny-compress-images' ); |
| 107 | ?> |
| 108 | </button> |
| 109 | <p class="message"></p> |
| 110 | <p> |
| 111 | <a href="#" id="cancel-change-key"><?php esc_html_e( 'Cancel', 'tiny-compress-images' ); ?></a> |
| 112 | </p> |
| 113 | </div> |
| 114 | |
| 115 | <?php if ( self::is_on_free_plan() ) { ?> |
| 116 | <div class="upgrade"> |
| 117 | <div class="button-container"> |
| 118 | <div class="box"> |
| 119 | <?php $encoded_email = str_replace( '%20', '%2B', rawurlencode( self::get_email_address() ) ); ?> |
| 120 | <a href="https://tinypng.com/dashboard/api?type=upgrade&mail=<?php echo $encoded_email; ?>" target="_blank" class="button button-primary upgrade-account"> |
| 121 | <?php esc_html_e( 'Upgrade account', 'tiny-compress-images' ); ?> |
| 122 | </a> |
| 123 | </div> |
| 124 | </div> |
| 125 | <p> |
| 126 | <?php |
| 127 | esc_html_e( |
| 128 | 'Remove all limitations? Visit your TinyPNG dashboard to upgrade your account.', |
| 129 | 'tiny-compress-images' |
| 130 | ); |
| 131 | ?> |
| 132 | </p> |
| 133 | </div> |
| 134 | <?php } ?> |
| 135 | </div> |
| 136 |