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


PHP DiscussRouter::getRoutedURL方法代码示例

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


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

示例1: getButtonHTML

    public static function getButtonHTML($row, $position = 'vertical')
    {
        $config = DiscussHelper::getConfig();
        if (!$config->get('integration_digg')) {
            return '';
        }
        $dataURL = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row->id, false, true);
        $dataURL = urlencode($dataURL);
        $html = '';
        if ($position == 'horizontal') {
            $class = 'DiggCompact';
        } else {
            $class = 'DiggMedium';
        }
        $html = '<script type="text/javascript">(function() {
		var s = document.createElement(\'SCRIPT\'), s1 = document.getElementsByTagName(\'SCRIPT\')[0];
		s.type = \'text/javascript\';
		s.async = true;
		s.src = \'http://widgets.digg.com/buttons.js\';
		s1.parentNode.insertBefore(s, s1);
		})();
		</script>
		<!-- Wide Button -->
		<div class="social-button digg-share"><a class="DiggThisButton ' . $class . '" href="https://digg.com/submit?url=' . $dataURL . '&amp;title=' . $row->title . '"></a></div>';
        return $html;
    }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:26,代码来源:digg.php

示例2: 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

示例3: requestAccess

 function requestAccess()
 {
     $session = JFactory::getSession();
     if ($session->has('twitter_oauth_request_token', 'discuss')) {
         $session->clear('twitter_oauth_request_token', 'discuss');
     }
     $config = DiscussHelper::getConfig();
     $consumerKey = $config->get('integration_twitter_consumer_key');
     $consumerSecretKey = $config->get('integration_twitter_consumer_secret_key');
     $consumer = new DiscussTwitterOAuth($consumerKey, $consumerSecretKey);
     $callback = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&controller=twitter&task=authorizeAccess', false, true);
     $request_token = $consumer->getRequestToken($callback);
     $session->set('twitter_oauth_request_token', "oauth_token=" . $request_token['oauth_token'] . ",oauth_token_secret=" . $request_token['oauth_token_secret'], 'discuss');
     $this->setRedirect($consumer->getAuthorizeURL($request_token['oauth_token'], FALSE));
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:15,代码来源:twitter.php

示例4: addOpenGraph

 public function addOpenGraph(DiscussPost $post)
 {
     // Use facebook developer tools to check the result
     // https://developers.facebook.com/tools/debug/og
     $doc = JFactory::getDocument();
     $config = DiscussHelper::getConfig();
     // Search for an image in the content
     $image = self::searchImage($post->content);
     if ($image) {
         $doc->addCustomTag('<meta property="og:image" content="' . $image . '" />');
     }
     if ($config->get('integration_facebook_like')) {
         $appId = $config->get('integration_facebook_like_appid');
         if ($appId) {
             $doc->addCustomTag('<meta property="fb:app_id" content="' . $appId . '" />');
         }
         $adminId = $config->get('integration_facebook_like_admin');
         if ($adminId) {
             $doc->addCustomTag('<meta property="fb:admins" content="' . $adminId . '" />');
         }
     }
     // Add post title info here.
     $doc->addCustomTag('<meta property="og:title" content="' . $post->title . '" />');
     // Add post content.
     $maxContent = 350;
     // Remove bbcode tags from the content.
     $content = EasyDiscussParser::removeCodes($post->content);
     $content = strip_tags($post->content);
     if (JString::strlen($content) > $maxContent) {
         $content = JString::substr($content, 0, $maxContent) . '...';
     }
     // Add content to description
     $doc->addCustomTag('<meta property="og:description" content="' . $content . '" />');
     // Add the type of the og tag.
     $doc->addCustomTag('<meta property="og:type" content="article" />');
     // Add the URL for this page.
     $url = DiscussRouter::getRoutedURL(DiscussRouter::getPostRoute($post->id, false, true));
     $doc->addCustomTag('<meta property="og:url" content="' . $url . '" />');
     $doc->setTitle($post->title);
     $doc->setDescription($content);
     return true;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:42,代码来源:facebook.php

示例5: getButtonHTML

 public static function getButtonHTML($row, $position = 'vertical')
 {
     $config = DiscussHelper::getConfig();
     if (!$config->get('integration_linkedin')) {
         return '';
     }
     $button = $config->get('integration_linkedin_button');
     $dataURL = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row->id, false, true);
     if ($position == 'horizontal') {
         $counter = ' data-counter="right"';
     } else {
         $counter = ' data-counter="top"';
     }
     $html = '';
     $html = '<div class="social-button linkedin-share">';
     $html .= '<script type="text/javascript" src="https://platform.linkedin.com/in.js"></script>';
     $html .= '<script type="in/share" data-url="' . $dataURL . '"' . $counter . '></script>';
     $html .= '</div>';
     return $html;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:20,代码来源:linkedin.php

示例6: getButtonHTML

 public static function getButtonHTML($row, $position = 'vertical')
 {
     $config = DiscussHelper::getConfig();
     if (!$config->get('integration_twitter_button')) {
         return '';
     }
     $html = '';
     $style = $config->get('integration_twitter_button_style');
     $dataURL = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row->id, false, true);
     $width = '80px';
     if ($position == 'horizontal') {
         $style = 'horizontal';
         $width = '80px';
     } else {
         $width = '55px';
         $style = 'vertical';
     }
     $html = '<div class="social-button retweet" style="width: ' . $width . '"><a href="http://twitter.com/share" class="twitter-share-button" data-url="' . $dataURL . '" data-counturl="' . $dataURL . '" data-count="' . $style . '">Tweet</a><script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script></div>';
     return $html;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:20,代码来源:twitter.php

示例7: getButtonHTML

 public static function getButtonHTML($row, $position = 'vertical')
 {
     $config = DiscussHelper::getConfig();
     if (!$config->get('integration_googleshare')) {
         return '';
     }
     $size = $config->get('integration_googleshare_layout');
     $dataURL = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row->id, false, true);
     $googleShare = '';
     if ($position == 'horizontal') {
         $size = 'medium';
         $width = '170px';
     } else {
         $size = 'tall';
         $width = '50px';
     }
     $googleShare .= '<div class="social-button google-share" style="width:' . $width . '">';
     $googleShare .= '<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>';
     $googleShare .= '<g:plus action="share" size="' . $size . '" href="' . $dataURL . '"></g:plus>';
     $googleShare .= '</div>';
     return $googleShare;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:22,代码来源:googleshare.php

示例8: getLikeHTML

 public static function getLikeHTML($row, $position = 'vertical')
 {
     $config = DiscussHelper::getConfig();
     if (!$config->get('integration_facebook_like')) {
         return '';
     }
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $language = explode('-', $language);
     if (count($language) != 2) {
         $language = array('en', 'GB');
     }
     $layout = $config->get('integration_facebook_like_layout');
     $faces = $config->get('integration_facebook_like_faces') ? 'true' : 'false';
     $width = $config->get('integration_facebook_like_width');
     $verb = $config->get('integration_facebook_like_verb');
     $theme = $config->get('integration_facebook_like_theme');
     $send = $config->get('integration_facebook_like_send') ? 'true' : 'false';
     $height = $faces == 'true' ? '70' : '30';
     $locale = $language[0] . '_' . JString::strtoupper($language[1]);
     $fb = DiscussHelper::getHelper('Facebook');
     $fb->addOpenGraph($row);
     $url = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row->id, true, true);
     $html = '';
     if ($position == 'horizontal') {
         $layout = 'button_count';
     } else {
         $layout = 'box_count';
     }
     $html = '<div class="social-button facebook-like">';
     if ($config->get('integration_facebook_scripts')) {
         $html .= '<div id="fb-root"></div><script src="https://connect.facebook.net/' . $locale . '/all.js#xfbml=1"></script>';
     }
     $html .= '<fb:like href="' . $url . '" send="' . $send . '" layout="' . $layout . '" action="' . $verb . '" ';
     $html .= 'locale="' . $locale . '" colorscheme="' . $theme . '" show_faces="' . $faces . '" style="height: ' . $height . ';" height="' . $height . '"></fb:like>';
     $html .= '</div>';
     return $html;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:38,代码来源:facebook.php

示例9: like


//.........这里部分代码省略.........
     $postId = JRequest::getInt('postid');
     $post = DiscussHelper::getTable('Post');
     $post->load($postId);
     // Determine if the likes are enabled or not.
     if ($post->isReply() && !$config->get('main_likes_replies') || $post->isQuestion() && !$config->get('main_likes_discussions')) {
         return $ajax->reject();
     }
     // Do not allow non logged in users to like an item.
     if (!$my->id) {
         return $ajax->reject();
     }
     // Determine if the current user request is to like the post item or unlike.
     $isLike = !$post->isLikedBy($my->id);
     if ($isLike) {
         DiscussHelper::getHelper('Likes')->addLikes($post->id, 'post', $my->id);
     } else {
         // If this is an unlike request, we need to remove it.
         DiscussHelper::getHelper('Likes')->removeLikes($post->id, $my->id);
     }
     // Get the main question if this is a reply.
     if ($post->isReply()) {
         $question = DiscussHelper::getTable('Post');
         $question->load($post->parent_id);
     } else {
         $question = $post;
     }
     // Add JomSocial activity item if the post for the main discussion item if it has been liked.
     if ($post->published && $isLike) {
         // EasySocial instegrations
         DiscussHelper::getHelper('EasySocial')->notify('new.likes', $post, $question);
         DiscussHelper::getHelper('jomsocial')->addActivityLikes($post, $question);
         DiscussHelper::getHelper('easysocial')->likesStream($post, $question);
     }
     // Add a badge record for the user when they like a discussion
     // The record should only be added when the user liked another user's post.
     if ($post->isQuestion() && $isLike && $my->id != $post->user_id) {
         // Add logging for user.
         DiscussHelper::getHelper('History')->log('easydiscuss.like.discussion', $my->id, JText::sprintf('COM_EASYDISCUSS_BADGES_HISTORY_LIKE_DISCUSSION', $question->title), $post->id);
         DiscussHelper::getHelper('Badges')->assign('easydiscuss.like.discussion', $my->id);
         DiscussHelper::getHelper('Points')->assign('easydiscuss.like.discussion', $my->id);
         // Assign badge for EasySocial
         DiscussHelper::getHelper('EasySocial')->assignBadge('like.question', $my->id, JText::sprintf('COM_EASYDISCUSS_BADGES_HISTORY_LIKE_DISCUSSION', $question->title));
     }
     // Add a badge record for the user when they like a discussion
     // The record should only be added when the user liked another user's post.
     if ($post->isReply() && $isLike && $my->id != $post->user_id) {
         // Add logging for user.
         DiscussHelper::getHelper('History')->log('easydiscuss.like.reply', $my->id, JText::sprintf('COM_EASYDISCUSS_BADGES_HISTORY_LIKE_REPLY', $post->title), $post->id);
         DiscussHelper::getHelper('Badges')->assign('easydiscuss.like.reply', $my->id);
         DiscussHelper::getHelper('Points')->assign('easydiscuss.like.reply', $my->id);
     }
     // Remove history when a user unlikes a discussion.
     if ($post->isQuestion() && !$isLike && $my->id != $post->user_id) {
         // Remove unlike
         DiscussHelper::getHelper('History')->removeLog('easydiscuss.like.discussion', $my->id, $post->id);
         DiscussHelper::getHelper('Badges')->assign('easydiscuss.unlike.discussion', $my->id);
         DiscussHelper::getHelper('Points')->assign('easydiscuss.unlike.discussion', $my->id);
     }
     // Remove history when a user unlikes a reply.
     if ($post->isReply() && !$isLike && $my->id != $post->user_id) {
         // Remove unlike
         DiscussHelper::getHelper('History')->removeLog('easydiscuss.like.reply', $my->id, $post->id);
         DiscussHelper::getHelper('Badges')->assign('easydiscuss.unlike.reply', $my->id);
         DiscussHelper::getHelper('Points')->assign('easydiscuss.unlike.reply', $my->id);
     }
     // Add notifications to the post owner.
     if ($post->user_id != $my->id) {
         $notification = DiscussHelper::getTable('Notifications');
         $text = $post->isQuestion() ? 'COM_EASYDISCUSS_LIKE_DISCUSSION_NOTIFICATION_TITLE' : 'COM_EASYDISCUSS_LIKE_REPLY_NOTIFICATION_TITLE';
         $title = $question->title;
         $likeType = $post->isQuestion() ? DISCUSS_NOTIFICATIONS_LIKES_DISCUSSION : DISCUSS_NOTIFICATIONS_LIKES_REPLIES;
         $notification->bind(array('title' => JText::sprintf($text, $title), 'cid' => $question->id, 'type' => $likeType, 'target' => $post->user_id, 'author' => $my->id, 'permalink' => 'index.php?option=com_easydiscuss&view=post&id=' . $question->id));
         $notification->store();
     }
     // Only send notification email if the post owner is a registered user.
     // And, it would not send email if the user that is liking on his own item.
     if ($post->user_id && $my->id != $post->user_id && $isLike && $config->get('notify_owner_like')) {
         // Send email to post / reply author that someone liked their post.
         $notify = DiscussHelper::getNotification();
         $profile = DiscussHelper::getTable('Profile');
         $profile->load($my->id);
         $emailSubject = JText::sprintf('COM_EASYDISCUSS_USER_LIKED_YOUR_POST', $profile->getName());
         $emailTemplate = 'email.like.post.php';
         $emailData = array();
         $emailData['authorName'] = $profile->getName();
         $emailData['authorAvatar'] = $profile->getAvatar();
         $emailData['replyContent'] = $post->content;
         $emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $question->id, false, true);
         $recipient = JFactory::getUser($post->user_id);
         $notify->addQueue($recipient->email, $emailSubject, '', $emailTemplate, $emailData);
     }
     // Get the like's text.
     $likeText = DiscussHelper::getHelper('Likes')->getLikesHTML($post->id, $my->id, 'post');
     if (!$likeText) {
         $likeText = JText::_('COM_EASYDISCUSS_BE_THE_FIRST_TO_LIKE');
     }
     $count = DiscussHelper::getModel('Likes')->getTotalLikes($postId);
     $ajax->resolve($likeText, $count);
     return $ajax->send();
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:101,代码来源:view.ajax.php

示例10: notify

 /**
  * Notify the user when a new conversation is started or replied.
  *
  * @since	3.0
  * @access	public
  * @param	DiscussConversationMessage	The message object that is formatted
  *
  */
 public function notify(DiscussConversationMessage $message)
 {
     $author = DiscussHelper::getTable('Profile');
     $author->load($message->created_by);
     $model = DiscussHelper::getModel('Conversation');
     $result = $model->getParticipants($this->id, $message->created_by);
     $recipient = DiscussHelper::getTable('Profile');
     $recipient->load($result[0]);
     $emailData = array();
     $emailData['conversationLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=conversation&layout=read&id=' . $this->id, false, true);
     $emailData['authorName'] = $author->getName();
     $emailData['authorAvatar'] = $author->getAvatar();
     $emailData['content'] = $message->message;
     $subject = JText::sprintf('COM_EASYDISCUSS_CONVERSATION_EMAIL_SUBJECT', $author->getName());
     $notification = DiscussHelper::getNotification();
     $notification->addQueue($recipient->user->email, $subject, '', 'email.conversation.reply.php', $emailData);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:25,代码来源:conversation.php

示例11: addActivityBadges

 public function addActivityBadges($badge)
 {
     $core = JPATH_ROOT . '/components/com_community/libraries/core.php';
     $config = DiscussHelper::getConfig();
     $my = JFactory::getUser();
     if (!JFile::exists($core)) {
         return false;
     }
     require_once $core;
     $lang = JFactory::getLanguage();
     $lang->load('com_easydiscuss', JPATH_ROOT);
     // We do not want to add activities if new badges activity is disabled.
     if (!$config->get('integration_jomsocial_activity_badges', 0)) {
         return false;
     }
     $link = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=badges&layout=listings&id=' . $badge->id);
     $content = '<img src="' . $badge->getAvatar() . '" />';
     $title = $this->getActivityTitle($badge->title);
     $obj = new stdClass();
     $obj->title = JText::sprintf('COM_EASYDISCUSS_JOMSOCIAL_ACTIVITY_BADGES_ITEM', $link, $title);
     $obj->content = $content;
     $obj->cmd = 'easydiscuss.badges.earned';
     $obj->actor = $my->id;
     $obj->target = 0;
     $obj->like_id = $badge->uniqueId;
     $obj->like_type = 'com_easydiscuss_badge';
     $obj->comment_id = $badge->uniqueId;
     $obj->comment_type = 'com_easydiscuss_badge';
     $obj->app = 'easydiscuss';
     $obj->cid = $badge->uniqueId;
     // add JomSocial activities
     CFactory::load('libraries', 'activities');
     CActivityStream::add($obj);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:34,代码来源:jomsocial.php

示例12: submit


//.........这里部分代码省略.........
         }
         // @trigger: onAfterSave
         DiscussEventsHelper::onContentAfterSave('post', $post, $isNew);
         // The category_id for the replies should change too
         $postTable->moveChilds($postTable->id, $postTable->category_id);
         $lastId = $postTable->id;
         // Bind file attachments
         $postTable->bindAttachments();
         $message = JText::_('COM_EASYDISCUSS_POST_SAVED');
         $date = DiscussHelper::getDate();
         //@task: Save tags
         $tags = JRequest::getVar('tags', '', 'POST');
         if (!empty($tags)) {
             $tagModel = $this->getModel('Tags');
             foreach ($tags as $tag) {
                 if (!empty($tag)) {
                     $tagTable = JTable::getInstance('Tags', 'Discuss');
                     //@task: Only add tags if it doesn't exist.
                     if (!$tagTable->exists($tag)) {
                         $tagInfo['title'] = JString::trim($tag);
                         $tagInfo['alias'] = DiscussHelper::getAlias($tag, 'tag');
                         $tagInfo['created'] = $date->toMySQL();
                         $tagInfo['published'] = 1;
                         $tagInfo['user_id'] = $user->id;
                         $tagTable->bind($tagInfo);
                         $tagTable->store();
                     } else {
                         $tagTable->load($tag, true);
                     }
                     $postTagInfo = array();
                     //@task: Store in the post tag
                     $postTagTable = JTable::getInstance('PostsTags', 'Discuss');
                     $postTagInfo['post_id'] = $postTable->id;
                     $postTagInfo['tag_id'] = $tagTable->id;
                     $postTagTable->bind($postTagInfo);
                     $postTagTable->store();
                 }
             }
         }
         $isNew = empty($id) ? true : false;
         if (($isNew || $prevPostStatus == DISCUSS_ID_PENDING) && $postTable->published == DISCUSS_ID_PUBLISHED) {
             $owner = $isNew ? $user->id : $postTable->user_id;
             DiscussHelper::sendNotification($postTable, $parent, $isNew, $owner, $prevPostStatus);
             // auto subscription
             if ($config->get('main_autopostsubscription') && $config->get('main_postsubscription') && $postTable->user_type != 'twitter' && !empty($postTable->parent_id)) {
                 // process only if this is a reply
                 //automatically subscribe this user into this reply
                 $replier = JFactory::getUser($postTable->user_id);
                 $subscription_info = array();
                 $subscription_info['type'] = 'post';
                 $subscription_info['userid'] = !empty($postTable->user_id) ? $postTable->user_id : '0';
                 $subscription_info['email'] = !empty($postTable->user_id) ? $replier->email : $postTable->poster_email;
                 $subscription_info['cid'] = $postTable->parent_id;
                 $subscription_info['member'] = !empty($postTable->user_id) ? '1' : '0';
                 $subscription_info['name'] = !empty($postTable->user_id) ? $replier->name : $postTable->poster_name;
                 $subscription_info['interval'] = 'instant';
                 //get frontend subscribe table
                 $susbcribeModel = DiscussHelper::getModel('Subscribe');
                 $sid = '';
                 if ($subscription_info['userid'] == 0) {
                     $sid = $susbcribeModel->isPostSubscribedEmail($subscription_info);
                     if (empty($sid)) {
                         $susbcribeModel->addSubscription($subscription_info);
                     }
                 } else {
                     $sid = $susbcribeModel->isPostSubscribedUser($subscription_info);
                     if (empty($sid['id'])) {
                         //add new subscription.
                         $susbcribeModel->addSubscription($subscription_info);
                     }
                 }
             }
             // only if the post is a discussion
             if ($config->get('integration_pingomatic') && empty($postTable->parent_id)) {
                 $pingo = DiscussHelper::getHelper('Pingomatic');
                 $urls = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $postTable->id, true, true);
                 $pingo->ping($postTable->title, $urls);
             }
         }
         $pid = '';
         if (!empty($parent)) {
             $pid = '&pid=' . $parent;
         }
         $task = $this->getTask();
         switch ($task) {
             case 'apply':
                 $redirect = 'index.php?option=com_easydiscuss&view=post&id=' . $postTable->id;
                 break;
             case 'save':
                 $redirect = 'index.php?option=com_easydiscuss&view=posts';
                 break;
             case 'savePublishNew':
             default:
                 $redirect = 'index.php?option=com_easydiscuss&view=post';
                 break;
         }
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_DISCUSSION_SAVED'), DISCUSS_QUEUE_SUCCESS);
         $this->setRedirect($redirect);
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:101,代码来源:posts.php

示例13: submit

 public function submit()
 {
     $config = DiscussHelper::getConfig();
     $my = JFactory::getUser();
     $id = JRequest::getInt('id');
     $app = JFactory::getApplication();
     $post = DiscussHelper::getTable('Post');
     $state = $post->load($id);
     $acl = DiscussHelper::getHelper('ACL');
     if (!$post->id || !$state) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_POST_ID'), DISCUSS_QUEUE_ERROR);
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
         $app->close();
     }
     // Get the URL to the discussion.
     $url = DiscussRouter::getPostRoute($post->id, false);
     if ($post->isReply()) {
         $url = DiscussRouter::getPostRoute($post->parent_id, false);
     }
     if (!$acl->allowed('send_report')) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_YOU_DO_NOT_HAVE_PERMISION_TO_SUBMIT_REPORT'), DISCUSS_QUEUE_ERROR);
         $app->redirect($url);
         $app->close();
     }
     if (!$config->get('main_report')) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_REPORT_HAS_BEEN_DISABLED_BY_ADMINISTRATOR'), DISCUSS_QUEUE_ERROR);
         $app->redirect($url);
         $app->close();
     }
     $message = JRequest::getString('reporttext', '');
     if (empty($message)) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_REPORT_EMPTY_TEXT'), DISCUSS_QUEUE_ERROR);
         $app->redirect($url);
         $app->close();
     }
     $date = DiscussHelper::getDate();
     $report = DiscussHelper::getTable('Report');
     $report->created_by = $my->id;
     $report->post_id = $post->id;
     $report->reason = $message;
     $report->created = $date->toMySQL();
     if (!$report->store()) {
         DiscussHelper::setMessageQueue($report->getError(), DISCUSS_QUEUE_ERROR);
         $app->redirect($url);
         $app->close();
     }
     // Mark post as reported.
     $report->markPostReport();
     $threshold = $config->get('main_reportthreshold', 15);
     $totalReports = $report->getReportCount();
     $redirectMessage = JText::_('COM_EASYDISCUSS_REPORT_SUBMITTED');
     // Check if the number of reports for this post exceeded the threshold.
     if ($totalReports > $reportThreshold) {
         $owner = $post->getOwner();
         $date = DiscussHelper::getDate($post->created);
         $emailData = array();
         $emailData['postContent'] = $post->content;
         $emailData['postAuthor'] = $owner->name;
         $emailData['postAuthorAvatar'] = $owner->avatar;
         $emailData['postDate'] = $date->toFormat();
         $emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false, true);
         $emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_REPORT_REQUIRED_YOUR_ATTENTION', JString::substr($postTbl->content, 0, 15)) . '...';
         $emailData['emailTemplate'] = 'email.post.attention.php';
         if ($post->isReply()) {
             $emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $post->parent_id, false, true);
         }
         DiscussHelper::getHelper('Mailer')->notifyAdministrators($emailData, array(), $config->get('notify_admin'), $config->get('notify_moderator'));
         $redirectMessage = JText::_('COM_EASYDISCUSS_REPORT_SUBMITTED_BUT_POST_MARKED_AS_REPORT');
     }
     DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_REPORT_SUBMITTED'), DISCUSS_QUEUE_SUCCESS);
     $app->redirect($url);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:72,代码来源:reports.php

