Version Description
- Improved Facebook detection
- Higher resolution Facebook thumbnails (when available)
Download this release
Release Info
Developer | sutherlandboswell |
Plugin | Video Thumbnails |
Version | 2.7.8 |
Comparing to | |
See all releases |
Code changes from version 2.7.7 to 2.7.8
- php/providers/class-facebook-thumbnails.php +20 -5
- readme.txt +5 -1
- video-thumbnails.php +2 -2
php/providers/class-facebook-thumbnails.php
CHANGED
@@ -35,13 +35,28 @@ class Facebook_Thumbnails extends Video_Thumbnails_Providers {
|
|
35 |
|
36 |
// Regex strings
|
37 |
public $regexes = array(
|
38 |
-
'#
|
39 |
-
'#
|
40 |
);
|
41 |
|
42 |
// Thumbnail URL
|
43 |
public static function get_thumbnail_url( $id ) {
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
|
47 |
// Test cases
|
@@ -50,13 +65,13 @@ class Facebook_Thumbnails extends Video_Thumbnails_Providers {
|
|
50 |
array(
|
51 |
'markup' => '<object width=420 height=180><param name=allowfullscreen value=true></param><param name=allowscriptaccess value=always></param><param name=movie value="http://www.facebook.com/v/2560032632599"></param><embed src="http://www.facebook.com/v/2560032632599" type="application/x-shockwave-flash" allowscriptaccess=always allowfullscreen=true width=420 height=180></embed></object>',
|
52 |
'expected' => 'https://graph.facebook.com/2560032632599/picture',
|
53 |
-
'expected_hash' => '
|
54 |
'name' => __( 'Flash Embed', 'video-thumbnails' )
|
55 |
),
|
56 |
array(
|
57 |
'markup' => '<iframe src="https://www.facebook.com/video/embed?video_id=2560032632599" width="960" height="720" frameborder="0"></iframe>',
|
58 |
'expected' => 'https://graph.facebook.com/2560032632599/picture',
|
59 |
-
'expected_hash' => '
|
60 |
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
61 |
),
|
62 |
);
|
35 |
|
36 |
// Regex strings
|
37 |
public $regexes = array(
|
38 |
+
'#http://www\.facebook\.com/v/([0-9]+)#', // Flash Embed
|
39 |
+
'#https?://www\.facebook\.com/video/embed\?video_id=([0-9]+)#' // iFrame Embed
|
40 |
);
|
41 |
|
42 |
// Thumbnail URL
|
43 |
public static function get_thumbnail_url( $id ) {
|
44 |
+
$request = 'https://graph.facebook.com/' . $id . '/picture?redirect=false';
|
45 |
+
$response = wp_remote_get( $request, array( 'sslverify' => false ) );
|
46 |
+
if( is_wp_error( $response ) ) {
|
47 |
+
$result = $this->construct_info_retrieval_error( $request, $response );
|
48 |
+
} else {
|
49 |
+
$result = json_decode( $response['body'] );
|
50 |
+
$result = $result->data->url;
|
51 |
+
$high_res = str_replace( '_t.jpg', '_b.jpg', $result);
|
52 |
+
if ( $high_res != $result ) {
|
53 |
+
$response = wp_remote_head( $high_res );
|
54 |
+
if ( !is_wp_error( $response ) && $response['response']['code'] == '200' ) {
|
55 |
+
$result = $high_res;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
return $result;
|
60 |
}
|
61 |
|
62 |
// Test cases
|
65 |
array(
|
66 |
'markup' => '<object width=420 height=180><param name=allowfullscreen value=true></param><param name=allowscriptaccess value=always></param><param name=movie value="http://www.facebook.com/v/2560032632599"></param><embed src="http://www.facebook.com/v/2560032632599" type="application/x-shockwave-flash" allowscriptaccess=always allowfullscreen=true width=420 height=180></embed></object>',
|
67 |
'expected' => 'https://graph.facebook.com/2560032632599/picture',
|
68 |
+
'expected_hash' => 'fa4a6b4b7a0f056a7558dc9ccacb34c3',
|
69 |
'name' => __( 'Flash Embed', 'video-thumbnails' )
|
70 |
),
|
71 |
array(
|
72 |
'markup' => '<iframe src="https://www.facebook.com/video/embed?video_id=2560032632599" width="960" height="720" frameborder="0"></iframe>',
|
73 |
'expected' => 'https://graph.facebook.com/2560032632599/picture',
|
74 |
+
'expected_hash' => 'fa4a6b4b7a0f056a7558dc9ccacb34c3',
|
75 |
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
76 |
),
|
77 |
);
|
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: 3.9
|
7 |
-
Stable tag: 2.7.
|
8 |
|
9 |
Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
|
10 |
|
@@ -130,6 +130,10 @@ The Vimeo API has a rate limit, so in rare cases you may exceed this limit. Try
|
|
130 |
|
131 |
== Changelog ==
|
132 |
|
|
|
|
|
|
|
|
|
133 |
= 2.7.7 =
|
134 |
* Improved error handling
|
135 |
* Fixed bugs
|
4 |
Tags: Video, Thumbnails, YouTube, Vimeo, Vine, Twitch, Dailymotion, Youku, Rutube, Featured Image
|
5 |
Requires at least: 3.2
|
6 |
Tested up to: 3.9
|
7 |
+
Stable tag: 2.7.8
|
8 |
|
9 |
Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
|
10 |
|
130 |
|
131 |
== Changelog ==
|
132 |
|
133 |
+
= 2.7.8 =
|
134 |
+
* Improved Facebook detection
|
135 |
+
* Higher resolution Facebook thumbnails (when available)
|
136 |
+
|
137 |
= 2.7.7 =
|
138 |
* Improved error handling
|
139 |
* Fixed bugs
|
video-thumbnails.php
CHANGED
@@ -5,7 +5,7 @@ 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.7.
|
9 |
License: GPL2
|
10 |
Text Domain: video-thumbnails
|
11 |
Domain Path: /languages/
|
@@ -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.7.
|
34 |
|
35 |
// Providers
|
36 |
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. 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.7.8
|
9 |
License: GPL2
|
10 |
Text Domain: video-thumbnails
|
11 |
Domain Path: /languages/
|
30 |
|
31 |
define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
|
32 |
define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
|
33 |
+
define( 'VIDEO_THUMBNAILS_VERSION', '2.7.8' );
|
34 |
|
35 |
// Providers
|
36 |
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-providers.php' );
|