add HTML filtering for meta tokens
This commit is contained in:
@@ -1637,9 +1637,12 @@ function _booking_studygroup_email_summary($node) {
|
||||
'studygroup-role' => _booking_studygroup_role_lookup($node->$roleid),
|
||||
);
|
||||
|
||||
$li_text = variable_get('booking_studygroup_summary_li_text',
|
||||
'You are a <b>[meta-booking:studygroup-role]</b> for group <b>[meta-booking:studygroup-descrip]</b>, which will occur on [meta-booking:studygroup-weekday].<br /><b>[meta-booking:studygroup-explan]</b>');
|
||||
$rows[] = token_replace($li_text, $tokens);
|
||||
$list_element_text = variable_get('booking_studygroup_summary_li_text',
|
||||
'You are a <b>[meta-booking:studygroup-role]</b> for group <b>[meta-booking:studygroup-descrip]</b>, which will occur on [meta-booking:studygroup-weekday]. ' .
|
||||
'<br /><b>[meta-booking:studygroup-explan]</b>');
|
||||
// Make sure there is only HTML in the admin-entered text
|
||||
$list_element_text = check_markup($list_element_text, 'full_html', '', FALSE);
|
||||
$rows[] = token_replace($list_element_text, $tokens);
|
||||
/*
|
||||
// Add some boldness if we're using html email
|
||||
if(variable_get('booking_enable_html_mail', 0) == 1) {
|
||||
@@ -1684,6 +1687,7 @@ function _booking_studygroup_email_summary($node) {
|
||||
function _booking_leader_helper_email_summary($node) {
|
||||
global $event;
|
||||
$rows = array();
|
||||
$tokens = array();
|
||||
$found = FALSE;
|
||||
|
||||
//display study session data if enabled
|
||||
@@ -1693,8 +1697,6 @@ function _booking_leader_helper_email_summary($node) {
|
||||
array(':eid' => $event->eid));
|
||||
$studygroups = $studygroups_query->fetchAllAssoc('sid');
|
||||
|
||||
$rows[] = "<ul>";
|
||||
|
||||
foreach ($studygroups as $studygroup) {
|
||||
//don't print info about the readings groups
|
||||
if ($studygroup->booking_is_readinggroup == 'Y') {
|
||||
@@ -1730,7 +1732,7 @@ function _booking_leader_helper_email_summary($node) {
|
||||
" AND booking_studygroup_id = :group AND booking_studygroup_role = :role AND booking_session_id = :session",
|
||||
array(':eid' => $event->eid, ':group' => $studygroup->sid, ':role' => $otherrole_id, ':session' => $node->$sessionid,
|
||||
));
|
||||
$otherperson = $otherperson_query->fetchAll();
|
||||
$otherperson = $otherperson_query->fetchAll();
|
||||
|
||||
//watchdog('booking', "<pre>Other person for studygroup !group and role !role result:\n@info</pre>",
|
||||
// array('!group' => $studygroup->sid, '!role' => $otherrole_id, '@info' => print_r( $otherperson, true)));
|
||||
@@ -1741,25 +1743,51 @@ function _booking_leader_helper_email_summary($node) {
|
||||
$otherperson_email = $other->booking_email;
|
||||
$otherperson_phone = $other->booking_mobile;
|
||||
}
|
||||
|
||||
// Generate tokens
|
||||
$tokens = array(
|
||||
'studygroup-descrip' => $studygroup->booking_studygroup_descrip,
|
||||
'studygroup-weekday' => $studygroup->booking_studygroup_weekday,
|
||||
'studygroup-explan' => $studygroup->booking_studygroup_explanation,
|
||||
'studygroup-role' => $role,
|
||||
'studygroup-otherrole' => $otherrole,
|
||||
'studygroup-othername' => $otherperson_name,
|
||||
'studygroup-otheremail' => $otherperson_email,
|
||||
'studygroup-otherphone' => $otherperson_phone,
|
||||
);
|
||||
|
||||
$list_element_text = variable_get('booking_studygroup_leaderhelperpair_text',
|
||||
'<b>[meta-booking:studygroup-role]</b> for <b>[meta-booking:studygroup-descrip]</b>. ' .
|
||||
'Your <b>[meta-booking:studygroup-otherrole]</b> is <b>[meta-booking:studygroup-othername]</b>. ' .
|
||||
'You can contact them on <b>[meta-booking:studygroup-otherphone]</b> or <b>[meta-booking:studygroup-otheremail]</b>.'
|
||||
);
|
||||
// Make sure there is only HTML in the admin-entered text
|
||||
$list_element_text = check_markup($list_element_text, 'full_html', '', FALSE);
|
||||
$rows[] = token_replace($list_element_text, $tokens);
|
||||
|
||||
$rows[] = t('<li>!role for !descrip. Your !otherrole is !other. You can contact them on !phone or !email.</li>',
|
||||
array('!role' => $role, '!id' => $studygroup->sid, '!descrip' => $studygroup->booking_studygroup_descrip,
|
||||
'!otherrole' => $otherrole, '!other' => $otherperson_name, '!phone' => $otherperson_phone, '!email' => $otherperson_email,
|
||||
));
|
||||
//$rows[] = t('<li>!role for !descrip. Your !otherrole is !other. You can contact them on !phone or !email.</li>',
|
||||
// array('!role' => $role, '!id' => $studygroup->sid, '!descrip' => $studygroup->booking_studygroup_descrip,
|
||||
// '!otherrole' => $otherrole, '!other' => $otherperson_name, '!phone' => $otherperson_phone, '!email' => $otherperson_email,
|
||||
//));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rows[] = "</ul>";
|
||||
|
||||
//format the output to be used in an email
|
||||
foreach ($rows as $key => $value) {
|
||||
$rows[$key] = wordwrap($value);
|
||||
}
|
||||
if(variable_get('booking_enable_html_mail', 0) == 1) {
|
||||
return implode("\n<br />", $rows);
|
||||
// Turn the rows into an unordered list
|
||||
$output = "\n<ul>\n";
|
||||
foreach ($rows as $row) {
|
||||
$output .= "\t<li>$row</li>\n";
|
||||
}
|
||||
$output .= "</ul>\n";
|
||||
return $output;
|
||||
}
|
||||
else {
|
||||
// Plain text so just separate by newline
|
||||
return implode("\n", $rows);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user