Version Description
- Support for TED when using foreign languages
Download this release
Release Info
Developer | sutherlandboswell |
Plugin | Video Thumbnails |
Version | 2.12.1 |
Comparing to | |
See all releases |
Code changes from version 2.12 to 2.12.1
- php/providers/class-ted-thumbnails.php +8 -2
- readme.txt +4 -1
- video-thumbnails.php +39 -9
php/providers/class-ted-thumbnails.php
CHANGED
@@ -35,7 +35,7 @@ class Ted_Thumbnails extends Video_Thumbnails_Provider {
|
|
35 |
|
36 |
// Regex strings
|
37 |
public $regexes = array(
|
38 |
-
'#//embed(?:\-ssl)?\.ted\.com/talks/([A-Za-z0-9_-]+)\.html#', // iFrame SRC
|
39 |
);
|
40 |
|
41 |
// Thumbnail URL
|
@@ -56,10 +56,16 @@ class Ted_Thumbnails extends Video_Thumbnails_Provider {
|
|
56 |
return array(
|
57 |
array(
|
58 |
'markup' => '<iframe src="http://embed.ted.com/talks/kitra_cahana_stories_of_the_homeless_and_hidden.html" width="640" height="360" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
|
59 |
-
'expected' => 'http://images.ted.com/images/ted/341053090f8bac8c324c75be3114b673b4355e8a_480x360.jpg',
|
60 |
'expected_hash' => 'f2a5f6af49e841b4f9c7b95d6ca0372a',
|
61 |
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
62 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
);
|
64 |
}
|
65 |
|
35 |
|
36 |
// Regex strings
|
37 |
public $regexes = array(
|
38 |
+
'#//embed(?:\-ssl)?\.ted\.com/talks/(?:lang/[A-Za-z_-]+/)?([A-Za-z0-9_-]+)\.html#', // iFrame SRC
|
39 |
);
|
40 |
|
41 |
// Thumbnail URL
|
56 |
return array(
|
57 |
array(
|
58 |
'markup' => '<iframe src="http://embed.ted.com/talks/kitra_cahana_stories_of_the_homeless_and_hidden.html" width="640" height="360" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
|
59 |
+
'expected' => 'http://images.ted.com/images/ted/341053090f8bac8c324c75be3114b673b4355e8a_480x360.jpg?lang=en',
|
60 |
'expected_hash' => 'f2a5f6af49e841b4f9c7b95d6ca0372a',
|
61 |
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
62 |
),
|
63 |
+
array(
|
64 |
+
'markup' => '<iframe src="https://embed-ssl.ted.com/talks/lang/fr-ca/shimpei_takahashi_play_this_game_to_come_up_with_original_ideas.html" width="640" height="360" frameborder="0" scrolling="no" allowfullscreen="allowfullscreen"></iframe>',
|
65 |
+
'expected' => 'http://images.ted.com/images/ted/b1f1183311cda4df9e1b65f2b363e0b806bff914_480x360.jpg?lang=en',
|
66 |
+
'expected_hash' => 'ff47c99c9eb95e3d6c4b986b18991f22',
|
67 |
+
'name' => __( 'Custom Language', 'video-thumbnails' )
|
68 |
+
),
|
69 |
);
|
70 |
}
|
71 |
|
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.12
|
8 |
|
9 |
Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
|
10 |
|
@@ -133,6 +133,9 @@ The Vimeo API has a rate limit, so in rare cases you may exceed this limit. Try
|
|
133 |
|
134 |
== Changelog ==
|
135 |
|
|
|
|
|
|
|
136 |
= 2.12 =
|
137 |
* Added support for Yahoo Screen
|
138 |
|
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.1
|
8 |
|
9 |
Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
|
10 |
|
133 |
|
134 |
== Changelog ==
|
135 |
|
136 |
+
= 2.12.1 =
|
137 |
+
* Support for TED when using foreign languages
|
138 |
+
|
139 |
= 2.12 =
|
140 |
* Added support for Yahoo Screen
|
141 |
|
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.12
|
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.12' );
|
34 |
|
35 |
// Providers
|
36 |
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/providers.php' );
|
@@ -103,6 +103,10 @@ class Video_Thumbnails {
|
|
103 |
add_management_page( __( 'Bulk Video Thumbnails', 'video-thumbnails' ), __( 'Bulk Video Thumbs', 'video-thumbnails' ), 'manage_options', 'video-thumbnails-bulk', array( &$this, 'bulk_scanning_page' ) );
|
104 |
}
|
105 |
|
|
|
|
|
|
|
|
|
106 |
function admin_scripts( $hook ) {
|
107 |
// Bulk tool page
|
108 |
if ( 'tools_page_video-thumbnails-bulk' == $hook ) {
|
@@ -127,7 +131,9 @@ class Video_Thumbnails {
|
|
127 |
}
|
128 |
}
|
129 |
|
130 |
-
|
|
|
|
|
131 |
function meta_box_init() {
|
132 |
if ( is_array( $this->settings->options['post_types'] ) ) {
|
133 |
foreach ( $this->settings->options['post_types'] as $type ) {
|
@@ -136,7 +142,9 @@ class Video_Thumbnails {
|
|
136 |
}
|
137 |
}
|
138 |
|
139 |
-
|
|
|
|
|
140 |
function meta_box() {
|
141 |
global $post;
|
142 |
// Add hidden troubleshooting info
|
@@ -243,7 +251,11 @@ class Video_Thumbnails {
|
|
243 |
return $thumbnail;
|
244 |
}
|
245 |
|
246 |
-
|
|
|
|
|
|
|
|
|
247 |
function get_video_thumbnail( $post_id = null ) {
|
248 |
|
249 |
// Get the post ID if none is provided
|
@@ -340,7 +352,12 @@ class Video_Thumbnails {
|
|
340 |
return $filename;
|
341 |
}
|
342 |
|
343 |
-
|
|
|
|
|
|
|
|
|
|
|
344 |
public static function save_to_media_library( $image_url, $post_id ) {
|
345 |
|
346 |
$error = '';
|
@@ -418,9 +435,11 @@ class Video_Thumbnails {
|
|
418 |
|
419 |
return $attach_id;
|
420 |
|
421 |
-
}
|
422 |
|
423 |
-
|
|
|
|
|
424 |
function ajax_reset_script() {
|
425 |
echo '<!-- Video Thumbnails Ajax Search -->' . PHP_EOL;
|
426 |
echo '<script type="text/javascript">' . PHP_EOL;
|
@@ -437,7 +456,9 @@ class Video_Thumbnails {
|
|
437 |
echo '</script>' . PHP_EOL;
|
438 |
}
|
439 |
|
440 |
-
|
|
|
|
|
441 |
function ajax_reset_callback() {
|
442 |
global $wpdb; // this is how you get access to the database
|
443 |
|
@@ -458,6 +479,9 @@ class Video_Thumbnails {
|
|
458 |
die();
|
459 |
}
|
460 |
|
|
|
|
|
|
|
461 |
function bulk_posts_query_callback() {
|
462 |
// Some default args
|
463 |
$args = array(
|
@@ -476,6 +500,9 @@ class Video_Thumbnails {
|
|
476 |
die();
|
477 |
}
|
478 |
|
|
|
|
|
|
|
479 |
function get_thumbnail_for_post_callback() {
|
480 |
|
481 |
$post_id = $_POST['post_id'];
|
@@ -504,6 +531,9 @@ class Video_Thumbnails {
|
|
504 |
die();
|
505 |
}
|
506 |
|
|
|
|
|
|
|
507 |
function bulk_scanning_page() {
|
508 |
|
509 |
if ( ! current_user_can( 'manage_options' ) ) {
|
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.1
|
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.12.1' );
|
34 |
|
35 |
// Providers
|
36 |
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/providers.php' );
|
103 |
add_management_page( __( 'Bulk Video Thumbnails', 'video-thumbnails' ), __( 'Bulk Video Thumbs', 'video-thumbnails' ), 'manage_options', 'video-thumbnails-bulk', array( &$this, 'bulk_scanning_page' ) );
|
104 |
}
|
105 |
|
106 |
+
/**
|
107 |
+
* Enqueues necessary admin scripts
|
108 |
+
* @param string $hook A hook for the current admin page
|
109 |
+
*/
|
110 |
function admin_scripts( $hook ) {
|
111 |
// Bulk tool page
|
112 |
if ( 'tools_page_video-thumbnails-bulk' == $hook ) {
|
131 |
}
|
132 |
}
|
133 |
|
134 |
+
/**
|
135 |
+
* Initialize meta box on edit page
|
136 |
+
*/
|
137 |
function meta_box_init() {
|
138 |
if ( is_array( $this->settings->options['post_types'] ) ) {
|
139 |
foreach ( $this->settings->options['post_types'] as $type ) {
|
142 |
}
|
143 |
}
|
144 |
|
145 |
+
/**
|
146 |
+
* Renders the video thumbnail meta box
|
147 |
+
*/
|
148 |
function meta_box() {
|
149 |
global $post;
|
150 |
// Add hidden troubleshooting info
|
251 |
return $thumbnail;
|
252 |
}
|
253 |
|
254 |
+
/**
|
255 |
+
* Finds the video thumbnail for a post, saves/sets as featured image if enabled, saves image URL to custom field and then returns the URL
|
256 |
+
* @param int $post_id An optional post ID (can be left blank in a loop)
|
257 |
+
* @return mixed A string with an image URL if successful or null if there is no video thumbnail
|
258 |
+
*/
|
259 |
function get_video_thumbnail( $post_id = null ) {
|
260 |
|
261 |
// Get the post ID if none is provided
|
352 |
return $filename;
|
353 |
}
|
354 |
|
355 |
+
/**
|
356 |
+
* Saves a remote image to the media library
|
357 |
+
* @param string $image_url URL of the image to save
|
358 |
+
* @param int $post_id ID of the post to attach image to
|
359 |
+
* @return int ID of the attachment
|
360 |
+
*/
|
361 |
public static function save_to_media_library( $image_url, $post_id ) {
|
362 |
|
363 |
$error = '';
|
435 |
|
436 |
return $attach_id;
|
437 |
|
438 |
+
}
|
439 |
|
440 |
+
/**
|
441 |
+
* Ajax reset script for post editor
|
442 |
+
*/
|
443 |
function ajax_reset_script() {
|
444 |
echo '<!-- Video Thumbnails Ajax Search -->' . PHP_EOL;
|
445 |
echo '<script type="text/javascript">' . PHP_EOL;
|
456 |
echo '</script>' . PHP_EOL;
|
457 |
}
|
458 |
|
459 |
+
/**
|
460 |
+
* Ajax callback for resetting a video thumbnail in the post editor
|
461 |
+
*/
|
462 |
function ajax_reset_callback() {
|
463 |
global $wpdb; // this is how you get access to the database
|
464 |
|
479 |
die();
|
480 |
}
|
481 |
|
482 |
+
/**
|
483 |
+
* Ajax callback used to get all the post IDs to be scanned in bulk
|
484 |
+
*/
|
485 |
function bulk_posts_query_callback() {
|
486 |
// Some default args
|
487 |
$args = array(
|
500 |
die();
|
501 |
}
|
502 |
|
503 |
+
/**
|
504 |
+
* Ajax callback used to get the video thumbnail for an individual post in the process of running the bulk tool
|
505 |
+
*/
|
506 |
function get_thumbnail_for_post_callback() {
|
507 |
|
508 |
$post_id = $_POST['post_id'];
|
531 |
die();
|
532 |
}
|
533 |
|
534 |
+
/**
|
535 |
+
* A function that renders the bulk scanning page
|
536 |
+
*/
|
537 |
function bulk_scanning_page() {
|
538 |
|
539 |
if ( ! current_user_can( 'manage_options' ) ) {
|