You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
889 B
PHP
42 lines
889 B
PHP
<?php
|
|
|
|
class Themes
|
|
{
|
|
private $themes = [];
|
|
|
|
public function __construct()
|
|
{
|
|
$_themes = glob("../content/themes/*", GLOB_ONLYDIR);
|
|
foreach ($_themes as $theme) {
|
|
array_push(
|
|
$this->themes,
|
|
json_decode(file_get_contents($theme . "/theme.json"), true)
|
|
);
|
|
}
|
|
}
|
|
|
|
public function getThemes()
|
|
{
|
|
return $this->themes;
|
|
}
|
|
|
|
public function getCustomViews()
|
|
{
|
|
$settings = (new Settings())->getSettings();
|
|
$currentTheme = $settings["global"]["theme"];
|
|
$folder = "../content/themes/" . $currentTheme;
|
|
$files = array_filter(glob("$folder/*twig"), "is_file");
|
|
$views = [];
|
|
|
|
foreach ($files as $file) {
|
|
$path = explode("/", $file);
|
|
$fileName = $path[4];
|
|
if (str_contains($fileName, "page")) {
|
|
$page = explode(".", $fileName);
|
|
$views[] = $page[0];
|
|
}
|
|
}
|
|
return $views;
|
|
}
|
|
}
|