71 $action_list = array_unique(array_merge($action_list,
$actions));
72 } elseif (!in_array(
'create', $action_list)) {
73 $action_list[] =
'create';
87 unset($this->
events[$type][$subtype]);
112 if (isset($this->methods[
$name])) {
113 unset($this->methods[$name]);
137 $object_type =
$object->getType();
138 $object_subtype =
$object->getSubtype();
141 if (isset($this->
events[$object_type])
142 && isset($this->
events[$object_type][$object_subtype])
143 && in_array(
$action, $this->
events[$object_type][$object_subtype])) {
152 $registered = $this->hooks->trigger(
'enqueue',
'notification',
$params, $registered);
176 $ia = $this->access->setIgnoreAccess(
true);
178 while (time() < $stopTime) {
180 $event = $this->queue->dequeue();
194 if ($this->hooks->trigger(
'send:before',
'notifications',
$params,
true)) {
197 $this->hooks->trigger(
'send:after',
'notifications',
$params);
203 $this->access->setIgnoreAccess(
$ia);
218 if (!$this->methods) {
225 if (in_array($method, $this->methods)) {
247 if (!$recipient || $recipient->isBanned()) {
270 'recipient' => $recipient,
280 if ($this->hooks->hasHandler(
'prepare', $type)) {
281 $notification = $this->hooks->trigger(
'prepare', $type,
$params, $notification);
287 if ($this->hooks->hasHandler(
'send',
"notification:$method")) {
290 'notification' => $notification,
293 return $this->hooks->trigger(
'send',
"notification:$method",
$params,
false);
296 $userGuid = $notification->getRecipientGUID();
297 $senderGuid = $notification->getSenderGUID();
298 $subject = $notification->subject;
299 $body = $notification->body;
300 $params = $notification->params;
323 if (isset($this->deprHandlers[
$method])) {
324 return $this->deprHandlers[
$method];
338 foreach ($this->methods as
$method) {
365 $notification->body =
$body;
368 return $notification;
387 if (!isset($this->deprSubjects[
$type])) {
388 $this->deprSubjects[
$type] = array();
409 if (!isset($this->deprSubjects[
$type])) {
413 if (!isset($this->deprSubjects[$type][
$subtype])) {
433 'object_type' =>
$entity->getType(),
436 $hookresult = $this->hooks->trigger(
'object:notifications',
$entity->getType(),
$params,
false);
437 if ($hookresult ===
true) {
438 elgg_deprecated_notice(
"Using the plugin hook 'object:notifications' has been deprecated by the hook 'send:before', 'notifications'", 1.9);
unregisterEvent($type, $subtype)
getDeprecatedNotificationSubject($type, $subtype)
Get the deprecated subject.
if($guid==elgg_get_logged_in_user_guid()) $name
enqueueEvent($action, $type, $object)
Add a notification event to the queue.
getRecipient()
Get the recipient entity.
getActorGUID()
Get the GUID of the actor.
$guid
Removes an admin notice.
registerEvent($type, $subtype, array $actions=array())
events($event="", $object_type="", $function="", $priority=500, $call=false, $object=null)
Deprecated events core function.
getDeprecatedNotificationBody(Elgg_Notifications_Notification $notification, Elgg_Notifications_Event $event, $method)
Get the notification body using a pre-Elgg 1.9 plugin hook.
getActor()
Get the actor of the event.
getObject()
Get the object of the event.
existsDeprecatedNotificationOverride(Elgg_Notifications_Event $event)
Is someone using the deprecated override.
registerDeprecatedHandler($method, $handler)
Register a deprecated notification handler.
elgg_instanceof($entity, $type=null, $subtype=null, $class=null)
Checks if $entity is an ElggEntity and optionally for type and subtype.
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
get_user($guid)
Get a user object from a GUID.
setDeprecatedNotificationSubject($type, $subtype, $subject)
Set message subject for deprecated notification code.
__construct(Elgg_Notifications_SubscriptionsService $subscriptions, Elgg_Queue_Queue $queue, Elgg_PluginHooksService $hooks, Elgg_Access $access)
Constructor.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Sends a notice about deprecated use of a function, view, etc.
sendNotification(Elgg_Notifications_Event $event, $guid, $method)
Send a notification to a subscriber.
processQueue($stopTime)
Pull notification events from queue until stop time is reached.
has_access_to_entity($entity, $user=null)
Can a user access an entity.
getAction()
Get the name of the action.
getMethodsAsDeprecatedGlobal()
Provides a way to incrementally wean Elgg's notifications code from the global $NOTIFICATION_HANDLERS...
sendNotifications($event, $subscriptions)
Sends the notifications based on subscriptions.
$language
$vars['language'] $vars['lc'] if present, client will be sent long expires headers ...
getDeprecatedHandler($method)
Get a deprecated notification handler callback.
$actions
Provides common Elgg services.
_elgg_notify_user($to, $from, $subject, $message, array $params=null, $methods_override="")
Notify a user via their preferences.
getDescription()
Get a description of the event.