YouTube Channel - Version 3.0.7.3

Version Description

(2015-05-29) = * Add: TinyMCE button to easy configure and insert shortcode to post/page content * Add: Report about zero videos in resource * Add: Helper method to generate resource nice name (DRY)

Download this release

Release Info

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

Code changes from version 3.0.7.2 to 3.0.7.3

inc/tinymce/plugin.js ADDED
@@ -0,0 +1,369 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function() {
2
+ tinymce.PluginManager.add( 'youtube_channel', function( editor, url ) {
3
+
4
+ // Add a button that opens a window
5
+ editor.addButton( 'youtube_channel_shortcode', {
6
+ tooltip: 'YouTube Channel',
7
+ icon: 'ytc',
8
+ onclick: function() {
9
+ // Open window
10
+ editor.windowManager.open( {
11
+ title: 'YouTube Channel',
12
+ // width: 600,
13
+ // height: 400,
14
+ // autoScroll: true,
15
+ // resizable: true,
16
+ // classes: 'ytc-shortcode-popup',
17
+ bodyType: 'tabpanel',
18
+ buttons: [
19
+ {
20
+ text: 'Insert Shortcode',
21
+ onclick: 'submit',
22
+ classes: 'widget btn primary',
23
+ minWidth: 130
24
+ },
25
+ {
26
+ text: 'Cancel',
27
+ onclick: 'close'
28
+ }
29
+ ],
30
+ body: [
31
+
32
+ {
33
+ title: 'General Settings',
34
+ type: 'form',
35
+ items: [
36
+ {
37
+ type: 'textbox',
38
+ name: 'class',
39
+ label: 'Custom CSS Class',
40
+ value: '',
41
+ tooltip: 'Enter custom class for YTC block, if you wish to target block styling'
42
+ },
43
+ {
44
+ type: 'textbox',
45
+ name: 'vanity',
46
+ label: 'Vanity/Custom ID',
47
+ value: '',
48
+ // tooltip: ''
49
+ },
50
+ {
51
+ type: 'textbox',
52
+ name: 'channel',
53
+ label: 'YouTube Channel ID',
54
+ value: '',
55
+ // tooltip: ''
56
+ },
57
+ {
58
+ type: 'textbox',
59
+ name: 'legacy',
60
+ label: 'Legacy username',
61
+ value: '',
62
+ // tooltip: ''
63
+ },
64
+ {
65
+ type: 'textbox',
66
+ name: 'playlist',
67
+ label: 'Playlist ID',
68
+ value: '',
69
+ // tooltip: ''
70
+ },
71
+ {
72
+ type: 'listbox',
73
+ name: 'resource',
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'},
81
+ ]
82
+ },
83
+ {
84
+ type: 'listbox',
85
+ name: 'cache',
86
+ label: 'Cache timeout',
87
+ tooltip: '',
88
+ values : [
89
+ {text: 'Do not cache', value: '0'},
90
+ {text: '1 minute', value: '60'},
91
+ {text: '5 minutes', value: '300', selected: true},
92
+ {text: '15 minutes', value: '900'},
93
+ {text: '30 minutes', value: '1800'},
94
+ {text: '1 hour', value: '3600'},
95
+ {text: '2 hours', value: '7200'},
96
+ {text: '5 hours', value: '18000'},
97
+ {text: '10 hours', value: '36000'},
98
+ {text: '12 hours', value: '43200'},
99
+ {text: '18 hours', value: '64800'},
100
+ {text: '1 day', value: '86400'},
101
+ {text: '2 days', value: '172800'},
102
+ {text: '3 days', value: '259200'},
103
+ {text: '4 days', value: '345600'},
104
+ {text: '5 days', value: '432000'},
105
+ {text: '6 days', value: '518400'},
106
+ {text: '1 week', value: '604800'},
107
+ {text: '2 weeks', value: '1209600'},
108
+ {text: '3 weeks', value: '1814400'},
109
+ {text: '1 month', value: '2419200'},
110
+ ]
111
+ },
112
+ {
113
+ type: 'checkbox',
114
+ name: 'only_pl',
115
+ label: 'Embed resource as playlist',
116
+ tooltip: 'Overrides random video option.',
117
+ checked: false
118
+ },
119
+ {
120
+ type: 'checkbox',
121
+ name: 'privacy',
122
+ label: 'Use Enhanced Privacy ',
123
+ // tooltip: '',
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 \"Embed resource as playlist\" is enabled)',
131
+ checked: false
132
+ },
133
+ {
134
+ type: 'textbox',
135
+ name: 'fetch',
136
+ label: 'Fetch',
137
+ value: '10',
138
+ tooltip: 'Number of videos that will be used for random pick (min 2, max 50, default 25)'
139
+ },
140
+ {
141
+ type: 'textbox',
142
+ name: 'num',
143
+ label: 'Show',
144
+ value: '1',
145
+ tooltip: 'Number of videos to display'
146
+ },
147
+ ]
148
+ },
149
+ {
150
+ title: 'Video Settings',
151
+ type: 'form',
152
+ items: [
153
+ {
154
+ type: 'listbox',
155
+ name: 'ratio',
156
+ label: 'Aspect Ratio',
157
+ // tooltip: '',
158
+ values : [
159
+ {text: 'Widescreen (16:9)', value: '3', selected: true},
160
+ {text: 'Standard TV (4:3)', value: '1'},
161
+ ]
162
+ },
163
+ {
164
+ type: 'checkbox',
165
+ name: 'responsive',
166
+ label: 'Responsive video',
167
+ tooltip: 'Make video responsive (distribute one full width video per row)',
168
+ checked: true
169
+ },
170
+ {
171
+ type: 'textbox',
172
+ name: 'width',
173
+ label: 'Width (px)',
174
+ value: '306',
175
+ tooltip: 'Set video or thumbnail width in pixels'
176
+ },
177
+ {
178
+ type: 'listbox',
179
+ name: 'display',
180
+ label: 'What to show?',
181
+ tooltip: '',
182
+ values : [
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',
191
+ label: 'Hide thumbnail tooltip',
192
+ checked: false
193
+ },
194
+ {
195
+ type: 'checkbox',
196
+ name: 'themelight',
197
+ label: 'Use light theme',
198
+ tooltip: 'Default theme is dark',
199
+ checked: false
200
+ },
201
+ {
202
+ type: 'checkbox',
203
+ name: 'controls',
204
+ label: 'Hide player controls',
205
+ checked: false
206
+ },
207
+ {
208
+ type: 'checkbox',
209
+ name: 'autoplay',
210
+ label: 'Autoplay video/playlist',
211
+ checked: false
212
+ },
213
+ {
214
+ type: 'checkbox',
215
+ name: 'autoplay_mute',
216
+ label: 'Mute video on autoplay',
217
+ checked: false
218
+ },
219
+ {
220
+ type: 'checkbox',
221
+ name: 'norel',
222
+ label: 'Hide related videos',
223
+ checked: true
224
+ },
225
+ {
226
+ type: 'checkbox',
227
+ name: 'modestbranding',
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: 'checkbox',
240
+ name: 'showtitle',
241
+ label: 'Show video title',
242
+ checked: false
243
+ },
244
+ {
245
+ type: 'checkbox',
246
+ name: 'titlebelow',
247
+ label: 'Move title below video',
248
+ checked: false
249
+ },
250
+ {
251
+ type: 'checkbox',
252
+ name: 'showdesc',
253
+ label: 'Show video description',
254
+ checked: false
255
+ },
256
+ {
257
+ type: 'textbox',
258
+ name: 'desclen',
259
+ label: 'Description length',
260
+ value: '0',
261
+ tooltip: 'Set number of characters to cut down video description to (0 means full length)'
262
+ },
263
+ {
264
+ type: 'checkbox',
265
+ name: 'hideanno',
266
+ label: 'Hide annotations',
267
+ checked: false
268
+ },
269
+ {
270
+ type: 'checkbox',
271
+ name: 'hideinfo',
272
+ label: 'Hide video info',
273
+ checked: false
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: 'Vanity/Custom URL', value: '2', selected: true},
301
+ {text: 'Channel page URL', value: '1'},
302
+ {text: 'Legacy username URL', value: '0'},
303
+ ]
304
+ },
305
+ ]
306
+ }
307
+ ],
308
+
309
+ onsubmit: function( e ) {
310
+ // Insert content when the window form is submitted
311
+ // Open shortcode
312
+ var shortcode = '[youtube_channel';
313
+
314
+ // General Settings
315
+ if ( e.data.vanity ) shortcode += ' vanity=' + e.data.vanity +'';
316
+ if ( e.data.channel ) shortcode += ' channel=' + e.data.channel +'';
317
+ if ( e.data.legacy ) shortcode += ' legacy=' + e.data.legacy +'';
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 +'';
325
+ if ( e.data.num ) shortcode += ' num=' + e.data.num +'';
326
+
327
+ // Video Settings
328
+ if ( e.data.ratio ) shortcode += ' ratio=' + e.data.ratio + '';
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.autoplay_mute ) shortcode += ' autoplay_mute=1';
337
+ if ( e.data.norel ) shortcode += ' norel=1';
338
+ if ( e.data.modestbranding ) shortcode += ' modestbranding=1';
339
+
340
+ // Content Layout
341
+ if ( e.data.showtitle ) shortcode += ' showtitle=1';
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.hideanno ) shortcode += ' hideanno=1';
346
+ if ( e.data.hideinfo ) shortcode += ' hideinfo=1';
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 + '';
355
+
356
+ // Close shortcode
357
+ shortcode += ']';
358
+
359
+ editor.insertContent( shortcode );
360
+ } // onsubmit alert
361
+
362
+ } );
363
+ } // onclick alert
364
+
365
+ } );
366
+
367
+ } );
368
+
369
+ } )();
inc/tinymce/plugin.min.js ADDED
@@ -0,0 +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 username",value:""},{type:"textbox",name:"playlist",label:"Playlist ID",value:""},{type:"listbox",name:"resource",label:"Resource to use",tooltip:"",values:[{text:"Channel",value:"0",selected:!0},{text:"Favourited videos",value:"1"},{text:"Liked videos",value:"3"},{text:"Playlist",value:"2"}]},{type:"listbox",name:"cache",label:"Cache timeout",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:"only_pl",label:"Embed resource as playlist",tooltip:"Overrides random video option.",checked:!1},{type:"checkbox",name:"privacy",label:"Use Enhanced Privacy ",checked:!1},{type:"checkbox",name:"random",label:"Random video",tooltip:'Show random video from resource (Have no effect if "Embed resource as playlist" is enabled)',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:"Width (px)",value:"306",tooltip:"Set video or thumbnail width 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"}]},{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:"autoplay_mute",label:"Mute video on autoplay",checked:!1},{type:"checkbox",name:"norel",label:"Hide related videos",checked:!0},{type:"checkbox",name:"modestbranding",label:"Hide YT Logo",tooltip:"Does not work for all videos",checked:!0}]},{title:"Content Layout",type:"form",items:[{type:"checkbox",name:"showtitle",label:"Show video title",checked:!1},{type:"checkbox",name:"titlebelow",label:"Move title below video",checked:!1},{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:"hideanno",label:"Hide annotations",checked:!1},{type:"checkbox",name:"hideinfo",label:"Hide video info",checked:!1}]},{title:"Link to Channel",type:"form",items:[{type:"checkbox",name:"showgoto",label:"Show link",tooltip:"Display link to channel below videos or thumbnails",checked:!1},{type:"textbox",name:"goto_txt",label:"Title for link",value:"Visit our YouTube channel"},{type:"listbox",name:"link_to",label:"Link to",values:[{text:"Vanity/Custom URL",value:"2",selected:!0},{text:"Channel page URL",value:"1"},{text:"Legacy username URL",value:"0"}]}]}],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.only_pl&&(a+=" only_pl=1"),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.autoplay_mute&&(a+=" autoplay_mute=1"),t.data.norel&&(a+=" norel=1"),t.data.modestbranding&&(a+=" modestbranding=1"),t.data.showtitle&&(a+=" showtitle=1"),t.data.titlebelow&&(a+=" titlebelow=1"),t.data.showdesc&&(a+=" showdesc=1"),t.data.desclen&&(a+=" desclen="+t.data.desclen),t.data.hideanno&&(a+=" hideanno=1"),t.data.hideinfo&&(a+=" hideinfo=1"),t.data.showgoto&&(a+=" showgoto=1"),t.data.goto_txt&&(a+=' goto_txt="'+t.data.goto_txt+'"'),t.data.link_to&&(a+=" link_to="+t.data.link_to),t.data.class&&(a+=" class="+t.data.class),a+="]",e.insertContent(a)}})}})})}();
readme.txt CHANGED
@@ -4,19 +4,21 @@ 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.7.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
- Show video thumbnails or playable blocks of recent videos from YouTube Channel or Playlist.
12
 
13
  == Description ==
14
 
15
- When you need to display sidebar widget with latest video from some YouTube channel or playlist, you can use customisable `YouTube Channel` plugin.
16
 
17
- Simply insert widget to sidebar, set channel name and if you wish leave all other options on default. You will get latest video from chosen YouTube channel embedded in sidebar widget, with link to channel on the bottom of the widget. If you wish to use playlist instead of channel, just set playlist ID and injoy!
18
 
19
- If you like this extension and you find it useful, please rate it on the right side.
 
 
20
 
21
  = Features =
22
  * Display latest videos from YouTube Channel (resources are sorted in reverse chronological order based on the date they were created) or videos naturaly sorted from Favorited Videos, Liked Videos and Playlist
@@ -27,18 +29,20 @@ If you like this extension and you find it useful, please rate it on the right s
27
  * Enhanced Privacy
28
  * Choose to display video as thumbnail (default), HTML5 (iframe) or HTML5 Asynchronous (iframe2)
29
  * Thumbnail mode opens video in lightbox
30
- * Custom caching timeout
31
- * Optimized data feeds
32
  * Optional video autoplay with optional muted audio
33
- * Show customized link to channel below videos
 
34
 
35
- = Notice =
36
 
37
  For fully functional plugin you need to have PHP 5.3 or newer! If you experience issues on older PHP, we can't help you as we don't have access to such old development platform.
