code cleanup

This commit is contained in:
2017-09-16 12:15:05 +10:00
parent 332dcabd52
commit a8ff994a9d
3 changed files with 2 additions and 347 deletions

View File

@@ -86,32 +86,6 @@ function _booking_registration_email($nid, $balance_payment, $manual = false) {
$themed_body = _booking_generate_html_body($subject, $raw_body, $tokens);
$params['body'] = $themed_body;
/*
//get the footer text
$message_footer = variable_get('booking_html_mail_footer');
$message_footer = isset($message_footer['format']) ? $message_footer['value'] : $message_footer;
$message_footer = token_replace($message_footer, $tokens);
//Check if we should apply a HTML theme to the email text or just send a normal email
if(variable_get('booking_enable_html_mail', 0) == 1) {
$html_body = theme('booking_htmlmail_registration_mail',
array(
'module' => 'booking',
'key' => 'registration_mail',
'body' => _booking_registration_email_generate($node, $tokens, $waiting_list, $balance_payment, $manual),
'subject' => $subject,
'footer' => $message_footer,
'links' => _booking_html_emails_links(),
));
//watchdog('booking_debug', "<pre>HTML body themed\n@info</pre>", array('@info' => print_r($html_body, true)));
$params['body'] = $html_body;
}
else {
$body = _booking_registration_email_generate($node, $tokens, $waiting_list, $balance_payment, $manual);
$params['body'] = $body;
}
*/
if (variable_get('booking_bcc_notify_email_workflow', 0) == 1) {
$params['headers']['Bcc'] = variable_get('booking_notify_email', variable_get('site_mail', ini_get('sendmail_from')));
}
@@ -168,32 +142,6 @@ function _booking_regn_notifyonly_email($node, $balance_payment) {
$themed_body = _booking_generate_html_body($subject, $message_body, $tokens);
$params['body'] = $themed_body;
/*
//get the footer text
$message_footer = variable_get('booking_html_mail_footer');
$message_footer = isset($message_footer['format']) ? $message_footer['value'] : $message_footer;
$message_footer = token_replace($message_footer, $tokens);
//Check if we should apply a HTML theme to the email text or just send a normal email
if(variable_get('booking_enable_html_mail', 0) == 1) {
$html_body = theme('booking_htmlmail_registration_mail',
array(
'module' => 'booking',
'key' => 'registration_mail_notify',
'body' => $body,
'subject' => $subject,
'footer' => $message_footer,
'links' => _booking_html_emails_links(),
));
//watchdog('booking_debug', "<pre>HTML body themed\n@info</pre>", array('@info' => print_r($html_body, true)));
$params['body'] = $html_body;
}
else {
$params['body'] = $body;
}
*/
//$params['body'] = token_replace(variable_get('booking_email_notification_text'), $tokens);
if (variable_get('booking_bcc_notify_email_workflow', 0) == 1) {
$params['headers']['Bcc'] = variable_get('booking_notify_email', variable_get('site_mail', ini_get('sendmail_from')));
}
@@ -294,31 +242,6 @@ function _booking_balance_payment_email($nid) {
$params['subject'] = $subject;
$params['body'] = $themed_body;
/*
//get the footer text
$message_footer = variable_get('booking_html_mail_footer');
$message_footer = isset($message_footer['format']) ? $message_footer['value'] : $message_footer;
$message_footer = token_replace($message_footer, $tokens);
//Check if we should apply a HTML theme to the email text or just send a normal email
if(variable_get('booking_enable_html_mail', 0) == 1) {
$html_body = theme('booking_htmlmail_registration_mail',
array(
'module' => 'booking',
'key' => 'registration_mail_bal_outstanding',
'body' => $message_body,
'subject' => $subject,
'footer' => $message_footer,
'links' => _booking_html_emails_links(),
));
//watchdog('booking_debug', "<pre>HTML body themed\n@info</pre>", array('@info' => print_r($html_body, true)));
$params['body'] = $html_body;
}
else {
$params['body'] = $message_body;
}
*/
//send the email
drupal_mail('booking', 'registration_mail_bal_outstanding', $to, $language, $params, $from);
}
@@ -366,35 +289,6 @@ function _booking_partialbalance_payment_email($nid) {
$themed_body = _booking_generate_html_body($subject, $message_body, $tokens);
$params['body'] = $themed_body;
/*
//Use the value of the field if it is an array from a HTML textarea
$body = isset($body['format']) ? $body['value'] : $body;
$body = token_replace($body, $tokens);
//get the footer text
$message_footer = variable_get('booking_html_mail_footer');
$message_footer = isset($message_footer['format']) ? $message_footer['value'] : $message_footer;
$message_footer = token_replace($message_footer, $tokens);
//Check if we should apply a HTML theme to the email text or just send a normal email
if(variable_get('booking_enable_html_mail', 0) == 1) {
$html_body = theme('booking_htmlmail_registration_mail',
array(
'module' => 'booking',
'key' => 'registration_mail_bal_outstanding',
'body' => $body,
'subject' => $subject,
'footer' => $message_footer,
'links' => _booking_html_emails_links(),
));
//watchdog('booking_debug', "<pre>HTML body themed\n@info</pre>", array('@info' => print_r($html_body, true)));
$params['body'] = $html_body;
}
else {
$params['body'] = $body;
}
*/
//send the email
drupal_mail('booking', 'registration_mail_bal_outstanding', $to, $language, $params, $from);
}
@@ -453,35 +347,7 @@ function _booking_custom_email($nid, $email_type, $sender = 'contact') {
$message_body = token_replace($message_body, $tokens);
$themed_body = _booking_generate_html_body($subject, $message_body, $tokens);
$params['body'] = $themed_body;
/*
//get the footer text
$message_footer = variable_get('booking_html_mail_footer');
$message_footer = isset($message_footer['format']) ? $message_footer['value'] : $message_footer;
$message_footer = token_replace($message_footer, $tokens);
//Check if we should apply a HTML theme to the email text or just send a normal email
if(variable_get('booking_enable_html_mail', 0) == 1) {
$html_body = theme('booking_htmlmail_registration_mail',
array(
'module' => 'booking',
'key' => 'booking_email_custom',
'body' => $message_body,
'subject' => $subject,
'footer' => $message_footer,
'links' => _booking_html_emails_links(),
));
//watchdog('booking_debug', "<pre>HTML body themed\n@info</pre>", array('@info' => print_r($html_body, true)));
$params['body'] = $html_body;
}
else {
$params['body'] = $message_body;
}
*/
//retrieve the body of the email
//$params['body'] = token_replace(variable_get($email_body_variable), $tokens);
//send the email to the person
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
}
@@ -529,34 +395,6 @@ function _booking_promoted_from_waitinglist_email($nid) {
$themed_body = _booking_generate_html_body($subject, $message_body, $tokens);
$params['body'] = $themed_body;
/*
//get the footer text
$message_footer = variable_get('booking_html_mail_footer');
$message_footer = isset($message_footer['format']) ? $message_footer['value'] : $message_footer;
$message_footer = token_replace($message_footer, $tokens);
//Check if we should apply a HTML theme to the email text or just send a normal email
if(variable_get('booking_enable_html_mail', 0) == 1) {
$html_body = theme('booking_htmlmail_registration_mail',
array(
'module' => 'booking',
'key' => 'booking_email_custom',
'body' => $body,
'subject' => $subject,
'footer' => $message_footer,
'links' => _booking_html_emails_links(),
));
//watchdog('booking_debug', "<pre>HTML body themed\n@info</pre>", array('@info' => print_r($html_body, true)));
$params['body'] = $html_body;
}
else {
$params['body'] = $body;
}
*/
//retrieve the body of the email
//$params['body'] = token_replace(variable_get('booking_email_waitinglistpromotion'), $tokens);
//send the email
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
}
@@ -606,31 +444,6 @@ function _booking_demoted_to_notcoming_email($nid) {
$themed_body = _booking_generate_html_body($subject, $message_body, $tokens);
$params['body'] = $themed_body;
/*
//get the footer text
$message_footer = variable_get('booking_html_mail_footer');
$message_footer = isset($message_footer['format']) ? $message_footer['value'] : $message_footer;
$message_footer = token_replace($message_footer, $tokens);
//Check if we should apply a HTML theme to the email text or just send a normal email
if(variable_get('booking_enable_html_mail', 0) == 1) {
$html_body = theme('booking_htmlmail_registration_mail',
array(
'module' => 'booking',
'key' => 'booking_email_custom',
'body' => $body,
'subject' => $subject,
'footer' => $message_footer,
'links' => _booking_html_emails_links(),
));
//watchdog('booking_debug', "<pre>HTML body themed\n@info</pre>", array('@info' => print_r($html_body, true)));
$params['body'] = $html_body;
}
else {
$params['body'] = $body;
}
*/
//send the email
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
}
@@ -680,31 +493,6 @@ function _booking_missedpayment_email($nid) {
$themed_body = _booking_generate_html_body($subject, $message_body, $tokens);
$params['body'] = $themed_body;
/*
//get the footer text
$message_footer = variable_get('booking_html_mail_footer');
$message_footer = isset($message_footer['format']) ? $message_footer['value'] : $message_footer;
$message_footer = token_replace($message_footer, $tokens);
//Check if we should apply a HTML theme to the email text or just send a normal email
if(variable_get('booking_enable_html_mail', 0) == 1) {
$html_body = theme('booking_htmlmail_registration_mail',
array(
'module' => 'booking',
'key' => 'booking_email_custom',
'body' => $body,
'subject' => $subject,
'footer' => $message_footer,
'links' => _booking_html_emails_links(),
));
//watchdog('booking_debug', "<pre>HTML body themed\n@info</pre>", array('@info' => print_r($html_body, true)));
$params['body'] = $html_body;
}
else {
$params['body'] = $body;
}
*/
//send the email
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
}
@@ -754,31 +542,6 @@ function _booking_travelform_initial_request_email($nid) {
$themed_body = _booking_generate_html_body($subject, $message_body, $tokens);
$params['body'] = $themed_body;
/*
//get the footer text
$message_footer = variable_get('booking_html_mail_footer');
$message_footer = isset($message_footer['format']) ? $message_footer['value'] : $message_footer;
$message_footer = token_replace($message_footer, $tokens);
//Check if we should apply a HTML theme to the email text or just send a normal email
if(variable_get('booking_enable_html_mail', 0) == 1) {
$html_body = theme('booking_htmlmail_registration_mail',
array(
'module' => 'booking',
'key' => 'booking_email_custom',
'body' => $body,
'subject' => $subject,
'footer' => $message_footer,
'links' => _booking_html_emails_links(),
));
//watchdog('booking_debug', "<pre>HTML body themed\n@info</pre>", array('@info' => print_r($html_body, true)));
$params['body'] = $html_body;
}
else {
$params['body'] = $body;
}
*/
//send the email
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
}
@@ -829,31 +592,6 @@ function _booking_travelform_reminder_request_email($nid) {
$themed_body = _booking_generate_html_body($subject, $message_body, $tokens);
$params['body'] = $themed_body;
/*
//get the footer text
$message_footer = variable_get('booking_html_mail_footer');
$message_footer = isset($message_footer['format']) ? $message_footer['value'] : $message_footer;
$message_footer = token_replace($message_footer, $tokens);
//Check if we should apply a HTML theme to the email text or just send a normal email
if(variable_get('booking_enable_html_mail', 0) == 1) {
$html_body = theme('booking_htmlmail_registration_mail',
array(
'module' => 'booking',
'key' => 'booking_email_custom',
'body' => $body,
'subject' => $subject,
'footer' => $message_footer,
'links' => _booking_html_emails_links(),
));
//watchdog('booking_debug', "<pre>HTML body themed\n@info</pre>", array('@info' => print_r($html_body, true)));
$params['body'] = $html_body;
}
else {
$params['body'] = $body;
}
*/
//send the email
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
}
@@ -907,31 +645,6 @@ function _booking_travelform_confirmation_email($nid) {
$themed_body = _booking_generate_html_body($subject, $message_body, $tokens);
$params['body'] = $themed_body;
/*
//get the footer text
$message_footer = variable_get('booking_html_mail_footer');
$message_footer = isset($message_footer['format']) ? $message_footer['value'] : $message_footer;
$message_footer = token_replace($message_footer, $tokens);
//Check if we should apply a HTML theme to the email text or just send a normal email
if(variable_get('booking_enable_html_mail', 0) == 1) {
$html_body = theme('booking_htmlmail_registration_mail',
array(
'module' => 'booking',
'key' => 'booking_email_custom',
'body' => $body,
'subject' => $subject,
'footer' => $message_footer,
'links' => _booking_html_emails_links(),
));
//watchdog('booking_debug', "<pre>HTML body themed\n@info</pre>", array('@info' => print_r($html_body, true)));
$params['body'] = $html_body;
}
else {
$params['body'] = $body;
}
*/
//send the email
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
}

View File

@@ -6,13 +6,7 @@
*/
function _booking_remove_emoji($text) {
$clean_text = "";
/*
return preg_replace('/([0-9|#][\x{20E3}])|[\x{00ae}|\x{00a9}|\x{203C}|\x{2047}|\x{2048}|\x{2049}|\x{3030}|\x{303D}|\x{2139}|
\x{2122}|\x{3297}|\x{3299}][\x{FE00}-\x{FEFF}]?|[\x{2190}-\x{21FF}][\x{FE00}-\x{FEFF}]?|
[\x{2300}-\x{23FF}][\x{FE00}-\x{FEFF}]?|[\x{2460}-\x{24FF}][\x{FE00}-\x{FEFF}]?|[\x{25A0}-\x{25FF}][\x{FE00}-\x{FEFF}]?|
[\x{2600}-\x{27BF}][\x{FE00}-\x{FEFF}]?|[\x{2900}-\x{297F}][\x{FE00}-\x{FEFF}]?|
[\x{2B00}-\x{2BF0}][\x{FE00}-\x{FEFF}]?|[\x{1F000}-\x{1F6FF}][\x{FE00}-\x{FEFF}]?/u', '', $text);
*/
//don't try to strip emojis if that feature is disabled
if (variable_get('booking_enable_emoji_removal', 1) == 0) {
return $text;
@@ -30,46 +24,6 @@ function _booking_remove_emoji($text) {
'[\x{1F9C0}]|' .
'[\x{1F9F9}]/u', '', $text);
}
/*
// Match Emoticons
$regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u';
$clean_text = preg_replace($regexEmoticons, '', $text);
// Match Miscellaneous Symbols and Pictographs
$regexSymbols = '/[\x{1F300}-\x{1F5FF}]/u';
$clean_text = preg_replace($regexSymbols, '', $clean_text);
// Match Transport And Map Symbols
$regexTransport = '/[\x{1F680}-\x{1F6FF}]/u';
$clean_text = preg_replace($regexTransport, '', $clean_text);
// Match Miscellaneous Symbols
$regexMisc = '/[\x{2600}-\x{26FF}]/u';
$clean_text = preg_replace($regexMisc, '', $clean_text);
// Match Dingbats
$regexDingbats = '/[\x{2700}-\x{27BF}]/u';
$clean_text = preg_replace($regexDingbats, '', $clean_text);
// Match Flags
$regexDingbats = '/[\x{1F1E6}-\x{1F1FF}]/u';
$clean_text = preg_replace($regexDingbats, '', $clean_text);
// Others
$regexDingbats = '/[\x{1F910}-\x{1F95E}]/u';
$clean_text = preg_replace($regexDingbats, '', $clean_text);
$regexDingbats = '/[\x{1F980}-\x{1F991}]/u';
$clean_text = preg_replace($regexDingbats, '', $clean_text);
$regexDingbats = '/[\x{1F9C0}]/u';
$clean_text = preg_replace($regexDingbats, '', $clean_text);
$regexDingbats = '/[\x{1F9F9}]/u';
$clean_text = preg_replace($regexDingbats, '', $clean_text);
return $clean_text;
*/
}
/**
@@ -87,18 +41,6 @@ function _booking_ucname($string) {
return $string;
}
/**
* Helper function to generate associative array of 3 email links supported by html email template
*/
function _booking_html_emails_links() {
return array(
'The Week' => 'https://www.studyweek.net/the-week/whats-happening',
'Resources' => 'https://www.studyweek.net/studynotes',
'Who\'s Coming' => 'https://www.studyweek.net/coming',
);
}
/**
* Helper function to perform some validity checking of email addresses
*/

View File

@@ -252,7 +252,7 @@ max-width: 100% !important; } }
<!--[if (!mso)&(!IE)]><!--><div style="border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;"><!--<![endif]-->
<!-- Subject -->
<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 10px; padding-left: 10px; padding-top: 20px; padding-bottom: 10px;"><![endif]-->
<div style="font-size:36px;line-height:43px;font-family:Verdana, Geneva, sans-serif;color:<?php print $colors['booking_mailtemplate_subjectheading_text_color'] ?>;text-align:left;">
<div style="font-size:28px;line-height:43px;font-family:Verdana, Geneva, sans-serif;color:<?php print $colors['booking_mailtemplate_subjectheading_text_color'] ?>;text-align:left;">
<p style="margin: 0;text-align: center"><strong><?php print $subject ?></strong></p>
</div>
<!--[if mso]></td></tr></table><![endif]-->