2020-10-27 12:57:12 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2020-10-27 12:57:12 +01:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Mail\Engine;
|
|
|
|
|
|
|
|
class BaseEmailEngine implements EngineInterface
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
public $footer;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
public $variables;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
public $contact;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
public $subject;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
public $body;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
public $template_style;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-12-02 23:26:46 +01:00
|
|
|
public $attachments = [];
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
public $link;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
public $text;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2021-02-22 01:18:52 +01:00
|
|
|
public $invitation;
|
|
|
|
|
2020-10-27 12:57:12 +01:00
|
|
|
public function setFooter($footer)
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
$this->footer = $footer;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setVariables($variables)
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
$this->variables = $variables;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setContact($contact)
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
$this->contact = $contact;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setSubject($subject)
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
if (! empty($this->variables)) {
|
2020-11-05 11:14:30 +01:00
|
|
|
$subject = str_replace(array_keys($this->variables), array_values($this->variables), $subject);
|
2020-11-25 15:19:52 +01:00
|
|
|
}
|
2020-11-05 11:14:30 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
$this->subject = $subject;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setBody($body)
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
if (! empty($this->variables)) {
|
2020-11-05 11:14:30 +01:00
|
|
|
$body = str_replace(array_keys($this->variables), array_values($this->variables), $body);
|
2021-03-31 03:55:33 +02:00
|
|
|
$body = str_replace(array_keys($this->variables), array_values($this->variables), $body);
|
2020-11-25 15:19:52 +01:00
|
|
|
}
|
2020-11-05 11:14:30 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
$this->body = $body;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setTemplate($template_style)
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
$this->template_style = $template_style;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setAttachments($attachments)
|
|
|
|
{
|
2020-12-02 23:26:46 +01:00
|
|
|
$this->attachments = array_merge($this->getAttachments(), $attachments);
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setViewLink($link)
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
$this->link = $link;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setViewText($text)
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
$this->text = $text;
|
2020-10-27 12:57:12 +01:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getSubject()
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this->subject;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getBody()
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this->body;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getAttachments()
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this->attachments;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getFooter()
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this->footer;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getTemplate()
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this->template_style;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getViewLink()
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this->link;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getViewText()
|
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
return $this->text;
|
2020-10-27 12:57:12 +01:00
|
|
|
}
|
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
public function build()
|
|
|
|
{
|
|
|
|
}
|
2021-02-22 01:18:52 +01:00
|
|
|
|
|
|
|
public function setInvitation($invitation)
|
|
|
|
{
|
|
|
|
$this->invitation = $invitation;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getInvitation()
|
|
|
|
{
|
|
|
|
return $this->invitation;
|
|
|
|
}
|
2020-11-25 15:19:52 +01:00
|
|
|
}
|
2021-02-22 01:18:52 +01:00
|
|
|
|