Elgg
Version 6.1
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
engine
classes
Elgg
Email
ThreadHeadersHandler.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Elgg\Email
;
4
10
class
ThreadHeadersHandler
{
11
20
public
function
__invoke
(\
Elgg
\
Event
$event) {
21
$email
= $event->getValue();
22
if
(!
$email
instanceof \
Elgg
\
Email
) {
23
return
;
24
}
25
26
$params
=
$email
->getParams();
27
28
$notification
=
elgg_extract
(
'notification'
,
$params
);
29
if
(!
$notification
instanceof \
Elgg
\Notifications\
Notification
) {
30
return
;
31
}
32
33
$object
=
elgg_extract
(
'object'
,
$notification
->params);
34
if
(!
$object
instanceof \
ElggEntity
) {
35
return
;
36
}
37
38
$event =
elgg_extract
(
'event'
,
$notification
->params);
39
if
(!$event instanceof \
Elgg
\Notifications\NotificationEvent) {
40
return
;
41
}
42
43
$message_id =
$email
->createEntityMessageID(
$object
, $event->getAction() !==
'create'
);
44
$email
->addHeader(
'Message-ID'
, $message_id);
45
46
// let's just thread comments by default
47
$container
=
$object
->getContainerEntity();
48
if
(
$container
instanceof \ElggEntity &&
$object
instanceof \
ElggComment
) {
49
$thread_message_id =
"<{$email->createEntityMessageID($container)}>"
;
50
51
$email
->addHeader(
'In-Reply-To'
, $thread_message_id);
52
$email
->addHeader(
'References'
, $thread_message_id);
53
}
54
55
return
$email
;
56
}
57
}
ElggComment
Definition:
ElggComment.php:11
$email
$email
Definition:
change_email.php:7
Elgg\Notifications\Notification
Notification container.
Definition:
Notification.php:11
elgg_extract
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition:
elgglib.php:256
Elgg\Email\ThreadHeadersHandler\__invoke
__invoke(\Elgg\Event $event)
Adds default thread SMTP headers to group messages correctly.
Definition:
ThreadHeadersHandler.php:20
Elgg
Definition:
ActionsService.php:3
Elgg\Email
Email message.
Definition:
Email.php:13
$notification
$notification
Definition:
body.php:13
$container
$container
Definition:
delete.php:23
Elgg\Email\$params
$params
Definition:
Email.php:53
$object
if($email instanceof\Elgg\Email) $object
Definition:
body.php:24
ElggEntity
Definition:
ElggEntity.php:52
Elgg\Email\ThreadHeadersHandler
Sets the thread headers for emails.
Definition:
ThreadHeadersHandler.php:10
Elgg\Event
Models an event passed to event handlers.
Definition:
Event.php:11
Elgg\Email
Definition:
Address.php:3
Generated on Mon Dec 2 2024 00:00:37 for Elgg by
1.8.11