Beispiel #1
0
 protected function _attach()
 {
     try {
         $sdk = new fb\SDK();
         if ($session = $sdk->obtainToken(Url::base('influencer/social/facebook/' . UserSession::get('user._id')))) {
             $token = $session->getAccessToken()->extend();
             $sdk = new fb\SDK($token);
             $profile = $sdk->getProfile();
             $pid = $profile->getId();
             $r = $sdk->getAccounts($pid)->asArray();
             $this->_display->view(array('main/app/influencer/social/facebook.php'), array('pages' => $r['data']));
         }
     } catch (fb\FacebookAccessTokenException $e) {
         Alert::once('error', 'Failed to add page: ' . $e->getMessage(), Url::base('influencer/social'));
     }
 }