summaryrefslogtreecommitdiff
path: root/src/web/config/aesthetic.php
blob: 304baecc4c45327cc2a1dad17c3ba79b96302a9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php /* Copyright (c) 2024 Freya Murphy */
class Aesthetic {

	private $config;

	function __construct() {
		$this->config = array(
			'_common' => array(
				'js' => [
					'js/thirdparty/jquery.min.js',
					'js/lib.js',
					'js/modal.js',
				],
				'css' => [
					'css/common.css'
				],
			),
			'error' => array(
				'css' => [
					'css/error.css'
				],
			),
			'home' => array(
				'js' => [
					'js/routes/home.js',
					'js/post.js',
				],
				'css' => [
					'css/home.css',
					'css/post.css'
				],
			),
			'auth' => array(
				'css' => [
					'css/auth.css'
				],
			),
		);
	}
    /**
     * @param mixed $route
     * @return array<string,>
     */
    function get_files($route): array {
		$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,
		);
	}

}