Skip to content

Commit

Permalink
No longer user Server::get method, will be removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Oct 11, 2023
1 parent e2543fa commit 55879af
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,20 @@ public function start( Payment $payment ) {
$merchant->close_window = 'false';

// Customer.
$customer = new Customer();
$customer->ip_address = Server::get( 'REMOTE_ADDR', FILTER_VALIDATE_IP );
$customer->forwarded_ip = Server::get( 'HTTP_X_FORWARDED_FOR', FILTER_VALIDATE_IP );
$customer = new Customer();

// phpcs:disable WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders -- No problem, this is up to MultiSafepay.

if ( \array_key_exists( 'REMOTE_ADDR', $_SERVER ) ) {
// phpcs:ignore WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___SERVER__REMOTE_ADDR__
$customer->ip_address = \sanitize_text_field( $_SERVER['REMOTE_ADDR'] );
}

if ( \array_key_exists( 'HTTP_X_FORWARDED_FOR', $_SERVER ) ) {
$customer->forwarded_ip = \sanitize_text_field( $_SERVER['HTTP_X_FORWARDED_FOR'] );
}

// phpcs:enable WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders

if ( null !== $payment->get_customer() ) {
$name = $payment->get_customer()->get_name();
Expand Down

0 comments on commit 55879af

Please sign in to comment.