Exemplo n.º 1
0
<?php

$id = $_POST['id'];
$feed = $_POST['feed'];
$token = $_POST['token'];
$url = $_POST['url'];
$connected_user_id = $_POST['connected_user_id'];
//tell if a user is connected or no
$f1 = new Fb_ypbox();
if ($url != '') {
    $data = $f1->getDataFromUrl($url);
    $data = json_decode($data, true);
} else {
    $data = $f1->get_fb_api_results(array('object' => $id, 'connection' => $feed, 'token' => $token));
}
/*
$page_data = $f1->get_fb_api_results(array('object'=>$id, 'token'=>$token));	
echo 'Likes: <b>'.$page_data['likes'].'</b><br>';
echo 'Talking about this: <b>'.$page_data['talking_about_count'].'</b><br>';
echo 'New likes: <b>'.$page_data['new_like_count'].'</b><br>';
if($page_data['description']!='') echo 'Description: '.$page_data['description'].'<br>';
//print_r($page_data);
*/
$d1 = new Fb_ypbox_display();
$posts = $d1->formatFacebookPosts($data);
$d1->displayTimeline(array('posts' => $posts, 'user_id' => $id, 'connected_user_id' => $connected_user_id));
if ($data['paging']['next'] != '') {
    echo '<a href="#" id="loadMorePosts" data-url="' . $data['paging']['next'] . '" class="btn btn-primary">Load more</a>';
}
Exemplo n.º 2
0
<?php

$post_id = $_POST['post_id'];
$comment = $_POST['comment'];
$user_id = $_POST['user_id'];
$name = $_POST['name'];
$token = $_POST['token'];
$created = date('Y-m-d') . 'T' . date('H:i:s') . 'Z';
//$pos = strpos($post_id, '_');
//$post_id = substr($post_id, ($pos+1));
$f1 = new Fb_ypbox();
$postParms = 'access_token=' . $token . '&message=' . $comment;
$url = 'https://graph.facebook.com/' . $post_id . '/comments';
$results = $f1->postDataToURL($url, $postParms);
$results = json_decode($results, true);
if ($results['id'] != '') {
    $d1 = new Fb_ypbox_display();
    $criteria2['userid'] = $user_id;
    $criteria2['name'] = $name;
    $criteria2['comment'] = $comment;
    $criteria2['created'] = $created;
    $display = $d1->displaySingleComment($criteria2);
    echo $display;
} else {
    echo '<div>The Facebook API didn\'t allow adding this comment to this post</div>';
}
Exemplo n.º 3
0
<?php

$post_id = $_POST['post_id'];
$url = $_POST['url'];
$token = $_POST['token'];
if ($url != '') {
    $f1 = new Fb_ypbox();
    $data = $f1->getDataFromUrl($url);
    $data = json_decode($data, true);
} else {
    $f1 = new Fb_ypbox();
    $data = $f1->get_fb_api_results(array('object' => $post_id, 'connection' => 'comments', 'token' => $token));
}
//print_r($data);
if (count($data['data']) > 0) {
    $d1 = new Fb_ypbox_display();
    $comments = $d1->displayComments(array('comments' => $data['data'], 'post_id' => $post_id));
    echo $comments;
    if ($data['paging']['next'] != '') {
        echo '<div style="background: #f5f5f5; padding:5px; margin:3px;" class="moreCommentsBox">';
        echo '<a href="#" class="loadMoreCommentsBtn" data-url="' . $data['paging']['next'] . '" class="btn">Load more comments</a>';
        echo '</div>';
    }
}