Video Thumbnails - Version 0.6

Version Description

  • Added support for Justin.tv
  • Fixed bug that could cause a conflict with other plugins
Download this release

Release Info

Developer sutherlandboswell
Plugin Icon 128x128 Video Thumbnails
Version 0.6
Comparing to
See all releases

Code changes from version 0.5.5 to 0.6

Files changed (2) hide show
  1. readme.txt +6 -1
  2. video-thumbnails.php +23 -4
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://sutherlandboswell.com/2010/11/wordpress-video-thumbnails/
4
  Tags: Video, YouTube, Vimeo, Blip.tv, Thumbnails
5
  Requires at least: 3.0
6
  Tested up to: 3.0.3
7
- Stable tag: 0.5.5
8
 
9
  Video Thumbnails is a simple plugin that makes it easy to automatically display video thumbnails in your template.
10
 
@@ -16,6 +16,7 @@ Video Thumbnails currently supports:
16
 
17
  * YouTube
18
  * Vimeo
 
19
  * Blip.tv
20
  * [Simple Video Embedder](http://wordpress.org/extend/plugins/simple-video-embedder/)
21
  * [Vimeo Shortcode](http://blog.esimplestudios.com/2010/08/embedding-vimeo-videos-in-wordpress/)
@@ -51,6 +52,10 @@ In version 0.2 `get_video_thumbnail()` was added which returns null when no thum
51
 
52
  == Changelog ==
53
 
 
 
 
 
54
  = 0.5.5 =
55
  * Video thumbnails are now found at the time the post is saved
56
 
4
  Tags: Video, YouTube, Vimeo, Blip.tv, Thumbnails
5
  Requires at least: 3.0
6
  Tested up to: 3.0.3
7
+ Stable tag: 0.6
8
 
9
  Video Thumbnails is a simple plugin that makes it easy to automatically display video thumbnails in your template.
10
 
16
 
17
  * YouTube
18
  * Vimeo
19
+ * Justin.tv
20
  * Blip.tv
21
  * [Simple Video Embedder](http://wordpress.org/extend/plugins/simple-video-embedder/)
22
  * [Vimeo Shortcode](http://blog.esimplestudios.com/2010/08/embedding-vimeo-videos-in-wordpress/)
52
 
53
  == Changelog ==
54
 
55
+ = 0.6 =
56
+ * Added support for Justin.tv
57
+ * Fixed bug that could cause a conflict with other plugins
58
+
59
  = 0.5.5 =
60
  * Video thumbnails are now found at the time the post is saved
61
 
video-thumbnails.php CHANGED
@@ -2,10 +2,10 @@
2
  /*
3
  Plugin Name: Video Thumbnails
4
  Plugin URI: http://sutherlandboswell.com/2010/11/wordpress-video-thumbnails/
5
- Description: Make adding video thumbnails to your posts easier and automatic, just add <code>&lt;?php video_thumbnail(); ?&gt;</code> to your loop to get the thumbnail's URL. <code>&lt;?php get_video_thumbnail(); ?&gt;</code> is also available for more advanced users. Currently works with YouTube, Vimeo, and Blip.tv, along with several embedding plugins.
6
  Author: Sutherland Boswell
7
  Author URI: http://sutherlandboswell.com
8
- Version: 0.5.5
9
  License: GPL2
10
  */
11
  /* Copyright 2010 Sutherland Boswell (email : sutherland.boswell@gmail.com)
@@ -46,6 +46,12 @@ function getBliptvInfo($id) {
46
  return $thumbnail;
47
  }
48
 
 
 
 
 
 
 
49
  // The Main Event
50
  function get_video_thumbnail($post_id=null) {
51
 
@@ -151,6 +157,19 @@ function get_video_thumbnail($post_id=null) {
151
  }
152
  }
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  // Return the new thumbnail variable and update meta if one is found
155
  if($new_thumbnail!=null) {
156
  if(!update_post_meta($post_id, '_video_thumbnail', $new_thumbnail)) add_post_meta($post_id, '_video_thumbnail', $new_thumbnail);
@@ -168,9 +187,9 @@ function video_thumbnail($post_id=null) {
168
 
169
  // Create Meta Fields on Edit Page
170
 
171
- add_action("admin_init", "admin_init");
172
 
173
- function admin_init(){
174
  add_meta_box("video_thumbnail", "Video Thumbnail", "video_thumbnail_admin", "post", "side", "low");
175
  }
176
 
2
  /*
3
  Plugin Name: Video Thumbnails
4
  Plugin URI: http://sutherlandboswell.com/2010/11/wordpress-video-thumbnails/
5
+ Description: Make adding video thumbnails to your posts easier and automatic, just add <code>&lt;?php video_thumbnail(); ?&gt;</code> to your loop to get the thumbnail's URL. <code>&lt;?php get_video_thumbnail(); ?&gt;</code> is also available for more advanced users. Currently works with YouTube, Vimeo, Justin.tv, and Blip.tv, along with several embedding plugins.
6
  Author: Sutherland Boswell
7
  Author URI: http://sutherlandboswell.com
8
+ Version: 0.6
9
  License: GPL2
10
  */
11
  /* Copyright 2010 Sutherland Boswell (email : sutherland.boswell@gmail.com)
46
  return $thumbnail;
47
  }
48
 
49
+ // Justin.tv Functions
50
+ function getJustintvInfo($id) {
51
+ $xml = simplexml_load_file("http://api.justin.tv/api/clip/show/$id.xml");
52
+ return (string) $xml->clip->image_url_large;
53
+ }
54
+
55
  // The Main Event
56
  function get_video_thumbnail($post_id=null) {
57
 
157
  }
158
  }
159
 
160
+ // Justin.tv
161
+ if($new_thumbnail==null) {
162
+
163
+ // Justin.tv archive ID
164
+ preg_match('#archive_id=([0-9]+)#s', $markup, $matches);
165
+
166
+ // Now if we've found a Justin.tv archive ID, let's set the thumbnail URL
167
+ if(isset($matches[1])) {
168
+ $justin_thumbnail = getJustintvInfo($matches[1]);
169
+ $new_thumbnail = $justin_thumbnail;
170
+ }
171
+ }
172
+
173
  // Return the new thumbnail variable and update meta if one is found
174
  if($new_thumbnail!=null) {
175
  if(!update_post_meta($post_id, '_video_thumbnail', $new_thumbnail)) add_post_meta($post_id, '_video_thumbnail', $new_thumbnail);
187
 
188
  // Create Meta Fields on Edit Page
189
 
190
+ add_action("admin_init", "video_thumbnail_admin_init");
191
 
192
+ function video_thumbnail_admin_init(){
193
  add_meta_box("video_thumbnail", "Video Thumbnail", "video_thumbnail_admin", "post", "side", "low");
194
  }
195