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


PHP Comments::get_comments方法代码示例

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


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

示例1: indexAction

 public function indexAction()
 {
     $toy_id = $this->_getParam('toy_id');
     $Comments = new Comments();
     $this->view->comments = $Comments->get_comments($toy_id);
     /*
     		$this->view->comments = array(
     			0 => array(
     				'comm_name' => 'vit',
     				'comm_text' => 'bla bla',
     				'comm_time' => time()
     				),
     			1 => array(
     				'comm_name' => 'vlad',
     				'comm_text' => 'who am i',
     				'comm_time' => time()
     				)
     		);
     */
     //$this->_helper->viewRenderer->setNoRender();
     //$this->_helper->layout->disableLayout();
 }
开发者ID:vitsun,项目名称:igrushki-detkam,代码行数:22,代码来源:CommentsController.php

示例2: ajax

 public function ajax()
 {
     //require_once('functions.php');
     // GET actions
     if (\Input::get('action')) {
         switch (\Input::get('action')) {
             case 'get-comments':
                 if (\Input::get('page')) {
                     $def = array('parent' => 0, 'email' => false, 'status' => 1, 'page' => urldecode(\Input::get('page')));
                     $input = array_merge($def, \Input::get());
                     $data = \Comments::get_comments($input);
                     return \Response::json(array('success' => true, 'data' => $data));
                 } else {
                     return 0;
                 }
                 break;
         }
     }
     // POST actions
     if (\Input::get('action')) {
         //if (Comments::config('logged_only') && !com_is_logged())
         //die('0');
         switch (\Input::get('action')) {
             case 'add-comment':
                 $def = array('page' => urldecode(\Input::get('page')));
                 $input = array_merge($def, \Input::get());
                 $data = \Comments::add_comment($input);
                 if (!empty(\Comments::$errors)) {
                     return \Response::json(array('success' => false, 'data' => \Comments::$errors));
                 } else {
                     return \Response::json(array('success' => true, 'data' => $data));
                 }
                 break;
         }
     }
 }
开发者ID:idfluid,项目名称:comments,代码行数:36,代码来源:AjaxController.php

示例3:

    $smarty->assign('forumId', $forum_check[1]);
}
if (isset($_REQUEST["comments_grandParentId"])) {
    $smarty->assign('comments_grandParentId', $_REQUEST["comments_grandParentId"]);
}
if (!empty($forum_mode) && $forum_mode == 'y') {
    $_REQUEST["comments_parentId"] > 0;
}
if (isset($_REQUEST["post_reply"]) && isset($_REQUEST["comments_reply_threadId"])) {
    $threadId_if_reply = $_REQUEST["comments_reply_threadId"];
} else {
    $threadId_if_reply = 0;
}
// $end_time = microtime(true);
// print "TIME4 in comments.php: ".($end_time - $start_time)."\n";
$comments_coms = $commentslib->get_comments($comments_objectId, $_REQUEST["comments_parentId"], $comments_offset, $comments_per_page, $thread_sort_mode, $_REQUEST["comments_commentFind"], $_REQUEST['comments_threshold'], $thread_style, $threadId_if_reply);
// $end_time = microtime(true);
// print "TIME5 in comments.php: ".($end_time - $start_time)."\n";
if ($comments_prefix_var == 'forum:') {
    $comments_cant = $commentslib->count_comments('topic:' . $_REQUEST['comments_parentId']);
    // comments in the topic not in the forum
} else {
    $comments_cant = $commentslib->count_comments($comments_objectId);
}
$comments_cant_page = $comments_coms['cant'];
$smarty->assign('comments_below', $comments_coms["below"]);
$smarty->assign('comments_cant', $comments_cant);
//print "<pre>";
//print_r($comments_coms);
//print "</pre>";
// Offset management
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:31,代码来源:comments.php

