- Added a no_html() method
This commit is contained in:
		
							parent
							
								
									44b0283938
								
							
						
					
					
						commit
						7a2fa872fa
					
				| @ -6,7 +6,7 @@ use Picea\Compiler\Context; | |||||||
| 
 | 
 | ||||||
| class PrintExtension implements Extension { | class PrintExtension implements Extension { | ||||||
| 
 | 
 | ||||||
|     public array $token = [ "echo", "print", "printf" ]; |     public array $token = [ "echo", "print", "printf", "no_html" ]; | ||||||
|      |      | ||||||
|     public int $flag = \ENT_QUOTES; |     public int $flag = \ENT_QUOTES; | ||||||
| 
 | 
 | ||||||
| @ -35,6 +35,10 @@ class PrintExtension implements Extension { | |||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 return "<?php echo htmlspecialchars(sprintf((string) $arguments), {$this->flag}, '{$this->encoding}', " . ($this->doubleEncode ? "true" : "false") . ") ?>"; |                 return "<?php echo htmlspecialchars(sprintf((string) $arguments), {$this->flag}, '{$this->encoding}', " . ($this->doubleEncode ? "true" : "false") . ") ?>"; | ||||||
|  | 
 | ||||||
|  |             case 'no_html': | ||||||
|  |                 return "<?php echo nl2br(strip_tags((string) $arguments)) ?>"; | ||||||
|  | 
 | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user