HarborServiceProvider.php
51 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Give\VendorOverrides\Harbor; |
| 6 | |
| 7 | use Give\Helpers\Hooks; |
| 8 | use Give\ServiceProviders\ServiceProvider as ServiceProviderContract; |
| 9 | use Give\VendorOverrides\Harbor\Actions\HasActivePremiumAddons; |
| 10 | use Give\VendorOverrides\Harbor\Actions\ReportLegacyLicences; |
| 11 | use Give\Vendors\LiquidWeb\Harbor\Config; |
| 12 | use Give\Vendors\LiquidWeb\Harbor\Harbor; |
| 13 | |
| 14 | /** |
| 15 | * @since 4.15.0 |
| 16 | */ |
| 17 | class HarborServiceProvider implements ServiceProviderContract |
| 18 | { |
| 19 | /** |
| 20 | * @since 4.15.2 Register lw_harbor/premium_plugin_exists filter |
| 21 | * @since 4.15.0 |
| 22 | * |
| 23 | * @inheritDoc |
| 24 | */ |
| 25 | public function register() |
| 26 | { |
| 27 | Config::set_plugin_basename(GIVE_PLUGIN_BASENAME); |
| 28 | Config::set_container(give()->getContainer()); |
| 29 | |
| 30 | // reports whether any GiveWP premium add-on is active to Harbor |
| 31 | Hooks::addFilter('lw_harbor/premium_plugin_exists', HasActivePremiumAddons::class); |
| 32 | |
| 33 | Harbor::init(); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * @since 4.15.0 |
| 38 | * |
| 39 | * @inheritDoc |
| 40 | */ |
| 41 | public function boot() |
| 42 | { |
| 43 | // reports legacy licenses to Harbor |
| 44 | Hooks::addFilter('stellarwp/harbor/legacy_licenses', ReportLegacyLicences::class); |
| 45 | |
| 46 | // adds a "licensing" submenu to Give |
| 47 | lw_harbor_register_submenu('edit.php?post_type=give_forms'); |
| 48 | } |
| 49 | |
| 50 | } |
| 51 |