示例14: share

 /**
  * Shares a new content on Facebook
  **/
 public function share($post)
 {
     $config = DiscussHelper::getConfig();
     $content = $post->content;
     $content = EasyDiscussParser::bbcode($content);
     JFactory::getLanguage()->load('com_easydiscuss', JPATH_ROOT);
     $editor = DiscussHelper::getEditorType('question');
     if ($editor == 'html') {
         // @rule: Match images from content
         $pattern = '/<\\s*img [^\\>]*src\\s*=\\s*[\\""\']?([^\\""\'\\s>]*)/i';
     } else {
         $pattern = '/\\[img\\](.*?)\\[\\/img\\]/ims';
     }
     preg_match($pattern, $content, $matches);
     $image = '';
     if ($matches) {
         $image = isset($matches[1]) ? $matches[1] : '';
         if (JString::stristr($matches[1], 'https://') === false && JString::stristr($matches[1], 'http://') === false && !empty($image)) {
             $image = DISCUSS_JURIROOT . '/' . ltrim($image, '/');
         }
     }
     $text = strip_tags($content);
     // @TODO: Configurable content length.
     $maxLength = 200;
     $text = JString::strlen($text) > $maxLength ? JString::substr($text, 0, $maxLength) . '...' : $text;
     $url = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false, true);
     $this->_access_token = preg_replace('/&expires=.*/i', '', $this->_access_token);
     $jConfig = DiscussHelper::getJConfig();
     $params = array('link' => $url, 'name' => $post->title, 'actions' => '{"name": "' . JText::_('COM_EASYDISCUSS_AUTOPOST_FB_VIEWON_BUTTON') . '", "link" : "' . $url . '"}', 'description' => $text, 'message' => JString::substr(strip_tags($text), 0, 30) . '...', 'access_token' => $this->_access_token);
     if (!empty($image)) {
         // Since Facebook does not allow https images we need to replace them here.
         $params['picture'] = str_ireplace('https://', 'http://', $image);
     } else {
         $params['picture'] = DISCUSS_JURIROOT . '/media/com_easydiscuss/images/default_facebook.png';
         $params['source'] = rtrim(JURI::root(), '/') . '/media/com_easydiscuss/images/default_facebook.png';
     }
     // @rule: See if we need to post this to a Facebook page instead.
     $pageId = $config->get('main_autopost_facebook_page_id');
     if (!empty($pageId)) {
         $pages = JString::trim($pageId);
         $pages = explode(',', $pages);
         $total = count($pages);
         // @rule: Test if there are any pages at all the user can access
         $accounts = parent::api('/me/accounts', array('access_token' => $this->_access_token));
         if (is_array($accounts) && isset($accounts['data'])) {
             for ($i = 0; $i < $total; $i++) {
                 foreach ($accounts['data'] as $page) {
                     if ($page['id'] == $pages[$i]) {
                         $params['access_token'] = $page['access_token'];
                         $query = parent::api('/' . $page['id'] . '/feed', 'post', $params);
                     }
                 }
             }
         }
     } else {
         // @rule: If this is just a normal posting, just post it on their page.
         $query = parent::api('/me/feed', 'post', $params);
     }
     $success = isset($query['id']) ? true : false;
     return $success;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:64,代码来源:helper.php

