diff options
Diffstat (limited to 'app.php')
| -rwxr-xr-x[-rw-r--r--] | app.php | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -24,17 +24,22 @@ define('ROOT_DIR', __DIR__ . '/'); define('HTML_DIR', __DIR__ . '/html/'); define('PHP_DIR', __DIR__ . '/php/'); -require_once PHP_DIR . 'templates.php'; +require_once PHP_DIR . 'replace.php'; +require_once PHP_DIR . 'execute.php'; +require_once PHP_DIR . 'path-clean.php'; -$file = $_GET['file'] ?? 'index.html'; +$file = path_clean($_GET['file'] ?? 'index.html'); -$components = [ - '{{HEADER}}' => HTML_DIR . 'header.html', - '{{CONTENT}}' => ROOT_DIR . $file, - '{{FOOTER}}' => PHP_DIR . 'footer.php' +$device = 'desktop'; + +$targets = [ + '{{header}}' => file_get_contents(HTML_DIR . 'header.html'), + '{{content}}' => file_get_contents(ROOT_DIR . $file), + '{{footer}}' => execute(PHP_DIR . 'footer.php'), + '{{device}}' => $device ]; -$app_html = template_process(HTML_DIR . 'app.html', $components); +$app_html = replace(HTML_DIR . 'app.html', $targets); echo $app_html; ?> |
