getServer('REQUEST_URI'))[0]; $uri = substr($uri, strlen(Application::get()->getBaseURL())); $parts = explode('/', $uri); if (count($parts) > 0) $this->_controller = $parts[0]; if (count($parts) > 2) { $this->_tour = $parts[1]; $this->_action = $parts[2]; } elseif (count($parts) > 1) { $this->_action = $parts[1]; } } public function getControllerName() { if (is_null($this->_controller)) $this->parseURL(); return $this->_controller; } public function getActionName() { return $this->_action; } public function getTourName() { return $this->_tour; } public function getPost($key = null, $default = null) { if ($key === null) { return $_POST; } return isset($_POST[$key]) ? $_POST[$key] : $default; } public function getServer($key = null, $default = null) { if ($key === null) { return $_SERVER; } return isset($_SERVER[$key]) ? $_SERVER[$key] : $default; } public function getScheme() { return ($this->getServer('HTTPS') === 'on') ? self::SCHEME_HTTPS : self::SCHEME_HTTP; } public function getHttpHost() { $host = $this->getServer('HTTP_HOST'); if (!empty($host)) { return $host; } $scheme = $this->getScheme(); $name = $this->getServer('SERVER_NAME'); $port = $this->getServer('SERVER_PORT'); if ($name === null) { return ''; } elseif (($scheme == self::SCHEME_HTTP && $port == 80) || ($scheme == self::SCHEME_HTTPS && $port == 443)) { return $name; } return $name . ':' . $port; } public function isPost() { return $this->getServer('REQUEST_METHOD') == 'POST'; } public function isAjax() { return !empty($this->getServer('HTTP_X_REQUESTED_WITH')) && strtolower($this->getServer('HTTP_X_REQUESTED_WITH')) == 'xmlhttprequest'; } }