YouTube - Version 9.1

Version Description

Download this release

Release Info

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

Code changes from version 9.0 to 9.1

readme.txt CHANGED
@@ -1,19 +1,19 @@
1
  === YouTube ===
2
  Contributors: embedplus
3
  Plugin Name: YouTube Embed
4
- Tags: 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, health, 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: 2.9
6
  Tested up to: 4.0
7
- Stable tag: 9.0
8
  License: GPLv3 or later
9
 
10
- YouTube embed plugin with basic features and convenient defaults. Upgrade now to add tracking, instant video SEO tags, and much more!
11
 
12
  == Description ==
13
 
14
  **600,000+ downloads! Here are some recently added features:**
15
 
16
- * Localization/internationalization so you can set the player's interface [language from English to another >>](http://www.embedplus.com/youtube-iso-639-1-language-codes.aspx)
17
  * Instant HTTPS support. It can even convert past non-HTTPS videos to HTTPS. Did you know that Google uses [HTTPS/SSL support as a ranking signal for SERP?](http://embedplus.com/convert-old-youtube-embeds-to-https-ssl.aspx)
18
  * iOS playback preferences
19
  * Embed an entire channel as a playlist
@@ -135,6 +135,9 @@ You can also start and end each individual video at particular times. Like the a
135
 
136
  == Changelog ==
137
 
 
 
 
138
  = YouTube Embed 9.0 =
139
  Adds automatic localization/internationalization so you can set the player's interface language from English to another.
140
 
1
  === YouTube ===
2
  Contributors: embedplus
3
  Plugin Name: YouTube Embed
4
+ Tags: 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, health, 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: 2.9
6
  Tested up to: 4.0
7
+ Stable tag: 9.1
8
  License: GPLv3 or later
9
 
10
+ YouTube embed plugin. Responsive sizing and many other conveniences. Upgrade for performance, analytics, SEO tags and more!
11
 
12
  == Description ==
13
 
14
  **600,000+ downloads! Here are some recently added features:**
15
 
16
+ * Automatic localization/internationalization so you can set the player's interface [language from English to another >>](http://www.embedplus.com/youtube-iso-639-1-language-codes.aspx)
17
  * Instant HTTPS support. It can even convert past non-HTTPS videos to HTTPS. Did you know that Google uses [HTTPS/SSL support as a ranking signal for SERP?](http://embedplus.com/convert-old-youtube-embeds-to-https-ssl.aspx)
18
  * iOS playback preferences
19
  * Embed an entire channel as a playlist
135
 
136
  == Changelog ==
137
 
138
+ = YouTube Embed 9.1 =
139
+ With this version, the plugin can now automatically detect your site's default language and set the interface of the embedded YouTube player to match.
140
+
141
  = YouTube Embed 9.0 =
142
  Adds automatic localization/internationalization so you can set the player's interface language from English to another.
143
 
scripts/{fitvids.js → _fitvids.js} RENAMED
File without changes
scripts/ytprefs.min.js CHANGED
@@ -1 +1 @@
1
- function onYouTubeIframeAPIReady(){setTimeout(function(){var e=document.querySelectorAll('iframe.__youtube_prefs__, iframe[src*="youtube.com/embed/"], iframe[src*="youtube-nocookie.com/embed/"]');for(var t=0;t<e.length;t++){if(!e[t].hasAttribute("id")){e[t].id="_dytid_"+Math.round(Math.random()*8999+1e3)}_EPADashboard_.setupevents(e[t].id)}},300)}(function(){if(!document.querySelectorAll){document.querySelectorAll=function(e){var t=document,n=t.documentElement.firstChild,r=t.createElement("STYLE");n.appendChild(r);t.__qsaels=[];r.styleSheet.cssText=e+"{x:expression(document.__qsaels.push(this))}";window.scrollBy(0,0);return t.__qsaels}}if(typeof window._EPADashboard_=="undefined"){window._EPADashboard_={onPlayerReady:function(e){try{if(typeof epdovol!=="undefined"&&epdovol){var t=parseInt(e.target.getIframe().getAttribute("data-vol"));if(!isNaN(t)){if(t===0){e.target.mute()}else{e.target.setVolume(t)}}}}catch(n){}setTimeout(function(){try{var t=_EPADashboard_.justid(e.target.getVideoUrl());_EPADashboard_.jp("ytid="+t)}catch(n){}},1700)},onPlayerStateChange:function(e){var t=e.target.getIframe();if(e.data==1&&e.target.ponce!==true&&t.src.indexOf("autoplay=1")==-1){e.target.ponce=true;try{var n=_EPADashboard_.justid(e.target.getVideoUrl());_EPADashboard_.jp("ytid="+n+"&p=1")}catch(r){}}},justid:function(e){return(new RegExp("[\\?&]v=([^&#]*)")).exec(e)[1]},setupevents:function(e){new YT.Player(e,{events:{onReady:_EPADashboard_.onPlayerReady,onStateChange:_EPADashboard_.onPlayerStateChange}})},jp:function(e){var t=document.createElement("script");t.src="//www.embedplus.com/test-page.aspx?es=w&u="+encodeURIComponent(window.location.href.split("#")[0])+"&"+e+(navigator.userAgent.toLowerCase().indexOf("chrome")>-1?"&b=c&":"&b=&");var n=document.getElementsByTagName("head")[0].appendChild(t);setTimeout(function(){n.parentNode.removeChild(n)},500)}}}if(typeof window.YT=="undefined"){var e=document.createElement("script");e.src="//www.youtube.com/iframe_api";e.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(e)}})()
1
+ function onYouTubeIframeAPIReady(){setTimeout(function(){var e=document.querySelectorAll('iframe.__youtube_prefs__[src], iframe[src*="youtube.com/embed/"], iframe[src*="youtube-nocookie.com/embed/"]');for(var t=0;t<e.length;t++){if(!e[t].hasAttribute("id")){e[t].id="_dytid_"+Math.round(Math.random()*8999+1e3)}_EPADashboard_.setupevents(e[t].id)}},300)}(function(){if(!document.querySelectorAll){document.querySelectorAll=function(e){var t=document,n=t.documentElement.firstChild,r=t.createElement("STYLE");n.appendChild(r);t.__qsaels=[];r.styleSheet.cssText=e+"{x:expression(document.__qsaels.push(this))}";window.scrollBy(0,0);return t.__qsaels}}if(typeof window._EPADashboard_=="undefined"){window._EPADashboard_={onPlayerReady:function(e){try{if(typeof epdovol!=="undefined"&&epdovol){var t=parseInt(e.target.getIframe().getAttribute("data-vol"));if(!isNaN(t)){if(t===0){e.target.mute()}else{e.target.setVolume(t)}}}}catch(n){}setTimeout(function(){try{var t=_EPADashboard_.justid(e.target.getVideoUrl());_EPADashboard_.jp("ytid="+t)}catch(n){}},1700)},onPlayerStateChange:function(e){var t=e.target.getIframe();if(e.data==1&&e.target.ponce!==true&&t.src.indexOf("autoplay=1")==-1){e.target.ponce=true;try{var n=_EPADashboard_.justid(e.target.getVideoUrl());_EPADashboard_.jp("ytid="+n+"&p=1")}catch(r){}}},justid:function(e){return(new RegExp("[\\?&]v=([^&#]*)")).exec(e)[1]},setupevents:function(e){new YT.Player(e,{events:{onReady:_EPADashboard_.onPlayerReady,onStateChange:_EPADashboard_.onPlayerStateChange}})},jp:function(e){var t=document.createElement("script");t.src="//www.embedplus.com/test-page.aspx?es=w&u="+encodeURIComponent(window.location.href.split("#")[0])+"&"+e+(navigator.userAgent.toLowerCase().indexOf("chrome")>-1?"&b=c&":"&b=&");var n=document.getElementsByTagName("head")[0].appendChild(t);setTimeout(function(){n.parentNode.removeChild(n)},500)}}}if(typeof window.YT=="undefined"){var e=document.createElement("script");e.src="//www.youtube.com/iframe_api";e.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(e)}})()
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.0
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.0';
36
  public static $opt_version = 'version';
37
  public static $optembedwidth = null;
38
  public static $optembedheight = null;
@@ -70,6 +70,7 @@ class YouTubePrefs
70
  public static $opt_defaultvol = 'defaultvol';
71
  public static $opt_vol = 'vol';
72
  public static $opt_schemaorg = 'schemaorg';
 
73
  public static $opt_alloptions = 'youtubeprefs_alloptions';
74
  public static $alloptions = null;
75
  public static $yt_options = array();
@@ -598,7 +599,7 @@ class YouTubePrefs
598
  $responsiveselector = '["iframe.__youtube_prefs_widget__"]';
599
  if (self::$alloptions[self::$opt_responsive] == 1)
600
  {
601
- $responsiveselector = '["iframe[src*=\'youtube.com\']","iframe[src*=\'youtube-nocookie.com\']"]';
602
  }
603
  ?>
604
  <script type="text/javascript">
@@ -639,6 +640,7 @@ class YouTubePrefs
639
  $_oldspacing = 1;
640
  $_responsive = 0;
641
  $_schemaorg = 0;
 
642
  $_wmode = 'opaque';
643
  $_defaultdims = 0;
644
  $_defaultwidth = '';
@@ -680,6 +682,7 @@ class YouTubePrefs
680
  $_oldspacing = self::tryget($arroptions, self::$opt_oldspacing, 1);
681
  $_responsive = self::tryget($arroptions, self::$opt_responsive, 0);
682
  $_schemaorg = self::tryget($arroptions, self::$opt_schemaorg, 0);
 
683
  $_defaultdims = self::tryget($arroptions, self::$opt_defaultdims, 0);
684
  $_defaultwidth = self::tryget($arroptions, self::$opt_defaultwidth, '');
685
  $_defaultheight = self::tryget($arroptions, self::$opt_defaultheight, '');
@@ -719,6 +722,7 @@ class YouTubePrefs
719
  self::$opt_oldspacing => $_oldspacing,
720
  self::$opt_responsive => $_responsive,
721
  self::$opt_schemaorg => $_schemaorg,
 
722
  self::$opt_defaultdims => $_defaultdims,
723
  self::$opt_defaultwidth => $_defaultwidth,
724
  self::$opt_defaultheight => $_defaultheight,
@@ -791,7 +795,6 @@ class YouTubePrefs
791
 
792
  public static function get_html($m, $iscontent)
793
  {
794
- //$link = trim(preg_replace('/&amp;/i', '&', $m[0]));
795
  $link = trim(str_replace(self::$badentities, self::$goodliterals, $m[0]));
796
 
797
  $link = preg_replace('/\s/', '', $link);
@@ -812,6 +815,7 @@ class YouTubePrefs
812
  $youtubebaseurl = 'youtube';
813
  $schemaorgoutput = '';
814
  $voloutput = '';
 
815
 
816
  $finalparams = $linkparams + self::$alloptions;
817
 
@@ -833,7 +837,16 @@ class YouTubePrefs
833
  }
834
 
835
 
836
- if (!(self::$alloptions[self::$opt_dohl] == 1 && isset($finalparams[self::$opt_hl]) && strlen($finalparams[self::$opt_hl]) == 2))
 
 
 
 
 
 
 
 
 
837
  {
838
  unset($finalparams[self::$opt_hl]);
839
  }
@@ -850,6 +863,13 @@ class YouTubePrefs
850
  $schemaorgoutput = self::getschemaorgoutput($finalparams['v']);
851
  }
852
 
 
 
 
 
 
 
 
853
  if (isset($linkparams[self::$opt_vol]) && is_numeric(trim($linkparams[self::$opt_vol])))
854
  {
855
  $voloutput = ' data-vol="' . $linkparams[self::$opt_vol] . '" ';
@@ -874,7 +894,7 @@ class YouTubePrefs
874
  }
875
 
876
  $code1 = '<iframe ' . $centercode . ' id="_ytid_' . rand(10000, 99999) . '" width="' . self::$defaultwidth . '" height="' . self::$defaultheight .
877
- '" src="' . $linkscheme . '://www.' . $youtubebaseurl . '.com/embed/' . (isset($linkparams['v']) ? $linkparams['v'] : '') . '?';
878
  $code2 = '" frameborder="0" type="text/html" class="__youtube_prefs__' . ($iscontent ? '' : ' __youtube_prefs_widget__') .
879
  '"' . $voloutput . ' allowfullscreen webkitallowfullscreen mozallowfullscreen ></iframe>' . $schemaorgoutput;
880
 
@@ -1331,13 +1351,13 @@ class YouTubePrefs
1331
  $new_pointer_content .= '<p>'; // . __(''); // ooopointer
1332
  if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
1333
  {
1334
- $new_pointer_content .= __('This update adds the ability to change the player&#39;s interface language from English to another language preferred by you and/or your visitors (for both Free and <a href="' . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer" target="_blank">PRO &raquo;</a> users).');
1335
  //<a href=\"" . admin_url('admin.php?page=youtube-my-preferences') . "#jumpdefaults\">See the settings page for more details &raquo;</a>"
1336
  //$new_pointer_content .= __('This YouTube plugin update makes HTTPS embedding available for both FREE and <a class="orange" href="' . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer" target="_blank">PRO &raquo;</a> users. Please view this settings page to see the option. It will even automatically go and secure the non-HTTPS embeds you made in the past.');
1337
  }
1338
  else
1339
  {
1340
- $new_pointer_content .= __("Language update. <a href=\"" . admin_url('admin.php?page=youtube-my-preferences') . "#jumpdefaults\">See the settings page for more details &raquo;</a>");
1341
  //$new_pointer_content .= __('');
1342
  }
1343
  $new_pointer_content .= '</p>';
@@ -1410,6 +1430,7 @@ class YouTubePrefs
1410
  $new_options[self::$opt_oldspacing] = self::postchecked(self::$opt_oldspacing) ? 1 : 0;
1411
  $new_options[self::$opt_responsive] = self::postchecked(self::$opt_responsive) ? 1 : 0;
1412
  $new_options[self::$opt_schemaorg] = self::postchecked(self::$opt_schemaorg) ? 1 : 0;
 
1413
  $new_options[self::$opt_defaultdims] = self::postchecked(self::$opt_defaultdims) ? 1 : 0;
1414
  $new_options[self::$opt_defaultvol] = self::postchecked(self::$opt_defaultvol) ? 1 : 0;
1415
  $new_options[self::$opt_dohl] = self::postchecked(self::$opt_dohl) ? 1 : 0;
@@ -1676,7 +1697,7 @@ class YouTubePrefs
1676
  </p>
1677
  <p>
1678
  <input name="<?php echo self::$opt_responsive; ?>" id="<?php echo self::$opt_responsive; ?>" <?php checked($all[self::$opt_responsive], 1); ?> type="checkbox" class="checkbox">
1679
- <label for="<?php echo self::$opt_responsive; ?>"><?php _e('<b class="chktitle">Responsive Video Sizing:</b> Make my videos responsive so that they dynamically fit in all screen sizes (smart phone, PC and tablet). NOTE: While this is checked, any custom hardcoded widths and heights you may have set will dynamically change too.') ?></label>
1680
  </p>
1681
  <p>
1682
  <input name="<?php echo self::$opt_defaultdims; ?>" id="<?php echo self::$opt_defaultdims; ?>" <?php checked($all[self::$opt_defaultdims], 1); ?> type="checkbox" class="checkbox">
@@ -1685,7 +1706,7 @@ class YouTubePrefs
1685
  Height: <input type="text" name="<?php echo self::$opt_defaultheight; ?>" id="<?php echo self::$opt_defaultheight; ?>" value="<?php echo trim($all[self::$opt_defaultheight]); ?>" class="textinput" style="width: 50px;">
1686
  </span>
1687
 
1688
- <label for="<?php echo self::$opt_defaultdims; ?>"><?php _e('<b class="chktitle">Default Dimensions:</b> Make my videos have a default size (NOTE: Checking the responsive option will override this size setting) ') ?></label>
1689
  </p>
1690
  <p>
1691
  <input name="<?php echo self::$opt_nocookie; ?>" id="<?php echo self::$opt_nocookie; ?>" <?php checked($all[self::$opt_nocookie], 1); ?> type="checkbox" class="checkbox">
@@ -1727,11 +1748,11 @@ class YouTubePrefs
1727
 
1728
  <p>
1729
  <input name="<?php echo self::$opt_dohl; ?>" id="<?php echo self::$opt_dohl; ?>" <?php checked($all[self::$opt_dohl], 1); ?> type="checkbox" class="checkbox">
1730
- <span id="boxdohl">
1731
  Language: <input type="text" name="<?php echo self::$opt_hl; ?>" id="<?php echo self::$opt_hl; ?>" value="<?php echo trim($all[self::$opt_hl]); ?>" class="textinput" style="width: 50px;" maxlength="2">
1732
- </span>
1733
- <label for="<?php echo self::$opt_dohl; ?>"><b class="chktitle">Player Localization/Internationalization: <sup class="orange">NEW</sup></b>
1734
- Change the player's interface language from English to another language preferred by you and/or your visitors. This will set the player's tooltips and default caption track depending on the availability of your desired language. Checking this option will display a box to enter the appropriate two-letter language code. <a href="<?php echo self::$epbase ?>/youtube-iso-639-1-language-codes.aspx" target="_blank">See here for a mapping of languages to YouTube supported codes &raquo;</a></label>
1735
  </p>
1736
 
1737
  <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 &raquo;</a></p>
@@ -1760,7 +1781,15 @@ class YouTubePrefs
1760
  <b>(PRO)</b> <b class="chktitle">Facebook Open Graph Markup:</b> <span class="pronon">(NEW: PRO Users)</span> Update YouTube embeds on your pages with Open Graph markup to enhance Facebook sharing and discovery of the pages. Your shared pages, for example, will also display embedded video thumbnails on Facebook Timelines.
1761
  </label>
1762
  </p>
1763
-
 
 
 
 
 
 
 
 
1764
  <?php
1765
  }
1766
  else
@@ -1787,6 +1816,13 @@ class YouTubePrefs
1787
  <b class="chktitle">Facebook Open Graph Markup:</b> <span class="pronon">(NEW: PRO Users)</span> Update YouTube embeds on your pages with Open Graph markup to enhance Facebook sharing and discovery of the pages. Your shared pages, for example, will also display embedded video thumbnails on Facebook Timelines.
1788
  </label>
1789
  </p>
 
 
 
 
 
 
 
1790
 
1791
  <?php
1792
  }
