Server IP : 172.67.158.161 / Your IP : 3.15.239.209 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/home/giankuin/thietke365.net/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 = []) { $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(); } // on PHP_VERSION_ID >= 70300 we'll be able to simply setcookie($name, $value, $options); setcookie( $name, $value, $options['expires'], $options['path'], $options['domain'], $options['secure'], $options['httponly'] ); } 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]); } }