xssbook2/web/config/aesthetic.php

57 lines
1 KiB
PHP
Raw Normal View History

<?php /* Copyright (c) 2024 Freya Murphy */
class Aesthetic {
private $config;
function __construct() {
$this->config = array(
'_common' => array(
'js' => [
'js/jquery-3.7.1.min.js',
'js/lib.js',
2024-03-30 16:14:42 +00:00
'js/shared/modal.js',
],
'css' => [
'css/common.css'
],
),
'error' => array(
'css' => [
'css/error.css'
],
),
'home' => array(
'js' => [
2024-03-30 16:14:42 +00:00
'js/shared/post.js',
'js/routes/home.js',
],
'css' => [
'css/home.css',
'css/post.css'
],
),
);
}
function get_files($route) {
$js_files = $this->config['_common']['js'];
$css_files = $this->config['_common']['css'];
if (array_key_exists($route, $this->config)) {
$config = $this->config[$route];
if (array_key_exists('js', $config)) {
$js_files = array_merge($js_files, $config['js']);
}
if (array_key_exists('css', $config)) {
$css_files = array_merge($css_files, $config['css']);
}
}
return array(
'js_files' => $js_files,
'css_files' => $css_files,
);
}
}