/* Add some HTML to the existing form */
- $s .= '<div class="settings-block">';
+ $s .= '<span id="settings_fbsync_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_fbsync_expanded\'); openClose(\'settings_fbsync_inflated\');">';
$s .= '<h3>' . t('Facebook Import Settings') . '</h3>';
+ $s .= '</span>';
+ $s .= '<div id="settings_fbsync_expanded" class="settings-block" style="display: none;">';
+ $s .= '<span class="fakelink" onclick="openClose(\'settings_fbsync_expanded\'); openClose(\'settings_fbsync_inflated\');">';
+ $s .= '<h3>' . t('Facebook Import Settings') . '</h3>';
+ $s .= '</span>';
$s .= '<div id="fbsync-enable-wrapper">';
$s .= '<label id="fbsync-enable-label" for="fbsync-checkbox">' . t('Import Facebook newsfeed') . '</label>';
/* provide a submit button */
- $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="fbsync-submit" name="fbsync-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
+ $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="fbsync-submit" name="fbsync-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';
}
function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $create_user) {
+ require_once("include/oembed.php");
+
// check if it was already imported
$r = q("SELECT * FROM `item` WHERE `uid` = %d AND `uri` = '%s' LIMIT 1",
intval($uid),
$postarray["body"] = $msgdata["body"];
$postarray["tag"] = $msgdata["tags"];
- if(isset($post->attachment->name) and isset($post->attachment->href))
- $postarray["body"] .= "\n\n[bookmark=".$post->attachment->href."]".$post->attachment->name."[/bookmark]";
- elseif (isset($post->attachment->name) AND ($post->attachment->name != ""))
- $postarray["body"] .= "\n\n[b]" . $post->attachment->name."[/b]";
+ $content = "";
+ $type = "";
+
+ if (isset($post->attachment->name) and isset($post->attachment->href)) {
+ $oembed_data = oembed_fetch_url($post->attachment->href);
+ $type = $oembed_data->type;
+ $content = "[bookmark=".$post->attachment->href."]".$post->attachment->name."[/bookmark]";
+ } elseif (isset($post->attachment->name) AND ($post->attachment->name != ""))
+ $content = "[b]" . $post->attachment->name."[/b]";
$quote = "";
if(isset($post->attachment->description) and ($post->attachment->fb_object_type != "photo"))
if(isset($post->attachment->caption) and ($post->attachment->fb_object_type == "photo"))
$quote = $post->attachment->caption;
- if ($quote.$post->attachment->href.$postarray["body"] == "")
+ if ($quote.$post->attachment->href.$content.$postarray["body"] == "")
return;
- if (isset($post->attachment->media) AND !strstr($post->attachment->href, "://www.youtube.com/")
- AND !strstr($post->attachment->href, "://youtu.be/")
- AND !strstr($post->attachment->href, ".vimeo.com/")) {
+ if (isset($post->attachment->media) // AND !strstr($post->attachment->href, "://www.youtube.com/")
+ //AND !strstr($post->attachment->href, "://youtu.be/")
+ //AND !strstr($post->attachment->href, ".vimeo.com/"))
+ AND (($type == "") OR ($type == "link"))) {
foreach ($post->attachment->media AS $media) {
//$media->photo->owner = number_format($media->photo->owner, 0, '', '');
//if ($media->photo->owner != '') {
// $postarray['author-avatar'] = $contacts[$media->photo->owner]->pic_square;
//}
+ if (isset($media->type))
+ $type = $media->type;
+
if(isset($media->src) && isset($media->href) AND ($media->src != "") AND ($media->href != ""))
- $postarray["body"] .= "\n".'[url='.$media->href.'][img]'.fpost_cleanpicture($media->src).'[/img][/url]';
+ $content .= "\n".'[url='.$media->href.'][img]'.fpost_cleanpicture($media->src).'[/img][/url]';
else {
if (isset($media->src) AND ($media->src != ""))
- $postarray["body"] .= "\n".'[img]'.fpost_cleanpicture($media->src).'[/img]';
+ $content .= "\n".'[img]'.fpost_cleanpicture($media->src).'[/img]';
// if just a link, it may be a wall photo - check
if(isset($post->link))
- $postarray["body"] .= fbpost_get_photo($media->href);
+ $content .= fbpost_get_photo($media->href);
}
}
}
+ if ($content)
+ $postarray["body"] .= "\n\n";
+
+ if ($type)
+ $postarray["body"] .= "[class=type-".$type."]";
+
+ if ($content)
+ $postarray["body"] .= $content;
+
if ($quote)
- $postarray["body"] .= "\n[quote]".$quote."[/quote]";
+ $postarray["body"] .= "\n[quote]".trim($quote)."[/quote]";
+
+ if ($type)
+ $postarray["body"] .= "[/class]";
$postarray["body"] = trim($postarray["body"]);