# multisafepay/trunk/src/Utils/QrOrder.php

MultiSafepay plugin for WooCommerce, version trunk. 41 lines.

- Page: https://pluginprobe.com/plugins/multisafepay/trunk/code/src/Utils/QrOrder.php
- Raw: https://pluginprobe.com/plugins/multisafepay/trunk/raw/src/Utils/QrOrder.php
- Modified: 2025-04-01T09:46:28+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/multisafepay/trunk/code/src/Utils/QrOrder.php#L10-L20`.

```php
<?php declare(strict_types=1);

namespace MultiSafepay\WooCommerce\Utils;

/**
 * This class defines methods to handle easily different actions related with the WC_Order object
 */
class QrOrder {

    /**
     * Get the customer IP address.
     *
     * @return string
     */
    public function get_customer_ip_address(): string {
        $possible_ip_sources = array(
            'HTTP_CLIENT_IP',
            'HTTP_X_FORWARDED_FOR',
            'REMOTE_ADDR',
        );

        foreach ( $possible_ip_sources as $source ) {
            if ( ! empty( $_SERVER[ $source ] ) ) {
                return sanitize_text_field( wp_unslash( $_SERVER[ $source ] ) );
            }
        }

        return '';
    }

    /**
     * Get the user agent.
     *
     * @return string
     */
    public function get_user_agent(): string {
        return sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ?? '' ) );
    }

}

```
