diff options
author | Freya Murphy <freya@freyacat.org> | 2024-04-01 11:09:25 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-04-01 11:09:25 -0400 |
commit | 3a82baec9d793edf81ac2b151b0f4d4159641375 (patch) | |
tree | f9d50c296b078ac48c2a2391c172c3ccf37edb3f /src/web/config | |
parent | refactor asset dir, refactor oberver in lib (diff) | |
download | xssbook2-3a82baec9d793edf81ac2b151b0f4d4159641375.tar.gz xssbook2-3a82baec9d793edf81ac2b151b0f4d4159641375.tar.bz2 xssbook2-3a82baec9d793edf81ac2b151b0f4d4159641375.zip |
login and register, liking on homepage
Diffstat (limited to 'src/web/config')
-rw-r--r-- | src/web/config/aesthetic.php | 64 | ||||
-rw-r--r-- | src/web/config/routes.php | 8 |
2 files changed, 72 insertions, 0 deletions
diff --git a/src/web/config/aesthetic.php b/src/web/config/aesthetic.php new file mode 100644 index 0000000..304baec --- /dev/null +++ b/src/web/config/aesthetic.php @@ -0,0 +1,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, + ); + } + +} diff --git a/src/web/config/routes.php b/src/web/config/routes.php new file mode 100644 index 0000000..33c871b --- /dev/null +++ b/src/web/config/routes.php @@ -0,0 +1,8 @@ +<?php /* Copyright (c) 2024 Freya Murphy */ + +$routes = array(); +$routes['home'] = 'apps/home'; +$routes['error'] = 'apps/error'; +$routes['auth'] = 'apps/auth'; + +$routes[''] = '_index'; |