Skip to content
Snippets Groups Projects
Commit ca4eb5a7 authored by Piotr Potrebka's avatar Piotr Potrebka
Browse files

feat: lang

parent 6adcbdb9
No related branches found
No related tags found
1 merge request!2Devel
Pipeline #153480 passed with stages
in 59 seconds
......@@ -14,46 +14,54 @@ abstract class EmailAbstract implements EmailInterface {
/**
* @var array
*/
protected $recipients = [];
private $recipients = [];
/**
* @var array
*/
protected $placeholders = [];
private $placeholders = [];
/**
* @var string
*/
protected $subject = '';
private $subject = '';
/**
* @var string
*/
protected $heading = '';
private $heading = '';
/**
* @var array
*/
protected $attachments = [];
private $attachments = [];
/**
* @var string
*/
protected $content = '';
private $content = '';
/**
* @var string
*/
protected $type = 'html';
private $type = 'html';
/**
* @var array
*/
protected $headers = [];
private $headers = [ 'Content-Type: text/html; charset=UTF-8' ];
/**
* @var string
*/
private $from_email;
/**
* @var string
*/
private $from_name;
/**
* Define unique email ID.
*
* @return string
*/
abstract public function get_id(): string;
......@@ -69,14 +77,36 @@ abstract class EmailAbstract implements EmailInterface {
* @return string
*/
public function get_from(): string {
return '';
return sanitize_email( $this->from_email );
}
/**
* @param string $from_email
*
* @return self
*/
public function set_from( string $from_email ): self {
$this->from_email = $from_email;
return $this;
}
/**
* @param string $from_name
*
* @return self
*/
public function set_from_name( string $from_name ): self {
$this->from_name = $from_name;
return $this;
}
/**
* @return string
*/
public function get_from_name(): string {
return '';
return wp_specialchars_decode( esc_html( $this->from_name ), ENT_QUOTES );
}
/**
......@@ -98,8 +128,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Set placeholders.
*
* @param array $placeholders
*
* @return self
......@@ -111,8 +139,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Get defined placeholders.
*
* @return string[]
*/
public function get_placeholders(): array {
......@@ -120,8 +146,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Get email subject.
*
* @param string $subject
*
* @return self
......@@ -133,8 +157,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Get email subject.
*
* @return string
* @throws Exception
*/
......@@ -147,8 +169,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Set email heading.
*
* @param string $heading
*
* @return self
......@@ -160,8 +180,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Get email heading.
*
* @return string
*/
public function get_heading(): string {
......@@ -169,8 +187,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Get valid recipients.
*
* @param array $recipients
*
* @return self
......@@ -182,8 +198,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Get valid recipients.
*
* @return string[]
*/
public function get_recipients(): array {
......@@ -191,8 +205,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Get email headers.
*
* @param array $headers
*
* @return self
......@@ -204,8 +216,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Get email headers.
*
* @return string[]
*/
public function get_headers(): array {
......@@ -213,8 +223,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Set attachments.
*
* @param array $attachments
*
* @return self
......@@ -226,8 +234,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Get email attachments.
*
* @return array
*/
public function get_attachments(): array {
......@@ -235,8 +241,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Set email type.
*
* @param string $type
*
* @return self
......@@ -248,8 +252,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Get email type.
*
* @return string
*/
public function get_type(): string {
......@@ -257,8 +259,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Get content type.
*
* @return string
*/
public function get_content_type(): string {
......@@ -273,8 +273,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Get email content.
*
* @param string $content
*
* @return self
......@@ -286,8 +284,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* Get email content.
*
* @return string
* @throws Exception
*/
......@@ -296,8 +292,6 @@ abstract class EmailAbstract implements EmailInterface {
}
/**
* @param string $string
*
* @return array|string|string[]
*/
protected function replace_placeholders( string $string ): string {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment