From 5270891eb41999d64a1855b76db56dfc3aeb52d4 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Wed, 27 Nov 2024 14:45:08 -0600 Subject: [PATCH] Update PD day banner and tweak blog post wording --- lib/Constants.php | 3 ++- lib/HttpInput.php | 13 +++++++------ templates/Header.php | 4 ++-- www/blog/public-domain-day-2025.php | 10 +++++----- www/css/core.css | 24 +++++++++++++++++++++++- www/images/confetti.svg | 21 +++++++++++++++++++++ 6 files changed, 60 insertions(+), 15 deletions(-) create mode 100644 www/images/confetti.svg diff --git a/lib/Constants.php b/lib/Constants.php index b37373ad..829561b5 100644 --- a/lib/Constants.php +++ b/lib/Constants.php @@ -5,6 +5,7 @@ use function Safe\define; const NOW = new DateTimeImmutable(); const LATEST_CONTINENTAL_US_TZ = new DateTimeZone('America/Juneau'); +const PD_NOW = new DateTimeImmutable('now', LATEST_CONTINENTAL_US_TZ); // This timestamp should be used for Public Domain Day calculations. const SITE_STATUS_LIVE = 'live'; const SITE_STATUS_DEV = 'dev'; @@ -77,7 +78,7 @@ const ZOHO_WEBHOOK_LOG_FILE_PATH = '/var/log/local/webhooks-zoho.log'; // Must b const DONATIONS_LOG_FILE_PATH = '/var/log/local/donations.log'; // Must be writable by `www-data` Unix user. const ARTWORK_UPLOADS_LOG_FILE_PATH = '/var/log/local/artwork-uploads.log'; // Must be writable by `www-data` Unix user. -define('PD_YEAR', intval((new DateTimeImmutable('now', LATEST_CONTINENTAL_US_TZ))->format('Y')) - 96); +define('PD_YEAR', intval(PD_NOW->format('Y')) - 96); define('PD_STRING', 'January 1, ' . (PD_YEAR + 1)); // Controls the progress bar donation dialog. diff --git a/lib/HttpInput.php b/lib/HttpInput.php index 062b3a3a..f0634266 100644 --- a/lib/HttpInput.php +++ b/lib/HttpInput.php @@ -22,7 +22,7 @@ class HttpInput{ } if($httpMethod == Enums\HttpMethod::Post){ - // If we're a HTTP POST, then we got here from a POST request initially, so just continue + // If we're a HTTP POST, then we got here from a POST request initially, so just continue. return; } @@ -44,6 +44,7 @@ class HttpInput{ /** * Check that the request's HTTP method is in a list of allowed HTTP methods. + * * @param ?array $allowedHttpMethods An array containing a list of allowed HTTP methods, or null if any valid HTTP method is allowed. * @param bool $throwException If the request HTTP method isn't allowed, then throw an exception; otherwise, output HTTP 405 and exit the script immediately. * @throws Exceptions\InvalidHttpMethodException If the HTTP method is not recognized, and `$throwException` is `true`. @@ -229,7 +230,7 @@ class HttpInput{ * @return array|array|array|array|string|int|float|bool|DateTimeImmutable|null */ private static function GetHttpVar(string $variable, Enums\HttpVariableType $type, Enums\HttpVariableSource $set): mixed{ - // Note that in Core.php we parse the request body of DELETE, PATCH, and PUT into $_POST. + // Note that in `Core.php` we parse the request body of DELETE, PATCH, and PUT into `$_POST`. $vars = []; @@ -250,15 +251,15 @@ class HttpInput{ if(isset($vars[$variable])){ if($type == Enums\HttpVariableType::Array && is_array($vars[$variable])){ - // We asked for an array, and we got one + // We asked for an array, and we got one. return $vars[$variable]; } elseif($type !== Enums\HttpVariableType::Array && is_array($vars[$variable])){ - // We asked for not an array, but we got an array + // We asked for not an array, but we got an array. return null; } elseif(is_string($vars[$variable])){ - // HTML `