Publiczna aplikacja fdmtech.pl: renderer CMS, formularz audytu, szablony i logotypy

This commit is contained in:
FDMTech
2026-10-09 15:22:48 +02:00
commit 48b544c6b3
32 changed files with 1914 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace FDMTech;
final class Router
{
/** No decoding ambiguity: public paths are ASCII single slugs. */
public static function route(string $uri): array
{
$path = explode('?', $uri, 2)[0];
if ($path === '/') {
return ['slug' => 'home', 'path' => '/'];
}
if (!preg_match('~^/([a-z0-9]+(?:-[a-z0-9]+)*)(/?)$~D', $path, $match) || strlen($match[1]) > 160) {
return ['error' => 404];
}
if ($match[1] === 'home') {
return ['redirect' => '/'];
}
if (($match[2] ?? '') === '/') {
return ['redirect' => '/' . $match[1]];
}
return ['slug' => $match[1], 'path' => $path];
}
}