diff --git a/composer.json b/composer.json index ca9152d..83fe2ea 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "authors": [ { "name": "Dave Mc Nicoll", - "email": "mcndave@gmail.com" + "email": "info@mcnd.ca" } ], "autoload": { diff --git a/src/Compiler/Context.php b/src/Compiler/Context.php index 9955055..97cdecc 100644 --- a/src/Compiler/Context.php +++ b/src/Compiler/Context.php @@ -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)); diff --git a/src/Extension/PrintExtension.php b/src/Extension/PrintExtension.php index a85f4fc..08240ca 100644 --- a/src/Extension/PrintExtension.php +++ b/src/Extension/PrintExtension.php @@ -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 ""; + } + return "flag}, '{$this->encoding}', " . ($this->doubleEncode ? "true" : "false") . ") ?>"; - case 'echo.raw': - case "print.raw": - return ""; - case 'printf': - return "flag}, '{$this->encoding}', " . ($this->doubleEncode ? "true" : "false") . ") ?>"; + if (in_array('raw', $opt)) { + return ""; + } - case 'printf.raw': - return ""; + return "flag}, '{$this->encoding}', " . ($this->doubleEncode ? "true" : "false") . ") ?>"; } }