PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 5.8.1
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v5.8.1
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 3.0.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.51 All 41 releases
double-opt-in / src / Events / Lifecycle / OptInOptedOutEvent.php

OptInOptedOutEvent.php in Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification 5.8.1, at src/Events/Lifecycle/OptInOptedOutEvent.php

93 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * OptIn Opted-Out Event
4 *
5 * @package Forge12\DoubleOptIn\Events\Lifecycle
6 * @since 5.8.0
7 */
8
9 declare( strict_types=1 );
10
11 namespace Forge12\DoubleOptIn\Events\Lifecycle;
12
13 use Forge12\DoubleOptIn\EventSystem\Event;
14
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit;
17 }
18
19 /**
20 * Dispatched when a confirmed consent is withdrawn.
21 *
22 * The core never withdraws a consent itself; addon-opt-out does and fires
23 * this, so that other add-ons (webhooks, newsletter sync) can follow
24 * without depending on it. Fired once per opt-in that actually changed —
25 * a second click on an old link fires nothing.
26 *
27 * @api Core API 4.6.0
28 */
29 class OptInOptedOutEvent extends Event {
30
31 public const SOURCE_LINK = 'link';
32 public const SOURCE_BULK = 'bulk';
33 public const SOURCE_ONE_CLICK = 'one-click';
34
35 /** @var int */
36 private $optInId;
37
38 /** @var string */
39 private $hash;
40
41 /** @var string */
42 private $email;
43
44 /** @var int */
45 private $formId;
46
47 /** @var string */
48 private $source;
49
50 /**
51 * @param int $optInId Opt-in id.
52 * @param string $hash Opt-in hash.
53 * @param string $email Subscriber address.
54 * @param int $formId Form the consent was given in.
55 * @param string $source How it was withdrawn, one of the SOURCE_* constants.
56 */
57 public function __construct( int $optInId, string $hash, string $email, int $formId, string $source ) {
58 parent::__construct();
59 $this->optInId = $optInId;
60 $this->hash = $hash;
61 $this->email = $email;
62 $this->formId = $formId;
63 $this->source = $source;
64 }
65
66 /**
67 * {@inheritdoc}
68 */
69 public static function getWordPressHookName(): string {
70 return 'f12_doi_optin_opted_out';
71 }
72
73 public function getOptInId(): int {
74 return $this->optInId;
75 }
76
77 public function getHash(): string {
78 return $this->hash;
79 }
80
81 public function getEmail(): string {
82 return $this->email;
83 }
84
85 public function getFormId(): int {
86 return $this->formId;
87 }
88
89 public function getSource(): string {
90 return $this->source;
91 }
92 }
93