Video Embed & Thumbnail Generator - Version 4.2.9

Version Description

  • November 15, 2013 =
  • Fixed bug that interfered with database queries that do not have post_meta (The Events Calendar revealed the bug, but it likely had an effect on other plugins).
  • Fixed bug that assigned auto-encoded videos to nobody.
  • Restored process to set featured image for video attachments when thumbnails are assigned.
Download this release

Release Info

Developer kylegilman
Plugin Icon 128x128 Video Embed & Thumbnail Generator
Version 4.2.9
Comparing to
See all releases

Code changes from version 4.2.8 to 4.2.9

Files changed (2) hide show
  1. readme.txt +8 -3
  2. video-embed-thumbnail-generator.php +23 -9
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: kylegilman
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kylegilman@gmail.com&item_name=Video%20Embed%20And%20Thumbnail%20Generator%20Plugin%20Donation
4
  Tags: video, video player, video gallery, html5, shortcode, thumbnail, poster, ffmpeg, libav, embed, mobile, webm, ogg, h.264, h264, responsive, mp4
5
  Requires at least: 3.5
6
- Tested up to: 3.7
7
- Stable tag: 4.2.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -53,7 +53,7 @@ To embed videos on other sites you can use code like this.
53
  `[KGVID poster="http://www.kylegilman.net/wp-content/uploads/2011/10/Reel-11-10-10-web_thumb2.jpg"
54
  width="720" height="404"]http://www.kylegilman.net/wp-content/uploads/2006/09/Reel-2012-05-15-720.mp4[/KGVID]`
55
 
56
- = If you want to further modify the way the video player works, you can add the following options inside the [KGVID] tag. These will override anything you've set in the plugin settings or attachment details. =
57
 
58
  * `id="xxx"` video attachment ID (instead of using a URL).
59
  * `videos="x"` number of attached videos to display if no URL or id is given.
@@ -155,6 +155,11 @@ Enter the username & password in the plugin settings "FFMPEG Settings" tab, or u
155
 
156
  == Changelog ==
157
 
 
 
 
 
 
158
  = 4.2.8 - November 11, 2013 =
159
  * Updated Video.js to version 4.3.0.
160
  * Fixed iframe embedded video auto-sizing bug.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kylegilman@gmail.com&item_name=Video%20Embed%20And%20Thumbnail%20Generator%20Plugin%20Donation
4
  Tags: video, video player, video gallery, html5, shortcode, thumbnail, poster, ffmpeg, libav, embed, mobile, webm, ogg, h.264, h264, responsive, mp4
5
  Requires at least: 3.5
6
+ Tested up to: 3.8
7
+ Stable tag: 4.2.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
53
  `[KGVID poster="http://www.kylegilman.net/wp-content/uploads/2011/10/Reel-11-10-10-web_thumb2.jpg"
54
  width="720" height="404"]http://www.kylegilman.net/wp-content/uploads/2006/09/Reel-2012-05-15-720.mp4[/KGVID]`
55
 
56
+ = If you want to further modify the way the video player works, you can add the following options inside the `[KGVID]` tag. These will override anything you've set in the plugin settings or attachment details. =
57
 
58
  * `id="xxx"` video attachment ID (instead of using a URL).
59
  * `videos="x"` number of attached videos to display if no URL or id is given.
155
 
156
  == Changelog ==
157
 
158
+ = 4.2.9 - November 15, 2013 =
159
+ * Fixed bug that interfered with database queries that do not have post_meta (The Events Calendar revealed the bug, but it likely had an effect on other plugins).
160
+ * Fixed bug that assigned auto-encoded videos to nobody.
161
+ * Restored process to set featured image for video attachments when thumbnails are assigned.
162
+
163
  = 4.2.8 - November 11, 2013 =
164
  * Updated Video.js to version 4.3.0.
165
  * Fixed iframe embedded video auto-sizing bug.
video-embed-thumbnail-generator.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Video Embed & Thumbnail Generator
4
  Plugin URI: http://www.kylegilman.net/2011/01/18/video-embed-thumbnail-generator-wordpress-plugin/
5
  Description: Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG or LIBAV for encoding.
6
- Version: 4.2.8
7
  Author: Kyle Gilman
8
  Author URI: http://www.kylegilman.net/
9
 
