-
Notifications
You must be signed in to change notification settings - Fork 3
/
uninstall.php
36 lines (28 loc) · 1000 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
<?php
// If uninstall is not called from WordPress, exit
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit();
}
//add required files
require_once dirname(__FILE__) . '/rps_result.php';
require_once dirname(__FILE__) . '/RPS/Helper/Function.php';
require_once dirname(__FILE__) . '/RPS/Uninstall.php';
$options = get_option( RPS_Result_Management::PLUGIN_SLUG . '_basics', array() );
if ( !is_multisite() ) {
//check options
if ( isset($options['delete_data']) && $options['delete_data'] == 'on' ) {
RPS_Uninstall::getInstance();
}
} else {
global $wpdb;
// Get all blogs in the network and activate plugin on each one
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
foreach ( $blog_ids as $blog_id ) {
switch_to_blog( $blog_id );
//check options
if ( isset($options['delete_data']) && $options['delete_data'] == 'on' ) {
RPS_Uninstall::getInstance();
}
restore_current_blog();
}
}