mirror of
https://github.com/standardebooks/web.git
synced 2025-07-16 03:16:36 -04:00
Use a NOW constant instead of new DateTimeImmutable objects, and tweak how some donation drive dates work
This commit is contained in:
parent
376dacd833
commit
eec79712fc
27 changed files with 108 additions and 143 deletions
|
@ -1,15 +1,14 @@
|
|||
<?
|
||||
// Auto-included by Composer in composer.json to satisfy PHPStan
|
||||
// Auto-included by Composer in composer.json to satisfy PHPStan.
|
||||
use Safe\DateTimeImmutable;
|
||||
use function Safe\define;
|
||||
|
||||
$now = new DateTimeImmutable();
|
||||
$nowPd = new DateTimeImmutable('now', new DateTimeZone('America/Juneau')); // Latest continental US time zone
|
||||
const NOW = new DateTimeImmutable();
|
||||
|
||||
const SITE_STATUS_LIVE = 'live';
|
||||
const SITE_STATUS_DEV = 'dev';
|
||||
|
||||
define('SITE_STATUS', get_cfg_var('app.site_status') ?: SITE_STATUS_DEV); // Set in the PHP INI configuration for both CLI and FPM. Have to use define() and not const so we can use a function.
|
||||
define('SITE_STATUS', get_cfg_var('app.site_status') ?: SITE_STATUS_DEV); // Set in the PHP INI configuration for both CLI and FPM. Have to use `define()` and not `const` so we can use a function.
|
||||
|
||||
// No trailing slash on any of the below constants.
|
||||
if(SITE_STATUS == SITE_STATUS_LIVE){
|
||||
|
@ -44,7 +43,7 @@ const ARTWORK_IMAGE_MINIMUM_HEIGHT = 300;
|
|||
const CAPTCHA_IMAGE_HEIGHT = 72;
|
||||
const CAPTCHA_IMAGE_WIDTH = 230;
|
||||
|
||||
// These are defined for convenience, so that getting HTTP input isn't so wordy
|
||||
// These are defined for convenience, so that getting HTTP input isn't so wordy.
|
||||
const GET = Enums\HttpVariableSource::Get;
|
||||
const POST = Enums\HttpVariableSource::Post;
|
||||
const SESSION = Enums\HttpVariableSource::Session;
|
||||
|
@ -72,18 +71,18 @@ 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($nowPd->format('Y')) - 96);
|
||||
define('PD_YEAR', intval((new DateTimeImmutable('now', new DateTimeZone('America/Juneau')))->format('Y')) - 96); // Latest continental US time zone.
|
||||
define('PD_STRING', 'January 1, ' . (PD_YEAR + 1));
|
||||
|
||||
define('DONATION_HOLIDAY_ALERT_ON', $now > new DateTimeImmutable('November 15, ' . $now->format('Y')) || $now < new DateTimeImmutable('January 7, ' . $now->add(new DateInterval('P1Y'))->format('Y')));
|
||||
define('DONATION_HOLIDAY_ALERT_ON', NOW > new DateTimeImmutable('November 15, ' . NOW->format('Y')) || NOW < new DateTimeImmutable('January 7, ' . NOW->add(new DateInterval('P1Y'))->format('Y')));
|
||||
define('DONATION_ALERT_ON', DONATION_HOLIDAY_ALERT_ON || rand(1, 4) == 2);
|
||||
|
||||
// Controls the progress bar donation dialog
|
||||
const DONATION_DRIVE_ON = true;
|
||||
const DONATION_DRIVE_START = 'May 20, 2024 00:00:00 America/New_York';
|
||||
const DONATION_DRIVE_END = 'June 3, 2024 23:59:00 America/New_York';
|
||||
const DONATION_DRIVE_START = new DateTimeImmutable('May 20, 2024 00:00:00 America/New_York');
|
||||
const DONATION_DRIVE_END = new DateTimeImmutable('June 3, 2024 23:59:00 America/New_York');
|
||||
|
||||
// Controls the countdown donation dialog
|
||||
const DONATION_DRIVE_COUNTER_ON = false;
|
||||
const DONATION_DRIVE_COUNTER_START = 'May 2, 2022 00:00:00 America/New_York';
|
||||
const DONATION_DRIVE_COUNTER_END = 'May 8, 2022 23:59:00 America/New_York';
|
||||
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');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue