site_key, $url );
wp_enqueue_script( 'awpcp-recaptcha', $url, array( 'awpcp' ), 'v3', true );
}
/**
* @since 3.9.4
*/
protected function get_recaptcha_html( $site_key ) {
$template = '
';
$template .= '';
$template .= '
';
return sprintf( $template, $site_key );
}
/**
* @since 3.9.4
*/
protected function get_recaptcha_response() {
return $this->request->post( 'awpcp_recaptcha_v3_response' );
}
/**
* @since 3.9.4
*/
protected function on_success( $response, &$error ) {
$threshold = floatval( awpcp_get_option( 'recaptcha-v3-score-threshold', 0.5 ) );
$score = floatval( $response['score'] );
if ( $score <= $threshold ) {
$error = __( 'The current interaction was not approved by reCAPTCHA. Please try again.', 'another-wordpress-classifieds-plugin' );
return false;
}
return true;
}
}