public function render() { Ajde::app()->getDocument()->setLayout(new Ajde_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 function run() { // For debugger $this->addTimer('<i>Application</i>'); // Create fresh response $timer = $this->addTimer('Create response'); $response = new Ajde_Http_Response(); $this->setResponse($response); $this->endTimer($timer); // Bootstrap init $timer = $this->addTimer('Run bootstrap cue'); $bootstrap = new Ajde_Core_Bootstrap(); $bootstrap->run(); $this->endTimer($timer); // Get request $timer = $this->addTimer('Read in global request'); $request = Ajde_Http_Request::fromGlobal(); $this->setRequest($request); $this->endTimer($timer); // Get route $timer = $this->addTimer('Initialize route'); $route = $request->initRoute(); $this->setRoute($route); $this->endTimer($timer); // Load document $timer = $this->addTimer('Create document'); $document = Ajde_Document::fromRoute($route); $this->setDocument($document); $this->endTimer($timer); // Load controller $timer = $this->addTimer('Load controller'); $controller = Ajde_Controller::fromRoute($route); $this->setController($controller); $this->endTimer($timer); // Invoke controller action $timer = $this->addTimer('Invoke controller'); $actionResult = $controller->invoke(); $document->setBody($actionResult); $this->endTimer($timer); // Get document contents $timer = $this->addTimer('Render document'); $contents = $document->render(); $this->endTimer($timer); // Let the cache handle the contents and have it saved to the response $timer = $this->addTimer('Save to response'); $cache = Ajde_Cache::getInstance(); $cache->setContents($contents); $cache->saveResponse(); $this->endTimer($timer); // Output the buffer $response->send(); }
public static function dieOnRoute($route) { ob_get_clean(); // We start a mini app here to display the route // Copied from Ajde_Application $route = new Ajde_Core_Route($route); $document = Ajde_Document::fromRoute($route); // replace document in Ajde_Application Ajde::app()->setDocument($document); $controller = Ajde_Controller::fromRoute($route); $actionResult = $controller->invoke(); $document->setBody($actionResult); if (!$document->hasLayout()) { $layout = new Ajde_Layout(Config::get("layout")); $document->setLayout($layout); } echo $document->render(); die; }
public function render() { Ajde::app()->getDocument()->setLayout(new Ajde_Layout('empty')); return parent::render(); }
public function render() { Ajde::app()->getDocument()->setLayout(new Ajde_Layout('empty')); Ajde::app()->getResponse()->removeHeader('Set-Cookie'); return parent::render(); }
public function render() { Ajde_Cache::getInstance()->disable(); Ajde::app()->getDocument()->setLayout(new Ajde_Layout('empty')); return parent::render(); }
public function saveCache() { // Bind document processors to compressor Ajde_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(LOCAL_ROOT . $this->getBase())) { throw new Ajde_Exception(sprintf('Directory %s is not writable', $this->getBase()), 90014); } // Execute compression Ajde_Event::trigger($this, 'beforeCompress'); $this->compress(); Ajde_Event::trigger($this, 'afterCompress'); // Save file to cache folder file_put_contents(LOCAL_ROOT . $this->getFilename(), $this->_contents); }
public function render() { $this->registerDocumentProcessor('html'); return parent::render(); }
public function render() { Ajde::app()->getResponse()->removeHeader('Set-Cookie'); // Get the controller to output the right headers and body return parent::getBody(); }