This repository has been archived on 2023-10-21. You can view files and clone it, but cannot push or open issues or pull requests.
koakuma/startup.php

24 lines
970 B
PHP
Raw Permalink Normal View History

2020-12-31 01:38:59 +00:00
<?php
namespace Koakuma;
define('KOA_STARTUP', microtime(true));
define('KOA_ROOT', __DIR__);
define('KOA_DEBUG', is_file(KOA_ROOT . '/.debug'));
define('KOA_PUB', KOA_ROOT . '/public'); // WWW visible
define('KOA_SRC', KOA_ROOT . '/src'); // Patchouli namespace
define('KOA_LIB', KOA_ROOT . '/lib'); // Other unresolved namespaces
ini_set('display_errors', KOA_DEBUG ? 'on' : 'off');
error_reporting(KOA_DEBUG ? -1 : 0);
mb_internal_encoding('utf-8');
set_include_path(KOA_SRC . PATH_SEPARATOR . KOA_LIB . PATH_SEPARATOR . get_include_path());
spl_autoload_register(function(string $className) {
$parts = explode('\\', trim($className, '\\'), 2);
if($parts[0] === __NAMESPACE__)
require_once KOA_SRC . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $parts[1]) . '.php';
else
require_once KOA_LIB . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php';
});