Example #1
0
 /**
  * Process comments data
  **/
 public static function process($row, $admin = 0)
 {
     if (isset($row->processed) && $row->processed) {
         return $row;
     }
     Komento::setCurrentComponent($row->component);
     $config = Komento::getConfig();
     $konfig = Komento::getKonfig();
     $user = JFactory::getUser()->id;
     $commentsModel = Komento::getModel('comments');
     Komento::import('helper', 'date');
     // Duplicate created date first before lapsed time messing up the original date
     $row->unformattedDate = $row->created;
     // get number of child for each comment
     $row->childs = $commentsModel->getTotalChilds($row->id);
     // set url to proper url
     if (!empty($row->url)) {
         // Add 'http://' if not present
         $row->url = 0 === strpos($row->url, 'http') ? $row->url : 'http://' . $row->url;
     }
     // 1. Load article and article details
     $application = Komento::loadApplication($row->component)->load($row->cid);
     if ($application === false) {
         $application = Komento::getErrorApplication($row->component, $row->cid);
     }
     // set component title
     $row->componenttitle = $application->getComponentName();
     // set content title
     $row->contenttitle = $application->getContentTitle();
     // get permalink
     $row->pagelink = $application->getContentPermalink();
     $row->permalink = $row->pagelink . '#kmt-' . $row->id;
     // set parentlink
     if ($row->parent_id != 0) {
         $row->parentlink = $row->pagelink . '#kmt-' . $row->parent_id;
     }
     // to be reassign
     $row->shortlink = $row->permalink;
     // set extension object
     // use this to check if application is able to load article details
     // if row->extension is false, means error loading article details
     $row->extension = $application;
     if ($admin == 0) {
         // frontend
         $actionsModel = Komento::getModel('actions');
         $socialHelper = Komento::getHelper('social');
         // parse comments HTML
         $row->comment = self::parseComment($row->comment);
         // author's object
         $row->author = Komento::getProfile($row->created_by);
         // don't convert for guest
         if ($row->created_by != 0 && $row->created_by != $row->author->id) {
             if ($config->get('enable_orphanitem_convert')) {
                 KomentoCommentHelper::convertOrphanitem($row->id);
             }
         }
         if ($row->created_by != 0) {
             switch ($config->get('name_type')) {
                 case 'username':
                     // force username
                     $row->name = $row->author->getUsername();
                     break;
                 case 'name':
                     $row->name = $row->author->getName();
                     break;
                 case 'default':
                 default:
                     // default name to profile if name is null
                     if (empty($row->name)) {
                         $row->name = $row->author->getName();
                     }
                     break;
             }
         } else {
             if (empty($row->name)) {
                 $row->name = JText::_('COM_KOMENTO_GUEST');
             } else {
                 if ($config->get('guest_label')) {
                     $row->name = JText::_('COM_KOMENTO_GUEST') . ' - ' . $row->name;
                 }
             }
         }
         // set datetime
         if ($config->get('enable_lapsed_time')) {
             $row->created = KomentoDateHelper::getLapsedTime($row->unformattedDate);
         } else {
             $dateformat = $config->get('date_format');
             $row->created = KomentoDateHelper::toFormat(KomentoDateHelper::dateWithOffSet($row->created), $dateformat);
             // $row->created = Komento::getDate( $row->created )->toFormat( $dateformat );
         }
         // get actions likes
         $row->likes = $actionsModel->countAction('likes', $row->id);
         // get user liked
         $row->liked = $actionsModel->liked($row->id, $user);
         // get user reported
         $row->reported = $actionsModel->reported($row->id, $user);
     } else {
         // backend
         // format comments
         $row->comment = nl2br(Komento::getHelper('comment')->parseBBCode($row->comment));
         $row->created = KomentoDateHelper::dateWithOffSet($row->created);
     }
     $row->processed = true;
     return $row;
 }
Example #2
0
		<li class="kmt-author">
			<?php if( !Komento::getProfile( $row->created_by )->guest ) { ?>
				<a href="<?php echo Komento::getProfile( $row->created_by )->getProfileLink(); ?>">
			<?php }

				echo Komento::getProfile( $row->created_by )->getName();

				if( !Komento::getProfile( $row->created_by )->guest) { ?>
				</a>
			<?php } ?>
		</li>

		<!-- Time -->
		<li class="kmt-date">
			<?php if( $system->config->get( 'enable_lapsed_time') ) {
				echo KomentoDateHelper::getLapsedTime( $row->created );
			} else {
				echo $row->created;
			} ?>
		</li>

		<!-- Permalink -->
		<li class="kmt-permalink"><a href="<?php echo Komento::loadApplication( $row->component )->load( $row->cid )->getContentPermalink() . '#kmt-' . $row->id; ?>"><?php echo JText::_( 'COM_KOMENTO_COMMENT_PERMALINK' ) ; ?></a></li>

		<!-- Status -->
		<li class="kmt-status"><?php echo $row->published ? JText::_( 'COM_KOMENTO_PUBLISHED' ) : JText::_( 'COM_KOMENTO_UNPUBLISHED' );?></li>
	</ul>

	<div class="kmt-body">

		<?php // parseBBcode to HTML
Example #3
0
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */
defined('_JEXEC') or die('Restricted access');
?>

<div class="kmt-profile-info">
	<h3 class="kmt-profile-name reset-h"><?php 
echo $profile->getName();
?>
</h3>
	<div class="kmt-profile-account float-wrapper">
		<span><?php 
echo JText::_('COM_KOMENTO_MEMBER_SINCE');
?>
 <?php 
echo KomentoDateHelper::getLapsedTime($profile->registerDate);
?>
</span>
		<span><?php 
echo JText::_('COM_KOMENTO_LAST_LOGIN');
?>
 <?php 
echo KomentoDateHelper::getLapsedTime($profile->lastvisitDate);
?>
</span>
	</div>
</div>
Example #4
0
<?php
/**
 * @package		Komento
 * @copyright	Copyright (C) 2012 Stack Ideas Private Limited. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
 *
 * Komento is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */
defined('_JEXEC') or die('Restricted access');
?>

<div class="kmt-profile-info">
	<h1 class="kmt-profile-name reset-h"><?php echo $profile->getName(); ?></h1>
	<div class="kmt-profile-account float-wrapper">
		<span><?php echo JText::_('COM_KOMENTO_MEMBER_SINCE'); ?> <?php echo KomentoDateHelper::getLapsedTime($profile->registerDate); ?></span>
		<span><?php echo JText::_('COM_KOMENTO_LAST_LOGIN'); ?> <?php echo KomentoDateHelper::getLapsedTime($profile->lastvisitDate); ?></span>
	</div>
</div>