Video Embed & Thumbnail Generator - Version 4.6.24

Version Description

  • April 1, 2019 =
  • Improved method for assigning Google Analytics Event labels.
Download this release

Release Info

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

Code changes from version 4.6.23 to 4.6.24

js/kgvid_video_embed.js CHANGED
@@ -965,7 +965,6 @@ function kgvid_video_counter(id, event) {
965
 
966
  var video_vars = jQuery('#video_'+id+'_div').data('kgvid_video_vars');
967
  var changed = false;
968
- var title = jQuery('#kgvid_'+id+'_wrapper meta[itemprop=name]').attr('content');
969
 
970
  var played = jQuery('#video_'+id+'_div').data("played") || "not played";
971
  if ( played == "not played" ) {
@@ -976,12 +975,12 @@ function kgvid_video_counter(id, event) {
976
  if (typeof gtag != "undefined") {
977
  gtag("event", kgvidL10n_frontend.playstart, {
978
  'event_category': "Videos",
979
- 'event_label': title
980
  });
981
  }
982
- else if (typeof ga != "undefined") { ga("send", "event", "Videos", kgvidL10n_frontend.playstart, title); }
983
- else if (typeof __gaTracker != "undefined") { __gaTracker("send", "event", "Videos", kgvidL10n_frontend.playstart, title); } // Yoast renamed ga function
984
- else if (typeof _gaq != "undefined") { _gaq.push(["_trackEvent", "Videos", kgvidL10n_frontend.playstart, title]); }
985
 
986
  }
987
 
@@ -993,12 +992,12 @@ function kgvid_video_counter(id, event) {
993
  if (typeof gtag != "undefined") {
994
  gtag("event", event+"%", {
995
  'event_category': "Videos",
996
- 'event_label': title
997
  });
998
  }
999
- else if (typeof ga != "undefined") { ga("send", "event", "Videos", event+"%", title); }
1000
- else if (typeof __gaTracker != "undefined") { __gaTracker("send", "event", "Videos", event+"%", title); } // Yoast renamed ga function
1001
- else if (typeof _gaq != "undefined") { _gaq.push(["_trackEvent", "Videos", event+"%", title]); }
1002
 
1003
  }
1004
 
@@ -1010,12 +1009,12 @@ function kgvid_video_counter(id, event) {
1010
  if (typeof gtag != "undefined") {
1011
  gtag("event", kgvidL10n_frontend.completeview, {
1012
  'event_category': "Videos",
1013
- 'event_label': title
1014
  });
1015
  }
1016
- if (typeof ga != "undefined") { ga("send", "event", "Videos", kgvidL10n_frontend.completeview, title); }
1017
- if (typeof __gaTracker != "undefined") { __gaTracker("send", "event", "Videos", kgvidL10n_frontend.completeview, title); } // Yoast renamed ga function
1018
- else if (typeof _gaq != 'undefined') { _gaq.push(['_trackEvent', 'Videos', kgvidL10n_frontend.completeview, title]); }
1019
 
1020
  }
1021
 
@@ -1031,7 +1030,8 @@ function kgvid_video_counter(id, event) {
1031
  action: 'kgvid_count_play',
1032
  security: kgvidL10n_frontend.ajax_nonce,
1033
  post_id: video_vars.attachment_id,
1034
- video_event: event
 
1035
  }, function(data) {
1036
  if ( event == "play" ) { jQuery('#video_'+id+'_viewcount').html(data); }
1037
  });
965
 
966
  var video_vars = jQuery('#video_'+id+'_div').data('kgvid_video_vars');
967
  var changed = false;
 
968
 
969
  var played = jQuery('#video_'+id+'_div').data("played") || "not played";
970
  if ( played == "not played" ) {
975
  if (typeof gtag != "undefined") {
976
  gtag("event", kgvidL10n_frontend.playstart, {
977
  'event_category': "Videos",
978
+ 'event_label': video_vars.title
979
  });
980
  }
981
+ else if (typeof ga != "undefined") { ga("send", "event", "Videos", kgvidL10n_frontend.playstart, video_vars.title); }
982
+ else if (typeof __gaTracker != "undefined") { __gaTracker("send", "event", "Videos", kgvidL10n_frontend.playstart, video_vars.title); } // Yoast renamed ga function
983
+ else if (typeof _gaq != "undefined") { _gaq.push(["_trackEvent", "Videos", kgvidL10n_frontend.playstart, video_vars.title]); }
984
 
985
  }
986
 
992
  if (typeof gtag != "undefined") {
993
  gtag("event", event+"%", {
994
  'event_category': "Videos",
995
+ 'event_label': video_vars.title
996
  });
997
  }
998
+ else if (typeof ga != "undefined") { ga("send", "event", "Videos", event+"%", video_vars.title); }
999
+ else if (typeof __gaTracker != "undefined") { __gaTracker("send", "event", "Videos", event+"%", video_vars.title); } // Yoast renamed ga function
1000
+ else if (typeof _gaq != "undefined") { _gaq.push(["_trackEvent", "Videos", event+"%", video_vars.title]); }
1001
 
1002
  }
