/[drupal]/contributions/modules/flickrmodule/flickr.module
ViewVC logotype

Diff of /contributions/modules/flickrmodule/flickr.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Fri Dec 24 18:32:39 2004 UTC revision 1.2, Wed Dec 29 08:00:15 2004 UTC
# Line 50  function flickr_tagify($text) { Line 50  function flickr_tagify($text) {
50    $text = preg_replace("/{{flickrnl:(.*)}}/e", "flickr_makefltag('\\1', '_m', 0)", $text);    $text = preg_replace("/{{flickrnl:(.*)}}/e", "flickr_makefltag('\\1', '_m', 0)", $text);
51    $text = preg_replace("/{{flickrtn:(.*)}}/e", "flickr_makefltag('\\1', '_s')", $text);    $text = preg_replace("/{{flickrtn:(.*)}}/e", "flickr_makefltag('\\1', '_s')", $text);
52    $text = preg_replace("/{{flickrbig:(.*)}}/e", "flickr_makefltag('\\1', '')", $text);    $text = preg_replace("/{{flickrbig:(.*)}}/e", "flickr_makefltag('\\1', '')", $text);
53      $text = preg_replace("/{{flickr_t:(.*)}}/e", "flickr_makefltag('\\1', '_t')", $text);
54      $text = preg_replace("/{{flickr_s:(.*)}}/e", "flickr_makefltag('\\1', '_s')", $text);
55      $text = preg_replace("/{{flickr_m:(.*)}}/e", "flickr_makefltag('\\1', '_m')", $text);
56    return $text;    return $text;
57  }  }
58    
# Line 87  function flickr_page() { Line 90  function flickr_page() {
90      else {      else {
91        $i = 0;        $i = 0;
92        foreach ($settree['rsp']['photosets'] as $album_id => $album_details) {        foreach ($settree['rsp']['photosets'] as $album_id => $album_details) {
93          $thumbnail = variable_get('flickr_proot','http://www.flickr.com/photos/').$album_details['primary']."_".$album_details['secret']."_s.jpg";          $output .= theme('flickr_photoset', $album_details, $album_id, "_t");
         $output .= "<div style='float: right;'><img src='".$thumbnail."' alt='".$album_details['title']."' class='kontent'></div>";  
         $output .= "<h2><a class=\"title\" href=\"". variable_get('flickr_proot','http://www.flickr.com/photos/').variable_get('flickr_uname','jluster')."/sets/". $album_id ."/\"";  
         $output .= "title=\"".$album_details['title']."\">".$album_details['title']."</a></h2>";  
         $output .= "<p>". format_plural($album_details['photos'], '1 photo', '%count photos') ." in this album (<a href='/flickr/setimages/$album_id'>view locally</a> - click title to view on Flickr).</p>";  
         $output .= "<p>".$album_details['description']."</p>";  
94        }        }
95      }      }
96      $output .= "<div style='font-size: 90%; text-align: center;'>flickr.module BETA.3, by <a href='http://www.jluster.org/'>Jonas M Luster</a></div>";      $output .= "<div style='font-size: 90%; text-align: center;'>flickr.module BETA.3, by <a href='http://www.jluster.org/'>Jonas M Luster</a></div>";
# Line 104  function flickr_page() { Line 102  function flickr_page() {
102    }    }
103  }  }
104    
105  function flickr_setimages()  function theme_flickr_photoset($album, $album_id, $tn_size="_t") {
106  {    // hand:
107      // $album == array containing album data
108      // $album_id == the Flickr ID
109      // $tn_size == set to _t, _s, _m, "", or _o
110    
111      $thumbnail = variable_get('flickr_proot','http://www.flickr.com/photos/').$album['primary']."_".$album['secret'].$tn_size.".jpg";
112      $link_to_photoset_on_flickr = variable_get('flickr_proot','http://www.flickr.com/photos/').variable_get('flickr_uname','jluster')."/sets/". $album_id;
113      $album_title = $album['title'];
114      $album_description = $album['description'];
115      $css_class = variable_get('flickr_class', 'flickr');
116    
117      // draw the thumbnail to the right.
118      $output .= "<div style='float: right;'><img src='".$thumbnail."' alt='".$album_title."' class='$class'></div>";
119    
120      $output .= "<h2>".$album_title."</h2>";
121      $output .= "<p>". format_plural($album['photos'], '1 photo', '%count photos') ." in this album (<a href='/flickr/setimages/$album_id'>view locally</a> - <a href='$link_to_photoset_on_flickr'>view on Flickr</a>).</p>";
122      $output .= "<p>$album_description</p><br clear='both' />";
123    
124      return $output;
125    }
126    
127    function flickr_setimages() {
128    if (user_access("access content")) {    if (user_access("access content")) {
129      $setid = arg(2);      $setid = arg(2);
130      $flickr_api_key = variable_get('flickr_apik','bd4441fc9cef3745a18955ffdf91c732');      $flickr_api_key = variable_get('flickr_apik','bd4441fc9cef3745a18955ffdf91c732');
# Line 125  function flickr_setimages() Line 144  function flickr_setimages()
144                    $output = "<div style='text-align: center'>";                    $output = "<div style='text-align: center'>";
145        foreach ($settree['rsp'][$setid] as $photo_id => $photo_details) {        foreach ($settree['rsp'][$setid] as $photo_id => $photo_details) {
146          $image = "http://photos".$photo_details['server'].".flickr.com/".$photo_id."_".$photo_details['secret']."_m.jpg";          $image = "http://photos".$photo_details['server'].".flickr.com/".$photo_id."_".$photo_details['secret']."_m.jpg";
147          $output .= "<a href=\"". variable_get('flickr_proot', 'http://www.flickr.com/photos/').variable_get('flickr_uname', 'jluster')."/$photo_id\"><img src=\"$image\" class='kontent'/></a>";          $output .= "<a href=\"". variable_get('flickr_proot', 'http://www.flickr.com/photos/').variable_get('flickr_uname', 'jluster')."/$photo_id\"><img src=\"$image\" class='".variable_get('flickr_class','flickr')."'/></a>";
148        }        }
149        $output .= "</div>";        $output .= "</div>";
150      }      }
# Line 137  function flickr_setimages() Line 156  function flickr_setimages()
156    }    }
157  }  }
158    
159  function flickr_get_cached_file_contents($file, $file_mode, $cache_timeout = 600, $cache_path = '../', $debug = false)  function flickr_get_cached_file_contents($file, $file_mode, $cache_timeout = 600, $cache_path = '../', $debug = false) {
 {  
160          clearstatcache();          clearstatcache();
161          $cache_filename = $cache_path . "/" . urlencode($file) .".cached"; // Path to cached file          $cache_filename = $cache_path . "/" . urlencode($file) .".cached"; // Path to cached file
162          if (( @file_exists($cache_filename) && (( @filemtime($cache_filename) + $cache_timeout) > ( time()))))          if (( @file_exists($cache_filename) && (( @filemtime($cache_filename) + $cache_timeout) > ( time()))))
# Line 158  function flickr_get_cached_file_contents Line 176  function flickr_get_cached_file_contents
176          return file_get_contents ($cache_filename); // Return the file contents from the cache          return file_get_contents ($cache_filename); // Return the file contents from the cache
177  }  }
178    
179  function flickr_make_xmltree ($data)  function flickr_make_xmltree ($data) {
 {  
180    // Yes, I know, this is slightly inflexible. This is a modified version of the WordPress FlickrXML parser. A new    // Yes, I know, this is slightly inflexible. This is a modified version of the WordPress FlickrXML parser. A new
181    // logic will be in 0.4.    // logic will be in 0.4.
182          $output = array();          $output = array();

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.2