| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package Catch_web_tools |
| 4 |
* @version 1.0 |
| 5 |
* Code used when the plugin is removed (not just deactivated but actively deleted through the WordPress Admin). |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) |
| 9 |
exit(); |
| 10 |
|
| 11 |
$options = array( 'catchwebtools_webmaster', |
| 12 |
'catchwebtools_opengraph', |
| 13 |
'catchwebtools_custom_css', |
| 14 |
'catchwebtools_seo', |
| 15 |
'catchwebtools_social', |
| 16 |
'catchwebtools_catchids' |
| 17 |
); |
| 18 |
|
| 19 |
$transient_options = array( 'catchwebtools_webmaster_transient', |
| 20 |
'catchwebtools_opengraph_transient', |
| 21 |
'catchwebtools_custom_css_transient', |
| 22 |
'catchwebtools_seo_transient', |
| 23 |
'catchwebtools_social_transient', |
| 24 |
'catchwebtools_catchids_transient' |
| 25 |
); |
| 26 |
|
| 27 |
// For Single site |
| 28 |
if ( !is_multisite() ) |
| 29 |
{ |
| 30 |
foreach ( $options as $option) { |
| 31 |
delete_option( $option ); |
| 32 |
} |
| 33 |
foreach ( $transient_options as $option) { |
| 34 |
delete_transient( $option ); |
| 35 |
} |
| 36 |
} |
| 37 |
// For Multisite |
| 38 |
else |
| 39 |
{ |
| 40 |
global $wpdb; |
| 41 |
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); |
| 42 |
$original_blog_id = get_current_blog_id(); |
| 43 |
foreach ( $blog_ids as $blog_id ) |
| 44 |
{ |
| 45 |
switch_to_blog( $blog_id ); |
| 46 |
foreach ( $options as $option) { |
| 47 |
delete_site_option( $option ); |
| 48 |
} |
| 49 |
foreach ( $transient_options as $option) { |
| 50 |
delete_transient( $option ); |
| 51 |
} |
| 52 |
} |
| 53 |
switch_to_blog( $original_blog_id ); |
| 54 |
} |