41 lines
880 B
PHP
41 lines
880 B
PHP
|
<?php
|
||
|
|
||
|
namespace kernel\services;
|
||
|
|
||
|
use kernel\models\Option;
|
||
|
|
||
|
class ThemeService
|
||
|
{
|
||
|
protected Option $option;
|
||
|
protected string $active_theme = "";
|
||
|
|
||
|
public function __construct()
|
||
|
{
|
||
|
$this->option = new Option();
|
||
|
$this->findActiveAdminTheme();
|
||
|
}
|
||
|
|
||
|
public function findActiveAdminTheme(): 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;
|
||
|
}
|
||
|
|
||
|
}
|