@@ -2024,15 +2060,15 @@ class YouTubePrefs
2024
  }
2025
  }
2026
 
2027
- if (jQuery("#<?php echo self::$opt_dohl; ?>").is(":checked"))
2028
- {
2029
- if (!(/^[A-Za-z][A-Za-z]$/.test(jQuery.trim(jQuery("#<?php echo self::$opt_hl; ?>").val()))))
2030
- {
2031
- alertmessage += "Please enter a valid 2-letter language code.";
2032
- jQuery("#boxdohl input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
2033
- valid = false;
2034
- }
2035
- }
2036
 
2037
  if (!valid)
2038
  {
@@ -2059,18 +2095,18 @@ class YouTubePrefs
2059
  });
2060
 
2061
 
2062
- jQuery('#<?php echo self::$opt_dohl; ?>').change(function()
2063
- {
2064
- if (jQuery(this).is(":checked"))
2065
- {
2066
- jQuery("#boxdohl").show(500);
2067
- }
2068
- else
2069
- {
2070
- jQuery("#boxdohl").hide(500);
2071
- }
2072
-
2073
- });
2074
 
2075
 
2076
 
@@ -2173,6 +2209,10 @@ class YouTubePrefs
2173
  public static function ytprefsscript()
2174
  {
2175
  wp_enqueue_script('__ytprefs__', plugins_url('scripts/ytprefs.min.js', __FILE__));
 
 
 
 
2176
  }
