예제 #1
0
파일: comment.php 프로젝트: Tommar/vino2
    /**
     * Retrieves the comment count for the specific blog
     *
     * @param	int	$blogId	The blog id.
     **/
    public static function getCommentCount($blog)
    {
        $blogId = $blog->id;
        $config = EasyBlogHelper::getConfig();
        // If multiple comments, we output a common link
        if ($config->get('main_comment_multiple')) {
            return false;
        }
        if ($config->get('comment_komento')) {
            $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'bootstrap.php';
            if (JFile::exists($file)) {
                require_once $file;
                $commentsModel = Komento::getModel('comments');
                $commentCount = $commentsModel->getCount('com_easyblog', $blog->id);
                return $commentCount;
            }
        }
        $easysocial = EasyBlogHelper::getHelper('EasySocial');
        if ($config->get('comment_easysocial') && $easysocial->exists()) {
            return $easysocial->getCommentCount($blog);
        }
        if ($config->get('comment_compojoom')) {
            $file = JPATH_ROOT . '/administrator/components/com_comment/plugin/com_easyblog/josc_com_easyblog.php';
            if (JFile::exists($file)) {
                require_once $file;
                return CommentEasyBlog::output($blog, array(), true);
            }
            $file = JPATH_ROOT . '/components/com_comment/helpers/utils.php';
            if (JFile::exists($file)) {
                JLoader::discover('ccommentHelper', JPATH_ROOT . '/components/com_comment/helpers');
                return ccommentHelperUtils::commentInit('com_easyblog', $blog);
            }
        }
        if ($config->get('intensedebate')) {
            return false;
        }
        if ($config->get('comment_disqus')) {
            static $disqus = false;
            if (!$disqus) {
                ob_start();
                ?>
					var disqus_shortname = '<?php 
                echo $config->get('comment_disqus_code');
                ?>
';
					(function () {
					var s = document.createElement('script'); s.async = true;
					s.type = 'text/javascript';
					s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
					(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
					}());
				<?php 
                $contents = ob_get_contents();
                ob_end_clean();
                JFactory::getDocument()->addScriptDeclaration($contents);
                $disqus = true;
            }
            $string = '<!-- Disqus -->';
            $string .= '<span class="discus-comment">';
            $string .= '<a href="' . EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blogId) . '#disqus_thread"><span>' . JText::_('COM_EASYBLOG_COMMENTS') . '</span></a>';
            $string .= '</span>';
            return $string;
            // return false;
        }
        if ($config->get('comment_livefyre')) {
            return false;
        }
        if ($config->get('comment_jomcomment')) {
            $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jomcomment' . DIRECTORY_SEPARATOR . 'helper' . DIRECTORY_SEPARATOR . 'minimal.helper.php';
            jimport('joomla.filesystem.file');
            if (!JFile::exists($file)) {
                return false;
            }
            require_once $file;
            return jcCountComment($blogId, 'com_easyblog');
        }
        $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jcomments' . DIRECTORY_SEPARATOR . 'jcomments.php';
        if ($config->get('comment_jcomments') && JFile::exists($file)) {
            $db = EasyBlogHelper::db();
            $query = 'SELECT COUNT(1) FROM ' . $db->nameQuote('#__jcomments') . ' ' . 'WHERE ' . $db->nameQuote('object_id') . '=' . $db->Quote($blogId) . ' ' . 'AND ' . $db->nameQuote('object_group') . '=' . $db->Quote('com_easyblog') . ' ' . 'AND ' . $db->nameQuote('published') . '=' . $db->Quote(1);
            $db->setQuery($query);
            $total = $db->loadResult();
            return $total;
        }
        if ($config->get('comment_rscomments')) {
            return false;
        }
        if ($config->get('comment_facebook')) {
            return false;
        }
        // @task: Let's allow the plugin to also trigger the comment count.
        $params = EasyBlogHelper::getRegistry();
        $result = EasyBlogHelper::triggerEvent('easyblog.commentCount', $blog, $params, 0);
        $count = trim(implode(" ", $result));
        if (!empty($count)) {
            return $count;
        }
        $db = EasyBlogHelper::db();
        $query = 'SELECT COUNT(1) FROM ' . $db->nameQuote('#__easyblog_comment') . ' WHERE ' . $db->nameQuote('post_id') . '=' . $db->Quote($blogId) . ' AND `published` = ' . $db->Quote('1');
        $db->setQuery($query);
        $count = $db->loadResult();
        return $count;
    }
예제 #2
0
						<?php 
                    } else {
                        ?>
						 <span class="jav-comment">
							<?php 
                        $totalComment = 0;
                        if ($sytem_comment == 'jcomments' && $this->jcomments) {
                            $comments = JPATH_SITE . '/components/com_jcomments/jcomments.php';
                            if (file_exists($comments)) {
                                require_once $comments;
                                $totalComment = JComments::getCommentsCount($item->id, 'com_javoice');
                            }
                        } else {
                            if ($sytem_comment == 'jomcomment' && $this->jomcomment) {
                                require_once JPATH_BASE . DS . 'components' . DS . 'com_jomcomment' . DS . 'helper' . DS . 'minimal.helper.php';
                                $totalComment = jcCountComment($item->id, 'com_javoice');
                            } else {
                                if ($sytem_comment == 'jacomment' && $this->jacomment) {
                                    $totalComment = $item->data->get($sytem_comment . '_total');
                                }
                            }
                        }
                        ?>
							<?php 
                        if ($sytem_comment == 'intensedebate') {
                            ?>
								<a href="<?php 
                            echo $link . '#jav-comment';
                            ?>
">								
									<?php