Advertisement
Adam_Wadsworth

Vimeo

Dec 7th, 2011
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. <!-- Vimeo Requirements -->
  2.  
  3. <?php
  4. $vimeo_video_id = get_post_meta($post->ID, '_cmb_vimeo_video_id', true);
  5. if ($vimeo_video_id){ ?>
  6.  
  7. <?php
  8. $api_endpoint = 'http://vimeo.com/api/v2/';
  9. function curl_get($url) {
  10. $curl = curl_init($url);
  11. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  12. curl_setopt($curl, CURLOPT_TIMEOUT, 30);
  13. $return = curl_exec($curl);
  14. curl_close($curl);
  15. return $return;
  16. }
  17. if ($_GET['album']) {
  18. $vimeo_user_name = ($_GET['user']) ? $_GET['user'] : $vimeo_video_id; // Username
  19. $videos = simplexml_load_string(curl_get($api_endpoint.$vimeo_user_name . '/videos.xml'));
  20. $image = $videos->video[0]->user_portrait_medium;
  21. $title = $videos->video[0]->user_name . "'s Videos";
  22. }
  23. else
  24. {
  25. $vimeo_user_name = ($_GET['user']) ? $_GET['user'] : $vimeo_video_id; // Username
  26. $videos = simplexml_load_string(curl_get($api_endpoint.$vimeo_user_name . '/videos.xml'));
  27. $image = $videos->video[0]->user_portrait_medium;
  28. $title = $videos->video[0]->user_name . "'s Videos";
  29. }
  30. ?>
  31. <div class="container">
  32. <div class="am-container" id="am-container">
  33. <?php foreach ($videos->video as $video): ?>
  34. <a href="http://player.vimeo.com/video/<?php echo $video->id ?>?title=0&amp;byline=0&amp;portrait=0" class="iframe" title="<?php echo $video->title ?>">
  35. <img src="<?php bloginfo('template_directory'); ?>/php/timthumb.php?src=<?php echo $video->thumbnail_medium ?>&w=275&h=205&s=1" class="thumb" alt="<?php echo $video->title ?>"></img>
  36. </a>
  37. <?php endforeach ?>
  38. </div>
  39. </div>
  40. <?php } else { ?>
  41. <?php } ?>
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement