本文整理汇总了PHP中FrontendModel::pushToAppleApp方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontendModel::pushToAppleApp方法的具体用法?PHP FrontendModel::pushToAppleApp怎么用?PHP FrontendModel::pushToAppleApp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrontendModel
的用法示例。
在下文中一共展示了FrontendModel::pushToAppleApp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notifyAdmin
/**
* Notify the admin
*
* @return void
* @param array $comment The comment that was submitted.
*/
public static function notifyAdmin(array $comment)
{
// don't notify admin in case of spam
if ($comment['status'] == 'spam') {
return;
}
// build data for pushnotification
if ($comment['status'] == 'moderation') {
$alert = array('loc-key' => 'NEW_COMMENT_TO_MODERATE');
} else {
$alert = array('loc-key' => 'NEW_COMMENT');
}
// get count of unmoderated items
$badge = (int) FrontendModel::getDB()->getVar('SELECT COUNT(i.id)
FROM blog_comments AS i
WHERE i.status = ? AND i.language = ?
GROUP BY i.status', array('moderation', FRONTEND_LANGUAGE));
// reset if needed
if ($badge == 0) {
$badge = null;
}
// build data
$data = array('data' => array('endpoint' => SITE_URL . '/api/1.0', 'comment_id' => $comment['id']));
// push it
FrontendModel::pushToAppleApp($alert, $badge, null, $data);
// get settings
$notifyByMailOnComment = FrontendModel::getModuleSetting('blog', 'notify_by_email_on_new_comment', false);
$notifyByMailOnCommentToModerate = FrontendModel::getModuleSetting('blog', 'notify_by_email_on_new_comment_to_moderate', false);
// create URLs
$URL = SITE_URL . FrontendNavigation::getURLForBlock('blog', 'detail') . '/' . $comment['post_url'] . '#comment-' . $comment['id'];
$backendURL = SITE_URL . FrontendNavigation::getBackendURLForBlock('comments', 'blog') . '#tabModeration';
// notify on all comments
if ($notifyByMailOnComment) {
// comment to moderate
if ($comment['status'] == 'moderation') {
// set variables
$variables['message'] = vsprintf(FL::msg('BlogEmailNotificationsNewCommentToModerate'), array($comment['author'], $URL, $comment['post_title'], $backendURL));
} elseif ($comment['status'] == 'published') {
// set variables
$variables['message'] = vsprintf(FL::msg('BlogEmailNotificationsNewComment'), array($comment['author'], $URL, $comment['post_title']));
}
// send the mail
FrontendMailer::addEmail(FL::msg('NotificationSubject'), FRONTEND_CORE_PATH . '/layout/templates/mails/notification.tpl', $variables);
} elseif ($notifyByMailOnCommentToModerate && $comment['status'] == 'moderation') {
// set variables
$variables['message'] = vsprintf(FL::msg('BlogEmailNotificationsNewCommentToModerate'), array($comment['author'], $URL, $comment['post_title'], $backendURL));
// send the mail
FrontendMailer::addEmail(FL::msg('NotificationSubject'), FRONTEND_CORE_PATH . '/layout/templates/mails/notification.tpl', $variables);
}
}