View source
<?php
define('SUBSCRIPTIONS_COMMENT_MAILKEY', 'subscriptions_content_node-nid+comment');
define('SUBSCRIPTIONS_DIGEST_MAILKEY', 'subscriptions_mail_digest');
function subscriptions_mail_template_raw($key, $langcode) {
switch ($key) {
case 'SEP':
return t('| --------------------------------------------------------------------
', array(), $langcode);
case 'SUBJ':
return t('[!site] !subs_type subscription for !name: !title', array(), $langcode);
case 'FOOT':
return t('| This is an automated message. Please do NOT reply to the sender address!
| To manage your subscriptions go to
| !manage_url
', array(), $langcode);
case 'BODY':
return t('| Greetings, !name.
|
| Your subscription on !site
| notifies you of {{!is_new==0?:a new post:
}}{{!is_updated==0?:an updated post:
}}{{!is_old==0?:new comments:
}}|
{{!is_published==1?:| ***** This post is unpublished! *****
}}{{!term_name==!term_name?:| Category: !term_name
}}{{!sender_name==!sender_name?:| Author: !sender_name
}}{{!sender_has_contact_page==0?:| Contact: !sender_contact_page
}}| Title: !title
{{!is_old==1?:
!teaser
}}| Link: !url
| Direct unsubscribe link (!subs_type):
| !unsubscribe_url
{{!has_new_comments==1?!SEPARATOR!comments:}}!SEPARATOR!FOOTER', array(
'!SEPARATOR' => subscriptions_mail_template_raw('SEP', $langcode),
'!FOOTER' => subscriptions_mail_template_raw('FOOT', $langcode),
), $langcode);
case 'CITEM':
return t('| {{!comment_is_new==1?New:Updated}} {{!comment_is_published==1?:UNPUBLISHED }}comment:
| Author: !comment_name
| Title: !comment_title
!comment_text
| Link: !comment_url
', array(), $langcode);
case 'DSUBJ':
return t('[!site] Subscription Digest for !name', array(), $langcode);
case 'DBODY':
return t('| Greetings, !name.
|
| Your subscriptions on !site
| notify you of the following changes since the previous digest:
|
!bodies!SEPARATOR!FOOTER', array(
'!SEPARATOR' => subscriptions_mail_template_raw('SEP', $langcode),
'!FOOTER' => subscriptions_mail_template_raw('FOOT', $langcode),
), $langcode);
case 'DITEM':
return t('{{!sender_name==!sender_name?:| Author: !sender_name
}}| Title: !title
{{!is_new==0?:!teaser
}}| Link: !url
| Direct unsubscribe link (!subs_type):
| !unsubscribe_url
{{!has_new_comments!=1?:!comments}}', array(), $langcode);
case 'DITEMCMT':
return t('| Comment: !comment_title
', array(), $langcode);
}
}
function subscriptions_mail_template($key, $langcode) {
static $templates;
if (!isset($templates[$langcode][$key])) {
$templates[$langcode][$key] = subscriptions_mail_template_raw($key, $langcode);
}
return $templates[$langcode][$key];
}
function subscriptions_mail_template_load($mailkey, $langcode, $part, $key) {
if (module_exists('mail_edit')) {
static $cache = array();
if (!isset($cache[$langcode][$mailkey])) {
$cache[$langcode][$mailkey] = db_fetch_object(db_query("SELECT * FROM {mail_edit} WHERE id = '%s' and language = '%s'", $mailkey, $langcode));
}
if (isset($cache[$langcode][$mailkey]->{$part})) {
return $cache[$langcode][$mailkey]->{$part};
}
}
return subscriptions_mail_template($key, $langcode);
}