@@ -138,7 +138,7 @@ |
||
138 | 138 | 'help_html' => true, |
139 | 139 | 'help' => 'admin.page.translations.help', |
140 | 140 | 'btn_add' => false, |
141 | - 'to_string_callback' => function ($entity) { |
|
141 | + 'to_string_callback' => function($entity) { |
|
142 | 142 | return $entity->getLocale() |
143 | 143 | ? $entity->getLocale().' ('.$entity->getSlug().')' |
144 | 144 | : $entity->getSlug(); // switch for getLocale |
@@ -61,7 +61,7 @@ |
||
61 | 61 | $columnFields = [ |
62 | 62 | 'admin.page.state.label' => ['createdAt', 'metaRobots'], |
63 | 63 | 'admin.page.permanlien.label' => ['host', 'slug', 'parentPage'], |
64 | - 'admin.page.extended.label' => ['expand' => true, 'fields' => ['mainImage', 'name', 'title', 'excrept']], |
|
64 | + 'admin.page.extended.label' => ['expand' => true, 'fields' => ['mainImage', 'name', 'title', 'excrept']], |
|
65 | 65 | 'admin.page.translations.label' => ['locale', 'translations'], |
66 | 66 | 'admin.page.otherProperties.label' => ['expand' => true, 'fields' => ['otherProperties']], |
67 | 67 | 'admin.page.images.label' => ['images'], |
@@ -21,7 +21,9 @@ |
||
21 | 21 | public function getH1($elseTitle = false): ?string |
22 | 22 | { |
23 | 23 | if ($elseTitle) { |
24 | - return ShortCodeConverter::do($this->h1 ?? $this->title ?? '', $this->getLocale()); |
|
24 | + return ShortCodeConverter::do { |
|
25 | + ($this->h1 ?? $this->title ?? '', $this->getLocale()); |
|
26 | + } |
|
25 | 27 | } |
26 | 28 | |
27 | 29 | return $this->h1; |
@@ -4,11 +4,13 @@ |
||
4 | 4 | |
5 | 5 | class ShortCodeConverter |
6 | 6 | { |
7 | - public static function do($string, $locale = null) |
|
7 | + public static function do { |
|
8 | + ($string, $locale = null) |
|
8 | 9 | { |
9 | 10 | //var_dump($string); exit; |
10 | 11 | if ($locale) { |
11 | 12 | setlocale(LC_TIME, self::convertLocale($locale)); |
13 | + } |
|
12 | 14 | } |
13 | 15 | |
14 | 16 | //$string = preg_replace('/date\([\'"]?([a-z% ]+)[\'"]?\)/i', |
@@ -123,7 +123,7 @@ |
||
123 | 123 | |
124 | 124 | $this->eventDispatcher->addListener( |
125 | 125 | KernelEvents::TERMINATE, |
126 | - function () use ($media) { |
|
126 | + function() use ($media) { |
|
127 | 127 | $this->cacheGenerator->generateCache($media); |
128 | 128 | } |
129 | 129 | ); |
@@ -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 | } |
@@ -30,8 +30,9 @@ |
||
30 | 30 | { |
31 | 31 | if ($input->getArgument('host')) { |
32 | 32 | $this->staticAppGenerator->generateFromHost($input->getArgument('host')); |
33 | - } else |
|
34 | - $this->staticAppGenerator->generateAll(); |
|
33 | + } else { |
|
34 | + $this->staticAppGenerator->generateAll(); |
|
35 | + } |
|
35 | 36 | |
36 | 37 | $output->writeln('Static version generation succeeded.'); |
37 | 38 | } |
@@ -62,8 +62,7 @@ discard block |
||
62 | 62 | $real = $request->getRequestUri(); |
63 | 63 | |
64 | 64 | $expected = 'homepage' == $page->getSlug() ? |
65 | - $this->get('piedweb.page_canonical')->generatePathForHomepage() : |
|
66 | - $this->get('piedweb.page_canonical')->generatePathForPage($page->getRealSlug()); |
|
65 | + $this->get('piedweb.page_canonical')->generatePathForHomepage() : $this->get('piedweb.page_canonical')->generatePathForPage($page->getRealSlug()); |
|
67 | 66 | |
68 | 67 | if ($real != $expected) { |
69 | 68 | return [$request->getBasePath().$expected, 301]; |
@@ -151,7 +150,7 @@ discard block |
||
151 | 150 | return $this->render('@PiedWebCMS/page/rss.xml.twig', array_merge([ |
152 | 151 | 'pages' => $this->getPages(5, $request, $params), |
153 | 152 | 'page' => $page, |
154 | - 'feedUri' => 'feed'.($params->get('locale') == $locale ? '' : '.'.$locale).'.xml',], $app->getParamsForRendering())); |
|
153 | + 'feedUri' => 'feed'.($params->get('locale') == $locale ? '' : '.'.$locale).'.xml', ], $app->getParamsForRendering())); |
|
155 | 154 | } |
156 | 155 | |
157 | 156 | public function showSitemap( |
@@ -174,7 +173,7 @@ discard block |
||
174 | 173 | |
175 | 174 | protected function getPages(?int $limit = null, Request $request, ParameterBagInterface $params) |
176 | 175 | { |
177 | - $requestedLocale = rtrim($request->getLocale(),'/'); |
|
176 | + $requestedLocale = rtrim($request->getLocale(), '/'); |
|
178 | 177 | |
179 | 178 | $app = App::load($request, $params); |
180 | 179 | $pages = Repository::getPageRepository($this->getDoctrine(), $params->get('pwc.entity_page')) |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | ]; |
110 | 110 | } |
111 | 111 | |
112 | - protected static function prepareForRegex ($var) |
|
112 | + protected static function prepareForRegex($var) |
|
113 | 113 | { |
114 | 114 | if (is_string($var)) { |
115 | 115 | return preg_quote($var, '/'); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | { |
130 | 130 | $urlInAttributes = ' '.self::prepareForRegex(['href', 'data-rot', 'src', 'data-img', 'data-bg']); |
131 | 131 | $regex = '/'.$urlInAttributes.'=((["\'])([^\3]+)\3|([^\s>]+)[\s>])/iU'; |
132 | - preg_match_all( $regex, $this->pageHtml, $matches ); |
|
132 | + preg_match_all($regex, $this->pageHtml, $matches); |
|
133 | 133 | |
134 | 134 | $linkedDocs = []; |
135 | 135 | foreach ($matches[0] as $k => $match) { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $this->linksCheckedCounter++; |
165 | 165 | if (!is_string($uri)) |
166 | 166 | continue; |
167 | - if (($uri[0] == '/' && !$this->uriExist($uri) ) |
|
167 | + if (($uri[0] == '/' && !$this->uriExist($uri)) |
|
168 | 168 | || (strpos($uri, 'http') === 0 && !$this->urlExist($uri))) { |
169 | 169 | $this->addError('<code>'.$uri.'</code> introuvable'); |
170 | 170 | } |
@@ -91,8 +91,7 @@ discard block |
||
91 | 91 | if ($response->isRedirect()) { |
92 | 92 | $linkedDocs[] = $response->headers->get('location'); |
93 | 93 | return; |
94 | - } |
|
95 | - elseif (200 != $response->getStatusCode()) { |
|
94 | + } elseif (200 != $response->getStatusCode()) { |
|
96 | 95 | $this->addError('error on generating the page ('.$response->getStatusCode().')'); |
97 | 96 | exit; |
98 | 97 | return; |
@@ -162,8 +161,9 @@ discard block |
||
162 | 161 | { |
163 | 162 | foreach ($linkedDocs as $uri) { |
164 | 163 | $this->linksCheckedCounter++; |
165 | - if (!is_string($uri)) |
|
166 | - continue; |
|
164 | + if (!is_string($uri)) { |
|
165 | + continue; |
|
166 | + } |
|
167 | 167 | if (($uri[0] == '/' && !$this->uriExist($uri) ) |
168 | 168 | || (strpos($uri, 'http') === 0 && !$this->urlExist($uri))) { |
169 | 169 | $this->addError('<code>'.$uri.'</code> introuvable'); |