/** * 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; }
/** * Removes a header key from the list */ public function removeHeader($key = '') { $key = Sanitize::toSlug($key); if (!empty($key) && array_key_exists($key, $this->headers)) { unset($this->headers[$key]); } }
/** * Sets the route controller name */ public function setDefaultAction($action = '') { $this->_default_action = Sanitize::toSlug($action); }
/** * Adds a new item node to the XML DOM, for when creating RSS feeds. */ public function item($pairs = array()) { $this->parent('channel')->node('item'); foreach ($pairs as $key => $value) { $key = Sanitize::toSlug($key); if (empty($key) || is_numeric($key)) { continue; } $this->node($key)->value($value)->parent(); } return $this; }