<?php
/**
 * Certificate Fix Handler
 *
 * Handles the diagnostics and fixing of certificate-related issues.
 *
 * @package HVAC_Community_Events
 * @subpackage Certificates
 */

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

/**
 * Certificate Fix Handler class.
 */
class HVAC_Certificate_Fix {
    /**
     * The single instance of the class.
     */
    private static $instance = null;

    /**
     * Main instance.
     */
    public static function instance() {
        if (is_null(self::$instance)) {
            self::$instance = new self();
        }
        return self::$instance;
    }

    /**
     * Constructor.
     */
    public function __construct() {
        add_shortcode('hvac_certificate_fix', array($this, 'render_certificate_fix'));
    }

    /**
     * Render certificate fix page content.
     */
    public function render_certificate_fix() {
        // Only administrators can access this page
        if (!current_user_can('manage_options')) {
            return '<div class="hvac-error">You do not have permission to access this page.</div>';
        }
        
        // Include the certificate fix template
        ob_start();
        include HVAC_PLUGIN_DIR . 'templates/certificates/certificate-fix.php';
        return ob_get_clean();
    }
}

// Initialize the class
HVAC_Certificate_Fix::instance();