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