示例4: Comments

 function export_page($page)
 {
     global $tikilib, $prefs, $smarty, $tikidomain;
     $parserlib = TikiLib::lib('parser');
     $info = $tikilib->get_page_info($page);
     if (empty($info)) {
         $this->errors[] = 'Page does not exist';
         $this->errorsArgs[] = $page;
         return false;
     }
     $dir = $page;
     $info['zip'] = "{$dir}/" . $page;
     $smarty->assign_by_ref('info', $info);
     if (!$this->zip->addFromString($info['zip'], $info['data'])) {
         $this->errors[] = 'Can not add the page';
         $this->errorsArgs[] = $info['zip'];
         return false;
     }
     if ($prefs['feature_wiki_comments'] == 'y' && $this->config['comments']) {
         global $dbTiki;
         include_once 'lib/comments/commentslib.php';
         $commentslib = new Comments($dbTiki);
         $comments = $commentslib->get_comments('wiki page:' . $page, 0, 0, 0, 'commentDate_asc', '', 0, 'commentStyle_plain');
         if (!empty($comments['cant'])) {
             $smarty->assign_by_ref('comments', $comments['data']);
         }
     }
     $images = array();
     if ($prefs['feature_wiki_pictures'] == 'y' && $this->config['images'] && preg_match_all('/\\{img\\s*\\(?([^\\}]+)\\)?\\s*\\}/i', $info['data'], $matches)) {
         global $tikiroot;
         foreach ($matches[1] as $match) {
             $args = $parserlib->plugin_split_args($match);
             if (!empty($args['src']) && preg_match('|img/wiki_up/(.*)|', $args['src'], $m)) {
                 $file = empty($tikidomain) ? $args['src'] : str_replace('img/wiki_up/', "img/wiki_up/{$tikidomain}/", $args['src']);
                 $image = array('filename' => $m[1], 'where' => 'wiki', 'zip' => "{$dir}/images/wiki/" . $m[1], 'wiki' => $args['src']);
                 if (!$this->zip->addFile($file, $image['zip'])) {
                     $this->errors[] = 'Can not add the image ';
                     $this->errorsArgs[] = $file;
                     return false;
                 }
             } elseif (!empty($args['src']) && preg_match('|show_image.php\\?(.*)|', $args['src'], $m)) {
                 global $imagegallib;
                 include_once 'lib/imagegals/imagegallib.php';
                 if (($i = strpos($args['src'], 'tiki-download_file.php')) > 0) {
                     $path = $_SERVER['HTTP_HOST'] . $tikiroot . substr($args['src'], $i);
                 } else {
                     $path = $_SERVER['HTTP_HOST'] . $tikiroot . $args['src'];
                 }
                 $img = $this->httprequest($path);
                 $this->parse_str($m[1], $p);
                 if (isset($p['name']) && isset($p['galleryId'])) {
                     $id = $imagegallib->get_imageid_byname($p['name'], $p['galleryId']);
                 } elseif (isset($p['name'])) {
                     $id = $imagegallib->get_imageid_byname($p['name']);
                 } elseif (isset($p['id'])) {
                     $id = $p['id'];
                 }
                 $image = array('where' => 'gal', 'zip' => "{$dir}/images/gal/" . $id, 'wiki' => $args['src']);
                 if (!$this->zip->addFromString($image['zip'], $img)) {
                     $this->errors[] = 'Can not add the image';
                     $this->errorsArgs[] = $m[1];
                     return false;
                 }
             } elseif (!empty($args['src']) && preg_match('|tiki-download_file.php\\?(.*)|', $args['src'], $m)) {
                 if (($i = strpos($args['src'], 'tiki-download_file.php')) > 0) {
                     $path = $_SERVER['HTTP_HOST'] . $tikiroot . substr($args['src'], $i);
                 } else {
                     $path = $_SERVER['HTTP_HOST'] . $tikiroot . $args['src'];
                 }
                 $img = $this->httprequest($path);
                 $this->parse_str($m[1], $p);
                 $image = array('where' => 'fgal', 'zip' => "{$dir}/images/fgal/" . $p['fileId'], 'wiki' => $args['src']);
                 if (!$this->zip->addFromString($image['zip'], $img)) {
                     $this->errors[] = 'Can not add the image';
                     $this->errorsArgs[] = $m[1];
                     return false;
                 }
             }
             /* else no idea where the img comes from - suppose there are outside tw */
             $images[] = $image;
         }
     }
     $smarty->assign_by_ref('images', $images);
     if ($prefs['feature_wiki_attachments'] == 'y' && $this->config['attachments']) {
         global $wikilib;
         include_once 'lib/wiki/wikilib.php';
         $attachments = $wikilib->list_wiki_attachments($page, 0, -1);
         if (!empty($attachments['cant'])) {
             foreach ($attachments['data'] as $key => $att) {
                 $att_info = $wikilib->get_item_attachment($att['attId']);
                 $attachments['data'][$key]['zip'] = "{$dir}/attachments/" . $att['attId'];
                 if ($prefs['w_use_dir']) {
                     if (!$this->zip->addFile($prefs['w_use_dir'] . $att_info['path'], $attachments['data'][$key]['zip'])) {
                         $this->errors[] = 'Can not add the attachment';
                         $this->errorsArgs[] = $att_info['attId'];
                         return false;
                     }
                 } else {
                     if (!$this->zip->addFromString($attachments['data'][$key]['zip'], $att_info['data'])) {
                         $this->errors[] = 'Can not add the attachment';
//.........这里部分代码省略.........
开发者ID:hurcane,项目名称:tiki-azure,代码行数:101,代码来源:xmllib.php

示例5: sprintf

                if (!empty($notif_email) and !empty($comment)) {
                    if ($comment['status'] == 1) {
                        $subject = sprintf($templates['new_comment']['subject'], $_POST['page_title']);
                        $message = sprintf($templates['new_comment']['header'], $_POST['page_title']);
                        $message .= sprintf($templates['body'], $comment['author'], $comment['author_ip'], $comment['author_email'], $comment['author_url'], $comment['comment']);
                        $message .= sprintf($templates['new_comment']['footer'], $_POST['page_url'], $_POST['comment_url']);
                    } else {
                        $subject = sprintf($templates['moderate']['subject'], $_POST['page_title']);
                        $message = sprintf($templates['moderate']['header'], $_POST['page_title']);
                        $message .= sprintf($templates['body'], $comment['author'], $comment['author_ip'], $comment['author_email'], $comment['author_url'], $comment['comment']);
                        $url = Comments::config('base_url') . 'admin/?page=comments';
                        $message .= sprintf($templates['moderate']['footer'], $url . '&action=approve&comments%5B%5D=' . $comment['id'], $url . '&action=spam&comments%5B%5D=' . $comment['id'], $url . ($comment['status'] == 2 ? '&status=spam' : '') . '#edit-' . $comment['id']);
                    }
                    Comments::send_email($notif_email, $subject, $message);
                }
                if (!empty($_POST['reply']) and is_numeric($_POST['reply']) and Comments::config('reply_notification') and !empty($comment) and $comment['status'] == 1) {
                    $parent = Comments::get_comments(array('id' => $_POST['reply'], 'rows' => $rows));
                    if ($parent) {
                        $subject = sprintf($templates['reply']['subject'], $_POST['page_title']);
                        $message = sprintf($templates['reply']['body'], $comment['author'], $comment['comment'], $_POST['comment_url']);
                        Comments::send_email($parent['author_email'], $subject, $message);
                    }
                }
            }
            unset($_SESSION['com_email_notif']);
            break;
        case 'refreshcaptcha':
            Comments::captcha();
            break;
    }
}
开发者ID:idfluid,项目名称:comments,代码行数:31,代码来源:ajax.php


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