-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.php
48 lines (36 loc) · 1.01 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
<?php
/**
* Trigger this file on Plugin delete/uninstall
*
* @package Strongetic - count page visits
* @since 1.0.0
*/
// If uninstall not called from WordPress exit
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
// Clear database stored data.
STRCPV_deletePluginData();
/**
* DELETE PLUGIN DATA
*
* DESC: Delete plugin data if settings option
* "Do not delete plugin data on plugin delete/uninstall" is unchecked.
*
* @since 1.0.0
*/
function STRCPV_deletePluginData() {
// Check "Do not delete plugin data on plugin delete/uninstall" option value.
$delete_plugin_data = get_option( 'strcpv_delete_plugin_data' );
if ( $delete_plugin_data === 'NO' ) {
return; // Abort.
}
// DELETE OPTIONS.
delete_option( 'strcpv_total_visits' );
delete_option( 'strcpv_visits_by_page' );
delete_option( 'strcpv_hidden_page_reports' );
delete_option( 'strcpv_count_refresh' );
delete_option( 'strcpv_delete_plugin_data' );
// DELETE TRANSIENTS.
delete_transient( 'strcpv_page_refreshed_data' );
}