function getData($number)
 {
     $data = array();
     $api = getNextendFlickr();
     if (!$api) {
         return $data;
     }
     $peoplephotostreamprivacy = intval($this->_data->get('peoplephotostreamprivacy', 1));
     $result = $api->people_getPhotos('me', array('per_page' => $number, 'privacy_filter' => $peoplephotostreamprivacy, 'extras' => 'description, date_upload, date_taken, owner_name, geo, tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o'));
     $people = array();
     foreach ($result['photos']['photo'] as $photo) {
         if (!isset($people[$photo['owner']])) {
             $people[$photo['owner']] = $api->people_getInfo($photo['owner']);
         }
         $ow = $people[$photo['owner']];
         $photo['owner_username'] = $ow['username'];
         $photo['owner_realname'] = isset($ow['realname']) ? $ow['realname'] : $ow['username'];
         $photo['owner_photosurl'] = $ow['photosurl'];
         $photo['owner_profileurl'] = $ow['profileurl'];
         $photo['image'] = isset($photo['url_o']) ? $photo['url_o'] : $photo['url_l'];
         $photo['thumbnail'] = isset($photo['url_m']) ? $photo['url_m'] : $photo['url_l'];
         $photo['url'] = $photo['owner_photosurl'];
         $photo['url_label'] = 'More photos';
         $photo['author_name'] = $photo['owner_realname'];
         $photo['author_url'] = $photo['owner_profileurl'];
         $data[] = $photo;
     }
     return $data;
 }
Example #2
0
 function fetchElement()
 {
     $this->_xml->addChild('option', 'Please choose')->addAttribute('value', '0');
     ob_start();
     $api = getNextendFlickr();
     if ($api) {
         ob_end_clean();
         $result = $api->photosets_getList('');
         if (isset($result['photoset'])) {
             if (count($result['photoset'])) {
                 foreach ($result['photoset'] as $set) {
                     $this->_xml->addChild('option', htmlentities($set['title']))->addAttribute('value', $set['id']);
                 }
             }
             $this->_value = $this->_form->get($this->_name, $this->_default);
         }
     }
     $html = parent::fetchElement();
     if (!$api) {
         $html .= ob_get_clean();
     }
     return $html;
 }
Example #3
0
 function getData($number)
 {
     $data = array();
     $photoset = $this->_data->get('peoplephotoset');
     if ($photoset) {
         $api = getNextendFlickr();
         if (!$api) {
             return $data;
         }
         $result = $api->photosets_getPhotos($photoset, 'description, date_upload, date_taken, owner_name, geo, tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o', NULL, $number);
         $people = array();
         foreach ($result['photoset']['photo'] as $photo) {
             if (!isset($people[$photo['ownername']])) {
                 $owner = $api->people_findByUsername($photo['ownername']);
                 $people[$photo['ownername']] = $api->people_getInfo($owner['nsid']);
             }
             $ow = $people[$photo['ownername']];
             $photo['owner_username'] = $ow['username'];
             $photo['owner_realname'] = isset($ow['realname']) ? $ow['realname'] : $ow['username'];
             $photo['owner_photosurl'] = $ow['photosurl'];
             $photo['owner_profileurl'] = $ow['profileurl'];
             $photo['image'] = isset($photo['url_o']) ? $photo['url_o'] : $photo['url_l'];
             $photo['thumbnail'] = isset($photo['url_m']) ? $photo['url_m'] : $photo['url_l'];
             $photo['url'] = $photo['owner_photosurl'];
             $photo['url_label'] = 'More photos';
             $photo['author_name'] = $photo['owner_realname'];
             $photo['author_url'] = $photo['owner_profileurl'];
             $data[] = $photo;
         }
     } else {
         if (NextendSmartSliderSettings::get('debugmessages', 1)) {
             echo 'Please choose a set for Flickr photoset generator!';
         }
     }
     return $data;
 }