Admin
5 years ago
Authenticator
5 years ago
BackgroundProcessing
5 years ago
Cron
5 years ago
Shortcodes
5 years ago
Utils
5 years ago
.gitkeep
6 years ago
EmailTemplate.php
5 years ago
WP2FA.php
5 years ago
EmailTemplate.php
95 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace WP2FA; |
| 5 | |
| 6 | /** |
| 7 | * Plain old PHP object to hold data for an email template. |
| 8 | * |
| 9 | * @package WP2FA |
| 10 | */ |
| 11 | class EmailTemplate { |
| 12 | |
| 13 | /** |
| 14 | * @var string Template ID used for most settings form fields and setting keys. |
| 15 | */ |
| 16 | private $id; |
| 17 | private $title; |
| 18 | private $description; |
| 19 | |
| 20 | /** |
| 21 | * @var string ID used for identifying the subject and body of the email. Defaults to $id. |
| 22 | */ |
| 23 | private $email_content_id; |
| 24 | |
| 25 | /** |
| 26 | * @var bool True if the email can be turned on or off in the plugin settings. |
| 27 | */ |
| 28 | private $can_be_toggled = true; |
| 29 | |
| 30 | /** |
| 31 | * EmailTemplate constructor. |
| 32 | * |
| 33 | * @param string $id |
| 34 | * @param string $title |
| 35 | * @param string $description |
| 36 | */ |
| 37 | public function __construct( string $id, string $title, string $description ) { |
| 38 | $this->id = $id; |
| 39 | $this->title = $title; |
| 40 | $this->description = $description; |
| 41 | $this->email_content_id = $id; |
| 42 | |
| 43 | return $this; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * @return bool |
| 48 | */ |
| 49 | public function canBeToggled(): bool { |
| 50 | return $this->can_be_toggled; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * @param bool $can_be_toggled |
| 55 | */ |
| 56 | public function setCanBeToggled( $can_be_toggled ) { |
| 57 | $this->can_be_toggled = $can_be_toggled; |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * @return string |
| 62 | */ |
| 63 | public function getId(): string { |
| 64 | return $this->id; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * @return string |
| 69 | */ |
| 70 | public function getTitle(): string { |
| 71 | return $this->title; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * @return string |
| 76 | */ |
| 77 | public function getDescription(): string { |
| 78 | return $this->description; |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * @return string |
| 83 | */ |
| 84 | public function getEmailContentId(): string { |
| 85 | return $this->email_content_id; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * @param string $email_content_id |
| 90 | */ |
| 91 | public function setEmailContentId( string $email_content_id ) { |
| 92 | $this->email_content_id = $email_content_id; |
| 93 | } |
| 94 | } |
| 95 |