YouTube - Version 10.6

Version Description

Download this release

Release Info

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

Code changes from version 10.5 to 10.6

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.5
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.5 =
151
  Enhanced gallery settings for scrolling, video titles, and thumbnail styling.
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.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
 
148
  == Changelog ==
149
 
150
+ = YouTube Embed 10.6 =
151
+ Enhanced debugging support for galleries.
152
+
153
  = YouTube Embed 10.5 =
154
  Enhanced gallery settings for scrolling, video titles, and thumbnail styling.
155
 
scripts/fitvids.min.js CHANGED
@@ -1,23 +1,8 @@
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
  function epdofitvids(e)
13
  {
14
- "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=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")})})};
15
-
16
  e(document).ready(function(){e("body").fitVidsEP();});
17
  return true;
18
  }
19
- var ephasjq = typeof window.jQuery != "undefined" && epdofitvids(window.jQuery);
20
- if (!ephasjq)
21
- {
22
- document.write("<script src='" + eppathtoscripts + "jqueryfit.min.js'>\x3C/script>");
23
- }
 
 
 
 
 
 
 
 
 
 
 
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){}
 
 
 
 
scripts/ytprefs.min.js CHANGED
@@ -1,10 +1,11 @@
1
- (function(a){document.querySelectorAll||(document.querySelectorAll=function(c){var d=document,b=d.documentElement.firstChild,e=d.createElement("STYLE");b.appendChild(e);d.__qsaels=[];e.styleSheet.cssText=c+"{x:expression(document.__qsaels.push(this))}";a.scrollBy(0,0);return d.__qsaels});"undefined"===typeof a._EPADashboard_&&(a._EPADashboard_={initStarted:!1,checkCount:0,onPlayerReady:function(c){try{if("undefined"!==typeof epdovol&&epdovol){var a=parseInt(c.target.getIframe().getAttribute("data-vol"));
2
- isNaN(a)||(0===a?c.target.mute():(c.target.isMuted()&&c.target.unMute(),c.target.setVolume(a)))}}catch(b){}setTimeout(function(){try{var a=_EPADashboard_.justid(c.target.getVideoUrl());_EPADashboard_.jp("ytid="+a)}catch(d){}},1700)},onPlayerStateChange:function(a){var d=a.target.getIframe();if(a.data===YT.PlayerState.PLAYING&&!0!==a.target.ponce&&-1===d.src.indexOf("autoplay=1")){a.target.ponce=!0;try{var b=_EPADashboard_.justid(a.target.getVideoUrl());_EPADashboard_.jp("ytid="+b+"&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(c){var b=document.createElement("script");b.src="//www.embedplus.com/test-page.aspx?es=w&u="+
4
- encodeURIComponent(a.location.href.split("#")[0])+"&"+c+(-1<navigator.userAgent.toLowerCase().indexOf("chrome")?"&b=c&":"&b=&");var f=document.getElementsByTagName("head")[0].appendChild(b);setTimeout(function(){f.parentNode.removeChild(f)},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)}});if("undefined"===typeof a.YT){var b=document.createElement("script");b.src="//www.youtube.com/iframe_api";
6
- b.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(b)}else YT.loaded&&(_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);
7
- (function(a){a(document).ready(function(){a(".epyt-gallery").each(function(){var b=a(this),c=a(this).find("iframe").first(),d=c.data("ep-gallerysrc"),f=a(this).find(".epyt-gallery-list .epyt-gallery-thumb").first().data("videoid"),d=d.replace("GALLERYVIDEOID",f);c.attr("src",d);var e=b.find(".epyt-gallery-list"),g=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",
8
- b+15+"px")}}catch(c){}};g();a(window).resize(g);b.on("click",".epyt-gallery-list .epyt-gallery-thumb",function(){var b=a(this).data("videoid"),d=c.data("ep-gallerysrc").replace("GALLERYVIDEOID",b),d=0<d.indexOf("autoplay")?d.replace("autoplay=0","autoplay=1"):d+"&autoplay=1";a("html, body").animate({scrollTop:c.offset().top-parseInt(_EPYT_.gallery_scrolloffset)},500,function(){c.attr("src",d)})});b.on("mouseenter",".epyt-gallery-list .epyt-gallery-thumb",function(){a(this).addClass("hover")});b.on("mouseleave",
9
- ".epyt-gallery-list .epyt-gallery-thumb",function(){a(this).removeClass("hover")});b.on("click",".epyt-pagebutton",function(){var c={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(b.data("currpage")+"");b.data("currpage",e+(d?1:-1));
10
- b.find(".epyt-gallery-list").addClass("epyt-loading");a.post(_EPYT_.ajaxurl,c,function(c){b.find(".epyt-gallery-list").html(c);b.find(".epyt-current").each(function(){a(this).text(b.data("currpage"))})}).fail(function(){alert("Sorry, there was an error loading the next page.")}).always(function(){b.find(".epyt-gallery-list").removeClass("epyt-loading");g()})})})})})(jQuery);
 
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);
styles/ytprefs.min.css CHANGED
@@ -1 +1 @@
1
- .epyt-gallery-clear,.epyt-gallery-rowbreak{clear:both}.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;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}
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.5
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.5';
36
  public static $opt_version = 'version';
37
  public static $optembedwidth = null;
38
  public static $optembedheight = null;
@@ -42,6 +42,7 @@ class YouTubePrefs
42
  public static $opt_center = 'centervid';
43
  public static $opt_glance = 'glance';
44
  public static $opt_autoplay = 'autoplay';
 
45
  public static $opt_cc_load_policy = 'cc_load_policy';
46
  public static $opt_iv_load_policy = 'iv_load_policy';
47
  public static $opt_loop = 'loop';
@@ -172,8 +173,7 @@ class YouTubePrefs
172
  if (!is_admin())
173
  {
174
 
175
- add_action('wp_print_scripts', array('YouTubePrefs', 'jsvars'));
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
  {
@@ -608,27 +608,6 @@ class YouTubePrefs
608
  die();
609
  }
610
 
611
- public static function jsvars()
612
- {
613
- //https://support.cloudflare.com/hc/en-us/articles/200169436-How-can-I-have-Rocket-Loader-ignore-my-script-s-in-Automatic-Mode-
614
- $responsiveselector = '[]';
615
- if (self::$alloptions[self::$opt_widgetfit] == 1)
616
- {
617
- $responsiveselector = '["iframe.__youtube_prefs_widget__"]';
618
- }
619
- if (self::$alloptions[self::$opt_responsive] == 1)
620
- {
621
- $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\']"]';
622
- }
623
- ?>
624
- <script data-cfasync="false">
625
- var eppathtoscripts = "<?php echo plugins_url('scripts/', __FILE__); ?>";
626
- var epresponsiveselector = <?php echo $responsiveselector; ?>;
627
- var epdovol = true; //<?php echo (self::$alloptions[self::$opt_defaultvol] == 1 ? 'true' : 'false') ?>;
628
- </script>
629
- <?php
630
- }
631
-
632
  public static function jsinitvars()
633
  {
634
 
@@ -640,7 +619,7 @@ class YouTubePrefs
640
  }
641
  if (self::$alloptions[self::$opt_responsive] == 1)
642
  {
643
- $responsiveselector = '["iframe[src*=\'youtube.com\']","iframe[src*=\'youtube-nocookie.com\']","iframe[data-ep-src*=\'youtube.com\']","iframe[data-ep-src*=\'youtube-nocookie.com\']"]';
644
  }
645
  ?>
646
  <script data-cfasync="false">
@@ -707,6 +686,7 @@ class YouTubePrefs
707
  $_gallery_showtitle = 1;
708
  $_gallery_pagesize = 15;
709
  $_gallery_style = 'grid';
 
710
 
711
  $arroptions = get_option(self::$opt_alloptions);
712
 
@@ -716,6 +696,7 @@ class YouTubePrefs
716
  $_center = self::tryget($arroptions, self::$opt_center, 0);
717
  $_glance = self::tryget($arroptions, self::$opt_glance, 1);
718
  $_autoplay = self::tryget($arroptions, self::$opt_autoplay, 0);
 
719
  $_cc_load_policy = self::tryget($arroptions, self::$opt_cc_load_policy, 0);
720
  $_iv_load_policy = self::tryget($arroptions, self::$opt_iv_load_policy, 1);
721
  $_loop = self::tryget($arroptions, self::$opt_loop, 0);
@@ -816,7 +797,8 @@ class YouTubePrefs
816
  self::$opt_gallery_scrolloffset => $_gallery_scrolloffset,
817
  self::$opt_gallery_showtitle => $_gallery_showtitle,
818
  self::$opt_gallery_style => $_gallery_style,
819
- self::$opt_gallery_pagesize => $_gallery_pagesize
 
820
  );
821
 
822
  update_option(self::$opt_alloptions, $all);
@@ -921,12 +903,8 @@ class YouTubePrefs
921
  //public static function get_gallery_page($playlistId, $pageToken, $pageSize, $columns, $style, $apiKey)
922
  public static function get_gallery_page($options)
