Uname: Linux premium294.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
Software: LiteSpeed
PHP version: 8.1.32 [ PHP INFO ] PHP os: Linux
Server Ip: 104.21.16.1
Your Ip: 216.73.216.223
User: mjbynoyq (1574) | Group: mjbynoyq (1570)
Safe Mode: OFF
Disable Function:
NONE

name : class-fw-request.php
<?php if (!defined('FW')) die('Forbidden');

/**
 * WordPress automatically adds slashes to:
 * $_REQUEST
 * $_POST
 * $_GET
 * $_COOKIE
 *
 * For e.g.
 *
 * If value is simple, get value directly:
 * $foo = isset($_GET['bar']) && $_GET['bar'] == 'yes';
 *
 * If value can contain some user input and can have quotes or json from some option, then use this helper:
 * $foo = json_decode(FW_Request::POST('bar')); // json_decode($_POST('bar')) will not work if json will contain quotes
 *
 * You can test that problem.
 * Add somewhere this code:
    fw_print(array(
        $_GET['test'],
        json_decode($_GET['test']),
        FW_Request::GET('test'),
        json_decode(FW_Request::GET('test'))
    ));
 * and access: http://your-site.com/?test={'a':1}
 */
class FW_Request
{
	protected static function prepare_key($key)
	{
		return $key;
	}

	protected static function get_set_key($multikey = null, $set_value = null, &$value = '')
	{
		$multikey = self::prepare_key($multikey);

		if ($set_value === null) { // get
			return fw_stripslashes_deep_keys($multikey === null ? $value : fw_akg($multikey, $value));
		} else { // set
			fw_aks($multikey, fw_addslashes_deep_keys($set_value), $value);
		}

		return '';
	}

	public static function GET($multikey = null, $default_value = null)
	{
		return fw_stripslashes_deep_keys(
			$multikey === null
				? $_GET
				: fw_akg($multikey, $_GET, $default_value)
		);
	}

	public static function POST($multikey = null, $default_value = null)
	{
		return fw_stripslashes_deep_keys(
			$multikey === null
				? $_POST
				: fw_akg($multikey, $_POST, $default_value)
		);
	}

	public static function COOKIE($multikey = null, $set_value = null, $expire = 0, $path = null)
	{
		if ($set_value !== null) {

			// transforms a string ( key1/key2/key3 => key1][key2][key3] )
			$multikey = str_replace('/', '][', $multikey) . ']';

			// removes the first closed square bracket ( key1][key2][key3] => key1[key2][key3] )
			$multikey = preg_replace('/\]/', '', $multikey, 1);

			return setcookie($multikey, $set_value, $expire, $path);
		} else {
			return self::get_set_key($multikey, $set_value, $_COOKIE);
		}
	}

	public static function REQUEST($multikey = null, $default_value = null)
	{
		return fw_stripslashes_deep_keys(
			$multikey === null
				? $_REQUEST
				: fw_akg($multikey, $_REQUEST, $default_value)
		);
	}
}
© 2025 XylotrechusZ