aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2019-08-09 17:05:05 +0200
committerMax Kostikov <max@kostikov.co>2019-08-09 17:05:05 +0200
commite896d316f263281c8ff1447c2eeff853f1741176 (patch)
treeee14ef0779ac6f2918606b61f6de8fe0ce3621a7 /Zotlabs
parent699aad8626e586b8d14a5fb18df30ccae4ff425e (diff)
parentaf690b64d6b0615c0f5f71ece2e2c75326d58092 (diff)
downloadvolse-hubzilla-e896d316f263281c8ff1447c2eeff853f1741176.tar.gz
volse-hubzilla-e896d316f263281c8ff1447c2eeff853f1741176.tar.bz2
volse-hubzilla-e896d316f263281c8ff1447c2eeff853f1741176.zip
Merge branch 'dev' into 'dev'
More intelligent quotation shortening while link embedding See merge request hubzilla/core!1702
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Linkinfo.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php
index b9f90deec..1551d1f26 100644
--- a/Zotlabs/Module/Linkinfo.php
+++ b/Zotlabs/Module/Linkinfo.php
@@ -275,7 +275,7 @@ class Linkinfo extends \Zotlabs\Web\Controller {
// Check codepage in HTTP headers or HTML if not exist
$cp = (preg_match('/Content-Type: text\/html; charset=(.+)\r\n/i', $header, $o) ? $o[1] : '');
if(empty($cp))
- $cp = (preg_match('/meta.+content=["|\']text\/html; charset=([^"|\']+)/i', $body, $o) ? $o[1] : 'AUTO');
+ $cp = (preg_match('/meta.+content=["\']text\/html; charset=([^"\']+)/i', $body, $o) ? $o[1] : 'AUTO');
$body = mb_convert_encoding($body, 'UTF-8', $cp);
$body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
@@ -444,8 +444,9 @@ class Linkinfo extends \Zotlabs\Web\Controller {
while (strpos($text, " "))
$text = trim(str_replace(" ", " ", $text));
-
- $siteinfo["text"] = html_entity_decode(substr($text,0,350), ENT_QUOTES, "UTF-8").'...';
+
+ $text = substr(html_entity_decode($text, ENT_QUOTES, "UTF-8"), 0, 350);
+ $siteinfo["text"] = rtrim(substr($text, 0, strrpos($text, " ")), "?.,:;!-") . '...';
}
}