当前位置: 首页>>代码示例>>PHP>>正文


PHP FrontendModel::pushToMicrosoftApp方法代码示例

本文整理汇总了PHP中FrontendModel::pushToMicrosoftApp方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontendModel::pushToMicrosoftApp方法的具体用法?PHP FrontendModel::pushToMicrosoftApp怎么用?PHP FrontendModel::pushToMicrosoftApp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FrontendModel的用法示例。


在下文中一共展示了FrontendModel::pushToMicrosoftApp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: notifyAdmin

    /**
     * Notify the admin
     *
     * @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);
        FrontendModel::pushToMicrosoftApp('NEW_COMMENT', $badge, null, null, null, null, '/MainPage.xaml?website=' . SITE_URL, null);
        // @todo: clean this up
        // 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);
        }
    }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:57,代码来源:model.php


注:本文中的FrontendModel::pushToMicrosoftApp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。