summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2017-10-23 03:01:23 +0200
committerThomas Lange <code@nerdmind.de>2017-10-23 03:01:23 +0200
commitb22b2cc4bdbafeb4a955753e2d92fbc706c79407 (patch)
tree3d062f6894211fd915de9c96c57906b0ace8fb43 /core
parentb886b447c939db888aee84224995da58540b4503 (diff)
downloadblog-b22b2cc4bdbafeb4a955753e2d92fbc706c79407.tar.gz
blog-b22b2cc4bdbafeb4a955753e2d92fbc706c79407.tar.xz
blog-b22b2cc4bdbafeb4a955753e2d92fbc706c79407.zip
The methods "setCookie" and "getCookie" have been added to the HTTP class.
Diffstat (limited to 'core')
-rw-r--r--core/namespace/HTTP.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/namespace/HTTP.php b/core/namespace/HTTP.php
index d14b69b..c8aea27 100644
--- a/core/namespace/HTTP.php
+++ b/core/namespace/HTTP.php
@@ -172,6 +172,20 @@ class HTTP {
}
#===============================================================================
+ # Set cookie
+ #===============================================================================
+ public static function setCookie($name, $value = '', $expire = 31536000): bool {
+ return setcookie($name, $value, $expire + time(), '/');
+ }
+
+ #===============================================================================
+ # Get cookie
+ #===============================================================================
+ public static function getCookie($name) {
+ return $_COOKIE[$name] ?? NULL;
+ }
+
+ #===============================================================================
# Return HTTP request method or check if request method equals with $method
#===============================================================================
public static function requestMethod($method = NULL) {