| 1 |
<?php |
| 2 |
/** |
| 3 |
* OptIn Deleted Event |
| 4 |
* |
| 5 |
* @package Forge12\DoubleOptIn\Events\Lifecycle |
| 6 |
* @since 4.0.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace Forge12\DoubleOptIn\Events\Lifecycle; |
| 10 |
|
| 11 |
use Forge12\DoubleOptIn\EventSystem\Event; |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Class OptInDeletedEvent |
| 19 |
* |
| 20 |
* @api |
| 21 |
* |
| 22 |
* Dispatched when an opt-in record is deleted. |
| 23 |
* Covered by the Addon API semver policy as of Core API 4.3.0. |
| 24 |
*/ |
| 25 |
class OptInDeletedEvent extends Event { |
| 26 |
|
| 27 |
private string $hash; |
| 28 |
private string $email; |
| 29 |
private string $deletedBy; |
| 30 |
private int $rowsDeleted; |
| 31 |
|
| 32 |
/** |
| 33 |
* Constructor. |
| 34 |
* |
| 35 |
* @param string $hash The opt-in hash. |
| 36 |
* @param string $email The subscriber email. |
| 37 |
* @param string $deletedBy Who deleted it (admin, cron, user). |
| 38 |
* @param int $rowsDeleted Number of rows deleted. |
| 39 |
*/ |
| 40 |
public function __construct( |
| 41 |
string $hash, |
| 42 |
string $email, |
| 43 |
string $deletedBy, |
| 44 |
int $rowsDeleted = 1 |
| 45 |
) { |
| 46 |
parent::__construct(); |
| 47 |
$this->hash = $hash; |
| 48 |
$this->email = $email; |
| 49 |
$this->deletedBy = $deletedBy; |
| 50 |
$this->rowsDeleted = $rowsDeleted; |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* {@inheritdoc} |
| 55 |
*/ |
| 56 |
public static function getWordPressHookName(): string { |
| 57 |
return 'f12_cf7_doubleoptin_deleted'; |
| 58 |
} |
| 59 |
|
| 60 |
public function getHash(): string { |
| 61 |
return $this->hash; |
| 62 |
} |
| 63 |
|
| 64 |
public function getEmail(): string { |
| 65 |
return $this->email; |
| 66 |
} |
| 67 |
|
| 68 |
public function getDeletedBy(): string { |
| 69 |
return $this->deletedBy; |
| 70 |
} |
| 71 |
|
| 72 |
public function getRowsDeleted(): int { |
| 73 |
return $this->rowsDeleted; |
| 74 |
} |
| 75 |
} |
| 76 |
|