1
0
mirror of https://github.com/typemill/typemill.git synced 2025-07-29 18:30:18 +02:00

v2.2.2 Fix error for folder contains if first item in folder is folder again

This commit is contained in:
trendschau
2024-03-04 19:48:28 +01:00
parent c0f7c4581c
commit a2eb9db6eb

View File

@@ -230,18 +230,26 @@ class Folder
{
$firstKey = array_key_first($folder);
$file = $folder[$firstKey];
if(is_array($file))
{
# first item in folder is folder again, so return pages
return 'pages';
}
$nameParts = $this->getStringParts($file);
$order = count($nameParts) > 1 ? array_shift($nameParts) : NULL;
$order = substr($order, 0, 7);
if($order && strlen($order > 8))
{
$order = substr($order, 0, 7);
if(\DateTime::createFromFormat('Ymd', $order) !== FALSE)
{
return "posts";
}
}
if(\DateTime::createFromFormat('Ymd', $order) !== FALSE)
{
return "posts";
}
else
{
return "pages";
}
return "pages";
}
}