From a22d01377673dfd0017ebcb845742203946c7890 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Wed, 8 Mar 2023 16:10:23 +0100 Subject: [PATCH 1/2] Move class files --- core/{include => class}/layout.class.php | 2326 +++++++++++----------- core/{include => class}/router.class.php | 1810 ++++++++--------- core/core.php | 4 +- 3 files changed, 2070 insertions(+), 2070 deletions(-) rename core/{include => class}/layout.class.php (97%) rename core/{include => class}/router.class.php (97%) diff --git a/core/include/layout.class.php b/core/class/layout.class.php similarity index 97% rename from core/include/layout.class.php rename to core/class/layout.class.php index 6ce750a8..a3ee334c 100644 --- a/core/include/layout.class.php +++ b/core/class/layout.class.php @@ -1,1164 +1,1164 @@ -core = $core; - } - - /** - * Affiche le consentement aux cookies - */ - public function showCookies() - { - // La gestion des cookies est externalisée - if ($this->getData(['config', 'cookieConsent']) === false) { - return; - } - // Le cookie est déjà validé - if ($this->getInput('ZWII_COOKIE_CONSENT') === 'true') { - return; - } - $item = '
'; - // Bouton de fermeture - $item .= '
'; - $item .= template::ico('cancel'); - $item .= '
'; - // Texte de la popup - $item .= '

' . $this->getData(['locale', 'cookies', 'titleLabel']) . '

'; - $item .= '

' . $this->getData(['locale', 'cookies', 'mainLabel']) . '

'; - // Formulaire de réponse - if ( - $this->getData(['locale', 'homePageId']) === $this->getUrl(0) - ) { - $item .= '
'; - } else { - $item .= ''; - } - $item .= '

'; - $item .= ''; - $item .= '
'; - // mentions légales si la page est définie - $legalPage = $this->getData(['locale', 'legalPageId']); - if ($legalPage !== 'none') { - $item .= '

' . $this->getData(['locale', 'cookies', 'linkLegalLabel']) . '

'; - } - $item .= '
'; - echo $item; - } - - /** - * Formate le contenu de la page selon les gabarits - * @param Page par defaut - */ - public function showSection() - { - echo '
'; - // Récupérer la config de la page courante - $blocks = is_null($this->getData(['page', $this->getUrl(0), 'block'])) ? '12' : $this->getData(['page', $this->getUrl(0), 'block']); - $blocks = explode('-', $blocks); - // Initialiser - $blockleft = ''; - $blockright = ''; - switch (sizeof($blocks)) { - case 1: // une colonne - $content = 'col' . $blocks[0]; - break; - case 2: // 2 blocs - if ($blocks[0] < $blocks[1]) { // détermine la position de la colonne - $blockleft = 'col' . $blocks[0]; - $content = 'col' . $blocks[1]; - } else { - $content = 'col' . $blocks[0]; - $blockright = 'col' . $blocks[1]; - } - break; - case 3: // 3 blocs - $blockleft = 'col' . $blocks[0]; - $content = 'col' . $blocks[1]; - $blockright = 'col' . $blocks[2]; - } - // Page pleine pour la configuration des modules et l'édition des pages sauf l'affichage d'un article de blog - $pattern = ['config', 'edit', 'add', 'comment', 'data']; - if ( - (sizeof($blocks) === 1 || - in_array($this->getUrl(1), $pattern)) - ) { // Pleine page en mode configuration - $this->showContent(); - } else { - echo '
'; - /** - * Barre gauche - */ - if ($blockleft !== "") { - echo '
"; - } - /** - * Contenu de page - */ - echo '
'; - $this->showContent(); - echo '
'; - /** - * Barre droite - */ - if ($blockright !== "") { - echo '
'; - } - echo '
'; - } - echo '
'; - } - - /** - * Affiche le contenu - * @param Page par défaut - */ - public function showContent() - { - - if ( - $this->core->output['title'] - and ($this->getData(['page', $this->getUrl(0)]) === null - or $this->getData(['page', $this->getUrl(0), 'hideTitle']) === false - or $this->getUrl(1) === 'config' - ) - ) { - echo '

' . $this->core->output['title'] . '

'; - } - - echo $this->core->output['content']; - } - - /** - * Affiche le pied de page - */ - public function showFooter() - { - // Déterminer la position - $positionFixed = ''; - if ( - $this->getData(['theme', 'footer', 'position']) === 'site' - // Affiche toujours le pied de page pour l'édition du thème - or ($this->getData(['theme', 'footer', 'position']) === 'hide' - and $this->getUrl(0) === 'theme' - ) - ) { - $position = 'site'; - } else { - $position = 'body'; - if ($this->getData(['theme', 'footer', 'fixed']) === true) { - $positionFixed = ' footerbodyFixed'; - } - // Sortir de la division précédente - echo ''; - } - - echo $this->getData(['theme', 'footer', 'position']) === 'hide' ? '