コード例 #1
0
 function getInterestingPhotos($date = false, $offsetpage = 0, $max = 15, $usecache = true)
 {
     if ($date) {
         $time_t = strtotime($date);
     } else {
         $date = date('Y-m-d');
     }
     $auth_token = get_option('silas_flickr_token');
     if ($auth_token) {
         require_once dirname(__FILE__) . '/lib.flickr.php';
         $flickr = new TanTanFlickr();
         $flickr->setToken($auth_token);
         $flickr->setOption(array('hidePrivatePhotos' => get_option('silas_flickr_hideprivate')));
         $user = $flickr->auth_checkToken();
         $nsid = $user['user']['nsid'];
         if (!$usecache) {
             $flickr->clearCacheStale('search');
             // should probably not blanket clear out everything in 'search'
             $flickr->clearCacheStale('getInteresting');
         }
         $photos = $flickr->getInteresting(NULL, NULL, $max, $offsetpage);
         foreach ($photos as $k => $photo) {
             $photos[$k]['info'] = $flickr->getPhoto($photo['id']);
             foreach (array('Medium', 'Large', 'Original') as $size) {
                 unset($photos[$k]['sizes'][$size]);
             }
         }
         return $photos;
     } else {
         return array();
     }
 }