17 if (!is_array($appMessages) || count($appMessages) <= 0)
21 foreach ($appMessages as $appID => $tokenMessages)
23 foreach ($tokenMessages as $token => $messages)
25 foreach ($messages as $messageArray)
28 (!$this->allowEmptyMessage && trim($messageArray[
"MESSAGE"]) ==
'')
29 || !static::shouldBeSent($messageArray)
35 $message = static::getMessageInstance($token);
36 $id = random_int(1, 10000);
37 $message->setCustomIdentifier($id);
38 $message->setFromArray($messageArray);
39 $message->setCustomProperty(
'target', md5($messageArray[
"USER_ID"] . \CMain::GetServerUniqID()));
46 $messageBatch = $message->getBatch();
47 if($messageBatch && $messageBatch <>
'')
49 $batch .= $messageBatch;
53 $host = static::getHost();
54 $appModifier =
";tkey={$appID};";
57 $appModifier .=
"h={$host};";
59 $batch = $appModifier . $batch;
67 return $modifier . $batch;
72 $groupedMessages = array();
73 foreach ($arMessages as $keyToken => $messTokenData)
75 $count = count($messTokenData[
"messages"]);
76 for ($i = 0; $i < $count; $i++)
78 $mode = $messTokenData[
"mode"];
79 $mess = $messTokenData[
"messages"][$i];
80 $app_id = $mess[
"APP_ID"];
81 $groupedMessages[$mode][$app_id][$keyToken][] = $mess;
85 return $groupedMessages;
90 $groupedMessages = array();
91 foreach ($arMessages as $keyToken => $messTokenData)
93 $count = count($messTokenData[
"messages"]);
94 for ($i = 0; $i < $count; $i++)
96 $mode = $arMessages[$keyToken][
"mode"];
97 $mess = $messTokenData[
"messages"][$i];
98 $app_id = $mess[
"APP_ID"];
99 $groupedMessages[$app_id][$keyToken][] = $mess;
103 return $groupedMessages;