Esempio n. 1
0
 /**
  * Get response status header string
  */
 public static function getHeader($scheme = 'HTTP/1.1', $code = 200)
 {
     $scheme = strtoupper(Sanitize::toText($scheme));
     $code = Sanitize::toNumber($code);
     $info = self::getString($code);
     return $scheme . ' ' . $code . ' ' . $info;
 }
Esempio n. 2
0
 /**
  * Sets the content type
  */
 public function setContentType($value = '')
 {
     $value = Sanitize::toText($value);
     if (!empty($value)) {
         $this->ctype = strtolower($value);
     }
 }
Esempio n. 3
0
 /**
  * Sets current working table name
  */
 public function setTable($table = '')
 {
     if (!empty($table) && is_string($table)) {
         $this->_table = Sanitize::toText($table);
     }
     $this->reset();
 }
Esempio n. 4
0
 /**
  * Add a new flash message to the list for $key
  */
 public function setFlash($key = '', $class = '', $message = '')
 {
     if (!empty($key) && is_string($key)) {
         $class = Sanitize::toText($class);
         $message = Sanitize::toText($message);
         $key = $this->fkey . '.' . $key;
         $list = $this->session->get($key, array());
         $list[] = array('class' => $class, 'message' => $message, 'addtime' => time());
         $this->session->set($key, $list);
     }
 }
Esempio n. 5
0
 /**
  * Set a table option
  */
 public function setOption($key = '', $value = '', $wrap = false)
 {
     $local = Sanitize::toKey($key);
     $key = Sanitize::toText($key);
     $value = Sanitize::toText($value);
     if (!empty($key) && !empty($value)) {
         if (!empty($wrap)) {
             $value = "'" . addslashes(stripslashes($value)) . "'";
         }
         $this->options[$local] = $key . "=" . $value;
     }
     return $this;
 }
Esempio n. 6
0
 /**
  * Checks if a SERVER key is available, or use default value
  */
 private static function _server($key = '', $default = '')
 {
     $key = strtoupper(trim($key));
     $default = trim($default);
     if (array_key_exists($key, $_SERVER)) {
         return Sanitize::toText($_SERVER[$key]);
     }
     return $default;
 }
Esempio n. 7
0
 /**
  * Sets the error message string
  */
 public function setErrorMessage($value = '')
 {
     if (!empty($value) && is_string($value)) {
         $this->_error_message = str_replace('\\', '/', Sanitize::toText($value));
     }
 }