| 1 |
<?php |
| 2 |
/** |
| 3 |
* Delete options upon uninstall to prevent issues with other plugins and leaving trash behind. |
| 4 |
*/ |
| 5 |
|
| 6 |
// Exit, if uninstall.php was not called from WordPress. |
| 7 |
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 8 |
die(); |
| 9 |
} |
| 10 |
|
| 11 |
$option_name = 'MatomoAnalyticsPP'; |
| 12 |
$plugin_name = "simple-matomo-tracking-code/simple-matomo-tracking-code.php"; |
| 13 |
|
| 14 |
if( !is_multisite()) { |
| 15 |
delete_option( $option_name ); |
| 16 |
} |
| 17 |
else { |
| 18 |
$sites = get_sites( [ 'number' => 99999 ] ); |
| 19 |
|
| 20 |
foreach ( $sites as $site ) { |
| 21 |
switch_to_blog( intval( $site->blog_id ) ); |
| 22 |
|
| 23 |
deactivate_plugins( $plugin_name ); |
| 24 |
delete_option( $option_name ); |
| 25 |
|
| 26 |
restore_current_blog(); |
| 27 |
} |
| 28 |
|
| 29 |
delete_site_option( $option_name ); |
| 30 |
} |
| 31 |
?> |