Changeset 429211
- Timestamp:
- 08/26/2011 07:53:27 PM (14 years ago)
- Location:
- vimeo-album/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
vimeo-album/trunk/readme.txt
r382669 r429211 1 1 === Vimeo Album === 2 Plugin URI: http://www.robertpasquini.com/nerd/2011/vimeo_album/ 3 Description: Allows the user to embed Vimeo albums by entering a shortcode ([vimeoAlbum album_id="**id from vimeo here**"]) into the post area. 4 Contributors: Pastispractice 5 Author: Robert Pasquini 6 Donate link: http://www.robertpasquini.com/nerd/2011/vimeo_album/ 7 Tags: vimeo, album, gallery 8 Requires at least: 2.0.2 9 Tested up to: 3.1.2 10 Stable tag: 0.2 2 Contributors: pastispractice 3 Donate link: http:// 4 Tags: vimeo, album, video, plugin 5 Requires at least: 3 6 Tested up to: 3 7 Stable tag: .2 11 8 12 Create a player with an vimeo album id that has links (thumbs optional), for all videos in the album. 9 Add a vimeo player with a list of all videos in the album that load into player on click 13 10 14 11 == Description == 15 12 16 This Shortcode takes the album id from a vimeo album and creates 1 player with links for all the videos in the album. 17 It can be called multiple times and will create multiple players with links on a page. 18 19 To change the size of the videos change vidHeight and vidWidth in vimeo_album.js 20 To enable thumbnails remove the commented out line in vimeo_album.php 21 22 Don't change the structure of the area in vimeo_album.php commented like this: 23 24 //put the html on page whenever shortcode is called 25 26 unless you understand DOM and are confident you can fix the .js file 13 Add a vimeo player with a list of all videos in the album that load 14 into player on click. 27 15 28 16 29 17 == Installation == 30 18 31 1. Upload `vimeo_album` folder to the `/wp-content/plugins/` directory 19 This section describes how to install the plugin and get it working. 20 21 e.g. 22 23 1. Upload `vimeo-album` folder to the `/wp-content/plugins/` directory 32 24 2. Activate the plugin through the 'Plugins' menu in WordPress 33 3. ready to use shortcode in [vimeo_album album_id='album id from vimeo goes here'] format25 3. add shortcode tag [vimeoAlbum album_id="your_album_id"] 34 26 35 27 == Frequently Asked Questions == 36 28 37 = What about by channel or user? = 38 39 If someone else doesn't make it happen soon I may. I'm not sure I have use for those so it may be a while 40 41 = What about css = 42 43 Coming. I just got this working for my site, user friendly features are coming later 29 na 44 30 45 31 == Screenshots == 46 none47 32 33 1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from 34 the directory of the stable readme.txt, so in this case, `/tags/4.3/screenshot-1.png` (or jpg, jpeg, gif) 35 2. This is the second screen shot 48 36 49 37 == Changelog == 50 38 51 = 0. 1 =52 * vimeo_album released39 = 0.01 = 40 * initial release. 53 41 54 42 == Upgrade Notice == 55 = 0.1 = 56 * vimeo_album released 43 44 = 0.01 = 45 initial release. -
vimeo-album/trunk/vimeo_album.js
r382669 r429211 1 var $va = jQuery.noConflict(); 2 3 var vidHeight = 280; 4 var vidWidth = 504; 1 5 var embedTarget ; 2 3 4 // Tell Vimeo what function to call5 6 var oEmbedCallback = 'embedVideo' ; 6 var firstOEmbedCallback = ['embedVideo', 'test']7 8 // Set up the URL9 7 var oEmbedUrl = 'http://vimeo.com/api/oembed.json'; 10 11 // Load the first one in automatically?12 var loadFirst = true;13 8 14 9 // This function puts the video on the page 15 10 function embedVideo(video) { 16 //alert(embedTarget);17 11 var videoEmbedCode = video.html; 18 jQuery('#' + embedTarget).html(unescape(videoEmbedCode)); 19 } 12 $va(embedTarget).html(unescape(videoEmbedCode)); 13 } 14 15 // This function loads the data from Vimeo 16 function loadScript(url, embedTarget) { 17 var js = document.createElement('script'); 18 js.setAttribute('src', url); 19 if ( document.getElementsByTagName('head').item(0).lastChild.getAttribute('src') !== js.getAttribute('src')) 20 { document.getElementsByTagName('head').item(0).appendChild(js); } 21 } 22 23 function va_init() { 24 var links = $va('#content').find('.vimeo_album_wrapper').find('a.vimeoAlbumA'); 25 $va(links).click(function(e){ 26 embedTarget = '#embed'+ $va(this).closest('div').attr('id').substring(5) ; 27 loadScript(oEmbedUrl + '?url=' + $va(this).attr('href') + '&width=' + vidWidth + '&height=' + vidHeight + '&callback=' + oEmbedCallback); 28 e.preventDefault(); 29 return false; 30 }); 31 } 32 33 $va(document).ready(function() { 34 va_init(); 35 }); 36 37 20 38 21 22 // This function runs when the page loads and adds click events to the links23 function init() {24 var links = jQuery('#content').find('.vimeo_album_wrapper div:nth-child(2)').find('a');25 26 for (var i = 0; i < links.size(); i++) {27 // Load a video using oEmbed when you click on a thumb28 if (document.addEventListener) {29 links[i].addEventListener('click', function(e) {30 var link = jQuery(this).attr('href');31 embedTarget = (jQuery(this).parent().parent().parent().prev().attr('id'));32 loadScript(oEmbedUrl + '?url=' + link + '&width=504&height=280&callback=' + oEmbedCallback);33 e.preventDefault();34 return false;35 }, false);36 }37 // IE (sucks)38 else {39 links[i].attachEvent('onclick', function(e) {40 var link = e.srcElement.parentNode;41 loadScript(oEmbedUrl + '?url=' + link.href + '&width=504&height=280&callback=' + oEmbedCallback);42 return false;43 });44 }45 } // close for loop46 47 // Load in the first videos -- Uses a simpler method then the rest48 if (loadFirst) {49 embedTargetCounter = jQuery('#content').find('.vimeo_album_wrapper div:first-child');50 loadFirstLink = jQuery('#content').find('.vimeo_album_wrapper div:nth-child(2)').find('li :first') ;51 for (var i = 0; i < jQuery(embedTargetCounter).size(); i++) {52 jQuery('#' + jQuery(embedTargetCounter[i]).attr('id')).html('<iframe src="http://player.vimeo.com/video/'+ jQuery(loadFirstLink[i]).attr('href').substr(17) +'" width="504" height="280" frameborder="0"></iframe>');53 }54 }55 }56 57 // This function loads the data from Vimeo58 function loadScript(url, embedTarget) {59 var js = document.createElement('script');60 js.setAttribute('src', url);61 62 if ( document.getElementsByTagName('head').item(0).lastChild.getAttribute('src') != js.getAttribute('src'))63 {64 document.getElementsByTagName('head').item(0).appendChild(js);65 }66 67 }68 69 jQuery(document).ready(function() {70 init();71 });72 73 -
vimeo-album/trunk/vimeo_album.php
r382669 r429211 2 2 /* 3 3 Plugin Name: Vimeo Album 4 Plugin URI: http://robertpasquini.com/ nerd/2011/vimeoalbum4 Plugin URI: http://robertpasquini.com/code/VimeoAlbum 5 5 Description: Allows the user to embed Vimeo albums by entering a shortcode ([vimeoAlbum album_id="**id from vimeo here**"]) into the post area. 6 6 Author: Robert Pasquini 7 Version: 0. 17 Version: 0.2 8 8 Author URI: http://robertpasquini.com 9 9 License: GPL 2.0, @see http://www.gnu.org/licenses/gpl-2.0.html 10 10 */ 11 add_action( 'wp_print_scripts', 'enqueue_vimeo_album_scripts' ); 12 add_action( 'wp_print_styles', 'enqueue_vimeo_album_styles' ); 13 14 //http://www.lastlifemedia.com/wptest/testpluginjs.js?ver=3.2.1 15 function enqueue_vimeo_album_scripts(){ 16 wp_enqueue_script( 'vimeoalbumJs', '/wp-content/plugins/vimeo-album/vimeo_album.js', array( 'jquery' )); 17 } 18 function enqueue_vimeo_album_styles(){ 19 wp_enqueue_style( 'vimeoalbumStyle', '/wp-content/plugins/vimeo-album/vastyle.css'); 20 } 11 21 12 22 class vimeo_album { … … 14 24 function shortcode($atts, $content=null) 15 25 { 26 ob_start(); 27 require_once('/home1/drinkin3/public_html/lastlifemedia/vimeo/vimeo.php'); 28 $vimeo = new phpVimeo('9507bd0c1539525bd6af485f4736355a', 'b99cca6e700fd428'); 29 16 30 extract( shortcode_atts( array( 17 31 'album_id' => 'no album ID set, get it from vimeo', … … 35 49 36 50 // Load the videos and info 37 $videos = simplexml_load_string(curl_get($api_endpoint . 'album/' . $album_id . '/videos.xml'));51 $videos = $vimeo->call('vimeo.albums.getVideos', array('album_id' => $album_id)); 38 52 $info = simplexml_load_string(curl_get($api_endpoint . 'album/' . $album_id . '/info.xml')); 53 39 54 40 55 // Thumbnail and title and album description … … 42 57 $title = $info->album->title; 43 58 $descrip = $info->album->description; 59 $albumCover = $info->album->thumbnail_large; 44 60 61 //put the html on page whenever shortcode is called 45 62 //put the html on page whenever shortcode is called 46 63 echo "<p>".$descrip."</p> 47 64 <div class='vimeo_album_wrapper'> 48 <div id='embed".$album_id."' class='embedTargetDiv'></div> 49 <div id='thumbs".$album_id."' class='embed".$album_id."'> 65 <div id='embed".$album_id."' class='embedTargetDiv'> 66 <a href='http://vimeo.com/".$videos->videos->video[0]->id."' class='vimeoAlbumA'> 67 68 <img class='vaAlbumCover' alt='' src='".$albumCover."' /> 69 <span class='va_title'><h2>".$title."</h2></span> 70 </a> 71 72 </div> 73 <div id='thumb".$album_id."' class='embeded".$album_id."'> 50 74 <ul class='vimeo_album-ul'>"; 51 foreach ($videos->video as $video):75 foreach ($videos->videos->video as $video): 52 76 echo" 53 77 <li class='vimeo_album-li'> 54 <a href='".$video->url."' class='vimeoAlbumA'> 55 <!-- <img src='".$video->thumbnail_medium."' class='thumb' /> --> 78 <a href='http://vimeo.com/".$video->id."' class='vimeoAlbumA'> 56 79 ".$video->title." 57 80 </a> … … 64 87 "; 65 88 66 //set the location of the vimeo_album.js file 67 $jsLocation = ('"'.WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'vimeo_album.js'.'"'); 68 ?> 69 70 <script> 71 // this will check if vimeo_album.js has been loaded on a previous shortcode call 72 // and load it if it hasn't 73 if (jQuery('.vimeo_album_wrapper').attr('class') != "vimeo_album_wrapper ready"){ 74 var vimeo_album_script = document.createElement("script"); 75 vimeo_album_script.type = "text/javascript"; 76 vimeo_album_script.src = (<?php echo $jsLocation ?>); 77 document.body.appendChild(vimeo_album_script); 78 //added a class as a marker to prevent script from loading multitple times. 79 //There must be a better way to do this 80 jQuery('.vimeo_album_wrapper').addClass('ready'); 81 } 82 </script> 83 <?php 89 $output_string = ob_get_contents(); 90 91 ob_end_clean(); 92 93 return $output_string; 84 94 } 85 95 }
Note: See TracChangeset
for help on using the changeset viewer.