diff --git a/mod/display.php b/mod/display.php index 75e51d5a90..116b4a17e3 100644 --- a/mod/display.php +++ b/mod/display.php @@ -203,6 +203,10 @@ function display_content(&$a, $update = 0) { $title = trim(html2plain(bbcode($r[0]["title"], false, false), 0, true)); $author_name = $r[0]["author-name"]; + $image = ""; + if ($image == "") + $image = $r[0]["thumb"]; + if ($title == "") $title = $author_name; @@ -219,9 +223,16 @@ function display_content(&$a, $update = 0) { // Schema.org microdata $a->page['htmlhead'] .= ''."\n"; $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; + $a->page['htmlhead'] .= ''."\n"; $a->page['htmlhead'] .= ''."\n"; + // Twitter cards + $a->page['htmlhead'] .= ''."\n"; + $a->page['htmlhead'] .= ''."\n"; + $a->page['htmlhead'] .= ''."\n"; + $a->page['htmlhead'] .= ''."\n"; + $a->page['htmlhead'] .= ''."\n"; + // Dublin Core $a->page['htmlhead'] .= ''."\n"; $a->page['htmlhead'] .= ''."\n"; @@ -229,7 +240,7 @@ function display_content(&$a, $update = 0) { // Open Graph $a->page['htmlhead'] .= ''."\n"; $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; + $a->page['htmlhead'] .= ''."\n"; $a->page['htmlhead'] .= ''."\n"; $a->page['htmlhead'] .= ''."\n"; $a->page['htmlhead'] .= ''."\n"; diff --git a/mod/parse_url.php b/mod/parse_url.php index 66ad1e57ce..52083dfbcd 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -52,6 +52,9 @@ function completeurl($url, $scheme) { function parseurl_getsiteinfo($url, $no_guessing = false) { $siteinfo = array(); + + $siteinfo["type"] = "link"; + $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); @@ -165,6 +168,18 @@ function parseurl_getsiteinfo($url, $no_guessing = false) { case "description": $siteinfo["text"] = $attr["content"]; break; + case "twitter:image": + $siteinfo["image"] = $attr["content"]; + break; + case "twitter:card": + $siteinfo["type"] = $attr["content"]; + break; + case "twitter:description": + $siteinfo["text"] = $attr["content"]; + break; + case "twitter:title": + $siteinfo["title"] = $attr["content"]; + break; case "dc.title": $siteinfo["title"] = $attr["content"]; break; @@ -311,9 +326,9 @@ function parse_url_content(&$a) { logger('parse_url: ' . $url); if($textmode) - $template = '[bookmark=%s]%s[/bookmark]%s' . $br; + $template = '[bookmark=%s]%s[/bookmark]%s'; else - $template = "%s%s
"; + $template = "%s%s"; $arr = array('url' => $url, 'text' => ''); @@ -386,9 +401,10 @@ function parse_url_content(&$a) { $text = '
'.htmlspecialchars(trim($text)).'
'; } - if($image) { + if($image) $text = $br.$br.$image.$text; - } + else + $text = $br.$text; $title = str_replace(array("\r","\n"),array('',''),$title); @@ -398,7 +414,10 @@ function parse_url_content(&$a) { $sitedata .= trim($result); - echo "[class=type-link]".$sitedata."[/class]"; + if (($siteinfo["type"] != "photo")) + echo "[class=type-link]".$sitedata."[/class]"; + else + echo "[class=type-photo]".$title.$br.$image."[/class]"; killme(); } diff --git a/mod/photos.php b/mod/photos.php index 79a51fd4c9..dac6dae9be 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -49,7 +49,7 @@ function photos_init(&$a) { if($albums_visible) { $o .= '