示例#1
0
 public function sharePost($data = false)
 {
     if (!$data) {
         $data = $this->post;
     }
     $facebook_token = SocialNetwork::get_access_token($data->uid, SocialNetwork::FACEBOOK);
     if ($facebook_token) {
         $facebook = new Facebook(array('appId' => FACEBOOK_APPID, 'secret' => FACEBOOK_SECRET, 'cookie' => true));
         $facebook->setAccessToken($facebook_token->accessToken);
         $facebook->api('/me/feed', 'post', array('message' => $data->title, 'link' => $data->url, 'caption' => $data->content, 'type' => 'link', 'picture' => $data->avatar));
     }
 }
示例#2
0
 public function feed()
 {
     Phalanx::loadClasses('SocialNetwork');
     $token = SocialNetwork::get_access_token(1, INSTAGRAM);
     $token = json_decode($token);
     $instagram = new Instagram($this->config);
     $instagram->setAccessToken($token->access_token);
     $popular = $instagram->getUserFeed();
     $response = json_decode($popular, true);
     foreach ($response['data'] as $each) {
         echo "<img src='{$each['images']['thumbnail']['url']}'>";
     }
 }
示例#3
0
 public function sharePost($data = false)
 {
     if (!$data) {
         $data = $this->post;
     }
     Phalanx::loadClasses("SocialNetwork");
     $twitter_token = SocialNetwork::get_access_token($data->uid, SocialNetwork::TWITTER);
     if ($twitter_token) {
         if (USE_HTTP_PROXY == 1) {
             $context = stream_context_create(array('http' => array('proxy' => HTTP_PROXY_HOST . ':' . HTTP_PROXY_PORT, 'request_fulluri' => true)));
             $short_url = file_get_contents("http://migre.me/api.txt?url=" . $data->url, false, $context);
         } else {
             $short_url = file_get_contents("http://migre.me/api.txt?url=" . $data->url);
         }
         Phalanx::loadClasses('twitteroauth', 'Twitter');
         $connection = new TwitterOAuth(TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, $twitter_token['oauth_token'], $twitter_token['oauth_token_secret']);
         Twitter::post($connection, html_entity_decode($data->title) . ' ' . $short_url . ' #Skynerd');
     }
 }