PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / trunk
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification vtrunk
5.7.0 5.6.2 5.6.3 5.6.1 5.6.0 5.5.0 5.4.0 5.3.2 5.3.1 5.1.6 5.1.5 trunk 2.1.5 2.11 2.12 2.13 2.15 3.0.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.51 3.0.60 3.0.61 All 39 releases
double-opt-in / src / Providers / GdprServiceProvider.php

GdprServiceProvider.php in Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification trunk, at src/Providers/GdprServiceProvider.php

74 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * GDPR Service Provider
4 *
5 * @package Forge12\DoubleOptIn\Providers
6 * @since 3.2.0
7 */
8
9 namespace Forge12\DoubleOptIn\Providers;
10
11 use Forge12\DoubleOptIn\Admin\SingleConsentExportController;
12 use Forge12\DoubleOptIn\Container\BootableProviderInterface;
13 use Forge12\DoubleOptIn\Audit\ConsentAuditListener;
14 use Forge12\DoubleOptIn\Container\Container;
15 use Forge12\DoubleOptIn\EventSystem\EventDispatcherInterface;
16 use Forge12\DoubleOptIn\Repository\OptInRepositoryInterface;
17 use Forge12\DoubleOptIn\Service\PrivacyIntegration;
18 use Forge12\Shared\LoggerInterface;
19
20 if ( ! defined( 'ABSPATH' ) ) {
21 exit;
22 }
23
24 /**
25 * Class GdprServiceProvider
26 *
27 * Registers all GDPR-related services in the DI container.
28 */
29 class GdprServiceProvider implements BootableProviderInterface {
30
31 /**
32 * {@inheritdoc}
33 */
34 public function register( Container $container ): void {
35 $container->singleton(
36 PrivacyIntegration::class,
37 function ( Container $c ) {
38 return new PrivacyIntegration(
39 $c->get( LoggerInterface::class ),
40 $c->get( OptInRepositoryInterface::class ),
41 // Bound by MailStatusServiceProvider (5.8.0); resolved lazily.
42 $c->get( \Forge12\DoubleOptIn\Repository\OptInMailStatusRepository::class )
43 );
44 }
45 );
46
47 $container->singleton(
48 SingleConsentExportController::class,
49 function ( Container $c ) {
50 return new SingleConsentExportController(
51 $c->get( LoggerInterface::class ),
52 $c->get( OptInRepositoryInterface::class )
53 );
54 }
55 );
56 }
57
58 /**
59 * {@inheritdoc}
60 */
61 public function boot( Container $container ): void {
62 // Register WordPress Privacy Tools hooks
63 $container->get( PrivacyIntegration::class )->register();
64
65 // Register single-record consent export (fallback if Pro is not active)
66 $container->get( SingleConsentExportController::class )->registerActions();
67
68 // A renewed consent is its own audit entry (5.8.0).
69 if ( $container->has( EventDispatcherInterface::class ) ) {
70 ( new ConsentAuditListener() )->register( $container->get( EventDispatcherInterface::class ) );
71 }
72 }
73 }
74