Youtube Channel Gallery - Version 1.7.5.1

Version Description

  • Fixed order of playlists videos, now by ascending and descending position.
  • Added control to select playlist order.
  • Fixed for attributes of some wigdet labels.
Download this release

Release Info

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

Code changes from version 1.7.5 to 1.7.5.1

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-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,209 +31,221 @@ 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: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
7
msgstr ""
8
"Project-Id-Version: youtube-channel-gallery\n"
9
"Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2013-01-08 16:50+0100\n"
11
+ "PO-Revision-Date: 2013-01-08 16:51+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:155
35
msgid "Title:"
36
msgstr "Título:"
37
38
+ #: youtube-channel-gallery.php:263
39
+ #: youtube-channel-gallery.php:267
40
+ #: youtube-channel-gallery.php:307
41
msgid "YouTube user id:"
42
msgstr "Id de usuario de Youtube:"
43
44
+ #: youtube-channel-gallery.php:270
45
msgid "YouTube playlist id:"
46
msgstr "Id de lista de reproducción de YouTube:"
47
48
+ #: youtube-channel-gallery.php:282
49
msgid "Feed"
50
msgstr "Feed"
51
52
+ #: youtube-channel-gallery.php:283
53
msgid "Player"
54
msgstr "Reproductor"
55
56
+ #: youtube-channel-gallery.php:284
57
msgid "Thumbnails"
58
msgstr "Miniaturas"
59
60
+ #: youtube-channel-gallery.php:285
61
msgid "Link"
62
msgstr "Enlace"
63
64
+ #: youtube-channel-gallery.php:298
65
msgid "Video feed type:"
66
msgstr "Tipo de feed de vídeo:"
67
68
+ #: youtube-channel-gallery.php:300
69
msgid "Uploaded by a user"
70
msgstr "Subidos por el usuario"
71
72
+ #: youtube-channel-gallery.php:302
73
msgid "Playlist"
74
msgstr "Lista de reproducción"
75
76
+ #: youtube-channel-gallery.php:312
77
+ msgid "Playlist order:"
78
+ msgstr "Orden de lista de reproducción:"
79
+
80
+ #: youtube-channel-gallery.php:314
81
+ msgid "Ascending Order"
82
+ msgstr "Ascendente"
83
+
84
+ #: youtube-channel-gallery.php:315
85
+ msgid "Descending Order"
86
+ msgstr "Descendente"
87
+
88
+ #: youtube-channel-gallery.php:331
89
msgid "Video width:"
90
msgstr "Ancho del vídeo:"
91
92
+ #: youtube-channel-gallery.php:336
93
+ #: youtube-channel-gallery.php:407
94
msgid "Aspect ratio:"
95
msgstr "Relación de aspecto:"
96
97
+ #: youtube-channel-gallery.php:338
98
+ #: youtube-channel-gallery.php:409
99
msgid "Standard (4x3)"
100
msgstr "Estándar (4x3)"
101
102
+ #: youtube-channel-gallery.php:339
103
+ #: youtube-channel-gallery.php:410
104
msgid "Widescreen (16x9)"
105
msgstr "Panorámico (16x9)"
106
107
+ #: youtube-channel-gallery.php:344
108
msgid "Theme:"
109
msgstr "Tema:"
110
111
+ #: youtube-channel-gallery.php:346
112
msgid "Dark"
113
msgstr "Oscuro"
114
115
+ #: youtube-channel-gallery.php:347
116
msgid "Light"
117
msgstr "Claro"
118
119
+ #: youtube-channel-gallery.php:352
120
msgid "Progress bar color:"
121
msgstr "Color de barra de progreso:"
122
123
+ #: youtube-channel-gallery.php:354
124
msgid "Red"
125
msgstr "Rojo"
126
127
+ #: youtube-channel-gallery.php:355
128
msgid "White"
129
msgstr "Blanco"
130
131
+ #: youtube-channel-gallery.php:360
132
msgid "Video quality:"
133
msgstr "Calidad del vídeo:"
134
135
+ #: youtube-channel-gallery.php:362
136
msgid "default"
137
msgstr "por defecto"
138
139
+ #: youtube-channel-gallery.php:363
140
msgid "highres"
141
msgstr "alta resolución"
142
143
+ #: youtube-channel-gallery.php:364
144
msgid "hd1080"
145
msgstr "hd1080"
146
147
+ #: youtube-channel-gallery.php:365
148
msgid "hd720"
149
msgstr "hd720"
150
151
+ #: youtube-channel-gallery.php:366
152
msgid "large"
153
msgstr "largo"
154
155
+ #: youtube-channel-gallery.php:367
156
msgid "medium"
157
msgstr "mediano"
158
159
+ #: youtube-channel-gallery.php:368
160
msgid "small"
161
msgstr "pequeño"
162
163
+ #: youtube-channel-gallery.php:373
164
msgid "Autoplay"
165
msgstr "Autoplay"
166
167
+ #: youtube-channel-gallery.php:378
168
msgid "Show related videos"
169
msgstr "Mostrar los vídeos relacionados"
170
171
+ #: youtube-channel-gallery.php:383
172
msgid "Show info (title, uploader)"
173
msgstr "Mostrar información (título, cargador)"
174
175
+ #: youtube-channel-gallery.php:396
176
msgid "Number of videos to show:"
177
msgstr "Número de vídeos a mostrar:"
178
179
+ #: youtube-channel-gallery.php:401
180
msgid "Thumbnail width:"
181
msgstr "Ancho de miniaturas:"
182
183
+ #: youtube-channel-gallery.php:415
184
msgid "Thumbnail columns:"
185
msgstr "Columnas de las miniaturas:"
186
187
+ #: youtube-channel-gallery.php:422
188
msgid "Show title or description"
189
msgstr "Mostrar título y descripción"
190
191
+ #: youtube-channel-gallery.php:429
192
msgid "Show title"
193
msgstr "Mostrar Título"
194
195
+ #: youtube-channel-gallery.php:434
196
msgid "Show description"
197
msgstr "Mostrar descripción"
198
199
+ #: youtube-channel-gallery.php:438
200
msgid "Thumbnail alignment:"
201
msgstr "Alineación de miniaturas:"
202
203
+ #: youtube-channel-gallery.php:440
204
msgid "Left"
205
msgstr "Izquierda"
206
207
+ #: youtube-channel-gallery.php:441
208
msgid "Right"
209
msgstr "Derecha"
210
211
+ #: youtube-channel-gallery.php:442
212
msgid "Top"
213
msgstr "Arriba"
214
215
+ #: youtube-channel-gallery.php:443
216
msgid "Bottom"
217
msgstr "Abajo"
218
219
+ #: youtube-channel-gallery.php:448
220
msgid "Description words number:"
221
msgstr "Número de palabras en la descripción:"
222
223
+ #: youtube-channel-gallery.php:469
224
msgid "Link text:"
225
msgstr "Texto del enlace"
226
227
+ #: youtube-channel-gallery.php:475
228
msgid "Show link to channel"
229
msgstr "Mostrar enlace al canal"
230
231
+ #: youtube-channel-gallery.php:480
232
msgid "Open in a new window or tab"
233
msgstr "Abri en una ventana nueva o pestaña"
234
235
+ #: youtube-channel-gallery.php:564
236
msgid "Show more videos»"
237
msgstr "Ver más vídeos»"
238
239
+ #: youtube-channel-gallery.php:598
240
+ #: youtube-channel-gallery.php:603
241
msgid "You must insert a valid YouTube user id."
242
msgstr "Debes introducir un id válido de usuario de YouTube."
243
244
+ #: youtube-channel-gallery.php:609
245
msgid "You must insert a valid playlist id."
246
msgstr "Debes introducir un id válido de lista de reproducción de YouTube."
247
248
+ #: youtube-channel-gallery.php:819
249
msgid "There is no video to show."
250
msgstr "No hay ningún vídeo para mostrar."
251
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.7.5
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -41,8 +41,9 @@ Description of the different fields of the plugin:
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
@@ -76,7 +77,7 @@ Description of the different fields of the plugin:
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: =
@@ -106,6 +107,10 @@ The username who uploaded a video to Youtube is located below each video, where
106
107
If you go to a playlist you will get the following url format: https://www.youtube.com/playlist?list=PL33942589618ABDE3. The playlist id is what you have after list=. In this example, the playlist id is PL33942589618ABDE3.
108
109
110
== Screenshots ==
111
@@ -118,6 +123,12 @@ If you go to a playlist you will get the following url format: https://www.youtu
118
119
== Changelog ==
120
121
= 1.7.5 =
122
* Corrected order of playlists videos.
123
* Enqueue of admin style only in widget page.
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.5.1
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
41
42
**Feed tab:**
43
44
* **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).
45
+ * **YouTube user id/YouTube playlist id:** 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).
46
+ * **Playlist order:** this option appears if you selected playlist as Video feed type. You can show videos in a playlist by ascending or descending order. Shortcode attribute: feedorder; value: asc (default) or desc. (Optional).
47
48
**Player tab:**
49
77
= Shortcode syntax: =
78
In the following example are all attributes that can be used with the shortcode and explained above:
79
80
+ `[Youtube_Channel_Gallery feed="user" user="MaxonC4D" feedorder="desc" 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"]`
81
82
83
= Languages: =
107
108
If you go to a playlist you will get the following url format: https://www.youtube.com/playlist?list=PL33942589618ABDE3. The playlist id is what you have after list=. In this example, the playlist id is PL33942589618ABDE3.
109
110
+ = I selected showing my playlist in descending order but the latest videos are not displayed, why? =
111
+
112
+ This will happen if your playlist has more than 1000 videos because YouTube API has this limit.
113
+
114
115
== Screenshots ==
116
123
124
== Changelog ==
125
126
+ = 1.7.5.1 =
127
+ * Fixed order of playlists videos, now by ascending and descending position.
128
+ * Added control to select playlist order.
129
+ * Fixed for attributes of some wigdet labels.
130
+
131
+
132
= 1.7.5 =
133
* Corrected order of playlists videos.
134
* Enqueue of admin style only in widget page.
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.7.5
9
License: GPL2
10
11
Copyright 2013 Javier Gómez Pose (email : javierpose@gmail.com)
@@ -81,6 +81,7 @@
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
86
$instance['ytchag_video_width'] = strip_tags( $new_instance['ytchag_video_width'] );
@@ -119,6 +120,8 @@
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'] ) : '';
@@ -246,23 +249,26 @@
246
247
//Feed label title
248
//---------------
249
- var feedselect = '#<?php echo $this->get_field_id( 'ytchag_feed' ); ?>';
250
var userLabel = 'label[for="<?php echo $this->get_field_id( 'ytchag_user' ); ?>"]';
251
252
- changeFeedTitle ();
253
- $(feedselect).change(function () {
254
- changeFeedTitle ();
255
});
256
257
- function changeFeedTitle (){
258
- if($(feedselect + ' option:selected').val() === 'user'){
259
- $(userLabel).text('<?php _e( 'YouTube user id:', 'youtube-channel-gallery' ); ?>');
260
}
261
- if($(feedselect + ' option:selected').val() === 'userfav'){
262
$(userLabel).text('<?php _e( 'YouTube user id:', 'youtube-channel-gallery' ); ?>');
263
- }
264
- if($(feedselect + ' option:selected').val() == 'playlist'){
265
- $(userLabel).text('<?php _e( 'YouTube playlist id:', 'youtube-channel-gallery' ); ?>');
266
}
267
}
268
});
@@ -289,7 +295,7 @@
289
<div id="tabs-<?php echo $this->id; ?>-1" class="ytchgtabs-content">
290
291
<p>
292
- <label for="ytchag_feed"><?php _e( 'Video feed type:', 'youtube-channel-gallery' ); ?></label>
293
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_feed' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_feed' ); ?>">
294
<option value="user"<?php selected( $instance['ytchag_feed'], 'user' ); ?>><?php _e( 'Uploaded by a user', 'youtube-channel-gallery' ); ?></option>
295
<?php /*<option value="favorites"<?php selected( $instance['ytchag_feed'], 'favorites' ); ?>><?php _e( 'User\'s favorites', 'youtube-channel-gallery' ); ?></option>*/?>
@@ -302,6 +308,14 @@
302
<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 ); ?>" />
303
</p>
304
305
</div>
306
307
@@ -314,12 +328,12 @@
314
<div id="tabs-<?php echo $this->id; ?>-2" class="ytchgtabs-content">
315
316
<p>
317
- <label for="ytchag_video_width"><?php _e( 'Video width:', 'youtube-channel-gallery' ); ?></label>
318
<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 ); ?>" />
319
</p>
320
321
<p>
322
- <label for="ytchag_ratio"><?php _e( 'Aspect ratio:', 'youtube-channel-gallery' ); ?></label>
323
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_ratio' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_ratio' ); ?>">
324
<option value="4x3"<?php selected( $instance['ytchag_ratio'], '4x3' ); ?>><?php _e( 'Standard (4x3)', 'youtube-channel-gallery' ); ?></option>
325
<option value="16x9"<?php selected( $instance['ytchag_ratio'], '16x9' ); ?>><?php _e( 'Widescreen (16x9)', 'youtube-channel-gallery' ); ?></option>
@@ -327,7 +341,7 @@
327
</p>
328
329
<p>
330
- <label for="ytchag_theme"><?php _e( 'Theme:', 'youtube-channel-gallery' ); ?></label>
331
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_theme' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_theme' ); ?>">
332
<option value="dark"<?php selected( $instance['ytchag_theme'], 'dark' ); ?>><?php _e( 'Dark', 'youtube-channel-gallery' ); ?></option>
333
<option value="light"<?php selected( $instance['ytchag_theme'], 'light' ); ?>><?php _e( 'Light', 'youtube-channel-gallery' ); ?></option>
@@ -335,7 +349,7 @@
335
</p>
336
337
<p>
338
- <label for="ytchag_color"><?php _e( 'Progress bar color:', 'youtube-channel-gallery' ); ?></label>
339
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_color' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_color' ); ?>">
340
<option value="red"<?php selected( $instance['ytchag_color'], 'red' ); ?>><?php _e( 'Red', 'youtube-channel-gallery' ); ?></option>
341
<option value="white"<?php selected( $instance['ytchag_color'], 'white' ); ?>><?php _e( 'White', 'youtube-channel-gallery' ); ?></option>
@@ -343,7 +357,7 @@
343
</p>
344
345
<p>
346
- <label for="ytchag_quality"><?php _e( 'Video quality:', 'youtube-channel-gallery' ); ?></label>
347
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_quality' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_quality' ); ?>">
348
<option value="default"<?php selected( $instance['ytchag_quality'], 'default' ); ?>><?php _e( 'default', 'youtube-channel-gallery' ); ?></option>
349
<option value="highres"<?php selected( $instance['ytchag_quality'], 'highres' ); ?>><?php _e( 'highres', 'youtube-channel-gallery' ); ?></option>
@@ -379,18 +393,18 @@
379
?>
380
<div id="tabs-<?php echo $this->id; ?>-3">
381
<p>
382
- <label for="ytchag_maxitems"><?php _e( 'Number of videos to show:', 'youtube-channel-gallery' ); ?></label>
383
<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 ); ?>" />
384
</p>
385
386
<p>
387
- <label for="ytchag_thumb_width"><?php _e( 'Thumbnail width:', 'youtube-channel-gallery' ); ?></label>
388
<input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_thumb_width' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_thumb_width' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_thumb_width ); ?>" />
389
</p>
390
391
<p>
392
393
- <label for="ytchag_thumb_ratio"><?php _e( 'Aspect ratio:', 'youtube-channel-gallery' ); ?></label>
394
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_thumb_ratio' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_thumb_ratio' ); ?>">
395
<option value="4x3"<?php selected( $instance['ytchag_thumb_ratio'], '4x3' ); ?>><?php _e( 'Standard (4x3)', 'youtube-channel-gallery' ); ?></option>
396
<option value="16x9"<?php selected( $instance['ytchag_thumb_ratio'], '16x9' ); ?>><?php _e( 'Widescreen (16x9)', 'youtube-channel-gallery' ); ?></option>
@@ -398,7 +412,7 @@
398
</p>
399
400
<p>
401
- <label for="ytchag_thumb_columns"><?php _e( 'Thumbnail columns:', 'youtube-channel-gallery' ); ?></label>
402
<input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_thumb_columns' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_thumb_columns' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_thumb_columns ); ?>" />
403
</p>
404
@@ -421,7 +435,7 @@
421
</p>
422
423
<p>
424
- <label for="ytchag_thumbnail_alignment"><?php _e( 'Thumbnail alignment:', 'youtube-channel-gallery' ); ?></label>
425
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_thumbnail_alignment' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_thumbnail_alignment' ); ?>">
426
<option value="left"<?php selected( $instance['ytchag_thumbnail_alignment'], 'left' ); ?>><?php _e( 'Left', 'youtube-channel-gallery' ); ?></option>
427
<option value="right"<?php selected( $instance['ytchag_thumbnail_alignment'], 'right' ); ?>><?php _e( 'Right', 'youtube-channel-gallery' ); ?></option>
@@ -431,7 +445,7 @@
431
</p>
432
433
<p>
434
- <label for="ytchag_description_words_number"><?php _e( 'Description words number:', 'youtube-channel-gallery' ); ?></label>
435
<input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_description_words_number' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_description_words_number' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_description_words_number ); ?>" />
436
</p>
437
</div>
@@ -452,7 +466,7 @@
452
<div id="tabs-<?php echo $this->id; ?>-4">
453
454
<p>
455
- <label for="ytchag_link_tx"><?php _e( 'Link text:', 'youtube-channel-gallery' ); ?></label>
456
<input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_link_tx' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_link_tx' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_link_tx ); ?>" />
457
</p>
458
@@ -488,6 +502,7 @@
488
// Feed options
489
$ytchag_feed = apply_filters('ytchag_feed', $instance['ytchag_feed']);
490
$ytchag_user = apply_filters('ytchag_user', $instance['ytchag_user']);
491
492
// Player options
493
$ytchag_video_width = apply_filters('ytchag_video_width', $instance['ytchag_video_width']);
@@ -522,6 +537,7 @@
522
523
// Feed options
524
$ytchag_feed = ( $ytchag_feed ) ? $ytchag_feed : 'user'; //default user
525
526
// Player options
527
$ytchag_video_width = ( $ytchag_video_width ) ? $ytchag_video_width : 250;
@@ -533,6 +549,7 @@
533
$ytchag_showinfo = ( $ytchag_showinfo ) ? '&showinfo='. $ytchag_showinfo : '&showinfo=0'; //default 1
534
535
// Thumbnail options
536
$ytchag_thumb_width = ( $ytchag_thumb_width ) ? $ytchag_thumb_width : 85;
537
$ytchag_thumb_columns = (( $ytchag_thumb_columns ) || ( $ytchag_thumb_columns != 0 )) ? $ytchag_thumb_columns : 0;
538
@@ -586,7 +603,7 @@
586
$errorMesagge = __('You must insert a valid YouTube user id.', 'youtube-channel-gallery');
587
}
588
if($ytchag_feed == 'playlist'){
589
- $ytchag_rss_url = $youtube_feed_url . '/playlists/' . $ytchag_user . '?alt=atom&v=2&orderby=published&prettyprint=true';
590
//print_r($ytchag_rss_url . '<br>');
591
$ytchag_link_url = 'http://www.youtube.com/playlist?list=' . $ytchag_user;
592
$errorMesagge = __('You must insert a valid playlist id.', 'youtube-channel-gallery');
@@ -596,33 +613,42 @@
596
include_once(ABSPATH . WPINC . '/feed.php');
597
598
$rss = fetch_feed($ytchag_rss_url);
599
600
// check if no correct user name
601
if (!is_wp_error( $rss ) ) {
602
603
- //items requested by the user
604
- $maxitems = ( $ytchag_maxitems ) ? $ytchag_maxitems : 9;
605
-
606
//get totalResultsData from playlist rss to order correctly videos
607
- if($ytchag_feed == 'playlist'){
608
//openSearch:totalResults
609
$totalResults = $rss->get_feed_tags('http://a9.com/-/spec/opensearch/1.1/', 'totalResults');
610
$totalResultsData = $totalResults[0]['data'];
611
- //print_r($totalResultsData . '<br>');
612
613
//get rss playlist again with the last videos. YouTube does not load in the first request, even if the orderby parameter is set.
614
- $startindex = $totalResultsData - $maxitems + 1;
615
- //print_r($startindex . '<br>');
616
- $ytchag_rss_url = $ytchag_rss_url . '&start-index=' . $startindex . '&max-results=' . $maxitems;
617
$rss = fetch_feed($ytchag_rss_url);
618
619
//to get the appropriate order of items
620
- $rss->enable_order_by_date(false);
621
//print_r($ytchag_rss_url . '<br>');
622
}
623
624
- $items = $rss->get_items(0, $maxitems);
625
-
626
627
if (!empty($items)) {
628
$i = 0;
@@ -645,14 +671,15 @@
645
$media_group = $item->get_item_tags('http://search.yahoo.com/mrss/', 'group');
646
$media_content = $media_group[0]['child']['http://search.yahoo.com/mrss/']['thumbnail'];
647
648
- /* to check order
649
$episode = $item->get_item_tags('http://gdata.youtube.com/schemas/2007', 'episode'); //yt
650
$episodecontent = $episode[0]['attribs']['']['number'];
651
if(!$episode){
652
$episode = $item->get_item_tags('http://gdata.youtube.com/schemas/2007', 'position'); //yt
653
$episodecontent = $episode[0]['data'];
654
}
655
- print_r($episodecontent . '-');
656
*/
657
658
//Check the thumbnail width
@@ -842,6 +869,7 @@
842
843
// Feed options
844
'feed' => '',
845
846
// Player options
847
'videowidth' => '',
@@ -873,6 +901,7 @@
873
// Feed options
874
$instance['ytchag_feed'] = $feed;
875
$instance['ytchag_user'] = $user;
876
877
// Player options
878
$instance['ytchag_video_width'] = $videowidth;
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.5.1
9
License: GPL2
10
11
Copyright 2013 Javier Gómez Pose (email : javierpose@gmail.com)
81
// Feed options
82
$instance['ytchag_feed'] = strip_tags( $new_instance['ytchag_feed'] );
83
$instance['ytchag_user'] = strip_tags( $new_instance['ytchag_user'] );
84
+ $instance['ytchag_feed_order'] = strip_tags( $new_instance['ytchag_feed_order'] );
85
86
// Player options
87
$instance['ytchag_video_width'] = strip_tags( $new_instance['ytchag_video_width'] );
120
// Feed options
121
$ytchag_feed = isset( $instance['ytchag_feed'] ) ? esc_attr( $instance['ytchag_feed'] ) : '';
122
$ytchag_user = isset( $instance['ytchag_user'] ) ? esc_attr( $instance['ytchag_user'] ) : ''; //left ytchag_user variable name for backward compatibility
123
+ $ytchag_feed_order = isset( $instance['ytchag_feed_order'] ) ? esc_attr( $instance['ytchag_feed_order'] ) : '';
124
+
125
126
// Player options
127
$ytchag_video_width = isset( $instance['ytchag_video_width'] ) ? esc_attr( $instance['ytchag_video_width'] ) : '';
249
250
//Feed label title
251
//---------------
252
+ var feedSelect = '#<?php echo $this->get_field_id( 'ytchag_feed' ); ?>';
253
var userLabel = 'label[for="<?php echo $this->get_field_id( 'ytchag_user' ); ?>"]';
254
+ var feedOrder = '.<?php echo $this->get_field_id( 'ytchag_feed_order' ); ?>';
255
256
+ changeFeedType ();
257
+ $(feedSelect).change(function () {
258
+ changeFeedType ();
259
});
260
261
+ function changeFeedType (){
262
+ if($(feedSelect + ' option:selected').val() === 'user'){
263
+ $(userLabel).text('<?php _e( 'YouTube user id:', 'youtube-channel-gallery' ); ?>');
264
+ $(feedOrder).slideUp('fast');
265
}
266
+ /*if($(feedSelect + ' option:selected').val() === 'userfav'){
267
$(userLabel).text('<?php _e( 'YouTube user id:', 'youtube-channel-gallery' ); ?>');
268
+ }*/
269
+ if($(feedSelect + ' option:selected').val() === 'playlist'){
270
+ $(userLabel).text('<?php _e( 'YouTube playlist id:', 'youtube-channel-gallery' ); ?>');
271
+ $(feedOrder).slideDown('fast');
272
}
273
}
274
});
295
<div id="tabs-<?php echo $this->id; ?>-1" class="ytchgtabs-content">
296
297
<p>
298
+ <label for="<?php echo $this->get_field_id( 'ytchag_feed' ); ?>"><?php _e( 'Video feed type:', 'youtube-channel-gallery' ); ?></label>
299
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_feed' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_feed' ); ?>">
300
<option value="user"<?php selected( $instance['ytchag_feed'], 'user' ); ?>><?php _e( 'Uploaded by a user', 'youtube-channel-gallery' ); ?></option>
301
<?php /*<option value="favorites"<?php selected( $instance['ytchag_feed'], 'favorites' ); ?>><?php _e( 'User\'s favorites', 'youtube-channel-gallery' ); ?></option>*/?>
308
<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 ); ?>" />
309
</p>
310
311
+ <p class="<?php echo $this->get_field_id( 'ytchag_feed_order' ); ?>">
312
+ <label for="<?php echo $this->get_field_id( 'ytchag_feed_order' ); ?>"><?php _e( 'Playlist order:', 'youtube-channel-gallery' ); ?></label>
313
+ <select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_feed_order' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_feed_order' ); ?>">
314
+ <option value="asc"<?php selected( $instance['ytchag_feed_order'], 'asc' ); ?>><?php _e( 'Ascending Order', 'youtube-channel-gallery' ); ?></option>
315
+ <option value="desc"<?php selected( $instance['ytchag_feed_order'], 'desc' ); ?>><?php _e( 'Descending Order', 'youtube-channel-gallery' ); ?></option>
316
+ </select>
317
+ </p>
318
+
319
</div>
320
321
328
<div id="tabs-<?php echo $this->id; ?>-2" class="ytchgtabs-content">
329
330
<p>
331
+ <label for="<?php echo $this->get_field_id( 'ytchag_video_width' ); ?>"><?php _e( 'Video width:', 'youtube-channel-gallery' ); ?></label>
332
<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 ); ?>" />
333
</p>
334
335
<p>
336
+ <label for="<?php echo $this->get_field_id( 'ytchag_ratio' ); ?>"><?php _e( 'Aspect ratio:', 'youtube-channel-gallery' ); ?></label>
337
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_ratio' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_ratio' ); ?>">
338
<option value="4x3"<?php selected( $instance['ytchag_ratio'], '4x3' ); ?>><?php _e( 'Standard (4x3)', 'youtube-channel-gallery' ); ?></option>
339
<option value="16x9"<?php selected( $instance['ytchag_ratio'], '16x9' ); ?>><?php _e( 'Widescreen (16x9)', 'youtube-channel-gallery' ); ?></option>
341
</p>
342
343
<p>
344
+ <label for="<?php echo $this->get_field_id( 'ytchag_theme' ); ?>"><?php _e( 'Theme:', 'youtube-channel-gallery' ); ?></label>
345
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_theme' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_theme' ); ?>">
346
<option value="dark"<?php selected( $instance['ytchag_theme'], 'dark' ); ?>><?php _e( 'Dark', 'youtube-channel-gallery' ); ?></option>
347
<option value="light"<?php selected( $instance['ytchag_theme'], 'light' ); ?>><?php _e( 'Light', 'youtube-channel-gallery' ); ?></option>
349
</p>
350
351
<p>
352
+ <label for="<?php echo $this->get_field_id( 'ytchag_color' ); ?>"><?php _e( 'Progress bar color:', 'youtube-channel-gallery' ); ?></label>
353
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_color' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_color' ); ?>">
354
<option value="red"<?php selected( $instance['ytchag_color'], 'red' ); ?>><?php _e( 'Red', 'youtube-channel-gallery' ); ?></option>
355
<option value="white"<?php selected( $instance['ytchag_color'], 'white' ); ?>><?php _e( 'White', 'youtube-channel-gallery' ); ?></option>
357
</p>
358
359
<p>
360
+ <label for="<?php echo $this->get_field_id( 'ytchag_quality' ); ?>"><?php _e( 'Video quality:', 'youtube-channel-gallery' ); ?></label>
361
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_quality' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_quality' ); ?>">
362
<option value="default"<?php selected( $instance['ytchag_quality'], 'default' ); ?>><?php _e( 'default', 'youtube-channel-gallery' ); ?></option>
363
<option value="highres"<?php selected( $instance['ytchag_quality'], 'highres' ); ?>><?php _e( 'highres', 'youtube-channel-gallery' ); ?></option>
393
?>
394
<div id="tabs-<?php echo $this->id; ?>-3">
395
<p>
396
+ <label for="<?php echo $this->get_field_id( 'ytchag_maxitems' ); ?>"><?php _e( 'Number of videos to show:', 'youtube-channel-gallery' ); ?></label>
397
<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 ); ?>" />
398
</p>
399
400
<p>
401
+ <label for="<?php echo $this->get_field_id( 'ytchag_thumb_width' ); ?>"><?php _e( 'Thumbnail width:', 'youtube-channel-gallery' ); ?></label>
402
<input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_thumb_width' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_thumb_width' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_thumb_width ); ?>" />
403
</p>
404
405
<p>
406
407
+ <label for="<?php echo $this->get_field_id( 'ytchag_thumb_ratio' ); ?>"><?php _e( 'Aspect ratio:', 'youtube-channel-gallery' ); ?></label>
408
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_thumb_ratio' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_thumb_ratio' ); ?>">
409
<option value="4x3"<?php selected( $instance['ytchag_thumb_ratio'], '4x3' ); ?>><?php _e( 'Standard (4x3)', 'youtube-channel-gallery' ); ?></option>
410
<option value="16x9"<?php selected( $instance['ytchag_thumb_ratio'], '16x9' ); ?>><?php _e( 'Widescreen (16x9)', 'youtube-channel-gallery' ); ?></option>
412
</p>
413
414
<p>
415
+ <label for="<?php echo $this->get_field_id( 'ytchag_thumb_columns' ); ?>"><?php _e( 'Thumbnail columns:', 'youtube-channel-gallery' ); ?></label>
416
<input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_thumb_columns' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_thumb_columns' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_thumb_columns ); ?>" />
417
</p>
418
435
</p>
436
437
<p>
438
+ <label for="<?php echo $this->get_field_id( 'ytchag_thumbnail_alignment' ); ?>"><?php _e( 'Thumbnail alignment:', 'youtube-channel-gallery' ); ?></label>
439
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_thumbnail_alignment' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_thumbnail_alignment' ); ?>">
440
<option value="left"<?php selected( $instance['ytchag_thumbnail_alignment'], 'left' ); ?>><?php _e( 'Left', 'youtube-channel-gallery' ); ?></option>
441
<option value="right"<?php selected( $instance['ytchag_thumbnail_alignment'], 'right' ); ?>><?php _e( 'Right', 'youtube-channel-gallery' ); ?></option>
445
</p>
446
447
<p>
448
+ <label for="<?php echo $this->get_field_id( 'ytchag_description_words_number' ); ?>"><?php _e( 'Description words number:', 'youtube-channel-gallery' ); ?></label>
449
<input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_description_words_number' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_description_words_number' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_description_words_number ); ?>" />
450
</p>
451
</div>
466
<div id="tabs-<?php echo $this->id; ?>-4">
467
468
<p>
469
+ <label for="<?php echo $this->get_field_id( 'ytchag_link_tx' ); ?>"><?php _e( 'Link text:', 'youtube-channel-gallery' ); ?></label>
470
<input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_link_tx' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_link_tx' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_link_tx ); ?>" />
471
</p>
472
502
// Feed options
503
$ytchag_feed = apply_filters('ytchag_feed', $instance['ytchag_feed']);
504
$ytchag_user = apply_filters('ytchag_user', $instance['ytchag_user']);
505
+ $ytchag_feed_order = apply_filters('ytchag_feed_order', $instance['ytchag_feed_order']);
506
507
// Player options
508
$ytchag_video_width = apply_filters('ytchag_video_width', $instance['ytchag_video_width']);
537
538
// Feed options
539
$ytchag_feed = ( $ytchag_feed ) ? $ytchag_feed : 'user'; //default user
540
+ $ytchag_feed_order = ( $ytchag_feed_order ) ? $ytchag_feed_order : 'asc'; //default ascending
541
542
// Player options
543
$ytchag_video_width = ( $ytchag_video_width ) ? $ytchag_video_width : 250;
549
$ytchag_showinfo = ( $ytchag_showinfo ) ? '&showinfo='. $ytchag_showinfo : '&showinfo=0'; //default 1
550
551
// Thumbnail options
552
+ $ytchag_maxitems = ( $ytchag_maxitems ) ? $ytchag_maxitems : 9;
553
$ytchag_thumb_width = ( $ytchag_thumb_width ) ? $ytchag_thumb_width : 85;
554
$ytchag_thumb_columns = (( $ytchag_thumb_columns ) || ( $ytchag_thumb_columns != 0 )) ? $ytchag_thumb_columns : 0;
555
603
$errorMesagge = __('You must insert a valid YouTube user id.', 'youtube-channel-gallery');
604
}
605
if($ytchag_feed == 'playlist'){
606
+ $ytchag_rss_url = $youtube_feed_url . '/playlists/' . $ytchag_user . '?v=2';//&prettyprint=true
607
//print_r($ytchag_rss_url . '<br>');
608
$ytchag_link_url = 'http://www.youtube.com/playlist?list=' . $ytchag_user;
609
$errorMesagge = __('You must insert a valid playlist id.', 'youtube-channel-gallery');
613
include_once(ABSPATH . WPINC . '/feed.php');
614
615
$rss = fetch_feed($ytchag_rss_url);
616
+ //to get the appropriate order of items
617
+ $rss->set_stupidly_fast(true);
618
619
// check if no correct user name
620
if (!is_wp_error( $rss ) ) {
621
622
+ //playlist descending order
623
//get totalResultsData from playlist rss to order correctly videos
624
+ if($ytchag_feed == 'playlist' && $ytchag_feed_order == 'desc'){
625
//openSearch:totalResults
626
$totalResults = $rss->get_feed_tags('http://a9.com/-/spec/opensearch/1.1/', 'totalResults');
627
$totalResultsData = $totalResults[0]['data'];
628
+ //print_r('totalResultsData: ' . $totalResultsData . '<br>');
629
630
//get rss playlist again with the last videos. YouTube does not load in the first request, even if the orderby parameter is set.
631
+
632
+ //Youtube feed limit is 1000
633
+ if($totalResultsData >= 1000){
634
+ $startindex = 1000 - $ytchag_maxitems + 1;
635
+ } elseif ($ytchag_maxitems >= $totalResultsData) {
636
+ $startindex = 1;
637
+ } else {
638
+ $startindex = $totalResultsData - $ytchag_maxitems + 1;
639
+ }
640
+
641
+ //print_r('startindex: ' . $startindex . '<br>');
642
+ $ytchag_rss_url = $ytchag_rss_url . '&start-index=' . $startindex . '&max-results=' . $ytchag_maxitems . '&orderby=reversedPosition';
643
+ //print_r($ytchag_rss_url . '<br>');
644
$rss = fetch_feed($ytchag_rss_url);
645
646
//to get the appropriate order of items
647
+ $rss->set_stupidly_fast(true);
648
//print_r($ytchag_rss_url . '<br>');
649
}
650
651
+ $items = $rss->get_items(0, $ytchag_maxitems);
652
653
if (!empty($items)) {
654
$i = 0;
671
$media_group = $item->get_item_tags('http://search.yahoo.com/mrss/', 'group');
672
$media_content = $media_group[0]['child']['http://search.yahoo.com/mrss/']['thumbnail'];
673
674
+ /*
675
+ // to check order of playlist items
676
$episode = $item->get_item_tags('http://gdata.youtube.com/schemas/2007', 'episode'); //yt
677
$episodecontent = $episode[0]['attribs']['']['number'];
678
if(!$episode){
679
$episode = $item->get_item_tags('http://gdata.youtube.com/schemas/2007', 'position'); //yt
680
$episodecontent = $episode[0]['data'];
681
}
682
+ //print_r($episodecontent . '-');
683
*/
684
685
//Check the thumbnail width
869
870
// Feed options
871
'feed' => '',
872
+ 'feedorder' => '',
873
874
// Player options
875
'videowidth' => '',
901
// Feed options
902
$instance['ytchag_feed'] = $feed;
903
$instance['ytchag_user'] = $user;
904
+ $instance['ytchag_feed_order'] = $feedorder;
905
906
// Player options
907
$instance['ytchag_video_width'] = $videowidth;