<?php

/**
 * CodePress CMS Core Loader
 * 
 * This file serves as the central entry point for the CodePress CMS core system.
 * It loads all essential classes and configuration needed for the CMS to function.
 * 
 * Architecture:
 * - config.php: Configuration loader that merges default settings with config.json
 * - SimpleTemplate.php: Lightweight template engine for rendering HTML with placeholders
 * - CodePressCMS.php: Main CMS class handling content, navigation, search, and rendering
 * 
 * Usage:
 * This file is included by public/index.php, which then:
 * 1. Loads configuration from config.php
 * 2. Creates a new CodePressCMS instance with the config
 * 3. Calls render() to output the complete page
 * 
 * The separation allows for:
 * - Clean public entry point (public/index.php)
 * - Reusable core components
 * - Proper class organization with PHPDoc documentation
 */

// Load configuration system - handles default settings and config.json merging
require_once 'config.php';

// Load Composer autoloader
$autoloader = dirname(__DIR__, 2) . '/vendor/autoload.php';
if (file_exists($autoloader)) {
    require_once $autoloader;
}

// Load template engine - renders HTML with {{variable}} placeholders and conditionals
require_once 'class/SimpleTemplate.php';

// Load Logger class - structured logging with log levels
require_once 'class/Logger.php';

// Load Plugin system
require_once 'plugin/CMSAPI.php';
require_once 'plugin/PluginManager.php';

// Load main CMS class - handles content parsing, navigation, search, and page rendering
require_once 'class/CodePressCMS.php';

// Initialize logger (debug mode can be enabled in config)
Logger::init();