/** * Render comments and respond form html. * * @param AppView $view The view the comments are rendered on * @param Item $item The item whos comments are rendered * * @return string The html output * * @since 2.0 */ public function renderComments($view, $item) { if ($item->getApplication()->isCommentsEnabled()) { // get application params $params = $this->app->parameter->create($item->getApplication()->getParams()->get('global.comments.')); if ($params->get('twitter_enable') && !function_exists('curl_init')) { $this->app->error->raiseWarning(500, JText::_('To use Twitter, CURL needs to be enabled in your php settings.')); $params->set('twitter_enable', false); } // get active author $active_author = $this->activeAuthor(); // filter author output JFilterOutput::objectHTMLSafe($active_author, ENT_QUOTES, array('app', 'application')); // get comment content from session $content = $this->app->system->session->get('com_zoo.comment.content'); $params->set('content', $content); // get comments and build tree $approved = $item->canManageComments() ? Comment::STATE_UNAPPROVED : Comment::STATE_APPROVED; $comments = $item->getCommentTree($approved); // build captcha $captcha = false; if ($plugin = $params->get('captcha', false) and (!$params->get('captcha_guest_only', 0) or !$this->app->user->get()->id)) { $captcha = JCaptcha::getInstance($plugin); } // filter redirect url $view->set('redirect', htmlspecialchars(JUri::getInstance()->toString())); if ($item->isCommentsEnabled() || count($comments) - 1) { // create comments html return $view->partial('comments', compact('item', 'active_author', 'comments', 'params', 'captcha')); } } return null; }