@@ -39,25 +39,25 @@ discard block |
||
| 39 | 39 | * @package OC\Mail |
| 40 | 40 | */ |
| 41 | 41 | class EMailTemplate implements IEMailTemplate { |
| 42 | - /** @var Defaults */ |
|
| 43 | - protected $themingDefaults; |
|
| 44 | - /** @var IURLGenerator */ |
|
| 45 | - protected $urlGenerator; |
|
| 46 | - /** @var IL10N */ |
|
| 47 | - protected $l10n; |
|
| 48 | - |
|
| 49 | - /** @var string */ |
|
| 50 | - protected $htmlBody = ''; |
|
| 51 | - /** @var string */ |
|
| 52 | - protected $plainBody = ''; |
|
| 53 | - /** @var bool indicated if the footer is added */ |
|
| 54 | - protected $headerAdded = false; |
|
| 55 | - /** @var bool indicated if the body is already opened */ |
|
| 56 | - protected $bodyOpened = false; |
|
| 57 | - /** @var bool indicated if the footer is added */ |
|
| 58 | - protected $footerAdded = false; |
|
| 59 | - |
|
| 60 | - protected $head = <<<EOF |
|
| 42 | + /** @var Defaults */ |
|
| 43 | + protected $themingDefaults; |
|
| 44 | + /** @var IURLGenerator */ |
|
| 45 | + protected $urlGenerator; |
|
| 46 | + /** @var IL10N */ |
|
| 47 | + protected $l10n; |
|
| 48 | + |
|
| 49 | + /** @var string */ |
|
| 50 | + protected $htmlBody = ''; |
|
| 51 | + /** @var string */ |
|
| 52 | + protected $plainBody = ''; |
|
| 53 | + /** @var bool indicated if the footer is added */ |
|
| 54 | + protected $headerAdded = false; |
|
| 55 | + /** @var bool indicated if the body is already opened */ |
|
| 56 | + protected $bodyOpened = false; |
|
| 57 | + /** @var bool indicated if the footer is added */ |
|
| 58 | + protected $footerAdded = false; |
|
| 59 | + |
|
| 60 | + protected $head = <<<EOF |
|
| 61 | 61 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 62 | 62 | <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" style="-webkit-font-smoothing:antialiased;background:#f3f3f3!important"> |
| 63 | 63 | <head> |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | <center data-parsed="" style="min-width:580px;width:100%"> |
| 76 | 76 | EOF; |
| 77 | 77 | |
| 78 | - protected $tail = <<<EOF |
|
| 78 | + protected $tail = <<<EOF |
|
| 79 | 79 | </center> |
| 80 | 80 | </td> |
| 81 | 81 | </tr> |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | </html> |
| 87 | 87 | EOF; |
| 88 | 88 | |
| 89 | - protected $header = <<<EOF |
|
| 89 | + protected $header = <<<EOF |
|
| 90 | 90 | <table align="center" class="wrapper header float-center" style="Margin:0 auto;background:#8a8a8a;background-color:%s;border-collapse:collapse;border-spacing:0;float:none;margin:0 auto;padding:0;text-align:center;vertical-align:top;width:100%%"> |
| 91 | 91 | <tr style="padding:0;text-align:left;vertical-align:top"> |
| 92 | 92 | <td class="wrapper-inner" style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#0a0a0a;font-family:Lucida Grande,Geneva,Verdana,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:1.3;margin:0;padding:20px;text-align:left;vertical-align:top;word-wrap:break-word"> |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | </table> |
| 120 | 120 | EOF; |
| 121 | 121 | |
| 122 | - protected $heading = <<<EOF |
|
| 122 | + protected $heading = <<<EOF |
|
| 123 | 123 | <table align="center" class="container main-heading float-center" style="Margin:0 auto;background:0 0!important;border-collapse:collapse;border-spacing:0;float:none;margin:0 auto;padding:0;text-align:center;vertical-align:top;width:580px"> |
| 124 | 124 | <tbody> |
| 125 | 125 | <tr style="padding:0;text-align:left;vertical-align:top"> |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | </table> |
| 139 | 139 | EOF; |
| 140 | 140 | |
| 141 | - protected $bodyBegin = <<<EOF |
|
| 141 | + protected $bodyBegin = <<<EOF |
|
| 142 | 142 | <table align="center" class="wrapper content float-center" style="Margin:0 auto;border-collapse:collapse;border-spacing:0;float:none;margin:0 auto;padding:0;text-align:center;vertical-align:top;width:100%"> |
| 143 | 143 | <tr style="padding:0;text-align:left;vertical-align:top"> |
| 144 | 144 | <td class="wrapper-inner" style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#0a0a0a;font-family:Lucida Grande,Geneva,Verdana,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"> |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | </table> |
| 156 | 156 | EOF; |
| 157 | 157 | |
| 158 | - protected $bodyText = <<<EOF |
|
| 158 | + protected $bodyText = <<<EOF |
|
| 159 | 159 | <table class="row description" style="border-collapse:collapse;border-spacing:0;display:table;padding:0;position:relative;text-align:left;vertical-align:top;width:100%%"> |
| 160 | 160 | <tbody> |
| 161 | 161 | <tr style="padding:0;text-align:left;vertical-align:top"> |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | </table> |
| 175 | 175 | EOF; |
| 176 | 176 | |
| 177 | - protected $buttonGroup = <<<EOF |
|
| 177 | + protected $buttonGroup = <<<EOF |
|
| 178 | 178 | <table class="spacer" style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%%"> |
| 179 | 179 | <tbody> |
| 180 | 180 | <tr style="padding:0;text-align:left;vertical-align:top"> |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | </table> |
| 228 | 228 | EOF; |
| 229 | 229 | |
| 230 | - protected $bodyEnd = <<<EOF |
|
| 230 | + protected $bodyEnd = <<<EOF |
|
| 231 | 231 | |
| 232 | 232 | </td> |
| 233 | 233 | </tr> |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | </table> |
| 239 | 239 | EOF; |
| 240 | 240 | |
| 241 | - protected $footer = <<<EOF |
|
| 241 | + protected $footer = <<<EOF |
|
| 242 | 242 | <table class="spacer float-center" style="Margin:0 auto;border-collapse:collapse;border-spacing:0;float:none;margin:0 auto;padding:0;text-align:center;vertical-align:top;width:100%%"> |
| 243 | 243 | <tbody> |
| 244 | 244 | <tr style="padding:0;text-align:left;vertical-align:top"> |
@@ -264,163 +264,163 @@ discard block |
||
| 264 | 264 | </table> |
| 265 | 265 | EOF; |
| 266 | 266 | |
| 267 | - /** |
|
| 268 | - * @param Defaults $themingDefaults |
|
| 269 | - * @param IURLGenerator $urlGenerator |
|
| 270 | - * @param IL10N $l10n |
|
| 271 | - */ |
|
| 272 | - public function __construct(Defaults $themingDefaults, |
|
| 273 | - IURLGenerator $urlGenerator, |
|
| 274 | - IL10N $l10n) { |
|
| 275 | - $this->themingDefaults = $themingDefaults; |
|
| 276 | - $this->urlGenerator = $urlGenerator; |
|
| 277 | - $this->l10n = $l10n; |
|
| 278 | - $this->htmlBody .= $this->head; |
|
| 279 | - } |
|
| 280 | - |
|
| 281 | - /** |
|
| 282 | - * Adds a header to the email |
|
| 283 | - */ |
|
| 284 | - public function addHeader() { |
|
| 285 | - if ($this->headerAdded) { |
|
| 286 | - return; |
|
| 287 | - } |
|
| 288 | - $this->headerAdded = true; |
|
| 289 | - |
|
| 290 | - $logoUrl = $this->urlGenerator->getAbsoluteURL($this->themingDefaults->getLogo()); |
|
| 291 | - $this->htmlBody .= vsprintf($this->header, [$this->themingDefaults->getColorPrimary(), $logoUrl]); |
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - /** |
|
| 295 | - * Adds a heading to the email |
|
| 296 | - * |
|
| 297 | - * @param string $title |
|
| 298 | - * @param string $plainTitle Title that is used in the plain text email - if empty the $title is used |
|
| 299 | - */ |
|
| 300 | - public function addHeading($title, $plainTitle = '') { |
|
| 301 | - if ($this->footerAdded) { |
|
| 302 | - return; |
|
| 303 | - } |
|
| 304 | - if ($plainTitle === '') { |
|
| 305 | - $plainTitle = $title; |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - $this->htmlBody .= vsprintf($this->heading, [$title]); |
|
| 309 | - $this->plainBody .= $plainTitle . PHP_EOL . PHP_EOL; |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - /** |
|
| 313 | - * Adds a paragraph to the body of the email |
|
| 314 | - * |
|
| 315 | - * @param string $text |
|
| 316 | - * @param string $plainText Text that is used in the plain text email - if empty the $text is used |
|
| 317 | - */ |
|
| 318 | - public function addBodyText($text, $plainText = '') { |
|
| 319 | - if ($this->footerAdded) { |
|
| 320 | - return; |
|
| 321 | - } |
|
| 322 | - if ($plainText === '') { |
|
| 323 | - $plainText = $text; |
|
| 324 | - } |
|
| 325 | - |
|
| 326 | - if (!$this->bodyOpened) { |
|
| 327 | - $this->htmlBody .= $this->bodyBegin; |
|
| 328 | - $this->bodyOpened = true; |
|
| 329 | - } |
|
| 330 | - |
|
| 331 | - $this->htmlBody .= vsprintf($this->bodyText, [$text]); |
|
| 332 | - $this->plainBody .= $plainText . PHP_EOL . PHP_EOL; |
|
| 333 | - } |
|
| 334 | - |
|
| 335 | - /** |
|
| 336 | - * Adds a button group of two buttons to the body of the email |
|
| 337 | - * |
|
| 338 | - * @param string $textLeft Text of left button |
|
| 339 | - * @param string $urlLeft URL of left button |
|
| 340 | - * @param string $textRight Text of right button |
|
| 341 | - * @param string $urlRight URL of right button |
|
| 342 | - * @param string $plainTextLeft Text of left button that is used in the plain text version - if unset the $textLeft is used |
|
| 343 | - * @param string $plainTextRight Text of right button that is used in the plain text version - if unset the $textRight is used |
|
| 344 | - */ |
|
| 345 | - public function addBodyButtonGroup($textLeft, $urlLeft, $textRight, $urlRight, $plainTextLeft = '', $plainTextRight = '') { |
|
| 346 | - if ($this->footerAdded) { |
|
| 347 | - return; |
|
| 348 | - } |
|
| 349 | - if ($plainTextLeft === '') { |
|
| 350 | - $plainTextLeft = $textLeft; |
|
| 351 | - } |
|
| 352 | - |
|
| 353 | - if ($plainTextRight === '') { |
|
| 354 | - $plainTextRight = $textRight; |
|
| 355 | - } |
|
| 356 | - |
|
| 357 | - if (!$this->bodyOpened) { |
|
| 358 | - $this->htmlBody .= $this->bodyBegin; |
|
| 359 | - $this->bodyOpened = true; |
|
| 360 | - } |
|
| 361 | - |
|
| 362 | - $color = $this->themingDefaults->getColorPrimary(); |
|
| 363 | - $this->htmlBody .= vsprintf($this->buttonGroup, [$color, $color, $urlLeft, $color, $textLeft, $urlRight, $textRight]); |
|
| 364 | - $this->plainBody .= $plainTextLeft . ': ' . $urlLeft . PHP_EOL; |
|
| 365 | - $this->plainBody .= $plainTextRight . ': ' . $urlRight . PHP_EOL . PHP_EOL; |
|
| 366 | - |
|
| 367 | - } |
|
| 368 | - |
|
| 369 | - /** |
|
| 370 | - * Adds a logo and a text to the footer. <br> in the text will be replaced by new lines in the plain text email |
|
| 371 | - * |
|
| 372 | - * @param string $text |
|
| 373 | - */ |
|
| 374 | - public function addFooter($text = '') { |
|
| 375 | - if($text === '') { |
|
| 376 | - $text = $this->themingDefaults->getName() . ' - ' . $this->themingDefaults->getSlogan() . '<br>' . $this->l10n->t('This is an automatically generated email, please do not reply.'); |
|
| 377 | - } |
|
| 378 | - |
|
| 379 | - if ($this->footerAdded) { |
|
| 380 | - return; |
|
| 381 | - } |
|
| 382 | - $this->footerAdded = true; |
|
| 383 | - |
|
| 384 | - if ($this->bodyOpened) { |
|
| 385 | - $this->htmlBody .= $this->bodyEnd; |
|
| 386 | - $this->bodyOpened = false; |
|
| 387 | - } |
|
| 388 | - |
|
| 389 | - $this->htmlBody .= vsprintf($this->footer, [$text]); |
|
| 390 | - $this->htmlBody .= $this->tail; |
|
| 391 | - $this->plainBody .= '--' . PHP_EOL; |
|
| 392 | - $this->plainBody .= str_replace('<br>', PHP_EOL, $text); |
|
| 393 | - } |
|
| 394 | - |
|
| 395 | - /** |
|
| 396 | - * Returns the rendered HTML email as string |
|
| 397 | - * |
|
| 398 | - * @return string |
|
| 399 | - */ |
|
| 400 | - public function renderHTML() { |
|
| 401 | - if (!$this->footerAdded) { |
|
| 402 | - $this->footerAdded = true; |
|
| 403 | - if ($this->bodyOpened) { |
|
| 404 | - $this->htmlBody .= $this->bodyEnd; |
|
| 405 | - } |
|
| 406 | - $this->htmlBody .= $this->tail; |
|
| 407 | - } |
|
| 408 | - return $this->htmlBody; |
|
| 409 | - } |
|
| 410 | - |
|
| 411 | - /** |
|
| 412 | - * Returns the rendered plain text email as string |
|
| 413 | - * |
|
| 414 | - * @return string |
|
| 415 | - */ |
|
| 416 | - public function renderText() { |
|
| 417 | - if (!$this->footerAdded) { |
|
| 418 | - $this->footerAdded = true; |
|
| 419 | - if ($this->bodyOpened) { |
|
| 420 | - $this->htmlBody .= $this->bodyEnd; |
|
| 421 | - } |
|
| 422 | - $this->htmlBody .= $this->tail; |
|
| 423 | - } |
|
| 424 | - return $this->plainBody; |
|
| 425 | - } |
|
| 267 | + /** |
|
| 268 | + * @param Defaults $themingDefaults |
|
| 269 | + * @param IURLGenerator $urlGenerator |
|
| 270 | + * @param IL10N $l10n |
|
| 271 | + */ |
|
| 272 | + public function __construct(Defaults $themingDefaults, |
|
| 273 | + IURLGenerator $urlGenerator, |
|
| 274 | + IL10N $l10n) { |
|
| 275 | + $this->themingDefaults = $themingDefaults; |
|
| 276 | + $this->urlGenerator = $urlGenerator; |
|
| 277 | + $this->l10n = $l10n; |
|
| 278 | + $this->htmlBody .= $this->head; |
|
| 279 | + } |
|
| 280 | + |
|
| 281 | + /** |
|
| 282 | + * Adds a header to the email |
|
| 283 | + */ |
|
| 284 | + public function addHeader() { |
|
| 285 | + if ($this->headerAdded) { |
|
| 286 | + return; |
|
| 287 | + } |
|
| 288 | + $this->headerAdded = true; |
|
| 289 | + |
|
| 290 | + $logoUrl = $this->urlGenerator->getAbsoluteURL($this->themingDefaults->getLogo()); |
|
| 291 | + $this->htmlBody .= vsprintf($this->header, [$this->themingDefaults->getColorPrimary(), $logoUrl]); |
|
| 292 | + } |
|
| 293 | + |
|
| 294 | + /** |
|
| 295 | + * Adds a heading to the email |
|
| 296 | + * |
|
| 297 | + * @param string $title |
|
| 298 | + * @param string $plainTitle Title that is used in the plain text email - if empty the $title is used |
|
| 299 | + */ |
|
| 300 | + public function addHeading($title, $plainTitle = '') { |
|
| 301 | + if ($this->footerAdded) { |
|
| 302 | + return; |
|
| 303 | + } |
|
| 304 | + if ($plainTitle === '') { |
|
| 305 | + $plainTitle = $title; |
|
| 306 | + } |
|
| 307 | + |
|
| 308 | + $this->htmlBody .= vsprintf($this->heading, [$title]); |
|
| 309 | + $this->plainBody .= $plainTitle . PHP_EOL . PHP_EOL; |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + /** |
|
| 313 | + * Adds a paragraph to the body of the email |
|
| 314 | + * |
|
| 315 | + * @param string $text |
|
| 316 | + * @param string $plainText Text that is used in the plain text email - if empty the $text is used |
|
| 317 | + */ |
|
| 318 | + public function addBodyText($text, $plainText = '') { |
|
| 319 | + if ($this->footerAdded) { |
|
| 320 | + return; |
|
| 321 | + } |
|
| 322 | + if ($plainText === '') { |
|
| 323 | + $plainText = $text; |
|
| 324 | + } |
|
| 325 | + |
|
| 326 | + if (!$this->bodyOpened) { |
|
| 327 | + $this->htmlBody .= $this->bodyBegin; |
|
| 328 | + $this->bodyOpened = true; |
|
| 329 | + } |
|
| 330 | + |
|
| 331 | + $this->htmlBody .= vsprintf($this->bodyText, [$text]); |
|
| 332 | + $this->plainBody .= $plainText . PHP_EOL . PHP_EOL; |
|
| 333 | + } |
|
| 334 | + |
|
| 335 | + /** |
|
| 336 | + * Adds a button group of two buttons to the body of the email |
|
| 337 | + * |
|
| 338 | + * @param string $textLeft Text of left button |
|
| 339 | + * @param string $urlLeft URL of left button |
|
| 340 | + * @param string $textRight Text of right button |
|
| 341 | + * @param string $urlRight URL of right button |
|
| 342 | + * @param string $plainTextLeft Text of left button that is used in the plain text version - if unset the $textLeft is used |
|
| 343 | + * @param string $plainTextRight Text of right button that is used in the plain text version - if unset the $textRight is used |
|
| 344 | + */ |
|
| 345 | + public function addBodyButtonGroup($textLeft, $urlLeft, $textRight, $urlRight, $plainTextLeft = '', $plainTextRight = '') { |
|
| 346 | + if ($this->footerAdded) { |
|
| 347 | + return; |
|
| 348 | + } |
|
| 349 | + if ($plainTextLeft === '') { |
|
| 350 | + $plainTextLeft = $textLeft; |
|
| 351 | + } |
|
| 352 | + |
|
| 353 | + if ($plainTextRight === '') { |
|
| 354 | + $plainTextRight = $textRight; |
|
| 355 | + } |
|
| 356 | + |
|
| 357 | + if (!$this->bodyOpened) { |
|
| 358 | + $this->htmlBody .= $this->bodyBegin; |
|
| 359 | + $this->bodyOpened = true; |
|
| 360 | + } |
|
| 361 | + |
|
| 362 | + $color = $this->themingDefaults->getColorPrimary(); |
|
| 363 | + $this->htmlBody .= vsprintf($this->buttonGroup, [$color, $color, $urlLeft, $color, $textLeft, $urlRight, $textRight]); |
|
| 364 | + $this->plainBody .= $plainTextLeft . ': ' . $urlLeft . PHP_EOL; |
|
| 365 | + $this->plainBody .= $plainTextRight . ': ' . $urlRight . PHP_EOL . PHP_EOL; |
|
| 366 | + |
|
| 367 | + } |
|
| 368 | + |
|
| 369 | + /** |
|
| 370 | + * Adds a logo and a text to the footer. <br> in the text will be replaced by new lines in the plain text email |
|
| 371 | + * |
|
| 372 | + * @param string $text |
|
| 373 | + */ |
|
| 374 | + public function addFooter($text = '') { |
|
| 375 | + if($text === '') { |
|
| 376 | + $text = $this->themingDefaults->getName() . ' - ' . $this->themingDefaults->getSlogan() . '<br>' . $this->l10n->t('This is an automatically generated email, please do not reply.'); |
|
| 377 | + } |
|
| 378 | + |
|
| 379 | + if ($this->footerAdded) { |
|
| 380 | + return; |
|
| 381 | + } |
|
| 382 | + $this->footerAdded = true; |
|
| 383 | + |
|
| 384 | + if ($this->bodyOpened) { |
|
| 385 | + $this->htmlBody .= $this->bodyEnd; |
|
| 386 | + $this->bodyOpened = false; |
|
| 387 | + } |
|
| 388 | + |
|
| 389 | + $this->htmlBody .= vsprintf($this->footer, [$text]); |
|
| 390 | + $this->htmlBody .= $this->tail; |
|
| 391 | + $this->plainBody .= '--' . PHP_EOL; |
|
| 392 | + $this->plainBody .= str_replace('<br>', PHP_EOL, $text); |
|
| 393 | + } |
|
| 394 | + |
|
| 395 | + /** |
|
| 396 | + * Returns the rendered HTML email as string |
|
| 397 | + * |
|
| 398 | + * @return string |
|
| 399 | + */ |
|
| 400 | + public function renderHTML() { |
|
| 401 | + if (!$this->footerAdded) { |
|
| 402 | + $this->footerAdded = true; |
|
| 403 | + if ($this->bodyOpened) { |
|
| 404 | + $this->htmlBody .= $this->bodyEnd; |
|
| 405 | + } |
|
| 406 | + $this->htmlBody .= $this->tail; |
|
| 407 | + } |
|
| 408 | + return $this->htmlBody; |
|
| 409 | + } |
|
| 410 | + |
|
| 411 | + /** |
|
| 412 | + * Returns the rendered plain text email as string |
|
| 413 | + * |
|
| 414 | + * @return string |
|
| 415 | + */ |
|
| 416 | + public function renderText() { |
|
| 417 | + if (!$this->footerAdded) { |
|
| 418 | + $this->footerAdded = true; |
|
| 419 | + if ($this->bodyOpened) { |
|
| 420 | + $this->htmlBody .= $this->bodyEnd; |
|
| 421 | + } |
|
| 422 | + $this->htmlBody .= $this->tail; |
|
| 423 | + } |
|
| 424 | + return $this->plainBody; |
|
| 425 | + } |
|
| 426 | 426 | } |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | $this->htmlBody .= vsprintf($this->heading, [$title]); |
| 309 | - $this->plainBody .= $plainTitle . PHP_EOL . PHP_EOL; |
|
| 309 | + $this->plainBody .= $plainTitle.PHP_EOL.PHP_EOL; |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | /** |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | $this->htmlBody .= vsprintf($this->bodyText, [$text]); |
| 332 | - $this->plainBody .= $plainText . PHP_EOL . PHP_EOL; |
|
| 332 | + $this->plainBody .= $plainText.PHP_EOL.PHP_EOL; |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | /** |
@@ -361,8 +361,8 @@ discard block |
||
| 361 | 361 | |
| 362 | 362 | $color = $this->themingDefaults->getColorPrimary(); |
| 363 | 363 | $this->htmlBody .= vsprintf($this->buttonGroup, [$color, $color, $urlLeft, $color, $textLeft, $urlRight, $textRight]); |
| 364 | - $this->plainBody .= $plainTextLeft . ': ' . $urlLeft . PHP_EOL; |
|
| 365 | - $this->plainBody .= $plainTextRight . ': ' . $urlRight . PHP_EOL . PHP_EOL; |
|
| 364 | + $this->plainBody .= $plainTextLeft.': '.$urlLeft.PHP_EOL; |
|
| 365 | + $this->plainBody .= $plainTextRight.': '.$urlRight.PHP_EOL.PHP_EOL; |
|
| 366 | 366 | |
| 367 | 367 | } |
| 368 | 368 | |
@@ -372,8 +372,8 @@ discard block |
||
| 372 | 372 | * @param string $text |
| 373 | 373 | */ |
| 374 | 374 | public function addFooter($text = '') { |
| 375 | - if($text === '') { |
|
| 376 | - $text = $this->themingDefaults->getName() . ' - ' . $this->themingDefaults->getSlogan() . '<br>' . $this->l10n->t('This is an automatically generated email, please do not reply.'); |
|
| 375 | + if ($text === '') { |
|
| 376 | + $text = $this->themingDefaults->getName().' - '.$this->themingDefaults->getSlogan().'<br>'.$this->l10n->t('This is an automatically generated email, please do not reply.'); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | if ($this->footerAdded) { |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | $this->htmlBody .= vsprintf($this->footer, [$text]); |
| 390 | 390 | $this->htmlBody .= $this->tail; |
| 391 | - $this->plainBody .= '--' . PHP_EOL; |
|
| 391 | + $this->plainBody .= '--'.PHP_EOL; |
|
| 392 | 392 | $this->plainBody .= str_replace('<br>', PHP_EOL, $text); |
| 393 | 393 | } |
| 394 | 394 | |
@@ -51,71 +51,71 @@ |
||
| 51 | 51 | * @since 12.0.0 |
| 52 | 52 | */ |
| 53 | 53 | interface IEMailTemplate { |
| 54 | - /** |
|
| 55 | - * Adds a header to the email |
|
| 56 | - * |
|
| 57 | - * @since 12.0.0 |
|
| 58 | - */ |
|
| 59 | - public function addHeader(); |
|
| 54 | + /** |
|
| 55 | + * Adds a header to the email |
|
| 56 | + * |
|
| 57 | + * @since 12.0.0 |
|
| 58 | + */ |
|
| 59 | + public function addHeader(); |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Adds a heading to the email |
|
| 63 | - * |
|
| 64 | - * @param string $title |
|
| 65 | - * @param string $plainTitle Title that is used in the plain text email - if empty the $title is used |
|
| 66 | - * |
|
| 67 | - * @since 12.0.0 |
|
| 68 | - */ |
|
| 69 | - public function addHeading($title, $plainTitle = ''); |
|
| 61 | + /** |
|
| 62 | + * Adds a heading to the email |
|
| 63 | + * |
|
| 64 | + * @param string $title |
|
| 65 | + * @param string $plainTitle Title that is used in the plain text email - if empty the $title is used |
|
| 66 | + * |
|
| 67 | + * @since 12.0.0 |
|
| 68 | + */ |
|
| 69 | + public function addHeading($title, $plainTitle = ''); |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Adds a paragraph to the body of the email |
|
| 73 | - * |
|
| 74 | - * @param string $text |
|
| 75 | - * @param string $plainText Text that is used in the plain text email - if empty the $text is used |
|
| 76 | - * |
|
| 77 | - * @since 12.0.0 |
|
| 78 | - */ |
|
| 79 | - public function addBodyText($text, $plainText = ''); |
|
| 71 | + /** |
|
| 72 | + * Adds a paragraph to the body of the email |
|
| 73 | + * |
|
| 74 | + * @param string $text |
|
| 75 | + * @param string $plainText Text that is used in the plain text email - if empty the $text is used |
|
| 76 | + * |
|
| 77 | + * @since 12.0.0 |
|
| 78 | + */ |
|
| 79 | + public function addBodyText($text, $plainText = ''); |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Adds a button group of two buttons to the body of the email |
|
| 83 | - * |
|
| 84 | - * @param string $textLeft Text of left button |
|
| 85 | - * @param string $urlLeft URL of left button |
|
| 86 | - * @param string $textRight Text of right button |
|
| 87 | - * @param string $urlRight URL of right button |
|
| 88 | - * @param string $plainTextLeft Text of left button that is used in the plain text version - if empty the $textLeft is used |
|
| 89 | - * @param string $plainTextRight Text of right button that is used in the plain text version - if empty the $textRight is used |
|
| 90 | - * |
|
| 91 | - * @since 12.0.0 |
|
| 92 | - */ |
|
| 93 | - public function addBodyButtonGroup($textLeft, $urlLeft, $textRight, $urlRight, $plainTextLeft = '', $plainTextRight = ''); |
|
| 81 | + /** |
|
| 82 | + * Adds a button group of two buttons to the body of the email |
|
| 83 | + * |
|
| 84 | + * @param string $textLeft Text of left button |
|
| 85 | + * @param string $urlLeft URL of left button |
|
| 86 | + * @param string $textRight Text of right button |
|
| 87 | + * @param string $urlRight URL of right button |
|
| 88 | + * @param string $plainTextLeft Text of left button that is used in the plain text version - if empty the $textLeft is used |
|
| 89 | + * @param string $plainTextRight Text of right button that is used in the plain text version - if empty the $textRight is used |
|
| 90 | + * |
|
| 91 | + * @since 12.0.0 |
|
| 92 | + */ |
|
| 93 | + public function addBodyButtonGroup($textLeft, $urlLeft, $textRight, $urlRight, $plainTextLeft = '', $plainTextRight = ''); |
|
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * Adds a logo and a text to the footer. <br> in the text will be replaced by new lines in the plain text email |
|
| 97 | - * |
|
| 98 | - * @param string $text |
|
| 99 | - * |
|
| 100 | - * @since 12.0.0 |
|
| 101 | - */ |
|
| 102 | - public function addFooter($text = ''); |
|
| 95 | + /** |
|
| 96 | + * Adds a logo and a text to the footer. <br> in the text will be replaced by new lines in the plain text email |
|
| 97 | + * |
|
| 98 | + * @param string $text |
|
| 99 | + * |
|
| 100 | + * @since 12.0.0 |
|
| 101 | + */ |
|
| 102 | + public function addFooter($text = ''); |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * Returns the rendered HTML email as string |
|
| 106 | - * |
|
| 107 | - * @return string |
|
| 108 | - * |
|
| 109 | - * @since 12.0.0 |
|
| 110 | - */ |
|
| 111 | - public function renderHTML(); |
|
| 104 | + /** |
|
| 105 | + * Returns the rendered HTML email as string |
|
| 106 | + * |
|
| 107 | + * @return string |
|
| 108 | + * |
|
| 109 | + * @since 12.0.0 |
|
| 110 | + */ |
|
| 111 | + public function renderHTML(); |
|
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * Returns the rendered plain text email as string |
|
| 115 | - * |
|
| 116 | - * @return string |
|
| 117 | - * |
|
| 118 | - * @since 12.0.0 |
|
| 119 | - */ |
|
| 120 | - public function renderText(); |
|
| 113 | + /** |
|
| 114 | + * Returns the rendered plain text email as string |
|
| 115 | + * |
|
| 116 | + * @return string |
|
| 117 | + * |
|
| 118 | + * @since 12.0.0 |
|
| 119 | + */ |
|
| 120 | + public function renderText(); |
|
| 121 | 121 | } |