Modification gestion des cookies
This commit is contained in:
parent
39aaa035b4
commit
020da0f9e3
@ -219,31 +219,30 @@ core.start = function() {
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Traitement du formulaire cookies
|
||||
*/
|
||||
$("#cookieForm").submit(function(event){
|
||||
var samesite = "samesite=lax";
|
||||
var getUrl = window.location;
|
||||
var domain = "domain=" + getUrl.host;
|
||||
var path = "path=" + getUrl.pathname.split('/')[1];
|
||||
var samesite = "samesite=lax";
|
||||
var e = new Date();
|
||||
e.setFullYear(e.getFullYear() + 1);
|
||||
var expires = "expires=" + e.toUTCString();
|
||||
/**
|
||||
* Traitement du formulaire cookies
|
||||
*/
|
||||
$("#cookieForm").submit(function(event){
|
||||
var samesite = "samesite=lax";
|
||||
var getUrl = window.location;
|
||||
var domain = "domain=" + getUrl.host;
|
||||
var path = "path=" + getUrl.pathname.split('/')[1];
|
||||
var samesite = "samesite=lax";
|
||||
var e = new Date();
|
||||
e.setFullYear(e.getFullYear() + 1);
|
||||
var expires = "expires=" + e.toUTCString();
|
||||
|
||||
// Crée le cookie d'acceptation Google Analytics si nécessaire
|
||||
var analytics = "<?php echo $this->getData(['config', 'seo', 'analyticsId']);?>";
|
||||
if( analytics.length > 0){
|
||||
document.cookie = "ZWII_COOKIE_CONSENT_GA=" + $("#googleAnalytics").prop("checked") + ";" + domain + ";" + path + ";" + samesite + ";" + expires;
|
||||
}
|
||||
//document.cookie = "ZWII_COOKIE_CONSENT=true;" + domain + ";" + path + ";" + samesite + ";" + expires;
|
||||
document.cookie = "ZWII_COOKIE_CONSENT=<?php echo str_replace('index.php','',str_replace( '/','',$_SERVER['PHP_SELF'])); ?>;" + domain + ";" + path + ";" + samesite + ";" + expires;
|
||||
});
|
||||
var analytics = "<?php echo $this->getData(['config', 'seo', 'analyticsId']);?>";
|
||||
if( analytics.length > 0){
|
||||
document.cookie = "ZWII_COOKIE_GA_CONSENT=" + $("#googleAnalytics").prop("checked") + "<?php echo $_SERVER['PHP_SELF']; ?>" +";" + domain + ";" + path + ";" + samesite + ";" + expires;
|
||||
}
|
||||
document.cookie = "ZWII_COOKIE_CONSENT=<?php echo $_SERVER['PHP_SELF']; ?>;" + domain + ";" + path + ";" + samesite + ";" + expires;
|
||||
});
|
||||
|
||||
$("#cookieConsent .cookieClose").on("click", function() {
|
||||
$(this).parents("#cookieConsent").fadeOut();
|
||||
});
|
||||
$("#cookieConsent .cookieClose").on("click", function() {
|
||||
$(this).parents("#cookieConsent").fadeOut();
|
||||
});
|
||||
|
||||
/**
|
||||
* Choix de page dans la barre de membre
|
||||
|
@ -1173,7 +1173,7 @@ class common {
|
||||
*/
|
||||
public function showAnalytics() {
|
||||
if( !empty($code = $this->getData(['config', 'seo', 'analyticsId'])) &&
|
||||
$this->getInput('ZWII_COOKIE_GA_CONSENT') === 'true_'.str_replace('index.php','',str_replace( '/','',$_SERVER['PHP_SELF']))) {
|
||||
$this->getInput('ZWII_COOKIE_GA_CONSENT') === 'true'.$_SERVER['PHP_SELF']) {
|
||||
echo '<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id='. $code .'"></script>
|
||||
<script>
|
||||
@ -1189,8 +1189,8 @@ class common {
|
||||
* Affiche le consentement aux cookies
|
||||
*/
|
||||
public function showCookies() {
|
||||
|
||||
if( $this->getInput('ZWII_COOKIE_CONSENT') !== str_replace('index.php','',str_replace( '/','',$_SERVER['PHP_SELF'])) AND
|
||||
|
||||
if( $this->getInput('ZWII_COOKIE_CONSENT') !== $_SERVER['PHP_SELF'] AND
|
||||
$this->getData(['config','cookieConsent']) === true
|
||||
){
|
||||
|
||||
@ -1213,10 +1213,10 @@ class common {
|
||||
}
|
||||
$item .= '<br><br>';
|
||||
$item .= '<input type="submit" id="cookieConsentConfirm" value="Valider">';
|
||||
$item .= '</form></div>';
|
||||
$item .= '</form></div>';
|
||||
echo $item;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user