Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decode HTML entities in email subject. #6

Open
wants to merge 1 commit into
base: 7.x-2.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions plugins/notifier/email/MessageNotifierEmail.class.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
<?php

/**
* @file
* Email notifier plugin class.
*/

/**
* Email notifier.
*/
class MessageNotifierEmail extends MessageNotifierBase {

/**
* Implements MessageNotifierInterface::deliver().
*/
public function deliver(array $output = array()) {
$plugin = $this->plugin;
$message = $this->message;
Expand All @@ -16,19 +24,23 @@ public function deliver(array $output = array()) {

$languages = language_list();
if (!$options['language override']) {
$lang = !empty($account->language) && $account->language != LANGUAGE_NONE ? $languages[$account->language]: language_default();
$lang = !empty($account->language) && $account->language != LANGUAGE_NONE ? $languages[$account->language] : language_default();
}
else {
$lang = $languages[$message->language];
}

// Start with basic clean-up to remove line-feeds etc.
$output['message_notify_email_subject'] = trim($output['message_notify_email_subject']);
// The subject in an email can't be with HTML, so strip it.
$output['message_notify_email_subject'] = strip_tags($output['message_notify_email_subject']);
// Decode entities.
$output['message_notify_email_subject'] = decode_entities($output['message_notify_email_subject']);

// Pass the message entity along to hook_drupal_mail().
$output['message_entity'] = $message;

$result = drupal_mail('message_notify', $message->type, $mail, $lang, $output);
$result = drupal_mail('message_notify', $message->type, $mail, $lang, $output);

return $result['result'];
}

Expand Down