Enable Opengraph - refs #5637

1.9.x
Imanol Losada 11 years ago
parent 03a607f799
commit d02a73edf9
  1. 11
      main/inc/lib/social.lib.php
  2. 2
      main/social/profile.php

@ -1479,7 +1479,8 @@ class SocialManager extends UserManager
// make the urls hyper links
$newText .= preg_replace($regExUrl, "<a target=\"_blank\" href=" . $url[0] . ">".$url[0]."</a> ", $text);
if ($count == 0) {
//$newText .= self::getHtmlByLink($url[0]);
// Comment this line to disable OpenGraph
$newText .= self::getHtmlByLink($url[0]);
}
$count++;
} else {
@ -1497,10 +1498,10 @@ class SocialManager extends UserManager
public function getHtmlByLink($link)
{
$graph = OpenGraph::fetch($link);
$title = !empty($graph->site_name) ? $graph->site_name .' : '.$graph->title : $graph->title;
$html = '<div style="border:1px solid gray">';
$html .= '<h3><a target="_blank" href="'.$link.'">' . $title . '</h3>';
$html .= empty($graph->image) ? '' : '<img alt="" src="'.$graph->image.'" height="160" >';
$title = $graph->title;
$html = '<div>';
$html .= '<a target="_blank" href="'.$link.'"><h3>'.$title.'</h3>';
$html .= empty($graph->image) ? '' : '<img alt="" src="'.$graph->image.'" height="160" ></a>';
$html .= empty($graph->description) ? '' : '<div>'.$graph->description.'</div>';
$html .= "</div>";

@ -11,7 +11,7 @@ $language_file = array('userInfo', 'index');
$cidReset = true;
require_once '../inc/global.inc.php';
// Include OpenGraph NOT AVAILABLE
// require_once api_get_path(LIBRARY_PATH) . 'opengraph/OpenGraph.php';
require_once api_get_path(LIBRARY_PATH) . 'opengraph/OpenGraph.php';
if (api_get_setting('allow_social_tool') !='true') {
$url = api_get_path(WEB_PATH).'whoisonline.php?id='.intval($_GET['u']);

Loading…
Cancel
Save