本文整理汇总了PHP中akismet_delete_old函数的典型用法代码示例。如果您正苦于以下问题:PHP akismet_delete_old函数的具体用法?PHP akismet_delete_old怎么用?PHP akismet_delete_old使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了akismet_delete_old函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: akismet_auto_check_comment
function akismet_auto_check_comment($comment)
{
global $akismet_api_host, $akismet_api_port;
$comment['user_ip'] = preg_replace('/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR']);
$comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
$comment['referrer'] = $_SERVER['HTTP_REFERER'];
$comment['blog'] = get_option('home');
$comment['blog_lang'] = get_locale();
$comment['blog_charset'] = get_option('blog_charset');
$comment['permalink'] = get_permalink($comment['comment_post_ID']);
$ignore = array('HTTP_COOKIE');
foreach ($_SERVER as $key => $value) {
if (!in_array($key, $ignore) && is_string($value)) {
$comment["{$key}"] = $value;
}
}
$query_string = '';
foreach ($comment as $key => $data) {
$query_string .= $key . '=' . urlencode(stripslashes($data)) . '&';
}
$response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port);
if ('true' == $response[1]) {
// akismet_spam_count will be incremented later by akismet_result_spam()
add_filter('pre_comment_approved', 'akismet_result_spam');
do_action('akismet_spam_caught');
$post = get_post($comment['comment_post_ID']);
$last_updated = strtotime($post->post_modified_gmt);
$diff = time() - $last_updated;
$diff = $diff / 86400;
if ($post->post_type == 'post' && $diff > 30 && get_option('akismet_discard_month') == 'true') {
// akismet_result_spam() won't be called so bump the counter here
if ($incr = apply_filters('akismet_spam_count_incr', 1)) {
update_option('akismet_spam_count', get_option('akismet_spam_count') + $incr);
}
die;
}
}
akismet_delete_old();
return $comment;
}
示例2: akismet_auto_check_comment
function akismet_auto_check_comment($commentdata)
{
global $akismet_api_host, $akismet_api_port;
$comment = $commentdata;
$comment['user_ip'] = $_SERVER['REMOTE_ADDR'];
$comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
$comment['referrer'] = $_SERVER['HTTP_REFERER'];
$comment['blog'] = get_option('home');
$comment['blog_lang'] = get_locale();
$comment['blog_charset'] = get_option('blog_charset');
$comment['permalink'] = get_permalink($comment['comment_post_ID']);
$comment['user_role'] = akismet_get_user_roles($comment['user_ID']);
$ignore = array('HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW');
foreach ($_SERVER as $key => $value) {
if (!in_array($key, $ignore) && is_string($value)) {
$comment["{$key}"] = $value;
} else {
$comment["{$key}"] = '';
}
}
$query_string = '';
foreach ($comment as $key => $data) {
$query_string .= $key . '=' . urlencode(stripslashes($data)) . '&';
}
$response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port);
$commentdata['akismet_result'] = $response[1];
if ('true' == $response[1]) {
// akismet_spam_count will be incremented later by akismet_result_spam()
add_filter('pre_comment_approved', 'akismet_result_spam');
do_action('akismet_spam_caught');
$post = get_post($comment['comment_post_ID']);
$last_updated = strtotime($post->post_modified_gmt);
$diff = time() - $last_updated;
$diff = $diff / 86400;
if ($post->post_type == 'post' && $diff > 30 && get_option('akismet_discard_month') == 'true' && empty($comment['user_ID'])) {
// akismet_result_spam() won't be called so bump the counter here
if ($incr = apply_filters('akismet_spam_count_incr', 1)) {
update_option('akismet_spam_count', get_option('akismet_spam_count') + $incr);
}
die;
}
}
if (function_exists('wp_next_scheduled') && function_exists('wp_schedule_event')) {
// WP 2.1+: delete old comments daily
if (!wp_next_scheduled('akismet_scheduled_delete')) {
wp_schedule_event(time(), 'daily', 'akismet_scheduled_delete');
}
} elseif (mt_rand(1, 10) == 3) {
// WP 2.0: run this one time in ten
akismet_delete_old();
}
return $commentdata;
}
示例3: akismet_auto_check_comment
function akismet_auto_check_comment($comment)
{
global $akismet_api_host, $akismet_api_port;
$comment['user_ip'] = preg_replace('/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR']);
$comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
$comment['referrer'] = $_SERVER['HTTP_REFERER'];
$comment['blog'] = get_option('home');
$ignore = array('HTTP_COOKIE');
foreach ($_SERVER as $key => $value) {
if (!in_array($key, $ignore)) {
$comment["{$key}"] = $value;
}
}
$query_string = '';
foreach ($comment as $key => $data) {
$query_string .= $key . '=' . urlencode(stripslashes($data)) . '&';
}
$response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port);
if ('true' == $response[1]) {
add_filter('pre_comment_approved', create_function('$a', 'return \'spam\';'));
update_option('akismet_spam_count', get_option('akismet_spam_count') + 1);
$post = get_post($comment['comment_post_ID']);
$last_updated = strtotime($post->post_modified_gmt);
$diff = time() - $last_updated;
$diff = $diff / 86400;
if ($post->post_type == 'post' && $diff > 30 && get_option('akismet_discard_month') == 'true') {
die;
}
}
akismet_delete_old();
return $comment;
}
示例4: akismet_auto_check_comment
function akismet_auto_check_comment($commentdata)
{
global $akismet_api_host, $akismet_api_port, $akismet_last_comment;
$comment = $commentdata;
$comment['user_ip'] = $_SERVER['REMOTE_ADDR'];
$comment['user_agent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
$comment['referrer'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
$comment['blog'] = get_option('home');
$comment['blog_lang'] = get_locale();
$comment['blog_charset'] = get_option('blog_charset');
$comment['permalink'] = get_permalink($comment['comment_post_ID']);
if (!empty($comment['user_ID'])) {
$comment['user_role'] = akismet_get_user_roles($comment['user_ID']);
}
$akismet_nonce_option = apply_filters('akismet_comment_nonce', get_option('akismet_comment_nonce'));
$comment['akismet_comment_nonce'] = 'inactive';
if ($akismet_nonce_option == 'true' || $akismet_nonce_option == '') {
$comment['akismet_comment_nonce'] = 'failed';
if (isset($_POST['akismet_comment_nonce']) && wp_verify_nonce($_POST['akismet_comment_nonce'], 'akismet_comment_nonce_' . $comment['comment_post_ID'])) {
$comment['akismet_comment_nonce'] = 'passed';
}
// comment reply in wp-admin
if (isset($_POST['_ajax_nonce-replyto-comment']) && check_ajax_referer('replyto-comment', '_ajax_nonce-replyto-comment')) {
$comment['akismet_comment_nonce'] = 'passed';
}
}
if (akismet_test_mode()) {
$comment['is_test'] = 'true';
}
foreach ($_POST as $key => $value) {
if (is_string($value)) {
$comment["POST_{$key}"] = $value;
}
}
$ignore = array('HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW');
foreach ($_SERVER as $key => $value) {
if (!in_array($key, $ignore) && is_string($value)) {
$comment["{$key}"] = $value;
} else {
$comment["{$key}"] = '';
}
}
$post = get_post($comment['comment_post_ID']);
$comment['comment_post_modified_gmt'] = $post->post_modified_gmt;
$query_string = '';
foreach ($comment as $key => $data) {
$query_string .= $key . '=' . urlencode(stripslashes($data)) . '&';
}
$commentdata['comment_as_submitted'] = $comment;
$response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port);
do_action('akismet_comment_check_response', $response);
akismet_update_alert($response);
$commentdata['akismet_result'] = $response[1];
if ('true' == $response[1]) {
// akismet_spam_count will be incremented later by akismet_result_spam()
add_filter('pre_comment_approved', 'akismet_result_spam');
do_action('akismet_spam_caught');
$last_updated = strtotime($post->post_modified_gmt);
$diff = time() - $last_updated;
$diff = $diff / 86400;
if ($post->post_type == 'post' && $diff > 30 && get_option('akismet_discard_month') == 'true' && empty($comment['user_ID'])) {
// akismet_result_spam() won't be called so bump the counter here
if ($incr = apply_filters('akismet_spam_count_incr', 1)) {
update_option('akismet_spam_count', get_option('akismet_spam_count') + $incr);
}
$redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : get_permalink($post);
wp_safe_redirect($redirect_to);
die;
}
}
// if the response is neither true nor false, hold the comment for moderation and schedule a recheck
if ('true' != $response[1] && 'false' != $response[1]) {
if (!current_user_can('moderate_comments')) {
add_filter('pre_comment_approved', 'akismet_result_hold');
}
if (!wp_next_scheduled('akismet_schedule_cron_recheck')) {
wp_schedule_single_event(time() + 1200, 'akismet_schedule_cron_recheck');
}
}
if (function_exists('wp_next_scheduled') && function_exists('wp_schedule_event')) {
// WP 2.1+: delete old comments daily
if (!wp_next_scheduled('akismet_scheduled_delete')) {
wp_schedule_event(time(), 'daily', 'akismet_scheduled_delete');
}
} elseif (mt_rand(1, 10) == 3) {
// WP 2.0: run this one time in ten
akismet_delete_old();
}
$akismet_last_comment = $commentdata;
akismet_fix_scheduled_recheck();
return $commentdata;
}
示例5: ksd_auto_check_comment
function ksd_auto_check_comment($comment)
{
global $auto_comment_approved, $ksd_api_host, $ksd_api_port;
$comment['user_ip'] = $_SERVER['REMOTE_ADDR'];
$comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
$comment['referrer'] = $_SERVER['HTTP_REFERER'];
$comment['blog'] = get_option('home');
$ignore = array('HTTP_COOKIE');
foreach ($_SERVER as $key => $value) {
if (!in_array($key, $ignore)) {
$comment["{$key}"] = $value;
}
}
$query_string = '';
foreach ($comment as $key => $data) {
$query_string .= $key . '=' . urlencode(stripslashes($data)) . '&';
}
$response = ksd_http_post($query_string, $ksd_api_host, '/1.1/comment-check', $ksd_api_port);
if ('true' == $response[1]) {
$auto_comment_approved = 'spam';
update_option('akismet_spam_count', get_option('akismet_spam_count') + 1);
}
akismet_delete_old();
return $comment;
}