Video Embed & Thumbnail Generator - Version 4.2.6

Version Description

  • October 19, 2013 =
  • Fixed bug that broke playback in some cases when using the shortcode without a URL.
  • Fixed bug that ignored width and height saved in the attachment meta if width and height were not set in the shortcode.
  • Fixed bug that broke WordPress Default player when embedding M4V files.
  • Removed line breaks from generated code to avoid adding extra line breaks in the rendered video in some situations where wpautop is run after the code is created.
Download this release

Release Info

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

Code changes from version 4.2.5 to 4.2.6

Files changed (2) hide show
  1. readme.txt +7 -1
  2. video-embed-thumbnail-generator.php +31 -22
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kyleg
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.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -155,6 +155,12 @@ Enter the username & password in the plugin settings "FFMPEG Settings" tab, or u
155
 
156
  == Changelog ==
157
 
 
 
 
 
 
 
158
  = 4.2.5 - October 12, 2013 =
159
  * Fixed bug that disabled FFMPEG when other plugin settings were changed.
160
 
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.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
155
 
156
  == Changelog ==
157
 
158
+ = 4.2.6 - October 19, 2013 =
159
+ * Fixed bug that broke playback in some cases when using the shortcode without a URL.
160
+ * Fixed bug that ignored width and height saved in the attachment meta if width and height were not set in the shortcode.
161
+ * Fixed bug that broke WordPress Default player when embedding M4V files.
162
+ * Removed line breaks from generated code to avoid adding extra line breaks in the rendered video in some situations where wpautop is run after the code is created.
163
+
164
  = 4.2.5 - October 12, 2013 =
165
  * Fixed bug that disabled FFMPEG when other plugin settings were changed.
166
 
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. <a href="options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php">Settings</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kylegilman@gmail.com&item_name=Video%20Embed%20And%20Thumbnail%20Generator%20Plugin%20Donation">Donate</a>
6
- Version: 4.2.5
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.25,
51
  "embed_method"=>"Video.js",
52
  "template"=>false,
53
  "template_gentle"=>"on",
