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


PHP Akismet::auto_check_comment方法代码示例

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


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

示例1: pre_check_pingback

 public static function pre_check_pingback($method)
 {
     if ($method !== 'pingback.ping') {
         return;
     }
     global $wp_xmlrpc_server;
     if (!is_object($wp_xmlrpc_server)) {
         return false;
     }
     // Lame: tightly coupled with the IXR class.
     $args = $wp_xmlrpc_server->message->params;
     if (!empty($args[1])) {
         $post_id = url_to_postid($args[1]);
         // If this gets through the pre-check, make sure we properly identify the outbound request as a pingback verification
         Akismet::pingback_forwarded_for(null, $args[0]);
         add_filter('http_request_args', array('Akismet', 'pingback_forwarded_for'), 10, 2);
         $comment = array('comment_author_url' => $args[0], 'comment_post_ID' => $post_id, 'comment_author' => '', 'comment_author_email' => '', 'comment_content' => '', 'comment_type' => 'pingback', 'akismet_pre_check' => '1', 'comment_pingback_target' => $args[1]);
         $comment = Akismet::auto_check_comment($comment);
         if (isset($comment['akismet_result']) && 'true' == $comment['akismet_result']) {
             // Lame: tightly coupled with the IXR classes. Unfortunately the action provides no context and no way to return anything.
             $wp_xmlrpc_server->error(new IXR_Error(0, 'Invalid discovery target'));
         }
     }
 }
开发者ID:onedaylabs,项目名称:onedaylabs.com,代码行数:24,代码来源:class.akismet.php

示例2: akismet_auto_check_comment

function akismet_auto_check_comment($commentdata)
{
    return Akismet::auto_check_comment($commentdata);
}
开发者ID:TheHiddenHaku,项目名称:fuzzy-waddle,代码行数:4,代码来源:wrapper.php

示例3: akismet_auto_check_comment

function akismet_auto_check_comment($commentdata)
{
    _deprecated_function(__FUNCTION__, '3.0', 'Akismet::auto_check_comment()');
    return Akismet::auto_check_comment($commentdata);
}
开发者ID:Didox,项目名称:beminfinito,代码行数:5,代码来源:wrapper.php

示例4: akismetCheck

 /**
  * Verify the $_POST using Akismet
  *
  * @filter akismet_comment_nonce
  * @link http://akismet.com/development/api/#comment-check
  * @uses akismet_init()
  * @uses akismet_auto_check_comment()
  *
  */
 function akismetCheck($Contact)
 {
     global $akismet_api_host, $akismet_api_port;
     // Disable using a filter
     if (apply_filters('disable_constant_contact_akismet', false)) {
         return true;
     }
     // Akismet not activated
     if (!class_exists('Akismet')) {
         do_action('ctct_activity', 'The Akismet class does not exist. Please upgrade to Version 3+ of Akismet.');
         return true;
     }
     $key = Akismet::get_api_key();
     if (empty($key)) {
         do_action('ctct_activity', 'Empty Akismet API key. Not processing.');
         return true;
     }
     /** Disable nonce verification */
     add_filter('akismet_comment_nonce', function () {
         return 'inactive';
     });
     ob_start();
     $comment_data = array('user_ID' => get_current_user_id(), 'comment_post_ID' => isset($_POST['cc_referral_post_id']) ? intval($_POST['cc_referral_post_id']) : NULL, 'comment_author' => $Contact->get('name'), 'comment_author_email' => $Contact->get('email'), 'is_test' => apply_filters('constant_contact_akismet_is_test', false));
     $check = Akismet::auto_check_comment($comment_data);
     ob_clean();
     if (empty($check) || empty($check['akismet_result'])) {
         do_action('ctct_activity', 'There was an issue with Akismet: the response was invalid.', $check);
     } else {
         switch ($check['akismet_result']) {
             case 'true':
                 do_action('ctct_activity', __('Akismet caught this entry as spam'), $check);
                 return new WP_Error('akismet', __('Your entry was flagged as spam.'), $check);
                 break;
             case 'false':
                 do_action('ctct_activity', __('Akismet cleared this comment'), $check);
                 break;
             default:
                 do_action('ctct_error', sprintf(__('Akismet was unable to check this entry (response: %s), will automatically retry again later.'), substr($check['akismet_result'], 0, 50)), $check);
         }
     }
     return true;
 }
开发者ID:kidaa30,项目名称:Constant-Contact-WordPress-Plugin,代码行数:51,代码来源:class.ctct_process_form.php


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