From c65035630f0a628df9fa46b6ea45c5559094e15d Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Wed, 27 Nov 2024 12:42:18 -0600 Subject: [PATCH] Add public domain day banner --- lib/Constants.php | 9 +- lib/Enums/ColorSchemeType.php | 8 ++ templates/DonationCounter.php | 3 +- templates/DonationProgress.php | 3 +- templates/Header.php | 33 ++++++- www/blog/public-domain-day-2025.php | 99 +++++++++---------- www/css/core.css | 133 +++++++++++++++++++++++++- www/css/dark.css | 5 +- www/css/public-domain-day.css | 11 +++ www/ebooks/download.php | 2 +- www/images/close-dark.svg | 16 ++++ www/newsletter/subscriptions/new.php | 2 +- www/newsletter/subscriptions/post.php | 2 +- www/settings/index.php | 9 +- www/settings/post.php | 55 ++++++----- www/sitemap.php | 8 +- 16 files changed, 293 insertions(+), 105 deletions(-) create mode 100644 lib/Enums/ColorSchemeType.php create mode 100644 www/images/close-dark.svg diff --git a/lib/Constants.php b/lib/Constants.php index 0b7a8c0a..b37373ad 100644 --- a/lib/Constants.php +++ b/lib/Constants.php @@ -1,9 +1,10 @@ format('Y')) - 96); // Latest continental US time zone. +define('PD_YEAR', intval((new DateTimeImmutable('now', LATEST_CONTINENTAL_US_TZ))->format('Y')) - 96); define('PD_STRING', 'January 1, ' . (PD_YEAR + 1)); // Controls the progress bar donation dialog. @@ -100,8 +101,8 @@ const DONATION_DRIVE_DATES = [ // Controls the countdown donation dialog, basically unused right now. const DONATION_DRIVE_COUNTER_ENABLED = false; -const DONATION_DRIVE_COUNTER_START = new DateTimeImmutable('May 2, 2022 00:00:00 America/New_York'); -const DONATION_DRIVE_COUNTER_END = new DateTimeImmutable('May 8, 2022 23:59:00 America/New_York'); +const DONATION_DRIVE_COUNTER_START = new DateTimeImmutable('May 2, 2022 00:00:00', new DateTimeZone('America/New_York')); +const DONATION_DRIVE_COUNTER_END = new DateTimeImmutable('May 8, 2022 23:59:00', new DateTimeZone('America/New_York')); const PD_DAY_YEAR = 2025; const PD_DAY_DRAFT_PATH = '/standardebooks.org/drafts/' . PD_DAY_YEAR; diff --git a/lib/Enums/ColorSchemeType.php b/lib/Enums/ColorSchemeType.php new file mode 100644 index 00000000..d5dc260f --- /dev/null +++ b/lib/Enums/ColorSchemeType.php @@ -0,0 +1,8 @@ + DONATION_DRIVE_COUNTER_END){ +if(!DONATION_DRIVE_COUNTER_ENABLED || ($autoHide ?? (HttpInput::Bool(COOKIE, 'hide-donation-alert') ?? false)) || NOW > DONATION_DRIVE_COUNTER_END){ return; } @@ -42,6 +42,7 @@ $digits = str_split(str_pad((string)$current, 3, "0", STR_PAD_LEFT))