<?php
/**
 * Uninstall routine for AxcelersBlocks.
 *
 * Runs only when the user deletes the plugin from the WordPress admin
 * (not on deactivation or update). Removes plugin-owned data so nothing
 * is left behind in the database.
 *
 * @package AxcelersBlocks
 */

// Exit if uninstall is not called by WordPress.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
	exit;
}

// Remove the plugin's settings option (responsive device widths).
delete_option( 'axcelersblocks_responsive_settings' );

// Multisite: clean the option from every site in the network.
if ( is_multisite() ) {
	$axcelersblocks_site_ids = get_sites(
		array(
			'fields' => 'ids',
			'number' => 0,
		)
	);

	foreach ( $axcelersblocks_site_ids as $axcelersblocks_site_id ) {
		switch_to_blog( $axcelersblocks_site_id );
		delete_option( 'axcelersblocks_responsive_settings' );
		restore_current_blog();
	}
}
