コード例 #1
0
 /**
  * Maps a content-type back to an alias
  *
  * @param string|array $cType Either a string content type to map, or an array of types.
  * @return string|array Aliases for the types provided.
  * @deprecated Use $this->response->mapType() in your controller instead.
  */
 public function mapType($cType)
 {
     return $this->response->mapType($cType);
 }
コード例 #2
0
 /**
  * Tests the mapType method
  *
  */
 public function testMapType()
 {
     $response = new CakeResponse();
     $this->assertEquals('wav', $response->mapType('audio/x-wav'));
     $this->assertEquals('pdf', $response->mapType('application/pdf'));
     $this->assertEquals('xml', $response->mapType('text/xml'));
     $this->assertEquals('html', $response->mapType('*/*'));
     $this->assertEquals('csv', $response->mapType('application/vnd.ms-excel'));
     $expected = array('json', 'xhtml', 'css');
     $result = $response->mapType(array('application/json', 'application/xhtml+xml', 'text/css'));
     $this->assertEquals($expected, $result);
 }
コード例 #3
0
ファイル: MimeLib.php プロジェクト: miznokruge/base-cake
 /**
  * Maps a content-type back to an alias
  *
  * e.g `mapType('application/pdf'); // returns 'pdf'`
  *
  * @param mixed $ctype Either a string content type to map, or an array of types.
  * @return mixed Aliases for the types provided.
  */
 public function mapType($ctype)
 {
     return parent::mapType($ctype);
 }