111 lines
4.7 KiB
PHP
111 lines
4.7 KiB
PHP
{{-- blade-formatter-disable --}}
|
|
@php
|
|
|
|
$site_name = Str::ucfirst(config('app.name'));
|
|
$logo_picture_url = asset('assets/images/logo-doux.png');
|
|
$logo_title_text = __('Logo du site :name', ['name' => $site_name]);
|
|
$logo_alt_text = __('Logo :name', ['name' => $site_name]);
|
|
|
|
$strings = (object)[
|
|
'modal_title' => __('cookie-notice.modal_title'),
|
|
'button_customize_cookies' => __('cookie-notice.button_customize_cookies'),
|
|
'button_close_cookies' => __('cookie-notice.button_close_cookies'),
|
|
'button_title_open_new_tab' => __('cookie-notice.button_title_open_new_tab'),
|
|
'button_forbid' => __('cookie-notice.button_forbid'),
|
|
'button_allow' => __('cookie-notice.button_allow'),
|
|
'button_forbid_all' => Str::upper(__('cookie-notice.button_forbid_all')),
|
|
'button_allow_all' => Str::upper(__('cookie-notice.button_allow_all')),
|
|
'button_customize' => Str::upper(__('cookie-notice.button_customize')),
|
|
'button_forbid_all_title' => __('cookie-notice.button_forbid_all_title'),
|
|
'button_allow_all_title' => __('cookie-notice.button_allow_all_title'),
|
|
'button_back' => Str::upper(__('cookie-notice.button_back')),
|
|
'banner_title' => __('cookie-notice.banner_title', ['site_name' => $site_name]),
|
|
'banner_text' => __('cookie-notice.banner_text'),
|
|
'panel_title' => __('cookie-notice.panel_title'),
|
|
'panel_content' => __('cookie-notice.panel_content'),
|
|
'panel_subtitle' => __('cookie-notice.panel_subtitle'),
|
|
'panel_details' => __('cookie-notice.panel_details'),
|
|
'picture_cookie_title' => __('cookie-notice.picture_cookie_title'),
|
|
'navigation_title' => __('cookie-notice.navigation_title'),
|
|
];
|
|
|
|
$cookies = [];
|
|
|
|
// RECAPTCHA
|
|
$cookies['recaptcha'] = [
|
|
'name' => __('cookie-notice.custom.recaptcha.title'),
|
|
'description' => __('cookie-notice.custom.recaptcha.description'),
|
|
'link' => 'https://policies.google.com/privacy',
|
|
'labelLink' => __('cookie-notice.custom.recaptcha.labelLink'),
|
|
'cookies' => ['NID', '__Secure-3PAPISID', '__Secure-3PSID', '__Secure-3PSIDCC']
|
|
];
|
|
|
|
$cookies['recaptcha']['script'] = <<<SCRIPT
|
|
function () {
|
|
if (window.__CN_Recaptcha) {
|
|
window.__CN_Recaptcha();
|
|
}
|
|
}
|
|
SCRIPT;
|
|
|
|
// MATOMO
|
|
$cookies['matomo'] = [
|
|
'name' => __('cookie-notice.custom.matomo.title'),
|
|
'description' => __('cookie-notice.custom.matomo.description'),
|
|
'link' => 'https://fr.matomo.org/gdpr-analytics/',
|
|
'labelLink' => __('cookie-notice.custom.matomo.labelLink'),
|
|
'cookies' => ['_pk']
|
|
];
|
|
|
|
$cookies['matomo']['script'] = <<<SCRIPT
|
|
function () {
|
|
var _paq = window._paq = window._paq || [];
|
|
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
|
_paq.push(['trackPageView']);
|
|
_paq.push(['enableLinkTracking']);
|
|
(function() {
|
|
var u="//yl.s-web.fr/";
|
|
_paq.push(['setTrackerUrl', u+'rainbow']);
|
|
_paq.push(['setSiteId', '
|
|
SCRIPT;
|
|
$cookies['matomo']['script'] .= config("services.matomo.site_id");
|
|
$cookies['matomo']['script'] .= <<<SCRIPT
|
|
']);
|
|
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
|
g.async=true; g.src=u+'unicorn'; s.parentNode.insertBefore(g,s);
|
|
})();
|
|
}
|
|
SCRIPT;
|
|
|
|
@endphp
|
|
|
|
{{-- INCLUDE TEMPLATE --}}
|
|
@include('vendor.cookie-notice-templates.standard', compact(
|
|
'site_name', 'logo_picture_url', 'logo_alt_text',
|
|
'logo_title_text', 'strings'
|
|
))
|
|
|
|
@push('scripts')
|
|
<script nonce="{{ $nonce ?? '' }}">
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
window.WebCookieNotice = {};
|
|
@foreach($cookies as $index_name => $cookie)
|
|
window.WebCookieNotice['{{ $index_name }}'] = {};
|
|
window.WebCookieNotice['{{ $index_name }}'].tmp = {};
|
|
// SCRIPT
|
|
window.WebCookieNotice['{{ $index_name }}'].tmp.script = {!! strip_tags($cookie['script']) !!};
|
|
@php unset($cookie['script']); @endphp
|
|
// FALLBACK
|
|
@if(isset($cookie['fallback']))
|
|
window.WebCookieNotice['{{ $index_name }}'].tmp.fallback = {!! strip_tags($cookie['fallback']) !!};
|
|
@php unset($cookie['fallback']); @endphp
|
|
@endif
|
|
window.WebCookieNotice['{{ $index_name }}'].conf = @json($cookie);
|
|
window.WebCookieNotice['{{ $index_name }}'].conf.script = window.WebCookieNotice['{{ $index_name }}'].tmp.script;
|
|
window.WebCookieNotice['{{ $index_name }}'].conf.fallback = window.WebCookieNotice['{{ $index_name }}'].tmp.fallback;
|
|
window.WebCookieNotice['{{ $index_name }}'] = window.WebCookieNotice['{{ $index_name }}'].conf;
|
|
@endforeach
|
|
window.WebCookieNotice = new window.CookieNotice(window.WebCookieNotice);
|
|
});
|
|
</script>
|
|
@endpush
|