-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuninstall.php
55 lines (50 loc) · 1.02 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
<?php
/**
* The plugin uninstall script.
*
* @package soter
*/
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
die;
}
if ( ! function_exists( '_soter_require_if_exists' ) ) {
/**
* Require a file (once) if it exists.
*
* Needed because the main plugin file isn't loaded on uninstall. Wrapped in a
* conditional check just to be safe.
*
* @param string $file The file to check and require.
*
* @return void
*/
function _soter_require_if_exists( $file ) {
if ( file_exists( $file ) ) {
require_once $file;
}
}
}
/**
* The plugin uninstaller.
*
* @return void
*/
function _soter_uninstall() {
$options = [
'soter_email_address',
'soter_email_enabled',
'soter_email_type',
'soter_ignored_plugins',
'soter_ignored_themes',
'soter_installed_version',
'soter_last_scan_hash',
'soter_should_nag',
'soter_slack_enabled',
'soter_slack_url',
];
foreach ( $options as $option ) {
delete_option( $option );
}
}
_soter_require_if_exists( __DIR__ . '/vendor/autoload.php' );
_soter_uninstall();