Exemple #1
0
 public function getCommentPage($object_id, $object_group, $comment_id)
 {
     $result = 0;
     if ($this->commentsPerPage > 0) {
         $compare = $this->commentsOrder == 'DESC' ? '>=' : '<=';
         $prev = JComments::getCommentsCount($object_id, $object_group, "\n id " . $compare . " " . $comment_id);
         $result = max(ceil($prev / $this->commentsPerPage), 1);
     }
     return $result;
 }
Exemple #2
0
 public function onK2CommentsCounter(&$item, &$params, $limitstart)
 {
     $result = '';
     $commentsAPI = JPATH_SITE . '/components/com_jcomments/jcomments.php';
     if (is_file($commentsAPI)) {
         require_once $commentsAPI;
         $count = JComments::getCommentsCount($item->id, 'com_k2');
         if ($count == 0) {
             $link = $item->link . '#addcomments';
             $text = JText::_('PLG_K2_JCOMMENTS_LINK_ADD_COMMENT');
         } else {
             $link = $item->link . '#comments';
             $text = JText::sprintf('PLG_K2_JCOMMENTS_LINK_READ_COMMENTS', $count);
         }
         $anchor_css = $this->params->get('anchor_css');
         $class = empty($anchor_css) ? '' : ' class="' . $anchor_css . '"';
         $result = '<a href="' . $link . '"' . $class . ' title="' . $text . '">' . $text . '</a>';
     }
     return $result;
 }
Exemple #3
0
 public static function getCommentListItem(&$comment)
 {
     $total = JComments::getCommentsCount($comment->object_id, $comment->object_group, 'parent = ' . $comment->parent);
     $tmpl = JCommentsFactory::getTemplate($comment->object_id, $comment->object_group);
     $tmpl->load('tpl_list');
     $tmpl->addVar('tpl_list', 'comment-id', $comment->id);
     $tmpl->addVar('tpl_list', 'comment-item', JComments::getCommentItem($comment));
     $tmpl->addVar('tpl_list', 'comment-modulo', $total % 2 ? 1 : 0);
     return $tmpl->renderTemplate('tpl_list');
 }
Exemple #4
0
            ?>
                <?php 
        }
        ?>

                <?php 
        if ($params->get('tz_comment_type') == 'jcomment') {
            ?>
                    <?php 
            $comments = JPATH_SITE . '/components/com_jcomments/jcomments.php';
            if (file_exists($comments)) {
                require_once $comments;
                if (class_exists('JComments')) {
                    ?>
                        <span itemprop="commentCount"><?php 
                    echo JComments::getCommentsCount((int) $this->item->id, 'com_tz_portfolio');
                    ?>
</span>
                    <?php 
                }
            }
            ?>
                <?php 
        }
        ?>


            </span>
        <?php 
    }
    ?>
Exemple #5
0
                    ?>
                                    <?php 
                }
                ?>

                                    <?php 
                if ($params->get('tz_comment_type') == 'jcomment') {
                    ?>
                                        <?php 
                    $comments = JPATH_SITE . '/components/com_jcomments/jcomments.php';
                    if (file_exists($comments)) {
                        require_once $comments;
                        if (class_exists('JComments')) {
                            ?>
                                                    <span itemprop="commentCount"><?php 
                            echo JComments::getCommentsCount((int) $row->id, 'com_tz_portfolio');
                            ?>
</span>
                                        <?php 
                        }
                    }
                    ?>
                                    <?php 
                }
                ?>
                                    <?php 
                if ($params->get('tz_comment_type') == 'disqus') {
                    ?>
                                        <?php 
                    if (isset($row->commentCount)) {
                        ?>
Exemple #6
0
			<?php 
        $this->escape(JText::printf($this->escape($this->article->created_by_alias) ? $this->escape($this->article->created_by_alias) : $this->escape($this->article->author)));
        ?>

		</span>
	<?php 
    }
    ?>


	<?php 
    $comments = JPATH_SITE . '/components/com_jcomments/jcomments.php';
    if (file_exists($comments)) {
        require_once $comments;
        if (JCommentsContentPluginHelper::checkCategory($this->article->catid) && (JCommentsContentPluginHelper::isEnabled($this->article, false) || !JCommentsContentPluginHelper::isDisabled($this->article, false))) {
            $jcomment_count = JComments::getCommentsCount($this->article->id, 'com_content');
            ?>

	
		<a class="comments" href="<?php 
            echo $this->article->readmore_link;
            ?>
#comments"><?php 
            echo $jcomment_count;
            ?>
 <?php 
            echo JText::_('COMMENTS');
            ?>
</a>
			
	<?php 
    function getJComments($content, $config)
    {
        //
        $db = JFactory::getDBO();
        $counters_tab = array();
        //
        if (count($content) > 0) {
            // initializing variables
            $sql_where = '';
            $ids = $content['ID'];
            //
            for ($i = 0; $i < count($ids); $i++) {
                // linking string with content IDs
                $sql_where .= $i != 0 ? ' OR content.id = ' . $ids[$i] : ' content.id = ' . $ids[$i];
            }
            // creating SQL query
            $query_news = '
		   SELECT
		   		content.id AS id
		   FROM
		        #__k2_items AS content
		   WHERE
		        ( ' . $sql_where . ' )
		   ;';
            // run SQL query
            $db->setQuery($query_news);
            // when exist some results
            if ($counters = $db->loadObjectList()) {
                $comments = JPATH_BASE . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
                // generating tables of news data
                if (file_exists($comments)) {
                    require_once $comments;
                    foreach ($counters as $item) {
                        $item->count = JComments::getCommentsCount($item->id, 'com_k2');
                        $counters_tab['art' . $item->id] = $item->count;
                    }
                } else {
                    foreach ($counters as $item) {
                        $counters_tab['art' . $item->id] = 0;
                    }
                }
            }
        }
        return $counters_tab;
    }
function showTopicCommentsShort($data)
{
    $db =& JFactory::getDbo();
    $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
    $option = 'com_joomla_lms';
    $JLMS_CONFIG =& JLMSFactory::getConfig();
    $Itemid = $JLMS_CONFIG->get('Itemid');
    $botParams = $_JLMS_PLUGINS->getPluginParams('jc_integration');
    $obj_data = new stdClass();
    if ($botParams->get('topic_comments', 1)) {
        $comments = JPATH_SITE . '/components/com_jcomments/jcomments.php';
        if (file_exists($comments)) {
            require_once $comments;
            include_once JCOMMENTS_HELPERS . DS . 'system.php';
            $document =& JFactory::getDocument();
            $document->addStyleSheet(JCommentsSystemPluginHelper::getCSS());
            $count = JComments::getCommentsCount($data->id, $data->component);
            $count = isset($count) && intval($count) ? $count : 0;
            $link = 'index.php?option=' . $option . '&task=topic&course_id=' . $data->course_id . '&topic_id=' . $data->id;
            $link .= '&short=1';
            $link .= '&Itemid=' . $Itemid;
            $user =& JFactory::getUser();
            $link_text = $count || !$user->get('id') ? str_replace('{X}', $count, _JLMS_PLUGIN_JC_COMMENTS) : _JLMS_PLUGIN_JC_ADD_COMMENTS;
            $obj_data->short = '<div class="jcomments-links"><a class="comments-link" href="' . JLMSRoute::_($link) . '" title="' . _JLMS_PLUGIN_JC_A_TITLE . '">' . $link_text . '</a></div>';
        }
    }
    if (isset($obj_data->short)) {
        JLMS_TMPL::OpenTS('', ' colspan="2" align="right"');
        echo $obj_data->short;
        JLMS_TMPL::CloseTS();
    }
    return $obj_data;
}
Exemple #9
0
 public static function get_comment_count($type, $app_name, $id = 0, $title = '', $url = '', $identifier = '', $item = null)
 {
     switch ($type) {
         case 'jcomment':
             $app = JFactory::getApplication();
             $path = JPATH_ROOT . '/components/com_jcomments/jcomments.php';
             if (file_exists($path)) {
                 require_once $path;
                 return JComments::getCommentsCount($id, $app_name);
             }
             break;
         case 'fbcomment':
             $json = json_decode(file_get_contents('https://graph.facebook.com/?ids=' . $url));
             return isset($json->{$url}->comments) ? $json->{$url}->comments : 0;
         case 'disqus':
             // 				$document = JFactory::getDocument();
             // 				$document->addScript('http://' + $identifier + '.disqus.com/count.js');
             break;
         case 'intensedebate':
             break;
         case 'jacomment':
             break;
         case 'kommento':
             break;
         case 'ccomment':
             break;
     }
 }
Exemple #10
0
                            echo $text;
                        }
                        ?>
								</a>								
							</span>			
						<?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') {
                            ?>
Exemple #11
0
 function getCommentCount(&$item){
     $jcommment_enabled = false;
     $comments = JPATH_SITE . '/components/com_jcomments/jcomments.php';
     if (file_exists($comments) ) {
         require_once($comments);
         $jcommment_enabled = true;
     }
     
     if ($jcommment_enabled && JCommentsContentPluginHelper::checkCategory($item->catid) && (JCommentsContentPluginHelper::isEnabled($item, false) || !JCommentsContentPluginHelper::isDisabled($item, false))){
         $count = JComments::getCommentsCount($item->id, 'com_content');
         if ($count == null) $count = 0;
         return $count;
     }
     return false;
 }
Exemple #12
0
 public static function deleteComment($id)
 {
     if (JCommentsSecurity::badRequest() == 1) {
         JCommentsSecurity::notAuth();
     }
     $acl = JCommentsFactory::getACL();
     $db = JCommentsFactory::getDBO();
     $config = JCommentsFactory::getConfig();
     $response = JCommentsFactory::getAjaxResponse();
     $comment = new JCommentsTableComment($db);
     if ($comment->load((int) $id)) {
         if ($acl->isLocked($comment)) {
             $response->addAlert(JText::_('ERROR_BEING_EDITTED'));
         } else {
             if ($acl->canDelete($comment)) {
                 $object_id = $comment->object_id;
                 $object_group = $comment->object_group;
                 $currentPage = 1;
                 if ($config->get('template_view') != 'tree' && $config->getInt('comments_per_page') > 0) {
                     require_once JCOMMENTS_HELPERS . DS . 'pagination.php';
                     $pagination = new JCommentsPagination($object_id, $object_group);
                     $currentPage = $pagination->getCommentPage($object_id, $object_group, $id);
                 }
                 $result = JCommentsEvent::trigger('onJCommentsCommentBeforeDelete', array(&$comment));
                 if (!in_array(false, $result, true)) {
                     if ($config->getInt('delete_mode') == 0) {
                         $comment->delete();
                         $count = JComments::getCommentsCount($object_id, $object_group, '', true);
                         if ($config->get('template_view') == 'tree') {
                             if ($count > 0) {
                                 $response->addScript("jcomments.updateComment('{$id}','');");
                             } else {
                                 $response->addScript("jcomments.updateTree('',null);");
                             }
                         } else {
                             if ($count > 0) {
                                 if ($config->getInt('comments_per_page') > 0) {
                                     $pagination->setCommentsCount($count);
                                     $currentPage = min($currentPage, $pagination->getTotalPages());
                                     $html = JComments::getCommentsList($object_id, $object_group, $currentPage);
                                     $html = JCommentsText::jsEscape($html);
                                     $response->addScript("jcomments.updateList('{$html}','r');");
                                 } else {
                                     $response->addScript("jcomments.updateComment('{$id}','');");
                                 }
                             } else {
                                 $response->addScript("jcomments.updateList('','r');");
                             }
                         }
                     } else {
                         $comment->markAsDeleted();
                         $html = JCommentsText::jsEscape(JComments::getCommentItem($comment));
                         $response->addScript("jcomments.updateComment(" . $comment->id . ", '{$html}');");
                     }
                     JCommentsEvent::trigger('onJCommentsCommentAfterDelete', array(&$comment));
                 }
             } else {
                 $response->addAlert(JText::_('ERROR_CANT_DELETE'));
             }
         }
     }
     return $response;
 }
Exemple #13
0
 function onJCommentsCount($object_id, $object_group)
 {
     $coreFile = JPATH_ROOT . '/components/com_jcomments/jcomments.php';
     if (is_file($coreFile)) {
         include_once $coreFile;
         echo JComments::getCommentsCount($object_id, $object_group);
     }
 }
Exemple #14
0
        echo $this->item->readmore_link;
        ?>
" class="contentpagetitle<?php 
        echo $this->escape($this->item->params->get('pageclass_sfx'));
        ?>
"><?php 
        echo $this->escape($this->item->title);
        ?>
</a><?php 
    } else {
        echo $this->escape($this->item->title);
    }
    ?>
</span></h2>
	<?php 
}
?>

	<?php 
if ($this->item->params->get('show_create_date') || $this->item->params->get('show_author') && $this->item->author != "" || ($this->item->params->get('show_section') && $this->item->sectionid || $this->item->params->get('show_category') && $this->item->catid) || ($this->item->params->get('show_pdf_icon') || $this->item->params->get('show_print_icon') || $this->item->params->get('show_email_icon')) || $this->item->params->get('show_url') && $this->item->urls) {
    ?>

<div class="article-tools clearfix">
<div class="article-meta">
	<?php 
    if ($this->item->params->get('show_create_date')) {
        ?>
		<?php 
        $article_time = strtotime($this->item->created);
        ?>
	<span class="createdate">