]> git.mxchange.org Git - friendica.git/blob - src/Object/EMail/ItemCCEMail.php
fix boolean field
[friendica.git] / src / Object / EMail / ItemCCEMail.php
1 <?php
2
3 namespace Friendica\Object\EMail;
4
5 use Friendica\App;
6 use Friendica\App\BaseURL;
7 use Friendica\Content\Text\HTML;
8 use Friendica\Core\L10n;
9 use Friendica\Model\Item;
10 use Friendica\Object\EMail;
11
12 /**
13  * Class for creating CC emails based on a received item
14  */
15 class ItemCCEMail extends EMail
16 {
17         public function __construct(App $a, L10n $l10n, BaseURL $baseUrl, array $item, string $toEmail, string $authorThumb)
18         {
19                 $disclaimer = '<hr />' . $l10n->t('This message was sent to you by %s, a member of the Friendica social network.', $a->user['username'])
20                               . '<br />';
21                 $disclaimer .= $l10n->t('You may visit them online at %s', $baseUrl . '/profile/' . $a->user['nickname']) . EOL;
22                 $disclaimer .= $l10n->t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
23                 if (!$item['title'] == '') {
24                         $subject = EMail::encodeHeader($item['title'], 'UTF-8');
25                 } else {
26                         $subject = Email::encodeHeader('[Friendica]' . ' ' . $l10n->t('%s posted an update.', $a->user['username']), 'UTF-8');
27                 }
28                 $link    = '<a href="' . $baseUrl . '/profile/' . $a->user['nickname'] . '"><img src="' . $authorThumb . '" alt="' . $a->user['username'] . '" /></a><br /><br />';
29                 $html    = Item::prepareBody($item);
30                 $message = '<html><body>' . $link . $html . $disclaimer . '</body></html>';;
31
32                 parent::__construct($a->user['username'], $a->user['email'], $a->user['email'], $toEmail,
33                         $subject, $message, HTML::toPlaintext($html . $disclaimer));
34         }
35 }