Escape special chars in description.
Quotes in a manually supplied description - or the first 200 characters of the entry body - have to be escaped before the text can become the content attribute of the og:description meta tag. It doesn't hurt to escape everything, then. Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
parent
e8d30987df
commit
c118fcbab8
1 changed files with 1 additions and 0 deletions
|
@ -154,6 +154,7 @@ class serendipity_event_social extends serendipity_event {
|
||||||
# /\s+/: multiple newline and whitespaces
|
# /\s+/: multiple newline and whitespaces
|
||||||
$meta_description = trim(preg_replace('/\s+/', ' ', substr(strip_tags($entry['body']), 0, 200))) . '...';
|
$meta_description = trim(preg_replace('/\s+/', ' ', substr(strip_tags($entry['body']), 0, 200))) . '...';
|
||||||
}
|
}
|
||||||
|
$meta_description = serendipity_specialchars($meta_description);
|
||||||
echo '<meta property="og:description" content="' . $meta_description . '" />' . "\n";
|
echo '<meta property="og:description" content="' . $meta_description . '" />' . "\n";
|
||||||
echo '<meta property="og:type" content="article" />' . "\n";
|
echo '<meta property="og:type" content="article" />' . "\n";
|
||||||
echo '<meta property="og:site_name" content="' . $serendipity['blogTitle'] . '" />' . "\n";
|
echo '<meta property="og:site_name" content="' . $serendipity['blogTitle'] . '" />' . "\n";
|
||||||
|
|
Loading…
Reference in a new issue