| 1 |
<?php |
| 2 |
/** |
| 3 |
* Runs the uninstallation routines when the plugin is deactivated. |
| 4 |
* |
| 5 |
* @since 1.2.2 |
| 6 |
* |
| 7 |
* @param bool $network_wide Is network wide deactivation |
| 8 |
*/ |
| 9 |
function wp_to_buffer_deactivate( $network_wide ) { |
| 10 |
|
| 11 |
// Initialise Plugin |
| 12 |
$wp_to_buffer = WP_To_Buffer::get_instance(); |
| 13 |
$wp_to_buffer->initialize(); |
| 14 |
|
| 15 |
// Check if we are on a multisite install, activating network wide, or a single install |
| 16 |
if ( ! is_multisite() || ! $network_wide ) { |
| 17 |
// Single Site deactivation |
| 18 |
$wp_to_buffer->get_class( 'install' )->uninstall(); |
| 19 |
} else { |
| 20 |
// Multisite network wide deactivation |
| 21 |
$sites = get_sites( array( |
| 22 |
'number' => 0, |
| 23 |
) ); |
| 24 |
foreach ( $sites as $site ) { |
| 25 |
switch_to_blog( $site->blog_id ); |
| 26 |
$wp_to_buffer->get_class( 'install' )->uninstall(); |
| 27 |
restore_current_blog(); |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
} |