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