Ejemplo n.º 1
0
 /**
  * Sends the response headers and body.
  * 
  * @return void
  */
 public function send()
 {
     if ($this->sent) {
         return;
     }
     ob_get_level() and ob_start();
     if (!isset($this->status)) {
         $this->status = $this->hasHeader('Location') ? 302 : http_response_code();
     }
     Util::sendStatus($this->status);
     $this->sendHeaders();
     if ($this->send_body) {
         echo $this->body;
     }
     ob_get_level() and ob_flush();
     $this->sent = true;
 }
Ejemplo n.º 2
0
 /**
  * Returns a filetype from MIME.
  *
  * @param string $mimetype MIME
  * @param mixed $default Default value. default null
  * @return string Filetype for MIME, or default if not found.
  */
 function mime2filetype($mimetype, $default = null)
 {
     return Util::lookupMimetypeExtension($mimetype, $default);
 }