Пример #1
0
 public function addCookie($name, $value, $attrs = array())
 {
     // TODO
     $attrs = array_change_key_case($attrs);
     if (ArrayUtil::hasKey($attrs, 'max-age')) {
         $expires = time() + $attrs['max-age'];
     } else {
         $expires = ArrayUtil::get($attrs, 'expires');
     }
     r::addCookie($name, $value, $expires, ArrayUtil::get($attrs, 'path'), ArrayUtil::get($attrs, 'domain'));
 }
Пример #2
0
 private static function getDatabase($config)
 {
     $options = array(\PDO::ATTR_PERSISTENT => ArrayUtil::get($config, 'persistent', false));
     switch ($config['driver']) {
         case 'sqlite':
             return new SqliteDatabase($config['file'], $options);
         case 'mysql':
             return new MysqlDatabase($config['host'], $config['database'], $config['user'], $config['password'], ArrayUtil::get($config, 'charset', 'utf8mb4'), $options);
     }
     throw new \InvalidArgumentException('SQL driver ' . $config['driver'] . ' not recognized');
 }
Пример #3
0
 /**
  * Look up information about a file sent in a multipart-form request.
  *
  * @param string $name
  * @return array
  */
 public static function file($name)
 {
     return \Jitsu\ArrayUtil::get($_FILES, $name);
 }
Пример #4
0
 public function get($key, $default = null)
 {
     return a::get($this->value, XString::unwrap($key), $default);
 }
Пример #5
0
 /**
  * Look up a cookie sent in the request.
  *
  * Parses and decodes the cookie value.
  *
  * @param string $name
  * @return string|null
  */
 public function cookie($name, $default = null)
 {
     return \Jitsu\ArrayUtil::get($this->cookies(), $name, $default);
 }