- Added a new json.html output

- Fixed a bug where post() was defined twice in request. Added server and request too
This commit is contained in:
mcndave committed 2020-03-30 12:20:28 -04:00
1 parent 404d1f4359
commit dcb22fe086
3 files changed
+38 -8

No files matched your search

+9 -4
View File
@@ -16,12 +16,17 @@ class JsonExtension implements Extension {
}
}
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token)
{
$flag = $this->flags;
if ( $token === "json.pretty" ) {
$flag = \JSON_PRETTY_PRINT;
switch ($token) {
case "json.pretty":
$flag = \JSON_PRETTY_PRINT;
break;
case "json.html":
return "<?php echo htmlentities(json_encode($arguments, {$this->flags}), ENT_QUOTES, 'UTF-8') ?>";
}
return "<?php echo json_encode($arguments, $flag) ?>";