';
$field .= '
';
return $field;
}
/**
* Method specific footer scripts.
*
* @return void
*
* @since 7.6.0
*/
public static function footer_scripts() {
// PHPCS ignored as this method uses inline scripts, which it does not like.
// phpcs:disable
?>
10,
'body' => array(
'secret' => $secret_key,
'response' => $response,
'remoteip' => $remoteip,
),
)
);
// get the request response body.
$request_body = wp_remote_retrieve_body( $request );
if ( ! $request_body ) {
return $verify;
}
$result = json_decode( $request_body, true );
if ( isset( $result['success'] ) && true === $result['success'] ) {
$verify = true;
}
$verify = apply_filters( 'c4wp_verify_captcha', $verify, $result, $response );
$last_verify = $verify;
// If we know this is a duplicated request, pass verification.
if ( isset( $result['error-codes'] ) && ! empty( $result['error-codes'] ) && 'timeout-or-duplicate' === $result['error-codes'][0] && $duplicate_response ) {
$verify = true;
}
/* @dev:start */
$dev_mode = apply_filters( 'c4wp_enable_dev_mode', false );
if ( $dev_mode ) {
$store = array();
$store['verify_post'] = $_POST; // phpcs:ignore WordPress.Security.NonceVerification.Missing,
$store['verify_result'] = $result;
$store['verify_return'] = $verify;
C4WP_Functions::c4wp_log_verify_result( $store );
if ( 'return_false' === C4WP_Functions::c4wp_get_option( 'override_result' ) ) {
return false;
} elseif ( 'return_true' === C4WP_Functions::c4wp_get_option( 'override_result' ) ) {
return true;
}
}
/* @dev:end */
return $verify;
}
/**
* Get this methods verification URL.
*
* @return string - The url.
*
* @since 7.6.0
*/
public static function get_verify_url() {
return self::$verify_url;
}
/**
* Get the script URL for this method.
*
* @return string - The URL.
*
* @since 7.6.0
*/
public static function get_provider_script_url() {
return 'https://challenges.cloudflare.com/turnstile/v0/api.js?onload=c4wp_onloadCallback';
}
}
}