protected function BeforeRemove(Layout $layout) { $layoutFile = PathUtil::LayoutTemplate($layout); if (File::Exists($layoutFile)) { File::Delete($layoutFile); } $logger = new Logger(self::Guard()->GetUser()); $logger->ReportLayoutAction($layout, Action::Delete()); }
protected function BeforeInit() { $this->layout = Layout::Schema()->ByID(Request::GetData('layout')); if (!$this->layout) { //TODO: Message Response::Redirect($this->BackLink()); } $this->file = PathUtil::LayoutTemplate($this->layout); if (!File::Exists($this->file)) { //TODO: Message Response::Redirect($this->BackLink()); } $this->contents = File::GetContents($this->file); return parent::BeforeInit(); }
private function UpdateFiles($oldFile) { $newFile = PathUtil::LayoutTemplate($this->layout); if ($oldFile == $newFile) { return; } else { if ($oldFile) { File::Move($oldFile, $newFile); } else { File::CreateWithText($newFile, $this->TemplateContent()); } } }
/** * Renders the complete page by requiring the page layout * @return string Returns the page contents */ function Render() { self::$currentPage = $this->page; self::$Title = self::$currentPage->GetTitle(); self::$Description = self::$currentPage->GetDescription(); self::$Keywords = self::$currentPage->GetKeywords(); if ($this->page->GetType() == (string) PageType::NotFound()) { header('HTTP/1.0 404 Not Found'); } else { if ($this->page->GetType() !== (string) PageType::Normal()) { throw new \Exception('Internal phine error: not normal page called'); } } ob_start(); require PathUtil::LayoutTemplate($this->layout); $result = ob_get_clean(); $replacer = new Replacer(); return $replacer->RealizeVariables($result); }