From d84094362165524ce64fb2f0a588a376efa96c68 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 17 Jan 2012 16:30:32 -0800 Subject: use reltoabs - primarily for github activity feeds --- include/text.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 1db88ca2c..416e19927 100644 --- a/include/text.php +++ b/include/text.php @@ -1065,3 +1065,37 @@ function array_xmlify($val){ if (is_array($val)) return array_map('array_xmlify', $val); return xmlify((string) $val); } + + +function reltoabs($text, $base) +{ + if (empty($base)) + return $text; + + $base = rtrim($base,'/'); + + $base2 = $base . "/"; + + // Replace links + $pattern = "/]*) href=\"(?!http|https|\/)([^\"]*)\"/"; + $replace = "