@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | { |
| 19 | 19 | public function onBeforeInit() |
| 20 | 20 | { |
| 21 | - if(Security::getCurrentUser()) { |
|
| 21 | + if (Security::getCurrentUser()) { |
|
| 22 | 22 | return; |
| 23 | 23 | } |
| 24 | 24 | if (Versioned::LIVE !== Versioned::get_stage()) { |
@@ -28,41 +28,41 @@ discard block |
||
| 28 | 28 | $owner = $this->getOwner(); |
| 29 | 29 | if ($owner instanceof ContentController) { |
| 30 | 30 | $extend = $owner->extend('updateCacheControl'); |
| 31 | - if($extend) { |
|
| 31 | + if ($extend) { |
|
| 32 | 32 | return; |
| 33 | 33 | } |
| 34 | 34 | $sc = SiteConfig::current_site_config(); |
| 35 | - if(! $sc->HasCaching) { |
|
| 35 | + if (!$sc->HasCaching) { |
|
| 36 | 36 | return; |
| 37 | 37 | } |
| 38 | 38 | $request = $owner->getRequest(); |
| 39 | - if($request->param('Action')) { |
|
| 39 | + if ($request->param('Action')) { |
|
| 40 | 40 | return; |
| 41 | 41 | } |
| 42 | - if($request->param('ID')) { |
|
| 42 | + if ($request->param('ID')) { |
|
| 43 | 43 | return; |
| 44 | 44 | } |
| 45 | - if($request->isAjax()) { |
|
| 45 | + if ($request->isAjax()) { |
|
| 46 | 46 | return; |
| 47 | 47 | } |
| 48 | - if($request->getVar('flush')) { |
|
| 48 | + if ($request->getVar('flush')) { |
|
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | - if($request->requestVars()) { |
|
| 51 | + if ($request->requestVars()) { |
|
| 52 | 52 | return; |
| 53 | 53 | } |
| 54 | 54 | $dataRecord = $owner->data(); |
| 55 | 55 | if (empty($dataRecord)) { |
| 56 | 56 | return; |
| 57 | 57 | } |
| 58 | - if($dataRecord->NeverCachePublicly) { |
|
| 58 | + if ($dataRecord->NeverCachePublicly) { |
|
| 59 | 59 | HTTPCacheControlMiddleware::singleton() |
| 60 | 60 | ->disableCache() |
| 61 | 61 | ; |
| 62 | 62 | return; |
| 63 | 63 | } |
| 64 | 64 | $cacheTime = (int) ($dataRecord->PublicCacheDurationInSeconds ?: $sc->PublicCacheDurationInSeconds); |
| 65 | - if($cacheTime > 0) { |
|
| 65 | + if ($cacheTime > 0) { |
|
| 66 | 66 | return HTTPCacheControlMiddleware::singleton() |
| 67 | 67 | ->enableCache() |
| 68 | 68 | ->setMaxAge($cacheTime) |