PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 5.13.0
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v5.13.0
5.12.0 5.13.0 5.13.1 5.11.0 5.10.0 5.9.0 5.8.0 5.8.1 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 All 47 releases
double-opt-in / src / Subscription / SubscriptionGroups.php

SubscriptionGroups.php in Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification 5.13.0, at src/Subscription/SubscriptionGroups.php

40 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Entry point for consumers that need subscription groups.
4 *
5 * @package Forge12\DoubleOptIn\Subscription
6 * @since 5.12.0
7 */
8
9 declare( strict_types=1 );
10
11 namespace Forge12\DoubleOptIn\Subscription;
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17 final class SubscriptionGroups {
18
19 /**
20 * The active resolver. An add-on supplies its own through the
21 * `f12_doi_subscription_group_resolver` filter; anything that is not a
22 * resolver is ignored so a faulty add-on cannot break a consumer.
23 */
24 public static function resolver(): SubscriptionGroupResolverInterface {
25 $resolver = apply_filters( 'f12_doi_subscription_group_resolver', new NullSubscriptionGroupResolver() );
26
27 return $resolver instanceof SubscriptionGroupResolverInterface
28 ? $resolver
29 : new NullSubscriptionGroupResolver();
30 }
31
32 /**
33 * Whether an add-on currently provides groups. Consumers use this to
34 * hide group controls instead of showing empty ones.
35 */
36 public static function isAvailable(): bool {
37 return ! ( self::resolver() instanceof NullSubscriptionGroupResolver );
38 }
39 }
40