mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
implement local welcome page
This commit is contained in:
parent
46a6a240cc
commit
49d73b6bc6
5 changed files with 125 additions and 4 deletions
31
src/Model/Page.php
Normal file
31
src/Model/Page.php
Normal 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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue