$end){ 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 ', [$start, $start, $start]); $totalTarget = $baseTarget; $deadline = $end->format('F j'); $timeLeft = $now->diff($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; } ?>