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


PHP JComments::getCommentItem方法代码示例

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


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

示例1: getCommentListItem

 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');
 }
开发者ID:korolariya,项目名称:gameportal,代码行数:10,代码来源:jcomments.php

示例2: saveComment

 public static function saveComment($values = array())
 {
     if (JCommentsSecurity::badRequest() == 1) {
         JCommentsSecurity::notAuth();
     }
     $db = JCommentsFactory::getDBO();
     $config = JCommentsFactory::getConfig();
     $response = JCommentsFactory::getAjaxResponse();
     $values = self::prepareValues($_POST);
     $comment = new JCommentsTableComment($db);
     $id = (int) $values['id'];
     if ($comment->load($id)) {
         $acl = JCommentsFactory::getACL();
         if ($acl->canEdit($comment)) {
             if ($values['comment'] == '') {
                 self::showErrorMessage(JText::_('ERROR_EMPTY_COMMENT'), 'comment');
             } else {
                 if ($config->getInt('comment_maxlength') != 0 && $acl->check('enable_comment_length_check') == 1 && JCommentsText::strlen($values['comment']) > $config->getInt('comment_maxlength')) {
                     self::showErrorMessage(JText::_('ERROR_TOO_LONG_COMMENT'), 'comment');
                 } else {
                     if ($config->getInt('comment_minlength') != 0 && $acl->check('enable_comment_length_check') == 1 && JCommentsText::strlen($values['comment']) < $config->getInt('comment_minlength')) {
                         self::showErrorMessage(JText::_('ERROR_YOUR_COMMENT_IS_TOO_SHORT'), 'comment');
                     } else {
                         $bbcode = JCommentsFactory::getBBCode();
                         $comment->comment = $values['comment'];
                         $comment->comment = $bbcode->filter($comment->comment);
                         $comment->published = $acl->check('autopublish');
                         if ($config->getInt('comment_title') != 0 && isset($values['title'])) {
                             $comment->title = stripslashes((string) $values['title']);
                         }
                         if ($config->getInt('author_homepage') == 1 && isset($values['homepage'])) {
                             $comment->homepage = JCommentsText::url($values['homepage']);
                         } else {
                             $comment->homepage = '';
                         }
                         $result = JCommentsEvent::trigger('onJCommentsCommentBeforeChange', array(&$comment));
                         if (in_array(false, $result, true)) {
                             return $response;
                         }
                         $comment->store();
                         $comment->checkin();
                         JCommentsEvent::trigger('onJCommentsCommentAfterChange', array(&$comment));
                         if ($config->getInt('enable_notification') == 1) {
                             if ($config->check('notification_type', 1) == true) {
                                 JComments::sendNotification($comment, false);
                             }
                         }
                         $html = JCommentsText::jsEscape(JComments::getCommentItem($comment));
                         $response->addScript("jcomments.updateComment(" . $comment->id . ", '{$html}');");
                     }
                 }
             }
         } else {
             $response->addAlert(JText::_('ERROR_CANT_EDIT'));
         }
     }
     return $response;
 }
开发者ID:sergy444,项目名称:joomla,代码行数:58,代码来源:jcomments.ajax.php


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