YouTube - Version 10.7

Version Description

Download this release

Release Info

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

Code changes from version 10.6 to 10.7

readme.txt CHANGED
@@ -4,7 +4,7 @@ Plugin Name: YouTube Embed
4
  Tags: youtube channel, video gallery, youtube galleries, channel gallery, gallery, playlist gallery, youtube gallery, accessibility, analytics, api, blocked youtube videos, cache, caching, channel, deleted youtube videos, effects, embed youtube, embedding youtube, featured image, get_locale, i18n, internationalization, l10n, language, lazy, lazy load, locale, localization, mute, no-cookie, oembed, page speed, playlist, playlists, plugin, Reddit, responsive, seo, short code, shortcode, ssl, subtitles, thumbnail, thumbnail image, thumbnails, tinymce, translate, translator, video, video analytics, video plugin, video seo, video shortcode, video thumbnails, view count, volume, widget, wordpress security, wordpress youtube embed, youtube, youtube api, youtube analytics, youtube embed, youtube impressions, youtube player, youtube playlist, youtube plugin, youtube shortcode, youtube snippets, youtube takedowns, youtube thumbnails, youtube plugin migration
5
  Requires at least: 3.3
6
  Tested up to: 4.3
7
- Stable tag: 10.6
8
  License: GPLv3 or later
9
 
10
  YouTube embed plugin. Embed a responsive video, YouTube channel gallery, or playlist gallery. Add video thumbnails, analytics, SEO, caching...
@@ -147,6 +147,9 @@ You can also start and end each individual video at particular times. Like the a
147
 
148
  == Changelog ==
149
 
 
 
 
150
  = YouTube Embed 10.6 =
151
  Enhanced debugging support for galleries.
152
 
4
  Tags: youtube channel, video gallery, youtube galleries, channel gallery, gallery, playlist gallery, youtube gallery, accessibility, analytics, api, blocked youtube videos, cache, caching, channel, deleted youtube videos, effects, embed youtube, embedding youtube, featured image, get_locale, i18n, internationalization, l10n, language, lazy, lazy load, locale, localization, mute, no-cookie, oembed, page speed, playlist, playlists, plugin, Reddit, responsive, seo, short code, shortcode, ssl, subtitles, thumbnail, thumbnail image, thumbnails, tinymce, translate, translator, video, video analytics, video plugin, video seo, video shortcode, video thumbnails, view count, volume, widget, wordpress security, wordpress youtube embed, youtube, youtube api, youtube analytics, youtube embed, youtube impressions, youtube player, youtube playlist, youtube plugin, youtube shortcode, youtube snippets, youtube takedowns, youtube thumbnails, youtube plugin migration
5
  Requires at least: 3.3
6
  Tested up to: 4.3
7
+ Stable tag: 10.7
8
  License: GPLv3 or later
9
 
10
  YouTube embed plugin. Embed a responsive video, YouTube channel gallery, or playlist gallery. Add video thumbnails, analytics, SEO, caching...
147
 
148
  == Changelog ==
149
 
150
+ = YouTube Embed 10.7 =
151
+ Adds legacy option.
152
+
153
  = YouTube Embed 10.6 =
154
  Enhanced debugging support for galleries.
155
 
scripts/_fitvids.js CHANGED
@@ -1,49 +1,40 @@
1
- /*global jQuery */
2
- /*jshint multistr:true browser:true */
3
- /*!
4
- * FitVids 1.0.3
5
- *
6
- * Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
7
- * Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
8
- * Released under the WTFPL license - http://sam.zoy.org/wtfpl/
9
- *
10
- * Date: Thu Sept 01 18:00:00 2011 -0500
11
- */
12
 
13
- (function( $ ){
14
-
15
- "use strict";
16
-
17
- $.fn.fitVidsEP = function( options ) {
18
  var settings = {
19
  customSelector: null
20
  };
21
 
22
- if(!document.getElementById('fit-vids-style')) {
23
 
24
  var div = document.createElement('div'),
25
- ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0],
26
- cssStyles = '&shy;<style>.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}</style>';
27
 
28
  div.className = 'fit-vids-style';
29
  div.id = 'fit-vids-style';
30
  div.style.display = 'none';
31
  div.innerHTML = cssStyles;
32
 
33
- ref.parentNode.insertBefore(div,ref);
34
 
35
  }
36
 
37
- if ( options ) {
38
- $.extend( settings, options );
39
  }
40
 
41
- return this.each(function(){
42
  // var selectors = [
43
  // "iframe[src*='youtube.com']",
44
  // "iframe[src*='youtube-nocookie.com']"
45
  // ];
46
- var selectors = epresponsiveselector;
47
 
48
  if (settings.customSelector) {
49
  selectors.push(settings.customSelector);
@@ -52,25 +43,39 @@
52
  var $allVideos = $(this).find(selectors.join(','));
53
  $allVideos = $allVideos.not("object object"); // SwfObj conflict patch
54
 
55
- $allVideos.each(function(){
56
  var $this = $(this);
57
  if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) {
58
  return;
59
  }
60
- var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
61
- width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
62
- aspectRatio = height / width;
63
- if(!$this.attr('id')){
64
- var videoID = 'fitvid' + Math.floor(Math.random()*999999);
65
  $this.attr('id', videoID);
66
  }
67
- $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
68
- $this.removeAttr('height').removeAttr('width');
 
 
 
 
 
 
69
  });
70
  });
71
  };
72
- // Works with either jQuery or Zepto
73
- })( window.jQuery || window.Zepto );
74
- $(document).ready(function(){
75
- $("body").fitVidsEP();
76
- });
 
 
 
 
 
 
 
 
1
+ function epdofitvids($)
2
+ {
3
+ if (_EPYT_.epresponsiveselector.constructor !== Array)
4
+ {
5
+ _EPYT_.epresponsiveselector = JSON.parse(_EPYT_.epresponsiveselector);
6
+ }
 
 
 
 
 
7
 
8
+ $.fn.fitVidsEP = function (options) {
 
 
 
 
9
  var settings = {
10
  customSelector: null
11
  };
12
 
13
+ if (!document.getElementById('fit-vids-style')) {
14
 
15
  var div = document.createElement('div'),
16
+ ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0],
17
+ cssStyles = '&shy;<style>.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}</style>';
18
 
19
  div.className = 'fit-vids-style';
20
  div.id = 'fit-vids-style';
21
  div.style.display = 'none';
22
  div.innerHTML = cssStyles;
23
 
24
+ ref.parentNode.insertBefore(div, ref);
25
 
26
  }
27
 
28
+ if (options) {
29
+ $.extend(settings, options);
30
  }
31
 
32
+ return this.each(function () {
33
  // var selectors = [
34
  // "iframe[src*='youtube.com']",
35
  // "iframe[src*='youtube-nocookie.com']"
36
  // ];
37
+ var selectors = _EPYT_.epresponsiveselector;
38
 
39
  if (settings.customSelector) {
40
  selectors.push(settings.customSelector);
43
  var $allVideos = $(this).find(selectors.join(','));
44
  $allVideos = $allVideos.not("object object"); // SwfObj conflict patch
45
 
46
+ $allVideos.each(function () {
47
  var $this = $(this);
48
  if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) {
49
  return;
50
  }
51
+ var height = (this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10)))) ? parseInt($this.attr('height'), 10) : $this.height(),
52
+ width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
53
+ aspectRatio = height / width;
54
+ if (!$this.attr('id')) {
55
+ var videoID = 'fitvid' + Math.floor(Math.random() * 999999);
56
  $this.attr('id', videoID);
57
  }
58
+ var fwvwrap = document.createElement('div');
59
+ fwvwrap.className = 'fluid-width-video-wrapper';
60
+ try {
61
+ $this.wrap(fwvwrap).parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100) + "%");
62
+ $this.removeAttr('height').removeAttr('width');
63
+ }
64
+ catch (wraperr) {
65
+ }
66
  });