923
  {
924
- // $playlistId = $options->playlistId;
925
- // $pageToken = $options->pageToken;
926
- $options->pageSize = intval($options->pageSize);
927
  $options->columns = intval($options->columns);
928
- // $style = $options->style;
929
- // $apiKey = $options->apiKey;
930
  $options->showTitle = intval($options->showTitle);
931
 
932
  if (empty($options->apiKey))
@@ -965,14 +943,24 @@ class YouTubePrefs
965
  $apiResult = wp_remote_get($apiEndpoint);
966
  $jsonResult = json_decode($apiResult['body']);
967
 
 
 
 
 
 
 
968
  if (isset($jsonResult->error))
969
  {
 
 
 
 
970
  return '<div>Sorry, there may be an issue with your YouTube API key. Please enter a valid key to embed galleries.</div>';
971
  }
972
 
973
 
974
 
975
- $resultsPerPage = $jsonResult->pageInfo->resultsPerPage;
976
  $totalResults = $jsonResult->pageInfo->totalResults;
977
 
978
  $nextPageToken = '';
@@ -989,46 +977,50 @@ class YouTubePrefs
989
 
990
  $cnt = 0;
991
  $code.= '<div class="epyt-gallery-allthumbs">';
992
- foreach ($jsonResult->items as $item)
993
  {
994
 
995
- $thumb = new stdClass();
 
996
 
997
- $thumb->id = isset($item->snippet->resourceId->videoId) ? $item->snippet->resourceId->videoId : null;
998
- $thumb->id = $thumb->id ? $thumb->id : $item->id->videoId;
999
- $thumb->title = $options->showTitle ? $item->snippet->title : '';
1000
- $thumb->privacyStatus = isset($item->status->privacyStatus) ? $item->status->privacyStatus : null;
1001
 
1002
- if ($thumb->privacyStatus == 'private')
1003
- {
1004
- $thumb->img = plugins_url('/images/private.png', __FILE__);
1005
- $thumb->quality = 'medium';
1006
- }
1007
- else
1008
- {
1009
- if (isset($item->snippet->thumbnails->high->url))
1010
- {
1011
- $thumb->img = $item->snippet->thumbnails->high->url;
1012
- $thumb->quality = 'high';
1013
- }
1014
- elseif (isset($item->snippet->thumbnails->default->url))
1015
  {
1016
- $thumb->img = $item->snippet->thumbnails->default->url;
1017
- $thumb->quality = 'default';
1018
  }
1019
  else
1020
  {
1021
- $thumb->img = $item->snippet->thumbnails->medium->url;
1022
- $thumb->quality = 'medium';
 
 
 
 
 
 
 
 
 
 
 
 
 
1023
  }
1024
- }
1025
 
1026
- $code .= self::get_thumbnail_html($thumb, $options);
1027
- $cnt++;
1028
 
1029
- if ($cnt % $options->columns === 0 && $options->style !== 'carousel')
1030
- {
1031
- $code .= '<div class="epyt-gallery-rowbreak"></div>';
 
1032
  }
1033
  }
1034
  $code .= '<div class="epyt-gallery-clear"></div></div>';
@@ -1401,8 +1393,7 @@ class YouTubePrefs
1401
 
1402
  public static function spdcpurge()
1403
  {
1404
- $allk = get_option(self::$spdcall, array());
1405
- {
1406
  foreach ($allk as $t)
1407
  {
1408
  $success = delete_transient($t);
@@ -1999,11 +1990,11 @@ class YouTubePrefs
1999
  $new_pointer_content .= '<p>'; // ooopointer
2000
  if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
2001
  {
2002
- $new_pointer_content .= __("This update improves existing video gallery support for Free and Pro users with <a target=_blank href=" . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer' . ">additional Pro benefits &raquo;</a>");
2003
  }
2004
  else
2005
  {
2006
- $new_pointer_content .= __("This update improves existing video gallery support for Free and Pro users with additional Pro benefits.");
2007
  }
2008
  $new_pointer_content .= '</p>';
2009
 
@@ -2055,6 +2046,7 @@ class YouTubePrefs
2055
  $new_options[self::$opt_center] = self::postchecked(self::$opt_center) ? 1 : 0;
2056
  $new_options[self::$opt_glance] = self::postchecked(self::$opt_glance) ? 1 : 0;
2057
  $new_options[self::$opt_autoplay] = self::postchecked(self::$opt_autoplay) ? 1 : 0;
 
2058
  $new_options[self::$opt_cc_load_policy] = self::postchecked(self::$opt_cc_load_policy) ? 1 : 0;
2059
  $new_options[self::$opt_iv_load_policy] = self::postchecked(self::$opt_iv_load_policy) ? 1 : 3;
2060
  $new_options[self::$opt_loop] = self::postchecked(self::$opt_loop) ? 1 : 0;
@@ -2358,7 +2350,7 @@ class YouTubePrefs
2358
  <input type="hidden" name="<?php echo $ytprefs_submitted; ?>" value="Y">
2359
 
2360
  <h3 class="sect">
2361
- <?php _e("How to Insert a YouTube Video or Playlist") ?> <!--<span class="pronon">(For Free and <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank">PRO Users &raquo;</a>)</span>-->
2362
  </h3>
2363
  <p>
2364
  <b>For videos:</b> <i>Method 1 - </i> Do you already have a URL to the video you want to embed in a post, page, or even a widget? All you have to do is paste it on its own line, as shown below (including the http:// part). Easy, eh?<br>
@@ -2408,10 +2400,10 @@ class YouTubePrefs
2408
  </p>
2409
  <div class="jumper" id="jumpdefaults"></div>
2410
  <h3 class="sect">
2411
- <?php _e("Default YouTube Options") ?> <a href="#top" class="totop">&#9650; top</a>
2412
  </h3>
2413
  <p>
2414
- <?php _e("One of the benefits of using this plugin is that you can set site-wide default options for all your videos (click \"Save Changes\" when finished). However, you can also override them (and more) on a per-video basis. Directions on how to do that are in the next section.") ?>
2415
  </p>
2416
  <p class="submit">
2417
  <input type="submit" onclick="return savevalidate();" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
@@ -2453,7 +2445,7 @@ class YouTubePrefs
2453
  </p>
2454
  <p>
2455
  <input name="<?php echo self::$opt_acctitle; ?>" id="<?php echo self::$opt_acctitle; ?>" <?php checked($all[self::$opt_acctitle], 1); ?> type="checkbox" class="checkbox">
2456
- <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>
2457
  </p>
2458
  <p>
2459
  <input name="<?php echo self::$opt_theme; ?>" id="<?php echo self::$opt_theme; ?>" <?php checked($all[self::$opt_theme], 'dark'); ?> type="checkbox" class="checkbox">
@@ -2581,6 +2573,14 @@ class YouTubePrefs
2581
 
2582
  </div>
2583
  </p>
 
 
 
 
 
 
 
 
2584
  </div>
2585
  <div class="jumper" id="jumpgallery"></div>
2586
  <h3 class="sect">Gallery Settings and Directions<sup class="orange bold">NEW</sup></h3>
@@ -2611,8 +2611,18 @@ class YouTubePrefs
2611
  </p>
2612
  <p>
2613
  <label for="<?php echo self::$opt_gallery_pagesize; ?>"><b class="chktitle">Gallery Page Size:</b></label>
2614
- <input name="<?php echo self::$opt_gallery_pagesize; ?>" id="<?php echo self::$opt_gallery_pagesize; ?>" type="number" class="textinput" style="width: 60px;" value="<?php echo trim($all[self::$opt_gallery_pagesize]); ?>">
2615
- Enter how many thumbnails per page should be shown at once.
 
 
 
 
 
 
 
 
 
 
2616
  </p>
2617
  <p>
2618
  <label for="<?php echo self::$opt_gallery_columns; ?>"><b class="chktitle">Number of Columns:</b></label>
@@ -2647,7 +2657,7 @@ class YouTubePrefs
2647
  <p class="smallnote orange">Below are PRO features for enhanced SEO and performance (works for even past embed links). Gallery options for PRO users will also be listed here.</p>
2648
  <p>
2649
  <img class="ssaltgallery" src="<?php echo plugins_url('images/ssaltgalleryall.jpg', __FILE__) ?>" />
2650
- <?php $cleanstyle = trim($all[self::$opt_gallery_style]); ?>
2651
  <select name="<?php echo self::$opt_gallery_style; ?>" id="<?php echo self::$opt_gallery_style; ?>" >
2652
  <option value="">Gallery Style</option>
2653
  <option value="grid" <?php echo 'grid' === $cleanstyle ? 'selected' : '' ?> >Grid (default)</option>
@@ -2664,13 +2674,13 @@ class YouTubePrefs
2664
  <p>
2665
  <input name="<?php echo self::$opt_spdc; ?>" id="<?php echo self::$opt_spdc; ?>" <?php checked($all[self::$opt_spdc], 1); ?> type="checkbox" class="checkbox">
2666
  <label for="<?php echo self::$opt_spdc; ?>">
2667
- <b>(PRO)</b> <b class="chktitle">Faster Page Loads (Caching): <sup class="orange">NEW</sup></b>
2668
  Use embed caching to speed up your page loads. By default, WordPress needs to request information from YouTube.com's servers for every video you embed, every time a page is loaded. These data requests can add time to your total page load time. Turn on this feature to cache that data (instead of having to request for the same information every time you load a page). This should then make your pages that have videos load faster. It's been noted that even small speed ups in page load can help increase visitor engagement, retention, and conversions. Caching also makes galleries run faster.
2669
  </label>
2670
  <div class="indent-option">
2671
  <div id="boxspdc">
2672
  <label>
2673
- <b class="chktitle">Cache Liftime (hours): <sup class="orange">NEW</sup></b>
2674
  <input name="<?php echo self::$opt_spdcexp; ?>" id="<?php echo self::$opt_spdcexp; ?>" value="<?php echo trim($all[self::$opt_spdcexp]); ?>" type="number" min="1"/>
2675
  </label>
2676
  Tip: If your pages rarely change, you may wish to set this to a much higher value than 24 hours.
@@ -2711,7 +2721,7 @@ class YouTubePrefs
2711
  <input name="<?php echo self::$opt_dynload; ?>" id="<?php echo self::$opt_dynload; ?>" <?php checked($all[self::$opt_dynload], 1); ?> type="checkbox" class="checkbox">
2712
  <span id="boxdyn">
2713
  Animation:
2714
- <?php $cleandyn = trim($all[self::$opt_dyntype]); ?>
2715
  <select name="<?php echo self::$opt_dyntype; ?>" id="<?php echo self::$opt_dyntype; ?>" >
2716
  <option value="">Select type</option>
2717
  <option value="rotateIn" <?php echo 'rotateIn' === $cleandyn ? 'selected' : '' ?> >rotate in</option>
@@ -2746,7 +2756,7 @@ class YouTubePrefs
2746
  <img class="ssfb" src="<?php echo plugins_url('images/youtube_thumbnail_sample.jpg', __FILE__) ?>" />
2747
  <input name="<?php echo self::$opt_ftpostimg; ?>" id="<?php echo self::$opt_ftpostimg; ?>" <?php checked($all[self::$opt_ftpostimg], 1); ?> type="checkbox" class="checkbox">
2748
  <label for="<?php echo self::$opt_ftpostimg; ?>">
2749
- <b>(PRO)</b> <b class="chktitle">Automatic Video Thumbnails: <sup class="orange">NEW</sup></b>
2750
  Automatically grab the thumbnail image of the first video embedded in each post or page, and use it as the featured image. If your theme can display featured images of posts on your blog home, you’ll see the thumbnails there as shown in the picture on the right. All you have to do is click Update on a post or page and the plugin does the rest!
2751
  (Example shown on the right) <a target="_blank" href="<?php echo self::$epbase ?>/add-youtube-video-thumbnails-featured-image-wordpress.aspx">Watch example here &raquo;</a>
2752
  </label>
@@ -2774,12 +2784,12 @@ class YouTubePrefs
2774
  <p>
2775
  <input disabled type="checkbox" class="checkbox">
2776
  <label>
2777
- <b class="chktitle">Faster Page Loads (Caching): <sup class="orange">NEW</sup></b> <span class="pronon">(PRO Users)</span>
2778
  Use embed caching to speed up your page loads. By default, WordPress needs to request information from YouTube.com's servers for every video you embed, every time a page is loaded. These data requests can add time to your total page load time. Turn on this feature to cache that data (instead of having to request for the same information every time you load a page). This should then make your pages that have videos load faster. It's been noted that even small speed ups in page load can help increase visitor engagement, retention, and conversions. Caching also makes galleries run faster.
2779
  </label>
2780
  <div class="indent-option">
2781
  <label>
2782
- <b class="chktitle">Cache Liftime (hours): <sup class="orange">NEW</sup></b>
2783
  <input disabled value="24" type="number">
2784
  Tip: If your pages rarely change, you may wish to set this to a much higher value than 24 hours.
2785
  </label>
@@ -2842,7 +2852,7 @@ class YouTubePrefs
2842
  <div class="jumper" id="jumpoverride"></div>
2843
 
2844
  <h3 class="sect">
2845
- <?php _e("How To Override Defaults / Other Options") ?> <a href="#top" class="totop">&#9650; top</a>
2846
  </h3>
2847
  <p>Suppose you have a few videos that need to be different from the above defaults. You can add options to the end of a link as displayed below to override the above defaults. Each option should begin with '&'.
2848
  <br><span class="smallnote orange">PRO users: You can use the <a href="<?php echo self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=protab' ?>" target="_blank" class="button-primary cuz">&#9658; Customize</a> button that you will see inside the wizard, instead of memorizing the following.</span>
@@ -2930,7 +2940,7 @@ class YouTubePrefs
2930
  <ul class="gopro">
2931
  <li>
2932
  <img src="<?php echo plugins_url('images/videothumbs.png', __FILE__) ?>">
2933
- Automatic video thumbnail images (just click 'Update') <sup class="orange bold">NEW</sup>
2934
  </li>
2935
  <li>
2936
  <img src="<?php echo plugins_url('images/prioritysupport.png', __FILE__) ?>">
@@ -3384,11 +3394,24 @@ class YouTubePrefs
3384
  wp_add_inline_style('__EPYT__style', $custom_css);
3385
 
3386
 
 
 
 
 
 
 
 
 
 
 
3387
  wp_enqueue_script('__ytprefs__', plugins_url('scripts/ytprefs.min.js', __FILE__), array('jquery'));
3388
  wp_localize_script('__ytprefs__', '_EPYT_', array(
3389
  'ajaxurl' => admin_url('admin-ajax.php'),
3390
  'security' => wp_create_nonce('embedplus-nonce'),
3391
- 'gallery_scrolloffset' => intval(self::$alloptions[self::$opt_gallery_scrolloffset])
 
 
 
3392
  ));
3393
 
3394
 
@@ -3628,7 +3651,6 @@ class YouTubePrefs
3628
 
3629
 
3630
  </script>
3631
- <?php
3632
- }
3633
  }
3634
-
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
  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;
42
  public static $opt_center = 'centervid';
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';
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
  {
608
  die();
609
  }
610
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
611
  public static function jsinitvars()
612
  {
613
 
619
  }
620
  if (self::$alloptions[self::$opt_responsive] == 1)
621
  {
622
+ $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\']"]';
623
  }
624
  ?>
625
  <script data-cfasync="false">
686
  $_gallery_showtitle = 1;
687
  $_gallery_pagesize = 15;
688
  $_gallery_style = 'grid';
689
+ $_debugmode = 0;
690
 
691
  $arroptions = get_option(self::$opt_alloptions);
692
 
696
  $_center = self::tryget($arroptions, self::$opt_center, 0);
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);
797
  self::$opt_gallery_scrolloffset => $_gallery_scrolloffset,
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);
903
  //public static function get_gallery_page($playlistId, $pageToken, $pageSize, $columns, $style, $apiKey)
904
  public static function get_gallery_page($options)
905
  {
906
+ $options->pageSize = min(intval($options->pageSize), 50);
 
 
907
  $options->columns = intval($options->columns);
 
 
908
  $options->showTitle = intval($options->showTitle);
909
 
910
  if (empty($options->apiKey))
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))
955
+ {
956
+ return '<div>Sorry, there was a YouTube API error: <em>' . strip_tags($jsonResult->error->message) . '</em></div>';
957
+ }
958
  return '<div>Sorry, there may be an issue with your YouTube API key. Please enter a valid key to embed galleries.</div>';
959
  }
960
 
961
 
962
 
963
+ $resultsPerPage = $options->pageSize; // $jsonResult->pageInfo->resultsPerPage;
964
  $totalResults = $jsonResult->pageInfo->totalResults;
965
 
966
  $nextPageToken = '';
977
 
978
  $cnt = 0;
979
  $code.= '<div class="epyt-gallery-allthumbs">';
980
+ if (isset($jsonResult->items) && $jsonResult->items != null && is_array($jsonResult->items))
981
  {
982
 
983
+ foreach ($jsonResult->items as $item)
984
+ {
985
 
986
+ $thumb = new stdClass();
 
 
 
987
 
988
+ $thumb->id = isset($item->snippet->resourceId->videoId) ? $item->snippet->resourceId->videoId : null;
989
+ $thumb->id = $thumb->id ? $thumb->id : $item->id->videoId;
990
+ $thumb->title = $options->showTitle ? $item->snippet->title : '';
991
+ $thumb->privacyStatus = isset($item->status->privacyStatus) ? $item->status->privacyStatus : null;
992
+
993
+ if ($thumb->privacyStatus == 'private')
 
 
 
 
 
 
 
994
  {
995
+ $thumb->img = plugins_url('/images/private.png', __FILE__);
996
+ $thumb->quality = 'medium';
997
  }
998
  else
999
  {
1000
+ if (isset($item->snippet->thumbnails->high->url))
1001
+ {
1002
+ $thumb->img = $item->snippet->thumbnails->high->url;
1003
+ $thumb->quality = 'high';
1004
+ }
1005
+ elseif (isset($item->snippet->thumbnails->default->url))
1006
+ {
1007
+ $thumb->img = $item->snippet->thumbnails->default->url;
1008
+ $thumb->quality = 'default';
1009
+ }
1010
+ else
1011
+ {
1012
+ $thumb->img = $item->snippet->thumbnails->medium->url;
1013
+ $thumb->quality = 'medium';
1014
+ }
1015
  }
 
1016
 
1017
+ $code .= self::get_thumbnail_html($thumb, $options);
1018
+ $cnt++;
1019
 
1020
+ if ($cnt % $options->columns === 0 && $options->style !== 'carousel')
1021
+ {
1022
+ $code .= '<div class="epyt-gallery-rowbreak"></div>';
1023
+ }
1024
  }
1025
  }
1026
  $code .= '<div class="epyt-gallery-clear"></div></div>';
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);
1990
  $new_pointer_content .= '<p>'; // ooopointer
