16235369cb
Highlights include configurable menus, specials, cart/checkout, taxes, customer accounts with email 2FA, newsletters, analytics, refunds, PDF/CSV exports, Square/Mailgun adapters, and optional MySQL migration. See README.md for setup and production configuration. Verified PHP/JavaScript syntax, responsive layouts, registration, 2FA, checkout, dashboard workflows, settings persistence, and PDF generation. Real Square, Mailgun, and MySQL connections require credentials/server access. Square implementation follows the official Payments API and Refunds API.
54 lines
1.1 KiB
PHP
54 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace FatBottom\Core;
|
|
|
|
final class Http
|
|
{
|
|
public static function redirect(string $path): never
|
|
{
|
|
header('Location: ' . $path);
|
|
exit;
|
|
}
|
|
|
|
public static function abort(int $status, string $message): never
|
|
{
|
|
http_response_code($status);
|
|
echo $message;
|
|
exit;
|
|
}
|
|
|
|
public static function flash(string $type, string $message): void
|
|
{
|
|
$_SESSION['_flash'][] = ['type' => $type, 'message' => $message];
|
|
}
|
|
|
|
public static function consumeFlash(): array
|
|
{
|
|
$messages = $_SESSION['_flash'] ?? [];
|
|
unset($_SESSION['_flash']);
|
|
return $messages;
|
|
}
|
|
|
|
public static function old(array $input): void
|
|
{
|
|
$_SESSION['_old'] = $input;
|
|
}
|
|
|
|
public static function consumeOld(): array
|
|
{
|
|
$old = $_SESSION['_old'] ?? [];
|
|
unset($_SESSION['_old']);
|
|
return $old;
|
|
}
|
|
|
|
public static function path(): string
|
|
{
|
|
$path = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH);
|
|
$path = is_string($path) ? rtrim($path, '/') : '/';
|
|
return $path === '' ? '/' : $path;
|
|
}
|
|
}
|
|
|