Пример #1
0
 /**
  * Get the HTTP protocol version
  */
 public static function getProtocol()
 {
     $value = Utils::getValue(@$_SERVER['SERVER_PROTOCOL'], '', true);
     $value = Sanitize::toTitle($value);
     return $value;
 }
Пример #2
0
 /**
  * Get the item mime/content-type string
  */
 public function getInfo()
 {
     $time = $this->getTimestamps();
     $title = Sanitize::toTitle($this->_name);
     $title = Sanitize::toCaps($title);
     return array('path' => $this->_path, 'parent' => $this->_parent, 'extension' => $this->_extension, 'name' => $this->_name, 'filename' => $this->getFileName(), 'type' => $this->getType(), 'perms' => $this->getPermissions(), 'owner' => $this->getOwner(), 'mimetype' => $this->getMimeType(), 'category' => $this->getCategory(), 'title' => $title, 'created' => $time['created'], 'modified' => $time['modified'], 'accessed' => $time['accessed'], 'writable' => is_writable($this->_path));
 }
Пример #3
0
 /**
  * Sets a custom header string
  */
 public function setHeader($key = '', $value = '', $replace = true)
 {
     $key = Sanitize::toSlug($key);
     $value = Sanitize::toTitle($value);
     if (!empty($key)) {
         $this->headers[$key] = array($value, $replace);
     }
 }
Пример #4
0
 /**
  * Add a column
  */
 public function addColumn($name = '', $type = '', $default = null, $auto = false, $null = false)
 {
     $name = Sanitize::toKey($name);
     $type = !empty($type) ? Sanitize::toTitle($type) : '';
     $default = !is_null($default) ? " DEFAULT '" . addslashes(stripslashes(trim($default))) . "'" : " DEFAULT ''";
     $auto = !empty($auto) ? " AUTO_INCREMENT" : '';
     $null = !empty($null) ? " NULL" : " NOT NULL";
     if (!empty($name) && !empty($type)) {
         if (!empty($auto)) {
             $default = '';
         }
         $this->columns[$name] = "`" . $name . "` " . $type . $null . $auto . $default;
     }
     return $this;
 }
Пример #5
0
 /**
  * Adds an entry to the list of breadcrumb links data
  */
 public function addCrumb($name = '', $link = '', $title = '', $params = array())
 {
     $key = Sanitize::toKey($name);
     $name = Sanitize::toName($name);
     $link = Sanitize::toPath($link);
     $title = Sanitize::toTitle($title);
     if (!empty($key) && !empty($link)) {
         $crumbs = $this->get('crumbs', array());
         $crumbs[$key] = array_merge(array('name' => $name, 'link' => $link, 'title' => $title), $params);
         $this->set('crumbs', $crumbs);
     }
 }