Exemplo n.º 1
0
 public function __construct(RequestInterface $request, ResponseInterface $response)
 {
     $this->request = $request;
     $this->response = $response;
     $event = Dispatcher::getInstance()->triggerEvent(new Event('CommandConstructor', $this));
     if ($event->isCancelled()) {
         $response->flush();
         exit;
     }
 }
Exemplo n.º 2
0
Arquivo: View.php Projeto: ofeige/opf
 public function render(RequestInterface $request, ResponseInterface $response)
 {
     ob_start();
     $uri = Bootstrap::getPathView() . "/{$this->template}.phtml";
     if (file_exists($uri) === false) {
         throw new \Exception("File not found " . $uri);
     }
     include_once $uri;
     $data = ob_get_clean();
     $response->write($data);
 }
Exemplo n.º 3
0
 public function render(RequestInterface $request, ResponseInterface $response)
 {
     $timing = microtime(true);
     $this->assign('action', $request->getParameter('action'));
     $this->assign('controller', $request->getParameter('controller'));
     $loader = new Twig_Loader_Filesystem(Bootstrap::getPathView());
     $twig = new Twig_Environment($loader, array('debug' => true, 'cache' => Bootstrap::getPathCache(), 'auto_reload' => true, 'optimizations' => -1));
     $twig->addExtension(new \Twig_Extension_Debug());
     $data = $twig->render("{$this->template}.twig", $this->vars);
     $response->addHeader('X-OPF-TWIG-TIMING', microtime(true) - $timing);
     $response->write($data);
 }