<?php
/**
 * Plugin Name:       Lens - AI Visibility Monitor
 * Plugin URI:        https://www.ewebmarketing.au/website-design/
 * Description:       See which AI bots crawl your site, what they read, and whether ChatGPT and Perplexity actually cite you. Free analytics dashboard, bring your own API key for AI features.
 * Version:           1.1.5
 * Requires at least: 6.2
 * Requires PHP:      7.4
 * Author:            E-Web Marketing
 * Author URI:        https://www.ewebmarketing.au/
 * License:           GPLv2 or later
 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain:       lens-ai-visibility-monitor
 * Domain Path:       /languages
 *
 * @package WPLens
 */

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

// Plugin constants.
define( 'WPLENS_VERSION', '1.1.5' );
define( 'WPLENS_DB_VERSION', '1.0.0' );
define( 'WPLENS_PLUGIN_FILE', __FILE__ );
define( 'WPLENS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'WPLENS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'WPLENS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );

// PHP version guard — refuse to load on anything older than 7.4.
if ( version_compare( PHP_VERSION, '7.4', '<' ) ) {
	add_action(
		'admin_notices',
		static function () {
			echo '<div class="notice notice-error"><p>';
			echo esc_html__( 'Lens requires PHP 7.4 or higher. Please upgrade your PHP version.', 'lens-ai-visibility-monitor' );
			echo '</p></div>';
		}
	);
	return;
}

// Autoloader.
require_once WPLENS_PLUGIN_DIR . 'includes/class-autoloader.php';
WPLens\Autoloader::register();

// Activation / deactivation hooks.
register_activation_hook( __FILE__, array( 'WPLens\\Activator', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'WPLens\\Deactivator', 'deactivate' ) );

/**
 * Boot the plugin once WordPress has loaded.
 *
 * Translations are loaded automatically by WordPress 4.6+ when the plugin is
 * hosted on WordPress.org, so we no longer manually load text-domain translations.
 */
add_action(
	'plugins_loaded',
	static function () {
		WPLens\Plugin::instance()->boot();
	},
	10
);