@@ -47,7 +47,7 @@ function kgvid_default_options_fn() {
47
  $upload_capable = kgvid_upload_capable();
48
 
49
  $options = array(
50
- "version"=>4.28,
51
  "embed_method"=>"Video.js",
52
  "template"=>false,
53
  "template_gentle"=>"on",
@@ -812,8 +812,8 @@ function kgvid_video_embed_enqueue_scripts() {
812
 
813
  //Video.js script and skins
814
  if ( $options['embed_method'] != "WordPress Default" ) {
815
- wp_enqueue_script( 'video-js', plugins_url("", __FILE__).'/video-js/video.js', '', '4.2.2' );
816
- wp_enqueue_style( 'video-js-css', plugins_url("", __FILE__).'/video-js/video-js.css', '', '4.2.2' );
817
  wp_enqueue_style( 'video-js-kg-skin', plugins_url("", __FILE__).'/video-js/kg-video-js-skin.css', '', $options['version'] );
818
  }
819
 
@@ -853,7 +853,7 @@ function kgvid_video_embed_print_scripts() {
853
  $options = get_option('kgvid_video_embed_options');
854
 
855
  if ( $options['embed_method'] != "WordPress Default" ) {
856
- echo '<script type="text/javascript">videojs.options.flash.swf = "'.plugins_url("", __FILE__).'/video-js/video-js.swf?4.2.2"</script>'."\n";
857
  }
858
 
859
  foreach ( $posts as $post ) {
@@ -2839,9 +2839,11 @@ add_filter("attachment_fields_to_edit", "kgvid_image_attachment_fields_to_edit",
2839
  function kgvid_hide_video_children($wp_query_obj) {
2840
 
2841
  if ( is_admin()
 
 
2842
  && !array_key_exists('post_mime_type', $wp_query_obj->query_vars) //show children when specifically displaying videos
2843
- && array_key_exists('posts_per_page', $wp_query_obj->query_vars)
2844
- && $wp_query_obj->query_vars['posts_per_page'] > 0 ) { //hide children only when showing paged content (makes sure that -1 will actually return all attachments)
2845
  $wp_query_obj->set(
2846
  'meta_query',
2847
  array(
@@ -2852,7 +2854,7 @@ function kgvid_hide_video_children($wp_query_obj) {
2852
  )
2853
  );
2854
 
2855
- }
2856
 
2857
  }
2858
  add_action('pre_get_posts','kgvid_hide_video_children');
@@ -3128,6 +3130,7 @@ function kgvid_video_attachment_fields_to_save($post, $attachment) {
3128
  if( isset($attachment['kgflashmediaplayer-featured']) ) {
3129
  update_post_meta($post['ID'], '_kgflashmediaplayer-featured', $attachment['kgflashmediaplayer-featured']);
3130
  if ( !empty($thumb_id) ) {
 
3131
  if ( isset($_POST['action']) && $_POST['action'] == 'save-attachment-compat' && isset($_POST['post_id']) ) { //if this is in the media modal
3132
  $post_parent = $_POST['post_id'];
3133
  }
@@ -3138,6 +3141,8 @@ function kgvid_video_attachment_fields_to_save($post, $attachment) {
3138
  if ( isset($post_parent) ) {
3139
  set_post_thumbnail($post_parent, $thumb_id);
3140
  }
 
 
3141
  }
3142
  }
3143
  else { update_post_meta($post['ID'], '_kgflashmediaplayer-featured', "notchecked"); }
@@ -4152,19 +4157,28 @@ function kgvid_encode_progress($video_key, $format, $page) {
4152
  }
4153
 
4154
  global $wpdb;
 
4155
  $query = "SELECT ID FROM {$wpdb->posts} WHERE guid='".$video_embed_queue[$video_key]['encode_formats'][$format]['url']."'"; //check for existing entry in the db
4156
  $video_id = $wpdb->get_var($query);
4157
  if ( !$video_id ) {
4158
  $wp_filetype = wp_check_filetype(basename($video_entry['encode_formats'][$format]['filepath']), null );
4159
  $video_formats = kgvid_video_formats();
4160
  $title .= " ".$video_formats[$format]['name'];
 
 
 
 
 
 
4161
  $attachment = array(
4162
  'guid' => $video_entry['encode_formats'][$format]['url'],
4163
  'post_mime_type' => $wp_filetype['type'],
4164
  'post_title' => $title,
4165
  'post_content' => '',
4166
- 'post_status' => 'inherit'
 
4167
  );
 
4168
  $new_id = wp_insert_attachment( $attachment, $video_entry['encode_formats'][$format]['filepath'], $parent_id );
4169
  // you must first include the image.php file
4170
  // for the function wp_generate_attachment_metadata() to work and media.php for wp_read_video_metadata() in WP 3.6+
3
  Plugin Name: Video Embed & Thumbnail Generator
4
  Plugin URI: http://www.kylegilman.net/2011/01/18/video-embed-thumbnail-generator-wordpress-plugin/
5
  Description: Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG or LIBAV for encoding.
6
+ Version: 4.2.9
7
  Author: Kyle Gilman
8
  Author URI: http://www.kylegilman.net/
9
 
47
  $upload_capable = kgvid_upload_capable();
48
 
49
  $options = array(
50
+ "version"=>4.29,
51
  "embed_method"=>"Video.js",
52
  "template"=>false,
53
  "template_gentle"=>"on",
812
 
813
  //Video.js script and skins
814
  if ( $options['embed_method'] != "WordPress Default" ) {
815
+ wp_enqueue_script( 'video-js', plugins_url("", __FILE__).'/video-js/video.js', '', '4.3.0' );
816
+ wp_enqueue_style( 'video-js-css', plugins_url("", __FILE__).'/video-js/video-js.css', '', '4.3.0' );
817
  wp_enqueue_style( 'video-js-kg-skin', plugins_url("", __FILE__).'/video-js/kg-video-js-skin.css', '', $options['version'] );
818
  }
819
 
853
  $options = get_option('kgvid_video_embed_options');
854
 
855
  if ( $options['embed_method'] != "WordPress Default" ) {
856
+ echo '<script type="text/javascript">videojs.options.flash.swf = "'.plugins_url("", __FILE__).'/video-js/video-js.swf?4.0.0"</script>'."\n";
857
  }
858
 
859
  foreach ( $posts as $post ) {
2839
  function kgvid_hide_video_children($wp_query_obj) {
2840
 
2841
  if ( is_admin()
2842
+ && is_array($wp_query_obj->query_vars)
2843
+ && ( array_key_exists('post_type', $wp_query_obj->query_vars) && $wp_query_obj->query_vars['post_type'] == 'attachment' ) //only deal with attachments
2844
  && !array_key_exists('post_mime_type', $wp_query_obj->query_vars) //show children when specifically displaying videos
2845
+ && ( array_key_exists('posts_per_page', $wp_query_obj->query_vars) && $wp_query_obj->query_vars['posts_per_page'] > 0 ) //hide children only when showing paged content (makes sure that -1 will actually return all attachments)
2846
+ ) {
2847
  $wp_query_obj->set(
2848
  'meta_query',
2849
  array(
2854
  )
2855
  );
2856
 
2857
+ }//end if
2858
 
2859
  }
2860
  add_action('pre_get_posts','kgvid_hide_video_children');
3130
  if( isset($attachment['kgflashmediaplayer-featured']) ) {
3131
  update_post_meta($post['ID'], '_kgflashmediaplayer-featured', $attachment['kgflashmediaplayer-featured']);
3132
  if ( !empty($thumb_id) ) {
3133
+
3134
  if ( isset($_POST['action']) && $_POST['action'] == 'save-attachment-compat' && isset($_POST['post_id']) ) { //if this is in the media modal
3135
  $post_parent = $_POST['post_id'];
3136
  }
3141
  if ( isset($post_parent) ) {
3142
  set_post_thumbnail($post_parent, $thumb_id);
3143
  }
3144
+
3145
+ set_post_thumbnail($post['ID'], $thumb_id); //set the video's featured image as well as the post's featured image
3146
  }
3147
  }
3148
  else { update_post_meta($post['ID'], '_kgflashmediaplayer-featured', "notchecked"); }
4157
  }
4158
 
4159
  global $wpdb;
4160
+ global $user_ID;
4161
  $query = "SELECT ID FROM {$wpdb->posts} WHERE guid='".$video_embed_queue[$video_key]['encode_formats'][$format]['url']."'"; //check for existing entry in the db
4162
  $video_id = $wpdb->get_var($query);
4163
  if ( !$video_id ) {
4164
  $wp_filetype = wp_check_filetype(basename($video_entry['encode_formats'][$format]['filepath']), null );
4165
  $video_formats = kgvid_video_formats();
4166
  $title .= " ".$video_formats[$format]['name'];
4167
+
4168
+ if ( $user_ID == 0 ) {
4169
+ $parent_post = get_post($parent_id);
4170
+ $user_ID = $parent_post->post_author;
4171
+ }
4172
+
4173
  $attachment = array(
4174
  'guid' => $video_entry['encode_formats'][$format]['url'],
4175
  'post_mime_type' => $wp_filetype['type'],
4176
  'post_title' => $title,
4177
  'post_content' => '',
4178
+ 'post_status' => 'inherit',
4179
+ 'post_author' => $user_ID
4180
  );
4181
+
4182
  $new_id = wp_insert_attachment( $attachment, $video_entry['encode_formats'][$format]['filepath'], $parent_id );
4183
  // you must first include the image.php file
4184
  // for the function wp_generate_attachment_metadata() to work and media.php for wp_read_video_metadata() in WP 3.6+