function gglcptch_commentform_check() { if (gglcptch_check_role()) { return; } $result = gglcptch_check(); if ($result['response'] || in_array($result['reason'], array('ERROR_ALLOW_URL_FOPEN', 'ERROR_NO_KEYS'))) { return; } wp_die(__('ERROR', 'google-captcha') . ': ' . __('You have entered an incorrect reCAPTCHA value. Click the BACK button on your browser, and try again.', 'google-captcha')); }
function gglcptch_commentform_check() { if (isset($_POST['gglcptch_test_enable_js_field'])) { if (wp_verify_nonce($_POST['gglcptch_test_enable_js_field'], 'gglcptch_recaptcha_nonce')) { return; } else { if (gglcptch_check_role()) { return; } gglcptch_lostpassword_check(); } } else { if (gglcptch_check_role()) { return; } gglcptch_lostpassword_check(); } }
function gglcptch_commentform_check($comment) { global $gglcptch_options; if (gglcptch_check_role()) { return $comment; } /* Skip captcha for comment replies from the admin menu */ if (isset($_REQUEST['action']) && 'replyto-comment' == $_REQUEST['action'] && (check_ajax_referer('replyto-comment', '_ajax_nonce', false) || check_ajax_referer('replyto-comment', '_ajax_nonce-replyto-comment', false))) { /* Skip capthca */ return $comment; } /* Skip captcha for trackback or pingback */ if ('' != $comment['comment_type'] && 'comment' != $comment['comment_type']) { return $comment; } require_once 'lib/recaptchalib.php'; $publickey = $gglcptch_options['public_key']; $privatekey = $gglcptch_options['private_key']; $resp = recaptcha_check_answer($privatekey, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']); if (!$resp->is_valid) { wp_die(__('Error: You have entered an incorrect CAPTCHA value. Click the BACK button on your browser, and try again.', 'google_captcha')); } else { return $comment; } }