og:image should be a fully qualified url

This commit is contained in:
E Camden Fisher 2013-09-12 05:26:49 -04:00
parent a33ffca69c
commit 75e10c00ba

View file

@ -371,7 +371,11 @@ class serendipity_event_facebook extends serendipity_event {
echo '<meta property="og:url" content="http' . ($_SERVER['HTTPS'] ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . htmlspecialchars($_SERVER['REQUEST_URI']) . '" />' . "\n";
if (preg_match('@<img.*src=["\'](.+)["\']@imsU', $GLOBALS['entry'][0]['body'] . $GLOBALS['entry'][0]['extended'], $im)) {
echo '<meta property="og:image" content="' . $im[1] . '" />' . "\n";
if (preg_match('/^http/i', $im[1])) {
echo '<meta property="og:image" content="' . $im[1] . '" />' . "\n";
} else {
echo '<meta property="og:image" content="http' . ($_SERVER['HTTPS'] ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $im[1] . '" />' . "\n";
}
}
return true;