NOW // If the drive hasn't started yet || NOW > DONATION_DRIVE_END // If the drive has ended ){ return; } $autoHide = $autoHide ?? true; $showDonateButton = $showDonateButton ?? true; $totalCurrent = Db::QueryInt(' SELECT sum(cnt) from ( ( # Anonymous patrons, i.e. from AOGF select count(*) cnt from Payments where UserId is null and ( (IsRecurring = true and Amount >= 10 and Created >= ?) or (IsRecurring = false and Amount >= 100 and Created >= ?) ) ) union all ( # All non-anonymous patrons select count(*) as cnt from Patrons where Created >= ? ) ) x ', [DONATION_DRIVE_START, DONATION_DRIVE_START, DONATION_DRIVE_START]); $totalTarget = $baseTarget; $deadline = DONATION_DRIVE_END->format('F j'); $timeLeft = NOW->diff(DONATION_DRIVE_END); $timeString = ''; if($timeLeft->days < 1 && $timeLeft->h < 20){ $timeString = 'Just hours'; } elseif($timeLeft->days >= 1 && $timeLeft->h <= 12){ $timeString = $timeLeft->days . ' day'; if($timeLeft->days > 1){ $timeString .= 's'; } else{ $timeString = 'Only ' . $timeString; } } else{ $timeString = ($timeLeft->days + 1) . ' day'; if($timeLeft->days + 1 > 1){ $timeString .= 's'; } else{ $timeString = 'Only ' . $timeString; } } $stretchOn = false; if($stretchTarget > 0 && $totalCurrent >= $baseTarget){ $stretchOn = true; $stretchCurrent = $totalCurrent - $baseTarget; $totalTarget = $baseTarget + $stretchTarget; } ?>