PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.3.2
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.3.2
3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 All 194 releases
convertkit / uninstall.php

uninstall.php in Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages 3.3.2, at uninstall.php

76 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Uninstall routine. Runs when the Plugin is deleted
4 * at Plugins > Delete.
5 *
6 * @package ConvertKit
7 * @author ConvertKit
8 */
9
10 // If uninstall.php is not called by WordPress, die.
11 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
12 die;
13 }
14
15 // Only WordPress and PHP methods can be used. Plugin classes and methods
16 // are not reliably available due to the Plugin being deactivated and going
17 // through deletion now.
18
19 // Get settings.
20 $settings = get_option( '_wp_convertkit_settings' );
21
22 // Bail if no settings exist.
23 if ( ! $settings ) {
24 return;
25 }
26
27 // Revoke Access Token.
28 if ( array_key_exists( 'access_token', $settings ) && ! empty( $settings['access_token'] ) ) {
29 wp_remote_post(
30 'https://api.kit.com/v4/oauth/revoke',
31 array(
32 'headers' => array(
33 'Accept' => 'application/json',
34 'Content-Type' => 'application/json',
35 ),
36 'body' => wp_json_encode(
37 array(
38 'client_id' => 'HXZlOCj-K5r0ufuWCtyoyo3f688VmMAYSsKg1eGvw0Y',
39 'token' => $settings['access_token'],
40 )
41 ),
42 'timeout' => 5,
43 )
44 );
45 }
46
47 // Revoke Refresh Token.
48 if ( array_key_exists( 'refresh_token', $settings ) && ! empty( $settings['refresh_token'] ) ) {
49 wp_remote_post(
50 'https://api.kit.com/v4/oauth/revoke',
51 array(
52 'headers' => array(
53 'Accept' => 'application/json',
54 'Content-Type' => 'application/json',
55 ),
56 'body' => wp_json_encode(
57 array(
58 'client_id' => 'HXZlOCj-K5r0ufuWCtyoyo3f688VmMAYSsKg1eGvw0Y',
59 'token' => $settings['refresh_token'],
60 )
61 ),
62 'timeout' => 5,
63 )
64 );
65 }
66
67 // Remove credentials from settings.
68 $settings['access_token'] = '';
69 $settings['refresh_token'] = '';
70 $settings['token_expires'] = '';
71 $settings['api_key'] = '';
72 $settings['api_secret'] = '';
73
74 // Save settings.
75 update_option( '_wp_convertkit_settings', $settings );
76