File modules/cms/output/PreviewOutput.class.php
Last commit: Sat Mar 19 01:47:45 2022 +0100 dankert Fix: Preview actions should set their content type itself.
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 }
Downloadmodules/cms/output/PreviewOutput.class.php
History Sat, 19 Mar 2022 01:47:45 +0100 dankert Fix: Preview actions should set their content type itself. Sat, 19 Mar 2022 01:29:19 +0100 dankert Fix: PreviewOutput should inherit from UIOutput. Sat, 19 Mar 2022 00:09:47 +0100 dankert Refactoring: Outputs are setting their content-type themself. Sun, 13 Feb 2022 19:39:49 +0100 dankert Refactoring: Special output type "preview" for previewing pages and files.