a7dd9328 by Chris Boden

Parsed subject line, removed HTML from subject line

1 parent 9827b8e2
......@@ -188,21 +188,15 @@ function remove_notice($notification_id = -1) {
@trigger = notification unique slug name
*/
function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),$send_override = false) {
$notification = get_notification_by_trigger($trigger);
if($notification) {
// get the notification and notificatio details....
$nid = $notification->ID;
$details = get_post_meta($nid,'details',true);
$email = get_post_meta($nid,'email',true);
$system = get_post_meta($nid,'system',true);
$notification->trigger = $details['trigger'];
$notification->status = isset($details['status']) ? $details['status'] : "active";
$notification->type = $details['type'];
......@@ -210,7 +204,6 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),
$notification->is_email = (($email['text'] != "" || $email['html'] != "") && $email['subject'] != "") ? true : false;
$notification->is_system = (isset($system['message']) && $system['message'] != "") ? true : false;
// if is_system ==========================================
if ($notification->is_system && $uid != 0) {
get_user_notices($uid);
......@@ -234,22 +227,17 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),
update_user_meta($uid,'notices',$notices);
}
// if is_email ===========================================
if ($notification->is_email) {
send_email($uid,$email,$args, true);
}
}
// if the system notification has set current user than get current user otherwise loop through the users needed.
}
function send_email($uid = 0, $contents,$args, $override = false) {
if ( $uid == 0 && !isset($args['email'])) { return; }
if ( isset($args['email'])) {
$to_email = $args['email'];
} else {
......@@ -272,8 +260,7 @@ function send_email($uid = 0, $contents,$args, $override = false) {
$from_address = get_bloginfo('admin_email');
$subject = $contents['subject'];
$subject = strip_tags($contents['subject']);
$html = $contents['html'];
$alttext = $contents['text'];
......@@ -296,9 +283,9 @@ function send_email($uid = 0, $contents,$args, $override = false) {
if ( (filter_var($val, FILTER_VALIDATE_URL) !== false) && !empty($html)) {
$message = str_replace("{".$key."}","<a href='".$val."'>".$val."</a>",$message);
} else {
$message = str_replace("{".$key."}",$val,$message);
$message = str_replace("{".$key."}", $val, $message);
$subject = str_replace("{".$key."}", $val, $subject);
}
}
// Additional headers
......