<?php
-define("ROOT", dirname(__DIR__));
-define("REFS", getenv("REFPATH") ?: implode(PATH_SEPARATOR, glob(ROOT."/refs/*")));
+use mdref\Action;
+use mdref\BaseUrl;
+use mdref\Reference;
+use mdref\ExceptionHandler;
-ini_set("open_basedir", ROOT.":".REFS);
+use http\Env\Request;
+use http\Env\Response;
-$loader = require ROOT . "/vendor/autoload.php";
-/* @var $loader \Composer\Autoload\ClassLoader */
-$loader->add("mdref", ROOT);
+define("ROOT", dirname(__DIR__));
+define("REFS", getenv("REFPATH") ?: implode(PATH_SEPARATOR, glob(ROOT."/refs/*")));
-use http\Controller;
-use http\Controller\Url;
-use http\Controller\Observer\Layout;
+ini_set("open_basedir", ROOT.PATH_SEPARATOR.REFS);
-use mdref\ExceptionHandler;
-use mdref\Action;
+spl_autoload_register(function($c) {
+ if (!strncmp($c, "mdref\\", 6)) {
+ return require ROOT . "/" . strtr($c, "\\", "/") . ".php";
+ }
+});
new ExceptionHandler;
-$ctl = new Controller;
-$ctl->setDependency("baseUrl", new Url)
- ->attach(new Action)
- ->attach(new Layout)
- ->notify()
- ->getResponse()
- ->send();
+$reference = new Reference(explode(PATH_SEPARATOR, REFS));
+$action = new Action($reference, new Request, new Response, new BaseUrl);
+$action->handle();