- Finalizing the documentation before tagging 1.0 release

This commit is contained in:
mcndave committed 2022-12-21 04:20:11 +00:00
1 parent bb29a56077
commit 46535c2734
29 files changed
+933 -211

No files matched your search

+11 -4
View File
@@ -6,7 +6,7 @@ use Picea\Compiler\Context;
class PrintExtension implements Extension {
public array $token = [ "print", "print.safe", "print.raw" ];
public array $token = [ "echo", "echo.raw", "print", "print.raw", "printf", "printf.raw" ];
public int $flag = \ENT_QUOTES;
@@ -21,12 +21,19 @@ class PrintExtension implements Extension {
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token) : string
{
switch($token) {
case 'echo':
case 'print':
case "print.safe":
return "<?php echo htmlspecialchars(sprintf($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 sprintf($arguments) ?>";
return "<?php echo $arguments ?>";
case 'printf':
return "<?php echo htmlspecialchars(sprintf((string) $arguments), {$this->flag}, '{$this->encoding}', " . ($this->doubleEncode ? "true" : "false") . ") ?>";
case 'printf.raw':
return "<?php printf((string) $arguments) ?>";
}
}