<?php
/**
 * Uninstall routine for Kripanov Anticopia.
 *
 * Executed by WordPress when the plugin is deleted from the Plugins screen.
 * Removes any option stored in the database, including in multisite setups.
 *
 * @package KripanovAnticopia
 * @since   1.0.0
 */

if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
    exit;
}

$kripanov_anticopia_option_name = 'kripanov_anticopia_settings';

if ( is_multisite() ) {
    $kripanov_anticopia_sites = get_sites(
        array(
            'fields' => 'ids',
            'number' => 0,
        )
    );
    foreach ( $kripanov_anticopia_sites as $kripanov_anticopia_site_id ) {
        switch_to_blog( (int) $kripanov_anticopia_site_id );
        delete_option( $kripanov_anticopia_option_name );
        restore_current_blog();
    }
    delete_site_option( $kripanov_anticopia_option_name );
} else {
    delete_option( $kripanov_anticopia_option_name );
}
