@@ -5,9 +5,9 @@ |
||
| 5 | 5 | use Symfony\Component\ErrorHandler\Debug; |
| 6 | 6 | use Symfony\Component\HttpFoundation\Request; |
| 7 | 7 | |
| 8 | -require dirname(__DIR__).'/vendor/autoload.php'; |
|
| 8 | +require dirname(__DIR__) . '/vendor/autoload.php'; |
|
| 9 | 9 | |
| 10 | -(new Dotenv())->bootEnv(dirname(__DIR__).'/.env'); |
|
| 10 | +(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); |
|
| 11 | 11 | |
| 12 | 12 | if ($_SERVER['APP_DEBUG']) { |
| 13 | 13 | umask(0000); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $this->imagineCacheManager = $imagineCacheManager; |
| 27 | 27 | |
| 28 | 28 | $this->filters = []; |
| 29 | - foreach($filterManager->getFilterConfiguration()->all() as $name => $filter) { |
|
| 29 | + foreach ($filterManager->getFilterConfiguration()->all() as $name => $filter) { |
|
| 30 | 30 | if (preg_match('/^srcset/', $name)) { |
| 31 | 31 | $width = $filter['filters']['relative_resize']['widen']; |
| 32 | 32 | $this->filters[] = [ |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | $image_asset_path = $this->uploaderHelper->asset($image); |
| 43 | 43 | $srcset = []; |
| 44 | - foreach($this->filters as $filter) { |
|
| 44 | + foreach ($this->filters as $filter) { |
|
| 45 | 45 | $srcset[] = [ |
| 46 | 46 | 'width' => $filter['width'], |
| 47 | 47 | 'path' => $this->imagineCacheManager->getBrowserPath($image_asset_path, $filter['filter']) |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | // Add original image as srcset option, otherwise it may never be used. |
| 52 | 52 | $srcset[] = ['width' => $image->getDimensions()[0], 'path' => $image_asset_path]; |
| 53 | 53 | |
| 54 | - $srcsetString = implode(', ', array_map(function ($src) { |
|
| 54 | + $srcsetString = implode(', ', array_map(function($src) { |
|
| 55 | 55 | return sprintf( |
| 56 | 56 | '%s %uw', |
| 57 | 57 | $src['path'], |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $response = new Response(); |
| 87 | 87 | $format = $request->getRequestFormat(); |
| 88 | 88 | return $this->render( |
| 89 | - 'admin/wander/backlog.'.$format.'.twig', |
|
| 89 | + 'admin/wander/backlog.' . $format . '.twig', |
|
| 90 | 90 | [ |
| 91 | 91 | 'wanders' => $wanders |
| 92 | 92 | ], |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function delete(Request $request, Wander $wander): Response |
| 181 | 181 | { |
| 182 | - if ($this->isCsrfTokenValid('delete'.$wander->getId(), $request->request->get('_token'))) { |
|
| 182 | + if ($this->isCsrfTokenValid('delete' . $wander->getId(), $request->request->get('_token'))) { |
|
| 183 | 183 | $entityManager = $this->getDoctrine()->getManager(); |
| 184 | 184 | $entityManager->remove($wander); |
| 185 | 185 | $entityManager->flush(); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public function deleteImages(Request $request, Wander $wander): Response |
| 195 | 195 | { |
| 196 | - if ($this->isCsrfTokenValid('delete_images'.$wander->getId(), $request->request->get('_token'))) { |
|
| 196 | + if ($this->isCsrfTokenValid('delete_images' . $wander->getId(), $request->request->get('_token'))) { |
|
| 197 | 197 | $entityManager = $this->getDoctrine()->getManager(); |
| 198 | 198 | $images = $wander->getImages(); |
| 199 | 199 | foreach ($images as $image) { |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | new File([ |
| 39 | 39 | 'maxSize' => '1024k', |
| 40 | 40 | 'mimeTypes' => [ |
| 41 | - "application/gpx+xml","text/xml","application/xml","application/octet-stream" |
|
| 41 | + "application/gpx+xml", "text/xml", "application/xml", "application/octet-stream" |
|
| 42 | 42 | ], |
| 43 | 43 | 'mimeTypesMessage' =>'Please upload a valid GPX document' |
| 44 | 44 | ]) |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) { |
|
| 4 | - require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php'; |
|
| 3 | +if (file_exists(dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php')) { |
|
| 4 | + require dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php'; |
|
| 5 | 5 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | |
| 40 | 40 | // TODO: Maybe try combining results from $imageFinder and $wanderFinder? |
| 41 | 41 | |
| 42 | - $form = $this->createFormBuilder(null, ['method' => 'GET' ]) |
|
| 42 | + $form = $this->createFormBuilder(null, ['method' => 'GET']) |
|
| 43 | 43 | ->add('query', SearchType::class, ['label' => false]) |
| 44 | 44 | ->getForm(); |
| 45 | 45 | |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $tags = []; |
| 101 | - foreach($imagga_result->result->tags as $tag) { |
|
| 101 | + foreach ($imagga_result->result->tags as $tag) { |
|
| 102 | 102 | $tags[] = $tag->tag->en; |
| 103 | 103 | } |
| 104 | 104 | $image->setAutoTags($tags); |
@@ -44,23 +44,23 @@ |
||
| 44 | 44 | |
| 45 | 45 | // Tasks |
| 46 | 46 | |
| 47 | -task('build', function () { |
|
| 47 | +task('build', function() { |
|
| 48 | 48 | run('cd {{release_path}} && build'); |
| 49 | 49 | }); |
| 50 | 50 | |
| 51 | 51 | desc('Stop any existing messenger consumers; Supervisor will restart them.'); |
| 52 | -task('deploy:stop-workers', function () { |
|
| 52 | +task('deploy:stop-workers', function() { |
|
| 53 | 53 | run('{{bin/console}} messenger:stop-workers {{console_options}}'); |
| 54 | 54 | }); |
| 55 | 55 | |
| 56 | 56 | // Testing |
| 57 | 57 | |
| 58 | -task('pwd', function () { |
|
| 58 | +task('pwd', function() { |
|
| 59 | 59 | $result = run('pwd'); |
| 60 | 60 | writeln("Current dir: $result"); |
| 61 | 61 | }); |
| 62 | 62 | |
| 63 | -task('test', function () { |
|
| 63 | +task('test', function() { |
|
| 64 | 64 | writeln('Hello world'); |
| 65 | 65 | }); |
| 66 | 66 | |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | $validUris = []; |
| 60 | 60 | $wanders = $this->wanderRepository->findAll(); |
| 61 | 61 | foreach ($wanders as $wander) { |
| 62 | - $uri = $this->router->generate('wanders_show', [ 'id' => $wander->getId()], UrlGeneratorInterface::ABSOLUTE_URL); |
|
| 62 | + $uri = $this->router->generate('wanders_show', ['id' => $wander->getId()], UrlGeneratorInterface::ABSOLUTE_URL); |
|
| 63 | 63 | $validUris[$uri] = true; // Really I just want a hash that doesn't actually map |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $images = $this->imageRepository->findAll(); |
| 67 | 67 | foreach ($images as $image) { |
| 68 | - $uri = $this->router->generate('image_show', [ 'id' => $image->getId()], UrlGeneratorInterface::ABSOLUTE_URL); |
|
| 68 | + $uri = $this->router->generate('image_show', ['id' => $image->getId()], UrlGeneratorInterface::ABSOLUTE_URL); |
|
| 69 | 69 | $validUris[$uri] = true; // Really I just want a hash that doesn't actually map |
| 70 | 70 | } |
| 71 | 71 | $homepage = $this->router->generate('home', [], RouterInterface::ABSOLUTE_URL); |
@@ -73,14 +73,14 @@ discard block |
||
| 73 | 73 | // Okay, now we've got a list of all valid URIs, let's have a look through all our descriptions |
| 74 | 74 | |
| 75 | 75 | // Wanders first... |
| 76 | - foreach($wanders as $wander) { |
|
| 77 | - $links = $this->markdownService->findLinks($wander->getDescription()); |
|
| 76 | + foreach ($wanders as $wander) { |
|
| 77 | + $links = $this->markdownService->findLinks($wander->getDescription()); |
|
| 78 | 78 | foreach ($links as $link) { |
| 79 | 79 | if (substr($link['uri'], 0, strlen($homepage)) == $homepage) { |
| 80 | 80 | if (!array_key_exists($link['uri'], $validUris)) { |
| 81 | 81 | $problem = new Problem(); |
| 82 | 82 | $problem->setDescription('Wander ' . $wander->getId() . ' links to invalid URI: ' . $link['uri'] . ' (text is: "' . $link['text'] . '")'); |
| 83 | - $problem->setUri($this->router->generate('wanders_show', [ 'id' => $wander->getId()], UrlGeneratorInterface::ABSOLUTE_URL)); |
|
| 83 | + $problem->setUri($this->router->generate('wanders_show', ['id' => $wander->getId()], UrlGeneratorInterface::ABSOLUTE_URL)); |
|
| 84 | 84 | $this->entityManager->persist($problem); |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | $this->entityManager->flush(); |
| 90 | 90 | // ...then Images: |
| 91 | - foreach($images as $image) { |
|
| 91 | + foreach ($images as $image) { |
|
| 92 | 92 | $links = $this->markdownService->findLinks($image->getDescription()); |
| 93 | 93 | foreach ($links as $link) { |
| 94 | 94 | if (substr($link['uri'], 0, strlen($homepage)) == $homepage) { |
| 95 | 95 | if (!array_key_exists($link['uri'], $validUris)) { |
| 96 | 96 | $problem = new Problem(); |
| 97 | 97 | $problem->setDescription('Image ' . $image->getId() . ' links to invalid URI: ' . $link['uri'] . ' (text is: "' . $link['text'] . '")'); |
| 98 | - $problem->setUri($this->router->generate('image_show', [ 'id' => $image->getId()], UrlGeneratorInterface::ABSOLUTE_URL)); |
|
| 98 | + $problem->setUri($this->router->generate('image_show', ['id' => $image->getId()], UrlGeneratorInterface::ABSOLUTE_URL)); |
|
| 99 | 99 | $this->entityManager->persist($problem); |
| 100 | 100 | } |
| 101 | 101 | } |