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


PHP EB::comment方法代码示例

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


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

示例1: execute

 public function execute()
 {
     $post = $this->items;
     // Get the blogger object
     $post->author = $post->getAuthor();
     // Determines if the post is featured
     $post->isFeatured = $post->isFeatured();
     // determines if this is a teamblog post
     $post->team_id = $post->source_type == EASYBLOG_POST_SOURCE_TEAM ? $post->source_id : '0';
     // Format microblog postings
     if ($post->posttype) {
         $this->formatMicroblog($post);
     } else {
         $post->posttype = 'standard';
     }
     // We want to format all the content first before the theme displays the content
     $post->text = $post->getContent('entry');
     // Get the total comments
     $post->totalComments = EB::comment()->getCommentCount($post);
     // Get custom fields for this blog post
     $post->fields = $post->getCustomFields();
     // Assign the category object into the blog
     $post->categories = $post->getCategories();
     $post->category = $post->getPrimaryCategory();
     // Get the post assets
     $post->assets = $post->getAssets();
     // Retrieve list of tags
     $post->tags = $post->getTags();
     return $post;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:30,代码来源:entry.php

示例2: save

 /**
  * Saves a comment item
  *
  * @since	4.0
  * @access	public
  */
 public function save()
 {
     // Check for request forgeries
     EB::checkToken();
     // Check for acl rules.
     $this->checkAccess('comment');
     // Get the comment id
     $id = $this->input->get('id', 0, 'int');
     // Get the comment object
     $comment = EB::table('Comment');
     $comment->load($id);
     // Get the posted data
     $post = $this->input->getArray('post');
     // Bind the post data
     $comment->bind($post);
     // Try to save the comment
     $state = $comment->store();
     if (!$state) {
         $this->info->set($comment->getError(), 'error');
         return $this->app->redirect('index.php?option=com_easyblog&view=comments&layout=form&id=' . $comment->id);
     }
     // If the comment is published and no notifications sent yet, we need to send it out
     if ($comment->published && !$comment->sent) {
         $comment->comment = EB::comment()->parseBBCode($comment->comment);
         $comment->comment = nl2br($comment->comment);
         // Get the blog object associated with the comment
         $post = $comment->getBlog();
         // Process the emails now
         $comment->processEmails(false, $post);
         // Update the sent flag to sent, so we will never notify more than once
         $comment->updateSent();
     }
     $this->info->set('COM_EASYBLOG_COMMENTS_SAVED', 'success');
     $task = $this->getTask();
     $redirect = 'index.php?option=com_easyblog&view=comments';
     if ($task == 'apply') {
         $redirect .= '&layout=form&id=' . $comment->id;
     }
     return $this->app->redirect($redirect);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:46,代码来源:comment.php

示例3: format

 /**
  * Format a list of stdclass objects into comment objects
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function format($items)
 {
     if (!$items) {
         return $items;
     }
     $my = JFactory::getUser();
     $model = EB::model('Comment');
     $comments = array();
     foreach ($items as $item) {
         $comment = EB::table('Comment');
         $comment->bind($item);
         // Load the author
         $comment->getAuthor();
         // Set the raw comments for editing
         $comment->raw = $comment->comment;
         // Set the comment depth
         if (isset($item->depth)) {
             $comment->depth = $item->depth;
         }
         // Format the comment
         $comment->comment = nl2br($comment->comment);
         $comment->comment = EB::comment()->parseBBCode($comment->comment);
         $comment->likesAuthor = '';
         $comment->likesCount = 0;
         $comment->isLike = false;
         if ($this->config->get('comment_likes')) {
             $data = EB::getLikesAuthors($comment->id, 'comment', $my->id);
             $comment->likesAuthor = $data->string;
             $comment->likesCount = $data->count;
             $comment->isLike = $model->isLikeComment($comment->id, $my->id);
         }
         // Determine if the current user liked the item or not
         $comments[] = $comment;
     }
     return $comments;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:44,代码来源:comment.php

示例4: getCommentCount

 /**
  * Retrieves the comment count for a post.
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public static function getCommentCount($id)
 {
     $post = EB::post($id);
     $count = EB::comment()->getCommentCount($post);
     return $count;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:14,代码来源:easyblog.php

示例5:

    ?>
        </div>
    <?php 
}
?>

    <?php 
if ($params->get('showcommentcount', 0)) {
    ?>
        <div class="mod-cell pr-10">
            <a href="<?php 
    echo $post->getPermalink();
    ?>
">
                <?php 
    echo EB::string()->getNoun('MOD_TOPBLOGS_COMMENTS', EB::comment()->getCommentCount($post), true);
    ?>
            </a>
        </div>
    <?php 
}
?>

    <?php 
if ($params->get('showreadmore', true)) {
    ?>
        <div class="mod-cell">
            <a href="<?php 
    echo $post->getPermalink();
    ?>
"><?php 
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:31,代码来源:default_item.php

示例6: getContent

 /**
  * Retrieves the formatted comment
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return	string
  */
 public function getContent($truncate = true)
 {
     if ($truncate) {
         $text = JString::strlen($this->comment) > 150 ? JString::substr($this->comment, 0, 150) . JText::_('COM_EASYBLOG_ELLIPSES') : $this->comment;
     } else {
         $text = EB::comment()->parseBBCode($this->comment);
     }
     $text = strip_tags($text, '<img>');
     return $text;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:18,代码来源:comment.php

示例7:

						<li>
							<a href="<?php 
            echo EB::_('index.php?option=com_easyblog&view=dashboard&layout=pending');
            ?>
">
								<i class="fa fa-ticket"></i> <?php 
            echo JText::_('COM_EASYBLOG_TOOLBAR_BLOG_POSTS_PENDING');
            ?>
							</a>
						</li>
						<?php 
        }
        ?>

						<?php 
        if ($this->acl->get('manage_comment') && EB::comment()->isBuiltin()) {
            ?>
						<li>
							<a href="<?php 
            echo EB::_('index.php?option=com_easyblog&view=dashboard&layout=comments');
            ?>
">
								<i class="fa fa-comments"></i> <?php 
            echo JText::_('COM_EASYBLOG_TOOLBAR_COMMENTS');
            ?>
							</a>
						</li>
						<?php 
        }
        ?>
开发者ID:knigherrant,项目名称:decopatio,代码行数:30,代码来源:default.php

示例8: strip_tags

				<?php 
        }
        ?>

				<div class="eb-post-comment-text">
					<?php 
        if (JString::strlen($comment->comment) > 130) {
            ?>
						<?php 
            echo JString::substr(strip_tags(EB::comment()->parseBBCode($comment->comment)), 0, 130);
            ?>
					<?php 
        } else {
            ?>
					<?php 
            echo strip_tags(EB::comment()->parseBBCode($comment->comment));
            ?>
					<?php 
        }
        ?>
				</div>

				<a href="<?php 
        echo $post->getPermalink();
        ?>
#comment-<?php 
        echo $comment->id;
        ?>
" class="eb-post-comment-date text-muted"><?php 
        echo $comment->getCreated()->format(JText::_('COM_EASYBLOG_DATE_FORMAT_STATISTICS'));
        ?>
开发者ID:knigherrant,项目名称:decopatio,代码行数:31,代码来源:part.comments.php

示例9: getCommentsCount

 /**
  * Retrieves total number of comments the author made on the site.
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function getCommentsCount()
 {
     if (!EB::comment()->isBuiltin()) {
         return 0;
     }
     $db = EB::db();
     $query = 'SELECT COUNT(1) FROM ' . $db->nameQuote('#__easyblog_comment') . ' ' . 'WHERE ' . $db->nameQuote('created_by') . '=' . $db->Quote($this->id) . ' ' . 'AND ' . $db->nameQuote('published') . '=' . $db->Quote(1);
     $db->setQuery($query);
     return $db->loadResult();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:18,代码来源:profile.php

示例10: processComment

 public static function processComment($data, $row, $params)
 {
     $row->comment_id = isset($data->comment_id) ? $data->comment_id : '';
     $row->comment = isset($data->comment) ? $data->comment : '';
     $row->commentor = isset($data->commentor) ? $data->commentor : '0';
     $row->comment_title = isset($data->comment_title) ? $data->comment_title : '';
     $row->commentor_name = isset($data->commentor_name) ? $data->commentor_name : '';
     if ($params->get('showlatestcomment', true)) {
         if ($row->commentor != 0) {
             $commentor = EB::user($row->commentor);
             $row->commentor = $commentor;
         } else {
             $obj = new stdClass();
             $obj->id = '0';
             $obj->nickname = !empty($row->commentor_name) ? $row->commentor_name : JText::_('COM_EASYBLOG_GUEST');
             $commentor = EB::table('Profile');
             $commentor->bind($obj);
             $row->commentor = $commentor;
         }
     }
     $comment = strip_tags($row->comment);
     $commentLength = JString::strlen($comment);
     $comment = '"' . $comment . '"';
     $comment = EB::comment()->parseBBCode($comment);
     $row->comment = $commentLength > 150 ? JString::substr($comment, 0, 150) . '...' : $comment;
     return $row;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:27,代码来源:helper.php

示例11: getBlogComment

 /**
  * Retrieves a list of comments from a blog post
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function getBlogComment($id, $limitFrontEnd = 0, $sort = 'asc', $lite = false)
 {
     $db = EB::db();
     $config = EB::getConfig();
     $sort = $config->get('comment_sort', 'asc');
     if ($lite) {
         $query = 'SELECT a.* FROM `#__easyblog_comment` a';
         $query .= ' INNER JOIN #__users AS c ON a.`created_by` = c.`id`';
         $query .= ' WHERE a.`post_id` = ' . $db->Quote($id);
         $query .= ' AND a.`published` = 1';
     } else {
         $query = 'SELECT a.*, (count(b.id) - 1) AS `depth` FROM `#__easyblog_comment` AS a';
         $query .= ' INNER JOIN `#__easyblog_comment` AS b';
         $query .= ' LEFT JOIN `#__users` AS c ON a.`created_by` = c.`id`';
         $query .= ' WHERE a.`post_id` = ' . $db->Quote($id);
         $query .= ' AND b.`post_id` = ' . $db->Quote($id);
         $query .= ' AND a.`published` = 1';
         $query .= ' AND b.`published` = 1';
         $query .= ' AND a.`lft` BETWEEN b.`lft` AND b.`rgt`';
         $query .= ' GROUP BY a.`id`';
     }
     // prepare the query to get total comment
     $queryTotal = 'SELECT COUNT(1) FROM (';
     $queryTotal .= $query;
     $queryTotal .= ') AS x';
     // continue the query.
     $limit = $this->getState('limit');
     $limitstart = $this->getState('limitstart');
     switch ($sort) {
         case 'desc':
             $query .= ' ORDER BY a.`rgt` desc';
             break;
         default:
             $query .= ' ORDER BY a.`lft` asc';
             break;
     }
     if ($limitFrontEnd > 0) {
         $query .= ' LIMIT ' . $limitFrontEnd;
     } else {
         $query .= ' LIMIT ' . $limitstart . ',' . $limit;
     }
     if ($limitFrontEnd <= 0) {
         $db->setQuery($queryTotal);
         $this->_total = $db->loadResult();
         jimport('joomla.html.pagination');
         $this->_pagination = EB::pagination($this->_total, $limitstart, $limit);
     }
     // the actual content sql
     $db->setQuery($query);
     $result = $db->loadObjectList();
     if (!$result) {
         return $result;
     }
     // Format the comments
     $result = EB::comment()->format($result);
     return $result;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:65,代码来源:blog.php

示例12: prepareNewCommentStream

 private function prepareNewCommentStream(&$item)
 {
     $comment = EB::table('Comment');
     $comment->load($item->contextId);
     // Format the likes for the stream
     $likes = Foundry::likes();
     $likes->get($comment->id, 'blog', 'comments');
     $item->likes = $likes;
     $url = EBR::_('index.php?option=com_easyblog&view=entry&id=' . $comment->post_id, true, null, false, true);
     // Apply comments on the stream
     $item->comments = Foundry::comments($item->contextId, 'blog', 'comments', SOCIAL_APPS_GROUP_USER, array('url' => $url));
     $post = EB::post($comment->post_id);
     $date = EB::date($post->created);
     // Parse the bbcode from EasyBlog
     $comment->comment = EB::comment()->parseBBCode($comment->comment);
     $this->set('comment', $comment);
     $this->set('date', $date);
     $this->set('permalink', $url);
     $this->set('blog', $post);
     $this->set('actor', $item->actor);
     $item->title = parent::display('streams/' . $item->verb . '.title');
     $item->content = parent::display('streams/' . $item->verb . '.content');
     $item->opengraph->addDescription($comment->comment);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:24,代码来源:easysocial.php

示例13: getTotalComments

 /**
  * Get total number of comments for this blog post
  *
  * @access	public
  * @param	null
  * @return	int
  */
 public function getTotalComments()
 {
     if (!isset(self::$commentCounts[$this->id])) {
         $count = EB::comment()->getCommentCount($this);
         self::$commentCounts[$this->id] = $count;
     }
     return self::$commentCounts[$this->id];
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:15,代码来源:post.php

示例14: update

 /**
  * Allows caller to update comments via ajax
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function update()
 {
     $ajax = EB::ajax();
     // Get the comment object
     $id = $this->input->get('id', 0, 'int');
     $comment = EB::table('Comment');
     $comment->load($id);
     if (!$id || !$comment->id) {
         return $ajax->reject(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_EDIT_COMMENT'));
     }
     if (!EB::isSiteAdmin() && ($this->acl->get('edit_comment') || $this->my->id != $comment->created_by) && !$this->acl->get('manage_comment')) {
         return $ajax->reject(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_EDIT_COMMENT'));
     }
     // Get the updated comment
     $message = $this->input->get('message', '', 'default');
     if (!$message) {
         return $ajax->reject(JText::_('COM_EASYBLOG_COMMENTS_EMPTY_COMMENT_NOT_ALLOWED'));
     }
     $comment->comment = $message;
     // Update the comment
     $comment->store();
     // Format the output back
     $output = nl2br($message);
     $output = EB::comment()->parseBBCode($output);
     return $ajax->resolve($output, $message);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:34,代码来源:view.ajax.php

示例15: insetCommentActivity

 /**
  *
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function insetCommentActivity($comment, EasyBlogPost $post)
 {
     if (!$this->exists()) {
         return false;
     }
     // We do not want to add activities if new comment activity is disabled.
     if (!$this->config->get('integrations_jomsocial_comment_new_activity')) {
         return false;
     }
     $command = 'easyblog.comment.add';
     // Get the post title
     $title = $this->getPostTitle($post);
     // Get the permalink
     $permalink = EBR::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $comment->post_id, false, true) . '#comment-' . $comment->id;
     // Get the content
     $content = '';
     if ($this->config->get('integrations_jomsocial_submit_content')) {
         $content = $comment->comment;
         $content = EB::comment()->parseBBCode($content);
         $content = nl2br($content);
         $content = strip_tags($content);
         $content = JString::substr($content, 0, $this->config->get('integrations_jomsocial_comments_length'));
     }
     $obj = new stdClass();
     $obj->title = JText::sprintf('COM_EASYBLOG_JS_ACTIVITY_COMMENT_ADDED', $permalink, $title);
     if (!$comment->created_by) {
         $obj->title = JText::sprintf('COM_EASYBLOG_JS_ACTIVITY_GUEST_COMMENT_ADDED', $permalink, $title);
     }
     $obj->content = $content;
     $obj->cmd = $command;
     $obj->actor = $comment->created_by;
     $obj->target = 0;
     $obj->app = 'easyblog';
     $obj->cid = $comment->id;
     if ($this->config->get('integrations_jomsocial_activity_likes')) {
         $obj->like_id = $comment->id;
         $obj->like_type = 'com_easyblog.comments';
     }
     if ($this->config->get('integrations_jomsocial_activity_comments')) {
         $obj->comment_id = $comment->id;
         $obj->comment_type = 'com_easyblog.comments';
     }
     // add JomSocial activities
     CFactory::load('libraries', 'activities');
     CActivityStream::add($obj);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:54,代码来源:jomsocial.php


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