本文整理汇总了PHP中Foundry::comments方法的典型用法代码示例。如果您正苦于以下问题:PHP Foundry::comments方法的具体用法?PHP Foundry::comments怎么用?PHP Foundry::comments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Foundry
的用法示例。
在下文中一共展示了Foundry::comments方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCommentCount
/**
* Returns the comment counter
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function getCommentCount($blog)
{
if (!$this->exists()) {
return;
}
Foundry::language()->load('com_easysocial', JPATH_ROOT);
$url = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id);
$comments = Foundry::comments($blog->id, 'blog', SOCIAL_APPS_GROUP_USER, $url);
return $comments->getCount();
}
示例2: processActions
/**
* Processes the stream actions
*
* @since 1.2
* @access public
* @param string
* @return
*/
private function processActions(SocialStreamItem &$item, $privacy)
{
$group = $item->cluster_id ? $item->cluster_type : SOCIAL_APPS_GROUP_USER;
// Whether the item is shared or uploaded via the photo albums, we need to bind the repost here
$repost = Foundry::get('Repost', $item->uid, SOCIAL_TYPE_STREAM, $group);
$item->repost = $repost;
// For photo items that are shared on the stream
if ($item->verb == 'share') {
// By default, we'll use the stream id as the object id
$objectId = $item->uid;
$objectType = SOCIAL_TYPE_STREAM;
$commentUrl = FRoute::stream(array('layout' => 'item', 'id' => $item->uid));
// When there is only 1 photo that is shared on the stream, we need to link to the photo item
// We will only alter the id
if (count($item->contextIds) == 1) {
$photo = Foundry::table('Photo');
$photo->load($item->contextIds[0]);
$objectId = $photo->id;
$objectType = SOCIAL_TYPE_PHOTO;
$commentUrl = $photo->getPermalink();
}
// Append the likes action on the stream
$likes = Foundry::likes();
$likes->get($objectId, $objectType, 'upload', $group, $item->uid);
$item->likes = $likes;
// Append the comment action on the stream
$comments = Foundry::comments($objectId, $objectType, 'upload', $group, array('url' => $commentUrl), $item->uid);
$item->comments = $comments;
return;
}
// If there is more than 1 photo uploaded, we need to link the likes and comments on the album
if (count($item->contextIds) > 1) {
$photo = false;
$photos = $this->getPhotoFromParams($item, $privacy);
if ($photos instanceof SocialTablePhoto) {
$photo = $photos;
}
if (is_array($photos)) {
$photo = $photos[0];
}
// If we can't get anything, skip this
if (!$photo) {
return;
}
// If we can't get anything, skip this
if (!$photo) {
return;
}
$element = SOCIAL_TYPE_ALBUM;
$uid = $photo->album_id;
// Get the album object
$album = Foundry::table('Album');
$album->load($photo->album_id);
// Format the likes for the stream
$likes = Foundry::likes();
$likes->get($photo->album_id, 'albums', 'create', $group);
$item->likes = $likes;
// Apply comments on the stream
$commentParams = array('url' => $album->getPermalink());
$comments = Foundry::comments($photo->album_id, 'albums', 'create', $group, $commentParams);
$item->comments = $comments;
return;
}
// Here onwards we are assuming that the likes and comment should be applied on the single photo.
// Since the stream library already handles this nicely, we leave it to the stream to handle.
// $likes = Foundry::likes();
// $likes->get($item->contextId , $item->context, $item->verb , SOCIAL_APPS_GROUP_USER );
// $item->likes = $likes;
// // Apply comments on the stream
// $comments = Foundry::comments( $item->contextId , $item->context , $item->verb, SOCIAL_APPS_GROUP_USER , array( 'url' => FRoute::photos( array( 'layout' => 'item', 'id' => $item->contextId ) ) ) );
// $item->comments = $comments;
}
示例3: prepareCreatedTaskStream
public function prepareCreatedTaskStream(SocialStreamItem $streamItem, $includePrivacy = true)
{
$params = FD::registry($streamItem->params);
// Get the tasks available from the cached data
$items = $params->get('tasks');
$tasks = array();
$taskId = '';
foreach ($items as $item) {
$task = FD::table('Task');
$task->load($item->id);
$tasks[] = $task;
$taskId = $task->id;
}
// Get the milestone
$milestone = FD::table('Milestone');
$milestone->bind($params->get('milestone'));
// Get the group data
FD::load('group');
$group = new SocialGroup();
$group->bind($params->get('group'));
// We need to get the task app for the group
$app = Foundry::table('App');
$app->load(array('element' => 'tasks', 'group' => 'group'));
$permalink = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias(), 'milestoneId' => $milestone->id));
$this->set('permalink', $permalink);
$this->set('stream', $streamItem);
$this->set('milestone', $milestone);
$this->set('total', count($tasks));
$this->set('actor', $streamItem->actor);
$this->set('group', $group);
$this->set('tasks', $tasks);
$streamItem->title = parent::display('streams/tasks/create.task.title');
$streamItem->content = parent::display('streams/tasks/create.task.content');
// Append the likes action on the stream
if (!$streamItem->contextIds[0]) {
$likes = Foundry::likes();
$likes->get($taskId, $streamItem->context, $streamItem->verb, SOCIAL_TYPE_GROUP, $streamItem->uid);
$streamItem->likes = $likes;
// Append the comment action on the stream
$comments = Foundry::comments($taskId, $streamItem->context, $streamItem->verb, SOCIAL_TYPE_GROUP, array('url' => FRoute::stream(array('layout' => 'item', 'id' => $streamItem->uid))), $streamItem->uid);
$streamItem->comments = $comments;
}
}
示例4: 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);
}