<?php
/**
 * Transfer Character
 * https://webenginecms.org/
 *
 * @version 1.0.0
 * @author Gabo Development <https://gabodevelop.com/>
 * @copyright (c) 2026 Gabriel Development, All Rights Reserved
 * @build w641ba01901cb0925ec50f543e59acbd
 */

$pageTitle = 'Transfer Character';
if (function_exists('lang')) {
    $translatedTitle = lang('transfercharacter_title', true);
    if (is_string($translatedTitle) && $translatedTitle !== '' && $translatedTitle !== 'ERROR') {
        $pageTitle = $translatedTitle;
    }
}
if (!empty($_SESSION['nexora_transfercharacter_error'])) {
	$errMsg = $_SESSION['nexora_transfercharacter_error'];
	unset($_SESSION['nexora_transfercharacter_error']);
	echo '<div class="nexora-usercp-page nexora-usercp-plugin-wrap">';
	echo '<header class="nexora-usercp-page-header"><h1 class="nexora-usercp-page-title">' . htmlspecialchars($pageTitle) . '</h1></header>';
	echo '<div class="nexora-usercp-panel nexora-usercp-plugin-panel"><div class="nexora-usercp-panel-body">';
	message('error', $errMsg);
	echo '</div></div></div>';
}

if (!isset($errMsg)) {
	try {
		if (!class_exists('Plugin\TransferCharacter\TransferCharacter')) {
			throw new Exception('Plugin disabled.');
		}
		ob_start();
		$TransferCharacter = new Plugin\TransferCharacter\TransferCharacter();
		$TransferCharacter->loadModule('transfer');
		$pluginContent = ob_get_clean();
		echo '<div class="nexora-usercp-page nexora-usercp-plugin-wrap">';
		echo '<header class="nexora-usercp-page-header"><h1 class="nexora-usercp-page-title">' . htmlspecialchars($pageTitle) . '</h1></header>';
		echo '<div class="nexora-usercp-panel nexora-usercp-plugin-panel"><div class="nexora-usercp-panel-body">' . $pluginContent . '</div></div>';
		echo '</div>';
	} catch (Exception $ex) {
		message('error', $ex->getMessage());
	}
}