Version Description
(20210227) = * Tested: WordPress 5.6.2 on PHP 7.4.15 and 8.0.2 * Add: compatibility with PHP 8 * Add: conditionally hide not applicable options in widget settings form * Change: Lowest supported PHP version increased to 5.6 * Improve: Readme, Installation (Step-by-Step instructions for obtaining YouTube Data API Key v3), FAQ
Download this release
Release Info
Developer | urkekg |
Plugin | YouTube Channel |
Version | 3.0.12.1 |
Comparing to | |
See all releases |
Code changes from version 3.0.12 to 3.0.12.1
- assets/css/admin.css +1 -1
- assets/css/admin.css.map +1 -1
- assets/css/admin.less +4 -1
- assets/css/youtube-channel.css +1 -1
- assets/css/youtube-channel.css.map +1 -1
- assets/js/admin.js +46 -0
- assets/js/admin.min.js +1 -0
- inc/settings-support.php +1 -1
- inc/settings-tools.php +1 -1
- inc/widget.php +34 -23
- readme.txt +117 -111
- update.php +0 -3
- youtube-channel.php +55 -47
assets/css/admin.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
i.mce-i-ytc{font:normal 20px/1 'dashicons';padding:0;vertical-align:top;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin-left:-2px;padding-right:2px}i.mce-i-ytc:before{content:'\f236'}div[id*='_youtube-channel-'] .widget-content p{width:100%;clear:both}div[id*='_youtube-channel-'] .widget-content p.half{width:49%}div[id*='_youtube-channel-'] .widget-content p.half.left{float:left;clear:left}div[id*='_youtube-channel-'] .widget-content p.half.right{float:right;clear:right}div[id*='_youtube-channel-'] .widget-content p.glue-top{margin-top:0}div[id*='_youtube-channel-'] .widget-content p.hidden{display:none}div[id*='_youtube-channel-'] .widget-content p.visible{display:block}@media screen and (max-width:782px){div[id*='_youtube-channel-'] .widget-content p.half.left,div[id*='_youtube-channel-'] .widget-content p.half.right{width:100%;float:none;clear:none}}.nav-tab.nav-tab-hidden{display:none}.subnav-tab-wrapper{margin-bottom:0}.subnav-tab-wrapper .nav-tab{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.subnav-tab-wrapper .nav-tab:focus{-webkit-box-shadow:initial;box-shadow:initial}.tab-content-ytc{display:none}.tab-content-ytc.tab-content-active{display:block;border-color:#ccc;border-width:0 1px 1px 1px;border-style:solid;padding:10px}
|
1 |
+
i.mce-i-ytc{font:normal 20px/1 'dashicons';padding:0;vertical-align:top;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin-left:-2px;padding-right:2px}i.mce-i-ytc:before{content:'\f236'}div[id*='_youtube-channel-'] .widget-content p{width:100%;clear:both}div[id*='_youtube-channel-'] .widget-content p.half{width:49%}div[id*='_youtube-channel-'] .widget-content p.half.left{float:left;clear:left}div[id*='_youtube-channel-'] .widget-content p.half.right{float:right;clear:right}div[id*='_youtube-channel-'] .widget-content p.glue-top{margin-top:0}div[id*='_youtube-channel-'] .widget-content p.hidden{display:none}div[id*='_youtube-channel-'] .widget-content p.visible{display:block}div[id*='_youtube-channel-'] .widget-content p .hidden{display:none}@media screen and (max-width:782px){div[id*='_youtube-channel-'] .widget-content p.half.left,div[id*='_youtube-channel-'] .widget-content p.half.right{width:100%;float:none;clear:none}}.nav-tab.nav-tab-hidden{display:none}.subnav-tab-wrapper{margin-bottom:0}.subnav-tab-wrapper .nav-tab{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.subnav-tab-wrapper .nav-tab:focus{-webkit-box-shadow:initial;box-shadow:initial}.tab-content-ytc{display:none}.tab-content-ytc.tab-content-active{display:block;border-color:#ccc;border-width:0 1px 1px 1px;border-style:solid;padding:10px}/*# sourceMappingURL=admin.css.map */
|
assets/css/admin.css.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["admin.less"],"names":[],"mappings":"AAAA,CAAC,WACA,mBAAoB,WAApB,CACA,SAAA,CACA,kBAAA,CACA,UAAA,CACA,kCAAA,CACA,iCAAA,CACA,gBAAA,CACA,kBAEA,CAVA,UAUC,QACA,QAAS,QAGX,GAAG,yBAA0B,gBAAgB,GAC5C,UAAA,CACA,WAEA,GAJE,yBAA0B,gBAAgB,EAI3C,MACA,UAEA,GAPC,yBAA0B,gBAAgB,EAI3C,KAGC,MACA,UAAA,CACA,WAED,GAXC,yBAA0B,gBAAgB,EAI3C,KAOC,OACA,WAAA,CACA,YAIF,GAjBE,yBAA0B,gBAAgB,EAiB3C,UACA,aAED,GApBE,yBAA0B,gBAAgB,EAoB3C,QACA,aAED,GAvBE,yBAA0B,gBAAgB,EAuB3C,SACA,
|
1 |
+
{"version":3,"sources":["admin.less"],"names":[],"mappings":"AAAA,CAAC,WACA,mBAAoB,WAApB,CACA,SAAA,CACA,kBAAA,CACA,UAAA,CACA,kCAAA,CACA,iCAAA,CACA,gBAAA,CACA,kBAEA,CAVA,UAUC,QACA,QAAS,QAGX,GAAG,yBAA0B,gBAAgB,GAC5C,UAAA,CACA,WAEA,GAJE,yBAA0B,gBAAgB,EAI3C,MACA,UAEA,GAPC,yBAA0B,gBAAgB,EAI3C,KAGC,MACA,UAAA,CACA,WAED,GAXC,yBAA0B,gBAAgB,EAI3C,KAOC,OACA,WAAA,CACA,YAIF,GAjBE,yBAA0B,gBAAgB,EAiB3C,UACA,aAED,GApBE,yBAA0B,gBAAgB,EAoB3C,QACA,aAED,GAvBE,yBAA0B,gBAAgB,EAuB3C,SACA,cAxBF,GAAG,yBAA0B,gBAAgB,EA0B5C,SACC,aAYF,mBATqC,iBACpC,GAAG,yBAA0B,gBAAgB,EAAC,KAAK,MACnD,GAAG,yBAA0B,gBAAgB,EAAC,KAAK,OAClD,UAAA,CACA,UAAA,CACA,YAKF,QAAQ,gBACP,aAED,oBACC,gBAEA,mBAAE,UACD,wBAAA,CACA,qBAAA,CACA,oBAAA,CACA,iBAEA,mBANC,SAMA,OACA,0BAAA,CACA,mBAIH,iBACC,aAEA,gBAAC,oBACA,aAAA,CACA,iBAAA,CACA,0BAAA,CACA,kBAAA,CACA","file":"admin.css","sourceRoot":""}
|
assets/css/admin.less
CHANGED
@@ -38,6 +38,9 @@ div[id*='_youtube-channel-'] .widget-content p {
|
|
38 |
&.visible {
|
39 |
display: block;
|
40 |
}
|
|
|
|
|
|
|
41 |
}
|
42 |
@media screen and (max-width: 782px) {
|
43 |
div[id*='_youtube-channel-'] .widget-content p.half.left,
|
@@ -77,4 +80,4 @@ div[id*='_youtube-channel-'] .widget-content p {
|
|
77 |
border-style: solid;
|
78 |
padding: 10px;
|
79 |
}
|
80 |
-
}
|
38 |
&.visible {
|
39 |
display: block;
|
40 |
}
|
41 |
+
.hidden {
|
42 |
+
display: none;
|
43 |
+
}
|
44 |
}
|
45 |
@media screen and (max-width: 782px) {
|
46 |
div[id*='_youtube-channel-'] .widget-content p.half.left,
|
80 |
border-style: solid;
|
81 |
padding: 10px;
|
82 |
}
|
83 |
+
}
|
assets/css/youtube-channel.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.youtube_channel{float:left;clear:both;position:relative;box-sizing:border-box}.youtube_channel .ytc_video_container{float:left;position:relative}.youtube_channel .ytc_video_container iframe{margin-bottom:0}.youtube_channel .ytc_video_container a{border:none}.youtube_channel.responsive{width:100%}.youtube_channel.responsive .ytc_video_container{width:100% !important}.youtube_channel.responsive .ytc_video_container.ar16_9 .fluid-width-video-wrapper{position:relative;padding-bottom:56.25%;height:0}.youtube_channel.responsive .ytc_video_container.ar4_3 .fluid-width-video-wrapper{position:relative;padding-bottom:75%;height:0}.youtube_channel.responsive .ytc_video_container .fluid-width-video-wrapper iframe{position:absolute;top:0;left:0;width:100%;height:100%}.youtube_channel .ytc_thumb{display:block;overflow:hidden;position:relative;height:0;width:100%;top:0;right:0;bottom:0;left:0;cursor:pointer}.youtube_channel .ytc_thumb>span{height:0;width:100%;display:block;-webkit-background-size:cover;background-size:cover;background-position:center center;background-repeat:no-repeat}.youtube_channel .ytc_thumb>span:before{content:" ";display:block;width:84px;height:59px;background-image:url(../img/yt_play.png);background-position:top center;background-repeat:no-repeat;background-color:transparent;opacity:.9;position:absolute;top:50%;left:50%;padding:0 !important;margin-left:-42px;margin-top:-30px;cursor:pointer;transform:scale(.85)}.youtube_channel .ytc_thumb>span .ytc_title_inside{display:block;position:absolute;margin:0;padding:10px;width:100%;color:#fff;background:rgba(0,0,0,0.6);font-weight:500;font-size:1.4rem}.youtube_channel .ytc_thumb>span .ytc_title_inside.ytc_title_inside_bottom{bottom:0}.youtube_channel .ytc_thumb:hover>span:before{background-position:bottom center}.youtube_channel .ytc_thumb.ar16_9,.youtube_channel .ytc_thumb.ar16_9>span{padding-bottom:56.26%}.youtube_channel .ytc_thumb.ar4_3,.youtube_channel .ytc_thumb.ar4_3>span{padding-bottom:75%}.youtube_channel .ytc_link{position:relative;clear:both;float:left;width:100%}.youtube_channel .ytc_link>p{padding:0;margin:0}.youtube_channel p.ytc_error{color:#d00}.clearfix:after,.widget_youtube-channel:after,.youtube_channel:after{content:" ";visibility:hidden;display:block;height:0;clear:both}
|
1 |
+
.youtube_channel{float:left;clear:both;position:relative;box-sizing:border-box}.youtube_channel .ytc_video_container{float:left;position:relative}.youtube_channel .ytc_video_container iframe{margin-bottom:0}.youtube_channel .ytc_video_container a{border:none}.youtube_channel.responsive{width:100%}.youtube_channel.responsive .ytc_video_container{width:100% !important}.youtube_channel.responsive .ytc_video_container.ar16_9 .fluid-width-video-wrapper{position:relative;padding-bottom:56.25%;height:0}.youtube_channel.responsive .ytc_video_container.ar4_3 .fluid-width-video-wrapper{position:relative;padding-bottom:75%;height:0}.youtube_channel.responsive .ytc_video_container .fluid-width-video-wrapper iframe{position:absolute;top:0;left:0;width:100%;height:100%}.youtube_channel .ytc_thumb{display:block;overflow:hidden;position:relative;height:0;width:100%;top:0;right:0;bottom:0;left:0;cursor:pointer}.youtube_channel .ytc_thumb>span{height:0;width:100%;display:block;-webkit-background-size:cover;background-size:cover;background-position:center center;background-repeat:no-repeat}.youtube_channel .ytc_thumb>span:before{content:" ";display:block;width:84px;height:59px;background-image:url(../img/yt_play.png);background-position:top center;background-repeat:no-repeat;background-color:transparent;opacity:.9;position:absolute;top:50%;left:50%;padding:0 !important;margin-left:-42px;margin-top:-30px;cursor:pointer;transform:scale(.85)}.youtube_channel .ytc_thumb>span .ytc_title_inside{display:block;position:absolute;margin:0;padding:10px;width:100%;color:#fff;background:rgba(0,0,0,0.6);font-weight:500;font-size:1.4rem}.youtube_channel .ytc_thumb>span .ytc_title_inside.ytc_title_inside_bottom{bottom:0}.youtube_channel .ytc_thumb:hover>span:before{background-position:bottom center}.youtube_channel .ytc_thumb.ar16_9,.youtube_channel .ytc_thumb.ar16_9>span{padding-bottom:56.26%}.youtube_channel .ytc_thumb.ar4_3,.youtube_channel .ytc_thumb.ar4_3>span{padding-bottom:75%}.youtube_channel .ytc_link{position:relative;clear:both;float:left;width:100%}.youtube_channel .ytc_link>p{padding:0;margin:0}.youtube_channel p.ytc_error{color:#d00}.clearfix:after,.widget_youtube-channel:after,.youtube_channel:after{content:" ";visibility:hidden;display:block;height:0;clear:both}/*# sourceMappingURL=youtube-channel.css.map */
|
assets/css/youtube-channel.css.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"
|
1 |
+
{"version":3,"sources":["youtube-channel.less"],"names":[],"mappings":"AAAA,iBACC,UAAA,CACA,UAAA,CACA,iBAAA,CACA,sBAEA,gBAAE,sBACD,UAAA,CACA,kBAEA,gBAJC,qBAIC,QACD,gBAGD,gBARC,qBAQC,GACD,YAIF,gBAAC,YACA,WACA,gBAFA,WAEE,sBACD,UAAA,YAGA,gBAND,WAEE,qBAIA,OAAQ,4BACR,iBAAA,CACA,qBAAA,CACA,SAED,gBAXD,WAEE,qBASA,MAAO,4BACP,iBAAA,CACA,kBAAA,CACA,SAED,gBAhBD,WAEE,qBAcC,2BAA2B,QAC5B,iBAAA,CACA,KAAA,CACA,MAAA,CACA,UAAA,CACA,YAMH,gBAAE,YACD,aAAA,CACA,eAAA,CACA,iBAAA,CACA,QAAA,CACA,UAAA,CACA,KAAA,CACA,OAAA,CACA,QAAA,CACA,MAAA,CACA,eAEA,gBAZC,WAYA,MACA,QAAA,CACA,UAAA,CACA,aAAA,CACA,6BAAA,CACA,qBAAA,CACA,iCAAA,CACA,4BAEA,gBArBA,WAYA,KASC,QACA,QAAS,GAAT,CACA,aAAA,CAGA,UAAA,CACA,WAAA,CACA,wCAAA,CACA,8BAAA,CACA,2BAAA,CACA,4BAAA,CAEA,UAAA,CAEA,iBAAA,CACA,OAAA,CACA,QAAA,CACA,SAAA,YAGA,iBAAA,CACA,gBAAA,CACA,cAAA,CACA,UAAW,WAhCb,gBAZC,WAYA,KAoCA,mBACC,aAAA,CACA,iBAAA,CACA,QAAA,CACA,YAAA,CACA,UAAA,CACA,UAAA,CACA,0BAAA,CACA,eAAA,CACA,iBAEA,gBA3DD,WAYA,KAoCA,kBAWE,yBACA,SAKH,gBAjEC,WAiEA,MAAM,KAAK,QAEX,kCAID,gBAvEC,WAuEA,QACD,gBAxEC,WAwEA,OAAO,MAEP,sBAED,gBA5EC,WA4EA,OACD,gBA7EC,WA6EA,MAAM,MAEN,mBAKF,gBAAE,WACD,iBAAA,CACA,UAAA,CACA,UAAA,CACA,WAEA,gBANC,UAMA,GACA,SAAA,CACA,SAKF,gBAAE,EAAC,WACF,WAKF,SAAS,OACT,uBAAuB,OACvB,gBAAgB,OACf,QAAS,GAAT,CACA,iBAAA,CACA,aAAA,CACA,QAAA,CACA","file":"youtube-channel.css","sourceRoot":""}
|
assets/js/admin.js
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function ytcFieldSwitch(fIds, fSelectors, newState) {
|
2 |
+
fSelectors.forEach(function(fSelector, index){
|
3 |
+
ytcWidgetField = document.querySelector("label[for='" + fIds + fSelector + "']");
|
4 |
+
if ("hide" == newState) {
|
5 |
+
ytcWidgetField.classList.add("hidden");
|
6 |
+
} else {
|
7 |
+
ytcWidgetField.classList.remove("hidden");
|
8 |
+
}
|
9 |
+
});
|
10 |
+
}
|
11 |
+
|
12 |
+
function ytcToggle(fieldsGroup, fIds) {
|
13 |
+
var fTrigger = document.getElementById(fIds + fieldsGroup);
|
14 |
+
var fSelectors, fState;
|
15 |
+
switch (fieldsGroup) {
|
16 |
+
case "resource":
|
17 |
+
fSelectors = ["random"];
|
18 |
+
fState = 2 == fTrigger.value ? "hide" : "show";
|
19 |
+
break;
|
20 |
+
case "responsive":
|
21 |
+
fSelectors = ["width"];
|
22 |
+
fState = fTrigger.checked ? "hide" : "show";
|
23 |
+
break;
|
24 |
+
case "display":
|
25 |
+
fSelectors = ["thumb_quality", "no_thumb_title"];
|
26 |
+
fState = "thumbnail" !== fTrigger.value ? "hide" : "show";
|
27 |
+
break;
|
28 |
+
case "showtitle":
|
29 |
+
fSelectors = ["linktitle", "titletag"];
|
30 |
+
fState = "none" == fTrigger.value ? "hide" : "show";
|
31 |
+
break;
|
32 |
+
case "showdesc":
|
33 |
+
fSelectors = ["desclen"];
|
34 |
+
fState = !fTrigger.checked ? "hide" : "show";
|
35 |
+
break;
|
36 |
+
case "link_to":
|
37 |
+
fSelectors = ["goto_txt", "popup_goto"];
|
38 |
+
fState = "none" == fTrigger.value ? "hide" : "show";
|
39 |
+
break;
|
40 |
+
}
|
41 |
+
if ("hide" == fState) {
|
42 |
+
ytcFieldSwitch(fIds, fSelectors, "hide");
|
43 |
+
} else if ("show" == fState) {
|
44 |
+
ytcFieldSwitch(fIds, fSelectors, "show");
|
45 |
+
}
|
46 |
+
}
|
assets/js/admin.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
function ytcFieldSwitch(e,t,i){t.forEach(function(t,d){ytcWidgetField=document.querySelector("label[for='"+e+t+"']"),"hide"==i?ytcWidgetField.classList.add("hidden"):ytcWidgetField.classList.remove("hidden")})}function ytcToggle(e,t){var i,d,c=document.getElementById(t+e);switch(e){case"resource":i=["random"],d=2==c.value?"hide":"show";break;case"responsive":i=["width"],d=c.checked?"hide":"show";break;case"display":i=["thumb_quality","no_thumb_title"],d="thumbnail"!==c.value?"hide":"show";break;case"showtitle":i=["linktitle","titletag"],d="none"==c.value?"hide":"show";break;case"showdesc":i=["desclen"],d=c.checked?"show":"hide";break;case"link_to":i=["goto_txt","popup_goto"],d="none"==c.value?"hide":"show"}"hide"==d?ytcFieldSwitch(t,i,"hide"):"show"==d&&ytcFieldSwitch(t,i,"show")}
|
inc/settings-support.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<p>For all questions, feature request and communication with author and users of this plugin, use our <a href="https://wordpress.org/support/plugin/youtube-channel" target="_blank">support forum</a>.</p>
|
2 |
|
3 |
<p>If you like <a href="https://wordpress.org/plugins/youtube-channel/" target="_blank">YouTube Channel</a> and my other <a href="https://urosevic.net/wordpress/plugins/" target="_blank">WordPress extensions</a>, feel free to support my work with <a href="https://urosevic.net/wordpress/donate/?donate_for=youtube-channel" target="_blank">donation</a>.</p>
|
1 |
+
<p>For all questions, feature request and communication with author and users of this plugin, use our <a href="https://wordpress.org/support/plugin/youtube-channel/" target="_blank">support forum</a>.</p>
|
2 |
|
3 |
<p>If you like <a href="https://wordpress.org/plugins/youtube-channel/" target="_blank">YouTube Channel</a> and my other <a href="https://urosevic.net/wordpress/plugins/" target="_blank">WordPress extensions</a>, feel free to support my work with <a href="https://urosevic.net/wordpress/donate/?donate_for=youtube-channel" target="_blank">donation</a>.</p>
|
inc/settings-tools.php
CHANGED
@@ -25,5 +25,5 @@ jQuery(document).ready(function($){
|
|
25 |
</script>
|
26 |
|
27 |
<h3>Export global settings to JSON</h3>
|
28 |
-
<p>If you experienced any error while you using shortcode <code>[youtube_channel]</code> please provide to <a href="https://wordpress.org/support/plugin/youtube-channel" target="_blank">support forum</a> exact shortcode syntax and JSON of global settings.</p>
|
29 |
<a href="?ytc_debug_json_for=global" class="button">Download YTC global settings</a>
|
25 |
</script>
|
26 |
|
27 |
<h3>Export global settings to JSON</h3>
|
28 |
+
<p>If you experienced any error while you using shortcode <code>[youtube_channel]</code> please provide to <a href="https://wordpress.org/support/plugin/youtube-channel/" target="_blank">support forum</a> exact shortcode syntax and JSON of global settings.</p>
|
29 |
<a href="?ytc_debug_json_for=global" class="button">Download YTC global settings</a>
|
inc/widget.php
CHANGED
@@ -118,7 +118,12 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
118 |
'Get your %1$s and %2$s from <a href="%3$s" target="_blank">here</a>.',
|
119 |
'youtube-channel'
|
120 |
),
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
122 |
),
|
123 |
__( 'Channel ID', 'youtube-channel' ),
|
124 |
__( 'Custom ID', 'youtube-channel' ),
|
@@ -153,7 +158,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
153 |
<p class="half left glue-top">
|
154 |
<label for="<?php echo $this->get_field_id( 'resource' ); ?>">
|
155 |
<?php _e( 'Resource to use', 'youtube-channel' ); ?>
|
156 |
-
<select class="widefat" id="<?php echo $this->get_field_id( 'resource' ); ?>" name="<?php echo $this->get_field_name( 'resource' ); ?>">
|
157 |
<option value="0"<?php selected( $resource, 0 ); ?>><?php _e( 'Channel (User Uploads)', 'youtube-channel' ); ?></option>
|
158 |
<option value="1"<?php selected( $resource, 1 ); ?>><?php _e( 'Favourites', 'youtube-channel' ); ?></option>
|
159 |
<option value="3"<?php selected( $resource, 3 ); ?>><?php _e( 'Liked Videos', 'youtube-channel' ); ?></option>
|
@@ -197,7 +202,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
197 |
<?php printf( __( 'Enable <a href="%s" target="_blank">privacy-enhanced mode</a>', 'youtube-channel' ), 'https://support.google.com/youtube/bin/answer.py?hl=en-GB&answer=171780' ); ?>
|
198 |
</label>
|
199 |
<br />
|
200 |
-
<label for="<?php echo $this->get_field_id( 'random' ); ?>"
|
201 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $random, true ); ?> id="<?php echo $this->get_field_id( 'random' ); ?>" name="<?php echo $this->get_field_name( 'random' ); ?>" title="<?php _e( 'Get random videos of all fetched from channel or playlist', 'youtube-channel' ); ?>" />
|
202 |
<?php _e( 'Show random video from resource', 'youtube-channel' ); ?>
|
203 |
<br />
|
@@ -216,12 +221,12 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
216 |
</label>
|
217 |
<br />
|
218 |
<label for="<?php echo $this->get_field_id( 'responsive' ); ?>">
|
219 |
-
<input class="checkbox" type="checkbox" <?php checked( (bool) $responsive, true ); ?> id="<?php echo $this->get_field_id( 'responsive' ); ?>" name="<?php echo $this->get_field_name( 'responsive' ); ?>" />
|
220 |
<?php _e( 'Responsive video <small>(distribute one full width item per row)</small>', 'youtube-channel' ); ?>
|
221 |
</label>
|
222 |
</p>
|
223 |
<p>
|
224 |
-
<label for="<?php echo $this->get_field_id( 'width' ); ?>"
|
225 |
<?php _e( 'Initial width', 'youtube-channel' ); ?>
|
226 |
<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', 'youtube-channel' ); ?>" />
|
227 |
<small>px (<?php _e( 'default', 'youtube-channel' ); ?> 306)</small>
|
@@ -230,7 +235,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
230 |
<p>
|
231 |
<label for="<?php echo $this->get_field_id( 'display' ); ?>">
|
232 |
<?php _e( 'What to display?', 'youtube-channel' ); ?>
|
233 |
-
<select class="widefat" id="<?php echo $this->get_field_id( 'display' ); ?>" name="<?php echo $this->get_field_name( 'display' ); ?>" onchange="ytcToggle('display', '<?php echo $this->get_field_id(''); ?>');">
|
234 |
<option value="thumbnail"<?php selected( $display, 'thumbnail' ); ?>><?php _e( 'Thumbnail', 'youtube-channel' ); ?></option>
|
235 |
<option value="iframe"<?php selected( $display, 'iframe' ); ?>><?php _e( 'HTML5 (iframe)', 'youtube-channel' ); ?></option>
|
236 |
<option value="iframe2"<?php selected( $display, 'iframe2' ); ?>><?php _e( 'HTML5 (iframe) Asynchronous', 'youtube-channel' ); ?></option>
|
@@ -265,7 +270,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
265 |
</label>
|
266 |
</p>
|
267 |
<p>
|
268 |
-
<label for="<?php echo $this->get_field_id( 'thumb_quality' ); ?>"
|
269 |
<?php _e( 'Thumbnail Quality', 'youtube-channel' ); ?>
|
270 |
<select class="widefat" id="<?php echo $this->get_field_id( 'thumb_quality' ); ?>" name="<?php echo $this->get_field_name( 'thumb_quality' ); ?>">
|
271 |
<option value="default"<?php selected( $thumb_quality, 'default' ); ?>><?php _e( 'Default Quality (120x90px)', 'youtube-channel' ); ?></option>
|
@@ -277,7 +282,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
277 |
</label>
|
278 |
</p>
|
279 |
<p>
|
280 |
-
<label for="<?php echo $this->get_field_id( 'no_thumb_title' ); ?>"
|
281 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $no_thumb_title, true ); ?> id="<?php echo $this->get_field_id( 'no_thumb_title' ); ?>" name="<?php echo $this->get_field_name( 'no_thumb_title' ); ?>" />
|
282 |
<?php _e( 'Disable thumbnail tooltip', 'youtube-channel' ); ?>
|
283 |
</label>
|
@@ -287,7 +292,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
287 |
<p>
|
288 |
<label for="<?php echo $this->get_field_id( 'showtitle' ); ?>">
|
289 |
<?php _e( 'Show video title', 'youtube-channel' ); ?>
|
290 |
-
<select class="widefat" id="<?php echo $this->get_field_id( 'showtitle' ); ?>" name="<?php echo $this->get_field_name( 'showtitle' ); ?>" onchange="ytcToggle('
|
291 |
<option value="none"<?php selected( $showtitle, 'none' ); ?>><?php _e( 'Hide title', 'youtube-channel' ); ?></option>
|
292 |
<option value="above"<?php selected( $showtitle, 'above' ); ?>><?php _e( 'Above video/thumbnail', 'youtube-channel' ); ?></option>
|
293 |
<option value="below"<?php selected( $showtitle, 'below' ); ?>><?php _e( 'Below video/thumbnail', 'youtube-channel' ); ?></option>
|
@@ -296,13 +301,13 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
296 |
</select>
|
297 |
</label>
|
298 |
<br />
|
299 |
-
<label for="<?php echo $this->get_field_id( 'linktitle' ); ?>"
|
300 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $linktitle, true ); ?> id="<?php echo $this->get_field_id( 'linktitle' ); ?>" name="<?php echo $this->get_field_name( 'linktitle' ); ?>" title="<?php _e( 'Enable this option to link outside title to video', 'youtube-channel' ); ?>" />
|
301 |
<?php _e( 'Link outside title to video', 'youtube-channel' ); ?>
|
302 |
</label>
|
303 |
</p>
|
304 |
<p>
|
305 |
-
<label for="<?php echo $this->get_field_id( 'titletag' ); ?>"
|
306 |
<?php _e( 'Title HTML tag', 'youtube-channel' ); ?>
|
307 |
<select class="widefat" id="<?php echo $this->get_field_id( 'titletag' ); ?>" name="<?php echo $this->get_field_name( 'titletag' ); ?>">
|
308 |
<?php
|
@@ -324,12 +329,12 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
324 |
</label>
|
325 |
<br />
|
326 |
<label for="<?php echo $this->get_field_id( 'showdesc' ); ?>">
|
327 |
-
<input class="checkbox" type="checkbox" <?php checked( (bool) $showdesc, true ); ?> id="<?php echo $this->get_field_id( 'showdesc' ); ?>" name="<?php echo $this->get_field_name( 'showdesc' ); ?>" />
|
328 |
<?php _e( 'Show video description', 'youtube-channel' ); ?>
|
329 |
</label>
|
330 |
</p>
|
331 |
<p>
|
332 |
-
<label for="<?php echo $this->get_field_id( 'desclen' ); ?>"
|
333 |
<?php _e( 'Description length', 'youtube-channel' ); ?>
|
334 |
<input class="small-text" id="<?php echo $this->get_field_id( 'desclen' ); ?>" name="<?php echo $this->get_field_name( 'desclen' ); ?>" type="number" value="<?php echo $desclen; ?>" title="<?php _e( 'Set number of characters to cut down video description to (0 means full length)', 'youtube-channel' ); ?>" />
|
335 |
<small>(0 = full)</small>
|
@@ -337,16 +342,10 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
337 |
</p>
|
338 |
|
339 |
<h4><?php _e( 'Link to Channel', 'youtube-channel' ); ?></h4>
|
340 |
-
<p class="glue-top">
|
341 |
-
<label for="<?php echo $this->get_field_id( 'goto_txt' ); ?>">
|
342 |
-
<?php _e( 'Link text', 'youtube-channel' ); ?>
|
343 |
-
<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 sprintf( __( 'Default: Visit our YouTube channel. You can use placeholders %1$s, %2$s and %3$s.', 'youtube-channel' ), '%vanity%', '%channel%', '%username%' ); ?>" placeholder="<?php _e( 'Visit our YouTube channel', 'youtube-channel' ); ?>" />
|
344 |
-
</label>
|
345 |
-
</p>
|
346 |
<p class="half left glue-top">
|
347 |
<label for="<?php echo $this->get_field_id( 'link_to' ); ?>">
|
348 |
<?php _e( 'Link type', 'youtube-channel' ); ?>
|
349 |
-
<select class="widefat" id="<?php echo $this->get_field_id( 'link_to' ); ?>" name="<?php echo $this->get_field_name( 'link_to' ); ?>">
|
350 |
<option value="none"<?php selected( $link_to, 'none' ); ?>><?php _e( 'Hide link', 'youtube-channel' ); ?></option>
|
351 |
<option value="vanity"<?php selected( $link_to, 'vanity' ); ?>><?php _e( 'Link to Vanity customized URL', 'youtube-channel' ); ?></option>
|
352 |
<option value="channel"<?php selected( $link_to, 'channel' ); ?>><?php _e( 'Link to Channel page URL', 'youtube-channel' ); ?></option>
|
@@ -355,7 +354,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
355 |
</label>
|
356 |
</p>
|
357 |
<p class="half right glue-top">
|
358 |
-
<label for="<?php echo $this->get_field_id( 'popup_goto' ); ?>"
|
359 |
<?php _e( 'Link behaviour', 'youtube-channel' ); ?>
|
360 |
<select class="widefat" id="<?php echo $this->get_field_id( 'popup_goto' ); ?>" name="<?php echo $this->get_field_name( 'popup_goto' ); ?>">
|
361 |
<option value="0"<?php selected( $popup_goto, 0 ); ?>><?php _e( 'Open link in same window', 'youtube-channel' ); ?></option>
|
@@ -364,6 +363,12 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
364 |
</select>
|
365 |
</label>
|
366 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
|
368 |
<h4><?php _e( 'Does not work?', 'youtube-channel' ); ?></h4>
|
369 |
<p>
|
@@ -377,15 +382,21 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
377 |
),
|
378 |
array( 'a' => array( 'href' => array() ) )
|
379 |
),
|
380 |
-
'https://wordpress.org/plugins/youtube-channel
|
381 |
__( 'FAQ', 'youtube-channel' ),
|
382 |
"?ytc_debug_json_for={$this->number}",
|
383 |
-
'https://wordpress.org/support/plugin/youtube-channel',
|
384 |
'https://wordpress.org/support/topic/ytc3-read-before-you-post-support-question-or-report-bug'
|
385 |
);
|
386 |
?>
|
387 |
</small>
|
388 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
<?php
|
390 |
} // END public function form()
|
391 |
|
118 |
'Get your %1$s and %2$s from <a href="%3$s" target="_blank">here</a>.',
|
119 |
'youtube-channel'
|
120 |
),
|
121 |
+
[
|
122 |
+
'a' => [
|
123 |
+
'href' => [],
|
124 |
+
'target' => [],
|
125 |
+
],
|
126 |
+
]
|
127 |
),
|
128 |
__( 'Channel ID', 'youtube-channel' ),
|
129 |
__( 'Custom ID', 'youtube-channel' ),
|
158 |
<p class="half left glue-top">
|
159 |
<label for="<?php echo $this->get_field_id( 'resource' ); ?>">
|
160 |
<?php _e( 'Resource to use', 'youtube-channel' ); ?>
|
161 |
+
<select class="widefat" id="<?php echo $this->get_field_id( 'resource' ); ?>" name="<?php echo $this->get_field_name( 'resource' ); ?>" onchange="ytcToggle('resource', '<?php echo $this->get_field_id( '' ); ?>');">
|
162 |
<option value="0"<?php selected( $resource, 0 ); ?>><?php _e( 'Channel (User Uploads)', 'youtube-channel' ); ?></option>
|
163 |
<option value="1"<?php selected( $resource, 1 ); ?>><?php _e( 'Favourites', 'youtube-channel' ); ?></option>
|
164 |
<option value="3"<?php selected( $resource, 3 ); ?>><?php _e( 'Liked Videos', 'youtube-channel' ); ?></option>
|
202 |
<?php printf( __( 'Enable <a href="%s" target="_blank">privacy-enhanced mode</a>', 'youtube-channel' ), 'https://support.google.com/youtube/bin/answer.py?hl=en-GB&answer=171780' ); ?>
|
203 |
</label>
|
204 |
<br />
|
205 |
+
<label for="<?php echo $this->get_field_id( 'random' ); ?>" <?php echo 2 === $resource ? 'class="hidden"' : ''; ?>>
|
206 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $random, true ); ?> id="<?php echo $this->get_field_id( 'random' ); ?>" name="<?php echo $this->get_field_name( 'random' ); ?>" title="<?php _e( 'Get random videos of all fetched from channel or playlist', 'youtube-channel' ); ?>" />
|
207 |
<?php _e( 'Show random video from resource', 'youtube-channel' ); ?>
|
208 |
<br />
|
221 |
</label>
|
222 |
<br />
|
223 |
<label for="<?php echo $this->get_field_id( 'responsive' ); ?>">
|
224 |
+
<input class="checkbox" type="checkbox" <?php checked( (bool) $responsive, true ); ?> id="<?php echo $this->get_field_id( 'responsive' ); ?>" name="<?php echo $this->get_field_name( 'responsive' ); ?>" onchange="ytcToggle('responsive', '<?php echo $this->get_field_id( '' ); ?>');" />
|
225 |
<?php _e( 'Responsive video <small>(distribute one full width item per row)</small>', 'youtube-channel' ); ?>
|
226 |
</label>
|
227 |
</p>
|
228 |
<p>
|
229 |
+
<label for="<?php echo $this->get_field_id( 'width' ); ?>" <?php echo $responsive ? 'class="hidden"' : ''; ?>>
|
230 |
<?php _e( 'Initial width', 'youtube-channel' ); ?>
|
231 |
<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', 'youtube-channel' ); ?>" />
|
232 |
<small>px (<?php _e( 'default', 'youtube-channel' ); ?> 306)</small>
|
235 |
<p>
|
236 |
<label for="<?php echo $this->get_field_id( 'display' ); ?>">
|
237 |
<?php _e( 'What to display?', 'youtube-channel' ); ?>
|
238 |
+
<select class="widefat" id="<?php echo $this->get_field_id( 'display' ); ?>" name="<?php echo $this->get_field_name( 'display' ); ?>" onchange="ytcToggle('display', '<?php echo $this->get_field_id( '' ); ?>');">
|
239 |
<option value="thumbnail"<?php selected( $display, 'thumbnail' ); ?>><?php _e( 'Thumbnail', 'youtube-channel' ); ?></option>
|
240 |
<option value="iframe"<?php selected( $display, 'iframe' ); ?>><?php _e( 'HTML5 (iframe)', 'youtube-channel' ); ?></option>
|
241 |
<option value="iframe2"<?php selected( $display, 'iframe2' ); ?>><?php _e( 'HTML5 (iframe) Asynchronous', 'youtube-channel' ); ?></option>
|
270 |
</label>
|
271 |
</p>
|
272 |
<p>
|
273 |
+
<label for="<?php echo $this->get_field_id( 'thumb_quality' ); ?>" <?php echo 'thumbnail' !== $display ? 'class="hidden"' : ''; ?>>
|
274 |
<?php _e( 'Thumbnail Quality', 'youtube-channel' ); ?>
|
275 |
<select class="widefat" id="<?php echo $this->get_field_id( 'thumb_quality' ); ?>" name="<?php echo $this->get_field_name( 'thumb_quality' ); ?>">
|
276 |
<option value="default"<?php selected( $thumb_quality, 'default' ); ?>><?php _e( 'Default Quality (120x90px)', 'youtube-channel' ); ?></option>
|
282 |
</label>
|
283 |
</p>
|
284 |
<p>
|
285 |
+
<label for="<?php echo $this->get_field_id( 'no_thumb_title' ); ?>" <?php echo 'thumbnail' !== $display ? 'class="hidden"' : ''; ?>>
|
286 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $no_thumb_title, true ); ?> id="<?php echo $this->get_field_id( 'no_thumb_title' ); ?>" name="<?php echo $this->get_field_name( 'no_thumb_title' ); ?>" />
|
287 |
<?php _e( 'Disable thumbnail tooltip', 'youtube-channel' ); ?>
|
288 |
</label>
|
292 |
<p>
|
293 |
<label for="<?php echo $this->get_field_id( 'showtitle' ); ?>">
|
294 |
<?php _e( 'Show video title', 'youtube-channel' ); ?>
|
295 |
+
<select class="widefat" id="<?php echo $this->get_field_id( 'showtitle' ); ?>" name="<?php echo $this->get_field_name( 'showtitle' ); ?>" onchange="ytcToggle('showtitle', '<?php echo $this->get_field_id( '' ); ?>');">
|
296 |
<option value="none"<?php selected( $showtitle, 'none' ); ?>><?php _e( 'Hide title', 'youtube-channel' ); ?></option>
|
297 |
<option value="above"<?php selected( $showtitle, 'above' ); ?>><?php _e( 'Above video/thumbnail', 'youtube-channel' ); ?></option>
|
298 |
<option value="below"<?php selected( $showtitle, 'below' ); ?>><?php _e( 'Below video/thumbnail', 'youtube-channel' ); ?></option>
|
301 |
</select>
|
302 |
</label>
|
303 |
<br />
|
304 |
+
<label for="<?php echo $this->get_field_id( 'linktitle' ); ?>" <?php echo 'none' == $showtitle ? 'class="hidden"' : ''; ?>>
|
305 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $linktitle, true ); ?> id="<?php echo $this->get_field_id( 'linktitle' ); ?>" name="<?php echo $this->get_field_name( 'linktitle' ); ?>" title="<?php _e( 'Enable this option to link outside title to video', 'youtube-channel' ); ?>" />
|
306 |
<?php _e( 'Link outside title to video', 'youtube-channel' ); ?>
|
307 |
</label>
|
308 |
</p>
|
309 |
<p>
|
310 |
+
<label for="<?php echo $this->get_field_id( 'titletag' ); ?>" <?php echo 'none' == $showtitle ? 'class="hidden"' : ''; ?>>
|
311 |
<?php _e( 'Title HTML tag', 'youtube-channel' ); ?>
|
312 |
<select class="widefat" id="<?php echo $this->get_field_id( 'titletag' ); ?>" name="<?php echo $this->get_field_name( 'titletag' ); ?>">
|
313 |
<?php
|
329 |
</label>
|
330 |
<br />
|
331 |
<label for="<?php echo $this->get_field_id( 'showdesc' ); ?>">
|
332 |
+
<input class="checkbox" type="checkbox" <?php checked( (bool) $showdesc, true ); ?> id="<?php echo $this->get_field_id( 'showdesc' ); ?>" name="<?php echo $this->get_field_name( 'showdesc' ); ?>" onchange="ytcToggle('showdesc', '<?php echo $this->get_field_id( '' ); ?>');" />
|
333 |
<?php _e( 'Show video description', 'youtube-channel' ); ?>
|
334 |
</label>
|
335 |
</p>
|
336 |
<p>
|
337 |
+
<label for="<?php echo $this->get_field_id( 'desclen' ); ?>" <?php echo ! $showdesc ? 'class="hidden"' : ''; ?>>
|
338 |
<?php _e( 'Description length', 'youtube-channel' ); ?>
|
339 |
<input class="small-text" id="<?php echo $this->get_field_id( 'desclen' ); ?>" name="<?php echo $this->get_field_name( 'desclen' ); ?>" type="number" value="<?php echo $desclen; ?>" title="<?php _e( 'Set number of characters to cut down video description to (0 means full length)', 'youtube-channel' ); ?>" />
|
340 |
<small>(0 = full)</small>
|
342 |
</p>
|
343 |
|
344 |
<h4><?php _e( 'Link to Channel', 'youtube-channel' ); ?></h4>
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
<p class="half left glue-top">
|
346 |
<label for="<?php echo $this->get_field_id( 'link_to' ); ?>">
|
347 |
<?php _e( 'Link type', 'youtube-channel' ); ?>
|
348 |
+
<select class="widefat" id="<?php echo $this->get_field_id( 'link_to' ); ?>" name="<?php echo $this->get_field_name( 'link_to' ); ?>" onchange="ytcToggle('link_to', '<?php echo $this->get_field_id( '' ); ?>');" >
|
349 |
<option value="none"<?php selected( $link_to, 'none' ); ?>><?php _e( 'Hide link', 'youtube-channel' ); ?></option>
|
350 |
<option value="vanity"<?php selected( $link_to, 'vanity' ); ?>><?php _e( 'Link to Vanity customized URL', 'youtube-channel' ); ?></option>
|
351 |
<option value="channel"<?php selected( $link_to, 'channel' ); ?>><?php _e( 'Link to Channel page URL', 'youtube-channel' ); ?></option>
|
354 |
</label>
|
355 |
</p>
|
356 |
<p class="half right glue-top">
|
357 |
+
<label for="<?php echo $this->get_field_id( 'popup_goto' ); ?>" <?php echo 'none' == $link_to ? 'class="hidden"' : ''; ?>>
|
358 |
<?php _e( 'Link behaviour', 'youtube-channel' ); ?>
|
359 |
<select class="widefat" id="<?php echo $this->get_field_id( 'popup_goto' ); ?>" name="<?php echo $this->get_field_name( 'popup_goto' ); ?>">
|
360 |
<option value="0"<?php selected( $popup_goto, 0 ); ?>><?php _e( 'Open link in same window', 'youtube-channel' ); ?></option>
|
363 |
</select>
|
364 |
</label>
|
365 |
</p>
|
366 |
+
<p class="glue-top">
|
367 |
+
<label for="<?php echo $this->get_field_id( 'goto_txt' ); ?>" <?php echo 'none' == $link_to ? 'class="hidden"' : ''; ?>>
|
368 |
+
<?php _e( 'Link text', 'youtube-channel' ); ?>
|
369 |
+
<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 sprintf( __( 'Default: Visit our YouTube channel. You can use placeholders %1$s, %2$s and %3$s.', 'youtube-channel' ), '%vanity%', '%channel%', '%username%' ); ?>" placeholder="<?php _e( 'Visit our YouTube channel', 'youtube-channel' ); ?>" />
|
370 |
+
</label>
|
371 |
+
</p>
|
372 |
|
373 |
<h4><?php _e( 'Does not work?', 'youtube-channel' ); ?></h4>
|
374 |
<p>
|
382 |
),
|
383 |
array( 'a' => array( 'href' => array() ) )
|
384 |
),
|
385 |
+
'https://wordpress.org/plugins/youtube-channel/#faq',
|
386 |
__( 'FAQ', 'youtube-channel' ),
|
387 |
"?ytc_debug_json_for={$this->number}",
|
388 |
+
'https://wordpress.org/support/plugin/youtube-channel/',
|
389 |
'https://wordpress.org/support/topic/ytc3-read-before-you-post-support-question-or-report-bug'
|
390 |
);
|
391 |
?>
|
392 |
</small>
|
393 |
</p>
|
394 |
+
<?php if ( $this->get_field_id( '' ) > 0 ) : ?>
|
395 |
+
<script>
|
396 |
+
window.ytcWidgets = window.ytcWidgets || [];
|
397 |
+
ytcWidgets.push('<?php echo $this->get_field_id( '' ); ?>');
|
398 |
+
</script>
|
399 |
+
<?php endif; ?>
|
400 |
<?php
|
401 |
} // END public function form()
|
402 |
|
readme.txt
CHANGED
@@ -3,52 +3,48 @@ Contributors: urkekg, techwebux
|
|
3 |
Donate link: https://urosevic.net/wordpress/donate/?donate_for=youtube-channel
|
4 |
Tags: youtube, channel, playlist, widget, video
|
5 |
Requires at least: 4.9
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 3.0.12
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
12 |
-
Show video thumbnails or playable
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
-
|
17 |
|
18 |
-
|
19 |
|
20 |
-
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
For manual set of videos from YouTube check out [Easy YouTube Gallery](https://wordpress.org/plugins/easy-youtube-gallery/).
|
25 |
|
26 |
= Features =
|
27 |
|
28 |
-
*
|
29 |
-
* Option to get random video from any of 4 resources
|
30 |
-
* Responsive (one full
|
31 |
* Preferred aspect ratio relative to width (16:9 and 4:3)
|
32 |
* Custom width for video embeded object (default is 306px)
|
33 |
-
*
|
34 |
-
*
|
35 |
-
*
|
36 |
* Hide or show video title above/below video wrapped to HTML tag by your choice (h3, h4, h5, span or div)
|
37 |
* Custom feed caching timeout
|
38 |
* Optional video autoplay with optional muted audio
|
39 |
-
* (Optional) *TinyMCE button* on post/page edit (can be disabled on General plugin settings page), which open shortcode GUI generator to help you build shortcode
|
40 |
-
* Show
|
41 |
-
* Final look is highly
|
42 |
|
43 |
= Requirements =
|
44 |
|
45 |
-
For fully functional plugin
|
46 |
-
|
47 |
-
If you have an old version of WordPress bundled with jQuery library older than v1.7, some aspects of plugin may not work, as we do not reinclude jQuery library.
|
48 |
|
49 |
= Styling =
|
50 |
|
51 |
-
|
52 |
|
53 |
* `.widget_youtube-channel` – class of whole widget (parent for widget title and YTC block)
|
54 |
* `.youtube_channel` – YTC block wrapper class. Additional classes are available:
|
@@ -73,24 +69,21 @@ You can use `style.css` from theme or other custom location to additionaly style
|
|
73 |
|
74 |
= Known Issues =
|
75 |
|
76 |
-
* Video title and description for embedded playlist mode
|
77 |
-
* Removing YouTube logo from playback control bar does not work for all videos
|
78 |
-
* Async HTML5 video does not work for 2nd same video on same page (two YTC blocks set to Async HTML5)
|
79 |
|
80 |
-
If WordFence or other malware scan tool detect YouTube Channel
|
81 |
|
82 |
= Credits =
|
83 |
|
84 |
-
* For playing videos in lightbox we use enhanced [Magnific Popup](
|
85 |
-
* Initial textdomain adds done by [dimadin](
|
86 |
-
*
|
87 |
-
* Czech localization by [Ladislav Drábek](http://zholesova.cz)
|
88 |
-
* Spanish localization by [Diego Riaño](http://Digital03.net)
|
89 |
-
* Danish localisation by [GSAdev v. Georg Adamsen](http://www.gsadev.dk)
|
90 |
|
91 |
= Shortcode =
|
92 |
|
93 |
-
Along
|
94 |
|
95 |
**General Settings**
|
96 |
|
@@ -171,6 +164,7 @@ Along to Widget, you can add YouTube Channel block inline by using shortcode `[y
|
|
171 |
You can modify final output of video block by hooking to filter `ytc_print_video`.
|
172 |
|
173 |
Four parameters are provided:
|
|
|
174 |
* `video_content` - HTML of original video block
|
175 |
* `item` - YouTube video object which contains:
|
176 |
* `snippet->publishedAt` - date of publishing YouTube video
|
@@ -219,46 +213,47 @@ Four parameters are provided:
|
|
219 |
* `y` - order number of video (`1` for first, `2` for second, etc)
|
220 |
|
221 |
Example:
|
|
|
222 |
`add_filter( 'ytc_print_video', 'customized_ytc_print_video', 10, 4 );
|
223 |
function customized_ytc_print_video( $video_block, $item, $instance, $y ) {
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
}`
|
228 |
|
229 |
== Installation ==
|
230 |
|
231 |
-
|
232 |
|
233 |
-
1.
|
234 |
-
1. Activate the plugin
|
235 |
-
1.
|
236 |
-
1.
|
|
|
237 |
|
238 |
-
If you have to upgrade manually
|
239 |
|
240 |
= YouTube Data API Key =
|
241 |
-
|
242 |
-
|
243 |
-
Learn more about [Obtaining authorization credentials](https://developers.google.com/youtube/registering_an_application) and for detailed instructions how to generate your own API Key
|
244 |
-
|
245 |
-
[
|
246 |
-
|
247 |
-
1.
|
248 |
-
1.
|
249 |
-
1.
|
250 |
-
1.
|
251 |
-
1.
|
252 |
-
1.
|
253 |
-
1.
|
254 |
-
1.
|
255 |
-
1.
|
256 |
-
1.
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
You can get **Channel ID** from page [Account Advanced](https://www.youtube.com/account_advanced) while you're loagged in to your YouTube account.
|
262 |
|
263 |
[youtube http://www.youtube.com/watch?v=wOqkfkNhOUE]
|
264 |
|
@@ -268,32 +263,30 @@ You can get **Channel ID** from page [Account Advanced](https://www.youtube.com/
|
|
268 |
|
269 |
== Frequently Asked Questions ==
|
270 |
|
271 |
-
Please note, latest FAQ you can find [on our website](http://urosevic.net/wordpress/plugins/youtube-channel/faq/). This section on WordPress.org has been updated only on plugin version release, so questions answered between releases are not visible here.
|
272 |
-
|
273 |
= How to get that YouTube Data API Key? =
|
274 |
|
275 |
-
Please folllow [Installation](https://wordpress.org/plugins/youtube-channel
|
276 |
|
277 |
-
=
|
278 |
|
279 |
-
|
280 |
|
281 |
-
If
|
282 |
|
283 |
-
Upload
|
284 |
|
285 |
-
= I set everything correct but
|
286 |
|
287 |
-
|
288 |
|
289 |
-
> **YTC ERROR:** Please check did you set proper Channel ID. You
|
290 |
|
291 |
-
Do
|
292 |
|
293 |
-
> **YTC ERROR** Check YouTube Data API Key restrictions, empty cache if enabled by appending in browser address bar parameter ?ytc_force_recache=1
|
294 |
|
295 |
-
1. Try to remove restrictions by referer or IP in your **YouTube Data API Key** and refresh page after couple minutes.
|
296 |
-
1. If that does not help, please try to create new API Key for Server w/o restrictions (not to regenerate existing one).
|
297 |
|
298 |
= How to use Google APIs Explorer to verify YouTube feeds? =
|
299 |
|
@@ -307,16 +300,16 @@ If there is no `YTC ERROR` code in HTML source, visit [Google API Explorer](http
|
|
307 |
Note that all four resources are *playlists* (including uploads to channel), so append mentioned ID to field **playlistId** (not to **id**), and click **Execute** button at the bottom of that page.
|
308 |
|
309 |
1. If you receive some error in results, tune parameters in APIs Explorer.
|
310 |
-
1. If there is no error
|
311 |
-
1. If there are video results but not displayed with YouTube Channel plugin – check topic [Read before you post support question or report bug](https://wordpress.org/support/topic/ytc3-read-before-you-post-support-question-or-report-bug) and then [start
|
312 |
|
313 |
= What this YTC ERROR/HTTP Error means? =
|
314 |
|
315 |
-
You will be able to reproduce HTTP Error w/o WordPress if you have SSH access to server
|
316 |
|
317 |
`curl https://www.googleapis.com/youtube/v3/playlistItems`
|
318 |
|
319 |
-
|
320 |
|
321 |
`{
|
322 |
"error": {
|
@@ -338,27 +331,27 @@ Known HTTP Errors:
|
|
338 |
|
339 |
**error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm**
|
340 |
|
341 |
-
|
342 |
|
343 |
-
Please contact your server
|
344 |
|
345 |
**Problem with the SSL CA cert (path? access rights?)**
|
346 |
|
347 |
-
|
348 |
|
349 |
-
|
350 |
|
351 |
-
= Where to find correct Channel ID and
|
352 |
|
353 |
Login to your YouTube account and visit page [Account Advanced](https://www.youtube.com/account_advanced).
|
354 |
|
355 |
-
|
356 |
|
357 |
**Channel ID** is **YouTube Channel ID** value composed of mixed characters starting with **UC**.
|
358 |
|
359 |
-
= Where
|
360 |
|
361 |
-
|
362 |
|
363 |
* For Favourites ID replace **UC** with **FL** (so you get `FLRPqmcpGcJ_gFtTmN_a4aVA`)
|
364 |
* For Liked Videos ID replace **UC** with **LL** (so you get `LLRPqmcpGcJ_gFtTmN_a4aVA`)
|
@@ -369,34 +362,38 @@ Check out [Channel custom URL](https://support.google.com/youtube/answer/2657968
|
|
369 |
|
370 |
= Where to find Playlist ID? =
|
371 |
|
372 |
-
Playlist ID
|
|
|
|
|
373 |
|
374 |
= Video titles missing after plugin update =
|
375 |
|
376 |
-
If you
|
377 |
|
378 |
-
|
379 |
|
380 |
-
|
381 |
-
1. Remove `showtitle` parameter from shortcode and set **Show title** global plugin option on **Content** tab, or
|
382 |
1. Change parameter `showtitle` to `above` or `below`.
|
383 |
|
384 |
-
= How to force
|
|
|
|
|
385 |
|
386 |
-
|
387 |
|
388 |
-
|
389 |
|
390 |
-
|
391 |
|
392 |
-
|
393 |
|
394 |
-
|
395 |
|
396 |
-
You can try with shortcode combination:
|
397 |
`[youtube_channel num=7 responsive=1 class=ytc_wall_1-6 resource=2 random=1]`
|
398 |
|
399 |
-
|
|
|
400 |
`.youtube_channel.ytc_wall_1-6 .ytc_video_container {
|
401 |
padding: 5px;
|
402 |
box-sizing: border-box;
|
@@ -416,20 +413,21 @@ and custom CSS code added to theme style.css or similar customization:
|
|
416 |
}
|
417 |
}`
|
418 |
|
419 |
-
|
|
|
|
|
420 |
|
421 |
-
|
422 |
|
423 |
-
|
424 |
|
425 |
-
|
426 |
|
427 |
-
Since v3.0.8 we changed how thumnail Play button is embedded. If you wish to reduce button size, tune transform CSS property in theme's style.css, like this:
|
428 |
`.youtube_channel .ytc_thumb>span:before {
|
429 |
transform: scale(.65);
|
430 |
}`
|
431 |
|
432 |
-
|
433 |
|
434 |
`.youtube_channel .ytc_thumb>span:before {
|
435 |
display: none !important;
|
@@ -437,12 +435,20 @@ If you wish to remove (hide) play button from thumbnails, simply set display pro
|
|
437 |
|
438 |
= Your plugin does not support *THIS* or *THAT* =
|
439 |
|
440 |
-
|
|
|
441 |
|
442 |
-
If you
|
443 |
|
444 |
== Changelog ==
|
445 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
= 3.0.12 (20201107) =
|
447 |
* Add: link video title to YouTube playback page opened in new tab/window
|
448 |
* Cleanup: remove deprecated parameters `theme` (`themelight`), `showinfo` (`noinfo`, `hideinfo`)
|
@@ -459,7 +465,7 @@ If you don't wish to pay for enhancements (then you don't care would that be imp
|
|
459 |
* Add: Global option `js_ev_listener` to enable Event Listener DOMContentLoaded
|
460 |
* (20180826) Add: Override video block template by 3rd party theme or plugin with filter `ytc_print_video`
|
461 |
* Add: Customizable timeout for wp_remote_get()
|
462 |
-
*
|
463 |
|
464 |
= 3.0.11.6 (20180826) =
|
465 |
* Add compatibility with async/defer optimization (thanks to @lordbass)
|
3 |
Donate link: https://urosevic.net/wordpress/donate/?donate_for=youtube-channel
|
4 |
Tags: youtube, channel, playlist, widget, video
|
5 |
Requires at least: 4.9
|
6 |
+
Tested up to: 5.6.2
|
7 |
+
Stable tag: 3.0.12.1
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
12 |
+
Show video thumbnails or playable video block of recent YouTube Playlist, Channel (User Uploads), Liked or Favourited videos.
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
+
Add **YouTube Channel** widget to the widget area or shortcode to post/page content, set **Channel ID** or **Playlist ID**, chose resource to use and keep defaults for all other options. And voila! You will get the latest video from chosen YouTube channel or playlist.
|
17 |
|
18 |
+
**IMPORTANT** YouTube Channel does not support **Live Streams** and does not have Gutenberg Block. Use **Shortcode Block** or **Classic Block** to insert shortcode to page/post content.
|
19 |
|
20 |
+
If you like our plugin and find it useful, please [write a review and rate it](https://wordpress.org/support/view/plugin-reviews/youtube-channel).
|
21 |
|
22 |
+
For a manually picked set of videos from YouTube, check out [Easy YouTube Gallery](https://wordpress.org/plugins/easy-youtube-gallery/).
|
|
|
|
|
23 |
|
24 |
= Features =
|
25 |
|
26 |
+
* Show latest videos from YouTube Channel (ordered in reverse chronological order related to the creation date), or from Favorited Videos, Liked Videos and Playlist
|
27 |
+
* Option to get a random video from any of 4 resources
|
28 |
+
* Responsive (one full-width video per row) or non-responsive
|
29 |
* Preferred aspect ratio relative to width (16:9 and 4:3)
|
30 |
* Custom width for video embeded object (default is 306px)
|
31 |
+
* Three modes to display video: **thumbnail** (`default`), **HTML5** (`iframe`) and **HTML5 Asynchronous** (`iframe2`)
|
32 |
+
* Thumbnail mode opens the video in lightbox
|
33 |
+
* Enhanced Privacy - please note that display mode **HTML5 (IFRAME) Asynchronous** (shortcode parameter `iframe2`) does not support Enhanced Privacy due to YouTube API limitations
|
34 |
* Hide or show video title above/below video wrapped to HTML tag by your choice (h3, h4, h5, span or div)
|
35 |
* Custom feed caching timeout
|
36 |
* Optional video autoplay with optional muted audio
|
37 |
+
* (Optional) *TinyMCE button* on post/page edit (can be disabled on General plugin settings page), which open a shortcode GUI generator to help you build a shortcode
|
38 |
+
* Show link to channel/vanity/legacy username below videos
|
39 |
+
* Final look is highly customisable thanks to classes for each element of YTC block!
|
40 |
|
41 |
= Requirements =
|
42 |
|
43 |
+
For a fully functional plugin, PHP 5.6 or newer has required! If you use older PHP, we highly recommend you request from your developer, server support or hosting company to update PHP to a secure version.
|
|
|
|
|
44 |
|
45 |
= Styling =
|
46 |
|
47 |
+
Use Customizer, `style.css` from the child theme or [Head & Footer Code](https://wordpress.org/plugins/head-footer-code/) plugin to custom style and tweak the look and feel of the YouTube Channel blocks. You can utilise the following classes:
|
48 |
|
49 |
* `.widget_youtube-channel` – class of whole widget (parent for widget title and YTC block)
|
50 |
* `.youtube_channel` – YTC block wrapper class. Additional classes are available:
|
69 |
|
70 |
= Known Issues =
|
71 |
|
72 |
+
* Video title and description for embedded playlist mode do not work.
|
73 |
+
* Removing the YouTube logo from the playback control bar does not work for all videos.
|
74 |
+
* Async HTML5 video does not work for 2nd same video on the same page (two YTC blocks set to Async HTML5)
|
75 |
|
76 |
+
If WordFence or other malware scan tool detect YouTube Channel file `youtube-channel.php` as a potential risk because `base64_encode()` and `base64_decode()` functions, remember that we use this two functions to store and restore JSON feeds to transient cache, so potential detection is false positive.
|
77 |
|
78 |
= Credits =
|
79 |
|
80 |
+
* For playing videos in lightbox we use enhanced [Magnific Popup](https://github.com/dimsemenov/Magnific-Popup).
|
81 |
+
* Initial textdomain adds done by [dimadin](https://profiles.wordpress.org/dimadin/).
|
82 |
+
* Federico Bozo reminded me to fix z-index problem
|
|
|
|
|
|
|
83 |
|
84 |
= Shortcode =
|
85 |
|
86 |
+
Along with Widget, you can add YouTube Channel block inline by using shortcode `[youtube_channel]`. Default plugin parameters will be used for shortcode, but you can customize all parameters per shortcode.
|
87 |
|
88 |
**General Settings**
|
89 |
|
164 |
You can modify final output of video block by hooking to filter `ytc_print_video`.
|
165 |
|
166 |
Four parameters are provided:
|
167 |
+
|
168 |
* `video_content` - HTML of original video block
|
169 |
* `item` - YouTube video object which contains:
|
170 |
* `snippet->publishedAt` - date of publishing YouTube video
|
213 |
* `y` - order number of video (`1` for first, `2` for second, etc)
|
214 |
|
215 |
Example:
|
216 |
+
|
217 |
`add_filter( 'ytc_print_video', 'customized_ytc_print_video', 10, 4 );
|
218 |
function customized_ytc_print_video( $video_block, $item, $instance, $y ) {
|
219 |
+
// Do whatever you wish to do
|
220 |
+
// ...
|
221 |
+
return $video_block;
|
222 |
}`
|
223 |
|
224 |
== Installation ==
|
225 |
|
226 |
+
Use **Plugins / Add New** in WordPress or install the plugin manually:
|
227 |
|
228 |
+
1. With your FTP program (eg. FileZilla) upload content of unzipped `youtube-channel` directory to the `wp-content/plugins/` directory on the server.
|
229 |
+
1. Activate the plugin on the **Plugins / Installed Plugins** page in WordPress
|
230 |
+
1. Enter **YouTube Data API Key** on **Settings / YouTube Channel** page.
|
231 |
+
1. Add **YouTube Channel** widget to the sidebar
|
232 |
+
1. Set **Channel ID** in plugin settings, widget or shortcode
|
233 |
|
234 |
+
If you have to upgrade manually, repeat the installation steps and re-enable the plugin.
|
235 |
|
236 |
= YouTube Data API Key =
|
237 |
+
To make YouTube Channel work you have to generate [YouTube Data API Key v3](https://developers.google.com/youtube/v3/getting-started) and insert it to General plugin settings.
|
238 |
+
|
239 |
+
Learn more about [Obtaining authorization credentials](https://developers.google.com/youtube/registering_an_application) and for detailed instructions on how to generate your own API Key follow instructions below.
|
240 |
+
|
241 |
+
1. Visit [Google Cloud Platform](https://console.cloud.google.com/cloud-resource-manager).
|
242 |
+
1. If you don't have any project, create a new one (click on **CREATE PROJECT**). Set the **Project name** so you can recognize it later (for example **My WordPress Website**). Then click the **CREATE** button and wait until Google create the project.
|
243 |
+
1. On the popup click **SELECT PROJECT** and in the left-hand side menu go to **APIs & Services** -> **Dashboard**, then click **ENABLE APIS AND SERVICES**
|
244 |
+
1. Search for **YouTube Data API v3** and click on it, then click the **ENABLE** button.
|
245 |
+
1. Click the **Credentials** item from the left-hand side menu.
|
246 |
+
1. From the **CREATE CREDENTIALS** drop-down menu select **API key**
|
247 |
+
1. As soon as the API key gets created, click the **RESTRICT KEY** button
|
248 |
+
1. Define recognizable key **Name** (eg. YouTube API key for my website)
|
249 |
+
1. Choose **Application restrictions** -> **IP addresses (web servers, cron jobs, etc.)** -> click **ADD AN ITEM** -> enter server IP (make sure you enter proper IP or you'll get **Oops, something went wrong.** error message).
|
250 |
+
1. Choose **API restrictions** -> **Restrict key** -> click **Select APIs** -> chose option **YouTube Data API v3**
|
251 |
+
1. When you finish, **SAVE** changes
|
252 |
+
1. On **API keys** table click **Copy API key** icon
|
253 |
+
1. In WordPress go to **Settings** -> **YouTube Channel** -> **General** and paster API key in to field **YouTube Data API Key**.
|
254 |
+
|
255 |
+
Also, do not forget to check and update **Channel ID** in the plugin's General settings, Widgets and/or shortcodes.
|
256 |
+
You can get **Channel ID** from the page [Account Advanced](https://www.youtube.com/account_advanced) while you're logged in to your YouTube account.
|
|
|
257 |
|
258 |
[youtube http://www.youtube.com/watch?v=wOqkfkNhOUE]
|
259 |
|
263 |
|
264 |
== Frequently Asked Questions ==
|
265 |
|
|
|
|
|
266 |
= How to get that YouTube Data API Key? =
|
267 |
|
268 |
+
Please folllow [Installation](https://wordpress.org/plugins/youtube-channel/#installation) instructions.
|
269 |
|
270 |
+
= The plugin does not work with a premium theme or clash with another premium plugin =
|
271 |
|
272 |
+
We cannot afford licenses for various premium themes and plugins to keep the fee plugin YouTube Channel working with each of them.
|
273 |
|
274 |
+
If YouTube Channel clash with a premium theme or plugin, we can help you only if you help us. Ask theme/plugin author for approval to provide a package to us for debugging on local development domain `youtube-channel.wp`.
|
275 |
|
276 |
+
Upload the installation package to your cloud drive (Dropbox, One Drive, Google Drive, iCloud, WeTransfer or other) and provide a share link to us by [contact form](https://urosevic.net/wordpress/contact/?subject=YouTube%20Channel).
|
277 |
|
278 |
+
= I set everything correct but receiving 'Oops, something went wrong' message =
|
279 |
|
280 |
+
As a logged-in administrator, you will see an error explanation. Known issues:
|
281 |
|
282 |
+
> **YTC ERROR:** Please check did you set the proper Channel ID. You choose to show videos from the channel, but YouTube does not recognize MyCoolLegacyName as an existing or public channel.
|
283 |
|
284 |
+
Do what the message says - check and correct Channel ID in default settings/widget/shortcode.
|
285 |
|
286 |
+
> **YTC ERROR** Check YouTube Data API Key restrictions, empty cache if enabled by appending in the browser address bar parameter ?ytc_force_recache=1
|
287 |
|
288 |
+
1. Try to remove restrictions by referer or IP in your **YouTube Data API Key** and refresh the page after a couple of minutes.
|
289 |
+
1. If that does not help, please try to create a new API Key for Server w/o restrictions (not to regenerate the existing one).
|
290 |
|
291 |
= How to use Google APIs Explorer to verify YouTube feeds? =
|
292 |
|
300 |
Note that all four resources are *playlists* (including uploads to channel), so append mentioned ID to field **playlistId** (not to **id**), and click **Execute** button at the bottom of that page.
|
301 |
|
302 |
1. If you receive some error in results, tune parameters in APIs Explorer.
|
303 |
+
1. If there is no error while the response is empty, and you are sure that there are public videos in selected resource – contact Google Support.
|
304 |
+
1. If there are video results but not displayed with YouTube Channel plugin – check topic [Read before you post support question or report a bug](https://wordpress.org/support/topic/ytc3-read-before-you-post-support-question-or-report-bug) and then [start new support topic](https://wordpress.org/support/plugin/youtube-channel/#new-topic-0).
|
305 |
|
306 |
= What this YTC ERROR/HTTP Error means? =
|
307 |
|
308 |
+
You will be able to reproduce HTTP Error w/o WordPress if you have SSH access to the server hosting your website. Log in to shell and run the following command (or ask your developer to do so):
|
309 |
|
310 |
`curl https://www.googleapis.com/youtube/v3/playlistItems`
|
311 |
|
312 |
+
You will get an HTTP Error from the curl command or response like the one below.
|
313 |
|
314 |
`{
|
315 |
"error": {
|
331 |
|
332 |
**error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm**
|
333 |
|
334 |
+
Server tool curl has built with an older version of OpenSSL that does not support certificates signed with sha256-With-RSA-Encryption. It requires at least OpenSSL 0.9.8o for the total management of SHA256.
|
335 |
|
336 |
+
Please contact your server administrator or hosting provider to help you with this issue.
|
337 |
|
338 |
**Problem with the SSL CA cert (path? access rights?)**
|
339 |
|
340 |
+
Yet another server issue, not related to YouTube Channel nor WordPress.
|
341 |
|
342 |
+
Please restart Apache (or Nginx) server. If that does not fix the issue, restart the entire server. Or contact server support to help.
|
343 |
|
344 |
+
= Where to find correct Channel ID and Vanity custom Name? =
|
345 |
|
346 |
Login to your YouTube account and visit page [Account Advanced](https://www.youtube.com/account_advanced).
|
347 |
|
348 |
+
**Vanity Name** is "Your custom URL" in the **Channel settings** section on the page above. Use part **after www.youtube.com/c/**, not the full URL for the YouTube Channel plugin.
|
349 |
|
350 |
**Channel ID** is **YouTube Channel ID** value composed of mixed characters starting with **UC**.
|
351 |
|
352 |
+
= Where I can find an ID for Favourites or Liked Videos? =
|
353 |
|
354 |
+
These two IDs' are composed of your **Channel ID**. Channel ID start with **UC** (like `UCRPqmcpGcJ_gFtTmN_a4aVA`)
|
355 |
|
356 |
* For Favourites ID replace **UC** with **FL** (so you get `FLRPqmcpGcJ_gFtTmN_a4aVA`)
|
357 |
* For Liked Videos ID replace **UC** with **LL** (so you get `LLRPqmcpGcJ_gFtTmN_a4aVA`)
|
362 |
|
363 |
= Where to find Playlist ID? =
|
364 |
|
365 |
+
Manually extract Playlist ID from YouTube playlist URL. Find string after `&list=` parameter in URL.
|
366 |
+
Playlist ID can contain lowercase and uppercase letters, dash and underscore characters.
|
367 |
+
Regular playlists starts with uppercase letters **PL** (like *PLEC850BE962234400*), while Playlist ID for YouTube mixes start with uppercase **RD** (eg. *RDCfMMlT8Lyns*).
|
368 |
|
369 |
= Video titles missing after plugin update =
|
370 |
|
371 |
+
If you entered shortcode before version 3.0.8, you could have set the parameter `showtitle=1`.
|
372 |
|
373 |
+
This parameter now accepts different values: `none`, `above` and `below`, depending do you wish to hide the video title or to show it above/below the video thumbnail.
|
374 |
|
375 |
+
You can do the following:
|
376 |
+
1. Remove the `showtitle` parameter from the shortcode and set **Show title** global plugin option on **Content** tab, or
|
377 |
1. Change parameter `showtitle` to `above` or `below`.
|
378 |
|
379 |
+
= How to force embedding 320p video with better audio quality? =
|
380 |
+
|
381 |
+
YouTube provide 320p videos if the height of the embedded video is 320 or more. If you use a small YTC video size, 240p will be loaded instead. It's not possible to force 720p in tiny YTC.
|
382 |
|
383 |
+
= I enabled option `Hide YT Logo` and YouTube logo is still visible =
|
384 |
|
385 |
+
The modestbranding option does not work for all videos. A lot of videos still have the YouTube logo in the control bar. We recommend enabling the option `Hide player controls` instead.
|
386 |
|
387 |
+
The logo appears in the upper right corner on hover or when the video pauses. [Read more here](https://developers.google.com/youtube/player_parameters#modestbranding)
|
388 |
|
389 |
+
= How I can achieve a 'wall' layout with one featured thumbnail? =
|
390 |
|
391 |
+
Start with following shortcode combination:
|
392 |
|
|
|
393 |
`[youtube_channel num=7 responsive=1 class=ytc_wall_1-6 resource=2 random=1]`
|
394 |
|
395 |
+
Then add custom CSS code to Customizer, or child theme **style.css** or to [Head & Footer Code](https://wordpress.org/plugins/head-footer-code/) plugin:
|
396 |
+
|
397 |
`.youtube_channel.ytc_wall_1-6 .ytc_video_container {
|
398 |
padding: 5px;
|
399 |
box-sizing: border-box;
|
413 |
}
|
414 |
}`
|
415 |
|
416 |
+
That will show thumbnails for seven random videos from the default playlist defined in plugin settings: one full-width thumbnail and six remaining thumbnails distributed to 3 columns on wide screens, two columns under 768px and a single thumbnail per row under 480px.
|
417 |
+
|
418 |
+
= How I can add pagination (to Dynamic Wall view)? =
|
419 |
|
420 |
+
YouTube Channel does not support pagination.
|
421 |
|
422 |
+
= How to reduce the size thumbnail Play button or remove it? =
|
423 |
|
424 |
+
Resize thumbnail play button by adding following custom CSS to Customizer, or child theme **style.css** or to [Head & Footer Code](https://wordpress.org/plugins/head-footer-code/) plugin:
|
425 |
|
|
|
426 |
`.youtube_channel .ytc_thumb>span:before {
|
427 |
transform: scale(.65);
|
428 |
}`
|
429 |
|
430 |
+
To remove (hide) thumbnail play button, use following custom CSS:
|
431 |
|
432 |
`.youtube_channel .ytc_thumb>span:before {
|
433 |
display: none !important;
|
435 |
|
436 |
= Your plugin does not support *THIS* or *THAT* =
|
437 |
|
438 |
+
Feel free to submit a feature request by creating a new topic on [Community forum](https://wordpress.org/support/plugin/youtube-channel/). Make sure to prefix *Topic Title* with **[Feature Request] ...**
|
439 |
+
Please note, we cannot guarantee an ETA to implement the requested feature.
|
440 |
|
441 |
+
If you are in a hurry, please find a developer to do it for you or [request a quote from us](https://urosevic.net/wordpress/contact/?subject=YouTube%20Channel).
|
442 |
|
443 |
== Changelog ==
|
444 |
|
445 |
+
= 3.0.12.1 (20210227) =
|
446 |
+
* Tested: WordPress 5.6.2 on PHP 7.4.15 and 8.0.2
|
447 |
+
* Add: compatibility with PHP 8
|
448 |
+
* Add: conditionally hide not applicable options in widget settings form
|
449 |
+
* Change: Lowest supported PHP version increased to 5.6
|
450 |
+
* Improve: Readme, Installation (Step-by-Step instructions for obtaining YouTube Data API Key v3), FAQ
|
451 |
+
|
452 |
= 3.0.12 (20201107) =
|
453 |
* Add: link video title to YouTube playback page opened in new tab/window
|
454 |
* Cleanup: remove deprecated parameters `theme` (`themelight`), `showinfo` (`noinfo`, `hideinfo`)
|
465 |
* Add: Global option `js_ev_listener` to enable Event Listener DOMContentLoaded
|
466 |
* (20180826) Add: Override video block template by 3rd party theme or plugin with filter `ytc_print_video`
|
467 |
* Add: Customizable timeout for wp_remote_get()
|
468 |
+
* Improve: Disable LastPass altering settings fields
|
469 |
|
470 |
= 3.0.11.6 (20180826) =
|
471 |
* Add compatibility with async/defer optimization (thanks to @lordbass)
|
update.php
CHANGED
@@ -216,9 +216,7 @@ function au_youtube_channel_update_routine_3() {
|
|
216 |
unset( $ytc_widgets[ $widget_id ][ $key ] );
|
217 |
}
|
218 |
} // END foreach ( $widget_data as $key => $val )
|
219 |
-
|
220 |
} // END if ( $widget_id != '_multiwidget' )
|
221 |
-
|
222 |
}
|
223 |
update_option( 'widget_youtube-channel', $ytc_widgets );
|
224 |
unset( $options_matrix, $init, $ytc_widgets, $widget_id, $widget_data );
|
@@ -387,7 +385,6 @@ function au_youtube_channel_update_routine_11() {
|
|
387 |
}
|
388 |
}
|
389 |
} // END if ( $widget_id != '_multiwidget' )
|
390 |
-
|
391 |
} // END foreach ( $ytc_widgets as $widget_id => $widget_data )
|
392 |
|
393 |
update_option( 'widget_youtube-channel', $ytc_widgets );
|
216 |
unset( $ytc_widgets[ $widget_id ][ $key ] );
|
217 |
}
|
218 |
} // END foreach ( $widget_data as $key => $val )
|
|
|
219 |
} // END if ( $widget_id != '_multiwidget' )
|
|
|
220 |
}
|
221 |
update_option( 'widget_youtube-channel', $ytc_widgets );
|
222 |
unset( $options_matrix, $init, $ytc_widgets, $widget_id, $widget_data );
|
385 |
}
|
386 |
}
|
387 |
} // END if ( $widget_id != '_multiwidget' )
|
|
|
388 |
} // END foreach ( $ytc_widgets as $widget_id => $widget_data )
|
389 |
|
390 |
update_option( 'widget_youtube-channel', $ytc_widgets );
|
youtube-channel.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: YouTube Channel
|
4 |
* Plugin URI: https://urosevic.net/wordpress/plugins/youtube-channel/
|
5 |
* Description: Quick and easy embed latest or random videos from YouTube channel (user uploads, liked or favourited videos) or playlist. Use <a href="widgets.php">widget</a> for sidebar or shortcode for content. Works with <em>YouTube Data API v3</em>.
|
6 |
-
* Version: 3.0.12
|
7 |
* Author: Aleksandar Urošević
|
8 |
* Author URI: https://urosevic.net/
|
9 |
* License: GPLv3
|
@@ -20,7 +20,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
20 |
class WPAU_YOUTUBE_CHANNEL {
|
21 |
|
22 |
const DB_VER = 23;
|
23 |
-
const VER = '3.0.12';
|
24 |
|
25 |
public $plugin_name = 'YouTube Channel';
|
26 |
public $plugin_slug = 'youtube-channel';
|
@@ -43,36 +43,36 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
43 |
}
|
44 |
|
45 |
// Clear all YTC cache
|
46 |
-
add_action( 'wp_ajax_ytc_clear_all_cache',
|
47 |
|
48 |
// Activation hook and maybe update trigger
|
49 |
-
register_activation_hook( __FILE__,
|
50 |
-
add_action( 'plugins_loaded',
|
51 |
|
52 |
$this->defaults = self::defaults();
|
53 |
|
54 |
// TinyMCE AddOn
|
55 |
if ( ! empty( $this->defaults['tinymce'] ) ) {
|
56 |
-
add_filter( 'mce_external_plugins',
|
57 |
-
add_filter( 'mce_buttons',
|
58 |
}
|
59 |
|
60 |
if ( is_admin() ) {
|
61 |
|
62 |
// Initialize Plugin Settings Magic
|
63 |
-
add_action( 'init',
|
64 |
|
65 |
// Add various Dashboard notices (if needed)
|
66 |
-
add_action( 'admin_notices',
|
67 |
|
68 |
// Enqueue scripts and styles for Widgets page
|
69 |
-
add_action( 'admin_enqueue_scripts',
|
70 |
|
71 |
} else { // ELSE if ( is_admin() )
|
72 |
|
73 |
// Enqueue frontend scripts
|
74 |
-
add_action( 'wp_enqueue_scripts',
|
75 |
-
add_action( 'wp_footer',
|
76 |
|
77 |
} // END if ( is_admin() )
|
78 |
|
@@ -80,8 +80,8 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
80 |
require_once( 'inc/widget.php' );
|
81 |
|
82 |
// Register shortcodes `youtube_channel` and `ytc`
|
83 |
-
add_shortcode( 'youtube_channel',
|
84 |
-
add_shortcode( 'ytc',
|
85 |
|
86 |
} // END function __construct()
|
87 |
|
@@ -103,7 +103,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
103 |
*/
|
104 |
public function init_options() {
|
105 |
|
106 |
-
$init =
|
107 |
'vanity' => '', // $this->vanity_id,
|
108 |
'channel' => '', // $this->channel_id,
|
109 |
'username' => '', // $this->username_id,
|
@@ -142,7 +142,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
142 |
'timeout' => 5, // timeout for wp_remote_get()
|
143 |
'sslverify' => true,
|
144 |
'js_ev_listener' => false,
|
145 |
-
|
146 |
|
147 |
add_option( 'youtube_channel_version', self::VER, '', 'no' );
|
148 |
add_option( 'youtube_channel_db_ver', self::DB_VER, '', 'no' );
|
@@ -172,9 +172,9 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
172 |
*/
|
173 |
function admin_init() {
|
174 |
|
175 |
-
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ),
|
176 |
// Add row on Plugins page
|
177 |
-
add_filter( 'plugin_row_meta',
|
178 |
|
179 |
require_once( 'inc/settings.php' );
|
180 |
|
@@ -211,12 +211,12 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
211 |
if ( 'youtube-channel/youtube-channel.php' === $file ) {
|
212 |
return array_merge(
|
213 |
$links,
|
214 |
-
|
215 |
sprintf(
|
216 |
-
'<a href="https://wordpress.org/support/plugin/youtube-channel" target="_blank">%s</a>',
|
217 |
__( 'Support' )
|
218 |
),
|
219 |
-
|
220 |
);
|
221 |
}
|
222 |
return $links;
|
@@ -231,22 +231,32 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
231 |
global $pagenow;
|
232 |
|
233 |
// Enqueue only on widget or post pages
|
234 |
-
if ( ! in_array( $pagenow,
|
235 |
return;
|
236 |
}
|
237 |
|
238 |
// Enqueue on post page only if tinymce is enabled
|
239 |
-
if ( in_array( $pagenow,
|
240 |
return;
|
241 |
}
|
242 |
|
243 |
wp_enqueue_style(
|
244 |
$this->plugin_slug . '-admin',
|
245 |
plugins_url( 'assets/css/admin.css', __FILE__ ),
|
246 |
-
|
247 |
self::VER
|
248 |
);
|
249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
} // END function admin_scripts()
|
251 |
|
252 |
/**
|
@@ -278,11 +288,11 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
278 |
|
279 |
// Prepare vars for notices
|
280 |
$settings_page = 'options-general.php?page=youtube-channel';
|
281 |
-
$notice =
|
282 |
'error' => '',
|
283 |
'warning' => '',
|
284 |
'info' => '',
|
285 |
-
|
286 |
|
287 |
// Inform if PHP version is lower than 5.3
|
288 |
if (
|
@@ -389,13 +399,13 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
389 |
wp_enqueue_style(
|
390 |
'magnific-popup-au',
|
391 |
plugins_url( 'assets/lib/magnific-popup/magnific-popup.min.css', __FILE__ ),
|
392 |
-
|
393 |
self::VER
|
394 |
);
|
395 |
wp_enqueue_script(
|
396 |
'magnific-popup-au',
|
397 |
plugins_url( 'assets/lib/magnific-popup/jquery.magnific-popup.min.js', __FILE__ ),
|
398 |
-
|
399 |
self::VER,
|
400 |
true
|
401 |
);
|
@@ -404,7 +414,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
404 |
wp_enqueue_style(
|
405 |
'youtube-channel',
|
406 |
plugins_url( 'assets/css/youtube-channel.css', __FILE__ ),
|
407 |
-
|
408 |
self::VER
|
409 |
);
|
410 |
|
@@ -812,7 +822,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
812 |
$output .= $this->front_debug( sprintf( __( 'You have set to display videos from %1$s [resource list ID: %2$s], but there have no public videos in that resouce.' ), $resource_nice_name, $resource_id ) );
|
813 |
return $output;
|
814 |
} elseif ( empty( $json_output ) ) {
|
815 |
-
$output .= $this->front_debug( sprintf( __( 'We have empty record for this feed. Please read <a href="%1$s" target="_blank">FAQ</a> and if that does not help, contact <a href="%2$s" target="_blank">support</a>.' ), 'https://wordpress.org/plugins/youtube-channel
|
816 |
return $output;
|
817 |
}
|
818 |
|
@@ -855,14 +865,14 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
855 |
if ( 'playlist' == $resource_name ) {
|
856 |
$error_msg = "Please check did you set existing <em>Playlist ID</em>. You set to show videos from {$resource_nice_name}, but YouTube does not recognize <strong>{$resource_id}</strong> as existing and public playlist.";
|
857 |
} else {
|
858 |
-
$error_msg = "Please check did you set proper <em>Channel ID</em>. You set to show videos from {$resource_nice_name}, but YouTube does not recognize <strong>{$channel}</strong> as existing
|
859 |
}
|
860 |
} elseif ( 'keyInvalid' == $json_output->error->errors[0]->reason ) {
|
861 |
// Invalid YouTube Data API Key
|
862 |
$error_msg = sprintf( __( "Double check <em>YouTube Data API Key</em> on <em>General</em> plugin tab and make sure it's correct. Read <a href=\"%s\" target=\"_blank\">Installation</a> document." ), 'https://wordpress.org/plugins/youtube-channel/installation/' );
|
863 |
} elseif ( 'ipRefererBlocked' == $json_output->error->errors[0]->reason ) {
|
864 |
// Restricted access YouTube Data API Key
|
865 |
-
$error_msg = 'Check <em>YouTube Data API Key</em> restrictions, empty cache if enabled by appending in browser address bar parameter <em>?ytc_force_recache=1</em>';
|
866 |
} elseif ( 'invalidChannelId' == $json_output->error->errors[0]->reason ) {
|
867 |
// (deprecated?) Non existing Channel ID set
|
868 |
$error_msg = sprintf( __( 'You have set wrong Channel ID. Fix that in General plugin settings, Widget and/or shortcode. Read <a href="%s" target="_blank">FAQ</a> document.' ), 'https://wordpress.org/plugins/youtube-channel/faq/' );
|
@@ -891,7 +901,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
891 |
|
892 |
// set array for unique random item
|
893 |
if ( ! empty( $instance['random'] ) ) {
|
894 |
-
$random_used =
|
895 |
}
|
896 |
|
897 |
/* AU:20141230 reduce number of videos if requested > available */
|
@@ -954,11 +964,11 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
954 |
$feed_url .= "&maxResults={$items}";
|
955 |
$feed_url .= "&key={$this->defaults['apikey']}";
|
956 |
|
957 |
-
$wparg =
|
958 |
-
'timeout'
|
959 |
'sslverify' => $this->defaults['sslverify'] ? true : false,
|
960 |
-
'headers'
|
961 |
-
|
962 |
|
963 |
$response = wp_remote_get( $feed_url, $wparg );
|
964 |
|
@@ -1012,14 +1022,12 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
1012 |
* @param integer $ratio Selected aspect ratio (1 for 4:3, other for 16:9)
|
1013 |
* @return integer Calculated height in pixels
|
1014 |
*/
|
1015 |
-
function height_ratio( $width = 306, $ratio ) {
|
1016 |
|
1017 |
switch ( $ratio ) {
|
1018 |
case 1:
|
1019 |
$height = round( ( $width / 4 ) * 3 );
|
1020 |
break;
|
1021 |
-
case 2:
|
1022 |
-
case 3:
|
1023 |
default:
|
1024 |
$height = round( ( $width / 16 ) * 9 );
|
1025 |
}
|
@@ -1189,7 +1197,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
1189 |
if ( ! empty( $instance['showtitle'] ) ) {
|
1190 |
if (
|
1191 |
// for non-thumbnail for `above` and `inside`
|
1192 |
-
( 'thumbnail' != $instance['display'] && in_array( $instance['showtitle'],
|
1193 |
// for thubmanil only if it's `below`
|
1194 |
( 'thumbnail' == $instance['display'] && 'above' == $instance['showtitle'] )
|
1195 |
) {
|
@@ -1341,7 +1349,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
1341 |
|
1342 |
// Show video title inside video?
|
1343 |
$title_inside = '';
|
1344 |
-
if ( ! empty( $instance['showtitle'] ) && in_array( $instance['showtitle'],
|
1345 |
$title_inside = sprintf(
|
1346 |
'<%1$s class="ytc_title ytc_title_inside %3$s">%2$s</%1$s>',
|
1347 |
$title_tag,
|
@@ -1358,7 +1366,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
1358 |
if ( ! empty( $instance['showtitle'] ) ) {
|
1359 |
if (
|
1360 |
// for non-thumbnail for `below` and `inside_b`
|
1361 |
-
( 'thumbnail' != $instance['display'] && in_array( $instance['showtitle'],
|
1362 |
// for thubmanil only if it's `below`
|
1363 |
( 'thumbnail' == $instance['display'] && 'below' == $instance['showtitle'] )
|
1364 |
) {
|
@@ -1461,7 +1469,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
1461 |
*/
|
1462 |
public static function cache_times_arr() {
|
1463 |
|
1464 |
-
return
|
1465 |
'0' => __( 'Do not cache', 'youtube-channel' ),
|
1466 |
'60' => __( '1 minute', 'youtube-channel' ),
|
1467 |
'300' => __( '5 minutes', 'youtube-channel' ),
|
@@ -1483,7 +1491,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
1483 |
'1209600' => __( '2 weeks', 'youtube-channel' ),
|
1484 |
'1814400' => __( '3 weeks', 'youtube-channel' ),
|
1485 |
'2419200' => __( '1 month', 'youtube-channel' ),
|
1486 |
-
|
1487 |
|
1488 |
} // END public static function cache_times_arr()
|
1489 |
|
@@ -1607,7 +1615,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
1607 |
|
1608 |
// prepare debug data with settings of current widget
|
1609 |
$data = array_merge(
|
1610 |
-
|
1611 |
'date' => date( 'r' ),
|
1612 |
'server' => $_SERVER['SERVER_SOFTWARE'],
|
1613 |
'php' => PHP_VERSION,
|
@@ -1615,7 +1623,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
1615 |
'ytc' => self::VER,
|
1616 |
'url' => get_site_url(),
|
1617 |
'for' => $for,
|
1618 |
-
|
1619 |
$options
|
1620 |
);
|
1621 |
|
3 |
* Plugin Name: YouTube Channel
|
4 |
* Plugin URI: https://urosevic.net/wordpress/plugins/youtube-channel/
|
5 |
* Description: Quick and easy embed latest or random videos from YouTube channel (user uploads, liked or favourited videos) or playlist. Use <a href="widgets.php">widget</a> for sidebar or shortcode for content. Works with <em>YouTube Data API v3</em>.
|
6 |
+
* Version: 3.0.12.1
|
7 |
* Author: Aleksandar Urošević
|
8 |
* Author URI: https://urosevic.net/
|
9 |
* License: GPLv3
|
20 |
class WPAU_YOUTUBE_CHANNEL {
|
21 |
|
22 |
const DB_VER = 23;
|
23 |
+
const VER = '3.0.12.1';
|
24 |
|
25 |
public $plugin_name = 'YouTube Channel';
|
26 |
public $plugin_slug = 'youtube-channel';
|
43 |
}
|
44 |
|
45 |
// Clear all YTC cache
|
46 |
+
add_action( 'wp_ajax_ytc_clear_all_cache', [ &$this, 'clear_all_cache' ] );
|
47 |
|
48 |
// Activation hook and maybe update trigger
|
49 |
+
register_activation_hook( __FILE__, [ $this, 'activate' ] );
|
50 |
+
add_action( 'plugins_loaded', [ $this, 'maybe_update' ] );
|
51 |
|
52 |
$this->defaults = self::defaults();
|
53 |
|
54 |
// TinyMCE AddOn
|
55 |
if ( ! empty( $this->defaults['tinymce'] ) ) {
|
56 |
+
add_filter( 'mce_external_plugins', [ $this, 'mce_external_plugins' ], 998 );
|
57 |
+
add_filter( 'mce_buttons', [ $this, 'mce_buttons' ], 999 );
|
58 |
}
|
59 |
|
60 |
if ( is_admin() ) {
|
61 |
|
62 |
// Initialize Plugin Settings Magic
|
63 |
+
add_action( 'init', [ $this, 'admin_init' ] );
|
64 |
|
65 |
// Add various Dashboard notices (if needed)
|
66 |
+
add_action( 'admin_notices', [ $this, 'admin_notices' ] );
|
67 |
|
68 |
// Enqueue scripts and styles for Widgets page
|
69 |
+
add_action( 'admin_enqueue_scripts', [ $this, 'admin_scripts' ] );
|
70 |
|
71 |
} else { // ELSE if ( is_admin() )
|
72 |
|
73 |
// Enqueue frontend scripts
|
74 |
+
add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
|
75 |
+
add_action( 'wp_footer', [ $this, 'footer_scripts' ] );
|
76 |
|
77 |
} // END if ( is_admin() )
|
78 |
|
80 |
require_once( 'inc/widget.php' );
|
81 |
|
82 |
// Register shortcodes `youtube_channel` and `ytc`
|
83 |
+
add_shortcode( 'youtube_channel', [ $this, 'shortcode' ] );
|
84 |
+
add_shortcode( 'ytc', [ $this, 'shortcode' ] );
|
85 |
|
86 |
} // END function __construct()
|
87 |
|
103 |
*/
|
104 |
public function init_options() {
|
105 |
|
106 |
+
$init = [
|
107 |
'vanity' => '', // $this->vanity_id,
|
108 |
'channel' => '', // $this->channel_id,
|
109 |
'username' => '', // $this->username_id,
|
142 |
'timeout' => 5, // timeout for wp_remote_get()
|
143 |
'sslverify' => true,
|
144 |
'js_ev_listener' => false,
|
145 |
+
];
|
146 |
|
147 |
add_option( 'youtube_channel_version', self::VER, '', 'no' );
|
148 |
add_option( 'youtube_channel_db_ver', self::DB_VER, '', 'no' );
|
172 |
*/
|
173 |
function admin_init() {
|
174 |
|
175 |
+
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), [ $this, 'add_settings_link' ] );
|
176 |
// Add row on Plugins page
|
177 |
+
add_filter( 'plugin_row_meta', [ $this, 'add_plugin_meta_links' ], 10, 2 );
|
178 |
|
179 |
require_once( 'inc/settings.php' );
|
180 |
|
211 |
if ( 'youtube-channel/youtube-channel.php' === $file ) {
|
212 |
return array_merge(
|
213 |
$links,
|
214 |
+
[
|
215 |
sprintf(
|
216 |
+
'<a href="https://wordpress.org/support/plugin/youtube-channel/" target="_blank">%s</a>',
|
217 |
__( 'Support' )
|
218 |
),
|
219 |
+
]
|
220 |
);
|
221 |
}
|
222 |
return $links;
|
231 |
global $pagenow;
|
232 |
|
233 |
// Enqueue only on widget or post pages
|
234 |
+
if ( ! in_array( $pagenow, [ 'widgets.php', 'customize.php', 'options-general.php', 'post.php', 'post-new.php' ] ) ) {
|
235 |
return;
|
236 |
}
|
237 |
|
238 |
// Enqueue on post page only if tinymce is enabled
|
239 |
+
if ( in_array( $pagenow, [ 'post.php', 'post-new.php' ] ) && empty( $this->defaults['tinymce'] ) ) {
|
240 |
return;
|
241 |
}
|
242 |
|
243 |
wp_enqueue_style(
|
244 |
$this->plugin_slug . '-admin',
|
245 |
plugins_url( 'assets/css/admin.css', __FILE__ ),
|
246 |
+
[],
|
247 |
self::VER
|
248 |
);
|
249 |
|
250 |
+
// Enqueue script for widget in admin
|
251 |
+
if ( in_array( $pagenow, [ 'widgets.php', 'customize.php' ] ) ) {
|
252 |
+
wp_enqueue_script(
|
253 |
+
$this->plugin_slug . '-admin',
|
254 |
+
plugins_url( 'assets/js/admin.min.js', __FILE__ ),
|
255 |
+
[ 'jquery' ],
|
256 |
+
self::VER,
|
257 |
+
true
|
258 |
+
);
|
259 |
+
}
|
260 |
} // END function admin_scripts()
|
261 |
|
262 |
/**
|
288 |
|
289 |
// Prepare vars for notices
|
290 |
$settings_page = 'options-general.php?page=youtube-channel';
|
291 |
+
$notice = [
|
292 |
'error' => '',
|
293 |
'warning' => '',
|
294 |
'info' => '',
|
295 |
+
];
|
296 |
|
297 |
// Inform if PHP version is lower than 5.3
|
298 |
if (
|
399 |
wp_enqueue_style(
|
400 |
'magnific-popup-au',
|
401 |
plugins_url( 'assets/lib/magnific-popup/magnific-popup.min.css', __FILE__ ),
|
402 |
+
[],
|
403 |
self::VER
|
404 |
);
|
405 |
wp_enqueue_script(
|
406 |
'magnific-popup-au',
|
407 |
plugins_url( 'assets/lib/magnific-popup/jquery.magnific-popup.min.js', __FILE__ ),
|
408 |
+
[ 'jquery' ],
|
409 |
self::VER,
|
410 |
true
|
411 |
);
|
414 |
wp_enqueue_style(
|
415 |
'youtube-channel',
|
416 |
plugins_url( 'assets/css/youtube-channel.css', __FILE__ ),
|
417 |
+
[],
|
418 |
self::VER
|
419 |
);
|
420 |
|
822 |
$output .= $this->front_debug( sprintf( __( 'You have set to display videos from %1$s [resource list ID: %2$s], but there have no public videos in that resouce.' ), $resource_nice_name, $resource_id ) );
|
823 |
return $output;
|
824 |
} elseif ( empty( $json_output ) ) {
|
825 |
+
$output .= $this->front_debug( sprintf( __( 'We have empty record for this feed. Please read <a href="%1$s" target="_blank">FAQ</a> and if that does not help, contact <a href="%2$s" target="_blank">support</a>.' ), 'https://wordpress.org/plugins/youtube-channel#faq', 'https://wordpress.org/support/plugin/youtube-channel/' ) );
|
826 |
return $output;
|
827 |
}
|
828 |
|
865 |
if ( 'playlist' == $resource_name ) {
|
866 |
$error_msg = "Please check did you set existing <em>Playlist ID</em>. You set to show videos from {$resource_nice_name}, but YouTube does not recognize <strong>{$resource_id}</strong> as existing and public playlist.";
|
867 |
} else {
|
868 |
+
$error_msg = "Please check did you set the proper <em>Channel ID</em>. You set to show videos from {$resource_nice_name}, but YouTube does not recognize <strong>{$channel}</strong> as an existing or public channel.";
|
869 |
}
|
870 |
} elseif ( 'keyInvalid' == $json_output->error->errors[0]->reason ) {
|
871 |
// Invalid YouTube Data API Key
|
872 |
$error_msg = sprintf( __( "Double check <em>YouTube Data API Key</em> on <em>General</em> plugin tab and make sure it's correct. Read <a href=\"%s\" target=\"_blank\">Installation</a> document." ), 'https://wordpress.org/plugins/youtube-channel/installation/' );
|
873 |
} elseif ( 'ipRefererBlocked' == $json_output->error->errors[0]->reason ) {
|
874 |
// Restricted access YouTube Data API Key
|
875 |
+
$error_msg = 'Check <em>YouTube Data API Key</em> restrictions, empty cache if enabled by appending in the browser address bar parameter <em>?ytc_force_recache=1</em>';
|
876 |
} elseif ( 'invalidChannelId' == $json_output->error->errors[0]->reason ) {
|
877 |
// (deprecated?) Non existing Channel ID set
|
878 |
$error_msg = sprintf( __( 'You have set wrong Channel ID. Fix that in General plugin settings, Widget and/or shortcode. Read <a href="%s" target="_blank">FAQ</a> document.' ), 'https://wordpress.org/plugins/youtube-channel/faq/' );
|
901 |
|
902 |
// set array for unique random item
|
903 |
if ( ! empty( $instance['random'] ) ) {
|
904 |
+
$random_used = [];
|
905 |
}
|
906 |
|
907 |
/* AU:20141230 reduce number of videos if requested > available */
|
964 |
$feed_url .= "&maxResults={$items}";
|
965 |
$feed_url .= "&key={$this->defaults['apikey']}";
|
966 |
|
967 |
+
$wparg = [
|
968 |
+
'timeout' => $this->defaults['timeout'],
|
969 |
'sslverify' => $this->defaults['sslverify'] ? true : false,
|
970 |
+
'headers' => [ 'referer' => site_url() ],
|
971 |
+
];
|
972 |
|
973 |
$response = wp_remote_get( $feed_url, $wparg );
|
974 |
|
1022 |
* @param integer $ratio Selected aspect ratio (1 for 4:3, other for 16:9)
|
1023 |
* @return integer Calculated height in pixels
|
1024 |
*/
|
1025 |
+
function height_ratio( $width = 306, $ratio = 2 ) {
|
1026 |
|
1027 |
switch ( $ratio ) {
|
1028 |
case 1:
|
1029 |
$height = round( ( $width / 4 ) * 3 );
|
1030 |
break;
|
|
|
|
|
1031 |
default:
|
1032 |
$height = round( ( $width / 16 ) * 9 );
|
1033 |
}
|
1197 |
if ( ! empty( $instance['showtitle'] ) ) {
|
1198 |
if (
|
1199 |
// for non-thumbnail for `above` and `inside`
|
1200 |
+
( 'thumbnail' != $instance['display'] && in_array( $instance['showtitle'], [ 'above', 'inside' ] ) ) ||
|
1201 |
// for thubmanil only if it's `below`
|
1202 |
( 'thumbnail' == $instance['display'] && 'above' == $instance['showtitle'] )
|
1203 |
) {
|
1349 |
|
1350 |
// Show video title inside video?
|
1351 |
$title_inside = '';
|
1352 |
+
if ( ! empty( $instance['showtitle'] ) && in_array( $instance['showtitle'], [ 'inside', 'inside_b' ] ) ) {
|
1353 |
$title_inside = sprintf(
|
1354 |
'<%1$s class="ytc_title ytc_title_inside %3$s">%2$s</%1$s>',
|
1355 |
$title_tag,
|
1366 |
if ( ! empty( $instance['showtitle'] ) ) {
|
1367 |
if (
|
1368 |
// for non-thumbnail for `below` and `inside_b`
|
1369 |
+
( 'thumbnail' != $instance['display'] && in_array( $instance['showtitle'], [ 'below', 'inside_b' ] ) ) ||
|
1370 |
// for thubmanil only if it's `below`
|
1371 |
( 'thumbnail' == $instance['display'] && 'below' == $instance['showtitle'] )
|
1372 |
) {
|
1469 |
*/
|
1470 |
public static function cache_times_arr() {
|
1471 |
|
1472 |
+
return [
|
1473 |
'0' => __( 'Do not cache', 'youtube-channel' ),
|
1474 |
'60' => __( '1 minute', 'youtube-channel' ),
|
1475 |
'300' => __( '5 minutes', 'youtube-channel' ),
|
1491 |
'1209600' => __( '2 weeks', 'youtube-channel' ),
|
1492 |
'1814400' => __( '3 weeks', 'youtube-channel' ),
|
1493 |
'2419200' => __( '1 month', 'youtube-channel' ),
|
1494 |
+
];
|
1495 |
|
1496 |
} // END public static function cache_times_arr()
|
1497 |
|
1615 |
|
1616 |
// prepare debug data with settings of current widget
|
1617 |
$data = array_merge(
|
1618 |
+
[
|
1619 |
'date' => date( 'r' ),
|
1620 |
'server' => $_SERVER['SERVER_SOFTWARE'],
|
1621 |
'php' => PHP_VERSION,
|
1623 |
'ytc' => self::VER,
|
1624 |
'url' => get_site_url(),
|
1625 |
'for' => $for,
|
1626 |
+
],
|
1627 |
$options
|
1628 |
);
|
1629 |
|