예제 #1
0
파일: response.php 프로젝트: rgantt/sake
 public function charset($encoding = null)
 {
     if (!is_null($encoding)) {
         $ct = $this->content_type() ? $this->content_type() : \Mime\type('HTML');
         $this->headers['Content-Type'] = "{$ct}; charset={$encoding}";
     }
     if (!isset($this->headers['Content-Type'])) {
         return null;
     }
     $content_type = explode(';', $this->headers['Content-Type']);
     $charset = explode('=', !empty($content_type[1]) ? $content_type[1] : '');
     return !empty($charset[1]) ? $charset[1] : null;
 }
예제 #2
0
파일: base.php 프로젝트: rgantt/sake
 private function assign_default_content_type_and_charset()
 {
     $ct = $this->response->content_type();
     $cs = $this->response->charset();
     $this->response->content_type(!empty($ct) ? $ct : \Mime\type('HTML'));
     $this->response->charset(!empty($cs) ? $cs : self::$default_charset);
 }
예제 #3
0
 public function test_default_for_html()
 {
     $this->get('render_default_for_html');
     $this->assertEquals(\Mime\type('HTML'), $this->response->content_type());
     $this->assertEquals("utf-8", $this->response->charset());
 }