当前位置: 首页>>代码示例>>PHP>>正文


PHP Komento::getComment方法代码示例

本文整理汇总了PHP中Komento::getComment方法的典型用法代码示例。如果您正苦于以下问题:PHP Komento::getComment方法的具体用法?PHP Komento::getComment怎么用?PHP Komento::getComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Komento的用法示例。


在下文中一共展示了Komento::getComment方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mark

	function mark()
	{
		$type		= JRequest::getVar('type');
		$id			= JRequest::getInt('id');
		$userId		= JFactory::getUser()->id;

		$ajax		= Komento::getHelper('Ajax');
		$commentObj	= Komento::getComment( $id );

		$commentObj->load( $id );
		$commentObj->flag = $type;
		$commentObj->flag_by = $userId;

		if( !$commentObj->save() )
		{
			$ajax->fail();
			$ajax->send();
		}

		$ajax->success();
		$ajax->send();
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:22,代码来源:view.ajax.php

示例2: download

	public function download()
	{
		$id	= JRequest::getInt( 'id' );

		// need to get component to check acl because controller link component is com_komento

		$filetable = Komento::getTable( 'uploads' );
		if( !$filetable->load( $id ) )
		{
			echo JText::_( 'COM_KOMENTO_ATTACHMENT_INVALID_ID' );
			exit;
		}

		$comment = Komento::getComment( $filetable->uid );

		$profile = Komento::getProfile();
		if( !$profile->allow( 'download_attachment', $comment->component ) )
		{
			echo JText::_( 'COM_KOMENTO_ATTACHMENT_NO_PERMISSION' );
			exit;
		}

		return $filetable->download();
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:24,代码来源:file.php

示例3: addJomSocialActivityLike

	public function addJomSocialActivityLike( $comment, $uid )
	{
		if( !is_object( $comment ) )
		{
			$comment = Komento::getComment( $comment );
		}

		$comment = Komento::getHelper( 'comment' )->process( $comment );
		$comment->comment = JString::substr( strip_tags( $comment->comment ), 0 , Komento::getConfig()->get( 'jomsocial_comment_length' ) );

		$options = array(
			'title'			=> JText::sprintf('COM_KOMENTO_JOMSOCIAL_ACTIVITY_LIKED_COMMENT', $comment->permalink, $comment->pagelink, $comment->extension->getContentTitle() ),
			'content'		=> $comment->comment,
			'cmd'			=> 'komento.comment.like',
			// 'app'			=> $comment->component,
			// due to js 2.8
			'app'			=> 'komento',
			'cid'			=> $comment->cid,
			'actor'			=> $uid,
			'comment_id'	=> $comment->id,
			'comment_type'	=> 'com_komento.comments',
			'like_id'		=> $comment->id,
			'like_type'		=> 'com_komento.likes'
		);
		self::addJomSocialActivity( $options );
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:26,代码来源:activity.php

示例4: defined

 * 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');
if ($system->config->get('enable_reply_reference') && $row->parent_id != 0) {
    ?>
<span class="inReplyTo kmt-inreplyto">
	<?php 
    if ($system->config->get('enable_threaded')) {
        $name = '';
        $parent = Komento::getComment($row->parent_id, true);
        echo JText::sprintf('COM_KOMENTO_COMMENT_IN_REPLY_TO_NAME', $row->parentlink, $parent->name);
        // echo JText::sprintf( 'COM_KOMENTO_COMMENT_IN_REPLY_TO_NAME', $row->parentlink, $parent->name );
    } else {
        // non threaded no need to show name, because will have parent comment as a popup when hover over comment id
        echo JText::sprintf('COM_KOMENTO_COMMENT_IN_REPLY_TO', $row->parentlink, $row->parent_id);
        // echo JText::sprintf( 'COM_KOMENTO_COMMENT_IN_REPLY_TO', $row->parentlink, $row->parent_id );
    }
    $parent = '';
    if ($system->konfig->get('parent_preload')) {
        $parent = Komento::getComment($row->parent_id);
    }
    $parentTheme = Komento::getTheme(true);
    $parentTheme->set('parent', $parent);
    echo $parentTheme->fetch('comment/item/parent.php');
    ?>
</span>
<?php 
}
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:31,代码来源:inreplyto.php

示例5: defined

* 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-mod mod_komento_activities kmt-mod-activities<?php 
echo $params->get('moduleclass_sfx');
?>
">
	<?php 
foreach ($activities as $activity) {
    $activity->comment = Komento::getComment($activity->comment_id, $process = true);
    $activity->comment->comment = strip_tags($activity->comment->comment);
    // trim comment length
    if (JString::strlen($activity->comment->comment) > $params->get('maxcommentlength')) {
        $activity->comment->comment = JString::substr($activity->comment->comment, 0, $params->get('maxcommentlength')) . '...';
    }
    // trim title length
    if (JString::strlen($activity->comment->contenttitle) > $params->get('maxtitlelength')) {
        $activity->comment->contenttitle = JString::substr($activity->comment->contenttitle, 0, $params->get('maxtitlelength')) . '...';
    }
    $profile = Komento::getProfile($activity->uid);
    $config = Komento::getConfig($activity->comment->component);
    if ($activity->uid != 0 && $profile->id != $activity->uid && $config->get('enable_orphanitem_convert')) {
        $table = Komento::getTable('activities');
        $table->load($activity->id);
        $table->uid = $config->get('orphanitem_ownership');
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:31,代码来源:default.php

示例6: allow

	public static function allow( $type, $comment = '', $component = '', $cid = '' )
	{
		// for complicated acl situations
		// $type = ['edit', 'delete', 'publish', 'unpublish', 'stick', 'delete_attachment'];

		if( !empty( $comment ) && ( empty( $component ) || empty( $cid ) ) )
		{
			if( !is_object( $comment ) )
			{
				$comment = Komento::getComment( $comment );
			}

			$component = $comment->component;
			$cid = $comment->cid;
		}

		if( empty( $component ) || empty( $cid ) )
		{
			return false;
		}

		$profile		= Komento::getProfile();
		$application	= Komento::loadApplication( $component )->load( $cid );

		Komento::setCurrentComponent( $component );

		switch( $type )
		{
			case 'edit':
				if( $profile->id != 0 && ($profile->allow( 'edit_all_comment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_edit_comment' ) ) || ( $profile->id == $comment->created_by && $profile->allow( 'edit_own_comment' ))))
				{
					return true;
				}
				break;
			case 'delete':
				if( $profile->id != 0 && ($profile->allow( 'delete_all_comment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_delete_comment' ) ) || ( $profile->id == $comment->created_by && $profile->allow( 'delete_own_comment' ))))
				{
					return true;
				}
				break;
			case 'publish':
				if( $profile->allow( 'publish_all_comment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_publish_comment' ) ) )
				{
					return true;
				}
				break;
			case 'unpublish':
				if( $profile->allow( 'unpublish_all_comment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_unpublish_comment' ) ) )
				{
					return true;
				}
				break;
			case 'stick':
				if( $profile->allow( 'stick_all_comment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_stick_comment' ) ) )
				{
					return true;
				}
				break;
			case 'like':
				if( $profile->allow( 'like_comment' ) )
				{
					return true;
				}
				break;
			case 'report':
				if( $profile->allow( 'report_comment' ) )
				{
					return true;
				}
				break;
			case 'delete_attachment':
				if( $profile->allow( 'delete_all_attachment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_delete_attachment' ) ) || ( $profile->id == $comment->created_by && $profile->allow( 'delete_own_attachment' ) ) )
				{
					return true;
				}
				break;
		}

		return false;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:80,代码来源:acl.php

