Example #1
0
 /**
  * Initializes the Request object
  */
 public static function start()
 {
     // Parse GET variables
     if (count($_GET) == 0) {
         parse_str(self::query(), self::$get);
     } else {
         self::$get = $_GET;
     }
     // Parse POST variables
     if (count($_POST) == 0) {
         //assuming its json
         $input = file_get_contents('php://input');
         $data = json_decode($input, true);
         self::$post = $data === null ? $input == '' ? [] : $input : $data;
     } else {
         self::$post = $_POST;
     }
     // Parse DATA
     $data = Session::get('xt-data', false);
     if ($data !== false) {
         self::$data = json_decode($data, true);
         Session::remove('xt-data');
     }
 }