You've already forked joomla_test
first commit
This commit is contained in:
250
modules/mod_k2_comments/helper.php
Normal file
250
modules/mod_k2_comments/helper.php
Normal file
@ -0,0 +1,250 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: helper.php 1951 2013-03-22 12:15:28Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'route.php');
|
||||
require_once (JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'utilities.php');
|
||||
|
||||
class modK2CommentsHelper
|
||||
{
|
||||
|
||||
public static function getLatestComments(&$params)
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$limit = $params->get('comments_limit', '5');
|
||||
$user = JFactory::getUser();
|
||||
$aid = $user->get('aid');
|
||||
$db = JFactory::getDBO();
|
||||
$cid = $params->get('category_id', NULL);
|
||||
|
||||
$jnow = JFactory::getDate();
|
||||
$now = K2_JVERSION != '15' ? $jnow->toSql() : $jnow->toMySQL();
|
||||
$nullDate = $db->getNullDate();
|
||||
|
||||
$model = K2Model::getInstance('Item', 'K2Model');
|
||||
|
||||
$componentParams = JComponentHelper::getParams('com_k2');
|
||||
|
||||
$query = "SELECT c.*, i.catid, i.title, i.alias, category.alias as catalias, category.name as categoryname
|
||||
FROM #__k2_comments as c
|
||||
LEFT JOIN #__k2_items as i ON i.id=c.itemID
|
||||
LEFT JOIN #__k2_categories as category ON category.id=i.catid
|
||||
WHERE i.published=1
|
||||
AND ( i.publish_up = ".$db->Quote($nullDate)." OR i.publish_up <= ".$db->Quote($now)." )
|
||||
AND ( i.publish_down = ".$db->Quote($nullDate)." OR i.publish_down >= ".$db->Quote($now)." )
|
||||
AND i.trash=0 ";
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query .= " AND i.access IN(".implode(',', $user->getAuthorisedViewLevels()).") ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= " AND i.access<={$aid} ";
|
||||
}
|
||||
$query .= " AND category.published=1 AND category.trash=0 ";
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query .= " AND category.access IN(".implode(',', $user->getAuthorisedViewLevels()).") ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= " AND category.access<={$aid} ";
|
||||
}
|
||||
$query .= " AND c.published=1 ";
|
||||
|
||||
if ($params->get('catfilter'))
|
||||
{
|
||||
if (!is_null($cid))
|
||||
{
|
||||
if (is_array($cid))
|
||||
{
|
||||
JArrayHelper::toInteger($cid);
|
||||
$query .= " AND i.catid IN(".implode(',', $cid).")";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= " AND i.catid=".(int)$cid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
if ($mainframe->getLanguageFilter())
|
||||
{
|
||||
$languageTag = JFactory::getLanguage()->getTag();
|
||||
$query .= " AND category.language IN (".$db->Quote($languageTag).", ".$db->Quote('*').") AND i.language IN (".$db->Quote($languageTag).", ".$db->Quote('*').")";
|
||||
}
|
||||
}
|
||||
|
||||
$query .= " ORDER BY c.commentDate DESC ";
|
||||
|
||||
$db->setQuery($query, 0, $limit);
|
||||
$rows = $db->loadObjectList();
|
||||
$pattern = "@\b(https?://)?(([0-9a-zA-Z_!~*'().&=+$%-]+:)?[0-9a-zA-Z_!~*'().&=+$%-]+\@)?(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+\.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z]\.[a-zA-Z]{2,6})(:[0-9]{1,4})?((/[0-9a-zA-Z_!~*'().;?:\@&=+$,%#-]+)*/?)@";
|
||||
|
||||
if (count($rows))
|
||||
{
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
|
||||
if ($params->get('commentDateFormat') == 'relative')
|
||||
{
|
||||
$config = JFactory::getConfig();
|
||||
$now = new JDate();
|
||||
if (K2_JVERSION == '30')
|
||||
{
|
||||
$tzoffset = new DateTimeZone(JFactory::getApplication()->getCfg('offset'));
|
||||
$now->setTimezone($tzoffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
$tzoffset = $config->getValue('config.offset');
|
||||
$now->setOffset($tzoffset);
|
||||
}
|
||||
|
||||
$created = new JDate($row->commentDate);
|
||||
$diff = $now->toUnix() - $created->toUnix();
|
||||
$dayDiff = floor($diff / 86400);
|
||||
|
||||
if ($dayDiff == 0)
|
||||
{
|
||||
if ($diff < 5)
|
||||
{
|
||||
$row->commentDate = JText::_('K2_JUST_NOW');
|
||||
}
|
||||
elseif ($diff < 60)
|
||||
{
|
||||
$row->commentDate = $diff.' '.JText::_('K2_SECONDS_AGO');
|
||||
}
|
||||
elseif ($diff < 120)
|
||||
{
|
||||
$row->commentDate = JText::_('K2_1_MINUTE_AGO');
|
||||
}
|
||||
elseif ($diff < 3600)
|
||||
{
|
||||
$row->commentDate = floor($diff / 60).' '.JText::_('K2_MINUTES_AGO');
|
||||
}
|
||||
elseif ($diff < 7200)
|
||||
{
|
||||
$row->commentDate = JText::_('K2_1_HOUR_AGO');
|
||||
}
|
||||
elseif ($diff < 86400)
|
||||
{
|
||||
$row->commentDate = floor($diff / 3600).' '.JText::_('K2_HOURS_AGO');
|
||||
}
|
||||
}
|
||||
}
|
||||
$row->commentText = K2HelperUtilities::wordLimit($row->commentText, $params->get('comments_word_limit'));
|
||||
$row->commentText = preg_replace($pattern, '<a target="_blank" rel="nofollow" href="\0">\0</a>', $row->commentText);
|
||||
$row->itemLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($row->itemID.':'.urlencode($row->alias), $row->catid.':'.urlencode($row->catalias))));
|
||||
$row->link = $row->itemLink."#comment{$row->id}";
|
||||
$row->catLink = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($row->catid.':'.urlencode($row->catalias))));
|
||||
|
||||
if ($row->userID > 0)
|
||||
{
|
||||
$row->userLink = JRoute::_(K2HelperRoute::getUserRoute($row->userID));
|
||||
$getExistingUser = JFactory::getUser($row->userID);
|
||||
$row->userUsername = $getExistingUser->username;
|
||||
}
|
||||
else
|
||||
{
|
||||
$row->userUsername = $row->userName;
|
||||
}
|
||||
|
||||
// Switch between commenter name and username
|
||||
if ($params->get('commenterName', 1) == 2)
|
||||
$row->userName = $row->userUsername;
|
||||
|
||||
$row->userImage = '';
|
||||
|
||||
if ($params->get('commentAvatar'))
|
||||
{
|
||||
$row->userImage = K2HelperUtilities::getAvatar($row->userID, $row->commentEmail, $componentParams->get('commenterImgWidth'));
|
||||
}
|
||||
|
||||
$comments[] = $row;
|
||||
|
||||
}
|
||||
|
||||
return $comments;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function getTopCommenters(&$params)
|
||||
{
|
||||
|
||||
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'tables');
|
||||
$limit = $params->get('commenters_limit', '5');
|
||||
$user = JFactory::getUser();
|
||||
$aid = $user->get('aid');
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT COUNT(id) as counter, userName, userID, commentEmail FROM #__k2_comments WHERE userID > 0 AND published = 1 GROUP BY userID ORDER BY counter DESC";
|
||||
$db->setQuery($query, 0, $limit);
|
||||
$rows = $db->loadObjectList();
|
||||
$pattern = "@\b(https?://)?(([0-9a-zA-Z_!~*'().&=+$%-]+:)?[0-9a-zA-Z_!~*'().&=+$%-]+\@)?(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+\.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z]\.[a-zA-Z]{2,6})(:[0-9]{1,4})?((/[0-9a-zA-Z_!~*'().;?:\@&=+$,%#-]+)*/?)@";
|
||||
|
||||
$model = K2Model::getInstance('Item', 'K2Model');
|
||||
|
||||
$componentParams = JComponentHelper::getParams('com_k2');
|
||||
|
||||
if (count($rows))
|
||||
{
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
|
||||
if ($row->counter > 0)
|
||||
{
|
||||
$row->link = JRoute::_(K2HelperRoute::getUserRoute($row->userID));
|
||||
|
||||
if ($params->get('commenterNameOrUsername', 1) == 2)
|
||||
{
|
||||
$getExistingUser = JFactory::getUser($row->userID);
|
||||
$row->userName = $getExistingUser->username;
|
||||
}
|
||||
|
||||
if ($params->get('commentAvatar'))
|
||||
{
|
||||
$row->userImage = K2HelperUtilities::getAvatar($row->userID, $row->commentEmail, $componentParams->get('commenterImgWidth'));
|
||||
}
|
||||
|
||||
if ($params->get('commenterLatestComment'))
|
||||
{
|
||||
$query = "SELECT * FROM #__k2_comments WHERE userID = ".(int)$row->userID." AND published = 1 ORDER BY commentDate DESC";
|
||||
|
||||
$db->setQuery($query, 0, 1);
|
||||
$comment = $db->loadObject();
|
||||
|
||||
$item = JTable::getInstance('K2Item', 'Table');
|
||||
$item->load($comment->itemID);
|
||||
|
||||
$category = JTable::getInstance('K2Category', 'Table');
|
||||
$category->load($item->catid);
|
||||
|
||||
$row->latestCommentText = $comment->commentText;
|
||||
$row->latestCommentText = preg_replace($pattern, '<a target="_blank" rel="nofollow" href="\0">\0</a>', $row->latestCommentText);
|
||||
$row->latestCommentLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($item->id.':'.urlencode($item->alias), $item->catid.':'.urlencode($category->alias))))."#comment{$comment->id}";
|
||||
$row->latestCommentDate = $comment->commentDate;
|
||||
}
|
||||
|
||||
$commenters[] = $row;
|
||||
}
|
||||
}
|
||||
if (isset($commenters))
|
||||
return $commenters;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
1
modules/mod_k2_comments/index.html
Normal file
1
modules/mod_k2_comments/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
65
modules/mod_k2_comments/mod_k2_comments.php
Normal file
65
modules/mod_k2_comments/mod_k2_comments.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: mod_k2_comments.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$language = JFactory::getLanguage();
|
||||
$language->load('mod_k2.j16', JPATH_ADMINISTRATOR, null, true);
|
||||
}
|
||||
|
||||
require_once (dirname(__FILE__).DS.'helper.php');
|
||||
|
||||
// Params
|
||||
$moduleclass_sfx = $params->get('moduleclass_sfx', '');
|
||||
$module_usage = $params->get('module_usage', '0');
|
||||
|
||||
$commentAvatarWidthSelect = $params->get('commentAvatarWidthSelect', 'custom');
|
||||
$commentAvatarWidth = $params->get('commentAvatarWidth', 50);
|
||||
|
||||
$commenterAvatarWidthSelect = $params->get('commenterAvatarWidthSelect', 'custom');
|
||||
$commenterAvatarWidth = $params->get('commenterAvatarWidth', 50);
|
||||
|
||||
// Get component params
|
||||
$componentParams = JComponentHelper::getParams('com_k2');
|
||||
|
||||
// User avatar for latest comments
|
||||
if ($commentAvatarWidthSelect == 'inherit')
|
||||
{
|
||||
$lcAvatarWidth = $componentParams->get('commenterImgWidth');
|
||||
}
|
||||
else
|
||||
{
|
||||
$lcAvatarWidth = $commentAvatarWidth;
|
||||
}
|
||||
|
||||
// User avatar for top commenters
|
||||
if ($commenterAvatarWidthSelect == 'inherit')
|
||||
{
|
||||
$tcAvatarWidth = $componentParams->get('commenterImgWidth');
|
||||
}
|
||||
else
|
||||
{
|
||||
$tcAvatarWidth = $commenterAvatarWidth;
|
||||
}
|
||||
|
||||
switch($module_usage)
|
||||
{
|
||||
case '0' :
|
||||
$comments = modK2CommentsHelper::getLatestComments($params);
|
||||
require (JModuleHelper::getLayoutPath('mod_k2_comments', 'comments'));
|
||||
break;
|
||||
|
||||
case '1' :
|
||||
$commenters = modK2CommentsHelper::getTopCommenters($params);
|
||||
require (JModuleHelper::getLayoutPath('mod_k2_comments', 'commenters'));
|
||||
break;
|
||||
}
|
111
modules/mod_k2_comments/mod_k2_comments.xml
Normal file
111
modules/mod_k2_comments/mod_k2_comments.xml
Normal file
@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="module" client="site" version="2.5" method="upgrade">
|
||||
<name>K2 Comments</name>
|
||||
<author>JoomlaWorks</author>
|
||||
<creationDate>July 8th, 2013</creationDate>
|
||||
<copyright>Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.</copyright>
|
||||
<authorEmail>please-use-the-contact-form@joomlaworks.net</authorEmail>
|
||||
<authorUrl>www.joomlaworks.net</authorUrl>
|
||||
<version>2.6.7</version>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<description>MOD_K2_COMMENTS_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_k2_comments">mod_k2_comments.php</filename>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic" addfieldpath="/administrator/components/com_k2/elements/">
|
||||
<field name="moduleclass_sfx" type="text" default="" label="K2_MODULE_CLASS_SUFFIX" description="K2_MODULE_CLASS_SUFFIX_DESCRIPTION"/>
|
||||
<field name="module_usage" type="list" default="" label="K2_SELECT_MODULE_FUNCTIONALITY" description="K2_SELECT_MODULE_FUNCTIONALITY_DESC">
|
||||
<option value="0">K2_LATEST_COMMENTS</option>
|
||||
<option value="1">K2_TOP_COMMENTERS</option>
|
||||
</field>
|
||||
<!-- Latest Comments -->
|
||||
<field name="" type="header" default="K2_LATEST_COMMENTS" label="" description=""/>
|
||||
<field name="catfilter" type="radio" default="0" label="K2_CATEGORY_FILTER">
|
||||
<option value="0">K2_ALL</option>
|
||||
<option value="1">K2_SELECT</option>
|
||||
</field>
|
||||
<field name="category_id" type="categoriesmultiple" default="" label="K2_FILTER_COMMENTS_BY_SELECTED_CATEGORIES" description="K2_SELECT_ONE_ORE_MORE_CATEGORIES_FROM_WHICH_YOU_WANT_TO_FILTER_THEIR_COMMENTS_SELECT_NONE_TO_FETCH_COMMENTS_FROM_ALL_CATEGORIES"/>
|
||||
<field name="comments_limit" type="text" size="4" default="5" label="K2_COMMENTS_LIST_LIMIT" description=""/>
|
||||
<field name="comments_word_limit" type="text" size="4" default="10" label="K2_COMMENT_WORD_LIMIT" description="K2_IF_WORD_LIMIT_IS_ENABLED_ANY_HTML_TAGS_WILL_BE_STRIPPED_OFF_TO_PREVENT_THE_PAGE_MARKUP_FROM_BREAKING"/>
|
||||
<field name="commenterName" type="list" default="1" label="K2_COMMENTER_IDENTIFIER" description="">
|
||||
<option value="0">K2_DONTSHOW</option>
|
||||
<option value="1">K2_SHOW_NAME</option>
|
||||
<option value="2">K2_SHOW_USERNAME_IFEXISTS</option>
|
||||
</field>
|
||||
<field name="commentAvatar" type="radio" default="1" label="K2_COMMENTER_AVATAR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="commentAvatarWidthSelect" type="list" default="custom" label="K2_COMMENTER_AVATAR_WIDTH" description="">
|
||||
<option value="inherit">K2_INHERIT_FROM_COMPONENT_PARAMETERS</option>
|
||||
<option value="custom">K2_USE_CUSTOM_WIDTH</option>
|
||||
</field>
|
||||
<field name="commentAvatarWidth" type="text" default="50" size="4" label="K2_CUSTOM_WIDTH_FOR_COMMENTER_AVATAR_IN_PX" description=""/>
|
||||
<field name="commentDate" type="radio" default="1" label="K2_COMMENT_DATE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="commentDateFormat" type="list" default="absolute" label="K2_COMMENT_DATE_FORMAT" description="">
|
||||
<option value="absolute">K2_ABSOLUTE_EG_POSTED_1225_THU_JULY_30TH</option>
|
||||
<option value="relative">K2_RELATIVE_EG_POSTED_2_HOURS_AGO</option>
|
||||
</field>
|
||||
<field name="commentLink" type="radio" default="1" label="K2_COMMENT_LINK" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemTitle" type="radio" default="1" label="K2_ITEM_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemCategory" type="radio" default="1" label="K2_ITEM_CATEGORY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="feed" type="radio" default="1" label="K2_FEED_LINK" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<!-- Top Commenters -->
|
||||
<field name="" type="header" default="K2_TOP_COMMENTERS" label="" description=""/>
|
||||
<field name="commenters_limit" type="text" size="4" default="5" label="K2_COMMENTERS_LIST_LIMIT" description=""/>
|
||||
<field name="commenterNameOrUsername" type="list" default="1" label="K2_COMMENTER_IDENTIFIER" description="">
|
||||
<option value="1">K2_SHOW_NAME</option>
|
||||
<option value="2">K2_SHOW_USERNAME</option>
|
||||
</field>
|
||||
<field name="commenterAvatar" type="radio" default="1" label="K2_COMMENTER_AVATAR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="commenterAvatarWidthSelect" type="list" default="custom" label="K2_COMMENTER_AVATAR_WIDTH" description="">
|
||||
<option value="inherit">K2_INHERIT_FROM_COMPONENT_PARAMETERS</option>
|
||||
<option value="custom">K2_USE_CUSTOM_WIDTH</option>
|
||||
</field>
|
||||
<field name="commenterAvatarWidth" type="text" default="50" size="4" label="K2_CUSTOM_WIDTH_FOR_COMMENTER_AVATAR_IN_PX" description=""/>
|
||||
<field name="commenterLink" type="radio" default="1" label="K2_COMMENTER_LINK_TO_USER_PAGE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="commenterCommentsCounter" type="radio" default="1" label="K2_COMMENTS_COUNTER" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="commenterLatestComment" type="radio" default="1" label="K2_LATEST_COMMENT_FROM_EACH_COMMENTER" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset name="advanced">
|
||||
<field name="cache" type="list" default="1" label="K2_CACHING" description="K2_SELECT_WHETHER_TO_CACHE_THE_CONTENT_OF_THIS_MODULE">
|
||||
<option value="1">K2_USE_GLOBAL</option>
|
||||
<option value="0">K2_NO_CACHING</option>
|
||||
</field>
|
||||
<field name="cache_time" type="text" default="900" label="K2_CACHE_TIME" description="K2_THE_TIME_IN_SECONDS_BEFORE_THE_MODULE_IS_RECACHED"/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
54
modules/mod_k2_comments/tmpl/commenters.php
Normal file
54
modules/mod_k2_comments/tmpl/commenters.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: commenters.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
|
||||
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2TopCommentersBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
|
||||
<?php if(count($commenters)): ?>
|
||||
<ul>
|
||||
<?php foreach ($commenters as $key=>$commenter): ?>
|
||||
<li class="<?php echo ($key%2) ? "odd" : "even"; if(count($commenters)==$key+1) echo ' lastItem'; ?>">
|
||||
|
||||
<?php if($commenter->userImage): ?>
|
||||
<a class="k2Avatar tcAvatar" rel="author" href="<?php echo $commenter->link; ?>">
|
||||
<img src="<?php echo $commenter->userImage; ?>" alt="<?php echo JFilterOutput::cleanText($commenter->userName); ?>" style="width:<?php echo $tcAvatarWidth; ?>px;height:auto;" />
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('commenterLink')): ?>
|
||||
<a class="tcLink" rel="author" href="<?php echo $commenter->link; ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<span class="tcUsername"><?php echo $commenter->userName; ?></span>
|
||||
|
||||
<?php if($params->get('commenterCommentsCounter')): ?>
|
||||
<span class="tcCommentsCounter">(<?php echo $commenter->counter; ?>)</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('commenterLink')): ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('commenterLatestComment')): ?>
|
||||
<a class="tcLatestComment" href="<?php echo $commenter->latestCommentLink; ?>">
|
||||
<?php echo $commenter->latestCommentText; ?>
|
||||
</a>
|
||||
<span class="tcLatestCommentDate"><?php echo JText::_('K2_POSTED_ON'); ?> <?php echo JHTML::_('date', $commenter->latestCommentDate, JText::_('K2_DATE_FORMAT_LC2')); ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="clr"></div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<li class="clearList"></li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
81
modules/mod_k2_comments/tmpl/comments.php
Normal file
81
modules/mod_k2_comments/tmpl/comments.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: comments.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
|
||||
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2LatestCommentsBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
|
||||
|
||||
<?php if(count($comments)): ?>
|
||||
<ul>
|
||||
<?php foreach ($comments as $key=>$comment): ?>
|
||||
<li class="<?php echo ($key%2) ? "odd" : "even"; if(count($comments)==$key+1) echo ' lastItem'; ?>">
|
||||
<?php if($comment->userImage): ?>
|
||||
<a class="k2Avatar lcAvatar" href="<?php echo $comment->link; ?>" title="<?php echo K2HelperUtilities::cleanHtml($comment->commentText); ?>">
|
||||
<img src="<?php echo $comment->userImage; ?>" alt="<?php echo JFilterOutput::cleanText($comment->userName); ?>" style="width:<?php echo $lcAvatarWidth; ?>px;height:auto;" />
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('commentLink')): ?>
|
||||
<a href="<?php echo $comment->link; ?>"><span class="lcComment"><?php echo $comment->commentText; ?></span></a>
|
||||
<?php else: ?>
|
||||
<span class="lcComment"><?php echo $comment->commentText; ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('commenterName')): ?>
|
||||
<span class="lcUsername"><?php echo JText::_('K2_WRITTEN_BY'); ?>
|
||||
<?php if(isset($comment->userLink)): ?>
|
||||
<a rel="author" href="<?php echo $comment->userLink; ?>"><?php echo $comment->userName; ?></a>
|
||||
<?php elseif($comment->commentURL): ?>
|
||||
<a target="_blank" rel="nofollow" href="<?php echo $comment->commentURL; ?>"><?php echo $comment->userName; ?></a>
|
||||
<?php else: ?>
|
||||
<?php echo $comment->userName; ?>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('commentDate')): ?>
|
||||
<span class="lcCommentDate">
|
||||
<?php if($params->get('commentDateFormat') == 'relative'): ?>
|
||||
<?php echo $comment->commentDate; ?>
|
||||
<?php else: ?>
|
||||
<?php echo JText::_('K2_ON'); ?> <?php echo JHTML::_('date', $comment->commentDate, JText::_('K2_DATE_FORMAT_LC2')); ?>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="clr"></div>
|
||||
|
||||
<?php if($params->get('itemTitle')): ?>
|
||||
<span class="lcItemTitle"><a href="<?php echo $comment->itemLink; ?>"><?php echo $comment->title; ?></a></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('itemCategory')): ?>
|
||||
<span class="lcItemCategory">(<a href="<?php echo $comment->catLink; ?>"><?php echo $comment->categoryname; ?></a>)</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="clr"></div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<li class="clearList"></li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($params->get('feed')): ?>
|
||||
<div class="k2FeedIcon">
|
||||
<a href="<?php echo JRoute::_('index.php?option=com_k2&view=itemlist&format=feed&moduleID='.$module->id); ?>" title="<?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?>">
|
||||
<span><?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?></span>
|
||||
</a>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
Reference in New Issue
Block a user