38
 
 
 
39
  = Styling =
40
 
41
- You can use `style.css` from theme to style `YouTube Video` widget content.
42
 
43
  * `.widget_youtube-channel` – class of whole widget (parent for widget title and YTC block)
44
  * `.youtube_channel` – YTC block wrapper class. Additional classes are available:
@@ -62,7 +66,6 @@ You can use `style.css` from theme to style `YouTube Video` widget content.
62
  * Video description for videos from playlist does not work.
63
  * Removing YouTube logo from playback control bar does not work for all videos
64
  * Async HTML5 video does not work for 2nd same video on same page (two YTC blocks set to Async HTML5)
65
- * Thumbnail and opening video in lightbox does not work with `Responz` theme by `Thenify.me` if you wish to hide related videos, because this theme uses original `Magnific Popup` library that does not support `rel` parameter.
66
 
67
  If WordFence or other malware scan tool detect YouTube Channel fule youtube-channel.php as potential risk because `base64_encode()` and `base64_decode()` functions, remember that we use this two functions to store and restore JSON feeds to transient cache, so potential detection is false positive.
68
 
@@ -137,6 +140,8 @@ Along to Widget, you can add YouTube Channel block inline by using shortcode `[y
137
  * `1` Channel page
138
  * `0` Legacy username page
139
 
 
 
140
  == Installation ==
141
 
142
  You can use the built in installer and upgrader, or you can install the plugin manually.
@@ -155,16 +160,16 @@ Learn more about [Obtaining authorization credentials](https://developers.google
155
 
156
  [youtube http://www.youtube.com/watch?v=8NlXV77QO8U]
157
 
158
- 1. Visit [Google Developers Console](https://console.developers.google.com/project)
159
  1. If you don't have any project, create new one. Name it so you can recognize it (for example **My WordPress Website**).
160
- 1. Select your new project and from LHS sidebar expand group **APIs & auth**, then select item **APIs**
161
- 1. Locate and click **YouTube Data API** under **YouTube API** section
162
- 1. Click **Enable API** button
163
- 1. When you get enabled YouTube Data API in your project, click **Credentials** item from LHS menu **APIs & auth**
164
- 1. Click **Create New Key** button and select **Server Key**
165
- 1. Leave empty or enter IP of your website. If you get message **Oops, something went wrong.** make sure you set proper IP, or leave any restriction.
166
- 1. Click **Create** button
167
- 1. Copy newly created **API Key**
168
 
169
  When you generate your own YouTube Data API Key, from your **Dashboard** go to **Settings** -> **YouTube Channel** -> **General** and paster key in to field **YouTube Data API Key**.
170
 
@@ -179,17 +184,13 @@ Please folllow [Installation](https://wordpress.org/plugins/youtube-channel/inst
179
 
180
  = I set everything correct but receiveing 'Oops, something went wrong' message =
181
 
182
- Right click that message on your website, click *Inspect Element*, expand tag with class *youtube_channel* and look for HTML comment below it, message will look like this:
183
 
184
- `<!-- YTC ERROR:
185
- Please check did you set proper Channel ID. You set to show videos from channel, but YouTube does not recognize MyCoolLegacyName as existing and public channel.
186
- -->`
187
 
188
  Do exactly what message says - check and correct Channel ID in default settings/widget/shortcode.
189
 
190
- `<!-- YTC ERROR:
191
- Check YouTube Data API Key restrictions, empty cache if enabled by appending in browser address bar parameter ?ytc_force_recache=1
192
- -->`
193
 
194
  1. Try to remove restrictions by referer or IP in your **YouTube Data API Key** and refresh page after couple minutes.
195
  1. If that does not help, please try to create new API Key for Server w/o restrictions (not to regenerate existing one).
@@ -274,6 +275,11 @@ If you don't wish to pay for enhancements (then you don't care would that be imp
274
 
275
  == Changelog ==
276
 
 
 
 
 
 
277
  = 3.0.7.2 (2015-05-24) =
278
  * Add: Error report if we have broken feed on record
279
  * Add: Report about failed HTTP connections and other problems ocurred when we try to fetch feed
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.7.3
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
+ Show video thumbnails or playable blocks of recent videos from YouTube Playlist, Channel (User Uploads), Liked or Favourited videos.
12
 
13
  == Description ==
14
 
15
+ When you need to display sidebar widget with latest or random video from some YouTube channel or playlist, use plugin **YouTube Channel**!
16
 
17
+ Simply insert widget to sidebar or shortcode to content, set Channel or Playlist ID, select resource to use and if you wish leave all other options on default. You will get latest video from chosen YouTube channel or playlist embedded on location of widget/shortcode, with optional link to channel at the bottom of the YTC block.
18
 
19
+ If you like our plugin and you find it useful, please [write review and rate it](https://wordpress.org/support/view/plugin-reviews/youtube-channel).
20
+
21
+ For manual set of videos from YouTube check out [Easy YouTube Gallery](https://wordpress.org/plugins/easy-youtube-gallery/).
22
 
23
  = Features =
24
  * Display latest videos from YouTube Channel (resources are sorted in reverse chronological order based on the date they were created) or videos naturaly sorted from Favorited Videos, Liked Videos and Playlist
29
  * Enhanced Privacy
30
  * Choose to display video as thumbnail (default), HTML5 (iframe) or HTML5 Asynchronous (iframe2)
31
  * Thumbnail mode opens video in lightbox
32
+ * Custom feed caching timeout
 
33
  * Optional video autoplay with optional muted audio
34
+ * Show customized link to channel/vanity/legacy username below videos
35
+ * Final look is highly customizable thanks to predefined classes for each element of YTC block!
36
 
37
+ = Requirements =
38
 
39
  For fully functional plugin you need to have PHP 5.3 or newer! If you experience issues on older PHP, we can't help you as we don't have access to such old development platform.
40
 
41
+ If you have an old version of WordPress bundled with jQuery library older than v1.7, some aspects of plugin may not work, as we do not reinclude jQuery library.
42
+
43
  = Styling =
44
 
45
+ You can use `style.css` from theme or other custom location to additionaly style/tweak look of YTC block. You can stick to classes:
46
 
47
  * `.widget_youtube-channel` – class of whole widget (parent for widget title and YTC block)
48
  * `.youtube_channel` – YTC block wrapper class. Additional classes are available:
66
  * Video description for videos from playlist does not work.
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
 
70
  If WordFence or other malware scan tool detect YouTube Channel fule youtube-channel.php as potential risk because `base64_encode()` and `base64_decode()` functions, remember that we use this two functions to store and restore JSON feeds to transient cache, so potential detection is false positive.
71
 
140
  * `1` Channel page
141
  * `0` Legacy username page
142
 
143
+ *Please note, to enhance plugin functionality, we can change some shortcode parameters in future.*
144
+
145
  == Installation ==
146
 
147
  You can use the built in installer and upgrader, or you can install the plugin manually.
160
 
161
  [youtube http://www.youtube.com/watch?v=8NlXV77QO8U]
162
 
163
+ 1. Visit [Google Developers Console](https://console.developers.google.com/project).
164
  1. If you don't have any project, create new one. Name it so you can recognize it (for example **My WordPress Website**).
165
+ 1. Select your new project and from LHS sidebar expand group **APIs & auth**, then select item **APIs**.
166
+ 1. Locate and click **YouTube Data API** under **YouTube API** section.
167
+ 1. Click **Enable API** button.
168
+ 1. When you get enabled YouTube Data API in your project, click **Credentials** item from LHS menu **APIs & auth**.
169
+ 1. Click **Create New Key** button and select **Server Key**.
170
+ 1. Leave empty or enter IP of your website. If you get message **Oops, something went wrong.** make sure you set proper IP, or do not set any restriction.
171
+ 1. Click **Create** button.
172
+ 1. Copy newly created **API Key**.
173
 
174
  When you generate your own YouTube Data API Key, from your **Dashboard** go to **Settings** -> **YouTube Channel** -> **General** and paster key in to field **YouTube Data API Key**.
175
 
184
 
185
  = I set everything correct but receiveing 'Oops, something went wrong' message =
186
 
187
+ Login as user with Administrator role and you'll see YTC ERROR message with explanation what's wrong. Examples:
188
 
189
+ > **YTC ERROR:** Please check did you set proper Channel ID. You set to show videos from channel, but YouTube does not recognize MyCoolLegacyName as existing and public channel.
 
 
190
 
191
  Do exactly what message says - check and correct Channel ID in default settings/widget/shortcode.
192
 
193
+ > **YTC ERROR** Check YouTube Data API Key restrictions, empty cache if enabled by appending in browser address bar parameter ?ytc_force_recache=1
 
 
194
 
195
  1. Try to remove restrictions by referer or IP in your **YouTube Data API Key** and refresh page after couple minutes.
196
  1. If that does not help, please try to create new API Key for Server w/o restrictions (not to regenerate existing one).
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
280
+ * Add: Report about zero videos in resource
281
+ * Add: Helper method to generate resource nice name (DRY)
282
+
283
  = 3.0.7.2 (2015-05-24) =
284
  * Add: Error report if we have broken feed on record
285
  * Add: Report about failed HTTP connections and other problems ocurred when we try to fetch feed
youtube-channel.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: YouTube Channel
4
  Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
5
  Description: <a href="widgets.php">Widget</a> that display latest video thumbnail or iframe (HTML5) video from YouTube Channel, Liked Videos, Favourites or Playlist.
6
  Author: Aleksandar Urošević
7
- Version: 3.0.7.2
8
  Author URI: http://urosevic.net/
9
  */
10
 
@@ -16,8 +16,8 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
16
  class WPAU_YOUTUBE_CHANNEL
17
  {
18
 
19
- const DB_VER = 8;
20
- const VER = '3.0.7.2';
21
 
22
  public $plugin_name = "YouTube Channel";
23
  public $plugin_slug = "youtube-channel";
@@ -42,6 +42,10 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
42
 
43
  $this->defaults = self::defaults();
44
 
 
 
 
 
45
  if ( is_admin() ) {
46
 
47
  // Initialize Plugin Settings Magic
@@ -185,7 +189,7 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
185
  global $pagenow;
186
 
187
  // Enqueue only on widget page
188
- if( $pagenow !== 'widgets.php' && $pagenow !== 'customize.php' ) return;
189
 
190
  wp_enqueue_script(
191
  $this->plugin_slug . '-admin',
@@ -621,6 +625,10 @@ function ytc_mute(event){
621
  $output[] = $this->front_debug( $json_output->get_error_message() );
622
  return $output;
623
  }
 
 
 
 
624
  elseif ( empty($json_output) ) {
625
  $output[] = $this->front_debug(sprintf(__('We have empty record for this feed. Please read <a href="%s" target="_blank">FAQ</a> and if that does not help, contact <a href="%s" target="_blank">support</a>.'), 'https://wordpress.org/plugins/youtube-channel/faq/', 'https://wordpress.org/support/plugin/youtube-channel'));
626
  return $output;
@@ -629,6 +637,7 @@ function ytc_mute(event){
629
  // Predefine `max_items` to prevent undefined notices
630
  $max_items = 0;
631
  if ( is_object($json_output) && ! empty($json_output->items) ) {
 
632
  // Sort by date uploaded
633
  $json_entry = $json_output->items;
634
 
@@ -644,6 +653,8 @@ function ytc_mute(event){
644
  }
645
  }
646
 
 
 
647
  if ($max_items == 0) {
648
 
649
  // append YouTube DATA API error reason as comment
@@ -656,9 +667,9 @@ function ytc_mute(event){
656
  // Playlist error from Google API
657
  elseif ( $json_output->error->errors[0]->reason == 'playlistNotFound' ) {
658
  if ( $resource_name == 'playlist' ) {
659
- $error_msg = "Please check did you set existing <em>Playlist ID</em>. You set to show videos from {$resource_name}, but YouTube does not recognize <strong>{$resource_id}</strong> as existing and public playlist.";
660
  } else {
661
- $error_msg = "Please check did you set proper <em>Channel ID</em>. You set to show videos from {$resource_name}, but YouTube does not recognize <strong>{$channel}</strong> as existing and public channel.";
662
  }
663
  }
664
  // Invalid YouTube Data API Key
@@ -1202,6 +1213,15 @@ JS;
1202
  return $youtube_domain;
1203
  } // end function youtube_domain
1204
 
 
 
 
 
 
 
 
 
 
1205
  function clean_playlist_id($playlist) {
1206
  if ( substr($playlist,0,4) == "http" ) {
1207
  // if URL provided, extract playlist ID
@@ -1212,6 +1232,32 @@ JS;
1212
  return $playlist;
1213
  } // end function clean_playlist_id
1214
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1215
  function generate_debug_json()
1216
  {
1217
  global $wp_version;
4
  Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
5
  Description: <a href="widgets.php">Widget</a> that display latest video thumbnail or iframe (HTML5) video from YouTube Channel, Liked Videos, Favourites or Playlist.
6
  Author: Aleksandar Urošević
7
+ Version: 3.0.7.3
8
  Author URI: http://urosevic.net/
9
  */
10
 
16
  class WPAU_YOUTUBE_CHANNEL
17
  {
18
 
19
+ const DB_VER = 9;
20
+ const VER = '3.0.7.3';
21
 
22
  public $plugin_name = "YouTube Channel";
23
  public $plugin_slug = "youtube-channel";
42
 
43
  $this->defaults = self::defaults();
44
 
45
+ // TinyMCE AddOn
46
+ add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 998 );
47
+ add_filter("mce_buttons", array($this, "mce_buttons"), 999 );
48
+
49
  if ( is_admin() ) {
50
 
51
  // Initialize Plugin Settings Magic
189
  global $pagenow;
190
 
191
  // Enqueue only on widget page
192
+ if( $pagenow !== 'widgets.php' && $pagenow !== 'customize.php' && $pagenow !== 'post.php' ) return;
193
 
194
  wp_enqueue_script(
195
  $this->plugin_slug . '-admin',
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."), $this->resource_nice_name($resource), $resource_id ));
630
+ return $output;
631
+ }
632
  elseif ( empty($json_output) ) {
633
  $output[] = $this->front_debug(sprintf(__('We have empty record for this feed. Please read <a href="%s" target="_blank">FAQ</a> and if that does not help, contact <a href="%s" target="_blank">support</a>.'), 'https://wordpress.org/plugins/youtube-channel/faq/', 'https://wordpress.org/support/plugin/youtube-channel'));
634
  return $output;
637
  // Predefine `max_items` to prevent undefined notices
638
  $max_items = 0;
639
  if ( is_object($json_output) && ! empty($json_output->items) ) {
640
+
641
  // Sort by date uploaded
642
  $json_entry = $json_output->items;
643
 
653
  }
654
  }
655
 
656
+ $resource_nice_name = $this->resource_nice_name($resource);
657
+
658
  if ($max_items == 0) {
659
 
660
  // append YouTube DATA API error reason as comment
667
  // Playlist error from Google API
668
  elseif ( $json_output->error->errors[0]->reason == 'playlistNotFound' ) {
669
  if ( $resource_name == 'playlist' ) {
670
+ $error_msg = "Please check did you set existing <em>Playlist ID</em>. You set to show videos from {$resource_nice_name}, but YouTube does not recognize <strong>{$resource_id}</strong> as existing and public playlist.";
671
  } else {
672
+ $error_msg = "Please check did you set proper <em>Channel ID</em>. You set to show videos from {$resource_nice_name}, but YouTube does not recognize <strong>{$channel}</strong> as existing and public channel.";
673
  }
674
  }
675
  // Invalid YouTube Data API Key
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'; }
1219
+ elseif ( $resource_id == 2 ) { $resource_nice_name = 'Liked videos'; }
1220
+ elseif ( $resource_id == 3 ) { $resource_nice_name = 'Liked videos'; }
1221
+ else { $resource_nice_name = 'Unknown resource'; }
1222
+ return $resource_nice_name;
1223
+ }
1224
+
1225
  function clean_playlist_id($playlist) {
1226
  if ( substr($playlist,0,4) == "http" ) {
1227
  // if URL provided, extract playlist ID
1232
  return $playlist;
1233
  } // end function clean_playlist_id
1234
 
1235
+
1236
+ /**
1237
+ * Register TinyMCE button for YTC
1238
+ * @param array $plugins Unmodified set of plugins
1239
+ * @return array Set of TinyMCE plugins with YTC addition
1240
+ */
1241
+ function mce_external_plugins($plugins) {
1242
+
1243
+ $plugins['youtube_channel'] = plugin_dir_url(__FILE__) . 'inc/tinymce/plugin.min.js';
1244
+
1245
+ return $plugins;
1246
+
1247
+ } // END function mce_external_plugins($plugins)
1248
+
1249
+ /**
1250
+ * Append TinyMCE button for YTC at the end of row 1
1251
+ * @param array $buttons Unmodified set of buttons
1252
+ * @return array Set of TinyMCE buttons with YTC addition
1253
+ */
1254
+ function mce_buttons($buttons) {
1255
+
1256
+ $buttons[] = 'youtube_channel_shortcode';
1257
+ return $buttons;
1258
+
1259
+ } // END function mce_buttons($buttons)
1260
+
1261
  function generate_debug_json()
1262
  {
1263
  global $wp_version;