Beispiel #1
0
 function get_user_events($criteria = array())
 {
     $id = $criteria['id'];
     $connection = 'events';
     $content = parent::get_fb_api_results(array('object' => $id, 'connection' => $connection));
     $content = $this->format_fb_events($content);
     return $content;
 }
Beispiel #2
0
 function get_gallery_images($criteria = array())
 {
     $gallery_id = $criteria['gallery_id'];
     $token = $criteria['token'];
     $limit = $criteria['limit'];
     if ($gallery_id != '') {
         $results = parent::get_fb_api_results(array('connection' => 'photos', 'object' => $gallery_id, 'token' => $token, 'limit' => $limit));
     }
     return $results;
 }
Beispiel #3
0
 function getUsersListByBirthday()
 {
     $f1 = new Fb_ypbox();
     $data = $f1->get_fb_api_results(array('object' => 'me', 'connection' => 'friends?fields=id,name,username,birthday,gender'));
     $users_list = $this->formatBirthdays($data);
     //Get array of next birthdays
     //Returned values: user_id => next birthday timestamp
     if (count($users_list) > 0) {
         $i = 0;
         foreach ($users_list as $value) {
             $birthday = strtotime(date('Y') . '/' . $value['month'] . '/' . $value['day']);
             $now = time() - 36000;
             //echo date('Y-m-d H:i:s', $now);
             if ($now >= $birthday) {
                 $birthday = strtotime(date('Y') + 1 . '/' . $value['month'] . '/' . $value['day']);
                 $coming_birthdays[$value['id']] = $birthday;
             } else {
                 $coming_birthdays[$value['id']] = $birthday;
             }
         }
     }
     asort($coming_birthdays);
     //Get array of all the birthdays of the year
     //Returned values: user_id => birthday timestamp
     if (count($users_list) > 0) {
         $i = 0;
         foreach ($users_list as $value) {
             $birthday = strtotime(date('Y') . '-' . $value['month'] . '-' . $value['day']);
             $ordered_birthdays[$value['id']] = $birthday;
         }
     }
     asort($ordered_birthdays);
     //print_r($coming_birthdays);
     //Order users list by birthday date (January to December)
     if (count($ordered_birthdays) > 0) {
         foreach ($ordered_birthdays as $ind => $value) {
             $tmpTab[$ind] = $users_list[$ind];
         }
     }
     $users_list = $tmpTab;
     $data['users_list'] = $users_list;
     $data['coming_birthdays'] = $coming_birthdays;
     $data['users_by_month_birthday'] = $this->getUsersByMonthBirthday($users_list);
     return $data;
 }
Beispiel #4
0
<?php

$token = $_POST['token'];
$url = $_POST['url'];
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' => $id, 'connection' => 'taggable_friends', 'token' => $token));
}
//print_r($data);
$friends = $data['data'];
if ($url == '' && count($friends) > 0) {
    echo '<div><h3>' . count($friends) . ' friends</h3></div>';
}
for ($i = 0; $i < count($friends); $i++) {
    $id = $friends[$i]['id'];
    $name = $friends[$i]['name'];
    $image = $friends[$i]['picture']['data']['url'];
    echo '<div style="position:relative; overflow:hidden;">';
    echo '<img src="' . $image . '" style="margin-right:10px; margin-bottom:10px; float:left;">';
    echo '<div>' . $name . '</div>';
    echo '<span style="position:absolute; right:0px; top:15px;">';
    echo '</span>';
    echo '</div>';
    echo '<hr style="margin-top:0px; margin-bottom:5px;">';
}
if ($data['paging']['next'] != '') {
    echo '<div id="displayMoreFriendsBox"><a href="#" class="loadMoreFriendsBtn btn" data-url="' . $data['paging']['next'] . '" class="btn">Load more</a></div>';
Beispiel #5
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>';
}
<?php

$token = $_POST['token'];
$f1 = new Fb_ypbox();
$data = $f1->get_fb_api_results(array('object' => 'me', 'connection' => 'friends?fields=id,name,username,birthday', 'token' => $token));
//echo count($data['data']).'<br>';
$data = formatBirthdays($data);
print_r($data);
Beispiel #7
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>';
    }
}