share: further improve og:description excerpt logic, minor layout stuff

This commit is contained in:
Andrew Dolgov 2019-03-19 20:41:38 +03:00
parent 74e8661351
commit 6ae0a3dd3e
1 changed files with 14 additions and 11 deletions

View File

@ -388,26 +388,29 @@ class Handler_Public extends Handler {
$rv .= "<!DOCTYPE html> $rv .= "<!DOCTYPE html>
<html><head> <html><head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<title>".$line["title"]."</title>". <title>".$line["title"]."</title>".
stylesheet_tag("css/default.css")." stylesheet_tag("css/default.css")."
<link rel=\"shortcut icon\" type=\"image/png\" href=\"images/favicon.png\"> <link rel='shortcut icon' type='image/png' href='images/favicon.png'>
<link rel=\"icon\" type=\"image/png\" sizes=\"72x72\" href=\"images/favicon-72px.png\">"; <link rel='icon' type='image/png' sizes='72x72' href='images/favicon-72px.png'>";
$rv .= "<meta property=\"og:title\" content=\"".htmlspecialchars(html_entity_decode($line["title"], ENT_NOQUOTES | ENT_HTML401))."\"/>\n"; $rv .= "<meta property='og:title' content=\"".htmlspecialchars(html_entity_decode($line["title"], ENT_NOQUOTES | ENT_HTML401))."\"/>\n";
//$rv .= "<meta property=\"og:site_name\" content=\"".htmlspecialchars($line["feed_title"])."\"/>\n"; $rv .= "<meta property='og:description' content=\"".
$rv .= "<meta property=\"og:description\" content=\"".
htmlspecialchars( htmlspecialchars(
preg_replace("/[\r\n\t]/", "", truncate_string(
truncate_string(strip_tags(html_entity_decode($line["content"], ENT_NOQUOTES | ENT_HTML401)), preg_replace("/[\r\n\t]/", "",
500, "...")))."\"/>\n"; preg_replace("/ {1,}/", " ",
strip_tags(html_entity_decode($line["content"], ENT_NOQUOTES | ENT_HTML401))
)
), 500, "...")
)."\"/>\n";
$rv .= "</head>"; $rv .= "</head>";
$og_image = $this->get_article_image($enclosures, $line['content'], $line["site_url"]); $og_image = $this->get_article_image($enclosures, $line['content'], $line["site_url"]);
if ($og_image) { if ($og_image) {
$rv .= "<meta property=\"og:image\" content=\"" . htmlspecialchars($og_image) . "\"/>"; $rv .= "<meta property='og:image' content=\"" . htmlspecialchars($og_image) . "\"/>";
} }
$rv .= "<body class='flat ttrss_utility ttrss_zoom'>"; $rv .= "<body class='flat ttrss_utility ttrss_zoom'>";
@ -442,7 +445,7 @@ class Handler_Public extends Handler {
/* content */ /* content */
$lang = $line['lang'] ? $line['lang'] : "en"; $lang = $line['lang'] ? $line['lang'] : "en";
$rv .= "<div class=\"content\" lang=\"$lang\">"; $rv .= "<div class='content' lang='$lang'>";
/* content body */ /* content body */