| 1 |
<?php |
| 2 |
/** |
| 3 |
* Fired when the plugin is uninstalled. |
| 4 |
* |
| 5 |
* When populating this file, consider the following flow |
| 6 |
* of control: |
| 7 |
* |
| 8 |
* - This method should be static |
| 9 |
* - Check if the $_REQUEST content actually is the plugin name |
| 10 |
* - Init an admin referrer check to make sure it goes through authentication |
| 11 |
* - Verify the output of $_GET makes sense |
| 12 |
* - Repeat with other user roles. Best directly by using the links/query string parameters. |
| 13 |
* - Repeat things for multisite. Once for a single site in the network, once sitewide. |
| 14 |
* |
| 15 |
* @author Paul Kilmurray <paul@kilbot.com.au> |
| 16 |
* |
| 17 |
* @see http://www.woopos.com.au |
| 18 |
* @package WooCommercePOS |
| 19 |
*/ |
| 20 |
|
| 21 |
// If uninstall not called from WordPress, then exit. |
| 22 |
if ( ! \defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 23 |
exit; |
| 24 |
} |
| 25 |
|
| 26 |
// Analytics identity (landing-experiments spec §5.1: deleted on uninstall). |
| 27 |
if ( \function_exists( 'is_multisite' ) && is_multisite() ) { |
| 28 |
$woocommerce_pos_sites = get_sites( array( 'fields' => 'ids' ) ); |
| 29 |
|
| 30 |
foreach ( $woocommerce_pos_sites as $woocommerce_pos_site_id ) { |
| 31 |
switch_to_blog( (int) $woocommerce_pos_site_id ); |
| 32 |
delete_option( 'wcpos_anon_id' ); |
| 33 |
restore_current_blog(); |
| 34 |
} |
| 35 |
} else { |
| 36 |
delete_option( 'wcpos_anon_id' ); |
| 37 |
} |
| 38 |
|