/** * Get the current host url * * @return string */ public static function host() { $host = str_replace('/', '', Steelcode_Server_Vars::getVar('HTTP_HOST')); return Steelcode_Ssl_Helper::isSSL() ? "https://{$host}" : "http://{$host}"; }
/** * Set a cookie * * @param string $name * @param string $value * @param bool $httpOnly * @param string $expires * @param string $path * @param string $domain */ public function setCookie($name, $value, $httpOnly = true, $expires = '', $path = '/', $domain = '') { $expires = $expires === '' ? Steelcode_Date_Helper::UTCDate('+7 day', 'D, j M Y H:i:s e') : Steelcode_Date_Helper::UTCDate($expires, 'D, j M Y H:i:s e'); $cookie = "{$name}={$value};Path={$path};Expires={$expires}"; $cookie .= Steelcode_String_Helper::isNull($domain) ? '' : ";Domain={$domain}"; $cookie .= Steelcode_Ssl_Helper::isSSL() ? ';Secure' : ''; $cookie .= $httpOnly ? ';HttpOnly' : ''; exit($cookie); //$this->setFields( 'Set-Cookie', $cookie ); }