if ($this->content !== NULL) {
return $this->content;
}
-
+
$tagid = optional_param('id', 0, PARAM_INT); // tag id
//include related tags in the photo query ?
$tags_csv .= ',' . tag_names_csv( get_item_tags('tag',$tagid));
}
$tags_csv = urlencode($tags_csv);
-
+
//number of photos to display
$numberofphotos = DEFAULT_NUMBER_OF_PHOTOS;
if( !empty($this->config->numberofphotos)) {
$sortby = $this->config->sortby;
}
-
//pull photos from a specific photoset
if(!empty($this->config->photoset)){
$request .= '&photoset_id='.$this->config->photoset;
$request .= '&per_page='.$numberofphotos;
$request .= '&format=php_serial';
-
+
$response = $this->fetch_request($request);
-
+
$search = unserialize($response);
foreach ($search['photoset']['photo'] as $p){
$p['owner'] = $search['photoset']['owner'];
}
-
+
$photos = array_values($search['photoset']['photo']);
-
+
}
//search for photos tagged with $tags_csv
else{
$request .= '&per_page='.$numberofphotos;
$request .= '&sort='.$sortby;
$request .= '&format=php_serial';
-
+
$response = $this->fetch_request($request);
-
+
$search = unserialize($response);
- $photos = array_values($search['photos']['photo']);
-
-
+ $photos = array_values($search['photos']['photo']);
}
-
+
if(strcmp($search['stat'], 'ok') != 0) return; //if no results were returned, exit...
$this->content->footer = '';
return $this->content;
-
}
-
- function fetch_request($request){
-
+
+ function fetch_request($request){
global $CFG;
make_upload_directory('/cache/flickr');
-
+
$cache = new RSSCache($CFG->dataroot . '/cache/flickr', FLICKR_CACHE_EXPIRATION);
$cache_status = $cache->check_cache( $request);
return $response;
}
-
+
function build_photo_url ($photo, $size='medium') {
//receives an array (can use the individual photo data returned
//from an API call) and returns a URL (doesn't mean that the
'large' => '_b',
'original' => '_o'
);
-
+
$size = strtolower($size);
if (!array_key_exists($size, $sizes)) {
$size = 'medium';
}
-
+
if ($size == 'original') {
$url = 'http://farm' . $photo['farm'] . '.static.flickr.com/' . $photo['server'] . '/' . $photo['id'] . '_' . $photo['originalsecret'] . '_o' . '.' . $photo['originalformat'];
} else {
return $url;
}
}
+
?>
function get_content() {
-
if ($this->content !== NULL) {
return $this->content;
}
-
if(!empty($this->config->playlist)){
//videos from a playlist
$text = $this->get_videos_by_playlist();
$this->content->footer = '';
return $this->content;
-
}
function get_videos_by_playlist(){
$request .= "&per_page={$numberofvideos}";
return $this->fetch_request($request);
-
}
function get_videos_by_tag(){
$request .= "&per_page={$numberofvideos}";
return $this->fetch_request($request);
-
}
function get_videos_by_tag_and_category(){
$xmlobj = XML_unserialize($cached_response);
return $this->render_video_list($xmlobj);
-
}
if ( $cache_status == 'STALE' ) {