Большая переработка

- миграция с Flight на Slim v4
- кэширование ini-файла
- кэширование скачанных плейлистов
- прочее
This commit is contained in:
2025-03-03 13:04:05 +08:00
parent de84bc8ae9
commit 00d612c0e9
29 changed files with 2341 additions and 2094 deletions

View File

@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace App\Core;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
class TwigExtention extends AbstractExtension
{
public function getFunctions(): array
{
return [
new TwigFunction('config', [$this, 'config']),
new TwigFunction('commit', [$this, 'commit']),
new TwigFunction('is_file', [$this, 'is_file']),
new TwigFunction('base_url', [$this, 'base_url']),
];
}
public function config(string $key, mixed $default = null): mixed
{
return config($key, $default);
}
public function commit(): string
{
return file_get_contents(root_path('commit'));
}
public function base_url(string $path = ''): string
{
return base_url($path);
}
public function is_file(string $path): bool
{
return is_file($path);
}
}