PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 5.5.0
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v5.5.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 3.0.70 3.0.71 3.0.72 3.1.0 All 34 releases
double-opt-in / src / Addon / AddonInterface.php

AddonInterface.php in Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification 5.5.0, at src/Addon/AddonInterface.php

122 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Addon Interface
4 *
5 * Public contract that every addon plugin implements to register itself
6 * with the Double Opt-In core.
7 *
8 * @package Forge12\DoubleOptIn\Addon
9 * @since 4.3.0
10 */
11
12 namespace Forge12\DoubleOptIn\Addon;
13
14 use Forge12\DoubleOptIn\Container\ContainerInterface;
15
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit;
18 }
19
20 /**
21 * Interface AddonInterface
22 *
23 * @api
24 *
25 * Implemented by every Double Opt-In addon. Addons register themselves
26 * by responding to the `f12_cf7_doubleoptin_register_addons` action hook
27 * with an instance that implements this interface:
28 *
29 * <code>
30 * add_action( 'f12_cf7_doubleoptin_register_addons', function( AddonRegistry $registry ) {
31 * $registry->register( new MyAddon() );
32 * } );
33 * </code>
34 *
35 * The core calls {@see AddonInterface::boot()} once all addons are registered,
36 * after which the addon may wire services into the container, attach event
37 * listeners, and register WordPress hooks.
38 */
39 interface AddonInterface {
40
41 /**
42 * Unique machine ID for the addon.
43 *
44 * Must be lowercase kebab-case and stable across versions of the addon.
45 * Used as a primary key in the registry, for capability lookups, and for
46 * license matching.
47 *
48 * @return string e.g. "elementor", "reminder", "analytics"
49 */
50 public function getId(): string;
51
52 /**
53 * Human-readable addon name. Must be translatable.
54 *
55 * @return string
56 */
57 public function getName(): string;
58
59 /**
60 * Addon version. Must match the version declared in the addon's
61 * plugin header and composer.json.
62 *
63 * @return string Semver-compatible version, e.g. "1.0.0".
64 */
65 public function getVersion(): string;
66
67 /**
68 * Required core version as a semver constraint.
69 *
70 * The core will silently skip booting an addon whose requirement is not
71 * met by the currently loaded core version and surface an admin notice.
72 *
73 * @return string e.g. "^4.0", ">=4.3 <5.0"
74 */
75 public function getCoreVersionRequirement(): string;
76
77 /**
78 * Runtime availability check.
79 *
80 * Return false when prerequisites such as a required third-party plugin,
81 * PHP extension, or license entitlement are not met. The registry will
82 * accept the addon for introspection (so admin UI can surface it) but
83 * {@see self::boot()} will not be called.
84 *
85 * @return bool
86 */
87 public function isAvailable(): bool;
88
89 /**
90 * Boot the addon.
91 *
92 * Called once during core bootstrap after all addons are registered and
93 * all core service providers are available. At this point the addon may:
94 * - register services in the container,
95 * - attach listeners via the EventDispatcher,
96 * - register form integrations in FormIntegrationRegistry,
97 * - add WordPress hooks.
98 *
99 * Expensive work (network, heavy DB) MUST be deferred via
100 * `wp_schedule_single_event` or event listeners — not performed inline.
101 *
102 * @param ContainerInterface $container Core DI container.
103 * @return void
104 */
105 public function boot( ContainerInterface $container ): void;
106
107 /**
108 * Capabilities advertised by this addon.
109 *
110 * Used by other addons and the core to detect features without
111 * hard-coupling to class names. Return a flat list of stable string IDs.
112 *
113 * Examples:
114 * - "form.elementor" (provides an Elementor form integration)
115 * - "mail.reminder" (provides reminder emails)
116 * - "admin.ui.settings-tab" (contributes a settings tab to admin UI)
117 *
118 * @return string[]
119 */
120 public function getCapabilities(): array;
121 }
122