Version Description
- Add: open thumbnails in lightbox and stay on site, instead opening YouTube page (Magnific Popup jQuery library)
- Add: make thumbnail responsive
- Add: play indicator for thumbnails
- Add: shortcode [youtube_channel]
- Add: tabbed settings page for default options for shortcodes
- Add: Help tab for shortcode parameters
- Change: moved parts of code to helper functions
Download this release
Release Info
Developer | urkekg |
Plugin | YouTube Channel |
Version | 2.2.0 |
Comparing to | |
See all releases |
Code changes from version 2.1.0.2 to 2.2.0
- assets/css/youtube-channel.css +52 -0
- assets/img/play.png +0 -0
- assets/js/youtube-channel.js +11 -0
- assets/lib/magnific-popup/LICENSE +20 -0
- assets/lib/magnific-popup/jquery.magnific-popup.min.js +4 -0
- assets/lib/magnific-popup/magnific-popup.css +370 -0
- assets/settings.php +658 -0
- assets/settings_help.php +62 -0
- assets/settings_template.php +19 -0
- readme.txt +18 -9
- youtube-channel.php +219 -91
assets/css/youtube-channel.css
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.ytc_thumb {
|
2 |
+
display: block;
|
3 |
+
overflow: hidden;
|
4 |
+
position: relative;
|
5 |
+
height: 0;
|
6 |
+
width: 100%;
|
7 |
+
top: 0;
|
8 |
+
right: 0;
|
9 |
+
bottom: 0;
|
10 |
+
left: 0;
|
11 |
+
}
|
12 |
+
.ytc_thumb>span {
|
13 |
+
height: 0;
|
14 |
+
width: 100%;
|
15 |
+
display: block;
|
16 |
+
-webkit-background-size: cover;
|
17 |
+
background-size: cover;
|
18 |
+
background-position: center center;
|
19 |
+
background-repeat: no-repeat;
|
20 |
+
}
|
21 |
+
.ytc_thumb>span:before {
|
22 |
+
content: "";
|
23 |
+
display: block;
|
24 |
+
width: 100%;
|
25 |
+
height: 0; /*100%;*/
|
26 |
+
background-image: url(../img/play.png);
|
27 |
+
background-position: center center;
|
28 |
+
background-repeat: no-repeat;
|
29 |
+
background-color: transparent;
|
30 |
+
opacity: 0.6;
|
31 |
+
transition: 0.4s;
|
32 |
+
}
|
33 |
+
.ytc_thumb:hover>span:before {
|
34 |
+
opacity: 1;
|
35 |
+
}
|
36 |
+
|
37 |
+
/* Aspect Ratio Thumbs */
|
38 |
+
.ytc_thumb.ar16_9,
|
39 |
+
.ytc_thumb.ar16_9>span,
|
40 |
+
.ytc_thumb.ar16_9>span:before {
|
41 |
+
padding-bottom: 56.26%;
|
42 |
+
}
|
43 |
+
.ytc_thumb.ar16_10,
|
44 |
+
.ytc_thumb.ar16_10>span,
|
45 |
+
.ytc_thumb.ar16_10>span:before {
|
46 |
+
padding-bottom: 62.5%;
|
47 |
+
}
|
48 |
+
.ytc_thumb.ar4_3,
|
49 |
+
.ytc_thumb.ar4_3>span,
|
50 |
+
.ytc_thumb.ar4_3>span:before {
|
51 |
+
padding-bottom: 75%;
|
52 |
+
}
|
assets/img/play.png
ADDED
Binary file
|
assets/js/youtube-channel.js
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($) {
|
2 |
+
$('.ytc-lightbox')
|
3 |
+
.magnificPopup({
|
4 |
+
disableOn: 700,
|
5 |
+
type: 'iframe',
|
6 |
+
mainClass: 'mfp-fade',
|
7 |
+
removalDelay: 160,
|
8 |
+
preloader: false,
|
9 |
+
fixedContentPos: false
|
10 |
+
});
|
11 |
+
});
|
assets/lib/magnific-popup/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
The MIT License (MIT)
|
2 |
+
|
3 |
+
Copyright (c) 2014 Dmitry Semenov, http://dimsemenov.com
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6 |
+
this software and associated documentation files (the "Software"), to deal in
|
7 |
+
the Software without restriction, including without limitation the rights to
|
8 |
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9 |
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10 |
+
subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17 |
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18 |
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19 |
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20 |
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
assets/lib/magnific-popup/jquery.magnific-popup.min.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
/*! Magnific Popup - v0.9.9 - 2013-12-27
|
2 |
+
* http://dimsemenov.com/plugins/magnific-popup/
|
3 |
+
* Copyright (c) 2013 Dmitry Semenov; */
|
4 |
+
(function(e){var t,n,i,o,r,a,s,l="Close",c="BeforeClose",d="AfterClose",u="BeforeAppend",p="MarkupParse",f="Open",m="Change",g="mfp",h="."+g,v="mfp-ready",C="mfp-removing",y="mfp-prevent-close",w=function(){},b=!!window.jQuery,I=e(window),x=function(e,n){t.ev.on(g+e+h,n)},k=function(t,n,i,o){var r=document.createElement("div");return r.className="mfp-"+t,i&&(r.innerHTML=i),o?n&&n.appendChild(r):(r=e(r),n&&r.appendTo(n)),r},T=function(n,i){t.ev.triggerHandler(g+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]))},E=function(n){return n===s&&t.currTemplate.closeBtn||(t.currTemplate.closeBtn=e(t.st.closeMarkup.replace("%title%",t.st.tClose)),s=n),t.currTemplate.closeBtn},_=function(){e.magnificPopup.instance||(t=new w,t.init(),e.magnificPopup.instance=t)},S=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};w.prototype={constructor:w,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=S(),t.probablyMobile=t.isAndroid||t.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),o=e(document),t.popupsCache={}},open:function(n){i||(i=e(document.body));var r;if(n.isObj===!1){t.items=n.items.toArray(),t.index=0;var s,l=n.items;for(r=0;l.length>r;r++)if(s=l[r],s.parsed&&(s=s.el[0]),s===n.el[0]){t.index=r;break}}else t.items=e.isArray(n.items)?n.items:[n.items],t.index=n.index||0;if(t.isOpen)return t.updateItemHTML(),void 0;t.types=[],a="",t.ev=n.mainEl&&n.mainEl.length?n.mainEl.eq(0):o,n.key?(t.popupsCache[n.key]||(t.popupsCache[n.key]={}),t.currTemplate=t.popupsCache[n.key]):t.currTemplate={},t.st=e.extend(!0,{},e.magnificPopup.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=k("bg").on("click"+h,function(){t.close()}),t.wrap=k("wrap").attr("tabindex",-1).on("click"+h,function(e){t._checkIfClose(e.target)&&t.close()}),t.container=k("container",t.wrap)),t.contentContainer=k("content"),t.st.preloader&&(t.preloader=k("preloader",t.container,t.st.tLoading));var c=e.magnificPopup.modules;for(r=0;c.length>r;r++){var d=c[r];d=d.charAt(0).toUpperCase()+d.slice(1),t["init"+d].call(t)}T("BeforeOpen"),t.st.showCloseBtn&&(t.st.closeBtnInside?(x(p,function(e,t,n,i){n.close_replaceWith=E(i.type)}),a+=" mfp-close-btn-in"):t.wrap.append(E())),t.st.alignTop&&(a+=" mfp-align-top"),t.fixedContentPos?t.wrap.css({overflow:t.st.overflowY,overflowX:"hidden",overflowY:t.st.overflowY}):t.wrap.css({top:I.scrollTop(),position:"absolute"}),(t.st.fixedBgPos===!1||"auto"===t.st.fixedBgPos&&!t.fixedContentPos)&&t.bgOverlay.css({height:o.height(),position:"absolute"}),t.st.enableEscapeKey&&o.on("keyup"+h,function(e){27===e.keyCode&&t.close()}),I.on("resize"+h,function(){t.updateSize()}),t.st.closeOnContentClick||(a+=" mfp-auto-cursor"),a&&t.wrap.addClass(a);var u=t.wH=I.height(),m={};if(t.fixedContentPos&&t._hasScrollBar(u)){var g=t._getScrollbarSize();g&&(m.marginRight=g)}t.fixedContentPos&&(t.isIE7?e("body, html").css("overflow","hidden"):m.overflow="hidden");var C=t.st.mainClass;return t.isIE7&&(C+=" mfp-ie7"),C&&t._addClassToMFP(C),t.updateItemHTML(),T("BuildControls"),e("html").css(m),t.bgOverlay.add(t.wrap).prependTo(t.st.prependTo||i),t._lastFocusedEl=document.activeElement,setTimeout(function(){t.content?(t._addClassToMFP(v),t._setFocus()):t.bgOverlay.addClass(v),o.on("focusin"+h,t._onFocusIn)},16),t.isOpen=!0,t.updateSize(u),T(f),n},close:function(){t.isOpen&&(T(c),t.isOpen=!1,t.st.removalDelay&&!t.isLowIE&&t.supportsTransition?(t._addClassToMFP(C),setTimeout(function(){t._close()},t.st.removalDelay)):t._close())},_close:function(){T(l);var n=C+" "+v+" ";if(t.bgOverlay.detach(),t.wrap.detach(),t.container.empty(),t.st.mainClass&&(n+=t.st.mainClass+" "),t._removeClassFromMFP(n),t.fixedContentPos){var i={marginRight:""};t.isIE7?e("body, html").css("overflow",""):i.overflow="",e("html").css(i)}o.off("keyup"+h+" focusin"+h),t.ev.off(h),t.wrap.attr("class","mfp-wrap").removeAttr("style"),t.bgOverlay.attr("class","mfp-bg"),t.container.attr("class","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,T(d)},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||I.height();t.fixedContentPos||t.wrap.css("height",t.wH),T("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(T("BeforeChange",[t.currItem?t.currItem.type:"",i]),t.currItem=n,!t.currTemplate[i]){var o=t.st[i]?t.st[i].markup:!1;T("FirstMarkupParse",o),t.currTemplate[i]=o?e(o):!0}r&&r!==n.type&&t.container.removeClass("mfp-"+r+"-holder");var a=t["get"+i.charAt(0).toUpperCase()+i.slice(1)](n,t.currTemplate[i]);t.appendContent(a,i),n.preloaded=!0,T(m,n),r=n.type,t.container.prepend(t.contentContainer),T("AfterChange")},appendContent:function(e,n){t.content=e,e?t.st.showCloseBtn&&t.st.closeBtnInside&&t.currTemplate[n]===!0?t.content.find(".mfp-close").length||t.content.append(E()):t.content=e:t.content="",T(u),t.container.addClass("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 r=t.types,a=0;r.length>a;a++)if(o.el.hasClass("mfp-"+r[a])){i=r[a];break}o.src=o.el.attr("data-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,T("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.magnificPopup";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 r=void 0!==o.midClick?o.midClick:e.magnificPopup.defaults.midClick;if(r||2!==n.which&&!n.ctrlKey&&!n.metaKey){var a=void 0!==o.disableOn?o.disableOn:e.magnificPopup.defaults.disableOn;if(a)if(e.isFunction(a)){if(!a.call(t))return!0}else if(a>I.width())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("mfp-s-"+n),i||"loading"!==e||(i=t.st.tLoading);var o={status:e,text:i};T("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("mfp-s-"+e),n=e}},_checkIfClose:function(n){if(!e(n).hasClass(y)){var i=t.st.closeOnContentClick,o=t.st.closeOnBgClick;if(i&&o)return!0;if(!t.content||e(n).hasClass("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?o.height():document.body.scrollHeight)>(e||I.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)),T(p,[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 r=o[1];"replaceWith"===r?i[0]!==n[0]&&i.replaceWith(n):"img"===r?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.id="mfp-sbm",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.magnificPopup={instance:null,proto:w.prototype,modules:[],open:function(t,n){return _(),t=t?e.extend(!0,{},t):{},t.isObj=!0,t.index=n||0,this.instance.open(t)},close:function(){return e.magnificPopup.instance&&e.magnificPopup.instance.close()},registerModule:function(t,n){n.options&&(e.magnificPopup.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="mfp-close">×</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},e.fn.magnificPopup=function(n){_();var i=e(this);if("string"==typeof n)if("open"===n){var o,r=b?i.data("magnificPopup"):i[0].magnificPopup,a=parseInt(arguments[1],10)||0;r.items?o=r.items[a]:(o=i,r.delegate&&(o=o.find(r.delegate)),o=o.eq(a)),t._openClick({mfpEl:o},i,r)}else t.isOpen&&t[n].apply(t,Array.prototype.slice.call(arguments,1));else n=e.extend(!0,{},n),b?i.data("magnificPopup",n):i[0].magnificPopup=n,t.addGroup(i,n);return i};var P,O,z,M="inline",B=function(){z&&(O.after(z.addClass(P)).detach(),z=null)};e.magnificPopup.registerModule(M,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){t.types.push(M),x(l+"."+M,function(){B()})},getInline:function(n,i){if(B(),n.src){var o=t.st.inline,r=e(n.src);if(r.length){var a=r[0].parentNode;a&&a.tagName&&(O||(P=o.hiddenClass,O=k(P),P="mfp-"+P),z=r.after(O).detach().removeClass(P)),t.updateStatus("ready")}else t.updateStatus("error",o.tNotFound),r=e("<div>");return n.inlineElement=r,r}return t.updateStatus("ready"),t._parseMarkup(i,{},n),i}}});var F,H="ajax",L=function(){F&&i.removeClass(F)},A=function(){L(),t.req&&t.req.abort()};e.magnificPopup.registerModule(H,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){t.types.push(H),F=t.st.ajax.cursor,x(l+"."+H,A),x("BeforeChange."+H,A)},getAjax:function(n){F&&i.addClass(F),t.updateStatus("loading");var o=e.extend({url:n.src,success:function(i,o,r){var a={data:i,xhr:r};T("ParseAjax",a),t.appendContent(e(a.data),H),n.finished=!0,L(),t._setFocus(),setTimeout(function(){t.wrap.addClass(v)},16),t.updateStatus("ready"),T("AjaxContentAdded")},error:function(){L(),n.finished=n.loadError=!0,t.updateStatus("error",t.st.ajax.tError.replace("%url%",n.src))}},t.st.ajax.settings);return t.req=e.ajax(o),""}}});var j,N=function(n){if(n.data&&void 0!==n.data.title)return n.data.title;var i=t.st.image.titleSrc;if(i){if(e.isFunction(i))return i.call(t,n);if(n.el)return n.el.attr(i)||""}return""};e.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var e=t.st.image,n=".image";t.types.push("image"),x(f+n,function(){"image"===t.currItem.type&&e.cursor&&i.addClass(e.cursor)}),x(l+n,function(){e.cursor&&i.removeClass(e.cursor),I.off("resize"+h)}),x("Resize"+n,t.resizeImage),t.isLowIE&&x("AfterChange",t.resizeImage)},resizeImage:function(){var e=t.currItem;if(e&&e.img&&t.st.image.verticalFit){var n=0;t.isLowIE&&(n=parseInt(e.img.css("padding-top"),10)+parseInt(e.img.css("padding-bottom"),10)),e.img.css("max-height",t.wH-n)}},_onImageHasSize:function(e){e.img&&(e.hasSize=!0,j&&clearInterval(j),e.isCheckingImgSize=!1,T("ImageHasSize",e),e.imgHidden&&(t.content&&t.content.removeClass("mfp-loading"),e.imgHidden=!1))},findImageSize:function(e){var n=0,i=e.img[0],o=function(r){j&&clearInterval(j),j=setInterval(function(){return i.naturalWidth>0?(t._onImageHasSize(e),void 0):(n>200&&clearInterval(j),n++,3===n?o(10):40===n?o(50):100===n&&o(500),void 0)},r)};o(1)},getImage:function(n,i){var o=0,r=function(){n&&(n.img[0].complete?(n.img.off(".mfploader"),n===t.currItem&&(t._onImageHasSize(n),t.updateStatus("ready")),n.hasSize=!0,n.loaded=!0,T("ImageLoadComplete")):(o++,200>o?setTimeout(r,100):a()))},a=function(){n&&(n.img.off(".mfploader"),n===t.currItem&&(t._onImageHasSize(n),t.updateStatus("error",s.tError.replace("%url%",n.src))),n.hasSize=!0,n.loaded=!0,n.loadError=!0)},s=t.st.image,l=i.find(".mfp-img");if(l.length){var c=document.createElement("img");c.className="mfp-img",n.img=e(c).on("load.mfploader",r).on("error.mfploader",a),c.src=n.src,l.is("img")&&(n.img=n.img.clone()),c=n.img[0],c.naturalWidth>0?n.hasSize=!0:c.width||(n.hasSize=!1)}return t._parseMarkup(i,{title:N(n),img_replaceWith:n.img},n),t.resizeImage(),n.hasSize?(j&&clearInterval(j),n.loadError?(i.addClass("mfp-loading"),t.updateStatus("error",s.tError.replace("%url%",n.src))):(i.removeClass("mfp-loading"),t.updateStatus("ready")),i):(t.updateStatus("loading"),n.loading=!0,n.hasSize||(n.imgHidden=!0,i.addClass("mfp-loading"),t.findImageSize(n)),i)}}});var W,R=function(){return void 0===W&&(W=void 0!==document.createElement("p").style.MozTransform),W};e.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(e){return e.is("img")?e:e.find("img")}},proto:{initZoom:function(){var e,n=t.st.zoom,i=".zoom";if(n.enabled&&t.supportsTransition){var o,r,a=n.duration,s=function(e){var t=e.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),i="all "+n.duration/1e3+"s "+n.easing,o={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},r="transition";return o["-webkit-"+r]=o["-moz-"+r]=o["-o-"+r]=o[r]=i,t.css(o),t},d=function(){t.content.css("visibility","visible")};x("BuildControls"+i,function(){if(t._allowZoom()){if(clearTimeout(o),t.content.css("visibility","hidden"),e=t._getItemToZoom(),!e)return d(),void 0;r=s(e),r.css(t._getOffset()),t.wrap.append(r),o=setTimeout(function(){r.css(t._getOffset(!0)),o=setTimeout(function(){d(),setTimeout(function(){r.remove(),e=r=null,T("ZoomAnimationEnded")},16)},a)},16)}}),x(c+i,function(){if(t._allowZoom()){if(clearTimeout(o),t.st.removalDelay=a,!e){if(e=t._getItemToZoom(),!e)return;r=s(e)}r.css(t._getOffset(!0)),t.wrap.append(r),t.content.css("visibility","hidden"),setTimeout(function(){r.css(t._getOffset())},16)}}),x(l+i,function(){t._allowZoom()&&(d(),r&&r.remove(),e=null)})}},_allowZoom:function(){return"image"===t.currItem.type},_getItemToZoom:function(){return t.currItem.hasSize?t.currItem.img:!1},_getOffset:function(n){var i;i=n?t.currItem.img:t.st.zoom.opener(t.currItem.el||t.currItem);var o=i.offset(),r=parseInt(i.css("padding-top"),10),a=parseInt(i.css("padding-bottom"),10);o.top-=e(window).scrollTop()-r;var s={width:i.width(),height:(b?i.innerHeight():i[0].offsetHeight)-a-r};return R()?s["-moz-transform"]=s.transform="translate("+o.left+"px,"+o.top+"px)":(s.left=o.left,s.top=o.top),s}}});var Z="iframe",q="//about:blank",D=function(e){if(t.currTemplate[Z]){var n=t.currTemplate[Z].find("iframe");n.length&&(e||(n[0].src=q),t.isIE8&&n.css("display",e?"block":"none"))}};e.magnificPopup.registerModule(Z,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},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(Z),x("BeforeChange",function(e,t,n){t!==n&&(t===Z?D():n===Z&&D(!0))}),x(l+"."+Z,function(){D()})},getIframe:function(n,i){var o=n.src,r=t.st.iframe;e.each(r.patterns,function(){return o.indexOf(this.index)>-1?(this.id&&(o="string"==typeof this.id?o.substr(o.lastIndexOf(this.id)+this.id.length,o.length):this.id.call(this,o)),o=this.src.replace("%id%",o),!1):void 0});var a={};return r.srcAction&&(a[r.srcAction]=o),t._parseMarkup(i,a,n),t.updateStatus("ready"),i}}});var K=function(e){var n=t.items.length;return e>n-1?e-n:0>e?n+e:e},Y=function(e,t,n){return e.replace(/%curr%/gi,t+1).replace(/%total%/gi,n)};e.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var n=t.st.gallery,i=".mfp-gallery",r=Boolean(e.fn.mfpFastClick);return t.direction=!0,n&&n.enabled?(a+=" mfp-gallery",x(f+i,function(){n.navigateByImgClick&&t.wrap.on("click"+i,".mfp-img",function(){return t.items.length>1?(t.next(),!1):void 0}),o.on("keydown"+i,function(e){37===e.keyCode?t.prev():39===e.keyCode&&t.next()})}),x("UpdateStatus"+i,function(e,n){n.text&&(n.text=Y(n.text,t.currItem.index,t.items.length))}),x(p+i,function(e,i,o,r){var a=t.items.length;o.counter=a>1?Y(n.tCounter,r.index,a):""}),x("BuildControls"+i,function(){if(t.items.length>1&&n.arrows&&!t.arrowLeft){var i=n.arrowMarkup,o=t.arrowLeft=e(i.replace(/%title%/gi,n.tPrev).replace(/%dir%/gi,"left")).addClass(y),a=t.arrowRight=e(i.replace(/%title%/gi,n.tNext).replace(/%dir%/gi,"right")).addClass(y),s=r?"mfpFastClick":"click";o[s](function(){t.prev()}),a[s](function(){t.next()}),t.isIE7&&(k("b",o[0],!1,!0),k("a",o[0],!1,!0),k("b",a[0],!1,!0),k("a",a[0],!1,!0)),t.container.append(o.add(a))}}),x(m+i,function(){t._preloadTimeout&&clearTimeout(t._preloadTimeout),t._preloadTimeout=setTimeout(function(){t.preloadNearbyImages(),t._preloadTimeout=null},16)}),x(l+i,function(){o.off(i),t.wrap.off("click"+i),t.arrowLeft&&r&&t.arrowLeft.add(t.arrowRight).destroyMfpFastClick(),t.arrowRight=t.arrowLeft=null}),void 0):!1},next:function(){t.direction=!0,t.index=K(t.index+1),t.updateItemHTML()},prev:function(){t.direction=!1,t.index=K(t.index-1),t.updateItemHTML()},goTo:function(e){t.direction=e>=t.index,t.index=e,t.updateItemHTML()},preloadNearbyImages:function(){var e,n=t.st.gallery.preload,i=Math.min(n[0],t.items.length),o=Math.min(n[1],t.items.length);for(e=1;(t.direction?o:i)>=e;e++)t._preloadItem(t.index+e);for(e=1;(t.direction?i:o)>=e;e++)t._preloadItem(t.index-e)},_preloadItem:function(n){if(n=K(n),!t.items[n].preloaded){var i=t.items[n];i.parsed||(i=t.parseEl(n)),T("LazyLoad",i),"image"===i.type&&(i.img=e('<img class="mfp-img" />').on("load.mfploader",function(){i.hasSize=!0}).on("error.mfploader",function(){i.hasSize=!0,i.loadError=!0,T("LazyLoadError",i)}).attr("src",i.src)),i.preloaded=!0}}}});var U="retina";e.magnificPopup.registerModule(U,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var e=t.st.retina,n=e.ratio;n=isNaN(n)?n():n,n>1&&(x("ImageHasSize."+U,function(e,t){t.img.css({"max-width":t.img[0].naturalWidth/n,width:"100%"})}),x("ElementParse."+U,function(t,i){i.src=e.replaceSrc(i,n)}))}}}}),function(){var t=1e3,n="ontouchstart"in window,i=function(){I.off("touchmove"+r+" touchend"+r)},o="mfpFastClick",r="."+o;e.fn.mfpFastClick=function(o){return e(this).each(function(){var a,s=e(this);if(n){var l,c,d,u,p,f;s.on("touchstart"+r,function(e){u=!1,f=1,p=e.originalEvent?e.originalEvent.touches[0]:e.touches[0],c=p.clientX,d=p.clientY,I.on("touchmove"+r,function(e){p=e.originalEvent?e.originalEvent.touches:e.touches,f=p.length,p=p[0],(Math.abs(p.clientX-c)>10||Math.abs(p.clientY-d)>10)&&(u=!0,i())}).on("touchend"+r,function(e){i(),u||f>1||(a=!0,e.preventDefault(),clearTimeout(l),l=setTimeout(function(){a=!1},t),o())})})}s.on("click"+r,function(){a||o()})})},e.fn.destroyMfpFastClick=function(){e(this).off("touchstart"+r+" click"+r),n&&I.off("touchmove"+r+" touchend"+r)}}(),_()})(window.jQuery||window.Zepto);
|
assets/lib/magnific-popup/magnific-popup.css
ADDED
@@ -0,0 +1,370 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Magnific Popup CSS */
|
2 |
+
.mfp-bg {
|
3 |
+
top: 0;
|
4 |
+
left: 0;
|
5 |
+
width: 100%;
|
6 |
+
height: 100%;
|
7 |
+
z-index: 1042;
|
8 |
+
overflow: hidden;
|
9 |
+
position: fixed;
|
10 |
+
background: #0b0b0b;
|
11 |
+
opacity: 0.8;
|
12 |
+
filter: alpha(opacity=80); }
|
13 |
+
|
14 |
+
.mfp-wrap {
|
15 |
+
top: 0;
|
16 |
+
left: 0;
|
17 |
+
width: 100%;
|
18 |
+
height: 100%;
|
19 |
+
z-index: 1043;
|
20 |
+
position: fixed;
|
21 |
+
outline: none !important;
|
22 |
+
-webkit-backface-visibility: hidden; }
|
23 |
+
|
24 |
+
.mfp-container {
|
25 |
+
text-align: center;
|
26 |
+
position: absolute;
|
27 |
+
width: 100%;
|
28 |
+
height: 100%;
|
29 |
+
left: 0;
|
30 |
+
top: 0;
|
31 |
+
padding: 0 8px;
|
32 |
+
-webkit-box-sizing: border-box;
|
33 |
+
-moz-box-sizing: border-box;
|
34 |
+
box-sizing: border-box; }
|
35 |
+
|
36 |
+
.mfp-container:before {
|
37 |
+
content: '';
|
38 |
+
display: inline-block;
|
39 |
+
height: 100%;
|
40 |
+
vertical-align: middle; }
|
41 |
+
|
42 |
+
.mfp-align-top .mfp-container:before {
|
43 |
+
display: none; }
|
44 |
+
|
45 |
+
.mfp-content {
|
46 |
+
position: relative;
|
47 |
+
display: inline-block;
|
48 |
+
vertical-align: middle;
|
49 |
+
margin: 0 auto;
|
50 |
+
text-align: left;
|
51 |
+
z-index: 1045; }
|
52 |
+
|
53 |
+
.mfp-inline-holder .mfp-content, .mfp-ajax-holder .mfp-content {
|
54 |
+
width: 100%;
|
55 |
+
cursor: auto; }
|
56 |
+
|
57 |
+
.mfp-ajax-cur {
|
58 |
+
cursor: progress; }
|
59 |
+
|
60 |
+
.mfp-zoom-out-cur, .mfp-zoom-out-cur .mfp-image-holder .mfp-close {
|
61 |
+
cursor: -moz-zoom-out;
|
62 |
+
cursor: -webkit-zoom-out;
|
63 |
+
cursor: zoom-out; }
|
64 |
+
|
65 |
+
.mfp-zoom {
|
66 |
+
cursor: pointer;
|
67 |
+
cursor: -webkit-zoom-in;
|
68 |
+
cursor: -moz-zoom-in;
|
69 |
+
cursor: zoom-in; }
|
70 |
+
|
71 |
+
.mfp-auto-cursor .mfp-content {
|
72 |
+
cursor: auto; }
|
73 |
+
|
74 |
+
.mfp-close, .mfp-arrow, .mfp-preloader, .mfp-counter {
|
75 |
+
-webkit-user-select: none;
|
76 |
+
-moz-user-select: none;
|
77 |
+
user-select: none; }
|
78 |
+
|
79 |
+
.mfp-loading.mfp-figure {
|
80 |
+
display: none; }
|
81 |
+
|
82 |
+
.mfp-hide {
|
83 |
+
display: none !important; }
|
84 |
+
|
85 |
+
.mfp-preloader {
|
86 |
+
color: #cccccc;
|
87 |
+
position: absolute;
|
88 |
+
top: 50%;
|
89 |
+
width: auto;
|
90 |
+
text-align: center;
|
91 |
+
margin-top: -0.8em;
|
92 |
+
left: 8px;
|
93 |
+
right: 8px;
|
94 |
+
z-index: 1044; }
|
95 |
+
.mfp-preloader a {
|
96 |
+
color: #cccccc; }
|
97 |
+
.mfp-preloader a:hover {
|
98 |
+
color: white; }
|
99 |
+
|
100 |
+
.mfp-s-ready .mfp-preloader {
|
101 |
+
display: none; }
|
102 |
+
|
103 |
+
.mfp-s-error .mfp-content {
|
104 |
+
display: none; }
|
105 |
+
|
106 |
+
button.mfp-close, button.mfp-arrow {
|
107 |
+
overflow: visible;
|
108 |
+
cursor: pointer;
|
109 |
+
background: transparent;
|
110 |
+
border: 0;
|
111 |
+
-webkit-appearance: none;
|
112 |
+
display: block;
|
113 |
+
outline: none;
|
114 |
+
padding: 0;
|
115 |
+
z-index: 1046;
|
116 |
+
-webkit-box-shadow: none;
|
117 |
+
box-shadow: none; }
|
118 |
+
button::-moz-focus-inner {
|
119 |
+
padding: 0;
|
120 |
+
border: 0; }
|
121 |
+
|
122 |
+
.mfp-close {
|
123 |
+
width: 44px;
|
124 |
+
height: 44px;
|
125 |
+
line-height: 44px;
|
126 |
+
position: absolute;
|
127 |
+
right: 0;
|
128 |
+
top: 0;
|
129 |
+
text-decoration: none;
|
130 |
+
text-align: center;
|
131 |
+
opacity: 0.65;
|
132 |
+
filter: alpha(opacity=65);
|
133 |
+
padding: 0 0 18px 10px;
|
134 |
+
color: white;
|
135 |
+
font-style: normal;
|
136 |
+
font-size: 28px;
|
137 |
+
font-family: Arial, Baskerville, monospace; }
|
138 |
+
.mfp-close:hover, .mfp-close:focus {
|
139 |
+
opacity: 1;
|
140 |
+
filter: alpha(opacity=100);
|
141 |
+
background: transparent;
|
142 |
+
}
|
143 |
+
.mfp-close:active {
|
144 |
+
top: 1px; }
|
145 |
+
|
146 |
+
.mfp-close-btn-in .mfp-close {
|
147 |
+
color: #333333; }
|
148 |
+
|
149 |
+
.mfp-image-holder .mfp-close, .mfp-iframe-holder .mfp-close {
|
150 |
+
color: white;
|
151 |
+
right: -6px;
|
152 |
+
text-align: right;
|
153 |
+
padding-right: 6px;
|
154 |
+
width: 100%; }
|
155 |
+
|
156 |
+
.mfp-counter {
|
157 |
+
position: absolute;
|
158 |
+
top: 0;
|
159 |
+
right: 0;
|
160 |
+
color: #cccccc;
|
161 |
+
font-size: 12px;
|
162 |
+
line-height: 18px; }
|
163 |
+
|
164 |
+
.mfp-arrow {
|
165 |
+
position: absolute;
|
166 |
+
opacity: 0.65;
|
167 |
+
filter: alpha(opacity=65);
|
168 |
+
margin: 0;
|
169 |
+
top: 50%;
|
170 |
+
margin-top: -55px;
|
171 |
+
padding: 0;
|
172 |
+
width: 90px;
|
173 |
+
height: 110px;
|
174 |
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); }
|
175 |
+
.mfp-arrow:active {
|
176 |
+
margin-top: -54px; }
|
177 |
+
.mfp-arrow:hover, .mfp-arrow:focus {
|
178 |
+
opacity: 1;
|
179 |
+
filter: alpha(opacity=100); }
|
180 |
+
.mfp-arrow:before, .mfp-arrow:after, .mfp-arrow .mfp-b, .mfp-arrow .mfp-a {
|
181 |
+
content: '';
|
182 |
+
display: block;
|
183 |
+
width: 0;
|
184 |
+
height: 0;
|
185 |
+
position: absolute;
|
186 |
+
left: 0;
|
187 |
+
top: 0;
|
188 |
+
margin-top: 35px;
|
189 |
+
margin-left: 35px;
|
190 |
+
border: medium inset transparent; }
|
191 |
+
.mfp-arrow:after, .mfp-arrow .mfp-a {
|
192 |
+
border-top-width: 13px;
|
193 |
+
border-bottom-width: 13px;
|
194 |
+
top: 8px; }
|
195 |
+
.mfp-arrow:before, .mfp-arrow .mfp-b {
|
196 |
+
border-top-width: 21px;
|
197 |
+
border-bottom-width: 21px;
|
198 |
+
opacity: 0.7; }
|
199 |
+
|
200 |
+
.mfp-arrow-left {
|
201 |
+
left: 0; }
|
202 |
+
.mfp-arrow-left:after, .mfp-arrow-left .mfp-a {
|
203 |
+
border-right: 17px solid white;
|
204 |
+
margin-left: 31px; }
|
205 |
+
.mfp-arrow-left:before, .mfp-arrow-left .mfp-b {
|
206 |
+
margin-left: 25px;
|
207 |
+
border-right: 27px solid #3f3f3f; }
|
208 |
+
|
209 |
+
.mfp-arrow-right {
|
210 |
+
right: 0; }
|
211 |
+
.mfp-arrow-right:after, .mfp-arrow-right .mfp-a {
|
212 |
+
border-left: 17px solid white;
|
213 |
+
margin-left: 39px; }
|
214 |
+
.mfp-arrow-right:before, .mfp-arrow-right .mfp-b {
|
215 |
+
border-left: 27px solid #3f3f3f; }
|
216 |
+
|
217 |
+
.mfp-iframe-holder {
|
218 |
+
padding-top: 40px;
|
219 |
+
padding-bottom: 40px; }
|
220 |
+
.mfp-iframe-holder .mfp-content {
|
221 |
+
line-height: 0;
|
222 |
+
width: 100%;
|
223 |
+
max-width: 900px; }
|
224 |
+
.mfp-iframe-holder .mfp-close {
|
225 |
+
top: -40px; }
|
226 |
+
|
227 |
+
.mfp-iframe-scaler {
|
228 |
+
width: 100%;
|
229 |
+
height: 0;
|
230 |
+
overflow: hidden;
|
231 |
+
padding-top: 56.25%; }
|
232 |
+
.mfp-iframe-scaler iframe {
|
233 |
+
position: absolute;
|
234 |
+
display: block;
|
235 |
+
top: 0;
|
236 |
+
left: 0;
|
237 |
+
width: 100%;
|
238 |
+
height: 100%;
|
239 |
+
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
|
240 |
+
background: black; }
|
241 |
+
|
242 |
+
/* Main image in popup */
|
243 |
+
img.mfp-img {
|
244 |
+
width: auto;
|
245 |
+
max-width: 100%;
|
246 |
+
height: auto;
|
247 |
+
display: block;
|
248 |
+
line-height: 0;
|
249 |
+
-webkit-box-sizing: border-box;
|
250 |
+
-moz-box-sizing: border-box;
|
251 |
+
box-sizing: border-box;
|
252 |
+
padding: 40px 0 40px;
|
253 |
+
margin: 0 auto; }
|
254 |
+
|
255 |
+
/* The shadow behind the image */
|
256 |
+
.mfp-figure {
|
257 |
+
line-height: 0; }
|
258 |
+
.mfp-figure:after {
|
259 |
+
content: '';
|
260 |
+
position: absolute;
|
261 |
+
left: 0;
|
262 |
+
top: 40px;
|
263 |
+
bottom: 40px;
|
264 |
+
display: block;
|
265 |
+
right: 0;
|
266 |
+
width: auto;
|
267 |
+
height: auto;
|
268 |
+
z-index: -1;
|
269 |
+
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
|
270 |
+
background: #444444; }
|
271 |
+
.mfp-figure small {
|
272 |
+
color: #bdbdbd;
|
273 |
+
display: block;
|
274 |
+
font-size: 12px;
|
275 |
+
line-height: 14px; }
|
276 |
+
.mfp-figure figure {
|
277 |
+
margin: 0; }
|
278 |
+
|
279 |
+
.mfp-bottom-bar {
|
280 |
+
margin-top: -36px;
|
281 |
+
position: absolute;
|
282 |
+
top: 100%;
|
283 |
+
left: 0;
|
284 |
+
width: 100%;
|
285 |
+
cursor: auto; }
|
286 |
+
|
287 |
+
.mfp-title {
|
288 |
+
text-align: left;
|
289 |
+
line-height: 18px;
|
290 |
+
color: #f3f3f3;
|
291 |
+
word-wrap: break-word;
|
292 |
+
padding-right: 36px; }
|
293 |
+
|
294 |
+
.mfp-image-holder .mfp-content {
|
295 |
+
max-width: 100%; }
|
296 |
+
|
297 |
+
.mfp-gallery .mfp-image-holder .mfp-figure {
|
298 |
+
cursor: pointer; }
|
299 |
+
|
300 |
+
@media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px) {
|
301 |
+
/**
|
302 |
+
* Remove all paddings around the image on small screen
|
303 |
+
*/
|
304 |
+
.mfp-img-mobile .mfp-image-holder {
|
305 |
+
padding-left: 0;
|
306 |
+
padding-right: 0; }
|
307 |
+
.mfp-img-mobile img.mfp-img {
|
308 |
+
padding: 0; }
|
309 |
+
.mfp-img-mobile .mfp-figure:after {
|
310 |
+
top: 0;
|
311 |
+
bottom: 0; }
|
312 |
+
.mfp-img-mobile .mfp-figure small {
|
313 |
+
display: inline;
|
314 |
+
margin-left: 5px; }
|
315 |
+
.mfp-img-mobile .mfp-bottom-bar {
|
316 |
+
background: rgba(0, 0, 0, 0.6);
|
317 |
+
bottom: 0;
|
318 |
+
margin: 0;
|
319 |
+
top: auto;
|
320 |
+
padding: 3px 5px;
|
321 |
+
position: fixed;
|
322 |
+
-webkit-box-sizing: border-box;
|
323 |
+
-moz-box-sizing: border-box;
|
324 |
+
box-sizing: border-box; }
|
325 |
+
.mfp-img-mobile .mfp-bottom-bar:empty {
|
326 |
+
padding: 0; }
|
327 |
+
.mfp-img-mobile .mfp-counter {
|
328 |
+
right: 5px;
|
329 |
+
top: 3px; }
|
330 |
+
.mfp-img-mobile .mfp-close {
|
331 |
+
top: 0;
|
332 |
+
right: 0;
|
333 |
+
width: 35px;
|
334 |
+
height: 35px;
|
335 |
+
line-height: 35px;
|
336 |
+
background: rgba(0, 0, 0, 0.6);
|
337 |
+
position: fixed;
|
338 |
+
text-align: center;
|
339 |
+
padding: 0; } }
|
340 |
+
|
341 |
+
@media all and (max-width: 900px) {
|
342 |
+
.mfp-arrow {
|
343 |
+
-webkit-transform: scale(0.75);
|
344 |
+
transform: scale(0.75); }
|
345 |
+
.mfp-arrow-left {
|
346 |
+
-webkit-transform-origin: 0;
|
347 |
+
transform-origin: 0; }
|
348 |
+
.mfp-arrow-right {
|
349 |
+
-webkit-transform-origin: 100%;
|
350 |
+
transform-origin: 100%; }
|
351 |
+
.mfp-container {
|
352 |
+
padding-left: 6px;
|
353 |
+
padding-right: 6px; } }
|
354 |
+
|
355 |
+
.mfp-ie7 .mfp-img {
|
356 |
+
padding: 0; }
|
357 |
+
.mfp-ie7 .mfp-bottom-bar {
|
358 |
+
width: 600px;
|
359 |
+
left: 50%;
|
360 |
+
margin-left: -300px;
|
361 |
+
margin-top: 5px;
|
362 |
+
padding-bottom: 5px; }
|
363 |
+
.mfp-ie7 .mfp-container {
|
364 |
+
padding: 0; }
|
365 |
+
.mfp-ie7 .mfp-content {
|
366 |
+
padding-top: 44px; }
|
367 |
+
.mfp-ie7 .mfp-close {
|
368 |
+
top: 0;
|
369 |
+
right: 0;
|
370 |
+
padding-top: 0; }
|
assets/settings.php
ADDED
@@ -0,0 +1,658 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(class_exists('WPAU_YOUTUBE_CHANNEL') && !class_exists('WPAU_YOUTUBE_CHANNEL_SETTINGS'))
|
3 |
+
{
|
4 |
+
|
5 |
+
class WPAU_YOUTUBE_CHANNEL_SETTINGS extends WPAU_YOUTUBE_CHANNEL
|
6 |
+
{
|
7 |
+
private $general_settings_key = 'ytc_general';
|
8 |
+
private $video_settings_key = 'ytc_video';
|
9 |
+
private $content_settings_key = 'ytc_content';
|
10 |
+
private $link_settings_key = 'ytc_link';
|
11 |
+
private $help_settings_key = 'ytc_help';
|
12 |
+
private $plugin_options_key = 'youtube_channel_defaults';
|
13 |
+
private $plugin_settings_page = YTCTDOM;
|
14 |
+
private $plugin_settings_tabs = array();
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Construct the plugin object
|
18 |
+
*/
|
19 |
+
public function __construct()
|
20 |
+
{
|
21 |
+
// register actions
|
22 |
+
add_action('init', array( &$this, 'load_settings' ) );
|
23 |
+
|
24 |
+
add_action('admin_init', array( &$this, 'register_general_settings' ) );
|
25 |
+
add_action('admin_init', array( &$this, 'register_video_settings' ) );
|
26 |
+
add_action('admin_init', array( &$this, 'register_content_settings' ) );
|
27 |
+
add_action('admin_init', array( &$this, 'register_link_settings' ) );
|
28 |
+
add_action('admin_init', array( &$this, 'register_help_settings' ) );
|
29 |
+
|
30 |
+
add_action('admin_menu', array( &$this, 'add_menu' ) );
|
31 |
+
} // END public function __construct
|
32 |
+
|
33 |
+
function load_settings() {
|
34 |
+
$this->defaults = $this->defaults();
|
35 |
+
}
|
36 |
+
|
37 |
+
// validate our options
|
38 |
+
function plugin_options_validate($options) {
|
39 |
+
$options = wp_parse_args($options, get_option('youtube_channel_defaults'));
|
40 |
+
return wp_parse_args($options, $this->defaults);
|
41 |
+
}
|
42 |
+
function register_general_settings()
|
43 |
+
{
|
44 |
+
$this->plugin_settings_tabs[$this->general_settings_key] = 'General';
|
45 |
+
register_setting(
|
46 |
+
$this->general_settings_key, // option_group
|
47 |
+
$this->plugin_options_key, // option_name
|
48 |
+
array(&$this, 'plugin_options_validate') // callback
|
49 |
+
);
|
50 |
+
|
51 |
+
// add general settings section
|
52 |
+
add_settings_section(
|
53 |
+
'general_settings', // id
|
54 |
+
__('General Settings',YTCTDOM), // title
|
55 |
+
array(&$this, 'general_settings_section_description'), // callback
|
56 |
+
$this->general_settings_key // page
|
57 |
+
);
|
58 |
+
|
59 |
+
// add setting's fields
|
60 |
+
add_settings_field(
|
61 |
+
'wpau_youtube_channel-channel', // id
|
62 |
+
__('YouTube Channel ID',YTCTDOM), // title
|
63 |
+
array(&$this, 'settings_field_input_text'), // callback
|
64 |
+
$this->general_settings_key, // page
|
65 |
+
'general_settings', // section
|
66 |
+
array(
|
67 |
+
'field' => "youtube_channel_defaults[channel]",
|
68 |
+
'description' => __('Enter your YouTube channel ID (channel name, not full URL to channel)',YTCTDOM),
|
69 |
+
'class' => 'regular-text',
|
70 |
+
'value' => $this->defaults['channel'],
|
71 |
+
)
|
72 |
+
);
|
73 |
+
add_settings_field(
|
74 |
+
'wpau_youtube_channel-playlist',
|
75 |
+
__('Default Playlist ID',YTCTDOM),
|
76 |
+
array(&$this, 'settings_field_input_text'),
|
77 |
+
$this->general_settings_key,
|
78 |
+
'general_settings',
|
79 |
+
array(
|
80 |
+
'field' => "youtube_channel_defaults[playlist]",
|
81 |
+
'description' => __('Enter default playlist ID (not playlist name)',YTCTDOM),
|
82 |
+
'class' => 'regular-text',
|
83 |
+
'value' => $this->defaults['playlist'],
|
84 |
+
)
|
85 |
+
);
|
86 |
+
add_settings_field(
|
87 |
+
'wpau_youtube_channel-use_res',
|
88 |
+
__('Resource to use',YTCTDOM),
|
89 |
+
array(&$this, 'settings_field_select'),
|
90 |
+
$this->general_settings_key,
|
91 |
+
'general_settings',
|
92 |
+
array(
|
93 |
+
'field' => "youtube_channel_defaults[use_res]",
|
94 |
+
'description' => __('What to use as resource for feeds',YTCTDOM),
|
95 |
+
'class' => 'regular-text',
|
96 |
+
'items' => array(
|
97 |
+
"0" => __("Channel",YTCTDOM),
|
98 |
+
"1" => __("Favorites",YTCTDOM),
|
99 |
+
"2" => __("Playlist",YTCTDOM)
|
100 |
+
),
|
101 |
+
'value' => $this->defaults['use_res'],
|
102 |
+
)
|
103 |
+
);
|
104 |
+
add_settings_field(
|
105 |
+
'wpau_youtube_channel-only_pl',
|
106 |
+
__('Embed standard playlist',YTCTDOM),
|
107 |
+
array(&$this, 'settings_field_checkbox'),
|
108 |
+
$this->general_settings_key,
|
109 |
+
'general_settings',
|
110 |
+
array(
|
111 |
+
'field' => "youtube_channel_defaults[only_pl]",
|
112 |
+
'description' => __('Enable this option to embed whole playlist instead single video from playlist when you chose playlist as resource',YTCTDOM),
|
113 |
+
'class' => 'checkbox',
|
114 |
+
'value' => $this->defaults['only_pl'],
|
115 |
+
)
|
116 |
+
);
|
117 |
+
// caching timeout field
|
118 |
+
add_settings_field(
|
119 |
+
'wpau_youtube_channel-cache_time',
|
120 |
+
__('Cache Timeout',YTCTDOM),
|
121 |
+
array(&$this, 'settings_field_input_number'),
|
122 |
+
$this->general_settings_key,
|
123 |
+
'general_settings',
|
124 |
+
array(
|
125 |
+
'field' => "youtube_channel_defaults[cache_time]",
|
126 |
+
'description' => __('Define caching timeout for YouTube feeds, in seconds',YTCTDOM),
|
127 |
+
'class' => 'number',
|
128 |
+
'value' => $this->defaults['cache_time'],
|
129 |
+
'min' => 0,
|
130 |
+
'max' => 2419200,
|
131 |
+
'step' => 60
|
132 |
+
)
|
133 |
+
);
|
134 |
+
add_settings_field(
|
135 |
+
'wpau_youtube_channel-maxrnd',
|
136 |
+
__('Fetch',YTCTDOM),
|
137 |
+
array(&$this, 'settings_field_input_number'),
|
138 |
+
$this->general_settings_key,
|
139 |
+
'general_settings',
|
140 |
+
array(
|
141 |
+
'field' => "youtube_channel_defaults[maxrnd]",
|
142 |
+
'description' => __('Number of videos that will be used for random pick (min 2, max 50, default 25)',YTCTDOM),
|
143 |
+
'class' => 'num',
|
144 |
+
'value' => $this->defaults['maxrnd'],
|
145 |
+
'min' => 2,
|
146 |
+
'max' => 50,
|
147 |
+
'step' => 1
|
148 |
+
)
|
149 |
+
);
|
150 |
+
add_settings_field(
|
151 |
+
'wpau_youtube_channel-vidqty',
|
152 |
+
__('Show',YTCTDOM),
|
153 |
+
array(&$this, 'settings_field_input_number'),
|
154 |
+
$this->general_settings_key,
|
155 |
+
'general_settings',
|
156 |
+
array(
|
157 |
+
'field' => "youtube_channel_defaults[vidqty]",
|
158 |
+
'description' => __('Number of videos to display',YTCTDOM),
|
159 |
+
'class' => 'number',
|
160 |
+
'value' => $this->defaults['vidqty'],
|
161 |
+
'min' => 1,
|
162 |
+
'max' => 50,
|
163 |
+
'step' => 1
|
164 |
+
)
|
165 |
+
);
|
166 |
+
add_settings_field(
|
167 |
+
'wpau_youtube_channel-enhprivacy',
|
168 |
+
__('Use Enhanced privacy',YTCTDOM),
|
169 |
+
array(&$this, 'settings_field_checkbox'),
|
170 |
+
$this->general_settings_key,
|
171 |
+
'general_settings',
|
172 |
+
array(
|
173 |
+
'field' => "youtube_channel_defaults[enhprivacy]",
|
174 |
+
'description' => __(sprintf('Enable this option to protect your visitors <a href="%s" target="_blank">privacy</a>.','http://support.google.com/youtube/bin/answer.py?hl=en-GB&answer=171780'),YTCTDOM),
|
175 |
+
'class' => 'number',
|
176 |
+
'value' => $this->defaults['enhprivacy'],
|
177 |
+
)
|
178 |
+
);
|
179 |
+
add_settings_field(
|
180 |
+
'wpau_youtube_channel-fixnoitem',
|
181 |
+
__('Fix <em>No items</em> error/Respect playlist order',YTCTDOM),
|
182 |
+
array(&$this, 'settings_field_checkbox'),
|
183 |
+
$this->general_settings_key,
|
184 |
+
'general_settings',
|
185 |
+
array(
|
186 |
+
'field' => "youtube_channel_defaults[fixnoitem]",
|
187 |
+
'description' => __('Enable this option if you get error No Item',YTCTDOM),
|
188 |
+
'class' => 'widefat',
|
189 |
+
'value' => $this->defaults['fixnoitem'],
|
190 |
+
)
|
191 |
+
);
|
192 |
+
add_settings_field(
|
193 |
+
'wpau_youtube_channel-getrnd',
|
194 |
+
__('Show random video',YTCTDOM),
|
195 |
+
array(&$this, 'settings_field_checkbox'),
|
196 |
+
$this->general_settings_key,
|
197 |
+
'general_settings',
|
198 |
+
array(
|
199 |
+
'field' => "youtube_channel_defaults[getrnd]",
|
200 |
+
'description' => __('Get random videos of all fetched from channel or playlist',YTCTDOM),
|
201 |
+
'class' => 'widefat',
|
202 |
+
'value' => $this->defaults['getrnd'],
|
203 |
+
)
|
204 |
+
);
|
205 |
+
} // END register_general_settings()
|
206 |
+
|
207 |
+
function register_video_settings()
|
208 |
+
{
|
209 |
+
$this->plugin_settings_tabs[$this->video_settings_key] = 'Video';
|
210 |
+
register_setting(
|
211 |
+
$this->video_settings_key,
|
212 |
+
$this->plugin_options_key,
|
213 |
+
array(&$this, 'plugin_options_validate')
|
214 |
+
);
|
215 |
+
|
216 |
+
// add video settings section
|
217 |
+
add_settings_section(
|
218 |
+
'video_settings',
|
219 |
+
__('Video Settings',YTCTDOM),
|
220 |
+
array(&$this, 'video_settings_section_description'),
|
221 |
+
$this->video_settings_key
|
222 |
+
);
|
223 |
+
add_settings_field(
|
224 |
+
'wpau_youtube_channel-ratio',
|
225 |
+
__('Aspect Ratio',YTCTDOM),
|
226 |
+
array(&$this, 'settings_field_select'),
|
227 |
+
$this->video_settings_key,
|
228 |
+
'video_settings',
|
229 |
+
array(
|
230 |
+
'field' => "youtube_channel_defaults[ratio]",
|
231 |
+
'description' => __('Select aspect ratio for displayed video',YTCTDOM),
|
232 |
+
'class' => 'regular-text',
|
233 |
+
'items' => array(
|
234 |
+
"3" => __("16:9",YTCTDOM),
|
235 |
+
"2" => __("16:10",YTCTDOM),
|
236 |
+
"1" => __("4:3",YTCTDOM)
|
237 |
+
),
|
238 |
+
'value' => $this->defaults['ratio'],
|
239 |
+
)
|
240 |
+
);
|
241 |
+
add_settings_field(
|
242 |
+
'wpau_youtube_channel-width',
|
243 |
+
__('Video Width','wpaust'),
|
244 |
+
array(&$this, 'settings_field_input_number'),
|
245 |
+
$this->video_settings_key,
|
246 |
+
'video_settings',
|
247 |
+
array(
|
248 |
+
'field' => "youtube_channel_defaults[width]",
|
249 |
+
'description' => __('Set default width for displayed video, in pixels',YTCTDOM),
|
250 |
+
'class' => 'number',
|
251 |
+
'value' => $this->defaults['width'],
|
252 |
+
'min' => 160,
|
253 |
+
'max' => 1920,
|
254 |
+
'step' => 1
|
255 |
+
)
|
256 |
+
);
|
257 |
+
add_settings_field(
|
258 |
+
'wpau_youtube_channel-to_show',
|
259 |
+
__('What to show?',YTCTDOM),
|
260 |
+
array(&$this, 'settings_field_select'),
|
261 |
+
$this->video_settings_key,
|
262 |
+
'video_settings',
|
263 |
+
array(
|
264 |
+
'field' => "youtube_channel_defaults[to_show]",
|
265 |
+
'description' => __('Set what will be shown by default',YTCTDOM),
|
266 |
+
'class' => 'regular-text',
|
267 |
+
'items' => array(
|
268 |
+
"thumbnail" => __("Thumbnail",YTCTDOM),
|
269 |
+
"object" => __("Flash (object)",YTCTDOM),
|
270 |
+
"iframe" => __("HTML5 (iframe)",YTCTDOM),
|
271 |
+
"iframe2" => __("HTML5 (iframe) Async",YTCTDOM),
|
272 |
+
"chromeless" => __("Chromeless",YTCTDOM)
|
273 |
+
),
|
274 |
+
'value' => $this->defaults['to_show'],
|
275 |
+
)
|
276 |
+
);
|
277 |
+
add_settings_field(
|
278 |
+
'wpau_youtube_channel-themelight',
|
279 |
+
__('Use light theme',YTCTDOM),
|
280 |
+
array(&$this, 'settings_field_checkbox'),
|
281 |
+
$this->video_settings_key,
|
282 |
+
'video_settings',
|
283 |
+
array(
|
284 |
+
'field' => "youtube_channel_defaults[themelight]",
|
285 |
+
'description' => __('Enable this option to use light theme for playback controls instead dark',YTCTDOM),
|
286 |
+
'class' => 'checkbox',
|
287 |
+
'value' => $this->defaults['themelight'],
|
288 |
+
)
|
289 |
+
);
|
290 |
+
add_settings_field(
|
291 |
+
'wpau_youtube_channel-controls',
|
292 |
+
__('Hide player controls',YTCTDOM),
|
293 |
+
array(&$this, 'settings_field_checkbox'),
|
294 |
+
$this->video_settings_key,
|
295 |
+
'video_settings',
|
296 |
+
array(
|
297 |
+
'field' => "youtube_channel_defaults[controls]",
|
298 |
+
'description' => __('Enable this option to hide playback controls',YTCTDOM),
|
299 |
+
'class' => 'checkbox',
|
300 |
+
'value' => $this->defaults['controls'],
|
301 |
+
)
|
302 |
+
);
|
303 |
+
add_settings_field(
|
304 |
+
'wpau_youtube_channel-fixyt',
|
305 |
+
__('Fix video height',YTCTDOM),
|
306 |
+
array(&$this, 'settings_field_checkbox'),
|
307 |
+
$this->video_settings_key,
|
308 |
+
'video_settings',
|
309 |
+
array(
|
310 |
+
'field' => "youtube_channel_defaults[fixyt]",
|
311 |
+
'description' => __('Enable this option to fix video height when playback controls are not hidden',YTCTDOM),
|
312 |
+
'class' => 'checkbox',
|
313 |
+
'value' => $this->defaults['fixyt'],
|
314 |
+
)
|
315 |
+
);
|
316 |
+
add_settings_field(
|
317 |
+
'wpau_youtube_channel-autoplay',
|
318 |
+
__('Autoplay video or playlist',YTCTDOM),
|
319 |
+
array(&$this, 'settings_field_checkbox'),
|
320 |
+
$this->video_settings_key,
|
321 |
+
'video_settings',
|
322 |
+
array(
|
323 |
+
'field' => "youtube_channel_defaults[autoplay]",
|
324 |
+
'description' => __('Enable this option to start video playback right after block is rendered',YTCTDOM),
|
325 |
+
'class' => 'checkbox',
|
326 |
+
'value' => $this->defaults['autoplay'],
|
327 |
+
)
|
328 |
+
);
|
329 |
+
add_settings_field(
|
330 |
+
'wpau_youtube_channel-autoplay_mute',
|
331 |
+
__('Mute video on autoplay',YTCTDOM),
|
332 |
+
array(&$this, 'settings_field_checkbox'),
|
333 |
+
$this->video_settings_key,
|
334 |
+
'video_settings',
|
335 |
+
array(
|
336 |
+
'field' => "youtube_channel_defaults[autoplay_mute]",
|
337 |
+
'description' => __('Enable this option to mute video when start autoplay',YTCTDOM),
|
338 |
+
'class' => 'checkbox',
|
339 |
+
'value' => $this->defaults['autoplay_mute'],
|
340 |
+
)
|
341 |
+
);
|
342 |
+
} // END register_video_settings()
|
343 |
+
|
344 |
+
function register_content_settings()
|
345 |
+
{
|
346 |
+
$this->plugin_settings_tabs[$this->content_settings_key] = 'Content';
|
347 |
+
register_setting(
|
348 |
+
$this->content_settings_key,
|
349 |
+
$this->plugin_options_key,
|
350 |
+
array(&$this, 'plugin_options_validate')
|
351 |
+
);
|
352 |
+
|
353 |
+
// add content settings section
|
354 |
+
add_settings_section(
|
355 |
+
'content_settings',
|
356 |
+
__('Content Layout',YTCTDOM),
|
357 |
+
array(&$this, 'content_settings_section_description'),
|
358 |
+
$this->content_settings_key
|
359 |
+
);
|
360 |
+
add_settings_field(
|
361 |
+
'wpau_youtube_channel-showtitle',
|
362 |
+
__('Show video title',YTCTDOM),
|
363 |
+
array(&$this, 'settings_field_checkbox'),
|
364 |
+
$this->content_settings_key,
|
365 |
+
'content_settings',
|
366 |
+
array(
|
367 |
+
'field' => "youtube_channel_defaults[showtitle]",
|
368 |
+
'description' => __('Enable this option to display title of video',YTCTDOM),
|
369 |
+
'class' => 'checkbox',
|
370 |
+
'value' => $this->defaults['showtitle']
|
371 |
+
)
|
372 |
+
);
|
373 |
+
add_settings_field(
|
374 |
+
'wpau_youtube_channel-showvidesc',
|
375 |
+
__('Show video description',YTCTDOM),
|
376 |
+
array(&$this, 'settings_field_checkbox'),
|
377 |
+
$this->content_settings_key,
|
378 |
+
'content_settings',
|
379 |
+
array(
|
380 |
+
'field' => "youtube_channel_defaults[showvidesc]",
|
381 |
+
'description' => __('Enable this option to display description for video',YTCTDOM),
|
382 |
+
'class' => 'checkbox',
|
383 |
+
'value' => $this->defaults['showvidesc']
|
384 |
+
)
|
385 |
+
);
|
386 |
+
add_settings_field(
|
387 |
+
'wpau_youtube_channel-videsclen',
|
388 |
+
__('Description length',YTCTDOM),
|
389 |
+
array(&$this, 'settings_field_input_number'),
|
390 |
+
$this->content_settings_key,
|
391 |
+
'content_settings',
|
392 |
+
array(
|
393 |
+
'field' => "youtube_channel_defaults[videsclen]",
|
394 |
+
'description' => __('Enter length for video description in characters (0 for full length)',YTCTDOM),
|
395 |
+
'class' => 'number',
|
396 |
+
'value' => $this->defaults['videsclen'],
|
397 |
+
'min' => 0,
|
398 |
+
'max' => 2000,
|
399 |
+
'step' => 1,
|
400 |
+
)
|
401 |
+
);
|
402 |
+
add_settings_field(
|
403 |
+
'wpau_youtube_channel-descappend',
|
404 |
+
__('Et cetera string',YTCTDOM),
|
405 |
+
array(&$this, 'settings_field_input_text'),
|
406 |
+
$this->content_settings_key,
|
407 |
+
'content_settings',
|
408 |
+
array(
|
409 |
+
'field' => "youtube_channel_defaults[descappend]",
|
410 |
+
'description' => __(sprintf('Indicator for shortened video description (default: %s)',$this->defaults['descappend']),YTCTDOM),
|
411 |
+
'class' => 'small-text',
|
412 |
+
'value' => $this->defaults['descappend'],
|
413 |
+
)
|
414 |
+
);
|
415 |
+
add_settings_field(
|
416 |
+
'wpau_youtube_channel-hideanno',
|
417 |
+
__('Hide annotations from video',YTCTDOM),
|
418 |
+
array(&$this, 'settings_field_checkbox'),
|
419 |
+
$this->content_settings_key,
|
420 |
+
'content_settings',
|
421 |
+
array(
|
422 |
+
'field' => "youtube_channel_defaults[hideanno]",
|
423 |
+
'description' => __('Enable this option to hide video annotations (custom text set by uploader over video during playback)',YTCTDOM),
|
424 |
+
'class' => 'checkbox',
|
425 |
+
'value' => $this->defaults['hideanno']
|
426 |
+
)
|
427 |
+
);
|
428 |
+
add_settings_field(
|
429 |
+
'wpau_youtube_channel-hideinfo',
|
430 |
+
__('Hide video info',YTCTDOM),
|
431 |
+
array(&$this, 'settings_field_checkbox'),
|
432 |
+
$this->content_settings_key,
|
433 |
+
'content_settings',
|
434 |
+
array(
|
435 |
+
'field' => "youtube_channel_defaults[hideinfo]",
|
436 |
+
'description' => __('Enable this option to hide informations about video before play start (video title and uploader in overlay)',YTCTDOM),
|
437 |
+
'class' => 'checkbox',
|
438 |
+
'value' => $this->defaults['hideinfo']
|
439 |
+
)
|
440 |
+
);
|
441 |
+
} // END register_content_settings
|
442 |
+
|
443 |
+
function register_link_settings()
|
444 |
+
{
|
445 |
+
$this->plugin_settings_tabs[$this->link_settings_key] = 'Link to Channel';
|
446 |
+
register_setting(
|
447 |
+
$this->link_settings_key,
|
448 |
+
$this->plugin_options_key,
|
449 |
+
array(&$this, 'plugin_options_validate')
|
450 |
+
);
|
451 |
+
|
452 |
+
// add content settings section
|
453 |
+
add_settings_section(
|
454 |
+
'link_settings',
|
455 |
+
__('Link to Channel',YTCTDOM),
|
456 |
+
array(&$this, 'link_settings_section_description'),
|
457 |
+
$this->link_settings_key
|
458 |
+
);
|
459 |
+
add_settings_field(
|
460 |
+
'wpau_youtube_channel-goto_txt',
|
461 |
+
__('Visit YouTube Channel text',YTCTDOM),
|
462 |
+
array(&$this, 'settings_field_input_text'),
|
463 |
+
$this->link_settings_key,
|
464 |
+
'link_settings',
|
465 |
+
array(
|
466 |
+
'field' => "youtube_channel_defaults[goto_txt]",
|
467 |
+
'description' => __('Use placeholder %channel% to insert channel name',YTCTDOM),
|
468 |
+
'class' => 'regular-text',
|
469 |
+
'value' => $this->defaults['goto_txt'],
|
470 |
+
)
|
471 |
+
);
|
472 |
+
add_settings_field(
|
473 |
+
'wpau_youtube_channel-showgoto',
|
474 |
+
__('Show link to channel',YTCTDOM),
|
475 |
+
array(&$this, 'settings_field_checkbox'),
|
476 |
+
$this->link_settings_key,
|
477 |
+
'link_settings',
|
478 |
+
array(
|
479 |
+
'field' => "youtube_channel_defaults[showgoto]",
|
480 |
+
'description' => __('Enable this option to show customized link to channel at the bottom of YTC block',YTCTDOM),
|
481 |
+
'class' => 'checkbox',
|
482 |
+
'value' => $this->defaults['showgoto']
|
483 |
+
)
|
484 |
+
);
|
485 |
+
add_settings_field(
|
486 |
+
'wpau_youtube_channel-popup_goto',
|
487 |
+
__('Open YouTube channel page',YTCTDOM),
|
488 |
+
array(&$this, 'settings_field_select'),
|
489 |
+
$this->link_settings_key,
|
490 |
+
'link_settings',
|
491 |
+
array(
|
492 |
+
'field' => "youtube_channel_defaults[popup_goto]",
|
493 |
+
'description' => __('Set what will be shown by default',YTCTDOM),
|
494 |
+
'class' => 'regular-text',
|
495 |
+
'items' => array(
|
496 |
+
"0" => __("in same window",YTCTDOM),
|
497 |
+
"1" => __("in new window (JavaScript)",YTCTDOM),
|
498 |
+
"2" => __("in new window (Target)",YTCTDOM),
|
499 |
+
),
|
500 |
+
'value' => $this->defaults['popup_goto'],
|
501 |
+
)
|
502 |
+
);
|
503 |
+
add_settings_field(
|
504 |
+
'wpau_youtube_channel-userchan',
|
505 |
+
__('Link to channel instead to user',YTCTDOM),
|
506 |
+
array(&$this, 'settings_field_checkbox'),
|
507 |
+
$this->link_settings_key,
|
508 |
+
'link_settings',
|
509 |
+
array(
|
510 |
+
'field' => "youtube_channel_defaults[userchan]",
|
511 |
+
'description' => __('Enable this option if link to your channel have <code>/channel/</code> instead <code>/user/</code> part in URL',YTCTDOM),
|
512 |
+
'class' => 'checkbox',
|
513 |
+
'value' => $this->defaults['userchan']
|
514 |
+
)
|
515 |
+
);
|
516 |
+
} // END register_link_settings()
|
517 |
+
|
518 |
+
function register_help_settings()
|
519 |
+
{
|
520 |
+
$this->plugin_settings_tabs[$this->help_settings_key] = 'Help';
|
521 |
+
register_setting($this->help_settings_key, $this->help_settings_key);
|
522 |
+
|
523 |
+
add_settings_section(
|
524 |
+
'help_settings',
|
525 |
+
__('Help',YTCTDOM),
|
526 |
+
array(&$this, 'help_settings_section'),
|
527 |
+
$this->help_settings_key
|
528 |
+
);
|
529 |
+
|
530 |
+
} // END register_help_settings()
|
531 |
+
|
532 |
+
function options_tabs() {
|
533 |
+
$current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $this->general_settings_key;
|
534 |
+
echo '<h2 class="nav-tab-wrapper">';
|
535 |
+
foreach ( $this->plugin_settings_tabs as $tab_key => $tab_caption ) {
|
536 |
+
$active = $current_tab == $tab_key ? 'nav-tab-active' : '';
|
537 |
+
echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->plugin_settings_page . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
|
538 |
+
}
|
539 |
+
echo '</h2>';
|
540 |
+
}
|
541 |
+
|
542 |
+
public function general_settings_section_description()
|
543 |
+
{
|
544 |
+
// Think of this as help text for the section.
|
545 |
+
_e('<p>Default settings for YouTuber Channel. This will be used as default values for shortcode.</p>',YTCTDOM);
|
546 |
+
}
|
547 |
+
public function video_settings_section_description()
|
548 |
+
{
|
549 |
+
// Think of this as help text for the section.
|
550 |
+
_e('<p>Default settings for video section. This will be used as default values for shortcode.</p>',YTCTDOM);
|
551 |
+
}
|
552 |
+
public function content_settings_section_description()
|
553 |
+
{
|
554 |
+
// Think of this as help text for the section.
|
555 |
+
_e('<p>Default settings for content layout section. This will be used as default values for shortcode.</p>',YTCTDOM);
|
556 |
+
}
|
557 |
+
public function link_settings_section_description()
|
558 |
+
{
|
559 |
+
// Think of this as help text for the section.
|
560 |
+
_e('<p>Default settings for channel link at the bottom of video block. This will be used as default values for shortcode.</p>',YTCTDOM);
|
561 |
+
}
|
562 |
+
public function help_settings_section()
|
563 |
+
{
|
564 |
+
include('settings_help.php');
|
565 |
+
}
|
566 |
+
|
567 |
+
/**
|
568 |
+
* This function provides text inputs for settings fields
|
569 |
+
*/
|
570 |
+
public function settings_field_input_text($args)
|
571 |
+
{
|
572 |
+
extract( $args );
|
573 |
+
echo sprintf('<input type="text" name="%s" id="%s" value="%s" class="%s" /><p class="description">%s</p>', $field, $field, $value, $class, $description);
|
574 |
+
} // END public function settings_field_input_text($args)
|
575 |
+
|
576 |
+
/**
|
577 |
+
* This function provides number inputs for settings fields
|
578 |
+
*/
|
579 |
+
public function settings_field_input_number($args)
|
580 |
+
{
|
581 |
+
extract( $args );
|
582 |
+
echo sprintf('<input type="number" name="%s" id="%s" value="%s" class="%s" min="%s" max="%s" step="%s" /><p class="description">%s</p>', $field, $field, $value, $class, $min, $max, $step, $description);
|
583 |
+
} // END public function settings_field_input_number($args)
|
584 |
+
|
585 |
+
/**
|
586 |
+
* This function provides checkbox for settings fields
|
587 |
+
*/
|
588 |
+
public function settings_field_checkbox($args)
|
589 |
+
{
|
590 |
+
extract( $args );
|
591 |
+
$checked = ( !empty($args['value']) ) ? 'checked="checked"' : '';
|
592 |
+
echo sprintf('<label for="%s"><input type="checkbox" name="%s" id="%s" value="1" class="%s" %s />%s</label>', $field, $field, $field, $class, $checked, $description);
|
593 |
+
} // END public function settings_field_checkbox($args)
|
594 |
+
|
595 |
+
/**
|
596 |
+
* This function provides textarea for settings fields
|
597 |
+
*/
|
598 |
+
public function settings_field_textarea($args)
|
599 |
+
{
|
600 |
+
extract( $args );
|
601 |
+
if (empty($rows)) $rows = 7;
|
602 |
+
echo sprintf('<textarea name="%s" id="%s" rows="%s" class="%s">%s</textarea><p class="description">%s</p>', $field, $field, $rows, $class, $value, $description);
|
603 |
+
} // END public function settings_field_textarea($args)
|
604 |
+
|
605 |
+
/**
|
606 |
+
* This function provides select for settings fields
|
607 |
+
*/
|
608 |
+
public function settings_field_select($args)
|
609 |
+
{
|
610 |
+
extract( $args );
|
611 |
+
$html = sprintf('<select id="%s" name="%s">',$field,$field);
|
612 |
+
foreach ($items as $key=>$val)
|
613 |
+
{
|
614 |
+
$selected = ($value==$key) ? 'selected="selected"' : '';
|
615 |
+
$html .= sprintf('<option %s value="%s">%s</option>',$selected,$key,$val);
|
616 |
+
}
|
617 |
+
$html .= sprintf('</select><p class="description">%s</p>',$description);
|
618 |
+
echo $html;
|
619 |
+
} // END public function settings_field_select($args)
|
620 |
+
|
621 |
+
public function settings_field_colour_picker($args)
|
622 |
+
{
|
623 |
+
extract( $args );
|
624 |
+
$html = sprintf('<input type="text" name="%s" id="%s" value="%s" class="wpau-color-field" />',$field, $field, $value);
|
625 |
+
$html .= (!empty($description)) ? ' <p class="description">'.$description.'</p>' : '';
|
626 |
+
echo $html;
|
627 |
+
} // END public function settings_field_colour_picker($args)
|
628 |
+
|
629 |
+
/**
|
630 |
+
* add a menu
|
631 |
+
*/
|
632 |
+
function add_menu()
|
633 |
+
{
|
634 |
+
// Add a page to manage this plugin's settings
|
635 |
+
add_options_page(
|
636 |
+
__(sprintf('%s Settings',YTCNAME),YTCTDOM),
|
637 |
+
__(YTCNAME,YTCTDOM),
|
638 |
+
'manage_options',
|
639 |
+
$this->plugin_settings_page,
|
640 |
+
array(&$this, 'plugin_settings_page')
|
641 |
+
);
|
642 |
+
} // END function add_menu()
|
643 |
+
|
644 |
+
/**
|
645 |
+
* Menu Callback
|
646 |
+
*/
|
647 |
+
public function plugin_settings_page()
|
648 |
+
{
|
649 |
+
if(!current_user_can('manage_options'))
|
650 |
+
wp_die(__('You do not have sufficient permissions to access this page.'));
|
651 |
+
|
652 |
+
// Render the settings template
|
653 |
+
include(sprintf("%s/settings_template.php", dirname(__FILE__)));
|
654 |
+
} // END public function plugin_settings_page()
|
655 |
+
} // END class WPAU_YOUTUBE_CHANNEL_SETTINGS
|
656 |
+
} // END if(!class_exists('WPAU_YOUTUBE_CHANNEL_SETTINGS'))
|
657 |
+
|
658 |
+
add_action( 'plugins_loaded', create_function( '', '$ytc_settings = new WPAU_YOUTUBE_CHANNEL_SETTINGS;' ) );
|
assets/settings_help.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<p>You also can use shortcode <code>[youtube_channel]</code> with options listed below (all options are optional):</p>
|
2 |
+
<h3>General Settings</h3>
|
3 |
+
<ul>
|
4 |
+
<li><code>channel</code> <em>(string)</em> ID of preferred YouTube channel. Do not set full URL to channel, but just last part from URL - ID (name)</li>
|
5 |
+
<li><code>playlist</code> <em>(string)</em> ID of preferred YouTube playlist.</li>
|
6 |
+
<li><code>res</code> <em>(int)</em> Resource to use for feed:
|
7 |
+
<ul>
|
8 |
+
<li>• <code>0</code> Channel</li>
|
9 |
+
<li>• <code>1</code> Favorites (for defined channel)</li>
|
10 |
+
<li>• <code>2</code> Playlist</li>
|
11 |
+
</ul></li>
|
12 |
+
<li><code>only_pl</code> <em>(bool)</em> If you set to use Playlist as resource, you can embed youtube playlist block instead single video from playlist. Simply set this option to true (<code>1</code> or <code>true</code>)</li>
|
13 |
+
<li><code>cache</code> <em>(int)</em> Period in seconds for caching feed. You can disable caching by setting this option to <code>0</code>, but if you have a lot of visits, consider at least short caching (couple minutes).</li>
|
14 |
+
|
15 |
+
<li><code>fetch</code> <em>(int)</em> Number of videos that will be used as stack for random pick (min 2, max 50)</li>
|
16 |
+
<li><code>num</code> <em>(int)</em> Number of videos to display per YTC block.</li>
|
17 |
+
|
18 |
+
<li><code>fix</code> <em>(bool)</em> Option to fix <em>No Items</em> error, and also to respect order of videos in feed or playlist.</li>
|
19 |
+
<li><code>random</code> <em>(bool)</em> Option to randomize videos on every page load.</li>
|
20 |
+
</ul>
|
21 |
+
<h3>Video Settings</h3>
|
22 |
+
<ul>
|
23 |
+
<li><code>ratio</code> <em>(int)</em> Set preferred aspect ratio for thumbnail and video. You can use:
|
24 |
+
<ul>
|
25 |
+
<li>• <code>3</code> 16:9 (widescreen)</li>
|
26 |
+
<li>• <code>2</code> 16:10 (computer screen)</li>
|
27 |
+
<li>• <code>1</code> 4:3</li>
|
28 |
+
</ul></li>
|
29 |
+
<li><code>width</code> <em>(int)</em> Width of thumbnail and video in pixels.</li>
|
30 |
+
<li><code>show</code> <em>(string)</em> Object that will be used to represent video. We have couple predefined options:
|
31 |
+
<ul>
|
32 |
+
<li>• <code>thumbnail</code> Thumbnail will be used and video will be loaded in lightbox.</li>
|
33 |
+
<li>• <code>iframe</code> HTML5 (iframe)</li>
|
34 |
+
<li>• <code>iframe2</code> HTML5 (iframe) with asynchronous loading - recommended</li>
|
35 |
+
<li>• <code>object</code> Flash object (not so good for Apple devices)</li>
|
36 |
+
<li>• <code>chromeless</code> Chromeless solution (also not good for Apple devices)</li>
|
37 |
+
</ul></li>
|
38 |
+
|
39 |
+
<li><code>themelight</code> <em>(bool)</em> By default YouTube have dark play controls theme. By setting this option to <code>1</code> or <code>true</code> you can get light theme in player (HTML5 and Flash)</li>
|
40 |
+
<li><code>controls</code> <em>(bool)</em> Set this option to <code>1</code> or <code>true</code> to hide playback controls.</li>
|
41 |
+
<li><code>fix_h</code> <em>(bool)</em> If you did not set to hide player controls, you can set this option to <code>1</code> or <code>true</code> to fix video height taken by controls</li>
|
42 |
+
<li><code>autoplay</code> <em>(bool)</em> Enable autoplay of first video in YTC video stack by setting this option to <code>1</code> or <code>true</code></li>
|
43 |
+
<li><code>mute</code> <em>(bool)</em> Set this option to <code>1</code> or <code>true</code> to mute videos set to autoplay on load</li>
|
44 |
+
</ul>
|
45 |
+
<h3>Content Layout</h3>
|
46 |
+
<ul>
|
47 |
+
<li><code>showtitle</code> <em>(bool)</em> </li>
|
48 |
+
<li><code>showdesc</code> <em>(bool)</em> </li>
|
49 |
+
<li><code>desclen</code> <em>(int)</em> </li>
|
50 |
+
<li><code>noinfo</code> <em>(bool)</em> </li>
|
51 |
+
<li><code>noanno</code> <em>(bool)</em> </li>
|
52 |
+
</ul>
|
53 |
+
<h3>Link to Channel</h3>
|
54 |
+
<ul>
|
55 |
+
<li><code>goto</code> <em>(bool)</em> </li>
|
56 |
+
<li><code>goto_txt</code> <em>(string)</em></li>
|
57 |
+
<li><code>popup</code> <em>(int)</em></li>
|
58 |
+
<li><code>userchan</code> <em>(bool)</em> </li>
|
59 |
+
</ul>
|
60 |
+
|
61 |
+
<p>Please note, you can exclude all options listed above, and then we'll use default options from Settings page.</p>
|
62 |
+
<p>YTC blocks inserted through widget have own settings.</p>
|
assets/settings_template.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" style="float:right">
|
2 |
+
<input type="hidden" name="cmd" value="_s-xclick">
|
3 |
+
<input type="hidden" name="hosted_button_id" value="YPUHSQ2G3YHQQ">
|
4 |
+
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
5 |
+
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
6 |
+
</form>
|
7 |
+
<?php
|
8 |
+
$tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $this->general_settings_key;
|
9 |
+
?>
|
10 |
+
<div class="wrap" id="youtube_channel_settings">
|
11 |
+
<h2><?php _e(sprintf('%s Settings',YTCNAME),YTCTDOM); ?></h2>
|
12 |
+
<?php $this->options_tabs(); ?>
|
13 |
+
<form method="post" action="options.php">
|
14 |
+
<?php wp_nonce_field( 'update-options' ); ?>
|
15 |
+
<?php settings_fields( $tab ); ?>
|
16 |
+
<?php do_settings_sections( $tab ); ?>
|
17 |
+
<?php submit_button(); ?>
|
18 |
+
</form>
|
19 |
+
</div>
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: urkekg
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Q6Q762MQ97XJ6
|
4 |
Tags: youtube, channel, playlist, single, widget, widgets, youtube player, flash player, rss, feed, video, thumbnail, embed, sidebar, chromeless, iframe, html5
|
5 |
-
Requires at least: 3.7.
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -19,14 +19,14 @@ Simply insert widget to sidebar, set channel name and if you wish leave all othe
|
|
19 |
If you like this extension and you find it useful, please rate it on the right side.
|
20 |
|
21 |
= Features =
|
22 |
-
* Display latest video from YouTube channel or playlist
|
23 |
-
* Option to get random video from
|
24 |
* Set custom widget title
|
25 |
* Enhanced Privacy
|
26 |
-
* Custom width for video thumbnail/embeded object (default is 220px)
|
27 |
* Preferred aspect ratio relative to width (16:9, 16:10 and 4:3)
|
28 |
-
*
|
29 |
-
*
|
|
|
30 |
* Custom caching timeout
|
31 |
* Optimized gdata feeds
|
32 |
* Option to enable autoplay video
|
@@ -38,7 +38,6 @@ If you like this extension and you find it useful, please rate it on the right s
|
|
38 |
* Option to use light controls theme
|
39 |
* Set custom text for link to channel
|
40 |
* Option to show link to channel
|
41 |
-
* Option to open channel in new tab/window
|
42 |
* Option to use target="_blank" instead of javascript window.open() for chanel link in new tab/window
|
43 |
|
44 |
= Styling =
|
@@ -60,6 +59,7 @@ Video description for videos from playlist does nt work.
|
|
60 |
|
61 |
= Credits =
|
62 |
Chromeless option borrowed from [Chromeless YouTube](http://wordpress.org/extend/plugins/chromeless-youtube/) extension.
|
|
|
63 |
Code improvements and textdomain adds done by [dimadin](http://wordpress.org/extend/plugins/profile/dimadin).
|
64 |
[Federico Bozo](http://corchoweb.com/) reminded me to fix z-index problem
|
65 |
|
@@ -122,6 +122,15 @@ Video feed for YTC has been retreived with standard youtube feed [uploads by spe
|
|
122 |
If you does not see your latest video in your uplaods feed (which you can access at https://gdata.youtube.com/feeds/api/users/YOUR_YT_USERID/uploads by replacing YOUR_YT_USERID with your real youtube user ID), then YTC will not see it too.
|
123 |
|
124 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
= 2.1.0.2 =
|
126 |
* Fix: remove embed object below old IFRAME implementation
|
127 |
|
2 |
Contributors: urkekg
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Q6Q762MQ97XJ6
|
4 |
Tags: youtube, channel, playlist, single, widget, widgets, youtube player, flash player, rss, feed, video, thumbnail, embed, sidebar, chromeless, iframe, html5
|
5 |
+
Requires at least: 3.7.1
|
6 |
+
Tested up to: 3.9
|
7 |
+
Stable tag: 2.2.0
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
19 |
If you like this extension and you find it useful, please rate it on the right side.
|
20 |
|
21 |
= Features =
|
22 |
+
* Display latest video from YouTube channel, favorites or playlist
|
23 |
+
* Option to get random video from resources mentioned above
|
24 |
* Set custom widget title
|
25 |
* Enhanced Privacy
|
|
|
26 |
* Preferred aspect ratio relative to width (16:9, 16:10 and 4:3)
|
27 |
+
* Custom width for video embeded object (default is 220px)
|
28 |
+
* Choose to display video as thumbnail, HTML5 (iframe), HTML5 Asynchronous (iframe2), Flash (object) or chromeless video
|
29 |
+
* Thumbnail mode is responsive and opens video in lightbox
|
30 |
* Custom caching timeout
|
31 |
* Optimized gdata feeds
|
32 |
* Option to enable autoplay video
|
38 |
* Option to use light controls theme
|
39 |
* Set custom text for link to channel
|
40 |
* Option to show link to channel
|
|
|
41 |
* Option to use target="_blank" instead of javascript window.open() for chanel link in new tab/window
|
42 |
|
43 |
= Styling =
|
59 |
|
60 |
= Credits =
|
61 |
Chromeless option borrowed from [Chromeless YouTube](http://wordpress.org/extend/plugins/chromeless-youtube/) extension.
|
62 |
+
For playing videos in lightbox we use [Magnific Popup](http://dimsemenov.com/plugins/magnific-popup/).
|
63 |
Code improvements and textdomain adds done by [dimadin](http://wordpress.org/extend/plugins/profile/dimadin).
|
64 |
[Federico Bozo](http://corchoweb.com/) reminded me to fix z-index problem
|
65 |
|
122 |
If you does not see your latest video in your uplaods feed (which you can access at https://gdata.youtube.com/feeds/api/users/YOUR_YT_USERID/uploads by replacing YOUR_YT_USERID with your real youtube user ID), then YTC will not see it too.
|
123 |
|
124 |
== Changelog ==
|
125 |
+
= 2.2.0 =
|
126 |
+
* Add: open thumbnails in lightbox and stay on site, instead opening YouTube page (Magnific Popup jQuery library)
|
127 |
+
* Add: make thumbnail responsive
|
128 |
+
* Add: play indicator for thumbnails
|
129 |
+
* Add: shortcode [youtube_channel]
|
130 |
+
* Add: tabbed settings page for default options for shortcodes
|
131 |
+
* Add: Help tab for shortcode parameters
|
132 |
+
* Change: moved parts of code to helper functions
|
133 |
+
|
134 |
= 2.1.0.2 =
|
135 |
* Fix: remove embed object below old IFRAME implementation
|
136 |
|
youtube-channel.php
CHANGED
@@ -4,24 +4,78 @@ Plugin Name: YouTube Channel
|
|
4 |
Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
|
5 |
Description: <a href="widgets.php">Widget</a> that display latest video thumbnail, iframe (HTML5 video), object (Flash video) or chromeless video from YouTube Channel or Playlist.
|
6 |
Author: Aleksandar Urošević
|
7 |
-
Version: 2.
|
8 |
Author URI: http://urosevic.net/
|
9 |
*/
|
10 |
-
define( 'YTCVER', '2.
|
11 |
define( 'YOUTUBE_CHANNEL_URL', plugin_dir_url(__FILE__) );
|
12 |
define( 'YTCPLID', 'PLEC850BE962234400' );
|
13 |
define( 'YTCUID', 'urkekg' );
|
14 |
define( 'YTCTDOM', 'youtube-channel' );
|
|
|
15 |
|
16 |
/* youtube widget */
|
17 |
-
class
|
18 |
|
19 |
public function __construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
parent::__construct(
|
21 |
YTCTDOM,
|
22 |
__( 'Youtube Channel' , YTCTDOM ),
|
23 |
array( 'description' => __( 'Serve YouTube videos from channel or playlist right to widget area', YTCTDOM ) )
|
24 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
|
27 |
/**
|
@@ -107,9 +161,72 @@ class YouTube_Channel_Widget extends WP_Widget {
|
|
107 |
|
108 |
} // END public static function activate
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
// TODO: Form code
|
111 |
public function form($instance) {
|
112 |
-
// outputs the options form
|
113 |
// General Options
|
114 |
$title = (!empty($instance['title'])) ? esc_attr($instance['title']) : '';
|
115 |
$channel = (!empty($instance['channel'])) ? esc_attr($instance['channel']) : '';
|
@@ -157,6 +274,7 @@ class YouTube_Channel_Widget extends WP_Widget {
|
|
157 |
// Debug YTC
|
158 |
$debugon = (!empty($instance['debugon'])) ? esc_attr($instance['debugon']) : '';
|
159 |
?>
|
|
|
160 |
<p>
|
161 |
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title:', YTCTDOM); ?><input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" title="<?php _e('Title for widget', YTCTDOM); ?>" /></label>
|
162 |
</p>
|
@@ -195,69 +313,8 @@ class YouTube_Channel_Widget extends WP_Widget {
|
|
195 |
<p>
|
196 |
<label for="<?php echo $this->get_field_id('cache_time'); ?>"><?php _e('Cache feed:', YTCTDOM); ?></label>
|
197 |
<select class="widefat" id="<?php echo $this->get_field_id( 'cache_time' ); ?>" name="<?php echo $this->get_field_name( 'cache_time' ); ?>">
|
198 |
-
|
199 |
<option value="0"<?php selected( $cache_time, 0 ); ?>><?php _e('Do not chache', YTCTDOM); ?></option>
|
200 |
-
<?php
|
201 |
-
$times = array(
|
202 |
-
'minute' => array(
|
203 |
-
1 => "1 minute",
|
204 |
-
5 => "5 minutes",
|
205 |
-
15 => "15 minutes",
|
206 |
-
30 => "30 minutes"
|
207 |
-
),
|
208 |
-
'hour' => array(
|
209 |
-
1 => "1 hour",
|
210 |
-
2 => "2 hours",
|
211 |
-
5 => "5 hours",
|
212 |
-
10 => "10 hours",
|
213 |
-
12 => "12 hours",
|
214 |
-
18 => "18 hours"
|
215 |
-
),
|
216 |
-
'day' => array(
|
217 |
-
1 => "1 day",
|
218 |
-
2 => "2 days",
|
219 |
-
3 => "3 days",
|
220 |
-
4 => "4 days",
|
221 |
-
5 => "5 days",
|
222 |
-
6 => "6 days"
|
223 |
-
),
|
224 |
-
'week' => array(
|
225 |
-
1 => "1 week",
|
226 |
-
2 => "2 weeks",
|
227 |
-
3 => "3 weeks",
|
228 |
-
4 => "1 month"
|
229 |
-
)
|
230 |
-
);
|
231 |
-
|
232 |
-
$out = "";
|
233 |
-
foreach ($times as $period => $timeset)
|
234 |
-
{
|
235 |
-
switch ($period)
|
236 |
-
{
|
237 |
-
case 'minute':
|
238 |
-
$sc = MINUTE_IN_SECONDS;
|
239 |
-
break;
|
240 |
-
case 'hour':
|
241 |
-
$sc = HOUR_IN_SECONDS;
|
242 |
-
break;
|
243 |
-
case 'day':
|
244 |
-
$sc = DAY_IN_SECONDS;
|
245 |
-
break;
|
246 |
-
case 'week':
|
247 |
-
$sc = WEEK_IN_SECONDS;
|
248 |
-
break;
|
249 |
-
}
|
250 |
-
|
251 |
-
foreach ($timeset as $n => $s)
|
252 |
-
{
|
253 |
-
$sec = $sc * $n;
|
254 |
-
$out .='<option value="'.$sec.'" '. selected( $cache_time, $sec ).'>'.__($s, YTCTDOM).'</option>';
|
255 |
-
unset($sec);
|
256 |
-
}
|
257 |
-
}
|
258 |
-
echo $out;
|
259 |
-
unset($out);
|
260 |
-
?>
|
261 |
</select>
|
262 |
</p>
|
263 |
<p>
|
@@ -273,7 +330,7 @@ class YouTube_Channel_Widget extends WP_Widget {
|
|
273 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $getrnd, true ); ?> id="<?php echo $this->get_field_id( 'getrnd' ); ?>" name="<?php echo $this->get_field_name( 'getrnd' ); ?>" title="<?php _e('Get random videos of all fetched from channel or playlist', YTCTDOM); ?>" /> <label for="<?php echo $this->get_field_id( 'getrnd' ); ?>"><?php _e('Show random video', YTCTDOM); ?></label>
|
274 |
</p>
|
275 |
|
276 |
-
<h4><?php _e('Video Settings', YTCTDOM); ?></h4>
|
277 |
<p><label for="<?php echo $this->get_field_id('ratio'); ?>"><?php _e('Aspect ratio', YTCTDOM); ?>:</label>
|
278 |
<select class="widefat" id="<?php echo $this->get_field_id( 'ratio' ); ?>" name="<?php echo $this->get_field_name( 'ratio' ); ?>">
|
279 |
<?php /* <option value="0"<?php selected( $ratio, 0 ); ?>><?php _e('Custom (as set above)', YTCTDOM); ?></option> */ ?>
|
@@ -284,10 +341,6 @@ class YouTube_Channel_Widget extends WP_Widget {
|
|
284 |
</p>
|
285 |
<p>
|
286 |
<label for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Width', YTCTDOM); ?>:</label> <input class="small-text" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="number" min="32" value="<?php echo $width; ?>" title="<?php _e('Set video width in pixels', YTCTDOM); ?>" /> px (<?php _e('default', YTCTDOM); ?> 220)
|
287 |
-
<?php /*
|
288 |
-
<br />
|
289 |
-
<label for="< ?php echo $this->get_field_id('height'); ?>">< ?php _e('Height', YTCTDOM); ?>:</label> <input class="small-text" id="< ?php echo $this->get_field_id('height'); ?>" name="< ?php echo $this->get_field_name('height'); ?>" type="number" min="32" value="< ?php echo $height; ?>" title="< ?php _e('Set video height in pixels', YTCTDOM); ?>" /> px (< ?php _e('default', YTCTDOM); ?> 165)
|
290 |
-
*/ ?>
|
291 |
</p>
|
292 |
<p>
|
293 |
<label for="<?php echo $this->get_field_id('to_show'); ?>"><?php _e('What to show?', YTCTDOM); ?></label>
|
@@ -305,7 +358,7 @@ class YouTube_Channel_Widget extends WP_Widget {
|
|
305 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $autoplay_mute, true ); ?> id="<?php echo $this->get_field_id( 'autoplay_mute' ); ?>" name="<?php echo $this->get_field_name( 'autoplay_mute' ); ?>" /> <label for="<?php echo $this->get_field_id( 'autoplay_mute' ); ?>"><?php _e('Mute video on autoplay', YTCTDOM); ?></label>
|
306 |
</p>
|
307 |
|
308 |
-
<h4><?php _e('Content Layout', YTCTDOM); ?></h4>
|
309 |
<p>
|
310 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $showtitle, true ); ?> id="<?php echo $this->get_field_id( 'showtitle' ); ?>" name="<?php echo $this->get_field_name( 'showtitle' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showtitle' ); ?>"><?php _e('Show video title', YTCTDOM); ?></label><br />
|
311 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $showvidesc, true ); ?> id="<?php echo $this->get_field_id( 'showvidesc' ); ?>" name="<?php echo $this->get_field_name( 'showvidesc' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showvidesc' ); ?>"><?php _e('Show video description', YTCTDOM); ?></label><br />
|
@@ -315,7 +368,7 @@ class YouTube_Channel_Widget extends WP_Widget {
|
|
315 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $hideinfo, true ); ?> id="<?php echo $this->get_field_id( 'hideinfo' ); ?>" name="<?php echo $this->get_field_name( 'hideinfo' ); ?>" /> <label for="<?php echo $this->get_field_id( 'hideinfo' ); ?>"><?php _e('Hide video info', YTCTDOM); ?></label>
|
316 |
</p>
|
317 |
|
318 |
-
<h4><?php _e('Link to Channel', YTCTDOM); ?></h4>
|
319 |
<p>
|
320 |
<label for="<?php echo $this->get_field_id('goto_txt'); ?>"><?php _e('Visit YouTube Channel text:', YTCTDOM); ?> <input class="widefat" id="<?php echo $this->get_field_id('goto_txt'); ?>" name="<?php echo $this->get_field_name('goto_txt'); ?>" type="text" value="<?php echo $goto_txt; ?>" title="<?php _e('Default: Visit channel %channel%. Use placeholder %channel% to insert channel name.', YTCTDOM); ?>" /></label>
|
321 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $showgoto, true ); ?> id="<?php echo $this->get_field_id( 'showgoto' ); ?>" name="<?php echo $this->get_field_name( 'showgoto' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showgoto' ); ?>"><?php _e('Show link to channel', YTCTDOM); ?></label><br />
|
@@ -329,7 +382,7 @@ class YouTube_Channel_Widget extends WP_Widget {
|
|
329 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $userchan, true ); ?> id="<?php echo $this->get_field_id( 'userchan' ); ?>" name="<?php echo $this->get_field_name( 'userchan' ); ?>" /> <label for="<?php echo $this->get_field_id( 'userchan' ); ?>"><?php _e('Link to channel instead to user', YTCTDOM); ?></label><br />
|
330 |
</p>
|
331 |
|
332 |
-
<h4><?php _e('Debug YTC', YTCTDOM); ?></h4>
|
333 |
<p>
|
334 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $debugon, true ); ?> id="<?php echo $this->get_field_id( 'debugon' ); ?>" name="<?php echo $this->get_field_name( 'debugon' ); ?>" /> <label for="<?php echo $this->get_field_id( 'debugon' ); ?>">Enable debugging</label><br />
|
335 |
|
@@ -400,11 +453,55 @@ if ( $debugon == 'on' ) {
|
|
400 |
return $instance;
|
401 |
}
|
402 |
|
403 |
-
public function widget($args, $instance) {
|
404 |
-
// outputs the content of the widget
|
405 |
-
extract( $args );
|
406 |
|
407 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
408 |
|
409 |
// set default channel if nothing predefined
|
410 |
$channel = $instance['channel'];
|
@@ -419,8 +516,6 @@ if ( $debugon == 'on' ) {
|
|
419 |
$use_res = $instance['use_res'];
|
420 |
|
421 |
$output = array();
|
422 |
-
$output[] = $before_widget;
|
423 |
-
if ( $title ) $output[] = $before_title . $title . $after_title;
|
424 |
|
425 |
$output[] = '<div class="youtube_channel">';
|
426 |
|
@@ -541,18 +636,31 @@ if ( $debugon == 'on' ) {
|
|
541 |
$output = array_merge( $output, ytc_channel_link($instance) ); // insert link to channel on bootom of widget
|
542 |
|
543 |
$output[] = '</div><!-- .youtube_channel -->';
|
544 |
-
$output[] = $after_widget;
|
545 |
|
546 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
547 |
|
|
|
548 |
}
|
549 |
|
550 |
-
} // class
|
551 |
|
552 |
-
if( class_exists('
|
553 |
{
|
554 |
// Installation and uninstallation hooks
|
555 |
-
register_activation_hook(__FILE__, array('
|
556 |
|
557 |
|
558 |
/* Load plugin's textdomain */
|
@@ -562,10 +670,22 @@ if( class_exists('YouTube_Channel_Widget'))
|
|
562 |
}
|
563 |
|
564 |
/* Load YTC player script */
|
565 |
-
|
566 |
// wp_enqueue_script( 'ytc', 'https://www.youtube.com/player_api', array(), '3.0.0', true );
|
567 |
-
|
568 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
|
570 |
function ytc_footer_js() {
|
571 |
// Print JS only if we have set YTC array
|
@@ -648,7 +768,7 @@ function ytc_print_video($item, $instance, $y) {
|
|
648 |
if ( $to_show != 'thumbnail' && !$controls && $instance['fixyt'] )
|
649 |
$height += 25;
|
650 |
|
651 |
-
$hideanno
|
652 |
$themelight = $instance['themelight'];
|
653 |
/* end of video settings */
|
654 |
|
@@ -658,6 +778,7 @@ function ytc_print_video($item, $instance, $y) {
|
|
658 |
|
659 |
$yt_thumb = "http://img.youtube.com/vi/$yt_id/0.jpg"; // zero for HD thumb
|
660 |
$yt_video = $item->link[0]->href;
|
|
|
661 |
$yt_title = $item->title->{'$t'};
|
662 |
$yt_date = $item->published->{'$t'};
|
663 |
//$yt_date = $item->get_date('j F Y | g:i a');
|
@@ -690,8 +811,15 @@ function ytc_print_video($item, $instance, $y) {
|
|
690 |
|
691 |
// print out video
|
692 |
if ( $to_show == "thumbnail" ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
693 |
$title = sprintf( __( 'Watch video %1$s published on %2$s' , YTCTDOM ), $yt_title, $yt_date );
|
694 |
-
$output[] = '<a href="'.$yt_video.'" title="'.$
|
695 |
} else if ( $to_show == "chromeless" ) {
|
696 |
ob_start();
|
697 |
?>
|
@@ -881,7 +1009,7 @@ function ytc_clean_playlist_id($playlist) {
|
|
881 |
|
882 |
/* Register plugin's widget */
|
883 |
function youtube_channel_register_widget() {
|
884 |
-
register_widget( '
|
885 |
}
|
886 |
add_action( 'widgets_init', 'youtube_channel_register_widget' );
|
887 |
|
4 |
Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
|
5 |
Description: <a href="widgets.php">Widget</a> that display latest video thumbnail, iframe (HTML5 video), object (Flash video) or chromeless video from YouTube Channel or Playlist.
|
6 |
Author: Aleksandar Urošević
|
7 |
+
Version: 2.2.0
|
8 |
Author URI: http://urosevic.net/
|
9 |
*/
|
10 |
+
define( 'YTCVER', '2.2.0' );
|
11 |
define( 'YOUTUBE_CHANNEL_URL', plugin_dir_url(__FILE__) );
|
12 |
define( 'YTCPLID', 'PLEC850BE962234400' );
|
13 |
define( 'YTCUID', 'urkekg' );
|
14 |
define( 'YTCTDOM', 'youtube-channel' );
|
15 |
+
define( 'YTCNAME', 'YouTube Channel' );
|
16 |
|
17 |
/* youtube widget */
|
18 |
+
class WPAU_YOUTUBE_CHANNEL extends WP_Widget {
|
19 |
|
20 |
public function __construct() {
|
21 |
+
|
22 |
+
// if ( is_admin() ){ // admin actions
|
23 |
+
// add_action( 'admin_menu', array($this,'add_admin_menu') );
|
24 |
+
// }
|
25 |
+
|
26 |
+
// Initialize Settings
|
27 |
+
require_once(sprintf("%s/assets/settings.php", dirname(__FILE__)));
|
28 |
+
|
29 |
+
add_shortcode( 'youtube_channel', array($this, 'youtube_channel_shortcode') );
|
30 |
+
// Initialize Widget
|
31 |
parent::__construct(
|
32 |
YTCTDOM,
|
33 |
__( 'Youtube Channel' , YTCTDOM ),
|
34 |
array( 'description' => __( 'Serve YouTube videos from channel or playlist right to widget area', YTCTDOM ) )
|
35 |
);
|
36 |
+
|
37 |
+
$WPAU_YOUTUBE_CHANNEL_SETTINGS = new WPAU_YOUTUBE_CHANNEL_SETTINGS();
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
public static function defaults()
|
42 |
+
{
|
43 |
+
$defaults = array(
|
44 |
+
'channel' => YTCUID,
|
45 |
+
'playlist' => YTCPLID,
|
46 |
+
'use_res' => false,
|
47 |
+
'only_pl' => false,
|
48 |
+
'cache_time' => 300, // 5 minutes
|
49 |
+
'maxrnd' => 25,
|
50 |
+
'vidqty' => 1,
|
51 |
+
'enhprivacy' => false,
|
52 |
+
'fixnoitem' => false,
|
53 |
+
'getrnd' => false,
|
54 |
+
'ratio' => 3, // 3 - 16:9, 2 - 16:10, 1 - 4:3
|
55 |
+
'width' => 220,
|
56 |
+
'to_show' => 'thumbnail', // thumbnail, iframe, iframe2, chromeless, object
|
57 |
+
'themelight' => false,
|
58 |
+
'controls' => false,
|
59 |
+
'fixyt' => false,
|
60 |
+
'autoplay' => false,
|
61 |
+
'autoplay_mute' => false,
|
62 |
+
|
63 |
+
'showtitle' => false,
|
64 |
+
'showvidesc' => false,
|
65 |
+
'videsclen' => 0,
|
66 |
+
'descappend' => '…',
|
67 |
+
'hideanno' => false,
|
68 |
+
'hideinfo' => false,
|
69 |
+
|
70 |
+
'goto_txt' => 'Visit our channel',
|
71 |
+
'showgoto' => false,
|
72 |
+
'popup_goto' => 3, // 3 same window, 2 new window JS, 1 new window target
|
73 |
+
'userchan' => false
|
74 |
+
);
|
75 |
+
// ChromePhp::log(get_option('youtube_channel_defaults'));
|
76 |
+
$options = wp_parse_args(get_option('youtube_channel_defaults'), $defaults);
|
77 |
+
// ChromePhp::log($options);
|
78 |
+
return $options;
|
79 |
}
|
80 |
|
81 |
/**
|
161 |
|
162 |
} // END public static function activate
|
163 |
|
164 |
+
// Helper function cache_time()
|
165 |
+
function cache_time($cache_time)
|
166 |
+
{
|
167 |
+
$times = array(
|
168 |
+
'minute' => array(
|
169 |
+
1 => "1 minute",
|
170 |
+
5 => "5 minutes",
|
171 |
+
15 => "15 minutes",
|
172 |
+
30 => "30 minutes"
|
173 |
+
),
|
174 |
+
'hour' => array(
|
175 |
+
1 => "1 hour",
|
176 |
+
2 => "2 hours",
|
177 |
+
5 => "5 hours",
|
178 |
+
10 => "10 hours",
|
179 |
+
12 => "12 hours",
|
180 |
+
18 => "18 hours"
|
181 |
+
),
|
182 |
+
'day' => array(
|
183 |
+
1 => "1 day",
|
184 |
+
2 => "2 days",
|
185 |
+
3 => "3 days",
|
186 |
+
4 => "4 days",
|
187 |
+
5 => "5 days",
|
188 |
+
6 => "6 days"
|
189 |
+
),
|
190 |
+
'week' => array(
|
191 |
+
1 => "1 week",
|
192 |
+
2 => "2 weeks",
|
193 |
+
3 => "3 weeks",
|
194 |
+
4 => "1 month"
|
195 |
+
)
|
196 |
+
);
|
197 |
+
|
198 |
+
$out = "";
|
199 |
+
foreach ($times as $period => $timeset)
|
200 |
+
{
|
201 |
+
switch ($period)
|
202 |
+
{
|
203 |
+
case 'minute':
|
204 |
+
$sc = MINUTE_IN_SECONDS;
|
205 |
+
break;
|
206 |
+
case 'hour':
|
207 |
+
$sc = HOUR_IN_SECONDS;
|
208 |
+
break;
|
209 |
+
case 'day':
|
210 |
+
$sc = DAY_IN_SECONDS;
|
211 |
+
break;
|
212 |
+
case 'week':
|
213 |
+
$sc = WEEK_IN_SECONDS;
|
214 |
+
break;
|
215 |
+
}
|
216 |
+
|
217 |
+
foreach ($timeset as $n => $s)
|
218 |
+
{
|
219 |
+
$sec = $sc * $n;
|
220 |
+
$out .='<option value="'.$sec.'" '. selected( $cache_time, $sec, 0 ).'>'.__($s, YTCTDOM).'</option>';
|
221 |
+
unset($sec);
|
222 |
+
}
|
223 |
+
}
|
224 |
+
return $out;
|
225 |
+
}
|
226 |
+
|
227 |
// TODO: Form code
|
228 |
public function form($instance) {
|
229 |
+
// outputs the options form for widget settings
|
230 |
// General Options
|
231 |
$title = (!empty($instance['title'])) ? esc_attr($instance['title']) : '';
|
232 |
$channel = (!empty($instance['channel'])) ? esc_attr($instance['channel']) : '';
|
274 |
// Debug YTC
|
275 |
$debugon = (!empty($instance['debugon'])) ? esc_attr($instance['debugon']) : '';
|
276 |
?>
|
277 |
+
|
278 |
<p>
|
279 |
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title:', YTCTDOM); ?><input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" title="<?php _e('Title for widget', YTCTDOM); ?>" /></label>
|
280 |
</p>
|
313 |
<p>
|
314 |
<label for="<?php echo $this->get_field_id('cache_time'); ?>"><?php _e('Cache feed:', YTCTDOM); ?></label>
|
315 |
<select class="widefat" id="<?php echo $this->get_field_id( 'cache_time' ); ?>" name="<?php echo $this->get_field_name( 'cache_time' ); ?>">
|
|
|
316 |
<option value="0"<?php selected( $cache_time, 0 ); ?>><?php _e('Do not chache', YTCTDOM); ?></option>
|
317 |
+
<?php echo self::cache_time($cache_time); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
</select>
|
319 |
</p>
|
320 |
<p>
|
330 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $getrnd, true ); ?> id="<?php echo $this->get_field_id( 'getrnd' ); ?>" name="<?php echo $this->get_field_name( 'getrnd' ); ?>" title="<?php _e('Get random videos of all fetched from channel or playlist', YTCTDOM); ?>" /> <label for="<?php echo $this->get_field_id( 'getrnd' ); ?>"><?php _e('Show random video', YTCTDOM); ?></label>
|
331 |
</p>
|
332 |
|
333 |
+
<h4><?php _e('Video Settings', YTCTDOM); ?></h4>
|
334 |
<p><label for="<?php echo $this->get_field_id('ratio'); ?>"><?php _e('Aspect ratio', YTCTDOM); ?>:</label>
|
335 |
<select class="widefat" id="<?php echo $this->get_field_id( 'ratio' ); ?>" name="<?php echo $this->get_field_name( 'ratio' ); ?>">
|
336 |
<?php /* <option value="0"<?php selected( $ratio, 0 ); ?>><?php _e('Custom (as set above)', YTCTDOM); ?></option> */ ?>
|
341 |
</p>
|
342 |
<p>
|
343 |
<label for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Width', YTCTDOM); ?>:</label> <input class="small-text" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="number" min="32" value="<?php echo $width; ?>" title="<?php _e('Set video width in pixels', YTCTDOM); ?>" /> px (<?php _e('default', YTCTDOM); ?> 220)
|
|
|
|
|
|
|
|
|
344 |
</p>
|
345 |
<p>
|
346 |
<label for="<?php echo $this->get_field_id('to_show'); ?>"><?php _e('What to show?', YTCTDOM); ?></label>
|
358 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $autoplay_mute, true ); ?> id="<?php echo $this->get_field_id( 'autoplay_mute' ); ?>" name="<?php echo $this->get_field_name( 'autoplay_mute' ); ?>" /> <label for="<?php echo $this->get_field_id( 'autoplay_mute' ); ?>"><?php _e('Mute video on autoplay', YTCTDOM); ?></label>
|
359 |
</p>
|
360 |
|
361 |
+
<h4><?php _e('Content Layout', YTCTDOM); ?></h4>
|
362 |
<p>
|
363 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $showtitle, true ); ?> id="<?php echo $this->get_field_id( 'showtitle' ); ?>" name="<?php echo $this->get_field_name( 'showtitle' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showtitle' ); ?>"><?php _e('Show video title', YTCTDOM); ?></label><br />
|
364 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $showvidesc, true ); ?> id="<?php echo $this->get_field_id( 'showvidesc' ); ?>" name="<?php echo $this->get_field_name( 'showvidesc' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showvidesc' ); ?>"><?php _e('Show video description', YTCTDOM); ?></label><br />
|
368 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $hideinfo, true ); ?> id="<?php echo $this->get_field_id( 'hideinfo' ); ?>" name="<?php echo $this->get_field_name( 'hideinfo' ); ?>" /> <label for="<?php echo $this->get_field_id( 'hideinfo' ); ?>"><?php _e('Hide video info', YTCTDOM); ?></label>
|
369 |
</p>
|
370 |
|
371 |
+
<h4><?php _e('Link to Channel', YTCTDOM); ?></h4>
|
372 |
<p>
|
373 |
<label for="<?php echo $this->get_field_id('goto_txt'); ?>"><?php _e('Visit YouTube Channel text:', YTCTDOM); ?> <input class="widefat" id="<?php echo $this->get_field_id('goto_txt'); ?>" name="<?php echo $this->get_field_name('goto_txt'); ?>" type="text" value="<?php echo $goto_txt; ?>" title="<?php _e('Default: Visit channel %channel%. Use placeholder %channel% to insert channel name.', YTCTDOM); ?>" /></label>
|
374 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $showgoto, true ); ?> id="<?php echo $this->get_field_id( 'showgoto' ); ?>" name="<?php echo $this->get_field_name( 'showgoto' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showgoto' ); ?>"><?php _e('Show link to channel', YTCTDOM); ?></label><br />
|
382 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $userchan, true ); ?> id="<?php echo $this->get_field_id( 'userchan' ); ?>" name="<?php echo $this->get_field_name( 'userchan' ); ?>" /> <label for="<?php echo $this->get_field_id( 'userchan' ); ?>"><?php _e('Link to channel instead to user', YTCTDOM); ?></label><br />
|
383 |
</p>
|
384 |
|
385 |
+
<h4><?php _e('Debug YTC', YTCTDOM); ?></h4>
|
386 |
<p>
|
387 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $debugon, true ); ?> id="<?php echo $this->get_field_id( 'debugon' ); ?>" name="<?php echo $this->get_field_name( 'debugon' ); ?>" /> <label for="<?php echo $this->get_field_id( 'debugon' ); ?>">Enable debugging</label><br />
|
388 |
|
453 |
return $instance;
|
454 |
}
|
455 |
|
|
|
|
|
|
|
456 |
|
457 |
+
public static function youtube_channel_shortcode($attr)
|
458 |
+
{
|
459 |
+
$defaults = WPAU_YOUTUBE_CHANNEL::defaults();
|
460 |
+
if (!empty($attr)) extract( $attr );
|
461 |
+
$instance = array();
|
462 |
+
$instance['channel'] = (empty($channel)) ? $defaults['channel'] : $channel;
|
463 |
+
$instance['playlist'] = (empty($playlist)) ? $defaults['playlist'] : $playlist;
|
464 |
+
$instance['use_res'] = (empty($res)) ? $defaults['use_res'] : $res; // resource: 0 channel, 1 favorites, 2 playlist
|
465 |
+
$instance['only_pl'] = (empty($only_pl)) ? $defaults['only_pl'] : true; // use embedded playlist - false by default
|
466 |
+
$instance['cache_time'] = (empty($cache)) ? $defaults['cache_time'] : $cache; // in seconds, def 5min - settings?
|
467 |
+
|
468 |
+
$instance['maxrnd'] = (empty($fetch)) ? $defaults['maxrnd'] : $fetch;
|
469 |
+
$instance['vidqty'] = (empty($num)) ? $defaults['vidqty'] : $num; // num: 1
|
470 |
+
|
471 |
+
$instance['fixnoitem'] = (empty($fix)) ? $defaults['fixnoitem'] : $fix; // fix noitem
|
472 |
+
$instance['getrnd'] = (empty($random)) ? $defaults['getrnd'] : $random; // use embedded playlist - false by default
|
473 |
+
|
474 |
+
// Video Settings
|
475 |
+
$instance['ratio'] = (empty($ratio)) ? $defaults['ratio'] : $ratio; // aspect ratio: 3 - 16:9, 2 - 16:10, 1 - 4:3
|
476 |
+
$instance['width'] = (empty($width)) ? $defaults['width'] : $width; // 220
|
477 |
+
$instance['to_show'] = (empty($show)) ? $defaults['to_show'] : $show; // thumbnail, iframe, iframe2, object, chromeless
|
478 |
+
|
479 |
+
$instance['themelight'] = (empty($themelight)) ? $defaults['themelight'] : $themelight; // use light theme, dark by default
|
480 |
+
$instance['controls'] = (empty($controls)) ? $defaults['controls'] : $controls; // hide controls, false by default
|
481 |
+
$instance['fixyt'] = (empty($fix_h)) ? $defaults['fixyt'] : $fix_h; // fix youtube height, disabled by default
|
482 |
+
$instance['autoplay'] = (empty($autoplay)) ? $defaults['autoplay'] : $autoplay; // autoplay disabled by default
|
483 |
+
$instance['autoplay_mute'] = (empty($mute)) ? $defaults['autoplay_mute'] : $mute; // mute sound on autoplay - disabled by default
|
484 |
+
|
485 |
+
// Content Layout
|
486 |
+
$instance['showtitle'] = (empty($showtitle)) ? $defaults['showtitle'] : $showtitle; // show video title, disabled by default
|
487 |
+
$instance['showvidesc'] = (empty($showdesc)) ? $defaults['showvidesc'] : $showdesc; // show video description, disabled by default
|
488 |
+
$instance['videsclen'] = (empty($desclen)) ? $defaults['videsclen'] : $desclen; // cut video description, number of characters
|
489 |
+
$instance['hideinfo'] = (empty($noinfo)) ? $defaults['hideinfo'] : $noinfo; // hide info by default
|
490 |
+
$instance['hideanno'] = (empty($noanno)) ? $defaults['hideanno'] : $noanno; // hide annotations, false by default
|
491 |
+
|
492 |
+
// Link to Channel
|
493 |
+
$instance['showgoto'] = (empty($goto)) ? $defaults['showgoto'] : $goto; // show goto link, disabled by default
|
494 |
+
$instance['goto_txt'] = (empty($goto_txt)) ? $defaults['goto_txt'] : $goto_txt; // text for goto link - use settings
|
495 |
+
$instance['popup_goto'] = (empty($popup)) ? $defaults['popup_goto'] : $popup; // open channel in: 0 same window, 1 javascript new, 2 target new
|
496 |
+
$instance['userchan'] = (empty($userchan)) ? $defaults['userchan'] : $userchan; // link to user channel instaled page
|
497 |
+
|
498 |
+
// return implode(self::print_ytc($instance));
|
499 |
+
return implode(array_values(self::print_ytc($instance)));
|
500 |
+
}
|
501 |
+
|
502 |
+
// print out widget
|
503 |
+
public static function print_ytc($instance)
|
504 |
+
{
|
505 |
|
506 |
// set default channel if nothing predefined
|
507 |
$channel = $instance['channel'];
|
516 |
$use_res = $instance['use_res'];
|
517 |
|
518 |
$output = array();
|
|
|
|
|
519 |
|
520 |
$output[] = '<div class="youtube_channel">';
|
521 |
|
636 |
$output = array_merge( $output, ytc_channel_link($instance) ); // insert link to channel on bootom of widget
|
637 |
|
638 |
$output[] = '</div><!-- .youtube_channel -->';
|
|
|
639 |
|
640 |
+
return $output;
|
641 |
+
}
|
642 |
+
|
643 |
+
// TODO: make shortcode
|
644 |
+
public function widget($args, $instance) {
|
645 |
+
// outputs the content of the widget
|
646 |
+
extract( $args );
|
647 |
+
|
648 |
+
$title = apply_filters('widget_title', $instance['title']);
|
649 |
+
$output = array();
|
650 |
+
$output[] = $before_widget;
|
651 |
+
if ( $title ) $output[] = $before_title . $title . $after_title;
|
652 |
+
$output[] = implode(self::print_ytc($instance));
|
653 |
+
$output[] = $after_widget;
|
654 |
|
655 |
+
echo implode('',array_values($output));
|
656 |
}
|
657 |
|
658 |
+
} // class WPAU_YOUTUBE_CHANNEL()
|
659 |
|
660 |
+
if( class_exists('WPAU_YOUTUBE_CHANNEL'))
|
661 |
{
|
662 |
// Installation and uninstallation hooks
|
663 |
+
register_activation_hook(__FILE__, array('WPAU_YOUTUBE_CHANNEL', 'activate'));
|
664 |
|
665 |
|
666 |
/* Load plugin's textdomain */
|
670 |
}
|
671 |
|
672 |
/* Load YTC player script */
|
673 |
+
function ytc_enqueue_scripts() {
|
674 |
// wp_enqueue_script( 'ytc', 'https://www.youtube.com/player_api', array(), '3.0.0', true );
|
675 |
+
wp_enqueue_style( 'youtube-channel', plugins_url('assets/css/youtube-channel.css', __FILE__), array(), YTCVER );
|
676 |
+
// enqueue fancybox
|
677 |
+
// wp_enqueue_script( 'fancybox', plugins_url('assets/lib/fancybox/jquery.fancybox.pack.js', __FILE__), array('jquery'), YTCVER, true );
|
678 |
+
// wp_enqueue_style( 'fancybox', plugins_url('assets/lib/fancybox/jquery.fancybox.css', __FILE__), array(), YTCVER );
|
679 |
+
// wp_enqueue_script( 'fancybox-media', plugins_url('assets/lib/fancybox/jquery.fancybox-media.js', __FILE__), array('jquery'), YTCVER, true );
|
680 |
+
// wp_enqueue_script( 'youtube-channel', plugins_url('assets/js/youtube-channel.js', __FILE__), array(), YTCVER, true );
|
681 |
+
|
682 |
+
// enqueue magnific-popup
|
683 |
+
wp_enqueue_script( 'magnific-popup', plugins_url('assets/lib/magnific-popup/jquery.magnific-popup.min.js', __FILE__), array('jquery'), YTCVER, true );
|
684 |
+
wp_enqueue_style( 'magnific-popup', plugins_url('assets/lib/magnific-popup/magnific-popup.css', __FILE__), array(), YTCVER );
|
685 |
+
// wp_enqueue_script( 'fancybox-media', plugins_url('assets/lib/fancybox/jquery.fancybox-media.js', __FILE__), array('jquery'), YTCVER, true );
|
686 |
+
wp_enqueue_script( 'youtube-channel', plugins_url('assets/js/youtube-channel.js', __FILE__), array(), YTCVER, true );
|
687 |
+
}
|
688 |
+
add_action( 'wp_enqueue_scripts', 'ytc_enqueue_scripts' );
|
689 |
|
690 |
function ytc_footer_js() {
|
691 |
// Print JS only if we have set YTC array
|
768 |
if ( $to_show != 'thumbnail' && !$controls && $instance['fixyt'] )
|
769 |
$height += 25;
|
770 |
|
771 |
+
$hideanno = $instance['hideanno'];
|
772 |
$themelight = $instance['themelight'];
|
773 |
/* end of video settings */
|
774 |
|
778 |
|
779 |
$yt_thumb = "http://img.youtube.com/vi/$yt_id/0.jpg"; // zero for HD thumb
|
780 |
$yt_video = $item->link[0]->href;
|
781 |
+
$yt_video = preg_replace('/\&.*$/','',$yt_video);
|
782 |
$yt_title = $item->title->{'$t'};
|
783 |
$yt_date = $item->published->{'$t'};
|
784 |
//$yt_date = $item->get_date('j F Y | g:i a');
|
811 |
|
812 |
// print out video
|
813 |
if ( $to_show == "thumbnail" ) {
|
814 |
+
// set proper class for responsive thumbs per selected aspect ratio
|
815 |
+
switch ($instance['ratio'])
|
816 |
+
{
|
817 |
+
case 1: $arclass = 'ar4_3'; break;
|
818 |
+
case 2: $arclass = 'ar16_10'; break;
|
819 |
+
default: $arclass = 'ar16_9';
|
820 |
+
}
|
821 |
$title = sprintf( __( 'Watch video %1$s published on %2$s' , YTCTDOM ), $yt_title, $yt_date );
|
822 |
+
$output[] = '<a href="'.$yt_video.'" title="'.$yt_title.'" class="ytc_thumb ytc-lightbox '.$arclass.'"><span style="background-image: url('.$yt_thumb.');" title="'.$title.'" id="'.$ytc_vid.'"></span></a>';
|
823 |
} else if ( $to_show == "chromeless" ) {
|
824 |
ob_start();
|
825 |
?>
|
1009 |
|
1010 |
/* Register plugin's widget */
|
1011 |
function youtube_channel_register_widget() {
|
1012 |
+
register_widget( 'WPAU_YOUTUBE_CHANNEL' );
|
1013 |
}
|
1014 |
add_action( 'widgets_init', 'youtube_channel_register_widget' );
|
1015 |
|