Skip to content

Commit

Permalink
Fix for plaintext email templates.
Browse files Browse the repository at this point in the history
For feature #1003

Template class preprocess_fn used to remove any linefeeds from initial template file.
  • Loading branch information
eSilverStrike committed Apr 11, 2022
1 parent 930c4d2 commit 3d421e0
Show file tree
Hide file tree
Showing 58 changed files with 486 additions and 639 deletions.
2 changes: 2 additions & 0 deletions plugins/calendar/functions.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,8 @@ function CALENDAR_sendNotification($table, $A)
$t = COM_newTemplate(CTL_plugin_templatePath('calendar', 'emails'));

$t->set_file(array('email_html' => 'event_submission-html.thtml'));
// Remove line feeds from plain text templates since required to use {LB} template variable
$t->preprocess_fn = "CTL_removeLineFeeds"; // Set preprocess_fn before the template file you want to use it on
$t->set_file(array('email_plaintext' => 'event_submission-plaintext.thtml'));

$t->set_var('email_divider', $LANG31['email_divider']);
Expand Down
2 changes: 2 additions & 0 deletions plugins/links/functions.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,8 @@ function LINKS_sendNotification ($table, $A)
$t = COM_newTemplate(CTL_plugin_templatePath('links', 'emails'));

$t->set_file(array('email_html' => 'link_submission-html.thtml'));
// Remove line feeds from plain text templates since required to use {LB} template variable
$t->preprocess_fn = "CTL_removeLineFeeds"; // Set preprocess_fn before the template file you want to use it on
$t->set_file(array('email_plaintext' => 'link_submission-plaintext.thtml'));

