From d6ff40c527f03d3430785be9de1e39f1de54a9cb Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Thu, 4 Aug 2016 12:34:19 +0200 Subject: [PATCH] [Reporterre] Replace relative image paths with absolute URL Images from their own servers are linked relatively via 'local/...' we must replace this for images to point to the correct destination. Also use strip_tags to get rid of iframes --- bridges/ReporterreBridge.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bridges/ReporterreBridge.php b/bridges/ReporterreBridge.php index f88d6d2d..b0dfb308 100644 --- a/bridges/ReporterreBridge.php +++ b/bridges/ReporterreBridge.php @@ -18,6 +18,12 @@ class ReporterreBridge extends BridgeAbstract{ } $html2->clear(); unset ($html2); + + // Replace all relative urls with absolute ones + $text = preg_replace('/(href|src)(\=[\"\'])(?!http)([^"\']+)/ims', "$1$2" . $this->getURI() . "$3", $text); + + $text = strip_tags($text, '


'); + return $text; }