-
Notifications
You must be signed in to change notification settings - Fork 14
/
uninstall.php
45 lines (35 loc) · 950 Bytes
/
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
<?php
/**
* Fired when the plugin is uninstalled.
*
* @link https://wpsocio.com
* @since 1.0.0
*
* @package WPTelegram
*/
// If uninstall not called from WordPress, then exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) || ! WP_UNINSTALL_PLUGIN || dirname( WP_UNINSTALL_PLUGIN ) !== dirname( plugin_basename( __FILE__ ) ) ) {
status_header( 404 );
exit;
}
$options = get_option( 'wptelegram', '' );
$options = json_decode( $options, true );
/**
* Cleans up the stale data.
*
* @return void
*/
function uninstall_wptelegram() {
if ( isset( $options['advanced']['clean_uninstall'] ) && false === $options['advanced']['clean_uninstall'] ) {
return;
}
$uninstall_options = [
'wptelegram',
'wptelegram_ver',
];
$uninstall_options = (array) apply_filters( 'wptelegram_uninstall_options', $uninstall_options );
foreach ( $uninstall_options as $option ) {
delete_option( $option );
}
}
uninstall_wptelegram();