| Server IP : 35.236.43.222 / Your IP : 216.73.216.143 Web Server : Apache System : Linux order-form-vm-001 5.10.0-37-cloud-amd64 #1 SMP Debian 5.10.247-1 (2025-12-11) x86_64 User : deploy ( 1002) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/mastersystem.app/public/wp-content/plugins/mailpoet/lib/Util/ |
Upload File : |
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Util;
if (!defined('ABSPATH')) exit;
use InvalidArgumentException;
class Cookies {
const DEFAULT_OPTIONS = [
'expires' => 0,
'path' => '',
'domain' => '',
'secure' => false,
'httponly' => false,
];
public function set($name, $value, array $options = []) {
if (headers_sent()) {
return;
}
$options = $options + self::DEFAULT_OPTIONS;
$value = json_encode($value, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$error = json_last_error();
if ($error || ($value === false)) {
throw new InvalidArgumentException();
}
setcookie(
$name,
$value,
$options
);
}
public function get($name) {
if (!array_key_exists($name, $_COOKIE)) {
return null;
}
$value = json_decode(sanitize_text_field(wp_unslash(($_COOKIE[$name]))), true);
$error = json_last_error();
if ($error) {
return null;
}
return $value;
}
public function delete($name) {
unset($_COOKIE[$name]);
}
}