- Mostly bugfixes made while working on ParcInfo
This commit is contained in:
parent
67040db155
commit
45c8173029
|
@ -48,7 +48,7 @@ class Compiler
|
|||
|
||||
list($token, $arguments) = array_pad(array_filter(explode(' ', $matches[2], 2), 'strlen'), 2, null);
|
||||
|
||||
$token = trim($token);
|
||||
$token = strtolower(trim($token));
|
||||
|
||||
# @TODO Refractor this parts to allows registration to the tag's name
|
||||
if ( $this->tagList[$token] ?? false ) {
|
||||
|
@ -87,7 +87,7 @@ class Compiler
|
|||
public function registerControlStructure(ControlStructure\ControlStructure $controlStructureObject) : self
|
||||
{
|
||||
foreach($controlStructureObject->tokens ?? (array) ( $controlStructureObject->token ?? [] ) as $token) {
|
||||
$this->tagList[$token] = $controlStructureObject;
|
||||
$this->tagList[strtolower($token)] = $controlStructureObject;
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -98,7 +98,7 @@ class Compiler
|
|||
$tokens = $extension->tokens ?? (array) ( $extension->token ?? [] );
|
||||
|
||||
foreach($tokens as $token) {
|
||||
$this->extensionList[$token] = $extension;
|
||||
$this->extensionList[strtolower($token)] = $extension;
|
||||
}
|
||||
|
||||
if (! $tokens ) {
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,8 +43,13 @@ class FileFetcher
|
|||
foreach($this->folderList as $folder) {
|
||||
foreach($this->supportedExtensionList as $extension) {
|
||||
$file = $folder['path'] . DIRECTORY_SEPARATOR . "$fileName.$extension";
|
||||
$file = str_replace([ '\\', '/' ], DIRECTORY_SEPARATOR, $file);
|
||||
|
||||
if ( file_exists($file) ) {
|
||||
if ( is_dir($file) ) {
|
||||
throw new \RuntimeException("Given view file `$fileName` is a folder, you must provide a valid filename.");
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
@ -53,8 +58,13 @@ class FileFetcher
|
|||
# Fallback on full-path
|
||||
foreach($this->folderList as $folder) {
|
||||
$file = $folder['path'] . DIRECTORY_SEPARATOR . $fileName;
|
||||
$file = str_replace([ '\\', '/' ], DIRECTORY_SEPARATOR, $file);
|
||||
|
||||
if ( file_exists($file) ) {
|
||||
if ( is_dir($file) ) {
|
||||
throw new \RuntimeException("Given view file `$fileName` is a folder, you must provide a valid filename.");
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue