- Fixed a bug added in previous commit
This commit is contained in:
		
							parent
							
								
									acd9f8c72e
								
							
						
					
					
						commit
						e9b2f0ece3
					
				| @ -6,7 +6,7 @@ | |||||||
|     "authors": [ |     "authors": [ | ||||||
|         { |         { | ||||||
|             "name": "Dave Mc Nicoll", |             "name": "Dave Mc Nicoll", | ||||||
|             "email": "mcndave@gmail.com" |             "email": "info@mcnd.ca" | ||||||
|         } |         } | ||||||
|     ], |     ], | ||||||
|     "autoload": { |     "autoload": { | ||||||
|  | |||||||
| @ -88,6 +88,11 @@ abstract class Context { | |||||||
|          |          | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     public function tokenName(string $token) : string | ||||||
|  |     { | ||||||
|  |         return explode('.', $token)[0]; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     public function tokenOptions(string $token, bool $export = false) : array|string |     public function tokenOptions(string $token, bool $export = false) : array|string | ||||||
|     { |     { | ||||||
|         $options = explode('.', strtolower($token)); |         $options = explode('.', strtolower($token)); | ||||||
|  | |||||||
| @ -22,20 +22,21 @@ class PrintExtension implements Extension { | |||||||
|     { |     { | ||||||
|         $opt = $context->tokenOptions($token); |         $opt = $context->tokenOptions($token); | ||||||
| 
 | 
 | ||||||
|         switch($token) { |         switch($context->tokenName($token)) { | ||||||
|             case 'echo': |             case 'echo': | ||||||
|             case 'print': |             case 'print': | ||||||
|  |                 if (in_array('raw', $opt)) { | ||||||
|  |                     return "<?php echo $arguments ?>"; | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|                 return "<?php echo htmlspecialchars((string) $arguments, {$this->flag}, '{$this->encoding}', " . ($this->doubleEncode ? "true" : "false") . ") ?>"; |                 return "<?php echo htmlspecialchars((string) $arguments, {$this->flag}, '{$this->encoding}', " . ($this->doubleEncode ? "true" : "false") . ") ?>"; | ||||||
| 
 | 
 | ||||||
|             case 'echo.raw': |  | ||||||
|             case "print.raw": |  | ||||||
|                 return "<?php echo $arguments ?>"; |  | ||||||
| 
 |  | ||||||
|             case 'printf': |             case 'printf': | ||||||
|                 return "<?php echo htmlspecialchars(sprintf((string) $arguments), {$this->flag}, '{$this->encoding}', " . ($this->doubleEncode ? "true" : "false") . ") ?>"; |                 if (in_array('raw', $opt)) { | ||||||
|  |                     return "<?php printf((string) $arguments) ?>"; | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
|             case 'printf.raw': |                 return "<?php echo htmlspecialchars(sprintf((string) $arguments), {$this->flag}, '{$this->encoding}', " . ($this->doubleEncode ? "true" : "false") . ") ?>"; | ||||||
|                 return "<?php printf((string) $arguments) ?>"; |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user