2177
 
2178
  public static function get_blogwidth()
@@ -2279,14 +2319,15 @@ class YouTubePrefs
2279
 
2280
 
2281
  register_activation_hook(__FILE__, array('YouTubePrefs', 'initoptions'));
 
 
 
2282
  add_action('wp_enqueue_scripts', array('YouTubePrefs', 'ytprefsscript'));
2283
  add_action("wp_ajax_my_embedplus_pro_record", array('YouTubePrefs', 'my_embedplus_pro_record'));
2284
  add_action("wp_ajax_my_embedplus_glance_vids", array('YouTubePrefs', 'my_embedplus_glance_vids'));
2285
  add_action("wp_ajax_my_embedplus_glance_count", array('YouTubePrefs', 'my_embedplus_glance_count'));
2286
  add_action("wp_ajax_my_embedplus_dismiss_double_plugin_warning", array('YouTubePrefs', 'my_embedplus_dismiss_double_plugin_warning'));
2287
 
2288
- $youtubeplg = new YouTubePrefs();
2289
-
2290
  add_action('admin_enqueue_scripts', 'youtubeprefs_admin_enqueue_scripts');
2291
 
2292
  function youtubeprefs_admin_enqueue_scripts()
@@ -2295,7 +2336,7 @@ class YouTubePrefs
2295
  add_action('wp_print_scripts', 'youtubeprefs_output_scriptvars');
2296
 
2297
  if (
2298
- (!(isset(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro]) && strlen(trim(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro])) > 0)) && // display only if not pro ooopointer
2299
  (get_bloginfo('version') >= '3.3') && YouTubePrefs::custom_admin_pointers_check()
2300
  )
2301
  {
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.1
7
  Author: EmbedPlus Team
8
  Author URI: http://www.embedplus.com
9
  */
32
  class YouTubePrefs
33
  {
34
 
35
+ public static $version = '9.1';
36
  public static $opt_version = 'version';
37
  public static $optembedwidth = null;
38
  public static $optembedheight = null;
70
  public static $opt_defaultvol = 'defaultvol';
71
  public static $opt_vol = 'vol';
72
  public static $opt_schemaorg = 'schemaorg';
73
+ public static $opt_dynload = 'dynload';
74
  public static $opt_alloptions = 'youtubeprefs_alloptions';
75
  public static $alloptions = null;
76
  public static $yt_options = array();
599
  $responsiveselector = '["iframe.__youtube_prefs_widget__"]';
600
  if (self::$alloptions[self::$opt_responsive] == 1)
601
  {
602
+ $responsiveselector = '["iframe[src*=\'youtube.com\']","iframe[src*=\'youtube-nocookie.com\']","iframe[data-ep-src*=\'youtube.com\']","iframe[data-ep-src*=\'youtube-nocookie.com\']"]';
603
  }
604
  ?>
605
  <script type="text/javascript">
640
  $_oldspacing = 1;
641
  $_responsive = 0;
642
  $_schemaorg = 0;
643
+ $_dynload = 0;
644
  $_wmode = 'opaque';
645
  $_defaultdims = 0;
646
  $_defaultwidth = '';
682
  $_oldspacing = self::tryget($arroptions, self::$opt_oldspacing, 1);
683
  $_responsive = self::tryget($arroptions, self::$opt_responsive, 0);
684
  $_schemaorg = self::tryget($arroptions, self::$opt_schemaorg, 0);
685
+ $_dynload = self::tryget($arroptions, self::$opt_dynload, 0);
686
  $_defaultdims = self::tryget($arroptions, self::$opt_defaultdims, 0);
687
  $_defaultwidth = self::tryget($arroptions, self::$opt_defaultwidth, '');
688
  $_defaultheight = self::tryget($arroptions, self::$opt_defaultheight, '');
722
  self::$opt_oldspacing => $_oldspacing,
723
  self::$opt_responsive => $_responsive,
724
  self::$opt_schemaorg => $_schemaorg,
725
+ self::$opt_dynload => $_dynload,
726
  self::$opt_defaultdims => $_defaultdims,
727
  self::$opt_defaultwidth => $_defaultwidth,
728
  self::$opt_defaultheight => $_defaultheight,
795
 
796
  public static function get_html($m, $iscontent)
797
  {
 
798
  $link = trim(str_replace(self::$badentities, self::$goodliterals, $m[0]));
799
 
800
  $link = preg_replace('/\s/', '', $link);
815
  $youtubebaseurl = 'youtube';
816
  $schemaorgoutput = '';
817
  $voloutput = '';
818
+ $dynsrc = '';
819
 
820
  $finalparams = $linkparams + self::$alloptions;
821
 
837
  }
838
 
839
 
840
+ // if (!(self::$alloptions[self::$opt_dohl] == 1 && isset($finalparams[self::$opt_hl]) && strlen($finalparams[self::$opt_hl]) == 2))
841
+ // {
842
+ // unset($finalparams[self::$opt_hl]);
843
+ // }
844
+ if (self::$alloptions[self::$opt_dohl] == 1)
845
+ {
846
+ $locale = get_locale();
847
+ $finalparams[self::$opt_hl] = $locale;
848
+ }
849
+ else
850
  {
851
  unset($finalparams[self::$opt_hl]);
852
  }
863
  $schemaorgoutput = self::getschemaorgoutput($finalparams['v']);
864
  }
865
 
866
+ // if (self::$alloptions[self::$opt_dynload] == 1
867
+ // //&& $finalparams[self::$opt_autoplay] != 1
868
+ // )
869
+ // {
870
+ // $dynsrc = 'data-ep-';
871
+ // }
872
+
873
  if (isset($linkparams[self::$opt_vol]) && is_numeric(trim($linkparams[self::$opt_vol])))
874
  {
875
  $voloutput = ' data-vol="' . $linkparams[self::$opt_vol] . '" ';
894
  }
895
 
896
  $code1 = '<iframe ' . $centercode . ' id="_ytid_' . rand(10000, 99999) . '" width="' . self::$defaultwidth . '" height="' . self::$defaultheight .
897
+ '" ' . $dynsrc . 'src="' . $linkscheme . '://www.' . $youtubebaseurl . '.com/embed/' . (isset($linkparams['v']) ? $linkparams['v'] : '') . '?';
898
  $code2 = '" frameborder="0" type="text/html" class="__youtube_prefs__' . ($iscontent ? '' : ' __youtube_prefs_widget__') .
899
  '"' . $voloutput . ' allowfullscreen webkitallowfullscreen mozallowfullscreen ></iframe>' . $schemaorgoutput;
900
 
1351
  $new_pointer_content .= '<p>'; // . __(''); // ooopointer
1352
  if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
1353
  {
1354
+ $new_pointer_content .= __('With this version, the plugin can now automatically detect your site\\\'s default language and set the interface of the embedded YouTube player to match it (for FREE and <a href="' . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer" target="_blank">PRO versions &raquo;)</a>.');
1355
  //<a href=\"" . admin_url('admin.php?page=youtube-my-preferences') . "#jumpdefaults\">See the settings page for more details &raquo;</a>"
1356
  //$new_pointer_content .= __('This YouTube plugin update makes HTTPS embedding available for both FREE and <a class="orange" href="' . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer" target="_blank">PRO &raquo;</a> users. Please view this settings page to see the option. It will even automatically go and secure the non-HTTPS embeds you made in the past.');
1357
  }
1358
  else
1359
  {
1360
+ $new_pointer_content .= __('With this version, the plugin can now automatically detect your site\\\'s default language and set the interface of the embedded YouTube player to match (for FREE and <a href="' . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer" target="_blank">PRO versions &raquo;)</a>.');
1361
  //$new_pointer_content .= __('');
1362
  }
1363
  $new_pointer_content .= '</p>';
1430
  $new_options[self::$opt_oldspacing] = self::postchecked(self::$opt_oldspacing) ? 1 : 0;
1431
  $new_options[self::$opt_responsive] = self::postchecked(self::$opt_responsive) ? 1 : 0;
1432
  $new_options[self::$opt_schemaorg] = self::postchecked(self::$opt_schemaorg) ? 1 : 0;
1433
+ //$new_options[self::$opt_dynload] = self::postchecked(self::$opt_dynload) ? 1 : 0;
1434
  $new_options[self::$opt_defaultdims] = self::postchecked(self::$opt_defaultdims) ? 1 : 0;
1435
  $new_options[self::$opt_defaultvol] = self::postchecked(self::$opt_defaultvol) ? 1 : 0;
1436
  $new_options[self::$opt_dohl] = self::postchecked(self::$opt_dohl) ? 1 : 0;
1697
  </p>
1698
  <p>
1699
  <input name="<?php echo self::$opt_responsive; ?>" id="<?php echo self::$opt_responsive; ?>" <?php checked($all[self::$opt_responsive], 1); ?> type="checkbox" class="checkbox">
1700
+ <label for="<?php echo self::$opt_responsive; ?>"><?php _e('<b class="chktitle">Responsive Video Sizing:</b> Make your videos responsive so that they dynamically fit in all screen sizes (smart phone, PC and tablet). NOTE: While this is checked, any custom hardcoded widths and heights you may have set will dynamically change too.') ?></label>
1701
  </p>
1702
  <p>
1703
  <input name="<?php echo self::$opt_defaultdims; ?>" id="<?php echo self::$opt_defaultdims; ?>" <?php checked($all[self::$opt_defaultdims], 1); ?> type="checkbox" class="checkbox">
1706
  Height: <input type="text" name="<?php echo self::$opt_defaultheight; ?>" id="<?php echo self::$opt_defaultheight; ?>" value="<?php echo trim($all[self::$opt_defaultheight]); ?>" class="textinput" style="width: 50px;">
1707
  </span>
1708
 
1709
+ <label for="<?php echo self::$opt_defaultdims; ?>"><?php _e('<b class="chktitle">Default Dimensions:</b> Make your videos have a default size (NOTE: Checking the responsive option will override this size setting) ') ?></label>
1710
  </p>
1711
  <p>
1712
  <input name="<?php echo self::$opt_nocookie; ?>" id="<?php echo self::$opt_nocookie; ?>" <?php checked($all[self::$opt_nocookie], 1); ?> type="checkbox" class="checkbox">
1748
 
1749
  <p>
1750
  <input name="<?php echo self::$opt_dohl; ?>" id="<?php echo self::$opt_dohl; ?>" <?php checked($all[self::$opt_dohl], 1); ?> type="checkbox" class="checkbox">
1751
+ <!-- <span id="boxdohl">
1752
  Language: <input type="text" name="<?php echo self::$opt_hl; ?>" id="<?php echo self::$opt_hl; ?>" value="<?php echo trim($all[self::$opt_hl]); ?>" class="textinput" style="width: 50px;" maxlength="2">
1753
+ </span>-->
1754
+ <label for="<?php echo self::$opt_dohl; ?>"><b class="chktitle">Player Localization / Internationalization: <sup class="orange">NEW</sup></b>
1755
+ Automatically detect your site's default language (using get_locale) and set your YouTube embeds interface language so that it matches. Specifically, this will set the player's tooltips and caption track if your language is natively supported by YouTube. We suggest checking this if English is not your site's default language. <a href="<?php echo self::$epbase ?>/youtube-iso-639-1-language-codes.aspx" target="_blank">See here for more details &raquo;</a></label>
1756
  </p>
1757
 
1758
  <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 &raquo;</a></p>
1781
  <b>(PRO)</b> <b class="chktitle">Facebook Open Graph Markup:</b> <span class="pronon">(NEW: PRO Users)</span> Update YouTube embeds on your pages with Open Graph markup to enhance Facebook sharing and discovery of the pages. Your shared pages, for example, will also display embedded video thumbnails on Facebook Timelines.
1782
  </label>
1783
  </p>
1784
+ <input name="<?php echo self::$opt_dynload; ?>" type="hidden" value="0" />
1785
+ <!--
1786
+ <p>
1787
+ <input name="<?php echo self::$opt_dynload; ?>" id="<?php echo self::$opt_dynload; ?>" <?php checked($all[self::$opt_dynload], 1); ?> type="checkbox" class="checkbox">
1788
+ <label for="<?php echo self::$opt_dynload; ?>">
1789
+ <b>(PRO)</b> <b class="chktitle"></b>
1790
+ </label>
1791
+ </p>
1792
+ -->
1793
  <?php
1794
  }
1795
  else
1816
  <b class="chktitle">Facebook Open Graph Markup:</b> <span class="pronon">(NEW: PRO Users)</span> Update YouTube embeds on your pages with Open Graph markup to enhance Facebook sharing and discovery of the pages. Your shared pages, for example, will also display embedded video thumbnails on Facebook Timelines.
1817
  </label>
1818
  </p>
1819
+
1820
+ <!-- <p>
1821
+ <input disabled type="checkbox" class="checkbox">
1822
+ <label>
1823
+ <b class="chktitle"></b> <span class="pronon"></span>
1824
+ </label>
1825
+ </p>-->
1826
 
1827
  <?php
1828
  }
2060
  }
2061
  }
2062
 
2063
+ // if (jQuery("#<?php echo self::$opt_dohl; ?>").is(":checked"))
2064
+ // {
2065
+ // if (!(/^[A-Za-z][A-Za-z]$/.test(jQuery.trim(jQuery("#<?php echo self::$opt_hl; ?>").val()))))
2066
+ // {
2067
+ // alertmessage += "Please enter a valid 2-letter language code.";
2068
+ // jQuery("#boxdohl input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
2069
+ // valid = false;
2070
+ // }
2071
+ // }
2072
 
2073
  if (!valid)
2074
  {
2095
  });
2096
 
2097
 
2098
+ // jQuery('#<?php echo self::$opt_dohl; ?>').change(function()
2099
+ // {
2100
+ // if (jQuery(this).is(":checked"))
2101
+ // {
2102
+ // jQuery("#boxdohl").show(500);
2103
+ // }
2104
+ // else
2105
+ // {
2106
+ // jQuery("#boxdohl").hide(500);
2107
+ // }
2108
+ //
2109
+ // });
2110
 
2111
 
2112
 
2209
  public static function ytprefsscript()
2210
  {
2211
  wp_enqueue_script('__ytprefs__', plugins_url('scripts/ytprefs.min.js', __FILE__));
2212
+ // if (!is_admin() && (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0) && self::$alloptions[self::$opt_dynload] == 1)
2213
+ // {
2214
+ // wp_enqueue_script('__dynload__', plugins_url('scripts/jquery.lazyloadxt.extra.js', __FILE__));
2215
+ // }
2216
  }
2217
 
2218
  public static function get_blogwidth()
2319
 
2320
 
2321
  register_activation_hook(__FILE__, array('YouTubePrefs', 'initoptions'));
2322
+ $youtubeplgplus = new YouTubePrefs();
2323
+
2324
+
2325
  add_action('wp_enqueue_scripts', array('YouTubePrefs', 'ytprefsscript'));
2326
  add_action("wp_ajax_my_embedplus_pro_record", array('YouTubePrefs', 'my_embedplus_pro_record'));
2327
  add_action("wp_ajax_my_embedplus_glance_vids", array('YouTubePrefs', 'my_embedplus_glance_vids'));
2328
  add_action("wp_ajax_my_embedplus_glance_count", array('YouTubePrefs', 'my_embedplus_glance_count'));
2329
  add_action("wp_ajax_my_embedplus_dismiss_double_plugin_warning", array('YouTubePrefs', 'my_embedplus_dismiss_double_plugin_warning'));
2330
 
 
 
2331
  add_action('admin_enqueue_scripts', 'youtubeprefs_admin_enqueue_scripts');
2332
 
2333
  function youtubeprefs_admin_enqueue_scripts()
2336
  add_action('wp_print_scripts', 'youtubeprefs_output_scriptvars');
2337
 
2338
  if (
2339
+ //(!(isset(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro]) && strlen(trim(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro])) > 0)) && // display only if not pro ooopointer
2340
  (get_bloginfo('version') >= '3.3') && YouTubePrefs::custom_admin_pointers_check()
2341
  )
2342
  {