@@ -932,16 +932,6 @@ function KGVID_shortcode($atts, $content = ''){
932
  $content = $original_content;
933
  $sources = array();
934
 
935
- $moviefiletype = pathinfo($content, PATHINFO_EXTENSION);
936
- if ( $moviefiletype == "mov" || $moviefiletype == "m4v" ) { $moviefiletype = "mp4"; }
937
- $video_formats = array(
938
- "original" => $moviefiletype,
939
- "1080" => "mp4",
940
- "720" => "mp4",
941
- "mobile" => "mp4",
942
- "webm" => "webm",
943
- "ogg" => "ogg"
944
- );
945
  $compatible = array("flv", "f4v", "mp4", "mov", "m4v", "ogv", "ogg", "webm");
946
  $flashcompatible = array("flv", "f4v", "mp4", "mov", "m4v");
947
  $h264compatible = array("mp4", "mov", "m4v");
@@ -963,13 +953,14 @@ function KGVID_shortcode($atts, $content = ''){
963
  if ( function_exists('wp_read_video_metadata') ) { $video_meta = wp_read_video_metadata($moviefile); }
964
 
965
  if ( $video_meta && array_key_exists('width', $video_meta) ) { $widthset = $video_meta['width']; }
966
- else { $widthset = get_post_meta($id, "_kgflashmediaplayer-actualwidth", true); }
967
 
968
  if ( $video_meta && array_key_exists('height', $video_meta) ) { $heightset = $video_meta['height']; }
969
- else { $heightset = get_post_meta($id, "_kgflashmediaplayer-actualheight", true); }
970
 
971
  if ( !empty($widthset) && !empty($heightset) ) {
972
  $aspect_ratio = $heightset/$widthset;
 
973
  $query_atts['height'] = round($query_atts['width']*$aspect_ratio);
974
  }
975
 
@@ -1006,6 +997,17 @@ function KGVID_shortcode($atts, $content = ''){
1006
  $countable = false;
1007
  }
1008
 
 
 
 
 
 
 
 
 
 
 
 
1009
  if ( in_array($moviefiletype, $compatible) ) {
1010
  $encodevideo_info["original_exists"] = true;
1011
  $encodevideo_info["originalurl"] = $content;
@@ -1072,17 +1074,17 @@ function KGVID_shortcode($atts, $content = ''){
1072
  else { $aligncode = ""; }
1073
 
1074
  $code .= '<div id="kgvid_'.$div_suffix.'_wrapper" class="kgvid_wrapper"'.$aligncode.'>'."\n\t\t\t";
1075
- $code .= '<div id="video_'.$div_suffix.'_div" class="kgvid_videodiv" itemscope itemtype="http://schema.org/VideoObject">'."\n\t\t\t\t";
1076
- if ( $query_atts["poster"] != '' ) { $code .= '<meta itemprop="thumbnailURL" content="'.$query_atts["poster"].'" />'."\n\t\t\t\t"; }
1077
  if ( !empty($id) ) { $schema_embedURL = site_url('/')."?attachment_id=".$id."&amp;kgvid_video_embed[enable]=true"; }
1078
  else { $schema_embedURL = $content; }
1079
- $code .= '<meta itemprop="embedURL" content="'.$schema_embedURL.'" />'."\n\t\t\t\t";
1080
 
1081
- if ( !empty($query_atts['title']) ) { $code .= '<meta itemprop="name" content="'.$query_atts['title'].'" />'."\n\t\t\t\t"; }
1082
  if ( !empty($query_atts['description']) ) { $description = $query_atts['description']; }
1083
  elseif ( !empty($query_atts['caption']) ) { $description = $query_atts['caption']; }
1084
  else { $description = ""; }
1085
- if ( !empty($description) ) { $code .= '<meta itemprop="description" content="'.esc_attr($description).'" />'."\n\t\t\t\t"; }
1086
 
1087
  if ( $options['embed_method'] == "WordPress Default" ) {
1088
  $wp_shortcode = "[video ";
@@ -1092,9 +1094,8 @@ function KGVID_shortcode($atts, $content = ''){
1092
  if ( $name != "original" && $encodevideo_info[$name."url"] == $content ) { unset($sources['original']); }
1093
  if ( $encodevideo_info[$name."_exists"] ) {
1094
  if ( $type != "mp4" || !$mp4already ) {
1095
- $shortcode_type = $type;
1096
- if ( $type == "ogg" ) { $shortcode_type = "ogv"; } //the shortcode requires ogv but MIME is still video/ogg
1097
- $sources[$name] = $shortcode_type.'="'.$encodevideo_info[$name."url"].'" ';
1098
  if ( $type == "mp4" ) { //WordPress built-in shortcode doesn't support multiple videos of the same type but we'll hack it in later
1099
  $search_string = '<source type="video/mp4" src="'.$encodevideo_info[$name."url"].'" />';
1100
  $mp4already = true;
@@ -1303,6 +1304,14 @@ function KGVID_shortcode($atts, $content = ''){
1303
  add_shortcode('FMP', 'KGVID_shortcode');
1304
  add_shortcode('KGVID', 'KGVID_shortcode');
1305
 
 
 
 
 
 
 
 
 
1306
  function kgvid_ajax_generate_encode_checkboxes() {
1307
 
1308
  global $wpdb;
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. <a href="options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php">Settings</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kylegilman@gmail.com&item_name=Video%20Embed%20And%20Thumbnail%20Generator%20Plugin%20Donation">Donate</a>
6
+ Version: 4.2.6
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.26,
51
  "embed_method"=>"Video.js",
52
  "template"=>false,
53
  "template_gentle"=>"on",
932
  $content = $original_content;
933
  $sources = array();
934
 
 
 
 
 
 
 
 
 
 
 
935
  $compatible = array("flv", "f4v", "mp4", "mov", "m4v", "ogv", "ogg", "webm");
936
  $flashcompatible = array("flv", "f4v", "mp4", "mov", "m4v");
937
  $h264compatible = array("mp4", "mov", "m4v");
953
  if ( function_exists('wp_read_video_metadata') ) { $video_meta = wp_read_video_metadata($moviefile); }
954
 
955
  if ( $video_meta && array_key_exists('width', $video_meta) ) { $widthset = $video_meta['width']; }
956
+ else { $widthset = get_post_meta($id, "_kgflashmediaplayer-width", true); }
957
 
958
  if ( $video_meta && array_key_exists('height', $video_meta) ) { $heightset = $video_meta['height']; }
959
+ else { $heightset = get_post_meta($id, "_kgflashmediaplayer-height", true); }
960
 
961
  if ( !empty($widthset) && !empty($heightset) ) {
962
  $aspect_ratio = $heightset/$widthset;
963
+ $query_atts['width'] = $widthset;
964
  $query_atts['height'] = round($query_atts['width']*$aspect_ratio);
965
  }
966
 
997
  $countable = false;
998
  }
999
 
1000
+ $moviefiletype = pathinfo($content, PATHINFO_EXTENSION);
1001
+ if ( $moviefiletype == "mov" || $moviefiletype == "m4v" ) { $moviefiletype = "mp4"; }
1002
+ $video_formats = array(
1003
+ "original" => $moviefiletype,
1004
+ "1080" => "mp4",
1005
+ "720" => "mp4",
1006
+ "mobile" => "mp4",
1007
+ "webm" => "webm",
1008
+ "ogg" => "ogg"
1009
+ );
1010
+
1011
  if ( in_array($moviefiletype, $compatible) ) {
1012
  $encodevideo_info["original_exists"] = true;
1013
  $encodevideo_info["originalurl"] = $content;
1074
  else { $aligncode = ""; }
1075
 
1076
  $code .= '<div id="kgvid_'.$div_suffix.'_wrapper" class="kgvid_wrapper"'.$aligncode.'>'."\n\t\t\t";
1077
+ $code .= '<div id="video_'.$div_suffix.'_div" class="kgvid_videodiv" itemscope itemtype="http://schema.org/VideoObject">';
1078
+ if ( $query_atts["poster"] != '' ) { $code .= '<meta itemprop="thumbnailURL" content="'.$query_atts["poster"].'" />'; }
1079
  if ( !empty($id) ) { $schema_embedURL = site_url('/')."?attachment_id=".$id."&amp;kgvid_video_embed[enable]=true"; }
1080
  else { $schema_embedURL = $content; }
1081
+ $code .= '<meta itemprop="embedURL" content="'.$schema_embedURL.'" />';
1082
 
1083
+ if ( !empty($query_atts['title']) ) { $code .= '<meta itemprop="name" content="'.$query_atts['title'].'" />'; }
1084
  if ( !empty($query_atts['description']) ) { $description = $query_atts['description']; }
1085
  elseif ( !empty($query_atts['caption']) ) { $description = $query_atts['caption']; }
1086
  else { $description = ""; }
1087
+ if ( !empty($description) ) { $code .= '<meta itemprop="description" content="'.esc_attr($description).'" />'; }
1088
 
1089
  if ( $options['embed_method'] == "WordPress Default" ) {
1090
  $wp_shortcode = "[video ";
1094
  if ( $name != "original" && $encodevideo_info[$name."url"] == $content ) { unset($sources['original']); }
1095
  if ( $encodevideo_info[$name."_exists"] ) {
1096
  if ( $type != "mp4" || !$mp4already ) {
1097
+ $shortcode_type = wp_check_filetype( $encodevideo_info[$name."url"], wp_get_mime_types() );
1098
+ $sources[$name] = $shortcode_type['ext'].'="'.$encodevideo_info[$name."url"].'" ';
 
1099
  if ( $type == "mp4" ) { //WordPress built-in shortcode doesn't support multiple videos of the same type but we'll hack it in later
1100
  $search_string = '<source type="video/mp4" src="'.$encodevideo_info[$name."url"].'" />';
1101
  $mp4already = true;
1304
  add_shortcode('FMP', 'KGVID_shortcode');
1305
  add_shortcode('KGVID', 'KGVID_shortcode');
1306
 
1307
+
1308
+ function kgvid_no_texturize_shortcode($shortcodes){
1309
+ $shortcodes[] = 'KGVID';
1310
+ $shortcodes[] = 'FMP';
1311
+ return $shortcodes;
1312
+ }
1313
+ add_filter( 'no_texturize_shortcodes', 'kgvid_no_texturize_shortcode' );
1314
+
1315
  function kgvid_ajax_generate_encode_checkboxes() {
1316
 
1317
  global $wpdb;