Skip to content

Commit

Permalink
Issue #2386273 by alfaguru, Andy_D, RoSk0: Decode HTML entities in su…
Browse files Browse the repository at this point in the history
…bject.
  • Loading branch information
RoSk0 committed Oct 13, 2015
1 parent 1fbea08 commit 60f6075
Showing 1 changed file with 15 additions and 3 deletions.
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'] = html_entity_decode($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

0 comments on commit 60f6075

Please sign in to comment.