-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathuninstall.php
65 lines (59 loc) · 1.26 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
56
57
58
59
60
61
62
63
64
65
<?php
/*
* Uninstall plugin
*/
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
exit ();
$option_names = array(
'email_smtp'
, 'email_contenttype'
, 'email_mailer'
, 'email_template_subject'
, 'email_template_body'
, 'email_template_bodyalt'
, 'email_template_sentsuccess'
, 'email_template_sentfailed'
, 'email_template_error'
, 'email_interval'
, 'email_snippet'
, 'email_multiple'
, 'email_imageverify'
, 'email_options'
, 'email_fields'
, 'email_template_title'
, 'email_template_subtitle'
, 'widget_email_most_emailed'
);
if ( is_multisite() ) {
$ms_sites = wp_get_sites();
if( 0 < sizeof( $ms_sites ) ) {
foreach ( $ms_sites as $ms_site ) {
switch_to_blog( $ms_site['blog_id'] );
if( sizeof( $option_names ) > 0 ) {
foreach( $option_names as $option_name ) {
delete_option( $option_name );
plugin_uninstalled();
}
}
}
}
restore_current_blog();
} else {
if( sizeof( $option_names ) > 0 ) {
foreach( $option_names as $option_name ) {
delete_option( $option_name );
plugin_uninstalled();
}
}
}
/**
* Delete plugin table when uninstalled
*
* @access public
* @return void
*/
function plugin_uninstalled() {
global $wpdb;
$email_table = $wpdb->prefix . 'email';
$wpdb->query( "DROP TABLE IF EXISTS $email_table" );
}