You are here

function theme_flickr_flickrcomslideshow in Flickr 7

Theme Flickr set/user/group photos as an embedded Flickr.com slideshow ('size' = x).

3 theme calls to theme_flickr_flickrcomslideshow()
flickr_album in ./flickr.inc
Render multiple photos as an album.
flickr_block_photosets in block/flickr_block.module
Photoset block. Block delta: 1 and 4.
theme_flickrfield_formatter_photoset_flickrcomslideshow in field/flickrfield.module
Theme a Flickr photo set as an embedded Flickr.com slideshow.

File

./flickr.module, line 921
The Flickr module.

Code

function theme_flickr_flickrcomslideshow($variables) {
  $id = $variables['id'];
  $class = $variables['class'];
  $style = $variables['style'];
  if (isset($style)) {
    $attribs = flickr_split_style($style);
  }
  else {
    $attribs = NULL;
  }
  if (isset($attribs[0]['width'])) {
    if (strpos($attribs[0]['width'], '%') !== FALSE) {
      $width = $attribs[0]['width'];
      $div = '<div style="width: ' . (int) $width . '%;">';
      $width = '100%';
      $height = '100%';
    }
    else {
      $width = $attribs[0]['width'];
      $height = isset($attribs[0]['height']) ? $attribs[0]['height'] : round($width * variable_get('flickr_sshratio', 3) / variable_get('flickr_sswratio', 4)) . 'px';
      $div = '<div style="width: ' . (int) $width . 'px; height: ' . (int) $height . 'px;">';
    }
    $divend = '</div>';
  }
  else {
    $width = '100%';
    $height = '100%';
    $div = '';
    $divend = '';
  }
  unset($attribs[0]['width']);
  unset($attribs[0]['height']);
  $attribs = isset($attribs[0]) ? urldecode(http_build_query($attribs[0], '', '; ')) : NULL;
  $attribs = str_replace('=', ':', $attribs);
  $attribs = str_replace('"', '', $attribs);
  if (empty($id)) {
    return;
  }
  switch (flickr_get_id_type($id)) {
    case 'photoset':
      $info = flickr_photosets_getinfo($id);
      $user_id = $info['owner'];
      return $div . '<div class="flickr-slideshow ' . $class . '"><object width="' . $width . '" height="' . $height . '" style="' . $attribs . '" type="application/x-shockwave-flash" data="https://www.flickr.com/apps/slideshow/show.swf?v=71649">
    <param name="movie" value="https://www.flickr.com/apps/slideshow/show.swf?v=71649" />
    <param name="allowFullScreen" value="true" />
    <param name="wmode" value="opaque" />
    <param name="flashvars" value="offsite=true&amp;lang=en-us&amp;page_show_url=/photos/' . $user_id . '/sets/' . $id . '/show/&amp;page_show_back_url=/photos/' . $user_id . '/sets/' . $id . '/&amp;set_id=' . $id . '" /></object></div>' . $divend;
    case 'user':
      return $div . '<div class="flickr-slideshow ' . $class . '"><object width="' . $width . '" height="' . $height . '" style="' . $attribs . '" type="application/x-shockwave-flash" data="https://www.flickr.com/apps/slideshow/show.swf?v=71649">
      <param name="movie" value="https://www.flickr.com/apps/slideshow/show.swf?v=71649" />
      <param name="allowFullScreen" value="true" />
      <param name="wmode" value="opaque" />
      <param name="flashvars" value="offsite=tru&amp;lang=en-us&amp;page_show_url=%2Fphotos%2F' . $id . '%2Fshow&amp;user_id=' . $id . '" /></object></div>' . $divend;
    case 'group':
      return $div . '<div class="flickr-slideshow ' . $class . '"><object width="' . $width . '" height="' . $height . '" style="' . $attribs . '" type="application/x-shockwave-flash" data="https://www.flickr.com/apps/slideshow/show.swf?v=140556"><param name="movie" value="https://www.flickr.com/apps/slideshow/show.swf?v=140556"></param><param name="flashvars" value="offsite=true&lang=en-us&page_show_url=%2Fgroups%2F' . $id . '%2Fpool%2Fshow%2F&page_show_back_url=%2Fgroups%2F' . $id . '%2Fpool%2F&group_id=' . $id . '&jump_to=&start_index="></param><param name="allowFullScreen" value="true"><param name="wmode" value="opaque" /></param></object></div>' . $divend;
  }
  drupal_set_message(t('No valid set, user or group ID is provided for the slideshow.'), 'error');
}