MAPG-180 don't buffer content output to variable
This commit is contained in:
		
							parent
							
								
									efdd5c54be
								
							
						
					
					
						commit
						a55ece7dac
					
				| @ -4,7 +4,7 @@ interface IContent | |||||||
| { | { | ||||||
|     public function &getData(): array; |     public function &getData(): array; | ||||||
| 
 | 
 | ||||||
|     public function &render(): string; |     public function render(): void; | ||||||
| 
 | 
 | ||||||
|     public function getContentType(): string; |     public function getContentType(): string; | ||||||
| } | } | ||||||
|  | |||||||
| @ -11,7 +11,7 @@ abstract class ContentBase implements IContent | |||||||
|         return $this->data; |         return $this->data; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     abstract public function &render(): string; |     abstract public function render(): void; | ||||||
| 
 | 
 | ||||||
|     abstract public function getContentType(): string; |     abstract public function getContentType(): string; | ||||||
| } | } | ||||||
|  | |||||||
| @ -12,7 +12,7 @@ class HtmlContent extends ContentBase | |||||||
|         $this->data = &$data; |         $this->data = &$data; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function &render(): string |     public function render(): void | ||||||
|     { |     { | ||||||
|         if (!empty($_ENV['DEV'])) { |         if (!empty($_ENV['DEV'])) { | ||||||
|             $generator = new Linker($this->view); |             $generator = new Linker($this->view); | ||||||
| @ -21,14 +21,9 @@ class HtmlContent extends ContentBase | |||||||
| 
 | 
 | ||||||
|         extract($this->data); |         extract($this->data); | ||||||
| 
 | 
 | ||||||
|         ob_start(); |  | ||||||
|         require ROOT . '/cache/views/' . $this->view . '.php'; |         require ROOT . '/cache/views/' . $this->view . '.php'; | ||||||
|         $content = ob_get_contents(); |  | ||||||
|         ob_end_clean(); |  | ||||||
| 
 | 
 | ||||||
|         $content .= '<!-- __debug__runtime: ' . round((hrtime(true) - SCRIPT_STARTED) / 1e+6, 1) . ' -->'; |         echo '<!-- __debug__runtime: ' . round((hrtime(true) - SCRIPT_STARTED) / 1e+6, 1) . ' -->'; | ||||||
| 
 |  | ||||||
|         return $content; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function getContentType(): string |     public function getContentType(): string | ||||||
|  | |||||||
| @ -7,13 +7,11 @@ class JsonContent extends ContentBase | |||||||
|         $this->data = &$data; |         $this->data = &$data; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function &render(): string |     public function render(): void | ||||||
|     { |     { | ||||||
|         $this->data['__debug__runtime'] = round((hrtime(true) - SCRIPT_STARTED) / 1e+6, 1); |         $this->data['__debug__runtime'] = round((hrtime(true) - SCRIPT_STARTED) / 1e+6, 1); | ||||||
| 
 | 
 | ||||||
|         $content = json_encode($this->data); |         echo json_encode($this->data); | ||||||
| 
 |  | ||||||
|         return $content; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function getContentType(): string |     public function getContentType(): string | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user