Youtube Channel Gallery - Version 1.7.2

Version Description

  • Added playlist feed support.
  • Added control to select video quality.
  • Added control to open link to Youtube in a new window.
  • Improved accessibility of video links.
  • Fixed bug with 1 column.
  • CSS improvements.
Download this release

Release Info

Developer javitxu123
Plugin Icon 128x128 Youtube Channel Gallery
Version 1.7.2
Comparing to
See all releases

Code changes from version 1.6.2 to 1.7.2

admin-styles.css CHANGED
@@ -29,11 +29,11 @@
29
}
30
31
32
-
33
/*tabs a*/
34
.ytchgtabs-tabs a{
35
padding: 5px;
36
display: inline-block;
37
}
38
39
/*content*/
29
}
30
31
32
/*tabs a*/
33
.ytchgtabs-tabs a{
34
padding: 5px;
35
display: inline-block;
36
+ text-decoration: none;
37
}
38
39
/*content*/
img/play.gif ADDED
Binary file
languages/youtube-channel-gallery-es_ES.mo CHANGED
Binary file
languages/youtube-channel-gallery-es_ES.po CHANGED
@@ -7,8 +7,8 @@ msgid ""
7
msgstr ""
8
"Project-Id-Version: youtube-channel-gallery\n"
9
"Report-Msgid-Bugs-To: \n"
10
- "POT-Creation-Date: 2012-11-07 13:47+0100\n"
11
- "PO-Revision-Date: 2012-11-07 13:50+0100\n"
12
"Last-Translator: Javier <javierpose@gmail.com>\n"
13
"Language-Team: PoseLab <javierpose@gmail.com>\n"
14
"MIME-Version: 1.0\n"
@@ -31,149 +31,214 @@ msgstr "Galería de Canal de Youtube"
31
msgid "Show a youtube video and a gallery of thumbnails for a youtube channel"
32
msgstr "Muestra un vídeo y una galería de miniaturas de una canal de Youtube "
33
34
- #: youtube-channel-gallery.php:142
35
msgid "Title:"
36
msgstr "Título:"
37
38
- #: youtube-channel-gallery.php:147
39
- msgid "YouTube user name:"
40
- msgstr "Nombre de usuario de Youtube:"
41
42
- #: youtube-channel-gallery.php:223
43
msgid "Player"
44
msgstr "Reproductor"
45
46
- #: youtube-channel-gallery.php:224
47
msgid "Thumbnails"
48
msgstr "Miniaturas"
49
50
- #: youtube-channel-gallery.php:225
51
msgid "Link"
52
msgstr "Enlace"
53
54
- #: youtube-channel-gallery.php:238
55
msgid "Video width:"
56
msgstr "Ancho del vídeo:"
57
58
- #: youtube-channel-gallery.php:244
59
- #: youtube-channel-gallery.php:304
60
msgid "Aspect ratio:"
61
msgstr "Relación de aspecto:"
62
63
- #: youtube-channel-gallery.php:246
64
- #: youtube-channel-gallery.php:306
65
msgid "Standard (4x3)"
66
msgstr "Estándar (4x3)"
67
68
- #: youtube-channel-gallery.php:247
69
- #: youtube-channel-gallery.php:307
70
msgid "Widescreen (16x9)"
71
msgstr "Panorámico (16x9)"
72
73
- #: youtube-channel-gallery.php:253
74
msgid "Theme:"
75
msgstr "Tema:"
76
77
- #: youtube-channel-gallery.php:255
78
msgid "Dark"
79
msgstr "Oscuro"
80
81
- #: youtube-channel-gallery.php:256
82
msgid "Light"
83
msgstr "Claro"
84
85
- #: youtube-channel-gallery.php:262
86
msgid "Progress bar color:"
87
msgstr "Color de barra de progreso:"
88
89
- #: youtube-channel-gallery.php:264
90
msgid "Red"
91
msgstr "Rojo"
92
93
- #: youtube-channel-gallery.php:265
94
msgid "White"
95
msgstr "Blanco"
96
97
- #: youtube-channel-gallery.php:270
98
msgid "Autoplay"
99
msgstr "Autoplay"
100
101
- #: youtube-channel-gallery.php:275
102
msgid "Show related videos"
103
msgstr "Mostrar los vídeos relacionados"
104
105
- #: youtube-channel-gallery.php:280
106
msgid "Show info (title, uploader)"
107
msgstr "Mostrar información (título, cargador)"
108
109
- #: youtube-channel-gallery.php:293
110
msgid "Number of videos to show:"
111
msgstr "Número de vídeos a mostrar:"
112
113
- #: youtube-channel-gallery.php:298
114
msgid "Thumbnail width:"
115
msgstr "Ancho de miniaturas:"
116
117
- #: youtube-channel-gallery.php:312
118
msgid "Thumbnail columns:"
119
msgstr "Columnas de las miniaturas:"
120
121
- #: youtube-channel-gallery.php:319
122
msgid "Show title or description"
123
msgstr "Mostrar título y descripción"
124
125
- #: youtube-channel-gallery.php:326
126
msgid "Show title"
127
msgstr "Mostrar Título"
128
129
- #: youtube-channel-gallery.php:331
130
msgid "Show description"
131
msgstr "Mostrar descripción"
132
133
- #: youtube-channel-gallery.php:335
134
msgid "Thumbnail alignment:"
135
msgstr "Alineación de miniaturas:"
136
137
- #: youtube-channel-gallery.php:337
138
msgid "Left"
139
msgstr "Izquierda"
140
141
- #: youtube-channel-gallery.php:338
142
msgid "Right"
143
msgstr "Derecha"
144
145
- #: youtube-channel-gallery.php:339
146
msgid "Top"
147
msgstr "Arriba"
148
149
- #: youtube-channel-gallery.php:340
150
msgid "Bottom"
151
msgstr "Abajo"
152
153
- #: youtube-channel-gallery.php:345
154
msgid "Description words number:"
155
msgstr "Número de palabras en la descripción:"
156
157
- #: youtube-channel-gallery.php:366
158
msgid "Link text:"
159
msgstr "Texto del enlace"
160
161
- #: youtube-channel-gallery.php:372
162
- msgid "Show link to channel:"
163
- msgstr "Mostrar enlace al canal:"
164
165
- #: youtube-channel-gallery.php:443
166
msgid "Show more videos»"
167
msgstr "Ver más vídeos»"
168
169
- #: youtube-channel-gallery.php:614
170
- msgid "You must insert a valid YouTube user name."
171
- msgstr "Debe introducir un nombre válido de usuario de YouTube."
172
173
- #: youtube-channel-gallery.php:619
174
msgid "There is no video to show."
175
msgstr "No hay ningún vídeo para mostrar."
176
177
#~ msgid "Light:"
178
#~ msgstr "Claro"
179
#~ msgid "No post to duplicate has been supplied!"
7
msgstr ""
8
"Project-Id-Version: youtube-channel-gallery\n"
9
"Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2012-12-19 17:11+0100\n"
11
+ "PO-Revision-Date: 2012-12-19 17:11+0100\n"
12
"Last-Translator: Javier <javierpose@gmail.com>\n"
13
"Language-Team: PoseLab <javierpose@gmail.com>\n"
14
"MIME-Version: 1.0\n"
31
msgid "Show a youtube video and a gallery of thumbnails for a youtube channel"
32
msgstr "Muestra un vídeo y una galería de miniaturas de una canal de Youtube "
33
34
+ #: youtube-channel-gallery.php:152
35
msgid "Title:"
36
msgstr "Título:"
37
38
+ #: youtube-channel-gallery.php:227
39
+ #: youtube-channel-gallery.php:230
40
+ #: youtube-channel-gallery.php:271
41
+ msgid "YouTube user id:"
42
+ msgstr "Id de usuario de Youtube:"
43
44
+ #: youtube-channel-gallery.php:233
45
+ msgid "YouTube playlist id:"
46
+ msgstr "Id de lista de reproducción de YouTube:"
47
+
48
+ #: youtube-channel-gallery.php:246
49
+ msgid "Feed"
50
+ msgstr "Feed"
51
+
52
+ #: youtube-channel-gallery.php:247
53
msgid "Player"
54
msgstr "Reproductor"
55
56
+ #: youtube-channel-gallery.php:248
57
msgid "Thumbnails"
58
msgstr "Miniaturas"
59
60
+ #: youtube-channel-gallery.php:249
61
msgid "Link"
62
msgstr "Enlace"
63
64
+ #: youtube-channel-gallery.php:262
65
+ msgid "Video feed type:"
66
+ msgstr "Tipo de feed de vídeo:"
67
+
68
+ #: youtube-channel-gallery.php:264
69
+ msgid "Uploaded by a user"
70
+ msgstr "Subidos por el usuario"
71
+
72
+ #: youtube-channel-gallery.php:266
73
+ msgid "Playlist"
74
+ msgstr "Lista de reproducción"
75
+
76
+ #: youtube-channel-gallery.php:287
77
msgid "Video width:"
78
msgstr "Ancho del vídeo:"
79
80
+ #: youtube-channel-gallery.php:292
81
+ #: youtube-channel-gallery.php:363
82
msgid "Aspect ratio:"
83
msgstr "Relación de aspecto:"
84
85
+ #: youtube-channel-gallery.php:294
86
+ #: youtube-channel-gallery.php:365
87
msgid "Standard (4x3)"
88
msgstr "Estándar (4x3)"
89
90
+ #: youtube-channel-gallery.php:295
91
+ #: youtube-channel-gallery.php:366
92
msgid "Widescreen (16x9)"
93
msgstr "Panorámico (16x9)"
94
95
+ #: youtube-channel-gallery.php:300
96
msgid "Theme:"
97
msgstr "Tema:"
98
99
+ #: youtube-channel-gallery.php:302
100
msgid "Dark"
101
msgstr "Oscuro"
102
103
+ #: youtube-channel-gallery.php:303
104
msgid "Light"
105
msgstr "Claro"
106
107
+ #: youtube-channel-gallery.php:308
108
msgid "Progress bar color:"
109
msgstr "Color de barra de progreso:"
110
111
+ #: youtube-channel-gallery.php:310
112
msgid "Red"
113
msgstr "Rojo"
114
115
+ #: youtube-channel-gallery.php:311
116
msgid "White"
117
msgstr "Blanco"
118
119
+ #: youtube-channel-gallery.php:316
120
+ msgid "Video quality:"
121
+ msgstr "Calidad del vídeo:"
122
+
123
+ #: youtube-channel-gallery.php:318
124
+ msgid "default"
125
+ msgstr "por defecto"
126
+
127
+ #: youtube-channel-gallery.php:319
128
+ msgid "highres"
129
+ msgstr "alta resolución"
130
+
131
+ #: youtube-channel-gallery.php:320
132
+ msgid "hd1080"
133
+ msgstr "hd1080"
134
+
135
+ #: youtube-channel-gallery.php:321
136
+ msgid "hd720"
137
+ msgstr "hd720"
138
+
139
+ #: youtube-channel-gallery.php:322
140
+ msgid "large"
141
+ msgstr "largo"
142
+
143
+ #: youtube-channel-gallery.php:323
144
+ msgid "medium"
145
+ msgstr "mediano"
146
+
147
+ #: youtube-channel-gallery.php:324
148
+ msgid "small"
149
+ msgstr "pequeño"
150
+
151
+ #: youtube-channel-gallery.php:329
152
msgid "Autoplay"
153
msgstr "Autoplay"
154
155
+ #: youtube-channel-gallery.php:334
156
msgid "Show related videos"
157
msgstr "Mostrar los vídeos relacionados"
158
159
+ #: youtube-channel-gallery.php:339
160
msgid "Show info (title, uploader)"
161
msgstr "Mostrar información (título, cargador)"
162
163
+ #: youtube-channel-gallery.php:352
164
msgid "Number of videos to show:"
165
msgstr "Número de vídeos a mostrar:"
166
167
+ #: youtube-channel-gallery.php:357
168
msgid "Thumbnail width:"
169
msgstr "Ancho de miniaturas:"
170
171
+ #: youtube-channel-gallery.php:371
172
msgid "Thumbnail columns:"
173
msgstr "Columnas de las miniaturas:"
174
175
+ #: youtube-channel-gallery.php:378
176
msgid "Show title or description"
177
msgstr "Mostrar título y descripción"
178
179
+ #: youtube-channel-gallery.php:385
180
msgid "Show title"
181
msgstr "Mostrar Título"
182
183
+ #: youtube-channel-gallery.php:390
184
msgid "Show description"
185
msgstr "Mostrar descripción"
186
187
+ #: youtube-channel-gallery.php:394
188
msgid "Thumbnail alignment:"
189
msgstr "Alineación de miniaturas:"
190
191
+ #: youtube-channel-gallery.php:396
192
msgid "Left"
193
msgstr "Izquierda"
194
195
+ #: youtube-channel-gallery.php:397
196
msgid "Right"
197
msgstr "Derecha"
198
199
+ #: youtube-channel-gallery.php:398
200
msgid "Top"
201
msgstr "Arriba"
202
203
+ #: youtube-channel-gallery.php:399
204
msgid "Bottom"
205
msgstr "Abajo"
206
207
+ #: youtube-channel-gallery.php:404
208
msgid "Description words number:"
209
msgstr "Número de palabras en la descripción:"
210
211
+ #: youtube-channel-gallery.php:425
212
msgid "Link text:"
213
msgstr "Texto del enlace"
214
215
+ #: youtube-channel-gallery.php:431
216
+ msgid "Show link to channel"
217
+ msgstr "Mostrar enlace al canal"
218
+
219
+ #: youtube-channel-gallery.php:436
220
+ msgid "Open in a new window or tab"
221
+ msgstr "Abri en una ventana nueva o pestaña"
222
223
+ #: youtube-channel-gallery.php:517
224
msgid "Show more videos»"
225
msgstr "Ver más vídeos»"
226
227
+ #: youtube-channel-gallery.php:551
228
+ #: youtube-channel-gallery.php:556
229
+ msgid "You must insert a valid YouTube user id."
230
+ msgstr "Debes introducir un id válido de usuario de YouTube."
231
+
232
+ #: youtube-channel-gallery.php:561
233
+ msgid "You must insert a valid playlist id."
234
+ msgstr "Debes introducir un id válido de lista de reproducción de YouTube."
235
236
+ #: youtube-channel-gallery.php:722
237
msgid "There is no video to show."
238
msgstr "No hay ningún vídeo para mostrar."
239
240
+ #~ msgid "User's favorites"
241
+ #~ msgstr "Favoritos del usuario"
242
#~ msgid "Light:"
243
#~ msgstr "Claro"
244
#~ msgid "No post to duplicate has been supplied!"
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://poselab.com/
4
Tags: widget, gallery, youtube, channel, user, sidebar, video, youtube playlist, html5, iframe, Youtube channel, youtube videos
5
Requires at least: 2.8
6
Tested up to: 3.4.1
7
- Stable tag: 1.6.2
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -27,7 +27,7 @@ You can see a demo of the plugin in the following URLs:
27
28
29
= Features: =
30
- * Display latest thumbnail videos from YouTube user channel.
31
* When you click on one of the thumbnails the video plays at the top.
32
* This plugin uses the YouTube IFrame player API that allows YouTube to serve an HTML5 player, rather than a Flash player, for mobile devices that do not support Flash.
33
* You can choose to use this plugin as a widget or as a shortcode.
@@ -38,7 +38,11 @@ You can see a demo of the plugin in the following URLs:
38
Description of the different fields of the plugin:
39
40
* **Title:** Widget Title.
41
- * **YouTube user name:** the username of the user's Youtube videos you want to show. Shortcode attribute: user; value: String. (Required).
42
43
**Player tab:**
44
@@ -46,6 +50,7 @@ Description of the different fields of the plugin:
46
* **Aspect ratio:** indicates the proportions of the player, standard (4:3) or widescreen (16:9) format. Shortcode attribute:** ratio; values: 4x3 (default) or 16x9. (Optional).
47
* **Theme:** display player controls (like a 'play' button or volume control) within a dark or light control bar. Shortcode attribute: theme; values: dark (default) or light. (Optional).
48
* **Progress bar color:** specifies the color that will be used in the player's video progress bar to highlight the amount of the video that the viewer has already seen. Shortcode attribute: color; values: red (default) or white. (Optional).
49
* **Autoplay:** automatically play the initial video when the player loads. Shortcode attribute: autoplay; values: 0 (default) or 1. (Optional).
50
* **Show related videos:** this parameter indicates whether the player should show related videos when playback of the initial video ends. Shortcode attribute: rel; values: 0 (default) or 1. (Optional).
51
* **Show info (title, uploader):** display information like the video title and rating before the video starts playing. Shortcode attribute: showinfo; values: 0 (default) or 1. (Optional).
@@ -65,12 +70,13 @@ Description of the different fields of the plugin:
65
66
* **Link text:** field to customize the text of the link to the gallery on YouTube. Shortcode attribute: link_tx; value: String. (Optional).
67
* **Show link to channel:** option to display a link to the youtube user channel. Shortcode attribute: link; values: 0 (default) or 1. (Optional).
68
69
70
= Shortcode syntax: =
71
In the following example are all attributes that can be used with the shortcode and explained above:
72
73
- `[Youtube_Channel_Gallery user="MaxonC4D" videowidth="500" ratio="16x9" theme="light" color="white" autoplay="1" rel="1" showinfo="1" maxitems="9" thumbwidth="90" thumbratio="16x9" thumbcolumns="3" title="1" description="1" thumbnail_alignment="left" descriptionwordsnumber="10"]`
74
75
76
= Languages: =
@@ -92,21 +98,30 @@ If you have created your own language pack, or have an update of an existing one
92
93
The “widgets” admin page is found in the administrator part (wp-admin) of your WordPress site. Go to Appearance > Widgets.
94
95
- = How do I find the YouTube user name? =
96
97
The username who uploaded a video to Youtube is located below each video, where says something like in this example, "Published on June 25, 2012 by DisneyShorts", where DisneyShorts is the username.
98
99
100
== Screenshots ==
101
102
- 1. Youtube Channel Gallery admin area.
103
- 2. Youtube Channel Gallery example.
104
3. Youtube Channel Gallery example.
105
4. Youtube Channel Gallery example.
106
107
108
== Changelog ==
109
110
= 1.6.2 =
111
* Fixed bug with columns.
112
* Fixed issue with CSS.
4
Tags: widget, gallery, youtube, channel, user, sidebar, video, youtube playlist, html5, iframe, Youtube channel, youtube videos
5
Requires at least: 2.8
6
Tested up to: 3.4.1
7
+ Stable tag: 1.7.2
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
27
28
29
= Features: =
30
+ * Display latest thumbnail videos from YouTube user channel or playlist.
31
* When you click on one of the thumbnails the video plays at the top.
32
* This plugin uses the YouTube IFrame player API that allows YouTube to serve an HTML5 player, rather than a Flash player, for mobile devices that do not support Flash.
33
* You can choose to use this plugin as a widget or as a shortcode.
38
Description of the different fields of the plugin:
39
40
* **Title:** Widget Title.
41
+
42
+ **Feed tab:**
43
+
44
+ * **YouTube user name:** the user id of the user's Youtube videos you want to show or the id of the playlist. Shortcode attribute: user; value: String. (Required).
45
+ * **Video feed type:** option to select the feed type to use to show videos. Yo can select uploaded by the user or playlist. Shortcode attribute: feed; value: user (default) or playlist. (Optional).
46
47
**Player tab:**
48
50
* **Aspect ratio:** indicates the proportions of the player, standard (4:3) or widescreen (16:9) format. Shortcode attribute:** ratio; values: 4x3 (default) or 16x9. (Optional).
51
* **Theme:** display player controls (like a 'play' button or volume control) within a dark or light control bar. Shortcode attribute: theme; values: dark (default) or light. (Optional).
52
* **Progress bar color:** specifies the color that will be used in the player's video progress bar to highlight the amount of the video that the viewer has already seen. Shortcode attribute: color; values: red (default) or white. (Optional).
53
+ * **Video quality:** sets the suggested video quality for the videos. The suggested quality parameter value can be small, medium, large, hd720, hd1080, highres or default. YouTube recommend that you set the parameter value to default, which instructs YouTube to select the most appropriate playback quality, which will vary for different users, videos, systems and other playback conditions. If you set suggested quality level that is not available for the video, then the quality will be set to the next lowest level that is available. Shortcode attribute: quality; values: small, medium, large, hd720, hd1080, highres or default (default). (Optional).
54
* **Autoplay:** automatically play the initial video when the player loads. Shortcode attribute: autoplay; values: 0 (default) or 1. (Optional).
55
* **Show related videos:** this parameter indicates whether the player should show related videos when playback of the initial video ends. Shortcode attribute: rel; values: 0 (default) or 1. (Optional).
56
* **Show info (title, uploader):** display information like the video title and rating before the video starts playing. Shortcode attribute: showinfo; values: 0 (default) or 1. (Optional).
70
71
* **Link text:** field to customize the text of the link to the gallery on YouTube. Shortcode attribute: link_tx; value: String. (Optional).
72
* **Show link to channel:** option to display a link to the youtube user channel. Shortcode attribute: link; values: 0 (default) or 1. (Optional).
73
+ * **Open in a new window or tab:** option to open the link to YouTube in a new window or tab . Shortcode attribute: link_window; values: 0 (default) or 1. (Optional).
74
75
76
= Shortcode syntax: =
77
In the following example are all attributes that can be used with the shortcode and explained above:
78
79
+ `[Youtube_Channel_Gallery feed="user" user="MaxonC4D" videowidth="500" ratio="16x9" theme="light" color="white" quality="small" autoplay="1" rel="1" showinfo="1" maxitems="9" thumbwidth="90" thumbratio="16x9" thumbcolumns="3" title="1" description="1" thumbnail_alignment="left" descriptionwordsnumber="10" link_window="0"]`
80
81
82
= Languages: =
98
99
The “widgets” admin page is found in the administrator part (wp-admin) of your WordPress site. Go to Appearance > Widgets.
100
101
+ = How do I find the YouTube user id? =
102
103
The username who uploaded a video to Youtube is located below each video, where says something like in this example, "Published on June 25, 2012 by DisneyShorts", where DisneyShorts is the username.
104
105
106
== Screenshots ==
107
108
+ 1. Youtube Channel Gallery widget: Feed and Player tabs.
109
+ 2. Youtube Channel Gallery widget: Thumbnails and Link tabs.
110
3. Youtube Channel Gallery example.
111
4. Youtube Channel Gallery example.
112
+ 5. Youtube Channel Gallery example.
113
114
115
== Changelog ==
116
117
+ = 1.7.2 =
118
+ * Added playlist feed support.
119
+ * Added control to select video quality.
120
+ * Added control to open link to Youtube in a new window.
121
+ * Improved accessibility of video links.
122
+ * Fixed bug with 1 column.
123
+ * CSS improvements.
124
+
125
= 1.6.2 =
126
* Fixed bug with columns.
127
* Fixed issue with CSS.
screenshot-1.jpg CHANGED
Binary file
screenshot-2.jpg CHANGED
Binary file
screenshot-3.jpg CHANGED
Binary file
screenshot-4.jpg CHANGED
Binary file
screenshot-5.jpg ADDED
Binary file
scripts.js CHANGED
@@ -1,23 +1,33 @@
1
- //thumbnails
2
- var ytcplayer = {};
3
-
4
- function ytcplayVideo (iframeid, youtubeid) {
5
-
6
- if(iframeid in ytcplayer) {
7
- ytcplayer[iframeid].loadVideoById(youtubeid);
8
- }else{
9
- ytcplayer[iframeid] = new YT.Player(iframeid, {
10
- events: {
11
- 'onReady': function(){
12
- ytcplayer[iframeid].loadVideoById(youtubeid);
13
}
14
- }
15
- });
16
}
17
18
- }
19
20
- jQuery(document).ready(function(){
21
//Equal Height Blocks in Rows
22
//http://css-tricks.com/equal-height-blocks-in-rows/
23
var currentTallest = 0,
1
+ jQuery(document).ready(function(){
2
+
3
+ //thumbnails
4
+ var ytcplayer = {};
5
+ $('.ytcthumb').click(function(){
6
+ var iframeid = $(this).attr('data-playerid');
7
+ var youtubeid = $(this).attr('href').split("youtu.be/")[1];
8
+ var quality = $(this).attr('data-quality');
9
+ ytcplayVideo (iframeid, youtubeid, quality);
10
+
11
+ return false;
12
+ });
13
+
14
+ function ytcplayVideo (iframeid, youtubeid, quality) {
15
+ if(iframeid in ytcplayer) {
16
+ ytcplayer[iframeid].loadVideoById(youtubeid);
17
+ }else{
18
+ ytcplayer[iframeid] = new YT.Player(iframeid, {
19
+ events: {
20
+ 'onReady': function(){
21
+ ytcplayer[iframeid].loadVideoById(youtubeid);
22
+ ytcplayer[iframeid].setPlaybackQuality(quality);
23
+ }
24
}
25
+ });
26
+ }
27
+
28
}
29
30
31
//Equal Height Blocks in Rows
32
//http://css-tricks.com/equal-height-blocks-in-rows/
33
var currentTallest = 0,
styles.css CHANGED
@@ -1,6 +1,7 @@
1
/*------------------------------------------------------------
2
Plugin Name: Youtube Channel Gallery
3
Plugin URI: http://www.poselab.com/
4
Description: Show a youtube video and a gallery of thumbnails for a youtube channel.
5
------------------------------------------------------------*/
6
@@ -20,7 +21,7 @@ iframe.ytcplayer{display: block;margin-bottom: 10px;padding: 0;}
20
/*Thumbnails, title and description*/
21
/*---------------------------------------------------*/
22
ul.ytchagallery.ytccf{margin: 0; padding: 0;list-style: none;}
23
- ul.ytchagallery.ytccf li{float:left;padding:0;margin: 0}
24
ul.ytchagallery.ytccf li.ytccell-first{clear: left;}
25
26
/*Thumbnails*/
1
/*------------------------------------------------------------
2
Plugin Name: Youtube Channel Gallery
3
Plugin URI: http://www.poselab.com/
4
+ Version: 1.7.2
5
Description: Show a youtube video and a gallery of thumbnails for a youtube channel.
6
------------------------------------------------------------*/
7
21
/*Thumbnails, title and description*/
22
/*---------------------------------------------------*/
23
ul.ytchagallery.ytccf{margin: 0; padding: 0;list-style: none;}
24
+ ul.ytchagallery.ytccf li{float:left;padding:0;margin: 0;list-style: none;}
25
ul.ytchagallery.ytccf li.ytccell-first{clear: left;}
26
27
/*Thumbnails*/
youtube-channel-gallery.php CHANGED
@@ -5,7 +5,7 @@
5
Description: Show a youtube video and a gallery of thumbnails for a youtube channel.
6
Author: Javier Gómez Pose
7
Author URI: http://www.poselab.com/
8
- Version: 1.6.2
9
License: GPL2
10
11
Copyright 2010 Javier Gómez Pose (email : javierpose@gmail.com)
@@ -77,6 +77,9 @@
77
public function update( $new_instance, $old_instance ) {
78
$instance = $old_instance;
79
$instance['title'] = strip_tags( $new_instance['title'] );
80
$instance['ytchag_user'] = strip_tags( $new_instance['ytchag_user'] );
81
82
// Player options
@@ -84,6 +87,7 @@
84
$instance['ytchag_ratio'] = strip_tags( $new_instance['ytchag_ratio'] );
85
$instance['ytchag_theme'] = strip_tags( $new_instance['ytchag_theme'] );
86
$instance['ytchag_color'] = strip_tags( $new_instance['ytchag_color'] );
87
$instance['ytchag_autoplay'] = strip_tags( $new_instance['ytchag_autoplay'] );
88
$instance['ytchag_rel'] = strip_tags( $new_instance['ytchag_rel'] );
89
$instance['ytchag_showinfo'] = strip_tags( $new_instance['ytchag_showinfo'] );
@@ -101,6 +105,7 @@
101
// Link options
102
$instance['ytchag_link'] = $new_instance['ytchag_link'];
103
$instance['ytchag_link_tx'] = strip_tags( $new_instance['ytchag_link_tx'] );
104
105
return $instance;
106
}
@@ -109,31 +114,36 @@
109
* Back-end widget form.
110
*/
111
public function form( $instance ) {
112
- $title = esc_attr($instance['title']);
113
- $ytchag_user = strip_tags($instance['ytchag_user']);
114
115
// Player options
116
- $ytchag_video_width = strip_tags($instance['ytchag_video_width']);
117
- $ytchag_ratio = strip_tags($instance['ytchag_ratio']);
118
- $ytchag_theme = strip_tags($instance['ytchag_theme']);
119
- $ytchag_color = strip_tags($instance['ytchag_color']);
120
- $ytchag_autoplay = strip_tags($instance['ytchag_autoplay']);
121
- $ytchag_rel = strip_tags($instance['ytchag_rel']);
122
- $ytchag_showinfo = strip_tags($instance['ytchag_showinfo']);
123
124
// Thumbnail options
125
- $ytchag_maxitems = strip_tags($instance['ytchag_maxitems']);
126
- $ytchag_thumb_width = strip_tags($instance['ytchag_thumb_width']);
127
- $ytchag_thumb_ratio = strip_tags($instance['ytchag_thumb_ratio']);
128
- $ytchag_thumb_columns = strip_tags($instance['ytchag_thumb_columns']);
129
- $ytchag_title = strip_tags($instance['ytchag_title']);
130
- $ytchag_description = strip_tags($instance['ytchag_description']);
131
- $ytchag_thumbnail_alignment = strip_tags($instance['ytchag_thumbnail_alignment']);
132
- $ytchag_description_words_number = strip_tags($instance['ytchag_description_words_number']);
133
134
// Link options
135
- $ytchag_link = esc_attr($instance['ytchag_link']);
136
- $ytchag_link_tx = strip_tags($instance['ytchag_link_tx']);
137
138
?>
139
@@ -143,12 +153,6 @@
143
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
144
</p>
145
146
- <p>
147
- <label for="<?php echo $this->get_field_id( 'ytchag_user' ); ?>"><?php _e( 'YouTube user name:', 'youtube-channel-gallery' ); ?></label>
148
- <input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_user' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_user' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_user ); ?>" />
149
- </p>
150
-
151
-
152
<script type="text/javascript">
153
jQuery(document).ready(function($) {
154
@@ -177,7 +181,7 @@
177
show_title_description ();
178
179
180
- $('#tabs-<?php echo $this->id; ?>-2 .ytchg-tit-desc a').click(function(){
181
if(!$(this).parent().parent().hasClass('active')){
182
slide_title_description ( 'slideDown' );
183
} else{
@@ -189,27 +193,46 @@
189
190
function slide_title_description ( action ){
191
if(action == 'slideDown'){
192
- $('#tabs-<?php echo $this->id; ?>-2 .ytchg-title-and-description').slideDown('fast');
193
- $('#tabs-<?php echo $this->id; ?>-2 fieldset.ytchg-field-tit-desc').addClass('ytchg-fieldborder active');
194
} else if(action == 'slideUp'){
195
- $('#tabs-<?php echo $this->id; ?>-2 .ytchg-title-and-description').slideUp('fast');
196
- $('#tabs-<?php echo $this->id; ?>-2 fieldset.ytchg-field-tit-desc').removeClass('ytchg-fieldborder active');
197
}
198
}
199
200
function show_title_description (){
201
- if( $('#tabs-<?php echo $this->id; ?>-2 .ytchg-tit').is(':checked') || $('#tabs-<?php echo $this->id; ?>-2 .ytchg-desc').is(':checked')){
202
- $('#tabs-<?php echo $this->id; ?>-2 .ytchg-title-and-description').show();
203
- $('#tabs-<?php echo $this->id; ?>-2 fieldset.ytchg-field-tit-desc').addClass('ytchg-fieldborder active');
204
} else{
205
- $('#tabs-<?php echo $this->id; ?>-2 .ytchg-title-and-description').hide();
206
207
}
208
}
209
210
- /*
211
- */
212
213
});
214
</script>
215
@@ -220,27 +243,52 @@
220
221
222
<ul class="ytchgtabs-tabs">
223
- <li><a href="#tabs-<?php echo $this->id; ?>-1"><?php _e( 'Player', 'youtube-channel-gallery' ); ?></a></li>
224
- <li><a href="#tabs-<?php echo $this->id; ?>-2"><?php _e( 'Thumbnails', 'youtube-channel-gallery' ); ?></a></li>
225
- <li><a href="#tabs-<?php echo $this->id; ?>-3"><?php _e( 'Link', 'youtube-channel-gallery' ); ?></a></li>
226
</ul>
227
228
229
<?php
230
/*
231
- Player Tab
232
--------------------
233
*/
234
?>
235
<div id="tabs-<?php echo $this->id; ?>-1" class="ytchgtabs-content">
236
237
<p>
238
<label for="ytchag_video_width"><?php _e( 'Video width:', 'youtube-channel-gallery' ); ?></label>
239
<input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_video_width' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_video_width' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_video_width ); ?>" />
240
</p>
241
242
<p>
243
-
244
<label for="ytchag_ratio"><?php _e( 'Aspect ratio:', 'youtube-channel-gallery' ); ?></label>
245
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_ratio' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_ratio' ); ?>">
246
<option value="4x3"<?php selected( $instance['ytchag_ratio'], '4x3' ); ?>><?php _e( 'Standard (4x3)', 'youtube-channel-gallery' ); ?></option>
@@ -249,7 +297,6 @@
249
</p>
250
251
<p>
252
-
253
<label for="ytchag_theme"><?php _e( 'Theme:', 'youtube-channel-gallery' ); ?></label>
254
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_theme' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_theme' ); ?>">
255
<option value="dark"<?php selected( $instance['ytchag_theme'], 'dark' ); ?>><?php _e( 'Dark', 'youtube-channel-gallery' ); ?></option>
@@ -258,13 +305,25 @@
258
</p>
259
260
<p>
261
-
262
<label for="ytchag_color"><?php _e( 'Progress bar color:', 'youtube-channel-gallery' ); ?></label>
263
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_color' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_color' ); ?>">
264
<option value="red"<?php selected( $instance['ytchag_color'], 'red' ); ?>><?php _e( 'Red', 'youtube-channel-gallery' ); ?></option>
265
<option value="white"<?php selected( $instance['ytchag_color'], 'white' ); ?>><?php _e( 'White', 'youtube-channel-gallery' ); ?></option>
266
</select>
267
</p>
268
269
<input class="checkbox" type="checkbox" <?php checked( (bool) $instance['ytchag_autoplay'], true ); ?> id="<?php echo $this->get_field_id( 'ytchag_autoplay' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_autoplay' ); ?>" />
270
<label for="<?php echo $this->get_field_id( 'ytchag_autoplay' ); ?>"><?php _e('Autoplay', 'youtube-channel-gallery'); ?></label>
@@ -288,7 +347,7 @@
288
--------------------
289
*/
290
?>
291
- <div id="tabs-<?php echo $this->id; ?>-2">
292
<p>
293
<label for="ytchag_maxitems"><?php _e( 'Number of videos to show:', 'youtube-channel-gallery' ); ?></label>
294
<input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_maxitems' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_maxitems' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_maxitems ); ?>" />
@@ -360,7 +419,7 @@
360
--------------------
361
*/
362
?>
363
- <div id="tabs-<?php echo $this->id; ?>-3">
364
365
<p>
366
<label for="ytchag_link_tx"><?php _e( 'Link text:', 'youtube-channel-gallery' ); ?></label>
@@ -369,7 +428,12 @@
369
370
<p>
371
<input class="checkbox" type="checkbox" <?php checked( (bool) $instance['ytchag_link'], true ); ?> id="<?php echo $this->get_field_id( 'ytchag_link' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_link' ); ?>" />
372
- <label for="<?php echo $this->get_field_id( 'ytchag_link' ); ?>"><?php _e('Show link to channel:', 'youtube-channel-gallery'); ?></label>
373
</p>
374
375
</div>
@@ -390,6 +454,9 @@
390
391
//$instance variables
392
//--------------------------------
393
$ytchag_user = apply_filters('ytchag_user', $instance['ytchag_user']);
394
395
// Player options
@@ -397,6 +464,7 @@
397
$ytchag_ratio = apply_filters('ytchag_ratio', $instance['ytchag_ratio']);
398
$ytchag_theme = apply_filters('ytchag_theme', $instance['ytchag_theme']);
399
$ytchag_color = apply_filters('ytchag_color', $instance['ytchag_color']);
400
$ytchag_autoplay = apply_filters('ytchag_autoplay', $instance['ytchag_autoplay']);
401
$ytchag_rel = apply_filters('ytchag_rel', $instance['ytchag_rel']);
402
$ytchag_showinfo = apply_filters('ytchag_showinfo', $instance['ytchag_showinfo']);
@@ -414,23 +482,29 @@
414
// Link options
415
$ytchag_link = apply_filters('ytchag_link', $instance['ytchag_link']);
416
$ytchag_link_tx = apply_filters('ytchag_link_tx', $instance['ytchag_link_tx']);
417
//--------------------------------
418
//end $instance variables
419
420
421
//defaults
422
//--------------------------------
423
// Player options
424
$ytchag_video_width = ( $ytchag_video_width ) ? $ytchag_video_width : 250;
425
- $ytchag_theme = ( $ytchag_theme ) ? '&theme='. $ytchag_theme : ''; //defaul dark
426
- $ytchag_color = ( $ytchag_color ) ? '&color='. $ytchag_color : ''; //defaul red
427
- $ytchag_autoplay = ( $ytchag_autoplay ) ? '&autoplay='. $ytchag_autoplay : ''; //defaul 0
428
- $ytchag_rel = ( $ytchag_rel ) ? '&rel='. $ytchag_rel : '&rel=0'; //defaul 1
429
- $ytchag_showinfo = ( $ytchag_showinfo ) ? '&showinfo='. $ytchag_showinfo : '&showinfo=0'; //defaul 1
430
431
// Thumbnail options
432
$ytchag_thumb_width = ( $ytchag_thumb_width ) ? $ytchag_thumb_width : 85;
433
- $ytchag_thumb_columns = ( $ytchag_thumb_columns ) ? $ytchag_thumb_columns : 0;
434
435
//title and desc
436
$ytchag_title = ( $ytchag_title ) ? $ytchag_title : 0;
@@ -441,6 +515,7 @@
441
// Link options
442
$ytchag_link = ( $ytchag_link ) ? $ytchag_link : 0;
443
$ytchag_link_tx = ( $ytchag_link_tx ) ? $ytchag_link_tx : __('Show more videos»', 'youtube-channel-gallery');
444
//--------------------------------
445
//end defaults
446
@@ -465,9 +540,26 @@
465
// only if user name inserted
466
if( $ytchag_user ) {
467
468
// links
469
- $ytchag_rss_url = "http://gdata.youtube.com/feeds/api/users/" . $ytchag_user . "/uploads";
470
- $ytchag_link_url = "http://www.youtube.com/user/" . $ytchag_user;
471
472
//RSS Feed
473
include_once(ABSPATH . WPINC . '/feed.php');
@@ -514,6 +606,7 @@
514
515
516
//title and description content
517
if($ytchag_title || $ytchag_description){
518
$title_and_description_alignment_class = ' ytc-td-' . $ytchag_thumbnail_alignment;
519
$title_and_description_content= '<div class="ytctitledesc-cont">';
@@ -528,17 +621,18 @@
528
}
529
530
$title_and_description_content.= '</div>';
531
- }//end title and description content
532
533
534
//rows and columns control
535
536
$column++;
537
- $columnlastfirst = '';
538
- if($ytchag_thumb_columns !=0 && $column%$ytchag_thumb_columns === 0){
539
- $columnlastfirst = ' ytccell-last';
540
- }
541
- if($ytchag_thumb_columns !=0 && $column === 1){
542
$columnlastfirst = ' ytccell-first';
543
STATIC $rowcount = 0;
544
$rowcount++;
@@ -546,6 +640,9 @@
546
$tableclass = ' ytc-table';
547
$columnnumber = ' ytc-columns'. $ytchag_thumb_columns;
548
549
}// end columns control
550
551
@@ -566,41 +663,40 @@
566
$i++;
567
568
569
-
570
- if($columnlastfirst == ' ytccell-first'){
571
$content.= "\n\n" .'<div class="ytccf ytc-row ytc-r-' . $rowcount . $row_oddeven . ' ">' . "\n\n";
572
}
573
574
- //$content.= '$column: ' + $column;
575
- $content.= "\n\n" . ' <li class="ytccell-' . $column . $columnlastfirst . '">';
576
577
- if($ytchag_thumb_columns !=0 && $column%$ytchag_thumb_columns === 0 ){
578
- $column = 0;
579
- }
580
581
- $content.= '<div class="ytcliinner">';
582
583
- if($ytchag_thumbnail_alignment == 'bottom'){
584
- $content.= $title_and_description_content;
585
586
- }
587
588
- $content.= '<div class="ytcthumb-cont">';
589
- $content.= '<a class="ytcthumb" href="javascript: ytcplayVideo(\'ytcplayer' . $plugincount . '\', \'' . $youtubeid . '\');" alt="' . $title . '" title="' . $title . '" style="background-image: url(' . $thumb . ');">';
590
- $content.= '<div class="ytcplay" style="width: ' . $ytchag_thumb_width . 'px; height: ' . $ytchag_thumb_height . 'px"></div>';
591
- $content.= '</a>';
592
- $content.= '</div>';
593
594
- if($ytchag_thumbnail_alignment != 'bottom'){
595
- $content.= $title_and_description_content;
596
- }
597
598
- $content.= '</div>';
599
600
- $content.= '</li>' . "\n\n";
601
-
602
- if($columnlastfirst == ' ytccell-last'){
603
- $content.= '</div>' . "\n\n\n";
604
}
605
606
} //foreach end
@@ -614,11 +710,11 @@
614
615
//link to youtube.com gallery
616
if( $ytchag_link) {
617
- $content.= '<a href="' . $ytchag_link_url . '" class="ytcmore">' . $ytchag_link_tx . '</a>';
618
}
619
}
620
} else {
621
- $content= '<p class="empty">' . __('You must insert a valid YouTube user name.', 'youtube-channel-gallery') . '</p>';
622
} // end check user name
623
624
// user name not inserted
@@ -663,11 +759,15 @@
663
extract( shortcode_atts( array(
664
'user' => '',
665
666
// Player options
667
'videowidth' => '',
668
'ratio' => '',
669
'theme' => '',
670
'color' => '',
671
'autoplay' => '',
672
'rel' => '',
673
'showinfo' => '',
@@ -684,10 +784,13 @@
684
685
// Link options
686
'link' => '',
687
- 'link_tx' => ''
688
689
), $atts ) );
690
691
$instance['ytchag_user'] = $user;
692
693
// Player options
@@ -695,6 +798,7 @@
695
$instance['ytchag_ratio'] = $ratio;
696
$instance['ytchag_theme'] = $theme;
697
$instance['ytchag_color'] = $color;
698
$instance['ytchag_autoplay'] = $autoplay;
699
$instance['ytchag_rel'] = $rel;
700
$instance['ytchag_showinfo'] = $showinfo;
@@ -712,6 +816,7 @@
712
// Link options
713
$instance['ytchag_link'] = $link;
714
$instance['ytchag_link_tx'] = $link_tx;
715
716
717
return '<div class="ytcshort">'. $this->ytchag_rss_markup($instance) . '</div>';
5
Description: Show a youtube video and a gallery of thumbnails for a youtube channel.
6
Author: Javier Gómez Pose
7
Author URI: http://www.poselab.com/
8
+ Version: 1.7.2
9
License: GPL2
10
11
Copyright 2010 Javier Gómez Pose (email : javierpose@gmail.com)
77
public function update( $new_instance, $old_instance ) {
78
$instance = $old_instance;
79
$instance['title'] = strip_tags( $new_instance['title'] );
80
+
81
+ // Feed options
82
+ $instance['ytchag_feed'] = strip_tags( $new_instance['ytchag_feed'] );
83
$instance['ytchag_user'] = strip_tags( $new_instance['ytchag_user'] );
84
85
// Player options
87
$instance['ytchag_ratio'] = strip_tags( $new_instance['ytchag_ratio'] );
88
$instance['ytchag_theme'] = strip_tags( $new_instance['ytchag_theme'] );
89
$instance['ytchag_color'] = strip_tags( $new_instance['ytchag_color'] );
90
+ $instance['ytchag_quality'] = strip_tags( $new_instance['ytchag_quality'] );
91
$instance['ytchag_autoplay'] = strip_tags( $new_instance['ytchag_autoplay'] );
92
$instance['ytchag_rel'] = strip_tags( $new_instance['ytchag_rel'] );
93
$instance['ytchag_showinfo'] = strip_tags( $new_instance['ytchag_showinfo'] );
105
// Link options
106
$instance['ytchag_link'] = $new_instance['ytchag_link'];
107
$instance['ytchag_link_tx'] = strip_tags( $new_instance['ytchag_link_tx'] );
108
+ $instance['ytchag_link_window'] = strip_tags( $new_instance['ytchag_link_window'] );
109
110
return $instance;
111
}
114
* Back-end widget form.
115
*/
116
public function form( $instance ) {
117
+ $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
118
+
119
+ // Feed options
120
+ $ytchag_feed = isset( $instance['ytchag_feed'] ) ? esc_attr( $instance['ytchag_feed'] ) : '';
121
+ $ytchag_user = isset( $instance['ytchag_user'] ) ? esc_attr( $instance['ytchag_user'] ) : ''; //left ytchag_user variable name for backward compatibility
122
123
// Player options
124
+ $ytchag_video_width = isset( $instance['ytchag_video_width'] ) ? esc_attr( $instance['ytchag_video_width'] ) : '';
125
+ $ytchag_ratio = isset( $instance['ytchag_ratio'] ) ? esc_attr( $instance['ytchag_ratio'] ) : '';
126
+ $ytchag_theme = isset( $instance['ytchag_theme'] ) ? esc_attr( $instance['ytchag_theme'] ) : '';
127
+ $ytchag_color = isset( $instance['ytchag_color'] ) ? esc_attr( $instance['ytchag_color'] ) : '';
128
+ $ytchag_quality = isset( $instance['ytchag_quality'] ) ? esc_attr( $instance['ytchag_quality'] ) : '';
129
+ $ytchag_autoplay = isset( $instance['ytchag_autoplay'] ) ? esc_attr( $instance['ytchag_autoplay'] ) : '';
130
+ $ytchag_rel = isset( $instance['ytchag_rel'] ) ? esc_attr( $instance['ytchag_rel'] ) : '';
131
+ $ytchag_showinfo = isset( $instance['ytchag_showinfo'] ) ? esc_attr( $instance['ytchag_showinfo'] ) : '';
132
133
// Thumbnail options
134
+ $ytchag_maxitems = isset( $instance['ytchag_maxitems'] ) ? esc_attr( $instance['ytchag_maxitems'] ) : '';
135
+ $ytchag_thumb_width = isset( $instance['ytchag_thumb_width'] ) ? esc_attr( $instance['ytchag_thumb_width'] ) : '';
136
+ $ytchag_thumb_ratio = isset( $instance['ytchag_thumb_ratio'] ) ? esc_attr( $instance['ytchag_thumb_ratio'] ) : '';
137
+ $ytchag_thumb_columns = isset( $instance['ytchag_thumb_columns'] ) ? esc_attr( $instance['ytchag_thumb_columns'] ) : '';
138
+ $ytchag_title = isset( $instance['ytchag_title'] ) ? esc_attr( $instance['ytchag_title'] ) : '';
139
+ $ytchag_description = isset( $instance['ytchag_description'] ) ? esc_attr( $instance['ytchag_description'] ) : '';
140
+ $ytchag_thumbnail_alignment = isset( $instance['ytchag_thumbnail_alignment'] ) ? esc_attr( $instance['ytchag_thumbnail_alignment'] ) : '';
141
+ $ytchag_description_words_number = isset( $instance['ytchag_description_words_number'] ) ? esc_attr( $instance['ytchag_description_words_number'] ) : '';
142
143
// Link options
144
+ $ytchag_link = isset( $instance['ytchag_link'] ) ? esc_attr( $instance['ytchag_link'] ) : 0;
145
+ $ytchag_link_tx = isset( $instance['ytchag_link_tx'] ) ? esc_attr( $instance['ytchag_link_tx'] ) : '';
146
+ $ytchag_link_window = isset( $instance['ytchag_link_window'] ) ? esc_attr( $instance['ytchag_link_window'] ) : 0;
147
148
?>
149
153
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
154
</p>
155
156
<script type="text/javascript">
157
jQuery(document).ready(function($) {
158
181
show_title_description ();
182
183
184
+ $('#tabs-<?php echo $this->id; ?>-3 .ytchg-tit-desc a').click(function(){
185
if(!$(this).parent().parent().hasClass('active')){
186
slide_title_description ( 'slideDown' );
187
} else{
193
194
function slide_title_description ( action ){
195
if(action == 'slideDown'){
196
+ $('#tabs-<?php echo $this->id; ?>-3 .ytchg-title-and-description').slideDown('fast');
197
+ $('#tabs-<?php echo $this->id; ?>-3 fieldset.ytchg-field-tit-desc').addClass('ytchg-fieldborder active');
198
} else if(action == 'slideUp'){
199
+ $('#tabs-<?php echo $this->id; ?>-3 .ytchg-title-and-description').slideUp('fast');
200
+ $('#tabs-<?php echo $this->id; ?>-3 fieldset.ytchg-field-tit-desc').removeClass('ytchg-fieldborder active');
201
}
202
}
203
204
function show_title_description (){
205
+ if( $('#tabs-<?php echo $this->id; ?>-3 .ytchg-tit').is(':checked') || $('#tabs-<?php echo $this->id; ?>-3 .ytchg-desc').is(':checked')){
206
+ $('#tabs-<?php echo $this->id; ?>-3 .ytchg-title-and-description').show();
207
+ $('#tabs-<?php echo $this->id; ?>-3 fieldset.ytchg-field-tit-desc').addClass('ytchg-fieldborder active');
208
} else{
209
+ $('#tabs-<?php echo $this->id; ?>-3 .ytchg-title-and-description').hide();
210
211
}
212
}
213
214
215
+ //Feed label title
216
+ //---------------
217
+ var feedselect = '#<?php echo $this->get_field_id( 'ytchag_feed' ); ?>';
218
+ var userLabel = 'label[for="<?php echo $this->get_field_id( 'ytchag_user' ); ?>"]';
219
+
220
+ changeFeedTitle ();
221
+ $(feedselect).change(function () {
222
+ changeFeedTitle ();
223
+ });
224
+
225
+ function changeFeedTitle (){
226
+ if($(feedselect + ' option:selected').val() == 'user'){
227
+ $(userLabel).text('<?php _e( 'YouTube user id:', 'youtube-channel-gallery' ); ?>');
228
+ }
229
+ if($(feedselect + ' option:selected').val() == 'userfav'){
230
+ $(userLabel).text('<?php _e( 'YouTube user id:', 'youtube-channel-gallery' ); ?>');
231
+ }
232
+ if($(feedselect + ' option:selected').val() == 'playlist'){
233
+ $(userLabel).text('<?php _e( 'YouTube playlist id:', 'youtube-channel-gallery' ); ?>');
234
+ }
235
+ }
236
});
237
</script>
238
243
244
245
<ul class="ytchgtabs-tabs">
246
+ <li><a href="#tabs-<?php echo $this->id; ?>-1"><?php _e( 'Feed', 'youtube-channel-gallery' ); ?></a></li>
247
+ <li><a href="#tabs-<?php echo $this->id; ?>-2"><?php _e( 'Player', 'youtube-channel-gallery' ); ?></a></li>
248
+ <li><a href="#tabs-<?php echo $this->id; ?>-3"><?php _e( 'Thumbnails', 'youtube-channel-gallery' ); ?></a></li>
249
+ <li><a href="#tabs-<?php echo $this->id; ?>-4"><?php _e( 'Link', 'youtube-channel-gallery' ); ?></a></li>
250
</ul>
251
252
253
<?php
254
/*
255
+ Feed Tab
256
--------------------
257
*/
258
?>
259
<div id="tabs-<?php echo $this->id; ?>-1" class="ytchgtabs-content">
260
261
+ <p>
262
+ <label for="ytchag_feed"><?php _e( 'Video feed type:', 'youtube-channel-gallery' ); ?></label>
263
+ <select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_feed' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_feed' ); ?>">
264
+ <option value="user"<?php selected( $instance['ytchag_feed'], 'user' ); ?>><?php _e( 'Uploaded by a user', 'youtube-channel-gallery' ); ?></option>
265
+ <?php /*<option value="favorites"<?php selected( $instance['ytchag_feed'], 'favorites' ); ?>><?php _e( 'User\'s favorites', 'youtube-channel-gallery' ); ?></option>*/?>
266
+ <option value="playlist"<?php selected( $instance['ytchag_feed'], 'playlist' ); ?>><?php _e( 'Playlist', 'youtube-channel-gallery' ); ?></option>
267
+ </select>
268
+ </p>
269
+
270
+ <p>
271
+ <label for="<?php echo $this->get_field_id( 'ytchag_user' ); ?>"><?php _e( 'YouTube user id:', 'youtube-channel-gallery' ); ?></label>
272
+ <input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_user' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_user' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_user ); ?>" />
273
+ </p>
274
+
275
+ </div>
276
+
277
+
278
+ <?php
279
+ /*
280
+ Player Tab
281
+ --------------------
282
+ */
283
+ ?>
284
+ <div id="tabs-<?php echo $this->id; ?>-2" class="ytchgtabs-content">
285
+
286
<p>
287
<label for="ytchag_video_width"><?php _e( 'Video width:', 'youtube-channel-gallery' ); ?></label>
288
<input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_video_width' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_video_width' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_video_width ); ?>" />
289
</p>
290
291
<p>
292
<label for="ytchag_ratio"><?php _e( 'Aspect ratio:', 'youtube-channel-gallery' ); ?></label>
293
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_ratio' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_ratio' ); ?>">
294
<option value="4x3"<?php selected( $instance['ytchag_ratio'], '4x3' ); ?>><?php _e( 'Standard (4x3)', 'youtube-channel-gallery' ); ?></option>
297
</p>
298
299
<p>
300
<label for="ytchag_theme"><?php _e( 'Theme:', 'youtube-channel-gallery' ); ?></label>
301
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_theme' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_theme' ); ?>">
302
<option value="dark"<?php selected( $instance['ytchag_theme'], 'dark' ); ?>><?php _e( 'Dark', 'youtube-channel-gallery' ); ?></option>
305
</p>
306
307
<p>
308
<label for="ytchag_color"><?php _e( 'Progress bar color:', 'youtube-channel-gallery' ); ?></label>
309
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_color' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_color' ); ?>">
310
<option value="red"<?php selected( $instance['ytchag_color'], 'red' ); ?>><?php _e( 'Red', 'youtube-channel-gallery' ); ?></option>
311
<option value="white"<?php selected( $instance['ytchag_color'], 'white' ); ?>><?php _e( 'White', 'youtube-channel-gallery' ); ?></option>
312
</select>
313
</p>
314
+
315
+ <p>
316
+ <label for="ytchag_quality"><?php _e( 'Video quality:', 'youtube-channel-gallery' ); ?></label>
317
+ <select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_quality' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_quality' ); ?>">
318
+ <option value="default"<?php selected( $instance['ytchag_quality'], 'default' ); ?>><?php _e( 'default', 'youtube-channel-gallery' ); ?></option>
319
+ <option value="highres"<?php selected( $instance['ytchag_quality'], 'highres' ); ?>><?php _e( 'highres', 'youtube-channel-gallery' ); ?></option>
320
+ <option value="hd1080"<?php selected( $instance['ytchag_quality'], 'hd1080' ); ?>><?php _e( 'hd1080', 'youtube-channel-gallery' ); ?></option>
321
+ <option value="hd720"<?php selected( $instance['ytchag_quality'], 'hd720' ); ?>><?php _e( 'hd720', 'youtube-channel-gallery' ); ?></option>
322
+ <option value="large"<?php selected( $instance['ytchag_quality'], 'large' ); ?>><?php _e( 'large', 'youtube-channel-gallery' ); ?></option>
323
+ <option value="medium"<?php selected( $instance['ytchag_quality'], 'medium' ); ?>><?php _e( 'medium', 'youtube-channel-gallery' ); ?></option>
324
+ <option value="small"<?php selected( $instance['ytchag_quality'], 'small' ); ?>><?php _e( 'small', 'youtube-channel-gallery' ); ?></option>
325
+ </select>
326
+ </p>
327
328
<input class="checkbox" type="checkbox" <?php checked( (bool) $instance['ytchag_autoplay'], true ); ?> id="<?php echo $this->get_field_id( 'ytchag_autoplay' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_autoplay' ); ?>" />
329
<label for="<?php echo $this->get_field_id( 'ytchag_autoplay' ); ?>"><?php _e('Autoplay', 'youtube-channel-gallery'); ?></label>
347
--------------------
348
*/
349
?>
350
+ <div id="tabs-<?php echo $this->id; ?>-3">
351
<p>
352
<label for="ytchag_maxitems"><?php _e( 'Number of videos to show:', 'youtube-channel-gallery' ); ?></label>
353
<input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_maxitems' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_maxitems' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_maxitems ); ?>" />
419
--------------------
420
*/
421
?>
422
+ <div id="tabs-<?php echo $this->id; ?>-4">
423
424
<p>
425
<label for="ytchag_link_tx"><?php _e( 'Link text:', 'youtube-channel-gallery' ); ?></label>
428
429
<p>
430
<input class="checkbox" type="checkbox" <?php checked( (bool) $instance['ytchag_link'], true ); ?> id="<?php echo $this->get_field_id( 'ytchag_link' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_link' ); ?>" />
431
+ <label for="<?php echo $this->get_field_id( 'ytchag_link' ); ?>"><?php _e('Show link to channel', 'youtube-channel-gallery'); ?></label>
432
+
433
+ </br>
434
+
435
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['ytchag_link_window'], true ); ?> id="<?php echo $this->get_field_id( 'ytchag_link_window' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_link_window' ); ?>" />
436
+ <label for="<?php echo $this->get_field_id( 'ytchag_link_window' ); ?>"><?php _e('Open in a new window or tab', 'youtube-channel-gallery'); ?></label>
437
</p>
438
439
</div>
454
455
//$instance variables
456
//--------------------------------
457
+
458
+ // Feed options
459
+ $ytchag_feed = apply_filters('ytchag_feed', $instance['ytchag_feed']);
460
$ytchag_user = apply_filters('ytchag_user', $instance['ytchag_user']);
461
462
// Player options
464
$ytchag_ratio = apply_filters('ytchag_ratio', $instance['ytchag_ratio']);
465
$ytchag_theme = apply_filters('ytchag_theme', $instance['ytchag_theme']);
466
$ytchag_color = apply_filters('ytchag_color', $instance['ytchag_color']);
467
+ $ytchag_quality = apply_filters('ytchag_quality', $instance['ytchag_quality']);
468
$ytchag_autoplay = apply_filters('ytchag_autoplay', $instance['ytchag_autoplay']);
469
$ytchag_rel = apply_filters('ytchag_rel', $instance['ytchag_rel']);
470
$ytchag_showinfo = apply_filters('ytchag_showinfo', $instance['ytchag_showinfo']);
482
// Link options
483
$ytchag_link = apply_filters('ytchag_link', $instance['ytchag_link']);
484
$ytchag_link_tx = apply_filters('ytchag_link_tx', $instance['ytchag_link_tx']);
485
+ $ytchag_link_window = apply_filters('ytchag_link_window', $instance['ytchag_link_window']);
486
//--------------------------------
487
//end $instance variables
488
489
490
//defaults
491
//--------------------------------
492
+
493
+ // Feed options
494
+ $ytchag_feed = ( $ytchag_feed ) ? $ytchag_feed : 'user'; //default user
495
+
496
// Player options
497
$ytchag_video_width = ( $ytchag_video_width ) ? $ytchag_video_width : 250;
498
+ $ytchag_theme = ( $ytchag_theme ) ? '&theme='. $ytchag_theme : ''; //default dark
499
+ $ytchag_color = ( $ytchag_color ) ? '&color='. $ytchag_color : ''; //default red
500
+ $ytchag_quality = ( $ytchag_quality ) ? $ytchag_quality : 'default'; //default default
501
+ $ytchag_autoplay = ( $ytchag_autoplay ) ? '&autoplay='. $ytchag_autoplay : ''; //default 0
502
+ $ytchag_rel = ( $ytchag_rel ) ? '&rel='. $ytchag_rel : '&rel=0'; //default 1
503
+ $ytchag_showinfo = ( $ytchag_showinfo ) ? '&showinfo='. $ytchag_showinfo : '&showinfo=0'; //default 1
504
505
// Thumbnail options
506
$ytchag_thumb_width = ( $ytchag_thumb_width ) ? $ytchag_thumb_width : 85;
507
+ $ytchag_thumb_columns = (( $ytchag_thumb_columns ) || ( $ytchag_thumb_columns != 0 )) ? $ytchag_thumb_columns : 0;
508
509
//title and desc
510
$ytchag_title = ( $ytchag_title ) ? $ytchag_title : 0;
515
// Link options
516
$ytchag_link = ( $ytchag_link ) ? $ytchag_link : 0;
517
$ytchag_link_tx = ( $ytchag_link_tx ) ? $ytchag_link_tx : __('Show more videos»', 'youtube-channel-gallery');
518
+ $ytchag_link_window = ( $ytchag_link_window ) ? 'target="_blank"' : 0;
519
//--------------------------------
520
//end defaults
521
540
// only if user name inserted
541
if( $ytchag_user ) {
542
543
+
544
+ // YouTube feed types
545
+ //--------------------------------
546
+ $youtube_feed_url = 'http://gdata.youtube.com/feeds/api';
547
// links
548
+ if($ytchag_feed == 'user'){
549
+ $ytchag_rss_url = $youtube_feed_url . '/users/' . $ytchag_user . '/uploads';
550
+ $ytchag_link_url = 'http://www.youtube.com/user/' . $ytchag_user;
551
+ $errorMesagge = __('You must insert a valid YouTube user id.', 'youtube-channel-gallery');
552
+ }
553
+ if($ytchag_feed == 'favorites'){
554
+ $ytchag_rss_url = $youtube_feed_url . '/users/' . $ytchag_user . '/favorites';
555
+ $ytchag_link_url = 'http://www.youtube.com/user/' . $ytchag_user . '/favorites';
556
+ $errorMesagge = __('You must insert a valid YouTube user id.', 'youtube-channel-gallery');
557
+ }
558
+ if($ytchag_feed == 'playlist'){
559
+ $ytchag_rss_url = $youtube_feed_url . '/playlists/' . $ytchag_user . '?alt=rss&v=2&orderby=published&rel=0';
560
+ $ytchag_link_url = 'http://www.youtube.com/playlist?list=' . $ytchag_user;
561
+ $errorMesagge = __('You must insert a valid playlist id.', 'youtube-channel-gallery');
562
+ }
563
564
//RSS Feed
565
include_once(ABSPATH . WPINC . '/feed.php');
606
607
608
//title and description content
609
+
610
if($ytchag_title || $ytchag_description){
611
$title_and_description_alignment_class = ' ytc-td-' . $ytchag_thumbnail_alignment;
612
$title_and_description_content= '<div class="ytctitledesc-cont">';
621
}
622
623
$title_and_description_content.= '</div>';
624
+ } else{
625
+ $title_and_description_alignment_class = '';
626
+ $title_and_description_content = '';
627
+ }
628
+ //end title and description content
629
630
631
//rows and columns control
632
633
$column++;
634
+ $columnlastfirst = $tableclass = $columnnumber = '';
635
+ if($ytchag_thumb_columns !=0 && $column == 1){
636
$columnlastfirst = ' ytccell-first';
637
STATIC $rowcount = 0;
638
$rowcount++;
640
$tableclass = ' ytc-table';
641
$columnnumber = ' ytc-columns'. $ytchag_thumb_columns;
642
643
+ }
644
+ if($ytchag_thumb_columns !=0 && $column%$ytchag_thumb_columns == 0){
645
+ $columnlastfirst = ' ytccell-last';
646
}// end columns control
647
648
663
$i++;
664
665
666
+ //----
667
+ if($ytchag_thumb_columns !=0 && $column == 1){
668
$content.= "\n\n" .'<div class="ytccf ytc-row ytc-r-' . $rowcount . $row_oddeven . ' ">' . "\n\n";
669
}
670
671
+ //$content.= '$column: ' + $column;
672
+ $content.= "\n\n" . ' <li class="ytccell-' . $column . $columnlastfirst . '">';
673
674
+ $content.= '<div class="ytcliinner">';
675
676
+ if($ytchag_thumbnail_alignment == 'bottom'){
677
+ $content.= $title_and_description_content;
678
679
+ }
680
681
+ $content.= '<div class="ytcthumb-cont">';
682
+ $content.= '<a class="ytcthumb" href="http://youtu.be/' . $youtubeid . '" data-playerid="ytcplayer' . $plugincount . '" data-quality="' . $ytchag_quality . '" alt="' . $title . '" title="' . $title . '" style="background-image: url(' . $thumb . ');">';
683
+ $content.= '<div class="ytcplay" style="width: ' . $ytchag_thumb_width . 'px; height: ' . $ytchag_thumb_height . 'px"></div>';
684
+ $content.= '</a>';
685
+ $content.= '</div>';
686
687
+ if($ytchag_thumbnail_alignment != 'bottom'){
688
+ $content.= $title_and_description_content;
689
+ }
690
691
+ $content.= '</div>';
692
693
+ $content.= '</li>' . "\n\n";
694
695
+ //----
696
+ if($ytchag_thumb_columns !=0 && $column%$ytchag_thumb_columns == 0 ){
697
+ $column = 0;
698
+ $columnlastfirst = ' ytccell-last';
699
+ $content.= '</div>' . "\n\n\n";
700
}
701
702
} //foreach end
710
711
//link to youtube.com gallery
712
if( $ytchag_link) {
713
+ $content.= '<a href="' . $ytchag_link_url . '" class="ytcmore" ' .$ytchag_link_window. ' >' . $ytchag_link_tx . '</a>';
714
}
715
}
716
} else {
717
+ $content= '<p class="empty">' . $errorMesagge . '</p>';
718
} // end check user name
719
720
// user name not inserted
759
extract( shortcode_atts( array(
760
'user' => '',
761
762
+ // Feed options
763
+ 'feed' => '',
764
+
765
// Player options
766
'videowidth' => '',
767
'ratio' => '',
768
'theme' => '',
769
'color' => '',
770
+ 'quality' => '',
771
'autoplay' => '',
772
'rel' => '',
773
'showinfo' => '',
784
785
// Link options
786
'link' => '',
787
+ 'link_tx' => '',
788
+ 'link_window' => ''
789
790
), $atts ) );
791
792
+ // Feed options
793
+ $instance['ytchag_feed'] = $feed;
794
$instance['ytchag_user'] = $user;
795
796
// Player options
798
$instance['ytchag_ratio'] = $ratio;
799
$instance['ytchag_theme'] = $theme;
800
$instance['ytchag_color'] = $color;
801
+ $instance['ytchag_quality'] = $quality;
802
$instance['ytchag_autoplay'] = $autoplay;
803
$instance['ytchag_rel'] = $rel;
804
$instance['ytchag_showinfo'] = $showinfo;
816
// Link options
817
$instance['ytchag_link'] = $link;
818
$instance['ytchag_link_tx'] = $link_tx;
819
+ $instance['ytchag_link_window'] = $link_window;
820
821
822
return '<div class="ytcshort">'. $this->ytchag_rss_markup($instance) . '</div>';