@@ -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 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | 'um' => 'minutes' |
| 44 | 44 | ], |
| 45 | 45 | 'provider' => env('APP_NAME'), |
| 46 | - 'domain' => str_replace(['http://', 'https://'], '', env('APP_URL')), |
|
| 46 | + 'domain' => str_replace([ 'http://', 'https://' ], '', env('APP_URL')), |
|
| 47 | 47 | ], |
| 48 | 48 | 'laravel_session' => [ |
| 49 | 49 | 'duration' => [ |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | 'um' => 'minutes' |
| 52 | 52 | ], |
| 53 | 53 | 'provider' => env('APP_NAME'), |
| 54 | - 'domain' => str_replace(['http://', 'https://'], '', env('APP_URL')), |
|
| 54 | + 'domain' => str_replace([ 'http://', 'https://' ], '', env('APP_URL')), |
|
| 55 | 55 | ], |
| 56 | 56 | // Laravel Cookie Consent |
| 57 | 57 | $COOKIE_CONSENT_NAME => [ |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | 'um' => $COOKIE_LIFETIME_UM |
| 61 | 61 | ], |
| 62 | 62 | 'provider' => env('APP_NAME'), |
| 63 | - 'domain' => str_replace(['http://', 'https://'], '', env('APP_URL')), |
|
| 63 | + 'domain' => str_replace([ 'http://', 'https://' ], '', env('APP_URL')), |
|
| 64 | 64 | ], |
| 65 | 65 | $COOKIE_CONSENT_NAME.'_statistics' => [ |
| 66 | 66 | 'duration' => [ |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | 'um' => $COOKIE_LIFETIME_UM |
| 69 | 69 | ], |
| 70 | 70 | 'provider' => env('APP_NAME'), |
| 71 | - 'domain' => str_replace(['http://', 'https://'], '', env('APP_URL')), |
|
| 71 | + 'domain' => str_replace([ 'http://', 'https://' ], '', env('APP_URL')), |
|
| 72 | 72 | ], |
| 73 | 73 | $COOKIE_CONSENT_NAME.'_marketing' => [ |
| 74 | 74 | 'duration' => [ |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | 'um' => $COOKIE_LIFETIME_UM |
| 77 | 77 | ], |
| 78 | 78 | 'provider' => env('APP_NAME'), |
| 79 | - 'domain' => str_replace(['http://', 'https://'], '', env('APP_URL')), |
|
| 79 | + 'domain' => str_replace([ 'http://', 'https://' ], '', env('APP_URL')), |
|
| 80 | 80 | ], |
| 81 | 81 | $COOKIE_CONSENT_NAME.'_functions' => [ |
| 82 | 82 | 'duration' => [ |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | 'um' => $COOKIE_LIFETIME_UM |
| 85 | 85 | ], |
| 86 | 86 | 'provider' => env('APP_NAME'), |
| 87 | - 'domain' => str_replace(['http://', 'https://'], '', env('APP_URL')), |
|
| 87 | + 'domain' => str_replace([ 'http://', 'https://' ], '', env('APP_URL')), |
|
| 88 | 88 | ], |
| 89 | 89 | // Google reCAPTCHA |
| 90 | 90 | '_GRECAPTCHA' => [ |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | 'um' => 'years' |
| 105 | 105 | ], |
| 106 | 106 | 'provider' => 'Google Analytics', |
| 107 | - 'domain' => str_replace(['http://', 'https://'], '', str_replace('www', '', env('APP_URL'))), |
|
| 107 | + 'domain' => str_replace([ 'http://', 'https://' ], '', str_replace('www', '', env('APP_URL'))), |
|
| 108 | 108 | ], |
| 109 | 109 | '_gid' => [ |
| 110 | 110 | 'duration' => [ |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | 'um' => 'day' |
| 113 | 113 | ], |
| 114 | 114 | 'provider' => 'Google Analytics', |
| 115 | - 'domain' => str_replace(['http://', 'https://'], '', str_replace('www', '', env('APP_URL'))), |
|
| 115 | + 'domain' => str_replace([ 'http://', 'https://' ], '', str_replace('www', '', env('APP_URL'))), |
|
| 116 | 116 | ], |
| 117 | 117 | '_ga_*' => [ |
| 118 | 118 | 'duration' => [ |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | 'um' => 'years' |
| 121 | 121 | ], |
| 122 | 122 | 'provider' => 'Google Analytics', |
| 123 | - 'domain' => str_replace(['http://', 'https://'], '', str_replace('www', '', env('APP_URL'))), |
|
| 123 | + 'domain' => str_replace([ 'http://', 'https://' ], '', str_replace('www', '', env('APP_URL'))), |
|
| 124 | 124 | ], |
| 125 | 125 | '_gat_*' => [ |
| 126 | 126 | 'duration' => [ |
@@ -128,10 +128,10 @@ discard block |
||
| 128 | 128 | 'um' => 'minute' |
| 129 | 129 | ], |
| 130 | 130 | 'provider' => 'Google Analytics', |
| 131 | - 'domain' => str_replace(['http://', 'https://'], '', str_replace('www', '', env('APP_URL'))), |
|
| 131 | + 'domain' => str_replace([ 'http://', 'https://' ], '', str_replace('www', '', env('APP_URL'))), |
|
| 132 | 132 | ], |
| 133 | 133 | ], |
| 134 | - 'marketing' => [], |
|
| 135 | - 'functional' => [], |
|
| 134 | + 'marketing' => [ ], |
|
| 135 | + 'functional' => [ ], |
|
| 136 | 136 | ] |
| 137 | 137 | ]; |