AnsPress_reCcaptcha::verify_recaptcha()
Description #
Check reCaptach verification.
Source #
File: addons/free/recaptcha.php
public static function verify_recaptcha() { require_once( ANSPRESS_ADDONS_DIR . '/free/recaptcha/autoload.php' ); $method = ap_opt( 'recaptcha_method' ) === 'curl' ? new \ReCaptcha\RequestMethod\CurlPost() : new \ReCaptcha\RequestMethod\Post(); $recaptcha = new \ReCaptcha\ReCaptcha( trim( ap_opt( 'recaptcha_secret_key' ) ), $method ); $ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP ); //@codingStandardsIgnoreLine. $captcha_response = ap_sanitize_unslash( 'g-recaptcha-response', 'r' ); $resp = $recaptcha->verify( $captcha_response, $ip ); if ( $resp->isSuccess() ) { do_action( 'ap_form_captcha_verified' ); return true; } return false; }
Expand full source code Collapse full source code View on GitHub: addons/free/recaptcha.php:95
Add your comment