YouTube Channel - Version 3.0.8.6

Version Description

  • Fix: Broken Enhanced Privacy on small screens in forked MagnificPopupAU library
  • Enhanced: Finished making code compliant to WordPress Core coding standards
Download this release

Release Info

Developer urkekg
Plugin Icon YouTube Channel
Version 3.0.8.6
Comparing to
See all releases

Code changes from version 3.0.8.5 to 3.0.8.6

assets/css/admin.css CHANGED
@@ -1 +1 @@
1
- i.mce-i-ytc{font:normal 20px/1 'dashicons';padding:0;vertical-align:top;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin-left:-2px;padding-right:2px}i.mce-i-ytc:before{content:'\f236'}div[id*='_youtube-channel-'] .widget-content p{width:100%;clear:both}div[id*='_youtube-channel-'] .widget-content p.half{width:49%}div[id*='_youtube-channel-'] .widget-content p.half.left{float:left;clear:left}div[id*='_youtube-channel-'] .widget-content p.half.right{float:right;clear:right}div[id*='_youtube-channel-'] .widget-content p.glue-top{margin-top:0}div[id*='_youtube-channel-'] .widget-content p.hidden{display:none}div[id*='_youtube-channel-'] .widget-content p.visible{display:block}@media screen and (max-width:782px){div[id*='_youtube-channel-'] .widget-content p.half.left,div[id*='_youtube-channel-'] .widget-content p.half.right{width:100%;float:none;clear:none}}.nav-tab.nav-tab-hidden{display:none}.subnav-tab-wrapper{margin-bottom:0}.subnav-tab-wrapper .nav-tab{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.subnav-tab-wrapper .nav-tab:focus{-webkit-box-shadow:initial;box-shadow:initial}.tab-content-ytc{display:none}.tab-content-ytc.tab-content-active{display:block;border-color:#ccc;border-width:0 1px 1px 1px;border-style:solid;padding:10px}
1
+ i.mce-i-ytc{font:400 20px/1 dashicons;padding:0;vertical-align:top;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin-left:-2px;padding-right:2px}i.mce-i-ytc:before{content:'\f236'}div[id*='_youtube-channel-'] .widget-content p{width:100%;clear:both}div[id*='_youtube-channel-'] .widget-content p.half{width:49%}div[id*='_youtube-channel-'] .widget-content p.half.left{float:left;clear:left}div[id*='_youtube-channel-'] .widget-content p.half.right{float:right;clear:right}div[id*='_youtube-channel-'] .widget-content p.glue-top{margin-top:0}div[id*='_youtube-channel-'] .widget-content p.hidden{display:none}div[id*='_youtube-channel-'] .widget-content p.visible{display:block}@media screen and (max-width:782px){div[id*='_youtube-channel-'] .widget-content p.half.left,div[id*='_youtube-channel-'] .widget-content p.half.right{width:100%;float:none;clear:none}}.nav-tab.nav-tab-hidden{display:none}.subnav-tab-wrapper{margin-bottom:0}.subnav-tab-wrapper .nav-tab{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.subnav-tab-wrapper .nav-tab:focus{-webkit-box-shadow:initial;box-shadow:initial}.tab-content-ytc{display:none}.tab-content-ytc.tab-content-active{display:block;border-color:#ccc;border-width:0 1px 1px 1px;border-style:solid;padding:10px}
assets/lib/magnific-popup/jquery.magnific-popup.js CHANGED
@@ -1,8 +1,9 @@
1
- /*! Magnific Popup - v1.0.0.1 - 2015-06-09
2
  * Mod v0.9.9.1 - 2014-09-14 Aleksandar Urosevic (YT rel)
3
  * Mod v0.9.9.2 - 2014-12-07 Aleksandar Urosevic (YT controls, modestbranding)
4
  * Mod v0.9.9.3 - 2015-06-09 Aleksandar Urosevic (YT noccookie support)
5
  * Mod v1.0.0.1 - 2015-06-09 Aleksandar Urosevic (sync to MagnificPopup v1.0.0; remove all modules except iframe; add YT playsinline parameter support)
 
6
  * http://dimsemenov.com/plugins/magnific-popup/
7
  * Copyright (c) 2015 Dmitry Semenov; */
8
  ;(function (factory) {
@@ -1013,18 +1014,9 @@ $.magnificPopupAU.registerModule(IFRAME_NS, {
1013
  theme: 'theme=',
1014
  controls: 'controls=',
1015
  playsinline: 'playsinline=',
 
1016
  src: '//www.youtube.com/embed/%id%?autoplay=1&rel=%rel%&modestbranding=%modestbranding%&controls=%controls%&playsinline=%playsinline%'
1017
  },
1018
- youtubenocookie: {
1019
- index: 'youtube-nocookie.com',
1020
- id: 'v=',
1021
- rel: 'rel=',
1022
- modestbranding: 'modestbranding=',
1023
- theme: 'theme=',
1024
- controls: 'controls=',
1025
- playsinline: 'playsinline=',
1026
- src: '//www.youtube-nocookie.com/embed/%id%?autoplay=1&rel=%rel%&modestbranding=%modestbranding%&controls=%controls%&playsinline=%playsinline%'
1027
- },
1028
  vimeo: {
1029
  index: 'vimeo.com/',
1030
  id: '/',
@@ -1059,17 +1051,28 @@ $.magnificPopupAU.registerModule(IFRAME_NS, {
1059
  },
1060
 
1061
  getIframe: function(item, template) {
1062
- var embedSrc = item.src;
1063
- var embedRel = item.src;
1064
- var embedMB = item.src;
1065
  var embedControls = item.src;
1066
- var embedPI = item.src;
1067
- var iframeSt = mfp.st.iframe;
1068
 
1069
  $.each(iframeSt.patterns, function() {
1070
  if(embedSrc.indexOf( this.index ) > -1) {
1071
 
1072
- eSrc = embedSrc;
 
 
 
 
 
 
 
 
 
 
 
1073
  if(this.id) {
1074
  if(typeof this.id === 'string') {
1075
  embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length, embedSrc.length);
1
+ /*! Magnific Popup - v1.0.0.2 - 2015-10-04
2
  * Mod v0.9.9.1 - 2014-09-14 Aleksandar Urosevic (YT rel)
3
  * Mod v0.9.9.2 - 2014-12-07 Aleksandar Urosevic (YT controls, modestbranding)
4
  * Mod v0.9.9.3 - 2015-06-09 Aleksandar Urosevic (YT noccookie support)
5
  * Mod v1.0.0.1 - 2015-06-09 Aleksandar Urosevic (sync to MagnificPopup v1.0.0; remove all modules except iframe; add YT playsinline parameter support)
6
+ * Mod v1.0.0.2 - 2015-10-04 Aleksandar Urosevic (fix broken nocookie functionality on small screens)
7
  * http://dimsemenov.com/plugins/magnific-popup/
8
  * Copyright (c) 2015 Dmitry Semenov; */
9
  ;(function (factory) {
1014
  theme: 'theme=',
1015
  controls: 'controls=',
1016
  playsinline: 'playsinline=',
1017
+ enhanceprivacy: 'enhanceprivacy=',
1018
  src: '//www.youtube.com/embed/%id%?autoplay=1&rel=%rel%&modestbranding=%modestbranding%&controls=%controls%&playsinline=%playsinline%'
1019
  },
 
 
 
 
 
 
 
 
 
 
1020
  vimeo: {
1021
  index: 'vimeo.com/',
1022
  id: '/',
1051
  },
1052
 
1053
  getIframe: function(item, template) {
1054
+ var embedSrc = item.src;
1055
+ var embedRel = item.src;
1056
+ var embedMB = item.src;
1057
  var embedControls = item.src;
1058
+ var embedPI = item.src;
1059
+ var iframeSt = mfp.st.iframe;
1060
 
1061
  $.each(iframeSt.patterns, function() {
1062
  if(embedSrc.indexOf( this.index ) > -1) {
1063
 
1064
+ if(this.enhanceprivacy) {
1065
+ if(typeof this.enhanceprivacy === 'string' && embedSrc.indexOf(this.enhanceprivacy) > 0) {
1066
+ enhancePrivacy = embedSrc.substr(embedSrc.lastIndexOf(this.enhanceprivacy)+this.enhanceprivacy.length, embedSrc.length);
1067
+ if ( enhancePrivacy.indexOf('&') > 0 ) {
1068
+ enhancePrivacy = enhancePrivacy.substr(0, enhancePrivacy.indexOf('&'));
1069
+ }
1070
+ if ( enhancePrivacy == 1 && this.src.indexOf('youtube.com') > 0 ) {
1071
+ this.src = this.src.replace('youtube.com', 'youtube-nocookie.com');
1072
+ }
1073
+ }
1074
+ }
1075
+
1076
  if(this.id) {
1077
  if(typeof this.id === 'string') {
1078
  embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length, embedSrc.length);
assets/lib/magnific-popup/jquery.magnific-popup.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(e){var t,n,i,o,s,r,a="Close",l="BeforeClose",c="AfterClose",p="BeforeAppend",d="MarkupParse",u="Open",f="Change",m="ytc-mfp",h="."+m,g="ytc-mfp-ready",y="ytc-mfp-removing",v="ytc-mfp-prevent-close",b=function(){},C=!!window.jQuery,w=e(window),x=function(e,n){t.ev.on(m+e+h,n)},O=function(t,n,i,o){var s=document.createElement("div");return s.className="ytc-mfp-"+t,i&&(s.innerHTML=i),o?n&&n.appendChild(s):(s=e(s),n&&s.appendTo(n)),s},k=function(n,i){t.ev.triggerHandler(m+n,i),t.st.callbacks&&(n=n.charAt(0).toLowerCase()+n.slice(1),t.st.callbacks[n]&&t.st.callbacks[n].apply(t,e.isArray(i)?i:[i]))},I=function(n){return n===r&&t.currTemplate.closeBtn||(t.currTemplate.closeBtn=e(t.st.closeMarkup.replace("%title%",t.st.tClose)),r=n),t.currTemplate.closeBtn},P=function(){e.magnificPopupAU.instance||(t=new b,t.init(),e.magnificPopupAU.instance=t)},E=function(){var e=document.createElement("p").style,t=["ms","O","Moz","Webkit"];if(void 0!==e.transition)return!0;for(;t.length;)if(t.pop()+"Transition"in e)return!0;return!1};b.prototype={constructor:b,init:function(){var n=navigator.appVersion;t.isIE7=-1!==n.indexOf("MSIE 7."),t.isIE8=-1!==n.indexOf("MSIE 8."),t.isLowIE=t.isIE7||t.isIE8,t.isAndroid=/android/gi.test(n),t.isIOS=/iphone|ipad|ipod/gi.test(n),t.supportsTransition=E(),t.probablyMobile=t.isAndroid||t.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),i=e(document),t.popupsCache={}},open:function(n){var o;if(n.isObj===!1){t.items=n.items.toArray(),t.index=0;var r,a=n.items;for(o=0;o<a.length;o++)if(r=a[o],r.parsed&&(r=r.el[0]),r===n.el[0]){t.index=o;break}}else t.items=e.isArray(n.items)?n.items:[n.items],t.index=n.index||0;if(t.isOpen)return void t.updateItemHTML();t.types=[],s="",t.ev=n.mainEl&&n.mainEl.length?n.mainEl.eq(0):i,n.key?(t.popupsCache[n.key]||(t.popupsCache[n.key]={}),t.currTemplate=t.popupsCache[n.key]):t.currTemplate={},t.st=e.extend(!0,{},e.magnificPopupAU.defaults,n),t.fixedContentPos="auto"===t.st.fixedContentPos?!t.probablyMobile:t.st.fixedContentPos,t.st.modal&&(t.st.closeOnContentClick=!1,t.st.closeOnBgClick=!1,t.st.showCloseBtn=!1,t.st.enableEscapeKey=!1),t.bgOverlay||(t.bgOverlay=O("bg").on("click"+h,function(){t.close()}),t.wrap=O("wrap").attr("tabindex",-1).on("click"+h,function(e){t._checkIfClose(e.target)&&t.close()}),t.container=O("container",t.wrap)),t.contentContainer=O("content"),t.st.preloader&&(t.preloader=O("preloader",t.container,t.st.tLoading));var l=e.magnificPopupAU.modules;for(o=0;o<l.length;o++){var c=l[o];c=c.charAt(0).toUpperCase()+c.slice(1),t["init"+c].call(t)}k("BeforeOpen"),t.st.showCloseBtn&&(t.st.closeBtnInside?(x(d,function(e,t,n,i){n.close_replaceWith=I(i.type)}),s+=" ytc-mfp-close-btn-in"):t.wrap.append(I())),t.st.alignTop&&(s+=" ytc-mfp-align-top"),t.wrap.css(t.fixedContentPos?{overflow:t.st.overflowY,overflowX:"hidden",overflowY:t.st.overflowY}:{top:w.scrollTop(),position:"absolute"}),(t.st.fixedBgPos===!1||"auto"===t.st.fixedBgPos&&!t.fixedContentPos)&&t.bgOverlay.css({height:i.height(),position:"absolute"}),t.st.enableEscapeKey&&i.on("keyup"+h,function(e){27===e.keyCode&&t.close()}),w.on("resize"+h,function(){t.updateSize()}),t.st.closeOnContentClick||(s+=" ytc-mfp-auto-cursor"),s&&t.wrap.addClass(s);var p=t.wH=w.height(),f={};if(t.fixedContentPos&&t._hasScrollBar(p)){var m=t._getScrollbarSize();m&&(f.marginRight=m)}t.fixedContentPos&&(t.isIE7?e("body, html").css("overflow","hidden"):f.overflow="hidden");var y=t.st.mainClass;return t.isIE7&&(y+=" ytc-mfp-ie7"),y&&t._addClassToMFP(y),t.updateItemHTML(),k("BuildControls"),e("html").css(f),t.bgOverlay.add(t.wrap).prependTo(t.st.prependTo||e(document.body)),t._lastFocusedEl=document.activeElement,setTimeout(function(){t.content?(t._addClassToMFP(g),t._setFocus()):t.bgOverlay.addClass(g),i.on("focusin"+h,t._onFocusIn)},16),t.isOpen=!0,t.updateSize(p),k(u),n},close:function(){t.isOpen&&(k(l),t.isOpen=!1,t.st.removalDelay&&!t.isLowIE&&t.supportsTransition?(t._addClassToMFP(y),setTimeout(function(){t._close()},t.st.removalDelay)):t._close())},_close:function(){k(a);var n=y+" "+g+" ";if(t.bgOverlay.detach(),t.wrap.detach(),t.container.empty(),t.st.mainClass&&(n+=t.st.mainClass+" "),t._removeClassFromMFP(n),t.fixedContentPos){var o={marginRight:""};t.isIE7?e("body, html").css("overflow",""):o.overflow="",e("html").css(o)}i.off("keyup"+h+" focusin"+h),t.ev.off(h),t.wrap.attr("class","ytc-mfp-wrap").removeAttr("style"),t.bgOverlay.attr("class","ytc-mfp-bg"),t.container.attr("class","ytc-mfp-container"),!t.st.showCloseBtn||t.st.closeBtnInside&&t.currTemplate[t.currItem.type]!==!0||t.currTemplate.closeBtn&&t.currTemplate.closeBtn.detach(),t._lastFocusedEl&&e(t._lastFocusedEl).focus(),t.currItem=null,t.content=null,t.currTemplate=null,t.prevHeight=0,k(c)},updateSize:function(e){if(t.isIOS){var n=document.documentElement.clientWidth/window.innerWidth,i=window.innerHeight*n;t.wrap.css("height",i),t.wH=i}else t.wH=e||w.height();t.fixedContentPos||t.wrap.css("height",t.wH),k("Resize")},updateItemHTML:function(){var n=t.items[t.index];t.contentContainer.detach(),t.content&&t.content.detach(),n.parsed||(n=t.parseEl(t.index));var i=n.type;if(k("BeforeChange",[t.currItem?t.currItem.type:"",i]),t.currItem=n,!t.currTemplate[i]){var s=t.st[i]?t.st[i].markup:!1;k("FirstMarkupParse",s),t.currTemplate[i]=s?e(s):!0}o&&o!==n.type&&t.container.removeClass("ytc-mfp-"+o+"-holder");var r=t["get"+i.charAt(0).toUpperCase()+i.slice(1)](n,t.currTemplate[i]);t.appendContent(r,i),n.preloaded=!0,k(f,n),o=n.type,t.container.prepend(t.contentContainer),k("AfterChange")},appendContent:function(e,n){t.content=e,e?t.st.showCloseBtn&&t.st.closeBtnInside&&t.currTemplate[n]===!0?t.content.find(".ytc-mfp-close").length||t.content.append(I()):t.content=e:t.content="",k(p),t.container.addClass("ytc-mfp-"+n+"-holder"),t.contentContainer.append(t.content)},parseEl:function(n){var i,o=t.items[n];if(o.tagName?o={el:e(o)}:(i=o.type,o={data:o,src:o.src}),o.el){for(var s=t.types,r=0;r<s.length;r++)if(o.el.hasClass("ytc-mfp-"+s[r])){i=s[r];break}o.src=o.el.attr("data-ytc-mfp-src"),o.src||(o.src=o.el.attr("href"))}return o.type=i||t.st.type||"inline",o.index=n,o.parsed=!0,t.items[n]=o,k("ElementParse",o),t.items[n]},addGroup:function(e,n){var i=function(i){i.mfpEl=this,t._openClick(i,e,n)};n||(n={});var o="click.magnificPopupAU";n.mainEl=e,n.items?(n.isObj=!0,e.off(o).on(o,i)):(n.isObj=!1,n.delegate?e.off(o).on(o,n.delegate,i):(n.items=e,e.off(o).on(o,i)))},_openClick:function(n,i,o){var s=void 0!==o.midClick?o.midClick:e.magnificPopupAU.defaults.midClick;if(s||2!==n.which&&!n.ctrlKey&&!n.metaKey){var r=void 0!==o.disableOn?o.disableOn:e.magnificPopupAU.defaults.disableOn;if(r)if(e.isFunction(r)){if(!r.call(t))return!0}else if(w.width()<r)return!0;n.type&&(n.preventDefault(),t.isOpen&&n.stopPropagation()),o.el=e(n.mfpEl),o.delegate&&(o.items=i.find(o.delegate)),t.open(o)}},updateStatus:function(e,i){if(t.preloader){n!==e&&t.container.removeClass("ytc-mfp-s-"+n),i||"loading"!==e||(i=t.st.tLoading);var o={status:e,text:i};k("UpdateStatus",o),e=o.status,i=o.text,t.preloader.html(i),t.preloader.find("a").on("click",function(e){e.stopImmediatePropagation()}),t.container.addClass("ytc-mfp-s-"+e),n=e}},_checkIfClose:function(n){if(!e(n).hasClass(v)){var i=t.st.closeOnContentClick,o=t.st.closeOnBgClick;if(i&&o)return!0;if(!t.content||e(n).hasClass("ytc-mfp-close")||t.preloader&&n===t.preloader[0])return!0;if(n===t.content[0]||e.contains(t.content[0],n)){if(i)return!0}else if(o&&e.contains(document,n))return!0;return!1}},_addClassToMFP:function(e){t.bgOverlay.addClass(e),t.wrap.addClass(e)},_removeClassFromMFP:function(e){this.bgOverlay.removeClass(e),t.wrap.removeClass(e)},_hasScrollBar:function(e){return(t.isIE7?i.height():document.body.scrollHeight)>(e||w.height())},_setFocus:function(){(t.st.focus?t.content.find(t.st.focus).eq(0):t.wrap).focus()},_onFocusIn:function(n){return n.target===t.wrap[0]||e.contains(t.wrap[0],n.target)?void 0:(t._setFocus(),!1)},_parseMarkup:function(t,n,i){var o;i.data&&(n=e.extend(i.data,n)),k(d,[t,n,i]),e.each(n,function(e,n){if(void 0===n||n===!1)return!0;if(o=e.split("_"),o.length>1){var i=t.find(h+"-"+o[0]);if(i.length>0){var s=o[1];"replaceWith"===s?i[0]!==n[0]&&i.replaceWith(n):"img"===s?i.is("img")?i.attr("src",n):i.replaceWith('<img src="'+n+'" class="'+i.attr("class")+'" />'):i.attr(o[1],n)}}else t.find(h+"-"+e).html(n)})},_getScrollbarSize:function(){if(void 0===t.scrollbarSize){var e=document.createElement("div");e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),t.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return t.scrollbarSize}},e.magnificPopupAU={instance:null,proto:b.prototype,modules:[],open:function(t,n){return P(),t=t?e.extend(!0,{},t):{},t.isObj=!0,t.index=n||0,this.instance.open(t)},close:function(){return e.magnificPopupAU.instance&&e.magnificPopupAU.instance.close()},registerModule:function(t,n){n.options&&(e.magnificPopupAU.defaults[t]=n.options),e.extend(this.proto,n.proto),this.modules.push(t)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="ytc-mfp-close">&times;</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},e.fn.magnificPopupAU=function(n){P();var i=e(this);if("string"==typeof n)if("open"===n){var o,s=C?i.data("magnificPopupAU"):i[0].magnificPopupAU,r=parseInt(arguments[1],10)||0;s.items?o=s.items[r]:(o=i,s.delegate&&(o=o.find(s.delegate)),o=o.eq(r)),t._openClick({mfpEl:o},i,s)}else t.isOpen&&t[n].apply(t,Array.prototype.slice.call(arguments,1));else n=e.extend(!0,{},n),C?i.data("magnificPopupAU",n):i[0].magnificPopupAU=n,t.addGroup(i,n);return i};var T="iframe",A="//about:blank",_=function(e){if(t.currTemplate[T]){var n=t.currTemplate[T].find("iframe");n.length&&(e||(n[0].src=A),t.isIE8&&n.css("display",e?"block":"none"))}};e.magnificPopupAU.registerModule(T,{options:{markup:'<div class="ytc-mfp-iframe-scaler"><div class="ytc-mfp-close"></div><iframe class="ytc-mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",rel:"rel=",modestbranding:"modestbranding=",theme:"theme=",controls:"controls=",playsinline:"playsinline=",src:"//www.youtube.com/embed/%id%?autoplay=1&rel=%rel%&modestbranding=%modestbranding%&controls=%controls%&playsinline=%playsinline%"},youtubenocookie:{index:"youtube-nocookie.com",id:"v=",rel:"rel=",modestbranding:"modestbranding=",theme:"theme=",controls:"controls=",playsinline:"playsinline=",src:"//www.youtube-nocookie.com/embed/%id%?autoplay=1&rel=%rel%&modestbranding=%modestbranding%&controls=%controls%&playsinline=%playsinline%"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){t.types.push(T),x("BeforeChange",function(e,t,n){t!==n&&(t===T?_():n===T&&_(!0))}),x(a+"."+T,function(){_()})},getIframe:function(n,i){var o=n.src,s=n.src,r=n.src,a=n.src,l=n.src,c=t.st.iframe;e.each(c.patterns,function(){return o.indexOf(this.index)>-1?(eSrc=o,this.id&&("string"==typeof this.id?(o=o.substr(o.lastIndexOf(this.id)+this.id.length,o.length),o.indexOf("&")>0&&(o=o.substr(0,o.indexOf("&")))):o=this.id.call(this,o)),this.rel&&("string"==typeof this.rel&&s.indexOf(this.rel)>0?(s=s.substr(s.lastIndexOf(this.rel)+this.rel.length,s.length),s.indexOf("&")>0&&(s=s.substr(0,s.indexOf("&")))):s="1"),this.modestbranding&&("string"==typeof this.modestbranding&&r.indexOf(this.modestbranding)>0?(r=r.substr(r.lastIndexOf(this.modestbranding)+this.modestbranding.length,r.length),r.indexOf("&")>0&&(r=r.substr(0,r.indexOf("&")))):r="0"),this.controls&&("string"==typeof this.controls&&a.indexOf(this.controls)>0?(a=a.substr(a.lastIndexOf(this.controls)+this.controls.length,a.length),a.indexOf("&")>0&&(a=a.substr(0,a.indexOf("&")))):a="1"),this.playsinline&&("string"==typeof this.playsinline&&l.indexOf(this.playsinline)>0?(l=l.substr(l.lastIndexOf(this.playsinline)+this.playsinline.length,l.length),l.indexOf("&")>0&&(l=l.substr(0,l.indexOf("&")))):l="0"),o=this.src.replace("%id%",o).replace("%rel%",s).replace("%modestbranding%",r).replace("%controls%",a).replace("%playsinline%",l),!1):void 0});var p={};return c.srcAction&&(p[c.srcAction]=o),t._parseMarkup(i,p,n),t.updateStatus("ready"),i}}}),P()});
1
+ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(e){var t,n,i,s,o,a,r="Close",c="BeforeClose",l="AfterClose",p="BeforeAppend",d="MarkupParse",f="Open",u="Change",m="ytc-mfp",h="."+m,g="ytc-mfp-ready",y="ytc-mfp-removing",v="ytc-mfp-prevent-close",b=function(){},C=!!window.jQuery,O=e(window),x=function(e,n){t.ev.on(m+e+h,n)},w=function(t,n,i,s){var o=document.createElement("div");return o.className="ytc-mfp-"+t,i&&(o.innerHTML=i),s?n&&n.appendChild(o):(o=e(o),n&&o.appendTo(n)),o},P=function(n,i){t.ev.triggerHandler(m+n,i),t.st.callbacks&&(n=n.charAt(0).toLowerCase()+n.slice(1),t.st.callbacks[n]&&t.st.callbacks[n].apply(t,e.isArray(i)?i:[i]))},k=function(n){return n===a&&t.currTemplate.closeBtn||(t.currTemplate.closeBtn=e(t.st.closeMarkup.replace("%title%",t.st.tClose)),a=n),t.currTemplate.closeBtn},I=function(){e.magnificPopupAU.instance||(t=new b,t.init(),e.magnificPopupAU.instance=t)},E=function(){var e=document.createElement("p").style,t=["ms","O","Moz","Webkit"];if(void 0!==e.transition)return!0;for(;t.length;)if(t.pop()+"Transition"in e)return!0;return!1};b.prototype={constructor:b,init:function(){var n=navigator.appVersion;t.isIE7=-1!==n.indexOf("MSIE 7."),t.isIE8=-1!==n.indexOf("MSIE 8."),t.isLowIE=t.isIE7||t.isIE8,t.isAndroid=/android/gi.test(n),t.isIOS=/iphone|ipad|ipod/gi.test(n),t.supportsTransition=E(),t.probablyMobile=t.isAndroid||t.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),i=e(document),t.popupsCache={}},open:function(n){var s;if(n.isObj===!1){t.items=n.items.toArray(),t.index=0;var a,r=n.items;for(s=0;s<r.length;s++)if(a=r[s],a.parsed&&(a=a.el[0]),a===n.el[0]){t.index=s;break}}else t.items=e.isArray(n.items)?n.items:[n.items],t.index=n.index||0;if(t.isOpen)return void t.updateItemHTML();t.types=[],o="",t.ev=n.mainEl&&n.mainEl.length?n.mainEl.eq(0):i,n.key?(t.popupsCache[n.key]||(t.popupsCache[n.key]={}),t.currTemplate=t.popupsCache[n.key]):t.currTemplate={},t.st=e.extend(!0,{},e.magnificPopupAU.defaults,n),t.fixedContentPos="auto"===t.st.fixedContentPos?!t.probablyMobile:t.st.fixedContentPos,t.st.modal&&(t.st.closeOnContentClick=!1,t.st.closeOnBgClick=!1,t.st.showCloseBtn=!1,t.st.enableEscapeKey=!1),t.bgOverlay||(t.bgOverlay=w("bg").on("click"+h,function(){t.close()}),t.wrap=w("wrap").attr("tabindex",-1).on("click"+h,function(e){t._checkIfClose(e.target)&&t.close()}),t.container=w("container",t.wrap)),t.contentContainer=w("content"),t.st.preloader&&(t.preloader=w("preloader",t.container,t.st.tLoading));var c=e.magnificPopupAU.modules;for(s=0;s<c.length;s++){var l=c[s];l=l.charAt(0).toUpperCase()+l.slice(1),t["init"+l].call(t)}P("BeforeOpen"),t.st.showCloseBtn&&(t.st.closeBtnInside?(x(d,function(e,t,n,i){n.close_replaceWith=k(i.type)}),o+=" ytc-mfp-close-btn-in"):t.wrap.append(k())),t.st.alignTop&&(o+=" ytc-mfp-align-top"),t.wrap.css(t.fixedContentPos?{overflow:t.st.overflowY,overflowX:"hidden",overflowY:t.st.overflowY}:{top:O.scrollTop(),position:"absolute"}),(t.st.fixedBgPos===!1||"auto"===t.st.fixedBgPos&&!t.fixedContentPos)&&t.bgOverlay.css({height:i.height(),position:"absolute"}),t.st.enableEscapeKey&&i.on("keyup"+h,function(e){27===e.keyCode&&t.close()}),O.on("resize"+h,function(){t.updateSize()}),t.st.closeOnContentClick||(o+=" ytc-mfp-auto-cursor"),o&&t.wrap.addClass(o);var p=t.wH=O.height(),u={};if(t.fixedContentPos&&t._hasScrollBar(p)){var m=t._getScrollbarSize();m&&(u.marginRight=m)}t.fixedContentPos&&(t.isIE7?e("body, html").css("overflow","hidden"):u.overflow="hidden");var y=t.st.mainClass;return t.isIE7&&(y+=" ytc-mfp-ie7"),y&&t._addClassToMFP(y),t.updateItemHTML(),P("BuildControls"),e("html").css(u),t.bgOverlay.add(t.wrap).prependTo(t.st.prependTo||e(document.body)),t._lastFocusedEl=document.activeElement,setTimeout(function(){t.content?(t._addClassToMFP(g),t._setFocus()):t.bgOverlay.addClass(g),i.on("focusin"+h,t._onFocusIn)},16),t.isOpen=!0,t.updateSize(p),P(f),n},close:function(){t.isOpen&&(P(c),t.isOpen=!1,t.st.removalDelay&&!t.isLowIE&&t.supportsTransition?(t._addClassToMFP(y),setTimeout(function(){t._close()},t.st.removalDelay)):t._close())},_close:function(){P(r);var n=y+" "+g+" ";if(t.bgOverlay.detach(),t.wrap.detach(),t.container.empty(),t.st.mainClass&&(n+=t.st.mainClass+" "),t._removeClassFromMFP(n),t.fixedContentPos){var s={marginRight:""};t.isIE7?e("body, html").css("overflow",""):s.overflow="",e("html").css(s)}i.off("keyup"+h+" focusin"+h),t.ev.off(h),t.wrap.attr("class","ytc-mfp-wrap").removeAttr("style"),t.bgOverlay.attr("class","ytc-mfp-bg"),t.container.attr("class","ytc-mfp-container"),!t.st.showCloseBtn||t.st.closeBtnInside&&t.currTemplate[t.currItem.type]!==!0||t.currTemplate.closeBtn&&t.currTemplate.closeBtn.detach(),t._lastFocusedEl&&e(t._lastFocusedEl).focus(),t.currItem=null,t.content=null,t.currTemplate=null,t.prevHeight=0,P(l)},updateSize:function(e){if(t.isIOS){var n=document.documentElement.clientWidth/window.innerWidth,i=window.innerHeight*n;t.wrap.css("height",i),t.wH=i}else t.wH=e||O.height();t.fixedContentPos||t.wrap.css("height",t.wH),P("Resize")},updateItemHTML:function(){var n=t.items[t.index];t.contentContainer.detach(),t.content&&t.content.detach(),n.parsed||(n=t.parseEl(t.index));var i=n.type;if(P("BeforeChange",[t.currItem?t.currItem.type:"",i]),t.currItem=n,!t.currTemplate[i]){var o=t.st[i]?t.st[i].markup:!1;P("FirstMarkupParse",o),t.currTemplate[i]=o?e(o):!0}s&&s!==n.type&&t.container.removeClass("ytc-mfp-"+s+"-holder");var a=t["get"+i.charAt(0).toUpperCase()+i.slice(1)](n,t.currTemplate[i]);t.appendContent(a,i),n.preloaded=!0,P(u,n),s=n.type,t.container.prepend(t.contentContainer),P("AfterChange")},appendContent:function(e,n){t.content=e,e?t.st.showCloseBtn&&t.st.closeBtnInside&&t.currTemplate[n]===!0?t.content.find(".ytc-mfp-close").length||t.content.append(k()):t.content=e:t.content="",P(p),t.container.addClass("ytc-mfp-"+n+"-holder"),t.contentContainer.append(t.content)},parseEl:function(n){var i,s=t.items[n];if(s.tagName?s={el:e(s)}:(i=s.type,s={data:s,src:s.src}),s.el){for(var o=t.types,a=0;a<o.length;a++)if(s.el.hasClass("ytc-mfp-"+o[a])){i=o[a];break}s.src=s.el.attr("data-ytc-mfp-src"),s.src||(s.src=s.el.attr("href"))}return s.type=i||t.st.type||"inline",s.index=n,s.parsed=!0,t.items[n]=s,P("ElementParse",s),t.items[n]},addGroup:function(e,n){var i=function(i){i.mfpEl=this,t._openClick(i,e,n)};n||(n={});var s="click.magnificPopupAU";n.mainEl=e,n.items?(n.isObj=!0,e.off(s).on(s,i)):(n.isObj=!1,n.delegate?e.off(s).on(s,n.delegate,i):(n.items=e,e.off(s).on(s,i)))},_openClick:function(n,i,s){var o=void 0!==s.midClick?s.midClick:e.magnificPopupAU.defaults.midClick;if(o||2!==n.which&&!n.ctrlKey&&!n.metaKey){var a=void 0!==s.disableOn?s.disableOn:e.magnificPopupAU.defaults.disableOn;if(a)if(e.isFunction(a)){if(!a.call(t))return!0}else if(O.width()<a)return!0;n.type&&(n.preventDefault(),t.isOpen&&n.stopPropagation()),s.el=e(n.mfpEl),s.delegate&&(s.items=i.find(s.delegate)),t.open(s)}},updateStatus:function(e,i){if(t.preloader){n!==e&&t.container.removeClass("ytc-mfp-s-"+n),i||"loading"!==e||(i=t.st.tLoading);var s={status:e,text:i};P("UpdateStatus",s),e=s.status,i=s.text,t.preloader.html(i),t.preloader.find("a").on("click",function(e){e.stopImmediatePropagation()}),t.container.addClass("ytc-mfp-s-"+e),n=e}},_checkIfClose:function(n){if(!e(n).hasClass(v)){var i=t.st.closeOnContentClick,s=t.st.closeOnBgClick;if(i&&s)return!0;if(!t.content||e(n).hasClass("ytc-mfp-close")||t.preloader&&n===t.preloader[0])return!0;if(n===t.content[0]||e.contains(t.content[0],n)){if(i)return!0}else if(s&&e.contains(document,n))return!0;return!1}},_addClassToMFP:function(e){t.bgOverlay.addClass(e),t.wrap.addClass(e)},_removeClassFromMFP:function(e){this.bgOverlay.removeClass(e),t.wrap.removeClass(e)},_hasScrollBar:function(e){return(t.isIE7?i.height():document.body.scrollHeight)>(e||O.height())},_setFocus:function(){(t.st.focus?t.content.find(t.st.focus).eq(0):t.wrap).focus()},_onFocusIn:function(n){return n.target===t.wrap[0]||e.contains(t.wrap[0],n.target)?void 0:(t._setFocus(),!1)},_parseMarkup:function(t,n,i){var s;i.data&&(n=e.extend(i.data,n)),P(d,[t,n,i]),e.each(n,function(e,n){if(void 0===n||n===!1)return!0;if(s=e.split("_"),s.length>1){var i=t.find(h+"-"+s[0]);if(i.length>0){var o=s[1];"replaceWith"===o?i[0]!==n[0]&&i.replaceWith(n):"img"===o?i.is("img")?i.attr("src",n):i.replaceWith('<img src="'+n+'" class="'+i.attr("class")+'" />'):i.attr(s[1],n)}}else t.find(h+"-"+e).html(n)})},_getScrollbarSize:function(){if(void 0===t.scrollbarSize){var e=document.createElement("div");e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),t.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return t.scrollbarSize}},e.magnificPopupAU={instance:null,proto:b.prototype,modules:[],open:function(t,n){return I(),t=t?e.extend(!0,{},t):{},t.isObj=!0,t.index=n||0,this.instance.open(t)},close:function(){return e.magnificPopupAU.instance&&e.magnificPopupAU.instance.close()},registerModule:function(t,n){n.options&&(e.magnificPopupAU.defaults[t]=n.options),e.extend(this.proto,n.proto),this.modules.push(t)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="ytc-mfp-close">&times;</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},e.fn.magnificPopupAU=function(n){I();var i=e(this);if("string"==typeof n)if("open"===n){var s,o=C?i.data("magnificPopupAU"):i[0].magnificPopupAU,a=parseInt(arguments[1],10)||0;o.items?s=o.items[a]:(s=i,o.delegate&&(s=s.find(o.delegate)),s=s.eq(a)),t._openClick({mfpEl:s},i,o)}else t.isOpen&&t[n].apply(t,Array.prototype.slice.call(arguments,1));else n=e.extend(!0,{},n),C?i.data("magnificPopupAU",n):i[0].magnificPopupAU=n,t.addGroup(i,n);return i};var T="iframe",A="//about:blank",_=function(e){if(t.currTemplate[T]){var n=t.currTemplate[T].find("iframe");n.length&&(e||(n[0].src=A),t.isIE8&&n.css("display",e?"block":"none"))}};e.magnificPopupAU.registerModule(T,{options:{markup:'<div class="ytc-mfp-iframe-scaler"><div class="ytc-mfp-close"></div><iframe class="ytc-mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",rel:"rel=",modestbranding:"modestbranding=",theme:"theme=",controls:"controls=",playsinline:"playsinline=",enhanceprivacy:"enhanceprivacy=",src:"//www.youtube.com/embed/%id%?autoplay=1&rel=%rel%&modestbranding=%modestbranding%&controls=%controls%&playsinline=%playsinline%"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){t.types.push(T),x("BeforeChange",function(e,t,n){t!==n&&(t===T?_():n===T&&_(!0))}),x(r+"."+T,function(){_()})},getIframe:function(n,i){var s=n.src,o=n.src,a=n.src,r=n.src,c=n.src,l=t.st.iframe;e.each(l.patterns,function(){return s.indexOf(this.index)>-1?(this.enhanceprivacy&&"string"==typeof this.enhanceprivacy&&s.indexOf(this.enhanceprivacy)>0&&(enhancePrivacy=s.substr(s.lastIndexOf(this.enhanceprivacy)+this.enhanceprivacy.length,s.length),enhancePrivacy.indexOf("&")>0&&(enhancePrivacy=enhancePrivacy.substr(0,enhancePrivacy.indexOf("&"))),1==enhancePrivacy&&this.src.indexOf("youtube.com")>0&&(this.src=this.src.replace("youtube.com","youtube-nocookie.com"))),this.id&&("string"==typeof this.id?(s=s.substr(s.lastIndexOf(this.id)+this.id.length,s.length),s.indexOf("&")>0&&(s=s.substr(0,s.indexOf("&")))):s=this.id.call(this,s)),this.rel&&("string"==typeof this.rel&&o.indexOf(this.rel)>0?(o=o.substr(o.lastIndexOf(this.rel)+this.rel.length,o.length),o.indexOf("&")>0&&(o=o.substr(0,o.indexOf("&")))):o="1"),this.modestbranding&&("string"==typeof this.modestbranding&&a.indexOf(this.modestbranding)>0?(a=a.substr(a.lastIndexOf(this.modestbranding)+this.modestbranding.length,a.length),a.indexOf("&")>0&&(a=a.substr(0,a.indexOf("&")))):a="0"),this.controls&&("string"==typeof this.controls&&r.indexOf(this.controls)>0?(r=r.substr(r.lastIndexOf(this.controls)+this.controls.length,r.length),r.indexOf("&")>0&&(r=r.substr(0,r.indexOf("&")))):r="1"),this.playsinline&&("string"==typeof this.playsinline&&c.indexOf(this.playsinline)>0?(c=c.substr(c.lastIndexOf(this.playsinline)+this.playsinline.length,c.length),c.indexOf("&")>0&&(c=c.substr(0,c.indexOf("&")))):c="0"),s=this.src.replace("%id%",s).replace("%rel%",o).replace("%modestbranding%",a).replace("%controls%",r).replace("%playsinline%",c),!1):void 0});var p={};return l.srcAction&&(p[l.srcAction]=s),t._parseMarkup(i,p,n),t.updateStatus("ready"),i}}}),I()});
inc/{settings_support.php → settings-support.php} RENAMED
File without changes
inc/settings-template.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ global $WPAU_YOUTUBE_CHANNEL;
3
+ ?>
4
+ <div class="wrap" id="youtube_channel_settings">
5
+ <p style="float:right;text-align:center;"><small>Support YTC developer</small><br><a href="http://urosevic.net/wordpress/donate/?donate_for=youtube-channel" target="_blank">Donate via PayPal</a></p>
6
+ <h2><?php _e( $WPAU_YOUTUBE_CHANNEL->plugin_name . ' Settings', 'youtube-channel' ); ?></h2>
7
+ <?php
8
+ $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general';
9
+
10
+ // define available tabs
11
+ $tabs = array(
12
+ 'general' => __( 'General', 'youtube-channel' ),
13
+ 'video' => __( 'Video', 'youtube-channel' ),
14
+ 'content' => __( 'Content', 'youtube-channel' ),
15
+ 'link' => __( 'Link to Channel', 'youtube-channel' ),
16
+ 'tools' => __( 'Tools', 'youtube-channel' ),
17
+ 'help' => __( 'Help', 'youtube-channel' ),
18
+ 'support' => __( 'Support', 'youtube-channel' ),
19
+ );
20
+ ?>
21
+ <h2 class="nav-tab-wrapper">
22
+ <?php
23
+ foreach ( $tabs as $tab_name => $tab_title ) {
24
+ echo '<a href="?page=' . $WPAU_YOUTUBE_CHANNEL->plugin_slug . '&tab=' . $tab_name . '" class="nav-tab' . ( ( $active_tab == $tab_name ) ? ' nav-tab-active' : '' ) . '">' . $tab_title . '</a>';
25
+ }
26
+ ?>
27
+ </h2>
28
+ <?php
29
+
30
+ if ( ! empty( $tabs[ $active_tab ] ) ) {
31
+
32
+ if ( ! in_array( $active_tab, array( 'tools', 'help', 'support' ) ) ) {
33
+ // for all tabs except tools and help
34
+
35
+ echo '<form method="post" action="options.php">';
36
+
37
+ settings_fields( 'ytc_' . $active_tab );
38
+ do_settings_sections( $WPAU_YOUTUBE_CHANNEL->plugin_slug . '_' . $active_tab );
39
+
40
+ submit_button();
41
+
42
+ echo '</form>';
43
+
44
+ } else if ( 'tools' == $active_tab ) {
45
+ include_once( 'settings-tools.php' );
46
+ } else if ( 'help' == $active_tab ) {
47
+ include_once( 'settings-usage.php' );
48
+ include_once( 'settings-usage-shortcode.php' );
49
+ } else if ( 'support' == $active_tab ) {
50
+ include_once( 'settings-support.php' );
51
+ } // $active_tab != 'tools|help|support'
52
+
53
+ } // ! empty ( $tabs[$active_tab] )
54
+ ?>
55
+
56
+ </div>
inc/{settings_tools.php → settings-tools.php} RENAMED
File without changes
inc/{settings_usage_shortcode.php → settings-usage-shortcode.php} RENAMED
File without changes
inc/{settings_usage.php → settings-usage.php} RENAMED
File without changes
inc/settings.php CHANGED
@@ -70,7 +70,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
70
  )
71
  ),
72
  'class' => 'regular-text password',
73
- 'value' => ! empty($this->defaults['apikey']) ? $this->defaults['apikey'] : '',
74
  ) // args
75
  );
76
  // Channel ID
@@ -311,7 +311,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
311
  __( 'YouTube Channel', 'youtube-channel' )
312
  ),
313
  'class' => 'checkbox',
314
- 'value' => $this->defaults['tinymce'],
315
  ) // args
316
  );
317
  // --- Register setting General so $_POST handling is done ---
@@ -455,7 +455,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
455
  'field' => $this->option_name . '[fullscreen]',
456
  'description' => __( 'Enable this option to make available Full Screen button for embedded playlists.', 'youtube-channel' ),
457
  'class' => 'checkbox',
458
- 'value' => $this->defaults['fullscreen'],
459
  ) // args
460
  );
461
 
@@ -969,7 +969,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
969
  }
970
 
971
  // Render the settings template
972
- require_once( 'settings_template.php' );
973
 
974
  } // eom plugin_settings_page()
975
 
70
  )
71
  ),
72
  'class' => 'regular-text password',
73
+ 'value' => isset( $this->defaults['apikey'] ) ? $this->defaults['apikey'] : '',
74
  ) // args
75
  );
76
  // Channel ID
311
  __( 'YouTube Channel', 'youtube-channel' )
312
  ),
313
  'class' => 'checkbox',
314
+ 'value' => isset( $this->defaults['tinymce'] ) ? $this->defaults['tinymce'] : false,
315
  ) // args
316
  );
317
  // --- Register setting General so $_POST handling is done ---
455
  'field' => $this->option_name . '[fullscreen]',
456
  'description' => __( 'Enable this option to make available Full Screen button for embedded playlists.', 'youtube-channel' ),
457
  'class' => 'checkbox',
458
+ 'value' => isset( $this->defaults['fullscreen'] ) ? $this->defaults['fullscreen'] : false,
459
  ) // args
460
  );
461
 
969
  }
970
 
971
  // Render the settings template
972
+ require_once( 'settings-template.php' );
973
 
974
  } // eom plugin_settings_page()
975
 
inc/settings_template.php DELETED
@@ -1,61 +0,0 @@
1
- <?php
2
- global $WPAU_YOUTUBE_CHANNEL;
3
- ?>
4
- <div class="wrap" id="youtube_channel_settings">
5
- <p style="float:right;text-align:center;"><small>Support YTC developer</small><br><a href="http://urosevic.net/wordpress/donate/?donate_for=youtube-channel" target="_blank">Donate via PayPal</a></p>
6
- <h2><?php _e( $WPAU_YOUTUBE_CHANNEL->plugin_name . ' Settings', 'youtube-channel' ); ?></h2>
7
- <?php
8
-
9
- $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'general';
10
-
11
- // define available tabs
12
- $tabs = array(
13
- 'general' => __('General', 'youtube-channel'),
14
- 'video' => __('Video', 'youtube-channel'),
15
- 'content' => __('Content', 'youtube-channel'),
16
- 'link' => __('Link to Channel', 'youtube-channel'),
17
- 'tools' => __('Tools', 'youtube-channel'),
18
- 'help' => __('Help', 'youtube-channel'),
19
- 'support' => __('Support', 'youtube-channel')
20
- );
21
- ?>
22
- <h2 class="nav-tab-wrapper">
23
- <?php
24
- foreach ( $tabs as $tab_name => $tab_title ) {
25
- echo '<a href="?page=' . $WPAU_YOUTUBE_CHANNEL->plugin_slug . '&tab=' . $tab_name . '" class="nav-tab' . ( ( $active_tab == $tab_name ) ? ' nav-tab-active' : '' ) . '">' . $tab_title . '</a>';
26
- }
27
- ?>
28
- </h2>
29
- <?php
30
-
31
- if ( ! empty($tabs[ $active_tab ]) ) {
32
-
33
- if ( ! in_array( $active_tab, array('tools', 'help', 'support') ) ) {
34
- // for all tabs except tools and help
35
-
36
- echo '<form method="post" action="options.php">';
37
-
38
- settings_fields( 'ytc_' . $active_tab );
39
- // settings_fields( $WPAU_YOUTUBE_CHANNEL->plugin_slug . '_' . $active_tab );
40
- do_settings_sections( $WPAU_YOUTUBE_CHANNEL->plugin_slug . '_' . $active_tab );
41
- // do_settings_sections( 'ytc_' . $active_tab );
42
- // settings_fields( $WPAU_YOUTUBE_CHANNEL->plugin_slug . '_' . $active_tab );
43
- // do_settings_sections( $WPAU_YOUTUBE_CHANNEL->plugin_slug . '_' . $active_tab );
44
-
45
- submit_button();
46
-
47
- echo '</form>';
48
-
49
- } else if ( $active_tab == 'tools' ) {
50
- include_once("settings_tools.php");
51
- } else if ( $active_tab == 'help' ) {
52
- include_once("settings_usage.php");
53
- include_once("settings_usage_shortcode.php");
54
- } else if ( $active_tab == 'support' ) {
55
- include_once("settings_support.php");
56
- } // $active_tab != 'tools|help|support'
57
-
58
- } // ! empty ( $tabs[$active_tab] )
59
- ?>
60
-
61
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/youtube-channel-sr_RS.mo CHANGED
Binary file
languages/youtube-channel-sr_RS.po CHANGED
@@ -2,7 +2,7 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: YouTube Channel\n"
4
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/youtube-channel\n"
5
- "POT-Creation-Date: 2015-06-19 21:18+0100\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Aleksandar Urošević <urke.kg@gmail.com>\n"
8
  "Language-Team: Aleksandar Urosevic <urke.kg@gmail.com>\n"
@@ -14,211 +14,312 @@ msgstr ""
14
  "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
15
  "X-Poedit-KeywordsList: __;_e\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
- "X-Generator: Poedit 1.8.1\n"
18
- "X-Poedit-Basepath: ..\\\n"
19
  "X-Poedit-SearchPath-0: languages\n"
20
  "X-Poedit-SearchPath-1: .\n"
21
 
22
- #: inc/settings.php:38 inc/settings_template.php:14
23
- #: inc/settings_usage_shortcode.php:104
 
 
 
 
24
  msgid "General"
25
  msgstr "Опште"
26
 
27
- #: inc/settings.php:46 youtube-channel.php:316
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  msgid "YouTube Data API Key"
29
  msgstr "Јутјуб АПИ кључ за податке"
30
 
31
- #: inc/settings.php:54 inc/settings.php:86
32
  msgid "Required"
33
  msgstr "Обавезно"
34
 
35
  #: inc/settings.php:58
36
  #, php-format
37
  msgid ""
38
- "Your YouTube Data API Key (get it from <a href=\"%s\" target=\"_blank\">%s</"
39
- "a>)"
40
  msgstr ""
41
- "Ваш АПИ кључ за Јутјуб податке (пронађите га на <a href=\"%s\" target="
42
- "\"_blank\">%s</a>)"
43
 
44
- #: inc/settings.php:68 youtube-channel.php:318
45
  msgid "Google Developers Console"
46
  msgstr "Гугловој страници за програмере"
47
 
48
- #: inc/settings.php:78
49
  msgid "YouTube Channel ID"
50
  msgstr "ИД канала"
51
 
52
- #: inc/settings.php:90
53
  #, php-format
54
  msgid ""
55
- "Your YouTube Channel ID (get it from <a href=\"%s\" target=\"_blank\">%s</a>)"
 
56
  msgstr ""
57
- "Ваш ИД Јутјуб канала (пронађите га на <a href=\"%s\" target=\"_blank\">%s</"
58
- "a>)"
59
 
60
- #: inc/settings.php:100 inc/settings.php:132 inc/settings.php:718
61
  msgid "YouTube Account Overview"
62
  msgstr "Преглед подешавања канала"
63
 
64
- #: inc/settings.php:110
65
  msgid "YouTube Vanity Name"
66
  msgstr "Прилагођено име"
67
 
68
- #: inc/settings.php:118 inc/settings.php:150 inc/settings.php:168
69
  msgid "Optional"
70
  msgstr "Није обавезно"
71
 
72
- #: inc/settings.php:122
73
  #, php-format
74
  msgid ""
75
- "Your YouTube Custom Name (get only part after www.youtube.com/c/ instead "
76
- "whole URL from <a href=\"%s\" target=\"_blank\">%s</a>)"
77
  msgstr ""
78
- "Ваше Прилагођено име (само део иза www.youtube.com/c/ а не целу адресу са "
79
- "странице <a href=\"%s\" target=\"_blank\">%s</a>)"
80
 
81
- #: inc/settings.php:142
82
  msgid "Legacy YouTube Username"
83
  msgstr "Старо корисничко име"
84
 
85
- #: inc/settings.php:151
86
  msgid "Your YouTube legacy username"
87
  msgstr "Ваше старо корисничко име за Јутјуб"
88
 
89
- #: inc/settings.php:160
90
  msgid "Default Playlist ID"
91
  msgstr "ИД подразумеване плејлисте"
92
 
93
- #: inc/settings.php:169
94
  msgid "Enter default playlist ID (not playlist name)"
95
  msgstr "Унесите подразумевани ИД плеј листе (не назив)"
96
 
97
- #: inc/settings.php:178 inc/widget.php:134
98
  msgid "Resource to use"
99
  msgstr "Користи ресурс"
100
 
101
- #: inc/settings.php:184
102
  msgid "Resource:"
103
  msgstr "Извор:"
104
 
105
- #: inc/settings.php:185
106
  msgid "What to use as resource for feeds"
107
  msgstr "Шта користити као извор довода"
108
 
109
- #: inc/settings.php:189
110
  msgid "Channel"
111
  msgstr "Канал"
112
 
113
- #: inc/settings.php:190 inc/widget.php:137
114
  msgid "Favourites"
115
  msgstr "Омиљени"
116
 
117
- #: inc/settings.php:191
118
  msgid "Liked Video"
119
  msgstr "Свидело вам се"
120
 
121
- #: inc/settings.php:192 inc/widget.php:139
122
  msgid "Playlist"
123
  msgstr "Плеј листа"
124
 
125
- #: inc/settings.php:199
126
  msgid "Cache Timeout"
127
  msgstr "Трајање кеша"
128
 
129
- #: inc/settings.php:205
130
  msgid "Define caching timeout for YouTube feeds, in seconds"
131
  msgstr "Одредите трајање кеша Јутјуб довода у секундама"
132
 
133
- #: inc/settings.php:209
134
  msgid "Do not chache"
135
  msgstr "Без кеширања"
136
 
137
- #: inc/settings.php:210 youtube-channel.php:1273
138
  msgid "1 minute"
139
  msgstr "1 минут"
140
 
141
- #: inc/settings.php:211 youtube-channel.php:1274
142
  msgid "5 minutes"
143
  msgstr "5 минута"
144
 
145
- #: inc/settings.php:212 youtube-channel.php:1275
146
  msgid "15 minutes"
147
  msgstr "15 минута"
148
 
149
- #: inc/settings.php:213 youtube-channel.php:1276
150
  msgid "30 minutes"
151
  msgstr "30 минута"
152
 
153
- #: inc/settings.php:214 youtube-channel.php:1279
154
  msgid "1 hour"
155
  msgstr "1 сат"
156
 
157
- #: inc/settings.php:215 youtube-channel.php:1280
158
  msgid "2 hours"
159
  msgstr "2 сата"
160
 
161
- #: inc/settings.php:216 youtube-channel.php:1281
162
  msgid "5 hours"
163
  msgstr "5 сати"
164
 
165
- #: inc/settings.php:217 youtube-channel.php:1282
166
  msgid "10 hours"
167
  msgstr "10 сати"
168
 
169
- #: inc/settings.php:218 youtube-channel.php:1283
170
  msgid "12 hours"
171
  msgstr "12 сати"
172
 
173
- #: inc/settings.php:219 youtube-channel.php:1284
174
  msgid "18 hours"
175
  msgstr "18 сати"
176
 
177
- #: inc/settings.php:220 youtube-channel.php:1287
178
  msgid "1 day"
179
  msgstr "1 дан"
180
 
181
- #: inc/settings.php:221 youtube-channel.php:1288
182
  msgid "2 days"
183
  msgstr "2 дана"
184
 
185
- #: inc/settings.php:222 youtube-channel.php:1289
186
  msgid "3 days"
187
  msgstr "3 дана"
188
 
189
- #: inc/settings.php:223 youtube-channel.php:1290
190
  msgid "4 days"
191
  msgstr "4 дана"
192
 
193
- #: inc/settings.php:224 youtube-channel.php:1291
194
  msgid "5 days"
195
  msgstr "5 дана"
196
 
197
- #: inc/settings.php:225 youtube-channel.php:1292
198
  msgid "6 days"
199
  msgstr "6 дана"
200
 
201
- #: inc/settings.php:226 youtube-channel.php:1295
202
  msgid "1 week"
203
  msgstr "1 недеља"
204
 
205
- #: inc/settings.php:227 youtube-channel.php:1296
206
  msgid "2 weeks"
207
  msgstr "2 недеље"
208
 
209
- #: inc/settings.php:228 youtube-channel.php:1297
210
  msgid "3 weeks"
211
  msgstr "3 недеље"
212
 
213
- #: inc/settings.php:229 youtube-channel.php:1298
214
  msgid "1 month"
215
  msgstr "1 месец"
216
 
217
- #: inc/settings.php:236 inc/widget.php:152
218
  msgid "Fetch"
219
  msgstr "Добави из ресурса"
220
 
221
- #: inc/settings.php:242 inc/widget.php:152
222
  msgid ""
223
  "Number of videos that will be used for random pick (min 2, max 50, default "
224
  "25)"
@@ -226,168 +327,187 @@ msgstr ""
226
  "Број видеа од којих ће бити одабран насумични (најмање 2, највише 50, "
227
  "подразумевано 25)"
228
 
229
- #: inc/settings.php:253 inc/widget.php:155
230
  msgid "Show"
231
  msgstr "Прикажи"
232
 
233
- #: inc/settings.php:259 inc/widget.php:155
234
  msgid "Number of videos to display"
235
  msgstr "Број видеа за приказ"
236
 
237
- #: inc/settings.php:270
238
  msgid "Use Enhanced privacy"
239
  msgstr "Побољшана приватност"
240
 
241
- #: inc/settings.php:279
242
  #, php-format
243
  msgid ""
244
- "Enable this option to protect your visitors privacy. <a href=\"%s\" target="
245
- "\"_blank\">%s</a>"
246
  msgstr ""
247
- "Омогућите ову опцију да би заштитили приватност Ваших посетилаца. <a href="
248
- "\"%s\" target=\"_blank\">%s</a>"
249
 
250
- #: inc/settings.php:289
251
  msgid "Learn more here"
252
  msgstr "Сазнајте више"
253
 
254
- #: inc/settings.php:306
 
 
 
 
 
 
 
 
 
 
 
255
  msgid "Video Tweaks"
256
  msgstr "Поставке видеа"
257
 
258
- #: inc/settings.php:314
259
  msgid "Initial Width"
260
  msgstr "Почетна ширина"
261
 
262
- #: inc/settings.php:320
263
  msgid "Set default width for displayed video, in pixels"
264
  msgstr "Одредите подразумевану ширину видеа у пикселима"
265
 
266
- #: inc/settings.php:331 inc/widget.php:164
267
  msgid "Aspect ratio"
268
  msgstr "Размера"
269
 
270
- #: inc/settings.php:338
271
  msgid "Select aspect ratio for displayed video"
272
  msgstr "Одаберите размеру приказаног видеа"
273
 
274
- #: inc/settings.php:350
275
  msgid "What to show?"
276
  msgstr "Шта приказати?"
277
 
278
- #: inc/settings.php:356
279
  msgid "Choose how to embed video block"
280
  msgstr "Одаберите како да се угради блок"
281
 
282
- #: inc/settings.php:360 inc/widget.php:179
283
  msgid "Thumbnail"
284
  msgstr "Сличица"
285
 
286
- #: inc/settings.php:361 inc/widget.php:180
287
  msgid "HTML5 (iframe)"
288
  msgstr "HTML5 (iframe)"
289
 
290
- #: inc/settings.php:362 inc/widget.php:181
291
  msgid "HTML5 (iframe) Asynchronous"
292
  msgstr "HTML5 (iframe) Asynchronous"
293
 
294
- #: inc/settings.php:363 inc/widget.php:182
295
  msgid "Embedded Playlist"
296
  msgstr "Уграђена плеј листа"
297
 
298
- #: inc/settings.php:371
299
  msgid "Enable Responsive"
300
  msgstr "Омогући респонзивност"
301
 
302
- #: inc/settings.php:377
303
  msgid ""
304
  "Enable this option to make YTC videos and thumbnails responsive by default. "
305
  "Please note, this option will set videos and thumbnail to full width "
306
  "relative to parent container, and disable more than one video per row."
307
  msgstr ""
308
 
309
- #: inc/settings.php:386
310
  msgid "Play inline on iOS"
311
  msgstr "Репродукција на страници за iOS"
312
 
313
- #: inc/settings.php:394
314
  #, php-format
315
  msgid ""
316
  "Enable this option to override fullscreen playback on iOS, and force inline "
317
- "playback on page and in lightbox. Learn more <a href=\"%s\">here</a>."
318
  msgstr ""
319
 
320
- #: inc/settings.php:406
321
  msgid "Disable Lightbox"
322
  msgstr "Онемогући искачући прозорчић"
323
 
324
- #: inc/settings.php:412
325
  msgid ""
326
  "Enable this option to disable built-in lightbox for thumbnails (in case that "
327
  "you have youtube links lightbox trigger in theme or other plugin)."
328
  msgstr ""
329
 
330
- #: inc/settings.php:421
 
 
 
 
 
 
 
 
 
 
331
  msgid "Light Theme"
332
  msgstr "Светла тема"
333
 
334
- #: inc/settings.php:427
335
  msgid ""
336
  "Enable this option to use light theme for playback controls instead dark."
337
  msgstr ""
338
 
339
- #: inc/settings.php:435
340
  msgid "Hide Player Controls"
341
  msgstr "Сакриј контроле за репродукцију"
342
 
343
- #: inc/settings.php:441
344
  msgid "Enable this option to hide playback controls"
345
  msgstr "Омогућите ову опцију да би сакрили контроле за репродукцију"
346
 
347
- #: inc/settings.php:450 inc/widget.php:187
348
  msgid "Autoplay video or playlist"
349
  msgstr "Аутоматски репродукуј видео или плеј листу"
350
 
351
- #: inc/settings.php:456
352
  msgid ""
353
  "Enable this option to start video playback right after block is rendered"
354
  msgstr ""
355
 
356
- #: inc/settings.php:464 inc/widget.php:188
357
  msgid "Mute video on autoplay"
358
  msgstr "Искључи звук при аутоматској репродукцији"
359
 
360
- #: inc/settings.php:470
361
  msgid "Enable this option to mute video when start autoplay"
362
  msgstr ""
363
  "Омогућите ову опцију да би искључити звук када започне аутоматска "
364
  "репродукција"
365
 
366
- #: inc/settings.php:478 inc/widget.php:189
367
  msgid "Hide related videos"
368
  msgstr "Сакриј повезане видео записе"
369
 
370
- #: inc/settings.php:484
371
  msgid "Enable this option to hide related videos after finished playback"
372
  msgstr ""
373
  "Омогућите ову опцију да би сакрили релевантне видео записе након завршетка "
374
  "репродукције"
375
 
376
- #: inc/settings.php:492
377
  msgid "Hide YT logo"
378
  msgstr "Сакриј Јутјуб логотип"
379
 
380
- #: inc/settings.php:498
381
  msgid ""
382
  "Enable this option to hide YouTube logo from playback control bar. Does not "
383
  "work for all videos."
384
  msgstr ""
385
 
386
- #: inc/settings.php:506
387
  msgid "Hide video annotations"
388
  msgstr "Сакриј видео прибелешке"
389
 
390
- #: inc/settings.php:512
391
  msgid ""
392
  "Enable this option to hide video annotations (custom text set by uploader "
393
  "over video during playback)"
@@ -395,11 +515,11 @@ msgstr ""
395
  "Омогућите ову опцију да би сакрили видео прибелешке (текст постављен преко "
396
  "слике видеа током репродукције)"
397
 
398
- #: inc/settings.php:520 inc/widget.php:213
399
  msgid "Hide video info"
400
  msgstr "Сакриј информације о видео запису"
401
 
402
- #: inc/settings.php:526
403
  msgid ""
404
  "Enable this option to hide informations about video before play start (video "
405
  "title and uploader in overlay)"
@@ -407,111 +527,99 @@ msgstr ""
407
  "Омогућите ову опцију да би сакрили информације о видео запису пре него што "
408
  "започен репродукција (наслов видео записа и аутора)"
409
 
410
- #: inc/settings.php:542
411
  msgid "Content Tweaks"
412
  msgstr "Поставке садржаја"
413
 
414
- #: inc/settings.php:550 inc/widget.php:196
415
  msgid "Show video title"
416
  msgstr "Прикажи наслов видео записа"
417
 
418
- #: inc/settings.php:556
419
  msgid "Select should we and where display title of video"
420
  msgstr "Одаберите да ли треба и када приказати наслов видеа"
421
 
422
- #: inc/settings.php:560 inc/widget.php:199
423
  msgid "Hide title"
424
  msgstr "Сакриј наслов"
425
 
426
- #: inc/settings.php:561 inc/widget.php:200
427
  msgid "Above video/thumbnail"
428
  msgstr "Изнад видеа"
429
 
430
- #: inc/settings.php:562 inc/widget.php:201
431
  msgid "Below video/thumbnail"
432
  msgstr "Испод видеа"
433
 
434
- #: inc/settings.php:569 inc/widget.php:204
435
  msgid "Show video description"
436
  msgstr "Прикажи опис видео записа"
437
 
438
- #: inc/settings.php:575
439
  msgid "Enable this option to display description for video"
440
  msgstr "Омогућите ову опцију да би приказали опис видео записа"
441
 
442
- #: inc/settings.php:583 inc/widget.php:206
443
  msgid "Description length"
444
  msgstr "Дужина описа"
445
 
446
- #: inc/settings.php:589
447
  msgid "Enter length for video description in characters (0 for full length)"
448
  msgstr "Унесите дужину описа видео записа у знаковима (0 за цео опис)"
449
 
450
- #: inc/settings.php:609 inc/settings_template.php:17
451
- #: inc/settings_usage_shortcode.php:15 inc/settings_usage_shortcode.php:107
452
- #: inc/widget.php:217
453
- msgid "Link to Channel"
454
- msgstr "Веза до канала"
455
-
456
- #: inc/settings.php:617
457
  msgid "Link to..."
458
  msgstr "Повежи са..."
459
 
460
- #: inc/settings.php:624
461
  msgid "Set where link will lead visitors"
462
  msgstr "Одредите где ће веза да одведе посетиоца"
463
 
464
- #: inc/settings.php:628 inc/widget.php:223
465
  msgid "Hide link"
466
  msgstr "Сакриј везу"
467
 
468
- #: inc/settings.php:629
469
  msgid "Vanity custom URL"
470
  msgstr "Прилагођена адреса"
471
 
472
- #: inc/settings.php:630
473
  msgid "Channel page URL"
474
  msgstr "Страница канала"
475
 
476
- #: inc/settings.php:631
477
  msgid "Legacy username page"
478
  msgstr "Старо корисничко име"
479
 
480
- #: inc/settings.php:638
481
  msgid "Open link in..."
482
  msgstr "Отвори везу у..."
483
 
484
- #: inc/settings.php:645
485
  msgid "Set where link will be opened"
486
  msgstr "Одредите како ће веза бити отворена"
487
 
488
- #: inc/settings.php:649
489
  msgid "same window"
490
  msgstr "исти прозор"
491
 
492
- #: inc/settings.php:650
493
  msgid "new window (JavaScript)"
494
  msgstr "нови прозор (ЈаваСкрипт)"
495
 
496
- #: inc/settings.php:651
497
  msgid "new window (target=\"_blank\")"
498
  msgstr "нови прозор (target=\"_blank\")"
499
 
500
- #: inc/settings.php:658
501
  msgid "Text for Visit channel link"
502
  msgstr "Текст за везу \"Посети канал\""
503
 
504
- #: inc/settings.php:665
505
  msgid "Set default title for link"
506
  msgstr "Поставите подразумевани текст за везу"
507
 
508
- #: inc/settings.php:686 inc/settings.php:687 inc/settings.php:714
509
- #: inc/settings.php:728 inc/settings.php:738 inc/settings.php:748
510
- #: inc/settings_usage_shortcode.php:115 inc/widget.php:11
511
- msgid "YouTube Channel"
512
- msgstr ""
513
-
514
- #: inc/settings.php:704
515
  #, php-format
516
  msgid ""
517
  "Configure general defaults for %1$s used as fallback options in widget or "
@@ -523,15 +631,15 @@ msgstr ""
523
  "шорткода. Да сазнате %2$s и %3$s посетите <a href=\"%4$s\" target=\"_blank\">"
524
  "%5$s</a>."
525
 
526
- #: inc/settings.php:715 inc/widget.php:108 inc/widget.php:119
527
  msgid "Channel ID"
528
  msgstr "ИД канала"
529
 
530
- #: inc/settings.php:716
531
  msgid "Vanity URL"
532
  msgstr "Прилагођени URL"
533
 
534
- #: inc/settings.php:727
535
  #, php-format
536
  msgid ""
537
  "Configure video specific defaults for %s used as fallback options in widget "
@@ -540,7 +648,7 @@ msgstr ""
540
  "Поставите подразумевана подешавања специфична за видео које ће бити "
541
  "искоришћене од стране %s приликом прављења новог виџета или шорткода."
542
 
543
- #: inc/settings.php:737
544
  #, php-format
545
  msgid ""
546
  "Configure defaults of content around and over videos for %s used as fallback "
@@ -550,7 +658,7 @@ msgstr ""
550
  "поставке ће бити употребљене као подразумеване вредности приликом прављења "
551
  "новог виџета или шорткода."
552
 
553
- #: inc/settings.php:747
554
  #, php-format
555
  msgid ""
556
  "Configure defaults for link to channel below %s block used as fallback "
@@ -560,104 +668,10 @@ msgstr ""
560
  "поставке ће бити употребљене као подразумеване вредности приликом прављења "
561
  "новог виџета или шорткода."
562
 
563
- #: inc/settings.php:908
564
  msgid "You do not have sufficient permissions to access this page."
565
  msgstr "Немате одговарајуће привилегије да би приступили овој страници."
566
 
567
- #: inc/settings_template.php:6
568
- msgid " Settings"
569
- msgstr "Поставке"
570
-
571
- #: inc/settings_template.php:15 inc/settings_usage_shortcode.php:105
572
- msgid "Video"
573
- msgstr "Видео"
574
-
575
- #: inc/settings_template.php:16 inc/settings_usage_shortcode.php:106
576
- msgid "Content"
577
- msgstr "Садржај"
578
-
579
- #: inc/settings_template.php:18
580
- msgid "Tools"
581
- msgstr "Алатке"
582
-
583
- #: inc/settings_template.php:19
584
- msgid "Help"
585
- msgstr "Помоћ"
586
-
587
- #: inc/settings_template.php:20 youtube-channel.php:201
588
- msgid "Support"
589
- msgstr "Подршка"
590
-
591
- #: inc/settings_usage.php:1
592
- msgid "How to use YouTube Channel"
593
- msgstr "Како се користи YouTube Channel"
594
-
595
- #: inc/settings_usage.php:2
596
- msgid "You can insert YouTube Channel in couple different ways."
597
- msgstr "YouTube Channel можете да уметнете на два начина."
598
-
599
- #: inc/settings_usage.php:7
600
- #, php-format
601
- msgid "Add %s to preferred %s, and configure it there."
602
- msgstr "Додајте %s у жељену %s, и подесите опције у виџету."
603
-
604
- #: inc/settings_usage.php:10
605
- msgid "YouTube Channel Widget"
606
- msgstr "виџет YouTube Channel"
607
-
608
- #: inc/settings_usage.php:13
609
- msgid "Widget Area"
610
- msgstr ""
611
-
612
- #: inc/settings_usage.php:19
613
- #, php-format
614
- msgid ""
615
- "Insert shortcode %s to your page or text widget, and even modify default "
616
- "settings by shortcode parameters listed in section below."
617
- msgstr ""
618
- "Уметните шорткод %s у садржај странице или виџета, па чак и измените "
619
- "подразумеване поставке додатка помоћу параметара шорткода наведених у "
620
- "секцији испод."
621
-
622
- #: inc/settings_usage_shortcode.php:1
623
- msgid "How to use shortcode"
624
- msgstr "Како да користите шорткод"
625
-
626
- #: inc/settings_usage_shortcode.php:5
627
- #, php-format
628
- msgid ""
629
- "You can use shortcode %s with options listed below (all options are optional "
630
- "if you have set defaults in global plugin settings)."
631
- msgstr ""
632
-
633
- #: inc/settings_usage_shortcode.php:12 youtube-channel.php:321
634
- msgid "General Settings"
635
- msgstr "Опште поставке"
636
-
637
- #: inc/settings_usage_shortcode.php:13 inc/widget.php:163
638
- msgid "Video Settings"
639
- msgstr "Поставке видео записа"
640
-
641
- #: inc/settings_usage_shortcode.php:14 inc/widget.php:193
642
- msgid "Content Layout"
643
- msgstr "Садржај"
644
-
645
- #: inc/settings_usage_shortcode.php:101
646
- #, php-format
647
- msgid ""
648
- "Please note, you can omit all options listed above, and then will be used "
649
- "plugin defaults customized on tabs %1$s, %2$s, %3$s and %4$s."
650
- msgstr ""
651
- "Обратите пажњу да можете изоставити све опције наведене изнад, и тада ће "
652
- "бити употребљене подразумеване опције постављене на картицама %1$s, %2$s, "
653
- "%3$s и %4$s."
654
-
655
- #: inc/settings_usage_shortcode.php:112
656
- #, php-format
657
- msgid ""
658
- "Important note: %s blocks inserted through widget have their own settings."
659
- msgstr ""
660
-
661
  #: inc/widget.php:14
662
  msgid "Serve YouTube videos from channel or playlist right to widget area"
663
  msgstr "Приказ видео записа са Јутјуб канала или плеј листе"
@@ -820,7 +834,7 @@ msgid ""
820
  "%channel% and %username%."
821
  msgstr ""
822
 
823
- #: inc/widget.php:219 youtube-channel.php:1043
824
  msgid "Visit our YouTube channel"
825
  msgstr "Посетите наш Јутјуб канал"
826
 
@@ -871,11 +885,11 @@ msgstr ""
871
  msgid "FAQ"
872
  msgstr "често постављана питања"
873
 
874
- #: youtube-channel.php:179
875
  msgid "Settings"
876
  msgstr "Поставке"
877
 
878
- #: youtube-channel.php:280
879
  #, php-format
880
  msgid ""
881
  "<p>Your website running on web server with PHP version %s. Please note that "
@@ -883,7 +897,7 @@ msgid ""
883
  "href=\"%s\" class=\"dismiss\">Dismiss</a></p>"
884
  msgstr ""
885
 
886
- #: youtube-channel.php:293
887
  #, php-format
888
  msgid ""
889
  "<p>Since <strong>%s</strong> v3.0.6 we store <strong>YouTube Data API Key</"
@@ -892,7 +906,7 @@ msgid ""
892
  "\">Dismiss</a></p>"
893
  msgstr ""
894
 
895
- #: youtube-channel.php:305
896
  #, php-format
897
  msgid ""
898
  "<p>Please note, to make <strong>%1$s</strong> plugin v3+ work, generate "
@@ -904,11 +918,11 @@ msgid ""
904
  "mentioned above!</p>"
905
  msgstr ""
906
 
907
- #: youtube-channel.php:323
908
  msgid "support forum"
909
  msgstr "форум за подршку"
910
 
911
- #: youtube-channel.php:332
912
  #, php-format
913
  msgid ""
914
  "<p><strong>%s</strong> since version 2.4 supports linking to channel through "
@@ -917,7 +931,7 @@ msgid ""
917
  "a>"
918
  msgstr ""
919
 
920
- #: youtube-channel.php:346
921
  #, php-format
922
  msgid ""
923
  "<p><strong>%s</strong> changed shortcode parameters by removing "
@@ -927,21 +941,21 @@ msgid ""
927
  "<a href=\"%s\" class=\"dismiss\">Dismiss</a>"
928
  msgstr ""
929
 
930
- #: youtube-channel.php:609
931
  #, php-format
932
  msgid ""
933
  "<strong>%s</strong> version 3+ requires <strong>YouTube DATA API Key</"
934
  "strong> to work. <a href=\"%s\" target=\"_blank\">Learn more here</a>."
935
  msgstr ""
936
 
937
- #: youtube-channel.php:782
938
  #, php-format
939
  msgid ""
940
  "You have set to display videos from %s [resource list ID: %s], but there "
941
  "have no public videos in that resouce."
942
  msgstr ""
943
 
944
- #: youtube-channel.php:786
945
  #, php-format
946
  msgid ""
947
  "We have empty record for this feed. Please read <a href=\"%s\" target="
@@ -949,7 +963,7 @@ msgid ""
949
  "\"_blank\">support</a>."
950
  msgstr ""
951
 
952
- #: youtube-channel.php:828
953
  #, php-format
954
  msgid ""
955
  "Double check <em>YouTube Data API Key</em> on <em>General</em> plugin tab "
@@ -957,33 +971,61 @@ msgid ""
957
  "\">Installation</a> document."
958
  msgstr ""
959
 
960
- #: youtube-channel.php:836
961
  #, php-format
962
  msgid ""
963
  "You have set wrong Channel ID. Fix that in General plugin settings, Widget "
964
  "and/or shortcode. Read <a href=\"%s\" target=\"_blank\">FAQ</a> document."
965
  msgstr ""
966
 
967
- #: youtube-channel.php:840
968
  #, php-format
969
  msgid ""
970
  "You do not have permission to access ressource <strong>%s</strong> (it's "
971
  "maybe set to private or even does not exists!)"
972
  msgstr ""
973
 
974
- #: youtube-channel.php:964
975
  msgid "Oops, something went wrong."
976
  msgstr "Извините, нешто не функционише како треба."
977
 
978
- #: youtube-channel.php:1046
979
  msgid "in new window/tab"
980
  msgstr "у новом прозору"
981
 
982
- #: youtube-channel.php:1198
983
  #, php-format
984
  msgid "Watch video %1$s published on %2$s"
985
  msgstr "Гледај видео %1$s објављен на %2$s"
986
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
987
  #~ msgid ""
988
  #~ "Carefully read <a href=\"%s\" target=\"_faq\">FAQ</a> before you contact "
989
  #~ "us. If that does not help, <a href=\"%s\" target=\"_blank\">get JSON "
2
  msgstr ""
3
  "Project-Id-Version: YouTube Channel\n"
4
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/youtube-channel\n"
5
+ "POT-Creation-Date: 2015-10-03 01:17+0200\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Aleksandar Urošević <urke.kg@gmail.com>\n"
8
  "Language-Team: Aleksandar Urosevic <urke.kg@gmail.com>\n"
14
  "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
15
  "X-Poedit-KeywordsList: __;_e\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Generator: Poedit 1.8.5\n"
18
+ "X-Poedit-Basepath: ..\n"
19
  "X-Poedit-SearchPath-0: languages\n"
20
  "X-Poedit-SearchPath-1: .\n"
21
 
22
+ #: inc/settings-template.php:6
23
+ msgid " Settings"
24
+ msgstr "Поставке"
25
+
26
+ #: inc/settings-template.php:12 inc/settings-usage-shortcode.php:104
27
+ #: inc/settings.php:38
28
  msgid "General"
29
  msgstr "Опште"
30
 
31
+ #: inc/settings-template.php:13 inc/settings-usage-shortcode.php:105
32
+ msgid "Video"
33
+ msgstr "Видео"
34
+
35
+ #: inc/settings-template.php:14 inc/settings-usage-shortcode.php:106
36
+ msgid "Content"
37
+ msgstr "Садржај"
38
+
39
+ #: inc/settings-template.php:15 inc/settings-usage-shortcode.php:15
40
+ #: inc/settings-usage-shortcode.php:107 inc/settings.php:653 inc/widget.php:217
41
+ msgid "Link to Channel"
42
+ msgstr "Веза до канала"
43
+
44
+ #: inc/settings-template.php:16
45
+ msgid "Tools"
46
+ msgstr "Алатке"
47
+
48
+ #: inc/settings-template.php:17
49
+ msgid "Help"
50
+ msgstr "Помоћ"
51
+
52
+ #: inc/settings-template.php:18 youtube-channel.php:208
53
+ msgid "Support"
54
+ msgstr "Подршка"
55
+
56
+ #: inc/settings-usage-shortcode.php:1
57
+ msgid "How to use shortcode"
58
+ msgstr "Како да користите шорткод"
59
+
60
+ #: inc/settings-usage-shortcode.php:5
61
+ #, php-format
62
+ msgid ""
63
+ "You can use shortcode %s with options listed below (all options are optional "
64
+ "if you have set defaults in global plugin settings)."
65
+ msgstr ""
66
+
67
+ #: inc/settings-usage-shortcode.php:12 youtube-channel.php:334
68
+ msgid "General Settings"
69
+ msgstr "Опште поставке"
70
+
71
+ #: inc/settings-usage-shortcode.php:13 inc/widget.php:163
72
+ msgid "Video Settings"
73
+ msgstr "Поставке видео записа"
74
+
75
+ #: inc/settings-usage-shortcode.php:14 inc/widget.php:193
76
+ msgid "Content Layout"
77
+ msgstr "Садржај"
78
+
79
+ #: inc/settings-usage-shortcode.php:101
80
+ #, php-format
81
+ msgid ""
82
+ "Please note, you can omit all options listed above, and then will be used "
83
+ "plugin defaults customized on tabs %1$s, %2$s, %3$s and %4$s."
84
+ msgstr ""
85
+ "Обратите пажњу да можете изоставити све опције наведене изнад, и тада ће "
86
+ "бити употребљене подразумеване опције постављене на картицама %1$s, %2$s, "
87
+ "%3$s и %4$s."
88
+
89
+ #: inc/settings-usage-shortcode.php:112
90
+ #, php-format
91
+ msgid ""
92
+ "Important note: %s blocks inserted through widget have their own settings."
93
+ msgstr ""
94
+
95
+ #: inc/settings-usage-shortcode.php:115 inc/settings.php:311
96
+ #: inc/settings.php:730 inc/settings.php:731 inc/settings.php:758
97
+ #: inc/settings.php:772 inc/settings.php:782 inc/settings.php:792
98
+ #: inc/widget.php:11
99
+ msgid "YouTube Channel"
100
+ msgstr ""
101
+
102
+ #: inc/settings-usage.php:1
103
+ msgid "How to use YouTube Channel"
104
+ msgstr "Како се користи YouTube Channel"
105
+
106
+ #: inc/settings-usage.php:2
107
+ msgid "You can insert YouTube Channel in couple different ways."
108
+ msgstr "YouTube Channel можете да уметнете на два начина."
109
+
110
+ #: inc/settings-usage.php:7
111
+ #, php-format
112
+ msgid "Add %s to preferred %s, and configure it there."
113
+ msgstr "Додајте %s у жељену %s, и подесите опције у виџету."
114
+
115
+ #: inc/settings-usage.php:10
116
+ msgid "YouTube Channel Widget"
117
+ msgstr "виџет YouTube Channel"
118
+
119
+ #: inc/settings-usage.php:13
120
+ msgid "Widget Area"
121
+ msgstr ""
122
+
123
+ #: inc/settings-usage.php:19
124
+ #, php-format
125
+ msgid ""
126
+ "Insert shortcode %s to your page or text widget, and even modify default "
127
+ "settings by shortcode parameters listed in section below."
128
+ msgstr ""
129
+ "Уметните шорткод %s у садржај странице или виџета, па чак и измените "
130
+ "подразумеване поставке додатка помоћу параметара шорткода наведених у "
131
+ "секцији испод."
132
+
133
+ #: inc/settings.php:46 youtube-channel.php:329
134
  msgid "YouTube Data API Key"
135
  msgstr "Јутјуб АПИ кључ за податке"
136
 
137
+ #: inc/settings.php:54 inc/settings.php:87
138
  msgid "Required"
139
  msgstr "Обавезно"
140
 
141
  #: inc/settings.php:58
142
  #, php-format
143
  msgid ""
144
+ "Your YouTube Data API Key (get it from <a href=\"%1$s\" target=\"_blank\">"
145
+ "%2$s</a>)"
146
  msgstr ""
 
 
147
 
148
+ #: inc/settings.php:69 youtube-channel.php:331
149
  msgid "Google Developers Console"
150
  msgstr "Гугловој страници за програмере"
151
 
152
+ #: inc/settings.php:79
153
  msgid "YouTube Channel ID"
154
  msgstr "ИД канала"
155
 
156
+ #: inc/settings.php:91
157
  #, php-format
158
  msgid ""
159
+ "Your YouTube Channel ID (get it from <a href=\"%1$s\" target=\"_blank\">"
160
+ "%2$s</a>)"
161
  msgstr ""
 
 
162
 
163
+ #: inc/settings.php:102 inc/settings.php:136 inc/settings.php:762
164
  msgid "YouTube Account Overview"
165
  msgstr "Преглед подешавања канала"
166
 
167
+ #: inc/settings.php:112
168
  msgid "YouTube Vanity Name"
169
  msgstr "Прилагођено име"
170
 
171
+ #: inc/settings.php:120 inc/settings.php:154 inc/settings.php:172
172
  msgid "Optional"
173
  msgstr "Није обавезно"
174
 
175
+ #: inc/settings.php:124
176
  #, php-format
177
  msgid ""
178
+ "Your YouTube Custom Name (get only part after %1$s instead whole URL from <a "
179
+ "href=\"%2$s\" target=\"_blank\">%3$s</a>)"
180
  msgstr ""
 
 
181
 
182
+ #: inc/settings.php:146
183
  msgid "Legacy YouTube Username"
184
  msgstr "Старо корисничко име"
185
 
186
+ #: inc/settings.php:155
187
  msgid "Your YouTube legacy username"
188
  msgstr "Ваше старо корисничко име за Јутјуб"
189
 
190
+ #: inc/settings.php:164
191
  msgid "Default Playlist ID"
192
  msgstr "ИД подразумеване плејлисте"
193
 
194
+ #: inc/settings.php:173
195
  msgid "Enter default playlist ID (not playlist name)"
196
  msgstr "Унесите подразумевани ИД плеј листе (не назив)"
197
 
198
+ #: inc/settings.php:182 inc/widget.php:134
199
  msgid "Resource to use"
200
  msgstr "Користи ресурс"
201
 
202
+ #: inc/settings.php:188
203
  msgid "Resource:"
204
  msgstr "Извор:"
205
 
206
+ #: inc/settings.php:189
207
  msgid "What to use as resource for feeds"
208
  msgstr "Шта користити као извор довода"
209
 
210
+ #: inc/settings.php:193
211
  msgid "Channel"
212
  msgstr "Канал"
213
 
214
+ #: inc/settings.php:194 inc/widget.php:137
215
  msgid "Favourites"
216
  msgstr "Омиљени"
217
 
218
+ #: inc/settings.php:195
219
  msgid "Liked Video"
220
  msgstr "Свидело вам се"
221
 
222
+ #: inc/settings.php:196 inc/widget.php:139
223
  msgid "Playlist"
224
  msgstr "Плеј листа"
225
 
226
+ #: inc/settings.php:203
227
  msgid "Cache Timeout"
228
  msgstr "Трајање кеша"
229
 
230
+ #: inc/settings.php:209
231
  msgid "Define caching timeout for YouTube feeds, in seconds"
232
  msgstr "Одредите трајање кеша Јутјуб довода у секундама"
233
 
234
+ #: inc/settings.php:213
235
  msgid "Do not chache"
236
  msgstr "Без кеширања"
237
 
238
+ #: inc/settings.php:214 youtube-channel.php:1276
239
  msgid "1 minute"
240
  msgstr "1 минут"
241
 
242
+ #: inc/settings.php:215 youtube-channel.php:1277
243
  msgid "5 minutes"
244
  msgstr "5 минута"
245
 
246
+ #: inc/settings.php:216 youtube-channel.php:1278
247
  msgid "15 minutes"
248
  msgstr "15 минута"
249
 
250
+ #: inc/settings.php:217 youtube-channel.php:1279
251
  msgid "30 minutes"
252
  msgstr "30 минута"
253
 
254
+ #: inc/settings.php:218 youtube-channel.php:1282
255
  msgid "1 hour"
256
  msgstr "1 сат"
257
 
258
+ #: inc/settings.php:219 youtube-channel.php:1283
259
  msgid "2 hours"
260
  msgstr "2 сата"
261
 
262
+ #: inc/settings.php:220 youtube-channel.php:1284
263
  msgid "5 hours"
264
  msgstr "5 сати"
265
 
266
+ #: inc/settings.php:221 youtube-channel.php:1285
267
  msgid "10 hours"
268
  msgstr "10 сати"
269
 
270
+ #: inc/settings.php:222 youtube-channel.php:1286
271
  msgid "12 hours"
272
  msgstr "12 сати"
273
 
274
+ #: inc/settings.php:223 youtube-channel.php:1287
275
  msgid "18 hours"
276
  msgstr "18 сати"
277
 
278
+ #: inc/settings.php:224 youtube-channel.php:1290
279
  msgid "1 day"
280
  msgstr "1 дан"
281
 
282
+ #: inc/settings.php:225 youtube-channel.php:1291
283
  msgid "2 days"
284
  msgstr "2 дана"
285
 
286
+ #: inc/settings.php:226 youtube-channel.php:1292
287
  msgid "3 days"
288
  msgstr "3 дана"
289
 
290
+ #: inc/settings.php:227 youtube-channel.php:1293
291
  msgid "4 days"
292
  msgstr "4 дана"
293
 
294
+ #: inc/settings.php:228 youtube-channel.php:1294
295
  msgid "5 days"
296
  msgstr "5 дана"
297
 
298
+ #: inc/settings.php:229 youtube-channel.php:1295
299
  msgid "6 days"
300
  msgstr "6 дана"
301
 
302
+ #: inc/settings.php:230 youtube-channel.php:1298
303
  msgid "1 week"
304
  msgstr "1 недеља"
305
 
306
+ #: inc/settings.php:231 youtube-channel.php:1299
307
  msgid "2 weeks"
308
  msgstr "2 недеље"
309
 
310
+ #: inc/settings.php:232 youtube-channel.php:1300
311
  msgid "3 weeks"
312
  msgstr "3 недеље"
313
 
314
+ #: inc/settings.php:233 youtube-channel.php:1301
315
  msgid "1 month"
316
  msgstr "1 месец"
317
 
318
+ #: inc/settings.php:240 inc/widget.php:152
319
  msgid "Fetch"
320
  msgstr "Добави из ресурса"
321
 
322
+ #: inc/settings.php:246 inc/widget.php:152
323
  msgid ""
324
  "Number of videos that will be used for random pick (min 2, max 50, default "
325
  "25)"
327
  "Број видеа од којих ће бити одабран насумични (најмање 2, највише 50, "
328
  "подразумевано 25)"
329
 
330
+ #: inc/settings.php:257 inc/widget.php:155
331
  msgid "Show"
332
  msgstr "Прикажи"
333
 
334
+ #: inc/settings.php:263 inc/widget.php:155
335
  msgid "Number of videos to display"
336
  msgstr "Број видеа за приказ"
337
 
338
+ #: inc/settings.php:274
339
  msgid "Use Enhanced privacy"
340
  msgstr "Побољшана приватност"
341
 
342
+ #: inc/settings.php:283
343
  #, php-format
344
  msgid ""
345
+ "Enable this option to protect your visitors privacy. <a href=\"%1$s\" target="
346
+ "\"_blank\">%2$s</a>"
347
  msgstr ""
 
 
348
 
349
+ #: inc/settings.php:294 inc/settings.php:427
350
  msgid "Learn more here"
351
  msgstr "Сазнајте више"
352
 
353
+ #: inc/settings.php:303
354
+ msgid "Enable TinyMCE button"
355
+ msgstr ""
356
+
357
+ #: inc/settings.php:310
358
+ #, php-format
359
+ msgid ""
360
+ "Disable this option to hide %s button from TinyMCE toolbar on post and page "
361
+ "editor."
362
+ msgstr ""
363
+
364
+ #: inc/settings.php:328
365
  msgid "Video Tweaks"
366
  msgstr "Поставке видеа"
367
 
368
+ #: inc/settings.php:336
369
  msgid "Initial Width"
370
  msgstr "Почетна ширина"
371
 
372
+ #: inc/settings.php:342
373
  msgid "Set default width for displayed video, in pixels"
374
  msgstr "Одредите подразумевану ширину видеа у пикселима"
375
 
376
+ #: inc/settings.php:353 inc/widget.php:164
377
  msgid "Aspect ratio"
378
  msgstr "Размера"
379
 
380
+ #: inc/settings.php:359
381
  msgid "Select aspect ratio for displayed video"
382
  msgstr "Одаберите размеру приказаног видеа"
383
 
384
+ #: inc/settings.php:371
385
  msgid "What to show?"
386
  msgstr "Шта приказати?"
387
 
388
+ #: inc/settings.php:377
389
  msgid "Choose how to embed video block"
390
  msgstr "Одаберите како да се угради блок"
391
 
392
+ #: inc/settings.php:381 inc/widget.php:179
393
  msgid "Thumbnail"
394
  msgstr "Сличица"
395
 
396
+ #: inc/settings.php:382 inc/widget.php:180
397
  msgid "HTML5 (iframe)"
398
  msgstr "HTML5 (iframe)"
399
 
400
+ #: inc/settings.php:383 inc/widget.php:181
401
  msgid "HTML5 (iframe) Asynchronous"
402
  msgstr "HTML5 (iframe) Asynchronous"
403
 
404
+ #: inc/settings.php:384 inc/widget.php:182
405
  msgid "Embedded Playlist"
406
  msgstr "Уграђена плеј листа"
407
 
408
+ #: inc/settings.php:392
409
  msgid "Enable Responsive"
410
  msgstr "Омогући респонзивност"
411
 
412
+ #: inc/settings.php:398
413
  msgid ""
414
  "Enable this option to make YTC videos and thumbnails responsive by default. "
415
  "Please note, this option will set videos and thumbnail to full width "
416
  "relative to parent container, and disable more than one video per row."
417
  msgstr ""
418
 
419
+ #: inc/settings.php:407
420
  msgid "Play inline on iOS"
421
  msgstr "Репродукција на страници за iOS"
422
 
423
+ #: inc/settings.php:416
424
  #, php-format
425
  msgid ""
426
  "Enable this option to override fullscreen playback on iOS, and force inline "
427
+ "playback on page and in lightbox. <a href=\"%1$s\" target=\"_blank\">%2$s</a>"
428
  msgstr ""
429
 
430
+ #: inc/settings.php:436
431
  msgid "Disable Lightbox"
432
  msgstr "Онемогући искачући прозорчић"
433
 
434
+ #: inc/settings.php:442
435
  msgid ""
436
  "Enable this option to disable built-in lightbox for thumbnails (in case that "
437
  "you have youtube links lightbox trigger in theme or other plugin)."
438
  msgstr ""
439
 
440
+ #: inc/settings.php:450
441
+ msgid "Enable Full Screen"
442
+ msgstr ""
443
+
444
+ #: inc/settings.php:456
445
+ msgid ""
446
+ "Enable this option to make available Full Screen button for embedded "
447
+ "playlists."
448
+ msgstr ""
449
+
450
+ #: inc/settings.php:465
451
  msgid "Light Theme"
452
  msgstr "Светла тема"
453
 
454
+ #: inc/settings.php:471
455
  msgid ""
456
  "Enable this option to use light theme for playback controls instead dark."
457
  msgstr ""
458
 
459
+ #: inc/settings.php:479
460
  msgid "Hide Player Controls"
461
  msgstr "Сакриј контроле за репродукцију"
462
 
463
+ #: inc/settings.php:485
464
  msgid "Enable this option to hide playback controls"
465
  msgstr "Омогућите ову опцију да би сакрили контроле за репродукцију"
466
 
467
+ #: inc/settings.php:494 inc/widget.php:187
468
  msgid "Autoplay video or playlist"
469
  msgstr "Аутоматски репродукуј видео или плеј листу"
470
 
471
+ #: inc/settings.php:500
472
  msgid ""
473
  "Enable this option to start video playback right after block is rendered"
474
  msgstr ""
475
 
476
+ #: inc/settings.php:508 inc/widget.php:188
477
  msgid "Mute video on autoplay"
478
  msgstr "Искључи звук при аутоматској репродукцији"
479
 
480
+ #: inc/settings.php:514
481
  msgid "Enable this option to mute video when start autoplay"
482
  msgstr ""
483
  "Омогућите ову опцију да би искључити звук када започне аутоматска "
484
  "репродукција"
485
 
486
+ #: inc/settings.php:522 inc/widget.php:189
487
  msgid "Hide related videos"
488
  msgstr "Сакриј повезане видео записе"
489
 
490
+ #: inc/settings.php:528
491
  msgid "Enable this option to hide related videos after finished playback"
492
  msgstr ""
493
  "Омогућите ову опцију да би сакрили релевантне видео записе након завршетка "
494
  "репродукције"
495
 
496
+ #: inc/settings.php:536
497
  msgid "Hide YT logo"
498
  msgstr "Сакриј Јутјуб логотип"
499
 
500
+ #: inc/settings.php:542
501
  msgid ""
502
  "Enable this option to hide YouTube logo from playback control bar. Does not "
503
  "work for all videos."
504
  msgstr ""
505
 
506
+ #: inc/settings.php:550
507
  msgid "Hide video annotations"
508
  msgstr "Сакриј видео прибелешке"
509
 
510
+ #: inc/settings.php:556
511
  msgid ""
512
  "Enable this option to hide video annotations (custom text set by uploader "
513
  "over video during playback)"
515
  "Омогућите ову опцију да би сакрили видео прибелешке (текст постављен преко "
516
  "слике видеа током репродукције)"
517
 
518
+ #: inc/settings.php:564 inc/widget.php:213
519
  msgid "Hide video info"
520
  msgstr "Сакриј информације о видео запису"
521
 
522
+ #: inc/settings.php:570
523
  msgid ""
524
  "Enable this option to hide informations about video before play start (video "
525
  "title and uploader in overlay)"
527
  "Омогућите ову опцију да би сакрили информације о видео запису пре него што "
528
  "започен репродукција (наслов видео записа и аутора)"
529
 
530
+ #: inc/settings.php:586
531
  msgid "Content Tweaks"
532
  msgstr "Поставке садржаја"
533
 
534
+ #: inc/settings.php:594 inc/widget.php:196
535
  msgid "Show video title"
536
  msgstr "Прикажи наслов видео записа"
537
 
538
+ #: inc/settings.php:600
539
  msgid "Select should we and where display title of video"
540
  msgstr "Одаберите да ли треба и када приказати наслов видеа"
541
 
542
+ #: inc/settings.php:604 inc/widget.php:199
543
  msgid "Hide title"
544
  msgstr "Сакриј наслов"
545
 
546
+ #: inc/settings.php:605 inc/widget.php:200
547
  msgid "Above video/thumbnail"
548
  msgstr "Изнад видеа"
549
 
550
+ #: inc/settings.php:606 inc/widget.php:201
551
  msgid "Below video/thumbnail"
552
  msgstr "Испод видеа"
553
 
554
+ #: inc/settings.php:613 inc/widget.php:204
555
  msgid "Show video description"
556
  msgstr "Прикажи опис видео записа"
557
 
558
+ #: inc/settings.php:619
559
  msgid "Enable this option to display description for video"
560
  msgstr "Омогућите ову опцију да би приказали опис видео записа"
561
 
562
+ #: inc/settings.php:627 inc/widget.php:206
563
  msgid "Description length"
564
  msgstr "Дужина описа"
565
 
566
+ #: inc/settings.php:633
567
  msgid "Enter length for video description in characters (0 for full length)"
568
  msgstr "Унесите дужину описа видео записа у знаковима (0 за цео опис)"
569
 
570
+ #: inc/settings.php:661
 
 
 
 
 
 
571
  msgid "Link to..."
572
  msgstr "Повежи са..."
573
 
574
+ #: inc/settings.php:668
575
  msgid "Set where link will lead visitors"
576
  msgstr "Одредите где ће веза да одведе посетиоца"
577
 
578
+ #: inc/settings.php:672 inc/widget.php:223
579
  msgid "Hide link"
580
  msgstr "Сакриј везу"
581
 
582
+ #: inc/settings.php:673
583
  msgid "Vanity custom URL"
584
  msgstr "Прилагођена адреса"
585
 
586
+ #: inc/settings.php:674
587
  msgid "Channel page URL"
588
  msgstr "Страница канала"
589
 
590
+ #: inc/settings.php:675
591
  msgid "Legacy username page"
592
  msgstr "Старо корисничко име"
593
 
594
+ #: inc/settings.php:682
595
  msgid "Open link in..."
596
  msgstr "Отвори везу у..."
597
 
598
+ #: inc/settings.php:689
599
  msgid "Set where link will be opened"
600
  msgstr "Одредите како ће веза бити отворена"
601
 
602
+ #: inc/settings.php:693
603
  msgid "same window"
604
  msgstr "исти прозор"
605
 
606
+ #: inc/settings.php:694
607
  msgid "new window (JavaScript)"
608
  msgstr "нови прозор (ЈаваСкрипт)"
609
 
610
+ #: inc/settings.php:695
611
  msgid "new window (target=\"_blank\")"
612
  msgstr "нови прозор (target=\"_blank\")"
613
 
614
+ #: inc/settings.php:702
615
  msgid "Text for Visit channel link"
616
  msgstr "Текст за везу \"Посети канал\""
617
 
618
+ #: inc/settings.php:709
619
  msgid "Set default title for link"
620
  msgstr "Поставите подразумевани текст за везу"
621
 
622
+ #: inc/settings.php:748
 
 
 
 
 
 
623
  #, php-format
624
  msgid ""
625
  "Configure general defaults for %1$s used as fallback options in widget or "
631
  "шорткода. Да сазнате %2$s и %3$s посетите <a href=\"%4$s\" target=\"_blank\">"
632
  "%5$s</a>."
633
 
634
+ #: inc/settings.php:759 inc/widget.php:108 inc/widget.php:119
635
  msgid "Channel ID"
636
  msgstr "ИД канала"
637
 
638
+ #: inc/settings.php:760
639
  msgid "Vanity URL"
640
  msgstr "Прилагођени URL"
641
 
642
+ #: inc/settings.php:771
643
  #, php-format
644
  msgid ""
645
  "Configure video specific defaults for %s used as fallback options in widget "
648
  "Поставите подразумевана подешавања специфична за видео које ће бити "
649
  "искоришћене од стране %s приликом прављења новог виџета или шорткода."
650
 
651
+ #: inc/settings.php:781
652
  #, php-format
653
  msgid ""
654
  "Configure defaults of content around and over videos for %s used as fallback "
658
  "поставке ће бити употребљене као подразумеване вредности приликом прављења "
659
  "новог виџета или шорткода."
660
 
661
+ #: inc/settings.php:791
662
  #, php-format
663
  msgid ""
664
  "Configure defaults for link to channel below %s block used as fallback "
668
  "поставке ће бити употребљене као подразумеване вредности приликом прављења "
669
  "новог виџета или шорткода."
670
 
671
+ #: inc/settings.php:968
672
  msgid "You do not have sufficient permissions to access this page."
673
  msgstr "Немате одговарајуће привилегије да би приступили овој страници."
674
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
675
  #: inc/widget.php:14
676
  msgid "Serve YouTube videos from channel or playlist right to widget area"
677
  msgstr "Приказ видео записа са Јутјуб канала или плеј листе"
834
  "%channel% and %username%."
835
  msgstr ""
836
 
837
+ #: inc/widget.php:219 youtube-channel.php:1049
838
  msgid "Visit our YouTube channel"
839
  msgstr "Посетите наш Јутјуб канал"
840
 
885
  msgid "FAQ"
886
  msgstr "често постављана питања"
887
 
888
+ #: youtube-channel.php:185
889
  msgid "Settings"
890
  msgstr "Поставке"
891
 
892
+ #: youtube-channel.php:293
893
  #, php-format
894
  msgid ""
895
  "<p>Your website running on web server with PHP version %s. Please note that "
897
  "href=\"%s\" class=\"dismiss\">Dismiss</a></p>"
898
  msgstr ""
899
 
900
+ #: youtube-channel.php:306
901
  #, php-format
902
  msgid ""
903
  "<p>Since <strong>%s</strong> v3.0.6 we store <strong>YouTube Data API Key</"
906
  "\">Dismiss</a></p>"
907
  msgstr ""
908
 
909
+ #: youtube-channel.php:318
910
  #, php-format
911
  msgid ""
912
  "<p>Please note, to make <strong>%1$s</strong> plugin v3+ work, generate "
918
  "mentioned above!</p>"
919
  msgstr ""
920
 
921
+ #: youtube-channel.php:336
922
  msgid "support forum"
923
  msgstr "форум за подршку"
924
 
925
+ #: youtube-channel.php:345
926
  #, php-format
927
  msgid ""
928
  "<p><strong>%s</strong> since version 2.4 supports linking to channel through "
931
  "a>"
932
  msgstr ""
933
 
934
+ #: youtube-channel.php:359
935
  #, php-format
936
  msgid ""
937
  "<p><strong>%s</strong> changed shortcode parameters by removing "
941
  "<a href=\"%s\" class=\"dismiss\">Dismiss</a>"
942
  msgstr ""
943
 
944
+ #: youtube-channel.php:622
945
  #, php-format
946
  msgid ""
947
  "<strong>%s</strong> version 3+ requires <strong>YouTube DATA API Key</"
948
  "strong> to work. <a href=\"%s\" target=\"_blank\">Learn more here</a>."
949
  msgstr ""
950
 
951
+ #: youtube-channel.php:796
952
  #, php-format
953
  msgid ""
954
  "You have set to display videos from %s [resource list ID: %s], but there "
955
  "have no public videos in that resouce."
956
  msgstr ""
957
 
958
+ #: youtube-channel.php:799
959
  #, php-format
960
  msgid ""
961
  "We have empty record for this feed. Please read <a href=\"%s\" target="
963
  "\"_blank\">support</a>."
964
  msgstr ""
965
 
966
+ #: youtube-channel.php:841
967
  #, php-format
968
  msgid ""
969
  "Double check <em>YouTube Data API Key</em> on <em>General</em> plugin tab "
971
  "\">Installation</a> document."
972
  msgstr ""
973
 
974
+ #: youtube-channel.php:847
975
  #, php-format
976
  msgid ""
977
  "You have set wrong Channel ID. Fix that in General plugin settings, Widget "
978
  "and/or shortcode. Read <a href=\"%s\" target=\"_blank\">FAQ</a> document."
979
  msgstr ""
980
 
981
+ #: youtube-channel.php:850
982
  #, php-format
983
  msgid ""
984
  "You do not have permission to access ressource <strong>%s</strong> (it's "
985
  "maybe set to private or even does not exists!)"
986
  msgstr ""
987
 
988
+ #: youtube-channel.php:971
989
  msgid "Oops, something went wrong."
990
  msgstr "Извините, нешто не функционише како треба."
991
 
992
+ #: youtube-channel.php:1052
993
  msgid "in new window/tab"
994
  msgstr "у новом прозору"
995
 
996
+ #: youtube-channel.php:1202
997
  #, php-format
998
  msgid "Watch video %1$s published on %2$s"
999
  msgstr "Гледај видео %1$s објављен на %2$s"
1000
 
1001
+ #~ msgid ""
1002
+ #~ "Your YouTube Data API Key (get it from <a href=\"%s\" target=\"_blank\">"
1003
+ #~ "%s</a>)"
1004
+ #~ msgstr ""
1005
+ #~ "Ваш АПИ кључ за Јутјуб податке (пронађите га на <a href=\"%s\" target="
1006
+ #~ "\"_blank\">%s</a>)"
1007
+
1008
+ #~ msgid ""
1009
+ #~ "Your YouTube Channel ID (get it from <a href=\"%s\" target=\"_blank\">%s</"
1010
+ #~ "a>)"
1011
+ #~ msgstr ""
1012
+ #~ "Ваш ИД Јутјуб канала (пронађите га на <a href=\"%s\" target=\"_blank\">"
1013
+ #~ "%s</a>)"
1014
+
1015
+ #~ msgid ""
1016
+ #~ "Your YouTube Custom Name (get only part after www.youtube.com/c/ instead "
1017
+ #~ "whole URL from <a href=\"%s\" target=\"_blank\">%s</a>)"
1018
+ #~ msgstr ""
1019
+ #~ "Ваше Прилагођено име (само део иза www.youtube.com/c/ а не целу адресу са "
1020
+ #~ "странице <a href=\"%s\" target=\"_blank\">%s</a>)"
1021
+
1022
+ #~ msgid ""
1023
+ #~ "Enable this option to protect your visitors privacy. <a href=\"%s\" "
1024
+ #~ "target=\"_blank\">%s</a>"
1025
+ #~ msgstr ""
1026
+ #~ "Омогућите ову опцију да би заштитили приватност Ваших посетилаца. <a href="
1027
+ #~ "\"%s\" target=\"_blank\">%s</a>"
1028
+
1029
  #~ msgid ""
1030
  #~ "Carefully read <a href=\"%s\" target=\"_faq\">FAQ</a> before you contact "
1031
  #~ "us. If that does not help, <a href=\"%s\" target=\"_blank\">get JSON "
languages/youtube-channel-xx_XX.pot CHANGED
@@ -2,14 +2,14 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: YouTube Channel\n"
5
- "POT-Creation-Date: 2015-06-19 21:15+0100\n"
6
  "PO-Revision-Date: 2015-06-19 21:15+0100\n"
7
  "Last-Translator: Aleksandar Urošević <urke.kg@gmail.com>\n"
8
  "Language-Team: Aleksandar Urošević <urke.kg@gmail.com>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.8.1\n"
13
  "X-Poedit-Basepath: ..\n"
14
  "X-Poedit-WPHeader: youtube-channel.php\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
@@ -19,482 +19,592 @@ msgstr ""
19
  "X-Poedit-SearchPath-0: .\n"
20
  "X-Poedit-SearchPathExcluded-0: *.js\n"
21
 
22
- #: inc/settings.php:38 inc/settings_template.php:14
23
- #: inc/settings_usage_shortcode.php:104
 
 
 
 
24
  msgid "General"
25
  msgstr ""
26
 
27
- #: inc/settings.php:46 youtube-channel.php:316
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  msgid "YouTube Data API Key"
29
  msgstr ""
30
 
31
- #: inc/settings.php:54 inc/settings.php:86
32
  msgid "Required"
33
  msgstr ""
34
 
35
  #: inc/settings.php:58
36
  #, php-format
37
  msgid ""
38
- "Your YouTube Data API Key (get it from <a href=\"%s\" target=\"_blank\">%s</"
39
- "a>)"
40
  msgstr ""
41
 
42
- #: inc/settings.php:68 youtube-channel.php:318
43
  msgid "Google Developers Console"
44
  msgstr ""
45
 
46
- #: inc/settings.php:78
47
  msgid "YouTube Channel ID"
48
  msgstr ""
49
 
50
- #: inc/settings.php:90
51
  #, php-format
52
  msgid ""
53
- "Your YouTube Channel ID (get it from <a href=\"%s\" target=\"_blank\">%s</a>)"
 
54
  msgstr ""
55
 
56
- #: inc/settings.php:100 inc/settings.php:132 inc/settings.php:718
57
  msgid "YouTube Account Overview"
58
  msgstr ""
59
 
60
- #: inc/settings.php:110
61
  msgid "YouTube Vanity Name"
62
  msgstr ""
63
 
64
- #: inc/settings.php:118 inc/settings.php:150 inc/settings.php:168
65
  msgid "Optional"
66
  msgstr ""
67
 
68
- #: inc/settings.php:122
69
  #, php-format
70
  msgid ""
71
- "Your YouTube Custom Name (get only part after www.youtube.com/c/ instead "
72
- "whole URL from <a href=\"%s\" target=\"_blank\">%s</a>)"
73
  msgstr ""
74
 
75
- #: inc/settings.php:142
76
  msgid "Legacy YouTube Username"
77
  msgstr ""
78
 
79
- #: inc/settings.php:151
80
  msgid "Your YouTube legacy username"
81
  msgstr ""
82
 
83
- #: inc/settings.php:160
84
  msgid "Default Playlist ID"
85
  msgstr ""
86
 
87
- #: inc/settings.php:169
88
  msgid "Enter default playlist ID (not playlist name)"
89
  msgstr ""
90
 
91
- #: inc/settings.php:178 inc/widget.php:134
92
  msgid "Resource to use"
93
  msgstr ""
94
 
95
- #: inc/settings.php:184
96
  msgid "Resource:"
97
  msgstr ""
98
 
99
- #: inc/settings.php:185
100
  msgid "What to use as resource for feeds"
101
  msgstr ""
102
 
103
- #: inc/settings.php:189
104
  msgid "Channel"
105
  msgstr ""
106
 
107
- #: inc/settings.php:190 inc/widget.php:137
108
  msgid "Favourites"
109
  msgstr ""
110
 
111
- #: inc/settings.php:191
112
  msgid "Liked Video"
113
  msgstr ""
114
 
115
- #: inc/settings.php:192 inc/widget.php:139
116
  msgid "Playlist"
117
  msgstr ""
118
 
119
- #: inc/settings.php:199
120
  msgid "Cache Timeout"
121
  msgstr ""
122
 
123
- #: inc/settings.php:205
124
  msgid "Define caching timeout for YouTube feeds, in seconds"
125
  msgstr ""
126
 
127
- #: inc/settings.php:209
128
  msgid "Do not chache"
129
  msgstr ""
130
 
131
- #: inc/settings.php:210 youtube-channel.php:1273
132
  msgid "1 minute"
133
  msgstr ""
134
 
135
- #: inc/settings.php:211 youtube-channel.php:1274
136
  msgid "5 minutes"
137
  msgstr ""
138
 
139
- #: inc/settings.php:212 youtube-channel.php:1275
140
  msgid "15 minutes"
141
  msgstr ""
142
 
143
- #: inc/settings.php:213 youtube-channel.php:1276
144
  msgid "30 minutes"
145
  msgstr ""
146
 
147
- #: inc/settings.php:214 youtube-channel.php:1279
148
  msgid "1 hour"
149
  msgstr ""
150
 
151
- #: inc/settings.php:215 youtube-channel.php:1280
152
  msgid "2 hours"
153
  msgstr ""
154
 
155
- #: inc/settings.php:216 youtube-channel.php:1281
156
  msgid "5 hours"
157
  msgstr ""
158
 
159
- #: inc/settings.php:217 youtube-channel.php:1282
160
  msgid "10 hours"
161
  msgstr ""
162
 
163
- #: inc/settings.php:218 youtube-channel.php:1283
164
  msgid "12 hours"
165
  msgstr ""
166
 
167
- #: inc/settings.php:219 youtube-channel.php:1284
168
  msgid "18 hours"
169
  msgstr ""
170
 
171
- #: inc/settings.php:220 youtube-channel.php:1287
172
  msgid "1 day"
173
  msgstr ""
174
 
175
- #: inc/settings.php:221 youtube-channel.php:1288
176
  msgid "2 days"
177
  msgstr ""
178
 
179
- #: inc/settings.php:222 youtube-channel.php:1289
180
  msgid "3 days"
181
  msgstr ""
182
 
183
- #: inc/settings.php:223 youtube-channel.php:1290
184
  msgid "4 days"
185
  msgstr ""
186
 
187
- #: inc/settings.php:224 youtube-channel.php:1291
188
  msgid "5 days"
189
  msgstr ""
190
 
191
- #: inc/settings.php:225 youtube-channel.php:1292
192
  msgid "6 days"
193
  msgstr ""
194
 
195
- #: inc/settings.php:226 youtube-channel.php:1295
196
  msgid "1 week"
197
  msgstr ""
198
 
199
- #: inc/settings.php:227 youtube-channel.php:1296
200
  msgid "2 weeks"
201
  msgstr ""
202
 
203
- #: inc/settings.php:228 youtube-channel.php:1297
204
  msgid "3 weeks"
205
  msgstr ""
206
 
207
- #: inc/settings.php:229 youtube-channel.php:1298
208
  msgid "1 month"
209
  msgstr ""
210
 
211
- #: inc/settings.php:236 inc/widget.php:152
212
  msgid "Fetch"
213
  msgstr ""
214
 
215
- #: inc/settings.php:242 inc/widget.php:152
216
  msgid ""
217
  "Number of videos that will be used for random pick (min 2, max 50, default "
218
  "25)"
219
  msgstr ""
220
 
221
- #: inc/settings.php:253 inc/widget.php:155
222
  msgid "Show"
223
  msgstr ""
224
 
225
- #: inc/settings.php:259 inc/widget.php:155
226
  msgid "Number of videos to display"
227
  msgstr ""
228
 
229
- #: inc/settings.php:270
230
  msgid "Use Enhanced privacy"
231
  msgstr ""
232
 
233
- #: inc/settings.php:279
234
  #, php-format
235
  msgid ""
236
- "Enable this option to protect your visitors privacy. <a href=\"%s\" target="
237
- "\"_blank\">%s</a>"
238
  msgstr ""
239
 
240
- #: inc/settings.php:289
241
  msgid "Learn more here"
242
  msgstr ""
243
 
244
- #: inc/settings.php:306
 
 
 
 
 
 
 
 
 
 
 
245
  msgid "Video Tweaks"
246
  msgstr ""
247
 
248
- #: inc/settings.php:314
249
  msgid "Initial Width"
250
  msgstr ""
251
 
252
- #: inc/settings.php:320
253
  msgid "Set default width for displayed video, in pixels"
254
  msgstr ""
255
 
256
- #: inc/settings.php:331 inc/widget.php:164
257
  msgid "Aspect ratio"
258
  msgstr ""
259
 
260
- #: inc/settings.php:338
261
  msgid "Select aspect ratio for displayed video"
262
  msgstr ""
263
 
264
- #: inc/settings.php:350
265
  msgid "What to show?"
266
  msgstr ""
267
 
268
- #: inc/settings.php:356
269
  msgid "Choose how to embed video block"
270
  msgstr ""
271
 
272
- #: inc/settings.php:360 inc/widget.php:179
273
  msgid "Thumbnail"
274
  msgstr ""
275
 
276
- #: inc/settings.php:361 inc/widget.php:180
277
  msgid "HTML5 (iframe)"
278
  msgstr ""
279
 
280
- #: inc/settings.php:362 inc/widget.php:181
281
  msgid "HTML5 (iframe) Asynchronous"
282
  msgstr ""
283
 
284
- #: inc/settings.php:363 inc/widget.php:182
285
  msgid "Embedded Playlist"
286
  msgstr ""
287
 
288
- #: inc/settings.php:371
289
  msgid "Enable Responsive"
290
  msgstr ""
291
 
292
- #: inc/settings.php:377
293
  msgid ""
294
  "Enable this option to make YTC videos and thumbnails responsive by default. "
295
  "Please note, this option will set videos and thumbnail to full width "
296
  "relative to parent container, and disable more than one video per row."
297
  msgstr ""
298
 
299
- #: inc/settings.php:386
300
  msgid "Play inline on iOS"
301
  msgstr ""
302
 
303
- #: inc/settings.php:394
304
  #, php-format
305
  msgid ""
306
  "Enable this option to override fullscreen playback on iOS, and force inline "
307
- "playback on page and in lightbox. Learn more <a href=\"%s\">here</a>."
308
  msgstr ""
309
 
310
- #: inc/settings.php:406
311
  msgid "Disable Lightbox"
312
  msgstr ""
313
 
314
- #: inc/settings.php:412
315
  msgid ""
316
  "Enable this option to disable built-in lightbox for thumbnails (in case that "
317
  "you have youtube links lightbox trigger in theme or other plugin)."
318
  msgstr ""
319
 
320
- #: inc/settings.php:421
 
 
 
 
 
 
 
 
 
 
321
  msgid "Light Theme"
322
  msgstr ""
323
 
324
- #: inc/settings.php:427
325
  msgid ""
326
  "Enable this option to use light theme for playback controls instead dark."
327
  msgstr ""
328
 
329
- #: inc/settings.php:435
330
  msgid "Hide Player Controls"
331
  msgstr ""
332
 
333
- #: inc/settings.php:441
334
  msgid "Enable this option to hide playback controls"
335
  msgstr ""
336
 
337
- #: inc/settings.php:450 inc/widget.php:187
338
  msgid "Autoplay video or playlist"
339
  msgstr ""
340
 
341
- #: inc/settings.php:456
342
  msgid ""
343
  "Enable this option to start video playback right after block is rendered"
344
  msgstr ""
345
 
346
- #: inc/settings.php:464 inc/widget.php:188
347
  msgid "Mute video on autoplay"
348
  msgstr ""
349
 
350
- #: inc/settings.php:470
351
  msgid "Enable this option to mute video when start autoplay"
352
  msgstr ""
353
 
354
- #: inc/settings.php:478 inc/widget.php:189
355
  msgid "Hide related videos"
356
  msgstr ""
357
 
358
- #: inc/settings.php:484
359
  msgid "Enable this option to hide related videos after finished playback"
360
  msgstr ""
361
 
362
- #: inc/settings.php:492
363
  msgid "Hide YT logo"
364
  msgstr ""
365
 
366
- #: inc/settings.php:498
367
  msgid ""
368
  "Enable this option to hide YouTube logo from playback control bar. Does not "
369
  "work for all videos."
370
  msgstr ""
371
 
372
- #: inc/settings.php:506
373
  msgid "Hide video annotations"
374
  msgstr ""
375
 
376
- #: inc/settings.php:512
377
  msgid ""
378
  "Enable this option to hide video annotations (custom text set by uploader "
379
  "over video during playback)"
380
  msgstr ""
381
 
382
- #: inc/settings.php:520 inc/widget.php:213
383
  msgid "Hide video info"
384
  msgstr ""
385
 
386
- #: inc/settings.php:526
387
  msgid ""
388
  "Enable this option to hide informations about video before play start (video "
389
  "title and uploader in overlay)"
390
  msgstr ""
391
 
392
- #: inc/settings.php:542
393
  msgid "Content Tweaks"
394
  msgstr ""
395
 
396
- #: inc/settings.php:550 inc/widget.php:196
397
  msgid "Show video title"
398
  msgstr ""
399
 
400
- #: inc/settings.php:556
401
  msgid "Select should we and where display title of video"
402
  msgstr ""
403
 
404
- #: inc/settings.php:560 inc/widget.php:199
405
  msgid "Hide title"
406
  msgstr ""
407
 
408
- #: inc/settings.php:561 inc/widget.php:200
409
  msgid "Above video/thumbnail"
410
  msgstr ""
411
 
412
- #: inc/settings.php:562 inc/widget.php:201
413
  msgid "Below video/thumbnail"
414
  msgstr ""
415
 
416
- #: inc/settings.php:569 inc/widget.php:204
417
  msgid "Show video description"
418
  msgstr ""
419
 
420
- #: inc/settings.php:575
421
  msgid "Enable this option to display description for video"
422
  msgstr ""
423
 
424
- #: inc/settings.php:583 inc/widget.php:206
425
  msgid "Description length"
426
  msgstr ""
427
 
428
- #: inc/settings.php:589
429
  msgid "Enter length for video description in characters (0 for full length)"
430
  msgstr ""
431
 
432
- #: inc/settings.php:609 inc/settings_template.php:17
433
- #: inc/settings_usage_shortcode.php:15 inc/settings_usage_shortcode.php:107
434
- #: inc/widget.php:217
435
- msgid "Link to Channel"
436
- msgstr ""
437
-
438
- #: inc/settings.php:617
439
  msgid "Link to..."
440
  msgstr ""
441
 
442
- #: inc/settings.php:624
443
  msgid "Set where link will lead visitors"
444
  msgstr ""
445
 
446
- #: inc/settings.php:628 inc/widget.php:223
447
  msgid "Hide link"
448
  msgstr ""
449
 
450
- #: inc/settings.php:629
451
  msgid "Vanity custom URL"
452
  msgstr ""
453
 
454
- #: inc/settings.php:630
455
  msgid "Channel page URL"
456
  msgstr ""
457
 
458
- #: inc/settings.php:631
459
  msgid "Legacy username page"
460
  msgstr ""
461
 
462
- #: inc/settings.php:638
463
  msgid "Open link in..."
464
  msgstr ""
465
 
466
- #: inc/settings.php:645
467
  msgid "Set where link will be opened"
468
  msgstr ""
469
 
470
- #: inc/settings.php:649
471
  msgid "same window"
472
  msgstr ""
473
 
474
- #: inc/settings.php:650
475
  msgid "new window (JavaScript)"
476
  msgstr ""
477
 
478
- #: inc/settings.php:651
479
  msgid "new window (target=\"_blank\")"
480
  msgstr ""
481
 
482
- #: inc/settings.php:658
483
  msgid "Text for Visit channel link"
484
  msgstr ""
485
 
486
- #: inc/settings.php:665
487
  msgid "Set default title for link"
488
  msgstr ""
489
 
490
- #. Plugin Name of the plugin/theme
491
- #: inc/settings.php:686 inc/settings.php:687 inc/settings.php:714
492
- #: inc/settings.php:728 inc/settings.php:738 inc/settings.php:748
493
- #: inc/settings_usage_shortcode.php:115 inc/widget.php:11
494
- msgid "YouTube Channel"
495
- msgstr ""
496
-
497
- #: inc/settings.php:704
498
  #, php-format
499
  msgid ""
500
  "Configure general defaults for %1$s used as fallback options in widget or "
@@ -502,127 +612,39 @@ msgid ""
502
  "%5$s</a>."
503
  msgstr ""
504
 
505
- #: inc/settings.php:715 inc/widget.php:108 inc/widget.php:119
506
  msgid "Channel ID"
507
  msgstr ""
508
 
509
- #: inc/settings.php:716
510
  msgid "Vanity URL"
511
  msgstr ""
512
 
513
- #: inc/settings.php:727
514
  #, php-format
515
  msgid ""
516
  "Configure video specific defaults for %s used as fallback options in widget "
517
  "or shortcodes."
518
  msgstr ""
519
 
520
- #: inc/settings.php:737
521
  #, php-format
522
  msgid ""
523
  "Configure defaults of content around and over videos for %s used as fallback "
524
  "options in widget or shortcodes."
525
  msgstr ""
526
 
527
- #: inc/settings.php:747
528
  #, php-format
529
  msgid ""
530
  "Configure defaults for link to channel below %s block used as fallback "
531
  "options in widget or shortcodes."
532
  msgstr ""
533
 
534
- #: inc/settings.php:908
535
  msgid "You do not have sufficient permissions to access this page."
536
  msgstr ""
537
 
538
- #: inc/settings_template.php:6
539
- msgid " Settings"
540
- msgstr ""
541
-
542
- #: inc/settings_template.php:15 inc/settings_usage_shortcode.php:105
543
- msgid "Video"
544
- msgstr ""
545
-
546
- #: inc/settings_template.php:16 inc/settings_usage_shortcode.php:106
547
- msgid "Content"
548
- msgstr ""
549
-
550
- #: inc/settings_template.php:18
551
- msgid "Tools"
552
- msgstr ""
553
-
554
- #: inc/settings_template.php:19
555
- msgid "Help"
556
- msgstr ""
557
-
558
- #: inc/settings_template.php:20 youtube-channel.php:201
559
- msgid "Support"
560
- msgstr ""
561
-
562
- #: inc/settings_usage.php:1
563
- msgid "How to use YouTube Channel"
564
- msgstr ""
565
-
566
- #: inc/settings_usage.php:2
567
- msgid "You can insert YouTube Channel in couple different ways."
568
- msgstr ""
569
-
570
- #: inc/settings_usage.php:7
571
- #, php-format
572
- msgid "Add %s to preferred %s, and configure it there."
573
- msgstr ""
574
-
575
- #: inc/settings_usage.php:10
576
- msgid "YouTube Channel Widget"
577
- msgstr ""
578
-
579
- #: inc/settings_usage.php:13
580
- msgid "Widget Area"
581
- msgstr ""
582
-
583
- #: inc/settings_usage.php:19
584
- #, php-format
585
- msgid ""
586
- "Insert shortcode %s to your page or text widget, and even modify default "
587
- "settings by shortcode parameters listed in section below."
588
- msgstr ""
589
-
590
- #: inc/settings_usage_shortcode.php:1
591
- msgid "How to use shortcode"
592
- msgstr ""
593
-
594
- #: inc/settings_usage_shortcode.php:5
595
- #, php-format
596
- msgid ""
597
- "You can use shortcode %s with options listed below (all options are optional "
598
- "if you have set defaults in global plugin settings)."
599
- msgstr ""
600
-
601
- #: inc/settings_usage_shortcode.php:12 youtube-channel.php:321
602
- msgid "General Settings"
603
- msgstr ""
604
-
605
- #: inc/settings_usage_shortcode.php:13 inc/widget.php:163
606
- msgid "Video Settings"
607
- msgstr ""
608
-
609
- #: inc/settings_usage_shortcode.php:14 inc/widget.php:193
610
- msgid "Content Layout"
611
- msgstr ""
612
-
613
- #: inc/settings_usage_shortcode.php:101
614
- #, php-format
615
- msgid ""
616
- "Please note, you can omit all options listed above, and then will be used "
617
- "plugin defaults customized on tabs %1$s, %2$s, %3$s and %4$s."
618
- msgstr ""
619
-
620
- #: inc/settings_usage_shortcode.php:112
621
- #, php-format
622
- msgid ""
623
- "Important note: %s blocks inserted through widget have their own settings."
624
- msgstr ""
625
-
626
  #: inc/widget.php:14
627
  msgid "Serve YouTube videos from channel or playlist right to widget area"
628
  msgstr ""
@@ -783,7 +805,7 @@ msgid ""
783
  "%channel% and %username%."
784
  msgstr ""
785
 
786
- #: inc/widget.php:219 youtube-channel.php:1043
787
  msgid "Visit our YouTube channel"
788
  msgstr ""
789
 
@@ -829,11 +851,11 @@ msgstr ""
829
  msgid "FAQ"
830
  msgstr ""
831
 
832
- #: youtube-channel.php:179
833
  msgid "Settings"
834
  msgstr ""
835
 
836
- #: youtube-channel.php:280
837
  #, php-format
838
  msgid ""
839
  "<p>Your website running on web server with PHP version %s. Please note that "
@@ -841,7 +863,7 @@ msgid ""
841
  "href=\"%s\" class=\"dismiss\">Dismiss</a></p>"
842
  msgstr ""
843
 
844
- #: youtube-channel.php:293
845
  #, php-format
846
  msgid ""
847
  "<p>Since <strong>%s</strong> v3.0.6 we store <strong>YouTube Data API Key</"
@@ -850,7 +872,7 @@ msgid ""
850
  "\">Dismiss</a></p>"
851
  msgstr ""
852
 
853
- #: youtube-channel.php:305
854
  #, php-format
855
  msgid ""
856
  "<p>Please note, to make <strong>%1$s</strong> plugin v3+ work, generate "
@@ -862,11 +884,11 @@ msgid ""
862
  "mentioned above!</p>"
863
  msgstr ""
864
 
865
- #: youtube-channel.php:323
866
  msgid "support forum"
867
  msgstr ""
868
 
869
- #: youtube-channel.php:332
870
  #, php-format
871
  msgid ""
872
  "<p><strong>%s</strong> since version 2.4 supports linking to channel through "
@@ -875,7 +897,7 @@ msgid ""
875
  "a>"
876
  msgstr ""
877
 
878
- #: youtube-channel.php:346
879
  #, php-format
880
  msgid ""
881
  "<p><strong>%s</strong> changed shortcode parameters by removing "
@@ -885,21 +907,21 @@ msgid ""
885
  "<a href=\"%s\" class=\"dismiss\">Dismiss</a>"
886
  msgstr ""
887
 
888
- #: youtube-channel.php:609
889
  #, php-format
890
  msgid ""
891
  "<strong>%s</strong> version 3+ requires <strong>YouTube DATA API Key</"
892
  "strong> to work. <a href=\"%s\" target=\"_blank\">Learn more here</a>."
893
  msgstr ""
894
 
895
- #: youtube-channel.php:782
896
  #, php-format
897
  msgid ""
898
  "You have set to display videos from %s [resource list ID: %s], but there "
899
  "have no public videos in that resouce."
900
  msgstr ""
901
 
902
- #: youtube-channel.php:786
903
  #, php-format
904
  msgid ""
905
  "We have empty record for this feed. Please read <a href=\"%s\" target="
@@ -907,7 +929,7 @@ msgid ""
907
  "\"_blank\">support</a>."
908
  msgstr ""
909
 
910
- #: youtube-channel.php:828
911
  #, php-format
912
  msgid ""
913
  "Double check <em>YouTube Data API Key</em> on <em>General</em> plugin tab "
@@ -915,29 +937,29 @@ msgid ""
915
  "\">Installation</a> document."
916
  msgstr ""
917
 
918
- #: youtube-channel.php:836
919
  #, php-format
920
  msgid ""
921
  "You have set wrong Channel ID. Fix that in General plugin settings, Widget "
922
  "and/or shortcode. Read <a href=\"%s\" target=\"_blank\">FAQ</a> document."
923
  msgstr ""
924
 
925
- #: youtube-channel.php:840
926
  #, php-format
927
  msgid ""
928
  "You do not have permission to access ressource <strong>%s</strong> (it's "
929
  "maybe set to private or even does not exists!)"
930
  msgstr ""
931
 
932
- #: youtube-channel.php:964
933
  msgid "Oops, something went wrong."
934
  msgstr ""
935
 
936
- #: youtube-channel.php:1046
937
  msgid "in new window/tab"
938
  msgstr ""
939
 
940
- #: youtube-channel.php:1198
941
  #, php-format
942
  msgid "Watch video %1$s published on %2$s"
943
  msgstr ""
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: YouTube Channel\n"
5
+ "POT-Creation-Date: 2015-10-03 01:17+0200\n"
6
  "PO-Revision-Date: 2015-06-19 21:15+0100\n"
7
  "Last-Translator: Aleksandar Urošević <urke.kg@gmail.com>\n"
8
  "Language-Team: Aleksandar Urošević <urke.kg@gmail.com>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.8.5\n"
13
  "X-Poedit-Basepath: ..\n"
14
  "X-Poedit-WPHeader: youtube-channel.php\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
  "X-Poedit-SearchPathExcluded-0: *.js\n"
21
 
22
+ #: inc/settings-template.php:6
23
+ msgid " Settings"
24
+ msgstr ""
25
+
26
+ #: inc/settings-template.php:12 inc/settings-usage-shortcode.php:104
27
+ #: inc/settings.php:38
28
  msgid "General"
29
  msgstr ""
30
 
31
+ #: inc/settings-template.php:13 inc/settings-usage-shortcode.php:105
32
+ msgid "Video"
33
+ msgstr ""
34
+
35
+ #: inc/settings-template.php:14 inc/settings-usage-shortcode.php:106
36
+ msgid "Content"
37
+ msgstr ""
38
+
39
+ #: inc/settings-template.php:15 inc/settings-usage-shortcode.php:15
40
+ #: inc/settings-usage-shortcode.php:107 inc/settings.php:653 inc/widget.php:217
41
+ msgid "Link to Channel"
42
+ msgstr ""
43
+
44
+ #: inc/settings-template.php:16
45
+ msgid "Tools"
46
+ msgstr ""
47
+
48
+ #: inc/settings-template.php:17
49
+ msgid "Help"
50
+ msgstr ""
51
+
52
+ #: inc/settings-template.php:18 youtube-channel.php:208
53
+ msgid "Support"
54
+ msgstr ""
55
+
56
+ #: inc/settings-usage-shortcode.php:1
57
+ msgid "How to use shortcode"
58
+ msgstr ""
59
+
60
+ #: inc/settings-usage-shortcode.php:5
61
+ #, php-format
62
+ msgid ""
63
+ "You can use shortcode %s with options listed below (all options are optional "
64
+ "if you have set defaults in global plugin settings)."
65
+ msgstr ""
66
+
67
+ #: inc/settings-usage-shortcode.php:12 youtube-channel.php:334
68
+ msgid "General Settings"
69
+ msgstr ""
70
+
71
+ #: inc/settings-usage-shortcode.php:13 inc/widget.php:163
72
+ msgid "Video Settings"
73
+ msgstr ""
74
+
75
+ #: inc/settings-usage-shortcode.php:14 inc/widget.php:193
76
+ msgid "Content Layout"
77
+ msgstr ""
78
+
79
+ #: inc/settings-usage-shortcode.php:101
80
+ #, php-format
81
+ msgid ""
82
+ "Please note, you can omit all options listed above, and then will be used "
83
+ "plugin defaults customized on tabs %1$s, %2$s, %3$s and %4$s."
84
+ msgstr ""
85
+
86
+ #: inc/settings-usage-shortcode.php:112
87
+ #, php-format
88
+ msgid ""
89
+ "Important note: %s blocks inserted through widget have their own settings."
90
+ msgstr ""
91
+
92
+ #. Plugin Name of the plugin/theme
93
+ #: inc/settings-usage-shortcode.php:115 inc/settings.php:311
94
+ #: inc/settings.php:730 inc/settings.php:731 inc/settings.php:758
95
+ #: inc/settings.php:772 inc/settings.php:782 inc/settings.php:792
96
+ #: inc/widget.php:11
97
+ msgid "YouTube Channel"
98
+ msgstr ""
99
+
100
+ #: inc/settings-usage.php:1
101
+ msgid "How to use YouTube Channel"
102
+ msgstr ""
103
+
104
+ #: inc/settings-usage.php:2
105
+ msgid "You can insert YouTube Channel in couple different ways."
106
+ msgstr ""
107
+
108
+ #: inc/settings-usage.php:7
109
+ #, php-format
110
+ msgid "Add %s to preferred %s, and configure it there."
111
+ msgstr ""
112
+
113
+ #: inc/settings-usage.php:10
114
+ msgid "YouTube Channel Widget"
115
+ msgstr ""
116
+
117
+ #: inc/settings-usage.php:13
118
+ msgid "Widget Area"
119
+ msgstr ""
120
+
121
+ #: inc/settings-usage.php:19
122
+ #, php-format
123
+ msgid ""
124
+ "Insert shortcode %s to your page or text widget, and even modify default "
125
+ "settings by shortcode parameters listed in section below."
126
+ msgstr ""
127
+
128
+ #: inc/settings.php:46 youtube-channel.php:329
129
  msgid "YouTube Data API Key"
130
  msgstr ""
131
 
132
+ #: inc/settings.php:54 inc/settings.php:87
133
  msgid "Required"
134
  msgstr ""
135
 
136
  #: inc/settings.php:58
137
  #, php-format
138
  msgid ""
139
+ "Your YouTube Data API Key (get it from <a href=\"%1$s\" target=\"_blank\">"
140
+ "%2$s</a>)"
141
  msgstr ""
142
 
143
+ #: inc/settings.php:69 youtube-channel.php:331
144
  msgid "Google Developers Console"
145
  msgstr ""
146
 
147
+ #: inc/settings.php:79
148
  msgid "YouTube Channel ID"
149
  msgstr ""
150
 
151
+ #: inc/settings.php:91
152
  #, php-format
153
  msgid ""
154
+ "Your YouTube Channel ID (get it from <a href=\"%1$s\" target=\"_blank\">"
155
+ "%2$s</a>)"
156
  msgstr ""
157
 
158
+ #: inc/settings.php:102 inc/settings.php:136 inc/settings.php:762
159
  msgid "YouTube Account Overview"
160
  msgstr ""
161
 
162
+ #: inc/settings.php:112
163
  msgid "YouTube Vanity Name"
164
  msgstr ""
165
 
166
+ #: inc/settings.php:120 inc/settings.php:154 inc/settings.php:172
167
  msgid "Optional"
168
  msgstr ""
169
 
170
+ #: inc/settings.php:124
171
  #, php-format
172
  msgid ""
173
+ "Your YouTube Custom Name (get only part after %1$s instead whole URL from <a "
174
+ "href=\"%2$s\" target=\"_blank\">%3$s</a>)"
175
  msgstr ""
176
 
177
+ #: inc/settings.php:146
178
  msgid "Legacy YouTube Username"
179
  msgstr ""
180
 
181
+ #: inc/settings.php:155
182
  msgid "Your YouTube legacy username"
183
  msgstr ""
184
 
185
+ #: inc/settings.php:164
186
  msgid "Default Playlist ID"
187
  msgstr ""
188
 
189
+ #: inc/settings.php:173
190
  msgid "Enter default playlist ID (not playlist name)"
191
  msgstr ""
192
 
193
+ #: inc/settings.php:182 inc/widget.php:134
194
  msgid "Resource to use"
195
  msgstr ""
196
 
197
+ #: inc/settings.php:188
198
  msgid "Resource:"
199
  msgstr ""
200
 
201
+ #: inc/settings.php:189
202
  msgid "What to use as resource for feeds"
203
  msgstr ""
204
 
205
+ #: inc/settings.php:193
206
  msgid "Channel"
207
  msgstr ""
208
 
209
+ #: inc/settings.php:194 inc/widget.php:137
210
  msgid "Favourites"
211
  msgstr ""
212
 
213
+ #: inc/settings.php:195
214
  msgid "Liked Video"
215
  msgstr ""
216
 
217
+ #: inc/settings.php:196 inc/widget.php:139
218
  msgid "Playlist"
219
  msgstr ""
220
 
221
+ #: inc/settings.php:203
222
  msgid "Cache Timeout"
223
  msgstr ""
224
 
225
+ #: inc/settings.php:209
226
  msgid "Define caching timeout for YouTube feeds, in seconds"
227
  msgstr ""
228
 
229
+ #: inc/settings.php:213
230
  msgid "Do not chache"
231
  msgstr ""
232
 
233
+ #: inc/settings.php:214 youtube-channel.php:1276
234
  msgid "1 minute"
235
  msgstr ""
236
 
237
+ #: inc/settings.php:215 youtube-channel.php:1277
238
  msgid "5 minutes"
239
  msgstr ""
240
 
241
+ #: inc/settings.php:216 youtube-channel.php:1278
242
  msgid "15 minutes"
243
  msgstr ""
244
 
245
+ #: inc/settings.php:217 youtube-channel.php:1279
246
  msgid "30 minutes"
247
  msgstr ""
248
 
249
+ #: inc/settings.php:218 youtube-channel.php:1282
250
  msgid "1 hour"
251
  msgstr ""
252
 
253
+ #: inc/settings.php:219 youtube-channel.php:1283
254
  msgid "2 hours"
255
  msgstr ""
256
 
257
+ #: inc/settings.php:220 youtube-channel.php:1284
258
  msgid "5 hours"
259
  msgstr ""
260
 
261
+ #: inc/settings.php:221 youtube-channel.php:1285
262
  msgid "10 hours"
263
  msgstr ""
264
 
265
+ #: inc/settings.php:222 youtube-channel.php:1286
266
  msgid "12 hours"
267
  msgstr ""
268
 
269
+ #: inc/settings.php:223 youtube-channel.php:1287
270
  msgid "18 hours"
271
  msgstr ""
272
 
273
+ #: inc/settings.php:224 youtube-channel.php:1290
274
  msgid "1 day"
275
  msgstr ""
276
 
277
+ #: inc/settings.php:225 youtube-channel.php:1291
278
  msgid "2 days"
279
  msgstr ""
280
 
281
+ #: inc/settings.php:226 youtube-channel.php:1292
282
  msgid "3 days"
283
  msgstr ""
284
 
285
+ #: inc/settings.php:227 youtube-channel.php:1293
286
  msgid "4 days"
287
  msgstr ""
288
 
289
+ #: inc/settings.php:228 youtube-channel.php:1294
290
  msgid "5 days"
291
  msgstr ""
292
 
293
+ #: inc/settings.php:229 youtube-channel.php:1295
294
  msgid "6 days"
295
  msgstr ""
296
 
297
+ #: inc/settings.php:230 youtube-channel.php:1298
298
  msgid "1 week"
299
  msgstr ""
300
 
301
+ #: inc/settings.php:231 youtube-channel.php:1299
302
  msgid "2 weeks"
303
  msgstr ""
304
 
305
+ #: inc/settings.php:232 youtube-channel.php:1300
306
  msgid "3 weeks"
307
  msgstr ""
308
 
309
+ #: inc/settings.php:233 youtube-channel.php:1301
310
  msgid "1 month"
311
  msgstr ""
312
 
313
+ #: inc/settings.php:240 inc/widget.php:152
314
  msgid "Fetch"
315
  msgstr ""
316
 
317
+ #: inc/settings.php:246 inc/widget.php:152
318
  msgid ""
319
  "Number of videos that will be used for random pick (min 2, max 50, default "
320
  "25)"
321
  msgstr ""
322
 
323
+ #: inc/settings.php:257 inc/widget.php:155
324
  msgid "Show"
325
  msgstr ""
326
 
327
+ #: inc/settings.php:263 inc/widget.php:155
328
  msgid "Number of videos to display"
329
  msgstr ""
330
 
331
+ #: inc/settings.php:274
332
  msgid "Use Enhanced privacy"
333
  msgstr ""
334
 
335
+ #: inc/settings.php:283
336
  #, php-format
337
  msgid ""
338
+ "Enable this option to protect your visitors privacy. <a href=\"%1$s\" target="
339
+ "\"_blank\">%2$s</a>"
340
  msgstr ""
341
 
342
+ #: inc/settings.php:294 inc/settings.php:427
343
  msgid "Learn more here"
344
  msgstr ""
345
 
346
+ #: inc/settings.php:303
347
+ msgid "Enable TinyMCE button"
348
+ msgstr ""
349
+
350
+ #: inc/settings.php:310
351
+ #, php-format
352
+ msgid ""
353
+ "Disable this option to hide %s button from TinyMCE toolbar on post and page "
354
+ "editor."
355
+ msgstr ""
356
+
357
+ #: inc/settings.php:328
358
  msgid "Video Tweaks"
359
  msgstr ""
360
 
361
+ #: inc/settings.php:336
362
  msgid "Initial Width"
363
  msgstr ""
364
 
365
+ #: inc/settings.php:342
366
  msgid "Set default width for displayed video, in pixels"
367
  msgstr ""
368
 
369
+ #: inc/settings.php:353 inc/widget.php:164
370
  msgid "Aspect ratio"
371
  msgstr ""
372
 
373
+ #: inc/settings.php:359
374
  msgid "Select aspect ratio for displayed video"
375
  msgstr ""
376
 
377
+ #: inc/settings.php:371
378
  msgid "What to show?"
379
  msgstr ""
380
 
381
+ #: inc/settings.php:377
382
  msgid "Choose how to embed video block"
383
  msgstr ""
384
 
385
+ #: inc/settings.php:381 inc/widget.php:179
386
  msgid "Thumbnail"
387
  msgstr ""
388
 
389
+ #: inc/settings.php:382 inc/widget.php:180
390
  msgid "HTML5 (iframe)"
391
  msgstr ""
392
 
393
+ #: inc/settings.php:383 inc/widget.php:181
394
  msgid "HTML5 (iframe) Asynchronous"
395
  msgstr ""
396
 
397
+ #: inc/settings.php:384 inc/widget.php:182
398
  msgid "Embedded Playlist"
399
  msgstr ""
400
 
401
+ #: inc/settings.php:392
402
  msgid "Enable Responsive"
403
  msgstr ""
404
 
405
+ #: inc/settings.php:398
406
  msgid ""
407
  "Enable this option to make YTC videos and thumbnails responsive by default. "
408
  "Please note, this option will set videos and thumbnail to full width "
409
  "relative to parent container, and disable more than one video per row."
410
  msgstr ""
411
 
412
+ #: inc/settings.php:407
413
  msgid "Play inline on iOS"
414
  msgstr ""
415
 
416
+ #: inc/settings.php:416
417
  #, php-format
418
  msgid ""
419
  "Enable this option to override fullscreen playback on iOS, and force inline "
420
+ "playback on page and in lightbox. <a href=\"%1$s\" target=\"_blank\">%2$s</a>"
421
  msgstr ""
422
 
423
+ #: inc/settings.php:436
424
  msgid "Disable Lightbox"
425
  msgstr ""
426
 
427
+ #: inc/settings.php:442
428
  msgid ""
429
  "Enable this option to disable built-in lightbox for thumbnails (in case that "
430
  "you have youtube links lightbox trigger in theme or other plugin)."
431
  msgstr ""
432
 
433
+ #: inc/settings.php:450
434
+ msgid "Enable Full Screen"
435
+ msgstr ""
436
+
437
+ #: inc/settings.php:456
438
+ msgid ""
439
+ "Enable this option to make available Full Screen button for embedded "
440
+ "playlists."
441
+ msgstr ""
442
+
443
+ #: inc/settings.php:465
444
  msgid "Light Theme"
445
  msgstr ""
446
 
447
+ #: inc/settings.php:471
448
  msgid ""
449
  "Enable this option to use light theme for playback controls instead dark."
450
  msgstr ""
451
 
452
+ #: inc/settings.php:479
453
  msgid "Hide Player Controls"
454
  msgstr ""
455
 
456
+ #: inc/settings.php:485
457
  msgid "Enable this option to hide playback controls"
458
  msgstr ""
459
 
460
+ #: inc/settings.php:494 inc/widget.php:187
461
  msgid "Autoplay video or playlist"
462
  msgstr ""
463
 
464
+ #: inc/settings.php:500
465
  msgid ""
466
  "Enable this option to start video playback right after block is rendered"
467
  msgstr ""
468
 
469
+ #: inc/settings.php:508 inc/widget.php:188
470
  msgid "Mute video on autoplay"
471
  msgstr ""
472
 
473
+ #: inc/settings.php:514
474
  msgid "Enable this option to mute video when start autoplay"
475
  msgstr ""
476
 
477
+ #: inc/settings.php:522 inc/widget.php:189
478
  msgid "Hide related videos"
479
  msgstr ""
480
 
481
+ #: inc/settings.php:528
482
  msgid "Enable this option to hide related videos after finished playback"
483
  msgstr ""
484
 
485
+ #: inc/settings.php:536
486
  msgid "Hide YT logo"
487
  msgstr ""
488
 
489
+ #: inc/settings.php:542
490
  msgid ""
491
  "Enable this option to hide YouTube logo from playback control bar. Does not "
492
  "work for all videos."
493
  msgstr ""
494
 
495
+ #: inc/settings.php:550
496
  msgid "Hide video annotations"
497
  msgstr ""
498
 
499
+ #: inc/settings.php:556
500
  msgid ""
501
  "Enable this option to hide video annotations (custom text set by uploader "
502
  "over video during playback)"
503
  msgstr ""
504
 
505
+ #: inc/settings.php:564 inc/widget.php:213
506
  msgid "Hide video info"
507
  msgstr ""
508
 
509
+ #: inc/settings.php:570
510
  msgid ""
511
  "Enable this option to hide informations about video before play start (video "
512
  "title and uploader in overlay)"
513
  msgstr ""
514
 
515
+ #: inc/settings.php:586
516
  msgid "Content Tweaks"
517
  msgstr ""
518
 
519
+ #: inc/settings.php:594 inc/widget.php:196
520
  msgid "Show video title"
521
  msgstr ""
522
 
523
+ #: inc/settings.php:600
524
  msgid "Select should we and where display title of video"
525
  msgstr ""
526
 
527
+ #: inc/settings.php:604 inc/widget.php:199
528
  msgid "Hide title"
529
  msgstr ""
530
 
531
+ #: inc/settings.php:605 inc/widget.php:200
532
  msgid "Above video/thumbnail"
533
  msgstr ""
534
 
535
+ #: inc/settings.php:606 inc/widget.php:201
536
  msgid "Below video/thumbnail"
537
  msgstr ""
538
 
539
+ #: inc/settings.php:613 inc/widget.php:204
540
  msgid "Show video description"
541
  msgstr ""
542
 
543
+ #: inc/settings.php:619
544
  msgid "Enable this option to display description for video"
545
  msgstr ""
546
 
547
+ #: inc/settings.php:627 inc/widget.php:206
548
  msgid "Description length"
549
  msgstr ""
550
 
551
+ #: inc/settings.php:633
552
  msgid "Enter length for video description in characters (0 for full length)"
553
  msgstr ""
554
 
555
+ #: inc/settings.php:661
 
 
 
 
 
 
556
  msgid "Link to..."
557
  msgstr ""
558
 
559
+ #: inc/settings.php:668
560
  msgid "Set where link will lead visitors"
561
  msgstr ""
562
 
563
+ #: inc/settings.php:672 inc/widget.php:223
564
  msgid "Hide link"
565
  msgstr ""
566
 
567
+ #: inc/settings.php:673
568
  msgid "Vanity custom URL"
569
  msgstr ""
570
 
571
+ #: inc/settings.php:674
572
  msgid "Channel page URL"
573
  msgstr ""
574
 
575
+ #: inc/settings.php:675
576
  msgid "Legacy username page"
577
  msgstr ""
578
 
579
+ #: inc/settings.php:682
580
  msgid "Open link in..."
581
  msgstr ""
582
 
583
+ #: inc/settings.php:689
584
  msgid "Set where link will be opened"
585
  msgstr ""
586
 
587
+ #: inc/settings.php:693
588
  msgid "same window"
589
  msgstr ""
590
 
591
+ #: inc/settings.php:694
592
  msgid "new window (JavaScript)"
593
  msgstr ""
594
 
595
+ #: inc/settings.php:695
596
  msgid "new window (target=\"_blank\")"
597
  msgstr ""
598
 
599
+ #: inc/settings.php:702
600
  msgid "Text for Visit channel link"
601
  msgstr ""
602
 
603
+ #: inc/settings.php:709
604
  msgid "Set default title for link"
605
  msgstr ""
606
 
607
+ #: inc/settings.php:748
 
 
 
 
 
 
 
608
  #, php-format
609
  msgid ""
610
  "Configure general defaults for %1$s used as fallback options in widget or "
612
  "%5$s</a>."
613
  msgstr ""
614
 
615
+ #: inc/settings.php:759 inc/widget.php:108 inc/widget.php:119
616
  msgid "Channel ID"
617
  msgstr ""
618
 
619
+ #: inc/settings.php:760
620
  msgid "Vanity URL"
621
  msgstr ""
622
 
623
+ #: inc/settings.php:771
624
  #, php-format
625
  msgid ""
626
  "Configure video specific defaults for %s used as fallback options in widget "
627
  "or shortcodes."
628
  msgstr ""
629
 
630
+ #: inc/settings.php:781
631
  #, php-format
632
  msgid ""
633
  "Configure defaults of content around and over videos for %s used as fallback "
634
  "options in widget or shortcodes."
635
  msgstr ""
636
 
637
+ #: inc/settings.php:791
638
  #, php-format
639
  msgid ""
640
  "Configure defaults for link to channel below %s block used as fallback "
641
  "options in widget or shortcodes."
642
  msgstr ""
643
 
644
+ #: inc/settings.php:968
645
  msgid "You do not have sufficient permissions to access this page."
646
  msgstr ""
647
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
648
  #: inc/widget.php:14
649
  msgid "Serve YouTube videos from channel or playlist right to widget area"
650
  msgstr ""
805
  "%channel% and %username%."
806
  msgstr ""
807
 
808
+ #: inc/widget.php:219 youtube-channel.php:1049
809
  msgid "Visit our YouTube channel"
810
  msgstr ""
811
 
851
  msgid "FAQ"
852
  msgstr ""
853
 
854
+ #: youtube-channel.php:185
855
  msgid "Settings"
856
  msgstr ""
857
 
858
+ #: youtube-channel.php:293
859
  #, php-format
860
  msgid ""
861
  "<p>Your website running on web server with PHP version %s. Please note that "
863
  "href=\"%s\" class=\"dismiss\">Dismiss</a></p>"
864
  msgstr ""
865
 
866
+ #: youtube-channel.php:306
867
  #, php-format
868
  msgid ""
869
  "<p>Since <strong>%s</strong> v3.0.6 we store <strong>YouTube Data API Key</"
872
  "\">Dismiss</a></p>"
873
  msgstr ""
874
 
875
+ #: youtube-channel.php:318
876
  #, php-format
877
  msgid ""
878
  "<p>Please note, to make <strong>%1$s</strong> plugin v3+ work, generate "
884
  "mentioned above!</p>"
885
  msgstr ""
886
 
887
+ #: youtube-channel.php:336
888
  msgid "support forum"
889
  msgstr ""
890
 
891
+ #: youtube-channel.php:345
892
  #, php-format
893
  msgid ""
894
  "<p><strong>%s</strong> since version 2.4 supports linking to channel through "
897
  "a>"
898
  msgstr ""
899
 
900
+ #: youtube-channel.php:359
901
  #, php-format
902
  msgid ""
903
  "<p><strong>%s</strong> changed shortcode parameters by removing "
907
  "<a href=\"%s\" class=\"dismiss\">Dismiss</a>"
908
  msgstr ""
909
 
910
+ #: youtube-channel.php:622
911
  #, php-format
912
  msgid ""
913
  "<strong>%s</strong> version 3+ requires <strong>YouTube DATA API Key</"
914
  "strong> to work. <a href=\"%s\" target=\"_blank\">Learn more here</a>."
915
  msgstr ""
916
 
917
+ #: youtube-channel.php:796
918
  #, php-format
919
  msgid ""
920
  "You have set to display videos from %s [resource list ID: %s], but there "
921
  "have no public videos in that resouce."
922
  msgstr ""
923
 
924
+ #: youtube-channel.php:799
925
  #, php-format
926
  msgid ""
927
  "We have empty record for this feed. Please read <a href=\"%s\" target="
929
  "\"_blank\">support</a>."
930
  msgstr ""
931
 
932
+ #: youtube-channel.php:841
933
  #, php-format
934
  msgid ""
935
  "Double check <em>YouTube Data API Key</em> on <em>General</em> plugin tab "
937
  "\">Installation</a> document."
938
  msgstr ""
939
 
940
+ #: youtube-channel.php:847
941
  #, php-format
942
  msgid ""
943
  "You have set wrong Channel ID. Fix that in General plugin settings, Widget "
944
  "and/or shortcode. Read <a href=\"%s\" target=\"_blank\">FAQ</a> document."
945
  msgstr ""
946
 
947
+ #: youtube-channel.php:850
948
  #, php-format
949
  msgid ""
950
  "You do not have permission to access ressource <strong>%s</strong> (it's "
951
  "maybe set to private or even does not exists!)"
952
  msgstr ""
953
 
954
+ #: youtube-channel.php:971
955
  msgid "Oops, something went wrong."
956
  msgstr ""
957
 
958
+ #: youtube-channel.php:1052
959
  msgid "in new window/tab"
960
  msgstr ""
961
 
962
+ #: youtube-channel.php:1202
963
  #, php-format
964
  msgid "Watch video %1$s published on %2$s"
965
  msgstr ""
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: urkekg
3
  Donate link: http://urosevic.net/wordpress/donate/?donate_for=youtube-channel
4
  Tags: youtube, channel, playlist, single, widget, widgets, youtube player, feed, video, thumbnail, embed, sidebar, iframe, html5, responsive
5
  Requires at least: 3.9.0
6
- Tested up to: 4.3
7
- Stable tag: 3.0.8.5
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -203,18 +203,20 @@ Do exactly what message says - check and correct Channel ID in default settings/
203
  1. Try to remove restrictions by referer or IP in your **YouTube Data API Key** and refresh page after couple minutes.
204
  1. If that does not help, please try to create new API Key for Server w/o restrictions (not to regenerate existing one).
205
 
206
- If there is no `YTC ERROR` code in HTML source, visit [Google API Explorer](https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.playlistItems.list?part=snippet&maxResults=5&playlistId=) and append:
 
 
207
 
208
  * for videos from channel replace **UC** with **UU** in Channel ID (so *UCRPqmcpGcJ_gFtTmN_a4aVA* becomes *UURPqmcpGcJ_gFtTmN_a4aVA*)
209
  * for videos from Favourited videos replace **UC** with **FL** (so *UCRPqmcpGcJ_gFtTmN_a4aVA* becomes *FLRPqmcpGcJ_gFtTmN_a4aVA*)
210
  * for videos from Liked Videos replace **UC** with **LL** (so *UCRPqmcpGcJ_gFtTmN_a4aVA* becomes *LLRPqmcpGcJ_gFtTmN_a4aVA*)
211
  * for videos from Playlist simply use Playlist ID (like *PLEC850BE962234400* or *RDMMjUe8uoKdHao*)
212
 
213
- Note that all four resources are *playlists* (including channel), so append mentioned ID to field **playlistId** (not to **id**), and click **Execute** button at the bottom of that page.
214
 
215
- 1. If you receive some error, fix settings.
216
- 1. If there is no error but you do not get any video in results - contact Google Support.
217
- 1. If there are video results but not displayed with YouTube Channel plugin - [contact us](https://wordpress.org/support/plugin/youtube-channel)
218
 
219
  = What this YTC ERROR/HTTP Error means? =
220
 
@@ -345,6 +347,10 @@ If you really need that missing feature ASAP, feel free to [contact me](urosevic
345
  If you don't wish to pay for enhancements (then you don't care would that be implemented in a week, month, year or so), then send new [Support topic](https://wordpress.org/support/plugin/youtube-channel) with *Topic title* in format **[Feature Request] ...**
346
 
347
  == Changelog ==
 
 
 
 
348
  = 3.0.8.5 =
349
  * Enhanced: Settings page made compliant to WordPress Core Coding Standard
350
  * Fix: Wrong links to external resources on Settings page
3
  Donate link: http://urosevic.net/wordpress/donate/?donate_for=youtube-channel
4
  Tags: youtube, channel, playlist, single, widget, widgets, youtube player, feed, video, thumbnail, embed, sidebar, iframe, html5, responsive
5
  Requires at least: 3.9.0
6
+ Tested up to: 4.3.2
7
+ Stable tag: 3.0.8.6
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
203
  1. Try to remove restrictions by referer or IP in your **YouTube Data API Key** and refresh page after couple minutes.
204
  1. If that does not help, please try to create new API Key for Server w/o restrictions (not to regenerate existing one).
205
 
206
+ = How to use Google APIs Explorer to verify YouTube feeds? =
207
+
208
+ If there is no `YTC ERROR` code in HTML source, visit [Google API Explorer](https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.playlistItems.list?part=snippet&maxResults=5&playlistId=) and append to the end of URL one of resource ID’s based on your Channel ID:
209
 
210
  * for videos from channel replace **UC** with **UU** in Channel ID (so *UCRPqmcpGcJ_gFtTmN_a4aVA* becomes *UURPqmcpGcJ_gFtTmN_a4aVA*)
211
  * for videos from Favourited videos replace **UC** with **FL** (so *UCRPqmcpGcJ_gFtTmN_a4aVA* becomes *FLRPqmcpGcJ_gFtTmN_a4aVA*)
212
  * for videos from Liked Videos replace **UC** with **LL** (so *UCRPqmcpGcJ_gFtTmN_a4aVA* becomes *LLRPqmcpGcJ_gFtTmN_a4aVA*)
213
  * for videos from Playlist simply use Playlist ID (like *PLEC850BE962234400* or *RDMMjUe8uoKdHao*)
214
 
215
+ Note that all four resources are *playlists* (including uploads to channel), so append mentioned ID to field **playlistId** (not to **id**), and click **Execute** button at the bottom of that page.
216
 
217
+ 1. If you receive some error in results, tune parameters in APIs Explorer.
218
+ 1. If there is no error but you do not get any video in results, and you are sure that there is public videos in selected resource – contact Google Support.
219
+ 1. If there are video results but not displayed with YouTube Channel plugin – check topic [Read before you post support question or report bug](https://wordpress.org/support/topic/ytc3-read-before-you-post-support-question-or-report-bug) and then [start your own support topic](https://wordpress.org/support/plugin/youtube-channel#postform).
220
 
221
  = What this YTC ERROR/HTTP Error means? =
222
 
347
  If you don't wish to pay for enhancements (then you don't care would that be implemented in a week, month, year or so), then send new [Support topic](https://wordpress.org/support/plugin/youtube-channel) with *Topic title* in format **[Feature Request] ...**
348
 
349
  == Changelog ==
350
+ = 3.0.8.6 =
351
+ * Fix: Broken Enhanced Privacy on small screens in forked MagnificPopupAU library
352
+ * Enhanced: Finished making code compliant to WordPress Core coding standards
353
+
354
  = 3.0.8.5 =
355
  * Enhanced: Settings page made compliant to WordPress Core Coding Standard
356
  * Fix: Wrong links to external resources on Settings page
youtube-channel.php CHANGED
@@ -1,1493 +1,1482 @@
1
- <?php
2
- /*
3
- Plugin Name: YouTube Channel
4
- Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
5
- Description: Quick and easy embed latest or random videos from YouTube channel (user uploads, liked or favourited videos) or playlist. Use <a href="widgets.php">widget</a> for sidebar or shortcode for content. Works with <em>YouTube Data API v3</em>.
6
- Version: 3.0.8.5
7
- Author: Aleksandar Urošević
8
- Author URI: http://urosevic.net/
9
- Text Domain: youtube-channel
10
- */
11
-
12
- // Exit if accessed directly
13
- if ( ! defined( 'ABSPATH' ) ) exit;
14
-
15
- if ( ! class_exists('WPAU_YOUTUBE_CHANNEL') )
16
- {
17
- class WPAU_YOUTUBE_CHANNEL
18
- {
19
-
20
- const DB_VER = 14;
21
- const VER = '3.0.8.5';
22
-
23
- public $plugin_name = "YouTube Channel";
24
- public $plugin_slug = "youtube-channel";
25
- public $plugin_option = "youtube_channel_defaults";
26
- public $plugin_url;
27
-
28
- /**
29
- * Construct class
30
- */
31
- function __construct() {
32
-
33
- $this->plugin_url = plugin_dir_url(__FILE__);
34
- load_plugin_textdomain( $this->plugin_slug, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
35
-
36
- // Generate debug JSON
37
- if ( ! empty($_GET['ytc_debug_json_for']) ) {
38
- $this->generate_debug_json();
39
- }
40
-
41
- // Clear all YTC cache
42
- add_action( 'wp_ajax_ytc_clear_all_cache', array(&$this, 'clear_all_cache') );
43
-
44
- // Activation hook and maybe update trigger
45
- register_activation_hook( __FILE__, array($this, 'activate') );
46
- add_action( 'plugins_loaded', array($this, 'maybe_update') );
47
-
48
- $this->defaults = self::defaults();
49
-
50
- // TinyMCE AddOn
51
- if ( ! empty($this->defaults['tinymce']) ) {
52
- add_filter( 'mce_external_plugins', array($this, 'mce_external_plugins'), 998 );
53
- add_filter( 'mce_buttons', array($this, "mce_buttons"), 999 );
54
- }
55
-
56
- if ( is_admin() ) {
57
-
58
- // Initialize Plugin Settings Magic
59
- add_action( 'init', array($this, 'admin_init') );
60
-
61
- // Add various Dashboard notices (if needed)
62
- add_action( 'admin_notices', array($this, 'admin_notices') );
63
-
64
- // Enqueue scripts and styles for Widgets page
65
- add_action( 'admin_enqueue_scripts', array($this, 'widget_scripts') );
66
-
67
- } else { // ELSE if ( is_admin() )
68
-
69
- // Enqueue frontend scripts
70
- add_action( 'wp_enqueue_scripts', array($this, 'enqueue_scripts') );
71
- add_action( 'wp_footer', array($this, 'footer_scripts') );
72
-
73
- } // END if ( is_admin() )
74
-
75
- // Load widget
76
- require_once('inc/widget.php');
77
-
78
- // Register shortcodes `youtube_channel` and `ytc`
79
- add_shortcode( 'youtube_channel', array($this, 'shortcode') );
80
- add_shortcode( 'ytc', array($this, 'shortcode') );
81
-
82
- } // END function __construct()
83
-
84
- /**
85
- * Activate the plugin
86
- * Credits: http://solislab.com/blog/plugin-activation-checklist/#update-routines
87
- */
88
- public static function activate() {
89
-
90
- global $WPAU_YOUTUBE_CHANNEL;
91
- $WPAU_YOUTUBE_CHANNEL->init_options();
92
- $WPAU_YOUTUBE_CHANNEL->maybe_update();
93
-
94
- } // end function activate
95
-
96
- /**
97
- * Return initial options
98
- * @return array Global defaults for current plugin version
99
- */
100
- public function init_options() {
101
-
102
- $init = array(
103
- 'vanity' => '', // $this->vanity_id,
104
- 'channel' => '', // $this->channel_id,
105
- 'username' => '', // $this->username_id,
106
- 'playlist' => '', // $this->playlist_id,
107
- 'resource' => 0, // ex use_res
108
- 'cache' => 300, // 5 minutes // ex cache_time
109
- 'fetch' => 25, // ex maxrnd
110
- 'num' => 1, // ex vidqty
111
- 'privacy' => 0,
112
-
113
- 'ratio' => 3, // 3 - 16:9, 1 - 4:3 (deprecated: 2 - 16:10)
114
- 'width' => 306,
115
- 'responsive' => 1,
116
- 'display' => 'thumbnail', // thumbnail, iframe, iframe2, playlist (deprecated: chromeless, object)
117
- 'themelight' => 0,
118
- 'fullscreen' => 0,
119
- 'controls' => 0,
120
- 'autoplay' => 0,
121
- 'autoplay_mute' => 0,
122
- 'norel' => 0,
123
- 'playsinline' => 0, // play video on mobile devices inline instead in native device player
124
- 'showtitle' => 'none',
125
- 'showdesc' => 0,
126
- 'desclen' => 0,
127
- 'modestbranding' => 0,
128
- 'hideanno' => 0,
129
- 'hideinfo' => 0,
130
-
131
- 'goto_txt' => 'Visit our channel',
132
- 'popup_goto' => 0, // 0 same window, 1 new window JS, 2 new window target
133
- 'link_to' => 'none', // 0 legacy username, 1 channel, 2 vanity
134
- 'tinymce' => 1 // show TInyMCE button by default
135
- );
136
-
137
- add_option('youtube_channel_version', self::VER, '', 'no');
138
- add_option('youtube_channel_db_ver', self::DB_VER, '', 'no');
139
- add_option($this->plugin_option, $init, '', 'no');
140
-
141
- return $init;
142
-
143
- } // END public function init_options()
144
-
145
- /**
146
- * Check do we need to migrate options
147
- */
148
- public function maybe_update() {
149
-
150
- // bail if this plugin data doesn't need updating
151
- if ( get_option( 'youtube_channel_db_ver' ) >= self::DB_VER ) {
152
- return;
153
- }
154
-
155
- require_once( dirname(__FILE__) . '/update.php' );
156
- au_youtube_channel_update();
157
-
158
- } // END public function maybe_update()
159
-
160
- /**
161
- * Initialize Settings link for Plugins page and create Settings page
162
- */
163
- function admin_init() {
164
-
165
- add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array($this, 'add_settings_link') );
166
- // add row to plugin page
167
- add_filter( 'plugin_row_meta', array($this, 'add_plugin_meta_links'), 10, 2 );
168
-
169
- require_once( 'inc/settings.php' );
170
-
171
- global $WPAU_YOUTUBE_CHANNEL_SETTINGS;
172
- if ( empty($WPAU_YOUTUBE_CHANNEL_SETTINGS) )
173
- $WPAU_YOUTUBE_CHANNEL_SETTINGS = new WPAU_YOUTUBE_CHANNEL_SETTINGS();
174
-
175
- } // END function admin_init_settings()
176
-
177
- /**
178
- * Append Settings link for Plugins page
179
- * @param array $links array of links on plugins page
180
- */
181
- function add_settings_link($links) {
182
-
183
- $settings_title = __('Settings');
184
- $settings_link = "<a href=\"options-general.php?page={$this->plugin_slug}\">{$settings_title}</a>";
185
- array_unshift( $links, $settings_link );
186
-
187
- // Free some memory
188
- unset($settings_title, $settings_link);
189
-
190
- // Return updated array of links
191
- return $links;
192
-
193
- } // END function add_settings_link()
194
-
195
- /**
196
- * Add link to official plugin page
197
- */
198
- function add_plugin_meta_links($links, $file) {
199
-
200
- if ($file === 'youtube-channel/youtube-channel.php') {
201
- return array_merge(
202
- $links,
203
- array( sprintf(
204
- '<a href="https://wordpress.org/support/plugin/youtube-channel" target="_blank">%s</a>',
205
- __('Support')
206
- ) )
207
- );
208
- }
209
- return $links;
210
-
211
- }
212
- /**
213
- * Enqueue admin scripts and styles for widget customization
214
- */
215
- function widget_scripts() {
216
-
217
- global $pagenow;
218
-
219
- // Enqueue only on widget or post pages
220
- if( $pagenow !== 'widgets.php' && $pagenow !== 'customize.php' && $pagenow !== 'options-general.php' && $pagenow !== 'post.php' ) {
221
- return;
222
- }
223
-
224
- // Enqueue on post page only if tinymce is enabled
225
- if ( $pagenow == 'post.php' && empty($this->defaults['tinymce']) ) {
226
- return;
227
- }
228
-
229
- /*
230
- wp_enqueue_script(
231
- $this->plugin_slug . '-admin',
232
- plugins_url( 'assets/js/admin.min.js', __FILE__ ),
233
- array('jquery'),
234
- self::VER
235
- );*/
236
- wp_enqueue_style(
237
- $this->plugin_slug . '-admin',
238
- plugins_url( 'assets/css/admin.css', __FILE__ ),
239
- array(),
240
- self::VER
241
- );
242
-
243
- } // END function widget_scripts()
244
-
245
- /**
246
- * Print dashboard notice
247
- * @return string Formatted notice with usefull explanation
248
- */
249
- function admin_notices() {
250
-
251
- // Get array of dismissed notices
252
- $dismissed_notices = get_option('youtube_channel_dismissed_notices');
253
-
254
- // Dismiss notices if requested and then update option in DB
255
- if ( ! empty($_GET['ytc_dismiss_notice_old_php']) ) {
256
- $dismissed_notices['old_php'] = 1;
257
- update_option('youtube_channel_dismissed_notices', $dismissed_notices);
258
- }
259
- if ( ! empty($_GET['ytc_dismiss_notice_apikey_wpconfig']) ) {
260
- $dismissed_notices['apikey_wpconfig'] = 1;
261
- update_option('youtube_channel_dismissed_notices', $dismissed_notices);
262
- }
263
- if ( ! empty($_GET['ytc_dismiss_notice_vanity_option']) ) {
264
- $dismissed_notices['vanity_option'] = 1;
265
- update_option('youtube_channel_dismissed_notices', $dismissed_notices);
266
- }
267
- if ( ! empty($_GET['ytc_dismiss_notice_changed_shortcode_308']) ) {
268
- $dismissed_notices['changed_shortcode_308'] = 1;
269
- update_option('youtube_channel_dismissed_notices', $dismissed_notices);
270
- }
271
-
272
- // Prepare vars for notices
273
- $settings_page = 'options-general.php?page=youtube-channel';
274
- $notice = array(
275
- 'error' => '',
276
- 'warning' => '',
277
- 'info' => ''
278
- );
279
-
280
- // Inform if PHP version is lower than 5.3
281
- if (
282
- version_compare(PHP_VERSION, "5.3", "<") &&
283
- (
284
- empty($dismissed_notices) ||
285
- ( ! empty($dismissed_notices) && empty($dismissed_notices['old_php']) )
286
- )
287
- ) {
288
- $notice['info'] .= sprintf(
289
- __('<p>Your website running on web server with PHP version %s. Please note that <strong>%s</strong> requires PHP at least 5.3 or newer to work properly. <a href="%s" class="dismiss">Dismiss</a></p>', 'youtube-channel'),
290
- PHP_VERSION,
291
- $this->plugin_name,
292
- '?ytc_dismiss_notice_old_php=1'
293
- );
294
- }
295
-
296
- // Inform if YOUTUBE_DATA_API_KEY is still in wp-config.php
297
- if (
298
- defined('YOUTUBE_DATA_API_KEY') &&
299
- empty($dismissed_notices['apikey_wpconfig'])
300
- ) {
301
- $notice['info'] .= sprintf(
302
- __('<p>Since <strong>%s</strong> v3.0.6 we store <strong>YouTube Data API Key</strong> in plugin settings. So, you can safely remove %s define line from your <strong>wp-config.php</strong> file. <a href="%s" class="dismiss">Dismiss</a></p>', 'youtube-channel'),
303
- $this->plugin_name,
304
- 'YOUTUBE_DATA_API_KEY',
305
- '?ytc_dismiss_notice_apikey_wpconfig=1'
306
- );
307
- }
308
-
309
- // No YouTube DATA Api Key?
310
- if ( empty($this->defaults['apikey']) ) {
311
- $notice['error'] .= sprintf(
312
- wp_kses(
313
- __(
314
- '<p>Please note, to make <strong>%1$s</strong> plugin v3+ work, generate <strong>%2$s</strong> in <a href="%3$s" target="_blank">%4$s</a>, as explained <a href="%5$s" target="_blank">here</a>, then add it to <a href="%6$s">%7$s</a>.<br><br>If you have any issue with new version of plugin, please ask for help on official <a href="%8$s" target="_blank">%9$s</a>.<br>This notice will disappear when you add missing key as mentioned above!</p>',
315
- 'youtube-channel'
316
- ),
317
- array(
318
- 'a' => array( 'href' => array(), 'target' => array('_blank') ),
319
- 'p' => array(),
320
- 'strong' => array(),
321
- 'br' => array(),
322
- )
323
- ),
324
- $this->plugin_name,
325
- __('YouTube Data API Key', 'youtube-channel'),
326
- esc_url('https://console.developers.google.com/project'),
327
- __('Google Developers Console', 'youtube-channel'),
328
- esc_url('http://urosevic.net/wordpress/plugins/youtube-channel/#youtube_data_api_key'),
329
- esc_url('options-general.php?page=youtube-channel&tab=general'),
330
- __('General Settings', 'youtube-channel'),
331
- esc_url('https://wordpress.org/support/plugin/youtube-channel'),
332
- __('support forum', 'youtube-channel')
333
- );
334
- }
335
-
336
- if (
337
- empty($dismissed_notices) ||
338
- ( ! empty($dismissed_notices) && empty($dismissed_notices['vanity_option']) )
339
- ) {
340
- $notice['warning'] .= sprintf(
341
- __('<p><strong>%s</strong> since version 2.4 supports linking to channel through <em>Vanity/Custom</em> URL. Please review <a href="%s">global</a> and <a href="%s">widgets</a> settings. <a href="%s" class="dismiss">Dismiss</a>', 'youtube-channel'),
342
- $this->plugin_name,
343
- $settings_page,
344
- 'widgets.php',
345
- '?ytc_dismiss_notice_vanity_option=1'
346
- );
347
- }
348
-
349
- // v3.0.8.1 shortcode changes from v3.0.8
350
- if (
351
- empty($dismissed_notices) ||
352
- ( ! empty($dismissed_notices) && empty($dismissed_notices['changed_shortcode_308']) )
353
- ) {
354
- $notice['warning'] .= sprintf(
355
- __('<p><strong>%s</strong> changed shortcode parameters by removing <code>only_pl</code> and <code>showgoto</code>, and combining with parameters <code>display</code> and <code>link_to</code> respectively. Please check out <a href="%s&tab=help">%s</a> and update your shortcodes. <a href="%s" class="dismiss">Dismiss</a>', 'youtube-channel'),
356
- $this->plugin_name,
357
- $settings_page,
358
- 'Help: How to use shortcode',
359
- '?ytc_dismiss_notice_changed_shortcode_308=1'
360
- );
361
- }
362
- foreach ( $notice as $type => $message ) {
363
- if ( ! empty($message) ) {
364
- echo "<div class=\"notice notice-{$type}\">{$message}</div>";
365
- }
366
- }
367
-
368
- } // END function admin_notices()
369
-
370
- /**
371
- * Get default options from DB
372
- * @return array Latest global defaults
373
- */
374
- public function defaults() {
375
-
376
- $defaults = get_option($this->plugin_option);
377
- if ( empty($defaults) ) {
378
- $this->init_options();
379
- }
380
-
381
- return $defaults;
382
-
383
- }
384
-
385
- /**
386
- * Enqueue frontend scripts and styles
387
- */
388
- function enqueue_scripts() {
389
-
390
- // Do we need our own lightbox?
391
- if ( empty($this->defaults['nolightbox']) ) {
392
- wp_enqueue_style(
393
- 'magnific-popup-au',
394
- plugins_url('assets/lib/magnific-popup/magnific-popup.min.css', __FILE__),
395
- array(),
396
- self::VER
397
- );
398
- wp_enqueue_script(
399
- 'magnific-popup-au',
400
- plugins_url('assets/lib/magnific-popup/jquery.magnific-popup.min.js', __FILE__),
401
- array('jquery'),
402
- self::VER,
403
- true
404
- );
405
- }
406
-
407
- wp_enqueue_style(
408
- 'youtube-channel',
409
- plugins_url('assets/css/youtube-channel.css', __FILE__),
410
- array(),
411
- self::VER
412
- );
413
- /* Not needed for v3.0.8.x
414
- wp_enqueue_script(
415
- 'youtube-channel',
416
- plugins_url('assets/js/youtube-channel.min.js', __FILE__),
417
- array('jquery'),
418
- self::VER,
419
- true
420
- );
421
- */
422
- } // end function enqueue_scripts
423
-
424
- /**
425
- * Generate comlete inline JavaScript code that conains
426
- * Async video load and lightbox init for thumbnails
427
- * @return string Compressed JavaScript code
428
- */
429
- function footer_scripts() {
430
-
431
- $js = '';
432
-
433
- // Print YT API only if we have set ytc_html5_js in $_SESSION
434
- if ( ! empty($_SESSION['ytc_html5_js']) ) {
435
- $js .= "
436
- if (!window['YT']) {
437
- var tag=document.createElement('script');
438
- tag.src=\"//www.youtube.com/iframe_api\";
439
- var firstScriptTag=document.getElementsByTagName('script')[0];
440
- firstScriptTag.parentNode.insertBefore(tag,firstScriptTag);
441
- }
442
- function ytc_create_ytplayers(){
443
- {$_SESSION['ytc_html5_js']}
444
- }
445
- try {
446
- ytc_create_ytplayers();
447
- } catch (e) {}
448
- function onYouTubeIframeAPIReady(){
449
- ytc_create_ytplayers();
450
- }
451
- function ytc_mute(event){event.target.mute();}
452
- ";
453
- } // END if ( ! empty($_SESSION['ytc_html5_js']) )
454
-
455
- // Print Magnific Popup if not disabled
456
- if ( empty($this->defaults['nolightbox']) ) {
457
- $js .= "
458
- function ytc_init_MPAU() {
459
- jQuery('.ytc-lightbox').magnificPopupAU({
460
- disableOn:320,
461
- type:'iframe',
462
- mainClass:'ytc-mfp-lightbox',
463
- removalDelay:160,
464
- preloader:false,
465
- fixedContentPos:false
466
- });
467
- }
468
- jQuery(window).on('load',function(){
469
- ytc_init_MPAU();
470
- });
471
- jQuery(document).ajaxComplete(function(){
472
- ytc_init_MPAU();
473
- });
474
- ";
475
- } // END if ( empty($this->defaults['nolightbox']) )
476
-
477
- if ( ! empty($js) ) {
478
- $js = "
479
- <!-- YouTube Channel 3 -->
480
- <script type=\"text/javascript\">
481
- $js
482
- </script>\n
483
- ";
484
-
485
- if ( WP_DEBUG ) {
486
- // Uncompressed code if WP debug is enabled
487
- $js = str_replace(';var', ";\nvar", $js);
488
- $js = str_replace("\t", "", $js);
489
- // $js = str_replace(',', ",\n\t", $js);
490
- echo $js;
491
- } else {
492
- echo trim(preg_replace('/[\t\r\n]+/', '', $js));
493
- }
494
- }
495
-
496
- } // END function footer_scripts()
497
-
498
- public function shortcode($atts) {
499
-
500
- // get general default settings
501
- $instance = $this->defaults();
502
-
503
- // extract shortcode parameters
504
- extract(
505
- shortcode_atts(
506
- array(
507
- 'vanity' => $instance['vanity'],
508
- 'channel' => $instance['channel'],
509
- 'username' => $instance['username'],
510
- 'playlist' => $instance['playlist'],
511
- 'res' => '', // (deprecated, but leave for back compatibility) ex res
512
- 'use_res' => '', // (deprecated, but leave for back compatibility) ex use_res
513
- 'resource' => $instance['resource'], // ex use_res
514
- 'only_pl' => 0, // disabled by default (was: $instance['only_pl'],)
515
- 'cache' => $instance['cache'], // ex cache_time
516
- 'privacy' => $instance['privacy'], // ex showvidesc
517
- 'fetch' => $instance['fetch'], // ex maxrnd
518
- 'num' => $instance['num'], // ex vidqty
519
-
520
- 'random' => 0, // ex getrnd
521
-
522
- 'ratio' => $instance['ratio'],
523
- 'width' => $instance['width'],
524
- 'responsive' => ( ! empty($instance['responsive']) ) ? $instance['responsive'] : '0',
525
-
526
- 'show' => $instance['display'], // (deprecated, but keep for back compatibility) ex to_show
527
- 'display' => $instance['display'],
528
- 'no_thumb_title' => 0,
529
- 'themelight' => $instance['themelight'],
530
- 'controls' => $instance['controls'],
531
- 'autoplay' => $instance['autoplay'],
532
- 'mute' => $instance['autoplay_mute'],
533
- 'norel' => $instance['norel'],
534
- 'playsinline' => $instance['playsinline'], // play video on mobile devices inline instead in native device player
535
-
536
- 'showtitle' => $instance['showtitle'], // none, above, below
537
- 'showdesc' => $instance['showdesc'], // ex showvidesc
538
- 'nobrand' => ( ! empty($instance['modestbranding']) ) ? $instance['modestbranding'] : '0',
539
- 'desclen' => $instance['desclen'], // ex videsclen
540
- 'noinfo' => $instance['hideinfo'],
541
- 'noanno' => $instance['hideanno'],
542
-
543
- 'goto_txt' => $instance['goto_txt'],
544
- 'popup' => $instance['popup_goto'],
545
- 'link_to' => $instance['link_to'], // none, vanity, channel, legacy
546
-
547
- 'class' => ( ! empty($instance['class']) ) ? $instance['class'] : ''
548
- ),
549
- $atts
550
- )
551
- );
552
-
553
- // backward compatibility for show -> display shortcode parameter
554
- if ( ! empty($show) && $show !== $display && $show !== $instance['display'] ) {
555
- $display = $show;
556
- }
557
- // backward compatibility for use_res -> resource shortcode parameter
558
- if ( ! empty($use_res) ) {
559
- $resource = $use_res;
560
- } else if ( ! empty($res) ) {
561
- $resource = $res;
562
- }
563
-
564
- // prepare instance for output
565
- $instance['vanity'] = $vanity;
566
- $instance['channel'] = $channel;
567
- $instance['username'] = $username;
568
- $instance['playlist'] = $playlist;
569
- $instance['resource'] = $resource; // resource: 0 channel, 1 favorites, 2 playlist, 3 liked
570
- $instance['cache'] = $cache; // in seconds, def 5min - settings?
571
- $instance['privacy'] = $privacy; // enhanced privacy
572
-
573
- $instance['fetch'] = $fetch;
574
- $instance['num'] = $num; // num: 1
575
-
576
- $instance['random'] = $random; // use embedded playlist - false by default
577
-
578
- // Video Settings
579
- $instance['ratio'] = $ratio; // aspect ratio: 3 - 16:9, 2 - 16:10, 1 - 4:3
580
- $instance['width'] = $width; // 306
581
- $instance['responsive'] = $responsive; // enable responsivenes?
582
- $instance['display'] = $display; // thumbnail, iframe, iframe2, playlist
583
- $instance['no_thumb_title'] = $no_thumb_title; // hide tooltip for thumbnails
584
-
585
- $instance['themelight'] = $themelight; // use light theme, dark by default
586
- $instance['controls'] = $controls; // hide controls, false by default
587
- $instance['autoplay'] = $autoplay; // autoplay disabled by default
588
- $instance['autoplay_mute'] = $mute; // mute sound on autoplay - disabled by default
589
- $instance['norel'] = $norel; // hide related videos
590
- $instance['playsinline'] = $playsinline; // inline plaer for iOS
591
-
592
- // Content Layout
593
- $instance['showtitle'] = $showtitle; // show video title, disabled by default
594
- $instance['showdesc'] = $showdesc; // show video description, disabled by default
595
- $instance['modestbranding'] = $nobrand; // hide YT logo
596
- $instance['desclen'] = $desclen; // cut video description, number of characters
597
- $instance['hideinfo'] = $noinfo; // hide info by default
598
- $instance['hideanno'] = $noanno; // hide annotations, false by default
599
-
600
- // Link to Channel
601
- $instance['goto_txt'] = $goto_txt; // text for goto link - use settings
602
- $instance['popup_goto'] = $popup; // open channel in: 0 same window, 1 javascript new, 2 target new
603
- $instance['link_to'] = $link_to; // link to: none, vanity, legacy, channel
604
-
605
- // Customization
606
- $instance['class'] = $class; // custom additional class for container
607
-
608
- return implode(array_values($this->output($instance)));
609
- } // END public function shortcode()
610
-
611
- // Print out YTC block
612
- public function output($instance) {
613
-
614
- // Error message if no YouTube Data API Key
615
- if ( empty($this->defaults['apikey']) ) {
616
-
617
- $error_msg = sprintf(
618
- __('<strong>%s</strong> version 3+ requires <strong>YouTube DATA API Key</strong> to work. <a href="%s" target="_blank">Learn more here</a>.', 'youtube-channel'),
619
- $this->plugin_name,
620
- 'http://urosevic.net/wordpress/plugins/youtube-channel/#youtube_data_api_key'
621
- );
622
-
623
- $output[] = $this->front_debug($error_msg);
624
- return $output;
625
-
626
- }
627
-
628
- // 1) Get resource from widget/shortcode
629
- // 2) If not set, get global default
630
- // 3) if no global, get plugin's default
631
- $resource = intval($instance['resource']);
632
- if ( empty($resource) && $resource !== 0 ) {
633
- $resource = intval($this->defaults['resource']);
634
- if ( empty($resource) ) {
635
- $resource = 0;
636
- }
637
- }
638
-
639
- // Get Channel or Playlist ID based on requested resource
640
- switch ($resource) {
641
-
642
- // Playlist
643
- case '2':
644
- // 1) Get Playlist from shortcode/widget
645
- // 2) If not set, use global default
646
- // 3) If no global, throw error
647
- if ( ! empty($instance['playlist']) ) {
648
- $playlist = trim($instance['playlist']);
649
- } else {
650
- $playlist = trim($this->defaults['playlist']);
651
- }
652
- // Now check has Playlist ID set or throw error
653
- if ( $playlist == "" ) {
654
- $output[] = $this->front_debug("Playlist selected as resource but no Playlist ID provided!");
655
- return $output;
656
- }
657
- break;
658
-
659
- // Channel, Favourites, Liked
660
- default:
661
- /* Channel */
662
- // 1) Get channel from shortcode/widget
663
- // 2) If not set, use global default
664
- // 3) If no global, throw error
665
- if ( ! empty($instance['channel']) ) {
666
- $channel = trim($instance['channel']);
667
- } else {
668
- $channel = trim($this->defaults['channel']);
669
- }
670
- // Now check is Channel ID set or throw error
671
- if ( $channel == '' ) {
672
- if ( $resource == 1 ) { $resource_name = 'Favourited videos'; }
673
- elseif ( $resource == 3 ) { $resource_name = 'Liked videos'; }
674
- else { $resource_name = 'Channel (User uploads)'; }
675
- $error_msg = sprintf('%s selected as resource but no Channel ID provided!', $resource_name);
676
- $output[] = $this->front_debug($error_msg);
677
- return $output;
678
- }
679
-
680
- } // END switch ($resource)
681
-
682
- /* OK, we have required resource (Playlist or Channel ID), so we can proceed to real job */
683
-
684
- // Set custom class and responsive if needed
685
- $class = $instance['class'] ? $instance['class'] : 'default';
686
- if ( ! empty($instance['responsive']) ) {
687
- $class .= ' responsive';
688
- }
689
- if ( ! empty($instance['display']) ) {
690
- $class .= " ytc_display_{$instance['display']}";
691
- }
692
-
693
- switch ($resource) {
694
- case 1: // Favourites
695
- $resource_name = 'favourites';
696
- $resource_id = preg_replace('/^UC/', 'FL', $channel);
697
- break;
698
- case 2: // Playlist
699
- $resource_name = 'playlist';
700
- $resource_id = $playlist;
701
- break;
702
- case 3: // Liked
703
- $resource_name = 'liked';
704
- $resource_id = preg_replace('/^UC/', 'LL', $channel);
705
- break;
706
- default: // Channel
707
- $resource_name = 'channel';
708
- $resource_id = preg_replace('/^UC/', 'UU', $channel);
709
- }
710
-
711
- // Start output array
712
- $output = array();
713
-
714
- $output[] = "<div class=\"youtube_channel {$class}\">";
715
-
716
- if ( $instance['display'] == 'playlist' ) { // Insert as Embedded playlist
717
-
718
- $output = array_merge( $output, self::embed_playlist($resource_id, $instance) );
719
-
720
- } else { // Individual videos from channel, favourites, liked or playlist
721
-
722
- // Get max items for random video
723
- $fetch = $instance['fetch'];
724
- if ( $fetch < 1 ) { $fetch = 10; } // default 10
725
- elseif ( $fetch > 50 ) { $fetch = 50; } // max 50
726
-
727
- $resource_key = "{$resource_id}_{$fetch}";
728
-
729
- // Do we need cache? Let we define cache fallback key
730
- $cache_key_fallback = 'ytc_' . md5($resource_key) . '_fallback';
731
-
732
- // Do cache magic
733
- if ( $instance['cache'] > 0 ) {
734
-
735
- // generate feed cache key for caching time
736
- $cache_key = 'ytc_' . md5($resource_key) . '_' . $instance['cache'];
737
-
738
- if ( ! empty($_GET['ytc_force_recache']) ) {
739
- delete_transient($cache_key);
740
- }
741
-
742
- // get/set transient cache
743
- if ( false === ($json = get_transient($cache_key)) || empty($json) ) {
744
-
745
- // no cached JSON, get new
746
- $json = $this->fetch_youtube_feed($resource_id, $fetch);
747
-
748
- // set decoded JSON to transient cache_key
749
- set_transient($cache_key, base64_encode($json), $instance['cache']);
750
-
751
- } else {
752
-
753
- // we already have cached feed JSON, get it encoded
754
- $json = base64_decode($json);
755
-
756
- }
757
-
758
- } else {
759
-
760
- // just get fresh feed if cache disabled
761
- $json = $this->fetch_youtube_feed($resource_id, $fetch);
762
-
763
- }
764
-
765
- // free some memory
766
- unset( $response );
767
-
768
- // decode JSON data
769
- $json_output = json_decode($json);
770
-
771
- // YTC 3.0.7: Do we need this, still?
772
- // if current feed is messed up, try to get it from fallback cache
773
- if ( is_wp_error($json_output) && ! is_object($json_output) && empty($json_output->items) ) {
774
- // do we have fallback cache?!
775
- if ( true === ( $json_fallback = get_transient( $cache_key_fallback ) ) && ! empty($json_fallback) ) {
776
- $json_output = json_decode( base64_decode($json_fallback) );
777
- // and free memory
778
- unset( $json_fallback );
779
- }
780
- }
781
-
782
- // Get resource nice name based on selected resource
783
- $resource_nice_name = $this->resource_nice_name($resource);
784
-
785
- // Prevent further checks if we have WP Error or empty record even after fallback
786
- if ( is_wp_error($json_output) ) {
787
- $output[] = $this->front_debug( $json_output->get_error_message() );
788
- return $output;
789
- }
790
- elseif ( isset($json_output->items) && sizeof($json_output->items) == 0 ) {
791
- $output[] = $this->front_debug(sprintf(__("You have set to display videos from %s [resource list ID: %s], but there have no public videos in that resouce."), $resource_nice_name, $resource_id ));
792
- return $output;
793
- }
794
- elseif ( empty($json_output) ) {
795
- $output[] = $this->front_debug(sprintf(__('We have empty record for this feed. Please read <a href="%s" target="_blank">FAQ</a> and if that does not help, contact <a href="%s" target="_blank">support</a>.'), 'https://wordpress.org/plugins/youtube-channel/faq/', 'https://wordpress.org/support/plugin/youtube-channel'));
796
- return $output;
797
- }
798
-
799
- // Predefine `max_items` to prevent undefined notices
800
- $max_items = 0;
801
- if ( is_object($json_output) && ! empty($json_output->items) ) {
802
-
803
- // Sort by date uploaded
804
- $json_entry = $json_output->items;
805
-
806
- $num = $instance['num'];
807
- if ( $num > $fetch ) { $fetch = $num; }
808
- $max_items = ( $fetch > sizeof($json_entry) ) ? sizeof($json_entry) : $fetch;
809
-
810
- if ( ! empty($instance['random']) ) {
811
- $items = array_slice($json_entry, 0, $max_items);
812
- } else {
813
- if ( ! $num ) $num = 1;
814
- $items = array_slice($json_entry, 0, $num);
815
- }
816
- }
817
-
818
- if ($max_items == 0) {
819
-
820
- // Append YouTube DATA API error reason as comment
821
- if ( ! empty($json_output) && is_object($json_output) && ! empty($json_output->error->errors) ) {
822
-
823
- // Error went in fetch_youtube_feed()
824
- if ( $json_output->error->errors[0]->reason == 'wpError' ) {
825
- $error_msg = $json_output->error->errors[0]->message;
826
- }
827
- // Playlist error from Google API
828
- elseif ( $json_output->error->errors[0]->reason == 'playlistNotFound' ) {
829
- if ( $resource_name == 'playlist' ) {
830
- $error_msg = "Please check did you set existing <em>Playlist ID</em>. You set to show videos from {$resource_nice_name}, but YouTube does not recognize <strong>{$resource_id}</strong> as existing and public playlist.";
831
- } else {
832
- $error_msg = "Please check did you set proper <em>Channel ID</em>. You set to show videos from {$resource_nice_name}, but YouTube does not recognize <strong>{$channel}</strong> as existing and public channel.";
833
- }
834
- }
835
- // Invalid YouTube Data API Key
836
- elseif ( $json_output->error->errors[0]->reason == 'keyInvalid' ) {
837
- $error_msg = sprintf(__("Double check <em>YouTube Data API Key</em> on <em>General</em> plugin tab and make sure it's correct. Read <a href=\"%s\" target=\"_blank\">Installation</a> document."), 'https://wordpress.org/plugins/youtube-channel/installation/');
838
- }
839
- // Restricted access YouTube Data API Key
840
- elseif ( $json_output->error->errors[0]->reason == 'ipRefererBlocked' ) {
841
- $error_msg = "Check <em>YouTube Data API Key</em> restrictions, empty cache if enabled by appending in browser address bar parameter <em>?ytc_force_recache=1</em>";
842
- }
843
- // (deprecated?) Non existing Channel ID set
844
- elseif ( $json_output->error->errors[0]->reason == 'invalidChannelId' ) {
845
- $error_msg = sprintf(__("You have set wrong Channel ID. Fix that in General plugin settings, Widget and/or shortcode. Read <a href=\"%s\" target=\"_blank\">FAQ</a> document."), 'https://wordpress.org/plugins/youtube-channel/faq/');
846
- }
847
- // Forbidden access to resource
848
- elseif ( $json_output->error->errors[0]->reason == 'playlistItemsNotAccessible' ) {
849
- $error_msg = sprintf(__("You do not have permission to access ressource <strong>%s</strong> (it's maybe set to private or even does not exists!)"), $resource_id);
850
- }
851
-
852
- } else { // ELSE ! empty($json_output->error->errors)
853
-
854
- $error_msg = "Unrecognized error experienced.";
855
-
856
- } // END ! empty($json_output->error->errors)
857
-
858
- $output[] = $this->front_debug($error_msg);
859
-
860
- } else { // ELSE if ($max_items == 0)
861
-
862
- // looks that feed is OK, let we update fallback that never expire
863
- set_transient($cache_key_fallback, base64_encode($json), 0);
864
-
865
- // and now free some memory
866
- unset ( $json, $json_output, $json_entry );
867
-
868
- // set array for unique random item
869
- if ( ! empty($instance['random']) ) {
870
- $random_used = array();
871
- }
872
-
873
- /* AU:20141230 reduce number of videos if requested > available */
874
- if ( $num > sizeof($items) ) {
875
- $num = sizeof($items);
876
- }
877
-
878
- for ( $y = 1; $y <= $num; ++$y ) {
879
- if ( ! empty($instance['random']) ) {
880
-
881
- $random_item = mt_rand( 0, (count($items)-1) );
882
- while ( $y > 1 && in_array($random_item, $random_used) ) {
883
- $random_item = mt_rand(0, (count($items)-1));
884
- }
885
- $random_used[] = $random_item;
886
- $item = $items[ $random_item ];
887
- } else {
888
- $item = $items[ $y - 1 ];
889
- }
890
-
891
- // Generate single video block
892
- $output = array_merge( $output, $this->ytc_print_video($item, $instance, $y) );
893
- }
894
- // Free some memory
895
- unset($random_used, $random_item, $json);
896
-
897
- } // END if ($max_items == 0)
898
-
899
- } // single playlist or ytc way
900
-
901
- // Append link to channel on bootom of the widget
902
- if ( ! empty($instance['link_to']) && $instance['link_to'] != 'none' ) {
903
- $output = array_merge( $output, $this->ytc_channel_link($instance) );
904
- }
905
-
906
- $output[] = '</div><!-- .youtube_channel -->';
907
-
908
- // fix overflow on crappy themes
909
- $output[] = '<div class="clearfix"></div>';
910
-
911
- return $output;
912
-
913
- } // END public function output($instance)
914
-
915
- // --- HELPER FUNCTIONS ---
916
-
917
- /**
918
- * Download YouTube video feed through API 3.0
919
- * @param string $id ID of resource
920
- * @param integer $items Number of items to fetch (min 2, max 50)
921
- * @return array JSON with videos
922
- */
923
- function fetch_youtube_feed($resource_id, $items) {
924
-
925
- $feed_url = 'https://www.googleapis.com/youtube/v3/playlistItems?';
926
- $feed_url .= 'part=snippet';
927
- $feed_url .= "&playlistId={$resource_id}";
928
- $feed_url .= '&fields=items(snippet(title%2Cdescription%2CpublishedAt%2CresourceId(videoId)))';
929
- $feed_url .= "&maxResults={$items}";
930
- $feed_url .= "&key={$this->defaults['apikey']}";
931
-
932
- $wprga = array(
933
- 'timeout' => 5 // five seconds only
934
- );
935
-
936
- $response = wp_remote_get($feed_url, $wprga);
937
-
938
- // If we have WP error, make JSON with error
939
- if ( is_wp_error($response) ) {
940
-
941
- $json = "{\"error\":{\"errors\":[{\"reason\":\"wpError\",";
942
- $json .= "\"message\":\"{$response->get_error_message()}\",";
943
- $json .= "\"domain\":\"wpRemoteGet\"}]}}";
944
-
945
- } else {
946
-
947
- $json = wp_remote_retrieve_body( $response );
948
-
949
- }
950
-
951
- // Free some memory
952
- unset($response);
953
-
954
- return $json;
955
-
956
- } // END function fetch_youtube_feed($resource_id, $items)
957
-
958
- /**
959
- * Print explanation of error for administrators (users with capability manage_options)
960
- * and hidden message for lower users and visitors
961
- * @param string $message Error message
962
- * @return string FOrmatted message for error
963
- */
964
- function front_debug($message) {
965
-
966
- // Show visible error to admin, Oops message to visitors and lower members
967
- if ( is_user_logged_in() && current_user_can('manage_options') ) {
968
-
969
- $output = "<p class=\"ytc_error\"><strong>YTC ERROR:</strong> $message</p>";
970
-
971
- } else {
972
-
973
- $output = __("Oops, something went wrong.", 'youtube-channel');
974
- $output .= "<!-- YTC ERROR:\n";
975
- $output .= strip_tags($message);
976
- $output .= "\n-->\n";
977
-
978
- }
979
-
980
- return $output;
981
-
982
- } // END function debug($message)
983
-
984
- /**
985
- * Calculate height by provided width and aspect ratio
986
- * @param integer $width Width in pixels
987
- * @param integer $ratio Selected aspect ratio (1 for 4:3, other for 16:9)
988
- * @return integer Calculated height in pixels
989
- */
990
- function height_ratio($width=306, $ratio) {
991
-
992
- switch ($ratio)
993
- {
994
- case 1:
995
- $height = round(($width / 4 ) * 3);
996
- break;
997
- case 2:
998
- case 3:
999
- default:
1000
- $height = round(($width / 16 ) * 9);
1001
- }
1002
- return $height;
1003
- } // END function height_ratio($width=306, $ratio)
1004
-
1005
- /**
1006
- * Generate link to YouTube channel/user
1007
- * @param array $instance widget or shortcode settings
1008
- * @return array components prepared for output
1009
- */
1010
- function ytc_channel_link($instance) {
1011
-
1012
- // initialize array
1013
- $output = array();
1014
-
1015
- // do we need to show goto link?
1016
- if ( $instance['link_to'] != 'none' ) {
1017
-
1018
- $goto_url = "https://www.youtube.com/";
1019
-
1020
- switch ($instance['link_to']) {
1021
- case 'vanity':
1022
- $vanity = trim($instance['vanity']);
1023
- if ( empty($vanity) ) {
1024
- return array("<!-- YTC ERROR: Selected Vanity custom URL to be linked but no Vanity Name provided! -->");
1025
- }
1026
- // sanity vanity content (strip all in front of last slash to cleanup vanity ID only)
1027
- if ( ! empty( $vanity ) && strpos($vanity, 'youtube.com') !== false ) {
1028
- $vanity = preg_replace('/^.*\//', '', $vanity);
1029
- }
1030
- $goto_url .= "c/$vanity";
1031
- break;
1032
-
1033
- case 'legacy':
1034
- $username = trim($instance['username']);
1035
- if ( empty($username) ) {
1036
- return array("<!-- YTC ERROR: Selected Legacy username to be linked but no Legacy username provided! -->");
1037
- }
1038
- $goto_url .= "user/$username";
1039
- break;
1040
-
1041
- case 'channel':
1042
- $channel = trim($instance['channel']);
1043
- if ( empty($channel) ) {
1044
- return array("<!-- YTC ERROR: Selected Channel page to be linked but no Channel ID provided! -->");
1045
- }
1046
- $goto_url .= "channel/$channel";
1047
- break;
1048
- }
1049
-
1050
- $goto_txt = trim($instance['goto_txt']);
1051
- if ( $goto_txt == "" ) {
1052
- $goto_txt = __('Visit our YouTube channel', 'youtube-channel');
1053
- }
1054
-
1055
- $newtab = __("in new window/tab", 'youtube-channel');
1056
-
1057
- $output[] = '<div class="clearfix"></div>';
1058
- $output[] = '<div class="ytc_link">';
1059
- $output[] = '<p>';
1060
- switch ( $instance['popup_goto'] ) {
1061
- case 1:
1062
- $output[] = "<a href=\"javascript: window.open('{$goto_url}'); void 0;\" title=\"{$goto_txt} {$newtab}\">{$goto_txt}</a>";
1063
- break;
1064
- case 2:
1065
- $output[] = "<a href=\"{$goto_url}\" target=\"_blank\" title=\"{$goto_txt} {$newtab}\">{$goto_txt}</a>";
1066
- break;
1067
- default:
1068
- $output[] = "<a href=\"{$goto_url}\" title=\"{$goto_txt}\">$goto_txt</a>";
1069
- } // switch popup_goto
1070
- $output[] = '</p>';
1071
- $output[] = '</div>';
1072
-
1073
- } // showgoto
1074
-
1075
- return $output;
1076
- } // end function ytc_channel_link
1077
-
1078
-
1079
- /**
1080
- * Generate output for single video block
1081
- * @param object $item Video object from JSON
1082
- * @param array $instance Settings from widget or shortcode
1083
- * @param int $y Order number of video
1084
- * @return array Prepared single video block as array to concatenate
1085
- */
1086
- function ytc_print_video($item, $instance, $y) {
1087
-
1088
- // Calculate width and height
1089
- if ( empty($instance['width']) ) {
1090
- $instance['width'] = $this->defaults['width'];
1091
- }
1092
- $height = $this->height_ratio($instance['width'], $instance['ratio']);
1093
-
1094
- // How to display videos?
1095
- if ( empty($instance['display']) ) {
1096
- $instance['display'] = 'thumbnail';
1097
- }
1098
-
1099
- // Extract details about video from Resource
1100
- $yt_id = $item->snippet->resourceId->videoId;
1101
- $yt_title = $item->snippet->title;
1102
- $yt_date = $item->snippet->publishedAt;
1103
- $yt_thumb = "//img.youtube.com/vi/$yt_id/0.jpg"; // zero for HD thumb
1104
-
1105
- // Enhanced privacy?
1106
- $youtube_domain = $this->youtube_domain($instance);
1107
-
1108
- switch ($y) {
1109
- case 1:
1110
- $vnumclass = 'first';
1111
- break;
1112
- case $instance['num']:
1113
- $autoplay = false;
1114
- $vnumclass = 'last';
1115
- break;
1116
- default:
1117
- $vnumclass = 'mid';
1118
- $autoplay = false;
1119
- break;
1120
- }
1121
-
1122
- // Set proper class for responsive thumbs per selected aspect ratio
1123
- $arclass = $this->arclass($instance);
1124
-
1125
- $output[] = "<div class=\"ytc_video_container ytc_video_{$y} ytc_video_{$vnumclass} ${arclass}\" style=\"width:{$instance['width']}px\">";
1126
-
1127
- // Show video title above video?
1128
- if ( ! empty($instance['showtitle']) && $instance['showtitle'] == 'above' ) {
1129
- $output[] = "<h3 class=\"ytc_title ytc_title_above\">{$yt_title}</h3>";
1130
- }
1131
-
1132
- // Print out video
1133
- if ( $instance['display'] == "iframe" ) {
1134
-
1135
- // Start wrapper for responsive item
1136
- if ( $instance['responsive'] ) {
1137
- $output[] = '<div class="fluid-width-video-wrapper">';
1138
- }
1139
-
1140
- $output[] = "<iframe title=\"YouTube Video Player\" width=\"{$instance['width']}\" height=\"{$height}\" src=\"//{$youtube_domain}/embed/{$yt_id}?wmode=opaque";
1141
-
1142
- if ( ! empty($instance['norel']) ) $output[] = "&amp;rel=0"; // disable related videos
1143
- if ( ! empty($instance['controls']) ) $output[] = "&amp;controls=0";
1144
- if ( ! empty($instance['hideinfo']) ) $output[] = "&amp;showinfo=0";
1145
- if ( ! empty($instance['autoplay']) ) $output[] = "&amp;autoplay=1";
1146
- if ( ! empty($instance['hideanno']) ) $output[] = "&amp;iv_load_policy=3";
1147
- if ( ! empty($instance['themelight']) ) $output[] = "&amp;theme=light";
1148
- if ( ! empty($instance['modestbranding']) ) $output[] = "&amp;modestbranding=1";
1149
- if ( ! empty($instance['playsinline']) ) $output[] = "&amp;playsinline=1";
1150
-
1151
- $output[] = "\" style=\"border:0;\" allowfullscreen id=\"ytc_{$yt_id}\"></iframe>";
1152
-
1153
- // Close wrapper for responsive item
1154
- if ( $instance['responsive'] ) {
1155
- $output[] = '</div>';
1156
- }
1157
-
1158
- } else if ( $instance['display'] == "iframe2" ) {
1159
-
1160
- // youtube API async
1161
- $js_vars = '';
1162
- $js_vars .= ( ! empty($instance['norel']) ) ? "rel:0," : '';
1163
- $js_vars .= ( ! empty($instance['autoplay']) ) ? "autoplay:1," : '';
1164
- $js_vars .= ( ! empty($instance['hideinfo']) ) ? "showinfo:0," : '';
1165
- $js_vars .= ( ! empty($instance['controls']) ) ? "controls:0," : '';
1166
- $js_vars .= ( ! empty($instance['themelight']) ) ? "theme:'light'," : '';
1167
- $js_vars .= ( ! empty($instance['modestbranding']) ) ? "modestbranding:1," : '';
1168
- $js_vars .= ( ! empty($instance['playsinline']) ) ? "playsinline:1," : '';
1169
- $js_vars .= "wmmode:'opaque'";
1170
- $js_vars = rtrim($js_vars, ",");
1171
-
1172
- $js_end = '';
1173
- $js_end .= ( ! empty($instance['hideanno']) ) ? "iv_load_policy:3," : '';
1174
- $js_end .= ( ! empty($instance['autoplay']) && ! empty($instance['autoplay_mute']) ) ? "events:{'onReady':ytc_mute}," : '';
1175
- $js_end = rtrim($js_end, ',');
1176
-
1177
- $js_player_id = str_replace('-', '_', $yt_id);
1178
-
1179
- // Start wrapper for responsive item
1180
- if ( $instance['responsive'] ) {
1181
- $output[] = '<div class="fluid-width-video-wrapper">';
1182
- }
1183
-
1184
- $output[] = "<div id=\"ytc_player_{$js_player_id}\"></div>";
1185
-
1186
- // Close wrapper for responsive item
1187
- if ( $instance['responsive'] ) {
1188
- $output[] = '</div>';
1189
- }
1190
-
1191
- $site_domain = $_SERVER['HTTP_HOST'];
1192
- $ytc_html5_js = "var ytc_player_{$js_player_id};";
1193
- $ytc_html5_js .= "ytc_player_{$js_player_id}=new YT.Player('ytc_player_{$js_player_id}',{height:'{$height}',width:'{$instance['width']}',";
1194
- $ytc_html5_js .= "videoId:'{$yt_id}',enablejsapi:1,playerVars:{{$js_vars}},origin:'{$site_domain}',{$js_end}});";
1195
-
1196
- // prepare JS for footer
1197
- if ( empty($_SESSION['ytc_html5_js']) ) {
1198
- $_SESSION['ytc_html5_js'] = $ytc_html5_js;
1199
- } else {
1200
- $_SESSION['ytc_html5_js'] .= $ytc_html5_js;
1201
- }
1202
-
1203
- } else { // default is thumbnail
1204
-
1205
- // Do we need tooltip for thumbnail?
1206
- if ( empty($instance['no_thumb_title']) ) {
1207
- $title = sprintf( __('Watch video %1$s published on %2$s', 'youtube-channel' ), $yt_title, $yt_date );
1208
- }
1209
-
1210
- $p = '';
1211
- if ( empty($instance['nolightbox']) ) {
1212
- if ( ! empty($instance['norel']) ) $p .= '&amp;rel=0';
1213
- if ( ! empty($instance['modestbranding']) ) $p .= "&amp;modestbranding=1";
1214
- if ( ! empty($instance['controls']) ) $p .= "&amp;controls=0";
1215
- if ( ! empty($instance['playsinline']) ) $p .= "&amp;playsinline=1";
1216
- }
1217
-
1218
- // Do we need thumbnail w/ or w/o tooltip
1219
- $tag_title = ( empty($instance['no_thumb_title']) ) ? $tag_title = "title=\"{$yt_title}\"" : "";
1220
- $output[] = "<a href=\"//${youtube_domain}/watch?v=${yt_id}${p}\" ${tag_title} class=\"ytc_thumb ytc-lightbox {$arclass}\"><span style=\"background-image: url({$yt_thumb});\" ${tag_title} id=\"ytc_{$yt_id}\"></span></a>";
1221
-
1222
- } // what to show conditions
1223
-
1224
- // show video title below video?
1225
- if ( ! empty($instance['showtitle']) && $instance['showtitle'] == 'below' ) {
1226
- $output[] = "<h3 class=\"ytc_title ytc_title_below\">{$yt_title}</h3>";
1227
- }
1228
-
1229
- // do we need to show video description?
1230
- if ( ! empty($instance['showdesc']) ) {
1231
-
1232
- $video_description = $item->snippet->description;
1233
- $etcetera = '';
1234
- if ( $instance['desclen'] > 0 ) {
1235
- if ( strlen($video_description) > $instance['desclen'] ) {
1236
- $video_description = substr($video_description, 0, $instance['desclen']);
1237
- $etcetera = '&hellip;';
1238
- }
1239
- }
1240
-
1241
- if ( ! empty($video_description) ) {
1242
- $output[] = "<p class=\"ytc_description\">{$video_description}{$etcetera}</p>";
1243
- }
1244
-
1245
- }
1246
-
1247
- $output[] = '</div><!-- .ytc_video_container -->';
1248
-
1249
- return $output;
1250
- } // end function ytc_print_video
1251
-
1252
- /* function to print standard playlist embed code */
1253
- function embed_playlist($resource_id, $instance) {
1254
-
1255
- $width = ( empty($instance['width']) ) ? 306 : $instance['width'];
1256
- $height = self::height_ratio($width, $instance['ratio']);
1257
- $autoplay = (empty($instance['autoplay'])) ? '' : '&autoplay=1';
1258
- $theme = (empty($instance['themelight'])) ? '' : '&theme=light';
1259
- $modestbranding = (empty($instance['modestbranding'])) ? '' : '&modestbranding=1';
1260
- $rel = (empty($instance['norel'])) ? '' : '&rel=0';
1261
- $playsinline = (empty($instance['playsinline'])) ? '' : '&playsinline=1';
1262
-
1263
- // enhanced privacy
1264
- $youtube_domain = $this->youtube_domain($instance);
1265
- $arclass = $this->arclass($instance);
1266
- $output[] = "<div class=\"ytc_video_container ytc_video_1 ytc_video_single ytc_playlist_only {$arclass}\">";
1267
- $output[] = "<div class=\"fluid-width-video-wrapper\">";
1268
- $output[] = "<iframe src=\"//{$youtube_domain}/embed/videoseries?list={$resource_id}{$autoplay}{$theme}{$modestbranding}{$rel}\"";
1269
- if ( ! empty($instance['fullscreen']) ) $output[] = " allowfullscreen";
1270
- $output[] = " width=\"{$width}\" height=\"{$height}\" frameborder=\"0\"></iframe>";
1271
- $output[] = "</div><!-- .fluid-width-video-wrapper -->";
1272
- $output[] = "</div><!-- .ytc_video_container -->";
1273
-
1274
- return $output;
1275
-
1276
- } // END function embed_playlist($resource_id, $instance)
1277
-
1278
- // Helper function cache_time()
1279
- function cache_time($cache_time)
1280
- {
1281
- $times = array(
1282
- 'minute' => array(
1283
- 1 => __("1 minute", 'youtube-channel'),
1284
- 5 => __("5 minutes", 'youtube-channel'),
1285
- 15 => __("15 minutes", 'youtube-channel'),
1286
- 30 => __("30 minutes", 'youtube-channel')
1287
- ),
1288
- 'hour' => array(
1289
- 1 => __("1 hour", 'youtube-channel'),
1290
- 2 => __("2 hours", 'youtube-channel'),
1291
- 5 => __("5 hours", 'youtube-channel'),
1292
- 10 => __("10 hours", 'youtube-channel'),
1293
- 12 => __("12 hours", 'youtube-channel'),
1294
- 18 => __("18 hours", 'youtube-channel')
1295
- ),
1296
- 'day' => array(
1297
- 1 => __("1 day", 'youtube-channel'),
1298
- 2 => __("2 days", 'youtube-channel'),
1299
- 3 => __("3 days", 'youtube-channel'),
1300
- 4 => __("4 days", 'youtube-channel'),
1301
- 5 => __("5 days", 'youtube-channel'),
1302
- 6 => __("6 days", 'youtube-channel')
1303
- ),
1304
- 'week' => array(
1305
- 1 => __("1 week", 'youtube-channel'),
1306
- 2 => __("2 weeks", 'youtube-channel'),
1307
- 3 => __("3 weeks", 'youtube-channel'),
1308
- 4 => __("1 month", 'youtube-channel')
1309
- )
1310
- );
1311
-
1312
- $out = "";
1313
- foreach ($times as $period => $timeset)
1314
- {
1315
- switch ($period)
1316
- {
1317
- case 'minute':
1318
- $sc = MINUTE_IN_SECONDS;
1319
- break;
1320
- case 'hour':
1321
- $sc = HOUR_IN_SECONDS;
1322
- break;
1323
- case 'day':
1324
- $sc = DAY_IN_SECONDS;
1325
- break;
1326
- case 'week':
1327
- $sc = WEEK_IN_SECONDS;
1328
- break;
1329
- }
1330
-
1331
- foreach ($timeset as $n => $s)
1332
- {
1333
- $sec = $sc * $n;
1334
- $out .='<option value="'.$sec.'" '. selected( $cache_time, $sec, 0 ).'>'.__($s, $this->plugin_slug).'</option>';
1335
- unset($sec);
1336
- }
1337
- }
1338
- return $out;
1339
- } // end function cache_time
1340
-
1341
-
1342
- /**
1343
- * Method to delete all YTC transient caches
1344
- * @return string Report message about success or failed purge cache
1345
- */
1346
- function clear_all_cache() {
1347
-
1348
- global $wpdb;
1349
-
1350
- $ret = $wpdb->query(
1351
- $wpdb->prepare(
1352
- "DELETE FROM $wpdb->options
1353
- WHERE option_name LIKE %s
1354
- OR option_name LIKE %s
1355
- ",
1356
- '_transient_timeout_ytc_%',
1357
- '_transient_ytc_%'
1358
- )
1359
- );
1360
-
1361
- if ( false === $ret ) {
1362
- echo "Oops, we did not cleared any YouTube Channel cache because some error occured";
1363
- } else {
1364
- if ( $ret == 0 ) {
1365
- echo "Congratulations! You can chill, there is no YouTube Channel caches.";
1366
- } else {
1367
- echo "Success! We cleared $ret row/s with YouTube Channel caches.";
1368
- }
1369
- }
1370
- exit();
1371
-
1372
- } // END function clear_all_cache()
1373
-
1374
- /**
1375
- * Return nice name for resource by provided resource ID
1376
- * @param integer $resource_id Resource ID
1377
- * @return string Resource nice name
1378
- */
1379
- function resource_nice_name($resource_id) {
1380
- if ( $resource_id == 0 ) { $resource_nice_name = 'Channel (User uploads)'; }
1381
- elseif ( $resource_id == 1 ) { $resource_nice_name = 'Favourited videos'; }
1382
- elseif ( $resource_id == 2 ) { $resource_nice_name = 'Liked videos'; }
1383
- elseif ( $resource_id == 3 ) { $resource_nice_name = 'Liked videos'; }
1384
- else { $resource_nice_name = 'Unknown resource'; }
1385
- return $resource_nice_name;
1386
- }
1387
-
1388
- function youtube_domain($instance) {
1389
- $youtube_domain = ( !empty($instance['privacy']) ) ? 'www.youtube-nocookie.com' : 'www.youtube.com';
1390
- return $youtube_domain;
1391
- } // end function youtube_domain
1392
-
1393
- function arclass($instance) {
1394
- return ( ! empty($instance['ratio']) && $instance['ratio'] == 1) ? 'ar4_3' : 'ar16_9';
1395
- } // END function arclass()
1396
-
1397
- /**
1398
- * Register TinyMCE button for YTC
1399
- * @param array $plugins Unmodified set of plugins
1400
- * @return array Set of TinyMCE plugins with YTC addition
1401
- */
1402
- function mce_external_plugins($plugins) {
1403
-
1404
- $plugins['youtube_channel'] = plugin_dir_url(__FILE__) . 'inc/tinymce/plugin.min.js';
1405
-
1406
- return $plugins;
1407
-
1408
- } // END function mce_external_plugins($plugins)
1409
-
1410
- /**
1411
- * Append TinyMCE button for YTC at the end of row 1
1412
- * @param array $buttons Unmodified set of buttons
1413
- * @return array Set of TinyMCE buttons with YTC addition
1414
- */
1415
- function mce_buttons($buttons) {
1416
-
1417
- $buttons[] = 'youtube_channel_shortcode';
1418
- return $buttons;
1419
-
1420
- } // END function mce_buttons($buttons)
1421
-
1422
- function generate_debug_json()
1423
- {
1424
- global $wp_version;
1425
-
1426
- // get widget ID from parameter
1427
- $for = trim($_GET['ytc_debug_json_for']);
1428
-
1429
- if ( $for == 'global' ) {
1430
- // global settings
1431
- $options = get_option('youtube_channel_defaults');
1432
-
1433
- if ( ! is_array($options) ) {
1434
- return;
1435
- }
1436
-
1437
- // Remove YouTube Data API Key from config JSON
1438
- unset($options['apikey']);
1439
-
1440
- } else {
1441
- // widget
1442
- $widget_id = (int)$for;
1443
- $for = "youtube-channel-{$for}";
1444
-
1445
- // get YTC widgets options
1446
- $widget_options = get_option('widget_youtube-channel');
1447
-
1448
- if ( ! is_array($widget_options[ $widget_id ]) ) {
1449
- return;
1450
- }
1451
-
1452
- $options = $widget_options[ $widget_id ];
1453
- unset ($widget_options);
1454
- }
1455
-
1456
- // prepare debug data with settings of current widget
1457
- $data = array_merge(
1458
- array(
1459
- 'date' => date("r"),
1460
- 'server' => $_SERVER['SERVER_SOFTWARE'],
1461
- 'php' => PHP_VERSION,
1462
- 'wp' => $wp_version,
1463
- 'ytc' => self::VER,
1464
- 'url' => get_site_url(),
1465
- 'for' => $for
1466
- ),
1467
- $options
1468
- );
1469
-
1470
- // Construct descriptive filename
1471
- $date = date('ymdHis');
1472
- $json_filename = "ytc3_{$_SERVER['HTTP_HOST']}_{$for}_{$date}.json";
1473
- // Return JSON file
1474
- header("Content-disposition: attachment; filename={$json_filename}");
1475
- header('Content-Type: application/json');
1476
- echo json_encode($data);
1477
-
1478
- // Destroy vars
1479
- unset($data, $options, $widget_id, $option_name, $for, $date, $json_filename);
1480
-
1481
- // Exit now, because we need only debug data in JSON file, not settings or any other page
1482
- exit;
1483
- }
1484
- } // end class
1485
- } // end class check
1486
-
1487
- // add_action('plugins_loaded', create_function( '', '$WPAU_YOUTUBE_CHANNEL = new WPAU_YOUTUBE_CHANNEL();' ) );
1488
-
1489
- global $WPAU_YOUTUBE_CHANNEL;
1490
- if ( empty($WPAU_YOUTUBE_CHANNEL) )
1491
- $WPAU_YOUTUBE_CHANNEL = new WPAU_YOUTUBE_CHANNEL();
1492
-
1493
-
1
+ <?php
2
+ /*
3
+ Plugin Name: YouTube Channel
4
+ Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
5
+ Description: Quick and easy embed latest or random videos from YouTube channel (user uploads, liked or favourited videos) or playlist. Use <a href="widgets.php">widget</a> for sidebar or shortcode for content. Works with <em>YouTube Data API v3</em>.
6
+ Version: 3.0.8.6
7
+ Author: Aleksandar Urošević
8
+ Author URI: http://urosevic.net/
9
+ Text Domain: youtube-channel
10
+ */
11
+
12
+ // Exit if accessed directly
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
+ exit;
15
+ }
16
+
17
+ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
18
+ class WPAU_YOUTUBE_CHANNEL
19
+ {
20
+
21
+ const DB_VER = 14;
22
+ const VER = '3.0.8.6';
23
+
24
+ public $plugin_name = 'YouTube Channel';
25
+ public $plugin_slug = 'youtube-channel';
26
+ public $plugin_option = 'youtube_channel_defaults';
27
+ public $plugin_url;
28
+
29
+ /**
30
+ * Construct class
31
+ */
32
+ function __construct() {
33
+
34
+ $this->plugin_url = plugin_dir_url( __FILE__ );
35
+ load_plugin_textdomain( $this->plugin_slug, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
36
+
37
+ // Generate debug JSON
38
+ if ( ! empty( $_GET['ytc_debug_json_for'] ) ) {
39
+ $this->generate_debug_json();
40
+ }
41
+
42
+ // Clear all YTC cache
43
+ add_action( 'wp_ajax_ytc_clear_all_cache', array( &$this, 'clear_all_cache' ) );
44
+
45
+ // Activation hook and maybe update trigger
46
+ register_activation_hook( __FILE__, array( $this, 'activate' ) );
47
+ add_action( 'plugins_loaded', array( $this, 'maybe_update' ) );
48
+
49
+ $this->defaults = self::defaults();
50
+
51
+ // TinyMCE AddOn
52
+ if ( ! empty( $this->defaults['tinymce'] ) ) {
53
+ add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 998 );
54
+ add_filter( 'mce_buttons', array( $this, 'mce_buttons' ), 999 );
55
+ }
56
+
57
+ if ( is_admin() ) {
58
+
59
+ // Initialize Plugin Settings Magic
60
+ add_action( 'init', array( $this, 'admin_init' ) );
61
+
62
+ // Add various Dashboard notices (if needed)
63
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
64
+
65
+ // Enqueue scripts and styles for Widgets page
66
+ add_action( 'admin_enqueue_scripts', array( $this, 'widget_scripts' ) );
67
+
68
+ } else { // ELSE if ( is_admin() )
69
+
70
+ // Enqueue frontend scripts
71
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
72
+ add_action( 'wp_footer', array( $this, 'footer_scripts' ) );
73
+
74
+ } // END if ( is_admin() )
75
+
76
+ // Load widget
77
+ require_once( 'inc/widget.php' );
78
+
79
+ // Register shortcodes `youtube_channel` and `ytc`
80
+ add_shortcode( 'youtube_channel', array( $this, 'shortcode' ) );
81
+ add_shortcode( 'ytc', array( $this, 'shortcode' ) );
82
+
83
+ } // END function __construct()
84
+
85
+ /**
86
+ * Activate the plugin
87
+ * Credits: http://solislab.com/blog/plugin-activation-checklist/#update-routines
88
+ */
89
+ public static function activate() {
90
+
91
+ global $WPAU_YOUTUBE_CHANNEL;
92
+ $WPAU_YOUTUBE_CHANNEL->init_options();
93
+ $WPAU_YOUTUBE_CHANNEL->maybe_update();
94
+
95
+ } // end function activate
96
+
97
+ /**
98
+ * Return initial options
99
+ * @return array Global defaults for current plugin version
100
+ */
101
+ public function init_options() {
102
+
103
+ $init = array(
104
+ 'vanity' => '', // $this->vanity_id,
105
+ 'channel' => '', // $this->channel_id,
106
+ 'username' => '', // $this->username_id,
107
+ 'playlist' => '', // $this->playlist_id,
108
+ 'resource' => 0, // ex use_res
109
+ 'cache' => 300, // 5 minutes // ex cache_time
110
+ 'fetch' => 25, // ex maxrnd
111
+ 'num' => 1, // ex vidqty
112
+ 'privacy' => 0,
113
+
114
+ 'ratio' => 3, // 3 - 16:9, 1 - 4:3 (deprecated: 2 - 16:10)
115
+ 'width' => 306,
116
+ 'responsive' => 1,
117
+ 'display' => 'thumbnail', // thumbnail, iframe, iframe2, playlist (deprecated: chromeless, object)
118
+ 'themelight' => 0,
119
+ 'fullscreen' => 0,
120
+ 'controls' => 0,
121
+ 'autoplay' => 0,
122
+ 'autoplay_mute' => 0,
123
+ 'norel' => 0,
124
+ 'playsinline' => 0, // play video on mobile devices inline instead in native device player
125
+ 'showtitle' => 'none',
126
+ 'showdesc' => 0,
127
+ 'desclen' => 0,
128
+ 'modestbranding' => 0,
129
+ 'hideanno' => 0,
130
+ 'hideinfo' => 0,
131
+
132
+ 'goto_txt' => 'Visit our channel',
133
+ 'popup_goto' => 0, // 0 same window, 1 new window JS, 2 new window target
134
+ 'link_to' => 'none', // 0 legacy username, 1 channel, 2 vanity
135
+ 'tinymce' => 1, // show TInyMCE button by default
136
+ );
137
+
138
+ add_option( 'youtube_channel_version', self::VER, '', 'no' );
139
+ add_option( 'youtube_channel_db_ver', self::DB_VER, '', 'no' );
140
+ add_option( $this->plugin_option, $init, '', 'no' );
141
+
142
+ return $init;
143
+
144
+ } // END public function init_options()
145
+
146
+ /**
147
+ * Check do we need to migrate options
148
+ */
149
+ public function maybe_update() {
150
+
151
+ // bail if this plugin data doesn't need updating
152
+ if ( get_option( 'youtube_channel_db_ver' ) >= self::DB_VER ) {
153
+ return;
154
+ }
155
+
156
+ require_once( dirname( __FILE__ ) . '/update.php' );
157
+ au_youtube_channel_update();
158
+
159
+ } // END public function maybe_update()
160
+
161
+ /**
162
+ * Initialize Settings link for Plugins page and create Settings page
163
+ */
164
+ function admin_init() {
165
+
166
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'add_settings_link' ) );
167
+ // add row to plugin page
168
+ add_filter( 'plugin_row_meta', array( $this, 'add_plugin_meta_links' ), 10, 2 );
169
+
170
+ require_once( 'inc/settings.php' );
171
+
172
+ global $WPAU_YOUTUBE_CHANNEL_SETTINGS;
173
+ if ( empty( $WPAU_YOUTUBE_CHANNEL_SETTINGS ) ) {
174
+ $WPAU_YOUTUBE_CHANNEL_SETTINGS = new WPAU_YOUTUBE_CHANNEL_SETTINGS();
175
+ }
176
+
177
+ } // END function admin_init_settings()
178
+
179
+ /**
180
+ * Append Settings link for Plugins page
181
+ * @param array $links array of links on plugins page
182
+ */
183
+ function add_settings_link($links) {
184
+
185
+ $settings_title = __( 'Settings' );
186
+ $settings_link = "<a href=\"options-general.php?page={$this->plugin_slug}\">{$settings_title}</a>";
187
+ array_unshift( $links, $settings_link );
188
+
189
+ // Free some memory
190
+ unset( $settings_title, $settings_link );
191
+
192
+ // Return updated array of links
193
+ return $links;
194
+
195
+ } // END function add_settings_link()
196
+
197
+ /**
198
+ * Add link to official plugin page
199
+ */
200
+ function add_plugin_meta_links($links, $file) {
201
+
202
+ if ( 'youtube-channel/youtube-channel.php' === $file ) {
203
+ return array_merge(
204
+ $links,
205
+ array(
206
+ sprintf(
207
+ '<a href="https://wordpress.org/support/plugin/youtube-channel" target="_blank">%s</a>',
208
+ __( 'Support' )
209
+ ),
210
+ )
211
+ );
212
+ }
213
+ return $links;
214
+
215
+ }
216
+ /**
217
+ * Enqueue admin scripts and styles for widget customization
218
+ */
219
+ function widget_scripts() {
220
+
221
+ global $pagenow;
222
+
223
+ // Enqueue only on widget or post pages
224
+ if ( ! in_array( $pagenow, array( 'widgets.php', 'customize.php', 'options-general.php', 'post.php' ) ) ) {
225
+ return;
226
+ }
227
+
228
+ // Enqueue on post page only if tinymce is enabled
229
+ if ( 'post.php' == $pagenow && empty( $this->defaults['tinymce'] ) ) {
230
+ return;
231
+ }
232
+
233
+ wp_enqueue_style(
234
+ $this->plugin_slug . '-admin',
235
+ plugins_url( 'assets/css/admin.css', __FILE__ ),
236
+ array(),
237
+ self::VER
238
+ );
239
+
240
+ } // END function widget_scripts()
241
+
242
+ /**
243
+ * Print dashboard notice
244
+ * @return string Formatted notice with usefull explanation
245
+ */
246
+ function admin_notices() {
247
+
248
+ // Get array of dismissed notices
249
+ $dismissed_notices = get_option( 'youtube_channel_dismissed_notices' );
250
+
251
+ // Dismiss notices if requested and then update option in DB
252
+ if ( ! empty( $_GET['ytc_dismiss_notice_old_php'] ) ) {
253
+ $dismissed_notices['old_php'] = 1;
254
+ update_option( 'youtube_channel_dismissed_notices', $dismissed_notices );
255
+ }
256
+ if ( ! empty( $_GET['ytc_dismiss_notice_apikey_wpconfig'] ) ) {
257
+ $dismissed_notices['apikey_wpconfig'] = 1;
258
+ update_option( 'youtube_channel_dismissed_notices', $dismissed_notices );
259
+ }
260
+ if ( ! empty( $_GET['ytc_dismiss_notice_vanity_option'] ) ) {
261
+ $dismissed_notices['vanity_option'] = 1;
262
+ update_option( 'youtube_channel_dismissed_notices', $dismissed_notices );
263
+ }
264
+ if ( ! empty( $_GET['ytc_dismiss_notice_changed_shortcode_308'] ) ) {
265
+ $dismissed_notices['changed_shortcode_308'] = 1;
266
+ update_option( 'youtube_channel_dismissed_notices', $dismissed_notices );
267
+ }
268
+
269
+ // Prepare vars for notices
270
+ $settings_page = 'options-general.php?page=youtube-channel';
271
+ $notice = array(
272
+ 'error' => '',
273
+ 'warning' => '',
274
+ 'info' => '',
275
+ );
276
+
277
+ // Inform if PHP version is lower than 5.3
278
+ if (
279
+ version_compare( PHP_VERSION, '5.3', '<' ) &&
280
+ (
281
+ empty( $dismissed_notices ) ||
282
+ ( ! empty( $dismissed_notices ) && empty( $dismissed_notices['old_php'] ) )
283
+ )
284
+ ) {
285
+ $notice['info'] .= sprintf(
286
+ __( '<p>Your website running on web server with PHP version %s. Please note that <strong>%s</strong> requires PHP at least 5.3 or newer to work properly. <a href="%s" class="dismiss">Dismiss</a></p>', 'youtube-channel' ),
287
+ PHP_VERSION,
288
+ $this->plugin_name,
289
+ '?ytc_dismiss_notice_old_php=1'
290
+ );
291
+ }
292
+
293
+ // Inform if YOUTUBE_DATA_API_KEY is still in wp-config.php
294
+ if (
295
+ defined( 'YOUTUBE_DATA_API_KEY' ) &&
296
+ empty( $dismissed_notices['apikey_wpconfig'] )
297
+ ) {
298
+ $notice['info'] .= sprintf(
299
+ __( '<p>Since <strong>%s</strong> v3.0.6 we store <strong>YouTube Data API Key</strong> in plugin settings. So, you can safely remove %s define line from your <strong>wp-config.php</strong> file. <a href="%s" class="dismiss">Dismiss</a></p>', 'youtube-channel' ),
300
+ $this->plugin_name,
301
+ 'YOUTUBE_DATA_API_KEY',
302
+ '?ytc_dismiss_notice_apikey_wpconfig=1'
303
+ );
304
+ }
305
+
306
+ // No YouTube DATA Api Key?
307
+ if ( empty( $this->defaults['apikey'] ) ) {
308
+ $notice['error'] .= sprintf(
309
+ wp_kses(
310
+ __(
311
+ '<p>Please note, to make <strong>%1$s</strong> plugin v3+ work, generate <strong>%2$s</strong> in <a href="%3$s" target="_blank">%4$s</a>, as explained <a href="%5$s" target="_blank">here</a>, then add it to <a href="%6$s">%7$s</a>.<br><br>If you have any issue with new version of plugin, please ask for help on official <a href="%8$s" target="_blank">%9$s</a>.<br>This notice will disappear when you add missing key as mentioned above!</p>',
312
+ 'youtube-channel'
313
+ ),
314
+ array(
315
+ 'a' => array( 'href' => array(), 'target' => array( '_blank' ) ),
316
+ 'p' => array(),
317
+ 'strong' => array(),
318
+ 'br' => array(),
319
+ )
320
+ ),
321
+ $this->plugin_name,
322
+ __( 'YouTube Data API Key', 'youtube-channel' ),
323
+ esc_url( 'https://console.developers.google.com/project' ),
324
+ __( 'Google Developers Console', 'youtube-channel' ),
325
+ esc_url( 'http://urosevic.net/wordpress/plugins/youtube-channel/#youtube_data_api_key' ),
326
+ esc_url( 'options-general.php?page=youtube-channel&tab=general' ),
327
+ __( 'General Settings', 'youtube-channel' ),
328
+ esc_url( 'https://wordpress.org/support/plugin/youtube-channel' ),
329
+ __( 'support forum', 'youtube-channel' )
330
+ );
331
+ }
332
+
333
+ if (
334
+ empty( $dismissed_notices ) ||
335
+ ( ! empty( $dismissed_notices ) && empty( $dismissed_notices['vanity_option'] ) )
336
+ ) {
337
+ $notice['warning'] .= sprintf(
338
+ __( '<p><strong>%s</strong> since version 2.4 supports linking to channel through <em>Vanity/Custom</em> URL. Please review <a href="%s">global</a> and <a href="%s">widgets</a> settings. <a href="%s" class="dismiss">Dismiss</a>', 'youtube-channel' ),
339
+ $this->plugin_name,
340
+ $settings_page,
341
+ 'widgets.php',
342
+ '?ytc_dismiss_notice_vanity_option=1'
343
+ );
344
+ }
345
+
346
+ // v3.0.8.1 shortcode changes from v3.0.8
347
+ if (
348
+ empty( $dismissed_notices ) ||
349
+ ( ! empty( $dismissed_notices ) && empty( $dismissed_notices['changed_shortcode_308'] ) )
350
+ ) {
351
+ $notice['warning'] .= sprintf(
352
+ __( '<p><strong>%s</strong> changed shortcode parameters by removing <code>only_pl</code> and <code>showgoto</code>, and combining with parameters <code>display</code> and <code>link_to</code> respectively. Please check out <a href="%s&tab=help">%s</a> and update your shortcodes. <a href="%s" class="dismiss">Dismiss</a>', 'youtube-channel' ),
353
+ $this->plugin_name,
354
+ $settings_page,
355
+ 'Help: How to use shortcode',
356
+ '?ytc_dismiss_notice_changed_shortcode_308=1'
357
+ );
358
+ }
359
+ foreach ( $notice as $type => $message ) {
360
+ if ( ! empty( $message ) ) {
361
+ echo "<div class=\"notice notice-{$type}\">{$message}</div>";
362
+ }
363
+ }
364
+
365
+ } // END function admin_notices()
366
+
367
+ /**
368
+ * Get default options from DB
369
+ * @return array Latest global defaults
370
+ */
371
+ public function defaults() {
372
+
373
+ $defaults = get_option( $this->plugin_option );
374
+ if ( empty( $defaults ) ) {
375
+ $this->init_options();
376
+ }
377
+
378
+ return $defaults;
379
+
380
+ }
381
+
382
+ /**
383
+ * Enqueue frontend scripts and styles
384
+ */
385
+ function enqueue_scripts() {
386
+
387
+ // Do we need our own lightbox?
388
+ if ( empty( $this->defaults['nolightbox'] ) ) {
389
+ wp_enqueue_style(
390
+ 'magnific-popup-au',
391
+ plugins_url( 'assets/lib/magnific-popup/magnific-popup.min.css', __FILE__ ),
392
+ array(),
393
+ self::VER
394
+ );
395
+ wp_enqueue_script(
396
+ 'magnific-popup-au',
397
+ plugins_url( 'assets/lib/magnific-popup/jquery.magnific-popup.min.js', __FILE__ ),
398
+ array( 'jquery' ),
399
+ self::VER,
400
+ true
401
+ );
402
+ }
403
+
404
+ wp_enqueue_style(
405
+ 'youtube-channel',
406
+ plugins_url( 'assets/css/youtube-channel.css', __FILE__ ),
407
+ array(),
408
+ self::VER
409
+ );
410
+ /* Not needed for v3.0.8.x
411
+ wp_enqueue_script(
412
+ 'youtube-channel',
413
+ plugins_url('assets/js/youtube-channel.min.js', __FILE__),
414
+ array('jquery'),
415
+ self::VER,
416
+ true
417
+ );
418
+ */
419
+ } // end function enqueue_scripts
420
+
421
+ /**
422
+ * Generate comlete inline JavaScript code that conains
423
+ * Async video load and lightbox init for thumbnails
424
+ * @return string Compressed JavaScript code
425
+ */
426
+ function footer_scripts() {
427
+
428
+ $js = '';
429
+
430
+ // Print YT API only if we have set ytc_html5_js in $_SESSION
431
+ if ( ! empty( $_SESSION['ytc_html5_js'] ) ) {
432
+ $js .= "
433
+ if (!window['YT']) {
434
+ var tag=document.createElement('script');
435
+ tag.src=\"//www.youtube.com/iframe_api\";
436
+ var firstScriptTag=document.getElementsByTagName('script')[0];
437
+ firstScriptTag.parentNode.insertBefore(tag,firstScriptTag);
438
+ }
439
+ function ytc_create_ytplayers(){
440
+ {$_SESSION['ytc_html5_js']}
441
+ }
442
+ try {
443
+ ytc_create_ytplayers();
444
+ } catch (e) {}
445
+ function onYouTubeIframeAPIReady(){
446
+ ytc_create_ytplayers();
447
+ }
448
+ function ytc_mute(event){event.target.mute();}
449
+ ";
450
+ } // END if ( ! empty($_SESSION['ytc_html5_js']) )
451
+
452
+ // Print Magnific Popup if not disabled
453
+ if ( empty( $this->defaults['nolightbox'] ) ) {
454
+ $js .= "
455
+ function ytc_init_MPAU() {
456
+ jQuery('.ytc-lightbox').magnificPopupAU({
457
+ disableOn:320,
458
+ type:'iframe',
459
+ mainClass:'ytc-mfp-lightbox',
460
+ removalDelay:160,
461
+ preloader:false,
462
+ fixedContentPos:false
463
+ });
464
+ }
465
+ jQuery(window).on('load',function(){
466
+ ytc_init_MPAU();
467
+ });
468
+ jQuery(document).ajaxComplete(function(){
469
+ ytc_init_MPAU();
470
+ });
471
+ ";
472
+ } // END if ( empty($this->defaults['nolightbox']) )
473
+
474
+ if ( ! empty( $js ) ) {
475
+ $js = "
476
+ <!-- YouTube Channel 3 -->
477
+ <script type=\"text/javascript\">
478
+ $js
479
+ </script>\n
480
+ ";
481
+
482
+ if ( WP_DEBUG ) {
483
+ // Uncompressed code if WP debug is enabled
484
+ $js = str_replace( ';var', ";\nvar", $js );
485
+ $js = str_replace( "\t", '', $js );
486
+ // $js = str_replace(',', ",\n\t", $js);
487
+ echo $js;
488
+ } else {
489
+ echo trim( preg_replace( '/[\t\r\n]+/', '', $js ) );
490
+ }
491
+ }
492
+
493
+ } // END function footer_scripts()
494
+
495
+ public function shortcode($atts) {
496
+
497
+ // get general default settings
498
+ $instance = $this->defaults();
499
+
500
+ // extract shortcode parameters
501
+ extract(
502
+ shortcode_atts(
503
+ array(
504
+ 'vanity' => $instance['vanity'],
505
+ 'channel' => $instance['channel'],
506
+ 'username' => $instance['username'],
507
+ 'playlist' => $instance['playlist'],
508
+ 'res' => '', // (deprecated, but leave for back compatibility) ex res
509
+ 'use_res' => '', // (deprecated, but leave for back compatibility) ex use_res
510
+ 'resource' => $instance['resource'], // ex use_res
511
+ 'only_pl' => 0, // disabled by default (was: $instance['only_pl'],)
512
+ 'cache' => $instance['cache'], // ex cache_time
513
+ 'privacy' => $instance['privacy'], // ex showvidesc
514
+ 'fetch' => $instance['fetch'], // ex maxrnd
515
+ 'num' => $instance['num'], // ex vidqty
516
+
517
+ 'random' => 0, // ex getrnd
518
+
519
+ 'ratio' => $instance['ratio'],
520
+ 'width' => $instance['width'],
521
+ 'responsive' => ( ! empty( $instance['responsive'] ) ) ? $instance['responsive'] : '0',
522
+
523
+ 'show' => $instance['display'], // (deprecated, but keep for back compatibility) ex to_show
524
+ 'display' => $instance['display'],
525
+ 'no_thumb_title' => 0,
526
+ 'themelight' => $instance['themelight'],
527
+ 'controls' => $instance['controls'],
528
+ 'autoplay' => $instance['autoplay'],
529
+ 'mute' => $instance['autoplay_mute'],
530
+ 'norel' => $instance['norel'],
531
+ 'playsinline' => $instance['playsinline'], // play video on mobile devices inline instead in native device player
532
+
533
+ 'showtitle' => $instance['showtitle'], // none, above, below
534
+ 'showdesc' => $instance['showdesc'], // ex showvidesc
535
+ 'nobrand' => ( ! empty( $instance['modestbranding'] ) ) ? $instance['modestbranding'] : '0',
536
+ 'desclen' => $instance['desclen'], // ex videsclen
537
+ 'noinfo' => $instance['hideinfo'],
538
+ 'noanno' => $instance['hideanno'],
539
+
540
+ 'goto_txt' => $instance['goto_txt'],
541
+ 'popup' => $instance['popup_goto'],
542
+ 'link_to' => $instance['link_to'], // none, vanity, channel, legacy
543
+
544
+ 'class' => ( ! empty( $instance['class'] ) ) ? $instance['class'] : '',
545
+ ),
546
+ $atts
547
+ )
548
+ );
549
+
550
+ // backward compatibility for show -> display shortcode parameter
551
+ if ( ! empty( $show ) && $show !== $display && $show !== $instance['display'] ) {
552
+ $display = $show;
553
+ }
554
+ // backward compatibility for use_res -> resource shortcode parameter
555
+ if ( ! empty( $use_res ) ) {
556
+ $resource = $use_res;
557
+ } else if ( ! empty( $res ) ) {
558
+ $resource = $res;
559
+ }
560
+
561
+ // prepare instance for output
562
+ $instance['vanity'] = $vanity;
563
+ $instance['channel'] = $channel;
564
+ $instance['username'] = $username;
565
+ $instance['playlist'] = $playlist;
566
+ $instance['resource'] = $resource; // resource: 0 channel, 1 favorites, 2 playlist, 3 liked
567
+ $instance['cache'] = $cache; // in seconds, def 5min - settings?
568
+ $instance['privacy'] = $privacy; // enhanced privacy
569
+
570
+ $instance['fetch'] = $fetch;
571
+ $instance['num'] = $num; // num: 1
572
+
573
+ $instance['random'] = $random; // use embedded playlist - false by default
574
+
575
+ // Video Settings
576
+ $instance['ratio'] = $ratio; // aspect ratio: 3 - 16:9, 2 - 16:10, 1 - 4:3
577
+ $instance['width'] = $width; // 306
578
+ $instance['responsive'] = $responsive; // enable responsivenes?
579
+ $instance['display'] = $display; // thumbnail, iframe, iframe2, playlist
580
+ $instance['no_thumb_title'] = $no_thumb_title; // hide tooltip for thumbnails
581
+
582
+ $instance['themelight'] = $themelight; // use light theme, dark by default
583
+ $instance['controls'] = $controls; // hide controls, false by default
584
+ $instance['autoplay'] = $autoplay; // autoplay disabled by default
585
+ $instance['autoplay_mute'] = $mute; // mute sound on autoplay - disabled by default
586
+ $instance['norel'] = $norel; // hide related videos
587
+ $instance['playsinline'] = $playsinline; // inline plaer for iOS
588
+
589
+ // Content Layout
590
+ $instance['showtitle'] = $showtitle; // show video title, disabled by default
591
+ $instance['showdesc'] = $showdesc; // show video description, disabled by default
592
+ $instance['modestbranding'] = $nobrand; // hide YT logo
593
+ $instance['desclen'] = $desclen; // cut video description, number of characters
594
+ $instance['hideinfo'] = $noinfo; // hide info by default
595
+ $instance['hideanno'] = $noanno; // hide annotations, false by default
596
+
597
+ // Link to Channel
598
+ $instance['goto_txt'] = $goto_txt; // text for goto link - use settings
599
+ $instance['popup_goto'] = $popup; // open channel in: 0 same window, 1 javascript new, 2 target new
600
+ $instance['link_to'] = $link_to; // link to: none, vanity, legacy, channel
601
+
602
+ // Customization
603
+ $instance['class'] = $class; // custom additional class for container
604
+
605
+ return implode( array_values( $this->output( $instance ) ) );
606
+ } // END public function shortcode()
607
+
608
+ // Print out YTC block
609
+ public function output($instance) {
610
+
611
+ // Error message if no YouTube Data API Key
612
+ if ( empty( $this->defaults['apikey'] ) ) {
613
+
614
+ $error_msg = sprintf(
615
+ __( '<strong>%s</strong> version 3+ requires <strong>YouTube DATA API Key</strong> to work. <a href="%s" target="_blank">Learn more here</a>.', 'youtube-channel' ),
616
+ $this->plugin_name,
617
+ 'http://urosevic.net/wordpress/plugins/youtube-channel/#youtube_data_api_key'
618
+ );
619
+
620
+ $output[] = $this->front_debug( $error_msg );
621
+ return $output;
622
+
623
+ }
624
+
625
+ // 1) Get resource from widget/shortcode
626
+ // 2) If not set, get global default
627
+ // 3) if no global, get plugin's default
628
+ $resource = intval( $instance['resource'] );
629
+ if ( empty( $resource ) && 0 !== $resource ) {
630
+ $resource = intval( $this->defaults['resource'] );
631
+ if ( empty( $resource ) ) {
632
+ $resource = 0;
633
+ }
634
+ }
635
+
636
+ // Get Channel or Playlist ID based on requested resource
637
+ switch ( $resource ) {
638
+
639
+ // Playlist
640
+ case '2':
641
+ // 1) Get Playlist from shortcode/widget
642
+ // 2) If not set, use global default
643
+ // 3) If no global, throw error
644
+ if ( ! empty( $instance['playlist'] ) ) {
645
+ $playlist = trim( $instance['playlist'] );
646
+ } else {
647
+ $playlist = trim( $this->defaults['playlist'] );
648
+ }
649
+ // Now check has Playlist ID set or throw error
650
+ if ( '' == $playlist ) {
651
+ $output[] = $this->front_debug( 'Playlist selected as resource but no Playlist ID provided!' );
652
+ return $output;
653
+ }
654
+ break;
655
+
656
+ // Channel, Favourites, Liked
657
+ default:
658
+ /* Channel */
659
+ // 1) Get channel from shortcode/widget
660
+ // 2) If not set, use global default
661
+ // 3) If no global, throw error
662
+ if ( ! empty( $instance['channel'] ) ) {
663
+ $channel = trim( $instance['channel'] );
664
+ } else {
665
+ $channel = trim( $this->defaults['channel'] );
666
+ }
667
+ // Now check is Channel ID set or throw error
668
+ if ( '' == $channel ) {
669
+ if ( 1 == $resource ) {
670
+ $resource_name = 'Favourited videos';
671
+ } elseif ( 3 == $resource ) {
672
+ $resource_name = 'Liked videos';
673
+ } else {
674
+ $resource_name = 'Channel (User uploads)';
675
+ }
676
+ $error_msg = sprintf( '%s selected as resource but no Channel ID provided!', $resource_name );
677
+ $output[] = $this->front_debug( $error_msg );
678
+ return $output;
679
+ }
680
+ } // END switch ($resource)
681
+
682
+ /* OK, we have required resource (Playlist or Channel ID), so we can proceed to real job */
683
+
684
+ // Set custom class and responsive if needed
685
+ $class = $instance['class'] ? $instance['class'] : 'default';
686
+ if ( ! empty( $instance['responsive'] ) ) {
687
+ $class .= ' responsive';
688
+ }
689
+ if ( ! empty( $instance['display'] ) ) {
690
+ $class .= " ytc_display_{$instance['display']}";
691
+ }
692
+
693
+ switch ( $resource ) {
694
+ case 1: // Favourites
695
+ $resource_name = 'favourites';
696
+ $resource_id = preg_replace( '/^UC/', 'FL', $channel );
697
+ break;
698
+ case 2: // Playlist
699
+ $resource_name = 'playlist';
700
+ $resource_id = $playlist;
701
+ break;
702
+ case 3: // Liked
703
+ $resource_name = 'liked';
704
+ $resource_id = preg_replace( '/^UC/', 'LL', $channel );
705
+ break;
706
+ default: // Channel
707
+ $resource_name = 'channel';
708
+ $resource_id = preg_replace( '/^UC/', 'UU', $channel );
709
+ }
710
+
711
+ // Start output array
712
+ $output = array();
713
+
714
+ $output[] = "<div class=\"youtube_channel {$class}\">";
715
+
716
+ if ( 'playlist' == $instance['display'] ) { // Insert as Embedded playlist
717
+
718
+ $output = array_merge( $output, self::embed_playlist( $resource_id, $instance ) );
719
+
720
+ } else { // Individual videos from channel, favourites, liked or playlist
721
+
722
+ // Get max items for random video
723
+ $fetch = $instance['fetch'];
724
+ if ( $fetch < 1 ) { $fetch = 10; } // default 10
725
+ elseif ( $fetch > 50 ) { $fetch = 50; } // max 50
726
+
727
+ $resource_key = "{$resource_id}_{$fetch}";
728
+
729
+ // Do we need cache? Let we define cache fallback key
730
+ $cache_key_fallback = 'ytc_' . md5( $resource_key ) . '_fallback';
731
+
732
+ // Do cache magic
733
+ if ( $instance['cache'] > 0 ) {
734
+
735
+ // generate feed cache key for caching time
736
+ $cache_key = 'ytc_' . md5( $resource_key ) . '_' . $instance['cache'];
737
+
738
+ if ( ! empty( $_GET['ytc_force_recache'] ) ) {
739
+ delete_transient( $cache_key );
740
+ }
741
+
742
+ // get/set transient cache
743
+ if ( false === ( $json = get_transient( $cache_key ) ) || empty( $json ) ) {
744
+
745
+ // no cached JSON, get new
746
+ $json = $this->fetch_youtube_feed( $resource_id, $fetch );
747
+
748
+ // set decoded JSON to transient cache_key
749
+ set_transient( $cache_key, base64_encode( $json ), $instance['cache'] );
750
+
751
+ } else {
752
+
753
+ // we already have cached feed JSON, get it encoded
754
+ $json = base64_decode( $json );
755
+
756
+ }
757
+ } else {
758
+
759
+ // just get fresh feed if cache disabled
760
+ $json = $this->fetch_youtube_feed( $resource_id, $fetch );
761
+
762
+ }
763
+
764
+ // free some memory
765
+ unset( $response );
766
+
767
+ // decode JSON data
768
+ $json_output = json_decode( $json );
769
+
770
+ // YTC 3.0.7: Do we need this, still?
771
+ // if current feed is messed up, try to get it from fallback cache
772
+ if ( is_wp_error( $json_output ) && ! is_object( $json_output ) && empty( $json_output->items ) ) {
773
+ // do we have fallback cache?!
774
+ if ( true === ( $json_fallback = get_transient( $cache_key_fallback ) ) && ! empty( $json_fallback ) ) {
775
+ $json_output = json_decode( base64_decode( $json_fallback ) );
776
+ // and free memory
777
+ unset( $json_fallback );
778
+ }
779
+ }
780
+
781
+ // Get resource nice name based on selected resource
782
+ $resource_nice_name = $this->resource_nice_name( $resource );
783
+
784
+ // Prevent further checks if we have WP Error or empty record even after fallback
785
+ if ( is_wp_error( $json_output ) ) {
786
+ $output[] = $this->front_debug( $json_output->get_error_message() );
787
+ return $output;
788
+ } elseif ( isset( $json_output->items ) && 0 == sizeof( $json_output->items ) ) {
789
+ $output[] = $this->front_debug( sprintf( __( 'You have set to display videos from %s [resource list ID: %s], but there have no public videos in that resouce.' ), $resource_nice_name, $resource_id ) );
790
+ return $output;
791
+ } elseif ( empty( $json_output ) ) {
792
+ $output[] = $this->front_debug( sprintf( __( 'We have empty record for this feed. Please read <a href="%s" target="_blank">FAQ</a> and if that does not help, contact <a href="%s" target="_blank">support</a>.' ), 'https://wordpress.org/plugins/youtube-channel/faq/', 'https://wordpress.org/support/plugin/youtube-channel' ) );
793
+ return $output;
794
+ }
795
+
796
+ // Predefine `max_items` to prevent undefined notices
797
+ $max_items = 0;
798
+ if ( is_object( $json_output ) && ! empty( $json_output->items ) ) {
799
+
800
+ // Sort by date uploaded
801
+ $json_entry = $json_output->items;
802
+
803
+ $num = $instance['num'];
804
+ if ( $num > $fetch ) { $fetch = $num; }
805
+ $max_items = ( $fetch > sizeof( $json_entry ) ) ? sizeof( $json_entry ) : $fetch;
806
+
807
+ if ( ! empty( $instance['random'] ) ) {
808
+ $items = array_slice( $json_entry, 0, $max_items );
809
+ } else {
810
+ if ( ! $num ) {
811
+ $num = 1;
812
+ }
813
+ $items = array_slice( $json_entry, 0, $num );
814
+ }
815
+ }
816
+
817
+ if ( 0 == $max_items ) {
818
+
819
+ // Append YouTube DATA API error reason as comment
820
+ if ( ! empty( $json_output ) && is_object( $json_output ) && ! empty( $json_output->error->errors ) ) {
821
+
822
+ // Error went in fetch_youtube_feed()
823
+ if ( 'wpError' == $json_output->error->errors[0]->reason ) {
824
+ $error_msg = $json_output->error->errors[0]->message;
825
+ } elseif ( 'playlistNotFound' == $json_output->error->errors[0]->reason ) {
826
+ // Playlist error from Google API
827
+ if ( 'playlist' == $resource_name ) {
828
+ $error_msg = "Please check did you set existing <em>Playlist ID</em>. You set to show videos from {$resource_nice_name}, but YouTube does not recognize <strong>{$resource_id}</strong> as existing and public playlist.";
829
+ } else {
830
+ $error_msg = "Please check did you set proper <em>Channel ID</em>. You set to show videos from {$resource_nice_name}, but YouTube does not recognize <strong>{$channel}</strong> as existing and public channel.";
831
+ }
832
+ } elseif ( 'keyInvalid' == $json_output->error->errors[0]->reason ) {
833
+ // Invalid YouTube Data API Key
834
+ $error_msg = sprintf( __( "Double check <em>YouTube Data API Key</em> on <em>General</em> plugin tab and make sure it's correct. Read <a href=\"%s\" target=\"_blank\">Installation</a> document." ), 'https://wordpress.org/plugins/youtube-channel/installation/' );
835
+ } elseif ( 'ipRefererBlocked' == $json_output->error->errors[0]->reason ) {
836
+ // Restricted access YouTube Data API Key
837
+ $error_msg = 'Check <em>YouTube Data API Key</em> restrictions, empty cache if enabled by appending in browser address bar parameter <em>?ytc_force_recache=1</em>';
838
+ } elseif ( 'invalidChannelId' == $json_output->error->errors[0]->reason ) {
839
+ // (deprecated?) Non existing Channel ID set
840
+ $error_msg = sprintf( __( 'You have set wrong Channel ID. Fix that in General plugin settings, Widget and/or shortcode. Read <a href="%s" target="_blank">FAQ</a> document.' ), 'https://wordpress.org/plugins/youtube-channel/faq/' );
841
+ } elseif ( 'playlistItemsNotAccessible' == $json_output->error->errors[0]->reason ) {
842
+ // Forbidden access to resource
843
+ $error_msg = sprintf( __( "You do not have permission to access ressource <strong>%s</strong> (it's maybe set to private or even does not exists!)" ), $resource_id );
844
+ }
845
+ } else { // ELSE ! empty($json_output->error->errors)
846
+
847
+ $error_msg = 'Unrecognized error experienced.';
848
+
849
+ } // END ! empty($json_output->error->errors)
850
+
851
+ $output[] = $this->front_debug( $error_msg );
852
+
853
+ } else { // ELSE if ($max_items == 0)
854
+
855
+ // looks that feed is OK, let we update fallback that never expire
856
+ set_transient( $cache_key_fallback, base64_encode( $json ), 0 );
857
+
858
+ // and now free some memory
859
+ unset( $json, $json_output, $json_entry );
860
+
861
+ // set array for unique random item
862
+ if ( ! empty( $instance['random'] ) ) {
863
+ $random_used = array();
864
+ }
865
+
866
+ /* AU:20141230 reduce number of videos if requested > available */
867
+ if ( $num > sizeof( $items ) ) {
868
+ $num = sizeof( $items );
869
+ }
870
+
871
+ for ( $y = 1; $y <= $num; ++$y ) {
872
+ if ( ! empty( $instance['random'] ) ) {
873
+
874
+ $random_item = mt_rand( 0, ( count( $items ) - 1 ) );
875
+ while ( $y > 1 && in_array( $random_item, $random_used ) ) {
876
+ $random_item = mt_rand( 0, ( count( $items ) - 1 ) );
877
+ }
878
+ $random_used[] = $random_item;
879
+ $item = $items[ $random_item ];
880
+ } else {
881
+ $item = $items[ $y - 1 ];
882
+ }
883
+
884
+ // Generate single video block
885
+ $output = array_merge( $output, $this->ytc_print_video( $item, $instance, $y ) );
886
+ }
887
+ // Free some memory
888
+ unset( $random_used, $random_item, $json );
889
+
890
+ } // END if ($max_items == 0)
891
+
892
+ } // single playlist or ytc way
893
+
894
+ // Append link to channel on bootom of the widget
895
+ if ( ! empty( $instance['link_to'] ) && 'none' != $instance['link_to'] ) {
896
+ $output = array_merge( $output, $this->ytc_channel_link( $instance ) );
897
+ }
898
+
899
+ $output[] = '</div><!-- .youtube_channel -->';
900
+
901
+ // fix overflow on crappy themes
902
+ $output[] = '<div class="clearfix"></div>';
903
+
904
+ return $output;
905
+
906
+ } // END public function output($instance)
907
+
908
+ // --- HELPER FUNCTIONS ---
909
+
910
+ /**
911
+ * Download YouTube video feed through API 3.0
912
+ * @param string $id ID of resource
913
+ * @param integer $items Number of items to fetch (min 2, max 50)
914
+ * @return array JSON with videos
915
+ */
916
+ function fetch_youtube_feed($resource_id, $items) {
917
+
918
+ $feed_url = 'https://www.googleapis.com/youtube/v3/playlistItems?';
919
+ $feed_url .= 'part=snippet';
920
+ $feed_url .= "&playlistId={$resource_id}";
921
+ $feed_url .= '&fields=items(snippet(title%2Cdescription%2CpublishedAt%2CresourceId(videoId)))';
922
+ $feed_url .= "&maxResults={$items}";
923
+ $feed_url .= "&key={$this->defaults['apikey']}";
924
+
925
+ $wparg = array(
926
+ 'timeout' => 5, // five seconds only
927
+ );
928
+
929
+ $response = wp_remote_get( $feed_url, $wparg );
930
+
931
+ // If we have WP error, make JSON with error
932
+ if ( is_wp_error( $response ) ) {
933
+
934
+ $json = sprintf( '{"error":{"errors":[{"reason":"wpError","message":"%s","domain":"wpRemoteGet"}]}}', $response->get_error_message() );
935
+
936
+ } else {
937
+
938
+ $json = wp_remote_retrieve_body( $response );
939
+
940
+ }
941
+
942
+ // Free some memory
943
+ unset( $response );
944
+
945
+ return $json;
946
+
947
+ } // END function fetch_youtube_feed($resource_id, $items)
948
+
949
+ /**
950
+ * Print explanation of error for administrators (users with capability manage_options)
951
+ * and hidden message for lower users and visitors
952
+ * @param string $message Error message
953
+ * @return string FOrmatted message for error
954
+ */
955
+ function front_debug($message) {
956
+
957
+ // Show visible error to admin, Oops message to visitors and lower members
958
+ if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
959
+
960
+ $output = "<p class=\"ytc_error\"><strong>YTC ERROR:</strong> $message</p>";
961
+
962
+ } else {
963
+
964
+ $output = __( 'Oops, something went wrong.', 'youtube-channel' );
965
+ $output .= "<!-- YTC ERROR:\n";
966
+ $output .= strip_tags( $message );
967
+ $output .= "\n-->\n";
968
+
969
+ }
970
+
971
+ return $output;
972
+
973
+ } // END function debug($message)
974
+
975
+ /**
976
+ * Calculate height by provided width and aspect ratio
977
+ * @param integer $width Width in pixels
978
+ * @param integer $ratio Selected aspect ratio (1 for 4:3, other for 16:9)
979
+ * @return integer Calculated height in pixels
980
+ */
981
+ function height_ratio( $width = 306, $ratio ) {
982
+
983
+ switch ( $ratio ) {
984
+ case 1:
985
+ $height = round( ( $width / 4 ) * 3 );
986
+ break;
987
+ case 2:
988
+ case 3:
989
+ default:
990
+ $height = round( ( $width / 16 ) * 9 );
991
+ }
992
+ return $height;
993
+ } // END function height_ratio($width=306, $ratio)
994
+
995
+ /**
996
+ * Generate link to YouTube channel/user
997
+ * @param array $instance widget or shortcode settings
998
+ * @return array components prepared for output
999
+ */
1000
+ function ytc_channel_link($instance) {
1001
+
1002
+ // initialize array
1003
+ $output = array();
1004
+
1005
+ // do we need to show goto link?
1006
+ if ( 'none' != $instance['link_to'] ) {
1007
+
1008
+ $goto_url = 'https://www.youtube.com/';
1009
+
1010
+ switch ( $instance['link_to'] ) {
1011
+ case 'vanity':
1012
+ $vanity = trim( $instance['vanity'] );
1013
+ if ( empty( $vanity ) ) {
1014
+ return array( '<!-- YTC ERROR: Selected Vanity custom URL to be linked but no Vanity Name provided! -->' );
1015
+ }
1016
+ // sanity vanity content (strip all in front of last slash to cleanup vanity ID only)
1017
+ if ( ! empty( $vanity ) && false !== strpos( $vanity, 'youtube.com' ) ) {
1018
+ $vanity = preg_replace( '/^.*\//', '', $vanity );
1019
+ }
1020
+ $goto_url .= "c/$vanity";
1021
+ break;
1022
+
1023
+ case 'legacy':
1024
+ $username = trim( $instance['username'] );
1025
+ if ( empty( $username ) ) {
1026
+ return array( '<!-- YTC ERROR: Selected Legacy username to be linked but no Legacy username provided! -->' );
1027
+ }
1028
+ $goto_url .= "user/$username";
1029
+ break;
1030
+
1031
+ case 'channel':
1032
+ $channel = trim( $instance['channel'] );
1033
+ if ( empty( $channel ) ) {
1034
+ return array( '<!-- YTC ERROR: Selected Channel page to be linked but no Channel ID provided! -->' );
1035
+ }
1036
+ $goto_url .= "channel/$channel";
1037
+ break;
1038
+ }
1039
+
1040
+ $goto_txt = trim( $instance['goto_txt'] );
1041
+ if ( '' == $goto_txt ) {
1042
+ $goto_txt = __( 'Visit our YouTube channel', 'youtube-channel' );
1043
+ }
1044
+
1045
+ $newtab = __( 'in new window/tab', 'youtube-channel' );
1046
+
1047
+ $output[] = '<div class="clearfix"></div>';
1048
+ $output[] = '<div class="ytc_link">';
1049
+ $output[] = '<p>';
1050
+ switch ( $instance['popup_goto'] ) {
1051
+ case 1:
1052
+ $output[] = "<a href=\"javascript: window.open('{$goto_url}'); void 0;\" title=\"{$goto_txt} {$newtab}\">{$goto_txt}</a>";
1053
+ break;
1054
+ case 2:
1055
+ $output[] = "<a href=\"{$goto_url}\" target=\"_blank\" title=\"{$goto_txt} {$newtab}\">{$goto_txt}</a>";
1056
+ break;
1057
+ default:
1058
+ $output[] = "<a href=\"{$goto_url}\" title=\"{$goto_txt}\">$goto_txt</a>";
1059
+ } // switch popup_goto
1060
+ $output[] = '</p>';
1061
+ $output[] = '</div>';
1062
+
1063
+ } // showgoto
1064
+
1065
+ return $output;
1066
+ } // end function ytc_channel_link
1067
+
1068
+
1069
+ /**
1070
+ * Generate output for single video block
1071
+ * @param object $item Video object from JSON
1072
+ * @param array $instance Settings from widget or shortcode
1073
+ * @param int $y Order number of video
1074
+ * @return array Prepared single video block as array to concatenate
1075
+ */
1076
+ function ytc_print_video($item, $instance, $y) {
1077
+
1078
+ // Calculate width and height
1079
+ if ( empty( $instance['width'] ) ) {
1080
+ $instance['width'] = $this->defaults['width'];
1081
+ }
1082
+ $height = $this->height_ratio( $instance['width'], $instance['ratio'] );
1083
+
1084
+ // How to display videos?
1085
+ if ( empty( $instance['display'] ) ) {
1086
+ $instance['display'] = 'thumbnail';
1087
+ }
1088
+
1089
+ // Extract details about video from Resource
1090
+ $yt_id = $item->snippet->resourceId->videoId;
1091
+ $yt_title = $item->snippet->title;
1092
+ $yt_date = $item->snippet->publishedAt;
1093
+ $yt_thumb = "//img.youtube.com/vi/$yt_id/0.jpg"; // zero for HD thumb
1094
+
1095
+ // Enhanced privacy?
1096
+ $youtube_domain = $this->youtube_domain( $instance );
1097
+
1098
+ switch ( $y ) {
1099
+ case 1:
1100
+ $vnumclass = 'first';
1101
+ break;
1102
+ case $instance['num']:
1103
+ $autoplay = false;
1104
+ $vnumclass = 'last';
1105
+ break;
1106
+ default:
1107
+ $vnumclass = 'mid';
1108
+ $autoplay = false;
1109
+ break;
1110
+ }
1111
+
1112
+ // Set proper class for responsive thumbs per selected aspect ratio
1113
+ $arclass = $this->arclass( $instance );
1114
+
1115
+ $output[] = "<div class=\"ytc_video_container ytc_video_{$y} ytc_video_{$vnumclass} ${arclass}\" style=\"width:{$instance['width']}px\">";
1116
+
1117
+ // Show video title above video?
1118
+ if ( ! empty( $instance['showtitle'] ) && 'above' == $instance['showtitle'] ) {
1119
+ $output[] = "<h3 class=\"ytc_title ytc_title_above\">{$yt_title}</h3>";
1120
+ }
1121
+
1122
+ // Print out video
1123
+ if ( 'iframe' == $instance['display'] ) {
1124
+
1125
+ // Start wrapper for responsive item
1126
+ if ( $instance['responsive'] ) {
1127
+ $output[] = '<div class="fluid-width-video-wrapper">';
1128
+ }
1129
+
1130
+ $output[] = "<iframe title=\"YouTube Video Player\" width=\"{$instance['width']}\" height=\"{$height}\" src=\"//{$youtube_domain}/embed/{$yt_id}?wmode=opaque";
1131
+
1132
+ if ( ! empty( $instance['norel'] ) ) { $output[] = '&amp;rel=0'; } // disable related videos
1133
+ if ( ! empty( $instance['controls'] ) ) { $output[] = '&amp;controls=0'; }
1134
+ if ( ! empty( $instance['hideinfo'] ) ) { $output[] = '&amp;showinfo=0'; }
1135
+ if ( ! empty( $instance['autoplay'] ) ) { $output[] = '&amp;autoplay=1'; }
1136
+ if ( ! empty( $instance['hideanno'] ) ) { $output[] = '&amp;iv_load_policy=3'; }
1137
+ if ( ! empty( $instance['themelight'] ) ) { $output[] = '&amp;theme=light'; }
1138
+ if ( ! empty( $instance['modestbranding'] ) ) { $output[] = '&amp;modestbranding=1'; }
1139
+ if ( ! empty( $instance['playsinline'] ) ) { $output[] = '&amp;playsinline=1'; }
1140
+
1141
+ $output[] = "\" style=\"border:0;\" allowfullscreen id=\"ytc_{$yt_id}\"></iframe>";
1142
+
1143
+ // Close wrapper for responsive item
1144
+ if ( $instance['responsive'] ) {
1145
+ $output[] = '</div>';
1146
+ }
1147
+ } else if ( 'iframe2' == $instance['display'] ) {
1148
+
1149
+ // youtube API async
1150
+ $js_vars = '';
1151
+ $js_vars .= ( ! empty( $instance['norel'] ) ) ? 'rel:0,' : '';
1152
+ $js_vars .= ( ! empty( $instance['autoplay'] ) ) ? 'autoplay:1,' : '';
1153
+ $js_vars .= ( ! empty( $instance['hideinfo'] ) ) ? 'showinfo:0,' : '';
1154
+ $js_vars .= ( ! empty( $instance['controls'] ) ) ? 'controls:0,' : '';
1155
+ $js_vars .= ( ! empty( $instance['themelight'] ) ) ? "theme:'light'," : '';
1156
+ $js_vars .= ( ! empty( $instance['modestbranding'] ) ) ? 'modestbranding:1,' : '';
1157
+ $js_vars .= ( ! empty( $instance['playsinline'] ) ) ? 'playsinline:1,' : '';
1158
+ $js_vars .= "wmmode:'opaque'";
1159
+ $js_vars = rtrim( $js_vars, ',' );
1160
+
1161
+ $js_end = '';
1162
+ $js_end .= ( ! empty( $instance['hideanno'] ) ) ? 'iv_load_policy:3,' : '';
1163
+ $js_end .= ( ! empty( $instance['autoplay'] ) && ! empty( $instance['autoplay_mute'] ) ) ? "events:{'onReady':ytc_mute}," : '';
1164
+ $js_end = rtrim( $js_end, ',' );
1165
+
1166
+ $js_player_id = str_replace( '-', '_', $yt_id );
1167
+
1168
+ // Start wrapper for responsive item
1169
+ if ( $instance['responsive'] ) {
1170
+ $output[] = '<div class="fluid-width-video-wrapper">';
1171
+ }
1172
+
1173
+ $output[] = "<div id=\"ytc_player_{$js_player_id}\"></div>";
1174
+
1175
+ // Close wrapper for responsive item
1176
+ if ( $instance['responsive'] ) {
1177
+ $output[] = '</div>';
1178
+ }
1179
+
1180
+ $site_domain = $_SERVER['HTTP_HOST'];
1181
+ $ytc_html5_js = "var ytc_player_{$js_player_id};";
1182
+ $ytc_html5_js .= "ytc_player_{$js_player_id}=new YT.Player('ytc_player_{$js_player_id}',{height:'{$height}',width:'{$instance['width']}',";
1183
+ $ytc_html5_js .= "videoId:'{$yt_id}',enablejsapi:1,playerVars:{{$js_vars}},origin:'{$site_domain}',{$js_end}});";
1184
+
1185
+ // prepare JS for footer
1186
+ if ( empty( $_SESSION['ytc_html5_js'] ) ) {
1187
+ $_SESSION['ytc_html5_js'] = $ytc_html5_js;
1188
+ } else {
1189
+ $_SESSION['ytc_html5_js'] .= $ytc_html5_js;
1190
+ }
1191
+ } else { // default is thumbnail
1192
+
1193
+ // Do we need tooltip for thumbnail?
1194
+ if ( empty( $instance['no_thumb_title'] ) ) {
1195
+ $title = sprintf( __( 'Watch video %1$s published on %2$s', 'youtube-channel' ), $yt_title, $yt_date );
1196
+ }
1197
+
1198
+ $p = '';
1199
+ if ( empty( $instance['nolightbox'] ) ) {
1200
+ if ( ! empty( $instance['norel'] ) ) { $p .= '&amp;rel=0'; }
1201
+ if ( ! empty( $instance['modestbranding'] ) ) { $p .= '&amp;modestbranding=1'; }
1202
+ if ( ! empty( $instance['controls'] ) ) { $p .= '&amp;controls=0'; }
1203
+ if ( ! empty( $instance['playsinline'] ) ) { $p .= '&amp;playsinline=1'; }
1204
+ if ( ! empty( $instance['privacy'] ) ) { $p .= '&amp;enhanceprivacy=1'; }
1205
+ }
1206
+
1207
+ // Do we need thumbnail w/ or w/o tooltip
1208
+ $tag_title = ( empty( $instance['no_thumb_title'] ) ) ? $tag_title = "title=\"{$yt_title}\"" : '';
1209
+ $output[] = "<a href=\"//www.youtube.com/watch?v=${yt_id}${p}\" ${tag_title} class=\"ytc_thumb ytc-lightbox {$arclass}\"><span style=\"background-image: url({$yt_thumb});\" ${tag_title} id=\"ytc_{$yt_id}\"></span></a>";
1210
+ // $output[] = "<a href=\"//${youtube_domain}/watch?v=${yt_id}${p}\" ${tag_title} class=\"ytc_thumb ytc-lightbox {$arclass}\"><span style=\"background-image: url({$yt_thumb});\" ${tag_title} id=\"ytc_{$yt_id}\"></span></a>";
1211
+
1212
+ } // what to show conditions
1213
+
1214
+ // show video title below video?
1215
+ if ( ! empty( $instance['showtitle'] ) && 'below' == $instance['showtitle'] ) {
1216
+ $output[] = "<h3 class=\"ytc_title ytc_title_below\">{$yt_title}</h3>";
1217
+ }
1218
+
1219
+ // do we need to show video description?
1220
+ if ( ! empty( $instance['showdesc'] ) ) {
1221
+
1222
+ $video_description = $item->snippet->description;
1223
+ $etcetera = '';
1224
+ if ( $instance['desclen'] > 0 ) {
1225
+ if ( strlen( $video_description ) > $instance['desclen'] ) {
1226
+ $video_description = substr( $video_description, 0, $instance['desclen'] );
1227
+ $etcetera = '&hellip;';
1228
+ }
1229
+ }
1230
+
1231
+ if ( ! empty( $video_description ) ) {
1232
+ $output[] = "<p class=\"ytc_description\">{$video_description}{$etcetera}</p>";
1233
+ }
1234
+ }
1235
+
1236
+ $output[] = '</div><!-- .ytc_video_container -->';
1237
+
1238
+ return $output;
1239
+ } // end function ytc_print_video
1240
+
1241
+ /* function to print standard playlist embed code */
1242
+ function embed_playlist($resource_id, $instance) {
1243
+
1244
+ $width = ( empty( $instance['width'] ) ) ? 306 : $instance['width'];
1245
+ $height = self::height_ratio( $width, $instance['ratio'] );
1246
+ $autoplay = ( empty( $instance['autoplay'] ) ) ? '' : '&autoplay=1';
1247
+ $theme = ( empty( $instance['themelight'] ) ) ? '' : '&theme=light';
1248
+ $modestbranding = ( empty( $instance['modestbranding'] ) ) ? '' : '&modestbranding=1';
1249
+ $rel = ( empty( $instance['norel'] ) ) ? '' : '&rel=0';
1250
+ $playsinline = ( empty( $instance['playsinline'] ) ) ? '' : '&playsinline=1';
1251
+
1252
+ // enhanced privacy
1253
+ $youtube_domain = $this->youtube_domain( $instance );
1254
+ $arclass = $this->arclass( $instance );
1255
+ $output[] = "<div class=\"ytc_video_container ytc_video_1 ytc_video_single ytc_playlist_only {$arclass}\">";
1256
+ $output[] = '<div class="fluid-width-video-wrapper">';
1257
+ $output[] = "<iframe src=\"//{$youtube_domain}/embed/videoseries?list={$resource_id}{$autoplay}{$theme}{$modestbranding}{$rel}\"";
1258
+ if ( ! empty( $instance['fullscreen'] ) ) { $output[] = ' allowfullscreen'; }
1259
+ $output[] = " width=\"{$width}\" height=\"{$height}\" frameborder=\"0\"></iframe>";
1260
+ $output[] = '</div><!-- .fluid-width-video-wrapper -->';
1261
+ $output[] = '</div><!-- .ytc_video_container -->';
1262
+
1263
+ return $output;
1264
+
1265
+ } // END function embed_playlist($resource_id, $instance)
1266
+
1267
+ // Helper function cache_time()
1268
+ function cache_time($cache_time) {
1269
+ $times = array(
1270
+ 'minute' => array(
1271
+ 1 => __( '1 minute', 'youtube-channel' ),
1272
+ 5 => __( '5 minutes', 'youtube-channel' ),
1273
+ 15 => __( '15 minutes', 'youtube-channel' ),
1274
+ 30 => __( '30 minutes', 'youtube-channel' ),
1275
+ ),
1276
+ 'hour' => array(
1277
+ 1 => __( '1 hour', 'youtube-channel' ),
1278
+ 2 => __( '2 hours', 'youtube-channel' ),
1279
+ 5 => __( '5 hours', 'youtube-channel' ),
1280
+ 10 => __( '10 hours', 'youtube-channel' ),
1281
+ 12 => __( '12 hours', 'youtube-channel' ),
1282
+ 18 => __( '18 hours', 'youtube-channel' ),
1283
+ ),
1284
+ 'day' => array(
1285
+ 1 => __( '1 day', 'youtube-channel' ),
1286
+ 2 => __( '2 days', 'youtube-channel' ),
1287
+ 3 => __( '3 days', 'youtube-channel' ),
1288
+ 4 => __( '4 days', 'youtube-channel' ),
1289
+ 5 => __( '5 days', 'youtube-channel' ),
1290
+ 6 => __( '6 days', 'youtube-channel' ),
1291
+ ),
1292
+ 'week' => array(
1293
+ 1 => __( '1 week', 'youtube-channel' ),
1294
+ 2 => __( '2 weeks', 'youtube-channel' ),
1295
+ 3 => __( '3 weeks', 'youtube-channel' ),
1296
+ 4 => __( '1 month', 'youtube-channel' ),
1297
+ ),
1298
+ );
1299
+
1300
+ $out = '';
1301
+ foreach ( $times as $period => $timeset ) {
1302
+ switch ( $period ) {
1303
+ case 'minute':
1304
+ $sc = MINUTE_IN_SECONDS;
1305
+ break;
1306
+ case 'hour':
1307
+ $sc = HOUR_IN_SECONDS;
1308
+ break;
1309
+ case 'day':
1310
+ $sc = DAY_IN_SECONDS;
1311
+ break;
1312
+ case 'week':
1313
+ $sc = WEEK_IN_SECONDS;
1314
+ break;
1315
+ }
1316
+
1317
+ foreach ( $timeset as $n => $s ) {
1318
+ $sec = $sc * $n;
1319
+ $out .= '<option value="' . $sec . '" ' . selected( $cache_time, $sec, 0 ).'>' . __( $s, 'youtube-channel' ) . '</option>';
1320
+ unset( $sec );
1321
+ }
1322
+ }
1323
+ return $out;
1324
+ } // end function cache_time
1325
+
1326
+
1327
+ /**
1328
+ * Method to delete all YTC transient caches
1329
+ * @return string Report message about success or failed purge cache
1330
+ */
1331
+ function clear_all_cache() {
1332
+
1333
+ global $wpdb;
1334
+
1335
+ $ret = $wpdb->query(
1336
+ $wpdb->prepare(
1337
+ "DELETE FROM $wpdb->options
1338
+ WHERE option_name LIKE %s
1339
+ OR option_name LIKE %s
1340
+ ",
1341
+ '_transient_timeout_ytc_%',
1342
+ '_transient_ytc_%'
1343
+ )
1344
+ );
1345
+
1346
+ if ( false === $ret ) {
1347
+ echo 'Oops, we did not cleared any YouTube Channel cache because some error occured';
1348
+ } else {
1349
+ if ( 0 == $ret ) {
1350
+ echo 'Congratulations! You can chill, there is no YouTube Channel caches.';
1351
+ } else {
1352
+ echo "Success! We cleared $ret row/s with YouTube Channel caches.";
1353
+ }
1354
+ }
1355
+ exit();
1356
+
1357
+ } // END function clear_all_cache()
1358
+
1359
+ /**
1360
+ * Return nice name for resource by provided resource ID
1361
+ * @param integer $resource_id Resource ID
1362
+ * @return string Resource nice name
1363
+ */
1364
+ function resource_nice_name($resource_id) {
1365
+ if ( 0 == $resource_id ) {
1366
+ $resource_nice_name = 'Channel (User uploads)';
1367
+ } elseif ( 1 == $resource_id ) {
1368
+ $resource_nice_name = 'Favourited videos';
1369
+ } elseif ( 2 == $resource_id ) {
1370
+ $resource_nice_name = 'Liked videos';
1371
+ } elseif ( 3 == $resource_id ) {
1372
+ $resource_nice_name = 'Liked videos';
1373
+ } else {
1374
+ $resource_nice_name = 'Unknown resource';
1375
+ }
1376
+ return $resource_nice_name;
1377
+ }
1378
+
1379
+ function youtube_domain($instance) {
1380
+ $youtube_domain = ( ! empty( $instance['privacy'] ) ) ? 'www.youtube-nocookie.com' : 'www.youtube.com';
1381
+ return $youtube_domain;
1382
+ } // end function youtube_domain
1383
+
1384
+ function arclass($instance) {
1385
+ return ( ! empty( $instance['ratio'] ) && 1 == $instance['ratio'] ) ? 'ar4_3' : 'ar16_9';
1386
+ } // END function arclass()
1387
+
1388
+ /**
1389
+ * Register TinyMCE button for YTC
1390
+ * @param array $plugins Unmodified set of plugins
1391
+ * @return array Set of TinyMCE plugins with YTC addition
1392
+ */
1393
+ function mce_external_plugins($plugins) {
1394
+
1395
+ $plugins['youtube_channel'] = plugin_dir_url( __FILE__ ) . 'inc/tinymce/plugin.min.js';
1396
+
1397
+ return $plugins;
1398
+
1399
+ } // END function mce_external_plugins($plugins)
1400
+
1401
+ /**
1402
+ * Append TinyMCE button for YTC at the end of row 1
1403
+ * @param array $buttons Unmodified set of buttons
1404
+ * @return array Set of TinyMCE buttons with YTC addition
1405
+ */
1406
+ function mce_buttons($buttons) {
1407
+
1408
+ $buttons[] = 'youtube_channel_shortcode';
1409
+ return $buttons;
1410
+
1411
+ } // END function mce_buttons($buttons)
1412
+
1413
+ function generate_debug_json() {
1414
+ global $wp_version;
1415
+
1416
+ // get widget ID from parameter
1417
+ $for = trim( $_GET['ytc_debug_json_for'] );
1418
+
1419
+ if ( 'global' == $for ) {
1420
+ // global settings
1421
+ $options = get_option( 'youtube_channel_defaults' );
1422
+
1423
+ if ( ! is_array( $options ) ) {
1424
+ return;
1425
+ }
1426
+
1427
+ // Remove YouTube Data API Key from config JSON
1428
+ unset( $options['apikey'] );
1429
+
1430
+ } else {
1431
+ // widget
1432
+ $widget_id = (int) $for;
1433
+ $for = "youtube-channel-{$for}";
1434
+
1435
+ // get YTC widgets options
1436
+ $widget_options = get_option( 'widget_youtube-channel' );
1437
+
1438
+ if ( ! is_array( $widget_options[ $widget_id ] ) ) {
1439
+ return;
1440
+ }
1441
+
1442
+ $options = $widget_options[ $widget_id ];
1443
+ unset( $widget_options );
1444
+ }
1445
+
1446
+ // prepare debug data with settings of current widget
1447
+ $data = array_merge(
1448
+ array(
1449
+ 'date' => date( 'r' ),
1450
+ 'server' => $_SERVER['SERVER_SOFTWARE'],
1451
+ 'php' => PHP_VERSION,
1452
+ 'wp' => $wp_version,
1453
+ 'ytc' => self::VER,
1454
+ 'url' => get_site_url(),
1455
+ 'for' => $for,
1456
+ ),
1457
+ $options
1458
+ );
1459
+
1460
+ // Construct descriptive filename
1461
+ $date = date( 'ymdHis' );
1462
+ $json_filename = "ytc3_{$_SERVER['HTTP_HOST']}_{$for}_{$date}.json";
1463
+ // Return JSON file
1464
+ header( "Content-disposition: attachment; filename={$json_filename}" );
1465
+ header( 'Content-Type: application/json' );
1466
+ echo json_encode( $data );
1467
+
1468
+ // Destroy vars
1469
+ unset( $data, $options, $widget_id, $option_name, $for, $date, $json_filename );
1470
+
1471
+ // Exit now, because we need only debug data in JSON file, not settings or any other page
1472
+ exit;
1473
+ }
1474
+ } // end class
1475
+ } // end class check
1476
+
1477
+ // add_action('plugins_loaded', create_function( '', '$WPAU_YOUTUBE_CHANNEL = new WPAU_YOUTUBE_CHANNEL();' ) );
1478
+
1479
+ global $WPAU_YOUTUBE_CHANNEL;
1480
+ if ( empty( $WPAU_YOUTUBE_CHANNEL ) ) {
1481
+ $WPAU_YOUTUBE_CHANNEL = new WPAU_YOUTUBE_CHANNEL();
1482
+ }