/** * Get a common file category type out of the mimetype string */ public function getCategory($default = "file") { $mime = $this->getMimeType(); $types = explode("/", $mime); $output = Sanitize::toSlug(array_pop($types)); return !empty($output) ? $output : $default; }
/** * Get request header value by name */ public function headers($name = "", $default = "") { $name = strtolower(Sanitize::toSlug($name)); if (!empty($name)) { foreach (getallheaders() as $k => $value) { if (strtolower(Sanitize::toSlug($k)) === $name) { return $value; } } } return $default; }