YouTube - Version 9.8

Version Description

Download this release

Release Info

Developer embedplus
Plugin Icon 128x128 YouTube
Version 9.8
Comparing to
See all releases

Code changes from version 9.7 to 9.8

Files changed (3) hide show
  1. images/youtube_thumbnail_sample.jpg +0 -0
  2. readme.txt +8 -5
  3. youtube.php +119 -49
images/youtube_thumbnail_sample.jpg ADDED
Binary file
readme.txt CHANGED
@@ -1,13 +1,13 @@
1
  === YouTube ===
2
  Contributors: embedplus
3
  Plugin Name: YouTube Embed
4
- Tags: featured image, css, cross site scripting, accessibility, same origin, screen reader, security, thumbnail, thumbnails, video thumbnails, wordpress security, xss, youtube thumbnails, thumbnail image, origin, lazy load, lazy, load, effects, special effects, get_locale, translator, locale, country code, country, TinyMCE, localization, internationalization, language, multi-language, translate, captions, subtitles, hl, audio, initialize, mute, sound, track, volume, at a glance, channel, annotations, music, music video, songs, song, lyrics, responsive, short code, shortcode, youtube shortcode, diagnostic, youtube status, seo, video seo, rich snippets, reddit, google+, google plus, comments, search, widget, sidebar, responsive, fluid, iphone, mobile, android, tablet, ipad, youtube playlist, playlists, playlist, wmode, hd, autohd, auto hd, video analytics, analytics, google, google analytics, view count, vlog, vlogging, web videos, youtube analytics, youtube, youtube plugin, youtube shortcode, embed youtube, plugin, video, video shortcode, embed videos, youtube player, shortcode, simple, simple youtube, smart youtube playback, youtube embed, wordpress youtube embed, embedding youtube, youtube embedding, video plugin, https, ssl, secure, no-cookie, cookie, html5, youtube html5, multilingual, multi-lingual, l10n, i18n
5
  Requires at least: 3.1
6
- Tested up to: 4.1
7
- Stable tag: 9.7
8
  License: GPLv3 or later
9
 
10
- YouTube embed plugin. Embed the YouTube player and playlist in posts/pages and widgets. Add video thumbnails, analytics, SEO, security, and more.
11
 
12
  == Description ==
13
 
@@ -28,7 +28,7 @@ YouTube embed plugin. Embed the YouTube player and playlist in posts/pages and w
28
 
29
  You can even extend the plugin with PRO features like:
30
 
31
- * Automatic video thumbnail images: each post or page that contains at least one video will have the thumbnail of its first video serve as its featured image.
32
  * [Eye-catching special effects for YouTube embeds >>](http://www.embedplus.com/add-special-effects-to-youtube-embeds-in-wordpress.aspx) (uses lazy loading)
33
  * Automatic tagging for video SEO
34
  * Automatic Open Graph tagging for Facebook
@@ -138,6 +138,9 @@ You can also start and end each individual video at particular times. Like the a
138
 
139
  == Changelog ==
140
 
 
 
 
141
  = YouTube Embed 9.7 =
142
  Adds improved accessibility for screen readers and video thumbnail as featured image support.
143
 
1
  === YouTube ===
2
  Contributors: embedplus
3
  Plugin Name: YouTube Embed
4
+ Tags: youtube snippets, deleted youtube videos, youtube takedowns, blocked youtube videos, youtube impressions, youtube alerts, featured image, css, cross site scripting, accessibility, same origin, screen reader, security, thumbnail, thumbnails, video thumbnails, wordpress security, xss, youtube thumbnails, thumbnail image, origin, lazy load, lazy, load, effects, special effects, get_locale, translator, locale, country code, country, TinyMCE, localization, internationalization, language, multi-language, translate, captions, subtitles, hl, audio, initialize, mute, sound, track, volume, at a glance, channel, annotations, music, music video, songs, song, lyrics, responsive, short code, shortcode, youtube shortcode, diagnostic, youtube status, seo, video seo, rich snippets, reddit, google+, google plus, comments, search, widget, sidebar, responsive, fluid, iphone, mobile, android, tablet, ipad, youtube playlist, playlists, playlist, wmode, hd, autohd, auto hd, video analytics, analytics, google, google analytics, view count, vlog, vlogging, web videos, youtube analytics, youtube, youtube plugin, youtube shortcode, embed youtube, plugin, video, video shortcode, embed videos, youtube player, shortcode, simple, simple youtube, smart youtube playback, youtube embed, wordpress youtube embed, embedding youtube, youtube embedding, video plugin, https, ssl, secure, no-cookie, cookie, html5, youtube html5, multilingual, multi-lingual, l10n, i18n
5
  Requires at least: 3.1
6
+ Tested up to: 4.2
7
+ Stable tag: 9.8
8
  License: GPLv3 or later
9
 
10
+ YouTube embed plugin. Embed responsive YouTube video players and playlists in posts/pages and widgets. Add video thumbnails, analytics, SEO, and more
11
 
12
  == Description ==
13
 
28
 
29
  You can even extend the plugin with PRO features like:
30
 
31
+ * [Automatic video thumbnail images](http://embedplus.com/add-youtube-video-thumbnails-featured-image-wordpress.aspx): each post or page that contains at least one video will have the thumbnail of its first video serve as its featured image.
32
  * [Eye-catching special effects for YouTube embeds >>](http://www.embedplus.com/add-special-effects-to-youtube-embeds-in-wordpress.aspx) (uses lazy loading)
33
  * Automatic tagging for video SEO
34
  * Automatic Open Graph tagging for Facebook
138
 
139
  == Changelog ==
140
 
141
+ = YouTube Embed 9.8 =
142
+ Upgraded code to use YouTube API v3.
143
+
144
  = YouTube Embed 9.7 =
145
  Adds improved accessibility for screen readers and video thumbnail as featured image support.
146
 
youtube.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: YouTube
4
  Plugin URI: http://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx
5
  Description: YouTube embed plugin with basic features and convenient defaults. Upgrade now to add tracking, instant video SEO tags, and much more!
6
- Version: 9.7
7
  Author: EmbedPlus Team
8
  Author URI: http://www.embedplus.com
9
  */
@@ -32,7 +32,7 @@
32
  class YouTubePrefs
33
  {
34
 
35
- public static $version = '9.7';
36
  public static $opt_version = 'version';
37
  public static $optembedwidth = null;
38
  public static $optembedheight = null;
@@ -73,6 +73,7 @@ class YouTubePrefs
73
  public static $opt_defaultheight = 'height';
74
  public static $opt_defaultvol = 'defaultvol';
75
  public static $opt_vol = 'vol';
 
76
  public static $opt_schemaorg = 'schemaorg';
77
  public static $opt_ftpostimg = 'ftpostimg';
78
  public static $opt_dynload = 'dynload';
@@ -374,46 +375,42 @@ class YouTubePrefs
374
 
375
  $vidid = $linkparams['v'];
376
 
377
- try
378
  {
379
- $ytapilink = 'http://gdata.youtube.com/feeds/api/videos/' . $vidid . '?v=2&alt=json&fields=id,published,title,content,media:group(media:description,yt:duration)';
380
- $apidata = wp_remote_get($ytapilink);
381
- if (!is_wp_error($apidata))
382
  {
383
- $raw = wp_remote_retrieve_body($apidata);
384
- if (!empty($raw))
 
385
  {
386
- $postlink = get_permalink($postid);
387
- $json = json_decode($raw, true);
388
- if (is_array($json))
389
- {
390
- $_name = esc_attr(sanitize_text_field($json['entry']['title']['$t']));
391
- $_description = esc_attr(sanitize_text_field($json['entry']['media$group']['media$description']['$t']));
392
- $_thumbnailUrl = esc_url("//i.ytimg.com/vi/" . $vidid . "/0.jpg");
393
- $_duration = self::formatDuration(self::secondsToDuration(intval($json['entry']['media$group']['yt$duration']['seconds'])));
394
- $_uploadDate = sanitize_text_field($json['entry']['published']['$t']);
395
-
396
- $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accthumb"><img src="' . $_thumbnailUrl . '" /></a>';
397
- $thehtml .= '<div class="accinfo">';
398
- $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accvidtitle">' . $_name . '</a>';
399
- $thehtml .= '<div class="accdesc">' . (strlen($_description) > 400 ? substr($_description, 0, 400) . "..." : $_description) . '</div>';
400
- $thehtml .= '</div>';
401
- $thehtml .= '<div class="clearboth pad20"></div>';
402
- }
403
- else
404
- {
405
- $thehtml .= '<p class="center bold orange">This <a target="_blank" href="' . $postlink . '">post/page</a> contains a video that has been removed from YouTube.';
406
 
407
- if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
408
- {
409
- $thehtml .='<br><a target="_blank" href="https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx">Activate delete video tracking to catch these cases &raquo;</a>';
410
- }
411
- $thehtml .= '</strong>';
412
  }
 
413
  }
414
  }
 
 
 
 
415
  }
416
- catch (Exception $ex)
417
  {
418
 
419
  }
@@ -663,6 +660,7 @@ class YouTubePrefs
663
  $_origin = 0;
664
  $_defaultvol = 0;
665
  $_vol = '';
 
666
  $_hl = '';
667
  $_dohl = 0;
668
 
@@ -708,6 +706,7 @@ class YouTubePrefs
708
  $_defaultheight = self::tryget($arroptions, self::$opt_defaultheight, '');
709
  $_defaultvol = self::tryget($arroptions, self::$opt_defaultvol, 0);
710
  $_vol = self::tryget($arroptions, self::$opt_vol, '');
 
711
  }
712
  else
713
  {
@@ -752,7 +751,8 @@ class YouTubePrefs
752
  self::$opt_defaultwidth => $_defaultwidth,
753
  self::$opt_defaultheight => $_defaultheight,
754
  self::$opt_defaultvol => $_defaultvol,
755
- self::$opt_vol => $_vol
 
756
  );
757
 
758
  update_option(self::$opt_alloptions, $all);
@@ -1020,7 +1020,9 @@ class YouTubePrefs
1020
  $schemaorgcode = '';
1021
  try
1022
  {
1023
- $ytapilink = 'http://gdata.youtube.com/feeds/api/videos/' . $vidid . '?v=2&alt=json&fields=id,published,title,content,media:group(media:description,yt:duration)';
 
 
1024
  $apidata = wp_remote_get($ytapilink);
1025
  if (!is_wp_error($apidata))
1026
  {
@@ -1030,11 +1032,11 @@ class YouTubePrefs
1030
  $json = json_decode($raw, true);
1031
  if (is_array($json))
1032
  {
1033
- $_name = esc_attr(sanitize_text_field(str_replace("@", "&#64;", $json['entry']['title']['$t'])));
1034
- $_description = esc_attr(sanitize_text_field(str_replace("@", "&#64;", $json['entry']['media$group']['media$description']['$t'])));
1035
  $_thumbnailUrl = esc_url("http://i.ytimg.com/vi/" . $vidid . "/0.jpg");
1036
- $_duration = self::formatDuration(self::secondsToDuration(intval($json['entry']['media$group']['yt$duration']['seconds'])));
1037
- $_uploadDate = sanitize_text_field($json['entry']['published']['$t']);
1038
 
1039
  $schemaorgcode = '<span itemprop="video" itemscope itemtype="http://schema.org/VideoObject">';
1040
  $schemaorgcode .= '<meta itemprop="embedURL" content="http://www.youtube.com/embed/' . $vidid . '">';
@@ -1558,14 +1560,21 @@ class YouTubePrefs
1558
 
1559
  $new_pointer_content = '<h3>' . __('New Update') . '</h3>'; // ooopointer
1560
 
1561
- $new_pointer_content .= '<p>'; // . __(''); // ooopointer
1562
  if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
1563
  {
1564
- $new_pointer_content .= __('New accessibility option added to FREE and PRO. Automatic video thumbnails as featured images is now an option for <a href="' . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer" target="_blank">PRO users &raquo;</a>.');
1565
  }
1566
  else
1567
  {
1568
- $new_pointer_content .= __('New accessibility option added to FREE and PRO. Automatic video thumbnails as featured images is now an option for PRO users.');
 
 
 
 
 
 
 
1569
  }
1570
  $new_pointer_content .= '</p>';
1571
 
@@ -1680,6 +1689,17 @@ class YouTubePrefs
1680
  $new_options[self::$opt_vol] = $_vol;
1681
 
1682
 
 
 
 
 
 
 
 
 
 
 
 
1683
  $_hl = '';
1684
  try
1685
  {
@@ -1782,7 +1802,7 @@ class YouTubePrefs
1782
  text-decoration: none; background-color: #ffffff;}
1783
  .jumper {height: 25px;}
1784
  .ssschema {float: right; width: 350px; height: auto; margin-right: 10px;}
1785
- .ssfb {float: right; height: auto; margin-right: 10px;}
1786
  .totop {position: absolute; right: 20px; top: 5px; color: #444444; font-size: 10px;}
1787
  input[type=checkbox] {border: 1px solid #000000;}
1788
  .chktitle {display: inline-block; padding: 1px 3px 1px 3px; border-radius: 3px; background-color: #ffffff; border: 1px solid #dddddd;}
@@ -1797,6 +1817,11 @@ class YouTubePrefs
1797
  .vol-range {background-color: #dddddd; border-radius: 3px; cursor: pointer;}
1798
  input#vol {vertical-align: middle;}
1799
  .vol-seeslider {display: none;}
 
 
 
 
 
1800
  #boxnocookie {display: inline-block; border-radius: 3px; padding: 2px 4px 2px 4px; color: red; background-color: yellow; font-weight: bold; <?php echo $all[self::$opt_nocookie] ? '' : 'display: none;' ?>}
1801
  .strike {text-decoration: line-through;}
1802
  .upgchecks { padding: 20px; border-radius: 15px; border: 1px dotted #777777; background-color: #fcfcfc; }
@@ -1913,7 +1938,7 @@ class YouTubePrefs
1913
  </p>
1914
  <p>
1915
  <input name="<?php echo self::$opt_acctitle; ?>" id="<?php echo self::$opt_acctitle; ?>" <?php checked($all[self::$opt_acctitle], 1); ?> type="checkbox" class="checkbox">
1916
- <label for="<?php echo self::$opt_acctitle; ?>"><b class="chktitle">Accessible Title Attributes: <sup class="orange">NEW</sup></b> Improve accessibility by using title attributes for screen reader support. It should help your site pass functional accessibility evaluation (FAE). </label>
1917
  </p>
1918
  <p>
1919
  <input name="<?php echo self::$opt_theme; ?>" id="<?php echo self::$opt_theme; ?>" <?php checked($all[self::$opt_theme], 'dark'); ?> type="checkbox" class="checkbox">
@@ -2019,12 +2044,13 @@ class YouTubePrefs
2019
  </label>
2020
  </p>
2021
 
2022
- <p class="smallnote orange">Below are PRO features for enhanced SEO and performance (works for even past embed links). <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank">Activate them and several other features &raquo;</a></p>
2023
  <div class="upgchecks">
2024
  <?php
2025
  if ($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0)
2026
  {
2027
  ?>
 
2028
 
2029
  <p>
2030
  <input name="<?php echo self::$opt_dynload; ?>" id="<?php echo self::$opt_dynload; ?>" <?php checked($all[self::$opt_dynload], 1); ?> type="checkbox" class="checkbox">
@@ -2053,18 +2079,34 @@ class YouTubePrefs
2053
  </label>
2054
  </p>
2055
  <p>
 
2056
  <input name="<?php echo self::$opt_ftpostimg; ?>" id="<?php echo self::$opt_ftpostimg; ?>" <?php checked($all[self::$opt_ftpostimg], 1); ?> type="checkbox" class="checkbox">
2057
  <label for="<?php echo self::$opt_ftpostimg; ?>">
2058
  <b>(PRO)</b> <b class="chktitle">Automatic Video Thumbnails: <sup class="orange">NEW</sup></b>
2059
  Automatically grab the thumbnail image of the first video embedded in each post or page, and use it as the featured image. All you have to do is click Update on a post or page and the plugin does the rest!
 
2060
  </label>
2061
  </p>
2062
-
2063
  <p>
2064
  <input name="<?php echo self::$opt_schemaorg; ?>" id="<?php echo self::$opt_schemaorg; ?>" <?php checked($all[self::$opt_schemaorg], 1); ?> type="checkbox" class="checkbox">
2065
  <label for="<?php echo self::$opt_schemaorg; ?>">
2066
  <b>(PRO)</b> <b class="chktitle">Video SEO Tags:</b> Update your YouTube embeds with Google, Bing, and Yahoo friendly video SEO markup.
2067
  </label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2068
  </p>
2069
  <p>
2070
  <br>
@@ -2079,6 +2121,7 @@ class YouTubePrefs
2079
  else
2080
  {
2081
  ?>
 
2082
  <p>
2083
  <input disabled type="checkbox" class="checkbox">
2084
  <label>
@@ -2087,12 +2130,16 @@ class YouTubePrefs
2087
  </label>
2088
  </p>
2089
  <p>
 
2090
  <input disabled type="checkbox" class="checkbox">
2091
  <label>
2092
  <b class="chktitle">Automatic Video Thumbnails: <sup class="orange">NEW</sup></b> <span class="pronon">(PRO Users)</span>
2093
- Automatically grab the thumbnail image of the first video embedded in each post or page, and use it as the featured image. All you have to do is click Update on a post or page and the plugin does the rest!
 
 
2094
  </label>
2095
  </p>
 
2096
  <p>
2097
  <input disabled type="checkbox" class="checkbox">
2098
  <label>
@@ -2296,7 +2343,7 @@ class YouTubePrefs
2296
  Deactivating the No Cookies option has also been proven to solve player errors.
2297
  </p>
2298
  <p>
2299
- We also have a YouTube channel with some helper videos. <a href="https://www.youtube.com/subscription_center?add_user=EmbedPlus" target="_blank">Subscribe for tips and updates here &raquo;</a>
2300
  </p>
2301
  </div>
2302
  <br>
@@ -2357,6 +2404,17 @@ class YouTubePrefs
2357
  }
2358
 
2359
 
 
 
 
 
 
 
 
 
 
 
 
2360
 
2361
  if (jQuery("#<?php echo self::$opt_dynload; ?>").is(":checked"))
2362
  {
@@ -2429,6 +2487,18 @@ class YouTubePrefs
2429
 
2430
  });
2431
 
 
 
 
 
 
 
 
 
 
 
 
 
2432
 
2433
  // jQuery('#<?php echo self::$opt_dohl; ?>').change(function()
2434
  // {
3
  Plugin Name: YouTube
4
  Plugin URI: http://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx
5
  Description: YouTube embed plugin with basic features and convenient defaults. Upgrade now to add tracking, instant video SEO tags, and much more!
6
+ Version: 9.8
7
  Author: EmbedPlus Team
8
  Author URI: http://www.embedplus.com
9
  */
32
  class YouTubePrefs
33
  {
34
 
35
+ public static $version = '9.8';
36
  public static $opt_version = 'version';
37
  public static $optembedwidth = null;
38
  public static $optembedheight = null;
73
  public static $opt_defaultheight = 'height';
74
  public static $opt_defaultvol = 'defaultvol';
75
  public static $opt_vol = 'vol';
76
+ public static $opt_apikey = 'apikey';
77
  public static $opt_schemaorg = 'schemaorg';
78
  public static $opt_ftpostimg = 'ftpostimg';
79
  public static $opt_dynload = 'dynload';
375
 
376
  $vidid = $linkparams['v'];
377
 
378
+ if ($vidid != null)
379
  {
380
+ try
 
 
381
  {
382
+ $odata = self::get_oembed('http://youtube.com/watch?v=' . $vidid, 1920, 1280);
383
+ $postlink = get_permalink($postid);
384
+ if ($odata != null && !is_wp_error($odata))
385
  {
386
+ $_name = esc_attr(sanitize_text_field($odata->title));
387
+ $_description = esc_attr(sanitize_text_field($odata->author_name));
388
+ $_thumbnailUrl = esc_url("//i.ytimg.com/vi/" . $vidid . "/0.jpg");
389
+
390
+ $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accthumb"><img src="' . $_thumbnailUrl . '" /></a>';
391
+ $thehtml .= '<div class="accinfo">';
392
+ $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accvidtitle">' . $_name . '</a>';
393
+ $thehtml .= '<div class="accdesc">' . (strlen($_description) > 400 ? substr($_description, 0, 400) . "..." : $_description) . '</div>';
394
+ $thehtml .= '</div>';
395
+ $thehtml .= '<div class="clearboth pad20"></div>';
396
+ }
397
+ else
398
+ {
399
+ $thehtml .= '<p class="center bold orange">This <a target="_blank" href="' . $postlink . '">post/page</a> contains a video that has been removed from YouTube.';
 
 
 
 
 
 
400
 
401
+ if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
402
+ {
403
+ $thehtml .='<br><a target="_blank" href="https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx">Activate delete video tracking to catch these cases &raquo;</a>';
 
 
404
  }
405
+ $thehtml .= '</strong>';
406
  }
407
  }
408
+ catch (Exception $ex)
409
+ {
410
+
411
+ }
412
  }
413
+ else if (false) // if playlist
414
  {
415
 
416
  }
660
  $_origin = 0;
661
  $_defaultvol = 0;
662
  $_vol = '';
663
+ $_apikey = '';
664
  $_hl = '';
665
  $_dohl = 0;
666
 
706
  $_defaultheight = self::tryget($arroptions, self::$opt_defaultheight, '');
707
  $_defaultvol = self::tryget($arroptions, self::$opt_defaultvol, 0);
708
  $_vol = self::tryget($arroptions, self::$opt_vol, '');
709
+ $_apikey = self::tryget($arroptions, self::$opt_apikey, '');
710
  }
711
  else
712
  {
751
  self::$opt_defaultwidth => $_defaultwidth,
752
  self::$opt_defaultheight => $_defaultheight,
753
  self::$opt_defaultvol => $_defaultvol,
754
+ self::$opt_vol => $_vol,
755
+ self::$opt_apikey => $_apikey
756
  );
757
 
758
  update_option(self::$opt_alloptions, $all);
1020
  $schemaorgcode = '';
1021
  try
1022
  {
1023
+ $ytapilink = 'https://www.googleapis.com/youtube/v3/videos?id=' . $vidid . '&part=contentDetails,snippet&key=' . self::$alloptions[self::$opt_apikey];
1024
+
1025
+
1026
  $apidata = wp_remote_get($ytapilink);
1027
  if (!is_wp_error($apidata))
1028
  {
1032
  $json = json_decode($raw, true);
1033
  if (is_array($json))
1034
  {
1035
+ $_name = esc_attr(sanitize_text_field(str_replace("@", "&#64;", $json['items'][0]['snippet']['title'])));
1036
+ $_description = esc_attr(sanitize_text_field(str_replace("@", "&#64;", $json['items'][0]['snippet']['description'])));
1037
  $_thumbnailUrl = esc_url("http://i.ytimg.com/vi/" . $vidid . "/0.jpg");
1038
+ $_duration = $json['items'][0]['contentDetails']['duration']; // "T0H9M35S" "PT9M35S"
1039
+ $_uploadDate = sanitize_text_field($json['items'][0]['snippet']['publishedAt']); // "2014-10-03T15:30:12.000Z"
1040
 
1041
  $schemaorgcode = '<span itemprop="video" itemscope itemtype="http://schema.org/VideoObject">';
1042
  $schemaorgcode .= '<meta itemprop="embedURL" content="http://www.youtube.com/embed/' . $vidid . '">';
1560
 
1561
  $new_pointer_content = '<h3>' . __('New Update') . '</h3>'; // ooopointer
1562
 
1563
+ $new_pointer_content .= '<p>'; // ooopointer
1564
  if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
1565
  {
1566
+ $new_pointer_content .= __('We upgraded the plugin to use the newest version of YouTube&apos;s API, v3. Used in FREE and <a href="' . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer" target="_blank">PRO features &raquo;</a>.');
1567
  }
1568
  else
1569
  {
1570
+ if (self::$alloptions[self::$opt_schemaorg] == 1)
1571
+ {
1572
+ $new_pointer_content .= 'Important for Pro users: YouTube now requires an API key for SEO tags. Please <a href="' . admin_url('admin.php?page=youtube-my-preferences') . '#ftpostimg">read more here &raquo;</a>';
1573
+ }
1574
+ else
1575
+ {
1576
+ $new_pointer_content .= __('We upgraded the plugin to use the newest version of YouTube&apos;s API, v3. Used in FREE and PRO features.');
1577
+ }
1578
  }
1579
  $new_pointer_content .= '</p>';
1580
 
1689
  $new_options[self::$opt_vol] = $_vol;
1690
 
1691
 
1692
+ $_apikey = '';
1693
+ try
1694
+ {
1695
+ $_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_apikey])));
1696
+ }
1697
+ catch (Exception $ex)
1698
+ {
1699
+ $_apikey = '';
1700
+ }
1701
+ $new_options[self::$opt_apikey] = $_apikey;
1702
+
1703
  $_hl = '';
1704
  try
1705
  {
1802
  text-decoration: none; background-color: #ffffff;}
1803
  .jumper {height: 25px;}
1804
  .ssschema {float: right; width: 350px; height: auto; margin-right: 10px;}
1805
+ .ssfb {float: right; height: auto; margin-right: 10px; margin-left: 15px;}
1806
  .totop {position: absolute; right: 20px; top: 5px; color: #444444; font-size: 10px;}
1807
  input[type=checkbox] {border: 1px solid #000000;}
1808
  .chktitle {display: inline-block; padding: 1px 3px 1px 3px; border-radius: 3px; background-color: #ffffff; border: 1px solid #dddddd;}
1817
  .vol-range {background-color: #dddddd; border-radius: 3px; cursor: pointer;}
1818
  input#vol {vertical-align: middle;}
1819
  .vol-seeslider {display: none;}
1820
+
1821
+ #boxschemaorg {font-weight: bold; padding: 7px 0; <?php echo $all[self::$opt_schemaorg] ? 'display: block;' : 'display: none;' ?>}
1822
+ .apikey-msg {display: inline-block; width: 45%; vertical-align: top;}
1823
+ .apikey-video{margin-left: 3%; display: inline-block; width: 50%; position: relative; padding-top: 29%}
1824
+ .apikey-video iframe{display: block; width: 100%; height: 100%; position: absolute; top: 0; left: 0;}
1825
  #boxnocookie {display: inline-block; border-radius: 3px; padding: 2px 4px 2px 4px; color: red; background-color: yellow; font-weight: bold; <?php echo $all[self::$opt_nocookie] ? '' : 'display: none;' ?>}
1826
  .strike {text-decoration: line-through;}
1827
  .upgchecks { padding: 20px; border-radius: 15px; border: 1px dotted #777777; background-color: #fcfcfc; }
1938
  </p>
1939
  <p>
1940
  <input name="<?php echo self::$opt_acctitle; ?>" id="<?php echo self::$opt_acctitle; ?>" <?php checked($all[self::$opt_acctitle], 1); ?> type="checkbox" class="checkbox">
1941
+ <label for="<?php echo self::$opt_acctitle; ?>"><b class="chktitle">Accessible Title Attributes: <sup class="orange">NEW</sup></b> Improve accessibility by using title attributes for screen reader support. It should help your site pass functional accessibility evaluations (FAE). </label>
1942
  </p>
1943
  <p>
1944
  <input name="<?php echo self::$opt_theme; ?>" id="<?php echo self::$opt_theme; ?>" <?php checked($all[self::$opt_theme], 'dark'); ?> type="checkbox" class="checkbox">
2044
  </label>
2045
  </p>
2046
 
2047
+
2048
  <div class="upgchecks">
2049
  <?php
2050
  if ($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0)
2051
  {
2052
  ?>
2053
+ <p class="smallnote orange">Below are PRO features for enhanced SEO and performance (works for even past embed links). </p>
2054
 
2055
  <p>
2056
  <input name="<?php echo self::$opt_dynload; ?>" id="<?php echo self::$opt_dynload; ?>" <?php checked($all[self::$opt_dynload], 1); ?> type="checkbox" class="checkbox">
2079
  </label>
2080
  </p>
2081
  <p>
2082
+ <img class="ssfb" src="<?php echo plugins_url('images/youtube_thumbnail_sample.jpg', __FILE__) ?>" />
2083
  <input name="<?php echo self::$opt_ftpostimg; ?>" id="<?php echo self::$opt_ftpostimg; ?>" <?php checked($all[self::$opt_ftpostimg], 1); ?> type="checkbox" class="checkbox">
2084
  <label for="<?php echo self::$opt_ftpostimg; ?>">
2085
  <b>(PRO)</b> <b class="chktitle">Automatic Video Thumbnails: <sup class="orange">NEW</sup></b>
2086
  Automatically grab the thumbnail image of the first video embedded in each post or page, and use it as the featured image. All you have to do is click Update on a post or page and the plugin does the rest!
2087
+ (Example shown on the right) <a target="_blank" href="<?php echo self::$epbase ?>/add-youtube-video-thumbnails-featured-image-wordpress.aspx">Read more here &raquo;</a>
2088
  </label>
2089
  </p>
2090
+ <div class="clearboth"></div>
2091
  <p>
2092
  <input name="<?php echo self::$opt_schemaorg; ?>" id="<?php echo self::$opt_schemaorg; ?>" <?php checked($all[self::$opt_schemaorg], 1); ?> type="checkbox" class="checkbox">
2093
  <label for="<?php echo self::$opt_schemaorg; ?>">
2094
  <b>(PRO)</b> <b class="chktitle">Video SEO Tags:</b> Update your YouTube embeds with Google, Bing, and Yahoo friendly video SEO markup.
2095
  </label>
2096
+ <span id="boxschemaorg">
2097
+ <span class="apikey-msg">
2098
+ The video SEO tags include data like the title, description, and thumbnail information of each video you embed. This plugin automatically extracts this data directly from YouTube using the version 3 API,
2099
+ which will soon replace the version 2 API. This particular API version requires that you obtain an API key so that YouTube can authenticate the requests. Don't worry, it's an easy process.
2100
+ Just <a href="https://developers.google.com/youtube/registering_an_application" target="_blank">click this link &raquo;</a> and follow the video to the right to get your API key. Then paste it in the box below, and click the "Save Changes" button:
2101
+ <br>
2102
+ <span style="vertical-align: middle; display: inline-block;">
2103
+ YouTube API Key: <input type="text" name="<?php echo self::$opt_apikey; ?>" id="<?php echo self::$opt_apikey; ?>" value="<?php echo trim($all[self::$opt_apikey]); ?>" class="textinput" style="width: 200px;">
2104
+ </span>
2105
+ </span>
2106
+ <span class="apikey-video">
2107
+ <iframe width="384" height="216" src="https://www.youtube.com/embed/2vmBACVETf4?rel=0" frameborder="0" allowfullscreen></iframe>
2108
+ </span>
2109
+ </span>
2110
  </p>
2111
  <p>
2112
  <br>
2121
  else
2122
  {
2123
  ?>
2124
+ <p class="smallnote orange">Below are PRO features for enhanced SEO and performance (works for even past embed links). <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank">Activate them and several other features &raquo;</a></p>
2125
  <p>
2126
  <input disabled type="checkbox" class="checkbox">
2127
  <label>
2130
  </label>
2131
  </p>
2132
  <p>
2133
+ <img class="ssfb" src="<?php echo plugins_url('images/youtube_thumbnail_sample.jpg', __FILE__) ?>" />
2134
  <input disabled type="checkbox" class="checkbox">
2135
  <label>
2136
  <b class="chktitle">Automatic Video Thumbnails: <sup class="orange">NEW</sup></b> <span class="pronon">(PRO Users)</span>
2137
+ Automatically grab the thumbnail image of the first video embedded in each post or page, and use it as the featured image.
2138
+ All you have to do is click Update on a post or page and the plugin does the rest!
2139
+ (Example shown on the right) <a target="_blank" href="<?php echo self::$epbase ?>/add-youtube-video-thumbnails-featured-image-wordpress.aspx">Read more here &raquo;</a>
2140
  </label>
2141
  </p>
2142
+ <div class="clearboth"></div>
2143
  <p>
2144
  <input disabled type="checkbox" class="checkbox">
2145
  <label>
2343
  Deactivating the No Cookies option has also been proven to solve player errors.
2344
  </p>
2345
  <p>
2346
+ We also have a YouTube channel. We use it to provide users with some helper videos and a way to keep updated on new features as they are introduced. <a href="https://www.youtube.com/subscription_center?add_user=EmbedPlus" target="_blank">Subscribe for tips and updates here &raquo;</a>
2347
  </p>
2348
  </div>
2349
  <br>
2404
  }
2405
 
2406
 
2407
+ if (jQuery("#<?php echo self::$opt_schemaorg; ?>").is(":checked"))
2408
+ {
2409
+ if (!(jQuery.trim(jQuery("#<?php echo self::$opt_apikey; ?>").val()).length > 0))
2410
+ {
2411
+ alertmessage += "Please enter a valid YouTube API key, or uncheck the 'Video SEO Tags' option.";
2412
+ jQuery("#boxschemaorg input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
2413
+ valid = false;
2414
+ }
2415
+ }
2416
+
2417
+
2418
 
2419
  if (jQuery("#<?php echo self::$opt_dynload; ?>").is(":checked"))
2420
  {
2487
 
2488
  });
2489
 
2490
+ jQuery('#<?php echo self::$opt_schemaorg; ?>').change(function()
2491
+ {
2492
+ if (jQuery(this).is(":checked"))
2493
+ {
2494
+ jQuery("#boxschemaorg").show(500);
2495
+ }
2496
+ else
2497
+ {
2498
+ jQuery("#boxschemaorg").hide(500);
2499
+ }
2500
+ });
2501
+
2502
 
2503
  // jQuery('#<?php echo self::$opt_dohl; ?>').change(function()
2504
  // {