2026-03-04 20:46:11 +00:00
|
|
|
<?php
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
use Core\Http\Router;
|
2026-03-05 17:09:01 +00:00
|
|
|
use Core\Services\Shortcodes;
|
2026-03-04 20:46:11 +00:00
|
|
|
use Modules\Pages\PagesController;
|
|
|
|
|
|
|
|
|
|
require_once __DIR__ . '/PagesController.php';
|
|
|
|
|
|
2026-03-05 17:09:01 +00:00
|
|
|
Shortcodes::register('hero', static function (array $attrs = []): string {
|
|
|
|
|
$eyebrow = trim((string)($attrs['eyebrow'] ?? 'Catalog Focus'));
|
|
|
|
|
$title = trim((string)($attrs['title'] ?? 'Latest Drops'));
|
|
|
|
|
$subtitle = trim((string)($attrs['subtitle'] ?? 'Discover fresh releases, artists, and top-selling tracks.'));
|
|
|
|
|
$ctaText = trim((string)($attrs['cta_text'] ?? 'Browse Releases'));
|
|
|
|
|
$ctaUrl = trim((string)($attrs['cta_url'] ?? '/releases'));
|
|
|
|
|
$secondaryText = trim((string)($attrs['secondary_text'] ?? 'Meet the Roster'));
|
|
|
|
|
$secondaryUrl = trim((string)($attrs['secondary_url'] ?? '/artists'));
|
|
|
|
|
|
|
|
|
|
$html = '<section class="ac-shortcode-hero">';
|
|
|
|
|
if ($eyebrow !== '') {
|
|
|
|
|
$html .= '<div class="ac-shortcode-hero-eyebrow">' . htmlspecialchars($eyebrow, ENT_QUOTES, 'UTF-8') . '</div>';
|
|
|
|
|
}
|
|
|
|
|
$html .= '<h2 class="ac-shortcode-hero-title">' . htmlspecialchars($title, ENT_QUOTES, 'UTF-8') . '</h2>';
|
|
|
|
|
if ($subtitle !== '') {
|
|
|
|
|
$html .= '<p class="ac-shortcode-hero-subtitle">' . htmlspecialchars($subtitle, ENT_QUOTES, 'UTF-8') . '</p>';
|
|
|
|
|
}
|
|
|
|
|
$html .= '<div class="ac-shortcode-hero-actions">'
|
|
|
|
|
. '<a class="ac-shortcode-hero-btn primary" href="' . htmlspecialchars($ctaUrl, ENT_QUOTES, 'UTF-8') . '">' . htmlspecialchars($ctaText, ENT_QUOTES, 'UTF-8') . '</a>';
|
|
|
|
|
if ($secondaryText !== '' && $secondaryUrl !== '') {
|
|
|
|
|
$html .= '<a class="ac-shortcode-hero-btn" href="' . htmlspecialchars($secondaryUrl, ENT_QUOTES, 'UTF-8') . '">' . htmlspecialchars($secondaryText, ENT_QUOTES, 'UTF-8') . '</a>';
|
|
|
|
|
}
|
|
|
|
|
$html .= '</div></section>';
|
|
|
|
|
return $html;
|
|
|
|
|
});
|
|
|
|
|
|
2026-03-05 20:15:48 +00:00
|
|
|
Shortcodes::register('home-catalog', static function (array $attrs = []): string {
|
|
|
|
|
$releaseLimit = max(1, min(12, (int)($attrs['release_limit'] ?? 8)));
|
|
|
|
|
$artistLimit = max(1, min(10, (int)($attrs['artist_limit'] ?? 6)));
|
|
|
|
|
$chartLimit = max(1, min(20, (int)($attrs['chart_limit'] ?? 10)));
|
|
|
|
|
|
|
|
|
|
$hero = Shortcodes::render('[hero eyebrow="Catalog Focus" title="Latest Drops" subtitle="Fresh releases, artists, and best sellers." cta_text="Browse Releases" cta_url="/releases" secondary_text="Meet Artists" secondary_url="/artists"]');
|
|
|
|
|
$releases = Shortcodes::render('[latest-releases limit="' . $releaseLimit . '"]');
|
|
|
|
|
$artists = Shortcodes::render('[new-artists limit="' . $artistLimit . '"]');
|
|
|
|
|
$chart = Shortcodes::render('[sale-chart type="tracks" window="latest" limit="' . $chartLimit . '"]');
|
|
|
|
|
$newsletter = Shortcodes::render('[newsletter-signup title="Join the list" button="Subscribe"]');
|
|
|
|
|
|
|
|
|
|
return '<section class="ac-home-catalog">'
|
|
|
|
|
. $hero
|
|
|
|
|
. '<div class="ac-home-columns">'
|
|
|
|
|
. '<div class="ac-home-main">' . $releases . $chart . '</div>'
|
|
|
|
|
. '<aside class="ac-home-side">' . $artists . $newsletter . '</aside>'
|
|
|
|
|
. '</div>'
|
|
|
|
|
. '</section>';
|
|
|
|
|
});
|
|
|
|
|
|
2026-03-04 20:46:11 +00:00
|
|
|
return function (Router $router): void {
|
|
|
|
|
$controller = new PagesController();
|
|
|
|
|
$router->get('/page', [$controller, 'show']);
|
|
|
|
|
|
|
|
|
|
$router->get('/admin/pages', [$controller, 'adminIndex']);
|
|
|
|
|
$router->get('/admin/pages/new', [$controller, 'adminEdit']);
|
|
|
|
|
$router->get('/admin/pages/edit', [$controller, 'adminEdit']);
|
|
|
|
|
$router->post('/admin/pages/save', [$controller, 'adminSave']);
|
|
|
|
|
$router->post('/admin/pages/delete', [$controller, 'adminDelete']);
|
|
|
|
|
};
|