1003
 
1009
  if (typeof gtag != "undefined") {
1010
  gtag("event", kgvidL10n_frontend.completeview, {
1011
  'event_category': "Videos",
1012
+ 'event_label': video_vars.title
1013
  });
1014
  }
1015
+ if (typeof ga != "undefined") { ga("send", "event", "Videos", kgvidL10n_frontend.completeview, video_vars.title); }
1016
+ if (typeof __gaTracker != "undefined") { __gaTracker("send", "event", "Videos", kgvidL10n_frontend.completeview, video_vars.title); } // Yoast renamed ga function
1017
+ else if (typeof _gaq != 'undefined') { _gaq.push(['_trackEvent', 'Videos', kgvidL10n_frontend.completeview, video_vars.title]); }
1018
 
1019
  }
1020
 
1030
  action: 'kgvid_count_play',
1031
  security: kgvidL10n_frontend.ajax_nonce,
1032
  post_id: video_vars.attachment_id,
1033
+ video_event: event,
1034
+ show_views: jQuery('#video_'+id+'_viewcount').length
1035
  }, function(data) {
1036
  if ( event == "play" ) { jQuery('#video_'+id+'_viewcount').html(data); }
1037
  });
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, video thumbnail, ffmpeg, resolution
5
  Requires at least: 4.4
6
- Tested up to: 5.0
7
- Stable tag: 4.6.23
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -248,6 +248,9 @@ Enter the username & password in the plugin settings "FFMPEG Settings" tab, or u
248
 
249
  == Changelog ==
250
 
 
 
 
251
  = 4.6.23 - March 26, 2019 =
252
  * Added option to override WordPress built-in [video] shortcodes.
253
  * Fixed bug that prevented generating in-browser thumbnails more than once without reloading the page.
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, video thumbnail, ffmpeg, resolution
5
  Requires at least: 4.4
6
+ Tested up to: 5.1
7
+ Stable tag: 4.6.24
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
248
 
249
  == Changelog ==
250
 
251
+ = 4.6.24 - April 1, 2019 =
252
+ * Improved method for assigning Google Analytics Event labels.
253
+
254
  = 4.6.23 - March 26, 2019 =
255
  * Added option to override WordPress built-in [video] shortcodes.
256
  * Fixed bug that prevented generating in-browser thumbnails more than once without reloading the page.
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.6.23
7
  Author: Kyle Gilman
8
  Author URI: http://www.kylegilman.net/
9
  Text Domain: video-embed-thumbnail-generator
