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