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


PHP Comment::save_comment方法代码示例

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


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

示例1: handleSaveAnswer

 public function handleSaveAnswer($request_method, $request_data)
 {
     $msg = NULL;
     $error = FALSE;
     switch ($request_method) {
         case 'POST':
             filter_all_post($request_data);
             $request_data['answer'] = trim($request_data['answer']);
             if (empty($request_data['answer'])) {
                 $msg = __('Answer can not be left blank');
                 $error = true;
             } else {
                 $comment = new Comment();
                 // setting some variables
                 $usr = PA::$user;
                 $comment->comment = $comment->subject = $request_data['answer'];
                 $comment->parent_type = TYPE_ANSWER;
                 $id = $comment->parent_id = $comment->content_id = $request_data['id'];
                 $comment->user_id = $usr->user_id;
                 $comment->name = $usr->login_name;
                 $comment->email = $usr->email;
                 if ($comment->spam_check()) {
                     $msg = __('Sorry, your Answer cannot be posted as it looks like spam. Try removing any links to possibly suspect sites, and re-submitting.');
                     $error = true;
                     Logger::log('Comment rejected by spam filter', LOGGER_ACTION);
                 } else {
                     $msg = __('Your Answer has been posted successfully');
                     $comment->save_comment();
                     if ($comment->spam_state != SPAM_STATE_OK) {
                         $msg = __('Sorry, your answer cannot be posted as it was classified as spam by Akismet, or contained links to blacklisted sites. Please check the links in your post, and that your name and e-mail address are correct.');
                         $error = true;
                     } else {
                         unset($request_data);
                         //invalidate cache of content block as it is modified now
                         if (PA::$network_info) {
                             $nid = '_network_' . PA::$network_info->network_id;
                         } else {
                             $nid = '';
                         }
                         //unique name
                         $cache_id = 'content_' . $id . $nid;
                         CachedTemplate::invalidate_cache($cache_id);
                     }
                 }
             }
             break;
     }
     $msg_array = array();
     $msg_array['failure_msg'] = $msg;
     $msg_array['success_msg'] = NULL;
     $redirect_url = NULL;
     $query_str = NULL;
     set_web_variables($msg_array, $redirect_url, $query_str);
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:54,代码来源:AnswersModule.php

示例2: actionSendcomment

 public function actionSendcomment($text = "")
 {
     global $arr_response;
     $model = new Comment();
     if ($_REQUEST['text']) {
         $model->comment = $_REQUEST['text'];
         $model->update_live = true;
         if (Comment::save_comment($model)) {
             $arr_response['response_message'] = 'Comment sent.';
         } else {
             $arr_response['response_code'] = 409;
             $arr_response['response_message'] = Yii::t('comment', 'Comment could not be saved.');
         }
     } else {
         $arr_response['response_code'] = 409;
         $arr_response['response_message'] = Yii::t('comment', "No 'text' parameter received.");
     }
 }
开发者ID:jjsub,项目名称:samesub,代码行数:18,代码来源:LiveController.php

示例3: actionPush

 public function actionPush($text = "")
 {
     $this->model = new Comment();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($this->model);
     if (isset($_POST['Comment']) or $text or $_POST['text']) {
         if (isset($_POST['Comment'])) {
             $this->model->attributes = $_POST['Comment'];
         }
         if ($text) {
             $this->model->comment = $text;
         }
         if ($_POST['text']) {
             $this->model->comment = $_POST['text'];
         }
         $this->model->update_live = true;
         Comment::save_comment($this->model);
         //we need to jsonecode something, as not doing so, can provoke an
         //ajax response error on the client site if the ajax request is of type json
         echo json_encode(array('success' => 'yes'));
         return;
     }
     $this->render('add', array('model' => $this->model));
 }
开发者ID:jjsub,项目名称:samesub,代码行数:24,代码来源:CommentController.php

示例4: unset

 $usr = get_user();
 $comment->comment = $_POST['comment'];
 $comment->subject = $_POST['comment'];
 $comment->parent_type = TYPE_CONTENT;
 $comment->parent_id = $_POST['id'];
 $comment->content_id = $_POST['id'];
 $comment->user_id = $usr->user_id;
 $comment->name = $usr->login_name;
 $comment->email = $usr->email;
 $id = $_POST['id'];
 if ($comment->spam_check()) {
     $error_message = "Sorry, your comment cannot be posted as it looks like spam.  Try removing any links to possibly suspect sites, and re-submitting.";
     Logger::log("Comment rejected by spam filter", LOGGER_ACTION);
 } else {
     $error_message = 'Your comment has been posted successfully';
     $comment->save_comment();
     if ($comment->spam_state != SPAM_STATE_OK) {
         $error_message = "Sorry, your comment cannot be posted as it was classified as spam by Akismet, or contained links to blacklisted sites.  Please check the links in your post, and that your name and e-mail address are correct.";
     } else {
         //TO DO: comment should be posted to contents of other network rather then just mother network
         //$params['cid'] = $comment->content_id;
         //auto_email_notification('comment_posted', $params );
         //** when uncommenting the above line, don't forget to uncomment the include of auto_email_notify.php at the top of this file too!
         unset($_POST);
         //invalidate cache of content block as it is modified now
         if ($network_info) {
             $nid = '_network_' . $network_info->network_id;
         } else {
             $nid = '';
         }
         //unique name
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:submit_comment.php

示例5: Comment

<?php

include_once $_SERVER["DOCUMENT_ROOT"] . '/config.php';
include_once ROOT_PATH . '/App/Models/Database.class.php';
include_once ROOT_PATH . '/App/Models/Comment.class.php';
$comment_goal_id = $_POST['comment-goal-id'];
$comment_body = $_POST["goal-{$comment_goal_id}-comment"];
$Comment = new Comment($comment_body, $comment_goal_id);
$Comment->save_comment($Comment);
header('Location: /public_html/goals?message=comment_added');
开发者ID:jdarrohn,项目名称:goal-cms,代码行数:10,代码来源:add_comment.php

示例6: handleAJAX_addUserComment

 private function handleAJAX_addUserComment($request_data)
 {
     $msg = 'success';
     $html = 'null';
     filter_all_post($request_data);
     if (!empty($request_data['content'])) {
         $comment = new Comment();
         $usr = PA::$login_user;
         $comment->comment = $request_data['content'];
         $comment->subject = $request_data['content'];
         $comment->parent_type = TYPE_USER;
         $comment->parent_id = PA::$page_uid;
         $comment->content_id = PA::$page_uid;
         $comment->user_id = $usr->user_id;
         $comment->name = $usr->login_name;
         $comment->email = $usr->email;
         $id = PA::$page_uid;
         if ($comment->spam_check()) {
             Logger::log("Comment rejected by spam filter", LOGGER_ACTION);
             $msg = $html = __("Comment rejected by spam filter");
         } else {
             try {
                 $comment->save_comment();
                 if ($comment->spam_state != SPAM_STATE_OK) {
                     $msg = $html = __("Comment rejected by spam filter");
                 }
                 $html = $this->render();
             } catch (Exception $e) {
                 $msg = $html = $e->getMessage();
             }
         }
     } else {
         $msg = __("Comment can't be empty.");
     }
     echo json_encode(array("msg" => $msg, "result" => htmlspecialchars($html)));
     exit;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:37,代码来源:ShowUserCommentModule.php


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