Video Thumbnails - Version 2.7.5

Version Description

  • Better support for WP Robot
  • Fixed bug related to Automatic YouTube Video Posts
  • Reorganized video thumbnail extensions
Download this release

Release Info

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

Code changes from version 2.7.4 to 2.7.5

php/extensions/automatic-youtube-video-posts.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* Copyright 2014 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 YouTube provider class
20
+ require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-youtube-thumbnails.php' );
21
+
22
+ /**
23
+ * Checks if AYVP is importing
24
+ * @return boolean True if importing, false if not
25
+ */
26
+ function is_ayvp_importing() {
27
+ // Global variables used by AYVP
28
+ global $getWP, $tern_wp_youtube_options, $tern_wp_youtube_o;
29
+ // Check for the class used by AYVP
30
+ if ( class_exists( 'ternWP' ) && isset( $getWP ) ) {
31
+ // Load the AYVP options
32
+ $tern_wp_youtube_o = $getWP->getOption( 'tern_wp_youtube', $tern_wp_youtube_options );
33
+ if ( $tern_wp_youtube_o['is_importing'] && $tern_wp_youtube_o['is_importing'] !== false ) {
34
+ return true;
35
+ } else {
36
+ return false;
37
+ }
38
+ } else {
39
+ return false;
40
+ }
41
+ }
42
+
43
+ function ayvp_new_video_thumbnail_url_filter( $new_thumbnail, $post_id ) {
44
+ // When publishing a post during import, use the global variable to generate thumbnail
45
+ if ( $new_thumbnail == null && is_ayvp_importing() ) {
46
+ global $tern_wp_youtube_array;
47
+ if ( isset( $tern_wp_youtube_array['_tern_wp_youtube_video'] ) && $tern_wp_youtube_array['_tern_wp_youtube_video'] != '' ) {
48
+ $new_thumbnail = YouTube_Thumbnails::get_thumbnail_url( $tern_wp_youtube_array['_tern_wp_youtube_video'] );
49
+ }
50
+ }
51
+ // When automatic publishing is disabled or rescanning an existing post, use custom field data to generate thumbnail
52
+ if ( $new_thumbnail == null ) {
53
+ $youtube_id = get_post_meta( $post_id, '_tern_wp_youtube_video', true );
54
+ if ( $youtube_id != '' ) {
55
+ $new_thumbnail = YouTube_Thumbnails::get_thumbnail_url( $youtube_id );
56
+ }
57
+ }
58
+ return $new_thumbnail;
59
+ }
60
+
61
+ // Make sure we can use is_plugin_active()
62
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
63
+
64
+ // If AYVP is active, add filter
65
+ if ( is_plugin_active( 'automatic-youtube-video-posts/tern_wp_youtube.php' ) ) {
66
+ add_filter( 'new_video_thumbnail_url', 'ayvp_new_video_thumbnail_url_filter', 10, 2 );
67
+ remove_filter( 'post_thumbnail_html', 'WP_ayvpp_thumbnail' );
68
+ remove_filter( 'post_thumbnail_size', 'WP_ayvpp_thumbnail_size' );
69
+ }
70
+
71
+ ?>
php/extensions/class-ayvp-thumbnails.php DELETED
@@ -1,57 +0,0 @@
1
- <?php
2
-
3
- /* Copyright 2014 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 extension class
20
- require_once( VIDEO_THUMBNAILS_PATH . '/php/extensions/class-video-thumbnails-extension.php' );
21
-
22
- // Require YouTube provider class
23
- require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-youtube-thumbnails.php' );
24
-
25
- class AYVP_Thumbnails extends Video_Thumbnails_Extension {
26
-
27
- public static function new_thumbnail( $new_thumbnail, $post_id ) {
28
- // When publishing a post during import, use the global variable to generate thumbnail
29
- global $tern_wp_youtube_array;
30
- if ( $new_thumbnail == null ) {
31
- if ( isset( $tern_wp_youtube_array['_tern_wp_youtube_video'] ) && $tern_wp_youtube_array['_tern_wp_youtube_video'] != '' ) {
32
- $new_thumbnail = YouTube_Thumbnails::get_thumbnail_url( $tern_wp_youtube_array['_tern_wp_youtube_video'] );
33
- }
34
- }
35
- // When automatic publishing is disabled or rescanning an existing post, use custom field data to generate thumbnail
36
- if ( $new_thumbnail == null ) {
37
- $youtube_id = get_post_meta( $post_id, '_tern_wp_youtube_video', true );
38
- if ( $youtube_id != '' ) {
39
- $new_thumbnail = YouTube_Thumbnails::get_thumbnail_url( $youtube_id );
40
- }
41
- }
42
- return $new_thumbnail;
43
- }
44
-
45
- }
46
-
47
- // Make sure we can use is_plugin_active()
48
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
49
-
50
- // If AYVP is active, add filter
51
- if ( is_plugin_active( 'automatic-youtube-video-posts/tern_wp_youtube.php' ) ) {
52
- add_filter( 'new_video_thumbnail_url', array( 'AYVP_Thumbnails', 'new_thumbnail' ), 10, 2 );
53
- remove_filter( 'post_thumbnail_html', 'WP_ayvpp_thumbnail' );
54
- remove_filter( 'post_thumbnail_size', 'WP_ayvpp_thumbnail_size' );
55
- }
56
-
57
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
php/extensions/{class-simple-video-embedder-thumbnails.php → extensions.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- /* Copyright 2013 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
@@ -16,23 +16,8 @@
16
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
  */
