Skip to content

Commit bca69cb

Browse files
committed
Issue #2386273 by alfaguru, Andy_D, RoSk0: Decode HTML entities in subject.
1 parent 1fbea08 commit bca69cb

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

plugins/notifier/email/MessageNotifierEmail.class.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
<?php
22

3+
/**
4+
* @file
5+
* Email notifier plugin class.
6+
*/
7+
38
/**
49
* Email notifier.
510
*/
611
class MessageNotifierEmail extends MessageNotifierBase {
712

13+
/**
14+
* Implements MessageNotifierInterface::deliver().
15+
*/
816
public function deliver(array $output = array()) {
917
$plugin = $this->plugin;
1018
$message = $this->message;
@@ -16,19 +24,23 @@ public function deliver(array $output = array()) {
1624

1725
$languages = language_list();
1826
if (!$options['language override']) {
19-
$lang = !empty($account->language) && $account->language != LANGUAGE_NONE ? $languages[$account->language]: language_default();
27+
$lang = !empty($account->language) && $account->language != LANGUAGE_NONE ? $languages[$account->language] : language_default();
2028
}
2129
else {
2230
$lang = $languages[$message->language];
2331
}
24-
32+
// Start with basic clean-up to remove line-feeds etc.
33+
$output['message_notify_email_subject'] = trim($output['message_notify_email_subject']);
2534
// The subject in an email can't be with HTML, so strip it.
2635
$output['message_notify_email_subject'] = strip_tags($output['message_notify_email_subject']);
36+
// Decode entities.
37+
$output['message_notify_email_subject'] = decode_entities($output['message_notify_email_subject']);
2738

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

31-
$result = drupal_mail('message_notify', $message->type, $mail, $lang, $output);
42+
$result = drupal_mail('message_notify', $message->type, $mail, $lang, $output);
43+
3244
return $result['result'];
3345
}
3446

0 commit comments

Comments
 (0)