public function getSiteUrl($withpath = false)
{
$url = ($this->req_is("ssl") ? 'https' : 'http') . "://";
if ($this->registry['base_port'] != "80") {
$url .= $this->registry['base_host'] . ":" . $this->registry['base_port'];
} else {
$url .= $this->registry['base_host'];
}
if ($withpath) {
$url .= implode("/", array_slice(explode("/", $_SERVER['SCRIPT_NAME']), 0, -1));
}
return rtrim($url, '/');
}