| 1 |
<?php |
| 2 |
/* |
| 3 |
* Uninstall plugin |
| 4 |
*/ |
| 5 |
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) |
| 6 |
exit (); |
| 7 |
|
| 8 |
$option_names = array( |
| 9 |
'stats_mostlimit' |
| 10 |
, 'stats_display' |
| 11 |
, 'stats_url' |
| 12 |
, 'widget_stats' |
| 13 |
); |
| 14 |
|
| 15 |
|
| 16 |
if ( is_multisite() ) { |
| 17 |
$ms_sites = wp_get_sites(); |
| 18 |
|
| 19 |
if( 0 < sizeof( $ms_sites ) ) { |
| 20 |
foreach ( $ms_sites as $ms_site ) { |
| 21 |
switch_to_blog( $ms_site['blog_id'] ); |
| 22 |
if( sizeof( $option_names ) > 0 ) { |
| 23 |
foreach( $option_names as $option_name ) { |
| 24 |
delete_option( $option_name ); |
| 25 |
plugin_uninstalled(); |
| 26 |
} |
| 27 |
} |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
restore_current_blog(); |
| 32 |
} else { |
| 33 |
if( sizeof( $option_names ) > 0 ) { |
| 34 |
foreach( $option_names as $option_name ) { |
| 35 |
delete_option( $option_name ); |
| 36 |
plugin_uninstalled(); |
| 37 |
} |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Delete plugin table when uninstalled |
| 43 |
* |
| 44 |
* @access public |
| 45 |
* @return void |
| 46 |
*/ |
| 47 |
function plugin_uninstalled() { |
| 48 |
global $wpdb; |
| 49 |
} |