From 56336ee3d5ec32647f6dbf35cf09f94a13795b60 Mon Sep 17 00:00:00 2001 From: Connor Thomson Date: Sat, 19 Sep 2026 10:51:36 -0700 Subject: Random fixes and updates --- php/execute.php | 29 +++++++++++++++++++++++++++++ php/footer.php | 0 php/load-css.php | 9 +++++++++ php/path-clean.php | 25 +++++++++++++++++++++++++ php/replace.php | 0 php/templates.php | 37 ------------------------------------- 6 files changed, 63 insertions(+), 37 deletions(-) create mode 100644 php/execute.php mode change 100644 => 100755 php/footer.php create mode 100644 php/load-css.php create mode 100644 php/path-clean.php mode change 100644 => 100755 php/replace.php delete mode 100644 php/templates.php (limited to 'php') diff --git a/php/execute.php b/php/execute.php new file mode 100644 index 0000000..bd8fe18 --- /dev/null +++ b/php/execute.php @@ -0,0 +1,29 @@ +. + */ + +function execute($path) { + if (file_exists($path)) { + ob_start(); + include $path; + return ob_get_clean(); + } + return ''; +} + +?> diff --git a/php/footer.php b/php/footer.php old mode 100644 new mode 100755 diff --git a/php/load-css.php b/php/load-css.php new file mode 100644 index 0000000..7cabc91 --- /dev/null +++ b/php/load-css.php @@ -0,0 +1,9 @@ + + + + + + diff --git a/php/path-clean.php b/php/path-clean.php new file mode 100644 index 0000000..d7b5fbf --- /dev/null +++ b/php/path-clean.php @@ -0,0 +1,25 @@ +. + */ + +function path_clean($path) { + $pattern = '/(\.\.\/)+/'; + return preg_replace($pattern, '', $path); +} + +?> diff --git a/php/replace.php b/php/replace.php old mode 100644 new mode 100755 diff --git a/php/templates.php b/php/templates.php deleted file mode 100644 index dfd4063..0000000 --- a/php/templates.php +++ /dev/null @@ -1,37 +0,0 @@ -. - */ - -function render_component(string $componentPath): string { - ob_start(); - include($componentPath); - return ob_get_clean(); -} - -function template_process(string $template, array $components = []): string { - $html = file_get_contents($template); - - foreach ($components as $placeholder => $componentPath) { - $injectedContent = render_component($componentPath); - $html = str_replace($placeholder, $injectedContent, $html); - } - - return $html; -} - -?> -- cgit v1.2.3