1991
  if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
1992
  {
1993
+ $new_pointer_content .= __("This update improves existing video gallery support for Free and <a target=_blank href=" . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer' . ">Pro features here &raquo;</a>");
1994
  }
1995
  else
1996
  {
1997
+ $new_pointer_content .= __("This update improves existing video gallery support for Free and Pro features.");
1998
  }
1999
  $new_pointer_content .= '</p>';
2000
 
2046
  $new_options[self::$opt_center] = self::postchecked(self::$opt_center) ? 1 : 0;
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;
2350
  <input type="hidden" name="<?php echo $ytprefs_submitted; ?>" value="Y">
2351
 
2352
  <h3 class="sect">
2353
+ <?php _e("How to Insert a YouTube Video or Playlist") ?> <!--<span class="pronon">(For Free and <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank">PRO Users &raquo;</a>)</span>-->
2354
  </h3>
2355
  <p>
2356
  <b>For videos:</b> <i>Method 1 - </i> Do you already have a URL to the video you want to embed in a post, page, or even a widget? All you have to do is paste it on its own line, as shown below (including the http:// part). Easy, eh?<br>
2400
  </p>
2401
  <div class="jumper" id="jumpdefaults"></div>
2402
  <h3 class="sect">
2403
+ <?php _e("Default YouTube Options") ?> <a href="#top" class="totop">&#9650; top</a>
2404
  </h3>
2405
  <p>
2406
+ <?php _e("One of the benefits of using this plugin is that you can set site-wide default options for all your videos (click \"Save Changes\" when finished). However, you can also override them (and more) on a per-video basis. Directions on how to do that are in the next section.") ?>
2407
  </p>
2408
  <p class="submit">
2409
  <input type="submit" onclick="return savevalidate();" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
2445
  </p>
2446
  <p>
2447
  <input name="<?php echo self::$opt_acctitle; ?>" id="<?php echo self::$opt_acctitle; ?>" <?php checked($all[self::$opt_acctitle], 1); ?> type="checkbox" class="checkbox">
2448
+ <label for="<?php echo self::$opt_acctitle; ?>"><b class="chktitle">Accessible Title Attributes: </b> Improve accessibility by using title attributes for screen reader support. It should help your site pass functional accessibility evaluations (FAE). </label>
2449
  </p>
2450
  <p>
2451
  <input name="<?php echo self::$opt_theme; ?>" id="<?php echo self::$opt_theme; ?>" <?php checked($all[self::$opt_theme], 'dark'); ?> type="checkbox" class="checkbox">
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; ?>">
2579
+ <b class="chktitle">Debug Mode: <sup class="orange bold">NEW</sup></b> If you ask for support, we may ask you to turn on debug mode here.
2580
+ It may print out some diagnostic info so that we can help you solve your issue.
2581
+ </label>
2582
+ </p>
2583
+
2584
  </div>
2585
  <div class="jumper" id="jumpgallery"></div>
2586
  <h3 class="sect">Gallery Settings and Directions<sup class="orange bold">NEW</sup></h3>
2611
  </p>
2612
  <p>
2613
  <label for="<?php echo self::$opt_gallery_pagesize; ?>"><b class="chktitle">Gallery Page Size:</b></label>
2614
+ <select name="<?php echo self::$opt_gallery_pagesize; ?>" id="<?php echo self::$opt_gallery_pagesize; ?>" style="width: 60px;">
2615
+ <?php
2616
+ $gps_val = intval(trim($all[self::$opt_gallery_pagesize]));
2617
+ $gps_val = min($gps_val, 50);
2618
+ for ($gps = 1; $gps <= 50; $gps++)
2619
+ {
2620
+ ?><option <?php echo $gps_val == $gps ? 'selected' : '' ?> value="<?php echo $gps ?>"><?php echo $gps ?></option>
2621
+ <?php
2622
+ }
2623
+ ?>
2624
+ </select>
2625
+ Enter how many thumbnails per page should be shown at once (YouTube allows a maximum of 50 per page).
2626
  </p>
2627
  <p>
2628
  <label for="<?php echo self::$opt_gallery_columns; ?>"><b class="chktitle">Number of Columns:</b></label>
2657
  <p class="smallnote orange">Below are PRO features for enhanced SEO and performance (works for even past embed links). Gallery options for PRO users will also be listed here.</p>
2658
  <p>
2659
  <img class="ssaltgallery" src="<?php echo plugins_url('images/ssaltgalleryall.jpg', __FILE__) ?>" />
2660
+ <?php $cleanstyle = trim($all[self::$opt_gallery_style]); ?>
2661
  <select name="<?php echo self::$opt_gallery_style; ?>" id="<?php echo self::$opt_gallery_style; ?>" >
2662
  <option value="">Gallery Style</option>
2663
  <option value="grid" <?php echo 'grid' === $cleanstyle ? 'selected' : '' ?> >Grid (default)</option>
2674
  <p>
2675
  <input name="<?php echo self::$opt_spdc; ?>" id="<?php echo self::$opt_spdc; ?>" <?php checked($all[self::$opt_spdc], 1); ?> type="checkbox" class="checkbox">
2676
  <label for="<?php echo self::$opt_spdc; ?>">
2677
+ <b>(PRO)</b> <b class="chktitle">Faster Page Loads (Caching): </b>
2678
  Use embed caching to speed up your page loads. By default, WordPress needs to request information from YouTube.com's servers for every video you embed, every time a page is loaded. These data requests can add time to your total page load time. Turn on this feature to cache that data (instead of having to request for the same information every time you load a page). This should then make your pages that have videos load faster. It's been noted that even small speed ups in page load can help increase visitor engagement, retention, and conversions. Caching also makes galleries run faster.
2679
  </label>
2680
  <div class="indent-option">
2681
  <div id="boxspdc">
2682
  <label>
2683
+ <b class="chktitle">Cache Liftime (hours): </b>
2684
  <input name="<?php echo self::$opt_spdcexp; ?>" id="<?php echo self::$opt_spdcexp; ?>" value="<?php echo trim($all[self::$opt_spdcexp]); ?>" type="number" min="1"/>
2685
  </label>
2686
  Tip: If your pages rarely change, you may wish to set this to a much higher value than 24 hours.
2721
  <input name="<?php echo self::$opt_dynload; ?>" id="<?php echo self::$opt_dynload; ?>" <?php checked($all[self::$opt_dynload], 1); ?> type="checkbox" class="checkbox">
2722
  <span id="boxdyn">
2723
  Animation:
2724
+ <?php $cleandyn = trim($all[self::$opt_dyntype]); ?>
2725
  <select name="<?php echo self::$opt_dyntype; ?>" id="<?php echo self::$opt_dyntype; ?>" >
2726
  <option value="">Select type</option>
2727
  <option value="rotateIn" <?php echo 'rotateIn' === $cleandyn ? 'selected' : '' ?> >rotate in</option>
2756
  <img class="ssfb" src="<?php echo plugins_url('images/youtube_thumbnail_sample.jpg', __FILE__) ?>" />
2757
  <input name="<?php echo self::$opt_ftpostimg; ?>" id="<?php echo self::$opt_ftpostimg; ?>" <?php checked($all[self::$opt_ftpostimg], 1); ?> type="checkbox" class="checkbox">
2758
  <label for="<?php echo self::$opt_ftpostimg; ?>">
2759
+ <b>(PRO)</b> <b class="chktitle">Automatic Video Thumbnails: </b>
2760
  Automatically grab the thumbnail image of the first video embedded in each post or page, and use it as the featured image. If your theme can display featured images of posts on your blog home, you’ll see the thumbnails there as shown in the picture on the right. All you have to do is click Update on a post or page and the plugin does the rest!
2761
  (Example shown on the right) <a target="_blank" href="<?php echo self::$epbase ?>/add-youtube-video-thumbnails-featured-image-wordpress.aspx">Watch example here &raquo;</a>
2762
  </label>
2784
  <p>
2785
  <input disabled type="checkbox" class="checkbox">
2786
  <label>
2787
+ <b class="chktitle">Faster Page Loads (Caching): </b> <span class="pronon">(PRO Users)</span>
2788
  Use embed caching to speed up your page loads. By default, WordPress needs to request information from YouTube.com's servers for every video you embed, every time a page is loaded. These data requests can add time to your total page load time. Turn on this feature to cache that data (instead of having to request for the same information every time you load a page). This should then make your pages that have videos load faster. It's been noted that even small speed ups in page load can help increase visitor engagement, retention, and conversions. Caching also makes galleries run faster.
2789
  </label>
2790
  <div class="indent-option">
2791
  <label>
2792
+ <b class="chktitle">Cache Liftime (hours): </b>
2793
  <input disabled value="24" type="number">
2794
  Tip: If your pages rarely change, you may wish to set this to a much higher value than 24 hours.
2795
  </label>
2852
  <div class="jumper" id="jumpoverride"></div>
2853
 
2854
  <h3 class="sect">
2855
+ <?php _e("How To Override Defaults / Other Options") ?> <a href="#top" class="totop">&#9650; top</a>
2856
  </h3>
2857
  <p>Suppose you have a few videos that need to be different from the above defaults. You can add options to the end of a link as displayed below to override the above defaults. Each option should begin with '&'.
2858
  <br><span class="smallnote orange">PRO users: You can use the <a href="<?php echo self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=protab' ?>" target="_blank" class="button-primary cuz">&#9658; Customize</a> button that you will see inside the wizard, instead of memorizing the following.</span>
2940
  <ul class="gopro">
2941
  <li>
2942
  <img src="<?php echo plugins_url('images/videothumbs.png', __FILE__) ?>">
2943
+ Automatic video thumbnail images (just click 'Update')
2944
  </li>
2945
  <li>
2946
  <img src="<?php echo plugins_url('images/prioritysupport.png', __FILE__) ?>">
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
 
3651
 
3652
 
3653
  </script>
3654
+ <?php
 
3655
  }
3656
+ }