aboutsummaryrefslogtreecommitdiffstats
path: root/include/html2plain.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-03-12 10:07:15 +0000
committerMario <mario@mariovavti.com>2021-03-12 10:07:15 +0000
commit3f053611bdbbd4a26a5d9c76a294b7ada07f0726 (patch)
treeb8b16b780d0353ede8580b41ec9e16f622c94c87 /include/html2plain.php
parentc29261487cdecda4282df25769540bc4fa20631d (diff)
parent1582b8bc9620a661823c608c0c7023a70554214b (diff)
downloadvolse-hubzilla-3f053611bdbbd4a26a5d9c76a294b7ada07f0726.tar.gz
volse-hubzilla-3f053611bdbbd4a26a5d9c76a294b7ada07f0726.tar.bz2
volse-hubzilla-3f053611bdbbd4a26a5d9c76a294b7ada07f0726.zip
Merge branch 'dev' into air
Diffstat (limited to 'include/html2plain.php')
-rw-r--r--include/html2plain.php47
1 files changed, 33 insertions, 14 deletions
diff --git a/include/html2plain.php b/include/html2plain.php
index 91a1f14cb..bf8581bdb 100644
--- a/include/html2plain.php
+++ b/include/html2plain.php
@@ -76,28 +76,47 @@ function quotelevel($message, $wraplength = 75)
return(implode("\n", $newlines));
}
+
function collecturls($message) {
+
$pattern = '/<a.*?href="(.*?)".*?>(.*?)<\/a>/is';
preg_match_all($pattern, $message, $result, PREG_SET_ORDER);
-
- $urls = array();
- foreach ($result as $treffer) {
- // A list of some links that should be ignored
- $list = array("/user/", "/tag/", "/group/", "/profile/", "/channel/", "/search?search=", "/search?tag=", "mailto:", "/u/", "/node/",
- "//facebook.com/profile.php?id=", "//plus.google.com/");
- foreach ($list as $listitem)
- if (strpos($treffer[1], $listitem) !== false)
- $ignore = true;
-
- if ((strpos($treffer[1], "//plus.google.com/") !== false) and (strpos($treffer[1], "/posts") !== false))
+
+ $urls = [];
+ if ($result) {
+ $ignore = false;
+ foreach ($result as $treffer) {
+ // A list of some links that should be ignored
+ $list = [
+ "/user/",
+ "/tag/",
+ "/group/",
+ "/profile/",
+ "/channel/",
+ "/search?search=",
+ "/search?tag=",
+ "mailto:",
+ "/u/",
+ "/node/",
+ "//facebook.com/profile.php?id=",
+ "//plus.google.com/"
+ ];
+ foreach ($list as $listitem)
+ if (strpos($treffer[1], $listitem) !== false)
+ $ignore = true;
+
+ if ((strpos($treffer[1], "//plus.google.com/") !== false) and (strpos($treffer[1], "/posts") !== false))
$ignore = false;
-
- if (!$ignore)
- $urls[$treffer[1]] = $treffer[1];
+
+ if (! $ignore)
+ $urls[$treffer[1]] = $treffer[1];
+ }
}
+
return($urls);
}
+
function html2plain($html, $wraplength = 75, $compact = false)
{