$t->set_var('email_divider', $LANG31['email_divider']);
Expand Down
4 changes: 4 additions & 0 deletions public_html/admin/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,8 @@ function saveusers($uid, $username, $fullname, $passwd, $passwd_conf, $email, $r
$t = COM_newTemplate(CTL_core_templatePath($_CONF['path_layout'] . 'emails/'));

$t->set_file(array('email_html' => 'user_send_password-html.thtml'));
// Remove line feeds from plain text templates since required to use {LB} template variable
$t->preprocess_fn = "CTL_removeLineFeeds"; // Set preprocess_fn before the template file you want to use it on
$t->set_file(array('email_plaintext' => 'user_send_password-plaintext.thtml'));

$t->set_var('email_divider', $LANG31['email_divider']);
Expand Down Expand Up @@ -1225,6 +1227,8 @@ function batchreminders()
$t = COM_newTemplate(CTL_core_templatePath($_CONF['path_layout'] . 'emails/'));

$t->set_file(array('email_html' => 'user_login_reminder-html.thtml'));
// Remove line feeds from plain text templates since required to use {LB} template variable
$t->preprocess_fn = "CTL_removeLineFeeds"; // Set preprocess_fn before the template file you want to use it on
$t->set_file(array('email_plaintext' => 'user_login_reminder-plaintext.thtml'));

$t->set_var('email_divider', $LANG31['email_divider']);
Expand Down
46 changes: 20 additions & 26 deletions public_html/layout/denim/emails/article-plaintext.thtml
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
{!if lang_cc_email_info}
{lang_cc_email_info}

{email_divider}

{lang_cc_email_info}{LB}
{LB}
{email_divider}{LB}
{LB}
{!endif}
{lang_email_sentinfo}

{lang_email_sentinfo}{LB}
{LB}
{!if lang_email_from}

{lang_email_from}


{lang_email_from}{LB}
{LB}
{short_message_plaintext}

{!endif}
{email_divider}

{article_title}

{article_date}

{lang_contributed_by} {article_author}

{LB}
{email_divider}{LB}
{LB}
{article_title}{LB}
{article_date}{LB}
{lang_contributed_by} {article_author}{LB}
{LB}
{article_introtext_plaintext}

{!if article_bodytext_plaintext}
{article_bodytext_plaintext}
{!endif}

{email_divider}

{lang_article_url}

{article_url}
{LB}
{email_divider}{LB}
{LB}
{lang_article_url}{LB}
{article_url}{LB}
24 changes: 10 additions & 14 deletions public_html/layout/denim/emails/article_submission-plaintext.thtml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{lang_title}: {submission_title}

{lang_author}: {submission_author}

{lang_date}: {submission_date}

{lang_topic}: {submission_topic}

{lang_title}: {submission_title}{LB}
{lang_author}: {submission_author}{LB}
{lang_date}: {submission_date}{LB}
{lang_topic}: {submission_topic}{LB}
{!if submission_content_plaintext}

{submission_content_plaintext}

{LB}
{submission_content_plaintext}{LB}
{!endif}
{email_divider}

{lang_url_label}: {submission_url}
{LB}
{email_divider}{LB}
{LB}
{lang_url_label}: {submission_url}{LB}
21 changes: 9 additions & 12 deletions public_html/layout/denim/emails/comment_reply-plaintext.thtml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
{lang_hello_name}


{lang_new_comment_msg}


{email_divider}

{lang_url_label}: {submission_url}


{lang_unsubscribe_url}: {unsubscribe_url}
{lang_hello_name}{LB}
{LB}
{lang_new_comment_msg}{LB}
{LB}
{email_divider}{LB}
{LB}
{lang_url_label}: {submission_url}{LB}
{LB}
{lang_unsubscribe_url}: {unsubscribe_url}{LB}
37 changes: 16 additions & 21 deletions public_html/layout/denim/emails/comment_submission-plaintext.thtml
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
{!if lang_abuse_comment_msg}
{lang_abuse_comment_msg}

{email_divider}

{lang_abuse_comment_msg}{LB}
{LB}
{email_divider}{LB}
{LB}
{!endif}
{lang_title}: {submission_title}

{lang_author}: {submission_author}

{lang_date}: {submission_date}

{lang_type}: {submission_type}

{lang_title}: {submission_title}{LB}
{lang_author}: {submission_author}{LB}
{lang_date}: {submission_date}{LB}
{lang_type}: {submission_type}{LB}
{!if submission_content_plaintext}

{submission_content_plaintext}

{LB}
{submission_content_plaintext}{LB}
{!endif}
{email_divider}

{lang_url_label}: {submission_url}


{lang_item_url}: {item_url}
{LB}
{email_divider}{LB}
{LB}
{lang_url_label}: {submission_url}{LB}
{LB}
{lang_item_url}: {item_url}{LB}
26 changes: 12 additions & 14 deletions public_html/layout/denim/emails/contact-plaintext.thtml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
{!if lang_cc_email_info}
{lang_cc_email_info}

{email_divider}

{lang_cc_email_info}{LB}
{LB}
{email_divider}{LB}
{LB}
{!endif}
{lang_email_sentinfo}

{email_divider}


{message_plaintext}

{lang_email_sentinfo}{LB}
{LB}
{email_divider}{LB}
{LB}
{message_plaintext}{LB}
{!if signature}
{signature_divider}

{signature}
{signature_divider}{LB}
{LB}
{signature}{LB}
{!endif}
33 changes: 13 additions & 20 deletions public_html/layout/denim/emails/daily_digest-plaintext.thtml
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
{lang_info_msg}


{lang_unsubscribe_msg}

{lang_info_msg}{LB}
{LB}
{lang_unsubscribe_msg}{LB}
{articles_plaintext}

<!-- BEGIN article_plaintext -->

{email_divider}

{lang_title}: {article_title}

{!if article_author}{lang_author}: {article_author}{!endif}

{lang_date}: {article_date}


{content_plaintext}


{lang_url_label}: {article_url}

{LB}
{email_divider}{LB}
{LB}
{lang_title}: {article_title}{LB}
{!if article_author}{lang_author}: {article_author}{LB}{!endif}
{lang_date}: {article_date}{LB}
{LB}
{content_plaintext}{LB}
{LB}
{lang_url_label}: {article_url}{LB}
<!-- END article_plaintext -->
27 changes: 12 additions & 15 deletions public_html/layout/denim/emails/email_footer-plaintext.thtml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@

{email_divider}

{LB}
{email_divider}{LB}
{LB}
{!if lang_email_footer_msg_noreply}
{lang_email_footer_msg_noreply}
{lang_email_footer_msg_noreply}{LB}
{!endif}


{lang_email_footer_msg_content}

{LB}
{lang_email_footer_msg_content}{LB}
{LB}
{!if ip_address}

{lang_ip_address_email} {ip_address}

{lang_ip_address_email} {ip_address}{LB}
{LB}
{!endif}

{lang_end_of_msg}

{email_divider}
{lang_end_of_msg}{LB}
{LB}
{email_divider}{LB}
23 changes: 9 additions & 14 deletions public_html/layout/denim/emails/user_info-plaintext.thtml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
{lang_user_info_msg}


{lang_username}: {username}

{lang_password}: {password}


{lang_password_msg}


{site_name}{!if site_slogan} - {site_slogan}{!endif}

{site_url}
{lang_user_info_msg}{LB}
{LB}
{lang_username}: {username}{LB}
{lang_password}: {password}{LB}
{LB}
{lang_password_msg}{LB}
{LB}
{site_name}{!if site_slogan} - {site_slogan}{!endif}{LB}
{site_url}{LB}
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{lang_username}: {username}

{lang_email}: {email}


{lang_max_invalid_login_msg}


{email_divider}

{lang_profile_url_label}: {profile_url}
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{lang_account_access_msg}


{lang_login_info_msg}


{lang_retrieve_password_msg} {new_password_url}


{site_name}{!if site_slogan} - {site_slogan}{!endif}

{site_url}
17 changes: 7 additions & 10 deletions public_html/layout/denim/emails/user_new-plaintext.thtml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{lang_username}: {username}

{lang_email}: {email}

{lang_date}: {date}


{email_divider}

{lang_profile_url_label}: {profile_url}
{lang_username}: {username}{LB}
{lang_email}: {email}{LB}
{lang_date}: {date}{LB}
{LB}
{email_divider}{LB}
{LB}
{lang_profile_url_label}: {profile_url}{LB}
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
{lang_user_request_msg}


{lang_user_action_msg}


{new_password_url}


{lang_ignore_request_msg}


{site_name}{!if site_slogan} - {site_slogan}{!endif}

{site_url}
{lang_user_request_msg}{LB}
{LB}
{lang_user_action_msg}{LB}
{LB}
{new_password_url}{LB}
{LB}
{lang_ignore_request_msg}{LB}
{LB}
{site_name}{!if site_slogan} - {site_slogan}{!endif}{LB}
{site_url}{LB}

0 comments on commit 3d421e0

Please sign in to comment.