本文整理汇总了PHP中JComments::getCommentListItem方法的典型用法代码示例。如果您正苦于以下问题:PHP JComments::getCommentListItem方法的具体用法?PHP JComments::getCommentListItem怎么用?PHP JComments::getCommentListItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JComments
的用法示例。
在下文中一共展示了JComments::getCommentListItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addComment
//.........这里部分代码省略.........
}
}
return $response;
}
// datetime field is used in prepareComment function
$comment->datetime = $comment->date;
if (is_string($comment->datetime)) {
$comment->datetime = strtotime($comment->datetime);
}
if ($config->getInt('enable_mambots') == 1) {
require_once JCOMMENTS_HELPERS . DS . 'plugin.php';
JCommentsPluginHelper::importPlugin('jcomments');
JCommentsPluginHelper::trigger('onAfterCommentAdded', array(&$comment, &$response, &$allowed));
}
// send notification to administrators
if ($config->getInt('enable_notification') == 1) {
if ($config->check('notification_type', 1) == true) {
JComments::sendNotification($comment, true);
}
}
// if comment published we need update comments list
if ($comment->published) {
// send notification to comment subscribers
JComments::sendToSubscribers($comment, true);
$comment->usertype = $my->id != 0 ? str_replace(' ', '-', strtolower($my->usertype)) : 'guest';
if ($merged) {
$commentText = $comment->comment;
JComments::prepareComment($comment);
$tmpl =& JCommentsFactory::getTemplate();
$tmpl->load('tpl_comment');
$tmpl->addVar('tpl_comment', 'get_comment_body', 1);
$tmpl->addObject('tpl_comment', 'comment', $comment);
$html = $tmpl->renderTemplate('tpl_comment');
$html = JCommentsText::jsEscape($html);
$response->addScript("jcomments.updateComment(" . $comment->id . ", '{$html}');");
$comment->comment = $commentText;
} else {
$count = JCommentsModel::getCommentsCount($comment->object_id, $comment->object_group);
if ($config->get('template_view') == 'tree') {
if ($count > 1) {
$html = JComments::getCommentListItem($comment);
$html = JCommentsText::jsEscape($html);
$response->addScript("jcomments.updateTree('{$html}','{$comment->parent}');");
} else {
$html = JComments::getCommentsTree($comment->object_id, $comment->object_group);
$html = JCommentsText::jsEscape($html);
$response->addScript("jcomments.updateTree('{$html}',null);");
}
} else {
// if pagination disabled and comments count > 1...
if ($config->getInt('comments_per_page') == 0 && $count > 1) {
// update only added comment
$html = JComments::getCommentListItem($comment);
$html = JCommentsText::jsEscape($html);
if ($config->get('comments_order') == 'DESC') {
$response->addScript("jcomments.updateList('{$html}','p');");
} else {
$response->addScript("jcomments.updateList('{$html}','a');");
}
} else {
// update comments list
$html = JComments::getCommentsList($comment->object_id, $comment->object_group, JComments::getCommentPage($comment->object_id, $comment->object_group, $comment->id));
$html = JCommentsText::jsEscape($html);
$response->addScript("jcomments.updateList('{$html}','r');");
}
// scroll to first comment
if ($config->get('comments_order') == 'DESC') {
$response->addScript("jcomments.scrollToList();");
}
}
}
JCommentsAJAX::showInfoMessage(JText::_('Thank you for your submission!'));
} else {
JCommentsAJAX::showInfoMessage(JText::_('Thank you, your comment will be published once reviewed'));
}
// clear comments textarea & update comment length counter if needed
$response->addScript("jcomments.clear('comment');");
unset($comment);
if ($acl->check('enable_captcha') == 1) {
$captchaEngine = $config->get('captcha_engine', 'kcaptcha');
if ($captchaEngine == 'kcaptcha') {
require_once JCOMMENTS_BASE . DS . 'jcomments.captcha.php';
JCommentsCaptcha::destroy();
$response->addScript("jcomments.clear('captcha');");
}
}
} else {
JCommentsAJAX::showErrorMessage(JText::_('ERROR_DUPLICATE_COMMENT'), 'comment');
}
}
}
}
}
}
}
} else {
$response->addAlert(JText::_('ERROR_CANT_COMMENT'));
}
return $response;
}
示例2: addComment
//.........这里部分代码省略.........
}
}
unset($prevComment);
}
}
// save new comment to database
if (!$comment->store()) {
$response->addScript("jcomments.clear('comment');");
if ($acl->check('enable_captcha') == 1 && $config->get('captcha_engine', 'kcaptcha') == 'kcaptcha') {
JCommentsCaptcha::destroy();
$response->addScript("jcomments.clear('captcha');");
}
return $response;
}
// store/update information about commented object
JCommentsObjectHelper::storeObjectInfo($comment->object_id, $comment->object_group, $comment->lang);
JCommentsEvent::trigger('onJCommentsCommentAfterAdd', array(&$comment));
// send notification to administrators
if ($config->getInt('enable_notification') == 1) {
if ($config->check('notification_type', 1) == true) {
JComments::sendNotification($comment, true);
}
}
// if comment published we need update comments list
if ($comment->published) {
// send notification to comment subscribers
JComments::sendToSubscribers($comment, true);
if ($merged) {
$commentText = $comment->comment;
$html = JCommentsText::jsEscape(JComments::getCommentItem($comment));
$response->addScript("jcomments.updateComment(" . $comment->id . ", '{$html}');");
$comment->comment = $commentText;
} else {
$count = JComments::getCommentsCount($comment->object_id, $comment->object_group);
if ($config->get('template_view') == 'tree') {
if ($count > 1) {
$html = JComments::getCommentListItem($comment);
$html = JCommentsText::jsEscape($html);
$mode = $config->getInt('tree_order') == 1 || $config->getInt('tree_order') == 2 && $comment->parent > 0 ? 'b' : 'a';
$response->addScript("jcomments.updateTree('{$html}','{$comment->parent}','{$mode}');");
} else {
$html = JComments::getCommentsTree($comment->object_id, $comment->object_group);
$html = JCommentsText::jsEscape($html);
$response->addScript("jcomments.updateTree('{$html}',null);");
}
} else {
// if pagination disabled and comments count > 1...
if ($config->getInt('comments_per_page') == 0 && $count > 1) {
// update only added comment
$html = JComments::getCommentListItem($comment);
$html = JCommentsText::jsEscape($html);
if ($config->get('comments_order') == 'DESC') {
$response->addScript("jcomments.updateList('{$html}','p');");
} else {
$response->addScript("jcomments.updateList('{$html}','a');");
}
} else {
// update comments list
$html = JComments::getCommentsList($comment->object_id, $comment->object_group, JComments::getCommentPage($comment->object_id, $comment->object_group, $comment->id));
$html = JCommentsText::jsEscape($html);
$response->addScript("jcomments.updateList('{$html}','r');");
}
// scroll to first comment
if ($config->get('comments_order') == 'DESC') {
$response->addScript("jcomments.scrollToList();");
}
}
}
self::showInfoMessage(JText::_('THANK_YOU_FOR_YOUR_SUBMISSION'));
} else {
self::showInfoMessage(JText::_('THANK_YOU_YOUR_COMMENT_WILL_BE_PUBLISHED_ONCE_REVIEWED'));
}
// clear comments textarea & update comment length counter if needed
$response->addScript("jcomments.clear('comment');");
if ($acl->check('enable_captcha') == 1 && $config->get('captcha_engine', 'kcaptcha') == 'kcaptcha') {
require_once JCOMMENTS_BASE . DS . 'jcomments.captcha.php';
JCommentsCaptcha::destroy();
$response->addScript("jcomments.clear('captcha');");
}
} else {
self::showErrorMessage(JText::_('ERROR_DUPLICATE_COMMENT'), 'comment');
}
}
}
}
}
}
}
} else {
$message = $config->get('ERROR_CANT_COMMENT');
if ($acl->getUserBlocked()) {
$bannedMessage = $config->get('message_banned');
if (!empty($bannedMessage)) {
$message = self::escapeMessage($bannedMessage);
}
}
$response->addAlert($message);
}
return $response;
}