Version Description
- Replaced SimplePie for SimpleXML to solve problems that many users have with Simplepie.
- Replaced SimplePie FeedCache for Transients API cache data to manage cache of RSS.
- Added a field to set the number of hours to keep the data before refreshing.
- Added a checkbox to deactivate the cache. Useful to check or flush new videos.
- Added default values.
- Changed the max-results parameter to 50 to allow the maximum display value of a single request.
- Fixed row counter with multiple instances of the plugin in the same page.
- Responsive design.
- Deleted video width field to make video player width responsive.
- Thumbnail width field is used for top and bottom alignments to obtain the most appropriate thumbnails from rss.
- Added checkbox Show YouTube logo, which if is unchecked, will prevent the YouTube logo from displaying in the control bar.
- Added contextual help to widget.
- Parameter orderby=reversedPosition of Google Data API is not working. The descending order of the playlist is created without the parameter of the api.
- Increased the width of the widget to show in a single row the tabs in Spanish.
- Changes in CSS.
- Update language file.
Download this release
Release Info
Developer | javitxu123 |
Plugin | Youtube Channel Gallery |
Version | 1.8 |
Comparing to | |
See all releases |
Code changes from version 1.7.10 to 1.8
- admin-styles.css +14 -1
- languages/youtube-channel-gallery-es_ES.mo +0 -0
- languages/youtube-channel-gallery-es_ES.po +120 -72
- readme.txt +24 -4
- styles.css +72 -39
- youtube-channel-gallery.php +689 -542
admin-styles.css
CHANGED
@@ -47,4 +47,17 @@
|
|
47 |
.ytchgtabs div.ytchg-title-and-description{border: none; background: none;}
|
48 |
|
49 |
|
50 |
-
.ytchgtabs fieldset.ytchg-fieldborder{border: 1px solid #DFDFDF;border-radius: 5px;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
.ytchgtabs div.ytchg-title-and-description{border: none; background: none;}
|
48 |
|
49 |
|
50 |
+
.ytchgtabs fieldset.ytchg-fieldborder{border: 1px solid #DFDFDF;border-radius: 5px;}
|
51 |
+
|
52 |
+
.ytchgtabs .ytchag_info {
|
53 |
+
background: #ADD3E2;
|
54 |
+
border-radius: 20px;
|
55 |
+
font-size: 11px;
|
56 |
+
width: 15px;
|
57 |
+
height: 15px;
|
58 |
+
line-height: 14px;
|
59 |
+
display: inline-block;
|
60 |
+
text-align: center;
|
61 |
+
cursor: pointer;
|
62 |
+
}
|
63 |
+
.wideinfo{width: 88%;margin-right: 2px;}
|
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: 2013-
|
11 |
-
"PO-Revision-Date: 2013-
|
12 |
"Last-Translator: Javier <javierpose@gmail.com>\n"
|
13 |
"Language-Team: PoseLab <javierpose@gmail.com>\n"
|
14 |
"MIME-Version: 1.0\n"
|
@@ -23,7 +23,7 @@ msgstr ""
|
|
23 |
"X-Poedit-SourceCharset: utf-8\n"
|
24 |
"X-Poedit-SearchPath-0: .\n"
|
25 |
|
26 |
-
#: youtube-channel-gallery.php:
|
27 |
msgid "Youtube Channel Gallery"
|
28 |
msgstr "Galería de Canal de Youtube"
|
29 |
|
@@ -31,224 +31,272 @@ 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:
|
35 |
msgid "Title:"
|
36 |
msgstr "Título:"
|
37 |
|
38 |
-
#: youtube-channel-gallery.php:
|
39 |
-
#: youtube-channel-gallery.php:
|
40 |
-
#: youtube-channel-gallery.php:
|
41 |
msgid "YouTube user id:"
|
42 |
msgstr "Id de usuario de Youtube:"
|
43 |
|
44 |
-
#: youtube-channel-gallery.php:
|
45 |
msgid "YouTube playlist id:"
|
46 |
msgstr "Id de lista de reproducción de YouTube:"
|
47 |
|
48 |
-
#: youtube-channel-gallery.php:
|
49 |
msgid "Feed"
|
50 |
msgstr "Feed"
|
51 |
|
52 |
-
#: youtube-channel-gallery.php:
|
53 |
msgid "Player"
|
54 |
msgstr "Reproductor"
|
55 |
|
56 |
-
#: youtube-channel-gallery.php:
|
57 |
msgid "Thumbnails"
|
58 |
msgstr "Miniaturas"
|
59 |
|
60 |
-
#: youtube-channel-gallery.php:
|
61 |
msgid "Link"
|
62 |
msgstr "Enlace"
|
63 |
|
64 |
-
#: youtube-channel-gallery.php:
|
65 |
msgid "Video feed type:"
|
66 |
msgstr "Tipo de feed de vídeo:"
|
67 |
|
68 |
-
#: youtube-channel-gallery.php:
|
69 |
msgid "Uploaded by a user"
|
70 |
msgstr "Subidos por el usuario"
|
71 |
|
72 |
-
#: youtube-channel-gallery.php:
|
73 |
msgid "Playlist"
|
74 |
msgstr "Lista de reproducción"
|
75 |
|
76 |
-
#: youtube-channel-gallery.php:
|
77 |
msgid "Playlist order:"
|
78 |
msgstr "Orden de lista de reproducción:"
|
79 |
|
80 |
-
#: youtube-channel-gallery.php:
|
81 |
msgid "Ascending Order"
|
82 |
msgstr "Ascendente"
|
83 |
|
84 |
-
#: youtube-channel-gallery.php:
|
85 |
msgid "Descending Order"
|
86 |
msgstr "Descendente"
|
87 |
|
88 |
-
#: youtube-channel-gallery.php:
|
89 |
-
msgid "
|
90 |
-
msgstr "
|
91 |
|
92 |
-
#: youtube-channel-gallery.php:
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
msgid "Aspect ratio:"
|
95 |
msgstr "Relación de aspecto:"
|
96 |
|
97 |
-
#: youtube-channel-gallery.php:
|
98 |
-
#: youtube-channel-gallery.php:
|
99 |
msgid "Standard (4x3)"
|
100 |
msgstr "Estándar (4x3)"
|
101 |
|
102 |
-
#: youtube-channel-gallery.php:
|
103 |
-
#: youtube-channel-gallery.php:
|
104 |
msgid "Widescreen (16x9)"
|
105 |
msgstr "Panorámico (16x9)"
|
106 |
|
107 |
-
#: youtube-channel-gallery.php:
|
108 |
msgid "Theme:"
|
109 |
msgstr "Tema:"
|
110 |
|
111 |
-
#: youtube-channel-gallery.php:
|
112 |
msgid "Dark"
|
113 |
msgstr "Oscuro"
|
114 |
|
115 |
-
#: youtube-channel-gallery.php:
|
116 |
msgid "Light"
|
117 |
msgstr "Claro"
|
118 |
|
119 |
-
#: youtube-channel-gallery.php:
|
120 |
msgid "Progress bar color:"
|
121 |
msgstr "Color de barra de progreso:"
|
122 |
|
123 |
-
#: youtube-channel-gallery.php:
|
124 |
msgid "Red"
|
125 |
msgstr "Rojo"
|
126 |
|
127 |
-
#: youtube-channel-gallery.php:
|
128 |
msgid "White"
|
129 |
msgstr "Blanco"
|
130 |
|
131 |
-
#: youtube-channel-gallery.php:
|
132 |
msgid "Video quality:"
|
133 |
msgstr "Calidad del vídeo:"
|
134 |
|
135 |
-
#: youtube-channel-gallery.php:
|
136 |
msgid "default"
|
137 |
msgstr "por defecto"
|
138 |
|
139 |
-
#: youtube-channel-gallery.php:
|
140 |
msgid "highres"
|
141 |
msgstr "alta resolución"
|
142 |
|
143 |
-
#: youtube-channel-gallery.php:
|
144 |
msgid "hd1080"
|
145 |
msgstr "hd1080"
|
146 |
|
147 |
-
#: youtube-channel-gallery.php:
|
148 |
msgid "hd720"
|
149 |
msgstr "hd720"
|
150 |
|
151 |
-
#: youtube-channel-gallery.php:
|
152 |
msgid "large"
|
153 |
msgstr "largo"
|
154 |
|
155 |
-
#: youtube-channel-gallery.php:
|
156 |
msgid "medium"
|
157 |
msgstr "mediano"
|
158 |
|
159 |
-
#: youtube-channel-gallery.php:
|
160 |
msgid "small"
|
161 |
msgstr "pequeño"
|
162 |
|
163 |
-
#: youtube-channel-gallery.php:
|
|
|
|
|
|
|
|
|
164 |
msgid "Autoplay"
|
165 |
msgstr "Autoplay"
|
166 |
|
167 |
-
#: youtube-channel-gallery.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
msgid "Show related videos"
|
169 |
msgstr "Mostrar los vídeos relacionados"
|
170 |
|
171 |
-
#: youtube-channel-gallery.php:
|
172 |
-
msgid "
|
173 |
-
msgstr "
|
|
|
|
|
|
|
|
|
174 |
|
175 |
-
#: youtube-channel-gallery.php:
|
|
|
|
|
|
|
|
|
176 |
msgid "Number of videos to show:"
|
177 |
msgstr "Número de vídeos a mostrar:"
|
178 |
|
179 |
-
#: youtube-channel-gallery.php:
|
|
|
|
|
|
|
|
|
180 |
msgid "Thumbnail width:"
|
181 |
msgstr "Ancho de miniaturas:"
|
182 |
|
183 |
-
#: youtube-channel-gallery.php:
|
|
|
|
|
|
|
|
|
184 |
msgid "Thumbnail columns:"
|
185 |
msgstr "Columnas de las miniaturas:"
|
186 |
|
187 |
-
#: youtube-channel-gallery.php:
|
188 |
msgid "Show title or description"
|
189 |
msgstr "Mostrar título y descripción"
|
190 |
|
191 |
-
#: youtube-channel-gallery.php:
|
192 |
msgid "Show title"
|
193 |
msgstr "Mostrar Título"
|
194 |
|
195 |
-
#: youtube-channel-gallery.php:
|
196 |
msgid "Show description"
|
197 |
msgstr "Mostrar descripción"
|
198 |
|
199 |
-
#: youtube-channel-gallery.php:
|
200 |
msgid "Thumbnail alignment:"
|
201 |
msgstr "Alineación de miniaturas:"
|
202 |
|
203 |
-
#: youtube-channel-gallery.php:
|
204 |
msgid "Left"
|
205 |
msgstr "Izquierda"
|
206 |
|
207 |
-
#: youtube-channel-gallery.php:
|
208 |
msgid "Right"
|
209 |
msgstr "Derecha"
|
210 |
|
211 |
-
#: youtube-channel-gallery.php:
|
212 |
msgid "Top"
|
213 |
msgstr "Arriba"
|
214 |
|
215 |
-
#: youtube-channel-gallery.php:
|
216 |
msgid "Bottom"
|
217 |
msgstr "Abajo"
|
218 |
|
219 |
-
#: youtube-channel-gallery.php:
|
220 |
msgid "Description words number:"
|
221 |
msgstr "Número de palabras en la descripción:"
|
222 |
|
223 |
-
#: youtube-channel-gallery.php:
|
|
|
|
|
|
|
|
|
224 |
msgid "Link text:"
|
225 |
msgstr "Texto del enlace"
|
226 |
|
227 |
-
#: youtube-channel-gallery.php:
|
228 |
msgid "Show link to channel"
|
229 |
msgstr "Mostrar enlace al canal"
|
230 |
|
231 |
-
#: youtube-channel-gallery.php:
|
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:
|
236 |
msgid "Show more videos»"
|
237 |
msgstr "Ver más vídeos»"
|
238 |
|
239 |
-
#: youtube-channel-gallery.php:
|
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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
#~ msgid "User's favorites"
|
253 |
#~ msgstr "Favoritos del usuario"
|
254 |
#~ msgid "Light:"
|
7 |
msgstr ""
|
8 |
"Project-Id-Version: youtube-channel-gallery\n"
|
9 |
"Report-Msgid-Bugs-To: \n"
|
10 |
+
"POT-Creation-Date: 2013-05-10 16:25+0100\n"
|
11 |
+
"PO-Revision-Date: 2013-05-10 16:31+0100\n"
|
12 |
"Last-Translator: Javier <javierpose@gmail.com>\n"
|
13 |
"Language-Team: PoseLab <javierpose@gmail.com>\n"
|
14 |
"MIME-Version: 1.0\n"
|
23 |
"X-Poedit-SourceCharset: utf-8\n"
|
24 |
"X-Poedit-SearchPath-0: .\n"
|
25 |
|
26 |
+
#: youtube-channel-gallery.php:46
|
27 |
msgid "Youtube Channel Gallery"
|
28 |
msgstr "Galería de Canal de Youtube"
|
29 |
|
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:191
|
35 |
msgid "Title:"
|
36 |
msgstr "Título:"
|
37 |
|
38 |
+
#: youtube-channel-gallery.php:299
|
39 |
+
#: youtube-channel-gallery.php:303
|
40 |
+
#: youtube-channel-gallery.php:343
|
41 |
msgid "YouTube user id:"
|
42 |
msgstr "Id de usuario de Youtube:"
|
43 |
|
44 |
+
#: youtube-channel-gallery.php:306
|
45 |
msgid "YouTube playlist id:"
|
46 |
msgstr "Id de lista de reproducción de YouTube:"
|
47 |
|
48 |
+
#: youtube-channel-gallery.php:318
|
49 |
msgid "Feed"
|
50 |
msgstr "Feed"
|
51 |
|
52 |
+
#: youtube-channel-gallery.php:319
|
53 |
msgid "Player"
|
54 |
msgstr "Reproductor"
|
55 |
|
56 |
+
#: youtube-channel-gallery.php:320
|
57 |
msgid "Thumbnails"
|
58 |
msgstr "Miniaturas"
|
59 |
|
60 |
+
#: youtube-channel-gallery.php:321
|
61 |
msgid "Link"
|
62 |
msgstr "Enlace"
|
63 |
|
64 |
+
#: youtube-channel-gallery.php:334
|
65 |
msgid "Video feed type:"
|
66 |
msgstr "Tipo de feed de vídeo:"
|
67 |
|
68 |
+
#: youtube-channel-gallery.php:336
|
69 |
msgid "Uploaded by a user"
|
70 |
msgstr "Subidos por el usuario"
|
71 |
|
72 |
+
#: youtube-channel-gallery.php:338
|
73 |
msgid "Playlist"
|
74 |
msgstr "Lista de reproducción"
|
75 |
|
76 |
+
#: youtube-channel-gallery.php:348
|
77 |
msgid "Playlist order:"
|
78 |
msgstr "Orden de lista de reproducción:"
|
79 |
|
80 |
+
#: youtube-channel-gallery.php:350
|
81 |
msgid "Ascending Order"
|
82 |
msgstr "Ascendente"
|
83 |
|
84 |
+
#: youtube-channel-gallery.php:351
|
85 |
msgid "Descending Order"
|
86 |
msgstr "Descendente"
|
87 |
|
88 |
+
#: youtube-channel-gallery.php:356
|
89 |
+
msgid "Cache time (hours):"
|
90 |
+
msgstr "Tiempo de cache (horas):"
|
91 |
|
92 |
+
#: youtube-channel-gallery.php:358
|
93 |
+
msgid "Hours that RSS data is saved in database, to not make a request every time the page is displayed. Assign this value according to how often you upgrade your playlist in YouTube."
|
94 |
+
msgstr "Horas que los datos del RSS se guardan en la base de datos, para no hacer una solicitud cada vez que se muestra la página. Asigna este valor en función de la frecuencia con que actualizas la lista de reproducción en YouTube."
|
95 |
+
|
96 |
+
#: youtube-channel-gallery.php:363
|
97 |
+
msgid "Activate cache"
|
98 |
+
msgstr "Activar caché"
|
99 |
+
|
100 |
+
#: youtube-channel-gallery.php:364
|
101 |
+
msgid "If you disable this field the cache will be deleted and will not be used. This is useful to refresh immediately the YouTube RSS used by the plugin. Reenable the cache when the gallery shows the changes you made in your youtube account."
|
102 |
+
msgstr "Si se deshabilita este campo la caché se borrará y no será utilizada. Esto es útil para actualizar inmediatamente el RSS de YouTube usado por el plugin. Vuelve a habilitar la caché cuando la galería muestre los cambios que ha realizado en su cuenta de YouTube."
|
103 |
+
|
104 |
+
#: youtube-channel-gallery.php:379
|
105 |
+
#: youtube-channel-gallery.php:461
|
106 |
msgid "Aspect ratio:"
|
107 |
msgstr "Relación de aspecto:"
|
108 |
|
109 |
+
#: youtube-channel-gallery.php:381
|
110 |
+
#: youtube-channel-gallery.php:463
|
111 |
msgid "Standard (4x3)"
|
112 |
msgstr "Estándar (4x3)"
|
113 |
|
114 |
+
#: youtube-channel-gallery.php:382
|
115 |
+
#: youtube-channel-gallery.php:464
|
116 |
msgid "Widescreen (16x9)"
|
117 |
msgstr "Panorámico (16x9)"
|
118 |
|
119 |
+
#: youtube-channel-gallery.php:387
|
120 |
msgid "Theme:"
|
121 |
msgstr "Tema:"
|
122 |
|
123 |
+
#: youtube-channel-gallery.php:389
|
124 |
msgid "Dark"
|
125 |
msgstr "Oscuro"
|
126 |
|
127 |
+
#: youtube-channel-gallery.php:390
|
128 |
msgid "Light"
|
129 |
msgstr "Claro"
|
130 |
|
131 |
+
#: youtube-channel-gallery.php:395
|
132 |
msgid "Progress bar color:"
|
133 |
msgstr "Color de barra de progreso:"
|
134 |
|
135 |
+
#: youtube-channel-gallery.php:397
|
136 |
msgid "Red"
|
137 |
msgstr "Rojo"
|
138 |
|
139 |
+
#: youtube-channel-gallery.php:398
|
140 |
msgid "White"
|
141 |
msgstr "Blanco"
|
142 |
|
143 |
+
#: youtube-channel-gallery.php:403
|
144 |
msgid "Video quality:"
|
145 |
msgstr "Calidad del vídeo:"
|
146 |
|
147 |
+
#: youtube-channel-gallery.php:405
|
148 |
msgid "default"
|
149 |
msgstr "por defecto"
|
150 |
|
151 |
+
#: youtube-channel-gallery.php:406
|
152 |
msgid "highres"
|
153 |
msgstr "alta resolución"
|
154 |
|
155 |
+
#: youtube-channel-gallery.php:407
|
156 |
msgid "hd1080"
|
157 |
msgstr "hd1080"
|
158 |
|
159 |
+
#: youtube-channel-gallery.php:408
|
160 |
msgid "hd720"
|
161 |
msgstr "hd720"
|
162 |
|
163 |
+
#: youtube-channel-gallery.php:409
|
164 |
msgid "large"
|
165 |
msgstr "largo"
|
166 |
|
167 |
+
#: youtube-channel-gallery.php:410
|
168 |
msgid "medium"
|
169 |
msgstr "mediano"
|
170 |
|
171 |
+
#: youtube-channel-gallery.php:411
|
172 |
msgid "small"
|
173 |
msgstr "pequeño"
|
174 |
|
175 |
+
#: youtube-channel-gallery.php:413
|
176 |
+
msgid "Default value enables YouTube to select the most appropriate playback quality. If you select a quality level that is not available for the video, then the quality will be set to the next lowest level that is available."
|
177 |
+
msgstr "El valor predeterminado permite a YouTube seleccionar la calidad de reproducción más adecuada. Si selecciona un nivel de calidad que no está disponible para el vídeo, la calidad se ajustará al siguiente nivel más bajo que este disponible."
|
178 |
+
|
179 |
+
#: youtube-channel-gallery.php:417
|
180 |
msgid "Autoplay"
|
181 |
msgstr "Autoplay"
|
182 |
|
183 |
+
#: youtube-channel-gallery.php:422
|
184 |
+
msgid "Show YouTube logo"
|
185 |
+
msgstr "Mostrar el logotipo de YouTube"
|
186 |
+
|
187 |
+
#: youtube-channel-gallery.php:423
|
188 |
+
msgid "Activate this field to show the YouTube logo in the control bar. Setting the color parameter to white will show the YouTube logo in the control bar."
|
189 |
+
msgstr "Activa este campo para mostrar el logotipo de YouTube en la barra de control. Un ajuste del parámetro de color a blanco mostrará el logotipo de YouTube en la barra de control."
|
190 |
+
|
191 |
+
#: youtube-channel-gallery.php:428
|
192 |
msgid "Show related videos"
|
193 |
msgstr "Mostrar los vídeos relacionados"
|
194 |
|
195 |
+
#: youtube-channel-gallery.php:429
|
196 |
+
msgid "Activate this field to show related videos when playback of the video ends."
|
197 |
+
msgstr "Activa este campo para mostrar videos relacionados cuando termine la reproducción del vídeo."
|
198 |
+
|
199 |
+
#: youtube-channel-gallery.php:434
|
200 |
+
msgid "Show info"
|
201 |
+
msgstr "Mostrar información"
|
202 |
|
203 |
+
#: youtube-channel-gallery.php:435
|
204 |
+
msgid "Activate this field to display information like the video title and uploader before the video starts playing."
|
205 |
+
msgstr "Active este campo para mostrar información como el título del vídeo y nombre de usuario antes de que el vídeo comience a reproducirse."
|
206 |
+
|
207 |
+
#: youtube-channel-gallery.php:448
|
208 |
msgid "Number of videos to show:"
|
209 |
msgstr "Número de vídeos a mostrar:"
|
210 |
|
211 |
+
#: youtube-channel-gallery.php:450
|
212 |
+
msgid "The plugin can display a maximum of 50 videos. This limitation will change in a future release."
|
213 |
+
msgstr "El plugin puede mostrar un máximo de 50 vídeos. Esta limitación cambiará en una futura versión."
|
214 |
+
|
215 |
+
#: youtube-channel-gallery.php:454
|
216 |
msgid "Thumbnail width:"
|
217 |
msgstr "Ancho de miniaturas:"
|
218 |
|
219 |
+
#: youtube-channel-gallery.php:456
|
220 |
+
msgid "This field is used to assign the appropriate quality of thumbnail images in top and bottom alignments and to assign width to thumbnails in left and right alignments. If the quality of thumbnail images is not enough, insert a larger value. If you are unsure you can assign one of the following values: 120, 320, 480 or 640"
|
221 |
+
msgstr "Este campo se utiliza para asignar la calidad de imagen más adecuada a las miniaturas en las alineaciones superior e inferior y para asignar ancho a las miniaturas en las alineaciones izquierda y derecha. Si la calidad de las imágenes de las miniaturas no es suficiente, introduzca un valor mayor. Si no está seguro de que valor usar puede asignar uno de los siguientes valores: 120, 320, 480 ó 640"
|
222 |
+
|
223 |
+
#: youtube-channel-gallery.php:469
|
224 |
msgid "Thumbnail columns:"
|
225 |
msgstr "Columnas de las miniaturas:"
|
226 |
|
227 |
+
#: youtube-channel-gallery.php:476
|
228 |
msgid "Show title or description"
|
229 |
msgstr "Mostrar título y descripción"
|
230 |
|
231 |
+
#: youtube-channel-gallery.php:483
|
232 |
msgid "Show title"
|
233 |
msgstr "Mostrar Título"
|
234 |
|
235 |
+
#: youtube-channel-gallery.php:488
|
236 |
msgid "Show description"
|
237 |
msgstr "Mostrar descripción"
|
238 |
|
239 |
+
#: youtube-channel-gallery.php:492
|
240 |
msgid "Thumbnail alignment:"
|
241 |
msgstr "Alineación de miniaturas:"
|
242 |
|
243 |
+
#: youtube-channel-gallery.php:494
|
244 |
msgid "Left"
|
245 |
msgstr "Izquierda"
|
246 |
|
247 |
+
#: youtube-channel-gallery.php:495
|
248 |
msgid "Right"
|
249 |
msgstr "Derecha"
|
250 |
|
251 |
+
#: youtube-channel-gallery.php:496
|
252 |
msgid "Top"
|
253 |
msgstr "Arriba"
|
254 |
|
255 |
+
#: youtube-channel-gallery.php:497
|
256 |
msgid "Bottom"
|
257 |
msgstr "Abajo"
|
258 |
|
259 |
+
#: youtube-channel-gallery.php:502
|
260 |
msgid "Description words number:"
|
261 |
msgstr "Número de palabras en la descripción:"
|
262 |
|
263 |
+
#: youtube-channel-gallery.php:504
|
264 |
+
msgid "Set the maximum number of words that will be displayed of the description. This field is useful when the descriptions of videos in the gallery have different sizes."
|
265 |
+
msgstr "Establece el número máximo de palabras que se mostrarán en la descripción. Este campo es útil cuando la descripción de los vídeos de la galería tienen diferentes tamaños."
|
266 |
+
|
267 |
+
#: youtube-channel-gallery.php:524
|
268 |
msgid "Link text:"
|
269 |
msgstr "Texto del enlace"
|
270 |
|
271 |
+
#: youtube-channel-gallery.php:530
|
272 |
msgid "Show link to channel"
|
273 |
msgstr "Mostrar enlace al canal"
|
274 |
|
275 |
+
#: youtube-channel-gallery.php:535
|
276 |
msgid "Open in a new window or tab"
|
277 |
msgstr "Abri en una ventana nueva o pestaña"
|
278 |
|
279 |
+
#: youtube-channel-gallery.php:621
|
280 |
msgid "Show more videos»"
|
281 |
msgstr "Ver más vídeos»"
|
282 |
|
283 |
+
#: youtube-channel-gallery.php:634
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
msgid "There is no video to show."
|
285 |
msgstr "No hay ningún vídeo para mostrar."
|
286 |
|
287 |
+
#: youtube-channel-gallery.php:692
|
288 |
+
#, php-format
|
289 |
+
msgid "Message from server: %1$s. Check in YouTube if the id <a href=\"%2$s\" target=\"_blank\">%3$s</a> belongs to a %4$s. To locate the id of your %4$s check the <a href=\"http://wordpress.org/extend/plugins/youtube-channel-gallery/faq/\" target=\"_blank\">FAQ</a> of the plugin."
|
290 |
+
msgstr "Mensaje del servidor: %1$s. Compruebe en YouTube si el id <a href=\"%2$s\" target=\"_blank\">%3$s</a> pertenece a un %4$s. Para localizar el id de la carpeta %4$s revise el <a href=\"http://wordpress.org/extend/plugins/youtube-channel-gallery/faq/\" target=\"_blank\"> FAQ </ a> del plugin."
|
291 |
+
|
292 |
+
#~ msgid "Video width:"
|
293 |
+
#~ msgstr "Ancho del vídeo:"
|
294 |
+
#~ msgid "Show info (title, uploader)"
|
295 |
+
#~ msgstr "Mostrar información (título, cargador)"
|
296 |
+
#~ msgid "You must insert a valid YouTube user id."
|
297 |
+
#~ msgstr "Debes introducir un id válido de usuario de YouTube."
|
298 |
+
#~ msgid "You must insert a valid playlist id."
|
299 |
+
#~ msgstr "Debes introducir un id válido de lista de reproducción de YouTube."
|
300 |
#~ msgid "User's favorites"
|
301 |
#~ msgstr "Favoritos del usuario"
|
302 |
#~ msgid "Light:"
|
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -45,15 +45,17 @@ Description of the different fields of the plugin:
|
|
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 |
* **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).
|
47 |
* **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).
|
|
|
|
|
48 |
|
49 |
**Player tab:**
|
50 |
|
51 |
-
* **Video width:** indicates the width of the video player. Shortcode attribute: videowidth; value: Number. (Optional).
|
52 |
* **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).
|
53 |
* **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).
|
54 |
* **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).
|
55 |
* **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).
|
56 |
* **Autoplay:** automatically play the initial video when the player loads. Shortcode attribute: autoplay; values: 0 (default) or 1. (Optional).
|
|
|
57 |
* **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).
|
58 |
* **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).
|
59 |
|
@@ -76,7 +78,7 @@ Description of the different fields of the plugin:
|
|
76 |
|
77 |
|
78 |
= Shortcode syntax: =
|
79 |
-
In the following example are
|
80 |
|
81 |
`[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"]`
|
82 |
|
@@ -124,8 +126,26 @@ This will happen if your playlist has more than 1000 videos because YouTube API
|
|
124 |
|
125 |
== Changelog ==
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
= 1.7.10 =
|
128 |
-
*
|
129 |
|
130 |
= 1.7.9 =
|
131 |
* Changed the max-results parameter to 50 to allow the maximum display value of a single request. The plugin will not show more than 50 videos at least until version 2
|
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.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
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 |
* **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).
|
47 |
* **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).
|
48 |
+
* **Cache time (hours):** Hours that RSS data is saved in database, to not make a request every time the page is displayed. Assign this value according to how often you upgrade your playlist in YouTube. Shortcode attribute: cache_time; value: Number. (Optional).
|
49 |
+
* **Activate cache:** If you disable this field the cache will be deleted and will not be used. This is useful to refresh immediately the YouTube RSS used by the plugin. Reenable the cache when the gallery shows the changes you made in your YouTube account. Shortcode attribute: cache; values: 0 or 1 (default). (Optional).
|
50 |
|
51 |
**Player tab:**
|
52 |
|
|
|
53 |
* **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).
|
54 |
* **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).
|
55 |
* **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).
|
56 |
* **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).
|
57 |
* **Autoplay:** automatically play the initial video when the player loads. Shortcode attribute: autoplay; values: 0 (default) or 1. (Optional).
|
58 |
+
* **Show YouTube logo:** Activate this field to show the YouTube logo in the control bar. Setting the color parameter to white will show the YouTube logo in the control bar. Shortcode attribute: modestbranding; values: 0 (default) or 1. (Optional).
|
59 |
* **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).
|
60 |
* **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).
|
61 |
|
78 |
|
79 |
|
80 |
= Shortcode syntax: =
|
81 |
+
In the following example are many attributes that can be used with the shortcode and explained above:
|
82 |
|
83 |
`[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"]`
|
84 |
|
126 |
|
127 |
== Changelog ==
|
128 |
|
129 |
+
= 1.8 =
|
130 |
+
* Replaced SimplePie for SimpleXML to solve problems that many users have with Simplepie.
|
131 |
+
* Replaced SimplePie FeedCache for Transients API cache data to manage cache of RSS.
|
132 |
+
* Added a field to set the number of hours to keep the data before refreshing.
|
133 |
+
* Added a checkbox to deactivate the cache. Useful to check or flush new videos.
|
134 |
+
* Added default values.
|
135 |
+
* Changed the max-results parameter to 50 to allow the maximum display value of a single request.
|
136 |
+
* Fixed row counter with multiple instances of the plugin in the same page.
|
137 |
+
* Responsive design.
|
138 |
+
* Deleted video width field to make video player width responsive.
|
139 |
+
* Thumbnail width field is used for top and bottom alignments to obtain the most appropriate thumbnails from rss.
|
140 |
+
* Added checkbox Show YouTube logo, which if is unchecked, will prevent the YouTube logo from displaying in the control bar.
|
141 |
+
* Added contextual help to widget.
|
142 |
+
* Parameter orderby=reversedPosition of Google Data API is not working. The descending order of the playlist is created without the parameter of the api.
|
143 |
+
* Increased the width of the widget to show in a single row the tabs in Spanish.
|
144 |
+
* Changes in CSS.
|
145 |
+
* Update language file.
|
146 |
+
|
147 |
= 1.7.10 =
|
148 |
+
* max-results=50 parameter removed from playlists. Some users have reported plugin crashes. After check it out I found that the plugin fails with multiple playlist because of this parameter randomly.
|
149 |
|
150 |
= 1.7.9 =
|
151 |
* Changed the max-results parameter to 50 to allow the maximum display value of a single request. The plugin will not show more than 50 videos at least until version 2
|
styles.css
CHANGED
@@ -4,6 +4,10 @@ Plugin URI: http://www.poselab.com/
|
|
4 |
Version: 1.7.4
|
5 |
Description: Show a youtube video and a gallery of thumbnails for a youtube channel.
|
6 |
------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
7 |
|
8 |
/*clearfix*/
|
9 |
.ytccf:before,.ytccf:after {content: " "; display: table;}
|
@@ -16,77 +20,106 @@ Description: Show a youtube video and a gallery of thumbnails for a youtube chan
|
|
16 |
|
17 |
/*Player*/
|
18 |
/*---------------------------------------------------*/
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
/*Thumbnails, title and description*/
|
22 |
/*---------------------------------------------------*/
|
23 |
-
ul.ytchagallery
|
24 |
-
ul.ytchagallery.
|
25 |
-
ul.ytchagallery
|
|
|
|
|
26 |
|
27 |
/*Thumbnails*/
|
28 |
-
|
29 |
-
ul.ytchagallery
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
33 |
|
34 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
-
|
|
|
|
|
|
|
37 |
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
/*left*/
|
41 |
-
ul.ytchagallery.ytc-td-left div.ytcthumb-cont{margin: 0 5px 5px 0}
|
42 |
|
43 |
/*right*/
|
44 |
-
ul.ytchagallery.ytc-td-right div.ytcthumb-cont{float: right; margin: 0 0 5px 5px}
|
45 |
|
46 |
|
47 |
/*top*/
|
48 |
-
ul.ytchagallery.ytc-td-top div.ytcthumb-cont{float: none;}
|
49 |
|
50 |
/*bottom*/
|
51 |
-
ul.ytchagallery.ytc-td-bottom div.ytcthumb-cont{float: none; }
|
52 |
ul.ytchagallery.ytc-td-bottom div.ytctitledesc-cont{margin-bottom: 5px}
|
53 |
ul.ytchagallery.ytc-td-bottom div.ytctitledesc-cont h5{margin-bottom: 5px}
|
54 |
|
55 |
|
56 |
|
57 |
-
/*
|
58 |
.ytc-row{clear: both;}
|
59 |
-
|
60 |
-
.ytc-columns2 li{ width: 50%; width:-webkit-calc(100%/2 + 10px/(2 - 1)); width:calc(100%/2 + 10px/(2 - 1));}
|
61 |
-
.ytc-columns2 li.ytccell-last{width:-webkit-calc(100%/2 - 10px); width:calc(100%/2 - 10px);}
|
62 |
|
63 |
-
.ytc-
|
64 |
-
|
|
|
65 |
|
66 |
-
.ytc-columns4 li{ width: 25%; width:-webkit-calc(100%/4
|
67 |
-
.ytc-columns4 li.ytccell-last{width:-webkit-calc(100%/4 - 10px); width:calc(100%/4 - 10px);}
|
68 |
|
69 |
-
.ytc-columns5 li{ width: 20%; width:-webkit-calc(100%/5
|
70 |
-
.ytc-columns5 li.ytccell-last{width:-webkit-calc(100%/5 - 10px); width:calc(100%/5 - 10px);}
|
71 |
|
72 |
-
.ytc-columns6 li{ width:
|
73 |
-
.ytc-columns6 li.ytccell-last{width:-webkit-calc(100%/6 - 10px); width:calc(100%/6 - 10px);}
|
74 |
|
75 |
-
.ytc-columns7 li{ width:
|
76 |
-
.ytc-columns7 li.ytccell-last{width:-webkit-calc(100%/7 - 10px); width:calc(100%/7 - 10px);}
|
77 |
|
78 |
-
.ytc-columns8 li{ width:
|
79 |
-
.ytc-columns8 li.ytccell-last{width:-webkit-calc(100%/8 - 10px); width:calc(100%/8 - 10px);}
|
80 |
|
81 |
-
.ytc-columns9 li{ width:
|
82 |
-
.ytc-columns9 li.ytccell-last{width:-webkit-calc(100%/9 - 10px); width:calc(100%/9 - 10px);}
|
83 |
|
84 |
-
.ytc-columns10 li{ width:
|
85 |
-
.ytc-columns10 li.ytccell-last{width:-webkit-calc(100%/10 - 10px); width:calc(100%/10 - 10px);}
|
86 |
|
87 |
-
ul.ytchagallery.ytccf li .ytcliinner{padding: 0 10px 10px 0;overflow: hidden;}
|
88 |
-
ul.ytchagallery.ytccf li.ytccell-last .ytcliinner{padding-right: 0;}
|
89 |
-
|
90 |
|
91 |
/*link to YouTube*/
|
92 |
/*---------------------------------------------------*/
|
4 |
Version: 1.7.4
|
5 |
Description: Show a youtube video and a gallery of thumbnails for a youtube channel.
|
6 |
------------------------------------------------------------*/
|
7 |
+
/*plugin wrapper*/
|
8 |
+
.youtubechannelgallery, .youtubechannelgallery *{
|
9 |
+
-webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;
|
10 |
+
}
|
11 |
|
12 |
/*clearfix*/
|
13 |
.ytccf:before,.ytccf:after {content: " "; display: table;}
|
20 |
|
21 |
/*Player*/
|
22 |
/*---------------------------------------------------*/
|
23 |
+
|
24 |
+
/*
|
25 |
+
padding-top: player chrome height
|
26 |
+
padding-bottom: height of player;
|
27 |
+
*/
|
28 |
+
.ytcplayer-wrapper{
|
29 |
+
/*display: block!important;margin-bottom: 10px!important;padding: 0!important;*/
|
30 |
+
position: relative; padding-bottom: 56.25%; height: 0; width: 100%;
|
31 |
+
margin-bottom: 10px;
|
32 |
+
}
|
33 |
+
.ytcplayer-wrapper.ytc-player4x3{
|
34 |
+
padding-bottom: 75%;
|
35 |
+
}
|
36 |
+
iframe.ytcplayer{
|
37 |
+
position: absolute; top: 0; left: 0; width: 100%; height: 100%;
|
38 |
+
}
|
39 |
|
40 |
/*Thumbnails, title and description*/
|
41 |
/*---------------------------------------------------*/
|
42 |
+
ul.ytchagallery{margin: 0!important; padding: 0!important;list-style: none!important; width: 100%; overflow: hidden;}
|
43 |
+
ul.ytchagallery .ytc-row{width:-webkit-calc(100% + 10px); width:calc(100% + 10px)}
|
44 |
+
ul.ytchagallery li{float:left;margin: 0!important;list-style: none!important;padding: 0 10px 10px 0!important;clear: none;}
|
45 |
+
ul.ytchagallery li.ytccell-first{clear: left!important;}
|
46 |
+
ul.ytchagallery li .ytcliinner {overflow: hidden;}
|
47 |
|
48 |
/*Thumbnails*/
|
49 |
+
/*----------------------------*/
|
50 |
+
ul.ytchagallery a.ytcthumb{
|
51 |
+
display: block!important;border:1px solid #999; position: relative; line-height: 0;width: 100%;
|
52 |
+
padding: 0; margin: 0; height: 0; overflow: hidden;
|
53 |
+
background-size: cover; background-position: center;
|
54 |
+
}
|
55 |
|
56 |
+
/*Play button*/
|
57 |
+
ul.ytchagallery a.ytcthumb .ytcplay{background: url(img/play.png) -9999px -9999px no-repeat; position: absolute; width: 100%; height: 100%}
|
58 |
+
ul.ytchagallery a.ytcthumb:hover{opacity: 0.75;}
|
59 |
+
ul.ytchagallery a.ytcthumb:hover .ytcplay{background-position: center center;}
|
60 |
+
|
61 |
+
ul.ytchagallery p{display: none}/*for some themes*/
|
62 |
+
|
63 |
+
/*images*/
|
64 |
+
/*----------------------------*/
|
65 |
+
|
66 |
+
/*4x3*/
|
67 |
+
ul.ytc-thumb4x3 a.ytcthumb{
|
68 |
+
padding-bottom: 75%;
|
69 |
+
}
|
70 |
|
71 |
+
/*16x9*/
|
72 |
+
ul.ytc-thumb16x9 a.ytcthumb{
|
73 |
+
padding-bottom: 55%;
|
74 |
+
}
|
75 |
|
76 |
+
|
77 |
+
|
78 |
+
/*Title and description*/
|
79 |
+
/*----------------------------*/
|
80 |
+
ul.ytchagallery .ytctitledesc-cont * {clear: none!important; }
|
81 |
+
ul.ytchagallery .ytctitle a{word-wrap: break-word; }
|
82 |
+
|
83 |
+
ul.ytchagallery .ytctitle{margin: 5px 0 10px 0}
|
84 |
|
85 |
/*left*/
|
86 |
+
ul.ytchagallery.ytc-td-left div.ytcthumb-cont{float: left!important; margin: 0 5px 5px 0!important;}
|
87 |
|
88 |
/*right*/
|
89 |
+
ul.ytchagallery.ytc-td-right div.ytcthumb-cont{float: right!important; margin: 0 0 5px 5px!important}
|
90 |
|
91 |
|
92 |
/*top*/
|
93 |
+
ul.ytchagallery.ytc-td-top div.ytcthumb-cont{float: none!important;}
|
94 |
|
95 |
/*bottom*/
|
96 |
+
ul.ytchagallery.ytc-td-bottom div.ytcthumb-cont{float: none!important; }
|
97 |
ul.ytchagallery.ytc-td-bottom div.ytctitledesc-cont{margin-bottom: 5px}
|
98 |
ul.ytchagallery.ytc-td-bottom div.ytctitledesc-cont h5{margin-bottom: 5px}
|
99 |
|
100 |
|
101 |
|
102 |
+
/*columns*/
|
103 |
.ytc-row{clear: both;}
|
|
|
|
|
|
|
104 |
|
105 |
+
.ytc-columns2 li{ width: 50%; width:-webkit-calc(100%/2); width:calc(100%/2);}
|
106 |
+
|
107 |
+
.ytc-columns3 li{ width: 33.33%; width:-webkit-calc(100%/3); width:calc(100%/3);}
|
108 |
|
109 |
+
.ytc-columns4 li{ width: 25%; width:-webkit-calc(100%/4); width:calc(100%/4);}
|
|
|
110 |
|
111 |
+
.ytc-columns5 li{ width: 20%; width:-webkit-calc(100%/5); width:calc(100%/5);}
|
|
|
112 |
|
113 |
+
.ytc-columns6 li{ width: 16.66%; width:-webkit-calc(100%/6); width:calc(100%/6);}
|
|
|
114 |
|
115 |
+
.ytc-columns7 li{ width: 14.28%; width:-webkit-calc(100%/7); width:calc(100%/7);}
|
|
|
116 |
|
117 |
+
.ytc-columns8 li{ width: 12.5%; width:-webkit-calc(100%/8); width:calc(100%/8);}
|
|
|
118 |
|
119 |
+
.ytc-columns9 li{ width: 11.11%; width:-webkit-calc(100%/9); width:calc(100%/9);}
|
|
|
120 |
|
121 |
+
.ytc-columns10 li{ width: 10%; width:-webkit-calc(100%/10); width:calc(100%/10);}
|
|
|
122 |
|
|
|
|
|
|
|
123 |
|
124 |
/*link to YouTube*/
|
125 |
/*---------------------------------------------------*/
|
youtube-channel-gallery.php
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
Plugin Name: Youtube Channel Gallery
|
4 |
Plugin URI: http://www.poselab.com/
|
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.
|
9 |
License: GPL2
|
10 |
-
|
11 |
Copyright 2013 Javier Gómez Pose (email : javierpose@gmail.com)
|
12 |
|
13 |
This program is free software; you can redistribute it and/or modify
|
14 |
-
it under the terms of the GNU General Public License, version 2, as
|
15 |
published by the Free Software Foundation.
|
16 |
|
17 |
This program is distributed in the hope that it will be useful,
|
@@ -24,135 +24,174 @@
|
|
24 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
*/
|
26 |
|
27 |
-
|
|
|
|
|
|
|
28 |
|
29 |
/**
|
30 |
-
* widget
|
31 |
*/
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
public function __construct() {
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
add_shortcode('Youtube_Channel_Gallery', array($this, 'YoutubeChannelGallery_Shortcode'));
|
42 |
-
|
43 |
-
//load admin scripts
|
44 |
-
add_action('admin_enqueue_scripts', array($this, 'register_admin_scripts_and_styles'));
|
45 |
-
|
46 |
-
parent::__construct(
|
47 |
-
'youtubechannelgallery_widget', // Base ID
|
48 |
-
__( 'Youtube Channel Gallery', 'youtube-channel-gallery' ), // Name
|
49 |
-
array( 'description' => __( 'Show a youtube video and a gallery of thumbnails for a youtube channel', 'youtube-channel-gallery' ), ) // Args
|
50 |
-
);
|
51 |
-
}
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
public function widget( $args, $instance ) {
|
57 |
|
58 |
-
|
59 |
-
$this->register_scripts_and_styles();
|
60 |
|
61 |
-
|
62 |
-
|
|
|
63 |
|
64 |
-
echo $before_widget;
|
65 |
-
if ( ! empty( $title ) ){
|
66 |
-
echo $before_title . $title . $after_title;
|
67 |
-
}
|
68 |
|
69 |
-
echo $this->ytchag_rss_markup($instance);
|
70 |
|
71 |
-
|
72 |
-
|
|
|
|
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
*/
|
77 |
-
public function update( $new_instance, $old_instance ) {
|
78 |
-
$instance = $old_instance;
|
79 |
-
$instance['title'] = strip_tags( $new_instance['title'] );
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
$instance['ytchag_user'] = strip_tags( $new_instance['ytchag_user'] );
|
84 |
-
$instance['ytchag_feed_order'] = strip_tags( $new_instance['ytchag_feed_order'] );
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
$
|
89 |
-
$instance['ytchag_theme'] = strip_tags( $new_instance['ytchag_theme'] );
|
90 |
-
$instance['ytchag_color'] = strip_tags( $new_instance['ytchag_color'] );
|
91 |
-
$instance['ytchag_quality'] = strip_tags( $new_instance['ytchag_quality'] );
|
92 |
-
$instance['ytchag_autoplay'] = strip_tags( $new_instance['ytchag_autoplay'] );
|
93 |
-
$instance['ytchag_rel'] = strip_tags( $new_instance['ytchag_rel'] );
|
94 |
-
$instance['ytchag_showinfo'] = strip_tags( $new_instance['ytchag_showinfo'] );
|
95 |
-
|
96 |
-
// Thumbnail options
|
97 |
-
$instance['ytchag_maxitems'] = strip_tags( $new_instance['ytchag_maxitems'] );
|
98 |
-
$instance['ytchag_thumb_width'] = strip_tags( $new_instance['ytchag_thumb_width'] );
|
99 |
-
$instance['ytchag_thumb_ratio'] = strip_tags( $new_instance['ytchag_thumb_ratio'] );
|
100 |
-
$instance['ytchag_thumb_columns'] = strip_tags( $new_instance['ytchag_thumb_columns'] );
|
101 |
-
$instance['ytchag_title'] = strip_tags( $new_instance['ytchag_title'] );
|
102 |
-
$instance['ytchag_description'] = strip_tags( $new_instance['ytchag_description'] );
|
103 |
-
$instance['ytchag_thumbnail_alignment'] = strip_tags( $new_instance['ytchag_thumbnail_alignment'] );
|
104 |
-
$instance['ytchag_description_words_number'] = strip_tags( $new_instance['ytchag_description_words_number'] );
|
105 |
-
|
106 |
-
// Link options
|
107 |
-
$instance['ytchag_link'] = $new_instance['ytchag_link'];
|
108 |
-
$instance['ytchag_link_tx'] = strip_tags( $new_instance['ytchag_link_tx'] );
|
109 |
-
$instance['ytchag_link_window'] = strip_tags( $new_instance['ytchag_link_window'] );
|
110 |
-
|
111 |
-
return $instance;
|
112 |
}
|
113 |
|
114 |
-
|
115 |
-
* Back-end widget form.
|
116 |
-
*/
|
117 |
-
public function form( $instance ) {
|
118 |
-
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
119 |
|
120 |
-
|
121 |
-
|
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 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
|
136 |
// Thumbnail options
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
153 |
<div class="ytchg">
|
154 |
<p>
|
155 |
-
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'youtube-channel-gallery' ); ?></label>
|
156 |
<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 ); ?>" />
|
157 |
</p>
|
158 |
|
@@ -177,7 +216,7 @@
|
|
177 |
// locate the widget block
|
178 |
widget = $('input.widget-id[value="' + request['widget-id'] + '"]').parents('.widget');
|
179 |
|
180 |
-
// trigger manual save, if this was the save request
|
181 |
// and if we didn't get the form html response (the wp bug)
|
182 |
if(!XMLHttpRequest.responseText)
|
183 |
wpWidgets.save(widget, 0, 1, 0);
|
@@ -207,7 +246,7 @@
|
|
207 |
$('#tabs-<?php echo $this->id; ?> > div').slideUp('fast');
|
208 |
$(currentTab).slideDown('fast');
|
209 |
}
|
210 |
-
return false;
|
211 |
});
|
212 |
|
213 |
|
@@ -218,16 +257,16 @@
|
|
218 |
|
219 |
$('#tabs-<?php echo $this->id; ?>-3 .ytchg-tit-desc a').click(function(){
|
220 |
if(!$(this).parent().parent().hasClass('active')){
|
221 |
-
slide_title_description ( 'slideDown' );
|
222 |
} else{
|
223 |
-
slide_title_description ( 'slideUp' );
|
224 |
}
|
225 |
return false;
|
226 |
});
|
227 |
|
228 |
|
229 |
function slide_title_description ( action ){
|
230 |
-
if(action === 'slideDown'){
|
231 |
$('#tabs-<?php echo $this->id; ?>-3 .ytchg-title-and-description').slideDown('fast');
|
232 |
$('#tabs-<?php echo $this->id; ?>-3 fieldset.ytchg-field-tit-desc').addClass('ytchg-fieldborder active');
|
233 |
} else if(action === 'slideUp'){
|
@@ -260,15 +299,15 @@
|
|
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 |
});
|
@@ -286,12 +325,12 @@
|
|
286 |
</ul>
|
287 |
|
288 |
|
289 |
-
<?php
|
290 |
-
|
291 |
Feed Tab
|
292 |
--------------------
|
293 |
*/
|
294 |
-
|
295 |
<div id="tabs-<?php echo $this->id; ?>-1" class="ytchgtabs-content">
|
296 |
|
297 |
<p>
|
@@ -316,22 +355,29 @@
|
|
316 |
</select>
|
317 |
</p>
|
318 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
</div>
|
320 |
|
321 |
|
322 |
-
<?php
|
323 |
-
|
324 |
Player Tab
|
325 |
--------------------
|
326 |
*/
|
327 |
-
|
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' ); ?>">
|
@@ -358,7 +404,7 @@
|
|
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>
|
364 |
<option value="hd1080"<?php selected( $instance['ytchag_quality'], 'hd1080' ); ?>><?php _e( 'hd1080', 'youtube-channel-gallery' ); ?></option>
|
@@ -367,39 +413,50 @@
|
|
367 |
<option value="medium"<?php selected( $instance['ytchag_quality'], 'medium' ); ?>><?php _e( 'medium', 'youtube-channel-gallery' ); ?></option>
|
368 |
<option value="small"<?php selected( $instance['ytchag_quality'], 'small' ); ?>><?php _e( 'small', 'youtube-channel-gallery' ); ?></option>
|
369 |
</select>
|
|
|
370 |
</p>
|
371 |
-
|
372 |
-
<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' ); ?>" />
|
373 |
-
<label for="<?php echo $this->get_field_id( 'ytchag_autoplay' ); ?>"><?php _e('Autoplay', 'youtube-channel-gallery'); ?></label>
|
374 |
|
375 |
<br>
|
376 |
|
377 |
-
<input class="checkbox" type="checkbox" <?php checked( (bool) $instance['
|
378 |
-
<label for="<?php echo $this->get_field_id( '
|
|
|
379 |
|
380 |
<br>
|
381 |
|
382 |
-
<input class="checkbox" type="checkbox" <?php checked( (bool) $instance['
|
383 |
-
<label for="<?php echo $this->get_field_id( '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
|
385 |
</div>
|
386 |
|
387 |
|
388 |
-
<?php
|
389 |
-
|
390 |
Thumbnails Tab
|
391 |
--------------------
|
392 |
*/
|
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 |
-
|
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>
|
@@ -410,7 +467,7 @@
|
|
410 |
<option value="16x9"<?php selected( $instance['ytchag_thumb_ratio'], '16x9' ); ?>><?php _e( 'Widescreen (16x9)', 'youtube-channel-gallery' ); ?></option>
|
411 |
</select>
|
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 ); ?>" />
|
@@ -419,19 +476,19 @@
|
|
419 |
<p>
|
420 |
<fieldset class="ytchg-field-tit-desc">
|
421 |
<legend class="ytchg-tit-desc">
|
422 |
-
<a href="#"><?php _e('Show title or description', 'youtube-channel-gallery'); ?></a>
|
423 |
</legend>
|
424 |
|
425 |
<div class="ytchg-title-and-description">
|
426 |
|
427 |
<p>
|
428 |
-
<input class="checkbox ytchg-tit" type="checkbox" <?php checked( (bool) $instance['ytchag_title'], true ); ?> id="<?php echo $this->get_field_id( 'ytchag_title' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_title' ); ?>" />
|
429 |
-
<label for="<?php echo $this->get_field_id( 'ytchag_title' ); ?>"><?php _e('Show title', 'youtube-channel-gallery'); ?></label>
|
430 |
</p>
|
431 |
-
|
432 |
<p>
|
433 |
-
<input class="checkbox ytchg-desc" type="checkbox" <?php checked( (bool) $instance['ytchag_description'], true ); ?> id="<?php echo $this->get_field_id( 'ytchag_description' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_description' ); ?>" />
|
434 |
-
<label for="<?php echo $this->get_field_id( 'ytchag_description' ); ?>"><?php _e('Show description', 'youtube-channel-gallery'); ?></label>
|
435 |
</p>
|
436 |
|
437 |
<p>
|
@@ -446,10 +503,11 @@
|
|
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 |
-
|
|
|
451 |
</div>
|
452 |
-
</fieldset>
|
453 |
</p>
|
454 |
|
455 |
|
@@ -457,12 +515,12 @@
|
|
457 |
</div>
|
458 |
|
459 |
|
460 |
-
<?php
|
461 |
-
|
462 |
Link Tab
|
463 |
--------------------
|
464 |
*/
|
465 |
-
|
466 |
<div id="tabs-<?php echo $this->id; ?>-4">
|
467 |
|
468 |
<p>
|
@@ -471,13 +529,13 @@
|
|
471 |
</p>
|
472 |
|
473 |
<p>
|
474 |
-
<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' ); ?>" />
|
475 |
-
<label for="<?php echo $this->get_field_id( 'ytchag_link' ); ?>"><?php _e('Show link to channel', 'youtube-channel-gallery'); ?></label>
|
476 |
-
|
477 |
</br>
|
478 |
-
|
479 |
-
<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' ); ?>" />
|
480 |
-
<label for="<?php echo $this->get_field_id( 'ytchag_link_window' ); ?>"><?php _e('Open in a new window or tab', 'youtube-channel-gallery'); ?></label>
|
481 |
</p>
|
482 |
|
483 |
</div>
|
@@ -487,464 +545,553 @@
|
|
487 |
|
488 |
</div>
|
489 |
|
490 |
-
<?php
|
491 |
-
|
492 |
|
493 |
|
494 |
-
|
495 |
-
|
496 |
/*--------------------------------------------------*/
|
497 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
498 |
|
499 |
-
|
500 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
501 |
|
502 |
-
|
503 |
-
|
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 |
-
|
508 |
-
$ytchag_video_width = apply_filters('ytchag_video_width', $instance['ytchag_video_width']);
|
509 |
-
$ytchag_ratio = apply_filters('ytchag_ratio', $instance['ytchag_ratio']);
|
510 |
-
$ytchag_theme = apply_filters('ytchag_theme', $instance['ytchag_theme']);
|
511 |
-
$ytchag_color = apply_filters('ytchag_color', $instance['ytchag_color']);
|
512 |
-
$ytchag_quality = apply_filters('ytchag_quality', $instance['ytchag_quality']);
|
513 |
-
$ytchag_autoplay = apply_filters('ytchag_autoplay', $instance['ytchag_autoplay']);
|
514 |
-
$ytchag_rel = apply_filters('ytchag_rel', $instance['ytchag_rel']);
|
515 |
-
$ytchag_showinfo = apply_filters('ytchag_showinfo', $instance['ytchag_showinfo']);
|
516 |
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
$ytchag_description_words_number = apply_filters('ytchag_description_words_number', $instance['ytchag_description_words_number']);
|
526 |
-
|
527 |
-
// Link options
|
528 |
-
$ytchag_link = apply_filters('ytchag_link', $instance['ytchag_link']);
|
529 |
-
$ytchag_link_tx = apply_filters('ytchag_link_tx', $instance['ytchag_link_tx']);
|
530 |
-
$ytchag_link_window = apply_filters('ytchag_link_window', $instance['ytchag_link_window']);
|
531 |
-
//--------------------------------
|
532 |
-
//end $instance variables
|
533 |
-
|
534 |
-
|
535 |
-
//defaults
|
536 |
-
//--------------------------------
|
537 |
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
$ytchag_autoplay = ( $ytchag_autoplay ) ? '&autoplay='. $ytchag_autoplay : ''; //default 0
|
548 |
-
$ytchag_rel = ( $ytchag_rel ) ? '&rel='. $ytchag_rel : '&rel=0'; //default 1
|
549 |
-
$ytchag_showinfo = ( $ytchag_showinfo ) ? '&showinfo='. $ytchag_showinfo : '&showinfo=0'; //default 1
|
550 |
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
$
|
559 |
-
|
560 |
-
$ytchag_description_words_number = ( $ytchag_description_words_number ) ? $ytchag_description_words_number : 10;
|
561 |
-
|
562 |
-
// Link options
|
563 |
-
$ytchag_link = ( $ytchag_link ) ? $ytchag_link : 0;
|
564 |
-
$ytchag_link_tx = ( $ytchag_link_tx ) ? $ytchag_link_tx : __('Show more videos»', 'youtube-channel-gallery');
|
565 |
-
$ytchag_link_window = ( $ytchag_link_window ) ? 'target="_blank"' : 0;
|
566 |
-
//--------------------------------
|
567 |
-
//end defaults
|
568 |
-
|
569 |
-
|
570 |
-
//heights of video and thumbnail
|
571 |
-
//--------------------------------
|
572 |
-
//video height
|
573 |
-
if ($ytchag_ratio == '16x9') {
|
574 |
-
$ytchag_video_heigh = round( ($ytchag_video_width * 9) / 16);
|
575 |
-
} else {
|
576 |
-
$ytchag_video_heigh = round( ($ytchag_video_width * 3) / 4);
|
577 |
}
|
578 |
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
586 |
|
587 |
-
// only if user name inserted
|
588 |
-
if( $ytchag_user ) {
|
589 |
-
|
590 |
|
591 |
-
// YouTube feed types
|
592 |
-
//--------------------------------
|
593 |
-
$youtube_feed_url = 'http://gdata.youtube.com/feeds/api';
|
594 |
-
// links
|
595 |
-
if($ytchag_feed == 'user'){
|
596 |
-
$ytchag_rss_url = $youtube_feed_url . '/users/' . $ytchag_user . '/uploads';
|
597 |
-
$ytchag_link_url = 'http://www.youtube.com/user/' . $ytchag_user;
|
598 |
-
$errorMesagge = __('You must insert a valid YouTube user id.', 'youtube-channel-gallery');
|
599 |
-
}
|
600 |
-
if($ytchag_feed == 'favorites'){
|
601 |
-
$ytchag_rss_url = $youtube_feed_url . '/users/' . $ytchag_user . '/favorites';
|
602 |
-
$ytchag_link_url = 'http://www.youtube.com/user/' . $ytchag_user . '/favorites';
|
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');
|
610 |
-
}
|
611 |
-
|
612 |
-
//RSS Feed
|
613 |
-
include_once(ABSPATH . WPINC . '/feed.php');
|
614 |
|
615 |
-
|
616 |
-
//
|
617 |
-
$
|
618 |
-
|
619 |
-
//
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
|
651 |
-
|
652 |
-
|
653 |
-
if (!empty($items)) {
|
654 |
-
$i = 0;
|
655 |
-
$column = 0;
|
656 |
-
STATIC $plugincount = 0;
|
657 |
-
foreach ( $items as $item ) {
|
658 |
-
$url = $item->get_permalink();
|
659 |
-
$youtubeid = $this->youtubeid($url);
|
660 |
-
$title = $item->get_title();
|
661 |
-
|
662 |
-
//descriptions in playlists are in media:description
|
663 |
-
if ($ytchag_feed == 'playlist') {
|
664 |
-
$media_group = $item->get_item_tags('http://search.yahoo.com/mrss/', 'group');
|
665 |
-
$description = $media_group[0]['child']['http://search.yahoo.com/mrss/']['description'][0]['data'];
|
666 |
-
} else {
|
667 |
-
$description = $item->get_description();
|
668 |
-
}
|
669 |
|
|
|
|
|
|
|
|
|
|
|
|
|
670 |
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
//media:thumbnail tag
|
679 |
-
$media_group = $item->get_item_tags('http://search.yahoo.com/mrss/', 'group');
|
680 |
-
$media_content = $media_group[0]['child']['http://search.yahoo.com/mrss/']['thumbnail'];
|
681 |
-
|
682 |
-
/*
|
683 |
-
// to check order of playlist items
|
684 |
-
$episode = $item->get_item_tags('http://gdata.youtube.com/schemas/2007', 'episode'); //yt
|
685 |
-
$episodecontent = $episode[0]['attribs']['']['number'];
|
686 |
-
if(!$episode){
|
687 |
-
$episode = $item->get_item_tags('http://gdata.youtube.com/schemas/2007', 'position'); //yt
|
688 |
-
$episodecontent = $episode[0]['data'];
|
689 |
-
}
|
690 |
-
//print_r($episodecontent . '-');
|
691 |
-
*/
|
692 |
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
//appropriate thumbnail width
|
699 |
-
$thumbcorrectW = $this->closest($thumbW, $ytchag_thumb_width);
|
700 |
|
701 |
-
|
702 |
-
|
703 |
|
704 |
-
|
705 |
-
|
706 |
|
707 |
|
708 |
-
|
709 |
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
$columnnumber = ' ytc-columns'. $ytchag_thumb_columns;
|
719 |
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
724 |
|
725 |
|
726 |
-
//check if title or description
|
727 |
-
if($ytchag_title || $ytchag_description){
|
728 |
-
$title_and_description_alignment_class = ' ytc-td-' . $ytchag_thumbnail_alignment;
|
729 |
-
} else{
|
730 |
-
$title_and_description_alignment_class = '';
|
731 |
-
}
|
732 |
|
|
|
|
|
733 |
|
734 |
-
|
735 |
-
|
|
|
|
|
736 |
|
737 |
-
|
738 |
-
|
739 |
-
//count the plugin occurrences on page
|
740 |
-
$plugincount++;
|
741 |
|
742 |
-
|
743 |
-
|
744 |
|
745 |
-
} // if player end
|
746 |
-
$i++;
|
747 |
|
748 |
|
|
|
749 |
|
750 |
-
|
|
|
751 |
|
752 |
-
|
753 |
-
|
|
|
754 |
|
755 |
-
|
756 |
-
|
757 |
-
|
|
|
758 |
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
|
|
763 |
|
764 |
-
$title_and_description_content.= '</div>';
|
765 |
-
} else{
|
766 |
-
$title_and_description_content = '';
|
767 |
-
}
|
768 |
-
//end title and description content
|
769 |
|
|
|
|
|
|
|
|
|
770 |
|
771 |
-
|
772 |
-
|
773 |
-
$content.= "\n\n" .'<div class="ytccf ytc-row ytc-r-' . $rowcount . $row_oddeven . ' ">' . "\n\n";
|
774 |
-
}
|
775 |
|
776 |
-
|
777 |
-
$content.= "\n\n" . ' <li class="ytccell-' . $column . $columnlastfirst . '">';
|
778 |
|
779 |
-
|
|
|
780 |
|
781 |
-
|
782 |
-
$content.= $title_and_description_content;
|
783 |
|
784 |
-
|
|
|
|
|
|
|
|
|
785 |
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
$content.= '</a>';
|
790 |
-
$content.= '</div>';
|
791 |
|
792 |
-
|
793 |
-
$content.= $title_and_description_content;
|
794 |
-
}
|
795 |
|
796 |
-
|
797 |
|
798 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
799 |
|
800 |
-
|
801 |
-
if($ytchag_thumb_columns !=0 && $column%$ytchag_thumb_columns == 0 ){
|
802 |
-
$column = 0;
|
803 |
-
$columnlastfirst = ' ytccell-last';
|
804 |
-
$content.= '</div>' . "\n\n\n";
|
805 |
-
}
|
806 |
-
|
807 |
-
} //foreach end
|
808 |
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
|
|
|
|
813 |
|
814 |
-
|
815 |
|
816 |
-
|
817 |
-
if( $ytchag_link) {
|
818 |
-
$content.= '<a href="' . $ytchag_link_url . '" class="ytcmore" ' .$ytchag_link_window. ' >' . $ytchag_link_tx . '</a>';
|
819 |
-
}
|
820 |
-
}
|
821 |
-
} else {
|
822 |
-
$content= '<p class="empty">' . $errorMesagge . '</p>';
|
823 |
-
} // end check user name
|
824 |
|
825 |
-
// user name not inserted
|
826 |
-
} else {
|
827 |
-
$content= '<p class="empty">' . __('There is no video to show.', 'youtube-channel-gallery') . '</p>';
|
828 |
-
}
|
829 |
-
|
830 |
-
return $content;
|
831 |
|
832 |
-
}//ytchag_rss_markup
|
833 |
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
parse_str($url_string, $args);
|
838 |
-
return isset($args['v']) ? $args['v'] : false;
|
839 |
-
}//youtubeid
|
840 |
|
|
|
|
|
|
|
|
|
841 |
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
if ($
|
|
|
|
|
|
|
846 |
}
|
847 |
-
return end($array); // or return NULL;
|
848 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
849 |
}
|
850 |
|
851 |
-
|
852 |
-
|
853 |
-
wp_enqueue_script('jquery');
|
854 |
-
wp_enqueue_script('youtube_player_api', 'http://www.youtube.com/player_api', false, false, true);
|
855 |
-
wp_enqueue_script('youtube-channel-gallery', plugins_url('/scripts.js', __FILE__), false, false, true);
|
856 |
-
wp_enqueue_style('youtube-channel-gallery', plugins_url('/styles.css', __FILE__), false, false, 'all');
|
857 |
-
}//register_scripts_and_styles
|
858 |
|
859 |
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
|
866 |
-
|
867 |
-
/* Shortcode
|
868 |
-
/*--------------------------------------------------*/
|
869 |
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
'theme' => '',
|
886 |
-
'color' => '',
|
887 |
-
'quality' => '',
|
888 |
-
'autoplay' => '',
|
889 |
-
'rel' => '',
|
890 |
-
'showinfo' => '',
|
891 |
-
|
892 |
-
// Thumbnail options
|
893 |
-
'maxitems' => '',
|
894 |
-
'thumbwidth' => '',
|
895 |
-
'thumbratio' => '',
|
896 |
-
'thumbcolumns' => '',
|
897 |
-
'title' => '',
|
898 |
-
'description' => '',
|
899 |
-
'thumbnail_alignment' => '',
|
900 |
-
'descriptionwordsnumber' => '',
|
901 |
-
|
902 |
-
// Link options
|
903 |
-
'link' => '',
|
904 |
-
'link_tx' => '',
|
905 |
-
'link_window' => ''
|
906 |
-
|
907 |
-
), $atts ) );
|
908 |
|
909 |
-
|
910 |
-
|
911 |
-
$instance['ytchag_user'] = $user;
|
912 |
-
$instance['ytchag_feed_order'] = $feedorder;
|
913 |
|
914 |
-
|
915 |
-
$
|
916 |
-
|
917 |
-
$instance['ytchag_theme'] = $theme;
|
918 |
-
$instance['ytchag_color'] = $color;
|
919 |
-
$instance['ytchag_quality'] = $quality;
|
920 |
-
$instance['ytchag_autoplay'] = $autoplay;
|
921 |
-
$instance['ytchag_rel'] = $rel;
|
922 |
-
$instance['ytchag_showinfo'] = $showinfo;
|
923 |
-
|
924 |
-
// Thumbnail options
|
925 |
-
$instance['ytchag_maxitems'] = $maxitems;
|
926 |
-
$instance['ytchag_thumb_width'] = $thumbwidth;
|
927 |
-
$instance['ytchag_thumb_ratio'] = $thumbratio;
|
928 |
-
$instance['ytchag_thumb_columns'] = $thumbcolumns;
|
929 |
-
$instance['ytchag_title'] = $title;
|
930 |
-
$instance['ytchag_description'] = $description;
|
931 |
-
$instance['ytchag_thumbnail_alignment'] = $thumbnail_alignment;
|
932 |
-
$instance['ytchag_description_words_number'] = $descriptionwordsnumber;
|
933 |
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
$instance['ytchag_link_window'] = $link_window;
|
938 |
|
|
|
|
|
939 |
|
940 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
941 |
|
942 |
-
} // YoutubeChannelGallery_Shortcode
|
943 |
|
|
|
|
|
|
|
|
|
|
|
944 |
|
945 |
-
|
|
|
|
|
946 |
|
947 |
-
|
948 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
949 |
|
950 |
?>
|
1 |
<?php
|
2 |
+
/*
|
3 |
Plugin Name: Youtube Channel Gallery
|
4 |
Plugin URI: http://www.poselab.com/
|
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.8
|
9 |
License: GPL2
|
10 |
+
|
11 |
Copyright 2013 Javier Gómez Pose (email : javierpose@gmail.com)
|
12 |
|
13 |
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License, version 2, as
|
15 |
published by the Free Software Foundation.
|
16 |
|
17 |
This program is distributed in the hope that it will be useful,
|
24 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
*/
|
26 |
|
27 |
+
/**
|
28 |
+
* widget class.
|
29 |
+
*/
|
30 |
+
class YoutubeChannelGallery_Widget extends WP_Widget {
|
31 |
|
32 |
/**
|
33 |
+
* Register widget with WordPress.
|
34 |
*/
|
35 |
+
public function __construct() {
|
36 |
|
37 |
+
//localization
|
38 |
+
load_plugin_textdomain( 'youtube-channel-gallery', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
39 |
+
add_shortcode( 'Youtube_Channel_Gallery', array( $this, 'YoutubeChannelGallery_Shortcode' ) );
|
|
|
40 |
|
41 |
+
//load admin scripts
|
42 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts_and_styles' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
+
parent::__construct(
|
45 |
+
'youtubechannelgallery_widget', // Base ID
|
46 |
+
__( 'Youtube Channel Gallery', 'youtube-channel-gallery' ), // Name
|
|
|
47 |
|
48 |
+
array( 'classname' => 'youtubechannelgallery', 'description' => __( 'Show a youtube video and a gallery of thumbnails for a youtube channel', 'youtube-channel-gallery' ), ), // Args
|
|
|
49 |
|
50 |
+
array( 'width' => 260)
|
51 |
+
);
|
52 |
+
}
|
53 |
|
|
|
|
|
|
|
|
|
54 |
|
|
|
55 |
|
56 |
+
/**
|
57 |
+
* Front-end display of widget.
|
58 |
+
*/
|
59 |
+
public function widget( $args, $instance ) {
|
60 |
|
61 |
+
// Load JavaScript and stylesheets
|
62 |
+
$this->register_scripts_and_styles();
|
|
|
|
|
|
|
|
|
63 |
|
64 |
+
extract( $args );
|
65 |
+
$title = apply_filters( 'widget_title', $instance['title'] );
|
|
|
|
|
66 |
|
67 |
+
echo $before_widget;
|
68 |
+
if ( ! empty( $title ) ) {
|
69 |
+
echo $before_title . $title . $after_title;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
}
|
71 |
|
72 |
+
echo $this->ytchag_rss_markup( $instance );
|
|
|
|
|
|
|
|
|
73 |
|
74 |
+
echo $after_widget;
|
75 |
+
}
|
|
|
|
|
76 |
|
77 |
+
/**
|
78 |
+
* Sanitize widget form values as they are saved.
|
79 |
+
*/
|
80 |
+
public function update( $new_instance, $old_instance ) {
|
81 |
+
$instance = $old_instance;
|
82 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
83 |
+
|
84 |
+
// Feed options
|
85 |
+
$instance['ytchag_feed'] = strip_tags( $new_instance['ytchag_feed'] );
|
86 |
+
$instance['ytchag_user'] = strip_tags( $new_instance['ytchag_user'] );
|
87 |
+
$instance['ytchag_feed_order'] = strip_tags( $new_instance['ytchag_feed_order'] );
|
88 |
+
$instance['ytchag_cache_time'] = strip_tags( $new_instance['ytchag_cache_time'] );
|
89 |
+
$instance['ytchag_cache'] = strip_tags( $new_instance['ytchag_cache'] );
|
90 |
+
|
91 |
+
// Player options
|
92 |
+
$instance['ytchag_ratio'] = strip_tags( $new_instance['ytchag_ratio'] );
|
93 |
+
$instance['ytchag_theme'] = strip_tags( $new_instance['ytchag_theme'] );
|
94 |
+
$instance['ytchag_color'] = strip_tags( $new_instance['ytchag_color'] );
|
95 |
+
$instance['ytchag_quality'] = strip_tags( $new_instance['ytchag_quality'] );
|
96 |
+
$instance['ytchag_autoplay'] = strip_tags( $new_instance['ytchag_autoplay'] );
|
97 |
+
$instance['ytchag_modestbranding'] = strip_tags( $new_instance['ytchag_modestbranding'] );
|
98 |
+
$instance['ytchag_rel'] = strip_tags( $new_instance['ytchag_rel'] );
|
99 |
+
$instance['ytchag_showinfo'] = strip_tags( $new_instance['ytchag_showinfo'] );
|
100 |
+
|
101 |
+
// Thumbnail options
|
102 |
+
$instance['ytchag_maxitems'] = strip_tags( $new_instance['ytchag_maxitems'] );
|
103 |
+
$instance['ytchag_thumb_width'] = strip_tags( $new_instance['ytchag_thumb_width'] );
|
104 |
+
$instance['ytchag_thumb_ratio'] = strip_tags( $new_instance['ytchag_thumb_ratio'] );
|
105 |
+
$instance['ytchag_thumb_columns'] = strip_tags( $new_instance['ytchag_thumb_columns'] );
|
106 |
+
$instance['ytchag_title'] = strip_tags( $new_instance['ytchag_title'] );
|
107 |
+
$instance['ytchag_description'] = strip_tags( $new_instance['ytchag_description'] );
|
108 |
+
$instance['ytchag_thumbnail_alignment'] = strip_tags( $new_instance['ytchag_thumbnail_alignment'] );
|
109 |
+
$instance['ytchag_description_words_number'] = strip_tags( $new_instance['ytchag_description_words_number'] );
|
110 |
+
|
111 |
+
// Link options
|
112 |
+
$instance['ytchag_link'] = $new_instance['ytchag_link'];
|
113 |
+
$instance['ytchag_link_tx'] = strip_tags( $new_instance['ytchag_link_tx'] );
|
114 |
+
$instance['ytchag_link_window'] = strip_tags( $new_instance['ytchag_link_window'] );
|
115 |
+
|
116 |
+
return $instance;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Back-end widget form.
|
121 |
+
*/
|
122 |
+
public function form( $instance ) {
|
123 |
+
$defaults = array(
|
124 |
+
'title' => 'Videos',
|
125 |
+
|
126 |
+
// Feed options
|
127 |
+
'ytchag_feed' => 'user',
|
128 |
+
'ytchag_user' => 'youtube',
|
129 |
+
'ytchag_feed_order' => 'asc',
|
130 |
+
'ytchag_cache_time' => '24',
|
131 |
+
'ytchag_cache' => '1',
|
132 |
|
133 |
// Player options
|
134 |
+
'ytchag_ratio' => '4x3',
|
135 |
+
'ytchag_theme' => 'dark',
|
136 |
+
'ytchag_color' => 'red',
|
137 |
+
'ytchag_quality' => 'default',
|
138 |
+
'ytchag_autoplay' => '',
|
139 |
+
'ytchag_modestbranding' => '',
|
140 |
+
'ytchag_rel' => '',
|
141 |
+
'ytchag_showinfo' => '',
|
142 |
|
143 |
// Thumbnail options
|
144 |
+
'ytchag_maxitems' => '9',
|
145 |
+
'ytchag_thumb_width' => '90',
|
146 |
+
'ytchag_thumb_ratio' => '4x3',
|
147 |
+
'ytchag_thumb_columns' => '3',
|
148 |
+
'ytchag_title' => '',
|
149 |
+
'ytchag_description' => '',
|
150 |
+
'ytchag_thumbnail_alignment' => 'top',
|
151 |
+
'ytchag_description_words_number' => '',
|
152 |
+
);
|
153 |
+
|
154 |
+
$instance = wp_parse_args( (array) $instance, $defaults );
|
155 |
+
|
156 |
+
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
157 |
+
|
158 |
+
// Feed options
|
159 |
+
$ytchag_feed = isset( $instance['ytchag_feed'] ) ? esc_attr( $instance['ytchag_feed'] ) : '';
|
160 |
+
$ytchag_user = isset( $instance['ytchag_user'] ) ? esc_attr( $instance['ytchag_user'] ) : ''; //left ytchag_user variable name for backward compatibility
|
161 |
+
$ytchag_feed_order = isset( $instance['ytchag_feed_order'] ) ? esc_attr( $instance['ytchag_feed_order'] ) : '';
|
162 |
+
$ytchag_cache_time = isset( $instance['ytchag_cache_time'] ) ? esc_attr( $instance['ytchag_cache_time'] ) : '';
|
163 |
+
//$ytchag_cache = isset( $instance['ytchag_cache'] ) ? esc_attr( $instance['ytchag_cache'] ) : '';
|
164 |
+
|
165 |
+
// Player options
|
166 |
+
$ytchag_ratio = isset( $instance['ytchag_ratio'] ) ? esc_attr( $instance['ytchag_ratio'] ) : '';
|
167 |
+
$ytchag_theme = isset( $instance['ytchag_theme'] ) ? esc_attr( $instance['ytchag_theme'] ) : '';
|
168 |
+
$ytchag_color = isset( $instance['ytchag_color'] ) ? esc_attr( $instance['ytchag_color'] ) : '';
|
169 |
+
$ytchag_quality = isset( $instance['ytchag_quality'] ) ? esc_attr( $instance['ytchag_quality'] ) : '';
|
170 |
+
$ytchag_autoplay = isset( $instance['ytchag_autoplay'] ) ? esc_attr( $instance['ytchag_autoplay'] ) : '';
|
171 |
+
$ytchag_modestbranding = isset( $instance['ytchag_modestbranding'] ) ? esc_attr( $instance['ytchag_modestbranding'] ) : '';
|
172 |
+
$ytchag_rel = isset( $instance['ytchag_rel'] ) ? esc_attr( $instance['ytchag_rel'] ) : '';
|
173 |
+
$ytchag_showinfo = isset( $instance['ytchag_showinfo'] ) ? esc_attr( $instance['ytchag_showinfo'] ) : '';
|
174 |
+
|
175 |
+
// Thumbnail options
|
176 |
+
$ytchag_maxitems = isset( $instance['ytchag_maxitems'] ) ? esc_attr( $instance['ytchag_maxitems'] ) : '';
|
177 |
+
$ytchag_thumb_width = isset( $instance['ytchag_thumb_width'] ) ? esc_attr( $instance['ytchag_thumb_width'] ) : '';
|
178 |
+
$ytchag_thumb_ratio = isset( $instance['ytchag_thumb_ratio'] ) ? esc_attr( $instance['ytchag_thumb_ratio'] ) : '';
|
179 |
+
$ytchag_thumb_columns = isset( $instance['ytchag_thumb_columns'] ) ? esc_attr( $instance['ytchag_thumb_columns'] ) : '';
|
180 |
+
$ytchag_title = isset( $instance['ytchag_title'] ) ? esc_attr( $instance['ytchag_title'] ) : '';
|
181 |
+
$ytchag_description = isset( $instance['ytchag_description'] ) ? esc_attr( $instance['ytchag_description'] ) : '';
|
182 |
+
$ytchag_thumbnail_alignment = isset( $instance['ytchag_thumbnail_alignment'] ) ? esc_attr( $instance['ytchag_thumbnail_alignment'] ) : '';
|
183 |
+
$ytchag_description_words_number = isset( $instance['ytchag_description_words_number'] ) ? esc_attr( $instance['ytchag_description_words_number'] ) : '';
|
184 |
+
|
185 |
+
// Link options
|
186 |
+
$ytchag_link = isset( $instance['ytchag_link'] ) ? esc_attr( $instance['ytchag_link'] ) : 0;
|
187 |
+
$ytchag_link_tx = isset( $instance['ytchag_link_tx'] ) ? esc_attr( $instance['ytchag_link_tx'] ) : '';
|
188 |
+
$ytchag_link_window = isset( $instance['ytchag_link_window'] ) ? esc_attr( $instance['ytchag_link_window'] ) : 0;
|
189 |
+
|
190 |
+
?>
|
191 |
|
192 |
<div class="ytchg">
|
193 |
<p>
|
194 |
+
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'youtube-channel-gallery' ); ?></label>
|
195 |
<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 ); ?>" />
|
196 |
</p>
|
197 |
|
216 |
// locate the widget block
|
217 |
widget = $('input.widget-id[value="' + request['widget-id'] + '"]').parents('.widget');
|
218 |
|
219 |
+
// trigger manual save, if this was the save request
|
220 |
// and if we didn't get the form html response (the wp bug)
|
221 |
if(!XMLHttpRequest.responseText)
|
222 |
wpWidgets.save(widget, 0, 1, 0);
|
246 |
$('#tabs-<?php echo $this->id; ?> > div').slideUp('fast');
|
247 |
$(currentTab).slideDown('fast');
|
248 |
}
|
249 |
+
return false;
|
250 |
});
|
251 |
|
252 |
|
257 |
|
258 |
$('#tabs-<?php echo $this->id; ?>-3 .ytchg-tit-desc a').click(function(){
|
259 |
if(!$(this).parent().parent().hasClass('active')){
|
260 |
+
slide_title_description ( 'slideDown' );
|
261 |
} else{
|
262 |
+
slide_title_description ( 'slideUp' );
|
263 |
}
|
264 |
return false;
|
265 |
});
|
266 |
|
267 |
|
268 |
function slide_title_description ( action ){
|
269 |
+
if(action === 'slideDown'){
|
270 |
$('#tabs-<?php echo $this->id; ?>-3 .ytchg-title-and-description').slideDown('fast');
|
271 |
$('#tabs-<?php echo $this->id; ?>-3 fieldset.ytchg-field-tit-desc').addClass('ytchg-fieldborder active');
|
272 |
} else if(action === 'slideUp'){
|
299 |
|
300 |
function changeFeedType (){
|
301 |
if($(feedSelect + ' option:selected').val() === 'user'){
|
302 |
+
$(userLabel).text('<?php _e( 'YouTube user id:', 'youtube-channel-gallery' ); ?>');
|
303 |
$(feedOrder).slideUp('fast');
|
304 |
}
|
305 |
/*if($(feedSelect + ' option:selected').val() === 'userfav'){
|
306 |
+
$(userLabel).text('<?php _e( 'YouTube user id:', 'youtube-channel-gallery' ); ?>');
|
307 |
}*/
|
308 |
if($(feedSelect + ' option:selected').val() === 'playlist'){
|
309 |
$(userLabel).text('<?php _e( 'YouTube playlist id:', 'youtube-channel-gallery' ); ?>');
|
310 |
+
$(feedOrder).slideDown('fast');
|
311 |
}
|
312 |
}
|
313 |
});
|
325 |
</ul>
|
326 |
|
327 |
|
328 |
+
<?php
|
329 |
+
/*
|
330 |
Feed Tab
|
331 |
--------------------
|
332 |
*/
|
333 |
+
?>
|
334 |
<div id="tabs-<?php echo $this->id; ?>-1" class="ytchgtabs-content">
|
335 |
|
336 |
<p>
|
355 |
</select>
|
356 |
</p>
|
357 |
|
358 |
+
<p class="<?php echo $this->get_field_id( 'ytchag_cache_time' ); ?>">
|
359 |
+
<label for="<?php echo $this->get_field_id( 'ytchag_cache_time' ); ?>"><?php _e( 'Cache time (hours):', 'youtube-channel-gallery' ); ?></label>
|
360 |
+
<input class="widefat wideinfo" id="<?php echo $this->get_field_id( 'ytchag_cache_time' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_cache_time' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_cache_time ); ?>" />
|
361 |
+
<span class="ytchag_info" title="<?php _e( 'Hours that RSS data is saved in database, to not make a request every time the page is displayed. Assign this value according to how often you upgrade your playlist in YouTube.', 'youtube-channel-gallery' ); ?>">?</span>
|
362 |
+
</p>
|
363 |
+
|
364 |
+
<p class="<?php echo $this->get_field_id( 'ytchag_cache' ); ?>">
|
365 |
+
<input class="checkbox" type="checkbox" value="1" <?php checked( (bool) $instance['ytchag_cache'], true, true ); ?> id="<?php echo $this->get_field_id( 'ytchag_cache' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_cache' ); ?>" />
|
366 |
+
<label for="<?php echo $this->get_field_id( 'ytchag_cache' ); ?>"><?php _e( 'Activate cache', 'youtube-channel-gallery' ); ?></label>
|
367 |
+
<span class="ytchag_info" title="<?php _e( 'If you disable this field the cache will be deleted and will not be used. This is useful to refresh immediately the YouTube RSS used by the plugin. Reenable the cache when the gallery shows the changes you made in your youtube account.', 'youtube-channel-gallery' ); ?>">?</span>
|
368 |
+
</p>
|
369 |
+
|
370 |
</div>
|
371 |
|
372 |
|
373 |
+
<?php
|
374 |
+
/*
|
375 |
Player Tab
|
376 |
--------------------
|
377 |
*/
|
378 |
+
?>
|
379 |
<div id="tabs-<?php echo $this->id; ?>-2" class="ytchgtabs-content">
|
380 |
|
|
|
|
|
|
|
|
|
|
|
381 |
<p>
|
382 |
<label for="<?php echo $this->get_field_id( 'ytchag_ratio' ); ?>"><?php _e( 'Aspect ratio:', 'youtube-channel-gallery' ); ?></label>
|
383 |
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_ratio' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_ratio' ); ?>">
|
404 |
|
405 |
<p>
|
406 |
<label for="<?php echo $this->get_field_id( 'ytchag_quality' ); ?>"><?php _e( 'Video quality:', 'youtube-channel-gallery' ); ?></label>
|
407 |
+
<select class="widefat wideinfo" id="<?php echo $this->get_field_id( 'ytchag_quality' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_quality' ); ?>">
|
408 |
<option value="default"<?php selected( $instance['ytchag_quality'], 'default' ); ?>><?php _e( 'default', 'youtube-channel-gallery' ); ?></option>
|
409 |
<option value="highres"<?php selected( $instance['ytchag_quality'], 'highres' ); ?>><?php _e( 'highres', 'youtube-channel-gallery' ); ?></option>
|
410 |
<option value="hd1080"<?php selected( $instance['ytchag_quality'], 'hd1080' ); ?>><?php _e( 'hd1080', 'youtube-channel-gallery' ); ?></option>
|
413 |
<option value="medium"<?php selected( $instance['ytchag_quality'], 'medium' ); ?>><?php _e( 'medium', 'youtube-channel-gallery' ); ?></option>
|
414 |
<option value="small"<?php selected( $instance['ytchag_quality'], 'small' ); ?>><?php _e( 'small', 'youtube-channel-gallery' ); ?></option>
|
415 |
</select>
|
416 |
+
<span class="ytchag_info" title="<?php _e( 'Default value enables YouTube to select the most appropriate playback quality. If you select a quality level that is not available for the video, then the quality will be set to the next lowest level that is available.', 'youtube-channel-gallery' ); ?>">?</span>
|
417 |
</p>
|
418 |
+
|
419 |
+
<input class="checkbox" type="checkbox" value="1" <?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' ); ?>" />
|
420 |
+
<label for="<?php echo $this->get_field_id( 'ytchag_autoplay' ); ?>"><?php _e( 'Autoplay', 'youtube-channel-gallery' ); ?></label>
|
421 |
|
422 |
<br>
|
423 |
|
424 |
+
<input class="checkbox" type="checkbox" value="1" <?php checked( (bool) $instance['ytchag_modestbranding'], true ); ?> id="<?php echo $this->get_field_id( 'ytchag_modestbranding' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_modestbranding' ); ?>" />
|
425 |
+
<label for="<?php echo $this->get_field_id( 'ytchag_modestbranding' ); ?>"><?php _e( 'Show YouTube logo', 'youtube-channel-gallery' ); ?></label>
|
426 |
+
<span class="ytchag_info" title="<?php _e( 'Activate this field to show the YouTube logo in the control bar. Setting the color parameter to white will show the YouTube logo in the control bar.', 'youtube-channel-gallery' ); ?>">?</span>
|
427 |
|
428 |
<br>
|
429 |
|
430 |
+
<input class="checkbox" type="checkbox" value="1" <?php checked( (bool) $instance['ytchag_rel'], true ); ?> id="<?php echo $this->get_field_id( 'ytchag_rel' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_rel' ); ?>" />
|
431 |
+
<label for="<?php echo $this->get_field_id( 'ytchag_rel' ); ?>"><?php _e( 'Show related videos', 'youtube-channel-gallery' ); ?></label>
|
432 |
+
<span class="ytchag_info" title="<?php _e( 'Activate this field to show related videos when playback of the video ends.', 'youtube-channel-gallery' ); ?>">?</span>
|
433 |
+
|
434 |
+
<br>
|
435 |
+
|
436 |
+
<input class="checkbox" type="checkbox" value="1" <?php checked( (bool) $instance['ytchag_showinfo'], true ); ?> id="<?php echo $this->get_field_id( 'ytchag_showinfo' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_showinfo' ); ?>" />
|
437 |
+
<label for="<?php echo $this->get_field_id( 'ytchag_showinfo' ); ?>"><?php _e( 'Show info', 'youtube-channel-gallery' ); ?></label>
|
438 |
+
<span class="ytchag_info" title="<?php _e( 'Activate this field to display information like the video title and uploader before the video starts playing.', 'youtube-channel-gallery' ); ?>">?</span>
|
439 |
|
440 |
</div>
|
441 |
|
442 |
|
443 |
+
<?php
|
444 |
+
/*
|
445 |
Thumbnails Tab
|
446 |
--------------------
|
447 |
*/
|
448 |
+
?>
|
449 |
<div id="tabs-<?php echo $this->id; ?>-3">
|
450 |
<p>
|
451 |
<label for="<?php echo $this->get_field_id( 'ytchag_maxitems' ); ?>"><?php _e( 'Number of videos to show:', 'youtube-channel-gallery' ); ?></label>
|
452 |
+
<input class="widefat wideinfo" 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 ); ?>" />
|
453 |
+
<span class="ytchag_info" title="<?php _e( 'The plugin can display a maximum of 50 videos. This limitation will change in a future release.', 'youtube-channel-gallery' ); ?>">?</span>
|
454 |
+
</p>
|
455 |
+
|
456 |
<p>
|
457 |
<label for="<?php echo $this->get_field_id( 'ytchag_thumb_width' ); ?>"><?php _e( 'Thumbnail width:', 'youtube-channel-gallery' ); ?></label>
|
458 |
+
<input class="widefat wideinfo" 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 ); ?>" />
|
459 |
+
<span class="ytchag_info" title="<?php _e( 'This field is used to assign the appropriate quality of thumbnail images in top and bottom alignments and to assign width to thumbnails in left and right alignments. If the quality of thumbnail images is not enough, insert a larger value. If you are unsure you can assign one of the following values: 120, 320, 480 or 640', 'youtube-channel-gallery' ); ?>">?</span>
|
460 |
</p>
|
461 |
|
462 |
<p>
|
467 |
<option value="16x9"<?php selected( $instance['ytchag_thumb_ratio'], '16x9' ); ?>><?php _e( 'Widescreen (16x9)', 'youtube-channel-gallery' ); ?></option>
|
468 |
</select>
|
469 |
</p>
|
470 |
+
|
471 |
<p>
|
472 |
<label for="<?php echo $this->get_field_id( 'ytchag_thumb_columns' ); ?>"><?php _e( 'Thumbnail columns:', 'youtube-channel-gallery' ); ?></label>
|
473 |
<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 ); ?>" />
|
476 |
<p>
|
477 |
<fieldset class="ytchg-field-tit-desc">
|
478 |
<legend class="ytchg-tit-desc">
|
479 |
+
<a href="#"><?php _e( 'Show title or description', 'youtube-channel-gallery' ); ?></a>
|
480 |
</legend>
|
481 |
|
482 |
<div class="ytchg-title-and-description">
|
483 |
|
484 |
<p>
|
485 |
+
<input class="checkbox ytchg-tit" type="checkbox" value="1" <?php checked( (bool) $instance['ytchag_title'], true ); ?> id="<?php echo $this->get_field_id( 'ytchag_title' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_title' ); ?>" />
|
486 |
+
<label for="<?php echo $this->get_field_id( 'ytchag_title' ); ?>"><?php _e( 'Show title', 'youtube-channel-gallery' ); ?></label>
|
487 |
</p>
|
488 |
+
|
489 |
<p>
|
490 |
+
<input class="checkbox ytchg-desc" type="checkbox" value="1" <?php checked( (bool) $instance['ytchag_description'], true ); ?> id="<?php echo $this->get_field_id( 'ytchag_description' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_description' ); ?>" />
|
491 |
+
<label for="<?php echo $this->get_field_id( 'ytchag_description' ); ?>"><?php _e( 'Show description', 'youtube-channel-gallery' ); ?></label>
|
492 |
</p>
|
493 |
|
494 |
<p>
|
503 |
|
504 |
<p>
|
505 |
<label for="<?php echo $this->get_field_id( 'ytchag_description_words_number' ); ?>"><?php _e( 'Description words number:', 'youtube-channel-gallery' ); ?></label>
|
506 |
+
<input class="widefat wideinfo" 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 ); ?>" />
|
507 |
+
<span class="ytchag_info" title="<?php _e( 'Set the maximum number of words that will be displayed of the description. This field is useful when the descriptions of videos in the gallery have different sizes.', 'youtube-channel-gallery' ); ?>">?</span>
|
508 |
+
</p>
|
509 |
</div>
|
510 |
+
</fieldset>
|
511 |
</p>
|
512 |
|
513 |
|
515 |
</div>
|
516 |
|
517 |
|
518 |
+
<?php
|
519 |
+
/*
|
520 |
Link Tab
|
521 |
--------------------
|
522 |
*/
|
523 |
+
?>
|
524 |
<div id="tabs-<?php echo $this->id; ?>-4">
|
525 |
|
526 |
<p>
|
529 |
</p>
|
530 |
|
531 |
<p>
|
532 |
+
<input class="checkbox" type="checkbox" value="1" <?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' ); ?>" />
|
533 |
+
<label for="<?php echo $this->get_field_id( 'ytchag_link' ); ?>"><?php _e( 'Show link to channel', 'youtube-channel-gallery' ); ?></label>
|
534 |
+
|
535 |
</br>
|
536 |
+
|
537 |
+
<input class="checkbox" type="checkbox" value="1" <?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' ); ?>" />
|
538 |
+
<label for="<?php echo $this->get_field_id( 'ytchag_link_window' ); ?>"><?php _e( 'Open in a new window or tab', 'youtube-channel-gallery' ); ?></label>
|
539 |
</p>
|
540 |
|
541 |
</div>
|
545 |
|
546 |
</div>
|
547 |
|
548 |
+
<?php
|
549 |
+
}
|
550 |
|
551 |
|
552 |
+
/*--------------------------------------------------*/
|
553 |
+
/* Private Functions
|
554 |
/*--------------------------------------------------*/
|
555 |
+
private function ytchag_rss_markup( $instance ) {
|
556 |
+
|
557 |
+
//$instance variables
|
558 |
+
//--------------------------------
|
559 |
+
|
560 |
+
// Feed options
|
561 |
+
$ytchag_feed = apply_filters( 'ytchag_feed', $instance['ytchag_feed'] );
|
562 |
+
$ytchag_user = apply_filters( 'ytchag_user', $instance['ytchag_user'] );
|
563 |
+
$ytchag_feed_order = apply_filters( 'ytchag_feed_order', $instance['ytchag_feed_order'] );
|
564 |
+
$ytchag_cache_time = (int) apply_filters( 'ytchag_cache_time', $instance['ytchag_cache_time'] );
|
565 |
+
$ytchag_cache = apply_filters( 'ytchag_cache', $instance['ytchag_cache'] );
|
566 |
+
|
567 |
+
// Player options
|
568 |
+
$ytchag_ratio = apply_filters( 'ytchag_ratio', $instance['ytchag_ratio'] );
|
569 |
+
$ytchag_theme = apply_filters( 'ytchag_theme', $instance['ytchag_theme'] );
|
570 |
+
$ytchag_color = apply_filters( 'ytchag_color', $instance['ytchag_color'] );
|
571 |
+
$ytchag_quality = apply_filters( 'ytchag_quality', $instance['ytchag_quality'] );
|
572 |
+
$ytchag_autoplay = apply_filters( 'ytchag_autoplay', $instance['ytchag_autoplay'] );
|
573 |
+
$ytchag_modestbranding = apply_filters( 'ytchag_modestbranding', $instance['ytchag_modestbranding'] );
|
574 |
+
$ytchag_rel = apply_filters( 'ytchag_rel', $instance['ytchag_rel'] );
|
575 |
+
$ytchag_showinfo = apply_filters( 'ytchag_showinfo', $instance['ytchag_showinfo'] );
|
576 |
+
|
577 |
+
// Thumbnail options
|
578 |
+
$ytchag_maxitems = apply_filters( 'ytchag_maxitems', $instance['ytchag_maxitems'] );
|
579 |
+
$ytchag_thumb_width = apply_filters( 'ytchag_thumb_width', $instance['ytchag_thumb_width'] );
|
580 |
+
$ytchag_thumb_ratio = apply_filters( 'ytchag_thumb_ratio', $instance['ytchag_thumb_ratio'] );
|
581 |
+
$ytchag_thumb_columns = apply_filters( 'ytchag_thumb_columns', $instance['ytchag_thumb_columns'] );
|
582 |
+
$ytchag_title = apply_filters( 'ytchag_title', $instance['ytchag_title'] );
|
583 |
+
$ytchag_description = apply_filters( 'ytchag_description', $instance['ytchag_description'] );
|
584 |
+
$ytchag_thumbnail_alignment = apply_filters( 'ytchag_thumbnail_alignment', $instance['ytchag_thumbnail_alignment'] );
|
585 |
+
$ytchag_description_words_number = apply_filters( 'ytchag_description_words_number', $instance['ytchag_description_words_number'] );
|
586 |
+
|
587 |
+
// Link options
|
588 |
+
$ytchag_link = apply_filters( 'ytchag_link', $instance['ytchag_link'] );
|
589 |
+
$ytchag_link_tx = apply_filters( 'ytchag_link_tx', $instance['ytchag_link_tx'] );
|
590 |
+
$ytchag_link_window = apply_filters( 'ytchag_link_window', $instance['ytchag_link_window'] );
|
591 |
+
//--------------------------------
|
592 |
+
//end $instance variables
|
593 |
+
|
594 |
+
|
595 |
+
//defaults
|
596 |
+
//--------------------------------
|
597 |
+
|
598 |
+
// Feed options
|
599 |
+
$ytchag_feed = ( $ytchag_feed ) ? $ytchag_feed : 'user'; //default user
|
600 |
+
$ytchag_feed_order = ( $ytchag_feed_order ) ? $ytchag_feed_order : 'asc'; //default ascending
|
601 |
+
|
602 |
+
// Player options
|
603 |
+
$ytchag_theme = ( $ytchag_theme ) ? '&theme='. $ytchag_theme : ''; //default dark
|
604 |
+
$ytchag_color = ( $ytchag_color ) ? '&color='. $ytchag_color : ''; //default red
|
605 |
+
$ytchag_quality = ( $ytchag_quality ) ? $ytchag_quality : 'default'; //default default
|
606 |
+
$ytchag_autoplay = ( $ytchag_autoplay ) ? '&autoplay='. $ytchag_autoplay : ''; //default 0
|
607 |
+
$ytchag_modestbranding = ( $ytchag_modestbranding ) ? '' : '&modestbranding='. $ytchag_modestbranding; //default 0
|
608 |
+
$ytchag_rel = ( $ytchag_rel ) ? '&rel='. $ytchag_rel : '&rel=0'; //default 1
|
609 |
+
$ytchag_showinfo = ( $ytchag_showinfo ) ? '&showinfo='. $ytchag_showinfo : '&showinfo=0'; //default 1
|
610 |
+
|
611 |
+
// Thumbnail options
|
612 |
+
$ytchag_maxitems = ( $ytchag_maxitems ) ? $ytchag_maxitems : 9;
|
613 |
+
$ytchag_thumb_width = ( $ytchag_thumb_width ) ? $ytchag_thumb_width : 85;
|
614 |
+
$ytchag_thumb_columns = ( ( $ytchag_thumb_columns ) || ( $ytchag_thumb_columns != 0 ) ) ? $ytchag_thumb_columns : 0;
|
615 |
+
|
616 |
+
//title and desc
|
617 |
+
$ytchag_title = ( $ytchag_title ) ? $ytchag_title : 0;
|
618 |
+
$ytchag_description = ( $ytchag_description ) ? $ytchag_description : 0;
|
619 |
+
$ytchag_thumbnail_alignment = ( $ytchag_thumbnail_alignment ) ? $ytchag_thumbnail_alignment : 'top';
|
620 |
+
$ytchag_description_words_number = ( $ytchag_description_words_number ) ? $ytchag_description_words_number : 10;
|
621 |
+
|
622 |
+
// Link options
|
623 |
+
$ytchag_link = ( $ytchag_link ) ? $ytchag_link : 0;
|
624 |
+
$ytchag_link_tx = ( $ytchag_link_tx ) ? $ytchag_link_tx : __( 'Show more videos»', 'youtube-channel-gallery' );
|
625 |
+
$ytchag_link_window = ( $ytchag_link_window ) ? 'target="_blank"' : 0;
|
626 |
+
//--------------------------------
|
627 |
+
//end defaults
|
628 |
+
|
629 |
+
|
630 |
+
|
631 |
+
|
632 |
+
// YouTube feed types
|
633 |
+
//--------------------------------
|
634 |
+
|
635 |
+
// only if user name inserted
|
636 |
+
if ( empty( $ytchag_user ) ) {
|
637 |
+
$content= '<p class="empty">' . __( 'There is no video to show.', 'youtube-channel-gallery' ) . '</p>';
|
638 |
+
|
639 |
+
} else {
|
640 |
+
$youtube_feed_url = 'http://gdata.youtube.com/feeds/api';
|
641 |
+
// links
|
642 |
+
if ( $ytchag_feed == 'user' ) {
|
643 |
+
$ytchag_rss_url = $youtube_feed_url . '/users/' . $ytchag_user . '/uploads?v=2&prettyprint=true&max-results='. $ytchag_maxitems;
|
644 |
+
$ytchag_link_url = 'http://www.youtube.com/user/' . $ytchag_user;
|
645 |
+
}
|
646 |
+
if ( $ytchag_feed == 'favorites' ) {
|
647 |
+
$ytchag_rss_url = $youtube_feed_url . '/users/' . $ytchag_user . '/favorites';
|
648 |
+
$ytchag_link_url = 'http://www.youtube.com/user/' . $ytchag_user . '/favorites';
|
649 |
+
}
|
650 |
+
if ( $ytchag_feed == 'playlist' ) {
|
651 |
+
$ytchag_rss_url = $youtube_feed_url . '/playlists/' . $ytchag_user . '?v=2&prettyprint=true&max-results=' . $ytchag_maxitems;//&prettyprint=true
|
652 |
+
$ytchag_link_url = 'http://www.youtube.com/playlist?list=' . $ytchag_user;
|
653 |
+
}
|
654 |
+
//HTTP API
|
655 |
|
656 |
+
$transientId = 'ytc-' .md5( $ytchag_feed . $ytchag_user . $ytchag_maxitems );
|
657 |
+
|
658 |
+
$videos_result = $this->get_rss_data ( $ytchag_cache, $transientId, $ytchag_rss_url, $ytchag_cache_time );
|
659 |
+
|
660 |
+
$rss = simplexml_load_string( $videos_result['body'] );
|
661 |
+
|
662 |
+
$response_code = wp_remote_retrieve_response_code( $videos_result );
|
663 |
+
$response_message = wp_remote_retrieve_response_message( $videos_result );
|
664 |
+
$entries = $rss;
|
665 |
|
666 |
+
if ( $ytchag_feed == 'playlist' && $ytchag_feed_order == 'desc' ) {
|
667 |
+
$totalResults = $rss->children( 'openSearch', true )->totalResults;
|
|
|
|
|
668 |
|
669 |
+
//get rss playlist again with the last videos. YouTube does not load in the first request, even if the orderby parameter is set.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
670 |
|
671 |
+
//Youtube feed limit is 1000
|
672 |
+
if ( $totalResults >= 1000 ) {
|
673 |
+
$startindex = 1000 - $ytchag_maxitems + 1;
|
674 |
+
} elseif ( $ytchag_maxitems >= $totalResults ) {
|
675 |
+
$startindex = 1;
|
676 |
+
} else {
|
677 |
+
$startindex = $totalResults - $ytchag_maxitems + 1;
|
678 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
679 |
|
680 |
+
$ytchag_rss_url = $youtube_feed_url . '/playlists/' . $ytchag_user . '?v=2&prettyprint=true&start-index=' . $startindex . '&max-results=' . $ytchag_maxitems;// . '&orderby=reversedPosition';
|
681 |
+
|
682 |
+
$transientId = 'ytc-' .md5( $ytchag_feed . $ytchag_user . $ytchag_feed_order . $ytchag_maxitems );
|
683 |
|
684 |
+
$videos_result = $this->get_rss_data ( $ytchag_cache, $transientId, $ytchag_rss_url, $ytchag_cache_time );
|
685 |
+
$rss = simplexml_load_string( $videos_result['body'] );
|
686 |
+
|
687 |
+
$response_code = wp_remote_retrieve_response_code( $videos_result );
|
688 |
+
$response_message = wp_remote_retrieve_response_message( $videos_result );
|
|
|
|
|
|
|
689 |
|
690 |
+
// parameter orderby=reversedPosition of Google Data API is not working, so I will use this to reverse the order
|
691 |
+
//get entries
|
692 |
+
|
693 |
+
$new_rss = new stdClass();
|
694 |
+
for ($i = sizeof($rss->entry) - 1; $i >= 0; --$i) {
|
695 |
+
$new_rss->entry[$i] = $rss->entry[$i];
|
696 |
+
}
|
697 |
+
$entries = $new_rss;
|
698 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
699 |
}
|
700 |
|
701 |
+
}
|
702 |
+
|
703 |
+
|
704 |
+
|
705 |
+
// content
|
706 |
+
//--------------------------------
|
707 |
+
if ( $response_code != 200 ) {
|
708 |
+
$content= '<div class="vmcerror">' . sprintf( __( 'Message from server: %1$s. Check in YouTube if the id <a href="%2$s" target="_blank">%3$s</a> belongs to a %4$s. To locate the id of your %4$s check the <a href="http://wordpress.org/extend/plugins/youtube-channel-gallery/faq/" target="_blank">FAQ</a> of the plugin.', 'youtube-channel-gallery' ), $response_message, $ytchag_link_url, $ytchag_user, $ytchag_feed ) . '</div>';
|
709 |
+
} else {
|
710 |
+
|
711 |
+
//playlist descending order
|
712 |
+
//get totalResults from playlist rss to order correctly videos
|
713 |
+
|
714 |
+
|
715 |
+
|
716 |
+
$thumb_count = 0;
|
717 |
+
$column = 0;
|
718 |
+
static $plugincount = 0;
|
719 |
+
$rowcount = 0;
|
720 |
+
$namespaces=$rss->getNameSpaces( true ); // access all the namespaces used in the tree
|
721 |
+
array_unshift( $namespaces, "" ); // add a blank at the beginning of the array to deal with the unprefixed default
|
722 |
|
|
|
|
|
|
|
723 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
724 |
|
725 |
+
foreach ( $entries->entry as $entry ) {
|
726 |
+
// get nodes in media: namespace for media information
|
727 |
+
$media = $entry->children( 'http://search.yahoo.com/mrss/' );
|
728 |
+
|
729 |
+
// get video player URL
|
730 |
+
$url = $media->group->player->attributes();
|
731 |
+
|
732 |
+
// get video player id
|
733 |
+
$yt = $media->children( 'http://gdata.youtube.com/schemas/2007' );
|
734 |
+
$youtubeid = $yt->videoid;
|
735 |
+
|
736 |
+
// get video title
|
737 |
+
$title = $media->group->title;
|
738 |
+
|
739 |
+
// get video description
|
740 |
+
$description = $media->group->description;
|
741 |
+
|
742 |
+
//default url thumbnail
|
743 |
+
$thumb_attrs = $media->group->thumbnail[0]->attributes();
|
744 |
+
$thumbnail = $thumb_attrs['url'];
|
745 |
+
|
746 |
+
$thumbs = $media->group->thumbnail;
|
747 |
+
$thumb_attrs = array();
|
748 |
+
$index = 0;
|
749 |
+
|
750 |
+
// get thumbnails attributes: url | height | width
|
751 |
+
//mqdefault: 320x180 (16:9)
|
752 |
+
foreach ( $thumbs as $thumb ) {
|
753 |
+
$attrstring="";
|
754 |
+
foreach ( $namespaces as $ns ) {
|
755 |
+
foreach ( $thumb->attributes( $ns ) as $attr => $value ) { // get all attributes, whatever namespace they might be in
|
756 |
+
$thumb_attrs[$index][$attr] = $value;
|
757 |
+
$attrstring.=$attr . ': ' . $thumb_attrs[$index][$attr] . "| ";
|
758 |
}
|
759 |
+
}
|
760 |
+
$index++;
|
761 |
+
}
|
762 |
|
|
|
|
|
|
|
|
|
763 |
|
764 |
+
// default; w: 120; h: 90; 4x3
|
765 |
+
// mqdefault; w: 320; h: 180; 16x9
|
766 |
+
// hqdefault; w: 480; h: 360; 4x3
|
767 |
+
// sddefault; w: 640; h: 480; 4x3
|
768 |
|
769 |
+
// Thumbnails
|
770 |
+
//--------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
771 |
|
772 |
+
//thumbnail height
|
773 |
+
if ( $ytchag_thumb_ratio == '16x9' ) {
|
774 |
+
$ytchag_thumb_height = round( ( $ytchag_thumb_width * 9 ) / 16 );
|
775 |
+
} else {
|
776 |
+
$ytchag_thumb_height = round( ( $ytchag_thumb_width * 3 ) / 4 );
|
777 |
+
}
|
778 |
|
779 |
+
//sort array by width
|
780 |
+
foreach ( $thumb_attrs as $key => $row ) {
|
781 |
+
$new_thumb_attrs[$key] = $row['width'];
|
782 |
+
}
|
783 |
+
array_multisort( $new_thumb_attrs, SORT_NUMERIC, $thumb_attrs );
|
784 |
+
unset( $new_thumb_attrs[$key] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
785 |
|
786 |
+
// get appropriate thumbnail width
|
787 |
+
$thumbcorrectW = $this->get_appropriate_thumbnail( $thumb_attrs, $ytchag_thumb_width, $ytchag_thumb_height, 'defaults' );
|
788 |
+
if ( !isset( $thumbcorrectW ) ) {
|
789 |
+
$thumbcorrectW = $this->get_appropriate_thumbnail( $thumb_attrs, $ytchag_thumb_width, $ytchag_thumb_height, 'other' );
|
790 |
+
}
|
|
|
|
|
791 |
|
792 |
+
//index in array of thumbnail width
|
793 |
+
$thumbcorrectWIndex = $this->array_search_multi( $thumb_attrs, 'width', $thumbcorrectW );
|
794 |
|
795 |
+
//appropriate url thumbnail
|
796 |
+
$thumb = $thumbcorrectWIndex[0]['url'];
|
797 |
|
798 |
|
799 |
+
//rows and columns control
|
800 |
|
801 |
+
$column++;
|
802 |
+
$columnlastfirst = $tableclass = $columnnumber = '';
|
803 |
+
if ( $ytchag_thumb_columns !=0 && $column == 1 ) {
|
804 |
+
$columnlastfirst = ' ytccell-first';
|
805 |
+
$rowcount++;
|
806 |
+
$row_oddeven = ( $rowcount%2==1 )?' ytc-r-odd':' ytc-r-even';
|
807 |
+
$tableclass = ' ytc-table';
|
808 |
+
$columnnumber = ' ytc-columns'. $ytchag_thumb_columns;
|
|
|
809 |
|
810 |
+
}
|
811 |
+
if ( $ytchag_thumb_columns !=0 && $column%$ytchag_thumb_columns == 0 ) {
|
812 |
+
$columnlastfirst = ' ytccell-last';
|
813 |
+
}// end columns control
|
814 |
+
|
815 |
+
//check if title or description
|
816 |
+
$ytchag_thumbnail_alignment_witdh = '';
|
817 |
+
$title_and_description_alignment_class = '';
|
818 |
+
|
819 |
+
if ( $ytchag_title || $ytchag_description ) {
|
820 |
+
$title_and_description_alignment_class = ' ytc-td-' . $ytchag_thumbnail_alignment;
|
821 |
+
if ( $ytchag_thumbnail_alignment == 'left' || $ytchag_thumbnail_alignment == 'right' ) {
|
822 |
+
$ytchag_thumbnail_alignment_witdh = ' style="width: ' . $ytchag_thumb_width . 'px; "';
|
823 |
+
}
|
824 |
+
}
|
825 |
|
826 |
|
|
|
|
|
|
|
|
|
|
|
|
|
827 |
|
828 |
+
//The content
|
829 |
+
//--------------------------------
|
830 |
|
831 |
+
//Show me the player: iframe player
|
832 |
+
if ( $thumb_count == 0 ) {
|
833 |
+
//count the plugin occurrences on page
|
834 |
+
$plugincount++;
|
835 |
|
836 |
+
$content = '<div class="ytcplayer-wrapper ytc-player' . $ytchag_ratio . '"><iframe id="ytcplayer' . $plugincount . '" class="ytcplayer" allowfullscreen src="http://www.youtube.com/embed/' . $youtubeid . '?version=3' . $ytchag_theme . $ytchag_color . $ytchag_autoplay. $ytchag_modestbranding . $ytchag_rel . $ytchag_showinfo .'&enablejsapi=1&wmode=transparent" frameborder="0"></iframe></div>';
|
837 |
+
$content.= '<ul class="ytchagallery ytccf' . $tableclass . $title_and_description_alignment_class . $columnnumber . ' ytc-thumb' . $ytchag_thumb_ratio . '">';
|
|
|
|
|
838 |
|
839 |
+
} // if player end
|
840 |
+
$thumb_count++;
|
841 |
|
|
|
|
|
842 |
|
843 |
|
844 |
+
//title and description content
|
845 |
|
846 |
+
if ( $ytchag_title || $ytchag_description ) {
|
847 |
+
$title_and_description_content= '<div class="ytctitledesc-cont">';
|
848 |
|
849 |
+
if ( $ytchag_title ) {
|
850 |
+
$title_and_description_content.= '<h5 class="ytctitle"><a class="ytclink" href="http://youtu.be/' . $youtubeid . '" data-playerid="ytcplayer' . $plugincount . '" data-quality="' . $ytchag_quality . '" alt="' . $title . '" title="' . $title . '">' . $title . '</a></h5>';
|
851 |
+
}
|
852 |
|
853 |
+
if ( $ytchag_description ) {
|
854 |
+
$description = wp_trim_words( $description, $num_words = $ytchag_description_words_number, $more = '…' );
|
855 |
+
$title_and_description_content.= '<div class="ytctdescription">' . $description . '</div>';
|
856 |
+
}
|
857 |
|
858 |
+
$title_and_description_content.= '</div>';
|
859 |
+
} else {
|
860 |
+
$title_and_description_content = '';
|
861 |
+
}
|
862 |
+
//end title and description content
|
863 |
|
|
|
|
|
|
|
|
|
|
|
864 |
|
865 |
+
//----
|
866 |
+
if ( $ytchag_thumb_columns !=0 && $column == 1 ) {
|
867 |
+
$content.= "\n\n" .'<div class="ytccf ytc-row ytc-r-' . $rowcount . $row_oddeven . ' ">' . "\n\n";
|
868 |
+
}
|
869 |
|
870 |
+
//$content.= '$column: ' + $column;
|
871 |
+
$content.= "\n\n" . ' <li class="ytccell-' . $column . $columnlastfirst . '">';//style="width: ' . $ytchag_thumb_width . 'px; "
|
|
|
|
|
872 |
|
873 |
+
$content.= '<div class="ytcliinner">';
|
|
|
874 |
|
875 |
+
if ( $ytchag_thumbnail_alignment == 'bottom' ) {
|
876 |
+
$content.= $title_and_description_content;
|
877 |
|
878 |
+
}
|
|
|
879 |
|
880 |
+
$content.= '<div class="ytcthumb-cont"' . $ytchag_thumbnail_alignment_witdh . '>';
|
881 |
+
$content.= '<a class="ytcthumb ytclink" href="http://youtu.be/' . $youtubeid . '" data-playerid="ytcplayer' . $plugincount . '" data-quality="' . $ytchag_quality . '" title="' . $title . '" style="background-image:url(' . $thumb . ')">';
|
882 |
+
$content.= '<div class="ytcplay"></div>';
|
883 |
+
$content.= '</a>';
|
884 |
+
$content.= '</div>';
|
885 |
|
886 |
+
if ( $ytchag_thumbnail_alignment != 'bottom' ) {
|
887 |
+
$content.= $title_and_description_content;
|
888 |
+
}
|
|
|
|
|
889 |
|
890 |
+
$content.= '</div>';
|
|
|
|
|
891 |
|
892 |
+
$content.= '</li>' . "\n\n";
|
893 |
|
894 |
+
//----
|
895 |
+
if ( $ytchag_thumb_columns !=0 && $column%$ytchag_thumb_columns == 0 ) {
|
896 |
+
$column = 0;
|
897 |
+
$columnlastfirst = ' ytccell-last';
|
898 |
+
$content.= '</div>' . "\n\n\n";
|
899 |
+
}
|
900 |
+
if ( $thumb_count == $ytchag_maxitems ) {
|
901 |
+
break;
|
902 |
+
}
|
903 |
+
} //foreach end
|
904 |
+
|
905 |
+
//if last row
|
906 |
+
if ( $ytchag_thumb_columns !=0 && $columnlastfirst != ' ytccell-last' ) {
|
907 |
+
$content.= '</div>' . "\n\n\n";
|
908 |
+
}
|
909 |
|
910 |
+
$content.= '</ul>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
911 |
|
912 |
+
//link to youtube.com gallery
|
913 |
+
if ( $ytchag_link ) {
|
914 |
+
$content.= '<a href="' . $ytchag_link_url . '" class="ytcmore" ' .$ytchag_link_window. ' >' . $ytchag_link_tx . '</a>';
|
915 |
+
}
|
916 |
+
//--}
|
917 |
+
}
|
918 |
|
919 |
+
return $content;
|
920 |
|
921 |
+
}//ytchag_rss_markup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
922 |
|
|
|
|
|
|
|
|
|
|
|
|
|
923 |
|
|
|
924 |
|
925 |
+
function get_rss_data ( $ytchag_cache, $transientId, $ytchag_rss_url, $ytchag_cache_time ) {
|
926 |
+
//use cache
|
927 |
+
if ( $ytchag_cache == '1' ) {
|
|
|
|
|
|
|
928 |
|
929 |
+
//if cache does not exist
|
930 |
+
if ( false === ( $videos_result = get_transient( $transientId ) ) ) {
|
931 |
+
//get rss
|
932 |
+
$videos_result = wp_remote_get( $ytchag_rss_url );
|
933 |
|
934 |
+
$response_code = wp_remote_retrieve_response_code( $videos_result );
|
935 |
+
$response_message = wp_remote_retrieve_response_message( $videos_result );
|
936 |
+
|
937 |
+
if ( $response_code == 200 ) {
|
938 |
+
|
939 |
+
set_transient( $transientId, $videos_result, $ytchag_cache_time * HOUR_IN_SECONDS );
|
940 |
+
}
|
941 |
}
|
|
|
942 |
|
943 |
+
//not to use cache
|
944 |
+
} else {
|
945 |
+
//get rss
|
946 |
+
$videos_result = wp_remote_get( $ytchag_rss_url );
|
947 |
+
|
948 |
+
//delete cache
|
949 |
+
delete_transient( $transientId );
|
950 |
}
|
951 |
|
952 |
+
return $videos_result;
|
953 |
+
}
|
|
|
|
|
|
|
|
|
|
|
954 |
|
955 |
|
956 |
+
function get_appropriate_thumbnail( $thumb_attrs, $ytchag_thumb_width, $ytchag_thumb_height, $type ) {
|
957 |
+
// get appropriate thumbnail width
|
958 |
+
|
959 |
+
// to check only this type of thumbnails
|
960 |
+
$ytchag_thumb_size_names = array( 'default', 'mqdefault', 'hqdefault', 'sddefault' );
|
961 |
|
962 |
+
foreach ( $thumb_attrs as $row ) {
|
|
|
|
|
963 |
|
964 |
+
if ( $type == 'defaults' ) {
|
965 |
+
if ( in_array( $row['name'], $ytchag_thumb_size_names ) ) {
|
966 |
+
if ( $row['width'] >= $ytchag_thumb_width && $row['height'] >= $ytchag_thumb_height ) {
|
967 |
+
return $row['width'];
|
968 |
+
}
|
969 |
+
}
|
970 |
+
} else{
|
971 |
+
if ( !in_array( $row['name'], $ytchag_thumb_size_names ) ) {
|
972 |
+
if ( $row['width'] >= $ytchag_thumb_width && $row['height'] >= $ytchag_thumb_height ) {
|
973 |
+
return $row['width'];
|
974 |
+
}
|
975 |
+
}
|
976 |
+
}
|
977 |
+
}
|
978 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
979 |
|
980 |
+
function array_search_multi( $array, $key, $value ) {
|
981 |
+
$results = array();
|
|
|
|
|
982 |
|
983 |
+
if ( is_array( $array ) ) {
|
984 |
+
if ( isset( $array[$key] ) && $array[$key] == $value )
|
985 |
+
$results[] = $array;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
986 |
|
987 |
+
foreach ( $array as $subarray )
|
988 |
+
$results = array_merge( $results, $this->array_search_multi( $subarray, $key, $value ) );
|
989 |
+
}
|
|
|
990 |
|
991 |
+
return $results;
|
992 |
+
}
|
993 |
|
994 |
+
// load css or js
|
995 |
+
private function register_scripts_and_styles() {
|
996 |
+
wp_enqueue_script( 'jquery' );
|
997 |
+
wp_enqueue_script( 'youtube_player_api', 'http://www.youtube.com/player_api', false, false, true );
|
998 |
+
wp_enqueue_script( 'youtube-channel-gallery', plugins_url( '/scripts.js', __FILE__ ), false, false, true );
|
999 |
+
wp_enqueue_style( 'youtube-channel-gallery', plugins_url( '/styles.css', __FILE__ ), false, false, 'all' );
|
1000 |
+
}//register_scripts_and_styles
|
1001 |
|
|
|
1002 |
|
1003 |
+
public function register_admin_scripts_and_styles( $hook ) {
|
1004 |
+
if ( 'widgets.php' != $hook )
|
1005 |
+
return;
|
1006 |
+
wp_enqueue_style( 'youtube-channel-gallery', plugins_url( '/admin-styles.css', __FILE__ ) );
|
1007 |
+
}
|
1008 |
|
1009 |
+
/*--------------------------------------------------*/
|
1010 |
+
/* Shortcode
|
1011 |
+
/*--------------------------------------------------*/
|
1012 |
|
1013 |
+
public function YoutubeChannelGallery_Shortcode( $atts ) {
|
1014 |
+
|
1015 |
+
// Load JavaScript and stylesheets
|
1016 |
+
$this->register_scripts_and_styles();
|
1017 |
+
|
1018 |
+
extract( shortcode_atts( array(
|
1019 |
+
'user' => 'youtube',
|
1020 |
+
|
1021 |
+
// Feed options
|
1022 |
+
'feed' => 'user',
|
1023 |
+
'feedorder' => 'asc',
|
1024 |
+
'cache_time' => '24',
|
1025 |
+
'cache' => '1',
|
1026 |
+
|
1027 |
+
// Player options
|
1028 |
+
'ratio' => '4x3',
|
1029 |
+
'theme' => 'dark',
|
1030 |
+
'color' => 'red',
|
1031 |
+
'quality' => 'default',
|
1032 |
+
'autoplay' => '',
|
1033 |
+
'modestbranding' => '',
|
1034 |
+
'rel' => '',
|
1035 |
+
'showinfo' => '',
|
1036 |
+
|
1037 |
+
// Thumbnail options
|
1038 |
+
'maxitems' => '9',
|
1039 |
+
'thumbwidth' => '90',
|
1040 |
+
'thumbratio' => '4x3',
|
1041 |
+
'thumbcolumns' => '3',
|
1042 |
+
'title' => '',
|
1043 |
+
'description' => '',
|
1044 |
+
'thumbnail_alignment' => 'top',
|
1045 |
+
'descriptionwordsnumber' => '',
|
1046 |
+
|
1047 |
+
// Link options
|
1048 |
+
'link' => '',
|
1049 |
+
'link_tx' => '',
|
1050 |
+
'link_window' => ''
|
1051 |
+
|
1052 |
+
), $atts ) );
|
1053 |
+
|
1054 |
+
// Feed options
|
1055 |
+
$instance['ytchag_feed'] = $feed;
|
1056 |
+
$instance['ytchag_user'] = $user;
|
1057 |
+
$instance['ytchag_feed_order'] = $feedorder;
|
1058 |
+
$instance['ytchag_cache_time'] = $cache_time;
|
1059 |
+
$instance['ytchag_cache'] = $cache;
|
1060 |
+
|
1061 |
+
// Player options
|
1062 |
+
$instance['ytchag_ratio'] = $ratio;
|
1063 |
+
$instance['ytchag_theme'] = $theme;
|
1064 |
+
$instance['ytchag_color'] = $color;
|
1065 |
+
$instance['ytchag_quality'] = $quality;
|
1066 |
+
$instance['ytchag_autoplay'] = $autoplay;
|
1067 |
+
$instance['ytchag_modestbranding'] = $modestbranding;
|
1068 |
+
$instance['ytchag_rel'] = $rel;
|
1069 |
+
$instance['ytchag_showinfo'] = $showinfo;
|
1070 |
+
|
1071 |
+
// Thumbnail options
|
1072 |
+
$instance['ytchag_maxitems'] = $maxitems;
|
1073 |
+
$instance['ytchag_thumb_width'] = $thumbwidth;
|
1074 |
+
$instance['ytchag_thumb_ratio'] = $thumbratio;
|
1075 |
+
$instance['ytchag_thumb_columns'] = $thumbcolumns;
|
1076 |
+
$instance['ytchag_title'] = $title;
|
1077 |
+
$instance['ytchag_description'] = $description;
|
1078 |
+
$instance['ytchag_thumbnail_alignment'] = $thumbnail_alignment;
|
1079 |
+
$instance['ytchag_description_words_number'] = $descriptionwordsnumber;
|
1080 |
+
|
1081 |
+
// Link options
|
1082 |
+
$instance['ytchag_link'] = $link;
|
1083 |
+
$instance['ytchag_link_tx'] = $link_tx;
|
1084 |
+
$instance['ytchag_link_window'] = $link_window;
|
1085 |
+
|
1086 |
+
|
1087 |
+
return '<div class="ytcshort youtubechannelgallery">'. $this->ytchag_rss_markup( $instance ) . '</div>';
|
1088 |
+
|
1089 |
+
} // YoutubeChannelGallery_Shortcode
|
1090 |
+
|
1091 |
+
|
1092 |
+
} // class YoutubeChannelGallery_Widget
|
1093 |
+
|
1094 |
+
// register YoutubeChannelGallery_Widget widget
|
1095 |
+
add_action( 'widgets_init', create_function( '', 'register_widget( "YoutubeChannelGallery_Widget" );' ) );
|
1096 |
|
1097 |
?>
|