Exemplo n.º 1
0
 /**
  * Get the value of a cookie.
  *
  * <code>
  *		// Get the value of the "favorite" cookie
  *		$favorite = Cookie::get('favorite');
  *
  *		// Get the value of a cookie or return a default value 
  *		$favorite = Cookie::get('framework', 'Laravel');
  * </code>
  *
  * @param  string  $name
  * @param  mixed   $default
  * @return string
  */
 public static function get($name, $default = null)
 {
     if (isset(static::$jar[$name])) {
         return static::$jar[$name];
     }
     return array_get(Request::foundation()->cookies->all(), $name, $default);
 }
Exemplo n.º 2
0
 /**
  * Reinitialize the global request.
  * 
  * @return void
  */
 protected function restartRequest()
 {
     // FIXME: Ugly hack, but old contents from previous requests seem to
     // trip up the Foundation class.
     $_FILES = array();
     Request::$foundation = RequestFoundation::createFromGlobals();
 }
Exemplo n.º 3
0
 /**
  * Get the base URL of the application.
  *
  * @return string
  */
 public static function base()
 {
     if (isset(static::$base)) {
         return static::$base;
     }
     $base = 'http://localhost';
     // If the application's URL configuration is set, we will just use that
     // instead of trying to guess the URL from the $_SERVER array's host
     // and script variables as this is a more reliable method.
     if (($url = Config::get('application.url')) !== '') {
         $base = $url;
     } else {
         $base = Request::foundation()->getRootUrl();
     }
     return static::$base = $base;
 }
Exemplo n.º 4
0
 /**
  * Send all of the response headers to the browser.
  *
  * @return void
  */
 public function send_headers()
 {
     $this->foundation->prepare(Request::foundation());
     $this->foundation->sendHeaders();
 }
Exemplo n.º 5
0
Request::$foundation = RequestFoundation::createFromGlobals();
/*
|--------------------------------------------------------------------------
| Determine The Application Environment
|--------------------------------------------------------------------------
|
| Next we're ready to determine the application environment. This may be
| set either via the command line options, or, if the request is from
| the web, via the mapping of URIs to environments that lives in
| the "paths.php" file for the application and is parsed.
|
*/
if (Request::cli()) {
    $environment = get_cli_option('env');
} else {
    $root = Request::foundation()->getRootUrl();
    $environment = Request::detect_env($environments, $root);
}
/*
|--------------------------------------------------------------------------
| Set The Application Environment
|--------------------------------------------------------------------------
|
| Once we have determined the application environment, we will set it on
| the global server array of the HttpFoundation request. This makes it
| available throughout the application, thought it is mainly only
| used to determine which configuration files to merge in.
|
*/
if (isset($environment)) {
    Request::set_env($environment);
Exemplo n.º 6
0
 public static function base()
 {
     if (isset(static::$base)) {
         return static::$base;
     }
     $base = 'http://localhost';
     if (($url = Config::get('application.url')) !== '') {
         $base = $url;
     } else {
         $base = Request::foundation()->getRootUrl();
     }
     return static::$base = $base;
 }