/** * Displays the stream item for new blog post * * @since 1.0 * @access public * @param string * @return */ public function prepareNewBlogStream(SocialStreamItem &$item, $appParams) { // Load the post $post = EB::post($item->contextId); // Format the likes for the stream $likes = Foundry::likes(); $likes->get($item->contextId, 'blog', 'create'); $item->likes = $likes; // Apply comments on the stream $url = $post->getExternalPermalink(); $item->comments = Foundry::comments($item->contextId, 'blog', 'create', SOCIAL_APPS_GROUP_USER, array('url' => $url)); // We might want to use some javascript codes. EB::init('site'); // Get the creation date $date = $post->getCreationDate(); $config = EB::config(); $source = $config->get('integrations_easysocial_stream_newpost_source', 'intro'); $content = isset($post->{$source}) && !empty($post->{$source}) ? $post->{$source} : $post->intro; $content = $this->truncateContent($content, $appParams); // See if there's any audio files to process. $audios = EB::audio()->getItems($content); // Get videos attached in the content $video = $this->getVideo($content); // Remove videos from the source $content = EB::videos()->strip($content); // Remove audios from the content $content = EB::audio()->strip($content); // Get the permalink of the primary category $catUrl = EBR::_('index.php?option=com_easyblog&view=categories&layout=listings&id=' . $post->category_id, true, null, false, true); // Get the alignment of the image $alignment = 'pull-' . $appParams->get('imagealignment', 'right'); $theme = Foundry::themes(); $theme->set('alignment', $alignment); $theme->set('video', $video); $theme->set('audios', $audios); $theme->set('date', $date); $theme->set('permalink', $url); $theme->set('blog', $post); $theme->set('actor', $item->actor); $theme->set('content', $content); $theme->set('categorypermalink', $catUrl); $item->title = $theme->output('easysocial/streams/' . $item->verb . '.title'); $item->content = $theme->output('easysocial/streams/' . $item->verb . '.content'); // Add opengraph tags for the stream item $item->opengraph->addImage($post->getImage('thumbnail')); $item->opengraph->addDescription($content); }