Download src/Presentation/RequestHandlers/Admin/SettingsRequestHandler.php from pnacorp/AIKEEDO: direct link, hf CLI and curl.
- Browser
- Download file 2.76 kB
-
https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/Presentation/RequestHandlers/Admin/SettingsRequestHandler.php
- Command line
-
hf download hf://pnacorp/AIKEEDO/src/Presentation/RequestHandlers/Admin/SettingsRequestHandler.php
-
curl -L -o SettingsRequestHandler.php https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/Presentation/RequestHandlers/Admin/SettingsRequestHandler.php
2.76 kB
| declare(strict_types=1); | |
| namespace Presentation\RequestHandlers\Admin; | |
| use Billing\Infrastructure\Currency\RateProviderCollectionInterface; | |
| use Billing\Infrastructure\Payments\PaymentGatewayFactoryInterface; | |
| use Easy\Container\Attributes\Inject; | |
| use Easy\Http\Message\RequestMethod; | |
| use Easy\Router\Attributes\Route; | |
| use Presentation\Response\ViewResponse; | |
| use Psr\Http\Message\ResponseInterface; | |
| use Psr\Http\Message\ServerRequestInterface; | |
| use Psr\Http\Server\RequestHandlerInterface; | |
| use Shared\Infrastructure\FileSystem\CdnAdapterCollectionInterface; | |
| use Symfony\Component\Intl\Currencies; | |
| use Symfony\Component\Intl\Exception\MissingResourceException; | |
| (path: '/settings', method: RequestMethod::GET) | |
| ( | |
| path: '/settings/[general|brand|billing|payments|credits|rate-providers|affiliates|openai|cohere|anthropic|elevenlabs|falai|stabilityai|gcp|azure|clipdrop|serper|onesignal|mail|smtp|policies|accounts|public-details|recaptcha|appearance|pwa|storage|cdn:name]?', | |
| method: RequestMethod::GET | |
| ) | |
| ( | |
| path: '/settings/[identity-providers:group]/[google|linkedin|facebook|github:name]?', | |
| method: RequestMethod::GET | |
| ) | |
| ( | |
| path: '/settings/[script-tags:group]/[google-analytics|google-tag-manager|intercom|custom:name]?', | |
| method: RequestMethod::GET | |
| ) | |
| ( | |
| path: '/settings/[features:group]/[writer|chat|voiceover|imagine|rest-api:name]?', | |
| method: RequestMethod::GET | |
| ) | |
| class SettingsRequestHandler extends AbstractAdminViewRequestHandler implements | |
| RequestHandlerInterface | |
| { | |
| public function __construct( | |
| private PaymentGatewayFactoryInterface $factory, | |
| private CdnAdapterCollectionInterface $cdnAdapters, | |
| private RateProviderCollectionInterface $rateProviders, | |
| #[Inject('config.dirs.webroot')] | |
| private string $webroot, | |
| ) {} | |
| /** | |
| * @throws MissingResourceException | |
| */ | |
| public function handle(ServerRequestInterface $request): ResponseInterface | |
| { | |
| $name = $request->getAttribute('name'); | |
| $group = $request->getAttribute('group'); | |
| if (!$name) { | |
| $name = 'index'; | |
| } | |
| if ($group) { | |
| $name = $group . '/' . $name; | |
| } | |
| $data = []; | |
| $data['currencies'] = Currencies::getNames(); | |
| $data['payment_gateways'] = $this->factory; | |
| $data['cdn_adapters'] = $this->cdnAdapters; | |
| $data['rate_providers'] = $this->rateProviders; | |
| $path = $this->webroot . '/app.webmanifest'; | |
| $data['pwa'] = json_decode( | |
| file_exists($path) ? file_get_contents($path) : '{}' | |
| ); | |
| return new ViewResponse( | |
| '/templates/admin/settings/' . $name . '.twig', | |
| $data | |
| ); | |
| } | |
| } | |