18
 
19
- // Require thumbnail extension class
20
- require_once( VIDEO_THUMBNAILS_PATH . '/php/extensions/class-video-thumbnails-extension.php' );
21
-
22
- class Simple_Video_Embedder_Thumbnails extends Video_Thumbnails_Extension {
23
-
24
- public static function markup( $markup, $post_id ) {
25
- if ( function_exists( 'p75HasVideo' ) ) {
26
- if ( p75HasVideo( $post_id ) ) {
27
- $markup .= ' ' . p75GetVideo( $post_id );
28
- }
29
- }
30
- return $markup;
31
- }
32
-
33
- }
34
-
35
- // Add filter to modify markup
36
- add_filter( 'video_thumbnail_markup', array( 'Simple_Video_Embedder_Thumbnails', 'markup' ), 10, 2 );
37
 
38
  ?>
1
  <?php
2
 
3
+ /* Copyright 2014 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
16
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
  */
18
 
19
+ require_once( VIDEO_THUMBNAILS_PATH . '/php/extensions/automatic-youtube-video-posts.php' );
20
+ require_once( VIDEO_THUMBNAILS_PATH . '/php/extensions/simple-video-embedder.php' );
21
+ require_once( VIDEO_THUMBNAILS_PATH . '/php/extensions/wp-robot.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  ?>
php/extensions/{class-video-thumbnails-extension.php → simple-video-embedder.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- /* Copyright 2013 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
@@ -16,15 +16,16 @@
16
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
  */
18
 
19
- class Video_Thumbnails_Extension {
20
-
21
- function __construct() {
22
- if ( method_exists( $this, 'settings_section') ) add_action( 'video_thumbnails_provider_options', array( &$this, 'settings_section' ) );
 
23
  }
24
-
25
  }
26
 
27
- require_once( VIDEO_THUMBNAILS_PATH . '/php/extensions/class-simple-video-embedder-thumbnails.php' );
28
- require_once( VIDEO_THUMBNAILS_PATH . '/php/extensions/class-ayvp-thumbnails.php' );
29
 
30
  ?>
1
  <?php
2
 
3
+ /* Copyright 2014 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
16
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
  */
18
 
19
+ function simple_video_embedder_video_thumbnail_markup_filter( $markup, $post_id ) {
20
+ if ( function_exists( 'p75HasVideo' ) ) {
21
+ if ( p75HasVideo( $post_id ) ) {
22
+ $markup .= ' ' . p75GetVideo( $post_id );
23
+ }
24
  }
25
+ return $markup;
26
  }
27
 
28
+ // Add filter to modify markup
29
+ add_filter( 'video_thumbnail_markup', 'simple_video_embedder_video_thumbnail_markup_filter', 10, 2 );
30
 
31
  ?>
php/extensions/wp-robot.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* Copyright 2014 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
+ function video_thumbnails_wpr_after_post_action( $post_id ) {
20
+ // Don't save video thumbnails during autosave or for unpublished posts
21
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return null;
22
+ if ( get_post_status( $post_id ) != 'publish' ) return null;
23
+ // Check that Video Thumbnails are enabled for current post type
24
+ $post_type = get_post_type( $post_id );
25
+ global $video_thumbnails;
26
+ if ( in_array( $post_type, (array) $video_thumbnails->settings->options['post_types'] ) || $post_type == $video_thumbnails->settings->options['post_types'] ) {
27
+ $video_thumbnails->get_video_thumbnail( $post_id );
28
+ } else {
29
+ return null;
30
+ }
31
+ }
32
+
33
+ add_action( 'wpr_after_post', 'video_thumbnails_wpr_after_post_action', 10, 1 );
34
+
35
+ ?>
readme.txt CHANGED
@@ -3,18 +3,20 @@ Contributors: sutherlandboswell
3
  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.8.2
7
- Stable tag: 2.7.4
8
 
9
  Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
10
 
11
  == Description ==
12
 
13
- Video Thumbnails makes it easy to automatically display video thumbnails in your template. When you publish a post, this plugin will find the first video embedded and locate the thumbnail for you. Thumbnails can be saved to your media library and set as a featured image automatically. There's even support for custom post types and custom fields!
14
 
15
- **New!** [Video Thumbnails Pro](https://refactored.co/plugins/video-thumbnails) gives you even more power. Enjoy features like maximum image sizes, widescreen cropping, more powerful bulk scanning options, a customizable upload directory, and more!
16
 
17
- Video Thumbnails currently supports these video services:
 
 
18
 
19
  * YouTube
20
  * Vimeo
@@ -34,25 +36,31 @@ Video Thumbnails currently supports these video services:
34
  * Youku
35
  * Rutube
36
 
37
- Video Thumbnails even works with most video embedding plugins, including:
38
 
39
  * [Refactored Video Importer](https://refactored.co/plugins/video-importer)
40
  * Viper's Video Quicktags
41
- * Automatic Youtube Video Posts Plugin
42
  * WP YouTube Lyte
43
 
44
- Video Thumbnails will always be totally free while remaining a full-featured plugin, but if you'd like to support the developer consider purchasing [Video Thumbnails Pro](https://refactored.co/plugins/video-thumbnails). The pro version runs alongside the standard version and adds additional features like maximum image sizes, more powerful bulk scanning options, a customizable upload directory, and more!
45
 
46
- Some functions are available to advanced users who want to customize their theme:
 
 
 
 
47
 
48
- * `<?php video_thumbnail(); ?>` will echo a thumbnail URL or the default image located at `wp-content/plugins/video-thumbnails/default.jpg` if a thumbnail cannot be found. Here is an example: `<img src="<?php video_thumbnail(); ?>" width="300" />`
49
- * `<?php $video_thumbnail = get_video_thumbnail(); ?>` will return the thumbnail URL or return NULL if none is found. In this example, a thumbnail is only shown if one is found: `<?php if( ( $video_thumbnail = get_video_thumbnail() ) != null ) { echo "<img src='" . $video_thumbnail . "' />"; } ?>`
50
 
51
  == Installation ==
52
 
53
  1. Upload the `/video-thumbnails/` directory to the `/wp-content/plugins/` directory
54
  1. Activate the plugin through the 'Plugins' menu in WordPress
55
 
 
 
 
 
 
56
  == Frequently Asked Questions ==
57
 
58
  = No video thumbnail for this post =
@@ -73,6 +81,10 @@ Video Thumbnails uses high-resolution widescreen thumbnails whenever they are av
73
 
74
  No, Video Thumbnails only uses thumbnails provided by the source. If you're posting videos from your own account, many providers allow you to choose the thumbnail.
75
 
 
 
 
 
76
  = My theme isn't showing thumbnails, what's wrong? =
77
 
78
  The most likely problem is that your theme doesn't support post thumbnails. If thumbnails are supported, you should see a box titled "Featured Image" on the edit post page. If thumbnails aren't supported, your theme will have to be modified to support Featured Images or to support one of our custom functions.
@@ -118,6 +130,11 @@ The Vimeo API has a rate limit, so in rare cases you may exceed this limit. Try
118
 
119
  == Changelog ==
120
 
 
 
 
 
 
121
  = 2.7.4 =
122
  * Improved VK detection
123
  * Added German translation (thanks [applewerbung](http://wordpress.org/support/profile/applewerbung))
3
  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.5
8
 
9
  Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
10
 
11
  == Description ==
12
 
13
+ Video Thumbnails makes it easy to automatically display video thumbnails in your template. When you publish a post, this plugin will find the first video embedded and retrieve a thumbnail for you. Thumbnails can be saved to your media library and set as a featured image automatically. There's even support for custom post types and custom fields!
14
 
15
+ = Video Thumbnails Pro =
16
 
17
+ [Video Thumbnails Pro](https://refactored.co/plugins/video-thumbnails) adds new options like maximum image sizes, widescreen cropping, more powerful bulk scanning, a customizable upload directory, and more!
18
+
19
+ = Supported Sites =
20
 
21
  * YouTube
22
  * Vimeo
36
  * Youku
37
  * Rutube
38
 
39
+ Video Thumbnails even works with most video plugins, including:
40
 
41
  * [Refactored Video Importer](https://refactored.co/plugins/video-importer)
42
  * Viper's Video Quicktags
 
43
  * WP YouTube Lyte
44
 
45
+ = Help Translate =
46
 
47
+ [Register on our translation site](http://translate.refactored.co/blog/) to help bring Video Thumbnails to more languages.
48
+
49
+ = Our Other Plugins =
50
+
51
+ [Video Thumbnails Pro](https://refactored.co/plugins/video-thumbnails) | [Video Importer](https://refactored.co/plugins/video-importer) | [Retinamatic](http://retinamatic.com/)
52
 
 
 
53
 
54
  == Installation ==
55
 
56
  1. Upload the `/video-thumbnails/` directory to the `/wp-content/plugins/` directory
57
  1. Activate the plugin through the 'Plugins' menu in WordPress
58
 
59
+ Some functions are available to advanced users who want to customize their theme:
60
+
61
+ * `<?php video_thumbnail(); ?>` will echo a thumbnail URL or the default image located at `wp-content/plugins/video-thumbnails/default.jpg` if a thumbnail cannot be found. Here is an example: `<img src="<?php video_thumbnail(); ?>" width="300" />`
62
+ * `<?php $video_thumbnail = get_video_thumbnail(); ?>` will return the thumbnail URL or return NULL if none is found. In this example, a thumbnail is only shown if one is found: `<?php if( ( $video_thumbnail = get_video_thumbnail() ) != null ) { echo "<img src='" . $video_thumbnail . "' />"; } ?>`
63
+
64
  == Frequently Asked Questions ==
65
 
66
  = No video thumbnail for this post =
81
 
82
  No, Video Thumbnails only uses thumbnails provided by the source. If you're posting videos from your own account, many providers allow you to choose the thumbnail.
83
 
84
+ = Can it get thumbnails for my self-hosted videos? =
85
+
86
+ No, it will only fetch thumbnails for videos from the list of supported sites. Decoding local video files to create thumbnails would require server resources and packages unavailable to most users, so the plugin focuses on .
87
+
88
  = My theme isn't showing thumbnails, what's wrong? =
89
 
90
  The most likely problem is that your theme doesn't support post thumbnails. If thumbnails are supported, you should see a box titled "Featured Image" on the edit post page. If thumbnails aren't supported, your theme will have to be modified to support Featured Images or to support one of our custom functions.
130
 
131
  == Changelog ==
132
 
133
+ = 2.7.5 =
134
+ * Better support for WP Robot
135
+ * Fixed bug related to Automatic YouTube Video Posts
136
+ * Reorganized video thumbnail extensions
137
+
138
  = 2.7.4 =
139
  * Improved VK detection
140
  * Added German translation (thanks [applewerbung](http://wordpress.org/support/profile/applewerbung))
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.4
9
  License: GPL2
10
  Text Domain: video-thumbnails
11
  Domain Path: /languages/
@@ -30,13 +30,13 @@ 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.4' );
34
 
35
  // Providers
36
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-providers.php' );
37
 
38
  // Extensions
39
- require_once( VIDEO_THUMBNAILS_PATH . '/php/extensions/class-video-thumbnails-extension.php' );
40
 
41
  // Settings
42
  require_once( VIDEO_THUMBNAILS_PATH . '/php/class-video-thumbnails-settings.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.5
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.5' );
34
 
35
  // Providers
36
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-providers.php' );
37
 
38
  // Extensions
39
+ require_once( VIDEO_THUMBNAILS_PATH . '/php/extensions/extensions.php' );
40
 
41
  // Settings
42
  require_once( VIDEO_THUMBNAILS_PATH . '/php/class-video-thumbnails-settings.php' );