Example #1
0
 function run($app = 'app')
 {
     MvcApplication::$app = $app;
     Console::debugEx(LOG_VERBOSE, __CLASS__, 'Invoking router...');
     // Create new router and invoke it
     response::setStatus(200);
     $router = config::get(self::KEY_MVC_ROUTER, 'DefaultRouter');
     $r = new $router();
     $r->route();
     return 0;
 }
Example #2
0
        $segments = explode('\\', $class);
        $class = array_pop($segments);
        if (isset($namespaces[$class])) {
            $namespaceClass = $namespaces[$class];
        }
        $file = classFile($path, $namespaceClass);
        if (is_file($file)) {
            if (!\System\Std\Environment::hasClassFile($file)) {
                require $file;
            }
            class_alias(str_replace('.', '\\', $namespaceClass), $class);
        }
    }
});
function classFile($path, $class)
{
    $namespacePath = str_replace(array('\\', '.'), '/', $class);
    $file = $path . '/' . $namespacePath . '.php';
    return $file;
}
require $rootPath . '/global.php';
$mvcApplication = new MvcApplication($rootPath);
try {
    $mvcApplication->start();
    $mvcApplication->init();
    $mvcApplication->load();
    $mvcApplication->run();
    $mvcApplication->end();
} catch (\Exception $e) {
    $mvcApplication->error($e);
}