-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.php
111 lines (100 loc) · 2.26 KB
/
uninstall.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// if uninstall not called from WordPress exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
/*
* Only remove ALL product and page data if WC_REMOVE_ALL_DATA constant is set to true in user's
* wp-config.php. This is to prevent data loss when deleting the plugin from the backend
* and to ensure only the site owner can perform this action.
*/
$order_status_fields = [
'order_status_new',
'order_status_in_progress',
'order_status_declined',
'order_status_authorized',
'order_status_completed',
'order_status_canceled',
'order_status_voided',
'order_status_refunded',
'order_status_charged_back',
'order_status_chargeback_resolved',
'order_status_terminated',
];
foreach ( $order_status_fields as $field ) {
delete_option( "woocommerce_unlimit_{$field}" );
}
$delete_options = [
'bankcard' => [
'payment_page',
'capture_payment',
'installment_enabled',
'minimum_installment_amount',
'maximum_accepted_installments',
'ask_cpf',
'dynamic_descriptor',
],
'apay' => [
'merchant_certificate',
'apple_merchant_id',
'merchant_key',
],
'boleto' => [],
'gpay' => [
'google_merchant_id',
],
'mbway' => [
'payment_page',
],
'multibanco' => [
'payment_page',
],
'paypal' => [
'payment_page',
],
'pix' => [],
'sepa' => [
'payment_page',
],
'spei' => [
'payment_page',
],
// Добавьте сюда другие опции, если необходимо
];
$common_fields = [
'terminal_code',
'terminal_password',
'callback_secret',
'test_environment',
'payment_title',
'log_to_file',
];
foreach ( $delete_options as $option => $fields ) {
foreach ( $fields as $field ) {
delete_option( "woocommerce_unlimit_{$option}_{$field}" );
}
foreach ( $common_fields as $common_field ) {
delete_option( "woocommerce_unlimit_{$option}_{$common_field}" );
}
}
$delete_options = [
'custom',
'apay',
'ticket',
'gpay',
'mbway',
'multibanco',
'paypal',
'pix',
'sepa',
'spei',
];
foreach ( $delete_options as $option ) {
delete_option( "woocommerce_woo-unlimit-{$option}_settings" );
}
global $wpdb;
$table_name = $wpdb->prefix . 'ul_recurring_data';
$wpdb->query( "DROP TABLE IF EXISTS `$table_name`" );