Esempio n. 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'));
 }
Esempio n. 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');
 }
Esempio n. 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);
 }
Esempio n. 4
0
 public function countValues()
 {
     return new self(a::countValues($this->value));
 }
Esempio n. 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);
 }