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


PHP Akismet::update_comment_history方法代码示例

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


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

示例1: submit_nonspam_comment

 public static function submit_nonspam_comment($comment_id)
 {
     global $wpdb, $current_user, $current_site;
     $comment_id = (int) $comment_id;
     $comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->comments} WHERE comment_ID = %d", $comment_id));
     if (!$comment) {
         // it was deleted
         return;
     }
     // use the original version stored in comment_meta if available
     $as_submitted = get_comment_meta($comment_id, 'akismet_as_submitted', true);
     if ($as_submitted && is_array($as_submitted) && isset($as_submitted['comment_content'])) {
         $comment = (object) array_merge((array) $comment, $as_submitted);
     }
     $comment->blog = get_bloginfo('url');
     $comment->blog_lang = get_locale();
     $comment->blog_charset = get_option('blog_charset');
     $comment->permalink = get_permalink($comment->comment_post_ID);
     $comment->user_role = '';
     if (is_object($current_user)) {
         $comment->reporter = $current_user->user_login;
     }
     if (is_object($current_site)) {
         $comment->site_domain = $current_site->domain;
     }
     if (isset($comment->user_ID)) {
         $comment->user_role = Akismet::get_user_roles($comment->user_ID);
     }
     if (Akismet::is_test_mode()) {
         $comment->is_test = 'true';
     }
     $post = get_post($comment->comment_post_ID);
     $comment->comment_post_modified_gmt = $post->post_modified_gmt;
     $response = Akismet::http_post(http_build_query($comment), 'submit-ham');
     if ($comment->reporter) {
         Akismet::update_comment_history($comment_id, sprintf(__('%s reported this comment as not spam', 'akismet'), $comment->reporter), 'report-ham');
         update_comment_meta($comment_id, 'akismet_user_result', 'false');
         update_comment_meta($comment_id, 'akismet_user', $comment->reporter);
     }
     do_action('akismet_submit_nonspam_comment', $comment_id, $response[1]);
 }
开发者ID:valiror,项目名称:sharingdais_demo1,代码行数:41,代码来源:class.akismet-admin.php

示例2: recheck_queue

 public static function recheck_queue()
 {
     global $wpdb;
     Akismet::fix_scheduled_recheck();
     if (!(isset($_GET['recheckqueue']) || isset($_REQUEST['action']) && 'akismet_recheck_queue' == $_REQUEST['action'])) {
         return;
     }
     $paginate = '';
     if (isset($_POST['limit']) && isset($_POST['offset'])) {
         $paginate = $wpdb->prepare(" LIMIT %d OFFSET %d", array($_POST['limit'], $_POST['offset']));
     }
     $moderation = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE comment_approved = '0'{$paginate}", ARRAY_A);
     foreach ((array) $moderation as $c) {
         $c['user_ip'] = $c['comment_author_IP'];
         $c['user_agent'] = $c['comment_agent'];
         $c['referrer'] = '';
         $c['blog'] = get_bloginfo('url');
         $c['blog_lang'] = get_locale();
         $c['blog_charset'] = get_option('blog_charset');
         $c['permalink'] = get_permalink($c['comment_post_ID']);
         $c['user_role'] = '';
         if (isset($c['user_ID'])) {
             $c['user_role'] = Akismet::get_user_roles($c['user_ID']);
         }
         if (Akismet::is_test_mode()) {
             $c['is_test'] = 'true';
         }
         add_comment_meta($c['comment_ID'], 'akismet_rechecking', true);
         $response = Akismet::http_post(Akismet::build_query($c), 'comment-check');
         if ('true' == $response[1]) {
             wp_set_comment_status($c['comment_ID'], 'spam');
             update_comment_meta($c['comment_ID'], 'akismet_result', 'true');
             delete_comment_meta($c['comment_ID'], 'akismet_error');
             delete_comment_meta($c['comment_ID'], 'akismet_delayed_moderation_email');
             Akismet::update_comment_history($c['comment_ID'], __('Akismet re-checked and caught this comment as spam', 'akismet'), 'check-spam');
         } elseif ('false' == $response[1]) {
             update_comment_meta($c['comment_ID'], 'akismet_result', 'false');
             delete_comment_meta($c['comment_ID'], 'akismet_error');
             delete_comment_meta($c['comment_ID'], 'akismet_delayed_moderation_email');
             Akismet::update_comment_history($c['comment_ID'], __('Akismet re-checked and cleared this comment', 'akismet'), 'check-ham');
             // abnormal result: error
         } else {
             update_comment_meta($c['comment_ID'], 'akismet_result', 'error');
             Akismet::update_comment_history($c['comment_ID'], sprintf(__('Akismet was unable to re-check this comment (response: %s)', 'akismet'), substr($response[1], 0, 50)), 'check-error');
         }
         delete_comment_meta($c['comment_ID'], 'akismet_rechecking');
     }
     if (defined('DOING_AJAX') && DOING_AJAX) {
         wp_send_json(array('processed' => count((array) $moderation)));
     } else {
         $redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : admin_url('edit-comments.php');
         wp_safe_redirect($redirect_to);
         exit;
     }
 }
开发者ID:sb-xs,项目名称:que-pour-elle,代码行数:55,代码来源:class.akismet-admin.php

示例3: akismet_update_comment_history

function akismet_update_comment_history($comment_id, $message, $event = null)
{
    return Akismet::update_comment_history($comment_id, $message, $event);
}
开发者ID:TheHiddenHaku,项目名称:fuzzy-waddle,代码行数:4,代码来源:wrapper.php

示例4: akismet_update_comment_history

function akismet_update_comment_history($comment_id, $message, $event = null)
{
    _deprecated_function(__FUNCTION__, '3.0', 'Akismet::update_comment_history()');
    return Akismet::update_comment_history($comment_id, $message, $event);
}
开发者ID:Didox,项目名称:beminfinito,代码行数:5,代码来源:wrapper.php

示例5: recheck_comment

 public static function recheck_comment($id, $recheck_reason = 'recheck_queue')
 {
     add_comment_meta($id, 'akismet_rechecking', true);
     $api_response = self::check_db_comment($id, $recheck_reason);
     delete_comment_meta($id, 'akismet_rechecking');
     if (is_wp_error($api_response)) {
         // Invalid comment ID.
     } else {
         if ('true' === $api_response) {
             wp_set_comment_status($id, 'spam');
             update_comment_meta($id, 'akismet_result', 'true');
             delete_comment_meta($id, 'akismet_error');
             delete_comment_meta($id, 'akismet_delayed_moderation_email');
             Akismet::update_comment_history($id, '', 'recheck-spam');
         } elseif ('false' === $api_response) {
             update_comment_meta($id, 'akismet_result', 'false');
             delete_comment_meta($id, 'akismet_error');
             delete_comment_meta($id, 'akismet_delayed_moderation_email');
             Akismet::update_comment_history($id, '', 'recheck-ham');
         } else {
             // abnormal result: error
             update_comment_meta($id, 'akismet_result', 'error');
             Akismet::update_comment_history($id, '', 'recheck-error', array('response' => substr($api_response, 0, 50)));
         }
     }
     return $api_response;
 }
开发者ID:coreymargulis,项目名称:karenmargulis,代码行数:27,代码来源:class.akismet.php


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