summaryrefslogtreecommitdiff
path: root/html/@include.php
diff options
context:
space:
mode:
authorAdam Spragg <adam@spra.gg>2018-07-26 15:09:50 +0100
committerAdam Spragg <adam@spra.gg>2018-07-26 15:09:50 +0100
commitf80f775dfbe12cf6b95bda38b73f5dc37327d7fa (patch)
treeb8f597150176d028da15fdb135e372dbc8b11239 /html/@include.php
parent4daf6063d86efc8fda2f8286a2474247f62359a3 (diff)
Change the "private file" prefix from "@" to "_"
It has all the benefits previously mentioned in commit 2f547251, as well as mirroring the common programming convention of using a "_" prefix to identify private variables/functions Hides files beginning with _ from mod_autoindex listings As well as 404ing on files starting with "_", also 404 on files starting with ".", as these are also private. Except for /.well-known/, because that's... well known, and should be public.
Diffstat (limited to 'html/@include.php')
-rw-r--r--html/@include.php66
1 files changed, 0 insertions, 66 deletions
diff --git a/html/@include.php b/html/@include.php
deleted file mode 100644
index 7ce79b0..0000000
--- a/html/@include.php
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-
-/// Indent all the lines in a string with a given number of tabs
-function indent($s, $n, $indent_first_line = false) {
- $s = preg_replace("/^/m", str_repeat("\t", $n), $s);
-
- if (!$indent_first_line) {
- $s = substr($s, $n);
- }
-
- return $s;
-}
-
-/// Get the standard <head> elements for the site
-function site_head($title) {
- return "<title>{$title}</title>\n"
- . "<link rel=\"stylesheet\" href=\"/style/main.css\" type=\"text/css\" />\n"
- . "<link rel=\"stylesheet\" href=\"/style/amber.css\" title=\"Amber\" type=\"text/css\" />\n"
- . "<link rel=\"alternate stylesheet\" href=\"/style/green.css\" title=\"Green\" type=\"text/css\" />\n"
- . "<!--\n"
- . " Hi there. Nice to see you here. Feel free to have a look around. Also check out the /about\n"
- . " page while you're at it. It's got a little bit more info about the site and the resources\n"
- . " used.\n"
- . "-->\n";
-}
-
-/// Get a single top-level navigation item for the site
-function site_navitem($url, $text, $hide = false) {
- $selected = $url == $_SERVER['REQUEST_URI'];
-
- $classes = [];
- if ($selected) {
- $classes[] = "selected";
- }
- if ($hide && !$selected) {
- $classes[] = "hidden";
- }
- $classes = count($classes) > 0 ? (" class=\"" . implode(" ", $classes) . "\"") : "";
-
- return "<li{$classes}><a href=\"{$url}\">{$text}</a></li>";
-}
-
-/// Get the standard page header elements for the site
-function site_header($title) {
- return "<h1 class=\"test\">{$title}</h1>\n"
- . "<nav>\n"
- . "\t<ul>\n"
- . "\t\t" . site_navitem('/', 'Home') . "\n"
- . "\t\t" . site_navitem('/projects', 'Projects') . "\n"
- . "\t\t" . site_navitem('/blog', 'Blog') . "\n"
- . "\t\t" . site_navitem('/privacy', 'Privacy') . "\n"
- . "\t\t" . site_navitem('/contact', 'Contact') . "\n"
- . "\t\t" . site_navitem('/about', 'About', true) . "\n"
- . "\t</ul>\n"
- . "</nav>\n";
-}
-
-/// Get the standard page footer elements for the site
-function site_footer() {
- return "<hr />\n"
- . "<p>Spragg Software Services Ltd is registered in England, No. 11248242.\n"
- . " Registered office: 82 Upper Hanover Street, Sheffield, S3 7RQ.\n"
- . " VAT reg No. 295343283.</p>\n";
-}
-
-?>