@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | 'um' => 'minutes' |
43 | 43 | ], |
44 | 44 | 'provider' => env('APP_NAME'), |
45 | - 'domain' => str_replace(['http://', 'https://'], '', env('APP_URL')), |
|
45 | + 'domain' => str_replace([ 'http://', 'https://' ], '', env('APP_URL')), |
|
46 | 46 | ], |
47 | 47 | 'laravel_session' => [ |
48 | 48 | 'duration' => [ |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'um' => 'minutes' |
51 | 51 | ], |
52 | 52 | 'provider' => env('APP_NAME'), |
53 | - 'domain' => str_replace(['http://', 'https://'], '', env('APP_URL')), |
|
53 | + 'domain' => str_replace([ 'http://', 'https://' ], '', env('APP_URL')), |
|
54 | 54 | ], |
55 | 55 | // Laravel Cookie Consent |
56 | 56 | env('COOKIE_CONSENT_NAME', 'laravel_cookie_consent') => [ |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'um' => $COOKIE_LIFETIME_UM |
60 | 60 | ], |
61 | 61 | 'provider' => env('APP_NAME'), |
62 | - 'domain' => str_replace(['http://', 'https://'], '', env('APP_URL')), |
|
62 | + 'domain' => str_replace([ 'http://', 'https://' ], '', env('APP_URL')), |
|
63 | 63 | ], |
64 | 64 | env('COOKIE_CONSENT_NAME', 'laravel_cookie_consent').'_statistics' => [ |
65 | 65 | 'duration' => [ |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'um' => $COOKIE_LIFETIME_UM |
68 | 68 | ], |
69 | 69 | 'provider' => env('APP_NAME'), |
70 | - 'domain' => str_replace(['http://', 'https://'], '', env('APP_URL')), |
|
70 | + 'domain' => str_replace([ 'http://', 'https://' ], '', env('APP_URL')), |
|
71 | 71 | ], |
72 | 72 | env('COOKIE_CONSENT_NAME', 'laravel_cookie_consent').'_marketing' => [ |
73 | 73 | 'duration' => [ |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | 'um' => $COOKIE_LIFETIME_UM |
76 | 76 | ], |
77 | 77 | 'provider' => env('APP_NAME'), |
78 | - 'domain' => str_replace(['http://', 'https://'], '', env('APP_URL')), |
|
78 | + 'domain' => str_replace([ 'http://', 'https://' ], '', env('APP_URL')), |
|
79 | 79 | ], |
80 | 80 | env('COOKIE_CONSENT_NAME', 'laravel_cookie_consent').'_functions' => [ |
81 | 81 | 'duration' => [ |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | 'um' => $COOKIE_LIFETIME_UM |
84 | 84 | ], |
85 | 85 | 'provider' => env('APP_NAME'), |
86 | - 'domain' => str_replace(['http://', 'https://'], '', env('APP_URL')), |
|
86 | + 'domain' => str_replace([ 'http://', 'https://' ], '', env('APP_URL')), |
|
87 | 87 | ], |
88 | 88 | // Google reCAPTCHA |
89 | 89 | '_GRECAPTCHA' => [ |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 'um' => 'years' |
104 | 104 | ], |
105 | 105 | 'provider' => 'Google Analytics', |
106 | - 'domain' => str_replace(['http://', 'https://'], '', str_replace('www', '', env('APP_URL'))), |
|
106 | + 'domain' => str_replace([ 'http://', 'https://' ], '', str_replace('www', '', env('APP_URL'))), |
|
107 | 107 | ], |
108 | 108 | '_gid' => [ |
109 | 109 | 'duration' => [ |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'um' => 'day' |
112 | 112 | ], |
113 | 113 | 'provider' => 'Google Analytics', |
114 | - 'domain' => str_replace(['http://', 'https://'], '', str_replace('www', '', env('APP_URL'))), |
|
114 | + 'domain' => str_replace([ 'http://', 'https://' ], '', str_replace('www', '', env('APP_URL'))), |
|
115 | 115 | ], |
116 | 116 | '_ga_*' => [ |
117 | 117 | 'duration' => [ |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | 'um' => 'years' |
120 | 120 | ], |
121 | 121 | 'provider' => 'Google Analytics', |
122 | - 'domain' => str_replace(['http://', 'https://'], '', str_replace('www', '', env('APP_URL'))), |
|
122 | + 'domain' => str_replace([ 'http://', 'https://' ], '', str_replace('www', '', env('APP_URL'))), |
|
123 | 123 | ], |
124 | 124 | '_gat_*' => [ |
125 | 125 | 'duration' => [ |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | 'um' => 'minute' |
128 | 128 | ], |
129 | 129 | 'provider' => 'Google Analytics', |
130 | - 'domain' => str_replace(['http://', 'https://'], '', str_replace('www', '', env('APP_URL'))), |
|
130 | + 'domain' => str_replace([ 'http://', 'https://' ], '', str_replace('www', '', env('APP_URL'))), |
|
131 | 131 | ], |
132 | 132 | ], |
133 | - 'marketing' => [], |
|
134 | - 'functional' => [], |
|
133 | + 'marketing' => [ ], |
|
134 | + 'functional' => [ ], |
|
135 | 135 | ] |
136 | 136 | ]; |
@@ -110,7 +110,7 @@ |
||
110 | 110 | data-session-secure="{{ config('session.secure') }}" |
111 | 111 | data-button-label-accept-selected="{{ trans('laravel-cookie-consent::translations.button_accept_selected') }}" |
112 | 112 | data-button-label-accept-all="{{ trans('laravel-cookie-consent::translations.button_accept') }}" |
113 | - data-cookie-types='<?php echo json_encode($config['cookie_types']) ?>' |
|
113 | + data-cookie-types='<?php echo json_encode($config[ 'cookie_types' ]) ?>' |
|
114 | 114 | data-cookie-selected='<?php echo json_encode($cookieTypesAccepted) ?>' |
115 | 115 | ></script> |
116 | 116 | @endif |
@@ -17,11 +17,11 @@ |
||
17 | 17 | $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-cookie-consent'); |
18 | 18 | $this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-cookie-consent'); |
19 | 19 | |
20 | - $this->publishes([__DIR__.'/../config/config.php' => config_path('laravel-cookie-consent.php')], 'config'); |
|
21 | - $this->publishes([__DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-cookie-consent')], 'lang'); |
|
22 | - $this->publishes([__DIR__.'/../resources/js' => public_path('vendor/laravel-cookie-consent')], 'public'); |
|
23 | - $this->publishes([__DIR__.'/../resources/css' => public_path('vendor/laravel-cookie-consent')], 'public'); |
|
24 | - $this->publishes([__DIR__.'/../resources/views' => resource_path('views/vendor/laravel-cookie-consent')], 'views'); |
|
20 | + $this->publishes([ __DIR__.'/../config/config.php' => config_path('laravel-cookie-consent.php') ], 'config'); |
|
21 | + $this->publishes([ __DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-cookie-consent') ], 'lang'); |
|
22 | + $this->publishes([ __DIR__.'/../resources/js' => public_path('vendor/laravel-cookie-consent') ], 'public'); |
|
23 | + $this->publishes([ __DIR__.'/../resources/css' => public_path('vendor/laravel-cookie-consent') ], 'public'); |
|
24 | + $this->publishes([ __DIR__.'/../resources/views' => resource_path('views/vendor/laravel-cookie-consent') ], 'views'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | $alreadyAccepted = array_key_exists(config('laravel-cookie-consent.cookie_name'), $request->cookie()); |
22 | 22 | $cookieTypesAccepted = $this->getCookieTypesConsent($request); |
23 | 23 | $response = $next($request); |
24 | - if (! $response instanceof Response) { |
|
24 | + if (!$response instanceof Response) { |
|
25 | 25 | return $response; |
26 | 26 | } |
27 | - if (! $this->containsBodyTag($response)) { |
|
27 | + if (!$this->containsBodyTag($response)) { |
|
28 | 28 | return $response; |
29 | 29 | } |
30 | 30 | return $this->addCookieConsentScriptToResponse($response, $alreadyAccepted, $cookieTypesAccepted); |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function getCookieTypesConsent($request): array |
40 | 40 | { |
41 | - $cookieTypesConsent = []; |
|
42 | - foreach(config('laravel-cookie-consent.cookie_types') as $type => $cookie_name) { |
|
43 | - if(array_key_exists($cookie_name, $request->cookie())) $cookieTypesConsent[] = $cookie_name; |
|
41 | + $cookieTypesConsent = [ ]; |
|
42 | + foreach (config('laravel-cookie-consent.cookie_types') as $type => $cookie_name) { |
|
43 | + if (array_key_exists($cookie_name, $request->cookie())) $cookieTypesConsent[ ] = $cookie_name; |
|
44 | 44 | } |
45 | 45 | return $cookieTypesConsent; |
46 | 46 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $closingBodyTagPosition = $this->getLastClosingBodyTagPosition($content); |
74 | 74 | $content = '' |
75 | 75 | .substr($content, 0, $closingBodyTagPosition) |
76 | - .view('laravel-cookie-consent::_banner', ['alreadyAccepted' => $alreadyAccepted, 'cookieTypesAccepted' => $cookieTypesAccepted])->render() |
|
76 | + .view('laravel-cookie-consent::_banner', [ 'alreadyAccepted' => $alreadyAccepted, 'cookieTypesAccepted' => $cookieTypesAccepted ])->render() |
|
77 | 77 | .substr($content, $closingBodyTagPosition); |
78 | 78 | //} |
79 | 79 | return $response->setContent($content); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return int |
87 | 87 | */ |
88 | - protected function getLastClosingBodyTagPosition(string $content = ''): int|false |
|
88 | + protected function getLastClosingBodyTagPosition(string $content = ''): int | false |
|
89 | 89 | { |
90 | 90 | return strripos($content, '</body>'); |
91 | 91 | } |