diff options
author | Max Kostikov <max@kostikov.co> | 2019-10-11 19:29:40 +0200 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2019-10-11 19:29:40 +0200 |
commit | 3bc44ee451b5c10b1635ac340f425f2b2a98aa43 (patch) | |
tree | f1c714dd5736d0f2e56b18f9c779240f2cd2d199 /Zotlabs/Module/Channel.php | |
parent | 125de855efd5fefdd25b47e7c9c7a4eca064f2b0 (diff) | |
download | volse-hubzilla-3bc44ee451b5c10b1635ac340f425f2b2a98aa43.tar.gz volse-hubzilla-3bc44ee451b5c10b1635ac340f425f2b2a98aa43.tar.bz2 volse-hubzilla-3bc44ee451b5c10b1635ac340f425f2b2a98aa43.zip |
Minor Opengraph improvements
Diffstat (limited to 'Zotlabs/Module/Channel.php')
-rw-r--r-- | Zotlabs/Module/Channel.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index e981257bc..0121e6689 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -381,14 +381,16 @@ class Channel extends Controller { if(! empty($r[0]['title'])) $ogtitle = $r[0]['title']; - if(preg_match("/\[[zi]mg(=[0-9]+x[0-9]+)?\]([^\[]+)/is", $r[0]['body'], $matches)) + $ogdesc = str_replace("#^[", "[", $r[0]['body']); + + if(preg_match("/\[[zi]mg(=[0-9]+x[0-9]+)?\]([^\[]+)/is", $ogdesc, $matches)) $ogimage = $matches[2]; - $ogdesc = bbcode($r[0]['body'], [ 'tryoembed' => false ]); + $ogdesc = bbcode($ogdesc, [ 'tryoembed' => false ]); $ogdesc = trim(html2plain($ogdesc, 0, true)); $ogdesc = html_entity_decode($ogdesc, ENT_QUOTES, 'UTF-8'); $ogdesc = preg_replace("/https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@]+/", "", $ogdesc); - $ogdesc = substr($ogdesc, 0, 280); + $ogdesc = substr($ogdesc, 0, 300); $ogdesc = str_replace("\n", " ", $ogdesc); while (strpos($ogdesc, " ") !== false) $ogdesc = str_replace(" ", " ", $ogdesc); |