コード例 #1
0
ファイル: Response.php プロジェクト: Calmacil/GotCm
 /**
  * Renders output
  */
 public function render()
 {
     if (Config::get('debug')) {
         $this->assign('DEBUGBAR_HEADER', Debug::getInstance()->getRenderer()->renderHead());
         $this->assign('DEBUGBAR', Debug::getInstance()->getRenderer()->render());
     }
     $this->assign('CROWNS', $this->getCrownsList());
     $content = $this->environment->render($this->template, $this->template_vars);
     ob_clean();
     ob_start();
     header("HTTP/1.1 " . $this->status);
     header("Content-Type: " . self::TYPE_HTML);
     echo $content;
     ob_end_flush();
 }
コード例 #2
0
ファイル: index.php プロジェクト: Calmacil/GotCm
/**
 * Created by PhpStorm.
 * User: calmacil
 * Date: 27/12/15
 * Time: 11:04
 */
define("ROOT", __DIR__ . '/..');
require_once ROOT . '/vendor/autoload.php';
use Got\Core\Config;
use Got\Core\Debug;
use Got\Core\Router;
use Got\Core\Response;
use Got\Core\Request;
$conf = new Config(ROOT . "/config/config.json");
if (Config::get('debug')) {
    $debug = Debug::getInstance();
    $sql = \Got\Core\Db::getInstance();
    $debug->setupPdoCollector($sql->getConnection());
}
$router = Router::getInstance(ROOT . Config::get('path')->routes_file);
$request = new Request($_SERVER['REQUEST_URI']);
$response = new Response();
try {
    $request->proceed();
    $controller_name = ucfirst($request->getController());
    $action_name = $request->getAction() . 'Action';
    $class = '\\Got\\Action\\' . $controller_name;
    $controller = new $class($request, $response);
    if (!method_exists($controller, $action_name) || !$controller->{$action_name}()) {
        header('HTTP/1.1 404 Not Found');
        echo "BOUH";