Ejemplo n.º 1
0
 /** Get response from Flickr YQL
  * @uses Pas_YqlOauth
  * @param object $access
  */
 private function getFlickr($access)
 {
     $access = (object) $access;
     if (!$this->_cache->test('flickrimagesfrontjson')) {
         $oauth = new Pas_Yql_Oauth();
         $q = 'SELECT * FROM flickr.photos.search WHERE tag_mode ="all" AND user_id="' . $this->_userID . '" AND extras="geo,license,url_sq,url_m" and api_key="' . $this->_flickrKey . '" LIMIT 8';
         $data = $oauth->execute($q, $access->access_token, $access->access_token_secret, $access->access_token_expiry, $access->handle);
         $this->_cache->save($data);
     } else {
         $data = $this->_cache->load('flickrimagesfrontjson');
     }
     if (is_array((array) $data)) {
         return $this->parseFlickr($data);
     } else {
         return false;
     }
 }
Ejemplo n.º 2
0
 /** Reverse geocode for woeid and other data
  * @param float $lat
  * @param float $lon
  * @return array|boolean
  */
 public function reverseGeoCode($lat, $lon)
 {
     if (!is_null($lat) && !is_null($lon)) {
         $key = 'geocode' . md5($lat . $lon);
         if (!($place = $this->_cache->load($key))) {
             $yql = 'SELECT * FROM geo.placefinder where text="' . $lat . ',' . $lon . '" and gflags="R"';
             //    $yql = 'SELECT * FROM xml WHERE url="http://where.yahooapis.com/geocode?location=' . $lat . '+' .  $lon
             //    . '&gflags=R&appid=' . $this->_appID . '"';
             $place = $this->_oauth->execute($yql, $this->_accessToken, $this->_accessSecret, $this->_accessExpiry, $this->_handle);
             $this->_cache->save($place);
         } else {
             $place = $this->_cache->load($key);
         }
         if (sizeof($place) > 0) {
             $place = $this->_parser->parseGeocoded($place);
             return $place;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Ejemplo n.º 3
0
 /** Get response from Flickr YQL
  * @uses Pas_YqlOauth
  * @param array $access
  */
 public function getFlickr()
 {
     $openup = $this->getAccessKeys();
     $access = (object) $openup;
     $key = md5('flickrfontrecent');
     Zend_Debug::dump($this->getFlickrConfig());
     exit;
     //        if (!($this->getCache()->test($key))) {
     $oauth = new Pas_Yql_Oauth();
     $q = 'SELECT * FROM flickr.photos.search WHERE';
     $q .= 'tag_mode ="all" AND user_id="';
     $q .= $this->getUserID();
     $q .= '" AND extras="';
     $q .= $this->getExtras();
     $q .= '" and api_key="';
     $q .= $this->getFlickrKey();
     $q .= '" LIMIT';
     $q .= $this->getLimit();
     if (!empty($access)) {
         $data = $oauth->execute($q, $access->access_token, $access->access_token_secret, $access->access_token_expiry, $access->handle);
     }
     //            $this->getCache()->save($data);
     //        } else {
     //            $data = $this->getCache()->load($key);
     //        }
     return $this->parseFlickr($data);
 }