Changeset 74 for FlickrPublicPhotos/trunk
- Timestamp:
- 06/08/05 15:47:10 (4 years ago)
- Files:
-
- 1 modified
-
FlickrPublicPhotos/trunk/FlickrPublicPhotos.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
FlickrPublicPhotos/trunk/FlickrPublicPhotos.pl
r71 r74 1 1 # A plugin for adding "FlickrPublicPhotos" container and related tags 2 2 # 3 # Release 0.2 0 (May 26, 2005)3 # Release 0.21 (June 6, 2005) 4 4 # 5 5 # This software is provided as-is. You may use it for commercial or … … 16 16 $plugin = new MT::Plugin(); 17 17 $plugin->name("FlickrPublicPhotos Plugin"); 18 $plugin->description("Add FlickrPublicPhotos container and related tags. Version 0.2 0");18 $plugin->description("Add FlickrPublicPhotos container and related tags. Version 0.21"); 19 19 $plugin->doc_link("http://as-is.net/hacks/2005/05/flickrpublicphotos_plugin.html"); 20 20 MT->add_plugin($plugin); … … 51 51 } 52 52 my $data = $pd->data() || {}; 53 my $now = time; 53 54 if (!defined($data->{last_updated}) || !defined($data->{photos}) || 54 ( time- $data->{last_updated} >= $refresh)) {55 ($now - $data->{last_updated} >= $refresh)) { 55 56 my @photos = eval { load_photos_fapi($user); }; 56 57 # if FlickrAPI call fails, reuse cache 57 58 if (!$@ || !defined($data->{photos})) { 58 59 $data->{photos} = \@photos; 59 $data->{last_updated} = time;60 $data->{last_updated} = $now; 60 61 } 61 62 $pd->data($data); … … 128 129 129 130 my $mtime = 0; 131 my $now = time; 130 132 if ($fmgr->exists($path)) { 131 133 $mtime = (stat($path))[9]; 132 return $site_url if ($refresh && ( time- $mtime < $refresh));134 return $site_url if ($refresh && ($now - $mtime < $refresh)); 133 135 } 134 136 … … 144 146 # put_data, and if can't return original url 145 147 $fmgr->put_data($rsp->content, $path) or return $url; 146 return$site_url;148 $url = $site_url; 147 149 } elsif ($rsp->code == 304) { # not modified 148 return $site_url;149 } else { 150 return $url; 151 }150 utime $now, $now, $path; # touch it 151 $url = $site_url; 152 } 153 $url; 152 154 } 153 155
![(please configure the [header_logo] section in trac.ini)](/public/chrome/common/trac_banner.png)