<?php
/**
 * Runs when the plugin is deleted from the WordPress admin.
 * Removes all plugin options and transients from the database.
 *
 * @package FENSE_BPVT
 */

if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
	exit;
}

$DB_KEY = 'FENSE_BPVT_DEVOZON_';

$option_keys = [
	'enable_dtg', 'licence_key', 'enable_on_custom', 'enable_on_logged_users',
	'enable_on_posts', 'enable_on_pages', 'enable_on_login', 'enable_cache',
	'show_link', 'show_link_val', 'protection_mode', 'restrict_message',
	'redirect_to_url', 'block_vpn', 'block_proxy', 'block_vps',
	'crawlers_bots', 'crawlers_bots_data',
	'ip_whitelisting_enable', 'ip_whitelisting', 'ip_whitelisting_range',
	'ip_blacklisting_enable', 'ip_blacklisting', 'ip_blacklisting_range',
	'enable_country', 'disable_country', 'restrict_enable_country', 'restrict_disable_country',
	'restrict_domain', 'cache_safe_mode', 'enable_stats', 'api_data', 'api_data_time',
	'url_mode', 'specific_pages', 'url_prefixes', 'excluded_urls', 'tg_wp_version',
	'tg_wp_version_time',
];

// delete transient
const TRANS_TO_DELETE = [
	'plugin_settings',
	'is_api_key_valid',
	'is_daily_limit_reached',
	'api_data',
	'api_data_time',
	'is_daily_limit_reached',
];

foreach ( $option_keys as $key ) {
	delete_option( $DB_KEY . $key );
}

foreach ( TRANS_TO_DELETE as $t ) {
	delete_transient( $DB_KEY . $t );
}



