public static function Prepare($config)
 {
     Define('DS', DIRECTORY_SEPARATOR);
     Define('FRAMEWORK_DIR', dirname(dirname(__FILE__)) . "/cherryphp");
     Define('APP_DIR', dirname(dirname(__FILE__)));
     spl_autoload_register(array('Cherry', 'LoadClass'));
     Init::$Router = (require APP_DIR . DS . 'router.php');
     if (!empty($config)) {
         Init::$Config = (require $config . "config.php");
     } else {
         Init::$Config = (require APP_DIR . DS . 'config.php');
     }
     foreach (Init::$Config['define'] as $k => $v) {
         Define($k, Init::$Config['define'][$k]);
     }
     #spl_autoload_register(array('Cherry','appClass'));
     return new self();
 }
Exemple #2
0
<?php

$start = microtime(true);
error_reporting(E_ALL);
define('__AUTH', 'Until Die');
if (defined('DIRECTORY_SEPARATOR')) {
    define('DS', DIRECTORY_SEPARATOR);
} else {
    define('DS', '/');
}
if (is_callable('realpath')) {
    define('BASE_PATH', realpath(dirname(__FILE__)));
} else {
    define('BASE_PATH', dirname(__FILE__));
}
define('SYS_PATH', BASE_PATH . DS . 'system');
define('APP_PATH', BASE_PATH . DS . 'application');
require SYS_PATH . DS . 'initialize.php';
try {
    Init::getInstance();
    Init::Router('loader');
} catch (Exception $exc) {
    include SYS_PATH . DS . 'error.php';
}
$end = microtime(true);
echo '<p sytle="margin: auto 20px;">' . round($end - $start, 4) . ' Sec</p>';