本文整理匯總了PHP中Notify::notifySubscribe方法的典型用法代碼示例。如果您正苦於以下問題:PHP Notify::notifySubscribe方法的具體用法?PHP Notify::notifySubscribe怎麽用?PHP Notify::notifySubscribe使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Notify
的用法示例。
在下文中一共展示了Notify::notifySubscribe方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addComment
function addComment()
{
global $current_user;
$subscribe = false;
if (isset(Request::$post['subscribe'])) {
if (Request::$post['subscribe']) {
$subscribe = true;
}
}
if (!$current_user->id) {
return;
}
$comment = isset(Request::$post['comment']) ? Request::$post['comment'] : false;
$comment = trim(prepare_review($comment, '<em><i><strong><b><u><s>'));
if (!$comment) {
throw new Exception('comment body expected');
}
$post_id = Request::$post['id'];
$data = array();
if ($post_id) {
if (isset(Request::$post['comment_id']) && ($comment_id = Request::$post['comment_id'])) {
$data = MongoDatabase::addEventComment($post_id, $current_user->id, $comment, $comment_id);
if ($data) {
Notify::notifyEventCommentAnswer($data['commenter_id'], $post_id, $data['comment_id']);
}
} else {
$data = MongoDatabase::addEventComment($post_id, $current_user->id, $comment);
if ($data) {
Notify::notifyEventComment($data['user_id'], $post_id, $data['comment_id']);
}
}
}
if ($data) {
if ($subscribe) {
// на своё и так и так подписаны
if ($data['post']['user_id'] != $current_user->id) {
$query = 'SELECT `id` FROM `events` WHERE `mongoid`=' . Database::escape($post_id);
$intid = Database::sql2single($query);
if ($intid) {
/* @var $current_user User */
$current_user->setNotifyRule(UserNotify::UN_COMMENT_ANSWER, UserNotify::UNT_NOTIFY);
$current_user->save();
Notify::notifySubscribe($current_user->id, $intid);
}
}
}
}
}