• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP comment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_comments

 /**
  * Return a list of comments
  *
  * @param string $contextlevel ('system, course, user', etc..)
  * @param int $instanceid
  * @param string $component the name of the component
  * @param int $itemid the item id
  * @param string $area comment area
  * @param int $page page number
  * @return array of comments and warnings
  * @since Moodle 2.9
  */
 public static function get_comments($contextlevel, $instanceid, $component, $itemid, $area = '', $page = 0)
 {
     $warnings = array();
     $arrayparams = array('contextlevel' => $contextlevel, 'instanceid' => $instanceid, 'component' => $component, 'itemid' => $itemid, 'area' => $area, 'page' => $page);
     $params = self::validate_parameters(self::get_comments_parameters(), $arrayparams);
     $context = self::get_context_from_params($params);
     self::validate_context($context);
     require_capability('moodle/comment:view', $context);
     $args = new stdClass();
     $args->context = $context;
     $args->area = $params['area'];
     $args->itemid = $params['itemid'];
     $args->component = $params['component'];
     $commentobject = new comment($args);
     $comments = $commentobject->get_comments($params['page']);
     // False means no permissions to see comments.
     if ($comments === false) {
         throw new moodle_exception('nopermissions', 'error', '', 'view comments');
     }
     foreach ($comments as $key => $comment) {
         list($comments[$key]->content, $comments[$key]->format) = external_format_text($comment->content, $comment->format, $context->id, $params['component'], '', 0);
     }
     $results = array('comments' => $comments, 'warnings' => $warnings);
     return $results;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:37,代码来源:external.php


示例2: module_comment_edit

function module_comment_edit()
{
    global $global, $smarty;
    $obj = new comment();
    $obj->set_where('com_id = ' . $global['id']);
    $one = $obj->get_one();
    $one['channel'] = '';
    $one['title'] = '';
    $obj = new channel();
    $list = $obj->get_list();
    for ($i = 0; $i < count($list); $i++) {
        if ($list[$i]['cha_id'] == $one['com_channel_id']) {
            $one['channel'] = $list[$i]['cha_code'];
            $original = $list[$i]['cha_code'];
            if ($list[$i]['cha_original'] != 0) {
                for ($j = 0; $j < count($list); $j++) {
                    if ($list[$i]['cha_original'] == $list[$j]['cha_id']) {
                        $original = $list[$j]['cha_code'];
                    }
                }
            }
            if ($original == 'goods') {
                $table = 'goods';
            } else {
                $table = 'article';
            }
            $one['title'] = get_data($table, $one['com_page_id'], substr($table, 0, 3) . '_title');
        }
    }
    $smarty->assign('comment', $one);
}
开发者ID:jechiy,项目名称:xiu-cms,代码行数:31,代码来源:comment_edit.php


示例3: get_content

 function get_content()
 {
     if ($this->content !== NULL) {
         return $this->content;
     }
     if (empty($this->instance)) {
         return null;
     }
     $this->content->footer = '';
     $this->content->text = '';
     if (isloggedin() && !isguestuser()) {
         // Show the block
         $cmt = new stdclass();
         $cmt->context = $this->instance->context;
         $cmt->area = 'block_comments';
         $cmt->itemid = $this->instance->id;
         $cmt->course = $this->page->course;
         // this is a hack to adjust commenting UI
         // in block_comments
         $cmt->env = 'block_comments';
         $cmt->linktext = get_string('showcomments');
         $comment = new comment($cmt);
         $this->content = new stdClass();
         $this->content->text = $comment->init(true);
         $this->content->footer = '';
     }
     return $this->content;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:28,代码来源:block_comments.php


示例4: module_comment_sheet

function module_comment_sheet()
{
    global $global, $smarty;
    $obj = new comment();
    $obj->set_page_size(10);
    $obj->set_page_num($global['page']);
    $sheet = $obj->get_sheet();
    set_link($obj->get_page_sum());
    for ($i = 0; $i < count($sheet); $i++) {
        $sheet[$i]['channel'] = '';
        $sheet[$i]['title'] = '';
        $obj = new channel();
        $list = $obj->get_list();
        for ($j = 0; $j < count($list); $j++) {
            if ($list[$j]['cha_id'] == $sheet[$i]['com_channel_id']) {
                $sheet[$i]['channel'] = $list[$j]['cha_code'];
                $original = $list[$j]['cha_code'];
                if ($list[$j]['cha_original'] != 0) {
                    for ($k = 0; $k < count($list); $k++) {
                        if ($list[$j]['cha_original'] == $list[$k]['cha_id']) {
                            $original = $list[$k]['cha_code'];
                        }
                    }
                }
                if ($original == 'goods') {
                    $table = 'goods';
                } else {
                    $table = 'article';
                }
                $sheet[$i]['title'] = get_data($table, $sheet[$i]['com_page_id'], substr($table, 0, 3) . '_title');
            }
        }
    }
    $smarty->assign('comment', $sheet);
}
开发者ID:jechiy,项目名称:xiu-cms,代码行数:35,代码来源:comment_sheet.php


示例5: get_content

 function get_content()
 {
     global $CFG, $PAGE;
     if (!$CFG->usecomments) {
         $this->content->text = '';
         if ($this->page->user_is_editing()) {
             $this->content->text = get_string('disabledcomments');
         }
         return $this->content;
     }
     if ($this->content !== NULL) {
         return $this->content;
     }
     if (empty($this->instance)) {
         return null;
     }
     $this->content->footer = '';
     $this->content->text = '';
     list($context, $course, $cm) = get_context_info_array($PAGE->context->id);
     $args = new stdClass();
     $args->context = $PAGE->context;
     $args->course = $course;
     $args->area = 'page_comments';
     $args->itemid = 0;
     // set 'env' to tell moodle tweak ui for this block
     $args->env = 'block_comments';
     $args->component = 'block_comments';
     $args->linktext = get_string('showcomments');
     $comment = new comment($args);
     $comment->set_view_permission(true);
     $this->content = new stdClass();
     $this->content->text = $comment->output(true);
     $this->content->footer = '';
     return $this->content;
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:35,代码来源:block_comments.php


示例6: adminNotify

 public function adminNotify()
 {
     if ($this->cookie->check("id_user") and $this->cookie->id_user == 1) {
         //no notificamos a administrador de su propio comentario.
         return;
     }
     $id = $this->registry->lastCommentID;
     $Comment = new comment();
     $comment = $Comment->find($id);
     $comment['content'] = utils::nl2br($comment['content']);
     if (!defined('GESHI_VERSION')) {
         $comment['content'] = $this->comment_source_code_beautifier($comment['content'], 'addTagPRE');
     } else {
         $comment['content'] = $this->comment_source_code_beautifier($comment['content']);
     }
     $User = new user();
     $user = $User->find(1);
     $Post = new post();
     $post = $Post->find($comment['ID_post']);
     $commentsWaiting = $Comment->countCommentsByPost(null, 'waiting');
     $mailStr = "\n\t\t\t<table width=\"100%\">\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<small>\n\t\t\t\t\t\t<strong>From IP</strong>: {$comment['IP']}<br />\n\t\t\t\t\t\t<strong>URL</strong>: <a href=\"{$comment['url']}\">{$comment['url']}</a><br />\n\t\t\t\t\t\t<strong>Email</strong>: <a href=\"mailto:{$comment['email']}\">{$comment['email']}</a><br />\n\t\t\t\t\t\t<strong>DateTime</strong>: {$comment['created']}<br />\n\t\t\t\t\t</small>\n\t\t\t\t\t<hr>\n\t\t\t\t\t<strong>Author</strong>: {$comment['author']}<br />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr><td><strong>Content</strong></td></tr>\n\t\t\t<tr><td bgcolor=\"#f7f7f7\">\n\t\t\t\t{$comment['content']}\n\t\t\t\t<hr />\n\t\t\t</td></tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<p>\n\t\t\t\t\t\tModerate comment: <a href=\"{$this->registry->path}comments/edit/{$comment['ID']}\">{$this->registry->path}comments/edit/{$comment['ID']}</a><br />\n\t\t\t\t\t\tView entry: <a href=\"{$this->registry->path}{$post['urlfriendly']}\">{$this->registry->path}{$post['urlfriendly']}</a>\n\t\t\t\t\t</p>\n\t\t\n\t\t\t\t\t<p>\n\t\t\t\t\t\tThere are {$commentsWaiting} comments waiting for approbal. <br />\n\t\t\t\t\t\tPlease moderate comments: <a href=\"{$this->registry->path}comments/waiting\">{$this->registry->path}comments</a>\n\t\t\t\t\t</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t</table>\n\t\t";
     $conf = $this->registry->conf;
     $subject = "[{$conf['blog_name']}] Nuevo Comentario en: {$post['title']}";
     $this->enviaMail($user['email'], $subject, $mailStr, $user['email']);
 }
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:25,代码来源:commentNotify.plugin.php


示例7: getAll

 public function getAll($ID_post, $status = null)
 {
     $C = new comment();
     $rows = array();
     if (is_null($status) === true) {
         $rows = $C->findAll('comments.*, md5(comments.email) as md5_email', 'created ASC', null, "WHERE ID_post={$ID_post}");
     } else {
         if (is_array($status)) {
             $status_sql = "";
             foreach ($status as $st) {
                 $status_sql .= "status = '{$st}' OR ";
             }
             $status_sql = substr($status_sql, 0, -4);
             $rows = $C->findAll('comments.*, md5(comments.email) as md5_email', 'created ASC', null, "WHERE ID_post={$ID_post} AND ({$status_sql})");
         } else {
             $rows = $C->findAll('comments.*, md5(comments.email) as md5_email', 'created ASC', null, "WHERE ID_post={$ID_post} AND status='{$status}'");
         }
     }
     foreach ($rows as $key => $comment) {
         $comment['content'] = utils::htmlentities($comment['content']);
         $comment['content'] = utils::nl2br($comment['content']);
         $rows[$key] = $comment;
     }
     return $rows;
 }
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:25,代码来源:comment.php


示例8: addAction

 public function addAction()
 {
     if (user::isGuest() && reg::getKey('/comments/only_reg')) {
         system::stop();
     }
     if (user::isGuest() && !system::validCapcha('random_image')) {
         system::json(array('error' => 1, 'data' => lang::get('FEEDBACK_ERROR1')));
     }
     // Добавляем новый комментарий
     $comment = new comment();
     $comment->setParentId(system::POST('parent_id'));
     $comment->setObjId(system::POST('obj_id'));
     $comment->setUserName(system::POST('username'));
     $comment->setEmail(system::POST('email'));
     $comment->setText(system::POST('text'));
     $comment->setSendEmail(system::POST('send_email'));
     $obj_id = $comment->save();
     if ($obj_id) {
         page::assign('current_url', system::POST('back_url'));
         $html = page::macros('comments')->view($comment->id());
         system::json(array('error' => 0, 'data' => $html));
     } else {
         system::json(array('error' => 2, 'data' => $comment->getErrorListText(' ')));
     }
     if (!empty($_POST['back_url']) && !system::isAjax()) {
         system::redirect($_POST['back_url'] . '#comment' . $obj_id, true);
     } else {
         system::stop();
     }
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:30,代码来源:controller.php


示例9: comment_js_action

 function comment_js_action() {
     front::check_type(front::get('aid'));
     $comment=new comment();
     $this->view->comments=$comment->getrows('state=1 and aid='.front::get('aid'),20,'1');
     $this->view->aid=front::get('aid');
     echo  tool::text_javascript($this->fetch());
     exit;
 }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:8,代码来源:comment_act.php


示例10: index

 public function index($id = NULL, $page = 1)
 {
     if (is_null($id) or is_numeric($id)) {
         $this->redirect($this->conf['blog_siteurl']);
     }
     $tag = $id;
     $post = new post();
     $link = new link();
     $comment = new comment();
     $this->html->useTheme($this->conf['blog_current_theme']);
     $info = array();
     $info["isAdmin"] = false;
     if ($this->cookie->check("logged") and $this->cookie->id_user == 1) {
         $info["isAdmin"] = true;
     }
     $this->themes->info = $info;
     $includes['charset'] = $this->html->charsetTag("UTF-8");
     $includes['rssFeed'] = $this->html->includeRSS();
     if ($page > 1) {
         $includes['canonical'] = "<link rel=\"canonical\" href=\"{$this->conf['blog_siteurl']}/tag/" . rawurlencode($post->sql_escape($id)) . "/{$page}\" />";
     } else {
         $includes['canonical'] = "<link rel=\"canonical\" href=\"{$this->conf['blog_siteurl']}/tag/" . rawurlencode($post->sql_escape($id)) . "\" />";
     }
     $this->registry->includes = $includes;
     $this->plugin->call('index_includes');
     $includes = null;
     foreach ($this->registry->includes as $include) {
         $includes .= $include;
     }
     $this->themes->includes = $includes;
     $this->themes->links = $link->findAll();
     $this->themes->single = false;
     $total_rows = $post->countPosts(array('status' => 'publish', 'tag' => $tag));
     $page = (int) is_null($page) ? 1 : $page;
     $limit = $this->conf['blog_posts_per_page'];
     $offset = ($page - 1) * $limit;
     $limitQuery = $offset . "," . $limit;
     $targetpage = $this->path . "tag/{$tag}/";
     $this->themes->pagination = $this->pagination->init($total_rows, $page, $limit, $targetpage);
     $posts = $post->getPostsByTag($tag, $limitQuery);
     foreach ($posts as $k => $p) {
         $posts[$k]['title'] = htmlspecialchars($p['title']);
         $posts[$k]['tags'] = $post->getTags($p['ID']);
         $posts[$k]['comments_count'] = $comment->countCommentsByPost($posts[$k]['ID']);
         $user = new user();
         if ($posts[$k]['id_user'] < 2) {
             $posts[$k]['autor'] = $user->find(1);
         } else {
             $posts[$k]['autor'] = $user->find($posts[$k]['id_user']);
         }
     }
     $this->registry->posts = $posts;
     $this->plugin->call("index_post_content");
     $this->themes->posts = $this->registry->posts;
     $this->themes->title_for_layout = "{$this->conf['blog_name']} - {$tag}";
     $this->render();
 }
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:57,代码来源:tag_controller.php


示例11: show

 public function show($id)
 {
     $articles = new Article();
     $comment = new comment();
     $article = $articles->where('article_id=' . $id)->find();
     $comments = $comment->where('article_id=' . $id)->order('created_at')->select();
     //$comments = $articles->relation(true)->find($id);
     $this->assign('article', $article);
     $this->assign('comments', $comments);
     $this->display('showArticle');
 }
开发者ID:sylvanasGG,项目名称:tpweb,代码行数:11,代码来源:ArticleController.class.php


示例12: reply_comment

function reply_comment()
{
    global $smarty, $lang;
    $com_id = post('com_id');
    $com_reply = post('com_reply');
    $obj = new comment();
    $obj->set_value('com_reply', $com_reply);
    $obj->set_where("com_id = {$com_id}");
    $obj->edit();
    $smarty->assign('info_text', '回复评论成功');
    $smarty->assign('link_text', $lang['return_list']);
    $smarty->assign('link_href', url(array('channel' => 'service', 'mod' => 'comment_sheet')));
}
开发者ID:jechiy,项目名称:xiu-cms,代码行数:13,代码来源:deal.php


示例13: _create

 /**
  * Add a new comment to the collection.
  * @see REST_Controller::_create($resource)
  */
 public function _create($comment)
 {
     $item = ORM::factory("item", $this->input->post("item_id"));
     access::required("view", $item);
     $form = comment_3nids::get_add_form($item);
     $valid = $form->validate();
     if ($valid) {
         if (user::active()->guest && !$form->add_comment->inputs["name"]->value) {
             $form->add_comment->inputs["name"]->add_error("missing", 1);
             $valid = false;
         }
         if (!$form->add_comment->text->value) {
             $form->add_comment->text->add_error("missing", 1);
             $valid = false;
         }
     }
     if ($valid) {
         $comment = comment::create($item, user::active(), $form->add_comment->text->value, $form->add_comment->inputs["name"]->value, $form->add_comment->email->value, $form->add_comment->url->value);
         $active = user::active();
         if ($active->guest) {
             $form->add_comment->inputs["name"]->value("");
             $form->add_comment->email->value("");
             $form->add_comment->url->value("");
         } else {
             $form->add_comment->inputs["name"]->value($active->full_name);
             $form->add_comment->email->value($active->email);
             $form->add_comment->url->value($active->url);
         }
     }
     url::redirect(url::site("comments_3nids?item_id=" . $item->id));
 }
开发者ID:regi01,项目名称:gallery3-contrib,代码行数:35,代码来源:comments_3nids.php


示例14: displayComments

 public function displayComments($resource_id, $instance)
 {
     //instance ce u stvari biti ovo gde dodamo (add_instance), na stranici kursa
     //Mozda prvo da se izlistaju svi resursi pa da se omoguce komentari
     comment::init();
     $options = new stdClass();
     $options->area = 'resource_comments';
     $options->course = $course;
     $options->context = $context;
     $options->itemid = $itemid;
     $options->component = 'component_1';
     $options->showcount = true;
     $options->displaycancel = true;
     $comment = new comment($options);
     $comment->set_view_permission(true);
 }
开发者ID:Chevijan,项目名称:moodle-plugin,代码行数:16,代码来源:locallib.php


示例15: create_comment_for_user_test

 public function create_comment_for_user_test()
 {
     $rand = rand();
     $root = ORM::factory("item", 1);
     $admin = user::lookup(2);
     $comment = comment::create($root, $admin, "text_{$rand}", "name_{$rand}", "email_{$rand}", "url_{$rand}");
     $this->assert_equal($admin->full_name, $comment->author_name());
     $this->assert_equal($admin->email, $comment->author_email());
     $this->assert_equal($admin->url, $comment->author_url());
     $this->assert_equal("text_{$rand}", $comment->text);
     $this->assert_equal(1, $comment->item_id);
     $this->assert_equal("REMOTE_ADDR", $comment->server_remote_addr);
     $this->assert_equal("HTTP_USER_AGENT", $comment->server_http_user_agent);
     $this->assert_equal("HTTP_ACCEPT", $comment->server_http_accept);
     $this->assert_equal("HTTP_ACCEPT_CHARSET", $comment->server_http_accept_charset);
     $this->assert_equal("HTTP_ACCEPT_ENCODING", $comment->server_http_accept_encoding);
     $this->assert_equal("HTTP_ACCEPT_LANGUAGE", $comment->server_http_accept_language);
     $this->assert_equal("HTTP_CONNECTION", $comment->server_http_connection);
     $this->assert_equal("HTTP_HOST", $comment->server_http_host);
     $this->assert_equal("HTTP_REFERER", $comment->server_http_referer);
     $this->assert_equal("HTTP_USER_AGENT", $comment->server_http_user_agent);
     $this->assert_equal("QUERY_STRING", $comment->server_query_string);
     $this->assert_equal("REMOTE_ADDR", $comment->server_remote_addr);
     $this->assert_equal("REMOTE_HOST", $comment->server_remote_host);
     $this->assert_equal("REMOTE_PORT", $comment->server_remote_port);
     $this->assert_true(!empty($comment->created));
 }
开发者ID:xafr,项目名称:gallery3,代码行数:27,代码来源:Comment_Helper_Test.php


示例16: delete

 /**
  * Delete a field completely
  */
 public function delete()
 {
     // Delete the comments.
     $params = array('contextid' => $this->df->context->id, 'commentarea' => $this->name);
     comment::delete_comments($params);
     return parent::delete();
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:10,代码来源:commentmdl.php


示例17: commentAction

 public function commentAction()
 {
     if ($_POST) {
         $content = $_POST['content'];
         $uid = $_POST['UID'];
         $aid = $_POST['AID'];
         $rid = $_POST['RID'];
         $abstract = substr($content, 0, 100);
         $time = date('Y-m-d H:i:s');
         $comment = new comment();
         $comment_arr = array('UID' => $uid, 'RID' => $rid, 'AID' => $aid, 'Time' => $time, 'Ccontent' => $content, 'Cabstract' => $abstract);
         $cid = $comment->insertComment($comment_arr);
         //$this->view->cid = $cid;
         echo $cid;
         //$this->render('commented');
     }
 }
开发者ID:Zziwei,项目名称:Microknow,代码行数:17,代码来源:questionController.php


示例18: form_add

 /**
  * Present a form for adding a new comment to this item or editing an existing comment.
  */
 public function form_add($item_id)
 {
     $item = ORM::factory("item", $item_id);
     access::required("view", $item);
     if (!comment::can_comment()) {
         access::forbidden();
     }
     print comment::prefill_add_form(comment::get_add_form($item));
 }
开发者ID:kandsten,项目名称:gallery3,代码行数:12,代码来源:comments.php


示例19: deleting_an_item_deletes_its_comments_too_test

 public function deleting_an_item_deletes_its_comments_too_test()
 {
     $rand = rand();
     $album = album::create(ORM::factory("item", 1), "test_{$rand}", "test_{$rand}");
     $comment = comment::create($album, identity::guest(), "text_{$rand}", "name_{$rand}", "email_{$rand}", "url_{$rand}");
     $album->delete();
     $deleted_comment = ORM::factory("comment", $comment->id);
     $this->assert_false($deleted_comment->loaded);
 }
开发者ID:ChrisRut,项目名称:gallery3,代码行数:9,代码来源:Comment_Event_Test.php


示例20: photo_bottom

 static function photo_bottom($theme)
 {
     $block = new Block();
     $block->css_id = "gComments";
     $block->title = t("Comments");
     $view = new View("comments.html");
     $view->comments = ORM::factory("comment")->where("item_id", $theme->item()->id)->where("state", "published")->orderby("created", "ASC")->find_all();
     $block->content = $view;
     $block->content .= comment::get_add_form($theme->item())->render("form.html");
     return $block;
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:11,代码来源:comment_theme.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP comments类代码示例发布时间:2022-05-23
下一篇:
PHP collection类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap