function sharing_email_check_for_spam_via_akismet($data) { if (!function_exists('akismet_http_post') && !method_exists('Akismet', 'http_post')) { return $data; } // Prepare the body_request for akismet $body_request = array('blog' => get_option('home'), 'permalink' => get_permalink($data['post']->ID), 'comment_type' => 'share', 'comment_author' => $data['name'], 'comment_author_email' => $data['source'], 'comment_content' => sharing_email_send_post_content($data), 'user_agent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null); if (method_exists('Akismet', 'http_post')) { $body_request['user_ip'] = Akismet::get_ip_address(); $response = Akismet::http_post(build_query($body_request), 'comment-check'); } else { global $akismet_api_host, $akismet_api_port; $body_request['user_ip'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null; $response = akismet_http_post(build_query($body_request), $akismet_api_host, '/1.1/comment-check', $akismet_api_port); } // The Response is spam lets not send the email. if (!empty($response) && isset($response[1]) && 'true' == trim($response[1])) { // 'true' is spam return false; // don't send the email } return $data; }
function akismet_get_ip_address() { _deprecated_function(__FUNCTION__, '3.0', 'Akismet::get_ip_address()'); return Akismet::get_ip_address(); }
function akismet_get_ip_address() { return Akismet::get_ip_address(); }
public function get_user_data() { return array('user_ip' => Akismet::get_ip_address(), 'user_agent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null, 'referrer' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null, 'blog' => get_option('home'), 'blog_lang' => get_locale(), 'blog_charset' => get_option('blog_charset')); }