WP YouTube Lyte - Version 1.7.18

Version Description

  • small improvements to the integration with the YouTube API, thanks to enchamun and mountbatt for their assistance!
Download this release

Release Info

Developer futtta
Plugin Icon 128x128 WP YouTube Lyte
Version 1.7.18
Comparing to
See all releases

Code changes from version 1.7.17 to 1.7.18

Files changed (3) hide show
  1. options.php +2 -2
  2. readme.txt +5 -2
  3. wp-youtube-lyte.php +8 -3
options.php CHANGED
@@ -400,7 +400,7 @@ function lyte_settings_page() {
400
  add_action( 'wp_ajax_lyte_check_yt_api_key', 'lyte_check_yt_api_key_callback' );
401
  function lyte_check_yt_api_key_callback() {
402
  check_ajax_referer( 'lyte_check_api_key', 'lyte_nonce' );
403
- $api_key = ( ctype_alnum( $_POST['lyte_yt_api_key'] ) ) ? $_POST['lyte_yt_api_key'] : '' ;
404
 
405
  // use random video to make sure a cache is not spoiling things
406
  $vidToCheck = array('ZmnZHudtzXg', '2_7oQcAkyl8', 'nOvv80wkSgI', 'pBCt5nfsZ30', 'KHw7gdJ14uQ', 'qJ_PMvjmC6M', 'DVwHCGAr_OE', 'LtOGa5M8AuU', 'VHO9uZX9FNU' );
@@ -409,7 +409,7 @@ function lyte_check_yt_api_key_callback() {
409
  if ( ! empty( $api_key ) ) {
410
  $api_response = lyte_get_YT_resp( $vidToCheck[$randVidIndex], false, '', $api_key );
411
  } else {
412
- $api_response = 'API key not alphanumeric.';
413
  }
414
 
415
  if ( is_array( $api_response ) ) {
400
  add_action( 'wp_ajax_lyte_check_yt_api_key', 'lyte_check_yt_api_key_callback' );
401
  function lyte_check_yt_api_key_callback() {
402
  check_ajax_referer( 'lyte_check_api_key', 'lyte_nonce' );
403
+ $api_key = ( esc_html( $_POST['lyte_yt_api_key'] ) === $_POST['lyte_yt_api_key'] ) ? $_POST['lyte_yt_api_key'] : '' ;
404
 
405
  // use random video to make sure a cache is not spoiling things
406
  $vidToCheck = array('ZmnZHudtzXg', '2_7oQcAkyl8', 'nOvv80wkSgI', 'pBCt5nfsZ30', 'KHw7gdJ14uQ', 'qJ_PMvjmC6M', 'DVwHCGAr_OE', 'LtOGa5M8AuU', 'VHO9uZX9FNU' );
409
  if ( ! empty( $api_key ) ) {
410
  $api_response = lyte_get_YT_resp( $vidToCheck[$randVidIndex], false, '', $api_key );
411
  } else {
412
+ $api_response = 'API key format error.';
413
  }
414
 
415
  if ( is_array( $api_response ) ) {
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: futtta, optimizingmatters
3
  Tags: youtube, video, performance, gdpr, lazy load
4
  Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
5
  Requires at least: 4.0
6
- Tested up to: 5.7
7
- Stable tag: 1.7.17
8
 
9
  High performance YouTube video, playlist and audio-only embeds which don't slow down your blog and offer optimal accessibility.
10
 
@@ -143,6 +143,9 @@ Just tell me, I like the feedback! Use the [Contact-page on my blog](http://blog
143
 
144
  == Changelog ==
145
 
 
 
 
146
  = 1.7.17 =
147
  * misc improvements as suggested by WordPress Plugins team
148
  * filter added to set description as proposed & contributed by Patrick Robertson
3
  Tags: youtube, video, performance, gdpr, lazy load
4
  Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
5
  Requires at least: 4.0
6
+ Tested up to: 5.8
7
+ Stable tag: 1.7.18
8
 
9
  High performance YouTube video, playlist and audio-only embeds which don't slow down your blog and offer optimal accessibility.
10
 
143
 
144
  == Changelog ==
145
 
146
+ = 1.7.18 =
147
+ * small improvements to the integration with the YouTube API, thanks to enchamun and mountbatt for their assistance!
148
+
149
  = 1.7.17 =
150
  * misc improvements as suggested by WordPress Plugins team
151
  * filter added to set description as proposed & contributed by Patrick Robertson
wp-youtube-lyte.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP YouTube Lyte
4
  Plugin URI: http://blog.futtta.be/wp-youtube-lyte/
5
  Description: Lite and accessible YouTube audio and video embedding.
6
  Author: Frank Goossens (futtta)
7
- Version: 1.7.17
8
  Author URI: http://blog.futtta.be/
9
  Text Domain: wp-youtube-lyte
10
  */
@@ -12,7 +12,7 @@ Text Domain: wp-youtube-lyte
12
  if ( ! defined( 'ABSPATH' ) ) exit;
13
 
14
  $debug = false;
15
- $lyte_version = '1.7.17';
16
  $lyte_db_version = get_option( 'lyte_version', 'none' );
17
 
18
  /** have we updated? */
@@ -467,7 +467,12 @@ function lyte_get_YT_resp( $vid, $playlist=false, $cachekey='', $apiTestKey='',
467
  }
468
 
469
  $yt_api_url = $yt_api_base . $yt_api_target;
470
- $yt_resp = wp_remote_get( $yt_api_url );
 
 
 
 
 
471
 
472
  // check if we got through
473
  if ( is_wp_error( $yt_resp ) ) {
4
  Plugin URI: http://blog.futtta.be/wp-youtube-lyte/
5
  Description: Lite and accessible YouTube audio and video embedding.
6
  Author: Frank Goossens (futtta)
7
+ Version: 1.7.18
8
  Author URI: http://blog.futtta.be/
9
  Text Domain: wp-youtube-lyte
10
  */
12
  if ( ! defined( 'ABSPATH' ) ) exit;
13
 
14
  $debug = false;
15
+ $lyte_version = '1.7.18';
16
  $lyte_db_version = get_option( 'lyte_version', 'none' );
17
 
18
  /** have we updated? */
467
  }
468
 
469
  $yt_api_url = $yt_api_base . $yt_api_target;
470
+ $yt_resp = wp_remote_get( $yt_api_url, array(
471
+ 'headers' => array(
472
+ 'referer' => home_url()
473
+ )
474
+ )
475
+ );
476
 
477
  // check if we got through
478
  if ( is_wp_error( $yt_resp ) ) {