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


PHP DiscussRouter类代码示例

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


在下文中一共展示了DiscussRouter类的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: getLink

 /**
  * Retrieves the profile link
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function getLink()
 {
     if (!EB::easydiscuss()->exists()) {
         return parent::getLink();
     }
     $link = DiscussRouter::_('index.php?option=com_easydiscuss&view=profile&id=' . $this->profile->id, false);
     return $link;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:16,代码来源:client.php

示例4: getFeedURL

 public function getFeedURL($url, $atom = false)
 {
     require_once DISCUSS_HELPERS . '/router.php';
     $sef = DiscussRouter::isSefEnabled();
     $join = $sef ? '?' : '&';
     $url = DiscussRouter::_($url) . $join . 'format=feed';
     $url .= $atom ? '&type=atom' : '&type=rss';
     return $url;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:9,代码来源:feeds.php

示例5: convert

 /**
  * Converts a comment into a discussion reply
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return	
  */
 public function convert()
 {
     JRequest::checkToken('request') or jexit('Invalid Token');
     // Get the Joomla app
     $app = JFactory::getApplication();
     // Get the comment id from the request.
     $id = JRequest::getInt('id');
     // Load the comment
     $comment = DiscussHelper::getTable('Comment');
     $comment->load($id);
     if (!$id || !$comment->id) {
         // Throw error here.
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_INVALID_COMMENT_ID_PROVIDED'), DISCUSS_QUEUE_ERROR);
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
         $app->close();
     }
     // Get the post id from the request.
     $postId = JRequest::getInt('postId');
     $post = DiscussHelper::getTable('Post');
     $post->load($postId);
     if (!$postId || !$post->id) {
         // Throw error here.
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_INVALID_POST_ID_PROVIDED'), DISCUSS_QUEUE_ERROR);
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
         $app->close();
     }
     if (!$comment->canConvert()) {
         // Throw error here.
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_NOT_ALLOWED_TO_CONVERT'), DISCUSS_QUEUE_ERROR);
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false));
         $app->close();
     }
     // Create a new reply.
     $reply = DiscussHelper::getTable('Post');
     $reply->title = $post->title;
     $reply->content = $comment->comment;
     $reply->published = 1;
     $reply->created = $comment->created;
     $reply->parent_id = $post->id;
     $reply->user_id = $comment->user_id;
     $reply->user_type = 'member';
     $reply->category_id = $post->category_id;
     $state = $reply->store();
     if (!$state) {
         // Throw error here.
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_ERROR_SAVING_REPLY'), DISCUSS_QUEUE_ERROR);
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false));
         $app->close();
     }
     // Once the reply is stored, delete the comment
     $comment->delete();
     DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_SUCCESS_CONVERTED_COMMENT_TO_REPLY'), DISCUSS_QUEUE_SUCCESS);
     $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false));
     $app->close();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:63,代码来源:comments.php

示例6: markreadall

 /**
  * Allows user to mark all their notification items as read
  **/
 public function markreadall()
 {
     $my = JFactory::getUser();
     if (!$my->id) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_PLEASE_LOGIN_FIRST'), 'error');
         JFactory::getApplication()->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
     }
     $db = DiscussHelper::getDBO();
     $query = 'UPDATE ' . $db->nameQuote('#__discuss_notifications') . ' ' . 'SET ' . $db->nameQuote('state') . '=' . $db->Quote(0) . ' ' . 'WHERE ' . $db->nameQuote('target') . '=' . $db->Quote($my->id);
     $db->setQuery($query);
     $db->Query();
     DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_ALL_NOTIFICATIONS_MARKED_AS_READ'));
     JFactory::getApplication()->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=notifications', false));
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:17,代码来源:notification.php

