| @@ -24,11 +24,8 @@ | ||
| 24 | 24 | |
| 25 | 25 | // Auto license activator. |
| 26 | 26 | add_action( 'wp_ajax_patchstack_activate_auto', [ $this, 'auto_activate' ] ); |
| 27 | 27 | add_action( 'wp_ajax_patchstack_activation_status', [ $this, 'activation_status' ] ); |
| 28 | - | |
| 29 | - // Manual connection re-check (Retry link on the settings card). | |
| 30 | - add_action( 'wp_ajax_patchstack_check_connection', [ $this, 'check_connection' ] ); | |
| 31 | 28 | } |
| 32 | 29 | } |
| 33 | 30 | |
| 34 | 31 | /** |
| @@ -40,9 +37,9 @@ | ||
| 40 | 37 | if ( ! isset( $_POST['key'] ) || strpos( $_POST['key'], '-' ) === false) { |
| 41 | 38 | wp_send_json( |
| 42 | 39 | [ |
| 43 | 40 | 'result' => 'error', |
| 44 | - 'error_message' => esc_attr__('An invalid API key was provided.', 'patchstack') | |
| 41 | + 'error_message' => 'An invalid API key was provided.' | |
| 45 | 42 | ] |
| 46 | 43 | ); |
| 47 | 44 | } |
| 48 | 45 | |
| @@ -47,10 +44,10 @@ | ||
| 47 | 44 | } |
| 48 | 45 | |
| 49 | 46 | // Since we have the keys combined into one now, split them up here. |
| 50 | 47 | $split = explode('-', $_POST['key']); |
| 51 | - $secretkey = trim($split[0]); | |
| 52 | - $clientid = trim($split[1]); | |
| 48 | + $secretkey = $split[0]; | |
| 49 | + $clientid = $split[1]; | |
| 53 | 50 | |
| 54 | 51 | // Test the new keys. |
| 55 | 52 | update_option( 'patchstack_api_token', '' ); |
| 56 | 53 | $results = $this->plugin->activation->alter_license( wp_filter_nohtml_kses( $clientid ), wp_filter_nohtml_kses( $secretkey ), 'activate' ); |
| @@ -88,27 +85,6 @@ | ||
| 88 | 85 | public function activation_status() { |
| 89 | 86 | wp_send_json( [ |
| 90 | 87 | 'activated' => get_option( 'patchstack_clientid', false ) != false |
| 91 | 88 | ] ); |
| 92 | - } | |
| 93 | - | |
| 94 | - /** | |
| 95 | - * Run a connection check on demand and return the new state for the settings card row. | |
| 96 | - * Wraps P_Api::update_license_status() so the existing 422-handling happens for free; a | |
| 97 | - * successful request stamps patchstack_last_sync, which get_last_sync_time() reads back. | |
| 98 | - * | |
| 99 | - * @return void | |
| 100 | - */ | |
| 101 | - public function check_connection() { | |
| 102 | - $this->plugin->api->update_license_status(); | |
| 103 | - | |
| 104 | - $timestamp = $this->get_last_sync_time(); | |
| 105 | - | |
| 106 | - wp_send_json( | |
| 107 | - [ | |
| 108 | - 'connected' => $this->is_connected(), | |
| 109 | - 'timestamp' => $timestamp, | |
| 110 | - 'label' => $this->format_relative_time( $timestamp ), | |
| 111 | - ] | |
| 112 | - ); | |
| 113 | 89 | } |
| 114 | 90 | } |