Video Thumbnails - Version 2.0.6

Version Description

  • Fix for "Fatal error: Cannot use object of type WP_Error as array" bug
Download this release

Release Info

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

Code changes from version 2.0.5 to 2.0.6

php/class-video-thumbnails-settings.php CHANGED
@@ -609,7 +609,7 @@ function scan_video_thumbnails(){
609
  <td></td>
610
  </tr>
611
  <tr>
612
- <td><strong>Active Providers</strong></td>
613
  <td>
614
  <?php global $video_thumbnails; ?>
615
  <?php $provider_names = array(); foreach ( $video_thumbnails->providers as $provider ) { $provider_names[] = $provider->service_name; }; ?>
609
  <td></td>
610
  </tr>
611
  <tr>
612
+ <td><strong>Providers</strong></td>
613
  <td>
614
  <?php global $video_thumbnails; ?>
615
  <?php $provider_names = array(); foreach ( $video_thumbnails->providers as $provider ) { $provider_names[] = $provider->service_name; }; ?>
php/providers/class-youtube-thumbnails.php CHANGED
@@ -47,7 +47,7 @@ class YouTube_Thumbnails extends Video_Thumbnails_Providers {
47
  public function get_thumbnail_url( $id ) {
48
  $maxres = 'http://img.youtube.com/vi/' . $id . '/maxresdefault.jpg';
49
  $response = wp_remote_head( $maxres );
50
- if ( $response['response']['code'] == '200' ) {
51
  $result = $maxres;
52
  } else {
53
  $result = 'http://img.youtube.com/vi/' . $id . '/0.jpg';
47
  public function get_thumbnail_url( $id ) {
48
  $maxres = 'http://img.youtube.com/vi/' . $id . '/maxresdefault.jpg';
49
  $response = wp_remote_head( $maxres );
50
+ if ( !is_wp_error( $response ) && $response['response']['code'] == '200' ) {
51
  $result = $maxres;
52
  } else {
53
  $result = 'http://img.youtube.com/vi/' . $id . '/0.jpg';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wie.ly/u/donate
4
  Tags: Video, Thumbnails, YouTube, Vimeo, Blip, Justin.tv, Dailymotion, Metacafe, Image, Featured Image, Post Thumbnail
5
  Requires at least: 3.1
6
  Tested up to: 3.5.1
7
- Stable tag: 2.0.5
8
 
9
  Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
10
 
@@ -96,6 +96,9 @@ The Vimeo API has a rate limit, so in rare cases you may exceed this limit. Try
96
 
97
  == Changelog ==
98
 
 
 
 
99
  = 2.0.5 =
100
  * Added support for Blip URLs
101
 
4
  Tags: Video, Thumbnails, YouTube, Vimeo, Blip, Justin.tv, Dailymotion, Metacafe, Image, Featured Image, Post Thumbnail
5
  Requires at least: 3.1
6
  Tested up to: 3.5.1
7
+ Stable tag: 2.0.6
8
 
9
  Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
10
 
96
 
97
  == Changelog ==
98
 
99
+ = 2.0.6 =
100
+ * Fix for "Fatal error: Cannot use object of type WP_Error as array" bug
101
+
102
  = 2.0.5 =
103
  * Added support for Blip URLs
104
 
video-thumbnails.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://refactored.co/plugins/video-thumbnails
5
  Description: Automatically retrieve video thumbnails for your posts and display them in your theme. Currently supports YouTube, Vimeo, Facebook, Blip.tv, Justin.tv, Dailymotion, Metacafe, Wistia, Youku, Funny or Die, and MPORA.
6
  Author: Sutherland Boswell
7
  Author URI: http://sutherlandboswell.com
8
- Version: 2.0.5
9
  License: GPL2
10
  */
11
  /* Copyright 2013 Sutherland Boswell (email : sutherland.boswell@gmail.com)
@@ -28,7 +28,7 @@ License: GPL2
28
 
29
  define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
30
  define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
31
- define( 'VIDEO_THUMBNAILS_VERSION', '2.0.5' );
32
 
33
  // Providers
34
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-providers.php' );
@@ -142,7 +142,10 @@ class Video_Thumbnails {
142
  // Filter for extensions to modify what markup is scanned
143
  $markup = apply_filters( 'video_thumbnail_markup', $markup, $post_id );
144
 
145
- foreach ( $this->providers as $key => $provider ) {
 
 
 
146
  $new_thumbnail = $provider->scan_for_thumbnail( $markup );
147
  if ( $new_thumbnail != null ) break;
148
  }
5
  Description: Automatically retrieve video thumbnails for your posts and display them in your theme. Currently supports YouTube, Vimeo, Facebook, Blip.tv, Justin.tv, Dailymotion, Metacafe, Wistia, Youku, Funny or Die, and MPORA.
6
  Author: Sutherland Boswell
7
  Author URI: http://sutherlandboswell.com
8
+ Version: 2.0.6
9
  License: GPL2
10
  */
11
  /* Copyright 2013 Sutherland Boswell (email : sutherland.boswell@gmail.com)
28
 
29
  define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
30
  define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
31
+ define( 'VIDEO_THUMBNAILS_VERSION', '2.0.6' );
32
 
33
  // Providers
34
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-providers.php' );
142
  // Filter for extensions to modify what markup is scanned
143
  $markup = apply_filters( 'video_thumbnail_markup', $markup, $post_id );
144
 
145
+ // Filter to modify providers immediately before scanning
146
+ $providers = apply_filters( 'video_thumbnail_providers_pre_scan', $this->providers );
147
+
148
+ foreach ( $providers as $key => $provider ) {
149
  $new_thumbnail = $provider->scan_for_thumbnail( $markup );
150
  if ( $new_thumbnail != null ) break;
151
  }