function wpcf7_captcha_validation_filter($result, $tag) { $tag = new WPCF7_Shortcode($tag); $type = $tag->type; $name = $tag->name; $captchac = '_wpcf7_captcha_challenge_' . $name; $prefix = isset($_POST[$captchac]) ? (string) $_POST[$captchac] : ''; $response = isset($_POST[$name]) ? (string) $_POST[$name] : ''; if ($prefix) { if (!wpcf7_check_captcha($prefix, $response)) { $result['valid'] = false; $result['reason'][$name] = wpcf7_get_message('captcha_not_match'); } wpcf7_remove_captcha($prefix); } return $result; }
function wpcf7_captcha_validation_filter($result, $tag) { $tag = new WPCF7_Shortcode($tag); $type = $tag->type; $name = $tag->name; $captchac = '_wpcf7_captcha_challenge_' . $name; $prefix = isset($_POST[$captchac]) ? (string) $_POST[$captchac] : ''; $response = isset($_POST[$name]) ? (string) $_POST[$name] : ''; $response = wpcf7_canonicalize($response); if (0 == strlen($prefix) || !wpcf7_check_captcha($prefix, $response)) { $result->invalidate($tag, wpcf7_get_message('captcha_not_match')); } if (0 != strlen($prefix)) { wpcf7_remove_captcha($prefix); } return $result; }
function wpcf7_captcha_validation_filter($result, $tag) { global $wpcf7_contact_form; $type = $tag['type']; $name = $tag['name']; $_POST[$name] = (string) $_POST[$name]; $captchac = '_wpcf7_captcha_challenge_' . $name; if (!wpcf7_check_captcha($_POST[$captchac], $_POST[$name])) { $result['valid'] = false; $result['reason'][$name] = $wpcf7_contact_form->message('captcha_not_match'); } wpcf7_remove_captcha($_POST[$captchac]); return $result; }