PreviewOutput.class.php (669B)
1 <?php 2 3 namespace cms\output; 4 5 use cms\output\APIOutput; 6 use util\json\JSON; 7 use util\YAML; 8 9 /** 10 * Preview rendering. 11 */ 12 class PreviewOutput extends UIOutput 13 { 14 protected function outputData($request, $data) 15 { 16 // HTTP Spec: 17 // "Applications SHOULD use this field to indicate the transfer-length of the 18 // message-body, unless this is prohibited by the rules in section 4.4." 19 // 20 // And the overhead of 'Transfer-Encoding: chunked' is eliminated... 21 header('Content-Length: ' . strlen($data['output']['value'])); 22 23 echo $data['output']['value']; 24 } 25 26 public function getContentType() 27 { 28 return null; // the content type is set by the action itself. 29 } 30 }