summaryrefslogtreecommitdiffstats
path: root/utility
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2013-09-26 22:27:48 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2013-09-26 22:28:10 +0200
commit4debca404f00a8ec04b7e60ad554c275c6f966d1 (patch)
treeb0385c2fa982c8bcaae78a3af8928e10b2bc29c9 /utility
parent008b409d77134f68b22871f1d728db1d2a4644e4 (diff)
fix relative link substition when & appears in the link
Diffstat (limited to 'utility')
-rw-r--r--utility/articleenhancer/xpatharticleenhancer.php8
1 files changed, 6 insertions, 2 deletions
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);
}
}