當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Akismet::recheck_comment方法代碼示例

本文整理匯總了PHP中Akismet::recheck_comment方法的典型用法代碼示例。如果您正苦於以下問題:PHP Akismet::recheck_comment方法的具體用法?PHP Akismet::recheck_comment怎麽用?PHP Akismet::recheck_comment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Akismet的用法示例。


在下文中一共展示了Akismet::recheck_comment方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: check

 /**
  * Checks one or more comments against the Akismet API.
  *
  * ## OPTIONS
  * <comment_id>...
  * : The ID(s) of the comment(s) to check.
  *
  * [--noaction]
  * : Don't change the status of the comment. Just report what Akismet thinks it is.
  *
  * ## EXAMPLES
  *
  *     wp akismet check 12345
  *
  * @alias comment-check
  */
 public function check($args, $assoc_args)
 {
     foreach ($args as $comment_id) {
         if (isset($assoc_args['noaction'])) {
             // Check the comment, but don't reclassify it.
             $api_response = Akismet::check_db_comment($comment_id, 'wp-cli');
         } else {
             $api_response = Akismet::recheck_comment($comment_id, 'wp-cli');
         }
         if ('true' === $api_response) {
             WP_CLI::line(sprintf(__("Comment #%d is spam.", 'akismet'), $comment_id));
         } else {
             if ('false' === $api_response) {
                 WP_CLI::line(sprintf(__("Comment #%d is not spam.", 'akismet'), $comment_id));
             } else {
                 if (false === $api_response) {
                     WP_CLI::error(__("Failed to connect to Akismet.", 'akismet'));
                 } else {
                     if (is_wp_error($api_response)) {
                         WP_CLI::warning(sprintf(__("Comment #%d could not be checked.", 'akismet'), $comment_id));
                     }
                 }
             }
         }
     }
 }
開發者ID:coreymargulis,項目名稱:karenmargulis,代碼行數:42,代碼來源:class.akismet-cli.php

示例2: recheck_queue_portion

 public static function recheck_queue_portion($start = 0, $limit = 100)
 {
     global $wpdb;
     $paginate = '';
     if ($limit <= 0) {
         $limit = 100;
     }
     if ($start < 0) {
         $start = 0;
     }
     $moderation = $wpdb->get_col($wpdb->prepare("SELECT * FROM {$wpdb->comments} WHERE comment_approved = '0' LIMIT %d OFFSET %d", $limit, $start));
     $result_counts = array('processed' => count($moderation), 'spam' => 0, 'ham' => 0, 'error' => 0);
     foreach ($moderation as $comment_id) {
         $api_response = Akismet::recheck_comment($comment_id, 'recheck_queue');
         if ('true' === $api_response) {
             ++$result_counts['spam'];
         } elseif ('false' === $api_response) {
             ++$result_counts['ham'];
         } else {
             ++$result_counts['error'];
         }
     }
     return $result_counts;
 }
開發者ID:kanei,項目名稱:vantuch.cz,代碼行數:24,代碼來源:class.akismet-admin.php


注:本文中的Akismet::recheck_comment方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。