aboutsummaryrefslogtreecommitdiff
path: root/lib/html.php
diff options
context:
space:
mode:
authorGravatar logmanoriginal <logmanoriginal@users.noreply.github.com> 2017-02-18 13:40:58 +0100
committerGravatar logmanoriginal <logmanoriginal@users.noreply.github.com> 2017-02-18 13:40:58 +0100
commitcf7da1d41ca50ee9c772a469a83b1164da1c88cc (patch)
tree682b42c0e9c892a33fab6867e65be0b8ab7edbb7 /lib/html.php
parentbb8e7495d83e629d855c16cd148c684a05766b03 (diff)
downloadrss-bridge-cf7da1d41ca50ee9c772a469a83b1164da1c88cc.tar.gz
rss-bridge-cf7da1d41ca50ee9c772a469a83b1164da1c88cc.tar.zst
rss-bridge-cf7da1d41ca50ee9c772a469a83b1164da1c88cc.zip
[html] Fix anchors after fixing images
Anchors will be fixed in a similar way as it is done with images, so it can be done in one go.
Diffstat (limited to 'lib/html.php')
-rw-r--r--lib/html.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/html.php b/lib/html.php
index 24a2cab4..8eb0deb3 100644
--- a/lib/html.php
+++ b/lib/html.php
@@ -285,5 +285,14 @@ function defaultImageSrcTo($content, $server){
&& strpos($image->src, 'data:') === false)
$image->src = $server . $image->src;
}
+
+ foreach($content->find('a') as $anchor){
+ if(strpos($anchor->href, 'http') === false
+ && strpos($anchor->href, '//') === false
+ && strpos($anchor->href, '#') !== 0
+ && strpos($anchor->href, '?') !== 0)
+ $anchor->href = $server . $anchor->href;
+ }
+
return $content;
}