From 5bf2cfa94ac29c5b73cac3f9e7465c20c35852d5 Mon Sep 17 00:00:00 2001 From: kylekatarnls Date: Fri, 8 Nov 2024 00:00:05 +0100 Subject: [PATCH] Update sponsors --- readme.md | 12 ++++++------ sponsors.php | 55 +++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 47 insertions(+), 20 deletions(-) diff --git a/readme.md b/readme.md index 69bd276529..8ed50f3c68 100644 --- a/readme.md +++ b/readme.md @@ -125,27 +125,27 @@ Support this project by becoming a sponsor. Your logo will show up here with a l Онлайн казино 777 Best non Gamstop sites in the UK -Real Money Pokies -Non GamStop Bookies UK +Real Money Pokies +Non GamStop Bookies UK CasinoHex Canada Route4Me Route Planner -Sportsbook Reviews Online Probukmacher Casino-portugal.pt inkedin Онлайн казино України +OnlineCasinosSpelen Guidebook.BetWinner Onlayn Kazino casino.ua -OnlineCasinosSpelen Онлайн Казино Украины casinorevisor.com Non-GamStop Bets UK -Online Kasyno Polis Pin-Up Slots City -Tidelift +Tidelift +Online Kasyno Polis Ігрові автомати +Slotozilla Fortune Tiger casino non aams Credit Zaim diff --git a/sponsors.php b/sponsors.php index 5a89e20bb7..4a4f4d6356 100644 --- a/sponsors.php +++ b/sponsors.php @@ -45,6 +45,7 @@ function getOpenCollectiveSponsors(): string ]; $members = json_decode(file_get_contents('https://opencollective.com/carbon/members/all.json'), true); + // Adding sponsors paying via other payment methods $members[] = [ 'MemberId' => 1, 'createdAt' => '2019-01-01 02:00', @@ -59,9 +60,26 @@ function getOpenCollectiveSponsors(): string 'profile' => 'https://tidelift.com/', 'name' => 'Tidelift', 'description' => 'Get professional support for Carbon', - 'image' => 'https://carbon.nesbot.com/tidelift-brand.png', + 'image' => 'https://carbon.nesbot.com/docs/sponsors/tidelift-brand.png', 'website' => 'https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=docs', ]; + $members[] = [ + 'MemberId' => 2, + 'createdAt' => '2024-11-07 02:00', + 'type' => 'ORGANIZATION', + 'role' => 'BACKER', + 'tier' => 'backer+ yearly', + 'isActive' => true, + 'totalAmountDonated' => 170, + 'currency' => 'USD', + 'lastTransactionAt' => '2024-11-07 02:00', + 'lastTransactionAmount' => 170, + 'profile' => 'https://www.slotozilla.com/nz/free-spins', + 'name' => 'Slotozilla', + 'description' => 'Slotozilla website', + 'image' => 'https://carbon.nesbot.com/docs/sponsors/slotozilla.png', + 'website' => 'https://www.slotozilla.com/nz/free-spins', + ]; $list = array_filter($members, static fn (array $member): bool => $member['totalAmountDonated'] > 3 && $member['role'] !== 'HOST' && ( $member['totalAmountDonated'] > 100 || @@ -81,21 +99,30 @@ function getOpenCollectiveSponsors(): string ->modify($lastTransactionAt->format('H:i:s.u')); } - $monthlyContribution = (float) ($member['totalAmountDonated'] / ceil($createdAt->floatDiffInMonths())); - - if ( - $lastTransactionAt->isAfter('last month') && - $member['lastTransactionAmount'] > $monthlyContribution - ) { - $monthlyContribution = (float) $member['lastTransactionAmount']; - } - - if ($lastTransactionAt->isBefore('-75 days')) { - $days = min(120, $lastTransactionAt->diffInDays('now') - 70); - $monthlyContribution *= 1 - $days / 240; + $isYearly = str_contains(strtolower($member['tier'] ?? ''), 'yearly'); + $monthlyContribution = (float) ($isYearly && $lastTransactionAt > CarbonImmutable::parse('-1 year') + ? ($member['lastTransactionAmount'] / 11.2) // 11.2 instead of 12 to include the discount for yearly subscription + : ($member['totalAmountDonated'] / ceil($createdAt->floatDiffInMonths())) + ); + + if (!$isYearly) { + if ( + $lastTransactionAt->isAfter('last month') && + $member['lastTransactionAmount'] > $monthlyContribution + ) { + $monthlyContribution = (float) $member['lastTransactionAmount']; + } + + if ($lastTransactionAt->isBefore('-75 days')) { + $days = min(120, $lastTransactionAt->diffInDays('now') - 70); + $monthlyContribution *= 1 - $days / 240; + } } - $yearlyContribution = (float) ($member['totalAmountDonated'] / max(1, $createdAt->floatDiffInYears())); + $yearlyContribution = (float) ($isYearly + ? (12 * $monthlyContribution) + : ($member['totalAmountDonated'] / max(1, $createdAt->floatDiffInYears())) + ); $status = null; $rank = 0;