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 / Licensing / AddonLicenseRegistryInterface.php

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

88 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Addon License Registry Interface
4 *
5 * @package Forge12\DoubleOptIn\Licensing
6 * @since 4.3.0
7 */
8
9 namespace Forge12\DoubleOptIn\Licensing;
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit;
13 }
14
15 /**
16 * Interface AddonLicenseRegistryInterface
17 *
18 * @api
19 *
20 * The license registry is a pure state holder. It does NOT perform license
21 * validation — that responsibility belongs to a license provider (e.g. the
22 * Pro bundle's LicenseManager). A license provider validates keys against
23 * its own server and then calls {@see grant()} on the registry for each
24 * addon the license entitles.
25 *
26 * Addons consume the registry read-only via {@see isLicensed()}. They
27 * MUST NOT grant or revoke entitlements themselves — that would defeat
28 * the separation of concerns.
29 *
30 * Free addons do not need to interact with this registry at all; only
31 * paid addons gate themselves on {@see isLicensed()}.
32 */
33 interface AddonLicenseRegistryInterface {
34
35 /**
36 * Grant a license entitlement for an addon.
37 *
38 * Called by a license provider after successful validation. Idempotent —
39 * re-granting the same addon overrides only the source, not the
40 * licensed state.
41 *
42 * @param string $addonId Addon ID, must match {@see \Forge12\DoubleOptIn\Addon\AddonInterface::getId()}.
43 * @param string $source Free-form provider identifier for audit logs,
44 * e.g. "pro-bundle", "elementor-standalone". Defaults to "default".
45 * @return void
46 */
47 public function grant( string $addonId, string $source = 'default' ): void;
48
49 /**
50 * Revoke an addon's entitlement.
51 *
52 * Called when a license expires or is removed. No-op if the addon has
53 * no entitlement.
54 *
55 * @param string $addonId Addon ID.
56 * @return void
57 */
58 public function revoke( string $addonId ): void;
59
60 /**
61 * Check whether an addon currently has a valid entitlement.
62 *
63 * This is the primary method called by paid addons during bootstrap
64 * to decide whether to activate their features.
65 *
66 * @param string $addonId Addon ID.
67 * @return bool
68 */
69 public function isLicensed( string $addonId ): bool;
70
71 /**
72 * Return the source of an addon's entitlement, or null if unlicensed.
73 *
74 * Useful for debugging and admin UI ("licensed via Pro bundle").
75 *
76 * @param string $addonId Addon ID.
77 * @return string|null
78 */
79 public function getSource( string $addonId ): ?string;
80
81 /**
82 * List all addon IDs currently entitled.
83 *
84 * @return string[]
85 */
86 public function getLicensedAddons(): array;
87 }
88