--- /dev/null
+{assign var='count' value=$event->getAuthors()|count}{assign var='guestTimesTriggered' value=$event->getNotification()->guestTimesTriggered}{assign var='authors' value=$event->getAuthors()|array_values}
+{if $mimeType === 'text/plain'}
+{capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.plaintext{/lang}{/capture}
+{lang}{@$languageVariablePrefix}.mail.plaintext{/lang}{if $count == 1 && !$guestTimesTriggered}
+
+{@$event->getUserNotificationObject()->getMailText($mimeType)}{/if} {* this line ends with a space *}
+{else}
+ {capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.html{/lang}{/capture}
+ {lang}{@$languageVariablePrefix}.mail.html{/lang}
+ {assign var='user' value=$event->getAuthor()}
+ {assign var='comment' value=$event->getUserNotificationObject()}
+
+ {if $notificationType == 'instant'}{assign var='avatarSize' value=48}
+ {else}{assign var='avatarSize' value=32}{/if}
+ {capture assign='commentContent'}
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$comment->username}">{@$user->getAvatar()->getImageTag($avatarSize)}</a></td>
+ <td class="boxContent">
+ <div class="containerHeadline">
+ <h3>
+ {if $comment->userID}
+ <a href="{link controller='User' object=$user isEmail=true}{/link}">{$comment->username}</a>
+ {else}
+ {$comment->username}
+ {/if}
+ ·
+ <small>{$comment->time|plainTime}</small>
+ </h3>
+ </div>
+ <div>
+ {@$comment->getMailText($mimeType)}
+ </div>
+ </td>
+ </tr>
+ </table>
+ {/capture}
+ {include file='email_paddingHelper' block=true class='box'|concat:$avatarSize content=$commentContent sandbox=true}
+{/if}
--- /dev/null
+{assign var='count' value=$event->getAuthors()|count}{assign var='guestTimesTriggered' value=$event->getNotification()->guestTimesTriggered}{assign var='authors' value=$event->getAuthors()|array_values}
+{if $mimeType === 'text/plain'}
+{capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.plaintext{/lang}{/capture}
+{lang}{@$languageVariablePrefix}.mail.plaintext{/lang}{if $count == 1 && !$guestTimesTriggered}
+
+{$event->getUserNotificationObject()->message}{/if} {* this line ends with a space *}
+{else}
+ {capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.html{/lang}{/capture}
+ {lang}{@$languageVariablePrefix}.mail.html{/lang}
+ {assign var='user' value=$event->getAuthor()}
+ {assign var='comment' value=$event->getUserNotificationObject()}
+
+ {if $notificationType == 'instant'}{assign var='avatarSize' value=48}
+ {else}{assign var='avatarSize' value=32}{/if}
+ {capture assign='commentContent'}
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$comment->username}">{@$user->getAvatar()->getImageTag($avatarSize)}</a></td>
+ <td class="boxContent">
+ <div class="containerHeadline">
+ <h3>
+ {if $comment->userID}
+ <a href="{link controller='User' object=$user isEmail=true}{/link}">{$comment->username}</a>
+ {else}
+ {$comment->username}
+ {/if}
+ ·
+ <small>{$comment->time|plainTime}</small>
+ </h3>
+ </div>
+ <div>
+ {$comment->message}
+ </div>
+ </td>
+ </tr>
+ </table>
+ {/capture}
+ {include file='email_paddingHelper' block=true class='box'|concat:$avatarSize content=$commentContent sandbox=true}
+{/if}
--- /dev/null
+{assign var='count' value=$event->getAuthors()|count}{assign var='guestTimesTriggered' value=$event->getNotification()->guestTimesTriggered}{assign var='authors' value=$event->getAuthors()|array_values}
+{if $mimeType === 'text/plain'}
+{capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.plaintext{/lang}{/capture}
+{lang}{@$languageVariablePrefix}.mail.plaintext{/lang}{if $count == 1 && !$guestTimesTriggered}
+
+{$event->getUserNotificationObject()->message}{/if} {* this line ends with a space *}
+{else}
+ {capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.html{/lang}{/capture}
+ {lang}{@$languageVariablePrefix}.mail.html{/lang}
+ {assign var='user' value=$event->getAuthor()}
+ {assign var='comment' value=$event->getUserNotificationObject()}
+
+ {if $notificationType == 'instant'}{assign var='avatarSize' value=48}
+ {else}{assign var='avatarSize' value=32}{/if}
+ {capture assign='commentContent'}
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$comment->username}">{@$user->getAvatar()->getImageTag($avatarSize)}</a></td>
+ <td class="boxContent">
+ <div class="containerHeadline">
+ <h3>
+ {if $comment->userID}
+ <a href="{link controller='User' object=$user isEmail=true}{/link}">{$comment->username}</a>
+ {else}
+ {$comment->username}
+ {/if}
+ ·
+ <small>{$comment->time|plainTime}</small>
+ </h3>
+ </div>
+ <div>
+ {$comment->message}
+ </div>
+ </td>
+ </tr>
+ </table>
+ {/capture}
+ {include file='email_paddingHelper' block=true class='box'|concat:$avatarSize content=$commentContent sandbox=true}
+{/if}
+++ /dev/null
-{assign var='count' value=$event->getAuthors()|count}{assign var='guestTimesTriggered' value=$event->getNotification()->guestTimesTriggered}{assign var='authors' value=$event->getAuthors()|array_values}
-{if $mimeType === 'text/plain'}
-{capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.plaintext{/lang}{/capture}
-{lang}wcf.user.notification.comment.mail.plaintext{/lang}{if $count == 1 && !$guestTimesTriggered}
-
-{$event->getUserNotificationObject()->message}{/if} {* this line ends with a space *}
-{else}
- {capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.html{/lang}{/capture}
- {lang}wcf.user.notification.comment.mail.html{/lang}
- {assign var='user' value=$event->getAuthor()}
- {assign var='comment' value=$event->getUserNotificationObject()}
-
- {if $notificationType == 'instant'}{assign var='avatarSize' value=48}
- {else}{assign var='avatarSize' value=32}{/if}
- {capture assign='commentContent'}
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$comment->username}">{@$user->getAvatar()->getImageTag($avatarSize)}</a></td>
- <td class="boxContent">
- <div class="containerHeadline">
- <h3>
- {if $comment->userID}
- <a href="{link controller='User' object=$user isEmail=true}{/link}">{$comment->username}</a>
- {else}
- {$comment->username}
- {/if}
- ·
- <small>{$comment->time|plainTime}</small>
- </h3>
- </div>
- <div>
- {$comment->message}
- </div>
- </td>
- </tr>
- </table>
- {/capture}
- {include file='email_paddingHelper' block=true class='box'|concat:$avatarSize content=$commentContent sandbox=true}
-{/if}
+++ /dev/null
-{assign var='count' value=$event->getAuthors()|count}{assign var='guestTimesTriggered' value=$event->getNotification()->guestTimesTriggered}{assign var='authors' value=$event->getAuthors()|array_values}
-{if $mimeType === 'text/plain'}
-{capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.plaintext{/lang}{/capture}
-{lang}wcf.user.notification.commentResponse.mail.plaintext{/lang}{if $count == 1 && !$guestTimesTriggered}
-
-{$event->getUserNotificationObject()->message}{/if} {* this line ends with a space *}
-{else}
- {capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.html{/lang}{/capture}
- {lang}wcf.user.notification.commentResponse.mail.html{/lang}
- {assign var='user' value=$event->getAuthor()}
- {assign var='comment' value=$event->getUserNotificationObject()}
-
- {if $notificationType == 'instant'}{assign var='avatarSize' value=48}
- {else}{assign var='avatarSize' value=32}{/if}
- {capture assign='commentContent'}
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$comment->username}">{@$user->getAvatar()->getImageTag($avatarSize)}</a></td>
- <td class="boxContent">
- <div class="containerHeadline">
- <h3>
- {if $comment->userID}
- <a href="{link controller='User' object=$user isEmail=true}{/link}">{$comment->username}</a>
- {else}
- {$comment->username}
- {/if}
- ·
- <small>{$comment->time|plainTime}</small>
- </h3>
- </div>
- <div>
- {$comment->message}
- </div>
- </td>
- </tr>
- </table>
- {/capture}
- {include file='email_paddingHelper' block=true class='box'|concat:$avatarSize content=$commentContent sandbox=true}
-{/if}
+++ /dev/null
-{assign var='count' value=$event->getAuthors()|count}{assign var='guestTimesTriggered' value=$event->getNotification()->guestTimesTriggered}{assign var='authors' value=$event->getAuthors()|array_values}
-{if $mimeType === 'text/plain'}
-{capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.plaintext{/lang}{/capture}
-{lang}wcf.user.notification.commentResponseOwner.mail.plaintext{/lang}{if $count == 1 && !$guestTimesTriggered}
-
-{$event->getUserNotificationObject()->message}{/if} {* this line ends with a space *}
-{else}
- {capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.html{/lang}{/capture}
- {lang}wcf.user.notification.commentResponseOwner.mail.html{/lang}
- {assign var='user' value=$event->getAuthor()}
- {assign var='comment' value=$event->getUserNotificationObject()}
-
- {if $notificationType == 'instant'}{assign var='avatarSize' value=48}
- {else}{assign var='avatarSize' value=32}{/if}
- {capture assign='commentContent'}
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$comment->username}">{@$user->getAvatar()->getImageTag($avatarSize)}</a></td>
- <td class="boxContent">
- <div class="containerHeadline">
- <h3>
- {if $comment->userID}
- <a href="{link controller='User' object=$user isEmail=true}{/link}">{$comment->username}</a>
- {else}
- {$comment->username}
- {/if}
- ·
- <small>{$comment->time|plainTime}</small>
- </h3>
- </div>
- <div>
- {$comment->message}
- </div>
- </td>
- </tr>
- </table>
- {/capture}
- {include file='email_paddingHelper' block=true class='box'|concat:$avatarSize content=$commentContent sandbox=true}
-{/if}
return $processor->getHtml();
}
+ /**
+ * Returns a version of this message optimized for use in emails.
+ *
+ * @param string $mimeType Either 'text/plain' or 'text/html'
+ * @return string
+ */
+ public function getMailText($mimeType = 'text/plain') {
+ switch ($mimeType) {
+ case 'text/plain':
+ $processor = new HtmlOutputProcessor();
+ $processor->setOutputType('text/plain');
+ $processor->process($this->message, 'com.woltlab.wcf.comment', $this->commentID);
+
+ return $processor->getHtml();
+ case 'text/html':
+ return $this->getSimplifiedFormattedMessage();
+ }
+
+ throw new \LogicException('Unreachable');
+ }
+
/**
* @inheritDoc
*/
$messageID = '<com.woltlab.wcf.user.profileComment.notification/'.$comment->commentID.'@'.Email::getHost().'>';
return [
- 'template' => 'email_notification_userProfileCommentResponseOwner',
+ 'template' => 'email_notification_commentResponseOwner',
'application' => 'wcf',
'in-reply-to' => [$messageID],
'references' => [$messageID],
'commentAuthor' => $commentAuthor,
'commentID' => $this->getUserNotificationObject()->commentID,
'owner' => $owner,
- 'responseID' => $this->getUserNotificationObject()->responseID
+ 'responseID' => $this->getUserNotificationObject()->responseID,
+ 'languageVariablePrefix' => 'wcf.user.notification.commentResponseOwner'
]
];
}
$messageID = '<com.woltlab.wcf.user.profileComment.notification/'.$comment->commentID.'@'.Email::getHost().'>';
return [
- 'template' => 'email_notification_userProfileCommentResponse',
+ 'template' => 'email_notification_commentResponse',
'application' => 'wcf',
'in-reply-to' => [$messageID],
'references' => [$messageID],
'variables' => [
'commentID' => $this->getUserNotificationObject()->commentID,
'owner' => $owner,
- 'responseID' => $this->getUserNotificationObject()->responseID
+ 'responseID' => $this->getUserNotificationObject()->responseID,
+ 'languageVariablePrefix' => 'wcf.user.notification.commentResponse'
]
];
}
public function getEmailMessage($notificationType = 'instant') {
return [
'message-id' => 'com.woltlab.wcf.user.profileComment.notification/'.$this->getUserNotificationObject()->commentID,
- 'template' => 'email_notification_userProfileComment',
+ 'template' => 'email_notification_comment',
'application' => 'wcf',
'variables' => [
'commentID' => $this->getUserNotificationObject()->commentID,
- 'owner' => new User($this->getUserNotificationObject()->objectID)
+ 'owner' => new User($this->getUserNotificationObject()->objectID),
+ 'languageVariablePrefix' => 'wcf.user.notification.comment'
]
];
}