| @@ -12,15 +12,25 @@ | ||
| 12 | 12 | * @param string $message Message. |
| 13 | 13 | * @param string $color Color to highlight message in. |
| 14 | 14 | */ |
| 15 | 15 | function ao_ccss_render_key( $key, $status, $status_msg, $message, $color ) { |
| 16 | + if ( defined( 'AO_PRO_VERSION' ) && has_filter( 'autoptimize_filter_ccss_key' ) ) { | |
| 17 | + ?> | |
| 18 | + <input type="hidden" id="autoptimize_ccss_key" name="autoptimize_ccss_key" value=""> | |
| 19 | + <?php | |
| 20 | + return; | |
| 21 | + } | |
| 22 | + | |
| 16 | 23 | if ( defined( 'AUTOPTIMIZE_CRITICALCSS_API_KEY' ) ) { |
| 17 | - $key = __( 'API key provided by your host/ WordPress administrator, no need to enter anything here. In case of problems with the API key, contact your host/ WordPress administrator.', 'autoptimize' ); | |
| 24 | + $key = esc_html__( 'API key provided by your host/ WordPress administrator, no need to enter anything here. In case of problems with the API key, contact your host/ WordPress administrator.', 'autoptimize' ); | |
| 25 | + } else if ( has_filter( 'autoptimize_filter_ccss_key' ) ) { | |
| 26 | + $key = esc_html__( 'API Key provided by a filter, no need to enter anything here.', 'autoptimize' ); | |
| 18 | 27 | } |
| 28 | + | |
| 19 | 29 | ?> |
| 20 | 30 | <ul id="key-panel"> |
| 21 | 31 | <li class="itemDetail"> |
| 22 | - <h2 class="itemTitle fleft"><?php _e( 'API Key', 'autoptimize' ); ?>: <span style="color:<?php echo $color; ?>;"><?php echo $status_msg; ?></span></h2> | |
| 32 | + <h2 class="itemTitle fleft"><?php esc_html_e( 'API Key', 'autoptimize' ); ?>: <span style="color:<?php echo $color; ?>;"><?php echo $status_msg; ?></span></h2> | |
| 23 | 33 | <button type="button" class="toggle-btn"> |
| 24 | 34 | <?php if ( 'valid' != $status ) { ?> |
| 25 | 35 | <span class="toggle-indicator dashicons dashicons-arrow-up"></span> |
| 26 | 36 | <?php } else { ?> |
| @@ -39,12 +49,12 @@ | ||
| 39 | 49 | <?php } ?> |
| 40 | 50 | <table id="key" class="form-table"> |
| 41 | 51 | <tr> |
| 42 | 52 | <th scope="row"> |
| 43 | - <?php _e( 'Your API Key', 'autoptimize' ); ?> | |
| 53 | + <?php esc_html_e( 'Your API Key', 'autoptimize' ); ?> | |
| 44 | 54 | </th> |
| 45 | 55 | <td> |
| 46 | - <textarea id="autoptimize_ccss_key" name="autoptimize_ccss_key" rows='3' style="width:100%;" placeholder="<?php _e( 'Please enter your criticalcss.com API key here.', 'autoptimize' ); ?>"><?php echo trim( $key ); ?></textarea> | |
| 56 | + <textarea id="autoptimize_ccss_key" name="autoptimize_ccss_key" rows='3' style="width:100%;" placeholder="<?php esc_html_e( 'Please enter your criticalcss.com API key here.', 'autoptimize' ); ?>"><?php echo trim( esc_textarea( $key ) ); ?></textarea> | |
| 47 | 57 | <p class="notes"> |
| 48 | 58 | <?php _e( 'Enter your <a href="https://criticalcss.com/account/api-keys?aff=1" target="_blank">criticalcss.com</a> API key above. The key is revalidated every time a new job is sent to it.<br />To obtain your API key, go to <a href="https://criticalcss.com/account/api-keys?aff=1" target="_blank">criticalcss.com</a> > Account > API Keys.<br />Requests to generate a critical CSS via the API are priced at £5 per domain per month.<br /><strong>Not sure yet? With the <a href="https://criticalcss.com/faq/?aff=1#trial" target="_blank">30 day money back guarantee</a>, you have nothing to lose!</strong>', 'autoptimize' ); ?> |
| 49 | 59 | </p> |
| 50 | 60 | </td> |
| @@ -52,6 +62,6 @@ | ||
| 52 | 62 | </table> |
| 53 | 63 | </div> |
| 54 | 64 | </li> |
| 55 | 65 | </ul> |
| 56 | -<?php | |
| 66 | + <?php | |
| 57 | 67 | } |