diff options
author | Joas Schilling <coding@schilljs.com> | 2017-04-25 14:31:21 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-04-25 14:31:21 +0200 |
commit | f1ffb728b9908e4981e6d7cf0fc7b4742ffbd880 (patch) | |
tree | 5cc4682177909e5647963e27a59d8b73cb76e03e /lib | |
parent | 35414884d37f8dd4b589980956f92fd2c7f99474 (diff) | |
download | nextcloud-server-f1ffb728b9908e4981e6d7cf0fc7b4742ffbd880.tar.gz nextcloud-server-f1ffb728b9908e4981e6d7cf0fc7b4742ffbd880.zip |
Allow meta info and icons
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Mail/EMailTemplate.php | 32 | ||||
-rw-r--r-- | lib/public/Mail/IEMailTemplate.php | 8 |
2 files changed, 32 insertions, 8 deletions
diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php index fa76a215465..3442e8e9430 100644 --- a/lib/private/Mail/EMailTemplate.php +++ b/lib/private/Mail/EMailTemplate.php @@ -187,10 +187,10 @@ EOF; protected $listItem = <<<EOF <tr style="padding:0;text-align:left;vertical-align:top"> <td style="Margin:0;color:#0a0a0a;font-family:Lucida Grande,Geneva,Verdana,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left;width:15px;"> - <p class="text-left" style="Margin:0;Margin-bottom:10px;color:#777;font-family:Lucida Grande,Geneva,Verdana,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;margin-bottom:10px;padding:0;padding-left:10px;text-align:left">•</p> + <p class="text-left" style="Margin:0;Margin-bottom:10px;color:#777;font-family:Lucida Grande,Geneva,Verdana,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;margin-bottom:10px;padding:0;padding-left:10px;text-align:left">%s</p> </td> <td style="Margin:0;color:#0a0a0a;font-family:Lucida Grande,Geneva,Verdana,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left"> - <p class="text-left" style="Margin:0;Margin-bottom:10px;color:#777;font-family:Lucida Grande,Geneva,Verdana,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;margin-bottom:10px;padding:0;padding-left:10px;text-align:left">%s</p> + <p class="text-left" style="Margin:0;Margin-bottom:10px;color:#555;font-family:Lucida Grande,Geneva,Verdana,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;margin-bottom:10px;padding:0;padding-left:10px;text-align:left">%s</p> </td> <td class="expander" style="Margin:0;color:#0a0a0a;font-family:Lucida Grande,Geneva,Verdana,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0!important;text-align:left;visibility:hidden;width:0"></td> </tr> @@ -421,20 +421,40 @@ EOF; * Adds a list item to the body of the email * * @param string $text + * @param string $metaInfo + * @param string $icon Absolute path, must be 16*16 pixels * @param string $plainText Text that is used in the plain text email - * if empty the $text is used + * if empty the $text is used, if false none will be used + * @param string $plainMetaInfo Meta info that is used in the plain text email + * if empty the $metaInfo is used, if false none will be used * @since 12.0.0 */ - public function addBodyListItem($text, $plainText = '') { + public function addBodyListItem($text, $metaInfo = '', $icon = '', $plainText = '', $plainMetaInfo = '') { $this->ensureBodyListOpened(); if ($plainText === '') { $plainText = $text; } + if ($plainMetaInfo === '') { + $plainMetaInfo = $metaInfo; + } - $this->htmlBody .= vsprintf($this->listItem, [htmlspecialchars($text)]); + $htmlText = htmlspecialchars($text); + if ($metaInfo) { + $htmlText = '<em style="color:#777;">' . htmlspecialchars($metaInfo) . '</em><br>' . $htmlText; + } + if ($icon !== '') { + $icon = '<img src="' . htmlspecialchars($icon) . '" alt="•">'; + } else { + $icon = '•'; + } + $this->htmlBody .= vsprintf($this->listItem, [$icon, $htmlText]); if ($plainText !== false) { - $this->plainBody .= ' * ' . $plainText . PHP_EOL; + $this->plainBody .= ' * ' . $plainText; + if ($plainMetaInfo !== false) { + $this->plainBody .= ' (' . $plainMetaInfo . ')'; + } + $this->plainBody .= PHP_EOL; } } diff --git a/lib/public/Mail/IEMailTemplate.php b/lib/public/Mail/IEMailTemplate.php index d4010618b10..6df83b4d10e 100644 --- a/lib/public/Mail/IEMailTemplate.php +++ b/lib/public/Mail/IEMailTemplate.php @@ -84,11 +84,15 @@ interface IEMailTemplate { * Adds a list item to the body of the email * * @param string $text + * @param string $metaInfo + * @param string $icon Absolute path, must be 16*16 pixels * @param string $plainText Text that is used in the plain text email - * if empty the $text is used + * if empty the $text is used, if false none will be used + * @param string $plainMetaInfo Meta info that is used in the plain text email + * if empty the $metaInfo is used, if false none will be used * @since 12.0.0 */ - public function addBodyListItem($text, $plainText = ''); + public function addBodyListItem($text, $metaInfo = '', $icon = '', $plainText = '', $plainMetaInfo = ''); /** * Adds a button group of two buttons to the body of the email |