AmplitudeProvider.php
2 months ago
AssetsProvider.php
11 months ago
BlocksProvider.php
3 months ago
ClientProvider.php
2 months ago
ContainerProvider.php
11 months ago
DatabaseProvider.php
8 months ago
HostingRoutesProvider.php
2 months ago
IntegrationsProvider.php
5 months ago
JobsProvider.php
7 months ago
MenusProvider.php
11 months ago
NoticesProvider.php
4 months ago
ProviderInterface.php
11 months ago
RedirectsProvider.php
11 months ago
RoutesProvider.php
9 months ago
SurveysProvider.php
2 months ago
TrackingProvider.php
8 months ago
WebhooksProvider.php
8 months ago
WpdbProvider.php
11 months ago
IntegrationsProvider.php
87 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Hostinger\Reach\Providers; |
| 4 | |
| 5 | use Hostinger\Reach\Api\Handlers\IntegrationsApiHandler; |
| 6 | use Hostinger\Reach\Container; |
| 7 | use Hostinger\Reach\Functions; |
| 8 | use Hostinger\Reach\Integrations\Brave\BraveIntegration; |
| 9 | use Hostinger\Reach\Integrations\ContactForm7\ContactForm7Integration; |
| 10 | use Hostinger\Reach\Integrations\Elementor\ElementorIntegration; |
| 11 | use Hostinger\Reach\Integrations\Forminator\ForminatorIntegration; |
| 12 | use Hostinger\Reach\Integrations\NinjaForms\NinjaFormsIntegration; |
| 13 | use Hostinger\Reach\Integrations\Reach\ReachFormIntegration; |
| 14 | use Hostinger\Reach\Integrations\SureForms\SureFormsIntegration; |
| 15 | use Hostinger\Reach\Integrations\ThriveLeads\ThriveLeadsIntegration; |
| 16 | use Hostinger\Reach\Integrations\OptInMonster\OptInMonsterIntegration; |
| 17 | use Hostinger\Reach\Integrations\WooCommerce\WooCommerceIntegration; |
| 18 | use Hostinger\Reach\Integrations\WPFormsLite\WpFormsLiteIntegration; |
| 19 | use Hostinger\Reach\Integrations\WSForms\WSFormsIntegration; |
| 20 | use Hostinger\Reach\Repositories\ContactListRepository; |
| 21 | use Hostinger\Reach\Repositories\FormRepository; |
| 22 | |
| 23 | if ( ! defined( 'ABSPATH' ) ) { |
| 24 | die; |
| 25 | } |
| 26 | |
| 27 | class IntegrationsProvider implements ProviderInterface { |
| 28 | |
| 29 | public const INTEGRATIONS = array( |
| 30 | ReachFormIntegration::INTEGRATION_NAME => ReachFormIntegration::class, |
| 31 | ContactForm7Integration::INTEGRATION_NAME => ContactForm7Integration::class, |
| 32 | WpFormsLiteIntegration::INTEGRATION_NAME => WpFormsLiteIntegration::class, |
| 33 | ElementorIntegration::INTEGRATION_NAME => ElementorIntegration::class, |
| 34 | WooCommerceIntegration::INTEGRATION_NAME => WooCommerceIntegration::class, |
| 35 | NinjaFormsIntegration::INTEGRATION_NAME => NinjaFormsIntegration::class, |
| 36 | SureFormsIntegration::INTEGRATION_NAME => SureFormsIntegration::class, |
| 37 | WSFormsIntegration::INTEGRATION_NAME => WSFormsIntegration::class, |
| 38 | ForminatorIntegration::INTEGRATION_NAME => ForminatorIntegration::class, |
| 39 | ThriveLeadsIntegration::INTEGRATION_NAME => ThriveLeadsIntegration::class, |
| 40 | BraveIntegration::INTEGRATION_NAME => BraveIntegration::class, |
| 41 | OptInMonsterIntegration::INTEGRATION_NAME => OptInMonsterIntegration::class, |
| 42 | ); |
| 43 | |
| 44 | public function register( Container $container ): void { |
| 45 | |
| 46 | $integrations = array( |
| 47 | ReachFormIntegration::class => array( |
| 48 | $container->get( FormRepository::class ), |
| 49 | $container->get( ContactListRepository::class ), |
| 50 | $container->get( Functions::class ), |
| 51 | ), |
| 52 | ContactForm7Integration::class => array(), |
| 53 | WpFormsLiteIntegration::class => array(), |
| 54 | ElementorIntegration::class => array( |
| 55 | $container->get( FormRepository::class ), |
| 56 | ), |
| 57 | WooCommerceIntegration::class => array( |
| 58 | $container->get( FormRepository::class ), |
| 59 | ), |
| 60 | NinjaFormsIntegration::class => array(), |
| 61 | SureFormsIntegration::class => array(), |
| 62 | WSFormsIntegration::class => array(), |
| 63 | ForminatorIntegration::class => array(), |
| 64 | ThriveLeadsIntegration::class => array(), |
| 65 | BraveIntegration::class => array(), |
| 66 | OptInMonsterIntegration::class => array( |
| 67 | $container->get( Functions::class ), |
| 68 | ), |
| 69 | ); |
| 70 | |
| 71 | foreach ( $integrations as $class_name => $dependencies ) { |
| 72 | $integration = new $class_name( ...$dependencies ); |
| 73 | $container->set( |
| 74 | $integration::class, |
| 75 | function () use ( $integration ) { |
| 76 | return $integration; |
| 77 | } |
| 78 | ); |
| 79 | |
| 80 | $integration = $container->get( $integration::class ); |
| 81 | $integration->init(); |
| 82 | } |
| 83 | |
| 84 | $container->get( IntegrationsApiHandler::class )->init_hooks(); |
| 85 | } |
| 86 | } |
| 87 |