implement local welcome page

This commit is contained in:
yggverse 2024-04-10 11:07:08 +03:00
parent 46a6a240cc
commit 49d73b6bc6
5 changed files with 125 additions and 4 deletions

31
src/Model/Page.php Normal file
View file

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Yggverse\Yoda\Model;
class Page
{
public static function get(string $name): ?string
{
$name = ucfirst(
mb_strtolower(
$name
)
);
$filename = __DIR__ .
DIRECTORY_SEPARATOR . '..' .
DIRECTORY_SEPARATOR . 'Page' .
DIRECTORY_SEPARATOR . $name . '.gmi';
if (file_exists($filename) && is_readable($filename))
{
return file_get_contents(
$filename
);
}
return null;
}
}