Connexion tocken, stripe 3D, tracking analytic
This commit is contained in:
1 parent
1deb30fcd1
commit
bd311da711
17 files changed
+3324
-455
No files matched your search
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
// htdocs/includes/accepter_cookies.php — CookieConsent v3 (correctif)
|
||||
// Si tu as des traductions dans lang/fr.php / lang/ru.php, on les lit (optionnel)
|
||||
$lang = $_SESSION['lang'] ?? 'fr';
|
||||
$langFile = __DIR__ . "/../lang/{$lang}.php";
|
||||
if (is_file($langFile)) { include $langFile; }
|
||||
$t = isset($translations) && is_array($translations) ? $translations : [];
|
||||
function tt($k,$d=''){ global $t; return htmlspecialchars($t[$k]??$d, ENT_QUOTES, 'UTF-8'); }
|
||||
// htdocs/includes/accepter_cookies.php — CookieConsent v3 (correctif)
|
||||
// Si tu as des traductions dans lang/fr.php / lang/ru.php, on les lit (optionnel)
|
||||
$lang = $_SESSION['lang'] ?? 'fr';
|
||||
$langFile = __DIR__ . "/../lang/{$lang}.php";
|
||||
if (is_file($langFile)) {include $langFile;}
|
||||
$t = isset($translations) && is_array($translations) ? $translations : [];
|
||||
function tt($k, $d = '')
|
||||
{global $t;return htmlspecialchars($t[$k] ?? $d, ENT_QUOTES, 'UTF-8');}
|
||||
?>
|
||||
<!--<a id="cc-manage" href="#" style="display:none"><?= tt('cookies_manage_link','Paramètres cookies') ?></a>-->
|
||||
<!--<a id="cc-manage" href="#" style="display:none"><?php echo tt('cookies_manage_link', 'Paramètres cookies') ?></a>-->
|
||||
|
||||
<link id="cc-css" rel="stylesheet" href="/js/cookieconsent.css"
|
||||
onerror="this.href='https://cdn.jsdelivr.net/gh/orestbida/cookieconsent@3.1.0/dist/cookieconsent.css'">
|
||||
@@ -16,15 +17,15 @@ function tt($k,$d=''){ global $t; return htmlspecialchars($t[$k]??$d, ENT_QUOTES
|
||||
(function(){
|
||||
// Textes (prend ceux de tes fichiers de langue si présents)
|
||||
const TXT = {
|
||||
title: <?= json_encode($t['cookies_title'] ?? 'Cookies & confidentialité') ?>,
|
||||
desc: <?= json_encode($t['cookies_desc'] ?? "Nous utilisons des cookies essentiels. Avec votre accord, nous activons aussi l'analyse et la personnalisation.") ?>,
|
||||
acceptAll: <?= json_encode($t['cookies_accept_all'] ?? 'Tout accepter') ?>,
|
||||
rejectAll: <?= json_encode($t['cookies_reject_all'] ?? 'Tout refuser') ?>,
|
||||
settings: <?= json_encode($t['cookies_settings'] ?? 'Personnaliser') ?>,
|
||||
necessary: <?= json_encode($t['cookies_necessary'] ?? 'Essentiels (toujours actifs)') ?>,
|
||||
analytics: <?= json_encode($t['cookies_analytics'] ?? 'Mesure d’audience') ?>,
|
||||
personalization: <?= json_encode($t['cookies_personalization'] ?? 'Personnalisation') ?>,
|
||||
save: <?= json_encode($t['cookies_save'] ?? 'Enregistrer') ?>,
|
||||
title: <?php echo json_encode($t['cookies_title'] ?? 'Cookies & confidentialité') ?>,
|
||||
desc: <?php echo json_encode($t['cookies_desc'] ?? "Nous utilisons des cookies essentiels. Avec votre accord, nous activons aussi l'analyse et la personnalisation.") ?>,
|
||||
acceptAll: <?php echo json_encode($t['cookies_accept_all'] ?? 'Tout accepter') ?>,
|
||||
rejectAll: <?php echo json_encode($t['cookies_reject_all'] ?? 'Tout refuser') ?>,
|
||||
settings: <?php echo json_encode($t['cookies_settings'] ?? 'Personnaliser') ?>,
|
||||
necessary: <?php echo json_encode($t['cookies_necessary'] ?? 'Essentiels (toujours actifs)') ?>,
|
||||
analytics: <?php echo json_encode($t['cookies_analytics'] ?? 'Mesure d’audience') ?>,
|
||||
personalization: <?php echo json_encode($t['cookies_personalization'] ?? 'Personnalisation') ?>,
|
||||
save: <?php echo json_encode($t['cookies_save'] ?? 'Enregistrer') ?>,
|
||||
};
|
||||
|
||||
const SRCS = [
|
||||
@@ -96,14 +97,8 @@ function tt($k,$d=''){ global $t; return htmlspecialchars($t[$k]??$d, ENT_QUOTES
|
||||
},
|
||||
|
||||
// Hooks
|
||||
onConsent: ({cookie}) => {
|
||||
if (CookieConsent.acceptedCategory('analytics')) enableAnalytics();
|
||||
},
|
||||
onChange: ({changedCategories}) => {
|
||||
if (changedCategories.includes('analytics')) {
|
||||
CookieConsent.acceptedCategory('analytics') ? enableAnalytics() : disableAnalytics();
|
||||
}
|
||||
}
|
||||
onConsent: ({cookie}) => {},
|
||||
onChange: ({changedCategories}) => {}
|
||||
});
|
||||
|
||||
// Lien pour rouvrir
|
||||
@@ -115,16 +110,6 @@ function tt($k,$d=''){ global $t; return htmlspecialchars($t[$k]??$d, ENT_QUOTES
|
||||
|
||||
}
|
||||
|
||||
// Tes hooks perso (ex: activer GA seulement si analytics accepté)
|
||||
window.enableAnalytics = function(){
|
||||
if (window.__gaLoaded) return; window.__gaLoaded = true;
|
||||
// Exemple:
|
||||
CookieConsent.loadScript('https://www.googletagmanager.com/gtag/js?id=G-XXXX').then(()=>{
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments)}; gtag('js', new Date()); gtag('config','G-XXXX');
|
||||
});
|
||||
};
|
||||
window.disableAnalytics = function(){ /* éventuellement reset */ };
|
||||
|
||||
// Lance le chargement (local → CDN fallback)
|
||||
loadScriptSequential(0);
|
||||
|
||||
Reference in new issue
Block a user