HasActivePremiumAddons.php
36 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Give\VendorOverrides\Harbor\Actions; |
| 6 | |
| 7 | /** |
| 8 | * Return true if another brand already has premium presence or if any GiveWP premium add-on is active. |
| 9 | * |
| 10 | * Hooked into the `lw_harbor/premium_plugin_exists` filter. |
| 11 | * |
| 12 | * @since 4.15.2 |
| 13 | */ |
| 14 | class HasActivePremiumAddons |
| 15 | { |
| 16 | /** |
| 17 | * @since 4.15.2 |
| 18 | */ |
| 19 | public function __invoke(bool $otherBrandsExistence): bool |
| 20 | { |
| 21 | if ($otherBrandsExistence) { |
| 22 | return true; |
| 23 | } |
| 24 | |
| 25 | $premiumAddons = give_get_plugins(['only_premium_add_ons' => true]); |
| 26 | |
| 27 | foreach ($premiumAddons as $addon) { |
| 28 | if ($addon['Status'] === 'active') { |
| 29 | return true; |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | return false; |
| 34 | } |
| 35 | } |
| 36 |