PluginProbe ʕ •ᴥ•ʔ
WP 2FA – Two-factor authentication for WordPress / 2.4.2
WP 2FA – Two-factor authentication for WordPress v2.4.2
1.7.1 2.0.0 2.0.1 2.1.0 2.2.0 2.2.1 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.8.0 2.9.0 2.9.1 2.9.2 2.9.3 3.0.0 3.0.1 3.1.0 3.1.1 3.1.1.2 trunk 1.2.0 1.3.0 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.6.2 1.7.0
wp-2fa / includes / classes / class-email-template.php
wp-2fa / includes / classes Last commit date
Admin 3 years ago App 3 years ago Authenticator 2 years ago Shortcodes 3 years ago Utils 3 years ago class-email-template.php 3 years ago class-wp2fa.php 2 years ago index.php 5 years ago
class-email-template.php
132 lines
1 <?php
2 /**
3 * Responsible for email templates generation.
4 *
5 * @package wp2fa
6 * @copyright 2023 WP White Security
7 * @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
8 * @link https://wordpress.org/plugins/wp-2fa/
9 */
10
11 namespace WP2FA;
12
13 /**
14 * Plain old PHP object to hold data for an email template.
15 *
16 * @package WP2FA
17 */
18 class Email_Template {
19
20 /**
21 * Template ID used for most settings form fields and setting keys.
22 *
23 * @var string
24 */
25 private $id;
26
27 /**
28 * The title of the email
29 *
30 * @var string
31 */
32 private $title;
33
34 /**
35 * Email template description
36 *
37 * @var string
38 */
39 private $description;
40
41 /**
42 * ID used for identifying the subject and body of the email. Defaults to $id.
43 *
44 * @var string ID used for identifying the subject and body of the email. Defaults to $id.
45 */
46 private $email_content_id;
47
48 /**
49 * True if the email can be turned on or off in the plugin settings.
50 *
51 * @var bool
52 */
53 private $can_be_toggled = true;
54
55 /**
56 * Email_Template constructor.
57 *
58 * @param string $id - The template ID.
59 * @param string $title - The title.
60 * @param string $description - The description.
61 */
62 public function __construct( string $id, string $title, string $description ) {
63 $this->id = $id;
64 $this->title = $title;
65 $this->description = $description;
66 $this->email_content_id = $id;
67 }
68
69 /**
70 * Can it be toggled
71 *
72 * @return bool
73 */
74 public function can_be_toggled(): bool {
75 return $this->can_be_toggled;
76 }
77
78 /**
79 * Sets the toggled flag for the template
80 *
81 * @param bool $can_be_toggled - Can it be toggled.
82 */
83 public function set_can_be_toggled( $can_be_toggled ) {
84 $this->can_be_toggled = $can_be_toggled;
85 }
86
87 /**
88 * Returns the template ID
89 *
90 * @return string
91 */
92 public function get_id(): string {
93 return $this->id;
94 }
95
96 /**
97 * Returns the title
98 *
99 * @return string
100 */
101 public function get_title(): string {
102 return $this->title;
103 }
104
105 /**
106 * Returns the description
107 *
108 * @return string
109 */
110 public function get_description(): string {
111 return $this->description;
112 }
113
114 /**
115 * Returns the mail content
116 *
117 * @return string
118 */
119 public function get_email_content_id(): string {
120 return $this->email_content_id;
121 }
122
123 /**
124 * Set content ID
125 *
126 * @param string $email_content_id - the ID of the content.
127 */
128 public function set_email_content_id( string $email_content_id ) {
129 $this->email_content_id = $email_content_id;
130 }
131 }
132