<?php
/**
 * Postomatic Plugin.
 *
 * A powerful plugin for creating multiple
 * high-quality blog posts with SEO-optimized content.
 *
 * PHP Version 7.4
 *
 * @package          Postomatic
 * @category         Plugin
 * @copyright        2024 Buildomatics
 * @license          GPL-2.0-or-later https://www.gnu.org/licenses/gpl-2.0.html
 * @link             https://buildomatics.com/postomatic
 * @since            1.0.0
 * @php              8.0
 * @wordpress-plugin
 * Plugin Name: Postomatic
 * Plugin URI:  https://buildomatics.com/postomatics
 * Description: AI-powered blog post generator with one-click writing and AutoPilot
 *              scheduling. Automatically detects WooCommerce, Easy Digital
 *              Downloads, or SureCart to write product promotion and comparison
 *              posts, and fills in SEO fields for Yoast, Rank Math, AIOSEO,
 *              SEOPress, and more. Every post starts as a draft for your review.
 * Version:     1.2.75
 * Author:      Buildomatics
 * Author URI:  https://buildomatics.com
 * License:     GPL2
 * Requires at least: 5.8
 * Requires PHP: 7.4
 * Text Domain: postomatic
 * Domain Path: /languages
 */

namespace Postomatic;

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

if ( version_compare( PHP_VERSION, '7.4', '<' ) ) {
	// We'll handle this notice in the Admin_Hooks class.
	return;
}

/**
 * Plugin Core Constants.
 *
 * Define essential constants for the Postomatic plugin.
 */
// Plugin version and basic information.
define( 'POSTOMATIC_VERSION', '1.2.75' );
define( 'POSTOMATIC_PLUGIN_NAME', 'postomatic' );

// Plugin paths and URLs.
define( 'POSTOMATIC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'POSTOMATIC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'POSTOMATIC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );

/**
 * AJAX callback to get attachment image HTML using WordPress standards.
 *
 * This section handles the AJAX functionality for retrieving and formatting
 * attachment images according to WordPress coding standards.
 */

// Autoload Plugin Classes.
require_once POSTOMATIC_PLUGIN_DIR . 'includes/autoloader.php';

// Include essential plugin components.
require_once POSTOMATIC_PLUGIN_DIR . 'includes/class-constants.php';

// Register lifecycle hooks.
Core\Lifecycle_Manager::register_hooks();

// Load core functionality.
$postomatic_core = new Core\Core();
$postomatic_core->run();


// Load API Endpoints.
require_once POSTOMATIC_PLUGIN_DIR . 'includes/class-api-loader.php';

// Load API endpoints.
Core\API_Loader::load_api_endpoints();

// Load internationalization (i18n).
require_once POSTOMATIC_PLUGIN_DIR . 'includes/i18n.php';
