Video Thumbnails - Version 2.12

Version Description

  • Added support for Yahoo Screen
Download this release

Release Info

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

Code changes from version 2.11 to 2.12

php/providers/class-yahooscreen-thumbnails.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* Copyright 2015 Sutherland Boswell (email : sutherland.boswell@gmail.com)
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License, version 2, as
7
+ published by the Free Software Foundation.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU General Public License for more details.
13
+
14
+ You should have received a copy of the GNU General Public License
15
+ along with this program; if not, write to the Free Software
16
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ // Require thumbnail provider class
20
+ require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
21
+
22
+ class Yahooscreen_Thumbnails extends Video_Thumbnails_Provider {
23
+
24
+ // Human-readable name of the video provider
25
+ public $service_name = 'Yahoo Screen';
26
+ const service_name = 'Yahoo Screen';
27
+ // Slug for the video provider
28
+ public $service_slug = 'yahooscreen';
29
+ const service_slug = 'yahooscreen';
30
+
31
+ public static function register_provider( $providers ) {
32
+ $providers[self::service_slug] = new self;
33
+ return $providers;
34
+ }
35
+
36
+ // Regex strings
37
+ public $regexes = array(
38
+ '#(\/\/screen\.yahoo\.com\/[^.]+\.html)#' // iFrame SRC
39
+ );
40
+
41
+ // Thumbnail URL
42
+ public function get_thumbnail_url( $url ) {
43
+ $request = "http://query.yahooapis.com/v1/public/yql?q=SELECT%20*%20FROM%20html%20WHERE%20url%3D%22" . urlencode( 'http:' . $url ) . "%22%20AND%20xpath%3D%22%2F%2Fmeta%5B%40property%3D'og%3Aimage'%5D%22%20and%20compat%3D%22html5%22&format=json&callback=";
44
+ $response = wp_remote_get( $request );
45
+ if( is_wp_error( $response ) ) {
46
+ $result = $this->construct_info_retrieval_error( $request, $response );
47
+ } else {
48
+ $json = json_decode( $response['body'] );
49
+ if ( empty( $json->query->results ) ) {
50
+ $result = new WP_Error( 'yahooscreen_invalid_url', sprintf( __( 'Error retrieving video information for <a href="http:%1$s">http:%1$s</a>. Check to be sure this is a valid Yahoo Screen URL.', 'video-thumbnails' ), $url ) );
51
+ } else {
52
+ $result = $json->query->results->meta->content;
53
+ $result_array = explode( 'http://', $result );
54
+ if ( count( $result_array ) > 1 ) {
55
+ $result = 'http://' . $result_array[count( $result_array )-1];
56
+ }
57
+ }
58
+ }
59
+ return $result;
60
+ }
61
+
62
+ // Test cases
63
+ public static function get_test_cases() {
64
+ return array(
65
+ array(
66
+ 'markup' => '<iframe width="640" height="360" scrolling="no" frameborder="0" src="https://screen.yahoo.com/first-u-bitcoin-exchange-opens-140857495.html?format=embed" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" allowtransparency="true"></iframe>',
67
+ 'expected' => 'http://media.zenfs.com/en-US/video/video.abcnewsplus.com/7c70071008e3711818517f19b6ad9629',
68
+ 'expected_hash' => '22c2b172b297cf09511d832ddab7b9f5',
69
+ 'name' => __( 'iFrame Embed', 'video-thumbnails' )
70
+ ),
71
+ );
72
+ }
73
+
74
+ }
75
+
76
+ ?>
php/providers/providers.php CHANGED
@@ -36,6 +36,7 @@ require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-sapo-thumbnails.php'
36
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-ted-thumbnails.php' );
37
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-twitch-thumbnails.php' );
38
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-googledrive-thumbnails.php' );
 
39
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-livestream-thumbnails.php' );
40
  // require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-kaltura-thumbnails.php' );
41
 
