| @@ -15,23 +15,8 @@ | ||
| 15 | 15 | // Only WordPress and PHP methods can be used. Plugin classes and methods |
| 16 | 16 | // are not reliably available due to the Plugin being deactivated and going |
| 17 | 17 | // through deletion now. |
| 18 | 18 | |
| 19 | -// Delete the log file from the uploads directory. | |
| 20 | -// The Plugin's own directory is deleted by WordPress once this routine completes, | |
| 21 | -// so any historic log file stored there doesn't need deleting here. | |
| 22 | -// This mirrors ConvertKit_Log::get_log_file_name() in the Kit WordPress Libraries, | |
| 23 | -// which we can't call as the Plugin's classes aren't reliably available. | |
| 24 | -$upload_dir = wp_upload_dir(); | |
| 25 | -if ( empty( $upload_dir['error'] ) && ! empty( $upload_dir['basedir'] ) ) { | |
| 26 | - $log_slug = sanitize_key( basename( __DIR__ ) ); | |
| 27 | - $log_file = trailingslashit( $upload_dir['basedir'] ) . 'kit-logs/' . $log_slug . '-' . wp_hash( $log_slug ) . '.log'; | |
| 28 | - | |
| 29 | - if ( file_exists( $log_file ) ) { | |
| 30 | - wp_delete_file( $log_file ); | |
| 31 | - } | |
| 32 | -} | |
| 33 | - | |
| 34 | 19 | // Get settings. |
| 35 | 20 | $settings = get_option( '_wp_convertkit_settings' ); |
| 36 | 21 | |
| 37 | 22 | // Bail if no settings exist. |
| @@ -44,14 +29,16 @@ | ||
| 44 | 29 | wp_remote_post( |
| 45 | 30 | 'https://api.kit.com/v4/oauth/revoke', |
| 46 | 31 | array( |
| 47 | 32 | 'headers' => array( |
| 48 | - 'Content-Type' => 'application/x-www-form-urlencoded', | |
| 33 | + 'Accept' => 'application/json', | |
| 34 | + 'Content-Type' => 'application/json', | |
| 49 | 35 | ), |
| 50 | - 'body' => array( | |
| 51 | - 'client_id' => 'HXZlOCj-K5r0ufuWCtyoyo3f688VmMAYSsKg1eGvw0Y', | |
| 52 | - 'token' => $settings['access_token'], | |
| 53 | - 'token_type_hint' => 'access_token', | |
| 36 | + 'body' => wp_json_encode( | |
| 37 | + array( | |
| 38 | + 'client_id' => 'HXZlOCj-K5r0ufuWCtyoyo3f688VmMAYSsKg1eGvw0Y', | |
| 39 | + 'token' => $settings['access_token'], | |
| 40 | + ) | |
| 54 | 41 | ), |
| 55 | 42 | 'timeout' => 5, |
| 56 | 43 | ) |
| 57 | 44 | ); |
| @@ -62,14 +49,16 @@ | ||
| 62 | 49 | wp_remote_post( |
| 63 | 50 | 'https://api.kit.com/v4/oauth/revoke', |
| 64 | 51 | array( |
| 65 | 52 | 'headers' => array( |
| 66 | - 'Content-Type' => 'application/x-www-form-urlencoded', | |
| 53 | + 'Accept' => 'application/json', | |
| 54 | + 'Content-Type' => 'application/json', | |
| 67 | 55 | ), |
| 68 | - 'body' => array( | |
| 69 | - 'client_id' => 'HXZlOCj-K5r0ufuWCtyoyo3f688VmMAYSsKg1eGvw0Y', | |
| 70 | - 'token' => $settings['refresh_token'], | |
| 71 | - 'token_type_hint' => 'refresh_token', | |
| 56 | + 'body' => wp_json_encode( | |
| 57 | + array( | |
| 58 | + 'client_id' => 'HXZlOCj-K5r0ufuWCtyoyo3f688VmMAYSsKg1eGvw0Y', | |
| 59 | + 'token' => $settings['refresh_token'], | |
| 60 | + ) | |
| 72 | 61 | ), |
| 73 | 62 | 'timeout' => 5, |
| 74 | 63 | ) |
| 75 | 64 | ); |