' . __( 'Please solve the captcha to proof that you are human.', 'affiliates-recaptcha' ) . ''; } if ( !function_exists( 'recaptcha_get_html' ) ) { require_once 'recaptcha/recaptchalib.php'; } $field .= recaptcha_get_html( get_option( 'affiliates-recaptcha-public-key', '' ), $affiliates_recaptcha_error, is_ssl() ); $field .= apply_filters( 'affiliates_recaptcha_field_css', '' ); $field .= apply_filters( 'affiliates_recaptcha_field_error', $field_error ); return $field; } /** * Validates the captcha. * * @param boolean $result * @param string $field_value * @return boolean */ public static function affiliates_captcha_validate( $result, $field_value ) { global $affiliates_recaptcha_error, $affiliates_recaptcha_response; if ( !isset( $affiliates_recaptcha_response ) ) { if ( !function_exists( 'recaptcha_check_answer' ) ) { require_once 'recaptcha/recaptchalib.php'; } $response = recaptcha_check_answer( get_option( 'affiliates-recaptcha-private-key' ), $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] ); if ( !$response->is_valid ) { $affiliates_recaptcha_error = $response->error; } else { $affiliates_recaptcha_error = null; $affiliates_recaptcha_response = $response; } } else { $response = $affiliates_recaptcha_response; } return $result && $response->is_valid; } } Affiliates_Recaptcha_Legacy::init();