<?php
/**
* Front controller do site Espaço Facial.
* O arquivo original da raiz havia sido substituído pelo conteúdo da view do tema.
*/
ob_start();
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
require __DIR__ . '/_app/Config.inc.php';
$Read = new Read;
$RawUrl = filter_input(INPUT_GET, 'url', FILTER_DEFAULT);
$RawUrl = trim((string) $RawUrl, " /\t\n\r\0\x0B");
if ($RawUrl === '') {
$URL = ['index', null, null];
} else {
$URL = explode('/', $RawUrl);
$URL = array_pad($URL, 3, null);
$URL = array_slice($URL, 0, 3);
foreach ($URL as $Key => $Value) {
$URL[$Key] = trim(strip_tags((string) $Value));
}
$URL[0] = strtolower($URL[0] ?: 'index');
}
$Seo = new Seo(implode('/', $URL));
if (class_exists('Session')) {
new Session(SIS_CACHE_TIME);
}
$RouteMap = [
'index' => 'index.php',
'empresa' => 'pagina.php',
'clube' => 'pagina.php',
'club' => 'pagina.php',
'contato' => 'page-contato.php',
'agendamento' => 'page-agendamento.php',
'tratamentos' => 'page-tratamentos.php',
'tratamento' => 'page-tratamento.php',
'unidades' => 'page-unidades.php',
'unidade' => 'page-unidade.php',
'artigos' => 'page-artigos.php',
'artigo' => 'page-artigo.php',
'pesquisa' => 'pesquisa.php',
];
$RouteFile = $RouteMap[$URL[0]] ?? 'pagina.php';
$RoutePath = __DIR__ . '/' . REQUIRE_PATH . '/' . $RouteFile;
if (!is_file($RoutePath)) {
$RoutePath = __DIR__ . '/' . REQUIRE_PATH . '/404.php';
}
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<meta name="description" content="<?= htmlspecialchars((string) $Seo->getDescription(), ENT_QUOTES, 'UTF-8'); ?>">
<meta property="og:title" content="<?= htmlspecialchars((string) $Seo->getTitle(), ENT_QUOTES, 'UTF-8'); ?>">
<meta property="og:description" content="<?= htmlspecialchars((string) $Seo->getDescription(), ENT_QUOTES, 'UTF-8'); ?>">
<meta property="og:image" content="<?= htmlspecialchars((string) $Seo->getImage(), ENT_QUOTES, 'UTF-8'); ?>">
<link rel="canonical" href="<?= htmlspecialchars(rtrim(BASE, '/') . '/' . ltrim($RawUrl, '/'), ENT_QUOTES, 'UTF-8'); ?>">
<title><?= htmlspecialchars((string) $Seo->getTitle(), ENT_QUOTES, 'UTF-8'); ?></title>
<link rel="icon" href="<?= INCLUDE_PATH; ?>/images/favicon.ico">
<link rel="stylesheet" href="<?= INCLUDE_PATH; ?>/style.css">
</head>
<body>
<?php
if (defined('ADMIN_MAINTENANCE') && ADMIN_MAINTENANCE) {
require __DIR__ . '/maintenance.php';
} else {
require __DIR__ . '/' . REQUIRE_PATH . '/inc/header.php';
require $RoutePath;
require __DIR__ . '/' . REQUIRE_PATH . '/inc/footer.php';
require __DIR__ . '/_cdn/wc_track.php';
}
?>
</body>
</html>
<?php ob_end_flush(); ?>