@@ -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'); |
@@ -390,11 +390,11 @@ |
||
| 390 | 390 | // todo |
| 391 | 391 | //$this->addRedirection($liveUri, getRedirectUri) |
| 392 | 392 | return; |
| 393 | - } |
|
| 394 | - elseif (200 != $response->getStatusCode()) { |
|
| 393 | + } elseif (200 != $response->getStatusCode()) { |
|
| 395 | 394 | //$this->kernel = static::$appKernel; |
| 396 | - if ($response->getStatusCode() === 500 && $this->kernel->getEnvironment() == 'dev') |
|
| 397 | - exit($this->kernel->handle($request)); |
|
| 395 | + if ($response->getStatusCode() === 500 && $this->kernel->getEnvironment() == 'dev') { |
|
| 396 | + exit($this->kernel->handle($request)); |
|
| 397 | + } |
|
| 398 | 398 | |
| 399 | 399 | return; |
| 400 | 400 | } |