@@ -60,8 +60,7 @@ |
||
| 60 | 60 | $real = $request->getRequestUri(); |
| 61 | 61 | |
| 62 | 62 | $expected = 'homepage' == $page->getSlug() ? |
| 63 | - $this->get('piedweb.page_canonical')->generatePathForHomepage() : |
|
| 64 | - $this->get('piedweb.page_canonical')->generatePathForPage($page->getRealSlug()); |
|
| 63 | + $this->get('piedweb.page_canonical')->generatePathForHomepage() : $this->get('piedweb.page_canonical')->generatePathForPage($page->getRealSlug()); |
|
| 65 | 64 | |
| 66 | 65 | if ($real != $expected) { |
| 67 | 66 | return [$request->getBasePath().$expected, 301]; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $pathWebP = $this->projectDir.'/public/'.$media->getRelativeDir().'/'.$filter.'/'.$media->getSlug().'.webp'; |
| 119 | 119 | $webPConverterOptions = self::$webPConverterOptions; |
| 120 | 120 | |
| 121 | - $this->pool->add(function () use ($pathJpg, $pathWebP, $webPConverterOptions, $filter) { |
|
| 121 | + $this->pool->add(function() use ($pathJpg, $pathWebP, $webPConverterOptions, $filter) { |
|
| 122 | 122 | // took 46s (vs 43s) to add liip generation in async |
| 123 | 123 | //exec($projectDir.'/bin/console liip:imagine:cache:resolve "'.$path.'" --force --filter='.$filter |
| 124 | 124 | //.' >/dev/null 2>&1 &'); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $source = $this->projectDir.$media->getPath(); |
| 133 | 133 | //self::createWebPStatic($destination, $source); |
| 134 | 134 | |
| 135 | - $this->pool->add(function () use ($destination, $source) { |
|
| 135 | + $this->pool->add(function() use ($destination, $source) { |
|
| 136 | 136 | self::createWebPStatic($destination, $source); |
| 137 | 137 | }); |
| 138 | 138 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | 'property' => 'title', // or any field in your media entity |
| 120 | 120 | 'label' => 'admin.page.relatedPage.label', |
| 121 | 121 | 'btn_add' => false, |
| 122 | - 'to_string_callback' => function ($entity) { |
|
| 122 | + 'to_string_callback' => function($entity) { |
|
| 123 | 123 | return $entity->getTitle(); |
| 124 | 124 | }, |
| 125 | 125 | ]); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | 'help_html' => true, |
| 183 | 183 | 'help' => 'admin.page.translations.help', |
| 184 | 184 | 'btn_add' => false, |
| 185 | - 'to_string_callback' => function ($entity) { |
|
| 185 | + 'to_string_callback' => function($entity) { |
|
| 186 | 186 | return $entity->getLocale() |
| 187 | 187 | ? $entity->getLocale().' ('.$entity->getSlug().')' |
| 188 | 188 | : $entity->getSlug(); // switch for getLocale |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | public function preRemove(MediaInterface $media) |
| 81 | 81 | { |
| 82 | - $this->filesystem->remove( $this->rootDir.'/../'.$media->getRelativeDir().'/'.$media->getMedia() ); |
|
| 82 | + $this->filesystem->remove($this->rootDir.'/../'.$media->getRelativeDir().'/'.$media->getMedia()); |
|
| 83 | 83 | $this->cacheManager->remove('/'.$media->getRelativeDir().'/'.$media->getMediaBeforeUpdate()); |
| 84 | 84 | } |
| 85 | 85 | /** |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | $this->eventDispatcher->addListener( |
| 131 | 131 | KernelEvents::TERMINATE, |
| 132 | - function () use ($media) { |
|
| 132 | + function() use ($media) { |
|
| 133 | 133 | $this->generateCache($media); |
| 134 | 134 | } |
| 135 | 135 | ); |
@@ -164,7 +164,7 @@ |
||
| 164 | 164 | if (!$media) |
| 165 | 165 | return $this; |
| 166 | 166 | |
| 167 | - if ($this->media!==null) { |
|
| 167 | + if ($this->media !== null) { |
|
| 168 | 168 | $this->setMediaBeforeUpdate($this->media); |
| 169 | 169 | // TODO must rename media (via service ?!) var_dump($this->media); exit; |
| 170 | 170 | } |
@@ -108,8 +108,9 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | public function setSlug($slug, $force = false) |
| 110 | 110 | { |
| 111 | - if (!$slug) |
|
| 112 | - return $this; |
|
| 111 | + if (!$slug) { |
|
| 112 | + return $this; |
|
| 113 | + } |
|
| 113 | 114 | |
| 114 | 115 | |
| 115 | 116 | $slug = (new Slugify())->slugify($slug); |
@@ -161,8 +162,9 @@ discard block |
||
| 161 | 162 | |
| 162 | 163 | public function setMedia($media): self |
| 163 | 164 | { |
| 164 | - if (!$media) |
|
| 165 | - return $this; |
|
| 165 | + if (!$media) { |
|
| 166 | + return $this; |
|
| 167 | + } |
|
| 166 | 168 | |
| 167 | 169 | if ($this->media!==null) { |
| 168 | 170 | $this->setMediaBeforeUpdate($this->media); |