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