' . esc_html('Gatecraft is already loaded from another plugin folder, so this copy is switched off. Deactivate one of the two.') . '
';
});
return;
}
define('GATECRAFT_VERSION', '2026.1.3.9');
define('GATECRAFT_DB_VERSION', 18);
define('GATECRAFT_FILE', __FILE__);
define('GATECRAFT_DIR', plugin_dir_path(__FILE__));
define('GATECRAFT_URL', plugin_dir_url(__FILE__));
/** Missing PHP extensions stop activation with a clear message instead of a fatal error later. */
if (!function_exists(__NAMESPACE__ . '\\gatecraft_requirements')) {
function gatecraft_requirements(): array
{
$missing = [];
if (PHP_VERSION_ID < 80100) $missing[] = 'PHP 8.1 or newer (this server runs ' . PHP_VERSION . ')';
foreach (['sodium', 'gd', 'mbstring', 'openssl'] as $ext) if (!extension_loaded($ext)) $missing[] = "PHP extension: $ext";
return $missing;
}
}
if (gatecraft_requirements()) {
add_action('admin_notices', function () {
echo 'Gatecraft cannot run on this server. Missing: ' . esc_html(implode(', ', gatecraft_requirements())) . '
';
});
return;
}
spl_autoload_register(function (string $class) {
$prefix = 'Gatecraft\\Lib\\chillerlan\\';
if (!str_starts_with($class, $prefix)) return;
$rel = substr($class, strlen($prefix));
[$pkg, $rest] = array_pad(explode('\\', $rel, 2), 2, '');
$dir = $pkg === 'QRCode' ? 'php-qrcode' : ($pkg === 'Settings' ? 'php-settings-container' : null);
if (!$dir) return;
$file = GATECRAFT_DIR . 'lib/chillerlan/' . $dir . '/src/' . str_replace('\\', '/', $rest) . '.php';
if (is_file($file)) require $file;
});
foreach (['helpers', 'security', 'settings', 'auth', 'totp', 'view', 'mailer', 'notify', 'inventory', 'discounts',
'orders', 'tax', 'i18n', 'trust', 'audience', 'adminui', 'manual', 'eventclone', 'infopages', 'brand', 'card-payments', 'qr', 'export', 'reports', 'upload', 'eventpack', 'richtext', 'design', 'ticketcard', 'install', 'wp', 'extend'] as $gatecraft_file) {
require_once GATECRAFT_DIR . 'includes/' . $gatecraft_file . '.php';
}
require_once GATECRAFT_DIR . 'includes/http/public.php';
require_once GATECRAFT_DIR . 'includes/http/admin.php';
register_activation_hook(__FILE__, __NAMESPACE__ . '\\gatecraft_activate');
register_deactivation_hook(__FILE__, __NAMESPACE__ . '\\gatecraft_deactivate');