-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
42 lines (34 loc) · 1.02 KB
/
uninstall.php
File metadata and controls
42 lines (34 loc) · 1.02 KB
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
<?php
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
exit;
}
// If uninstall not called from WordPress, then exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
// Important: Check if the file is the one
// that was registered during the uninstall hook.
if ( basename(__DIR__) . '/mtcf.php' !== WP_UNINSTALL_PLUGIN ) {
exit;
}
// Check if the $_REQUEST content actually is the plugin name
if ( isset( $_REQUEST['checked'] ) && ! in_array( basename(__DIR__) . '/mtcf.php', $_REQUEST['checked'] ) ) {
exit;
}
if ( ! in_array( $_REQUEST['action'], array( 'delete-plugin', 'delete-selected' ) ) ) {
exit;
}
// Check user roles.
if ( ! current_user_can( 'activate_plugins' ) ) {
exit;
}
// Run an admin referrer check to make sure it goes through authentication
if ( defined('DOING_AJAX') && DOING_AJAX ) {
check_ajax_referer( 'updates' );
} else {
check_admin_referer( 'bulk-plugins' );
}
global $wpdb;
// delete options
$wpdb->query("DELETE FROM {$wpdb->options} WHERE `option_name` LIKE 'mtcf_%'");