public function deliver(PageCacheRecord $record) { $response = new Response(); $headers = array(); if (defined('APP_CHARSET')) { $headers["Content-Type"] = "text/html; charset=" . APP_CHARSET; } $headers = array_merge($headers, $record->getCacheRecordHeaders()); $response->headers->add($headers); $response->setContent($record->getCacheRecordContent()); return $response; }
public function preview($pThemeID) { $vl = $this->getValueListFromRequest($pThemeID); $pt = PageTheme::getByID($pThemeID); $pt->enablePreviewRequest(); $sheets = $pt->getThemeCustomizableStyleSheets(); // for each customizable stylesheet in the theme, we take the value list // and send its variables through the LESS parser. foreach ($sheets as $sheet) { $sheet->setValueList($vl); // we save each sheet to the preview location. $sheet->output(); } // and finally, we pass our modified theme into the updated view, which we send back in the iframe. $req = Request::getInstance(); $req->setCurrentPage($this->page); $controller = $this->page->getPageController(); $view = $controller->getViewObject(); $view->setCustomPageTheme($pt); $req->setCustomRequestUser(-1); $response = new Response(); $content = $view->render(); $response->setContent($content); return $response; }
/** * Sets the response content. * * Valid types are strings, numbers, null, and objects that implement a __toString() method. * * @param mixed $content Content that can be cast to string * * @return Response * * @throws \UnexpectedValueException * * @api */ public function setContent($content) { return parent::setContent($content); }