PluginProbe ʕ •ᴥ•ʔ
Independent Analytics – WordPress Analytics Plugin / 1.30.0
Independent Analytics – WordPress Analytics Plugin v1.30.0
2.15.5 2.15.4 2.15.3 2.15.2 2.15.1 2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 1.19.1 1.2 1.20.0 1.21.0 1.22.0 1.22.1 1.23.0 1.23.1 1.24.0 1.24.1 1.25.0 1.25.1 1.26.0 1.27.0 1.28.0 1.28.1 1.28.2 1.28.3 1.29.0 1.3 1.30.0 1.30.1 1.4 1.5 1.6 1.7 1.8 1.9 2.0.0 2.0.1 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.10 2.11.2 2.11.3 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.9 2.12.0 2.12.1 2.12.2 2.13.1 2.13.2 2.13.5 2.13.6 2.14.0 2.14.1 2.14.2 2.14.4 2.14.6 2.14.7 2.14.8 2.14.9 2.2.0 2.2.1 2.3.1 2.3.2 2.4.2 2.4.3 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.7.1 2.7.2 2.7.3 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7
independent-analytics / vendor / nesbot / carbon / sponsors.php
independent-analytics / vendor / nesbot / carbon Last commit date
bin 3 years ago lazy 3 years ago src 3 years ago extension.neon 3 years ago sponsors.php 3 years ago
sponsors.php
59 lines
1 <?php
2
3 namespace IAWP_SCOPED;
4
5 /**
6 * This file is part of the Carbon package.
7 *
8 * (c) Brian Nesbitt <brian@nesbot.com>
9 *
10 * For the full copyright and license information, please view the LICENSE
11 * file that was distributed with this source code.
12 */
13 use IAWP_SCOPED\Carbon\CarbonImmutable;
14 require_once __DIR__ . '/vendor/autoload.php';
15 function getOpenCollectiveSponsors() : string
16 {
17 $members = \json_decode(\file_get_contents('https://opencollective.com/carbon/members/all.json'), \true);
18 $sixMonthsAgo = CarbonImmutable::parse('now - 6 months')->format('Y-m-d h:i');
19 $list = \array_filter($members, static function ($member) use($sixMonthsAgo) {
20 return ($member['lastTransactionAmount'] > 3 || $member['isActive']) && $member['role'] === 'BACKER' && $member['type'] !== 'USER' && ($member['totalAmountDonated'] > 100 || $member['lastTransactionAt'] > $sixMonthsAgo || $member['isActive'] && $member['lastTransactionAmount'] >= 30);
21 });
22 $list = \array_map(static function (array $member) {
23 $createdAt = CarbonImmutable::parse($member['createdAt']);
24 $monthlyContribution = (float) ($member['totalAmountDonated'] / (1 + $createdAt->diffInMonths()));
25 if (CarbonImmutable::parse($member['lastTransactionAt'])->isAfter('last month') && $member['lastTransactionAmount'] > $monthlyContribution) {
26 $monthlyContribution = (float) $member['lastTransactionAmount'];
27 }
28 $yearlyContribution = (float) ($member['totalAmountDonated'] / \max(1, $createdAt->floatDiffInYears()));
29 $status = null;
30 if ($monthlyContribution > 29) {
31 $status = 'sponsor';
32 } elseif ($monthlyContribution > 3 || $yearlyContribution > 20) {
33 $status = 'backer';
34 } elseif ($member['totalAmountDonated'] > 0) {
35 $status = 'helper';
36 }
37 return \array_merge($member, ['star' => $monthlyContribution > 98 || $yearlyContribution > 500, 'status' => $status, 'monthlyContribution' => $monthlyContribution, 'yearlyContribution' => $yearlyContribution]);
38 }, $list);
39 \usort($list, static function (array $a, array $b) {
40 return $b['monthlyContribution'] <=> $a['monthlyContribution'] ?: $b['totalAmountDonated'] <=> $a['totalAmountDonated'];
41 });
42 return \implode('', \array_map(static function (array $member) {
43 $href = \htmlspecialchars($member['website'] ?? $member['profile']);
44 $src = $member['image'] ?? \strtr($member['profile'], ['https://opencollective.com/' => 'https://images.opencollective.com/']) . '/avatar/256.png';
45 [$x, $y] = @\getimagesize($src) ?: [0, 0];
46 $validImage = $x && $y;
47 $src = $validImage ? \htmlspecialchars($src) : 'https://opencollective.com/static/images/default-guest-logo.svg';
48 $height = 64;
49 $width = $validImage ? \round($x * $height / $y) : $height;
50 $href .= (\strpos($href, '?') === \false ? '?' : '&amp;') . 'utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon';
51 $title = \htmlspecialchars($member['description'] ?? null ?: $member['name']);
52 $alt = \htmlspecialchars($member['name']);
53 return "\n" . '<a title="' . $title . '" href="' . $href . '" target="_blank" rel="sponsored">' . '<img alt="' . $alt . '" src="' . $src . '" width="' . $width . '" height="' . $height . '">' . '</a>';
54 }, $list)) . "\n";
55 }
56 \file_put_contents('readme.md', \preg_replace_callback('/(<!-- <open-collective-sponsors> -->)[\\s\\S]+(<!-- <\\/open-collective-sponsors> -->)/', static function (array $match) {
57 return $match[1] . getOpenCollectiveSponsors() . $match[2];
58 }, \file_get_contents('readme.md')));
59