option = new Option(); $this->findActiveTheme(); } public function findActiveTheme(): void { $model = $this->option::where("key", "active_theme")->first(); $this->active_theme = $model->value; } public function getActiveTheme(): string { return $this->active_theme; } public function getThemeRout(string $path) { if (file_exists($path . "/manifest.json")){ $manifest = json_decode(file_get_contents($path . "/manifest.json"), true); if ($manifest['routs']) { return $manifest['routs']; } } return false; } public function getThemeInfo(string $theme): false|array|string { $info = []; $theme = getConst($theme); $info['path'] = $theme; if (file_exists($theme . "/manifest.json")) { $manifest = file_get_contents($theme . "/manifest.json"); $manifest = Manifest::getWithVars($manifest); $manifest['preview'] = $manifest['resource'] . "/" . $manifest['preview']; $info = array_merge($info, $manifest); } return $info; } public function setActiveTheme(string $theme): void { $activeTheme = Option::where("key", "active_theme")->first(); $activeTheme->value = getConst($theme); $activeTheme->save(); } }