/** * Read the current session using the driver set in the config file */ public static function read() { if (is_null(static::$cargo)) { $driver = static::factory(Config::session()); static::$cargo = new Cargo($driver, Config::app('key')); } static::instance()->read(); }
public function __construct($config) { $this->config = $config; $this->key = Config::app('key'); // setup the memcache server extract(Config::cache('memcached')); $this->server = new M(); $this->server->addServer($host, $port); }
/** * Sends the final headers cookies and output */ public function send() { // dont send headers for CLI if (!Request::cli()) { // create a status header Status::create($this->status)->header(); // always make sure we send the content type if (!array_key_exists('content-type', $this->headers)) { $this->headers['content-type'] = 'text/html; charset=' . Config::app('encoding', 'UTF-8'); } // output headers foreach ($this->headers as $name => $value) { header($name . ': ' . $value); } // send any cookies we may have stored in the cookie class foreach (Cookie::$bag as $cookie) { call_user_func_array('setcookie', array_values($cookie)); } } // output the final content if ($this->output) { echo $this->output; } }
/** * Remove the relative path from the uri set in the application config * * @param string * @return string */ public static function remove_relative_uri($uri) { // remove base url if ($base = Config::app('url')) { $uri = static::remove(rtrim($base, '/'), $uri); } // remove index if ($index = Config::app('index')) { $uri = static::remove('/' . $index, $uri); } return $uri; }