From 28f76ed0215ffba14cd9a9683c1cb5d502b81932 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 11 Oct 2023 11:37:32 +0200 Subject: [PATCH] No longer use `Server::get` method, will be removed. --- src/DirectLink/Gateway.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/DirectLink/Gateway.php b/src/DirectLink/Gateway.php index a44287b..1471b58 100644 --- a/src/DirectLink/Gateway.php +++ b/src/DirectLink/Gateway.php @@ -166,10 +166,17 @@ public function start( Payment $payment ) { $secure_data_helper ->set_3d_secure_flag( true ) - ->set_http_accept( Server::get( 'HTTP_ACCEPT' ) ) - ->set_http_user_agent( Server::get( 'HTTP_USER_AGENT' ) ) ->set_window( 'MAINW' ); + if ( \array_key_exists( 'HTTP_ACCEPT', $_SERVER ) ) { + $secure_data_helper->set_http_accept( \sanitize_text_field( $_SERVER['HTTP_ACCEPT'] ) ); + } + + if ( \array_key_exists( 'HTTP_USER_AGENT', $_SERVER ) ) { + // phpcs:ignore WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___SERVER__HTTP_USER_AGENT__ + $secure_data_helper->set_http_accept( \sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ) ); + } + $ogone_data->set_field( 'ACCEPTURL', $payment->get_return_url() ); $ogone_data->set_field( 'DECLINEURL', $payment->get_return_url() ); $ogone_data->set_field( 'EXCEPTIONURL', $payment->get_return_url() );