Beispiel #1
0
 /**
  * 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;
 }
Beispiel #2
0
 /**
  * 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]);
     }
 }
Beispiel #3
0
 /**
  * Sets the route controller name
  */
 public function setDefaultAction($action = '')
 {
     $this->_default_action = Sanitize::toSlug($action);
 }
Beispiel #4
0
 /**
  * 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;
 }