示例15: submit


//.........这里部分代码省略.........
             foreach ($tags as $tag) {
                 if (!empty($tag)) {
                     $tagTable = DiscussHelper::getTable('Tags');
                     //@task: Only add tags if it doesn't exist.
                     if (!$tagTable->exists($tag)) {
                         $tagTable->set('title', JString::trim($tag));
                         $tagTable->set('alias', DiscussHelper::getAlias($tag, 'tag'));
                         $tagTable->set('created', DiscussHelper::getDate()->toMySQL());
                         $tagTable->set('published', 1);
                         $tagTable->set('user_id', $my->id);
                         $tagTable->store();
                     } else {
                         $tagTable->load($tag, true);
                     }
                     $postTagInfo = array();
                     //@task: Store in the post tag
                     $postTagTable = DiscussHelper::getTable('PostsTags');
                     $postTagInfo['post_id'] = $post->id;
                     $postTagInfo['tag_id'] = $tagTable->id;
                     $postTagTable->bind($postTagInfo);
                     $postTagTable->store();
                 }
             }
         }
     }
     // prepare email content and information.
     $profile = DiscussHelper::getTable('Profile');
     $profile->load($my->id);
     // For use within the emails.
     $emailData = array();
     $emailData['postTitle'] = $post->title;
     $emailData['postAuthor'] = $profile->id ? $profile->getName() : $post->poster_name;
     $emailData['postAuthorAvatar'] = $profile->getAvatar();
     $emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false, true);
     $emailContent = $post->content;
     if ($post->content_type != 'html') {
         // the content is bbcode. we need to parse it.
         $emailContent = EasyDiscussParser::bbcode($emailContent);
         $emailContent = EasyDiscussParser::removeBrTag($emailContent);
     }
     // If post is html type we need to strip off html codes.
     if ($post->content_type == 'html') {
         $emailContent = strip_tags($post->content);
     }
     $emailContent = $post->trimEmail($emailContent);
     $attachments = $post->getAttachments();
     $emailData['attachments'] = $attachments;
     $emailData['postContent'] = $emailContent;
     $emailData['post_id'] = $post->id;
     $emailData['cat_id'] = $post->category_id;
     $emailData['emailTemplate'] = 'email.subscription.site.new.php';
     $emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_QUESTION_ASKED', $post->id, $post->title);
     if ($isModerate) {
         // Generate hashkeys to map this current request
         $hashkey = DiscussHelper::getTable('HashKeys');
         $hashkey->uid = $post->id;
         $hashkey->type = DISCUSS_QUESTION_TYPE;
         $hashkey->store();
         require_once DISCUSS_HELPERS . '/router.php';
         $approveURL = DiscussHelper::getExternalLink('index.php?option=com_easydiscuss&controller=posts&task=approvePost&key=' . $hashkey->key);
         $rejectURL = DiscussHelper::getExternalLink('index.php?option=com_easydiscuss&controller=posts&task=rejectPost&key=' . $hashkey->key);
         $emailData['moderation'] = '<div style="display:inline-block;width:100%;padding:20px;border-top:1px solid #ccc;padding:20px 0 10px;margin-top:20px;line-height:19px;color:#555;font-family:\'Lucida Grande\',Tahoma,Arial;font-size:12px;text-align:left">';
         $emailData['moderation'] .= '<a href="' . $approveURL . '" style="display:inline-block;padding:5px 15px;background:#fc0;border:1px solid #caa200;border-bottom-color:#977900;color:#534200;text-shadow:0 1px 0 #ffe684;font-weight:bold;box-shadow:inset 0 1px 0 #ffe064;-moz-box-shadow:inset 0 1px 0 #ffe064;-webkit-box-shadow:inset 0 1px 0 #ffe064;border-radius:2px;moz-border-radius:2px;-webkit-border-radius:2px;text-decoration:none!important">' . JText::_('COM_EASYDISCUSS_EMAIL_APPROVE_POST') . '</a>';
         $emailData['moderation'] .= ' ' . JText::_('COM_EASYDISCUSS_OR') . ' <a href="' . $rejectURL . '" style="color:#477fda">' . JText::_('COM_EASYDISCUSS_REJECT') . '</a>';
         $emailData['moderation'] .= '</div>';
         $emailData['emailTemplate'] = 'email.subscription.site.moderate.php';
开发者ID:pguilford,项目名称:vcomcc,代码行数:67,代码来源:posts.php


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