@@ -60,7 +60,7 @@ function kgvid_default_options_fn() {
60
  $edit_others_capable = kgvid_check_if_capable('edit_others_posts');
61
 
62
  $options = array(
63
- "version" => '4.6.23',
64
  "embed_method" => "Video.js",
65
  "jw_player_id" => "",
66
  "template" => false,
@@ -2650,7 +2650,8 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
2650
  'auto_res' => $query_atts['auto_res'],
2651
  'pixel_ratio' => $query_atts['pixel_ratio'],
2652
  'right_click' => $query_atts['right_click'],
2653
- 'playback_rate' => $query_atts['playback_rate']
 
2654
  );
2655
 
2656
  if ( $options['embed_method'] == "Video.js" || $options['embed_method'] == "Strobe Media Playback" ) {
@@ -2736,12 +2737,7 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
2736
  else { $schema_embedURL = $content; }
2737
  $code .= '<meta itemprop="embedUrl" content="'.esc_attr($schema_embedURL).'" />';
2738
  $code .= '<meta itemprop="contentUrl" content="'.$content.'" />';
2739
-
2740
- if ( !empty($query_atts['title']) && $query_atts['title'] != "false" ) { $code .= '<meta itemprop="name" content="'.esc_attr($query_atts['title']).'" />'; }
2741
- elseif ( in_the_loop() && !is_attachment() ) {
2742
- global $post;
2743
- if ( !empty($post->post_title) ) { $code .= '<meta itemprop="name" content="'.esc_attr($post->post_title).'" />'; }
2744
- }
2745
 
2746
  $description = kgvid_generate_video_description($query_atts);
2747
 
@@ -8908,6 +8904,7 @@ function kgvid_count_play() {
8908
 
8909
  $post_id = $_POST['post_id'];
8910
  $event = $_POST['video_event'];
 
8911
  if ( $event == "play" ) { $event = "starts"; }
8912
  if ( $event == "end" ) { $event = "completeviews"; }
8913
  if ( is_numeric($event) ) { $event = "play_".$event; }
@@ -8917,7 +8914,10 @@ function kgvid_count_play() {
8917
  else { $plays = 1; }
8918
  $kgvid_postmeta[$event] = $plays;
8919
  kgvid_save_attachment_meta($post_id, $kgvid_postmeta);
8920
- echo sprintf( _n( '%s view', '%s views', $plays, 'video-embed-thumbnail-generator'), number_format($plays) );
 
 
 
8921
  die(); // stop executing script
8922
 
8923
  }
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.6.24
7
  Author: Kyle Gilman
8
  Author URI: http://www.kylegilman.net/
9
  Text Domain: video-embed-thumbnail-generator
60
  $edit_others_capable = kgvid_check_if_capable('edit_others_posts');
61
 
62
  $options = array(
63
+ "version" => '4.6.24',
64
  "embed_method" => "Video.js",
65
  "jw_player_id" => "",
66
  "template" => false,
2650
  'auto_res' => $query_atts['auto_res'],
2651
  'pixel_ratio' => $query_atts['pixel_ratio'],
2652
  'right_click' => $query_atts['right_click'],
2653
+ 'playback_rate' => $query_atts['playback_rate'],
2654
+ 'title' => $stats_title
2655
  );
2656
 
2657
  if ( $options['embed_method'] == "Video.js" || $options['embed_method'] == "Strobe Media Playback" ) {
2737
  else { $schema_embedURL = $content; }
2738
  $code .= '<meta itemprop="embedUrl" content="'.esc_attr($schema_embedURL).'" />';
2739
  $code .= '<meta itemprop="contentUrl" content="'.$content.'" />';
2740
+ $code .= '<meta itemprop="name" content="'.esc_attr($stats_title).'" />';
 
 
 
 
 
2741
 
2742
  $description = kgvid_generate_video_description($query_atts);
2743
 
8904
 
8905
  $post_id = $_POST['post_id'];
8906
  $event = $_POST['video_event'];
8907
+ $show_views = $_POST['show_views'];
8908
  if ( $event == "play" ) { $event = "starts"; }
8909
  if ( $event == "end" ) { $event = "completeviews"; }
8910
  if ( is_numeric($event) ) { $event = "play_".$event; }
8914
  else { $plays = 1; }
8915
  $kgvid_postmeta[$event] = $plays;
8916
  kgvid_save_attachment_meta($post_id, $kgvid_postmeta);
8917
+ if ( $show_views > 0 ) { //only return number of views if they are displayed on the site
8918
+ echo sprintf( _n( '%s view', '%s views', $plays, 'video-embed-thumbnail-generator'), number_format($plays) );
8919
+ }
8920
+ else { echo ''; }
8921
  die(); // stop executing script
8922
 
8923
  }