PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 5.3.2
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v5.3.2
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 3.0.62 All 38 releases
double-opt-in / src / Providers / HealthServiceProvider.php

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

94 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Health Service Provider
4 *
5 * @package Forge12\DoubleOptIn\Providers
6 * @since 5.3.0
7 */
8
9 namespace Forge12\DoubleOptIn\Providers;
10
11 use Forge12\DoubleOptIn\Container\BootableProviderInterface;
12 use Forge12\DoubleOptIn\Container\Container;
13 use Forge12\DoubleOptIn\Health\DatabaseTableHealthCheck;
14 use Forge12\DoubleOptIn\Health\HealthCheckRegistry;
15 use Forge12\DoubleOptIn\Health\SiteHealthIntegration;
16
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit;
19 }
20
21 /**
22 * Class HealthServiceProvider
23 *
24 * Wires the health-check registry and its Site Health surfaces.
25 *
26 * Registration of *addon* checks happens through the
27 * `f12_doi_health_checks` filter, which the registry applies lazily on
28 * first read — so this provider does not need to run after addon boot,
29 * and addons do not need a Core new enough to know about this API.
30 *
31 * Only the Core's own tables are registered here. They are the three
32 * that `OnActivation.php` creates; if one of them is missing the plugin
33 * is broken in a way that has, historically, only shown up as a silent
34 * failure much later.
35 */
36 class HealthServiceProvider implements BootableProviderInterface {
37
38 /**
39 * {@inheritdoc}
40 */
41 public function register( Container $container ): void {
42 $container->singleton(
43 HealthCheckRegistry::class,
44 function () {
45 return new HealthCheckRegistry();
46 }
47 );
48 }
49
50 /**
51 * {@inheritdoc}
52 */
53 public function boot( Container $container ): void {
54 $registry = $container->get( HealthCheckRegistry::class );
55
56 $optInsUrl = admin_url( 'admin.php?page=f12-doi-admin' );
57
58 $registry->register(
59 new DatabaseTableHealthCheck(
60 'f12_doi_table_optin',
61 'core',
62 'f12_cf7_doubleoptin',
63 __( 'Opt-in records', 'double-opt-in' ),
64 __( 'Open Double Opt-In', 'double-opt-in' ),
65 $optInsUrl
66 )
67 );
68
69 $registry->register(
70 new DatabaseTableHealthCheck(
71 'f12_doi_table_categories',
72 'core',
73 'f12_cf7_doubleoptin_categories',
74 __( 'Opt-in categories', 'double-opt-in' ),
75 __( 'Open Double Opt-In', 'double-opt-in' ),
76 $optInsUrl
77 )
78 );
79
80 $registry->register(
81 new DatabaseTableHealthCheck(
82 'f12_doi_table_audit_log',
83 'core',
84 'f12_cf7_doubleoptin_audit_log',
85 __( 'Consent audit log', 'double-opt-in' ),
86 __( 'Open Double Opt-In', 'double-opt-in' ),
87 $optInsUrl
88 )
89 );
90
91 ( new SiteHealthIntegration( $registry ) )->register();
92 }
93 }
94