/** * Take the http request path and translate it to an array. * will get from $_SERVER['REQUEST_URI'], first stripping base url. * If path was just "/", array will be empty. * * @return array array of path elements */ private function pathElements() { // lazy load if (!$this->path_elements) { $request_uri = $this->getServer('REQUEST_URI'); // get the path by stripping off base url + querystring $configBase = $this->registry->getConfig('BASE_WEB_PATH', false, ""); // remove base path, which might be simply '/' if (substr($request_uri, 0, strlen($configBase) + 1) == $configBase . "/") { // $request_uri = str_replace( $configBase . "/", "", $request_uri ); $request_uri = substr_replace($request_uri, '', 0, strlen($configBase) + 1); } // remove query string $request_uri = Xerxes_Framework_Parser::removeRight($request_uri, "?"); // now get the elements $path_elements = explode('/', $request_uri); for ($x = 0; $x < count($path_elements); $x++) { $path_elements[$x] = urldecode($path_elements[$x]); } // for an empty path, we'll have one empty string element, get rid of it. if (strlen($path_elements[0]) == 0) { unset($path_elements[0]); } $this->path_elements = $path_elements; } return $this->path_elements; }