| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* The code in this file runs when a plugin is uninstalled from the WordPress dashboard. |
| 5 |
*/ |
| 6 |
|
| 7 |
/* If uninstall is not called from WordPress exit. */ |
| 8 |
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
/** |
| 13 |
* Remove all plugin options for the current site. |
| 14 |
*/ |
| 15 |
function wsc_proofreader_uninstall_site() { |
| 16 |
delete_option( 'wsc' ); |
| 17 |
delete_option( 'wsc_proofreader_version' ); |
| 18 |
delete_option( 'wsc_proofreader_info' ); |
| 19 |
delete_option( 'wsc_proofreader' ); |
| 20 |
delete_transient( 'wsc_proofreader_info_cache' ); |
| 21 |
} |
| 22 |
|
| 23 |
if ( is_multisite() ) { |
| 24 |
$wsc_site_ids = get_sites( array( 'fields' => 'ids', 'number' => 0 ) ); |
| 25 |
foreach ( $wsc_site_ids as $wsc_site_id ) { |
| 26 |
switch_to_blog( $wsc_site_id ); |
| 27 |
wsc_proofreader_uninstall_site(); |
| 28 |
restore_current_blog(); |
| 29 |
} |
| 30 |
} else { |
| 31 |
wsc_proofreader_uninstall_site(); |
| 32 |
} |
| 33 |
|