PluginProbe
MultiSafepay plugin for WooCommerce / trunk
MultiSafepay plugin for WooCommerce vtrunk
6.11.1 6.12.0 6.13.0 6.2.0 6.2.1 6.3.0 6.3.1 6.4.0 6.4.1 6.4.2 6.4.3 6.5.0 6.5.1 6.6.0 6.6.1 6.6.2 6.7.0 6.7.1 6.7.2 6.7.3 6.8.0 6.8.1 6.8.2 6.8.3 6.9.0 All 84 releases
multisafepay / src / Utils / QrOrder.php

QrOrder.php in MultiSafepay plugin for WooCommerce trunk, at src/Utils/QrOrder.php

41 lines 931 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php declare(strict_types=1);
2
3 namespace MultiSafepay\WooCommerce\Utils;
4
5 /**
6 * This class defines methods to handle easily different actions related with the WC_Order object
7 */
8 class QrOrder {
9
10 /**
11 * Get the customer IP address.
12 *
13 * @return string
14 */
15 public function get_customer_ip_address(): string {
16 $possible_ip_sources = array(
17 'HTTP_CLIENT_IP',
18 'HTTP_X_FORWARDED_FOR',
19 'REMOTE_ADDR',
20 );
21
22 foreach ( $possible_ip_sources as $source ) {
23 if ( ! empty( $_SERVER[ $source ] ) ) {
24 return sanitize_text_field( wp_unslash( $_SERVER[ $source ] ) );
25 }
26 }
27
28 return '';
29 }
30
31 /**
32 * Get the user agent.
33 *
34 * @return string
35 */
36 public function get_user_agent(): string {
37 return sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ?? '' ) );
38 }
39
40 }
41