/** * Imports PATH_INFO string as parameters. * * @param boolean $importPathInfo * @since Method available since Release 0.4.0 */ public function importPathInfo() { $pathInfo = Stagehand_HTTP_ServerEnv::getPathInfo(); if (is_null($pathInfo)) { return; } $pathInfoParameters = explode('/', trim($pathInfo, '/')); for ($i = 0, $count = count($pathInfoParameters); $i < $count; $i += 2) { $this->_parameters[$pathInfoParameters[$i]] = @$pathInfoParameters[$i + 1]; } }
/** * Gets the relative URI requested by a client. If the system has REQUEST_URI, * it has precedence. If not, the relative URI will be built using SCRIPT_NAME, * PATH_INFO, and QUERY_STRING. * * Note when using mod_rewrite in per-directory context on Apache, SCRIPT_NAME * does not indicate the original URI. * * @return string */ public static function getRelativeURI() { if (array_key_exists('REQUEST_URI', $_SERVER)) { return str_replace('//', '/', $_SERVER['REQUEST_URI']); } if (strlen(@$_SERVER['QUERY_STRING'])) { $queryString = '?' . $_SERVER['QUERY_STRING']; } else { $queryString = ''; } $pathInfo = Stagehand_HTTP_ServerEnv::getPathInfo(); if (!is_null($pathInfo)) { $pathInfo = str_replace('%2F', '/', rawurlencode($pathInfo)); } return str_replace('//', '/', $_SERVER['SCRIPT_NAME']) . $pathInfo . $queryString; }