HEX
Server: Apache
System: Linux vps-3158868-x.dattaweb.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: emerlux (1185)
PHP: 8.3.1
Disabled: system, shell, exec, system_exec, shell_exec, mysql_pconnect, passthru, popen, proc_open, proc_close, proc_nice, proc_terminate, proc_get_status, escapeshellarg, escapeshellcmd, eval
Upload Files
File: /home/emerlux/public_html/wp-content/plugins/woocommerce-mercadopago/src/Helpers/Form.php
<?php

namespace MercadoPago\Woocommerce\Helpers;

if (!defined('ABSPATH')) {
    exit;
}

class Form
{
    /**
     * Sanitizes $_GET object or otherwise sanitizes an $_GET[$key] object/data
     *
     * @param string $key
     *
     * @return object|array|string
     */
    public static function sanitizedGetData(?string $key = null)
    {
        $data = filter_input_array(INPUT_GET, FILTER_SANITIZE_SPECIAL_CHARS);
        if (isset($key)) {
            $data = $data[$key] ?? null;
        }
        return self::sanitizedData($data);
    }

    /**
     * Sanitizes $_POST object or otherwise sanitizes an $_POST[$key] object/data
     *
     * @return object|array|string
     */
    public static function sanitizedPostData(?string $key = null)
    {
        $data = sanitize_post($_POST);

        return self::sanitizedData(isset($key) ? $data[$key] : $data);
    }

    /**
     * @param object|array|string $data
     *
     * @return object|array|string
     */
    private static function sanitizedData($data)
    {
        if (is_object($data) || is_array($data)) {
            return map_deep($data, function ($value) {
                return sanitize_text_field($value ?? null);
            });
        }

        return sanitize_text_field($data ?? null);
    }
}