@@ -59,6 +60,7 @@ add_filter( 'video_thumbnail_providers', array( 'Sapo_Thumbnails', 'register_pro
59
  add_filter( 'video_thumbnail_providers', array( 'Ted_Thumbnails', 'register_provider' ) );
60
  add_filter( 'video_thumbnail_providers', array( 'Twitch_Thumbnails', 'register_provider' ) );
61
  add_filter( 'video_thumbnail_providers', array( 'Googledrive_Thumbnails', 'register_provider' ) );
 
62
  add_filter( 'video_thumbnail_providers', array( 'Livestream_Thumbnails', 'register_provider' ) );
63
  // add_filter( 'video_thumbnail_providers', array( 'Kaltura_Thumbnails', 'register_provider' ) );
64
 
36
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-ted-thumbnails.php' );
37
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-twitch-thumbnails.php' );
38
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-googledrive-thumbnails.php' );
39
+ require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-yahooscreen-thumbnails.php' );
40
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-livestream-thumbnails.php' );
41
  // require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-kaltura-thumbnails.php' );
42
 
60
  add_filter( 'video_thumbnail_providers', array( 'Ted_Thumbnails', 'register_provider' ) );
61
  add_filter( 'video_thumbnail_providers', array( 'Twitch_Thumbnails', 'register_provider' ) );
62
  add_filter( 'video_thumbnail_providers', array( 'Googledrive_Thumbnails', 'register_provider' ) );
63
+ add_filter( 'video_thumbnail_providers', array( 'Yahooscreen_Thumbnails', 'register_provider' ) );
64
  add_filter( 'video_thumbnail_providers', array( 'Livestream_Thumbnails', 'register_provider' ) );
65
  // add_filter( 'video_thumbnail_providers', array( 'Kaltura_Thumbnails', 'register_provider' ) );
66
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wie.ly/u/donate
4
  Tags: Video, Thumbnails, YouTube, Vimeo, Vine, Twitch, Dailymotion, Youku, Rutube, Featured Image
5
  Requires at least: 3.2
6
  Tested up to: 4.1
7
- Stable tag: 2.11
8
 
9
  Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
10
 
@@ -33,6 +33,7 @@ Video Thumbnails makes it easy to automatically display video thumbnails in your
33
  * CollegeHumor
34
  * MPORA
35
  * Livestream
 
36
  * Wistia
37
  * Youku
38
  * Tudou
@@ -132,6 +133,9 @@ The Vimeo API has a rate limit, so in rare cases you may exceed this limit. Try
132
 
133
  == Changelog ==
134
 
 
 
 
135
  = 2.11 =
136
  * Added support for Livestream
137
  * Support for latest TED embed code
4
  Tags: Video, Thumbnails, YouTube, Vimeo, Vine, Twitch, Dailymotion, Youku, Rutube, Featured Image
5
  Requires at least: 3.2
6
  Tested up to: 4.1
7
+ Stable tag: 2.12
8
 
9
  Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
10
 
33
  * CollegeHumor
34
  * MPORA
35
  * Livestream
36
+ * Yahoo Screen
37
  * Wistia
38
  * Youku
39
  * Tudou
133
 
134
  == Changelog ==
135
 
136
+ = 2.12 =
137
+ * Added support for Yahoo Screen
138
+
139
  = 2.11 =
140
  * Added support for Livestream
141
  * Support for latest TED embed code
video-thumbnails.php CHANGED
@@ -5,12 +5,12 @@ Plugin URI: https://refactored.co/plugins/video-thumbnails
5
  Description: Automatically retrieve video thumbnails for your posts and display them in your theme. Supports YouTube, Vimeo, Facebook, Vine, Justin.tv, Twitch, Dailymotion, Metacafe, VK, Blip, Google Drive, Funny or Die, CollegeHumor, MPORA, Wistia, Youku, and Rutube.
6
  Author: Sutherland Boswell
7
  Author URI: http://sutherlandboswell.com
8
- Version: 2.11
9
  License: GPL2
10
  Text Domain: video-thumbnails
11
  Domain Path: /languages/
12
  */
13
- /* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
14
 
15
  This program is free software; you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License, version 2, as
@@ -30,7 +30,7 @@ Domain Path: /languages/
30
 
31
  define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
32
  define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
33
- define( 'VIDEO_THUMBNAILS_VERSION', '2.11' );
34
 
35
  // Providers
36
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/providers.php' );
5
  Description: Automatically retrieve video thumbnails for your posts and display them in your theme. Supports YouTube, Vimeo, Facebook, Vine, Justin.tv, Twitch, Dailymotion, Metacafe, VK, Blip, Google Drive, Funny or Die, CollegeHumor, MPORA, Wistia, Youku, and Rutube.
6
  Author: Sutherland Boswell
7
  Author URI: http://sutherlandboswell.com
8
+ Version: 2.12
9
  License: GPL2
10
  Text Domain: video-thumbnails
11
  Domain Path: /languages/
12
  */
13
+ /* Copyright 2015 Sutherland Boswell (email : sutherland.boswell@gmail.com)
14
 
15
  This program is free software; you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License, version 2, as
30
 
31
  define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
32
  define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
33
+ define( 'VIDEO_THUMBNAILS_VERSION', '2.12' );
34
 
35
  // Providers
36
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/providers.php' );