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 { ...@@ -14,46 +14,54 @@ abstract class EmailAbstract implements EmailInterface {
/** /**
* @var array * @var array
*/ */
protected $recipients = []; private $recipients = [];
/** /**
* @var array * @var array
*/ */
protected $placeholders = []; private $placeholders = [];
/** /**
* @var string * @var string
*/ */
protected $subject = ''; private $subject = '';
/** /**
* @var string * @var string
*/ */
protected $heading = ''; private $heading = '';
/** /**
* @var array * @var array
*/ */
protected $attachments = []; private $attachments = [];
/** /**
* @var string * @var string
*/ */
protected $content = ''; private $content = '';
/** /**
* @var string * @var string
*/ */
protected $type = 'html'; private $type = 'html';
/** /**
* @var array * @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 * @return string
*/ */
abstract public function get_id(): string; abstract public function get_id(): string;
...@@ -69,14 +77,36 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -69,14 +77,36 @@ abstract class EmailAbstract implements EmailInterface {
* @return string * @return string
*/ */
public function get_from(): 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 * @return string
*/ */
public function get_from_name(): 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 { ...@@ -98,8 +128,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Set placeholders.
*
* @param array $placeholders * @param array $placeholders
* *
* @return self * @return self
...@@ -111,8 +139,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -111,8 +139,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Get defined placeholders.
*
* @return string[] * @return string[]
*/ */
public function get_placeholders(): array { public function get_placeholders(): array {
...@@ -120,8 +146,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -120,8 +146,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Get email subject.
*
* @param string $subject * @param string $subject
* *
* @return self * @return self
...@@ -133,8 +157,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -133,8 +157,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Get email subject.
*
* @return string * @return string
* @throws Exception * @throws Exception
*/ */
...@@ -147,8 +169,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -147,8 +169,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Set email heading.
*
* @param string $heading * @param string $heading
* *
* @return self * @return self
...@@ -160,8 +180,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -160,8 +180,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Get email heading.
*
* @return string * @return string
*/ */
public function get_heading(): string { public function get_heading(): string {
...@@ -169,8 +187,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -169,8 +187,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Get valid recipients.
*
* @param array $recipients * @param array $recipients
* *
* @return self * @return self
...@@ -182,8 +198,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -182,8 +198,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Get valid recipients.
*
* @return string[] * @return string[]
*/ */
public function get_recipients(): array { public function get_recipients(): array {
...@@ -191,8 +205,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -191,8 +205,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Get email headers.
*
* @param array $headers * @param array $headers
* *
* @return self * @return self
...@@ -204,8 +216,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -204,8 +216,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Get email headers.
*
* @return string[] * @return string[]
*/ */
public function get_headers(): array { public function get_headers(): array {
...@@ -213,8 +223,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -213,8 +223,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Set attachments.
*
* @param array $attachments * @param array $attachments
* *
* @return self * @return self
...@@ -226,8 +234,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -226,8 +234,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Get email attachments.
*
* @return array * @return array
*/ */
public function get_attachments(): array { public function get_attachments(): array {
...@@ -235,8 +241,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -235,8 +241,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Set email type.
*
* @param string $type * @param string $type
* *
* @return self * @return self
...@@ -248,8 +252,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -248,8 +252,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Get email type.
*
* @return string * @return string
*/ */
public function get_type(): string { public function get_type(): string {
...@@ -257,8 +259,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -257,8 +259,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Get content type.
*
* @return string * @return string
*/ */
public function get_content_type(): string { public function get_content_type(): string {
...@@ -273,8 +273,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -273,8 +273,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Get email content.
*
* @param string $content * @param string $content
* *
* @return self * @return self
...@@ -286,8 +284,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -286,8 +284,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* Get email content.
*
* @return string * @return string
* @throws Exception * @throws Exception
*/ */
...@@ -296,8 +292,6 @@ abstract class EmailAbstract implements EmailInterface { ...@@ -296,8 +292,6 @@ abstract class EmailAbstract implements EmailInterface {
} }
/** /**
* @param string $string
*
* @return array|string|string[] * @return array|string|string[]
*/ */
protected function replace_placeholders( string $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