示例7: display

 function display($tmpl = null)
 {
     $config = DiscussHelper::getConfig();
     if (!$config->get('main_rss')) {
         return;
     }
     $userid = JRequest::getInt('id', null);
     $user = JFactory::getUser($userid);
     $document = JFactory::getDocument();
     $document->link = DiscussRouter::_('index.php?option=com_easydiscuss&view=profile&id=' . $user->id);
     $profile = DiscussHelper::getTable('Profile');
     $profile->load($user->id);
     $document->setTitle($profile->getName());
     $document->setDescription($profile->getDescription());
     $jConfig = DiscussHelper::getJConfig();
     $model = $this->getModel('Posts');
     $posts = $model->getPostsBy('user', $profile->id);
     $posts = DiscussHelper::formatPost($posts);
     foreach ($posts as $row) {
         // Assign to feed item
         $title = $this->escape($row->title);
         $title = html_entity_decode($title);
         // load individual item creator class
         $item = new JFeedItem();
         $item->title = $title;
         $item->link = JRoute::_('index.php?option=com_easydiscuss&view=post&id=' . $row->id);
         $item->description = $row->content;
         $item->date = DiscussHelper::getDate($row->created)->toMySQL();
         if (!empty($row->tags)) {
             $tagData = array();
             foreach ($row->tags as $tag) {
                 $tagData[] = '<a href="' . JRoute::_('index.php?option=com_easydiscuss&view=tags&id=' . $tag->id) . '">' . $tag->title . '</a>';
             }
             $row->tags = implode(', ', $tagData);
         } else {
             $row->tags = '';
         }
         $item->category = $row->tags;
         $item->author = $row->user->getName();
         if ($jConfig->get('feed_email') != 'none') {
             if ($jConfig->get('feed_email') == 'author') {
                 $item->authorEmail = $row->user->email;
             } else {
                 $item->authorEmail = $jConfig->get('mailfrom');
             }
         }
         $document->addItem($item);
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:49,代码来源:view.feed.php

示例8: display

 public function display($tpl = null)
 {
     $my = JFactory::getUser();
     if (!$my->id) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_PLEASE_LOGIN_FIRST'), 'error');
         JFactory::getApplication()->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
     }
     $model = $this->getModel('Notification');
     $this->setPathway(JText::_('COM_EASYDISCUSS_BREADCRUMBS_NOTIFICATIONS'));
     // Make this configurable?
     $limit = 100;
     $notifications = $model->getNotifications($my->id, false, $limit);
     DiscussHelper::getHelper('Notifications')->format($notifications, true);
     $theme = new DiscussThemes();
     $theme->set('notifications', $notifications);
     echo $theme->fetch('notifications.php');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:17,代码来源:view.html.php

示例9: removeAccess

 function removeAccess()
 {
     $mainframe = JFactory::getApplication();
     $user = JFactory::getUser();
     $return = DiscussRouter::_('index.php?option=com_easydiscuss&view=profile', false);
     if ($user->id == 0) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_TWITTER_USER_NOT_FOUND'), 'error');
         $this->setRedirect($return);
     }
     $twitter = DiscussHelper::getTable('Twitter');
     if (!$twitter->load($user->id)) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_TWITTER_OAUTH_DOESNT_EXIST'), 'error');
         $this->setRedirect($return);
     }
     $twitter->delete();
     DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_TWITTER_REQUIRE_AUTHENTICATION'));
     $this->setRedirect($return);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:18,代码来源:twitter.php

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

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

示例12: listings

 public function listings()
 {
     $app = JFactory::getApplication();
     $config = DiscussHelper::getConfig();
     $id = JRequest::getInt('id');
     if (empty($id)) {
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=badges', false), JText::_('COM_EASYDISCUSS_INVALID_BADGE'));
         $app->close();
     }
     $badge = DiscussHelper::getTable('Badges');
     $badge->load($id);
     $this->setPathway(JText::_('COM_EASYDISCUSS_BADGES'), DiscussRouter::_('index.php?option=com_easydiscuss&view=badges'));
     $this->setPathway(JText::_($badge->get('title')));
     DiscussHelper::setPageTitle(JText::sprintf('COM_EASYDISCUSS_VIEWING_BADGE_TITLE', $this->escape($badge->title)));
     $users = $badge->getUsers();
     $theme = new DiscussThemes();
     $theme->set('badge', $badge);
     $theme->set('users', $users);
     echo $theme->fetch('badge.php');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:20,代码来源:view.html.php

示例13: getReturnURL

 public static function getReturnURL($params, $isLogged = false)
 {
     $type = empty($isLogged) ? 'login' : 'logout';
     if ($itemid = $params->get($type)) {
         $menu = JFactory::getApplication()->getMenu();
         $item = $menu->getItem($itemid);
         if ($item) {
             $url = JRoute::_($item->link . '&Itemid=' . $itemid, false);
         } else {
             // stay on the same page
             $uri = JFactory::getURI();
             $url = $uri->toString(array('path', 'query', 'fragment'));
         }
     } else {
         // Proceeed to the front page of EasyDiscuss.
         $itemid = DiscussRouter::getItemId();
         $url = JRoute::_('index.php?option=com_easydiscuss&Itemid=' . $itemid, false);
     }
     return base64_encode($url);
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:20,代码来源:helper.php

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

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


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