From fd6b71b45927cfbd2be8984ccc9341e480d970cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Preu=C3=9F?= Date: Sat, 4 May 2019 22:23:50 +0200 Subject: [PATCH] Adding request class for testing --- classes/Core.class.php | 2 ++ classes/Request.class.php | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/classes/Core.class.php b/classes/Core.class.php index c2239d1..8058ef6 100644 --- a/classes/Core.class.php +++ b/classes/Core.class.php @@ -70,6 +70,8 @@ } private function init() { + Request::init(); + $this->hooks = new Hooks(); $this->modules = new Modules($this); $this->template = new Template($this); diff --git a/classes/Request.class.php b/classes/Request.class.php index f5d08d5..38f94d5 100644 --- a/classes/Request.class.php +++ b/classes/Request.class.php @@ -2,6 +2,24 @@ namespace fruithost; class Request { + private static $get = []; + + public static function init() { + self::$get = $_GET; + } + + public static function has($name) { + return in_array($name, self::$get); + } + + public static function get($name) { + if(self::has($name)) { + return null; + } + + return self::$get[$name]; + } + public static function url() { return $_SERVER['REQUEST_URI']; }