Video Thumbnails - Version 2.0.2

Version Description

  • Added descriptive messages for errors during provider tests
  • Fix possible fatal error on activation when VimeoAPIException is already declared
  • Fix possible undefined index warnings for provider settings
Download this release

Release Info

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

Code changes from version 2.0.1 to 2.0.2

php/class-video-thumbnails-settings.php CHANGED
@@ -262,21 +262,29 @@ function scan_video_thumbnails(){
262
  $passed = 0;
263
  $failed = 0;
264
  foreach ( $video_thumbnails->providers as $provider ) {
265
- foreach ( $provider->test_cases as $test_case ) {
266
- $result = $provider->scan_for_thumbnail( $test_case['markup'] );
267
- $result = explode( '?', $result );
268
- $result = $result[0];
269
  echo '<tr>';
270
  echo '<td><strong>' . $provider->service_name . '</strong> - ' . $test_case['name'] . '</td>';
271
- if ( $result == $test_case['expected'] ) {
272
- echo '<td style="color:green;">&#10004; Passed</td>';
273
- $passed++;
274
- } else {
275
  echo '<td style="color:red;">&#10007; Failed</td>';
 
 
 
276
  $failed++;
277
- if ( is_wp_error( $result ) ) echo $result->get_error_message();
 
 
 
 
 
 
 
 
 
 
278
  }
279
- echo '<td>' . $result . '</td>';
280
  echo '</tr>';
281
  }
282
  } ?>
262
  $passed = 0;
263
  $failed = 0;
264
  foreach ( $video_thumbnails->providers as $provider ) {
265
+ foreach ( $provider->test_cases as $test_case ) {
 
 
 
266
  echo '<tr>';
267
  echo '<td><strong>' . $provider->service_name . '</strong> - ' . $test_case['name'] . '</td>';
268
+ $result = $provider->scan_for_thumbnail( $test_case['markup'] );
269
+ if ( is_wp_error( $result ) ) {
270
+ $error_string = $result->get_error_message();
 
271
  echo '<td style="color:red;">&#10007; Failed</td>';
272
+ echo '<td>';
273
+ echo '<div class="error"><p>' . $error_string . '</p></div>';
274
+ echo '</td>';
275
  $failed++;
276
+ } else {
277
+ $result = explode( '?', $result );
278
+ $result = $result[0];
279
+ if ( $result == $test_case['expected'] ) {
280
+ echo '<td style="color:green;">&#10004; Passed</td>';
281
+ $passed++;
282
+ } else {
283
+ echo '<td style="color:red;">&#10007; Failed</td>';
284
+ $failed++;
285
+ }
286
+ echo '<td>' . $result . '</td>';
287
  }
 
288
  echo '</tr>';
289
  }
290
  } ?>
php/providers/class-video-thumbnails-providers.php CHANGED
@@ -57,7 +57,8 @@ class Video_Thumbnails_Providers {
57
  }
58
 
59
  function text_setting_callback( $args ) {
60
- $html = '<input type="text" id="' . $args['slug'] . '" name="video_thumbnails[providers][' . $this->service_slug . '][' . $args['slug'] . ']" value="' . $this->options[$args['slug']] . '"/>';
 
61
  $html .= '<label for="' . $args['slug'] . '"> ' . $args['description'] . '</label>';
62
  echo $html;
63
  }
57
  }
58
 
59
  function text_setting_callback( $args ) {
60
+ $value = ( isset( $this->options[$args['slug']] ) ? $this->options[$args['slug']] : '' );
61
+ $html = '<input type="text" id="' . $args['slug'] . '" name="video_thumbnails[providers][' . $this->service_slug . '][' . $args['slug'] . ']" value="' . $value . '"/>';
62
  $html .= '<label for="' . $args['slug'] . '"> ' . $args['description'] . '</label>';
63
  echo $html;
64
  }
php/providers/class-vimeo-thumbnails.php CHANGED
@@ -72,8 +72,13 @@ class Vimeo_Thumbnails extends Video_Thumbnails_Providers {
72
 
73
  // Thumbnail URL
74
  public function get_thumbnail_url( $id ) {
 
 
 
 
 
75
  // If API credentials are entered, use the API
76
- if ( $this->options['client_id'] && $this->options['client_secret'] && $this->options['access_token'] && $this->options['access_token_secret'] ) {
77
  $vimeo = new phpVimeo( $this->options['client_id'], $this->options['client_secret'] );
78
  $vimeo->setToken( $this->options['access_token'], $this->options['access_token_secret'] );
79
  $response = $vimeo->call('vimeo.videos.getThumbnailUrls', array('video_id'=>$id));
@@ -659,8 +664,10 @@ class phpVimeo
659
 
660
  }
661
 
662
- class VimeoAPIException extends Exception {}
663
-
664
  endif;
665
 
 
 
 
 
666
  ?>
72
 
73
  // Thumbnail URL
74
  public function get_thumbnail_url( $id ) {
75
+ // Get our settings
76
+ $client_id = ( isset( $this->options['client_id'] ) && $this->options['client_id'] != '' ? $this->options['client_id'] : false );
77
+ $client_secret = ( isset( $this->options['client_secret'] ) && $this->options['client_secret'] != '' ? $this->options['client_secret'] : false );
78
+ $access_token = ( isset( $this->options['access_token'] ) && $this->options['access_token'] != '' ? $this->options['access_token'] : false );
79
+ $access_token_secret = ( isset( $this->options['access_token_secret'] ) && $this->options['access_token_secret'] != '' ? $this->options['access_token_secret'] : false );
80
  // If API credentials are entered, use the API
81
+ if ( $client_id && $client_secret && $access_token && $access_token_secret ) {
82
  $vimeo = new phpVimeo( $this->options['client_id'], $this->options['client_secret'] );
83
  $vimeo->setToken( $this->options['access_token'], $this->options['access_token_secret'] );
84
  $response = $vimeo->call('vimeo.videos.getThumbnailUrls', array('video_id'=>$id));
664
 
665
  }
666
 
 
 
667
  endif;
668
 
669
+ if( !class_exists( 'VimeoAPIException' ) ) {
670
+ class VimeoAPIException extends Exception {}
671
+ }
672
+
673
  ?>
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.1
8
 
9
  Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
10
 
@@ -96,6 +96,11 @@ The Vimeo API has a rate limit, so in rare cases you may exceed this limit. Try
96
 
97
  == Changelog ==
98
 
 
 
 
 
 
99
  = 2.0.1 =
100
  * Added support for Facebook's iFrame player
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.2
8
 
9
  Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
10
 
96
 
97
  == Changelog ==
98
 
99
+ = 2.0.2 =
100
+ * Added descriptive messages for errors during provider tests
101
+ * Fix possible fatal error on activation when VimeoAPIException is already declared
102
+ * Fix possible undefined index warnings for provider settings
103
+
104
  = 2.0.1 =
105
  * Added support for Facebook's iFrame player
106
 
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.1
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.1' );
32
 
33
  // Providers
34
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-providers.php' );
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.2
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.2' );
32
 
33
  // Providers
34
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-providers.php' );