- Mostly bugfixes made while working on ParcInfo

This commit is contained in:
Dave Mc Nicoll committed 2021-10-19 12:39:14 +00:00
1 parent 67040db155
commit 45c8173029
4 files changed
+28 -8

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ class JsonExtension implements Extension, FunctionExtension {
public array $token = [ "json", "json.pretty" ];
public int $flags = JSON_HEX_TAG | \JSON_HEX_APOS | \JSON_HEX_QUOT | \JSON_THROW_ON_ERROR;
public int $flags = JSON_HEX_TAG | \JSON_HEX_QUOT | \JSON_THROW_ON_ERROR | \JSON_UNESCAPED_UNICODE;
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token)
{
+14 -4
View File
@@ -165,7 +165,7 @@ class UrlExtension implements Extension {
$_SERVER['X-Forwarded-Ssl'] ?? "",
$_SERVER['X-Forwarded-Proto'] ?? "",
$_SERVER['X-Forwarded-Protocol'] ?? "",
]));
])) || isset($_SERVER['HTTP_X_ARR_SSL']);
return $header
|| ( "443" === ( $_SERVER['SERVER_PORT'] ?? "" ) )
@@ -183,7 +183,7 @@ class UrlExtension implements Extension {
list($variable, $default) = explode('=', $item[1]);
}
elseif (strpos($item[1], ":") !== false) {
list($variable, ) = explode(':', $item[1]);
list($variable, $type) = explode(':', $item[1]);
}
else {
$variable = $item[1];
@@ -191,6 +191,7 @@ class UrlExtension implements Extension {
if ( array_key_exists($variable, $arguments) ) {
$value = $arguments[ $variable ];
unset($arguments[ $variable ]);
}
else {
@@ -198,13 +199,22 @@ class UrlExtension implements Extension {
}
$search[ $item[0] ] = $value;
}
$route = str_replace(array_keys($search), array_values($search), $route);
}
return $route;
/*
* @TODO - must also take into account that recursivity is possible here [/test[/another[/still]]],
* so the regex must be adjusted (or simply using another method could also be a possiblity)
* while(strpos($route, '[') !== false && strpos($route, ']') !== false ) {
if ( preg_match_all('~[(.*?)]~si', $route, $matches, PREG_SET_ORDER) ) {
}
}*/
$route = trim(str_replace([ '[', ']' ], '', $route), '/');
return $route;
}
}