public function render() { Ajde::app()->getDocument()->setLayout(new Layout('empty')); Ajde::app()->getResponse()->removeHeader('Set-Cookie'); if (Ajde::app()->getRequest()->getRoute()->getAction() == 'resourceCompressed') { $this->registerDocumentProcessor('css', 'compressor'); } else { $this->registerDocumentProcessor('css'); } return parent::render(); }
public static function dieOnRoute($route) { ob_get_clean(); // We start a mini app here to display the route // Copied from Ajde_Application $route = new Route($route); $document = Document::fromRoute($route); // replace document in Ajde_Application Ajde::app()->setDocument($document); // replace route in Ajde_Application Ajde::app()->setRoute($route); $controller = Controller::fromRoute($route); $actionResult = $controller->invoke(); $document->setBody($actionResult); if (!$document->hasLayout()) { $layout = new Layout(Config::get("layout")); $document->setLayout($layout); } echo $document->render(); die; }
public function render() { Ajde::app()->getResponse()->removeHeader('Set-Cookie'); // Get the controller to output the right headers and body return parent::getBody(); }
public function render() { Ajde::app()->getDocument()->setLayout(new Layout('empty')); return parent::render(); }
public function saveCache() { // Bind document processors to compressor Document::registerDocumentProcessor($this->getType(), 'compressor'); // Prepare content $this->_contents = ''; foreach ($this->_resources as $resource) { /* @var $resource Ajde_Resource_Local */ $this->_contents .= $resource->getContents() . PHP_EOL; } if (!is_writable($this->getBase())) { throw new Exception(sprintf("Directory %s is not writable", $this->getBase()), 90014); } // Execute compression Dispatcher::trigger($this, 'beforeCompress'); $this->compress(); Dispatcher::trigger($this, 'afterCompress'); // Save file to cache folder file_put_contents($this->getFilename(), $this->_contents); }
public function render() { Ajde::app()->getDocument()->setLayout(new Layout('empty')); Ajde::app()->getResponse()->removeHeader('Set-Cookie'); return parent::render(); }
public function run() { // For debugger $this->addTimer('<i>Application</i>'); // Create fresh response $timer = $this->addTimer('Create response'); $response = new Response(); $this->setResponse($response); $this->endTimer($timer); Dispatcher::trigger($this, 'onAfterResponseCreated'); // Bootstrap init $timer = $this->addTimer('Run bootstrap queue'); $bootstrap = new Bootstrap(); $bootstrap->run(); $this->endTimer($timer); Dispatcher::trigger($this, 'onAfterBootstrap'); // Get request $timer = $this->addTimer('Read in global request'); $request = Request::fromGlobal(); $this->setRequest($request); $this->endTimer($timer); Dispatcher::trigger($this, 'onAfterRequestCreated'); // Get route $timer = $this->addTimer('Initialize route'); $route = $request->initRoute(); $this->setRoute($route); $this->endTimer($timer); Dispatcher::trigger($this, 'onAfterRouteInitialized'); // Load document $timer = $this->addTimer('Create document'); $document = Document::fromRoute($route); $this->setDocument($document); $this->endTimer($timer); Dispatcher::trigger($this, 'onAfterDocumentCreated'); // Load controller $timer = $this->addTimer('Load controller'); $controller = Controller::fromRoute($route); $this->setController($controller); $this->endTimer($timer); Dispatcher::trigger($this, 'onAfterControllerCreated'); // Invoke controller action $timer = $this->addTimer('Invoke controller'); $actionResult = $controller->invoke(); $document->setBody($actionResult); $this->endTimer($timer); Dispatcher::trigger($this, 'onAfterControllerInvoked'); // Get document contents $timer = $this->addTimer('Render document'); $contents = $document->render(); $this->endTimer($timer); Dispatcher::trigger($this, 'onAfterDocumentRendered'); // Let the cache handle the contents and have it saved to the response $timer = $this->addTimer('Save to response'); $cache = Cache::getInstance(); $cache->setContents($contents); $cache->saveResponse(); $this->endTimer($timer); Dispatcher::trigger($this, 'onAfterResponseCreated'); // Output the buffer $response->send(); Dispatcher::trigger($this, 'onAfterResponseSent'); }
public function render() { Cache::getInstance()->disable(); Ajde::app()->getDocument()->setLayout(new Layout('empty')); return parent::render(); }
public function render() { $this->registerDocumentProcessor('html'); return parent::render(); }