| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Fired when the plugin is uninstalled. |
| 5 |
* |
| 6 |
* @link https://themeatelier.net |
| 7 |
* @since 1.0.0 |
| 8 |
* |
| 9 |
* @package chat-help |
| 10 |
* @subpackage chat-help/src/Admin/Views/Advance |
| 11 |
* @author ThemeAtelier<themeatelierbd@gmail.com> |
| 12 |
*/ |
| 13 |
|
| 14 |
// If uninstall not called from WordPress, then exit. |
| 15 |
if (! defined('WP_UNINSTALL_PLUGIN')) { |
| 16 |
exit; |
| 17 |
} |
| 18 |
|
| 19 |
/** |
| 20 |
* Delete plugin data function. |
| 21 |
* |
| 22 |
* @return void |
| 23 |
*/ |
| 24 |
function chat_help_delete_plugin_data() |
| 25 |
{ |
| 26 |
global $wpdb; |
| 27 |
// Delete plugin option settings. |
| 28 |
$options = [ |
| 29 |
'cwp_option', |
| 30 |
'ch_wooCommerce', |
| 31 |
'ch_shortcode', |
| 32 |
'ch_settings', |
| 33 |
'ch_help', |
| 34 |
'chat_help_version', |
| 35 |
'chat_help_db_version', |
| 36 |
'chat_help_first_version', |
| 37 |
'chat_help_activation_date', |
| 38 |
'themeatelier_offer_banner_dismissed_new_year_2026', |
| 39 |
]; |
| 40 |
|
| 41 |
foreach ($options as $option_name) { |
| 42 |
delete_option($option_name); // Delete regular option. |
| 43 |
delete_site_option($option_name); // Delete multisite option. |
| 44 |
} |
| 45 |
|
| 46 |
// delete leads table |
| 47 |
$table_name = $wpdb->prefix . 'chat_help_leads'; |
| 48 |
$wpdb->query("DROP TABLE IF EXISTS `$table_name`"); |
| 49 |
$table_name_analytics = $wpdb->prefix . 'chat_help_analytics'; |
| 50 |
$wpdb->query("DROP TABLE IF EXISTS `$table_name_analytics`"); |
| 51 |
} |
| 52 |
|
| 53 |
// Load WPTP file. |
| 54 |
require plugin_dir_path(__FILE__) . '/chat-whatsapp.php'; |
| 55 |
$ch_settings = get_option('ch_settings'); |
| 56 |
$chat_help_data_delete = isset($ch_settings['cleanup_data_deletion']) ? $ch_settings['cleanup_data_deletion'] : false; |
| 57 |
|
| 58 |
if ($chat_help_data_delete) { |
| 59 |
chat_help_delete_plugin_data(); |
| 60 |
} |
| 61 |
|