diff --git a/bl-kernel/boot/init.php b/bl-kernel/boot/init.php index 4c7b5527..f4f21b8c 100644 --- a/bl-kernel/boot/init.php +++ b/bl-kernel/boot/init.php @@ -240,6 +240,9 @@ $WHERE_AM_I = $Url->whereAmI(); // --- Objects shortcuts --- $L = $language; +// GDPR +Cookie::set('BLUDIT_GDPR_ALLOW_TRACKING', true, 7); + // DEBUG: Print constants // $arr = array_filter(get_defined_constants(), 'is_string'); // echo json_encode($arr); diff --git a/bl-kernel/js/functions.php b/bl-kernel/js/functions.php index e9fb81ac..c3c69446 100644 --- a/bl-kernel/js/functions.php +++ b/bl-kernel/js/functions.php @@ -68,4 +68,29 @@ function sanitizeHTML(text) { return text.replace(/[&<>"']/g, function(m) { return map[m]; }); } +function setCookie(name, value, days) { + var expires = ""; + if (days) { + var date = new Date(); + date.setTime(date.getTime() + (days*24*60*60*1000)); + expires = "; expires=" + date.toUTCString(); + } + document.cookie = name + "=" + (value || "") + expires + "; path=/"; +} + +function getCookie(name) { + var nameEQ = name + "="; + var ca = document.cookie.split(';'); + for(var i=0; i < ca.length;i++) { + var c = ca[i]; + while (c.charAt(0)==' ') c = c.substring(1,c.length); + if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); + } + return false; +} + +function deleteCookie(name) { + document.cookie = name+'=; Max-Age=-999;'; +} + \ No newline at end of file diff --git a/bl-plugins/gdpr-cookie/languages/en.json b/bl-plugins/gdpr-cookie/languages/en.json new file mode 100644 index 00000000..44284b7c --- /dev/null +++ b/bl-plugins/gdpr-cookie/languages/en.json @@ -0,0 +1,7 @@ +{ + "plugin-data": + { + "name": "GDPR Cookie", + "description": "General Data Protection Cookie Concent" + } +} \ No newline at end of file diff --git a/bl-plugins/gdpr-cookie/metadata.json b/bl-plugins/gdpr-cookie/metadata.json new file mode 100644 index 00000000..13635940 --- /dev/null +++ b/bl-plugins/gdpr-cookie/metadata.json @@ -0,0 +1,10 @@ +{ + "author": "Bludit", + "email": "", + "website": "https://plugins.bludit.com", + "version": "2.3", + "releaseDate": "2018-01-23", + "license": "MIT", + "compatible": "2.3", + "notes": "" +} \ No newline at end of file diff --git a/bl-plugins/gdpr-cookie/plugin.php b/bl-plugins/gdpr-cookie/plugin.php new file mode 100644 index 00000000..10b9a1f7 --- /dev/null +++ b/bl-plugins/gdpr-cookie/plugin.php @@ -0,0 +1,103 @@ +dbFields = array( + 'enabled'=>true, + 'message'=>'Allow to Google Analytics tracking you?' + ); + } + + public function form() + { + global $Language; + + $html = '