<?php
/**
 * Plugin Name: WebAbility Accessibility Widget
 * Plugin URI: https://webability.io/
 * Description: AI-powered accessibility widget for WCAG 2.2, ADA, Section 508, and EAA compliance. Includes accessibility profiles, text adjustments, color controls, and a built-in statement generator.
 * Version: 2.3.3
 * Author: WebAbility.io
 * Author URI: https://webability.io/
 * License: GPLv2 or later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: webability-accessibility-widget
 * Requires at least: 5.8
 * Tested up to: 6.9
 * Requires PHP: 7.4
 */

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

// Plugin version constant
define('WEBABILITY_WIDGET_VERSION', '2.3.1');

// Define plugin paths
define('WEBABILITY_WIDGET_PATH', plugin_dir_path(__FILE__));
define('WEBABILITY_WIDGET_URL', plugin_dir_url(__FILE__));

// Define the option key
define('WEBABILITY_ACWG_OPT_KEY', 'webability_options');

// Load plugin files
require_once WEBABILITY_WIDGET_PATH . 'includes/settings.php';
require_once WEBABILITY_WIDGET_PATH . 'includes/admin-page.php';
require_once WEBABILITY_WIDGET_PATH . 'includes/frontend.php';
require_once WEBABILITY_WIDGET_PATH . 'includes/verify.php';
// require_once WEBABILITY_WIDGET_PATH . 'includes/scanner.php';
// require_once WEBABILITY_WIDGET_PATH . 'includes/fixer.php';
// require_once WEBABILITY_WIDGET_PATH . 'includes/admin-scanner-page.php';
require_once WEBABILITY_WIDGET_PATH . 'includes/admin-design-page.php';
require_once WEBABILITY_WIDGET_PATH . 'includes/admin-statement-page.php';

// Plugin activation hook
register_activation_hook(__FILE__, 'webability_acwg_activate');

// Plugin deactivation hook
register_deactivation_hook(__FILE__, 'webability_acwg_deactivate');

/**
 * Plugin activation callback
 */
function webability_acwg_activate() {
    // Add default options if they don't exist
    if (!get_option(WEBABILITY_ACWG_OPT_KEY)) {
        add_option(WEBABILITY_ACWG_OPT_KEY, webability_acwg_defaults());
    }


    // Clear any cached data
    if (function_exists('wp_cache_flush')) {
        wp_cache_flush();
    }
}

/**
 * Plugin deactivation callback
 */
function webability_acwg_deactivate() {
    // Clean up if needed (optional)
    // Note: We don't delete options here as user might reactivate
}