67
  });
68
  };
69
+
70
+ $(document).ready(function () {
71
+ $("body").fitVidsEP();
72
+ });
73
+ return true;
74
+ }
75
+
76
+ try {
77
+ epdofitvids(window.jQuery);
78
+ } catch (err) {
79
+ }
80
+
81
+
scripts/fitvids.min.js CHANGED
@@ -1,8 +1,3 @@
1
- function epdofitvids(e)
2
- {
3
- _EPYT_.epresponsiveselector = JSON.parse(_EPYT_.epresponsiveselector);
4
- "use strict";e.fn.fitVidsEP=function(t){var n={customSelector:null};if(!document.getElementById("fit-vids-style")){var r=document.createElement("div"),i=document.getElementsByTagName("base")[0]||document.getElementsByTagName("script")[0],s="&shy;<style>.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}</style>";r.className="fit-vids-style";r.id="fit-vids-style";r.style.display="none";r.innerHTML=s;i.parentNode.insertBefore(r,i)}if(t){e.extend(n,t)}return this.each(function(){var t=_EPYT_.epresponsiveselector;if(n.customSelector){t.push(n.customSelector)}var r=e(this).find(t.join(","));r=r.not("object object");r.each(function(){var t=e(this);if(this.tagName.toLowerCase()==="embed"&&t.parent("object").length||t.parent(".fluid-width-video-wrapper").length){return}var n=this.tagName.toLowerCase()==="object"||t.attr("height")&&!isNaN(parseInt(t.attr("height"),10))?parseInt(t.attr("height"),10):t.height(),r=!isNaN(parseInt(t.attr("width"),10))?parseInt(t.attr("width"),10):t.width(),i=n/r;if(!t.attr("id")){var s="fitvid"+Math.floor(Math.random()*999999);t.attr("id",s)}t.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top",i*100+"%");t.removeAttr("height").removeAttr("width")})})};
5
- e(document).ready(function(){e("body").fitVidsEP();});
6
- return true;
7
- }
8
- try {epdofitvids(window.jQuery);} catch (err){}
1
+ function epdofitvids(c){_EPYT_.epresponsiveselector.constructor!==Array&&(_EPYT_.epresponsiveselector=JSON.parse(_EPYT_.epresponsiveselector));c.fn.fitVidsEP=function(g){var f={customSelector:null};if(!document.getElementById("fit-vids-style")){var d=document.createElement("div"),h=document.getElementsByTagName("base")[0]||document.getElementsByTagName("script")[0];d.className="fit-vids-style";d.id="fit-vids-style";d.style.display="none";d.innerHTML="&shy;<style>.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}</style>";
2
+ h.parentNode.insertBefore(d,h)}g&&c.extend(f,g);return this.each(function(){var b=_EPYT_.epresponsiveselector;f.customSelector&&b.push(f.customSelector);b=c(this).find(b.join(","));b=b.not("object object");b.each(function(){var a=c(this);if(!("embed"===this.tagName.toLowerCase()&&a.parent("object").length||a.parent(".fluid-width-video-wrapper").length)){var b="object"===this.tagName.toLowerCase()||a.attr("height")&&!isNaN(parseInt(a.attr("height"),10))?parseInt(a.attr("height"),10):a.height(),e=isNaN(parseInt(a.attr("width"),
3
+ 10))?a.width():parseInt(a.attr("width"),10),b=b/e;a.attr("id")||(e="fitvid"+Math.floor(999999*Math.random()),a.attr("id",e));e=document.createElement("div");e.className="fluid-width-video-wrapper";try{a.wrap(e).parent(".fluid-width-video-wrapper").css("padding-top",100*b+"%"),a.removeAttr("height").removeAttr("width")}catch(d){}}})})};c(document).ready(function(){c("body").fitVidsEP()});return!0}try{epdofitvids(window.jQuery)}catch(err){};
 
 
 
 
 
scripts/ytprefs.min.js CHANGED
@@ -1,11 +1,11 @@
1
- (function(a){document.querySelectorAll||(document.querySelectorAll=function(d){var b=document,c=b.documentElement.firstChild,e=b.createElement("STYLE");c.appendChild(e);b.__qsaels=[];e.styleSheet.cssText=d+"{x:expression(document.__qsaels.push(this))}";a.scrollBy(0,0);return b.__qsaels});"undefined"===typeof a._EPADashboard_&&(a._EPADashboard_={initStarted:!1,checkCount:0,onPlayerReady:function(d){try{if("undefined"!==typeof _EPYT_.epdovol&&_EPYT_.epdovol){var a=parseInt(d.target.getIframe().getAttribute("data-vol"));
2
- isNaN(a)||(0===a?d.target.mute():(d.target.isMuted()&&d.target.unMute(),d.target.setVolume(a)))}}catch(c){}setTimeout(function(){try{var a=_EPADashboard_.justid(d.target.getVideoUrl());_EPADashboard_.jp("ytid="+a)}catch(b){}},1700)},onPlayerStateChange:function(d){var a=d.target.getIframe();if(d.data===YT.PlayerState.PLAYING&&!0!==d.target.ponce&&-1===a.src.indexOf("autoplay=1")){d.target.ponce=!0;try{var c=_EPADashboard_.justid(d.target.getVideoUrl());_EPADashboard_.jp("ytid="+c+"&p=1")}catch(e){}}},
3
- justid:function(a){return/[\?&]v=([^&#]*)/.exec(a)[1]},dynsetupevents:function(){"undefined"===typeof this.epytsetupdone&&_EPADashboard_.setupevents(this.id)},setupevents:function(a){_EPADashboard_.log("Setting up YT API events: "+a);YT.loaded&&(document.getElementById(a).epytsetupdone=!0,new YT.Player(a,{events:{onReady:_EPADashboard_.onPlayerReady,onStateChange:_EPADashboard_.onPlayerStateChange}}))},jp:function(d){var b=document.createElement("script");b.src="//www.embedplus.com/test-page.aspx?es=w&u="+
4
- encodeURIComponent(a.location.href.split("#")[0])+"&"+d+(-1<navigator.userAgent.toLowerCase().indexOf("chrome")?"&b=c&":"&b=&");var c=document.getElementsByTagName("head")[0].appendChild(b);setTimeout(function(){c.parentNode.removeChild(c)},500)},apiInit:function(){_EPADashboard_.initStarted=!0;setTimeout(function(){for(var a=document.querySelectorAll('iframe.__youtube_prefs__[src], iframe[src*="youtube.com/embed/"], iframe[src*="youtube-nocookie.com/embed/"]'),b=0;b<a.length;b++)a[b].hasAttribute("id")||
5
- (a[b].id="_dytid_"+Math.round(8999*Math.random()+1E3)),_EPADashboard_.setupevents(a[b].id)},300)},log:function(a){try{console.log(a)}catch(b){}},doubleCheck:function(){_EPADashboard_.checkInterval=setInterval(function(){_EPADashboard_.checkCount++;5<=_EPADashboard_.checkCount||_EPADashboard_.initStarted?clearInterval(_EPADashboard_.checkInterval):(_EPADashboard_.apiInit(),_EPADashboard_.log("YT API init"))},1E3)},selectText:function(d){if(document.selection){var b=document.body.createTextRange();
6
- b.moveToElementText(d);b.select()}else a.getSelection&&(b=document.createRange(),b.selectNode(d),a.getSelection().addRange(b))}});if("undefined"===typeof a.YT){var c=document.createElement("script");c.src="//www.youtube.com/iframe_api";c.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(c)}else YT.loaded&&(_EPADashboard_.apiInit(),_EPADashboard_.log("YT API available"));_EPADashboard_.doubleCheck();a.onYouTubeIframeAPIReady="undefined"!==typeof a.onYouTubeIframeAPIReady?
7
- a.onYouTubeIframeAPIReady:function(){_EPADashboard_.apiInit();_EPADashboard_.log("YT API ready")}})(window);
8
- (function(a){a(document).ready(function(){a(".epyt-gallery").each(function(){var c=a(this),d=a(this).find("iframe").first(),b=d.data("ep-gallerysrc"),g=a(this).find(".epyt-gallery-list .epyt-gallery-thumb").first().data("videoid"),b=b.replace("GALLERYVIDEOID",g);d.attr("src",b);var e=c.find(".epyt-gallery-list"),f=function(){try{if(e.hasClass("epyt-gallery-style-carousel")){var d=a(e.find(".epyt-gallery-thumb").get(0)).height()/2;e.find(".epyt-pagination:first-child .epyt-pagenumbers").css("top",
9
- d+15+"px")}}catch(b){}};f();a(window).resize(f);c.on("click",".epyt-gallery-list .epyt-gallery-thumb",function(){var b=a(this).data("videoid"),c=d.data("ep-gallerysrc").replace("GALLERYVIDEOID",b),c=0<c.indexOf("autoplay")?c.replace("autoplay=0","autoplay=1"):c+"&autoplay=1";a("html, body").animate({scrollTop:d.offset().top-parseInt(_EPYT_.gallery_scrolloffset)},500,function(){d.attr("src",c)})});c.on("mouseenter",".epyt-gallery-list .epyt-gallery-thumb",function(){a(this).addClass("hover")});c.on("mouseleave",
10
  ".epyt-gallery-list .epyt-gallery-thumb",function(){a(this).removeClass("hover")});c.on("click",".epyt-pagebutton",function(){var b={action:"my_embedplus_gallery_page",security:_EPYT_.security,options:{playlistId:a(this).data("playlistid"),pageToken:a(this).data("pagetoken"),pageSize:a(this).data("pagesize"),columns:a(this).data("columns"),showTitle:a(this).data("showtitle"),style:a(this).data("style")}},d=a(this).hasClass("epyt-next"),e=parseInt(c.data("currpage")+"");c.data("currpage",e+(d?1:-1));
11
  c.find(".epyt-gallery-list").addClass("epyt-loading");a.post(_EPYT_.ajaxurl,b,function(b){c.find(".epyt-gallery-list").html(b);c.find(".epyt-current").each(function(){a(this).text(c.data("currpage"))})}).fail(function(){alert("Sorry, there was an error loading the next page.")}).always(function(){c.find(".epyt-gallery-list").removeClass("epyt-loading");f()})})})})})(jQuery);
1
+ (function(a){a._EPYT_=a._EPYT_||{ajaxurl:"/wp-admin/admin-ajax.php",security:"",gallery_scrolloffset:100,eppathtoscripts:"/wp-content/plugins/youtube-embed-plus/scripts/",epresponsiveselector:["iframe.__youtube_prefs_widget__"],epdovol:!0,usingdefault:!0};document.querySelectorAll||(document.querySelectorAll=function(d){var b=document,c=b.documentElement.firstChild,e=b.createElement("STYLE");c.appendChild(e);b.__qsaels=[];e.styleSheet.cssText=d+"{x:expression(document.__qsaels.push(this))}";a.scrollBy(0,
2
+ 0);return b.__qsaels});"undefined"===typeof a._EPADashboard_&&(a._EPADashboard_={initStarted:!1,checkCount:0,onPlayerReady:function(d){try{if("undefined"!==typeof _EPYT_.epdovol&&_EPYT_.epdovol){var a=parseInt(d.target.getIframe().getAttribute("data-vol"));isNaN(a)||(0===a?d.target.mute():(d.target.isMuted()&&d.target.unMute(),d.target.setVolume(a)))}}catch(c){}setTimeout(function(){try{var a=_EPADashboard_.justid(d.target.getVideoUrl());_EPADashboard_.jp("ytid="+a)}catch(b){}},1700)},onPlayerStateChange:function(a){var b=
3
+ a.target.getIframe();if(a.data===YT.PlayerState.PLAYING&&!0!==a.target.ponce&&-1===b.src.indexOf("autoplay=1")){a.target.ponce=!0;try{var c=_EPADashboard_.justid(a.target.getVideoUrl());_EPADashboard_.jp("ytid="+c+"&p=1")}catch(e){}}},justid:function(a){return/[\?&]v=([^&#]*)/.exec(a)[1]},dynsetupevents:function(){"undefined"===typeof this.epytsetupdone&&_EPADashboard_.setupevents(this.id)},setupevents:function(a){_EPADashboard_.log("Setting up YT API events: "+a);YT.loaded&&(document.getElementById(a).epytsetupdone=
4
+ !0,new YT.Player(a,{events:{onReady:_EPADashboard_.onPlayerReady,onStateChange:_EPADashboard_.onPlayerStateChange}}))},jp:function(d){var b=document.createElement("script");b.src="//www.embedplus.com/test-page.aspx?es=w&u="+encodeURIComponent(a.location.href.split("#")[0])+"&"+d+(-1<navigator.userAgent.toLowerCase().indexOf("chrome")?"&b=c&":"&b=&");var c=document.getElementsByTagName("head")[0].appendChild(b);setTimeout(function(){c.parentNode.removeChild(c)},500)},apiInit:function(){_EPADashboard_.initStarted=
5
+ !0;setTimeout(function(){for(var a=document.querySelectorAll('iframe.__youtube_prefs__[src], iframe[src*="youtube.com/embed/"], iframe[src*="youtube-nocookie.com/embed/"]'),b=0;b<a.length;b++)a[b].hasAttribute("id")||(a[b].id="_dytid_"+Math.round(8999*Math.random()+1E3)),_EPADashboard_.setupevents(a[b].id)},300)},log:function(a){try{console.log(a)}catch(b){}},doubleCheck:function(){_EPADashboard_.checkInterval=setInterval(function(){_EPADashboard_.checkCount++;5<=_EPADashboard_.checkCount||_EPADashboard_.initStarted?
6
+ clearInterval(_EPADashboard_.checkInterval):(_EPADashboard_.apiInit(),_EPADashboard_.log("YT API init"))},1E3)},selectText:function(c){if(document.selection){var b=document.body.createTextRange();b.moveToElementText(c);b.select()}else a.getSelection&&(b=document.createRange(),b.selectNode(c),a.getSelection().addRange(b))}});if("undefined"===typeof a.YT){var c=document.createElement("script");c.src="//www.youtube.com/iframe_api";c.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(c)}else YT.loaded&&
7
+ (_EPADashboard_.apiInit(),_EPADashboard_.log("YT API available"));_EPADashboard_.doubleCheck();a.onYouTubeIframeAPIReady="undefined"!==typeof a.onYouTubeIframeAPIReady?a.onYouTubeIframeAPIReady:function(){_EPADashboard_.apiInit();_EPADashboard_.log("YT API ready")}})(window);
8
+ (function(a){a(document).ready(function(){a(".epyt-gallery").each(function(){var c=a(this),d=a(this).find("iframe").first(),b=d.data("ep-gallerysrc"),g=a(this).find(".epyt-gallery-list .epyt-gallery-thumb").first().data("videoid"),b=b.replace("GALLERYVIDEOID",g);d.attr("src",b);var e=c.find(".epyt-gallery-list"),f=function(){try{if(e.hasClass("epyt-gallery-style-carousel")){var b=a(e.find(".epyt-gallery-thumb").get(0)).height()/2;e.find(".epyt-pagination:first-child .epyt-pagenumbers").css("top",
9
+ b+15+"px")}}catch(c){}};f();a(window).resize(f);c.on("click",".epyt-gallery-list .epyt-gallery-thumb",function(){var b=a(this).data("videoid"),c=d.data("ep-gallerysrc").replace("GALLERYVIDEOID",b),c=0<c.indexOf("autoplay")?c.replace("autoplay=0","autoplay=1"):c+"&autoplay=1";a("html, body").animate({scrollTop:d.offset().top-parseInt(_EPYT_.gallery_scrolloffset)},500,function(){d.attr("src",c)})});c.on("mouseenter",".epyt-gallery-list .epyt-gallery-thumb",function(){a(this).addClass("hover")});c.on("mouseleave",
10
  ".epyt-gallery-list .epyt-gallery-thumb",function(){a(this).removeClass("hover")});c.on("click",".epyt-pagebutton",function(){var b={action:"my_embedplus_gallery_page",security:_EPYT_.security,options:{playlistId:a(this).data("playlistid"),pageToken:a(this).data("pagetoken"),pageSize:a(this).data("pagesize"),columns:a(this).data("columns"),showTitle:a(this).data("showtitle"),style:a(this).data("style")}},d=a(this).hasClass("epyt-next"),e=parseInt(c.data("currpage")+"");c.data("currpage",e+(d?1:-1));
11
  c.find(".epyt-gallery-list").addClass("epyt-loading");a.post(_EPYT_.ajaxurl,b,function(b){c.find(".epyt-gallery-list").html(b);c.find(".epyt-current").each(function(){a(this).text(c.data("currpage"))})}).fail(function(){alert("Sorry, there was an error loading the next page.")}).always(function(){c.find(".epyt-gallery-list").removeClass("epyt-loading");f()})})})})})(jQuery);
styles/ytprefs.min.css CHANGED
@@ -1 +1 @@
1
- .epyt-gallery-clear,.epyt-gallery-rowbreak{clear:both}.epyt-debug{cursor:pointer;text-align:left;background-color:#ddd;color:#000}.epyt-gallery{text-align:center}.epyt-gallery iframe{margin-bottom:0}.epyt-gallery-list{margin:0 -8px;position:relative;transition:opacity ease-out .3s}.epyt-gallery-list.epyt-loading{opacity:.5;transition:opacity ease-out .3s}.epyt-gallery-thumb{box-sizing:border-box;overflow-y:hidden;display:block!important;cursor:pointer;opacity:.8;float:left;padding:0 8px 10px}.epyt-gallery-thumb.hover{opacity:1;transition:opacity ease-out .3s}.epyt-gallery-img-box{width:100%}.epyt-gallery-img{height:0;width:100%;padding-top:56.25%;position:relative;overflow:hidden!important;background-size:cover!important;background-position:center!important}.epyt-gallery-playhover{opacity:0;position:absolute;top:-10px;left:0;width:100%;height:100%;vertical-align:middle;text-align:center;transition:opacity ease-out .3s}.epyt-gallery-thumb.hover .epyt-gallery-playhover{opacity:1;top:0;transition:all ease-out .3s}.epyt-gallery-thumb .epyt-gallery-playcrutch{display:inline-block;height:100%;vertical-align:middle;width:0}.epyt-gallery-playhover .epyt-play-img{height:auto!important;max-width:15%!important;padding:0!important;margin:0!important;min-width:30px!important;vertical-align:middle!important;display:inline-block!important}.epyt-gallery-title{font-size:80%;line-height:120%;padding:10px}.epyt-gallery-notitle{padding:4px}.epyt-gallery-list.epyt-gallery-style-listview{margin-left:0;margin-right:0;margin-bottom:25px}.epyt-gallery-thumb.epyt-listview{width:100%!important;padding:0;margin:8px 0}.epyt-gallery-thumb.epyt-listview+.epyt-gallery-rowbreak{display:none}.epyt-gallery-thumb.epyt-listview .epyt-gallery-img-box{float:left;width:150px;max-width:25%;margin-right:20px}.epyt-gallery-thumb.epyt-listview .epyt-gallery-title{padding:10px;text-align:left}.epyt-gallery-thumb.epyt-listview.hover{background-color:#ddd;color:#000;transition:background-color ease-out .3s,color ease-out .3s}.epyt-pagination{clear:both;text-align:center;padding:10px 8px}.epyt-pagenumbers>div,.epyt-pagination>div{display:inline-block;padding:0 2px;vertical-align:middle}.epyt-pagination .epyt-pagebutton{cursor:pointer;display:inline-block;padding:0 10px}.epyt-pagebutton>div{display:inline}.epyt-pagination .epyt-loader{display:none}.epyt-gallery-list.epyt-loading .epyt-pagination .epyt-loader{display:inline-block}.epyt-gallery-list.epyt-gallery-style-carousel{margin-bottom:50px}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-pagination{display:none}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-pagination:first-child{position:absolute;left:-8px;width:100%;display:block;margin:auto;top:0;bottom:0;padding-top:0;padding-bottom:0;height:30px}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-gallery-allthumbs{margin:15px 35px}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-gallery-thumb{padding-bottom:0}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-pagebutton>div{display:none}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-pagebutton>div.arrow{background:url(../images/arrow-right.svg) no-repeat;background-size:contain;width:20px;height:100%;display:block;text-indent:-99999px;opacity:.7}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-pagebutton>div.arrow:hover{opacity:1}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-pagebutton.epyt-prev>div.arrow{background-image:url(../images/arrow-left.svg)}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-next{float:right}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-prev{float:left}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-pagenumbers{position:absolute;top:100%;left:0;right:0}
1
+ .epyt-gallery-clear,.epyt-gallery-rowbreak{clear:both}.epyt-debug{cursor:pointer;text-align:left;background-color:#ddd;color:#000}.epyt-gallery{text-align:center}.epyt-gallery iframe{margin-bottom:0}.epyt-gallery-list{margin:0 -8px;position:relative;transition:opacity ease-out .3s}.epyt-gallery-list.epyt-loading{opacity:.5;transition:opacity ease-out .3s}.epyt-gallery-thumb{box-sizing:border-box;overflow-y:hidden;display:block!important;cursor:pointer;opacity:.8;float:left;padding:0 8px 10px}.epyt-gallery-thumb.hover{opacity:1;transition:opacity ease-out .3s}.epyt-gallery-img-box{width:100%}.epyt-gallery-img{height:0;width:100%;padding-top:56.25%;position:relative;overflow:hidden!important;background-size:cover!important;background-position:center!important}.epyt-gallery-playhover{opacity:0;position:absolute;top:-10px;left:0;width:100%;height:100%;vertical-align:middle;text-align:center;transition:opacity ease-out .3s}.epyt-gallery-thumb.hover .epyt-gallery-playhover{opacity:1;top:0;transition:all ease-out .3s}.epyt-gallery-thumb .epyt-gallery-playcrutch{display:inline-block;height:100%;vertical-align:middle;width:0}.epyt-gallery-playhover .epyt-play-img{height:auto!important;max-width:15%!important;padding:0!important;margin:0!important;min-width:30px!important;vertical-align:middle!important;display:inline-block!important}.epyt-gallery-title{font-size:80%;line-height:120%;padding:10px}.epyt-gallery-notitle{padding:4px}.epyt-gallery-list.epyt-gallery-style-listview{margin-left:0;margin-right:0;margin-bottom:25px}.epyt-gallery-thumb.epyt-listview{width:100%!important;padding:0;margin:8px 0}.epyt-gallery-thumb.epyt-listview+.epyt-gallery-rowbreak{display:none}.epyt-gallery-thumb.epyt-listview .epyt-gallery-img-box{float:left;width:150px;max-width:25%;margin-right:20px}.epyt-gallery-thumb.epyt-listview .epyt-gallery-title{padding:10px;text-align:left}.epyt-gallery-thumb.epyt-listview.hover{background-color:#ddd;color:#000;transition:background-color ease-out .3s,color ease-out .3s}.epyt-pagination{clear:both;text-align:center;padding:10px 8px}.epyt-pagenumbers>div,.epyt-pagination>div{display:inline-block;padding:0 2px;vertical-align:middle}.epyt-pagination .epyt-pagebutton{cursor:pointer;display:inline-block;padding:0 10px}.epyt-pagebutton>div{display:inline}.epyt-pagination .epyt-loader{display:none}.epyt-gallery-list.epyt-loading .epyt-pagination .epyt-loader{display:inline-block}.epyt-gallery-list.epyt-gallery-style-carousel{margin-bottom:50px}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-pagination{display:none}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-pagination:first-child{position:absolute;width:100%;display:block;margin:auto;top:0;bottom:0;padding-top:0;padding-bottom:0;height:30px}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-gallery-allthumbs{margin:15px 35px}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-gallery-thumb{padding-bottom:0}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-pagebutton>div{display:none}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-pagebutton>div.arrow{background:url(../images/arrow-right.svg) no-repeat;background-size:contain;width:20px;height:100%;display:block;text-indent:-99999px;opacity:.7}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-pagebutton>div.arrow:hover{opacity:1}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-pagebutton.epyt-prev>div.arrow{background-image:url(../images/arrow-left.svg)}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-next{float:right}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-prev{float:left}.epyt-gallery-list.epyt-gallery-style-carousel .epyt-pagenumbers{position:absolute;top:100%;left:0;right:0}
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. Embed a responsive YouTube video, playlist gallery, or channel gallery. Add video thumbnails, analytics, SEO, caching...
6
- Version: 10.6
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 = '10.6';
36
  public static $opt_version = 'version';
37
  public static $optembedwidth = null;
38
  public static $optembedheight = null;
@@ -43,6 +43,7 @@ class YouTubePrefs
43
  public static $opt_glance = 'glance';
44
  public static $opt_autoplay = 'autoplay';
45
  public static $opt_debugmode = 'debugmode';
 
46
  public static $opt_cc_load_policy = 'cc_load_policy';
47
  public static $opt_iv_load_policy = 'iv_load_policy';
48
  public static $opt_loop = 'loop';
@@ -163,18 +164,19 @@ class YouTubePrefs
163
  add_action('media_buttons', 'YouTubePrefs::media_button_wizard', 11);
164
 
165
 
166
-
167
- //$embedplusmce_wiz = new Add_new_tinymce_btn_Youtubeprefs('|', 'embedplus_youtubeprefs_wiz', plugins_url() . '/youtube-embed-plus/scripts/embedplus_mce_wiz.js');
168
- //$embedplusmce_prefs = new Add_new_tinymce_btn_Youtubeprefs('|', 'embedplus_youtubeprefs', plugins_url() . '/youtube-embed-plus/scripts/embedplus_mce_prefs.js');
169
- //$epstatsmce_youtubeprefs = new Add_new_tinymce_btn_Youtubeprefs('|', 'embedplusstats_youtubeprefs', plugins_url() . '/youtube-embed-plus/scripts/embedplusstats_mce.js');
170
-
171
  self::do_ytprefs();
172
  add_action('admin_menu', 'YouTubePrefs::ytprefs_plugin_menu');
173
  if (!is_admin())
174
  {
 
 
 
 
 
175
 
176
- //add_action('wp_enqueue_scripts', array('YouTubePrefs', 'jsinitvars'));
177
  add_action('wp_enqueue_scripts', array('YouTubePrefs', 'fitvids'));
 
178
  if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && self::$alloptions[self::$opt_ogvideo] == 1)
179
  {
180
  add_action('wp_head', array('YouTubePrefs', 'do_ogvideo'));
@@ -608,7 +610,24 @@ class YouTubePrefs
608
  die();
609
  }
610
 
611
- public static function jsinitvars()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
612
  {
613
 
614
  //https://support.cloudflare.com/hc/en-us/articles/200169436-How-can-I-have-Rocket-Loader-ignore-my-script-s-in-Automatic-Mode-
@@ -687,6 +706,7 @@ class YouTubePrefs
687
  $_gallery_pagesize = 15;
688
  $_gallery_style = 'grid';
689
  $_debugmode = 0;
 
690
 
691
  $arroptions = get_option(self::$opt_alloptions);
692
 
@@ -697,6 +717,7 @@ class YouTubePrefs
697
  $_glance = self::tryget($arroptions, self::$opt_glance, 1);
698
  $_autoplay = self::tryget($arroptions, self::$opt_autoplay, 0);
699
  $_debugmode = self::tryget($arroptions, self::$opt_debugmode, 0);
 
700
  $_cc_load_policy = self::tryget($arroptions, self::$opt_cc_load_policy, 0);
701
  $_iv_load_policy = self::tryget($arroptions, self::$opt_iv_load_policy, 1);
702
  $_loop = self::tryget($arroptions, self::$opt_loop, 0);
@@ -798,7 +819,8 @@ class YouTubePrefs
798
  self::$opt_gallery_showtitle => $_gallery_showtitle,
799
  self::$opt_gallery_style => $_gallery_style,
800
  self::$opt_gallery_pagesize => $_gallery_pagesize,
801
- self::$opt_debugmode => $_debugmode
 
802
  );
803
 
804
  update_option(self::$opt_alloptions, $all);
@@ -851,7 +873,7 @@ class YouTubePrefs
851
  {
852
  if (strpos($exclude, 'ytprefs.min.js') === false)
853
  {
854
- return $exclude . ",ytprefs.min.js";
855
  }
856
  return $exclude;
857
  }
@@ -941,14 +963,14 @@ class YouTubePrefs
941
  $code = '';
942
 
943
  $apiResult = wp_remote_get($apiEndpoint);
944
- $jsonResult = json_decode($apiResult['body']);
945
-
946
  if (self::$alloptions[self::$opt_debugmode] == 1 && current_user_can('manage_options'))
947
  {
948
  $redactedEndpoint = preg_replace('@&key=[^&]+@i', '&key=PRIVATE', $apiEndpoint);
949
  return '<pre onclick="_EPADashboard_.selectText(this);" class="epyt-debug">CLICK this debug text to auto-select all. Then, COPY the selection.' . "\n\n" . $redactedEndpoint . "\n\n" . print_r($apiResult, true) . '</pre>';
950
  }
951
 
 
 
952
  if (isset($jsonResult->error))
953
  {
954
  if (isset($jsonResult->error->message))
@@ -1115,7 +1137,6 @@ class YouTubePrefs
1115
  if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
1116
  {
1117
  check_ajax_referer('embedplus-nonce', 'security');
1118
- //echo self::get_gallery_page($_POST['playlistId'], $_POST['pageToken'], $_POST['pageSize'], $_POST['columns'], $_POST['style'], self::$alloptions[self::$opt_apikey]);
1119
  $options = (object) $_POST['options'];
1120
  $options->apiKey = self::$alloptions[self::$opt_apikey];
1121
  echo self::get_gallery_page($options);
@@ -1312,7 +1333,6 @@ class YouTubePrefs
1312
  $galleryWrapper1 = '<div class="epyt-gallery" data-currpage="1">';
1313
  $galleryWrapper2 = '</div>';
1314
  $galleryCode = '<div class="epyt-gallery-list epyt-gallery-style-' . esc_attr($gallery_options->style) . '">' .
1315
- //self::get_gallery_page($finalparams['list'], null, $finalparams[self::$opt_gallery_pagesize], intval($finalparams[self::$opt_gallery_columns]), $finalparams[self::$opt_gallery_style], self::$alloptions[self::$opt_apikey]) .
1316
  self::get_gallery_page($gallery_options) .
1317
  '</div>';
1318
  $videoidoutput = 'GALLERYVIDEOID';
@@ -1393,13 +1413,15 @@ class YouTubePrefs
1393
 
1394
  public static function spdcpurge()
1395
  {
1396
- $allk = get_option(self::$spdcall, array()); {
 
 
1397
  foreach ($allk as $t)
1398
  {
1399
  $success = delete_transient($t);
1400
  }
1401
- update_option(self::$spdcall, array());
1402
  }
 
1403
  }
1404
 
1405
  public static function keyvalue($qry, $includev)
@@ -1821,7 +1843,7 @@ class YouTubePrefs
1821
  echo "<h2>" . '<img style="vertical-align: text-bottom;" src="' . plugins_url('images/iconwizard.png', __FILE__) . '" /> ' . __('YouTube Plugin PRO') . "</h2><p class='bold orange'>This tab is here to provide direct access to analytics. Graphs and other data about your site will show below after you activate PRO.</p><br>";
1822
  }
1823
  ?>
1824
- <iframe class="shadow" src="<?php echo $dashurl ?>" width="1060" height="2700" scrolling="auto"/>
1825
  </div>
1826
  <?php
1827
  }
@@ -2047,6 +2069,7 @@ class YouTubePrefs
2047
  $new_options[self::$opt_glance] = self::postchecked(self::$opt_glance) ? 1 : 0;
2048
  $new_options[self::$opt_autoplay] = self::postchecked(self::$opt_autoplay) ? 1 : 0;
2049
  $new_options[self::$opt_debugmode] = self::postchecked(self::$opt_debugmode) ? 1 : 0;
 
2050
  $new_options[self::$opt_cc_load_policy] = self::postchecked(self::$opt_cc_load_policy) ? 1 : 0;
2051
  $new_options[self::$opt_iv_load_policy] = self::postchecked(self::$opt_iv_load_policy) ? 1 : 3;
2052
  $new_options[self::$opt_loop] = self::postchecked(self::$opt_loop) ? 1 : 0;
@@ -2160,18 +2183,25 @@ class YouTubePrefs
2160
  $new_options[self::$opt_gallery_style] = $_gallery_style;
2161
 
2162
 
2163
- $_apikey = '';
2164
  try
2165
  {
2166
- $_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_apikey])));
2167
- if (empty($_apikey))
 
 
 
2168
  {
2169
- $_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_gallery_apikey])));
 
 
 
 
2170
  }
2171
  }
2172
  catch (Exception $ex)
2173
  {
2174
- $_apikey = '';
2175
  }
2176
  $new_options[self::$opt_apikey] = $_apikey;
2177
 
@@ -2268,7 +2298,7 @@ class YouTubePrefs
2268
  ul.reglist li {margin: 0px 0px 0px 30px; list-style: disc outside none;}
2269
  .procol {width: 475px; float: left;}
2270
  .ytindent .procol ul {font-size: 11px;}
2271
- .smallnote {font-style: italic; font-size: 10px;}
2272
  .italic {font-style: italic;}
2273
  .ytindent h3 {font-size: 15px; line-height: 22px; margin: 5px 0px 10px 0px;}
2274
  #wizleftlink {float: left; display: block; width: 240px; font-style: italic; text-align: center; text-decoration: none;}
@@ -2573,6 +2603,14 @@ class YouTubePrefs
2573
 
2574
  </div>
2575
  </p>
 
 
 
 
 
 
 
 
2576
  <p>
2577
  <input name="<?php echo self::$opt_debugmode; ?>" id="<?php echo self::$opt_debugmode; ?>" <?php checked($all[self::$opt_debugmode], 1); ?> type="checkbox" class="checkbox">
2578
  <label for="<?php echo self::$opt_debugmode; ?>">
@@ -2598,7 +2636,7 @@ class YouTubePrefs
2598
  <code style="font-size: .9em;">http://www.youtube.com/watch?listType=playlist&width=474&height=266&list=UUAuUUnT6oDeKwE6v1NGQxug&plindex=0<b>&layout=gallery</b></code>
2599
  </p>
2600
  <p class="smallnote">
2601
- The PRO wizard steps for playlist and channels can also fully to build codes like the above.
2602
  </p>
2603
  <p>
2604
  Below are the settings for galleries:
@@ -3389,31 +3427,27 @@ class YouTubePrefs
3389
  $colwidth = 100.0 / $cols;
3390
  $custom_css = "
3391
  .epyt-gallery-thumb {
3392
- width: {$colwidth}%;
3393
  }";
3394
  wp_add_inline_style('__EPYT__style', $custom_css);
3395
 
 
3396
 
3397
- $responsiveselector = '[]';
3398
- if (self::$alloptions[self::$opt_widgetfit] == 1)
3399
  {
3400
- $responsiveselector = '["iframe.__youtube_prefs_widget__"]';
3401
- }
3402
- if (self::$alloptions[self::$opt_responsive] == 1)
3403
- {
3404
- $responsiveselector = '["iframe[src*=\'youtube.com\']","iframe[src*=\'youtube-nocookie.com\']","iframe[data-ep-src*=\'youtube.com\']","iframe[data-ep-src*=\'youtube-nocookie.com\']","iframe[data-ep-gallerysrc*=\'youtube.com\']"]';
 
 
 
 
3405
  }
3406
 
3407
- wp_enqueue_script('__ytprefs__', plugins_url('scripts/ytprefs.min.js', __FILE__), array('jquery'));
3408
- wp_localize_script('__ytprefs__', '_EPYT_', array(
3409
- 'ajaxurl' => admin_url('admin-ajax.php'),
3410
- 'security' => wp_create_nonce('embedplus-nonce'),
3411
- 'gallery_scrolloffset' => intval(self::$alloptions[self::$opt_gallery_scrolloffset]),
3412
- 'eppathtoscripts' => plugins_url('scripts/', __FILE__),
3413
- 'epresponsiveselector' => $responsiveselector,
3414
- 'epdovol' => true
3415
- ));
3416
-
3417
 
3418
  if (!is_admin() && (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0) && self::$alloptions[self::$opt_dynload] == 1)
3419
  {
@@ -3422,6 +3456,29 @@ class YouTubePrefs
3422
  }
3423
  }
3424
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3425
  public static function get_blogwidth()
3426
  {
3427
  $blogwidth = null;
@@ -3529,7 +3586,6 @@ class YouTubePrefs
3529
  $youtubeplgplus = new YouTubePrefs();
3530
 
3531
 
3532
- add_action('wp_enqueue_scripts', array('YouTubePrefs', 'ytprefsscript'), 100);
3533
  add_action("wp_ajax_my_embedplus_pro_record", array('YouTubePrefs', 'my_embedplus_pro_record'));
3534
  add_action("wp_ajax_my_embedplus_clearspdc", array('YouTubePrefs', 'my_embedplus_clearspdc'));
3535
  add_action("wp_ajax_my_embedplus_glance_vids", array('YouTubePrefs', 'my_embedplus_glance_vids'));
@@ -3651,6 +3707,7 @@ class YouTubePrefs
3651
 
3652
 
3653
  </script>
3654
- <?php
 
3655
  }
3656
- }
3
  Plugin Name: YouTube
4
  Plugin URI: http://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx
5
  Description: YouTube embed plugin. Embed a responsive YouTube video, playlist gallery, or channel gallery. Add video thumbnails, analytics, SEO, caching...
6
+ Version: 10.7
7
  Author: EmbedPlus Team
8
  Author URI: http://www.embedplus.com
9
  */
32
  class YouTubePrefs
33
  {
34
 
35
+ public static $version = '10.7';
36
  public static $opt_version = 'version';
37
  public static $optembedwidth = null;
38
  public static $optembedheight = null;
43
  public static $opt_glance = 'glance';
44
  public static $opt_autoplay = 'autoplay';
45
  public static $opt_debugmode = 'debugmode';
46
+ public static $opt_old_script_method = 'old_script_method';
47
  public static $opt_cc_load_policy = 'cc_load_policy';
48
  public static $opt_iv_load_policy = 'iv_load_policy';
49
  public static $opt_loop = 'loop';
164
  add_action('media_buttons', 'YouTubePrefs::media_button_wizard', 11);
165
 
166
 
 
 
 
 
 
167
  self::do_ytprefs();
168
  add_action('admin_menu', 'YouTubePrefs::ytprefs_plugin_menu');
169
  if (!is_admin())
170
  {
171
+ if (self::$alloptions[self::$opt_old_script_method] == 1)
172
+ {
173
+ add_action('wp_print_scripts', array('YouTubePrefs', 'jsvars'));
174
+ add_action('wp_enqueue_scripts', array('YouTubePrefs', 'jsvars'));
175
+ }
176
 
177
+ add_action('wp_enqueue_scripts', array('YouTubePrefs', 'ytprefsscript'), 100);
178
  add_action('wp_enqueue_scripts', array('YouTubePrefs', 'fitvids'));
179
+
180
  if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && self::$alloptions[self::$opt_ogvideo] == 1)
181
  {
182
  add_action('wp_head', array('YouTubePrefs', 'do_ogvideo'));
610
  die();
611
  }
612
 
613
+ public static function jsvars()
614
+ {
615
+ ?>
616
+ <script data-cfasync="false">
617
+ window._EPYT_ = window._EPYT_ || {
618
+ ajaxurl: "<?php echo admin_url('admin-ajax.php'); ?>",
619
+ security: "<?php echo wp_create_nonce('embedplus-nonce'); ?>",
620
+ gallery_scrolloffset: <?php echo intval(self::$alloptions[self::$opt_gallery_scrolloffset]) ?>,
621
+ eppathtoscripts: "<?php echo plugins_url('scripts/', __FILE__); ?>",
622
+ epresponsiveselector: <?php echo self::get_responsiveselector(); ?>,
623
+ version: "<?php echo self::$alloptions[self::$opt_version] ?>",
624
+ epdovol: true
625
+ };
626
+ </script>
627
+ <?php
628
+ }
629
+
630
+ public static function jsinitvars() // NOT USED
631
  {
632
 
633
  //https://support.cloudflare.com/hc/en-us/articles/200169436-How-can-I-have-Rocket-Loader-ignore-my-script-s-in-Automatic-Mode-
706
  $_gallery_pagesize = 15;
707
  $_gallery_style = 'grid';
708
  $_debugmode = 0;
709
+ $_old_script_method = 0;
710
 
711
  $arroptions = get_option(self::$opt_alloptions);
712
 
717
  $_glance = self::tryget($arroptions, self::$opt_glance, 1);
718
  $_autoplay = self::tryget($arroptions, self::$opt_autoplay, 0);
719
  $_debugmode = self::tryget($arroptions, self::$opt_debugmode, 0);
720
+ $_old_script_method = self::tryget($arroptions, self::$opt_old_script_method, 0);
721
  $_cc_load_policy = self::tryget($arroptions, self::$opt_cc_load_policy, 0);
722
  $_iv_load_policy = self::tryget($arroptions, self::$opt_iv_load_policy, 1);
723
  $_loop = self::tryget($arroptions, self::$opt_loop, 0);
819
  self::$opt_gallery_showtitle => $_gallery_showtitle,
820
  self::$opt_gallery_style => $_gallery_style,
821
  self::$opt_gallery_pagesize => $_gallery_pagesize,
822
+ self::$opt_debugmode => $_debugmode,
823
+ self::$opt_old_script_method => $_old_script_method
824
  );
825
 
826
  update_option(self::$opt_alloptions, $all);
873
  {
874
  if (strpos($exclude, 'ytprefs.min.js') === false)
875
  {
876
+ return $exclude . ",ytprefs.min.js,__ytprefs__";
877
  }
878
  return $exclude;
879
  }
963
  $code = '';
964
 
965
  $apiResult = wp_remote_get($apiEndpoint);
 
 
966
  if (self::$alloptions[self::$opt_debugmode] == 1 && current_user_can('manage_options'))
967
  {
968
  $redactedEndpoint = preg_replace('@&key=[^&]+@i', '&key=PRIVATE', $apiEndpoint);
969
  return '<pre onclick="_EPADashboard_.selectText(this);" class="epyt-debug">CLICK this debug text to auto-select all. Then, COPY the selection.' . "\n\n" . $redactedEndpoint . "\n\n" . print_r($apiResult, true) . '</pre>';
970
  }
971
 
972
+ $jsonResult = json_decode($apiResult['body']);
973
+
974
  if (isset($jsonResult->error))
975
  {
976
  if (isset($jsonResult->error->message))
1137
  if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
1138
  {
1139
  check_ajax_referer('embedplus-nonce', 'security');
 
1140
  $options = (object) $_POST['options'];
1141
  $options->apiKey = self::$alloptions[self::$opt_apikey];
1142
  echo self::get_gallery_page($options);
1333
  $galleryWrapper1 = '<div class="epyt-gallery" data-currpage="1">';
1334
  $galleryWrapper2 = '</div>';
1335
  $galleryCode = '<div class="epyt-gallery-list epyt-gallery-style-' . esc_attr($gallery_options->style) . '">' .
 
1336
  self::get_gallery_page($gallery_options) .
1337
  '</div>';
1338
  $videoidoutput = 'GALLERYVIDEOID';
1413
 
1414
  public static function spdcpurge()
1415
  {
1416
+ $allk = get_option(self::$spdcall, array());
1417
+ if (is_array($allk))
1418
+ {
1419
  foreach ($allk as $t)
1420
  {
1421
  $success = delete_transient($t);
1422
  }
 
1423
  }
1424
+ update_option(self::$spdcall, array());
1425
  }
1426
 
1427
  public static function keyvalue($qry, $includev)
1843
  echo "<h2>" . '<img style="vertical-align: text-bottom;" src="' . plugins_url('images/iconwizard.png', __FILE__) . '" /> ' . __('YouTube Plugin PRO') . "</h2><p class='bold orange'>This tab is here to provide direct access to analytics. Graphs and other data about your site will show below after you activate PRO.</p><br>";
1844
  }
1845
  ?>
1846
+ <iframe class="shadow" src="<?php echo $dashurl ?>" width="1060" height="3600" scrolling="auto"/>
1847
  </div>
1848
  <?php
1849
  }
2069
  $new_options[self::$opt_glance] = self::postchecked(self::$opt_glance) ? 1 : 0;
2070
  $new_options[self::$opt_autoplay] = self::postchecked(self::$opt_autoplay) ? 1 : 0;
2071
  $new_options[self::$opt_debugmode] = self::postchecked(self::$opt_debugmode) ? 1 : 0;
2072
+ $new_options[self::$opt_old_script_method] = self::postchecked(self::$opt_old_script_method) ? 1 : 0;
2073
  $new_options[self::$opt_cc_load_policy] = self::postchecked(self::$opt_cc_load_policy) ? 1 : 0;
2074
  $new_options[self::$opt_iv_load_policy] = self::postchecked(self::$opt_iv_load_policy) ? 1 : 3;
2075
  $new_options[self::$opt_loop] = self::postchecked(self::$opt_loop) ? 1 : 0;
2183
  $new_options[self::$opt_gallery_style] = $_gallery_style;
2184
 
2185
 
2186
+ $_apikey = $all[self::$opt_apikey];
2187
  try
2188
  {
2189
+ $_curr_apikey = $all[self::$opt_apikey];
2190
+ $_schema_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_apikey])));
2191
+ $_gallery_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_gallery_apikey])));
2192
+
2193
+ if (!empty($_schema_apikey) && $_schema_apikey != $_curr_apikey)
2194
  {
2195
+ $_apikey = $_schema_apikey;
2196
+ }
2197
+ if (!empty($_gallery_apikey) && $_gallery_apikey != $_curr_apikey)
2198
+ {
2199
+ $_apikey = $_gallery_apikey;
2200
  }
2201
  }
2202
  catch (Exception $ex)
2203
  {
2204
+ //$_apikey = '';
2205
  }
2206
  $new_options[self::$opt_apikey] = $_apikey;
2207
 
2298
  ul.reglist li {margin: 0px 0px 0px 30px; list-style: disc outside none;}
2299
  .procol {width: 475px; float: left;}
2300
  .ytindent .procol ul {font-size: 11px;}
2301
+ .smallnote, .ytindent .smallnote {font-style: italic; font-size: 10px;}
2302
  .italic {font-style: italic;}
2303
  .ytindent h3 {font-size: 15px; line-height: 22px; margin: 5px 0px 10px 0px;}
2304
  #wizleftlink {float: left; display: block; width: 240px; font-style: italic; text-align: center; text-decoration: none;}
2603
 
2604
  </div>
2605
  </p>
2606
+ <p>
2607
+ <input name="<?php echo self::$opt_old_script_method; ?>" id="<?php echo self::$opt_old_script_method; ?>" <?php checked($all[self::$opt_old_script_method], 1); ?> type="checkbox" class="checkbox">
2608
+ <label for="<?php echo self::$opt_old_script_method; ?>">
2609
+ <b class="chktitle">Use Legacy Scripts: <sup class="orange bold">NEW</sup></b>
2610
+ This is a legacy option for users with theme issues that require backwards compatibility (v.10.5 or earlier). It may also help with caching plugin or CDN plugin issues.
2611
+ </label>
2612
+ </p>
2613
+
2614
  <p>
2615
  <input name="<?php echo self::$opt_debugmode; ?>" id="<?php echo self::$opt_debugmode; ?>" <?php checked($all[self::$opt_debugmode], 1); ?> type="checkbox" class="checkbox">
2616
  <label for="<?php echo self::$opt_debugmode; ?>">
2636
  <code style="font-size: .9em;">http://www.youtube.com/watch?listType=playlist&width=474&height=266&list=UUAuUUnT6oDeKwE6v1NGQxug&plindex=0<b>&layout=gallery</b></code>
2637
  </p>
2638
  <p class="smallnote">
2639
+ Note: The PRO wizard has steps to fully create playlist, channel, and gallery codes like the above.
2640
  </p>
2641
  <p>
2642
  Below are the settings for galleries:
3427
  $colwidth = 100.0 / $cols;
3428
  $custom_css = "
3429
  .epyt-gallery-thumb {
3430
+ width: " . round($colwidth, 3) . "%;
3431
  }";
3432
  wp_add_inline_style('__EPYT__style', $custom_css);
3433
 
3434
+ wp_enqueue_script('__ytprefs__', plugins_url('scripts/ytprefs.min.js', __FILE__), array('jquery'));
3435
 
3436
+ if (self::$alloptions[self::$opt_old_script_method] != 1)
 
