Version Description
Bugfixes, optimizations and improvements.
Download this release
Release Info
Developer | urkekg |
Plugin | YouTube Channel |
Version | 3.0.8 |
Comparing to | |
See all releases |
Code changes from version 3.0.7.3 to 3.0.8
- assets/css/admin.css +1 -32
- assets/css/admin.less +49 -0
- assets/css/admin.min.css +0 -1
- assets/css/youtube-channel.css +1 -109
- assets/css/youtube-channel.less +142 -0
- assets/css/youtube-channel.min.css +0 -1
- assets/img/yt_play.png +0 -0
- assets/js/youtube-channel.js +0 -10
- assets/js/youtube-channel.min.js +0 -1
- changelog_legacy.txt +214 -0
- inc/settings.php +97 -105
- inc/settings_tools.php +16 -12
- inc/settings_usage_shortcode.php +10 -12
- inc/tinymce/plugin.js +55 -47
- inc/tinymce/plugin.min.js +1 -1
- inc/widget.php +71 -61
- readme.txt +56 -227
- update.php +69 -0
- youtube-channel.php +336 -266
assets/css/admin.css
CHANGED
@@ -1,32 +1 @@
|
|
1 |
-
div[id*='_youtube-channel-'] .widget-content p {
|
2 |
-
width: 100%;
|
3 |
-
clear: both;
|
4 |
-
}
|
5 |
-
div[id*='_youtube-channel-'] .widget-content p.half {
|
6 |
-
width: 49%;
|
7 |
-
}
|
8 |
-
div[id*='_youtube-channel-'] .widget-content p.glue-top {
|
9 |
-
margin-top: 0;
|
10 |
-
}
|
11 |
-
div[id*='_youtube-channel-'] .widget-content p.half.left {
|
12 |
-
float: left;
|
13 |
-
clear: left;
|
14 |
-
}
|
15 |
-
div[id*='_youtube-channel-'] .widget-content p.half.right {
|
16 |
-
float: right;
|
17 |
-
clear: right;
|
18 |
-
}
|
19 |
-
div[id*='_youtube-channel-'] .widget-content p.hidden {
|
20 |
-
display: none;
|
21 |
-
}
|
22 |
-
div[id*='_youtube-channel-'] .widget-content p.visible {
|
23 |
-
display: block;
|
24 |
-
}
|
25 |
-
@media screen and (max-width: 782px) {
|
26 |
-
div[id*='_youtube-channel-'] .widget-content p.half.left,
|
27 |
-
div[id*='_youtube-channel-'] .widget-content p.half.right {
|
28 |
-
width: 100%;
|
29 |
-
float: none;
|
30 |
-
clear: none;
|
31 |
-
}
|
32 |
-
}
|
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}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/admin.less
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
i.mce-i-ytc {
|
2 |
+
font: normal 20px/1 'dashicons';
|
3 |
+
padding: 0;
|
4 |
+
vertical-align: top;
|
5 |
+
speak: none;
|
6 |
+
-webkit-font-smoothing: antialiased;
|
7 |
+
-moz-osx-font-smoothing: grayscale;
|
8 |
+
margin-left: -2px;
|
9 |
+
padding-right: 2px;
|
10 |
+
|
11 |
+
&:before {
|
12 |
+
content: '\f236';
|
13 |
+
}
|
14 |
+
}
|
15 |
+
div[id*='_youtube-channel-'] .widget-content p {
|
16 |
+
width: 100%;
|
17 |
+
clear: both;
|
18 |
+
|
19 |
+
&.half {
|
20 |
+
width: 49%;
|
21 |
+
|
22 |
+
&.left {
|
23 |
+
float: left;
|
24 |
+
clear: left;
|
25 |
+
}
|
26 |
+
&.right {
|
27 |
+
float: right;
|
28 |
+
clear: right;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
&.glue-top {
|
33 |
+
margin-top: 0;
|
34 |
+
}
|
35 |
+
&.hidden {
|
36 |
+
display: none;
|
37 |
+
}
|
38 |
+
&.visible {
|
39 |
+
display: block;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
@media screen and (max-width: 782px) {
|
43 |
+
div[id*='_youtube-channel-'] .widget-content p.half.left,
|
44 |
+
div[id*='_youtube-channel-'] .widget-content p.half.right {
|
45 |
+
width: 100%;
|
46 |
+
float: none;
|
47 |
+
clear: none;
|
48 |
+
}
|
49 |
+
}
|
assets/css/admin.min.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
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.glue-top{margin-top:0}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.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}}
|
|
assets/css/youtube-channel.css
CHANGED
@@ -1,109 +1 @@
|
|
1 |
-
.youtube_channel {
|
2 |
-
float: left;
|
3 |
-
clear: both;
|
4 |
-
position: relative;
|
5 |
-
box-sizing: border-box;
|
6 |
-
}
|
7 |
-
.youtube_channel.responsive {
|
8 |
-
width:100%;
|
9 |
-
}
|
10 |
-
.clearfix:after,
|
11 |
-
.widget_youtube-channel:after,
|
12 |
-
.youtube_channel:after {
|
13 |
-
content: " "; /* Older browser do not support empty content */
|
14 |
-
visibility: hidden;
|
15 |
-
display: block;
|
16 |
-
height: 0;
|
17 |
-
clear: both;
|
18 |
-
}
|
19 |
-
.youtube_channel .ytc_video_container {
|
20 |
-
float: left;
|
21 |
-
}
|
22 |
-
.youtube_channel.responsive .ytc_video_container {
|
23 |
-
width:100%!important;
|
24 |
-
}
|
25 |
-
/* Fix for Twenty Fifteen */
|
26 |
-
.youtube_channel .ytc_video_container a {
|
27 |
-
border: none;
|
28 |
-
}
|
29 |
-
.ytc_thumb {
|
30 |
-
display: block;
|
31 |
-
overflow: hidden;
|
32 |
-
position: relative;
|
33 |
-
height: 0;
|
34 |
-
width: 100%;
|
35 |
-
top: 0;
|
36 |
-
right: 0;
|
37 |
-
bottom: 0;
|
38 |
-
left: 0;
|
39 |
-
}
|
40 |
-
.ytc_thumb>span {
|
41 |
-
height: 0;
|
42 |
-
width: 100%;
|
43 |
-
display: block;
|
44 |
-
-webkit-background-size: cover;
|
45 |
-
background-size: cover;
|
46 |
-
background-position: center center;
|
47 |
-
background-repeat: no-repeat;
|
48 |
-
}
|
49 |
-
.ytc_thumb>span:before {
|
50 |
-
content: "";
|
51 |
-
display: block;
|
52 |
-
width: 100%;
|
53 |
-
height: 0;
|
54 |
-
background-image: url(../img/play.png);
|
55 |
-
background-position: center center;
|
56 |
-
background-repeat: no-repeat;
|
57 |
-
background-color: transparent;
|
58 |
-
opacity: 0.6;
|
59 |
-
transition: 0.4s;
|
60 |
-
}
|
61 |
-
.ytc_thumb:hover>span:before {
|
62 |
-
opacity: 1;
|
63 |
-
}
|
64 |
-
|
65 |
-
/* Aspect Ratio Thumbs */
|
66 |
-
.ytc_thumb.ar16_9,
|
67 |
-
.ytc_thumb.ar16_9>span,
|
68 |
-
.ytc_thumb.ar16_9>span:before {
|
69 |
-
padding-bottom: 56.26%;
|
70 |
-
}
|
71 |
-
.ytc_thumb.ar4_3,
|
72 |
-
.ytc_thumb.ar4_3>span,
|
73 |
-
.ytc_thumb.ar4_3>span:before {
|
74 |
-
padding-bottom: 75%;
|
75 |
-
}
|
76 |
-
|
77 |
-
/* responsive iframe */
|
78 |
-
.youtube_channel .ytc_video_container iframe {
|
79 |
-
margin-bottom: 0;
|
80 |
-
}
|
81 |
-
.youtube_channel.responsive .ytc_video_container.ar16_9 .fluid-width-video-wrapper {
|
82 |
-
position: relative;
|
83 |
-
padding-bottom: 56.25%; /* 16:9 */
|
84 |
-
height: 0;
|
85 |
-
}
|
86 |
-
.youtube_channel.responsive .ytc_video_container.ar4_3 .fluid-width-video-wrapper {
|
87 |
-
position: relative;
|
88 |
-
padding-bottom: 75%; /* 4:3; */
|
89 |
-
height: 0;
|
90 |
-
}
|
91 |
-
.youtube_channel.responsive .ytc_video_container .fluid-width-video-wrapper iframe {
|
92 |
-
position: absolute;
|
93 |
-
top: 0;
|
94 |
-
left: 0;
|
95 |
-
width: 100%;
|
96 |
-
height: 100%;
|
97 |
-
}
|
98 |
-
|
99 |
-
/* link */
|
100 |
-
.youtube_channel .ytc_link {
|
101 |
-
position: relative;
|
102 |
-
clear: both;
|
103 |
-
float: left;
|
104 |
-
width: 100%;
|
105 |
-
}
|
106 |
-
.youtube_channel .ytc_link>p {
|
107 |
-
padding: 0;
|
108 |
-
margin: 0;
|
109 |
-
}
|
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: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}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/youtube-channel.less
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.youtube_channel {
|
2 |
+
float: left;
|
3 |
+
clear: both;
|
4 |
+
position: relative;
|
5 |
+
box-sizing: border-box;
|
6 |
+
|
7 |
+
& .ytc_video_container {
|
8 |
+
float: left;
|
9 |
+
position: relative;
|
10 |
+
|
11 |
+
& iframe {
|
12 |
+
margin-bottom: 0;
|
13 |
+
}
|
14 |
+
/* Fix for Twenty Fifteen */
|
15 |
+
& a {
|
16 |
+
border: none;
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
&.responsive {
|
21 |
+
width:100%;
|
22 |
+
& .ytc_video_container {
|
23 |
+
width:100%!important;
|
24 |
+
|
25 |
+
/* responsive iframe */
|
26 |
+
&.ar16_9 .fluid-width-video-wrapper {
|
27 |
+
position: relative;
|
28 |
+
padding-bottom: 56.25%; /* 16:9 */
|
29 |
+
height: 0;
|
30 |
+
}
|
31 |
+
&.ar4_3 .fluid-width-video-wrapper {
|
32 |
+
position: relative;
|
33 |
+
padding-bottom: 75%; /* 4:3; */
|
34 |
+
height: 0;
|
35 |
+
}
|
36 |
+
& .fluid-width-video-wrapper iframe {
|
37 |
+
position: absolute;
|
38 |
+
top: 0;
|
39 |
+
left: 0;
|
40 |
+
width: 100%;
|
41 |
+
height: 100%;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
} // .responsive
|
46 |
+
|
47 |
+
& .ytc_thumb {
|
48 |
+
display: block;
|
49 |
+
overflow: hidden;
|
50 |
+
position: relative;
|
51 |
+
height: 0;
|
52 |
+
width: 100%;
|
53 |
+
top: 0;
|
54 |
+
right: 0;
|
55 |
+
bottom: 0;
|
56 |
+
left: 0;
|
57 |
+
cursor: pointer;
|
58 |
+
|
59 |
+
&>span {
|
60 |
+
height: 0;
|
61 |
+
width: 100%;
|
62 |
+
display: block;
|
63 |
+
-webkit-background-size: cover;
|
64 |
+
background-size: cover;
|
65 |
+
background-position: center center;
|
66 |
+
background-repeat: no-repeat;
|
67 |
+
|
68 |
+
&:before {
|
69 |
+
content: " ";
|
70 |
+
display: block;
|
71 |
+
// width: 48px;
|
72 |
+
// height: 48px;
|
73 |
+
width: 84px;
|
74 |
+
height: 59px;
|
75 |
+
background-image: url(../img/yt_play.png);
|
76 |
+
background-position: top center;
|
77 |
+
background-repeat: no-repeat;
|
78 |
+
background-color: transparent;
|
79 |
+
// opacity: .6;
|
80 |
+
opacity: 0.9;
|
81 |
+
// transition: .4s;
|
82 |
+
position: absolute;
|
83 |
+
top: 50%;
|
84 |
+
left: 50%;
|
85 |
+
padding: 0!important;
|
86 |
+
// margin-left: -24px;
|
87 |
+
// margin-top: -25px;
|
88 |
+
margin-left: -42px;
|
89 |
+
margin-top: -30px;
|
90 |
+
cursor: pointer;
|
91 |
+
transform: scale(0.85);
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
&:hover>span:before {
|
96 |
+
// opacity: 1;
|
97 |
+
background-position: bottom center;
|
98 |
+
}
|
99 |
+
|
100 |
+
/* Aspect Ratio Thumbs */
|
101 |
+
&.ar16_9,
|
102 |
+
&.ar16_9>span/*,
|
103 |
+
&.ar16_9>span:before*/ {
|
104 |
+
padding-bottom: 56.26%;
|
105 |
+
}
|
106 |
+
&.ar4_3,
|
107 |
+
&.ar4_3>span/*,
|
108 |
+
&.ar4_3>span:before*/ {
|
109 |
+
padding-bottom: 75%;
|
110 |
+
}
|
111 |
+
} // .ytc_thumb
|
112 |
+
|
113 |
+
/* link */
|
114 |
+
& .ytc_link {
|
115 |
+
position: relative;
|
116 |
+
clear: both;
|
117 |
+
float: left;
|
118 |
+
width: 100%;
|
119 |
+
|
120 |
+
&>p {
|
121 |
+
padding: 0;
|
122 |
+
margin: 0;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
/* Debug Errors */
|
127 |
+
& p.ytc_error {
|
128 |
+
color: #DD0000;
|
129 |
+
}
|
130 |
+
|
131 |
+
} // .youtube_channel
|
132 |
+
|
133 |
+
.clearfix:after,
|
134 |
+
.widget_youtube-channel:after,
|
135 |
+
.youtube_channel:after {
|
136 |
+
content: " "; /* Older browser do not support empty content */
|
137 |
+
visibility: hidden;
|
138 |
+
display: block;
|
139 |
+
height: 0;
|
140 |
+
clear: both;
|
141 |
+
}
|
142 |
+
|
assets/css/youtube-channel.min.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
.ytc_thumb>span,.ytc_thumb>span:before{background-position:center center;background-repeat:no-repeat}.youtube_channel{float:left;clear:both;position:relative;box-sizing:border-box}.youtube_channel.responsive{width:100%}.clearfix:after,.widget_youtube-channel:after,.youtube_channel:after{content:" ";visibility:hidden;display:block;height:0;clear:both}.youtube_channel .ytc_video_container{float:left}.youtube_channel.responsive .ytc_video_container{width:100%!important}.youtube_channel .ytc_video_container a{border:none}.ytc_thumb{display:block;overflow:hidden;position:relative;height:0;width:100%;top:0;right:0;bottom:0;left:0}.ytc_thumb>span{height:0;width:100%;display:block;-webkit-background-size:cover;background-size:cover}.ytc_thumb>span:before{content:"";display:block;width:100%;height:0;background-image:url(../img/play.png);background-color:transparent;opacity:.6;transition:.4s}.ytc_thumb:hover>span:before{opacity:1}.ytc_thumb.ar16_9,.ytc_thumb.ar16_9>span,.ytc_thumb.ar16_9>span:before{padding-bottom:56.26%}.ytc_thumb.ar4_3,.ytc_thumb.ar4_3>span,.ytc_thumb.ar4_3>span:before{padding-bottom:75%}.youtube_channel .ytc_video_container iframe{margin-bottom:0}.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_link{position:relative;clear:both;float:left;width:100%}.youtube_channel .ytc_link>p{padding:0;margin:0}
|
|
assets/img/yt_play.png
ADDED
Binary file
|
assets/js/youtube-channel.js
CHANGED
@@ -1,10 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function($) {
|
2 |
-
$('.ytc-lightbox').magnificPopupAU({
|
3 |
-
disableOn: 700,
|
4 |
-
type: 'iframe',
|
5 |
-
mainClass: 'mfp-fade',
|
6 |
-
removalDelay: 160,
|
7 |
-
preloader: false,
|
8 |
-
fixedContentPos: false
|
9 |
-
});
|
10 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/youtube-channel.min.js
CHANGED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function(e){e(".ytc-lightbox").magnificPopupAU({disableOn:700,type:"iframe",mainClass:"mfp-fade",removalDelay:160,preloader:!1,fixedContentPos:!1})});
|
|
changelog_legacy.txt
ADDED
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
== ChangeLog for old releases ==
|
2 |
+
|
3 |
+
= 2.4.2.1 (2015-04-24) =
|
4 |
+
* Fix: devicesupport workaround strip 1st video from playlist and favourites and apply only for channel
|
5 |
+
|
6 |
+
= 2.4.2 (2015-04-22) =
|
7 |
+
* Fix: Broken layout introduced by missing responsive for embedded playlist, iframe and iframe2
|
8 |
+
* Fix: Replace amp's with HTML entity in thumbnail link
|
9 |
+
* Add: Option to disable thumbnail tooltips (shortcode parameter no_thumb_title)
|
10 |
+
* Add: List of Shortcode attributes to README file
|
11 |
+
* Add: Danis localisation by GSAdev v. Georg Adamsen
|
12 |
+
* Micro optimizations
|
13 |
+
|
14 |
+
= 2.4.1.7 (2015-04-20) =
|
15 |
+
* Quick Fix: strip 1st video from feed that provides notice "YouTube is upgrading to a newer version, which is not supported by this device or app." (more on www.youtube.com/devicesupport) until we finish YouTube Channel 3.0.0 (on the way)
|
16 |
+
|
17 |
+
= 2.4.1.6 (2015-04-15) =
|
18 |
+
* Fix: missing responsive support for embedded playlist, iframe and iframe2
|
19 |
+
* Fix: missing support to hide playback controls, info and annotations for embedded playlist
|
20 |
+
|
21 |
+
= 2.4.1.5 (2015-04-13) =
|
22 |
+
* (2015-04-13) Change: Add dismiss link for Old PHP notice and lower suggested PHP version to 5.3.x
|
23 |
+
* (2015-02-19) Fix: missing admin notices if ReduxFramework not active
|
24 |
+
* (2015-02-10) Add: links to explanations for channel ID and vanity URL
|
25 |
+
* (2015-02-10) Add: goto macro %vanity% to insert vanity ID
|
26 |
+
* (2015-02-10) Add: field for vanity URL ID
|
27 |
+
* (2015-02-10) Add: option to select link to user page, channel page or vanity URL for goto link
|
28 |
+
* (2015-02-10) Remove: option to use channel instead user page for goto link
|
29 |
+
|
30 |
+
= 2.4.1.4 (2015-04-09) =
|
31 |
+
* (2015-04-09) Add: Notification about old PHP if lower than 5.3.29
|
32 |
+
* (2015-04-09) Change: Run admin functions only in dashboard
|
33 |
+
* (2015-02-09) Fix: strip whitespace from the beginngine/end of channel and playlist ID
|
34 |
+
* (2014-12-30) Fix: prevent Undefined Offset notice when on resource we get less items than user requested in shortcode/widget
|
35 |
+
* (2014-12-30) Fix: prevent Undefined Offset notice when on resource we get less items than user requested in shortcode/widget
|
36 |
+
* (2014-12-30) Add: make fallback cache for every feed and use it if no item occurs to avoid No items
|
37 |
+
|
38 |
+
= 2.4.1.3 (2014-12-10) =
|
39 |
+
* Fix: previous release broke opening lightbox for thumbnails and load YouTube website.
|
40 |
+
|
41 |
+
= 2.4.1.2 (2014-12-07) =
|
42 |
+
* Add: Add support for hidden controls and YouTube logo in Thumbnail mode.
|
43 |
+
* Change: Rename Magnific Popup function to prevent clash with original Modest Branding that does not have support for disabling related videos, player controls and YouTube logo.
|
44 |
+
|
45 |
+
= 2.4.1.1 (2014-12-07) =
|
46 |
+
* Change: Remove parameter `&rel=1` from thumbnail link because that is a default value and can prevent some lightboxes to load video.
|
47 |
+
|
48 |
+
= 2.4.1 (2014-11-15) =
|
49 |
+
* Fix: Typo in widget `Do not chache` [2014-10-03]
|
50 |
+
* Fix: do not show global settings notice with link to settings page if not Redux Framerowk is active [2014-11-15]
|
51 |
+
* Fix: Plugin name on Support tab in global plugin settings. [2014-11-15]
|
52 |
+
* Change: Remove protocol from links and leave browser to decide should get resource from HTTP or HTTPS (depends on website protocol) [2014-10-03]
|
53 |
+
* Change: Add height addition for `Fix height taken by controls` for embedded playlist and count control above video [2014-10-03]
|
54 |
+
* Change: Move debug log from widget to downloadable dynamic JSON [2014-11-15]
|
55 |
+
* Add: ModestBranding (remove YouTube logo from player control bar) [2014-10-03]
|
56 |
+
* Add: Responsive (make video optionally responsive) [2014-10-04]
|
57 |
+
* Add: Support for WordPress 4.1 [2014-11-15]
|
58 |
+
|
59 |
+
= 2.4.0.2 (2014-10-02) =
|
60 |
+
* Fix: light theme not applicable to embedded playlist [2014-10-01]
|
61 |
+
* Fix: add clearfix after YTC widget to prevent jumping out of widget block on bad styled themes [2014-10-02]
|
62 |
+
* Add: explanation that `What to embed` have no effect for embedded playlist (HTML5 always used) [2014-10-01]
|
63 |
+
|
64 |
+
= 2.4.0.1 (2014-10-01) =
|
65 |
+
* Fix: fatal error - broken execution for embedded playlist with enhanced privacy
|
66 |
+
* Add: button to discard warning notice for Redux Framework
|
67 |
+
|
68 |
+
= 2.4.0 (2014-10-01) =
|
69 |
+
* Fix: false options set in shortcode had no effect to output box and default settings always used [20140924]
|
70 |
+
* Fix: enabled checkbox in global settings could not be unticked (disabled) [20140924]
|
71 |
+
* Fix: prevent array_slice notice if channel have no uploaded videos [20141001]
|
72 |
+
* Add: fitVids for responsive videos [20140924]
|
73 |
+
* Add: option for additional YTC box class in widget and shortcode [20140924]
|
74 |
+
* Change: global settings page re-implemented with Redux Framework and requires Redux Framework Plugin [20140924]
|
75 |
+
* Change: rewrite plugin to be more OOP [20140924]
|
76 |
+
* Change: removed obsolete methods [20140924]
|
77 |
+
* Change: default box width changed from 220 to 306px [20140924]
|
78 |
+
* Change: YTC block and video pieces now floated left to enable horizontal stack [20140924]
|
79 |
+
* Change: update localization support [20140926]
|
80 |
+
* Change: updated Serbian localization [20140926]
|
81 |
+
* Change: removed PayPal donation button from widget and moved to plugin Settings page [20141001]
|
82 |
+
|
83 |
+
= 2.2.3 (2014-09-14) =
|
84 |
+
* Add: option to disable related videos (not supported by chromeless player)
|
85 |
+
* Enhance: added support for YouTube `rel` parameter in Magnific PopUp IFRAME module
|
86 |
+
* Minified assets
|
87 |
+
* Add plugin icon for WordPress 4.x plugin installer
|
88 |
+
* Update plugin banner
|
89 |
+
|
90 |
+
= 2.2.2 (2014-07-25) =
|
91 |
+
* Add: admin notices after upgrade to prevent errors and avare users to do ReCache and prevent mixed json_decode / base64_encode strings for cached feeds
|
92 |
+
* Change: moved ReCache part to Tools tab on settings page
|
93 |
+
|
94 |
+
= 2.2.1 (2014-07-13) =
|
95 |
+
* Fix: to prevent broken JSON feed, transient caching changed from plain serialized string to base64_encode
|
96 |
+
* Add: URL parameter `ytc_force_recache` to force recache, also included on Help tab in plugin settings
|
97 |
+
|
98 |
+
= 2.2.0 =
|
99 |
+
* Add: open thumbnails in lightbox and stay on site, instead opening YouTube page (Magnific Popup jQuery library)
|
100 |
+
* Add: make thumbnail responsive
|
101 |
+
* Add: play indicator for thumbnails
|
102 |
+
* Add: shortcode [youtube_channel]
|
103 |
+
* Add: tabbed settings page for default options for shortcodes
|
104 |
+
* Add: Help tab for shortcode parameters
|
105 |
+
* Change: moved parts of code to helper functions
|
106 |
+
|
107 |
+
= 2.1.0.2 =
|
108 |
+
* Fix: remove embed object below old IFRAME implementation
|
109 |
+
|
110 |
+
= 2.1.0.1 =
|
111 |
+
* Change: add back old iframe functionality, second iframe option is async loading
|
112 |
+
|
113 |
+
= 2.1.0 =
|
114 |
+
* Change: iframe/HTML5 player inject with IFrame Player API https://developers.google.com/youtube/player_parameters#IFrame_Player_API
|
115 |
+
* Change: use native WP remote file download function wp_remote_get to fetch feeds (prevent some permission errors on some hosts)
|
116 |
+
* Change: removed height parameter so height is calculated by aspect ratio selection - 16:9 as default
|
117 |
+
* Add: mute audio on autoplay if iframe/HTML5 is selected
|
118 |
+
* Add: converter that will port pre-2.0.0 YTC widgets to 2.0.0+ version
|
119 |
+
* Fix: playlist parser (now allowed dash and underscore in playlist ID)
|
120 |
+
|
121 |
+
= 2.0.0 =
|
122 |
+
* Fix: undefined vars notices
|
123 |
+
* Fix: embedding default plugin playlist instead custom set for "Embed standard playlist"
|
124 |
+
* Add: caching system
|
125 |
+
* Add: option to link to channel instead to user
|
126 |
+
* Add: support for enhanced privacy by YouTube
|
127 |
+
* Enhance: RSS feed replaced with JSON
|
128 |
+
* Enhance: better formatted debug info with site URL
|
129 |
+
* Enhance: re-group widget options
|
130 |
+
* Enhance: updated wording
|
131 |
+
* Enhance: added tooltips for options
|
132 |
+
* Enhance: playlist ID detection from URL
|
133 |
+
* Remove: modified error_reporting
|
134 |
+
|
135 |
+
= 1.5.1 =
|
136 |
+
* Fix issue in widget settings when no apache_get_version() support on server
|
137 |
+
* Fix validation errors for widget settings
|
138 |
+
* Fix broken sidebar issue introduced in 1.5.0 release
|
139 |
+
|
140 |
+
= 1.5.0 =
|
141 |
+
* Add inline debug tracker
|
142 |
+
* Fix deprecated functions - changed rss.php by feed.php and split() by extract()
|
143 |
+
* Fix video description parser for new YouTube feed format
|
144 |
+
* Fix autoplay for single video bug
|
145 |
+
* Fix autoplay for multiple videos to play only first video
|
146 |
+
* Code cleanup
|
147 |
+
* Update compatibility to WordPress 3.5.1
|
148 |
+
|
149 |
+
= 1.4.0 =
|
150 |
+
* Added option to show preferred quantity of videos
|
151 |
+
* Added option to embed classic playlist
|
152 |
+
* Added class to video container: universal .ytc_video_container and selective (.ytc_video_first, .ytc_video_mid, .ytc_video_last)
|
153 |
+
* Added class to video title .ytc_title
|
154 |
+
* Added class to video description text .ytc_description
|
155 |
+
* Added class to container for link to channel .ytc_link
|
156 |
+
* Added routine to unique random video from channel if displayed more than one video
|
157 |
+
* Added option to set `et cetera` string for shortened video description
|
158 |
+
* Changed option for random video to use channel or playlist
|
159 |
+
* Fields for width and height converted to number with spinner
|
160 |
+
* Improved playlist ID handler
|
161 |
+
|
162 |
+
= 1.3.3 =
|
163 |
+
* Added Czech translation by Ladislav Drábek
|
164 |
+
|
165 |
+
= 1.3.2 =
|
166 |
+
* Add option to show video description below video
|
167 |
+
* Add option to shorten video description to N characters
|
168 |
+
* Add option to use light theme for controls instead of default dark theme (HTML5 iframe and flash object)
|
169 |
+
* Add option to hide annotations from video
|
170 |
+
|
171 |
+
= 1.3.1 =
|
172 |
+
* Add support for playlist full URL
|
173 |
+
* Fixed no random video for playlist
|
174 |
+
|
175 |
+
= 1.3 =
|
176 |
+
* Fixed z-index problem with flash and iframe object
|
177 |
+
* Add option to try to fix 'No items' error
|
178 |
+
* Add donate button in options dialog
|
179 |
+
|
180 |
+
= 1.2 =
|
181 |
+
* Fixed number of items for random video (min 1, max 50)
|
182 |
+
* Fixed no-controls for HTML5 iframe
|
183 |
+
|
184 |
+
= 1.1 =
|
185 |
+
* Added option to use the playlist instead of channel (suggested by Stacy)
|
186 |
+
|
187 |
+
= 1.0 =
|
188 |
+
* Ported to WordPress 3.2.1
|
189 |
+
* Added option to set maximum number of items for random video
|
190 |
+
* Version changed from major.minor.micro to to major.minor format
|
191 |
+
* Adds Spanish translation
|
192 |
+
|
193 |
+
= 0.1.3 =
|
194 |
+
* Uses selected() instead of if [dimadin]
|
195 |
+
* Uses sprintf for better i18n [dimadin]
|
196 |
+
* Wraps some strings in gettext [dimadin]
|
197 |
+
* Adds textdomain and loads it [dimadin]
|
198 |
+
* Adds target="_blank" for channel link [dimadin]
|
199 |
+
* Adds option to open channel link in popup
|
200 |
+
* Uses plugin_dir_url() instead of guessing of location [dimadin]
|
201 |
+
* Loads widget in its own function [dimadin]
|
202 |
+
* Adds Serbian translation
|
203 |
+
|
204 |
+
= 0.1.2 =
|
205 |
+
* Option to display random video from channel
|
206 |
+
|
207 |
+
= 0.1.1 =
|
208 |
+
* Fixed option to toggle video title visibility
|
209 |
+
* Added option to hide controls for iframe and object videos
|
210 |
+
* Added option to hide video info
|
211 |
+
* Enabled autostart for iframe and object videos
|
212 |
+
|
213 |
+
= 0.1.0 =
|
214 |
+
* Initial release
|
inc/settings.php
CHANGED
@@ -235,7 +235,7 @@ if ( ! class_exists('WPAU_YOUTUBE_CHANNEL_SETTINGS') ) {
|
|
235 |
// Width
|
236 |
add_settings_field(
|
237 |
$this->option_name . 'width', // id
|
238 |
-
__('Width', 'wpsk'), // Title
|
239 |
array(&$this, 'settings_field_input_number'), // Callback
|
240 |
$this->slug . '_video', // Page
|
241 |
'ytc_video', // section
|
@@ -268,38 +268,53 @@ if ( ! class_exists('WPAU_YOUTUBE_CHANNEL_SETTINGS') ) {
|
|
268 |
)
|
269 |
) // args
|
270 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
// Responsive
|
272 |
add_settings_field(
|
273 |
$this->option_name . 'responsive', // id
|
274 |
-
__('Responsive
|
275 |
array(&$this, 'settings_field_checkbox'), // Callback
|
276 |
$this->slug . '_video', // Page
|
277 |
'ytc_video', // section
|
278 |
array(
|
279 |
'field' => $this->option_name . "[responsive]",
|
280 |
-
'description' => __("Enable this option to make
|
281 |
'class' => 'checkbox',
|
282 |
'value' => $this->defaults['responsive'],
|
283 |
) // args
|
284 |
);
|
285 |
-
//
|
286 |
add_settings_field(
|
287 |
-
$this->option_name . '
|
288 |
-
__('
|
289 |
-
array(&$this, '
|
290 |
$this->slug . '_video', // Page
|
291 |
'ytc_video', // section
|
292 |
array(
|
293 |
-
'field' => $this->option_name . "[
|
294 |
-
|
295 |
-
'
|
296 |
-
'
|
297 |
-
'value' => $this->defaults['display'],
|
298 |
-
'items' => array(
|
299 |
-
'thumbnail' => 'Thumbnail',
|
300 |
-
'iframe' => 'HTML5 (iframe)',
|
301 |
-
'iframe2' => 'HTML5 (iframe) Asynchronous'
|
302 |
-
)
|
303 |
) // args
|
304 |
);
|
305 |
// Light Theme
|
@@ -387,6 +402,34 @@ if ( ! class_exists('WPAU_YOUTUBE_CHANNEL_SETTINGS') ) {
|
|
387 |
'value' => $this->defaults['modestbranding'],
|
388 |
) // args
|
389 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
// --- Register setting Video so $_POST handling is done ---
|
391 |
register_setting(
|
392 |
'ytc_video', // Setting group
|
@@ -407,14 +450,19 @@ if ( ! class_exists('WPAU_YOUTUBE_CHANNEL_SETTINGS') ) {
|
|
407 |
add_settings_field(
|
408 |
$this->option_name . 'showtitle', // id
|
409 |
__('Show video title', 'wpsk'), // Title
|
410 |
-
array(&$this, '
|
411 |
$this->slug . '_content', // Page
|
412 |
'ytc_content', // section
|
413 |
array(
|
414 |
'field' => $this->option_name . "[showtitle]",
|
415 |
-
'description' => __("
|
416 |
-
'class' => '
|
417 |
'value' => $this->defaults['showtitle'],
|
|
|
|
|
|
|
|
|
|
|
418 |
) // args
|
419 |
);
|
420 |
// Video Description
|
@@ -448,48 +496,6 @@ if ( ! class_exists('WPAU_YOUTUBE_CHANNEL_SETTINGS') ) {
|
|
448 |
'std' => 0
|
449 |
) // args
|
450 |
);
|
451 |
-
// Et cetera string
|
452 |
-
add_settings_field(
|
453 |
-
$this->option_name . 'descappend', // id
|
454 |
-
__('Et cetera string', 'wpsk'), // Title
|
455 |
-
array(&$this, 'settings_field_input_text'), // Callback
|
456 |
-
$this->slug . '_content', // Page
|
457 |
-
'ytc_content', // section
|
458 |
-
array(
|
459 |
-
'field' => $this->option_name . "[descappend]",
|
460 |
-
'description' => __('Indicator for shortened video description (default: …)', 'wpsk'),
|
461 |
-
'class' => 'small-text',
|
462 |
-
'value' => $this->defaults['descappend'],
|
463 |
-
) // args
|
464 |
-
);
|
465 |
-
// Hide Annotations
|
466 |
-
add_settings_field(
|
467 |
-
$this->option_name . 'hideanno', // id
|
468 |
-
__('Hide video annotations', 'wpsk'), // Title
|
469 |
-
array(&$this, 'settings_field_checkbox'), // Callback
|
470 |
-
$this->slug . '_content', // Page
|
471 |
-
'ytc_content', // section
|
472 |
-
array(
|
473 |
-
'field' => $this->option_name . "[hideanno]",
|
474 |
-
'description' => __("Enable this option to hide video annotations (custom text set by uploader over video during playback)", 'wpsk'),
|
475 |
-
'class' => 'checkbox',
|
476 |
-
'value' => $this->defaults['hideanno'],
|
477 |
-
) // args
|
478 |
-
);
|
479 |
-
// Hide Video Info
|
480 |
-
add_settings_field(
|
481 |
-
$this->option_name . 'hideinfo', // id
|
482 |
-
__('Hide video info', 'wpsk'), // Title
|
483 |
-
array(&$this, 'settings_field_checkbox'), // Callback
|
484 |
-
$this->slug . '_content', // Page
|
485 |
-
'ytc_content', // section
|
486 |
-
array(
|
487 |
-
'field' => $this->option_name . "[hideinfo]",
|
488 |
-
'description' => __("Enable this option to hide informations about video before play start (video title and uploader in overlay)", 'wpsk'),
|
489 |
-
'class' => 'checkbox',
|
490 |
-
'value' => $this->defaults['hideinfo'],
|
491 |
-
) // args
|
492 |
-
);
|
493 |
|
494 |
// --- Register setting Content so $_POST handling is done ---
|
495 |
register_setting(
|
@@ -507,32 +513,25 @@ if ( ! class_exists('WPAU_YOUTUBE_CHANNEL_SETTINGS') ) {
|
|
507 |
$this->slug . '_link' // Page Name
|
508 |
);
|
509 |
// --- Add Fields to video section ---
|
510 |
-
//
|
511 |
-
add_settings_field(
|
512 |
-
$this->option_name . 'showgoto', // id
|
513 |
-
__('Show link to channel', 'wpsk'), // Title
|
514 |
-
array(&$this, 'settings_field_checkbox'), // Callback
|
515 |
-
$this->slug . '_link', // Page
|
516 |
-
'ytc_link', // section
|
517 |
-
array(
|
518 |
-
'field' => $this->option_name . "[showgoto]",
|
519 |
-
'description' => __("Enable this option to show customized link to channel at the bottom of YTC block", 'wpsk'),
|
520 |
-
'class' => 'checkbox',
|
521 |
-
'value' => $this->defaults['showgoto'],
|
522 |
-
) // args
|
523 |
-
);
|
524 |
-
// Visit channel text
|
525 |
add_settings_field(
|
526 |
-
$this->option_name . '
|
527 |
-
__('
|
528 |
-
array(&$this, '
|
529 |
$this->slug . '_link', // Page
|
530 |
'ytc_link', // section
|
531 |
array(
|
532 |
-
'field' => $this->option_name . "[
|
533 |
-
'
|
|
|
534 |
'class' => 'regular-text',
|
535 |
-
'value' => $this->defaults['
|
|
|
|
|
|
|
|
|
|
|
|
|
536 |
) // args
|
537 |
);
|
538 |
// Open in...
|
@@ -555,26 +554,21 @@ if ( ! class_exists('WPAU_YOUTUBE_CHANNEL_SETTINGS') ) {
|
|
555 |
)
|
556 |
) // args
|
557 |
);
|
558 |
-
//
|
559 |
add_settings_field(
|
560 |
-
$this->option_name . '
|
561 |
-
__('
|
562 |
-
array(&$this, '
|
563 |
$this->slug . '_link', // Page
|
564 |
'ytc_link', // section
|
565 |
array(
|
566 |
-
'field' => $this->option_name . "[
|
567 |
-
// 'label' => __('Ratio:', 'wpsk'),
|
568 |
-
'description' => __('Set where link will lead visitors', 'wpsk'),
|
569 |
'class' => 'regular-text',
|
570 |
-
'
|
571 |
-
'
|
572 |
-
'2' => 'Vanity custom URL',
|
573 |
-
'1' => 'Channel page URL',
|
574 |
-
'0' => 'Legacy username page'
|
575 |
-
)
|
576 |
) // args
|
577 |
);
|
|
|
578 |
// --- Register setting Content so $_POST handling is done ---
|
579 |
register_setting(
|
580 |
'ytc_link', // Setting group
|
@@ -805,44 +799,42 @@ if ( ! class_exists('WPAU_YOUTUBE_CHANNEL_SETTINGS') ) {
|
|
805 |
$sanitized['username'] = ( ! empty($options['username']) ) ? trim($options['username']) : ''; //$this->defaults['username'];
|
806 |
$sanitized['playlist'] = ( ! empty($options['playlist']) ) ? trim($options['playlist']) : ''; //$this->defaults['playlist'];
|
807 |
$sanitized['resource'] = ( isset($options['resource']) ) ? intval($options['resource']) : $this->defaults['resource'];
|
808 |
-
// $sanitized['only_pl'] = ( ! empty($options['only_pl']) && $options['only_pl'] ) ? 1 : 0;
|
809 |
$sanitized['cache'] = ( isset($options['cache']) ) ? intval($options['cache']) : $this->defaults['cache'];
|
810 |
$sanitized['fetch'] = ( ! empty($options['fetch']) ) ? intval($options['fetch']) : $this->defaults['fetch'];
|
811 |
$sanitized['num'] = ( ! empty($options['num']) ) ? intval($options['num']) : $this->defaults['num'];
|
812 |
$sanitized['privacy'] = ( ! empty($options['privacy']) && $options['privacy'] ) ? 1 : 0;
|
813 |
-
// $sanitized['random'] = ( ! empty($options['random']) && $options['random'] ) ? 1 : 0;
|
814 |
break; // General
|
815 |
|
816 |
// --- Video ---
|
817 |
case 'ytc_video':
|
818 |
$sanitized['width'] = ( ! empty($options['width']) ) ? intval($options['width']) : $this->defaults['width'];
|
819 |
$sanitized['ratio'] = ( isset($options['ratio']) ) ? intval($options['ratio']) : $this->defaults['ratio'];
|
820 |
-
$sanitized['responsive'] = ( ! empty($options['responsive']) && $options['responsive'] ) ? 1 : 0;
|
821 |
$sanitized['display'] = ( ! empty($options['display']) ) ? trim($options['display']) : $this->defaults['display'];
|
|
|
|
|
|
|
822 |
$sanitized['themelight'] = ( ! empty($options['themelight']) && $options['themelight'] ) ? 1 : 0;
|
823 |
$sanitized['controls'] = ( ! empty($options['controls']) && $options['controls'] ) ? 1 : 0;
|
824 |
$sanitized['autoplay'] = ( ! empty($options['autoplay']) && $options['autoplay'] ) ? 1 : 0;
|
825 |
$sanitized['autoplay_mute'] = ( ! empty($options['autoplay_mute']) && $options['autoplay_mute'] ) ? 1 : 0;
|
826 |
$sanitized['norel'] = ( ! empty($options['norel']) && $options['norel'] ) ? 1 : 0;
|
827 |
$sanitized['modestbranding'] = ( ! empty($options['modestbranding']) && $options['modestbranding'] ) ? 1 : 0;
|
|
|
|
|
828 |
break; // Video
|
829 |
|
830 |
// --- Content ---
|
831 |
case 'ytc_content':
|
832 |
-
$sanitized['showtitle'] = ( ! empty($options['showtitle'])
|
833 |
$sanitized['showdesc'] = ( ! empty($options['showdesc']) && $options['showdesc'] ) ? 1 : 0;
|
834 |
$sanitized['desclen'] = ( ! empty($options['desclen']) ) ? intval($options['desclen']) : $this->defaults['desclen'];
|
835 |
-
$sanitized['descappend'] = ( ! empty($options['descappend']) ) ? $options['descappend'] : $this->defaults['descappend'];
|
836 |
-
$sanitized['hideanno'] = ( ! empty($options['hideanno']) && $options['hideanno'] ) ? 1 : 0;
|
837 |
-
$sanitized['hideinfo'] = ( ! empty($options['hideinfo']) && $options['hideinfo'] ) ? 1 : 0;
|
838 |
break; // Content
|
839 |
|
840 |
// --- Link to Channel ---
|
841 |
case 'ytc_link':
|
842 |
-
$sanitized['
|
843 |
$sanitized['goto_txt'] = ( ! empty($options['goto_txt']) ) ? $options['goto_txt'] : $this->defaults['goto_txt'];
|
844 |
$sanitized['popup_goto'] = ( isset($options['popup_goto']) ) ? intval($options['popup_goto']) : $this->defaults['popup_goto'];
|
845 |
-
$sanitized['link_to'] = ( isset($options['link_to']) ) ? intval($options['link_to']) : $this->defaults['link_to'];
|
846 |
break; // Link to Channel
|
847 |
|
848 |
} // switch
|
235 |
// Width
|
236 |
add_settings_field(
|
237 |
$this->option_name . 'width', // id
|
238 |
+
__('Initial Width', 'wpsk'), // Title
|
239 |
array(&$this, 'settings_field_input_number'), // Callback
|
240 |
$this->slug . '_video', // Page
|
241 |
'ytc_video', // section
|
268 |
)
|
269 |
) // args
|
270 |
);
|
271 |
+
// Display
|
272 |
+
add_settings_field(
|
273 |
+
$this->option_name . 'display', // id
|
274 |
+
__('What to show?', 'wpsk'), // Title
|
275 |
+
array(&$this, 'settings_field_select'), // Callback
|
276 |
+
$this->slug . '_video', // Page
|
277 |
+
'ytc_video', // section
|
278 |
+
array(
|
279 |
+
'field' => $this->option_name . "[display]",
|
280 |
+
'description' => __('Choose how to embed video block', 'wpsk'),
|
281 |
+
'class' => 'regular-text',
|
282 |
+
'value' => $this->defaults['display'],
|
283 |
+
'items' => array(
|
284 |
+
'thumbnail' => 'Thumbnail',
|
285 |
+
'iframe' => 'HTML5 (iframe)',
|
286 |
+
'iframe2' => 'HTML5 (iframe) Asynchronous',
|
287 |
+
'playlist' => 'Embedded Playlist',
|
288 |
+
// 'gallery' => 'Gallery'
|
289 |
+
)
|
290 |
+
) // args
|
291 |
+
);
|
292 |
// Responsive
|
293 |
add_settings_field(
|
294 |
$this->option_name . 'responsive', // id
|
295 |
+
__('Enable Responsive', 'wpsk'), // Title
|
296 |
array(&$this, 'settings_field_checkbox'), // Callback
|
297 |
$this->slug . '_video', // Page
|
298 |
'ytc_video', // section
|
299 |
array(
|
300 |
'field' => $this->option_name . "[responsive]",
|
301 |
+
'description' => __("Enable this option to make YTC videos and thumbnails responsive by default. Please note, this option will set videos and thumbnail to full width relative to parent container, and disable more than one video per row.", 'wpsk'),
|
302 |
'class' => 'checkbox',
|
303 |
'value' => $this->defaults['responsive'],
|
304 |
) // args
|
305 |
);
|
306 |
+
// No Lightbox
|
307 |
add_settings_field(
|
308 |
+
$this->option_name . 'nolightbox', // id
|
309 |
+
__('Disable Lightbox', 'wpsk'), // Title
|
310 |
+
array(&$this, 'settings_field_checkbox'), // Callback
|
311 |
$this->slug . '_video', // Page
|
312 |
'ytc_video', // section
|
313 |
array(
|
314 |
+
'field' => $this->option_name . "[nolightbox]",
|
315 |
+
'description' => __("Enable this option to disable built-in lightbox for thumbnails.", 'wpsk'),
|
316 |
+
'class' => 'checkbox',
|
317 |
+
'value' => ( isset($this->defaults['nolightbox']) ) ? $this->defaults['nolightbox'] : '',
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
) // args
|
319 |
);
|
320 |
// Light Theme
|
402 |
'value' => $this->defaults['modestbranding'],
|
403 |
) // args
|
404 |
);
|
405 |
+
// Hide Annotations
|
406 |
+
add_settings_field(
|
407 |
+
$this->option_name . 'hideanno', // id
|
408 |
+
__('Hide video annotations', 'wpsk'), // Title
|
409 |
+
array(&$this, 'settings_field_checkbox'), // Callback
|
410 |
+
$this->slug . '_video', // Page
|
411 |
+
'ytc_video', // section
|
412 |
+
array(
|
413 |
+
'field' => $this->option_name . "[hideanno]",
|
414 |
+
'description' => __("Enable this option to hide video annotations (custom text set by uploader over video during playback)", 'wpsk'),
|
415 |
+
'class' => 'checkbox',
|
416 |
+
'value' => $this->defaults['hideanno'],
|
417 |
+
) // args
|
418 |
+
);
|
419 |
+
// Hide Video Info
|
420 |
+
add_settings_field(
|
421 |
+
$this->option_name . 'hideinfo', // id
|
422 |
+
__('Hide video info', 'wpsk'), // Title
|
423 |
+
array(&$this, 'settings_field_checkbox'), // Callback
|
424 |
+
$this->slug . '_video', // Page
|
425 |
+
'ytc_video', // section
|
426 |
+
array(
|
427 |
+
'field' => $this->option_name . "[hideinfo]",
|
428 |
+
'description' => __("Enable this option to hide informations about video before play start (video title and uploader in overlay)", 'wpsk'),
|
429 |
+
'class' => 'checkbox',
|
430 |
+
'value' => $this->defaults['hideinfo'],
|
431 |
+
) // args
|
432 |
+
);
|
433 |
// --- Register setting Video so $_POST handling is done ---
|
434 |
register_setting(
|
435 |
'ytc_video', // Setting group
|
450 |
add_settings_field(
|
451 |
$this->option_name . 'showtitle', // id
|
452 |
__('Show video title', 'wpsk'), // Title
|
453 |
+
array(&$this, 'settings_field_select'), // Callback
|
454 |
$this->slug . '_content', // Page
|
455 |
'ytc_content', // section
|
456 |
array(
|
457 |
'field' => $this->option_name . "[showtitle]",
|
458 |
+
'description' => __("Select should we and where display title of video", 'wpsk'),
|
459 |
+
'class' => 'regular-text',
|
460 |
'value' => $this->defaults['showtitle'],
|
461 |
+
'items' => array(
|
462 |
+
'none' => 'Hide title',
|
463 |
+
'above' => 'Above video/thumbnail',
|
464 |
+
'below' => 'Below video/thumbnail',
|
465 |
+
)
|
466 |
) // args
|
467 |
);
|
468 |
// Video Description
|
496 |
'std' => 0
|
497 |
) // args
|
498 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
499 |
|
500 |
// --- Register setting Content so $_POST handling is done ---
|
501 |
register_setting(
|
513 |
$this->slug . '_link' // Page Name
|
514 |
);
|
515 |
// --- Add Fields to video section ---
|
516 |
+
// Link to...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
517 |
add_settings_field(
|
518 |
+
$this->option_name . 'link_to', // id
|
519 |
+
__('Link to...', 'wpsk'), // Title
|
520 |
+
array(&$this, 'settings_field_select'), // Callback
|
521 |
$this->slug . '_link', // Page
|
522 |
'ytc_link', // section
|
523 |
array(
|
524 |
+
'field' => $this->option_name . "[link_to]",
|
525 |
+
// 'label' => __('Ratio:', 'wpsk'),
|
526 |
+
'description' => __('Set where link will lead visitors', 'wpsk'),
|
527 |
'class' => 'regular-text',
|
528 |
+
'value' => $this->defaults['link_to'],
|
529 |
+
'items' => array(
|
530 |
+
'none' => 'Hide link',
|
531 |
+
'vanity' => 'Vanity custom URL',
|
532 |
+
'channel' => 'Channel page URL',
|
533 |
+
'legacy' => 'Legacy username page'
|
534 |
+
)
|
535 |
) // args
|
536 |
);
|
537 |
// Open in...
|
554 |
)
|
555 |
) // args
|
556 |
);
|
557 |
+
// Visit channel text
|
558 |
add_settings_field(
|
559 |
+
$this->option_name . 'goto_txt', // id
|
560 |
+
__('Text for Visit channel link', 'wpsk'), // Title
|
561 |
+
array(&$this, 'settings_field_input_text'), // Callback
|
562 |
$this->slug . '_link', // Page
|
563 |
'ytc_link', // section
|
564 |
array(
|
565 |
+
'field' => $this->option_name . "[goto_txt]",
|
|
|
|
|
566 |
'class' => 'regular-text',
|
567 |
+
'description' => 'Set default title for link',
|
568 |
+
'value' => $this->defaults['goto_txt'],
|
|
|
|
|
|
|
|
|
569 |
) // args
|
570 |
);
|
571 |
+
|
572 |
// --- Register setting Content so $_POST handling is done ---
|
573 |
register_setting(
|
574 |
'ytc_link', // Setting group
|
799 |
$sanitized['username'] = ( ! empty($options['username']) ) ? trim($options['username']) : ''; //$this->defaults['username'];
|
800 |
$sanitized['playlist'] = ( ! empty($options['playlist']) ) ? trim($options['playlist']) : ''; //$this->defaults['playlist'];
|
801 |
$sanitized['resource'] = ( isset($options['resource']) ) ? intval($options['resource']) : $this->defaults['resource'];
|
|
|
802 |
$sanitized['cache'] = ( isset($options['cache']) ) ? intval($options['cache']) : $this->defaults['cache'];
|
803 |
$sanitized['fetch'] = ( ! empty($options['fetch']) ) ? intval($options['fetch']) : $this->defaults['fetch'];
|
804 |
$sanitized['num'] = ( ! empty($options['num']) ) ? intval($options['num']) : $this->defaults['num'];
|
805 |
$sanitized['privacy'] = ( ! empty($options['privacy']) && $options['privacy'] ) ? 1 : 0;
|
|
|
806 |
break; // General
|
807 |
|
808 |
// --- Video ---
|
809 |
case 'ytc_video':
|
810 |
$sanitized['width'] = ( ! empty($options['width']) ) ? intval($options['width']) : $this->defaults['width'];
|
811 |
$sanitized['ratio'] = ( isset($options['ratio']) ) ? intval($options['ratio']) : $this->defaults['ratio'];
|
|
|
812 |
$sanitized['display'] = ( ! empty($options['display']) ) ? trim($options['display']) : $this->defaults['display'];
|
813 |
+
$sanitized['responsive'] = ( ! empty($options['responsive']) && $options['responsive'] ) ? 1 : 0;
|
814 |
+
$sanitized['nolightbox'] = ( ! empty($options['nolightbox']) && $options['nolightbox'] ) ? 1 : 0;
|
815 |
+
|
816 |
$sanitized['themelight'] = ( ! empty($options['themelight']) && $options['themelight'] ) ? 1 : 0;
|
817 |
$sanitized['controls'] = ( ! empty($options['controls']) && $options['controls'] ) ? 1 : 0;
|
818 |
$sanitized['autoplay'] = ( ! empty($options['autoplay']) && $options['autoplay'] ) ? 1 : 0;
|
819 |
$sanitized['autoplay_mute'] = ( ! empty($options['autoplay_mute']) && $options['autoplay_mute'] ) ? 1 : 0;
|
820 |
$sanitized['norel'] = ( ! empty($options['norel']) && $options['norel'] ) ? 1 : 0;
|
821 |
$sanitized['modestbranding'] = ( ! empty($options['modestbranding']) && $options['modestbranding'] ) ? 1 : 0;
|
822 |
+
$sanitized['hideanno'] = ( ! empty($options['hideanno']) && $options['hideanno'] ) ? 1 : 0;
|
823 |
+
$sanitized['hideinfo'] = ( ! empty($options['hideinfo']) && $options['hideinfo'] ) ? 1 : 0;
|
824 |
break; // Video
|
825 |
|
826 |
// --- Content ---
|
827 |
case 'ytc_content':
|
828 |
+
$sanitized['showtitle'] = ( ! empty($options['showtitle']) ) ? $options['showtitle'] : $this->defaults['showtitle'];
|
829 |
$sanitized['showdesc'] = ( ! empty($options['showdesc']) && $options['showdesc'] ) ? 1 : 0;
|
830 |
$sanitized['desclen'] = ( ! empty($options['desclen']) ) ? intval($options['desclen']) : $this->defaults['desclen'];
|
|
|
|
|
|
|
831 |
break; // Content
|
832 |
|
833 |
// --- Link to Channel ---
|
834 |
case 'ytc_link':
|
835 |
+
$sanitized['link_to'] = ( isset($options['link_to']) ) ? intval($options['link_to']) : $this->defaults['link_to'];
|
836 |
$sanitized['goto_txt'] = ( ! empty($options['goto_txt']) ) ? $options['goto_txt'] : $this->defaults['goto_txt'];
|
837 |
$sanitized['popup_goto'] = ( isset($options['popup_goto']) ) ? intval($options['popup_goto']) : $this->defaults['popup_goto'];
|
|
|
838 |
break; // Link to Channel
|
839 |
|
840 |
} // switch
|
inc/settings_tools.php
CHANGED
@@ -1,25 +1,29 @@
|
|
1 |
<h3>Clear YTC Cache</h3>
|
2 |
|
3 |
<p>To avoid page load slowdown, we provide internal YouTube Channel caching functionality. You can enable caching per widget or shortcode, and set how long cached feed for particular widget or shortcode will live.</p>
|
4 |
-
<p>If you wish to force clear cache before it expires (for example, you have set cache timeout to 2 days, but wish to force loading of fresh channel or playlist feed), you can
|
|
|
|
|
5 |
|
6 |
-
<form name="ytc_recache">
|
7 |
-
<label for="slug">Enter relative URL to page where you display target YTC block (include starting and ending slash): <input name="recache_slug" id="recache_slug" value="" /></label>
|
8 |
-
<input type="submit" name="do_recache" id="do_recache" value="ReCache" class="button button-secondary" /> <span id="recache_message"></span>
|
9 |
-
</form>
|
10 |
<script type="text/javascript">
|
11 |
jQuery(document).ready(function($){
|
12 |
-
$('#
|
13 |
ev.preventDefault();
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
});
|
20 |
});
|
21 |
</script>
|
22 |
|
23 |
<h3>Export global settings to JSON</h3>
|
24 |
<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>
|
25 |
-
<a href="?ytc_debug_json_for=global" class="button">Download
|
1 |
<h3>Clear YTC Cache</h3>
|
2 |
|
3 |
<p>To avoid page load slowdown, we provide internal YouTube Channel caching functionality. You can enable caching per widget or shortcode, and set how long cached feed for particular widget or shortcode will live.</p>
|
4 |
+
<p>If you wish to force clear cache before it expires (for example, you have set cache timeout to 2 days, but wish to force loading of fresh channel or playlist feed), you can force Clear All YTC Cache to remove transients from database on demand.</p>
|
5 |
+
|
6 |
+
<button id="ytc_clear_all_cache" class="button">Clear All YTC Cache</button>
|
7 |
|
|
|
|
|
|
|
|
|
8 |
<script type="text/javascript">
|
9 |
jQuery(document).ready(function($){
|
10 |
+
$('#ytc_clear_all_cache').on('click', function(ev){
|
11 |
ev.preventDefault();
|
12 |
+
|
13 |
+
$.post(
|
14 |
+
ajaxurl,
|
15 |
+
{
|
16 |
+
'action': 'ytc_clear_all_cache'
|
17 |
+
},
|
18 |
+
function(response){
|
19 |
+
alert(response);
|
20 |
+
}
|
21 |
+
);
|
22 |
+
|
23 |
});
|
24 |
});
|
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/settings_usage_shortcode.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<h3>How to use shortcode</h3>
|
2 |
-
<p>You can use shortcode <code>[youtube_channel]</code> with options listed below (all options are optional):</p>
|
3 |
|
4 |
<h4>General Settings</h4>
|
5 |
<ul>
|
@@ -9,18 +9,17 @@
|
|
9 |
<li><code>playlist</code> <em>(string)</em> ID of preferred YouTube playlist.</li>
|
10 |
<li><code>resource</code> <em>(int)</em> Resource to use for feed:
|
11 |
<ul>
|
12 |
-
<li>• <code>0</code> Channel</li>
|
13 |
<li>• <code>1</code> Favorites (for defined channel)</li>
|
14 |
<li>• <code>2</code> Playlist</li>
|
15 |
<li>• <code>3</code> Liked Videos (for defined channel)</li>
|
16 |
</ul></li>
|
17 |
-
<li><code>only_pl</code> <em>(bool)</em> You can embed all 4 resources as seekable YouTube playlist block instead to display individual videos. Simply set this option to true (<code>1</code> or <code>true</code>)</li>
|
18 |
<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>
|
19 |
|
20 |
<li><code>fetch</code> <em>(int)</em> Number of videos that will be used as stack for random pick (min 2, max 50)</li>
|
21 |
<li><code>num</code> <em>(int)</em> Number of videos to display per YTC block.</li>
|
22 |
|
23 |
-
<li><code>random</code> <em>(bool)</em> Option to randomize videos on every page load
|
24 |
</ul>
|
25 |
<h4>Video Settings</h4>
|
26 |
<ul>
|
@@ -36,12 +35,12 @@
|
|
36 |
<li>• <code>thumbnail</code> Thumbnail will be used and video will be loaded in lightbox.</li>
|
37 |
<li>• <code>iframe</code> HTML5 (iframe)</li>
|
38 |
<li>• <code>iframe2</code> HTML5 (iframe) with asynchronous loading - recommended</li>
|
|
|
39 |
</ul></li>
|
40 |
|
41 |
<li><code>no_thumb_title</code> <em>(bool)</em> By default YouTube thumbnail will have tooltip with info about video title and date of publishing. By setting this option to <code>1</code> or <code>true</code> you can hide tooltip</li>
|
42 |
<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>
|
43 |
<li><code>controls</code> <em>(bool)</em> Set this option to <code>1</code> or <code>true</code> to hide playback controls. To display controls set this option to <code>0</code> or <code>false</code>.</li>
|
44 |
-
<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>
|
45 |
<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>
|
46 |
<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>
|
47 |
<li><code>norel</code> <em>(bool)</em> Set this option to <code>1</code> or <code>true</code> to hire related videos after finished playbak</li>
|
@@ -49,8 +48,7 @@
|
|
49 |
</ul>
|
50 |
<h4>Content Layout</h4>
|
51 |
<ul>
|
52 |
-
<li><code>showtitle</code> <em>(
|
53 |
-
<li><code>titlebelow</code> <em>(bool)</em> Set to <code>1</code> or <code>true</code> to move video title below video.</li>
|
54 |
<li><code>showdesc</code> <em>(bool)</em> Set to <code>1</code> or <code>true</code> to show video description.</li>
|
55 |
<li><code>desclen</code> <em>(int)</em> Set number of characters to cut down length of video description. Set to <code>0</code> to use full length description.</li>
|
56 |
<li><code>noinfo</code> <em>(bool)</em> Set to <code>1</code> or <code>true</code> to hide overlay video infos (from embedded player)</li>
|
@@ -58,7 +56,6 @@
|
|
58 |
</ul>
|
59 |
<h4>Link to Channel</h4>
|
60 |
<ul>
|
61 |
-
<li><code>goto</code> <em>(bool)</em> Set to <code>1</code> or <code>true</code> to display link to channel at the bottom of YTC block.</li>
|
62 |
<li><code>goto_txt</code> <em>(string)</em></li>
|
63 |
<li><code>popup</code> <em>(int)</em> Control where link to channel will be opened:
|
64 |
<ul>
|
@@ -67,11 +64,12 @@
|
|
67 |
<li>• <code>2</code> open link in new window with <code>target="_blank"</code> anchor attribute</li>
|
68 |
</ul>
|
69 |
</li>
|
70 |
-
<li><code>link_to</code> <em>(
|
71 |
<ul>
|
72 |
-
<li>• <code>
|
73 |
-
<li>• <code>
|
74 |
-
<li>• <code>
|
|
|
75 |
</ul>
|
76 |
</li>
|
77 |
</ul>
|
1 |
<h3>How to use shortcode</h3>
|
2 |
+
<p>You can use shortcode <code>[youtube_channel]</code> with options listed below (all options are optional if you have set defaults in global plugin settings):</p>
|
3 |
|
4 |
<h4>General Settings</h4>
|
5 |
<ul>
|
9 |
<li><code>playlist</code> <em>(string)</em> ID of preferred YouTube playlist.</li>
|
10 |
<li><code>resource</code> <em>(int)</em> Resource to use for feed:
|
11 |
<ul>
|
12 |
+
<li>• <code>0</code> Channel (User Uploads)</li>
|
13 |
<li>• <code>1</code> Favorites (for defined channel)</li>
|
14 |
<li>• <code>2</code> Playlist</li>
|
15 |
<li>• <code>3</code> Liked Videos (for defined channel)</li>
|
16 |
</ul></li>
|
|
|
17 |
<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>
|
18 |
|
19 |
<li><code>fetch</code> <em>(int)</em> Number of videos that will be used as stack for random pick (min 2, max 50)</li>
|
20 |
<li><code>num</code> <em>(int)</em> Number of videos to display per YTC block.</li>
|
21 |
|
22 |
+
<li><code>random</code> <em>(bool)</em> Option to randomize videos on every page load. [<strong>Individual option, does not exists in global plugin settings!</strong>]</li>
|
23 |
</ul>
|
24 |
<h4>Video Settings</h4>
|
25 |
<ul>
|
35 |
<li>• <code>thumbnail</code> Thumbnail will be used and video will be loaded in lightbox.</li>
|
36 |
<li>• <code>iframe</code> HTML5 (iframe)</li>
|
37 |
<li>• <code>iframe2</code> HTML5 (iframe) with asynchronous loading - recommended</li>
|
38 |
+
<li>• <code>playlist</code> Embedded playlist</li>
|
39 |
</ul></li>
|
40 |
|
41 |
<li><code>no_thumb_title</code> <em>(bool)</em> By default YouTube thumbnail will have tooltip with info about video title and date of publishing. By setting this option to <code>1</code> or <code>true</code> you can hide tooltip</li>
|
42 |
<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>
|
43 |
<li><code>controls</code> <em>(bool)</em> Set this option to <code>1</code> or <code>true</code> to hide playback controls. To display controls set this option to <code>0</code> or <code>false</code>.</li>
|
|
|
44 |
<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>
|
45 |
<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>
|
46 |
<li><code>norel</code> <em>(bool)</em> Set this option to <code>1</code> or <code>true</code> to hire related videos after finished playbak</li>
|
48 |
</ul>
|
49 |
<h4>Content Layout</h4>
|
50 |
<ul>
|
51 |
+
<li><code>showtitle</code> <em>(string)</em> Set to <code>none</code> to hide title; <code>above</code> to show video title above video/thumbnail, or <code>below</code> to show video title below video/thumbnail.</li>
|
|
|
52 |
<li><code>showdesc</code> <em>(bool)</em> Set to <code>1</code> or <code>true</code> to show video description.</li>
|
53 |
<li><code>desclen</code> <em>(int)</em> Set number of characters to cut down length of video description. Set to <code>0</code> to use full length description.</li>
|
54 |
<li><code>noinfo</code> <em>(bool)</em> Set to <code>1</code> or <code>true</code> to hide overlay video infos (from embedded player)</li>
|
56 |
</ul>
|
57 |
<h4>Link to Channel</h4>
|
58 |
<ul>
|
|
|
59 |
<li><code>goto_txt</code> <em>(string)</em></li>
|
60 |
<li><code>popup</code> <em>(int)</em> Control where link to channel will be opened:
|
61 |
<ul>
|
64 |
<li>• <code>2</code> open link in new window with <code>target="_blank"</code> anchor attribute</li>
|
65 |
</ul>
|
66 |
</li>
|
67 |
+
<li><code>link_to</code> <em>(string)</em> URL to link:
|
68 |
<ul>
|
69 |
+
<li>• <code>none</code> hide link (default)</li>
|
70 |
+
<li>• <code>vanity</code> Vanity custom URL</li>
|
71 |
+
<li>• <code>channel</code> Channel page</li>
|
72 |
+
<li>• <code>legacy</code> Legacy username page</li>
|
73 |
</ul>
|
74 |
</li>
|
75 |
</ul>
|
inc/tinymce/plugin.js
CHANGED
@@ -57,7 +57,7 @@
|
|
57 |
{
|
58 |
type: 'textbox',
|
59 |
name: 'legacy',
|
60 |
-
label: 'Legacy
|
61 |
value: '',
|
62 |
// tooltip: ''
|
63 |
},
|
@@ -74,7 +74,7 @@
|
|
74 |
label: 'Resource to use',
|
75 |
tooltip: '',
|
76 |
values : [
|
77 |
-
{text: 'Channel', value: '0', selected: true},
|
78 |
{text: 'Favourited videos', value: '1'},
|
79 |
{text: 'Liked videos', value: '3'},
|
80 |
{text: 'Playlist', value: '2'},
|
@@ -83,7 +83,7 @@
|
|
83 |
{
|
84 |
type: 'listbox',
|
85 |
name: 'cache',
|
86 |
-
label: 'Cache
|
87 |
tooltip: '',
|
88 |
values : [
|
89 |
{text: 'Do not cache', value: '0'},
|
@@ -109,6 +109,7 @@
|
|
109 |
{text: '1 month', value: '2419200'},
|
110 |
]
|
111 |
},
|
|
|
112 |
{
|
113 |
type: 'checkbox',
|
114 |
name: 'only_pl',
|
@@ -116,18 +117,19 @@
|
|
116 |
tooltip: 'Overrides random video option.',
|
117 |
checked: false
|
118 |
},
|
|
|
119 |
{
|
120 |
type: 'checkbox',
|
121 |
name: 'privacy',
|
122 |
-
label: 'Use Enhanced Privacy
|
123 |
-
|
124 |
checked: false
|
125 |
},
|
126 |
{
|
127 |
type: 'checkbox',
|
128 |
name: 'random',
|
129 |
label: 'Random video',
|
130 |
-
tooltip: 'Show random video from resource (Have no effect if \"
|
131 |
checked: false
|
132 |
},
|
133 |
{
|
@@ -146,6 +148,7 @@
|
|
146 |
},
|
147 |
]
|
148 |
},
|
|
|
149 |
{
|
150 |
title: 'Video Settings',
|
151 |
type: 'form',
|
@@ -170,9 +173,9 @@
|
|
170 |
{
|
171 |
type: 'textbox',
|
172 |
name: 'width',
|
173 |
-
label: '
|
174 |
value: '306',
|
175 |
-
tooltip: 'Set video or thumbnail
|
176 |
},
|
177 |
{
|
178 |
type: 'listbox',
|
@@ -183,8 +186,19 @@
|
|
183 |
{text: 'Thumbnail', value: 'thumbnail'},
|
184 |
{text: 'HTML5 (iframe)', value: 'iframe'},
|
185 |
{text: 'HTML5 (iframe) Asynchronous', value: 'iframe2'},
|
|
|
|
|
186 |
]
|
187 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
{
|
189 |
type: 'checkbox',
|
190 |
name: 'no_thumb_title',
|
@@ -212,7 +226,7 @@
|
|
212 |
},
|
213 |
{
|
214 |
type: 'checkbox',
|
215 |
-
name: '
|
216 |
label: 'Mute video on autoplay',
|
217 |
checked: false
|
218 |
},
|
@@ -224,28 +238,29 @@
|
|
224 |
},
|
225 |
{
|
226 |
type: 'checkbox',
|
227 |
-
name: '
|
228 |
label: 'Hide YT Logo',
|
229 |
tooltip: 'Does not work for all videos',
|
230 |
checked: true
|
231 |
},
|
232 |
]
|
233 |
},
|
|
|
234 |
{
|
235 |
title: 'Content Layout',
|
236 |
type: 'form',
|
237 |
items: [
|
|
|
238 |
{
|
239 |
-
type: '
|
240 |
name: 'showtitle',
|
241 |
label: 'Show video title',
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
checked: false
|
249 |
},
|
250 |
{
|
251 |
type: 'checkbox',
|
@@ -262,46 +277,41 @@
|
|
262 |
},
|
263 |
{
|
264 |
type: 'checkbox',
|
265 |
-
name: '
|
266 |
label: 'Hide annotations',
|
267 |
-
checked:
|
268 |
},
|
269 |
{
|
270 |
type: 'checkbox',
|
271 |
-
name: '
|
272 |
label: 'Hide video info',
|
273 |
-
checked:
|
274 |
},
|
275 |
]
|
276 |
},
|
|
|
277 |
{
|
278 |
title: 'Link to Channel',
|
279 |
type: 'form',
|
280 |
items: [
|
281 |
-
{
|
282 |
-
type: 'checkbox',
|
283 |
-
name: 'showgoto',
|
284 |
-
label: 'Show link',
|
285 |
-
tooltip: 'Display link to channel below videos or thumbnails',
|
286 |
-
checked: false
|
287 |
-
},
|
288 |
-
{
|
289 |
-
type: 'textbox',
|
290 |
-
name: 'goto_txt',
|
291 |
-
label: 'Title for link',
|
292 |
-
value: 'Visit our YouTube channel',
|
293 |
-
},
|
294 |
{
|
295 |
type: 'listbox',
|
296 |
name: 'link_to',
|
297 |
label: 'Link to',
|
298 |
// tooltip: '',
|
299 |
values : [
|
300 |
-
{text: '
|
301 |
-
{text: '
|
302 |
-
{text: '
|
|
|
303 |
]
|
304 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
]
|
306 |
}
|
307 |
],
|
@@ -318,7 +328,6 @@
|
|
318 |
if ( e.data.playlist ) shortcode += ' playlist=' + e.data.playlist +'';
|
319 |
if ( e.data.resource ) shortcode += ' resource=' + e.data.resource +'';
|
320 |
if ( e.data.cache ) shortcode += ' cache=' + e.data.cache +'';
|
321 |
-
if ( e.data.only_pl ) shortcode += ' only_pl=1';
|
322 |
if ( e.data.privacy ) shortcode += ' privacy=1';
|
323 |
if ( e.data.random ) shortcode += ' random=1';
|
324 |
if ( e.data.fetch ) shortcode += ' fetch=' + e.data.fetch +'';
|
@@ -329,26 +338,25 @@
|
|
329 |
if ( e.data.responsive ) shortcode += ' responsive=1';
|
330 |
if ( e.data.width ) shortcode += ' width=' + e.data.width + '';
|
331 |
if ( e.data.display ) shortcode += ' display=' + e.data.display + '';
|
|
|
332 |
if ( e.data.no_thumb_title ) shortcode += ' no_thumb_title=1';
|
333 |
if ( e.data.themelight ) shortcode += ' themelight=1';
|
334 |
if ( e.data.controls ) shortcode += ' controls=1';
|
335 |
if ( e.data.autoplay ) shortcode += ' autoplay=1';
|
336 |
-
if ( e.data.
|
337 |
if ( e.data.norel ) shortcode += ' norel=1';
|
338 |
-
if ( e.data.
|
339 |
|
340 |
// Content Layout
|
341 |
-
if ( e.data.showtitle ) shortcode += ' showtitle=
|
342 |
-
if ( e.data.titlebelow ) shortcode += ' titlebelow=1';
|
343 |
if ( e.data.showdesc ) shortcode += ' showdesc=1';
|
344 |
if ( e.data.desclen ) shortcode += ' desclen=' + e.data.desclen + '';
|
345 |
-
if ( e.data.
|
346 |
-
if ( e.data.
|
347 |
|
348 |
// Link to Channel
|
349 |
-
if ( e.data.showgoto ) shortcode += ' showgoto=1';
|
350 |
-
if ( e.data.goto_txt ) shortcode += ' goto_txt=\"' + e.data.goto_txt + '\"';
|
351 |
if ( e.data.link_to ) shortcode += ' link_to=' + e.data.link_to + '';
|
|
|
352 |
|
353 |
// Global
|
354 |
if ( e.data.class ) shortcode += ' class=' + e.data.class + '';
|
57 |
{
|
58 |
type: 'textbox',
|
59 |
name: 'legacy',
|
60 |
+
label: 'Legacy Username',
|
61 |
value: '',
|
62 |
// tooltip: ''
|
63 |
},
|
74 |
label: 'Resource to use',
|
75 |
tooltip: '',
|
76 |
values : [
|
77 |
+
{text: 'Channel (User Uploads)', value: '0', selected: true},
|
78 |
{text: 'Favourited videos', value: '1'},
|
79 |
{text: 'Liked videos', value: '3'},
|
80 |
{text: 'Playlist', value: '2'},
|
83 |
{
|
84 |
type: 'listbox',
|
85 |
name: 'cache',
|
86 |
+
label: 'Cache feed',
|
87 |
tooltip: '',
|
88 |
values : [
|
89 |
{text: 'Do not cache', value: '0'},
|
109 |
{text: '1 month', value: '2419200'},
|
110 |
]
|
111 |
},
|
112 |
+
/*
|
113 |
{
|
114 |
type: 'checkbox',
|
115 |
name: 'only_pl',
|
117 |
tooltip: 'Overrides random video option.',
|
118 |
checked: false
|
119 |
},
|
120 |
+
*/
|
121 |
{
|
122 |
type: 'checkbox',
|
123 |
name: 'privacy',
|
124 |
+
label: 'Use Enhanced Privacy',
|
125 |
+
tooltip: 'Enable this option to protect your visitors privacy',
|
126 |
checked: false
|
127 |
},
|
128 |
{
|
129 |
type: 'checkbox',
|
130 |
name: 'random',
|
131 |
label: 'Random video',
|
132 |
+
tooltip: 'Show random video from resource (Have no effect if \"What to show?\" has been set to \"Embedded Playlist\")',
|
133 |
checked: false
|
134 |
},
|
135 |
{
|
148 |
},
|
149 |
]
|
150 |
},
|
151 |
+
|
152 |
{
|
153 |
title: 'Video Settings',
|
154 |
type: 'form',
|
173 |
{
|
174 |
type: 'textbox',
|
175 |
name: 'width',
|
176 |
+
label: 'Initial width (px)',
|
177 |
value: '306',
|
178 |
+
tooltip: 'Set initial width for video or thumbnail (in pixels)'
|
179 |
},
|
180 |
{
|
181 |
type: 'listbox',
|
186 |
{text: 'Thumbnail', value: 'thumbnail'},
|
187 |
{text: 'HTML5 (iframe)', value: 'iframe'},
|
188 |
{text: 'HTML5 (iframe) Asynchronous', value: 'iframe2'},
|
189 |
+
{text: 'Embedded Playlist', value: 'playlist'},
|
190 |
+
// {text: 'Gallery', value: 'gallery'},
|
191 |
]
|
192 |
},
|
193 |
+
/*
|
194 |
+
{
|
195 |
+
type: 'textbox',
|
196 |
+
name: 'cols',
|
197 |
+
label: 'Columns in Gallery',
|
198 |
+
value: '3',
|
199 |
+
tooltip: 'Set number of columns for gallery display mode (min 1, max 8)'
|
200 |
+
},
|
201 |
+
*/
|
202 |
{
|
203 |
type: 'checkbox',
|
204 |
name: 'no_thumb_title',
|
226 |
},
|
227 |
{
|
228 |
type: 'checkbox',
|
229 |
+
name: 'mute',
|
230 |
label: 'Mute video on autoplay',
|
231 |
checked: false
|
232 |
},
|
238 |
},
|
239 |
{
|
240 |
type: 'checkbox',
|
241 |
+
name: 'nobrand',
|
242 |
label: 'Hide YT Logo',
|
243 |
tooltip: 'Does not work for all videos',
|
244 |
checked: true
|
245 |
},
|
246 |
]
|
247 |
},
|
248 |
+
|
249 |
{
|
250 |
title: 'Content Layout',
|
251 |
type: 'form',
|
252 |
items: [
|
253 |
+
|
254 |
{
|
255 |
+
type: 'listbox',
|
256 |
name: 'showtitle',
|
257 |
label: 'Show video title',
|
258 |
+
tooltip: '',
|
259 |
+
values : [
|
260 |
+
{text: 'Hide title', value: 'none', selected: true},
|
261 |
+
{text: 'Above video/thumbnail', value: 'above'},
|
262 |
+
{text: 'Below video/thumbnail', value: 'below'},
|
263 |
+
]
|
|
|
264 |
},
|
265 |
{
|
266 |
type: 'checkbox',
|
277 |
},
|
278 |
{
|
279 |
type: 'checkbox',
|
280 |
+
name: 'noanno',
|
281 |
label: 'Hide annotations',
|
282 |
+
checked: true
|
283 |
},
|
284 |
{
|
285 |
type: 'checkbox',
|
286 |
+
name: 'noinfo',
|
287 |
label: 'Hide video info',
|
288 |
+
checked: true
|
289 |
},
|
290 |
]
|
291 |
},
|
292 |
+
|
293 |
{
|
294 |
title: 'Link to Channel',
|
295 |
type: 'form',
|
296 |
items: [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
{
|
298 |
type: 'listbox',
|
299 |
name: 'link_to',
|
300 |
label: 'Link to',
|
301 |
// tooltip: '',
|
302 |
values : [
|
303 |
+
{text: 'Hide link', value: 'none', selected: true},
|
304 |
+
{text: 'Vanity/Custom URL', value: 'vanity'}, // ex 2
|
305 |
+
{text: 'Channel page URL', value: 'channel'}, // ex 1
|
306 |
+
{text: 'Legacy username URL', value: 'legacy'}, // ex 0
|
307 |
]
|
308 |
},
|
309 |
+
{
|
310 |
+
type: 'textbox',
|
311 |
+
name: 'goto_txt',
|
312 |
+
label: 'Title for link',
|
313 |
+
value: 'Visit our YouTube channel',
|
314 |
+
},
|
315 |
]
|
316 |
}
|
317 |
],
|
328 |
if ( e.data.playlist ) shortcode += ' playlist=' + e.data.playlist +'';
|
329 |
if ( e.data.resource ) shortcode += ' resource=' + e.data.resource +'';
|
330 |
if ( e.data.cache ) shortcode += ' cache=' + e.data.cache +'';
|
|
|
331 |
if ( e.data.privacy ) shortcode += ' privacy=1';
|
332 |
if ( e.data.random ) shortcode += ' random=1';
|
333 |
if ( e.data.fetch ) shortcode += ' fetch=' + e.data.fetch +'';
|
338 |
if ( e.data.responsive ) shortcode += ' responsive=1';
|
339 |
if ( e.data.width ) shortcode += ' width=' + e.data.width + '';
|
340 |
if ( e.data.display ) shortcode += ' display=' + e.data.display + '';
|
341 |
+
// if ( e.data.cols ) shortcode += ' cols=' + e.data.cols + '';
|
342 |
if ( e.data.no_thumb_title ) shortcode += ' no_thumb_title=1';
|
343 |
if ( e.data.themelight ) shortcode += ' themelight=1';
|
344 |
if ( e.data.controls ) shortcode += ' controls=1';
|
345 |
if ( e.data.autoplay ) shortcode += ' autoplay=1';
|
346 |
+
if ( e.data.mute ) shortcode += ' mute=1';
|
347 |
if ( e.data.norel ) shortcode += ' norel=1';
|
348 |
+
if ( e.data.nobrand ) shortcode += ' nobrand=1';
|
349 |
|
350 |
// Content Layout
|
351 |
+
if ( e.data.showtitle ) shortcode += ' showtitle=' + e.data.showtitle + '';
|
|
|
352 |
if ( e.data.showdesc ) shortcode += ' showdesc=1';
|
353 |
if ( e.data.desclen ) shortcode += ' desclen=' + e.data.desclen + '';
|
354 |
+
if ( e.data.noanno ) shortcode += ' noanno=1';
|
355 |
+
if ( e.data.noinfo ) shortcode += ' noinfo=1';
|
356 |
|
357 |
// Link to Channel
|
|
|
|
|
358 |
if ( e.data.link_to ) shortcode += ' link_to=' + e.data.link_to + '';
|
359 |
+
if ( e.data.goto_txt ) shortcode += ' goto_txt=\"' + e.data.goto_txt + '\"';
|
360 |
|
361 |
// Global
|
362 |
if ( e.data.class ) shortcode += ' class=' + e.data.class + '';
|
inc/tinymce/plugin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(){tinymce.PluginManager.add("youtube_channel",function(e){e.addButton("youtube_channel_shortcode",{tooltip:"YouTube Channel",icon:"ytc",onclick:function(){e.windowManager.open({title:"YouTube Channel",bodyType:"tabpanel",buttons:[{text:"Insert Shortcode",onclick:"submit",classes:"widget btn primary",minWidth:130},{text:"Cancel",onclick:"close"}],body:[{title:"General Settings",type:"form",items:[{type:"textbox",name:"class",label:"Custom CSS Class",value:"",tooltip:"Enter custom class for YTC block, if you wish to target block styling"},{type:"textbox",name:"vanity",label:"Vanity/Custom ID",value:""},{type:"textbox",name:"channel",label:"YouTube Channel ID",value:""},{type:"textbox",name:"legacy",label:"Legacy
|
1 |
+
!function(){tinymce.PluginManager.add("youtube_channel",function(e){e.addButton("youtube_channel_shortcode",{tooltip:"YouTube Channel",icon:"ytc",onclick:function(){e.windowManager.open({title:"YouTube Channel",bodyType:"tabpanel",buttons:[{text:"Insert Shortcode",onclick:"submit",classes:"widget btn primary",minWidth:130},{text:"Cancel",onclick:"close"}],body:[{title:"General Settings",type:"form",items:[{type:"textbox",name:"class",label:"Custom CSS Class",value:"",tooltip:"Enter custom class for YTC block, if you wish to target block styling"},{type:"textbox",name:"vanity",label:"Vanity/Custom ID",value:""},{type:"textbox",name:"channel",label:"YouTube Channel ID",value:""},{type:"textbox",name:"legacy",label:"Legacy Username",value:""},{type:"textbox",name:"playlist",label:"Playlist ID",value:""},{type:"listbox",name:"resource",label:"Resource to use",tooltip:"",values:[{text:"Channel (User Uploads)",value:"0",selected:!0},{text:"Favourited videos",value:"1"},{text:"Liked videos",value:"3"},{text:"Playlist",value:"2"}]},{type:"listbox",name:"cache",label:"Cache feed",tooltip:"",values:[{text:"Do not cache",value:"0"},{text:"1 minute",value:"60"},{text:"5 minutes",value:"300",selected:!0},{text:"15 minutes",value:"900"},{text:"30 minutes",value:"1800"},{text:"1 hour",value:"3600"},{text:"2 hours",value:"7200"},{text:"5 hours",value:"18000"},{text:"10 hours",value:"36000"},{text:"12 hours",value:"43200"},{text:"18 hours",value:"64800"},{text:"1 day",value:"86400"},{text:"2 days",value:"172800"},{text:"3 days",value:"259200"},{text:"4 days",value:"345600"},{text:"5 days",value:"432000"},{text:"6 days",value:"518400"},{text:"1 week",value:"604800"},{text:"2 weeks",value:"1209600"},{text:"3 weeks",value:"1814400"},{text:"1 month",value:"2419200"}]},{type:"checkbox",name:"privacy",label:"Use Enhanced Privacy",tooltip:"Enable this option to protect your visitors privacy",checked:!1},{type:"checkbox",name:"random",label:"Random video",tooltip:'Show random video from resource (Have no effect if "What to show?" has been set to "Embedded Playlist")',checked:!1},{type:"textbox",name:"fetch",label:"Fetch",value:"10",tooltip:"Number of videos that will be used for random pick (min 2, max 50, default 25)"},{type:"textbox",name:"num",label:"Show",value:"1",tooltip:"Number of videos to display"}]},{title:"Video Settings",type:"form",items:[{type:"listbox",name:"ratio",label:"Aspect Ratio",values:[{text:"Widescreen (16:9)",value:"3",selected:!0},{text:"Standard TV (4:3)",value:"1"}]},{type:"checkbox",name:"responsive",label:"Responsive video",tooltip:"Make video responsive (distribute one full width video per row)",checked:!0},{type:"textbox",name:"width",label:"Initial width (px)",value:"306",tooltip:"Set initial width for video or thumbnail (in pixels)"},{type:"listbox",name:"display",label:"What to show?",tooltip:"",values:[{text:"Thumbnail",value:"thumbnail"},{text:"HTML5 (iframe)",value:"iframe"},{text:"HTML5 (iframe) Asynchronous",value:"iframe2"},{text:"Embedded Playlist",value:"playlist"}]},{type:"checkbox",name:"no_thumb_title",label:"Hide thumbnail tooltip",checked:!1},{type:"checkbox",name:"themelight",label:"Use light theme",tooltip:"Default theme is dark",checked:!1},{type:"checkbox",name:"controls",label:"Hide player controls",checked:!1},{type:"checkbox",name:"autoplay",label:"Autoplay video/playlist",checked:!1},{type:"checkbox",name:"mute",label:"Mute video on autoplay",checked:!1},{type:"checkbox",name:"norel",label:"Hide related videos",checked:!0},{type:"checkbox",name:"nobrand",label:"Hide YT Logo",tooltip:"Does not work for all videos",checked:!0}]},{title:"Content Layout",type:"form",items:[{type:"listbox",name:"showtitle",label:"Show video title",tooltip:"",values:[{text:"Hide title",value:"none",selected:!0},{text:"Above video/thumbnail",value:"above"},{text:"Below video/thumbnail",value:"below"}]},{type:"checkbox",name:"showdesc",label:"Show video description",checked:!1},{type:"textbox",name:"desclen",label:"Description length",value:"0",tooltip:"Set number of characters to cut down video description to (0 means full length)"},{type:"checkbox",name:"noanno",label:"Hide annotations",checked:!0},{type:"checkbox",name:"noinfo",label:"Hide video info",checked:!0}]},{title:"Link to Channel",type:"form",items:[{type:"listbox",name:"link_to",label:"Link to",values:[{text:"Hide link",value:"none",selected:!0},{text:"Vanity/Custom URL",value:"vanity"},{text:"Channel page URL",value:"channel"},{text:"Legacy username URL",value:"legacy"}]},{type:"textbox",name:"goto_txt",label:"Title for link",value:"Visit our YouTube channel"}]}],onsubmit:function(t){var a="[youtube_channel";t.data.vanity&&(a+=" vanity="+t.data.vanity),t.data.channel&&(a+=" channel="+t.data.channel),t.data.legacy&&(a+=" legacy="+t.data.legacy),t.data.playlist&&(a+=" playlist="+t.data.playlist),t.data.resource&&(a+=" resource="+t.data.resource),t.data.cache&&(a+=" cache="+t.data.cache),t.data.privacy&&(a+=" privacy=1"),t.data.random&&(a+=" random=1"),t.data.fetch&&(a+=" fetch="+t.data.fetch),t.data.num&&(a+=" num="+t.data.num),t.data.ratio&&(a+=" ratio="+t.data.ratio),t.data.responsive&&(a+=" responsive=1"),t.data.width&&(a+=" width="+t.data.width),t.data.display&&(a+=" display="+t.data.display),t.data.no_thumb_title&&(a+=" no_thumb_title=1"),t.data.themelight&&(a+=" themelight=1"),t.data.controls&&(a+=" controls=1"),t.data.autoplay&&(a+=" autoplay=1"),t.data.mute&&(a+=" mute=1"),t.data.norel&&(a+=" norel=1"),t.data.nobrand&&(a+=" nobrand=1"),t.data.showtitle&&(a+=" showtitle="+t.data.showtitle),t.data.showdesc&&(a+=" showdesc=1"),t.data.desclen&&(a+=" desclen="+t.data.desclen),t.data.noanno&&(a+=" noanno=1"),t.data.noinfo&&(a+=" noinfo=1"),t.data.link_to&&(a+=" link_to="+t.data.link_to),t.data.goto_txt&&(a+=' goto_txt="'+t.data.goto_txt+'"'),t.data.class&&(a+=" class="+t.data.class),a+="]",e.insertContent(a)}})}})})}();
|
inc/widget.php
CHANGED
@@ -37,13 +37,12 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
37 |
// General Options
|
38 |
$title = (!empty($instance['title'])) ? esc_attr($instance['title']) : '';
|
39 |
$class = (!empty($instance['class'])) ? esc_attr($instance['class']) : '';
|
40 |
-
$vanity = (!empty($instance['vanity']) ) ? esc_attr($instance['vanity']) :
|
41 |
-
$channel = (!empty($instance['channel'])) ? esc_attr($instance['channel']) :
|
42 |
-
$username = (!empty($instance['username'])) ? esc_attr($instance['username']) :
|
43 |
-
$playlist = (!empty($instance['playlist'])) ? esc_attr($instance['playlist']) :
|
44 |
|
45 |
$resource = (!empty($instance['resource'])) ? esc_attr($instance['resource']) : 0; // resource to use: channel, favorites, playlist
|
46 |
-
$only_pl = (!empty($instance['only_pl'])) ? esc_attr($instance['only_pl']) : '';
|
47 |
|
48 |
$cache = (!empty($instance['cache'])) ? esc_attr($instance['cache']) : trim($defaults['cache']);
|
49 |
|
@@ -56,7 +55,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
56 |
// Video Settings
|
57 |
$ratio = (!empty($instance['ratio'])) ? esc_attr($instance['ratio']) : trim($defaults['ratio']);
|
58 |
$width = (!empty($instance['width'])) ? esc_attr($instance['width']) : trim($defaults['width']);
|
59 |
-
$responsive = (
|
60 |
|
61 |
$display = (!empty($instance['display'])) ? esc_attr($instance['display']) : trim($defaults['display']);
|
62 |
$no_thumb_title = (!empty($instance['no_thumb_title'])) ? esc_attr($instance['no_thumb_title']) : 0;
|
@@ -68,105 +67,101 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
68 |
$norel = (!empty($instance['norel'])) ? esc_attr($instance['norel']) : '';
|
69 |
|
70 |
// Content Layout
|
71 |
-
$showtitle = (!empty($instance['showtitle'])) ? esc_attr($instance['showtitle']) : '';
|
72 |
-
$titlebelow = (!empty($instance['titlebelow'])) ? esc_attr($instance['titlebelow']) : '';
|
73 |
$showdesc = (!empty($instance['showdesc'])) ? esc_attr($instance['showdesc']) : '';
|
74 |
$modestbranding = (!empty($instance['modestbranding'])) ? esc_attr($instance['modestbranding']) : '';
|
75 |
$desclen = (!empty($instance['desclen'])) ? esc_attr($instance['desclen']) : 0;
|
76 |
-
$descappend = (!empty($instance['descappend'])) ? esc_attr($instance['descappend']) : '…';
|
77 |
|
78 |
$hideanno = (!empty($instance['hideanno'])) ? esc_attr($instance['hideanno']) : '';
|
79 |
$hideinfo = (!empty($instance['hideinfo'])) ? esc_attr($instance['hideinfo']) : '';
|
80 |
|
81 |
// Link to Channel
|
|
|
82 |
$goto_txt = (!empty($instance['goto_txt'])) ? esc_attr($instance['goto_txt']) : '';
|
83 |
-
$showgoto = (!empty($instance['showgoto'])) ? esc_attr($instance['showgoto']) : '';
|
84 |
$popup_goto = (!empty($instance['popup_goto'])) ? esc_attr($instance['popup_goto']) : '';
|
85 |
-
$link_to = (!empty($instance['link_to'])) ? esc_attr($instance['link_to']) : '';
|
86 |
?>
|
87 |
|
88 |
<p>
|
89 |
-
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'youtube-channel');
|
90 |
<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', 'youtube-channel'); ?>" />
|
91 |
</label>
|
92 |
</p>
|
93 |
<p>
|
94 |
-
<label for="<?php echo $this->get_field_id('class'); ?>"><?php _e('Custom CSS Class', 'youtube-channel');
|
95 |
<input type="text" class="widefat" id="<?php echo $this->get_field_id('class'); ?>" name="<?php echo $this->get_field_name('class'); ?>" value="<?php echo $class; ?>" title="<?php _e('Enter custom class for YTC block, if you wish to target block styling', 'youtube-channel'); ?>" />
|
96 |
</label>
|
97 |
</p>
|
98 |
<p>Get your Channel ID and Custom ID from <a href="https://www.youtube.com/account_advanced" target="_blank">here</a>.</p>
|
99 |
<p class="half left glue-top">
|
100 |
-
<label for="<?php echo $this->get_field_id('vanity'); ?>"><?php _e('Vanity/Custom ID', 'youtube-channel');
|
101 |
<input type="text" class="widefat" id="<?php echo $this->get_field_id('vanity'); ?>" name="<?php echo $this->get_field_name('vanity'); ?>" value="<?php echo $vanity; ?>" title="<?php _e('YouTube Vanity/Custom ID from URL (part after /c/)', 'youtube-channel'); ?>" />
|
102 |
</label>
|
103 |
</p>
|
104 |
<p class="half right glue-top">
|
105 |
-
<label for="<?php echo $this->get_field_id('channel'); ?>"><?php _e('Channel ID', 'youtube-channel');
|
106 |
<input type="text" class="widefat" id="<?php echo $this->get_field_id('channel'); ?>" name="<?php echo $this->get_field_name('channel'); ?>" value="<?php echo $channel; ?>" title="<?php _e('Find Channel ID behind My Channel menu item in YouTube (ID have UC at the beginning)', 'youtube-channel'); ?>" />
|
107 |
</label>
|
108 |
</p>
|
109 |
<p class="half left glue-top">
|
110 |
-
<label for="<?php echo $this->get_field_id('username'); ?>"><?php _e('Legacy Username', 'youtube-channel');
|
111 |
<input type="text" class="widefat" id="<?php echo $this->get_field_id('username'); ?>" name="<?php echo $this->get_field_name('username'); ?>" value="<?php echo $username; ?>" title="<?php _e('Legacy YouTube username located behind /user/ part of channel URL (available only on old YouTube accounts)', 'youtube-channel'); ?>" />
|
112 |
</label>
|
113 |
</p>
|
114 |
<p class="half right glue-top">
|
115 |
-
<label for="<?php echo $this->get_field_id('playlist'); ?>"><?php _e('Playlist ID', 'youtube-channel');
|
116 |
<input type="text" class="widefat" id="<?php echo $this->get_field_id('playlist'); ?>" name="<?php echo $this->get_field_name('playlist'); ?>" value="<?php echo $playlist; ?>" title="<?php _e('Find Playlist ID in your playlists (ID have PL at the beginning)', 'youtube-channel'); ?>" />
|
117 |
</label>
|
118 |
</p>
|
119 |
<p class="half left glue-top">
|
120 |
-
<label for="<?php echo $this->get_field_id('resource'); ?>"><?php _e('Resource to use', 'youtube-channel');
|
121 |
<select class="widefat" id="<?php echo $this->get_field_id( 'resource' ); ?>" name="<?php echo $this->get_field_name( 'resource' ); ?>">
|
122 |
-
|
123 |
<option value="1"<?php selected( $resource, 1 ); ?>><?php _e('Favourites', 'youtube-channel'); ?></option>
|
124 |
<option value="3"<?php selected( $resource, 3 ); ?>><?php _e('Liked Videos', 'youtube-channel'); ?></option>
|
125 |
<option value="2"<?php selected( $resource, 2 ); ?>><?php _e('Playlist', 'youtube-channel'); ?></option>
|
126 |
</select>
|
|
|
127 |
</p>
|
128 |
<p class="half right glue-top">
|
129 |
-
<label for="<?php echo $this->get_field_id('cache'); ?>"><?php _e('Cache feed', 'youtube-channel');
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
<p class="playlist-only <?php echo $this->get_field_id('resource'); ?> glue-top">
|
137 |
-
<label for="<?php echo $this->get_field_id( 'only_pl' ); ?>" id="<?php echo $this->get_field_id( 'only_pl' ); ?>_label"><input class="checkbox" type="checkbox" <?php checked( (bool) $only_pl, true ); ?> id="<?php echo $this->get_field_id( 'only_pl' ); ?>" name="<?php echo $this->get_field_name( 'only_pl' ); ?>" title="<?php _e('Enable this option to embed seek YouTube playlist instead individual videos from selected resource.', 'youtube-channel'); ?>" /> <?php _e('Embed resource as playlist <small>(override "random video")</small>', 'youtube-channel'); ?></label>
|
138 |
</p>
|
139 |
-
|
140 |
<p class="half left glue-top">
|
141 |
-
<label for="<?php echo $this->get_field_id('fetch'); ?>"><?php _e('Fetch', 'youtube-channel');
|
142 |
</p>
|
143 |
<p class="half right glue-top">
|
144 |
-
<label for="<?php echo $this->get_field_id('num'); ?>"><?php _e('Show', 'youtube-channel');
|
145 |
</p>
|
146 |
<p>
|
147 |
-
<input class="checkbox" type="checkbox" <?php checked( (bool) $privacy, true ); ?> id="<?php echo $this->get_field_id( 'privacy' ); ?>" name="<?php echo $this->get_field_name( 'privacy' ); ?>" title="<?php _e('Enable this option to protect your visitors privacy', 'youtube-channel'); ?>" /> <label for="<?php echo $this->get_field_id( 'privacy' ); ?>"><?php printf(__('
|
148 |
<br />
|
149 |
-
<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'); ?>" /> <label for="<?php echo $this->get_field_id( 'random' ); ?>"><?php _e('Show random video from resource <small>(Have no effect if "
|
150 |
</p>
|
151 |
|
152 |
<h4><?php _e('Video Settings', 'youtube-channel'); ?></h4>
|
153 |
-
<p><label for="<?php echo $this->get_field_id('ratio'); ?>"><?php _e('Aspect ratio', 'youtube-channel');
|
154 |
<select class="widefat" id="<?php echo $this->get_field_id( 'ratio' ); ?>" name="<?php echo $this->get_field_name( 'ratio' ); ?>">
|
155 |
<option value="3"<?php selected( $ratio, 3 ); ?>>16:9</option>
|
156 |
-
<?php /* <option value="2"<?php selected( $ratio, 2 ); ?>>16:10</option> */ ?>
|
157 |
<option value="1"<?php selected( $ratio, 1 ); ?>>4:3</option>
|
158 |
</select><br />
|
159 |
-
<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' ); ?>" /> <label for="<?php echo $this->get_field_id( 'responsive' ); ?>"><?php _e('Responsive video (distribute one full width
|
160 |
</p>
|
161 |
<p>
|
162 |
-
<label for="<?php echo $this->get_field_id('width'); ?>"><?php _e('
|
163 |
</p>
|
164 |
<p>
|
165 |
-
<label for="<?php echo $this->get_field_id('display'); ?>"
|
|
|
|
|
166 |
<select class="widefat" id="<?php echo $this->get_field_id( 'display' ); ?>" name="<?php echo $this->get_field_name( 'display' ); ?>">
|
167 |
<option value="thumbnail"<?php selected( $display, 'thumbnail' ); ?>><?php _e('Thumbnail', 'youtube-channel'); ?></option>
|
168 |
<option value="iframe"<?php selected( $display, 'iframe' ); ?>><?php _e('HTML5 (iframe)', 'youtube-channel'); ?></option>
|
169 |
<option value="iframe2"<?php selected( $display, 'iframe2' ); ?>><?php _e('HTML5 (iframe) Asynchronous', 'youtube-channel'); ?></option>
|
|
|
170 |
</select>
|
171 |
<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' ); ?>" /> <label for="<?php echo $this->get_field_id( 'no_thumb_title' ); ?>"><?php _e('Hide thumbnail tooltip', 'youtube-channel'); ?></label><br />
|
172 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $themelight, true ); ?> id="<?php echo $this->get_field_id( 'themelight' ); ?>" name="<?php echo $this->get_field_name( 'themelight' ); ?>" /> <label for="<?php echo $this->get_field_id( 'themelight' ); ?>"><?php _e('Use light theme (default is dark)', 'youtube-channel'); ?></label><br />
|
@@ -179,30 +174,41 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
179 |
|
180 |
<h4><?php _e('Content Layout', 'youtube-channel'); ?></h4>
|
181 |
<p>
|
182 |
-
<
|
183 |
-
|
184 |
-
|
185 |
-
<
|
186 |
-
|
187 |
-
|
188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
</p>
|
190 |
|
191 |
<h4><?php _e('Link to Channel', 'youtube-channel'); ?></h4>
|
192 |
-
<p>
|
193 |
-
<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 below videos', 'youtube-channel'); ?></label>
|
194 |
-
</p>
|
195 |
-
<p class="glue-top <?php echo $this->get_field_id('showgoto'); ?>">
|
196 |
<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 our YouTube channel. You can use placeholders %vanity%, %channel% and %username%.', 'youtube-channel'); ?>" placeholder="<?php _e('Visit our YouTube channel', 'youtube-channel'); ?>" />
|
197 |
</p>
|
198 |
-
<p class="half left glue-top
|
199 |
<select class="widefat" id="<?php echo $this->get_field_id( 'link_to' ); ?>" name="<?php echo $this->get_field_name( 'link_to' ); ?>">
|
200 |
-
<option value="
|
201 |
-
<option value="
|
202 |
-
<option value="
|
|
|
203 |
</select>
|
204 |
</p>
|
205 |
-
<p class="half right glue-top
|
206 |
<select class="widefat" id="<?php echo $this->get_field_id( 'popup_goto' ); ?>" name="<?php echo $this->get_field_name( 'popup_goto' ); ?>">
|
207 |
<option value="0"<?php selected( $popup_goto, 0 ); ?>><?php _e('Open link in same window', 'youtube-channel'); ?></option>
|
208 |
<option value="1"<?php selected( $popup_goto, 1 ); ?>><?php _e('Open link in new window (JavaScript)', 'youtube-channel'); ?></option>
|
@@ -210,8 +216,16 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
210 |
</select>
|
211 |
</p>
|
212 |
|
213 |
-
<h4><?php _e('Does not work?
|
214 |
-
<p
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
</p>
|
216 |
|
217 |
<?php
|
@@ -229,19 +243,15 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
229 |
$instance['num'] = $new_instance['num'];
|
230 |
$instance['resource'] = $new_instance['resource'];
|
231 |
$instance['cache'] = $new_instance['cache'];
|
232 |
-
$instance['only_pl'] = (isset($new_instance['only_pl'])) ? $new_instance['only_pl'] : false;
|
233 |
$instance['random'] = (isset($new_instance['random'])) ? $new_instance['random'] : false;
|
234 |
$instance['fetch'] = $new_instance['fetch'];
|
235 |
|
236 |
-
$instance['showgoto'] = (isset($new_instance['showgoto'])) ? $new_instance['showgoto'] : false;
|
237 |
$instance['goto_txt'] = strip_tags($new_instance['goto_txt']);
|
238 |
$instance['popup_goto'] = $new_instance['popup_goto'];
|
239 |
$instance['link_to'] = $new_instance['link_to'];
|
240 |
|
241 |
-
$instance['showtitle'] = (isset($new_instance['showtitle'])) ? $new_instance['showtitle'] :
|
242 |
-
$instance['titlebelow'] = (isset($new_instance['titlebelow'])) ? $new_instance['titlebelow'] : false;
|
243 |
$instance['showdesc'] = (isset($new_instance['showdesc'])) ? $new_instance['showdesc'] : false;
|
244 |
-
$instance['descappend'] = strip_tags($new_instance['descappend']);
|
245 |
$instance['desclen'] = strip_tags($new_instance['desclen']);
|
246 |
$instance['width'] = strip_tags($new_instance['width']);
|
247 |
$instance['responsive'] = (isset($new_instance['responsive'])) ? $new_instance['responsive'] : '';
|
37 |
// General Options
|
38 |
$title = (!empty($instance['title'])) ? esc_attr($instance['title']) : '';
|
39 |
$class = (!empty($instance['class'])) ? esc_attr($instance['class']) : '';
|
40 |
+
$vanity = (!empty($instance['vanity']) ) ? esc_attr($instance['vanity']) : '';
|
41 |
+
$channel = (!empty($instance['channel'])) ? esc_attr($instance['channel']) : '';
|
42 |
+
$username = (!empty($instance['username'])) ? esc_attr($instance['username']) : '';
|
43 |
+
$playlist = (!empty($instance['playlist'])) ? esc_attr($instance['playlist']) : '';
|
44 |
|
45 |
$resource = (!empty($instance['resource'])) ? esc_attr($instance['resource']) : 0; // resource to use: channel, favorites, playlist
|
|
|
46 |
|
47 |
$cache = (!empty($instance['cache'])) ? esc_attr($instance['cache']) : trim($defaults['cache']);
|
48 |
|
55 |
// Video Settings
|
56 |
$ratio = (!empty($instance['ratio'])) ? esc_attr($instance['ratio']) : trim($defaults['ratio']);
|
57 |
$width = (!empty($instance['width'])) ? esc_attr($instance['width']) : trim($defaults['width']);
|
58 |
+
$responsive = (isset($instance['responsive'])) ? esc_attr($instance['responsive']) : 1;
|
59 |
|
60 |
$display = (!empty($instance['display'])) ? esc_attr($instance['display']) : trim($defaults['display']);
|
61 |
$no_thumb_title = (!empty($instance['no_thumb_title'])) ? esc_attr($instance['no_thumb_title']) : 0;
|
67 |
$norel = (!empty($instance['norel'])) ? esc_attr($instance['norel']) : '';
|
68 |
|
69 |
// Content Layout
|
70 |
+
$showtitle = (!empty($instance['showtitle'])) ? esc_attr($instance['showtitle']) : 'none';
|
|
|
71 |
$showdesc = (!empty($instance['showdesc'])) ? esc_attr($instance['showdesc']) : '';
|
72 |
$modestbranding = (!empty($instance['modestbranding'])) ? esc_attr($instance['modestbranding']) : '';
|
73 |
$desclen = (!empty($instance['desclen'])) ? esc_attr($instance['desclen']) : 0;
|
|
|
74 |
|
75 |
$hideanno = (!empty($instance['hideanno'])) ? esc_attr($instance['hideanno']) : '';
|
76 |
$hideinfo = (!empty($instance['hideinfo'])) ? esc_attr($instance['hideinfo']) : '';
|
77 |
|
78 |
// Link to Channel
|
79 |
+
$link_to = (!empty($instance['link_to'])) ? esc_attr($instance['link_to']) : 'none';
|
80 |
$goto_txt = (!empty($instance['goto_txt'])) ? esc_attr($instance['goto_txt']) : '';
|
|
|
81 |
$popup_goto = (!empty($instance['popup_goto'])) ? esc_attr($instance['popup_goto']) : '';
|
|
|
82 |
?>
|
83 |
|
84 |
<p>
|
85 |
+
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'youtube-channel'); ?>
|
86 |
<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', 'youtube-channel'); ?>" />
|
87 |
</label>
|
88 |
</p>
|
89 |
<p>
|
90 |
+
<label for="<?php echo $this->get_field_id('class'); ?>"><?php _e('Custom CSS Class', 'youtube-channel'); ?>
|
91 |
<input type="text" class="widefat" id="<?php echo $this->get_field_id('class'); ?>" name="<?php echo $this->get_field_name('class'); ?>" value="<?php echo $class; ?>" title="<?php _e('Enter custom class for YTC block, if you wish to target block styling', 'youtube-channel'); ?>" />
|
92 |
</label>
|
93 |
</p>
|
94 |
<p>Get your Channel ID and Custom ID from <a href="https://www.youtube.com/account_advanced" target="_blank">here</a>.</p>
|
95 |
<p class="half left glue-top">
|
96 |
+
<label for="<?php echo $this->get_field_id('vanity'); ?>"><?php _e('Vanity/Custom ID', 'youtube-channel'); ?>
|
97 |
<input type="text" class="widefat" id="<?php echo $this->get_field_id('vanity'); ?>" name="<?php echo $this->get_field_name('vanity'); ?>" value="<?php echo $vanity; ?>" title="<?php _e('YouTube Vanity/Custom ID from URL (part after /c/)', 'youtube-channel'); ?>" />
|
98 |
</label>
|
99 |
</p>
|
100 |
<p class="half right glue-top">
|
101 |
+
<label for="<?php echo $this->get_field_id('channel'); ?>"><?php _e('Channel ID', 'youtube-channel'); ?>
|
102 |
<input type="text" class="widefat" id="<?php echo $this->get_field_id('channel'); ?>" name="<?php echo $this->get_field_name('channel'); ?>" value="<?php echo $channel; ?>" title="<?php _e('Find Channel ID behind My Channel menu item in YouTube (ID have UC at the beginning)', 'youtube-channel'); ?>" />
|
103 |
</label>
|
104 |
</p>
|
105 |
<p class="half left glue-top">
|
106 |
+
<label for="<?php echo $this->get_field_id('username'); ?>"><?php _e('Legacy Username', 'youtube-channel'); ?>
|
107 |
<input type="text" class="widefat" id="<?php echo $this->get_field_id('username'); ?>" name="<?php echo $this->get_field_name('username'); ?>" value="<?php echo $username; ?>" title="<?php _e('Legacy YouTube username located behind /user/ part of channel URL (available only on old YouTube accounts)', 'youtube-channel'); ?>" />
|
108 |
</label>
|
109 |
</p>
|
110 |
<p class="half right glue-top">
|
111 |
+
<label for="<?php echo $this->get_field_id('playlist'); ?>"><?php _e('Playlist ID', 'youtube-channel'); ?>
|
112 |
<input type="text" class="widefat" id="<?php echo $this->get_field_id('playlist'); ?>" name="<?php echo $this->get_field_name('playlist'); ?>" value="<?php echo $playlist; ?>" title="<?php _e('Find Playlist ID in your playlists (ID have PL at the beginning)', 'youtube-channel'); ?>" />
|
113 |
</label>
|
114 |
</p>
|
115 |
<p class="half left glue-top">
|
116 |
+
<label for="<?php echo $this->get_field_id('resource'); ?>"><?php _e('Resource to use', 'youtube-channel'); ?>
|
117 |
<select class="widefat" id="<?php echo $this->get_field_id( 'resource' ); ?>" name="<?php echo $this->get_field_name( 'resource' ); ?>">
|
118 |
+
<option value="0"<?php selected( $resource, 0 ); ?>><?php _e('Channel (User Uploads)', 'youtube-channel'); ?></option>
|
119 |
<option value="1"<?php selected( $resource, 1 ); ?>><?php _e('Favourites', 'youtube-channel'); ?></option>
|
120 |
<option value="3"<?php selected( $resource, 3 ); ?>><?php _e('Liked Videos', 'youtube-channel'); ?></option>
|
121 |
<option value="2"<?php selected( $resource, 2 ); ?>><?php _e('Playlist', 'youtube-channel'); ?></option>
|
122 |
</select>
|
123 |
+
</label>
|
124 |
</p>
|
125 |
<p class="half right glue-top">
|
126 |
+
<label for="<?php echo $this->get_field_id('cache'); ?>"><?php _e('Cache feed', 'youtube-channel'); ?>
|
127 |
+
<select class="widefat" id="<?php echo $this->get_field_id( 'cache' ); ?>" name="<?php echo $this->get_field_name( 'cache' ); ?>">
|
128 |
+
<option value="0"<?php selected( $cache, 0 ); ?>><?php _e('Do not cache', 'youtube-channel'); ?></option>
|
129 |
+
<?php echo $WPAU_YOUTUBE_CHANNEL->cache_time($cache); ?>
|
130 |
+
</select>
|
131 |
+
</label>
|
|
|
|
|
|
|
132 |
</p>
|
|
|
133 |
<p class="half left glue-top">
|
134 |
+
<label for="<?php echo $this->get_field_id('fetch'); ?>"><?php _e('Fetch', 'youtube-channel'); ?> <input class="small-text" id="<?php echo $this->get_field_id('fetch'); ?>" name="<?php echo $this->get_field_name('fetch'); ?>" type="number" min="2" value="<?php echo $fetch; ?>" title="<?php _e('Number of videos that will be used for random pick (min 2, max 50, default 25)', 'youtube-channel'); ?>" /> <?php _e('video(s)', 'youtube-channel'); ?></label>
|
135 |
</p>
|
136 |
<p class="half right glue-top">
|
137 |
+
<label for="<?php echo $this->get_field_id('num'); ?>"><?php _e('Show', 'youtube-channel'); ?></label> <input class="small-text" id="<?php echo $this->get_field_id('num'); ?>" name="<?php echo $this->get_field_name('num'); ?>" type="number" min="1" value="<?php echo ( $num ) ? $num : '1'; ?>" title="<?php _e('Number of videos to display', 'youtube-channel'); ?>" /> <?php _e('video(s)', 'youtube-channel'); ?>
|
138 |
</p>
|
139 |
<p>
|
140 |
+
<input class="checkbox" type="checkbox" <?php checked( (bool) $privacy, true ); ?> id="<?php echo $this->get_field_id( 'privacy' ); ?>" name="<?php echo $this->get_field_name( 'privacy' ); ?>" title="<?php _e('Enable this option to protect your visitors privacy', 'youtube-channel'); ?>" /> <label for="<?php echo $this->get_field_id( 'privacy' ); ?>"><?php printf(__('Enable <a href="%s" target="_blank">privacy-enhanced mode</a>', 'youtube-channel'), 'http://support.google.com/youtube/bin/answer.py?hl=en-GB&answer=171780'); ?></label>
|
141 |
<br />
|
142 |
+
<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'); ?>" /> <label for="<?php echo $this->get_field_id( 'random' ); ?>"><?php _e('Show random video from resource <small>(Have no effect if "What to show?" has been set to "Embedded Playlist")</small>', 'youtube-channel'); ?></label>
|
143 |
</p>
|
144 |
|
145 |
<h4><?php _e('Video Settings', 'youtube-channel'); ?></h4>
|
146 |
+
<p><label for="<?php echo $this->get_field_id('ratio'); ?>"><?php _e('Aspect ratio', 'youtube-channel'); ?></label>
|
147 |
<select class="widefat" id="<?php echo $this->get_field_id( 'ratio' ); ?>" name="<?php echo $this->get_field_name( 'ratio' ); ?>">
|
148 |
<option value="3"<?php selected( $ratio, 3 ); ?>>16:9</option>
|
|
|
149 |
<option value="1"<?php selected( $ratio, 1 ); ?>>4:3</option>
|
150 |
</select><br />
|
151 |
+
<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' ); ?>" /> <label for="<?php echo $this->get_field_id( 'responsive' ); ?>"><?php _e('Responsive video <small>(distribute one full width item per row)</small>', 'youtube-channel'); ?></label>
|
152 |
</p>
|
153 |
<p>
|
154 |
+
<label for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Initial width', 'youtube-channel'); ?></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', 'youtube-channel'); ?>" /> px (<?php _e('default', 'youtube-channel'); ?> 306)
|
155 |
</p>
|
156 |
<p>
|
157 |
+
<label for="<?php echo $this->get_field_id('display'); ?>">
|
158 |
+
<?php _e('What to display?', 'youtube-channel'); ?>
|
159 |
+
</label>
|
160 |
<select class="widefat" id="<?php echo $this->get_field_id( 'display' ); ?>" name="<?php echo $this->get_field_name( 'display' ); ?>">
|
161 |
<option value="thumbnail"<?php selected( $display, 'thumbnail' ); ?>><?php _e('Thumbnail', 'youtube-channel'); ?></option>
|
162 |
<option value="iframe"<?php selected( $display, 'iframe' ); ?>><?php _e('HTML5 (iframe)', 'youtube-channel'); ?></option>
|
163 |
<option value="iframe2"<?php selected( $display, 'iframe2' ); ?>><?php _e('HTML5 (iframe) Asynchronous', 'youtube-channel'); ?></option>
|
164 |
+
<option value="playlist"<?php selected( $display, 'playlist' ); ?>><?php _e('Embedded Playlist', 'youtube-channel'); ?></option>
|
165 |
</select>
|
166 |
<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' ); ?>" /> <label for="<?php echo $this->get_field_id( 'no_thumb_title' ); ?>"><?php _e('Hide thumbnail tooltip', 'youtube-channel'); ?></label><br />
|
167 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $themelight, true ); ?> id="<?php echo $this->get_field_id( 'themelight' ); ?>" name="<?php echo $this->get_field_name( 'themelight' ); ?>" /> <label for="<?php echo $this->get_field_id( 'themelight' ); ?>"><?php _e('Use light theme (default is dark)', 'youtube-channel'); ?></label><br />
|
174 |
|
175 |
<h4><?php _e('Content Layout', 'youtube-channel'); ?></h4>
|
176 |
<p>
|
177 |
+
<label for="<?php echo $this->get_field_id( 'showtitle' ); ?>">
|
178 |
+
<?php _e('Show video title', 'youtube-channel'); ?>
|
179 |
+
</label>
|
180 |
+
<select class="widefat" id="<?php echo $this->get_field_id( 'showtitle' ); ?>" name="<?php echo $this->get_field_name( 'showtitle' ); ?>">
|
181 |
+
<option value="none"<?php selected( $showtitle, 'none' ); ?>>Hide title</option>
|
182 |
+
<option value="above"<?php selected( $showtitle, 'above' ); ?>>Above video/thumbnail</option>
|
183 |
+
<option value="below"<?php selected( $showtitle, 'below' ); ?>>Below video/thumbnail</option>
|
184 |
+
</select><br />
|
185 |
+
<label for="<?php echo $this->get_field_id( 'showdesc' ); ?>">
|
186 |
+
<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' ); ?>" /> <?php _e('Show video description', 'youtube-channel'); ?>
|
187 |
+
</label><br />
|
188 |
+
<label for="<?php echo $this->get_field_id('desclen'); ?>"><?php _e('Description length', 'youtube-channel'); ?>
|
189 |
+
<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');?>" /> (0 = full)
|
190 |
+
</label><br />
|
191 |
+
<label for="<?php echo $this->get_field_id( 'hideanno' ); ?>">
|
192 |
+
<input class="checkbox" type="checkbox" <?php checked( (bool) $hideanno, true ); ?> id="<?php echo $this->get_field_id('hideanno'); ?>" name="<?php echo $this->get_field_name( 'hideanno' ); ?>" /> <?php _e('Hide annotations from video', 'youtube-channel'); ?>
|
193 |
+
</label><br />
|
194 |
+
<label for="<?php echo $this->get_field_id( 'hideinfo' ); ?>" title="<?php _e('Enabling this option causes the player to not display information like the video title and uploader before the video starts playing.'); ?>">
|
195 |
+
<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' ); ?>" /> <?php _e('Hide video info', 'youtube-channel'); ?>
|
196 |
+
</label>
|
197 |
</p>
|
198 |
|
199 |
<h4><?php _e('Link to Channel', 'youtube-channel'); ?></h4>
|
200 |
+
<p class="glue-top">
|
|
|
|
|
|
|
201 |
<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 our YouTube channel. You can use placeholders %vanity%, %channel% and %username%.', 'youtube-channel'); ?>" placeholder="<?php _e('Visit our YouTube channel', 'youtube-channel'); ?>" />
|
202 |
</p>
|
203 |
+
<p class="half left glue-top">
|
204 |
<select class="widefat" id="<?php echo $this->get_field_id( 'link_to' ); ?>" name="<?php echo $this->get_field_name( 'link_to' ); ?>">
|
205 |
+
<option value="none"<?php selected( $link_to, 'none' ); ?>><?php _e('Hide link', 'youtube-channel'); ?></option>
|
206 |
+
<option value="vanity"<?php selected( $link_to, 'vanity' ); ?>><?php _e('Link to Vanity customized URL', 'youtube-channel'); ?></option>
|
207 |
+
<option value="channel"<?php selected( $link_to, 'channel' ); ?>><?php _e('Link to Channel page URL', 'youtube-channel'); ?></option>
|
208 |
+
<option value="legacy"<?php selected( $link_to, 'legacy' ); ?>><?php _e('Link to Legacy username page', 'youtube-channel'); ?></option>
|
209 |
</select>
|
210 |
</p>
|
211 |
+
<p class="half right glue-top">
|
212 |
<select class="widefat" id="<?php echo $this->get_field_id( 'popup_goto' ); ?>" name="<?php echo $this->get_field_name( 'popup_goto' ); ?>">
|
213 |
<option value="0"<?php selected( $popup_goto, 0 ); ?>><?php _e('Open link in same window', 'youtube-channel'); ?></option>
|
214 |
<option value="1"<?php selected( $popup_goto, 1 ); ?>><?php _e('Open link in new window (JavaScript)', 'youtube-channel'); ?></option>
|
216 |
</select>
|
217 |
</p>
|
218 |
|
219 |
+
<h4><?php _e('Does not work?', 'youtube-channel'); ?></h4>
|
220 |
+
<p>
|
221 |
+
<small><?php printf(__(
|
222 |
+
'Carefully read <a href="%s" target="_faq">FAQ</a> before you contact us. If that does not help, <a href="%s" target="_blank">get JSON file</a> and send it to <a href="%s" target="_support">support forum</a> along with other details noted in <a href="%s" target=_blank">this article</a>.', 'youtube-channel'
|
223 |
+
),
|
224 |
+
'https://wordpress.org/plugins/youtube-channel/faq/',
|
225 |
+
"?ytc_debug_json_for={$this->number}",
|
226 |
+
'http://wordpress.org/support/plugin/youtube-channel',
|
227 |
+
'https://wordpress.org/support/topic/ytc3-read-before-you-post-support-question-or-report-bug'
|
228 |
+
); ?></small>
|
229 |
</p>
|
230 |
|
231 |
<?php
|
243 |
$instance['num'] = $new_instance['num'];
|
244 |
$instance['resource'] = $new_instance['resource'];
|
245 |
$instance['cache'] = $new_instance['cache'];
|
|
|
246 |
$instance['random'] = (isset($new_instance['random'])) ? $new_instance['random'] : false;
|
247 |
$instance['fetch'] = $new_instance['fetch'];
|
248 |
|
|
|
249 |
$instance['goto_txt'] = strip_tags($new_instance['goto_txt']);
|
250 |
$instance['popup_goto'] = $new_instance['popup_goto'];
|
251 |
$instance['link_to'] = $new_instance['link_to'];
|
252 |
|
253 |
+
$instance['showtitle'] = (isset($new_instance['showtitle'])) ? $new_instance['showtitle'] : 'none';
|
|
|
254 |
$instance['showdesc'] = (isset($new_instance['showdesc'])) ? $new_instance['showdesc'] : false;
|
|
|
255 |
$instance['desclen'] = strip_tags($new_instance['desclen']);
|
256 |
$instance['width'] = strip_tags($new_instance['width']);
|
257 |
$instance['responsive'] = (isset($new_instance['responsive'])) ? $new_instance['responsive'] : '';
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: youtube, channel, playlist, single, widget, widgets, youtube player, feed, video, thumbnail, embed, sidebar, iframe, html5, responsive
|
5 |
Requires at least: 3.9.0
|
6 |
Tested up to: 4.2.2
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -49,6 +49,8 @@ You can use `style.css` from theme or other custom location to additionaly style
|
|
49 |
* `.default` – for non-responsive block
|
50 |
* `.responsive` – when you have enabled responsive option
|
51 |
* `.ytc_title` – class of H3 tag for video title above thumbnail/video object
|
|
|
|
|
52 |
* `.ytc_video_container` – class of container for single item, plus:
|
53 |
* `.ytc_video_1`, `.ytc_video_2`, … – class of container for single item with ordering number of item in widget
|
54 |
* `.ytc_video_first` – class of first container for single item
|
@@ -63,7 +65,7 @@ You can use `style.css` from theme or other custom location to additionaly style
|
|
63 |
|
64 |
= Known Issues =
|
65 |
|
66 |
-
* Video description for
|
67 |
* Removing YouTube logo from playback control bar does not work for all videos
|
68 |
* Async HTML5 video does not work for 2nd same video on same page (two YTC blocks set to Async HTML5)
|
69 |
|
@@ -87,13 +89,13 @@ Along to Widget, you can add YouTube Channel block inline by using shortcode `[y
|
|
87 |
* `class` (string) Set custom class if you wish to target special styling for specific YTC block
|
88 |
* `channel` (string) ID of preferred YouTube channel. Do not set full URL to channel, but just last part from URL - ID (name)
|
89 |
* `vanity` (string) part after www.youtube.com/c/ from [Custom URL](https://support.google.com/youtube/answer/2657968?hl=en)
|
|
|
90 |
* `playlist` (string) ID of preferred YouTube playlist.
|
91 |
* `resource` (int) Resource to use for feed:
|
92 |
-
* `0` Channel
|
93 |
* `1` Favorites (for defined channel)
|
94 |
* `2` Playlist
|
95 |
* `3` Liked Videos
|
96 |
-
* `only_pl` (bool) 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 (1 or true)
|
97 |
* `cache` (int) Period in seconds for caching feed. You can disable caching by setting this option to 0, but if you have a lot of visits, consider at least short caching (couple minutes).
|
98 |
* `fetch` (int) Number of videos that will be used as stack for random pick (min 2, max 50)
|
99 |
* `num` (int) Number of videos to display per YTC block.
|
@@ -110,6 +112,7 @@ Along to Widget, you can add YouTube Channel block inline by using shortcode `[y
|
|
110 |
* `thumbnail` Thumbnail will be used and video will be loaded in lightbox. (default)
|
111 |
* `iframe` HTML5 (iframe)
|
112 |
* `iframe2` HTML5 (iframe) with asynchronous loading - recommended
|
|
|
113 |
* `no_thumb_title` (bool) By default YouTube thumbnail will have tooltip with info about video title and date of publishing. By setting this option to 1 or true you can hide tooltip
|
114 |
* `themelight` (bool) By default YouTube have dark play controls theme. By setting this option to 1 or true you can get light theme in player (HTML5 and Flash)
|
115 |
* `controls` (bool) Set this option to 1 or true to hide playback controls.
|
@@ -120,8 +123,10 @@ Along to Widget, you can add YouTube Channel block inline by using shortcode `[y
|
|
120 |
|
121 |
**Content Layout**
|
122 |
|
123 |
-
* `showtitle` (
|
124 |
-
* `
|
|
|
|
|
125 |
* `showdesc` (bool) Set to 1 or true to show video description.
|
126 |
* `desclen` (int) Set number of characters to cut down length of video description. Set to 0 to use full length description.
|
127 |
* `noinfo` (bool) Set to 1 or true to hide overlay video infos (from embedded player)
|
@@ -129,16 +134,16 @@ Along to Widget, you can add YouTube Channel block inline by using shortcode `[y
|
|
129 |
|
130 |
**Link to Channel**
|
131 |
|
132 |
-
* `goto` (bool) Set to 1 or true to display link to channel at the bottom of YTC block.
|
133 |
* `goto_txt` (string)
|
134 |
* `popup` (int) Control where link to channel will be opened:
|
135 |
* `0` open link in same window
|
136 |
* `1` open link in new window with JavaScript
|
137 |
* `2` open link in new window with target="_blank" anchor attribute
|
138 |
-
* `link_to` (
|
139 |
-
* `
|
140 |
-
* `
|
141 |
-
* `
|
|
|
142 |
|
143 |
*Please note, to enhance plugin functionality, we can change some shortcode parameters in future.*
|
144 |
|
@@ -274,6 +279,32 @@ If you really need that missing feature ASAP, feel free to [contact me](urosevic
|
|
274 |
If you don't wish to pay for enhancements (then you don't care would that be implemented in a week, month, year or so), then send new [Support topic](https://wordpress.org/support/plugin/youtube-channel) with *Topic title* in format **[Feature Request] ...**
|
275 |
|
276 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
|
278 |
= 3.0.7.3 (2015-05-29) =
|
279 |
* Add: TinyMCE button to easy configure and insert shortcode to post/page content
|
@@ -383,224 +414,22 @@ If you don't wish to pay for enhancements (then you don't care would that be imp
|
|
383 |
* Remove: Aspect Ration 16:10 (so support only 16:9 and 4:3, same as modern YouTube)
|
384 |
* Remove: "Fix No Item" option - not required for YouTube API 3.0
|
385 |
|
386 |
-
**OLD RELEASES**
|
387 |
-
|
388 |
-
= 2.4.2.1 (2015-04-24) =
|
389 |
-
* Fix: devicesupport workaround strip 1st video from playlist and favourites and apply only for channel
|
390 |
-
|
391 |
-
= 2.4.2 (2015-04-22) =
|
392 |
-
* Fix: Broken layout introduced by missing responsive for embedded playlist, iframe and iframe2
|
393 |
-
* Fix: Replace amp's with HTML entity in thumbnail link
|
394 |
-
* Add: Option to disable thumbnail tooltips (shortcode parameter no_thumb_title)
|
395 |
-
* Add: List of Shortcode attributes to README file
|
396 |
-
* Add: Danis localisation by GSAdev v. Georg Adamsen
|
397 |
-
* Micro optimizations
|
398 |
-
|
399 |
-
= 2.4.1.7 (2015-04-20) =
|
400 |
-
* Quick Fix: strip 1st video from feed that provides notice "YouTube is upgrading to a newer version, which is not supported by this device or app." (more on www.youtube.com/devicesupport) until we finish YouTube Channel 3.0.0 (on the way)
|
401 |
-
|
402 |
-
= 2.4.1.6 (2015-04-15) =
|
403 |
-
* Fix: missing responsive support for embedded playlist, iframe and iframe2
|
404 |
-
* Fix: missing support to hide playback controls, info and annotations for embedded playlist
|
405 |
-
|
406 |
-
= 2.4.1.5 (2015-04-13) =
|
407 |
-
* (2015-04-13) Change: Add dismiss link for Old PHP notice and lower suggested PHP version to 5.3.x
|
408 |
-
* (2015-02-19) Fix: missing admin notices if ReduxFramework not active
|
409 |
-
* (2015-02-10) Add: links to explanations for channel ID and vanity URL
|
410 |
-
* (2015-02-10) Add: goto macro %vanity% to insert vanity ID
|
411 |
-
* (2015-02-10) Add: field for vanity URL ID
|
412 |
-
* (2015-02-10) Add: option to select link to user page, channel page or vanity URL for goto link
|
413 |
-
* (2015-02-10) Remove: option to use channel instead user page for goto link
|
414 |
-
|
415 |
-
= 2.4.1.4 (2015-04-09) =
|
416 |
-
* (2015-04-09) Add: Notification about old PHP if lower than 5.3.29
|
417 |
-
* (2015-04-09) Change: Run admin functions only in dashboard
|
418 |
-
* (2015-02-09) Fix: strip whitespace from the beginngine/end of channel and playlist ID
|
419 |
-
* (2014-12-30) Fix: prevent Undefined Offset notice when on resource we get less items than user requested in shortcode/widget
|
420 |
-
* (2014-12-30) Fix: prevent Undefined Offset notice when on resource we get less items than user requested in shortcode/widget
|
421 |
-
* (2014-12-30) Add: make fallback cache for every feed and use it if no item occurs to avoid No items
|
422 |
-
|
423 |
-
= 2.4.1.3 (2014-12-10) =
|
424 |
-
* Fix: previous release broke opening lightbox for thumbnails and load YouTube website.
|
425 |
-
|
426 |
-
= 2.4.1.2 (2014-12-07) =
|
427 |
-
* Add: Add support for hidden controls and YouTube logo in Thumbnail mode.
|
428 |
-
* Change: Rename Magnific Popup function to prevent clash with original Modest Branding that does not have support for disabling related videos, player controls and YouTube logo.
|
429 |
-
|
430 |
-
= 2.4.1.1 (2014-12-07) =
|
431 |
-
* Change: Remove parameter `&rel=1` from thumbnail link because that is a default value and can prevent some lightboxes to load video.
|
432 |
-
|
433 |
-
= 2.4.1 (2014-11-15) =
|
434 |
-
* Fix: Typo in widget `Do not chache` [2014-10-03]
|
435 |
-
* Fix: do not show global settings notice with link to settings page if not Redux Framerowk is active [2014-11-15]
|
436 |
-
* Fix: Plugin name on Support tab in global plugin settings. [2014-11-15]
|
437 |
-
* Change: Remove protocol from links and leave browser to decide should get resource from HTTP or HTTPS (depends on website protocol) [2014-10-03]
|
438 |
-
* Change: Add height addition for `Fix height taken by controls` for embedded playlist and count control above video [2014-10-03]
|
439 |
-
* Change: Move debug log from widget to downloadable dynamic JSON [2014-11-15]
|
440 |
-
* Add: ModestBranding (remove YouTube logo from player control bar) [2014-10-03]
|
441 |
-
* Add: Responsive (make video optionally responsive) [2014-10-04]
|
442 |
-
* Add: Support for WordPress 4.1 [2014-11-15]
|
443 |
-
|
444 |
-
= 2.4.0.2 (2014-10-02) =
|
445 |
-
* Fix: light theme not applicable to embedded playlist [2014-10-01]
|
446 |
-
* Fix: add clearfix after YTC widget to prevent jumping out of widget block on bad styled themes [2014-10-02]
|
447 |
-
* Add: explanation that `What to embed` have no effect for embedded playlist (HTML5 always used) [2014-10-01]
|
448 |
-
|
449 |
-
= 2.4.0.1 (2014-10-01) =
|
450 |
-
* Fix: fatal error - broken execution for embedded playlist with enhanced privacy
|
451 |
-
* Add: button to discard warning notice for Redux Framework
|
452 |
-
|
453 |
-
= 2.4.0 (2014-10-01) =
|
454 |
-
* Fix: false options set in shortcode had no effect to output box and default settings always used [20140924]
|
455 |
-
* Fix: enabled checkbox in global settings could not be unticked (disabled) [20140924]
|
456 |
-
* Fix: prevent array_slice notice if channel have no uploaded videos [20141001]
|
457 |
-
* Add: fitVids for responsive videos [20140924]
|
458 |
-
* Add: option for additional YTC box class in widget and shortcode [20140924]
|
459 |
-
* Change: global settings page re-implemented with Redux Framework and requires Redux Framework Plugin [20140924]
|
460 |
-
* Change: rewrite plugin to be more OOP [20140924]
|
461 |
-
* Change: removed obsolete methods [20140924]
|
462 |
-
* Change: default box width changed from 220 to 306px [20140924]
|
463 |
-
* Change: YTC block and video pieces now floated left to enable horizontal stack [20140924]
|
464 |
-
* Change: update localization support [20140926]
|
465 |
-
* Change: updated Serbian localization [20140926]
|
466 |
-
* Change: removed PayPal donation button from widget and moved to plugin Settings page [20141001]
|
467 |
-
|
468 |
-
= 2.2.3 (2014-09-14) =
|
469 |
-
* Add: option to disable related videos (not supported by chromeless player)
|
470 |
-
* Enhance: added support for YouTube `rel` parameter in Magnific PopUp IFRAME module
|
471 |
-
* Minified assets
|
472 |
-
* Add plugin icon for WordPress 4.x plugin installer
|
473 |
-
* Update plugin banner
|
474 |
-
|
475 |
-
= 2.2.2 (2014-07-25) =
|
476 |
-
* Add: admin notices after upgrade to prevent errors and avare users to do ReCache and prevent mixed json_decode / base64_encode strings for cached feeds
|
477 |
-
* Change: moved ReCache part to Tools tab on settings page
|
478 |
-
|
479 |
-
= 2.2.1 (2014-07-13) =
|
480 |
-
* Fix: to prevent broken JSON feed, transient caching changed from plain serialized string to base64_encode
|
481 |
-
* Add: URL parameter `ytc_force_recache` to force recache, also included on Help tab in plugin settings
|
482 |
-
|
483 |
-
= 2.2.0 =
|
484 |
-
* Add: open thumbnails in lightbox and stay on site, instead opening YouTube page (Magnific Popup jQuery library)
|
485 |
-
* Add: make thumbnail responsive
|
486 |
-
* Add: play indicator for thumbnails
|
487 |
-
* Add: shortcode [youtube_channel]
|
488 |
-
* Add: tabbed settings page for default options for shortcodes
|
489 |
-
* Add: Help tab for shortcode parameters
|
490 |
-
* Change: moved parts of code to helper functions
|
491 |
-
|
492 |
-
= 2.1.0.2 =
|
493 |
-
* Fix: remove embed object below old IFRAME implementation
|
494 |
-
|
495 |
-
= 2.1.0.1 =
|
496 |
-
* Change: add back old iframe functionality, second iframe option is async loading
|
497 |
-
|
498 |
-
= 2.1.0 =
|
499 |
-
* Change: iframe/HTML5 player inject with IFrame Player API https://developers.google.com/youtube/player_parameters#IFrame_Player_API
|
500 |
-
* Change: use native WP remote file download function wp_remote_get to fetch feeds (prevent some permission errors on some hosts)
|
501 |
-
* Change: removed height parameter so height is calculated by aspect ratio selection - 16:9 as default
|
502 |
-
* Add: mute audio on autoplay if iframe/HTML5 is selected
|
503 |
-
* Add: converter that will port pre-2.0.0 YTC widgets to 2.0.0+ version
|
504 |
-
* Fix: playlist parser (now allowed dash and underscore in playlist ID)
|
505 |
-
|
506 |
-
= 2.0.0 =
|
507 |
-
* Fix: undefined vars notices
|
508 |
-
* Fix: embedding default plugin playlist instead custom set for "Embed standard playlist"
|
509 |
-
* Add: caching system
|
510 |
-
* Add: option to link to channel instead to user
|
511 |
-
* Add: support for enhanced privacy by YouTube
|
512 |
-
* Enhance: RSS feed replaced with JSON
|
513 |
-
* Enhance: better formatted debug info with site URL
|
514 |
-
* Enhance: re-group widget options
|
515 |
-
* Enhance: updated wording
|
516 |
-
* Enhance: added tooltips for options
|
517 |
-
* Enhance: playlist ID detection from URL
|
518 |
-
* Remove: modified error_reporting
|
519 |
-
|
520 |
-
= 1.5.1 =
|
521 |
-
* Fix issue in widget settings when no apache_get_version() support on server
|
522 |
-
* Fix validation errors for widget settings
|
523 |
-
* Fix broken sidebar issue introduced in 1.5.0 release
|
524 |
-
|
525 |
-
= 1.5.0 =
|
526 |
-
* Add inline debug tracker
|
527 |
-
* Fix deprecated functions - changed rss.php by feed.php and split() by extract()
|
528 |
-
* Fix video description parser for new YouTube feed format
|
529 |
-
* Fix autoplay for single video bug
|
530 |
-
* Fix autoplay for multiple videos to play only first video
|
531 |
-
* Code cleanup
|
532 |
-
* Update compatibility to WordPress 3.5.1
|
533 |
-
|
534 |
-
= 1.4.0 =
|
535 |
-
* Added option to show preferred quantity of videos
|
536 |
-
* Added option to embed classic playlist
|
537 |
-
* Added class to video container: universal .ytc_video_container and selective (.ytc_video_first, .ytc_video_mid, .ytc_video_last)
|
538 |
-
* Added class to video title .ytc_title
|
539 |
-
* Added class to video description text .ytc_description
|
540 |
-
* Added class to container for link to channel .ytc_link
|
541 |
-
* Added routine to unique random video from channel if displayed more than one video
|
542 |
-
* Added option to set `et cetera` string for shortened video description
|
543 |
-
* Changed option for random video to use channel or playlist
|
544 |
-
* Fields for width and height converted to number with spinner
|
545 |
-
* Improved playlist ID handler
|
546 |
-
|
547 |
-
= 1.3.3 =
|
548 |
-
* Added Czech translation by Ladislav Drábek
|
549 |
-
|
550 |
-
= 1.3.2 =
|
551 |
-
* Add option to show video description below video
|
552 |
-
* Add option to shorten video description to N characters
|
553 |
-
* Add option to use light theme for controls instead of default dark theme (HTML5 iframe and flash object)
|
554 |
-
* Add option to hide annotations from video
|
555 |
-
|
556 |
-
= 1.3.1 =
|
557 |
-
* Add support for playlist full URL
|
558 |
-
* Fixed no random video for playlist
|
559 |
-
|
560 |
-
= 1.3 =
|
561 |
-
* Fixed z-index problem with flash and iframe object
|
562 |
-
* Add option to try to fix 'No items' error
|
563 |
-
* Add donate button in options dialog
|
564 |
-
|
565 |
-
= 1.2 =
|
566 |
-
* Fixed number of items for random video (min 1, max 50)
|
567 |
-
* Fixed no-controls for HTML5 iframe
|
568 |
-
|
569 |
-
= 1.1 =
|
570 |
-
* Added option to use the playlist instead of channel (suggested by Stacy)
|
571 |
-
|
572 |
-
= 1.0 =
|
573 |
-
* Ported to WordPress 3.2.1
|
574 |
-
* Added option to set maximum number of items for random video
|
575 |
-
* Version changed from major.minor.micro to to major.minor format
|
576 |
-
* Adds Spanish translation
|
577 |
-
|
578 |
-
= 0.1.3 =
|
579 |
-
* Uses selected() instead of if [dimadin]
|
580 |
-
* Uses sprintf for better i18n [dimadin]
|
581 |
-
* Wraps some strings in gettext [dimadin]
|
582 |
-
* Adds textdomain and loads it [dimadin]
|
583 |
-
* Adds target="_blank" for channel link [dimadin]
|
584 |
-
* Adds option to open channel link in popup
|
585 |
-
* Uses plugin_dir_url() instead of guessing of location [dimadin]
|
586 |
-
* Loads widget in its own function [dimadin]
|
587 |
-
* Adds Serbian translation
|
588 |
-
|
589 |
-
= 0.1.2 =
|
590 |
-
* Option to display random video from channel
|
591 |
-
|
592 |
-
= 0.1.1 =
|
593 |
-
* Fixed option to toggle video title visibility
|
594 |
-
* Added option to hide controls for iframe and object videos
|
595 |
-
* Added option to hide video info
|
596 |
-
* Enabled autostart for iframe and object videos
|
597 |
-
|
598 |
-
= 0.1.0 =
|
599 |
-
* Initial release
|
600 |
-
|
601 |
== Upgrade Notice ==
|
602 |
|
603 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
604 |
|
605 |
== Screenshots ==
|
606 |
|
4 |
Tags: youtube, channel, playlist, single, widget, widgets, youtube player, feed, video, thumbnail, embed, sidebar, iframe, html5, responsive
|
5 |
Requires at least: 3.9.0
|
6 |
Tested up to: 4.2.2
|
7 |
+
Stable tag: 3.0.8
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
49 |
* `.default` – for non-responsive block
|
50 |
* `.responsive` – when you have enabled responsive option
|
51 |
* `.ytc_title` – class of H3 tag for video title above thumbnail/video object
|
52 |
+
* `.ytc_title_above` - additional class for video title above video/thumbnail
|
53 |
+
* `.ytc_title_below` - additional class for video title below video/thumbnail
|
54 |
* `.ytc_video_container` – class of container for single item, plus:
|
55 |
* `.ytc_video_1`, `.ytc_video_2`, … – class of container for single item with ordering number of item in widget
|
56 |
* `.ytc_video_first` – class of first container for single item
|
65 |
|
66 |
= Known Issues =
|
67 |
|
68 |
+
* Video title and description for embedded playlist mode does not work.
|
69 |
* Removing YouTube logo from playback control bar does not work for all videos
|
70 |
* Async HTML5 video does not work for 2nd same video on same page (two YTC blocks set to Async HTML5)
|
71 |
|
89 |
* `class` (string) Set custom class if you wish to target special styling for specific YTC block
|
90 |
* `channel` (string) ID of preferred YouTube channel. Do not set full URL to channel, but just last part from URL - ID (name)
|
91 |
* `vanity` (string) part after www.youtube.com/c/ from [Custom URL](https://support.google.com/youtube/answer/2657968?hl=en)
|
92 |
+
* `username` (string) Optional legacy YouTube username.
|
93 |
* `playlist` (string) ID of preferred YouTube playlist.
|
94 |
* `resource` (int) Resource to use for feed:
|
95 |
+
* `0` Channel (User uploads)
|
96 |
* `1` Favorites (for defined channel)
|
97 |
* `2` Playlist
|
98 |
* `3` Liked Videos
|
|
|
99 |
* `cache` (int) Period in seconds for caching feed. You can disable caching by setting this option to 0, but if you have a lot of visits, consider at least short caching (couple minutes).
|
100 |
* `fetch` (int) Number of videos that will be used as stack for random pick (min 2, max 50)
|
101 |
* `num` (int) Number of videos to display per YTC block.
|
112 |
* `thumbnail` Thumbnail will be used and video will be loaded in lightbox. (default)
|
113 |
* `iframe` HTML5 (iframe)
|
114 |
* `iframe2` HTML5 (iframe) with asynchronous loading - recommended
|
115 |
+
* `playlist` Embedded playlist (same behaviour as old function `only_pl`)
|
116 |
* `no_thumb_title` (bool) By default YouTube thumbnail will have tooltip with info about video title and date of publishing. By setting this option to 1 or true you can hide tooltip
|
117 |
* `themelight` (bool) By default YouTube have dark play controls theme. By setting this option to 1 or true you can get light theme in player (HTML5 and Flash)
|
118 |
* `controls` (bool) Set this option to 1 or true to hide playback controls.
|
123 |
|
124 |
**Content Layout**
|
125 |
|
126 |
+
* `showtitle` (string):
|
127 |
+
* `none` - Hide title
|
128 |
+
* `above` - Display title above video/thumbnail
|
129 |
+
* `below` - Display title below video/thumbnail
|
130 |
* `showdesc` (bool) Set to 1 or true to show video description.
|
131 |
* `desclen` (int) Set number of characters to cut down length of video description. Set to 0 to use full length description.
|
132 |
* `noinfo` (bool) Set to 1 or true to hide overlay video infos (from embedded player)
|
134 |
|
135 |
**Link to Channel**
|
136 |
|
|
|
137 |
* `goto_txt` (string)
|
138 |
* `popup` (int) Control where link to channel will be opened:
|
139 |
* `0` open link in same window
|
140 |
* `1` open link in new window with JavaScript
|
141 |
* `2` open link in new window with target="_blank" anchor attribute
|
142 |
+
* `link_to` (string) URL to link:
|
143 |
+
* `none` Hide link (defult)
|
144 |
+
* `vanity` Vanity custom URL
|
145 |
+
* `channel` Channel page
|
146 |
+
* `legacy` Legacy username page
|
147 |
|
148 |
*Please note, to enhance plugin functionality, we can change some shortcode parameters in future.*
|
149 |
|
279 |
If you don't wish to pay for enhancements (then you don't care would that be implemented in a week, month, year or so), then send new [Support topic](https://wordpress.org/support/plugin/youtube-channel) with *Topic title* in format **[Feature Request] ...**
|
280 |
|
281 |
== Changelog ==
|
282 |
+
= 3.0.8 (2015-06-07) =
|
283 |
+
* Fix: Undefined and deprecated global options
|
284 |
+
* Add: Global option to disable builtin Lightbox (Video tab)
|
285 |
+
* Add: Link to Support forums on Plugins page
|
286 |
+
* Add: Visible error in YTC block for Administrator, Oops for visitors and lower members
|
287 |
+
* Add: Filename of debug JSON
|
288 |
+
* Add: Video title classes `ytc_title_above`/`ytc_title_below`
|
289 |
+
* Add: Button `Clear All YTC Cache` on `Tools` tab to quick purge all cached YTC feeds
|
290 |
+
* Improve: Do not include YT `iframe_api` if already included by other plugin and make YTC iframe2 to work even if other plugin uses `iframe_api`
|
291 |
+
* Improve: Remove `Playlist Only` checkbox (`only_pl=1` shortcode parameter) and integrate as new Display:Embedded Playlist option (`display=playlist` shortcode parameter)
|
292 |
+
* Improve: Remove `Show title below` checkbox (titlebelow) and integrate to `Show video title` (showtitle) as dropdown
|
293 |
+
* Improve: Remove `Show link to channel` checkbox (showgoto) and integrate option `None` to `What to link` (link_to)
|
294 |
+
* Improve: Move JS code to initiate Magnific popup to inline print on wp_footer
|
295 |
+
* Improve: LESS stylesheet for easier maintenance
|
296 |
+
* Remove: `Et cetera` (descappend) option and always use `...` for shortened description
|
297 |
+
* Remove: Macro templates for Link to channel title
|
298 |
+
* Change: Values for `showtitle` and `link_to` are changed from integer to string (check Shortcodes section)
|
299 |
+
* Change: Move `Hide annotations` and `Hide video info` from `Content` to `Video` tab on settings page
|
300 |
+
* Change: Play icon to be like original YT play shape
|
301 |
+
* Change: Make responsive enabled by default in new widgets
|
302 |
+
* Optimize: DRY of visible errors for Administrator and visitors (Oops message)
|
303 |
+
* Optimize: Faster empty defaults for channel, vanity, legacy and playlist in global settings
|
304 |
+
* Optimize: Minify inline JS code
|
305 |
+
* Optimize: Remove call to fitVids() function
|
306 |
+
* Cleanup: Remove $yt_url and $yt_video variables
|
307 |
+
* Cleanup: Remove unused function to clean playlist ID
|
308 |
|
309 |
= 3.0.7.3 (2015-05-29) =
|
310 |
* Add: TinyMCE button to easy configure and insert shortcode to post/page content
|
414 |
* Remove: Aspect Ration 16:10 (so support only 16:9 and 4:3, same as modern YouTube)
|
415 |
* Remove: "Fix No Item" option - not required for YouTube API 3.0
|
416 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
== Upgrade Notice ==
|
418 |
|
419 |
+
= 3.0.8 =
|
420 |
+
Bugfixes, optimizations and improvements.
|
421 |
+
|
422 |
+
= 3.0.7.3 =
|
423 |
+
User experience improved with Shortcode generator for TinyMCE
|
424 |
+
|
425 |
+
= 3.0.7.2 =
|
426 |
+
Added report for user if any HTTP error occured
|
427 |
+
|
428 |
+
= 3.0.7,1 =
|
429 |
+
Quick fix for clearfix class
|
430 |
+
|
431 |
+
= 3.0.7 =
|
432 |
+
Cleanup and optimization release
|
433 |
|
434 |
== Screenshots ==
|
435 |
|
update.php
CHANGED
@@ -249,3 +249,72 @@ function au_youtube_channel_update_routine_5() {
|
|
249 |
delete_option('youtube_channel_ver');
|
250 |
|
251 |
} //END function au_youtube_channel_update_routine_5()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
delete_option('youtube_channel_ver');
|
250 |
|
251 |
} //END function au_youtube_channel_update_routine_5()
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Remove deprecated and migrate modified options
|
255 |
+
*/
|
256 |
+
function au_youtube_channel_update_routine_10() {
|
257 |
+
|
258 |
+
// get options from DB
|
259 |
+
$defaults = get_option('youtube_channel_defaults');
|
260 |
+
|
261 |
+
// Set default `link_to` and migrate
|
262 |
+
if ( ! isset($defaults['link_to']) ) {
|
263 |
+
$defaults['link_to'] = 'none';
|
264 |
+
} else {
|
265 |
+
switch ($defaults['link_to']) {
|
266 |
+
case 2:
|
267 |
+
$defaults['link_to'] = 'vanity';
|
268 |
+
break;
|
269 |
+
case 1:
|
270 |
+
$defaults['link_to'] = 'channel';
|
271 |
+
break;
|
272 |
+
case 0:
|
273 |
+
$defaults['link_to'] = 'legacy';
|
274 |
+
break;
|
275 |
+
default:
|
276 |
+
$defaults['link_to'] = 'none';
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
// Show title migration
|
281 |
+
if ( isset($defaults['showtitle']) ) {
|
282 |
+
if ( isset($defaults['titlebelow']) ) {
|
283 |
+
$defaults['showtitle'] = 'below';
|
284 |
+
unset($defaults['titlebelow']);
|
285 |
+
} else {
|
286 |
+
$defaults['showtitle'] = 'above';
|
287 |
+
}
|
288 |
+
} else {
|
289 |
+
$defaults['showtitle'] = 'none';
|
290 |
+
}
|
291 |
+
|
292 |
+
// Remove deprecated
|
293 |
+
$deprecated_options = array(
|
294 |
+
'vidqty',
|
295 |
+
'maxrnd',
|
296 |
+
'getrnd',
|
297 |
+
'random',
|
298 |
+
'only_pl',
|
299 |
+
'fixyt',
|
300 |
+
'showvidesc',
|
301 |
+
'videsclen',
|
302 |
+
'descappend',
|
303 |
+
'titlebelow',
|
304 |
+
'showgoto',
|
305 |
+
'userchan',
|
306 |
+
'fixnoitem',
|
307 |
+
'use_res'
|
308 |
+
);
|
309 |
+
foreach ( $deprecated_options as $deprecated ) {
|
310 |
+
if ( isset($defaults[$deprecated]) ) {
|
311 |
+
unset($defaults[$deprecated]);
|
312 |
+
}
|
313 |
+
}
|
314 |
+
|
315 |
+
if ( isset($defaults) ) {
|
316 |
+
update_option('youtube_channel_defaults', $defaults);
|
317 |
+
unset($defaults);
|
318 |
+
}
|
319 |
+
|
320 |
+
} //END function au_youtube_channel_update_routine_10()
|
youtube-channel.php
CHANGED
@@ -2,22 +2,22 @@
|
|
2 |
/*
|
3 |
Plugin Name: YouTube Channel
|
4 |
Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
|
5 |
-
Description: <a href="widgets.php">
|
6 |
Author: Aleksandar Urošević
|
7 |
-
Version: 3.0.
|
8 |
Author URI: http://urosevic.net/
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
12 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
|
14 |
-
if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
15 |
{
|
16 |
class WPAU_YOUTUBE_CHANNEL
|
17 |
{
|
18 |
|
19 |
-
const DB_VER =
|
20 |
-
const VER = '3.0.
|
21 |
|
22 |
public $plugin_name = "YouTube Channel";
|
23 |
public $plugin_slug = "youtube-channel";
|
@@ -32,9 +32,13 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
|
32 |
$this->plugin_url = plugin_dir_url(__FILE__);
|
33 |
load_plugin_textdomain( $this->plugin_slug, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
|
34 |
|
35 |
-
// debug JSON
|
36 |
-
if ( ! empty($_GET['ytc_debug_json_for']) )
|
37 |
$this->generate_debug_json();
|
|
|
|
|
|
|
|
|
38 |
|
39 |
// Activation hook and maybe update trigger
|
40 |
register_activation_hook( __FILE__, array($this, 'activate') );
|
@@ -43,8 +47,8 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
|
43 |
$this->defaults = self::defaults();
|
44 |
|
45 |
// TinyMCE AddOn
|
46 |
-
add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 998 );
|
47 |
-
add_filter(
|
48 |
|
49 |
if ( is_admin() ) {
|
50 |
|
@@ -55,7 +59,7 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
|
55 |
add_action( 'admin_notices', array($this, 'admin_notices') );
|
56 |
|
57 |
// Enqueue scripts and styles for Widgets page
|
58 |
-
add_action('admin_enqueue_scripts', array($this, 'widget_scripts'));
|
59 |
|
60 |
} else { // ELSE if ( is_admin() )
|
61 |
|
@@ -105,32 +109,32 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
|
105 |
|
106 |
'ratio' => 3, // 3 - 16:9, 1 - 4:3 (deprecated: 2 - 16:10)
|
107 |
'width' => 306,
|
108 |
-
'responsive' =>
|
109 |
-
'display' => 'thumbnail', // thumbnail, iframe, iframe2 (deprecated: chromeless, object)
|
110 |
'themelight' => 0,
|
111 |
'controls' => 0,
|
112 |
'autoplay' => 0,
|
113 |
'autoplay_mute' => 0,
|
114 |
'norel' => 0,
|
115 |
|
116 |
-
'showtitle' =>
|
117 |
'showdesc' => 0,
|
118 |
'desclen' => 0,
|
119 |
-
'descappend' => '…',
|
120 |
'modestbranding' => 0,
|
121 |
'hideanno' => 0,
|
122 |
'hideinfo' => 0,
|
123 |
|
124 |
'goto_txt' => 'Visit our channel',
|
125 |
-
'showgoto' => 0,
|
126 |
'popup_goto' => 0, // 0 same window, 1 new window JS, 2 new window target
|
127 |
-
'link_to' =>
|
128 |
);
|
129 |
|
130 |
add_option('youtube_channel_version', self::VER, '', 'no');
|
131 |
add_option('youtube_channel_db_ver', self::DB_VER, '', 'no');
|
132 |
add_option($this->plugin_option, $init, '', 'no');
|
133 |
|
|
|
|
|
134 |
} // END public function init_options()
|
135 |
|
136 |
/**
|
@@ -153,7 +157,9 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
|
153 |
*/
|
154 |
function admin_init() {
|
155 |
|
156 |
-
add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'add_settings_link') );
|
|
|
|
|
157 |
|
158 |
require_once( 'inc/settings.php' );
|
159 |
|
@@ -181,6 +187,20 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
|
181 |
|
182 |
} // END function add_settings_link()
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
/**
|
185 |
* Enqueue admin scripts and styles for widget customization
|
186 |
*/
|
@@ -188,18 +208,21 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
|
188 |
|
189 |
global $pagenow;
|
190 |
|
191 |
-
// Enqueue only on widget
|
192 |
-
if( $pagenow !== 'widgets.php' && $pagenow !== 'customize.php' && $pagenow !== 'post.php' )
|
|
|
|
|
193 |
|
|
|
194 |
wp_enqueue_script(
|
195 |
$this->plugin_slug . '-admin',
|
196 |
plugins_url( 'assets/js/admin.min.js', __FILE__ ),
|
197 |
array('jquery'),
|
198 |
self::VER
|
199 |
-
)
|
200 |
wp_enqueue_style(
|
201 |
$this->plugin_slug . '-admin',
|
202 |
-
plugins_url( 'assets/css/admin.
|
203 |
array(),
|
204 |
self::VER
|
205 |
);
|
@@ -305,36 +328,88 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
|
305 |
* Enqueue frontend scripts and styles
|
306 |
*/
|
307 |
function enqueue_scripts() {
|
308 |
-
wp_enqueue_style( 'youtube-channel', plugins_url('assets/css/youtube-channel.min.css', __FILE__), array(), self::VER );
|
309 |
|
310 |
-
//
|
311 |
-
|
312 |
-
|
313 |
-
|
|
|
|
|
|
|
|
|
|
|
314 |
} // end function enqueue_scripts
|
315 |
|
|
|
|
|
|
|
|
|
|
|
316 |
function footer_scripts() {
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
tag
|
325 |
-
|
326 |
-
firstScriptTag.
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
}
|
336 |
|
337 |
-
} //
|
338 |
|
339 |
public function shortcode($atts) {
|
340 |
|
@@ -373,18 +448,16 @@ function ytc_mute(event){
|
|
373 |
'mute' => $instance['autoplay_mute'],
|
374 |
'norel' => $instance['norel'],
|
375 |
|
376 |
-
'showtitle' => $instance['showtitle'],
|
377 |
-
'titlebelow' => 0, // move title below video
|
378 |
'showdesc' => $instance['showdesc'], // ex showvidesc
|
379 |
'nobrand' => ( ! empty($instance['modestbranding']) ) ? $instance['modestbranding'] : '0',
|
380 |
'desclen' => $instance['desclen'], // ex videsclen
|
381 |
'noinfo' => $instance['hideinfo'],
|
382 |
'noanno' => $instance['hideanno'],
|
383 |
|
384 |
-
'goto' => $instance['showgoto'],
|
385 |
'goto_txt' => $instance['goto_txt'],
|
386 |
'popup' => $instance['popup_goto'],
|
387 |
-
'link_to' => $instance['link_to'],
|
388 |
|
389 |
'class' => ( ! empty($instance['class']) ) ? $instance['class'] : ''
|
390 |
),
|
@@ -393,7 +466,7 @@ function ytc_mute(event){
|
|
393 |
);
|
394 |
|
395 |
// backward compatibility for show -> display shortcode parameter
|
396 |
-
if ( $show !== $display && $show !== $instance['display'] ) {
|
397 |
$display = $show;
|
398 |
}
|
399 |
// backward compatibility for use_res -> resource shortcode parameter
|
@@ -408,8 +481,7 @@ function ytc_mute(event){
|
|
408 |
$instance['channel'] = $channel;
|
409 |
$instance['username'] = $username;
|
410 |
$instance['playlist'] = $playlist;
|
411 |
-
$instance['resource'] = $resource; // resource: 0 channel, 1 favorites, 2 playlist
|
412 |
-
$instance['only_pl'] = $only_pl; // use embedded playlist - false by default
|
413 |
$instance['cache'] = $cache; // in seconds, def 5min - settings?
|
414 |
$instance['privacy'] = $privacy; // enhanced privacy
|
415 |
|
@@ -422,7 +494,7 @@ function ytc_mute(event){
|
|
422 |
$instance['ratio'] = $ratio; // aspect ratio: 3 - 16:9, 2 - 16:10, 1 - 4:3
|
423 |
$instance['width'] = $width; // 306
|
424 |
$instance['responsive'] = $responsive; // enable responsivenes?
|
425 |
-
$instance['display'] = $display; // thumbnail, iframe, iframe2
|
426 |
$instance['no_thumb_title'] = $no_thumb_title; // hide tooltip for thumbnails
|
427 |
|
428 |
$instance['themelight'] = $themelight; // use light theme, dark by default
|
@@ -433,7 +505,6 @@ function ytc_mute(event){
|
|
433 |
|
434 |
// Content Layout
|
435 |
$instance['showtitle'] = $showtitle; // show video title, disabled by default
|
436 |
-
$instance['titlebelow'] = $titlebelow; // show video title, disabled by default
|
437 |
$instance['showdesc'] = $showdesc; // show video description, disabled by default
|
438 |
$instance['modestbranding'] = $nobrand; // hide YT logo
|
439 |
$instance['desclen'] = $desclen; // cut video description, number of characters
|
@@ -441,10 +512,9 @@ function ytc_mute(event){
|
|
441 |
$instance['hideanno'] = $noanno; // hide annotations, false by default
|
442 |
|
443 |
// Link to Channel
|
444 |
-
$instance['showgoto'] = $goto; // show goto link, disabled by default
|
445 |
$instance['goto_txt'] = $goto_txt; // text for goto link - use settings
|
446 |
$instance['popup_goto'] = $popup; // open channel in: 0 same window, 1 javascript new, 2 target new
|
447 |
-
$instance['link_to'] = $link_to; //
|
448 |
|
449 |
// Customization
|
450 |
$instance['class'] = $class; // custom additional class for container
|
@@ -530,6 +600,9 @@ function ytc_mute(event){
|
|
530 |
if ( ! empty($instance['responsive']) ) {
|
531 |
$class .= ' responsive';
|
532 |
}
|
|
|
|
|
|
|
533 |
|
534 |
switch ($resource) {
|
535 |
case 1: // Favourites
|
@@ -554,11 +627,11 @@ function ytc_mute(event){
|
|
554 |
|
555 |
$output[] = "<div class=\"youtube_channel {$class}\">";
|
556 |
|
557 |
-
if ( $instance['
|
558 |
|
559 |
$output = array_merge( $output, self::embed_playlist($resource_id, $instance) );
|
560 |
|
561 |
-
} else { // videos from channel, favourites, liked or playlist
|
562 |
|
563 |
// Get max items for random video
|
564 |
$fetch = $instance['fetch'];
|
@@ -574,7 +647,7 @@ function ytc_mute(event){
|
|
574 |
if ( $instance['cache'] > 0 ) {
|
575 |
|
576 |
// generate feed cache key for caching time
|
577 |
-
$cache_key = 'ytc_'.md5($resource_key).'_'
|
578 |
|
579 |
if ( ! empty($_GET['ytc_force_recache']) ) {
|
580 |
delete_transient($cache_key);
|
@@ -620,13 +693,16 @@ function ytc_mute(event){
|
|
620 |
}
|
621 |
}
|
622 |
|
|
|
|
|
|
|
623 |
// Prevent further checks if we have WP Error or empty record even after fallback
|
624 |
if ( is_wp_error($json_output) ) {
|
625 |
$output[] = $this->front_debug( $json_output->get_error_message() );
|
626 |
return $output;
|
627 |
}
|
628 |
elseif ( isset($json_output->items) && sizeof($json_output->items) == 0 ) {
|
629 |
-
$output[] = $this->front_debug(sprintf(__("You have set to display videos from %s [resource list ID: %s], but there have no public videos in that resouce."), $
|
630 |
return $output;
|
631 |
}
|
632 |
elseif ( empty($json_output) ) {
|
@@ -653,11 +729,9 @@ function ytc_mute(event){
|
|
653 |
}
|
654 |
}
|
655 |
|
656 |
-
$resource_nice_name = $this->resource_nice_name($resource);
|
657 |
-
|
658 |
if ($max_items == 0) {
|
659 |
|
660 |
-
//
|
661 |
if ( ! empty($json_output) && is_object($json_output) && ! empty($json_output->error->errors) ) {
|
662 |
|
663 |
// Error went in fetch_youtube_feed()
|
@@ -711,7 +785,7 @@ function ytc_mute(event){
|
|
711 |
$num = sizeof($items);
|
712 |
}
|
713 |
|
714 |
-
for ($y = 1; $y <= $num; ++$y) {
|
715 |
if ( ! empty($instance['random']) ) {
|
716 |
|
717 |
$random_item = mt_rand( 0, (count($items)-1) );
|
@@ -724,7 +798,7 @@ function ytc_mute(event){
|
|
724 |
$item = $items[ $y - 1 ];
|
725 |
}
|
726 |
|
727 |
-
//
|
728 |
$output = array_merge( $output, $this->ytc_print_video($item, $instance, $y) );
|
729 |
}
|
730 |
// Free some memory
|
@@ -734,8 +808,9 @@ function ytc_mute(event){
|
|
734 |
|
735 |
} // single playlist or ytc way
|
736 |
|
737 |
-
|
738 |
-
|
|
|
739 |
}
|
740 |
|
741 |
$output[] = '</div><!-- .youtube_channel -->';
|
@@ -783,14 +858,13 @@ function ytc_mute(event){
|
|
783 |
|
784 |
}
|
785 |
|
786 |
-
//
|
787 |
unset($response);
|
788 |
|
789 |
return $json;
|
790 |
|
791 |
} // END function fetch_youtube_feed($resource_id, $items)
|
792 |
|
793 |
-
|
794 |
/**
|
795 |
* Print explanation of error for administrators (users with capability manage_options)
|
796 |
* and hidden message for lower users and visitors
|
@@ -839,7 +913,7 @@ function ytc_mute(event){
|
|
839 |
} // END function height_ratio($width=306, $ratio)
|
840 |
|
841 |
/**
|
842 |
-
* Generate link to
|
843 |
* @param array $instance widget or shortcode settings
|
844 |
* @return array components prepared for output
|
845 |
*/
|
@@ -849,51 +923,45 @@ function ytc_mute(event){
|
|
849 |
$output = array();
|
850 |
|
851 |
// do we need to show goto link?
|
852 |
-
if ( $instance['
|
853 |
|
854 |
-
$
|
855 |
|
856 |
-
|
857 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
858 |
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
|
|
|
|
|
|
|
|
863 |
|
864 |
$goto_txt = trim($instance['goto_txt']);
|
865 |
if ( $goto_txt == "" ) {
|
866 |
$goto_txt = __('Visit our YouTube channel', 'youtube-channel');
|
867 |
}
|
868 |
|
869 |
-
if ( ! empty($username) ) {
|
870 |
-
$goto_txt = str_replace('%username%', $username, $goto_txt);
|
871 |
-
}
|
872 |
-
if ( ! empty($channel) ) {
|
873 |
-
$goto_txt = str_replace('%channel%', $channel, $goto_txt);
|
874 |
-
}
|
875 |
-
if ( ! empty( $vanity ) ) {
|
876 |
-
$goto_txt = str_replace('%vanity%', $vanity, $goto_txt);
|
877 |
-
}
|
878 |
-
|
879 |
-
$goto_url = "https://www.youtube.com/";
|
880 |
-
if ( $link_to == '2' ) { // vanity
|
881 |
-
if ( empty($vanity) ) {
|
882 |
-
return array("<!-- YTC ERROR: Selected Vanity custom URL to be linked but no Vanity Name provided! -->");
|
883 |
-
}
|
884 |
-
$goto_url .= "c/$vanity";
|
885 |
-
} else if ( $link_to == '0') { // legacy username
|
886 |
-
if ( empty($username) ) {
|
887 |
-
return array("<!-- YTC ERROR: Selected Legacy username to be linked but no Legacy username provided! -->");
|
888 |
-
}
|
889 |
-
$goto_url .= "user/$username";
|
890 |
-
} else { // channel (default)
|
891 |
-
if ( empty($channel) ) {
|
892 |
-
return array("<!-- YTC ERROR: Selected Channel page to be linked but no Channel ID provided! -->");
|
893 |
-
}
|
894 |
-
$goto_url .= "channel/$channel";
|
895 |
-
}
|
896 |
-
|
897 |
$newtab = __("in new window/tab", 'youtube-channel');
|
898 |
|
899 |
$output[] = '<div class="clearfix"></div>';
|
@@ -917,40 +985,35 @@ function ytc_mute(event){
|
|
917 |
return $output;
|
918 |
} // end function ytc_channel_link
|
919 |
|
920 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
921 |
function ytc_print_video($item, $instance, $y) {
|
922 |
|
923 |
-
//
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
$
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
$
|
936 |
-
|
937 |
-
|
938 |
-
$imgfixedheight = $width / 4 * 3;
|
939 |
-
|
940 |
-
// which type to show
|
941 |
-
$display = (empty($instance['display'])) ? 'object' : $instance['display'];
|
942 |
-
$hideanno = $instance['hideanno'];
|
943 |
-
$themelight = $instance['themelight'];
|
944 |
-
/* end of video settings */
|
945 |
-
|
946 |
-
// Prepare Video ID from Resource
|
947 |
-
$yt_id = $item->snippet->resourceId->videoId;
|
948 |
-
$yt_url = "v/$yt_id";
|
949 |
$yt_thumb = "//img.youtube.com/vi/$yt_id/0.jpg"; // zero for HD thumb
|
950 |
-
$yt_video = "//www.youtube.com/watch?v=" . $yt_id;
|
951 |
|
952 |
-
|
953 |
-
$
|
954 |
|
955 |
switch ($y) {
|
956 |
case 1:
|
@@ -966,74 +1029,67 @@ function ytc_mute(event){
|
|
966 |
break;
|
967 |
}
|
968 |
|
969 |
-
//
|
970 |
-
|
971 |
-
{
|
972 |
-
case 1: $arclass = 'ar4_3'; break;
|
973 |
-
default: $arclass = 'ar16_9';
|
974 |
-
}
|
975 |
-
$output[] = "<div class=\"ytc_video_container ytc_video_{$y} ytc_video_{$vnumclass} ${arclass}\" style=\"width:{$width}px\">";
|
976 |
|
977 |
-
|
978 |
-
if ( ! empty($instance['showtitle']) && empty($instance['titlebelow']) ) {
|
979 |
-
$output[] = "<h3 class=\"ytc_title\">{$yt_title}</h3>";
|
980 |
-
}
|
981 |
|
982 |
-
//
|
983 |
-
$
|
984 |
-
|
985 |
-
|
986 |
-
$youtube_domain = $this->youtube_domain($instance);
|
987 |
|
988 |
// Print out video
|
989 |
-
if ( $display == "iframe" ) {
|
990 |
-
if ( empty($usepl) ) {
|
991 |
-
$yt_url = $yt_id;
|
992 |
-
}
|
993 |
|
994 |
// Start wrapper for responsive item
|
995 |
if ( $instance['responsive'] ) {
|
996 |
$output[] = '<div class="fluid-width-video-wrapper">';
|
997 |
}
|
998 |
|
999 |
-
$output[] = "<iframe title=\"YouTube Video Player\" width=\"{$width}\" height=\"{$height}\" src=\"//{$youtube_domain}/embed/{$
|
1000 |
-
if ( $controls ) $output[] = "&controls=0";
|
1001 |
-
if ( $hideinfo ) $output[] = "&showinfo=0";
|
1002 |
-
if ( $autoplay ) $output[] = "&autoplay=1";
|
1003 |
-
if ( $hideanno ) $output[] = "&iv_load_policy=3";
|
1004 |
-
if ( $themelight ) $output[] = "&theme=light";
|
1005 |
-
if ( $modestbranding ) $output[] = "&modestbranding=1";
|
1006 |
-
// disable related videos
|
1007 |
-
if ( $norel ) $output[] = "&rel=0";
|
1008 |
|
1009 |
-
$output[] = "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1010 |
|
1011 |
// Close wrapper for responsive item
|
1012 |
if ( $instance['responsive'] ) {
|
1013 |
$output[] = '</div>';
|
1014 |
}
|
1015 |
|
1016 |
-
} else if ( $display == "iframe2" ) {
|
1017 |
|
1018 |
// youtube API async
|
1019 |
-
|
1020 |
-
|
1021 |
-
$
|
1022 |
-
$
|
1023 |
-
$
|
1024 |
-
$
|
1025 |
-
$
|
1026 |
-
$
|
1027 |
-
$
|
1028 |
-
|
1029 |
-
$
|
|
|
|
|
|
|
|
|
|
|
1030 |
|
1031 |
// Start wrapper for responsive item
|
1032 |
if ( $instance['responsive'] ) {
|
1033 |
$output[] = '<div class="fluid-width-video-wrapper">';
|
1034 |
}
|
1035 |
|
1036 |
-
$output[] =
|
1037 |
|
1038 |
// Close wrapper for responsive item
|
1039 |
if ( $instance['responsive'] ) {
|
@@ -1041,75 +1097,51 @@ function ytc_mute(event){
|
|
1041 |
}
|
1042 |
|
1043 |
$site_domain = $_SERVER['HTTP_HOST'];
|
1044 |
-
$ytc_html5_js =
|
1045 |
-
|
1046 |
-
|
1047 |
-
height: '$height',
|
1048 |
-
width: '$width',
|
1049 |
-
videoId: '$yt_url',
|
1050 |
-
enablejsapi: 1,
|
1051 |
-
playerVars: {
|
1052 |
-
$js_autoplay $js_showinfo $js_controls $js_theme $js_rel $js_modestbranding wmmode: 'opaque'
|
1053 |
-
},
|
1054 |
-
origin: '$site_domain',
|
1055 |
-
$js_iv_load_policy $js_autoplay_mute
|
1056 |
-
});
|
1057 |
-
JS;
|
1058 |
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
|
|
1064 |
|
1065 |
} else { // default is thumbnail
|
1066 |
|
1067 |
-
// set proper class for responsive thumbs per selected aspect ratio
|
1068 |
-
switch ($instance['ratio']) {
|
1069 |
-
case 1:
|
1070 |
-
$arclass = 'ar4_3';
|
1071 |
-
break;
|
1072 |
-
default:
|
1073 |
-
$arclass = 'ar16_9';
|
1074 |
-
}
|
1075 |
-
|
1076 |
// Do we need tooltip for thumbnail?
|
1077 |
if ( empty($instance['no_thumb_title']) ) {
|
1078 |
$title = sprintf( __('Watch video %1$s published on %2$s', 'youtube-channel' ), $yt_title, $yt_date );
|
1079 |
}
|
1080 |
|
1081 |
$p = '';
|
1082 |
-
if ( $
|
1083 |
-
|
1084 |
-
|
|
|
|
|
1085 |
|
1086 |
// Do we need thumbnail w/ or w/o tooltip
|
1087 |
-
|
1088 |
-
|
1089 |
-
} else {
|
1090 |
-
$output[] = "<a href=\"${yt_video}${p}\" class=\"ytc_thumb ytc-lightbox {$arclass}\"><span style=\"background-image: url({$yt_thumb});\" id=\"{$ytc_vid}\"></span></a>";
|
1091 |
-
}
|
1092 |
|
1093 |
} // what to show conditions
|
1094 |
|
1095 |
// show video title below video?
|
1096 |
-
if ( ! empty($instance['showtitle']) &&
|
1097 |
-
$output[] = "<h3 class=\"ytc_title\">{$yt_title}</h3>";
|
1098 |
}
|
1099 |
|
1100 |
// do we need to show video description?
|
1101 |
-
if ( $instance['showdesc'] ) {
|
1102 |
|
1103 |
$video_description = $item->snippet->description;
|
1104 |
$etcetera = '';
|
1105 |
if ( $instance['desclen'] > 0 ) {
|
1106 |
if ( strlen($video_description) > $instance['desclen'] ) {
|
1107 |
$video_description = substr($video_description, 0, $instance['desclen']);
|
1108 |
-
|
1109 |
-
$etcetera = $instance['descappend'];
|
1110 |
-
} else {
|
1111 |
-
$etcetera = '…';
|
1112 |
-
}
|
1113 |
}
|
1114 |
}
|
1115 |
|
@@ -1127,19 +1159,22 @@ JS;
|
|
1127 |
/* function to print standard playlist embed code */
|
1128 |
function embed_playlist($resource_id, $instance) {
|
1129 |
|
1130 |
-
$width
|
1131 |
-
$height
|
1132 |
-
$autoplay
|
1133 |
-
$theme
|
1134 |
$modestbranding = (empty($instance['modestbranding'])) ? '' : '&modestbranding=1';
|
1135 |
-
$rel
|
1136 |
|
1137 |
// enhanced privacy
|
1138 |
$youtube_domain = $this->youtube_domain($instance);
|
1139 |
-
|
1140 |
-
$output[] = "<div class=\"ytc_video_container ytc_video_1 ytc_video_single ytc_playlist_only\">";
|
|
|
1141 |
$output[] = "<iframe src=\"//{$youtube_domain}/embed/videoseries?list={$resource_id}{$autoplay}{$theme}{$modestbranding}{$rel}\"";
|
1142 |
-
$output[] = " width=\"{$width}\" height=\"{$height}\" frameborder=\"0\"></iframe
|
|
|
|
|
1143 |
|
1144 |
return $output;
|
1145 |
|
@@ -1208,11 +1243,44 @@ JS;
|
|
1208 |
return $out;
|
1209 |
} // end function cache_time
|
1210 |
|
1211 |
-
function youtube_domain($instance) {
|
1212 |
-
$youtube_domain = ( !empty($instance['privacy']) ) ? 'www.youtube-nocookie.com' : 'www.youtube.com';
|
1213 |
-
return $youtube_domain;
|
1214 |
-
} // end function youtube_domain
|
1215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1216 |
function resource_nice_name($resource_id) {
|
1217 |
if ( $resource_id == 0 ) { $resource_nice_name = 'Channel (User uploads)'; }
|
1218 |
elseif ( $resource_id == 1 ) { $resource_nice_name = 'Favourited videos'; }
|
@@ -1222,16 +1290,14 @@ JS;
|
|
1222 |
return $resource_nice_name;
|
1223 |
}
|
1224 |
|
1225 |
-
function
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
} else if ( substr($playlist,0,2) == 'PL' ) {
|
1230 |
-
$playlist = substr($playlist,2);
|
1231 |
-
}
|
1232 |
-
return $playlist;
|
1233 |
-
} // end function clean_playlist_id
|
1234 |
|
|
|
|
|
|
|
1235 |
|
1236 |
/**
|
1237 |
* Register TinyMCE button for YTC
|
@@ -1263,57 +1329,61 @@ JS;
|
|
1263 |
global $wp_version;
|
1264 |
|
1265 |
// get widget ID from parameter
|
1266 |
-
$for = $_GET['ytc_debug_json_for'];
|
1267 |
|
1268 |
if ( $for == 'global' ) {
|
1269 |
// global settings
|
1270 |
$options = get_option('youtube_channel_defaults');
|
1271 |
|
1272 |
-
if ( ! is_array($options) )
|
1273 |
return;
|
|
|
1274 |
|
1275 |
-
//
|
1276 |
unset($options['apikey']);
|
1277 |
|
1278 |
} else {
|
1279 |
-
//
|
1280 |
-
|
1281 |
-
$
|
1282 |
-
$widget_id = substr($for,strrpos($for,"-")+1);
|
1283 |
|
1284 |
// get YTC widgets options
|
1285 |
-
$widget_options = get_option(
|
1286 |
|
1287 |
-
if ( ! is_array($widget_options[$widget_id]) )
|
1288 |
return;
|
|
|
1289 |
|
1290 |
-
$options = $widget_options[$widget_id];
|
1291 |
unset ($widget_options);
|
1292 |
}
|
1293 |
|
1294 |
// prepare debug data with settings of current widget
|
1295 |
$data = array_merge(
|
1296 |
array(
|
1297 |
-
'date'
|
1298 |
-
'server'
|
1299 |
-
'php'
|
1300 |
-
'wp'
|
1301 |
-
'ytc'
|
1302 |
-
'url'
|
1303 |
-
'for'
|
1304 |
),
|
1305 |
$options
|
1306 |
);
|
1307 |
|
1308 |
-
//
|
1309 |
-
|
|
|
|
|
|
|
1310 |
header('Content-Type: application/json');
|
1311 |
echo json_encode($data);
|
1312 |
|
1313 |
-
//
|
1314 |
-
unset($data
|
1315 |
|
1316 |
-
//
|
1317 |
exit;
|
1318 |
}
|
1319 |
} // end class
|
2 |
/*
|
3 |
Plugin Name: YouTube Channel
|
4 |
Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
|
5 |
+
Description: Quick and easy embed latest or random videos from YouTube channel (user uploads, liked or favourited videos) or playlist. Use <a href="widgets.php">widget</a> for sidebar or shortcode for content. Works with <em>YouTube Data API v3</em>.
|
6 |
Author: Aleksandar Urošević
|
7 |
+
Version: 3.0.8
|
8 |
Author URI: http://urosevic.net/
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
12 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
|
14 |
+
if ( ! class_exists('WPAU_YOUTUBE_CHANNEL') )
|
15 |
{
|
16 |
class WPAU_YOUTUBE_CHANNEL
|
17 |
{
|
18 |
|
19 |
+
const DB_VER = 10;
|
20 |
+
const VER = '3.0.8';
|
21 |
|
22 |
public $plugin_name = "YouTube Channel";
|
23 |
public $plugin_slug = "youtube-channel";
|
32 |
$this->plugin_url = plugin_dir_url(__FILE__);
|
33 |
load_plugin_textdomain( $this->plugin_slug, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
|
34 |
|
35 |
+
// Generate debug JSON
|
36 |
+
if ( ! empty($_GET['ytc_debug_json_for']) ) {
|
37 |
$this->generate_debug_json();
|
38 |
+
}
|
39 |
+
|
40 |
+
// Clear all YTC cache
|
41 |
+
add_action( 'wp_ajax_ytc_clear_all_cache', array(&$this, 'clear_all_cache') );
|
42 |
|
43 |
// Activation hook and maybe update trigger
|
44 |
register_activation_hook( __FILE__, array($this, 'activate') );
|
47 |
$this->defaults = self::defaults();
|
48 |
|
49 |
// TinyMCE AddOn
|
50 |
+
add_filter( 'mce_external_plugins', array($this, 'mce_external_plugins'), 998 );
|
51 |
+
add_filter( 'mce_buttons', array($this, "mce_buttons"), 999 );
|
52 |
|
53 |
if ( is_admin() ) {
|
54 |
|
59 |
add_action( 'admin_notices', array($this, 'admin_notices') );
|
60 |
|
61 |
// Enqueue scripts and styles for Widgets page
|
62 |
+
add_action( 'admin_enqueue_scripts', array($this, 'widget_scripts') );
|
63 |
|
64 |
} else { // ELSE if ( is_admin() )
|
65 |
|
109 |
|
110 |
'ratio' => 3, // 3 - 16:9, 1 - 4:3 (deprecated: 2 - 16:10)
|
111 |
'width' => 306,
|
112 |
+
'responsive' => 1,
|
113 |
+
'display' => 'thumbnail', // thumbnail, iframe, iframe2, playlist (deprecated: chromeless, object)
|
114 |
'themelight' => 0,
|
115 |
'controls' => 0,
|
116 |
'autoplay' => 0,
|
117 |
'autoplay_mute' => 0,
|
118 |
'norel' => 0,
|
119 |
|
120 |
+
'showtitle' => 'none',
|
121 |
'showdesc' => 0,
|
122 |
'desclen' => 0,
|
|
|
123 |
'modestbranding' => 0,
|
124 |
'hideanno' => 0,
|
125 |
'hideinfo' => 0,
|
126 |
|
127 |
'goto_txt' => 'Visit our channel',
|
|
|
128 |
'popup_goto' => 0, // 0 same window, 1 new window JS, 2 new window target
|
129 |
+
'link_to' => 'none' // 0 legacy username, 1 channel, 2 vanity
|
130 |
);
|
131 |
|
132 |
add_option('youtube_channel_version', self::VER, '', 'no');
|
133 |
add_option('youtube_channel_db_ver', self::DB_VER, '', 'no');
|
134 |
add_option($this->plugin_option, $init, '', 'no');
|
135 |
|
136 |
+
return $init;
|
137 |
+
|
138 |
} // END public function init_options()
|
139 |
|
140 |
/**
|
157 |
*/
|
158 |
function admin_init() {
|
159 |
|
160 |
+
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array($this, 'add_settings_link') );
|
161 |
+
// add row to plugin page
|
162 |
+
add_filter( 'plugin_row_meta', array($this, 'add_plugin_meta_links'), 10, 2 );
|
163 |
|
164 |
require_once( 'inc/settings.php' );
|
165 |
|
187 |
|
188 |
} // END function add_settings_link()
|
189 |
|
190 |
+
/**
|
191 |
+
* Add link to official plugin page
|
192 |
+
*/
|
193 |
+
function add_plugin_meta_links($links, $file) {
|
194 |
+
|
195 |
+
if ($file === 'youtube-channel/youtube-channel.php') {
|
196 |
+
return array_merge(
|
197 |
+
$links,
|
198 |
+
array( sprintf( '<a href="https://wordpress.org/support/plugin/youtube-channel" target="_blank">%s</a>', __('Support') ) )
|
199 |
+
);
|
200 |
+
}
|
201 |
+
return $links;
|
202 |
+
|
203 |
+
}
|
204 |
/**
|
205 |
* Enqueue admin scripts and styles for widget customization
|
206 |
*/
|
208 |
|
209 |
global $pagenow;
|
210 |
|
211 |
+
// Enqueue only on widget or post pages
|
212 |
+
if( $pagenow !== 'widgets.php' && $pagenow !== 'customize.php' && $pagenow !== 'post.php' ) {
|
213 |
+
return;
|
214 |
+
}
|
215 |
|
216 |
+
/*
|
217 |
wp_enqueue_script(
|
218 |
$this->plugin_slug . '-admin',
|
219 |
plugins_url( 'assets/js/admin.min.js', __FILE__ ),
|
220 |
array('jquery'),
|
221 |
self::VER
|
222 |
+
);*/
|
223 |
wp_enqueue_style(
|
224 |
$this->plugin_slug . '-admin',
|
225 |
+
plugins_url( 'assets/css/admin.css', __FILE__ ),
|
226 |
array(),
|
227 |
self::VER
|
228 |
);
|
328 |
* Enqueue frontend scripts and styles
|
329 |
*/
|
330 |
function enqueue_scripts() {
|
|
|
331 |
|
332 |
+
// Do we need our own lightbox?
|
333 |
+
if ( empty($this->defaults['nolightbox']) ) {
|
334 |
+
wp_enqueue_style( 'magnific-popup-au', plugins_url('assets/lib/magnific-popup/magnific-popup.min.css', __FILE__), array(), self::VER );
|
335 |
+
wp_enqueue_script( 'magnific-popup-au', plugins_url('assets/lib/magnific-popup/jquery.magnific-popup.min.js', __FILE__), array('jquery'), self::VER, true );
|
336 |
+
}
|
337 |
+
|
338 |
+
wp_enqueue_style( 'youtube-channel', plugins_url('assets/css/youtube-channel.css', __FILE__), array(), self::VER );
|
339 |
+
wp_enqueue_script( 'youtube-channel', plugins_url('assets/js/youtube-channel.min.js', __FILE__), array('jquery'), self::VER, true );
|
340 |
+
|
341 |
} // end function enqueue_scripts
|
342 |
|
343 |
+
/**
|
344 |
+
* Generate comlete inline JavaScript code that conains
|
345 |
+
* Async video load and lightbox init for thumbnails
|
346 |
+
* @return string Compressed JavaScript code
|
347 |
+
*/
|
348 |
function footer_scripts() {
|
349 |
+
|
350 |
+
$js = '';
|
351 |
+
|
352 |
+
// Print YT API only if we have set ytc_html5_js in $_SESSION
|
353 |
+
if ( ! empty($_SESSION['ytc_html5_js']) ) {
|
354 |
+
$js .= "
|
355 |
+
if (!window['YT']) {
|
356 |
+
var tag=document.createElement('script');
|
357 |
+
tag.src=\"//www.youtube.com/iframe_api\";
|
358 |
+
var firstScriptTag=document.getElementsByTagName('script')[0];
|
359 |
+
firstScriptTag.parentNode.insertBefore(tag,firstScriptTag);
|
360 |
+
}
|
361 |
+
function ytc_create_ytplayers(){
|
362 |
+
{$_SESSION['ytc_html5_js']}
|
363 |
+
}
|
364 |
+
// Create YouTube players if API is loaded
|
365 |
+
try {
|
366 |
+
ytc_create_ytplayers();
|
367 |
+
} catch (e) {
|
368 |
+
// console.log('API not loaded and will create player using onYouTubeIframeAPIReady');
|
369 |
+
}
|
370 |
+
function onYouTubeIframeAPIReady(){
|
371 |
+
ytc_create_ytplayers();
|
372 |
+
}
|
373 |
+
function ytc_mute(event){event.target.mute();}
|
374 |
+
";
|
375 |
+
} // END if ( ! empty($_SESSION['ytc_html5_js']) )
|
376 |
+
|
377 |
+
// Print Magnific Popup if not disabled
|
378 |
+
if ( empty($this->defaults['nolightbox']) ) {
|
379 |
+
$js .= "
|
380 |
+
jQuery(document).ready(function($){
|
381 |
+
$('.ytc-lightbox').magnificPopupAU({
|
382 |
+
disableOn:700,
|
383 |
+
type:'iframe',
|
384 |
+
mainClass:'mfp-fade',
|
385 |
+
removalDelay:160,
|
386 |
+
preloader:false,
|
387 |
+
fixedContentPos:false
|
388 |
+
});
|
389 |
+
});
|
390 |
+
";
|
391 |
+
} // END if ( empty($this->defaults['nolightbox']) )
|
392 |
+
|
393 |
+
if ( ! empty($js) ) {
|
394 |
+
$js = "
|
395 |
+
<!-- YouTube Channel 3 -->
|
396 |
+
<script type=\"text/javascript\">
|
397 |
+
$js
|
398 |
+
</script>\n
|
399 |
+
";
|
400 |
+
|
401 |
+
if ( WP_DEBUG ) {
|
402 |
+
// Uncompressed code if WP debug is enabled
|
403 |
+
$js = str_replace(';var', ";\nvar", $js);
|
404 |
+
$js = str_replace("\t", "", $js);
|
405 |
+
// $js = str_replace(',', ",\n\t", $js);
|
406 |
+
echo $js;
|
407 |
+
} else {
|
408 |
+
echo trim(preg_replace('/[\t\r\n]+/', '', $js));
|
409 |
+
}
|
410 |
}
|
411 |
|
412 |
+
} // END function footer_scripts()
|
413 |
|
414 |
public function shortcode($atts) {
|
415 |
|
448 |
'mute' => $instance['autoplay_mute'],
|
449 |
'norel' => $instance['norel'],
|
450 |
|
451 |
+
'showtitle' => $instance['showtitle'], // none, above, below
|
|
|
452 |
'showdesc' => $instance['showdesc'], // ex showvidesc
|
453 |
'nobrand' => ( ! empty($instance['modestbranding']) ) ? $instance['modestbranding'] : '0',
|
454 |
'desclen' => $instance['desclen'], // ex videsclen
|
455 |
'noinfo' => $instance['hideinfo'],
|
456 |
'noanno' => $instance['hideanno'],
|
457 |
|
|
|
458 |
'goto_txt' => $instance['goto_txt'],
|
459 |
'popup' => $instance['popup_goto'],
|
460 |
+
'link_to' => $instance['link_to'], // none, vanity, channel, legacy
|
461 |
|
462 |
'class' => ( ! empty($instance['class']) ) ? $instance['class'] : ''
|
463 |
),
|
466 |
);
|
467 |
|
468 |
// backward compatibility for show -> display shortcode parameter
|
469 |
+
if ( ! empty($show) && $show !== $display && $show !== $instance['display'] ) {
|
470 |
$display = $show;
|
471 |
}
|
472 |
// backward compatibility for use_res -> resource shortcode parameter
|
481 |
$instance['channel'] = $channel;
|
482 |
$instance['username'] = $username;
|
483 |
$instance['playlist'] = $playlist;
|
484 |
+
$instance['resource'] = $resource; // resource: 0 channel, 1 favorites, 2 playlist, 3 liked
|
|
|
485 |
$instance['cache'] = $cache; // in seconds, def 5min - settings?
|
486 |
$instance['privacy'] = $privacy; // enhanced privacy
|
487 |
|
494 |
$instance['ratio'] = $ratio; // aspect ratio: 3 - 16:9, 2 - 16:10, 1 - 4:3
|
495 |
$instance['width'] = $width; // 306
|
496 |
$instance['responsive'] = $responsive; // enable responsivenes?
|
497 |
+
$instance['display'] = $display; // thumbnail, iframe, iframe2, playlist
|
498 |
$instance['no_thumb_title'] = $no_thumb_title; // hide tooltip for thumbnails
|
499 |
|
500 |
$instance['themelight'] = $themelight; // use light theme, dark by default
|
505 |
|
506 |
// Content Layout
|
507 |
$instance['showtitle'] = $showtitle; // show video title, disabled by default
|
|
|
508 |
$instance['showdesc'] = $showdesc; // show video description, disabled by default
|
509 |
$instance['modestbranding'] = $nobrand; // hide YT logo
|
510 |
$instance['desclen'] = $desclen; // cut video description, number of characters
|
512 |
$instance['hideanno'] = $noanno; // hide annotations, false by default
|
513 |
|
514 |
// Link to Channel
|
|
|
515 |
$instance['goto_txt'] = $goto_txt; // text for goto link - use settings
|
516 |
$instance['popup_goto'] = $popup; // open channel in: 0 same window, 1 javascript new, 2 target new
|
517 |
+
$instance['link_to'] = $link_to; // link to: none, vanity, legacy, channel
|
518 |
|
519 |
// Customization
|
520 |
$instance['class'] = $class; // custom additional class for container
|
600 |
if ( ! empty($instance['responsive']) ) {
|
601 |
$class .= ' responsive';
|
602 |
}
|
603 |
+
if ( ! empty($instance['display']) ) {
|
604 |
+
$class .= " ytc_display_{$instance['display']}";
|
605 |
+
}
|
606 |
|
607 |
switch ($resource) {
|
608 |
case 1: // Favourites
|
627 |
|
628 |
$output[] = "<div class=\"youtube_channel {$class}\">";
|
629 |
|
630 |
+
if ( $instance['display'] == 'playlist' ) { // Insert as Embedded playlist
|
631 |
|
632 |
$output = array_merge( $output, self::embed_playlist($resource_id, $instance) );
|
633 |
|
634 |
+
} else { // Individual videos from channel, favourites, liked or playlist
|
635 |
|
636 |
// Get max items for random video
|
637 |
$fetch = $instance['fetch'];
|
647 |
if ( $instance['cache'] > 0 ) {
|
648 |
|
649 |
// generate feed cache key for caching time
|
650 |
+
$cache_key = 'ytc_' . md5($resource_key) . '_' . $instance['cache'];
|
651 |
|
652 |
if ( ! empty($_GET['ytc_force_recache']) ) {
|
653 |
delete_transient($cache_key);
|
693 |
}
|
694 |
}
|
695 |
|
696 |
+
// Get resource nice name based on selected resource
|
697 |
+
$resource_nice_name = $this->resource_nice_name($resource);
|
698 |
+
|
699 |
// Prevent further checks if we have WP Error or empty record even after fallback
|
700 |
if ( is_wp_error($json_output) ) {
|
701 |
$output[] = $this->front_debug( $json_output->get_error_message() );
|
702 |
return $output;
|
703 |
}
|
704 |
elseif ( isset($json_output->items) && sizeof($json_output->items) == 0 ) {
|
705 |
+
$output[] = $this->front_debug(sprintf(__("You have set to display videos from %s [resource list ID: %s], but there have no public videos in that resouce."), $resource_nice_name, $resource_id ));
|
706 |
return $output;
|
707 |
}
|
708 |
elseif ( empty($json_output) ) {
|
729 |
}
|
730 |
}
|
731 |
|
|
|
|
|
732 |
if ($max_items == 0) {
|
733 |
|
734 |
+
// Append YouTube DATA API error reason as comment
|
735 |
if ( ! empty($json_output) && is_object($json_output) && ! empty($json_output->error->errors) ) {
|
736 |
|
737 |
// Error went in fetch_youtube_feed()
|
785 |
$num = sizeof($items);
|
786 |
}
|
787 |
|
788 |
+
for ( $y = 1; $y <= $num; ++$y ) {
|
789 |
if ( ! empty($instance['random']) ) {
|
790 |
|
791 |
$random_item = mt_rand( 0, (count($items)-1) );
|
798 |
$item = $items[ $y - 1 ];
|
799 |
}
|
800 |
|
801 |
+
// Generate single video block
|
802 |
$output = array_merge( $output, $this->ytc_print_video($item, $instance, $y) );
|
803 |
}
|
804 |
// Free some memory
|
808 |
|
809 |
} // single playlist or ytc way
|
810 |
|
811 |
+
// Append link to channel on bootom of the widget
|
812 |
+
if ( ! empty($instance['link_to']) && $instance['link_to'] != 'none' ) {
|
813 |
+
$output = array_merge( $output, $this->ytc_channel_link($instance) );
|
814 |
}
|
815 |
|
816 |
$output[] = '</div><!-- .youtube_channel -->';
|
858 |
|
859 |
}
|
860 |
|
861 |
+
// Free some memory
|
862 |
unset($response);
|
863 |
|
864 |
return $json;
|
865 |
|
866 |
} // END function fetch_youtube_feed($resource_id, $items)
|
867 |
|
|
|
868 |
/**
|
869 |
* Print explanation of error for administrators (users with capability manage_options)
|
870 |
* and hidden message for lower users and visitors
|
913 |
} // END function height_ratio($width=306, $ratio)
|
914 |
|
915 |
/**
|
916 |
+
* Generate link to YouTube channel/user
|
917 |
* @param array $instance widget or shortcode settings
|
918 |
* @return array components prepared for output
|
919 |
*/
|
923 |
$output = array();
|
924 |
|
925 |
// do we need to show goto link?
|
926 |
+
if ( $instance['link_to'] != 'none' ) {
|
927 |
|
928 |
+
$goto_url = "https://www.youtube.com/";
|
929 |
|
930 |
+
switch ($instance['link_to']) {
|
931 |
+
case 'vanity':
|
932 |
+
$vanity = trim($instance['vanity']);
|
933 |
+
if ( empty($vanity) ) {
|
934 |
+
return array("<!-- YTC ERROR: Selected Vanity custom URL to be linked but no Vanity Name provided! -->");
|
935 |
+
}
|
936 |
+
// sanity vanity content (strip all in front of last slash to cleanup vanity ID only)
|
937 |
+
if ( ! empty( $vanity ) && strpos($vanity, 'youtube.com') !== false ) {
|
938 |
+
$vanity = preg_replace('/^.*\//', '', $vanity);
|
939 |
+
}
|
940 |
+
$goto_url .= "c/$vanity";
|
941 |
+
break;
|
942 |
+
|
943 |
+
case 'legacy':
|
944 |
+
$username = trim($instance['username']);
|
945 |
+
if ( empty($username) ) {
|
946 |
+
return array("<!-- YTC ERROR: Selected Legacy username to be linked but no Legacy username provided! -->");
|
947 |
+
}
|
948 |
+
$goto_url .= "user/$username";
|
949 |
+
break;
|
950 |
|
951 |
+
case 'channel':
|
952 |
+
$channel = trim($instance['channel']);
|
953 |
+
if ( empty($channel) ) {
|
954 |
+
return array("<!-- YTC ERROR: Selected Channel page to be linked but no Channel ID provided! -->");
|
955 |
+
}
|
956 |
+
$goto_url .= "channel/$channel";
|
957 |
+
break;
|
958 |
+
}
|
959 |
|
960 |
$goto_txt = trim($instance['goto_txt']);
|
961 |
if ( $goto_txt == "" ) {
|
962 |
$goto_txt = __('Visit our YouTube channel', 'youtube-channel');
|
963 |
}
|
964 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
965 |
$newtab = __("in new window/tab", 'youtube-channel');
|
966 |
|
967 |
$output[] = '<div class="clearfix"></div>';
|
985 |
return $output;
|
986 |
} // end function ytc_channel_link
|
987 |
|
988 |
+
|
989 |
+
/**
|
990 |
+
* Generate output for single video block
|
991 |
+
* @param object $item Video object from JSON
|
992 |
+
* @param array $instance Settings from widget or shortcode
|
993 |
+
* @param int $y Order number of video
|
994 |
+
* @return array Prepared single video block as array to concatenate
|
995 |
+
*/
|
996 |
function ytc_print_video($item, $instance, $y) {
|
997 |
|
998 |
+
// Calculate width and height
|
999 |
+
if ( empty($instance['width']) ) {
|
1000 |
+
$instance['width'] = $this->defaults['width'];
|
1001 |
+
}
|
1002 |
+
$height = $this->height_ratio($instance['width'], $instance['ratio']);
|
1003 |
+
|
1004 |
+
// How to display videos?
|
1005 |
+
if ( empty($instance['display']) ) {
|
1006 |
+
$instance['display'] = 'thumbnail';
|
1007 |
+
}
|
1008 |
+
|
1009 |
+
// Extract details about video from Resource
|
1010 |
+
$yt_id = $item->snippet->resourceId->videoId;
|
1011 |
+
$yt_title = $item->snippet->title;
|
1012 |
+
$yt_date = $item->snippet->publishedAt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1013 |
$yt_thumb = "//img.youtube.com/vi/$yt_id/0.jpg"; // zero for HD thumb
|
|
|
1014 |
|
1015 |
+
// Enhanced privacy?
|
1016 |
+
$youtube_domain = $this->youtube_domain($instance);
|
1017 |
|
1018 |
switch ($y) {
|
1019 |
case 1:
|
1029 |
break;
|
1030 |
}
|
1031 |
|
1032 |
+
// Set proper class for responsive thumbs per selected aspect ratio
|
1033 |
+
$arclass = $this->arclass($instance);
|
|
|
|
|
|
|
|
|
|
|
1034 |
|
1035 |
+
$output[] = "<div class=\"ytc_video_container ytc_video_{$y} ytc_video_{$vnumclass} ${arclass}\" style=\"width:{$instance['width']}px\">";
|
|
|
|
|
|
|
1036 |
|
1037 |
+
// Show video title above video?
|
1038 |
+
if ( ! empty($instance['showtitle']) && $instance['showtitle'] == 'above' ) {
|
1039 |
+
$output[] = "<h3 class=\"ytc_title ytc_title_above\">{$yt_title}</h3>";
|
1040 |
+
}
|
|
|
1041 |
|
1042 |
// Print out video
|
1043 |
+
if ( $instance['display'] == "iframe" ) {
|
|
|
|
|
|
|
1044 |
|
1045 |
// Start wrapper for responsive item
|
1046 |
if ( $instance['responsive'] ) {
|
1047 |
$output[] = '<div class="fluid-width-video-wrapper">';
|
1048 |
}
|
1049 |
|
1050 |
+
$output[] = "<iframe title=\"YouTube Video Player\" width=\"{$instance['width']}\" height=\"{$height}\" src=\"//{$youtube_domain}/embed/{$yt_id}?wmode=opaque";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1051 |
|
1052 |
+
if ( ! empty($instance['norel']) ) $output[] = "&rel=0"; // disable related videos
|
1053 |
+
if ( ! empty($instance['controls']) ) $output[] = "&controls=0";
|
1054 |
+
if ( ! empty($instance['hideinfo']) ) $output[] = "&showinfo=0";
|
1055 |
+
if ( ! empty($instance['autoplay']) ) $output[] = "&autoplay=1";
|
1056 |
+
if ( ! empty($instance['hideanno']) ) $output[] = "&iv_load_policy=3";
|
1057 |
+
if ( ! empty($instance['themelight']) ) $output[] = "&theme=light";
|
1058 |
+
if ( ! empty($instance['modestbranding']) ) $output[] = "&modestbranding=1";
|
1059 |
+
|
1060 |
+
$output[] = "\" style=\"border:0;\" allowfullscreen id=\"ytc_{$yt_id}\"></iframe>";
|
1061 |
|
1062 |
// Close wrapper for responsive item
|
1063 |
if ( $instance['responsive'] ) {
|
1064 |
$output[] = '</div>';
|
1065 |
}
|
1066 |
|
1067 |
+
} else if ( $instance['display'] == "iframe2" ) {
|
1068 |
|
1069 |
// youtube API async
|
1070 |
+
$js_vars = '';
|
1071 |
+
$js_vars .= ( ! empty($instance['norel']) ) ? "rel:0," : '';
|
1072 |
+
$js_vars .= ( ! empty($instance['autoplay']) ) ? "autoplay:1," : '';
|
1073 |
+
$js_vars .= ( ! empty($instance['hideinfo']) ) ? "showinfo:0," : '';
|
1074 |
+
$js_vars .= ( ! empty($instance['controls']) ) ? "controls:0," : '';
|
1075 |
+
$js_vars .= ( ! empty($instance['themelight']) ) ? "theme:'light'," : '';
|
1076 |
+
$js_vars .= ( ! empty($instance['modestbranding']) ) ? "modestbranding:1," : '';
|
1077 |
+
$js_vars .= "wmmode:'opaque'";
|
1078 |
+
$js_vars = rtrim($js_vars, ",");
|
1079 |
+
|
1080 |
+
$js_end = '';
|
1081 |
+
$js_end .= ( ! empty($instance['hideanno']) ) ? "iv_load_policy:3," : '';
|
1082 |
+
$js_end .= ( ! empty($instance['autoplay']) && ! empty($instance['autoplay_mute']) ) ? "events:{'onReady':ytc_mute}," : '';
|
1083 |
+
$js_end = rtrim($js_end, ',');
|
1084 |
+
|
1085 |
+
$js_player_id = str_replace('-', '_', $yt_id);
|
1086 |
|
1087 |
// Start wrapper for responsive item
|
1088 |
if ( $instance['responsive'] ) {
|
1089 |
$output[] = '<div class="fluid-width-video-wrapper">';
|
1090 |
}
|
1091 |
|
1092 |
+
$output[] = "<div id=\"ytc_player_{$js_player_id}\"></div>";
|
1093 |
|
1094 |
// Close wrapper for responsive item
|
1095 |
if ( $instance['responsive'] ) {
|
1097 |
}
|
1098 |
|
1099 |
$site_domain = $_SERVER['HTTP_HOST'];
|
1100 |
+
$ytc_html5_js = "var ytc_player_{$js_player_id};";
|
1101 |
+
$ytc_html5_js .= "ytc_player_{$js_player_id}=new YT.Player('ytc_player_{$js_player_id}',{height:'{$height}',width:'{$instance['width']}',";
|
1102 |
+
$ytc_html5_js .= "videoId:'{$yt_id}',enablejsapi:1,playerVars:{{$js_vars}},origin:'{$site_domain}',{$js_end}});";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1103 |
|
1104 |
+
// prepare JS for footer
|
1105 |
+
if ( empty($_SESSION['ytc_html5_js']) ) {
|
1106 |
+
$_SESSION['ytc_html5_js'] = $ytc_html5_js;
|
1107 |
+
} else {
|
1108 |
+
$_SESSION['ytc_html5_js'] .= $ytc_html5_js;
|
1109 |
+
}
|
1110 |
|
1111 |
} else { // default is thumbnail
|
1112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1113 |
// Do we need tooltip for thumbnail?
|
1114 |
if ( empty($instance['no_thumb_title']) ) {
|
1115 |
$title = sprintf( __('Watch video %1$s published on %2$s', 'youtube-channel' ), $yt_title, $yt_date );
|
1116 |
}
|
1117 |
|
1118 |
$p = '';
|
1119 |
+
if ( empty($instance['nolightbox']) ) {
|
1120 |
+
if ( ! empty($instance['norel']) ) $p .= '&rel=0';
|
1121 |
+
if ( ! empty($instance['modestbranding']) ) $p .= "&modestbranding=1";
|
1122 |
+
if ( ! empty($instance['controls']) ) $p .= "&controls=0";
|
1123 |
+
}
|
1124 |
|
1125 |
// Do we need thumbnail w/ or w/o tooltip
|
1126 |
+
$tag_title = ( empty($instance['no_thumb_title']) ) ? $tag_title = "title=\"{$yt_title}\"" : "";
|
1127 |
+
$output[] = "<a href=\"//${youtube_domain}/watch?v=${yt_id}${p}\" ${tag_title} class=\"ytc_thumb ytc-lightbox {$arclass}\"><span style=\"background-image: url({$yt_thumb});\" ${tag_title} id=\"ytc_{$yt_id}\"></span></a>";
|
|
|
|
|
|
|
1128 |
|
1129 |
} // what to show conditions
|
1130 |
|
1131 |
// show video title below video?
|
1132 |
+
if ( ! empty($instance['showtitle']) && $instance['showtitle'] == 'below' ) {
|
1133 |
+
$output[] = "<h3 class=\"ytc_title ytc_title_below\">{$yt_title}</h3>";
|
1134 |
}
|
1135 |
|
1136 |
// do we need to show video description?
|
1137 |
+
if ( ! empty($instance['showdesc']) ) {
|
1138 |
|
1139 |
$video_description = $item->snippet->description;
|
1140 |
$etcetera = '';
|
1141 |
if ( $instance['desclen'] > 0 ) {
|
1142 |
if ( strlen($video_description) > $instance['desclen'] ) {
|
1143 |
$video_description = substr($video_description, 0, $instance['desclen']);
|
1144 |
+
$etcetera = '…';
|
|
|
|
|
|
|
|
|
1145 |
}
|
1146 |
}
|
1147 |
|
1159 |
/* function to print standard playlist embed code */
|
1160 |
function embed_playlist($resource_id, $instance) {
|
1161 |
|
1162 |
+
$width = ( empty($instance['width']) ) ? 306 : $instance['width'];
|
1163 |
+
$height = self::height_ratio($width, $instance['ratio']);
|
1164 |
+
$autoplay = (empty($instance['autoplay'])) ? '' : '&autoplay=1';
|
1165 |
+
$theme = (empty($instance['themelight'])) ? '' : '&theme=light';
|
1166 |
$modestbranding = (empty($instance['modestbranding'])) ? '' : '&modestbranding=1';
|
1167 |
+
$rel = (empty($instance['norel'])) ? '' : '&rel=0';
|
1168 |
|
1169 |
// enhanced privacy
|
1170 |
$youtube_domain = $this->youtube_domain($instance);
|
1171 |
+
$arclass = $this->arclass($instance);
|
1172 |
+
$output[] = "<div class=\"ytc_video_container ytc_video_1 ytc_video_single ytc_playlist_only {$arclass}\">";
|
1173 |
+
$output[] = "<div class=\"fluid-width-video-wrapper\">";
|
1174 |
$output[] = "<iframe src=\"//{$youtube_domain}/embed/videoseries?list={$resource_id}{$autoplay}{$theme}{$modestbranding}{$rel}\"";
|
1175 |
+
$output[] = " width=\"{$width}\" height=\"{$height}\" frameborder=\"0\"></iframe>";
|
1176 |
+
$output[] = "</div><!-- .fluid-width-video-wrapper -->";
|
1177 |
+
$output[] = "</div><!-- .ytc_video_container -->";
|
1178 |
|
1179 |
return $output;
|
1180 |
|
1243 |
return $out;
|
1244 |
} // end function cache_time
|
1245 |
|
|
|
|
|
|
|
|
|
1246 |
|
1247 |
+
/**
|
1248 |
+
* Method to delete all YTC transient caches
|
1249 |
+
* @return string Report message about success or failed purge cache
|
1250 |
+
*/
|
1251 |
+
function clear_all_cache() {
|
1252 |
+
|
1253 |
+
global $wpdb;
|
1254 |
+
|
1255 |
+
$ret = $wpdb->query(
|
1256 |
+
$wpdb->prepare(
|
1257 |
+
"DELETE FROM $wpdb->options
|
1258 |
+
WHERE option_name LIKE %s
|
1259 |
+
OR option_name LIKE %s
|
1260 |
+
",
|
1261 |
+
'_transient_timeout_ytc_%',
|
1262 |
+
'_transient_ytc_%'
|
1263 |
+
)
|
1264 |
+
);
|
1265 |
+
|
1266 |
+
if ( false === $ret ) {
|
1267 |
+
echo "Oops, we did not cleared any YouTube Channel cache because some error occured";
|
1268 |
+
} else {
|
1269 |
+
if ( $ret == 0 ) {
|
1270 |
+
echo "Congratulations! You can chill, there is no YouTube Channel caches.";
|
1271 |
+
} else {
|
1272 |
+
echo "Success! We cleared $ret row/s with YouTube Channel caches.";
|
1273 |
+
}
|
1274 |
+
}
|
1275 |
+
exit();
|
1276 |
+
|
1277 |
+
} // END function clear_all_cache()
|
1278 |
+
|
1279 |
+
/**
|
1280 |
+
* Return nice name for resource by provided resource ID
|
1281 |
+
* @param integer $resource_id Resource ID
|
1282 |
+
* @return string Resource nice name
|
1283 |
+
*/
|
1284 |
function resource_nice_name($resource_id) {
|
1285 |
if ( $resource_id == 0 ) { $resource_nice_name = 'Channel (User uploads)'; }
|
1286 |
elseif ( $resource_id == 1 ) { $resource_nice_name = 'Favourited videos'; }
|
1290 |
return $resource_nice_name;
|
1291 |
}
|
1292 |
|
1293 |
+
function youtube_domain($instance) {
|
1294 |
+
$youtube_domain = ( !empty($instance['privacy']) ) ? 'www.youtube-nocookie.com' : 'www.youtube.com';
|
1295 |
+
return $youtube_domain;
|
1296 |
+
} // end function youtube_domain
|
|
|
|
|
|
|
|
|
|
|
1297 |
|
1298 |
+
function arclass($instance) {
|
1299 |
+
return ( ! empty($instance['ratio']) && $instance['ratio'] == 1) ? 'ar4_3' : 'ar16_9';
|
1300 |
+
} // END function arclass()
|
1301 |
|
1302 |
/**
|
1303 |
* Register TinyMCE button for YTC
|
1329 |
global $wp_version;
|
1330 |
|
1331 |
// get widget ID from parameter
|
1332 |
+
$for = trim($_GET['ytc_debug_json_for']);
|
1333 |
|
1334 |
if ( $for == 'global' ) {
|
1335 |
// global settings
|
1336 |
$options = get_option('youtube_channel_defaults');
|
1337 |
|
1338 |
+
if ( ! is_array($options) ) {
|
1339 |
return;
|
1340 |
+
}
|
1341 |
|
1342 |
+
// Remove YouTube Data API Key from config JSON
|
1343 |
unset($options['apikey']);
|
1344 |
|
1345 |
} else {
|
1346 |
+
// widget
|
1347 |
+
$widget_id = (int)$for;
|
1348 |
+
$for = "youtube-channel-{$for}";
|
|
|
1349 |
|
1350 |
// get YTC widgets options
|
1351 |
+
$widget_options = get_option('widget_youtube-channel');
|
1352 |
|
1353 |
+
if ( ! is_array($widget_options[ $widget_id ]) ) {
|
1354 |
return;
|
1355 |
+
}
|
1356 |
|
1357 |
+
$options = $widget_options[ $widget_id ];
|
1358 |
unset ($widget_options);
|
1359 |
}
|
1360 |
|
1361 |
// prepare debug data with settings of current widget
|
1362 |
$data = array_merge(
|
1363 |
array(
|
1364 |
+
'date' => date("r"),
|
1365 |
+
'server' => $_SERVER['SERVER_SOFTWARE'],
|
1366 |
+
'php' => PHP_VERSION,
|
1367 |
+
'wp' => $wp_version,
|
1368 |
+
'ytc' => self::VER,
|
1369 |
+
'url' => get_site_url(),
|
1370 |
+
'for' => $for
|
1371 |
),
|
1372 |
$options
|
1373 |
);
|
1374 |
|
1375 |
+
// Construct descriptive filename
|
1376 |
+
$date = date('ymdHis');
|
1377 |
+
$json_filename = "ytc3_{$_SERVER['HTTP_HOST']}_{$for}_{$date}.json";
|
1378 |
+
// Return JSON file
|
1379 |
+
header("Content-disposition: attachment; filename={$json_filename}");
|
1380 |
header('Content-Type: application/json');
|
1381 |
echo json_encode($data);
|
1382 |
|
1383 |
+
// Destroy vars
|
1384 |
+
unset($data, $options, $widget_id, $option_name, $for, $date, $json_filename);
|
1385 |
|
1386 |
+
// Exit now, because we need only debug data in JSON file, not settings or any other page
|
1387 |
exit;
|
1388 |
}
|
1389 |
} // end class
|