vB_Notification
in package
Uses
vB_Trait_NoSerialize
Table of Contents
Constants
- DELIM = '.'
- FCM_SUPPORTED = \false
- GROUP_CHILDREN = \false
- GUESTS_CAN_SEND = \true
- RECIPIENT_KEY_PREFIX = '_'
- REGEX_ALLOWED_TYPENAME = "/[A-Za-z0-9_]+/"
- TYPENAME = 'Notification'
Properties
- $recipientsInfoCache : mixed
Methods
- __construct() : mixed
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __unserialize() : void
- __wakeup() : void
- clearMemory() : mixed
- combineNotifications() : mixed
- fetchLookupid() : string|null
- Fetch the lookupid based on the defineUnique() function & the class's "address".
- fetchPhraseArray() : array<string|int, mixed>
- Returns the phrase data used by privatemessage_notificationdetail template to render the individual notification.
- generateNotificationQueueKey() : string
- This function allows "collisions" to occur to limit or allow multiple notifications to a recipient.
- getCachedRecipientData() : mixed
- Returns the memory cached array of recipients' information like email, languageid etc.
- getFCMExtraData() : mixed
- getHasEmailNotificationOption() : mixed
- getHashedLookupid() : string|null
- Returns the md5() of the $lookupid or NULL if $lookupid is empty.
- getNotificationData() : mixed
- Returns the notification data.
- getRecipients() : array<string|int, int>
- Returns the array of recipients to receive this notification
- getTriggers() : mixed
- getUpdateEvents() : mixed
- handleUpdateEvents() : mixed
- Handle update/dismiss events. The required data in $eventData depends on the particular event.
- renderEmailPhrases() : string|bool
- Returns the rendered phrase used in notification emails for this type.
- shouldCombine() : mixed
Constants
DELIM
public
mixed
DELIM
= '.'
FCM_SUPPORTED
public
mixed
FCM_SUPPORTED
= \false
GROUP_CHILDREN
public
mixed
GROUP_CHILDREN
= \false
GUESTS_CAN_SEND
public
mixed
GUESTS_CAN_SEND
= \true
RECIPIENT_KEY_PREFIX
public
mixed
RECIPIENT_KEY_PREFIX
= '_'
REGEX_ALLOWED_TYPENAME
public
mixed
REGEX_ALLOWED_TYPENAME
= "/[A-Za-z0-9_]+/"
TYPENAME
public
mixed
TYPENAME
= 'Notification'
Properties
$recipientsInfoCache
public
static mixed
$recipientsInfoCache
= []
Methods
__construct()
public
final __construct([mixed $trigger = '' ][, mixed $notificationData = [] ][, mixed $recipients = [] ]) : mixed
Parameters
- $trigger : mixed = ''
- $notificationData : mixed = []
- $recipients : mixed = []
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
__wakeup()
public
__wakeup() : void
clearMemory()
public
final static clearMemory() : mixed
combineNotifications()
public
combineNotifications(mixed $addNotificationData, mixed $sourceNotificationData, mixed $addNotificationFromDb) : mixed
Parameters
- $addNotificationData : mixed
- $sourceNotificationData : mixed
- $addNotificationFromDb : mixed
fetchLookupid()
Fetch the lookupid based on the defineUnique() function & the class's "address".
public
final static fetchLookupid(array<string|int, mixed> $notificationData[, bool $skipValidation = false ]) : string|null
Parameters
- $notificationData : array<string|int, mixed>
-
Data required by this class's defineUnique() function to generate a lookupid. Usually includes:
- INT|NULL sender,
- INT|NULL sentbynodeid,
- String|NULL customdata
- $skipValidation : bool = false
-
Optional, default false. If true, defineUnique will skip any validation and assume that $notificationData is correct and that $notificationData contains all data required to create the unique key.
Tags
Return values
string|null —NULL only if defineUnique() returns empty string/array, indicating that this type should NEVER be grouped.
fetchPhraseArray()
Returns the phrase data used by privatemessage_notificationdetail template to render the individual notification.
public
static fetchPhraseArray(mixed $notificationData) : array<string|int, mixed>
Parameters
- $notificationData : mixed
Return values
array<string|int, mixed> —First element is the string phrase title, second element is an array of replacement data used by the phrase.
generateNotificationQueueKey()
This function allows "collisions" to occur to limit or allow multiple notifications to a recipient.
public
static generateNotificationQueueKey(mixed $notificationData) : string
Collisions are handled by the library based on the priority of the collided notification currently in the queue.
Parameters
- $notificationData : mixed
Return values
string —Note that empty string will be considered as an "always unique" request, meaning it will allow multiple notifications to a single recipient!
getCachedRecipientData()
Returns the memory cached array of recipients' information like email, languageid etc.
public
final getCachedRecipientData() : mixed
Return values
mixed —Nested array of user data keyed by userid. Each subarray holds an individual recipient's data including:
- string 'email'
- string 'username'
- int 'languageid'
- int 'emailnotification'
getFCMExtraData()
public
static getFCMExtraData(mixed $data, mixed $languageids) : mixed
Parameters
- $data : mixed
- $languageids : mixed
getHasEmailNotificationOption()
public
getHasEmailNotificationOption() : mixed
getHashedLookupid()
Returns the md5() of the $lookupid or NULL if $lookupid is empty.
public
final static getHashedLookupid(string $lookupid) : string|null
Parameters
- $lookupid : string
Return values
string|null —32 character string or NULL.
getNotificationData()
Returns the notification data.
public
final getNotificationData() : mixed
Return values
mixed —Notification data including
- int|NULL sender
- string|NULL lookupid
- int|NULL sentbynodeid
- string typename
- int lastsenttime
- string trigger
- int priority
getRecipients()
Returns the array of recipients to receive this notification
public
final getRecipients() : array<string|int, int>
Return values
array<string|int, int> —Recipients.
getTriggers()
public
static getTriggers() : mixed
getUpdateEvents()
public
static getUpdateEvents() : mixed
handleUpdateEvents()
Handle update/dismiss events. The required data in $eventData depends on the particular event.
public
static handleUpdateEvents(string $event, array<string|int, mixed> $eventData) : mixed
Children may also handle their specific events.
Parameters
- $event : string
-
One of the event strings in static::$updateEvents
- $eventData : array<string|int, mixed>
-
When $event is 'read_topic'|'read_channel', expects: int 'nodeid' int 'userid' (Optional)
renderEmailPhrases()
Returns the rendered phrase used in notification emails for this type.
public
static renderEmailPhrases(mixed $data) : string|bool
Parameters
- $data : mixed
Return values
string|bool —Rendered email phrase or False if it doesn't have an email or its email goes through the legacy email function.
shouldCombine()
public
final shouldCombine() : mixed