From 4debca404f00a8ec04b7e60ad554c275c6f966d1 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 26 Sep 2013 22:27:48 +0200 Subject: fix relative link substition when & appears in the link --- utility/articleenhancer/xpatharticleenhancer.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'utility') diff --git a/utility/articleenhancer/xpatharticleenhancer.php b/utility/articleenhancer/xpatharticleenhancer.php index 114a612f0..c9cff238a 100644 --- a/utility/articleenhancer/xpatharticleenhancer.php +++ b/utility/articleenhancer/xpatharticleenhancer.php @@ -119,10 +119,14 @@ class XPathArticleEnhancer implements ArticleEnhancer { foreach ($substitution as $attribute) { $xpath = new \DOMXpath($dom); - $xpathResult = $xpath->query("//*[@".$attribute." and not(contains(@".$attribute.", '://')) and not(starts-with(@".$attribute.", 'mailto:'))]"); + $xpathResult = $xpath->query( + "//*[@" . $attribute . " " . + "and not(contains(@" . $attribute . ", '://')) " . + "and not(starts-with(@" . $attribute . ", 'mailto:'))]"); foreach ($xpathResult as $linkNode) { $urlElement = $linkNode->attributes->getNamedItem($attribute); - $urlElement->nodeValue = $this->relativeToAbsoluteUrl( $urlElement->nodeValue, $absoluteUrl ); + $abs = $this->relativeToAbsoluteUrl( $urlElement->nodeValue, $absoluteUrl ); + $urlElement->nodeValue = htmlspecialchars($abs); } } -- cgit v1.2.3