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


PHP DiscussHelper::getUnsubscribeLink方法代码示例

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


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

示例1: process

 function process()
 {
     $view = new EasyDiscussView();
     $date = DiscussHelper::getDate();
     $now = $date->toMySQL();
     $modelSubscribe = $view->getModel('Subscribe');
     $subscribers = $modelSubscribe->getSiteSubscribers($this->interval, $now);
     $total = count($subscribers);
     if (empty($total)) {
         return false;
     }
     foreach ($subscribers as $subscriber) {
         $notify = DiscussHelper::getNotification();
         $data = array();
         $rows = $modelSubscribe->getCreatedPostByInterval($subscriber->sent_out, $now);
         $posts = array();
         if ($rows) {
             foreach ($rows as $row) {
                 $row['categorylink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=categorie&layout=listings&category_id=' . $row['category_id'], false, true);
                 $row['link'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row['id'], false, true);
                 $row['userlink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=profile&id=' . $row['user_id'], false, true);
                 $category = DiscussHelper::getTable('Category');
                 $creator = DiscussHelper::getTable('Profile');
                 $category->load($row['category_id']);
                 $creator->load($row['user_id']);
                 $row['category'] = $category->getTitle();
                 $row['avatar'] = $creator->getAvatar();
                 $row['name'] = $creator->getName();
                 $row['date'] = DiscussDateHelper::toFormat($row['created'], '%b %e, %Y');
                 $row['message'] = DiscussHelper::parseContent($row['content']);
                 $posts[] = $row;
             }
         }
         $data['post'] = $posts;
         $data['total'] = count($data['post']);
         $data['unsubscribeLink'] = DiscussHelper::getUnsubscribeLink($subscriber, true, true);
         $subject = $date->toMySQL();
         switch (strtoupper($this->interval)) {
             case 'DAILY':
                 $subject = $date->toFormat('%F');
                 $data['interval'] = JText::_('today');
                 break;
             case 'WEEKLY':
                 $subject = $date->toFormat('%V');
                 $data['interval'] = JText::_('this week');
                 break;
             case 'MONTHLY':
                 $subject = $date->toFormat('%B');
                 $data['interval'] = JText::_('this month');
                 break;
         }
         if (!empty($data['post'])) {
             $notify->addQueue($subscriber->email, JText::sprintf('COM_EASYDISCUSS_YOUR_' . $this->interval . '_SUBSCRIPTION', $subject), '', 'email.subscription.site.interval.php', $data);
         }
         $subscribe = DiscussHelper::getTable('Subscribe');
         $subscribe->load($subscriber->id);
         $subscribe->sent_out = $now;
         $subscribe->store();
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:60,代码来源:subscription.php

示例2: sendNotification


//.........这里部分代码省略.........
         //$modelSubscribe		= self::getModel( 'Subscribe' );
         $subscribers = $modelSubscribe->getSiteSubscribers('instant', '', $post->category_id);
         $postSubscribers = $modelSubscribe->getPostSubscribers($post->parent_id);
         // This was added because the user allow site wide notification (as in all subscribers should get notified) but category subscribers did not get it.
         $catSubscribers = $modelSubscribe->getCategorySubscribers($post->id);
         if (!empty($subscribers)) {
             foreach ($subscribers as $subscriber) {
                 $subscriberEmails[] = $subscriber->email;
             }
         }
         if (!empty($postSubscribers)) {
             foreach ($postSubscribers as $postSubscriber) {
                 $postSubscriberEmails[] = $postSubscriber->email;
             }
         }
         if (!empty($catSubscribers)) {
             foreach ($catSubscribers as $catSubscriber) {
                 $catSubscriberEmails[] = $catSubscriber->email;
             }
         }
     }
     // Notify Participants if this is a reply
     if (!empty($parent) && $config->get('notify_participants') && ($isNew || $prevPostStatus == DISCUSS_ID_PENDING)) {
         $participantEmails = DiscussHelper::getHelper('Mailer')->_getParticipants($post->parent_id);
         $participantEmails = array_unique($participantEmails);
         // merge into owneremails. dirty hacks.
         if (count($participantEmails) > 0) {
             $newPostOwnerEmails = array_merge($newPostOwnerEmails, $participantEmails);
         }
     }
     if (!empty($adminEmails) || !empty($subscriberEmails) || !empty($newPostOwnerEmails) || !empty($postSubscriberEmails) || $config->get('notify_all')) {
         $emails = array_unique(array_merge($adminEmails, $subscriberEmails, $newPostOwnerEmails, $postSubscriberEmails, $catSubscriberEmails));
         // prepare email content and information.
         $emailData = array();
         $emailData['postTitle'] = $emailPostTitle;
         $emailData['postAuthor'] = $authorName;
         $emailData['postAuthorAvatar'] = $authorAvatar;
         $emailData['replyAuthor'] = $authorName;
         $emailData['replyAuthorAvatar'] = $authorAvatar;
         $emailData['comment'] = $post->content;
         $emailData['postContent'] = $post->trimEmail($post->content);
         $emailData['replyContent'] = $post->trimEmail($post->content);
         $attachments = $post->getAttachments();
         $emailData['attachments'] = $attachments;
         // get the correct post id in url, the parent post id should take precedence
         $postId = empty($parent) ? $post->id : $parentTable->id;
         $emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $postId, false, true);
         if ($config->get('notify_all') && $post->published == DISCUSS_ID_PUBLISHED) {
             $emailData['emailTemplate'] = 'email.subscription.site.new.php';
             $emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_QUESTION_ASKED', $post->id, $post->title);
             DiscussHelper::getHelper('Mailer')->notifyAllMembers($emailData, $newPostOwnerEmails);
         } else {
             //insert into mailqueue
             foreach ($emails as $email) {
                 if (in_array($email, $subscriberEmails) || in_array($email, $postSubscriberEmails) || in_array($email, $newPostOwnerEmails)) {
                     $doContinue = false;
                     // these are subscribers
                     if (!empty($subscribers)) {
                         foreach ($subscribers as $key => $value) {
                             if ($value->email == $email) {
                                 $emailData['unsubscribeLink'] = DiscussHelper::getUnsubscribeLink($subscribers[$key], true, true);
                                 $notify->addQueue($email, $emailSubject, '', $emailTemplate, $emailData);
                                 $doContinue = true;
                                 break;
                             }
                         }
                     }
                     if ($doContinue) {
                         continue;
                     }
                     if (!empty($postSubscribers)) {
                         foreach ($postSubscribers as $key => $value) {
                             if ($value->email == $email) {
                                 $emailData['unsubscribeLink'] = DiscussHelper::getUnsubscribeLink($postSubscribers[$key], true, true);
                                 $notify->addQueue($email, $emailSubject, '', $emailTemplate, $emailData);
                                 $doContinue = true;
                                 break;
                             }
                         }
                     }
                     if ($doContinue) {
                         continue;
                     }
                     if (!empty($newPostOwnerEmails)) {
                         $emailSubject = JText::sprintf('COM_EASYDISCUSS_NEW_POST_ADDED', $emailPostTitle, $post->id);
                         foreach ($newPostOwnerEmails as $ownerEmail) {
                             //$emailData['unsubscribeLink']	= DiscussHelper::getUnsubscribeLink( $ownerEmail, true, true);
                             $notify->addQueue($email, $emailSubject, '', $emailTemplate, $emailData);
                             $doContinue = true;
                             break;
                         }
                     }
                 } else {
                     // non-subscribers will not get the unsubscribe link
                     $notify->addQueue($email, $emailSubject, '', $emailTemplate, $emailData);
                 }
             }
         }
     }
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:101,代码来源:helper.php


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