YouTube Embed - Version 3.3.1

Version Description

  • Maintenance: Remove reference to Google API, as videos are now not displaying as a result of v2 being retired. Will update the plugin more fully in future release
Download this release

Release Info

Developer dartiss
Plugin Icon 128x128 YouTube Embed
Version 3.3.1
Comparing to
See all releases

Code changes from version 3.3 to 3.3.1

includes/admin-config.php CHANGED
@@ -82,13 +82,13 @@ function vye_menu_initialise() {
82
 
83
  $menu_icon = 'dashicons-video-alt3';
84
 
85
- add_menu_page( __( 'About YouTube Embed', 'youtube-embed' ), __( 'YouTube', 'youtube-embed' ), $menu_access, 'general-options', 'vye_general_options', $menu_icon, 12 );
86
 
87
  // Add options sub-menu
88
 
89
  global $vye_options_hook;
90
 
91
- $vye_options_hook = add_submenu_page( 'general-options', __( 'YouTube Embed Options', 'youtube-embed' ), __( 'Options', 'youtube-embed' ), $menu_access, 'general-options', 'vye_general_options' );
92
 
93
  add_action( 'load-' . $vye_options_hook, 'vye_add_options_help' );
94
 
@@ -96,7 +96,7 @@ function vye_menu_initialise() {
96
 
97
  global $vye_profiles_hook;
98
 
99
- $vye_profiles_hook = add_submenu_page( 'general-options', __( 'YouTube Embed Profiles', 'youtube-embed' ), __( 'Profiles', 'youtube-embed' ), $menu_access, 'profile-options', 'vye_profile_options' );
100
 
101
  add_action( 'load-' . $vye_profiles_hook, 'vye_add_profiles_help' );
102
 
@@ -104,7 +104,7 @@ function vye_menu_initialise() {
104
 
105
  global $vye_lists_hook;
106
 
107
- $vye_lists_hook = add_submenu_page( 'general-options', __( 'YouTube Embed Lists', 'youtube-embed' ), __( 'Lists', 'youtube-embed' ), $menu_access, 'list-options', 'vye_list_options' );
108
 
109
  add_action( 'load-' . $vye_lists_hook, 'vye_add_lists_help' );
110
 
82
 
83
  $menu_icon = 'dashicons-video-alt3';
84
 
85
+ add_menu_page( __( 'About YouTube Embed', 'youtube-embed' ), __( 'YouTube', 'youtube-embed' ), $menu_access, 've-general-options', 'vye_general_options', $menu_icon, 12 );
86
 
87
  // Add options sub-menu
88
 
89
  global $vye_options_hook;
90
 
91
+ $vye_options_hook = add_submenu_page( 've-general-options', __( 'YouTube Embed Options', 'youtube-embed' ), __( 'Options', 'youtube-embed' ), $menu_access, 've-general-options', 'vye_general_options' );
92
 
93
  add_action( 'load-' . $vye_options_hook, 'vye_add_options_help' );
94
 
96
 
97
  global $vye_profiles_hook;
98
 
99
+ $vye_profiles_hook = add_submenu_page( 've-general-options', __( 'YouTube Embed Profiles', 'youtube-embed' ), __( 'Profiles', 'youtube-embed' ), $menu_access, 've-profile-options', 'vye_profile_options' );
100
 
101
  add_action( 'load-' . $vye_profiles_hook, 'vye_add_profiles_help' );
102
 
104
 
105
  global $vye_lists_hook;
106
 
107
+ $vye_lists_hook = add_submenu_page( 've-general-options', __( 'YouTube Embed Lists', 'youtube-embed' ), __( 'Lists', 'youtube-embed' ), $menu_access, 've-list-options', 'vye_list_options' );
108
 
109
  add_action( 'load-' . $vye_lists_hook, 'vye_add_lists_help' );
110
 
includes/generate-embed-code.php CHANGED
@@ -101,7 +101,7 @@ function vye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
101
 
102
  // Is it being previewed? In which case remove any cache
103
 
104
- if ( ( preg_match( '/p=([0-9]*)&preview=true/', $_SERVER['QUERY_STRING'] ) == 1 ) && ( $general[ 'preview' ] == 1 ) ) {
105
  delete_transient( 'vye_type_' . $id );
106
  delete_transient( 'vye_title_' . $id );
107
  }
101
 
102
  // Is it being previewed? In which case remove any cache
103
 
104
+ if ( preg_match( '/p=([0-9]*)&preview=true/', $_SERVER['QUERY_STRING'] ) == 1 ) {
105
  delete_transient( 'vye_type_' . $id );
106
  delete_transient( 'vye_title_' . $id );
107
  }
includes/options-general.php CHANGED
@@ -45,7 +45,6 @@ if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'youtube-embed-general', 'yo
45
  $options[ 'comments_profile' ] = $_POST[ 'youtube_embed_comments_profile' ];
46
  $options[ 'metadata' ] = $_POST[ 'youtube_embed_metadata' ];
47
  $options[ 'feed' ] = $_POST[ 'youtube_embed_feed' ];
48
- $options[ 'api' ] = $_POST[ 'youtube_embed_api' ];
49
  $options[ 'error_message' ] = str_replace( '\"', '"', $_POST[ 'youtube_embed_error_message' ] );
50
  $options[ 'thumbnail' ] = $_POST[ 'youtube_embed_thumbnail' ];
51
  $options[ 'privacy' ] = $_POST[ 'youtube_embed_privacy' ];
@@ -274,23 +273,6 @@ echo '<p>' . __( 'You currently have cache for', 'youtube_embed' ) . ' ' . numbe
274
  <td><input type="checkbox" name="youtube_embed_clear_cache" value="1">&nbsp;<span class="description"><?php _e( 'Select this option to remove all YouTube Embed cache.', 'youtube-embed' ); ?></span></td>
275
  </tr></table>
276
 
277
- <h3 class="title"><?php _e( 'YouTube API', 'youtube-embed' ); ?></h3>
278
-
279
- <p><?php _e( 'The YouTube API is used to validate video IDs and to determine if it is a video or playlist.', 'youtube-embed' ); ?></p>
280
-
281
- <table class="form-table">
282
- <tr>
283
- <th scope="row"><?php _e( 'API State', 'youtube-embed' ); ?></th>
284
- <td><select name="youtube_embed_api">
285
- <option value="0"<?php if ( $options[ 'api' ] == "0" ) { echo " selected='selected'"; } ?>><?php _e ( 'API should not be used', 'youtube-embed' ); ?></option>
286
- <option value="1"<?php if ( $options[ 'api' ] == "1" ) { echo " selected='selected'"; } ?>><?php _e ( 'HTTP API used and errors are reported', 'youtube-embed' ); ?></option>
287
- <option value="2"<?php if ( $options[ 'api' ] == "2" ) { echo " selected='selected'"; } ?>><?php _e ( 'HTTPS API used and errors are reported', 'youtube-embed' ); ?></option>
288
- <option value="3"<?php if ( $options[ 'api' ] == "3" ) { echo " selected='selected'"; } ?>><?php _e ( 'HTTP API used and no errors are reported', 'youtube-embed' ); ?></option>
289
- <option value="4"<?php if ( $options[ 'api' ] == "4" ) { echo " selected='selected'"; } ?>><?php _e ( 'HTTPS API used and no errors are reported', 'youtube-embed' ); ?></option>
290
- </select></td>
291
- </tr>
292
- </table>
293
-
294
  <h3 class="title"><?php _e( 'Error Reporting', 'youtube-embed' ); ?></h3>
295
 
296
  <p><?php _e( 'Playback errors are within the XHTML source code as comments - parameter errors and other types are displayed on the post output.', 'youtube-embed' ); ?></p>
45
  $options[ 'comments_profile' ] = $_POST[ 'youtube_embed_comments_profile' ];
46
  $options[ 'metadata' ] = $_POST[ 'youtube_embed_metadata' ];
47
  $options[ 'feed' ] = $_POST[ 'youtube_embed_feed' ];
 
48
  $options[ 'error_message' ] = str_replace( '\"', '"', $_POST[ 'youtube_embed_error_message' ] );
49
  $options[ 'thumbnail' ] = $_POST[ 'youtube_embed_thumbnail' ];
50
  $options[ 'privacy' ] = $_POST[ 'youtube_embed_privacy' ];
273
  <td><input type="checkbox" name="youtube_embed_clear_cache" value="1">&nbsp;<span class="description"><?php _e( 'Select this option to remove all YouTube Embed cache.', 'youtube-embed' ); ?></span></td>
274
  </tr></table>
275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  <h3 class="title"><?php _e( 'Error Reporting', 'youtube-embed' ); ?></h3>
277
 
278
  <p><?php _e( 'Playback errors are within the XHTML source code as comments - parameter errors and other types are displayed on the post output.', 'youtube-embed' ); ?></p>
includes/set-defaults.php CHANGED
@@ -116,7 +116,7 @@ function vye_set_general_defaults() {
116
  }
117
  $version_change = true;
118
  }
119
-
120
  if ( $version_change ) {
121
  $options[ 'current_version' ] = youtube_embed_version;
122
  $changed = true;
@@ -141,7 +141,6 @@ function vye_set_general_defaults() {
141
  if ( !array_key_exists( 'comments_profile', $options ) ) { $options[ 'comments_profile' ] = 0; $changed = true; }
142
  if ( !array_key_exists( 'metadata', $options ) ) { $options[ 'metadata' ] = 1; $changed = true; }
143
  if ( !array_key_exists( 'feed', $options ) ) { $options[ 'feed' ] = 'b'; $changed = true; }
144
- if ( !array_key_exists( 'api', $options ) ) { $options[ 'api' ] = 1; $changed = true; }
145
  if ( !array_key_exists( 'error_message', $options ) ) { $options[ 'error_message' ] = $default_error; $changed = true; }
146
  if ( !array_key_exists( 'thumbnail', $options ) ) { $options[ 'thumbnail' ] = 2; $changed = true; }
147
  if ( !array_key_exists( 'privacy', $options ) ) { $options[ 'privacy' ] = 0; $changed = true; }
116
  }
117
  $version_change = true;
118
  }
119
+
120
  if ( $version_change ) {
121
  $options[ 'current_version' ] = youtube_embed_version;
122
  $changed = true;
141
  if ( !array_key_exists( 'comments_profile', $options ) ) { $options[ 'comments_profile' ] = 0; $changed = true; }
142
  if ( !array_key_exists( 'metadata', $options ) ) { $options[ 'metadata' ] = 1; $changed = true; }
143
  if ( !array_key_exists( 'feed', $options ) ) { $options[ 'feed' ] = 'b'; $changed = true; }
 
144
  if ( !array_key_exists( 'error_message', $options ) ) { $options[ 'error_message' ] = $default_error; $changed = true; }
145
  if ( !array_key_exists( 'thumbnail', $options ) ) { $options[ 'thumbnail' ] = 2; $changed = true; }
146
  if ( !array_key_exists( 'privacy', $options ) ) { $options[ 'privacy' ] = 0; $changed = true; }
includes/shared-functions.php CHANGED
@@ -200,57 +200,12 @@ function vye_validate_id( $id, $title_needed = false ) {
200
 
201
  if ( !$cache ) {
202
 
203
- $type = '-';
204
-
205
- if ( $options [ 'api' ] != 0 ) {
206
-
207
- if ( ( $options[ 'api' ] == 2 ) or ( $options[ 'api' ] == 4 ) ) { $https = 's'; } else { $https = ''; }
208
-
209
- // Check with YouTube API as to whether the ID is a video
210
-
211
- $id_check = vye_get_file( 'http' . $https . '://gdata.youtube.com/feeds/api/videos/' . $id . '?v=2', false );
212
- if ( $id_check[ 'rc' ] == 0 ) {
213
- if ( $id_check[ 'response' ] != 200 ) {
214
-
215
- // Check with YouTube API as to whether the ID is a playlist
216
-
217
- if ( strtolower( substr( $id, 0, 2 ) ) == 'pl' ) { $id = substr( $id, 2 ); }
218
- $id_check = vye_get_file( 'http' . $https . '://gdata.youtube.com/feeds/api/playlists/' . $id . '?v=2', false );
219
- if ( $id_check[ 'rc' ] == 0 ) {
220
- if ( $id_check[ 'response' ] != 200 ) {
221
- $type = '';
222
- } else {
223
- $type = 'p';
224
- }
225
- }
226
- } else {
227
- $type = 'v';
228
- }
229
- }
230
- }
231
-
232
- // If no type has been assigned then an API error must have occured
233
-
234
- if ( $type == '-' ) {
235
-
236
- if ( ( $options[ 'api' ] == 1 ) or ( $options[ 'api' ] == 2 ) ) {
237
-
238
- // If reporting API errors, output it
239
-
240
- $type = sprintf( __('An error occurred accessing the YouTube API for video ID %s - %s', 'youtube-embed' ), $id, $id_check[ 'error' ] );
241
-
242
- } else {
243
-
244
- // If not reporting errors or API switched off, work out whether a video or playlist
245
-
246
- $type = '';
247
- if ( strlen( $id ) == 11 ) {
248
- $type = 'v';
249
- } else {
250
- if ( strlen( $id ) == 16 ) {
251
- $type = 'p';
252
- }
253
- }
254
  }
255
  }
256
 
@@ -258,24 +213,6 @@ function vye_validate_id( $id, $title_needed = false ) {
258
 
259
  set_transient( 'vye_type_' . $id, $type, $options[ 'info_cache' ] * 3600 );
260
 
261
- // If the video is valid extract the title from the XML
262
-
263
- if ( ( $title_needed) && ( $id_check[ 'file' ] != '' ) ) {
264
-
265
- // Find title in XML
266
-
267
- $tag_start = strpos( $id_check[ 'file' ], '<title>', 1 ) + 7;
268
- if ( $tag_start !== false ) {
269
- $tag_end = strpos( $id_check[ 'file' ], '</title>', $tag_start );
270
- if ( $tag_end !== false ) {
271
- $title = substr( $id_check[ 'file' ], $tag_start, $tag_end - $tag_start );
272
- }
273
- }
274
-
275
- // Update the cache
276
-
277
- set_transient( 'vye_title_' . $id, $title, $options[ 'info_cache' ] * 3600 );
278
- }
279
  }
280
 
281
  if ( !$title_needed ) { return $type; }
200
 
201
  if ( !$cache ) {
202
 
203
+ $type = '';
204
+ if ( strlen( $id ) == 11 ) {
205
+ $type = 'v';
206
+ } else {
207
+ if ( strlen( $id ) == 16 ) {
208
+ $type = 'p';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  }
210
  }
211
 
213
 
214
  set_transient( 'vye_type_' . $id, $type, $options[ 'info_cache' ] * 3600 );
215
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  }
217
 
218
  if ( !$title_needed ) { return $type; }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://artiss.co.uk/donate
4
  Tags: annotations, artiss, chromecast, comments, download, embed, embedding, embedplus, flash, flv, hd, iframe, media, play, playlist, profile, responsive, seo, url, video, widget, youtube, youtuber
5
  Requires at least: 3.9
6
  Tested up to: 4.1.1
7
- Stable tag: 3.3
8
 
9
  A simple to use method of embedding YouTube videos into your posts and pages but with powerful features for those that need them.
10
 
@@ -481,6 +481,9 @@ Although I attempt to keep with PHP 4 compatibility there are no guarantees of t
481
 
482
  == Changelog ==
483
 
 
 
 
484
  = 3.3 =
485
  * Maintenance: Ding, dong Applian has gone. Removed Vixy branding, updated README and language files to match
486
  * Maintenance: Removed those Vixy download links and restored the old method - will enhance this in a future release
@@ -763,6 +766,9 @@ Although I attempt to keep with PHP 4 compatibility there are no guarantees of t
763
 
764
  == Upgrade Notice ==
765
 
 
 
 
766
  = 3.3 =
767
  * Update to fix assorted bugs and to remove the redundant Vixy branding
768
 
4
  Tags: annotations, artiss, chromecast, comments, download, embed, embedding, embedplus, flash, flv, hd, iframe, media, play, playlist, profile, responsive, seo, url, video, widget, youtube, youtuber
5
  Requires at least: 3.9
6
  Tested up to: 4.1.1
7
+ Stable tag: 3.3.1
8
 
9
  A simple to use method of embedding YouTube videos into your posts and pages but with powerful features for those that need them.
10
 
481
 
482
  == Changelog ==
483
 
484
+ = 3.3.1 =
485
+ * Maintenance: Remove reference to Google API, as videos are now not displaying as a result of v2 being retired. Will update the plugin more fully in future release
486
+
487
  = 3.3 =
488
  * Maintenance: Ding, dong Applian has gone. Removed Vixy branding, updated README and language files to match
489
  * Maintenance: Removed those Vixy download links and restored the old method - will enhance this in a future release
766
 
767
  == Upgrade Notice ==
768
 
769
+ = 3.3.1 =
770
+ * Urgent fix to get videos displaying. Alternatively, switch off API in Options screen.
771
+
772
  = 3.3 =
773
  * Update to fix assorted bugs and to remove the redundant Vixy branding
774
 
youtube-embed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: YouTube Embed
4
  Plugin URI: https://wordpress.org/plugins/youtube-embed/
5
  Description: Embed YouTube Videos in WordPress
6
- Version: 3.3
7
  Author: David Artiss
8
  Author URI: http://www.artiss.co.uk
9
  */
@@ -17,7 +17,7 @@ Author URI: http://www.artiss.co.uk
17
  * @since 2.0
18
  */
19
 
20
- define( 'youtube_embed_version', '3.3' );
21
 
22
  $functions_dir = WP_PLUGIN_DIR . '/youtube-embed/includes/';
23
 
@@ -42,8 +42,8 @@ include_once( $functions_dir . 'generate-shorturl-code.php' ); // Generate sho
42
  include_once( $functions_dir . 'generate-thumbnail-code.php' ); // Generate thumbnail code
43
 
44
  include_once( $functions_dir . 'generate-transcript-code.php' ); // Generate transcripts
45
-
46
- if ( is_admin() && !( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
47
 
48
  include_once( $functions_dir . 'admin-config.php' ); // Administration configuration
49
 
3
  Plugin Name: YouTube Embed
4
  Plugin URI: https://wordpress.org/plugins/youtube-embed/
5
  Description: Embed YouTube Videos in WordPress
6
+ Version: 3.3.1
7
  Author: David Artiss
8
  Author URI: http://www.artiss.co.uk
9
  */
17
  * @since 2.0
18
  */
19
 
20
+ define( 'youtube_embed_version', '3.3.1' );
21
 
22
  $functions_dir = WP_PLUGIN_DIR . '/youtube-embed/includes/';
23
 
42
  include_once( $functions_dir . 'generate-thumbnail-code.php' ); // Generate thumbnail code
43
 
44
  include_once( $functions_dir . 'generate-transcript-code.php' ); // Generate transcripts
45
+
46
+ if ( is_admin() && !( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
47
 
48
  include_once( $functions_dir . 'admin-config.php' ); // Administration configuration
49