本文整理汇总了PHP中Parse::sendNotification方法的典型用法代码示例。如果您正苦于以下问题:PHP Parse::sendNotification方法的具体用法?PHP Parse::sendNotification怎么用?PHP Parse::sendNotification使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse
的用法示例。
在下文中一共展示了Parse::sendNotification方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parsePusher
function parsePusher($to, $insertedid, $message, $isChatroom = '0')
{
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "extensions" . DIRECTORY_SEPARATOR . "mobileapp" . DIRECTORY_SEPARATOR . "parse_push.php";
global $userid;
if ($isChatroom === '0') {
$rawMessage = array("name" => $_SESSION['cometchat']['user']['n'], "fid" => $userid, "m" => $message, "sent" => $insertedid);
if (strlen($insertedid) < 13) {
$rawMessage['id'] = $insertedid;
}
$channel = $_SERVER['HTTP_HOST'] . "USER_" . $to;
} else {
$parse_message = $_SESSION['cometchat']['user']['n'] . "@" . $_SESSION['cometchat']['chatroom']['n'] . ": " . $message;
if (strpos($message, "has shared a file") !== false) {
$parse_message = $_SESSION['cometchat']['user']['n'] . "@" . $_SESSION['cometchat']['chatroom']['n'] . ": " . "has shared a file";
}
$rawMessage = array("id" => $insertedid, "from" => $_SESSION['cometchat']['user']['n'], "fid" => $userid, "m" => sanitize($parse_message), "sent" => $insertedid, "cid" => $to);
$channel = $_SERVER['HTTP_HOST'] . "CHATROOM_" . $to;
}
$parse = new Parse();
$parse->sendNotification($channel, $rawMessage, $isChatroom);
}
示例2: parsePusher
function parsePusher($to, $insertedid, $message, $isChatroom = '0')
{
$emojiUTF8 = (include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "extensions" . DIRECTORY_SEPARATOR . "mobileapp" . DIRECTORY_SEPARATOR . "emoji_notification.php");
if (strpos($message, 'cometchat_smiley') !== false) {
preg_match_all('/<img[^>]+\\>/i', $message, $matches);
for ($i = 0; $i < sizeof($matches[0]); $i++) {
$msgpart = explode('/images/smileys/', $matches[0][$i]);
$imagenamearr = explode('"', $msgpart[1]);
$imagename = $imagenamearr[0];
$smileynamearr = explode('.', $imagename);
$smileyname = $smileynamearr[0];
if (!empty($imagename) && !empty($emojiUTF8[$imagename])) {
$message = str_replace($matches[0][$i], $emojiUTF8[$imagename], $message);
} else {
$message = str_replace($matches[0][$i], ':' . $smileyname . ':', $message);
}
}
}
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "extensions" . DIRECTORY_SEPARATOR . "mobileapp" . DIRECTORY_SEPARATOR . "parse_push.php";
global $userid;
global $channelprefix;
if ($isChatroom === '0') {
$rawMessage = array("name" => $_SESSION['cometchat']['user']['n'], "fid" => $userid, "m" => $message, "sent" => $insertedid);
if (strlen($insertedid) < 13) {
$rawMessage['id'] = $insertedid;
}
$channel = md5($channelprefix . "USER_" . $to . BASE_URL);
} else {
$chatroom_name = base64_decode($_SESSION['cometchat']['chatroom']['n']);
$parse_message = $_SESSION['cometchat']['user']['n'] . "@" . $chatroom_name . ": " . $message;
if (strpos($message, "has shared a file") !== false) {
$parse_message = $_SESSION['cometchat']['user']['n'] . "@" . $chatroom_name . ": " . "has shared a file";
}
$rawMessage = array("id" => $insertedid, "from" => $_SESSION['cometchat']['user']['n'], "fid" => $userid, "m" => sanitize($parse_message), "sent" => $insertedid, "cid" => $to);
$channel = md5($channelprefix . "CHATROOM_" . $to . BASE_URL);
}
$parse = new Parse();
$parse->sendNotification($channel, $rawMessage, $isChatroom);
}
示例3: parsePusherAnn
function parsePusherAnn($zero, $sent, $message, $isAnnouncement = '0', $insertedid)
{
global $userid;
if (file_exists(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "extensions" . DIRECTORY_SEPARATOR . "mobileapp" . DIRECTORY_SEPARATOR . "parse_push.php")) {
include_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "extensions" . DIRECTORY_SEPARATOR . "mobileapp" . DIRECTORY_SEPARATOR . "parse_push.php";
$announcementpushchannel = '';
if (file_exists(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . "announcements" . DIRECTORY_SEPARATOR . "config.php")) {
include_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . "announcements" . DIRECTORY_SEPARATOR . "config.php";
}
if (!empty($isAnnouncement)) {
$rawMessage = array("m" => $message, "sent" => $sent, "id" => $insertedid);
}
$parse = new Parse();
$parse->sendNotification($announcementpushchannel, $rawMessage, 0, 1);
}
}