A quick hack in Drupal 6 for the links would be:
<?php
function MYMODULE_filter($op, $delta=0, $format=-1, $text='') {
switch ($op) {
case 'list':
return array (0 => t('MYMODULE Open Graph Link Maker'));
case 'description':
return t('Changes links into Open Graph Link Blocks with a thumbnail, title, and description');
case 'no cache':
return FALSE;
case 'process':
return _MYMODULE_og_block($text);
case 'prepare':
return $text;
}
}
function _MYMODULE_og_block($text) {
$text = preg_replace_callback("`(<p>|<li>|[ \n\r\t\(])(www\.[a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_+~#\&=/;-])([.,?!]*?)(?=(</p>|</li>|<br\s*/?>|[ \n\r\t\)]))`i", '_MYMODULE_link_to_og', $text);
return $text;
}
function _MYMODULE_link_to_og($match) {
$all = file_get_contents('http://' . $match[2]); // alas get_meta_tags() only finds tags with name=, not property= like og: uses so we need to do this ourselves...
$title=_MYMODULE_get_og_meta('title', $all);
$image=_MYMODULE_get_og_meta('image', $all);
$description=_MYMODULE_get_og_meta('description', $all);
if ($title && $image) {
$content=$match[1];
$content.='<div style="border:1px solid grey;padding:5px;margin:5px;width:300px;">';
$content.='<img style="height:50px;width:50px;margin-right:5px;float:left" src="' . $image . '">';
$content.='<b><a target="_blank" href="http://' . $match[2] . '">' . $title . '</a></b><br>';
$content.=$description;
$content.='</div>';
$content.=$match[3];
return $content;
} else {
_filter_url_trim(NULL,72); // these might be different in D7
return _filter_url_parse_partial_links($match); // but all it does is the default behavior of changing it into a link
}
}
function _MYMODULE_get_og_meta($meta, $text) {
$foo=explode('<meta property="og:' . $meta . '" content="', $text); // I am sure someone out there can do this better with preg_replace_callback :)
$bar=explode('"', $foo[1]);
return $bar[0];
}
which looks for www.__ and creates a simple facebook like div from the facebook og: meta tags. If you wanted to get fancier, of course you could look for the first image etc in the html in a similar fashion if they weren't present.
Now, I know you said you are using drupal 7, and I think that would be just changing MYMODULE_filter() to MYMODULE_filter_info() and changing up the arrays in the return as the filtering code itself should be the same. Obviously, css style it how you want, I just threw in some quick stuff.
Also, this obviously doesn't do any of the fancy facebook ahah stuff but for something coded while watching Hawaii Five-O, I hope it helps you out a bit :)
Oh, somewhat obviously, to turn it on, you would go into your input filters and add/enable it for filtered_html, for example, and turn off the original one that changes www.__ into links so you don't refilter it again.