3437
  {
3438
+ wp_localize_script('__ytprefs__', '_EPYT_', array(
3439
+ 'ajaxurl' => admin_url('admin-ajax.php'),
3440
+ 'security' => wp_create_nonce('embedplus-nonce'),
3441
+ 'gallery_scrolloffset' => intval(self::$alloptions[self::$opt_gallery_scrolloffset]),
3442
+ 'eppathtoscripts' => plugins_url('scripts/', __FILE__),
3443
+ 'epresponsiveselector' => self::get_responsiveselector(),
3444
+ 'epdovol' => true,
3445
+ 'version' => self::$alloptions[self::$opt_version]
3446
+ ));
3447
  }
3448
 
3449
+ ////////////////////// cloudflare accomodation
3450
+ //add_filter('script_loader_tag', 'YouTubePrefs::set_cfasync', 10, 3);
 
 
 
 
 
 
 
 
3451
 
3452
  if (!is_admin() && (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0) && self::$alloptions[self::$opt_dynload] == 1)
3453
  {
3456
  }
3457
  }
3458
 
3459
+ public static function set_cfasync($tag, $handle, $src)
3460
+ {
3461
+ if ('__ytprefs__' !== $handle)
3462
+ {
3463
+ return $tag;
3464
+ }
3465
+ return str_replace('<script', '<script data-cfasync="false" ', $tag);
3466
+ }
3467
+
3468
+ public static function get_responsiveselector()
3469
+ {
3470
+ $responsiveselector = '[]';
3471
+ if (self::$alloptions[self::$opt_widgetfit] == 1)
3472
+ {
3473
+ $responsiveselector = '["iframe.__youtube_prefs_widget__"]';
3474
+ }
3475
+ if (self::$alloptions[self::$opt_responsive] == 1)
3476
+ {
3477
+ $responsiveselector = '["iframe[src*=\'youtube.com\']","iframe[src*=\'youtube-nocookie.com\']","iframe[data-ep-src*=\'youtube.com\']","iframe[data-ep-src*=\'youtube-nocookie.com\']","iframe[data-ep-gallerysrc*=\'youtube.com\']"]';
3478
+ }
3479
+ return $responsiveselector;
3480
+ }
3481
+
3482
  public static function get_blogwidth()
3483
  {
3484
  $blogwidth = null;
3586
  $youtubeplgplus = new YouTubePrefs();
3587
 
3588
 
 
3589
  add_action("wp_ajax_my_embedplus_pro_record", array('YouTubePrefs', 'my_embedplus_pro_record'));
3590
  add_action("wp_ajax_my_embedplus_clearspdc", array('YouTubePrefs', 'my_embedplus_clearspdc'));
3591
  add_action("wp_ajax_my_embedplus_glance_vids", array('YouTubePrefs', 'my_embedplus_glance_vids'));
3707
 
3708
 
3709
  </script>
3710
+ <?php
3711
+ }
3712
  }
3713
+