<?php
namespace Actirise\Includes;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

use Actirise\Includes\Cron;
use Actirise\Includes\Options;
use Actirise\Includes\EventAnnotation;
use ActirisePublic\Includes\AdsTxt;

/**
 * Fired during plugin desactivation.
 *
 * This class defines all code necessary to run during the plugin's desactivation.
 *
 * @link       https://actirise.com
 * @since      2.0.0
 * @package    actirise
 * @subpackage actirise/includes
 * @author     actirise <wordpress@actirise.com>
 */
final class Desactivator {

	/**
	 * Desactivate the plugin and remove schedule cron.
	 *
	 * @since    2.0.0
	 * @return void
	 */
	public static function desactivate() {
		if ( ACTIRISE_CRON === 'true' ) {
			wp_clear_scheduled_hook( 'actirise_cron_update_adstxt' );
			wp_clear_scheduled_hook( 'actirise_cron_update_presized_div' );
			wp_clear_scheduled_hook( 'actirise_cron_update_debug_token' );
			wp_clear_scheduled_hook( 'actirise_cron_update_fast_cmp' );
			wp_clear_scheduled_hook( 'actirise_cron_check_slots' );
			wp_clear_scheduled_hook( 'actirise_cron_event_annotation' );
			wp_clear_scheduled_hook( 'actirise_cron_check_optimization' );
			wp_clear_scheduled_hook( 'actirise_cron_check_adstxt_followup' );
			delete_transient( Cron::ADSTXT_FOLLOWUP_ATTEMPT_TRANSIENT );
		}

		AdsTxt::delete_file();
	}
}
