Esempio n. 1
0
 public function getLikes()
 {
     $utility = new Utility();
     $url = 'https://api.instagram.com/v1/users/self/media/liked?access_token=' . $this->accessToken;
     $response = $utility->fetchUrlAndJsonDecode($url);
     printR($response);
     return $response;
 }
Esempio n. 2
0
 public function fetchData($url)
 {
     require_once 'vendor/yelp/OAuth.php';
     // Token object built using the OAuth library
     $token = new \Yelp\OAuthToken($this->token, $this->token_secret);
     // Consumer object built using the OAuth library
     $consumer = new \Yelp\OAuthConsumer($this->consumer_key, $this->consumer_secret);
     // Yelp uses HMAC SHA1 encoding
     $signature_method = new \Yelp\OAuthSignatureMethod_HMAC_SHA1();
     // Build OAuth Request using the OAuth PHP library. Uses the consumer and token object created above.
     $oauthrequest = \Yelp\OAuthRequest::from_consumer_and_token($consumer, $token, 'GET', $url);
     // Sign the request
     $oauthrequest->sign_request($signature_method, $consumer, $token);
     // Get the signed URL
     $signed_url = $oauthrequest->to_url();
     $utility = new Utility();
     return $utility->fetchUrlAndJsonDecode($signed_url);
 }
Esempio n. 3
0
 public function twittercronAction()
 {
     //http://www.idfromuser.com/ get twitter id from user name
     $utilObj = new Utility('twitter');
     $this->twitterBlvd = $this->serviceLocator->get('TwitterBlvd\\Model\\TwitterBlvd');
     $userIdArr = $this->twitterBlvd->getTwitterFriendIds($this->twitterBlvd->getUserId());
     // add site's twitter account to id array
     $userIdArr[] = $this->twitterBlvd->getUserId();
     // to update/test single users, use their twitter_id here
     //$userIdArr=array(11039532);
     $twitterUsersArr = $this->twitterBlvd->getTwitterFriends($userIdArr);
     foreach ($twitterUsersArr as $key => $obj) {
         $userEnt = $this->getServiceLocator()->get('TwitterBlvd\\Model\\TwitterUserMapper')->formatTwitterUser($obj);
         $userEnt = $this->getServiceLocator()->get('TwitterBlvd\\Model\\TwitterUserMapper')->saveTwitterUser($userEnt);
         if ($tweetEnt = $this->getServiceLocator()->get('TwitterBlvd\\Model\\TweetMapper')->formatTweet($obj, $userEnt)) {
             $tweetEnt->setTweet($utilObj->cleanText($tweetEnt->getTweet()));
             $this->getServiceLocator()->get('TwitterBlvd\\Model\\TweetMapper')->saveTweet($tweetEnt);
         }
     }
     return false;
 }
Esempio n. 4
0
 public function __invoke($news)
 {
     $utilityObj = new Utility('tumblr.com');
     if ($news->count() > 0) {
         echo "<div class='moduleBody' id='newsBody' style='display:none';>";
         foreach ($news as $key => $obj) {
             echo "<div class='moduleRow'>";
             if ($obj->getPhoto() != '') {
                 $img = $obj->getPhoto();
             }
             echo "<a target='_blank' href='" . $obj->getPostUrl() . "'>";
             echo "<img src='" . $img . "' width='50' height='50' style='float:left;margin:0px 2px 0px 0px;'>";
             echo "</a>";
             echo "<div class='moduleText'>";
             $text = '';
             if ($obj->getCaption() != '') {
                 $text = $obj->getCaption();
             }
             if ($obj->getTitle() != '') {
                 $text = $obj->getTitle();
             }
             if ($obj->getDescription() != '') {
                 $text = $obj->getDescription();
             }
             echo $utilityObj->parseText($text);
             echo " &nbsp; <a target='_blank' href='" . $obj->getPostUrl() . "'>More&raquo;</a>";
             echo "</div>";
             echo "<div style='clear:both;'></div>";
             echo "</div>";
         }
     } else {
         echo "<div class='moduleBodyEmpty' style='display:none;'>";
         echo "<div class='moduleRow'>No news at the moment. Check back later.</div>";
     }
     echo "</div>";
 }