예제 #1
0
 public static function post_photo_to_fb_by_url($data)
 {
     $data = json_decode($data);
     $flag = false;
     $facebook = new \Libs\Facebook();
     $page = \Model_Pages::find(\Fuel\Core\Input::post('page_id'));
     $flag = $facebook->post_photo_by_url($page->long_lived_access_token, $page->fanpage_id, $data);
     return $flag;
 }
예제 #2
0
 public static function filter_fb_page($user_id, $access_token)
 {
     $result = array();
     $facebook = new \Libs\Facebook();
     $pages = $facebook->get_user_pages($access_token);
     foreach ($pages as $item) {
         $item = $item->asArray();
         //Convert oject to array
         if (in_array('CREATE_CONTENT', $item['perms'])) {
             //*** Check if fanpage has added in DB
             if (empty(\Model_UserPage::find('first', array('where' => array('fanpage_id' => $item['id'], 'user_id' => $user_id))))) {
                 $result[] = array('name' => $item['name'], 'id' => $item['id'], 'access_token' => $item['access_token']);
             }
         }
     }
     return $result;
 }