@@ -86,17 +86,17 @@ |
||
| 86 | 86 | $all_hrefs = array_unique($links[1]); |
| 87 | 87 | //replace local links |
| 88 | 88 | foreach ($all_hrefs as $href) { |
| 89 | - $code = 'urn:newsml:' . $href; |
|
| 89 | + $code = 'urn:newsml:'.$href; |
|
| 90 | 90 | //get the referenced article |
| 91 | 91 | $refArticle = $this->articleRepository->findOneBy(['code' => $code, 'status' => 'published']); |
| 92 | 92 | if ($refArticle != null && $refArticle->getRoute()) { |
| 93 | 93 | $slugName = $refArticle->getSlug(); |
| 94 | 94 | $parameters = ['slug' => $slugName]; |
| 95 | 95 | $realUrl = $this->router->generate($refArticle->getRoute(), $parameters, UrlGeneratorInterface::ABSOLUTE_URL); |
| 96 | - $articleBody = preg_replace('#urn:newsml:' . $href . '#is', $realUrl, $articleBody); |
|
| 96 | + $articleBody = preg_replace('#urn:newsml:'.$href.'#is', $realUrl, $articleBody); |
|
| 97 | 97 | } else { |
| 98 | 98 | // the article code is not valid - delete the link |
| 99 | - $re = "/(<a[^href]href=[\"']" . $code . "[^>]*>)([^<>]*|.*)(<\/a>)/m"; |
|
| 99 | + $re = "/(<a[^href]href=[\"']".$code."[^>]*>)([^<>]*|.*)(<\/a>)/m"; |
|
| 100 | 100 | $subst = "$2"; |
| 101 | 101 | $articleBody = preg_replace($re, $subst, $articleBody); |
| 102 | 102 | } |