Escape special chars in og:description.

Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
Thomas Hochstein 2016-08-31 19:55:24 +02:00
parent 5af09439a1
commit 85b7a25bdb

View file

@ -154,6 +154,7 @@ class serendipity_event_social extends serendipity_event {
# /\s+/: multiple newline and whitespaces
$meta_description = trim(preg_replace('/\s+/', ' ', substr(strip_tags($entry['body']), 0, 200))) . '...';
}
$meta_description = (function_exists('serendipity_specialchars') ? serendipity_specialchars($meta_description) : htmlspecialchars($meta_description, ENT_COMPAT, LANG_CHARSET));
echo '<meta property="og:description" content="' . $meta_description . '" />' . "\n";
echo '<meta property="og:type" content="article" />' . "\n";
echo '<meta property="og:site_name" content="' . $serendipity['blogTitle'] . '" />' . "\n";