From 5edeb0250b1fe1cb6b8e89282b661ab13025e7f0 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sun, 13 Oct 2019 14:27:54 +0200 Subject: Revert "Remove visible channels list from pubstream tags cloud creation procedure" This reverts commit 5c4c6e68f600d50deed8ddb32dd6702af9b52853 --- include/opengraph.php | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 include/opengraph.php (limited to 'include') diff --git a/include/opengraph.php b/include/opengraph.php new file mode 100644 index 000000000..2d72ffca1 --- /dev/null +++ b/include/opengraph.php @@ -0,0 +1,71 @@ + false ]); + $ogdesc = trim(html2plain($ogdesc, 0, true)); + $ogdesc = html_entity_decode($ogdesc, ENT_QUOTES, 'UTF-8'); + + // remove all URLs + $ogdesc = preg_replace("/https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@]+/", "", $ogdesc); + + // shorten description + $ogdesc = substr($ogdesc, 0, 300); + $ogdesc = str_replace("\n", " ", $ogdesc); + while (strpos($ogdesc, " ") !== false) + $ogdesc = str_replace(" ", " ", $ogdesc); + $ogdesc = rtrim(substr($ogdesc, 0, strrpos($ogdesc, " ")), "?.,:;!-") . "..."; + + $ogtype = "article"; + } + + $channel = channelx_by_n($profile['profile_uid']); + + if(! isset($ogdesc)) { + if($profile['about'] && perm_is_allowed($channel['channel_id'],get_observer_hash(),'view_profile')) { + $ogdesc = $profile['about']; + } + else { + $ogdesc = sprintf( t('This is the home page of %s.'), $channel['channel_name']); + } + } + + if(! isset($ogimage)) + $ogimage = $channel['xchan_photo_l']; + + App::$page['htmlhead'] .= '' . "\r\n"; + App::$page['htmlhead'] .= '' . "\r\n"; + App::$page['htmlhead'] .= '' . "\r\n"; + App::$page['htmlhead'] .= '' . "\r\n"; + App::$page['htmlhead'] .= '' . "\r\n"; + + return true; + } + \ No newline at end of file -- cgit v1.2.3