YouTube Embed - Version 3.2

Version Description

  • Bug: Prevented download bar SPAN from appearing even when switched off
  • Bug: Fixed issue that caused playlists to not appear
  • Enhancement: Added new shortcode for displaying video comments
  • Enhancement: IFRAME output now includes metadata
  • Enhancement: Editor button will now work with MCE4 editor (WP 3.9+)
  • Enhancement: SVG icon used in admin menu for WP 3.8+
Download this release

Release Info

Developer Applian
Plugin Icon 128x128 YouTube Embed
Version 3.2
Comparing to
See all releases

Code changes from version 3.1 to 3.2

css/admin.css CHANGED
@@ -1,4 +1,17 @@
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /* Administration screen styles */
3
 
4
  .ytbox_grey {
1
 
2
+ /* Add extra dashicons for MCE4 editor */
3
+
4
+ i.mce-i-icon {
5
+ font: 400 20px/1 dashicons;
6
+ padding: 0;
7
+ vertical-align: top;
8
+ speak: none;
9
+ -webkit-font-smoothing: antialiased;
10
+ -moz-osx-font-smoothing: grayscale;
11
+ margin-left: -2px;
12
+ padding-right: 2px
13
+ }
14
+
15
  /* Administration screen styles */
16
 
17
  .ytbox_grey {
css/admin.min.css CHANGED
@@ -1 +1 @@
1
- .ytbox_grey{background-color:#f1f1f1;padding:10px;border:1px solid #ddd;}.yt_heading{font-weight:bold;font-size:1.1em;}#np-notepad ul{list-style:disc;}#np-notepad ul,ol{margin-left:60px;}.ye-container{position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden;}.ye-container iframe,.ye-container object,.ye-container embed{position:absolute;top:0;left:0;width:100%;height:100%;}.wp_themeSkin span.mce_YouTube{background:url('../images/youtube_button_b&w.png') no-repeat 0 0;}.wp_themeSkin span.mce_YouTube:hover{background:url('../images/youtube_button_color.png') no-repeat 0 0;}
1
+ i.mce-i-icon{font:400 20px/1 dashicons;vertical-align:top;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin-left:-2px;padding:0 2px 0 0}.ytbox_grey{background-color:#f1f1f1;border:1px solid #ddd;padding:10px}.yt_heading{font-weight:bold;font-size:1.1em}#np-notepad ul{list-style:disc}#np-notepad ul,ol{margin-left:60px}.ye-container{position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden}.ye-container iframe,.ye-container object,.ye-container embed{position:absolute;top:0;left:0;width:100%;height:100%}.wp_themeSkin span.mce_YouTube{background:url(../images/youtube_button_b&w.png) no-repeat 0 0}.wp_themeSkin span.mce_YouTube:hover{background:url(../images/youtube_button_color.png) no-repeat 0 0}
images/Thumbs.db DELETED
Binary file
includes/add-mce-button.php CHANGED
@@ -51,7 +51,15 @@ add_action( 'init', 'youtube_embed_button' );
51
  */
52
 
53
  function register_youtube_embed_button( $buttons ) {
54
- array_push( $buttons, '|', 'YouTube' );
 
 
 
 
 
 
 
 
55
  return $buttons;
56
  }
57
 
@@ -67,7 +75,15 @@ function register_youtube_embed_button( $buttons ) {
67
  */
68
 
69
  function add_youtube_embed_mce_plugin( $plugin_array ) {
70
- $plugin_array[ 'YouTube' ] = plugins_url() . '/youtube-embed/js/mce-button.min.php';
 
 
 
 
 
 
 
 
71
  return $plugin_array;
72
  }
73
  ?>
51
  */
52
 
53
  function register_youtube_embed_button( $buttons ) {
54
+
55
+ global $wp_version;
56
+
57
+ if ( ( float ) $wp_version < 3.9 ) {
58
+ array_push( $buttons, '|', 'YouTube' );
59
+ } else {
60
+ array_push( $buttons, 'mce4_youtube_button' );
61
+ }
62
+
63
  return $buttons;
64
  }
65
 
75
  */
76
 
77
  function add_youtube_embed_mce_plugin( $plugin_array ) {
78
+
79
+ global $wp_version;
80
+
81
+ if ( ( float ) $wp_version < 3.9 ) {
82
+ $plugin_array[ 'YouTube' ] = plugins_url() . '/youtube-embed/js/mce-button.min.php';
83
+ } else {
84
+ $plugin_array[ 'mce4_youtube_button' ] = plugins_url() . '/youtube-embed/js/mce4-button.min.php';
85
+ }
86
+
87
  return $plugin_array;
88
  }
89
  ?>
includes/admin-config.php CHANGED
@@ -72,6 +72,8 @@ add_filter( 'plugin_row_meta', 'vye_set_plugin_meta', 10, 2 );
72
 
73
  function vye_menu_initialise() {
74
 
 
 
75
  // Get level access for menus
76
 
77
  $options = vye_set_general_defaults();
@@ -83,8 +85,14 @@ function vye_menu_initialise() {
83
  $contextual_help = vye_contextual_help_type();
84
 
85
  // Add main admin option
 
 
 
 
 
 
86
 
87
- add_menu_page( __( 'About Vixy YouTube Embed', 'youtube-embed' ), __( 'YouTube', 'youtube-embed' ), $menu_access, 'general-options', 'vye_general_options', plugins_url() . '/youtube-embed/images/admin_menu_icon.png' );
88
 
89
  // Add options sub-menu
90
 
72
 
73
  function vye_menu_initialise() {
74
 
75
+ global $wp_version;
76
+
77
  // Get level access for menus
78
 
79
  $options = vye_set_general_defaults();
85
  $contextual_help = vye_contextual_help_type();
86
 
87
  // Add main admin option
88
+
89
+ if ( ( float ) $wp_version < 3.8 ) {
90
+ $menu_icon = plugins_url() . '/youtube-embed/images/admin_menu_icon.png';
91
+ } else {
92
+ $menu_icon = 'dashicons-video-alt3';
93
+ }
94
 
95
+ add_menu_page( __( 'About Vixy YouTube Embed', 'youtube-embed' ), __( 'YouTube', 'youtube-embed' ), $menu_access, 'general-options', 'vye_general_options', $menu_icon, 12 );
96
 
97
  // Add options sub-menu
98
 
includes/generate-comments-code.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Create comments
4
+ *
5
+ * All functions relating to listing video comments
6
+ *
7
+ * @package YouTube-Embed
8
+ * @since 3.2
9
+ */
10
+
11
+ /**
12
+ * Get YouTube comments
13
+ *
14
+ * Generate output of video comments
15
+ *
16
+ * @since 3.2
17
+ *
18
+ * @uses vye_extract_id Extract the ID
19
+ * @uses vye_get_file Get a file
20
+ * @uses vye_set_general_defaults Set default options
21
+ * @uses vye_validate_id Validate the ID
22
+ *
23
+ * @param string $id Video ID
24
+ * @param string $language Language
25
+ * @return string $output Transcript output
26
+ */
27
+
28
+ function vye_generate_comments( $paras ) {
29
+
30
+ extract( $paras );
31
+ if ( $id == '' ) { return vye_error( __( 'No YouTube ID was specified.', 'youtube-embed' ) ); }
32
+
33
+ // Extract the ID if a full URL has been specified
34
+
35
+ $id = vye_extract_id( $id );
36
+
37
+ // Check what type of video it is and whether it's valid
38
+
39
+ $embed_type = vye_validate_id( $id );
40
+ if ( $embed_type != 'v' ) {
41
+ if ( strlen( $embed_type ) > 1 ) {
42
+ return vye_error( $embed_type );
43
+ } else {
44
+ return vye_error( sprintf( __( 'The YouTube ID of %s is invalid.', 'youtube-embed' ), $id ) );
45
+ }
46
+ }
47
+
48
+ // Get general options
49
+
50
+ $general = vye_set_general_defaults();
51
+
52
+ // Get cache time
53
+
54
+ if ( $cache == '' ) { $cache = $general[ 'comments_cache' ]; }
55
+
56
+ // Check to see if cache is available
57
+
58
+ if ( $cache != 0 ) {
59
+ $cache_key = 'vye_comments_' . $id;
60
+ $output = get_transient( $cache_key );
61
+ $output = false;
62
+ if ( $output !== false) { return $output; }
63
+ }
64
+
65
+ // Get transcript file
66
+
67
+ $return = vye_get_file( 'https://gdata.youtube.com/feeds/api/videos/' . $id . '/comments?orderby=published' );
68
+ $xml = $return[ 'file' ];
69
+ $output = '';
70
+
71
+ // If comments file exists process the XML and build the output
72
+
73
+ if ( $return[ 'rc' ] == 0 ) {
74
+
75
+ // Set default values
76
+
77
+ $output = "<!-- Vixy YouTube Embed v" . youtube_embed_version . " -->\n" . '<div id="comments">' . "\n";
78
+ $pos = 0;
79
+ $eof = false;
80
+ $number = 1;
81
+ if ( !is_numeric( $avatar ) ) { $avatar = 32; }
82
+ if ( !is_numeric( $limit ) ) { $limit = 10; }
83
+
84
+ $tab = "\t";
85
+
86
+ while ( !$eof ) {
87
+
88
+ $entry = vye_extract_xml( $xml, 'entry' );
89
+ if ( $entry != '' ) {
90
+
91
+ // Extract field data from XML
92
+
93
+ $published = human_time_diff( strtotime( vye_extract_xml( $entry, 'published' ) ) );
94
+ $comment = vye_extract_xml( $entry, 'content' );
95
+ $user = vye_extract_xml( $entry, 'name' );
96
+ $profile_url = 'http://www.youtube.com/user/' . $user;
97
+ $user_xml_url = vye_extract_xml( $entry, 'uri' );
98
+
99
+ // Get user image URL from a seperate XML file
100
+
101
+ $image_url = '';
102
+ $user_xml = wp_remote_get( $user_xml_url );
103
+ $start_pos = strpos( $user_xml[ 'body' ], '<media:thumbnail url=' );
104
+ if ( $start_pos !== false ) {
105
+ $start_pos = $start_pos + 22;
106
+ $end_pos = strpos( $user_xml[ 'body' ], '/>', $start_pos );
107
+ if ( $end_pos !== false ) {
108
+ $end_pos = $end_pos - 2;
109
+ $image_url = substr( $user_xml[ 'body' ], $start_pos, $end_pos - $start_pos + 1 );
110
+ }
111
+ }
112
+
113
+ // Using the information fetched above built the comment output
114
+
115
+ $output .= '<div id="comment-' . $number . '">' . "\n";
116
+ $output .= $tag . '<div class="comment-author">' . "\n";
117
+ if ( is_numeric( $avatar ) ) { $output .= $tab . $tab . '<img alt="" src="' . $image_url . '" class="avatar avatar-' . $avatar . '" height="' . $avatar . 'px" width="' . $avatar . 'px" />' . "\n"; }
118
+ $output .= $tab . $tab . '<cite class="fn"><a href="' . $profile_url . '" rel="external nofollow" class="url">' . $user . '</a></cite>' . "\n";
119
+ $output .= $tab . '</div>' . "\n";
120
+ $output .= $tab . '<div class="comment-meta commentmetadata">' . $published . ' ' . __( 'ago', 'youtube-embed' ) . '</div>' . "\n";
121
+ $output .= $tab . '<div class="comment-body"><p>' . $comment . '</p></div>' . "\n";
122
+ $output .= '</div>' . "\n";
123
+
124
+ $number++;
125
+ if ( $number > $limit ) { $eof = true; }
126
+
127
+ } else {
128
+ $eof = true;
129
+ }
130
+
131
+ // Remove current record from the XML file
132
+
133
+ $next_record = strpos( $xml, '</entry>' );
134
+ if ( $next_record !== false ) { $xml = substr( $xml, $next_record + 8 ); }
135
+
136
+ }
137
+
138
+ $output .= "</div>\n<!-- End of Vixy YouTube Embed code -->\n";
139
+ }
140
+
141
+ // Save the cache
142
+
143
+ if ( $cache != 0 ) { set_transient( $cache_key, $output, 60 * $cache ); }
144
+
145
+ return $output;
146
+ }
147
+ ?>
includes/generate-embed-code.php CHANGED
@@ -462,9 +462,20 @@ function vye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
462
 
463
  if ( ( $iframe ) or ( ( $embedplus ) && ( $fallback == "v" ) ) ) {
464
  if ( $embed_type == "p" ) { $playlist_para = "p/"; } else { $playlist_para = ''; }
 
465
  $result .= $tab . '<iframe ' . $frameborder . 'style="border: 0;' . $style . '" class="' . $class . '" width="' . $width . '" height="' . $height . '" src="' . $embed_url . '&amp;wmode=' . $wmode . '"';
466
  if ( $fullscreen == 1 ) { $result .= ' allowfullscreen="allowfullscreen"'; }
467
  $result .= " ></iframe>\n";
 
 
 
 
 
 
 
 
 
 
468
  }
469
 
470
  // If using EmbedPlus, add the OBJECT closure tag
462
 
463
  if ( ( $iframe ) or ( ( $embedplus ) && ( $fallback == "v" ) ) ) {
464
  if ( $embed_type == "p" ) { $playlist_para = "p/"; } else { $playlist_para = ''; }
465
+ if ( $metadata != 0 ) { $result .= $tab . '<span itemscope="itemscope" xmlns:media="http://search.yahoo.com/searchmonkey/media/" xmlns:dc="http://purl.org/dc/terms/">' . "\n"; $tab .= $tab; }
466
  $result .= $tab . '<iframe ' . $frameborder . 'style="border: 0;' . $style . '" class="' . $class . '" width="' . $width . '" height="' . $height . '" src="' . $embed_url . '&amp;wmode=' . $wmode . '"';
467
  if ( $fullscreen == 1 ) { $result .= ' allowfullscreen="allowfullscreen"'; }
468
  $result .= " ></iframe>\n";
469
+ if ( $metadata != 0 ) {
470
+ $result .= $tab . '<link itemprop="media:video" rel="alternate" href="http' . $https . '://www.youtube.com/' . $embed_type . '/' . $id . '"/>' . "\n";
471
+ $result .= $tab . '<link itemprop="media:thumbnail" rel="icon" href="http://i.ytimg.com/vi/' . $id . '/hqdefault.jpg"/>' . "\n";
472
+ $result .= $tab . '<link itemprop="media:thumbnail" rel="icon" href="http://i.ytimg.com/vi/' . $id . '/default.jpg"/>' . "\n";
473
+ if ( $return[ 'title' ] != '' ) { $result .= $tab . '<meta itemprop="media:title" content="' . htmlentities( $return[ 'title' ] ) . '"/>' . "\n"; }
474
+ $result .= $tab . '<meta itemprop="media:width" content="' . $width . '"/>' . "\n";
475
+ $result .= $tab . '<meta itemprop="media:height" content="' . $height . '"/>' . "\n";
476
+ $tab = "\t";
477
+ $result .= $tab . '</span>' . "\n";
478
+ }
479
  }
480
 
481
  // If using EmbedPlus, add the OBJECT closure tag
includes/options-general.php CHANGED
@@ -36,6 +36,7 @@ if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'youtube-embed-general', 'yo
36
  $options[ 'embed_cache' ] = $_POST[ 'youtube_embed_embed_cache' ];
37
  $options[ 'info_cache' ] = $_POST[ 'youtube_embed_info_cache' ];
38
  $options[ 'transcript_cache' ] = $_POST[ 'youtube_embed_transcript_cache' ];
 
39
  $options[ 'fetch_title' ] = $_POST[ 'youtube_embed_fetch_title' ];
40
  $options[ 'alt_profile' ] = $_POST[ 'youtube_embed_alt_profile' ];
41
  $options[ 'alt_profile2' ] = $_POST[ 'youtube_embed_alt_profile2' ];
@@ -81,7 +82,7 @@ if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'youtube-embed-general', 'yo
81
 
82
  if ( !empty( $_POST[ 'youtube_embed_clear_cache' ] ) ) {
83
  global $wpdb;
84
- $wpdb -> query( "DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_%ye_video_%' OR option_name LIKE '_transient_%ye_type_%' OR option_name LIKE '_transient_%ye_title_%'" );
85
  $update_message .= ' ' . __( 'Cache cleared.', 'youtube-embed' );
86
  }
87
 
@@ -100,7 +101,14 @@ $editor_sc = vye_set_editor_sc();
100
 
101
  <form method="post" action="<?php echo get_bloginfo( 'wpurl' ).'/wp-admin/admin.php?page=general-options' ?>">
102
 
103
- <span class="yt_heading"><?php _e( 'Embedding', 'youtube-embed' ); ?></span>
 
 
 
 
 
 
 
104
 
105
  <table class="form-table">
106
  <tr>
@@ -254,6 +262,11 @@ $editor_sc = vye_set_editor_sc();
254
  <tr>
255
  <th scope="row"><?php _e( 'Transcript Cache', 'youtube-embed' ); ?></th>
256
  <td><input type="text" size="3" maxlength="3" name="youtube_embed_transcript_cache" value="<?php echo $options[ 'transcript_cache' ]; ?>"/>&nbsp;<span class="description"><?php _e( 'How many hours to store transcripts for in cache. 0 to switch off', 'youtube-embed' ); ?></span></td>
 
 
 
 
 
257
  </tr></table>
258
 
259
  <?php
@@ -261,8 +274,9 @@ global $wpdb;
261
  $video_cache = $wpdb -> get_var( "SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_%ye_video_%'" );
262
  $type_cache = $wpdb -> get_var( "SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_%ye_type_%'" );
263
  $title_cache = $wpdb -> get_var( "SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_%ye_title_%'" );
 
264
 
265
- echo '<p>' . __( 'You currently have cache for', 'youtube_embed' ) . ' ' . number_format( $video_cache ) . ' video' . ( $video_cache <> 1 ? 's' : '' ) . ', ' . number_format( $type_cache ) . ' video type' . ( $type_cache <> 1 ? 's' : '' ) . ' ' . __( 'and', 'youtube_embed' ) . ' ' . number_format( $title_cache ) . ' title' . ( $title_cache <> 1 ? 's' : '' ) . ".</p>\n";
266
  ?>
267
 
268
  <table class="form-table"><tr>
@@ -316,12 +330,6 @@ echo '<p>' . __( 'You currently have cache for', 'youtube_embed' ) . ' ' . numbe
316
  <td><input type="checkbox" name="youtube_embed_frameborder" value="1"<?php if ( $options[ 'frameborder' ] == '1' ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'FRAMEBORDER is not HTML5 compliant', 'youtube-embed' ); ?></span></td>
317
  </tr></table>
318
 
319
- <br/><span class="yt_heading"><?php _e( 'Affiliates', 'youtube-embed' ); ?></span>
320
- <table class="form-table"><tr>
321
- <th scope="row"><?php _e( 'ShareASale ID', 'youtube-embed' ); ?></th>
322
- <td><input type="text" maxlength="6" size="6" name="youtube_embed_shareasale_id" value="<?php echo $options[ 'shareasale_id' ]; ?>"/>&nbsp;<span class="description"><?php _e( '<a href="http://www.shareasale.com/r.cfm?B=44&U=668714&M=47&urllink=">Sign up to ShareASale</a> and earn money. <a href="http://vixy.net/youtube-embed/documentation.php#make_money">Read more</a>.', 'youtube-embed' ); ?></span></td>
323
- </tr></table>
324
-
325
  <?php wp_nonce_field( 'youtube-embed-general','youtube_embed_general_nonce', true, true ); ?>
326
 
327
  <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e( 'Save Settings', 'youtube-embed' ); ?>"/></p>
36
  $options[ 'embed_cache' ] = $_POST[ 'youtube_embed_embed_cache' ];
37
  $options[ 'info_cache' ] = $_POST[ 'youtube_embed_info_cache' ];
38
  $options[ 'transcript_cache' ] = $_POST[ 'youtube_embed_transcript_cache' ];
39
+ $options[ 'comments_cache' ] = $_POST[ 'youtube_embed_comments_cache' ];
40
  $options[ 'fetch_title' ] = $_POST[ 'youtube_embed_fetch_title' ];
41
  $options[ 'alt_profile' ] = $_POST[ 'youtube_embed_alt_profile' ];
42
  $options[ 'alt_profile2' ] = $_POST[ 'youtube_embed_alt_profile2' ];
82
 
83
  if ( !empty( $_POST[ 'youtube_embed_clear_cache' ] ) ) {
84
  global $wpdb;
85
+ $wpdb -> query( "DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_%ye_video_%' OR option_name LIKE '_transient_%ye_type_%' OR option_name LIKE '_transient_%ye_title_%' OR option_name LIKE '_transient_%vye_comments_%'" );
86
  $update_message .= ' ' . __( 'Cache cleared.', 'youtube-embed' );
87
  }
88
 
101
 
102
  <form method="post" action="<?php echo get_bloginfo( 'wpurl' ).'/wp-admin/admin.php?page=general-options' ?>">
103
 
104
+ <span class="yt_heading"><?php _e( 'Affiliates', 'youtube-embed' ); ?></span>
105
+
106
+ <table class="form-table ytbox_grey"><tr>
107
+ <th scope="row"><?php _e( 'ShareASale ID', 'youtube-embed' ); ?></th>
108
+ <td><input type="text" maxlength="6" size="6" name="youtube_embed_shareasale_id" value="<?php echo $options[ 'shareasale_id' ]; ?>"/>&nbsp;<span class="description"><?php _e( '<a href="http://www.shareasale.com/r.cfm?B=44&U=668714&M=47&urllink=">Sign up to ShareASale</a> and earn money. <a href="http://vixy.net/youtube-embed/documentation.php#make_money">Read more</a>.', 'youtube-embed' ); ?></span></td>
109
+ </tr></table>
110
+
111
+ <br/><span class="yt_heading"><?php _e( 'Embedding', 'youtube-embed' ); ?></span>
112
 
113
  <table class="form-table">
114
  <tr>
262
  <tr>
263
  <th scope="row"><?php _e( 'Transcript Cache', 'youtube-embed' ); ?></th>
264
  <td><input type="text" size="3" maxlength="3" name="youtube_embed_transcript_cache" value="<?php echo $options[ 'transcript_cache' ]; ?>"/>&nbsp;<span class="description"><?php _e( 'How many hours to store transcripts for in cache. 0 to switch off', 'youtube-embed' ); ?></span></td>
265
+ </tr>
266
+
267
+ <tr>
268
+ <th scope="row"><?php _e( 'Comments Cache', 'youtube-embed' ); ?></th>
269
+ <td><input type="text" size="3" maxlength="3" name="youtube_embed_comments_cache" value="<?php echo $options[ 'comments_cache' ]; ?>"/>&nbsp;<span class="description"><?php _e( 'How many minutes to store video comments for in cache. 0 to switch off', 'youtube-embed' ); ?></span></td>
270
  </tr></table>
271
 
272
  <?php
274
  $video_cache = $wpdb -> get_var( "SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_%ye_video_%'" );
275
  $type_cache = $wpdb -> get_var( "SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_%ye_type_%'" );
276
  $title_cache = $wpdb -> get_var( "SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_%ye_title_%'" );
277
+ $comment_cache = $wpdb -> get_var( "SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_%vye_commentse_%'" );
278
 
279
+ echo '<p>' . __( 'You currently have cache for', 'youtube_embed' ) . ' ' . number_format( $video_cache ) . ' video' . ( $video_cache <> 1 ? 's' : '' ) . ', ' . number_format( $type_cache ) . ' video type' . ( $type_cache <> 1 ? 's' : '' ) . ', ' . number_format( $title_cache ) . ' title' . ( $title_cache <> 1 ? 's' : '' ) . ' ' . __( 'and', 'youtube_embed' ) . ' ' . number_format( $comment_cache ) . ' comment' . ( $comment_cache <> 1 ? 's' : '' ) . ".</p>\n";
280
  ?>
281
 
282
  <table class="form-table"><tr>
330
  <td><input type="checkbox" name="youtube_embed_frameborder" value="1"<?php if ( $options[ 'frameborder' ] == '1' ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'FRAMEBORDER is not HTML5 compliant', 'youtube-embed' ); ?></span></td>
331
  </tr></table>
332
 
 
 
 
 
 
 
333
  <?php wp_nonce_field( 'youtube-embed-general','youtube_embed_general_nonce', true, true ); ?>
334
 
335
  <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e( 'Save Settings', 'youtube-embed' ); ?>"/></p>
includes/set-defaults.php CHANGED
@@ -123,6 +123,7 @@ function vye_set_general_defaults() {
123
  if ( !array_key_exists( 'info_cache', $options ) ) { $options[ 'info_cache' ] = 1; $changed = true; }
124
  if ( !array_key_exists( 'embed_cache', $options ) ) { $options[ 'embed_cache' ] = 24; $changed = true; }
125
  if ( !array_key_exists( 'transcript_cache', $options ) ) { $options[ 'transcript_cache' ] = 24; $changed = true; }
 
126
  if ( !array_key_exists( 'alt_profile', $options ) ) { $options[ 'alt_profile' ] = 0; $changed = true; }
127
  if ( !array_key_exists( 'alt_profile2', $options ) ) { $options[ 'alt_profile2' ] = 0; $changed = true; }
128
  if ( !array_key_exists( 'bracket', $options ) ) { $options[ 'bracket' ] = ''; $changed = true; }
@@ -230,6 +231,9 @@ function vye_set_profile_defaults( $profile ) {
230
  if ( !array_key_exists( 'dynamic', $options ) ) { $options[ 'dynamic' ] = ''; $changed = true; }
231
  if ( !array_key_exists( 'fixed', $options ) ) { $options[ 'fixed' ] = ''; $changed = true; }
232
  if ( !array_key_exists( 'download_style', $options ) ) { $options[ 'download_style' ] = ''; $changed = true; }
 
 
 
233
 
234
  // Update the options, if changed, and return the result
235
 
123
  if ( !array_key_exists( 'info_cache', $options ) ) { $options[ 'info_cache' ] = 1; $changed = true; }
124
  if ( !array_key_exists( 'embed_cache', $options ) ) { $options[ 'embed_cache' ] = 24; $changed = true; }
125
  if ( !array_key_exists( 'transcript_cache', $options ) ) { $options[ 'transcript_cache' ] = 24; $changed = true; }
126
+ if ( !array_key_exists( 'comments_cache', $options ) ) { $options[ 'comments_cache' ] = 60; $changed = true; }
127
  if ( !array_key_exists( 'alt_profile', $options ) ) { $options[ 'alt_profile' ] = 0; $changed = true; }
128
  if ( !array_key_exists( 'alt_profile2', $options ) ) { $options[ 'alt_profile2' ] = 0; $changed = true; }
129
  if ( !array_key_exists( 'bracket', $options ) ) { $options[ 'bracket' ] = ''; $changed = true; }
231
  if ( !array_key_exists( 'dynamic', $options ) ) { $options[ 'dynamic' ] = ''; $changed = true; }
232
  if ( !array_key_exists( 'fixed', $options ) ) { $options[ 'fixed' ] = ''; $changed = true; }
233
  if ( !array_key_exists( 'download_style', $options ) ) { $options[ 'download_style' ] = ''; $changed = true; }
234
+ if ( !array_key_exists( 'link_to_youtube', $options ) ) { $options[ 'link_to_youtube' ] = ''; $changed = true; }
235
+ if ( !array_key_exists( 'vixy_download', $options ) ) { $options[ 'vixy_download' ] = ''; $changed = true; }
236
+ if ( !array_key_exists( 'vq', $options ) ) { $options[ 'vq' ] = ''; $changed = true; }
237
 
238
  // Update the options, if changed, and return the result
239
 
includes/shared-functions.php CHANGED
@@ -523,7 +523,6 @@ function vye_add_links( $link_to_youtube, $vixy_download, $download_style, $id,
523
 
524
  if ( ( $link ) or ( $vixy_download == 1 ) ) {
525
 
526
- $result .= '<br/><span style="' . $download_style . '" class="vye_links">';
527
 
528
  // Show link to YouTube
529
 
@@ -536,10 +535,57 @@ function vye_add_links( $link_to_youtube, $vixy_download, $download_style, $id,
536
 
537
  if ( $vixy_download == 1 ) { $result .= vye_generate_download_code( $id ); }
538
 
539
- $result .= "</span>\n";
 
 
 
 
 
540
 
541
  }
542
 
543
  return $result;
544
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
545
  ?>
523
 
524
  if ( ( $link ) or ( $vixy_download == 1 ) ) {
525
 
 
526
 
527
  // Show link to YouTube
528
 
535
 
536
  if ( $vixy_download == 1 ) { $result .= vye_generate_download_code( $id ); }
537
 
538
+ // If anything added wrap in SPAN and, optional, style information
539
+
540
+ if ( $result != '' ) {
541
+ $result = '<br/><span style="' . $download_style . '" class="vye_links">' . $result;
542
+ $result .= "</span>\n";
543
+ }
544
 
545
  }
546
 
547
  return $result;
548
  }
549
+
550
+ /**
551
+ * Extract XML (2.0)
552
+ *
553
+ * Function to extract from an XML compatible file
554
+ *
555
+ * @since
556
+ *
557
+ * @param string $input The XML file
558
+ * @param string $tag The tag to search for
559
+ * @return string The tag contents
560
+ */
561
+
562
+ function vye_extract_xml( $input, $tag ) {
563
+
564
+ $field = '';
565
+ $tag = trim( $tag );
566
+
567
+ // Find start tag
568
+
569
+ $start_tag = strpos( $input, '<' . $tag . ' ' );
570
+ if ( !$start_tag ) { $start_tag = strpos( $input, '<' . $tag . '>' ); }
571
+
572
+ if ( $start_tag !== false ) {
573
+
574
+ // Find the end of the start field
575
+
576
+ $field_start = strpos( $input, '>', $start_tag );
577
+
578
+ // Find the end tag
579
+
580
+ $field_end = strpos( $input, '</' . $tag . '>' );
581
+
582
+ // Now extract the field
583
+
584
+ if ( ( $field_start !== false ) && ( $field_start !== false ) ) {
585
+ $field = substr( $input, $field_start + 1, $field_end - $field_start - 1 );
586
+ }
587
+ }
588
+
589
+ return $field;
590
+ }
591
  ?>
includes/shortcodes.php CHANGED
@@ -270,4 +270,28 @@ function vye_video_name_shortcode( $paras = '', $content = '' ) {
270
  }
271
 
272
  add_shortcode( 'youtube_name', 'vye_video_name_shortcode' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  ?>
270
  }
271
 
272
  add_shortcode( 'youtube_name', 'vye_video_name_shortcode' );
273
+
274
+ /**
275
+ * Comments Shortcode
276
+ *
277
+ * Shortcode to return YouTube comments
278
+ *
279
+ * @since 3.2
280
+ *
281
+ * @uses vye_generate_comments Generate the comments
282
+ *
283
+ * @param string $paras Shortcode parameters
284
+ * @param string $content Shortcode content
285
+ * @return string Comments output
286
+ */
287
+
288
+ function vye_comments_sc( $paras = '', $content = '' ) {
289
+
290
+ $paras = shortcode_atts( array( 'avatar' => '', 'limit' => '', 'cache' => '' ), $paras );
291
+ $paras[ 'id' ] = $content;
292
+
293
+ return do_shortcode( vye_generate_comments( $paras ) );
294
+ }
295
+
296
+ add_shortcode( 'youtube_comments', 'vye_comments_sc' );
297
  ?>
js/mce4-button.min.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ (function(){
2
+ <?php $cookie_name='vye_mce_shortcode';if(isset($_COOKIE[$cookie_name])){$shortcode=$_COOKIE[$cookie_name];}else{$shortcode='youtube';}?>
3
+ var shortcode="<?php echo $shortcode; ?>";tinymce.PluginManager.add('mce4_youtube_button',function(editor,url){editor.addButton('mce4_youtube_button',{title:'YouTube Embed',icon:'icon dashicons-video-alt3',onclick:function(){selectText=tinymce.activeEditor.selection.getContent({format:'text'});if(selectText==''){var yeOut='Insert video URL or ID here'}else{var yeOut=selectText}editor.insertContent('['+shortcode+']'+yeOut+'[/'+shortcode+']')}})})})();
js/mce4-button.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function() {
2
+ <?php
3
+
4
+ // Get cookie of default shortcode to use
5
+
6
+ $cookie_name = 'vye_mce_shortcode';
7
+ if ( isset( $_COOKIE[ $cookie_name ] ) ) { $shortcode = $_COOKIE[ $cookie_name ]; } else { $shortcode = 'youtube'; }
8
+ ?>
9
+ var shortcode = "<?php echo $shortcode; ?>";
10
+ tinymce.PluginManager.add('mce4_youtube_button', function( editor, url ) {
11
+ editor.addButton( 'mce4_youtube_button', {
12
+ title: 'YouTube Embed',
13
+ icon: 'icon dashicons-video-alt3',
14
+ onclick: function() {
15
+ selectText = tinymce.activeEditor.selection.getContent({format: 'text'});
16
+ if ( selectText == '' ) {
17
+ var yeOut = 'Insert video URL or ID here';
18
+ } else {
19
+ var yeOut = selectText;
20
+ }
21
+ editor.insertContent('[' + shortcode + ']' + yeOut + '[/' + shortcode + ']');
22
+ }
23
+ });
24
+ });
25
+ })();
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Vixy YouTube Embed and Download ===
2
  Contributors: Applian
3
- Tags: admin, annotations, applian, artiss, automatic, download, editor, embed, embedding, embedplus, flash, flv, google, hd, height, iframe, manage, media, plugin, page, play, playlist, post, profile, responsive, search, seo, sidebar, simple, smart, url, user, valid, video, vixy, widget, width, xhtml, youtube, youtuber
4
  Requires at least: 2.9
5
- Tested up to: 3.5.1
6
- Stable tag: 3.1
7
 
8
  A simple method of embedding YouTube videos (with download links) into your pages. Easy to use, but with powerful features for those that need them.
9
 
@@ -23,19 +23,19 @@ Just add a shortcode with the YouTube video ID, and your video appears in the pa
23
 
24
  **Important Setup**
25
 
26
- WordPress requires you to opt-in to the video download feature.
27
 
28
  1. Go to the **Profile** section under the YouTube sidebar option in your WordPress Admin.
29
  2. Tick the **Show Download Links** option under **Options for All Player Types**.
30
 
31
- **Powerful**
32
 
33
  With over 50 embedding options, Vixy YouTube Embed does everything any other WordPress plug-in does, and a lot of things they don't.
34
 
35
  Options include:
36
 
37
  * Set size of video, controls, other behaviors via profiles or inline commands.
38
- * Includes download links option.
39
  * Build your own playlists and play them back however you want
40
  * XHTML and HTML5 compliant - works with all the latest browsers
41
  * Multiple embedding methods available - OBJECT, IFRAME, CHROMELESS and EmbedPlus
@@ -48,6 +48,7 @@ Options include:
48
  * Using a different YouTube plugin? Documentation and tools are provided to help you migrate to Vixy YouTube Embed
49
  * Fully internationalized ready for translations. **If you would like to add a translation to his plugin then please [contact us](http://wordpress.org/support/plugin/youtube-embed "YouTube Embed Support")**
50
  * Support for Do Not Track
 
51
  * Compatible with [Video SEO for WordPress](http://yoast.com/wordpress/video-seo/ "Video SEO for WordPress")
52
  * And much, much more!
53
 
@@ -86,7 +87,7 @@ Vixy YouTube Embed is easy to install:
86
  1. Download the ZIP file containing the plug-in code.
87
  2. Unzip, and upload the entire youtube-embed folder to your wp-content/plugins/ directory.
88
  3. Activate the plug-in through the Plugins menu in WordPress.
89
- 4. Make sure to enable the video download option. Go to the plug-in settings, and check "Enable Download Links".
90
 
91
  That's it, you're done - you just need to add the shortcode wherever you need.
92
 
@@ -107,6 +108,14 @@ A full list of FAQs can be found [on the Vixy.net website](http://vixy.net/youtu
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
 
 
 
110
  = 3.1 =
111
  * Enhancement: Allow user to specify video resolution required (experimental)
112
  * Enhancement: Different languages can be specified for transcripts, other than the English default
@@ -368,20 +377,18 @@ A full list of FAQs can be found [on the Vixy.net website](http://vixy.net/youtu
368
  = 1.0 =
369
  * Initial release
370
 
371
- == Upgrade Notice ==
372
-
373
 
 
 
374
 
375
  = 3.1 =
376
  * Update to add new features including video quality option
377
 
378
  = 3.0.1 =
379
- * Update to fix admin bar links and add some further security improvements
380
-
381
-
382
-
383
- = 3.0 =
384
 
 
385
  * Update for bug fixes and enhancements including a new video download option with affiliate scheme
386
 
387
  = 2.7 =
1
  === Vixy YouTube Embed and Download ===
2
  Contributors: Applian
3
+ Tags: admin, annotations, applian, artiss, automatic, comments, download, editor, embed, embedding, embedplus, flash, flv, google, hd, height, iframe, manage, media, plugin, page, play, playlist, post, profile, responsive, search, seo, sidebar, simple, smart, url, user, valid, video, vixy, widget, width, xhtml, youtube, youtuber
4
  Requires at least: 2.9
5
+ Tested up to: 3.9.1
6
+ Stable tag: 3.2
7
 
8
  A simple method of embedding YouTube videos (with download links) into your pages. Easy to use, but with powerful features for those that need them.
9
 
23
 
24
  **Important Setup**
25
 
26
+ WordPress requires you to opt-in to the video download feature.
27
 
28
  1. Go to the **Profile** section under the YouTube sidebar option in your WordPress Admin.
29
  2. Tick the **Show Download Links** option under **Options for All Player Types**.
30
 
31
+ **Powerful**
32
 
33
  With over 50 embedding options, Vixy YouTube Embed does everything any other WordPress plug-in does, and a lot of things they don't.
34
 
35
  Options include:
36
 
37
  * Set size of video, controls, other behaviors via profiles or inline commands.
38
+ * Includes download links option.
39
  * Build your own playlists and play them back however you want
40
  * XHTML and HTML5 compliant - works with all the latest browsers
41
  * Multiple embedding methods available - OBJECT, IFRAME, CHROMELESS and EmbedPlus
48
  * Using a different YouTube plugin? Documentation and tools are provided to help you migrate to Vixy YouTube Embed
49
  * Fully internationalized ready for translations. **If you would like to add a translation to his plugin then please [contact us](http://wordpress.org/support/plugin/youtube-embed "YouTube Embed Support")**
50
  * Support for Do Not Track
51
+ * Display video comments
52
  * Compatible with [Video SEO for WordPress](http://yoast.com/wordpress/video-seo/ "Video SEO for WordPress")
53
  * And much, much more!
54
 
87
  1. Download the ZIP file containing the plug-in code.
88
  2. Unzip, and upload the entire youtube-embed folder to your wp-content/plugins/ directory.
89
  3. Activate the plug-in through the Plugins menu in WordPress.
90
+ 4. Make sure to enable the video download option. Go to the plug-in settings, and check "Enable Download Links".
91
 
92
  That's it, you're done - you just need to add the shortcode wherever you need.
93
 
108
 
109
  == Changelog ==
110
 
111
+ = 3.2 =
112
+ * Bug: Prevented download bar SPAN from appearing even when switched off
113
+ * Bug: Fixed issue that caused playlists to not appear
114
+ * Enhancement: Added new shortcode for displaying video comments
115
+ * Enhancement: IFRAME output now includes metadata
116
+ * Enhancement: Editor button will now work with MCE4 editor (WP 3.9+)
117
+ * Enhancement: SVG icon used in admin menu for WP 3.8+
118
+
119
  = 3.1 =
120
  * Enhancement: Allow user to specify video resolution required (experimental)
121
  * Enhancement: Different languages can be specified for transcripts, other than the English default
377
  = 1.0 =
378
  * Initial release
379
 
380
+ == Upgrade Notice ==
 
381
 
382
+ = 3.2 =
383
+ * Update to add new features, including the ability to show a video's comments
384
 
385
  = 3.1 =
386
  * Update to add new features including video quality option
387
 
388
  = 3.0.1 =
389
+ * Update to fix admin bar links and add some further security improvements
 
 
 
 
390
 
391
+ = 3.0 =
392
  * Update for bug fixes and enhancements including a new video download option with affiliate scheme
393
 
394
  = 2.7 =
screenshot-1.png CHANGED
Binary file
screenshot-6.png CHANGED
Binary file
youtube-embed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Vixy YouTube Embed
4
  Plugin URI: http://vixy.net/youtube-embed
5
  Description: Embed YouTube Videos in WordPress
6
- Version: 3.1
7
  Author: Applian Technologies Inc.
8
  Author URI: http://www.applian.com
9
  */
@@ -17,7 +17,7 @@ Author URI: http://www.applian.com
17
  * @since 2.0
18
  */
19
 
20
- define( 'youtube_embed_version', '3.1' );
21
 
22
  $functions_dir = WP_PLUGIN_DIR . '/youtube-embed/includes/';
23
 
@@ -51,6 +51,8 @@ if ( is_admin() ) {
51
 
52
  } else {
53
 
 
 
54
  include_once( $functions_dir . 'update-post-content.php' ); // Process post content
55
 
56
  include_once( $functions_dir . 'shortcodes.php' ); // Shortcodes
3
  Plugin Name: Vixy YouTube Embed
4
  Plugin URI: http://vixy.net/youtube-embed
5
  Description: Embed YouTube Videos in WordPress
6
+ Version: 3.2
7
  Author: Applian Technologies Inc.
8
  Author URI: http://www.applian.com
9
  */
17
  * @since 2.0
18
  */
19
 
20
+ define( 'youtube_embed_version', '3.2' );
21
 
22
  $functions_dir = WP_PLUGIN_DIR . '/youtube-embed/includes/';
23
 
51
 
52
  } else {
53
 
54
+ include_once( $functions_dir . 'generate-comments-code.php' ); // Generate video comments
55
+
56
  include_once( $functions_dir . 'update-post-content.php' ); // Process post content
57
 
58
  include_once( $functions_dir . 'shortcodes.php' ); // Shortcodes