示例7: onAfterSaveComment

 public function onAfterSaveComment($comment)
 {
     CSubscriptionsHelper::subscribe_record($this->_item->id);
     ATlog::log($this->_item, ATlog::COM_NEW, $comment->id);
     CEventsHelper::notify('record', CEventsHelper::_COMMENT_NEW, $this->_item->id, $this->_item->section_id, JFactory::getApplication()->input->getInt('cat_id'), $comment->id, 0, $this->_item);
     if ($comment->parent_id > 0) {
         $parent = Komento::getComment($comment->parent_id);
         if ($parent->created_by) {
             CEventsHelper::notify('record', CEventsHelper::_COMMENT_REPLY, $this->_item->id, $this->_item->section_id, JFactory::getApplication()->input->getInt('cat_id'), $parent->id, 0, $this->_item, 2, $parent->created_by);
         }
     }
     $this->_update_comments($comment->cid);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:13,代码来源:com_cobalt.php

示例8: approveComment

 public function approveComment()
 {
     $id = JRequest::getInt('commentId', '');
     $comment = Komento::getComment($id);
     Komento::setCurrentComponent($comment->component);
     $acl = Komento::getHelper('acl');
     $type = 'message';
     $message = '';
     if (!$acl->allow('publish', $comment)) {
         $type = 'error';
         $message = JText::_('COM_KOMENTO_NOT_ALLOWED');
         $this->setRedirect('index.php?option=com_komento', $message, $type);
         return false;
     }
     $model = Komento::getModel('comments');
     if ($model->publish($id)) {
         $message = JText::_('COM_KOMENTO_COMMENTS_COMMENT_PUBLISHED');
     } else {
         $message = JText::_('COM_KOMENTO_COMMENTS_COMMENT_PUBLISH_ERROR');
         $type = 'error';
     }
     $this->setRedirect('index.php?option=com_komento', $message, $type);
     return true;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:24,代码来源:controller.php

示例9: getCommentDepth

 function getCommentDepth($id)
 {
     $comment = Komento::getComment($id);
     $component = $comment->component;
     $cid = $comment->cid;
     $query = 'SELECT COUNT(`parent`.`id`)-1 AS `depth`';
     $query .= ' FROM `#__komento_comments` AS `node`';
     $query .= ' INNER JOIN `#__komento_comments` AS `parent` on parent.component = node.component and node.cid = parent.cid';
     $query .= ' WHERE `node`.`component` = ' . $this->db->Quote($component);
     $query .= ' AND `node`.`cid` = ' . $this->db->Quote($cid);
     $query .= ' AND `node`.`id` = ' . $this->db->Quote($id);
     $query .= ' AND `node`.`lft` BETWEEN `parent`.`lft` AND `parent`.`rgt`';
     $query .= ' GROUP BY `node`.`id`';
     $this->db->setQuery($query);
     $result = $this->db->loadObject();
     return $result->depth;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:17,代码来源:comments.php

示例10: push

	/**
	 * Push the email notification to MailQ
	 * @param	string	$type			type of notification
	 * @param	string	$recipient		recipient (subscribers,admins,author,me)
	 * @param	array	$options		various options
	 *
	 * @return nothing
	 */
	public function push( $type, $recipients, $options = array() )
	{
		if( !empty( $options['commentId'] ) )
		{
			$comment = Komento::getComment( $options['commentId'] );
			$options['comment'] = $comment;
			$options['component'] = $comment->component;
			$options['cid'] = $comment->cid;

			$options['comment'] = Komento::getHelper( 'comment' )->process( $options['comment'] );


			unset( $options['commentId'] );
		}

		if( !isset( $options['component'] ) || !isset( $options['cid'] ) )
		{
			return;
		}

		if( $type == 'new' && $options['comment']->parent_id )
		{
			$type = 'reply';
		}

		$recipients		= explode(',', $recipients);
		$rows			= array();
		$skipMe			= true;

		// process requested recipients first
		foreach ($recipients as $recipient)
		{
			$recipient		= 'get' . ucfirst( strtolower( trim($recipient) ) );

			if( !method_exists($this, $recipient) )
			{
				continue;
			}

			if( $recipient == 'getMe' )
			{
				$skipMe = false;
			}

			$result = $this->$recipient( $type, $options );

			// stacking up all the emails and details
			$rows	= $rows + $result;
		}

		// process usergroups notification based on notification type
		$rows = $rows + $this->getUsergroups( $type );

		if( $type == 'report' )
		{
			$admins = $this->getAdmins();

			foreach( $admins as $admin )
			{
				if( isset($rows[$options['comment']->email]) && $options['comment']->email === $admin->email )
				{
					$skipMe = false;
				}
			}
		}

		if( empty($rows) )
		{
			return;
		}

		// Do not send to the commentor/actor
		if( $skipMe && isset($rows[$options['comment']->email]) )
		{
			unset( $rows[$options['comment']->email] );
		}

		$lang = JFactory::getLanguage();

		// Load English first as fallback
		$konfig = Komento::getKonfig();
		if( $konfig->get( 'enable_language_fallback' ) )
		{
			$lang->load( 'com_komento', JPATH_ROOT, 'en-GB', true );
		}

		// Load site's selected language
		$lang->load( 'com_komento', JPATH_ROOT, $lang->getDefault(), true );

		// Load user's preferred language file
		$lang->load( 'com_komento', JPATH_ROOT, null, true );

//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:notification.php

示例11: getParent

	public function getParent( $process = 0, $admin = 0 )
	{
		if( empty( $this->parent_id ) )
		{
			return false;
		}

		$parent = Komento::getComment( $this->parent_id, $process, $admin );

		return $parent;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:11,代码来源:comment.php

示例12: approveComment

	public function approveComment()
	{
		$token = JRequest::getVar( 'token', '' );

		if( empty( $token ) )
		{
			echo JText::_( 'COM_KOMENTO_INVALID_TOKEN' );
			exit;
		}

		$hashkeys = Komento::getTable( 'hashkeys' );

		if( !$hashkeys->loadByKey( $token ) )
		{
			echo JText::_( 'COM_KOMENTO_INVALID_TOKEN' );
			exit;
		}

		if( empty( $hashkeys->uid ) )
		{
			echo JText::_( 'COM_KOMENTO_APPROVE_COMMENT_INVALID_COMMENT_ID' );
			exit;
		}

		$comment = Komento::getComment( $hashkeys->uid );

		// If this hashkey has been used, then either redirect to the comment or throw error
		if( $hashkeys->state )
		{
			if( $comment->published != 1 )
			{
				echo JText::_( 'COM_KOMENTO_APPROVE_COMMENT_ADMIN_REMOVED_COMMENT' );
				exit;
			}

		}
		else
		{
			$state = $comment->publish();

			if( !$state )
			{
				$error = $comment->getError();

				if( empty( $error ) )
				{
					$error = JText::_( 'COM_KOMENTO_APPROVE_COMMENT_ERROR_OCCURED' );
				}

				echo $error;
				exit;
			}

			$hashkeys->state = 1;
			$hashkeys->store();
		}

		$mainframe = JFactory::getApplication();
		$mainframe->redirect( $comment->getPermalink() );

		return;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:62,代码来源:controller.php

示例13: addAction

	function addAction($type, $comment_id, $user_id)
	{
		$comment	= Komento::getComment( $comment_id );

		$now			= Komento::getDate()->toMySQL();

		$actionsTable	= Komento::getTable( 'actions' );

		$actionsTable->type			= $type;
		$actionsTable->comment_id	= $comment_id;
		$actionsTable->action_by	= $user_id;
		$actionsTable->actioned		= $now;

		if(!$actionsTable->store())
		{
			return false;
			// return JText::_( 'COM_KOMENTO_LIKES_ERROR_SAVING_LIKES' );
		}

		return $actionsTable->id;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:21,代码来源:actions.php

示例14: subscribe

	private function subscribe( $type = 'comment', $component, $cid, $commentId = 0, $userid = 0, $name, $email )
	{
		if( $commentId !== 0 && ( !$component || !$cid ) )
		{
			$comment = Komento::getComment( $commentId );
			$component = $comment->component;
			$cid = $comment->cid;
		}

		if( !$component || !$cid )
		{
			return false;
		}

		$subscriptionExist = Komento::getModel( 'subscription' )->checkSubscriptionExist( $component, $cid, $userid, $email, $type );

		if( !$subscriptionExist )
		{
			$data = array(
				'type'		=> $type,
				'component' => $component,
				'cid'		=> $cid,
				'userid'	=> $userid,
				'fullname'	=> $name,
				'email'		=> $email,
				'created'	=> Komento::getDate()->toMySQL(),
				'published'	=> 1
			);

			$config = Komento::getConfig();

			if( $config->get( 'subscription_confirmation' ) )
			{
				$data['published'] = 0;
			}

			$subscribeTable = Komento::getTable( 'subscription' );

			$subscribeTable->bind( $data );

			if( !$subscribeTable->store() )
			{
				return false;
			}

			if( $config->get( 'subscription_confirmation' ) )
			{
				Komento::getHelper( 'Notification' )->push( 'confirm', 'me', array( 'component' => $component, 'cid' => $cid, 'subscribeId' => $subscribeTable->id, 'commentId' => $commentId ) );
			}
		}

		return true;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:53,代码来源:view.ajax.php


注:本文中的Komento::getComment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。