document = $document; $this->searchable = false; $this->title = "Untitled View"; $this->langModules = array(); $this->loadView = $loadView; } public function getTitle(): string { return $this->title; } public function getDocument(): Document { return $this->document; } public function isSearchable(): bool { return $this->searchable; } public function getSiteName(): string { // what a chain lol return $this->getDocument()->getUser()->getConfiguration()->getSettings()->getSiteName(); } protected function load(string $viewClass) : string { try { $reflectionClass = new \ReflectionClass($viewClass); if ($reflectionClass->isSubclassOf(View::class) && $reflectionClass->isInstantiable()) { $view = $reflectionClass->newInstanceArgs(array($this->getDocument())); $view->loadView(); return $view; } } catch(\ReflectionException $e) { error_log($e->getMessage()); } return ""; } private function loadLanguageModules() { $lang = $this->document->getUser()->getLanguage(); foreach($this->langModules as $langModule) { $lang->loadModule($langModule); } } // Virtual Methods public function loadView() { } public function getCode(): string { // Load translations $this->loadLanguageModules(); // Load Meta Data + Head (title, scripts, includes, ...) if($this->loadView) { $this->loadView(); } return ''; } // UI Functions private function createList($items, $tag, $classes = ""): string { $class = ($classes ? " class=\"$classes\"" : ""); if(count($items) === 0) { return "<$tag$class>$tag>"; } else { return "<$tag$class>
$content
"; } public function createParagraph($title, $id, $content): string { $id = replaceCssSelector($id); $iconId = urlencode("$id-icon"); return "