Version Description
- Fixed bug with shortcode position.
- Deleted decimals to thumbnail heights.
- Added background-size to CSS of thumbnails to control image size.
- Added Brazilian Portuguese (pt_BR). Thanks to Rodny.
Download this release
Release Info
Developer | javitxu123 |
Plugin | Youtube Channel Gallery |
Version | 1.4.8 |
Comparing to | |
See all releases |
Code changes from version 1.4.7 to 1.4.8
- img/play.gif +0 -0
- languages/youtube-channel-gallery-pt_BR.mo +0 -0
- languages/youtube-channel-gallery-pt_BR.po +178 -0
- readme.txt +10 -3
- styles.css +1 -0
- youtube-channel-gallery.php +283 -283
img/play.gif
DELETED
Binary file
|
languages/youtube-channel-gallery-pt_BR.mo
ADDED
Binary file
|
languages/youtube-channel-gallery-pt_BR.po
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Spanish translation for duplicate-post
|
2 |
+
# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010
|
3 |
+
# This file is distributed under the same license as the duplicate-post package.
|
4 |
+
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
|
5 |
+
#
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: youtube-channel-gallery\n"
|
9 |
+
"Report-Msgid-Bugs-To: \n"
|
10 |
+
"POT-Creation-Date: 2012-07-24 14:14+0100\n"
|
11 |
+
"PO-Revision-Date: 2012-09-18 13:07+0100\n"
|
12 |
+
"Last-Translator: Javier <javierpose@gmail.com>\n"
|
13 |
+
"Language-Team: PoseLab <javierpose@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
"X-Launchpad-Export-Date: 2010-06-23 21:48+0000\n"
|
18 |
+
"X-Generator: Launchpad (build Unknown)\n"
|
19 |
+
"X-Poedit-Basepath: ..\n"
|
20 |
+
"X-Poedit-Language: Portuguese\n"
|
21 |
+
"X-Poedit-Country: PORTUGAL\n"
|
22 |
+
"X-Poedit-KeywordsList: _e;__\n"
|
23 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
24 |
+
"X-Poedit-SearchPath-0: .\n"
|
25 |
+
|
26 |
+
#: youtube-channel-gallery.php:44
|
27 |
+
#: pruebas/youtube-channel-gallery_bueno.php:46
|
28 |
+
#: pruebas/youtube-channel-gallery_bueno2.php:46
|
29 |
+
msgid "Youtube Channel Gallery"
|
30 |
+
msgstr "Galería do Canal Youtube"
|
31 |
+
|
32 |
+
#: youtube-channel-gallery.php:45
|
33 |
+
#: pruebas/youtube-channel-gallery_bueno.php:47
|
34 |
+
#: pruebas/youtube-channel-gallery_bueno2.php:47
|
35 |
+
msgid "Show a youtube video and a gallery of thumbnails for a youtube channel"
|
36 |
+
msgstr "Mostrar um video youtube e a gelaria de miniaturas para o canal Youtube"
|
37 |
+
|
38 |
+
#: youtube-channel-gallery.php:100
|
39 |
+
#: pruebas/youtube-channel-gallery_bueno.php:109
|
40 |
+
#: pruebas/youtube-channel-gallery_bueno2.php:107
|
41 |
+
msgid "Title:"
|
42 |
+
msgstr "Título:"
|
43 |
+
|
44 |
+
#: youtube-channel-gallery.php:105
|
45 |
+
#: pruebas/youtube-channel-gallery_bueno.php:114
|
46 |
+
#: pruebas/youtube-channel-gallery_bueno2.php:112
|
47 |
+
msgid "YouTube user name:"
|
48 |
+
msgstr "Nome do usuário Youtube:"
|
49 |
+
|
50 |
+
#: youtube-channel-gallery.php:111
|
51 |
+
#: pruebas/youtube-channel-gallery_bueno.php:120
|
52 |
+
#: pruebas/youtube-channel-gallery_bueno2.php:118
|
53 |
+
msgid "Show link to channel:"
|
54 |
+
msgstr "Mostrar link do canal:"
|
55 |
+
|
56 |
+
#: youtube-channel-gallery.php:115
|
57 |
+
#: pruebas/youtube-channel-gallery_bueno.php:124
|
58 |
+
#: pruebas/youtube-channel-gallery_bueno2.php:122
|
59 |
+
msgid "Number of videos to show:"
|
60 |
+
msgstr "Quantidade de vídeos a mostrar:"
|
61 |
+
|
62 |
+
#: youtube-channel-gallery.php:120
|
63 |
+
#: pruebas/youtube-channel-gallery_bueno.php:129
|
64 |
+
#: pruebas/youtube-channel-gallery_bueno2.php:127
|
65 |
+
msgid "Video width:"
|
66 |
+
msgstr "Largura do vídeo:"
|
67 |
+
|
68 |
+
#: youtube-channel-gallery.php:125
|
69 |
+
#: pruebas/youtube-channel-gallery_bueno.php:134
|
70 |
+
#: pruebas/youtube-channel-gallery_bueno2.php:132
|
71 |
+
msgid "Thumbnail width:"
|
72 |
+
msgstr "Largura das miniaturas:"
|
73 |
+
|
74 |
+
#: youtube-channel-gallery.php:130
|
75 |
+
#: pruebas/youtube-channel-gallery_bueno.php:139
|
76 |
+
#: pruebas/youtube-channel-gallery_bueno.php:144
|
77 |
+
#: pruebas/youtube-channel-gallery_bueno2.php:137
|
78 |
+
msgid "Thumbnail columns:"
|
79 |
+
msgstr "Colunas das miniaturas:"
|
80 |
+
|
81 |
+
#: youtube-channel-gallery.php:135
|
82 |
+
#: pruebas/youtube-channel-gallery_bueno.php:149
|
83 |
+
msgid "Theme:"
|
84 |
+
msgstr "Tema:"
|
85 |
+
|
86 |
+
#: youtube-channel-gallery.php:137
|
87 |
+
#: pruebas/youtube-channel-gallery_bueno.php:151
|
88 |
+
msgid "Dark"
|
89 |
+
msgstr "Escuro"
|
90 |
+
|
91 |
+
#: youtube-channel-gallery.php:138
|
92 |
+
msgid "Light"
|
93 |
+
msgstr "Claro"
|
94 |
+
|
95 |
+
#: youtube-channel-gallery.php:270
|
96 |
+
#: pruebas/youtube-channel-gallery_bueno.php:345
|
97 |
+
#: pruebas/youtube-channel-gallery_bueno2.php:315
|
98 |
+
msgid "Show more videos»"
|
99 |
+
msgstr "Ver mais vídeos»"
|
100 |
+
|
101 |
+
#: youtube-channel-gallery.php:276
|
102 |
+
#: pruebas/youtube-channel-gallery_bueno.php:351
|
103 |
+
#: pruebas/youtube-channel-gallery_bueno2.php:321
|
104 |
+
msgid "There is no video to show."
|
105 |
+
msgstr "Não tem nenhum vídeo para mostrar."
|
106 |
+
|
107 |
+
#: pruebas/youtube-channel-gallery_bueno.php:152
|
108 |
+
msgid "Light:"
|
109 |
+
msgstr "Claro:"
|
110 |
+
|
111 |
+
#~ msgid "No post to duplicate has been supplied!"
|
112 |
+
#~ msgstr "No se facilitó ninguna entrada a copiar"
|
113 |
+
#~ msgid "Post creation failed, could not find original post:"
|
114 |
+
#~ msgstr ""
|
115 |
+
#~ "Creación realizada sin éxito, no ha sido posible encontrar la entrada "
|
116 |
+
#~ "original:"
|
117 |
+
#~ msgid "No page to duplicate has been supplied!"
|
118 |
+
#~ msgstr "No se facilitó ninguna página a copiar"
|
119 |
+
#~ msgid "Make a duplicate from this post"
|
120 |
+
#~ msgstr "Crea una copia de esta entrada"
|
121 |
+
#~ msgid "Duplicate"
|
122 |
+
#~ msgstr "Duplicar"
|
123 |
+
#~ msgid "Make a duplicate from this page"
|
124 |
+
#~ msgstr "Crea una copia de esta página"
|
125 |
+
#~ msgid "Copy to a new draft"
|
126 |
+
#~ msgstr "Copia en un borrador nuevo"
|
127 |
+
#~ msgid "Duplicate Post Options"
|
128 |
+
#~ msgstr "Opciones"
|
129 |
+
#~ msgid "Duplicate Post"
|
130 |
+
#~ msgstr "Duplicate Post"
|
131 |
+
#~ msgid "Copy post/page date also"
|
132 |
+
#~ msgstr "Copiar también fecha del post o la página"
|
133 |
+
#~ msgid ""
|
134 |
+
#~ "Normally, the new draft has publication date set to current time: check "
|
135 |
+
#~ "the box to copy the original post/page date"
|
136 |
+
#~ msgstr ""
|
137 |
+
#~ "Normalmente se establece la fecha de publicación del nuevo borrador a la "
|
138 |
+
#~ "fecha actual: compruebe la casilla para copiar la fecha original del post "
|
139 |
+
#~ "o la página"
|
140 |
+
#~ msgid "Do not copy these fields"
|
141 |
+
#~ msgstr "No copiar estos campos"
|
142 |
+
#~ msgid ""
|
143 |
+
#~ "Comma-separated list of meta fields that must not be copied when cloning "
|
144 |
+
#~ "a post/page"
|
145 |
+
#~ msgstr ""
|
146 |
+
#~ "Lista separada por comas de meta campos que no pueden ser copiados cuando "
|
147 |
+
#~ "se clona una entrada/pagina."
|
148 |
+
#~ msgid "Title prefix"
|
149 |
+
#~ msgstr "Prefijo del titulo"
|
150 |
+
#~ msgid ""
|
151 |
+
#~ "Prefix to be added before the original title when cloning a post/page, e."
|
152 |
+
#~ "g. \"Copy of\" (blank for no prefix)"
|
153 |
+
#~ msgstr ""
|
154 |
+
#~ "Prefijo a ser agregado antes del titulo original cuando se clona una "
|
155 |
+
#~ "entrada/pagina, ej. \"Copia de\" (en blanco para no agregar prefijo)"
|
156 |
+
#~ msgid "Minimum level to copy posts"
|
157 |
+
#~ msgstr "Nivel mínimo para copiar posts"
|
158 |
+
#~ msgid ""
|
159 |
+
#~ "Warning: users will be able to copy all posts, even those of higher level "
|
160 |
+
#~ "users"
|
161 |
+
#~ msgstr ""
|
162 |
+
#~ "Atención: los usuarios podrán copiar todos los posts, incluso aquellos de "
|
163 |
+
#~ "usuarios de nivel más alto"
|
164 |
+
#~ msgid "Save Changes"
|
165 |
+
#~ msgstr "Guardar los cambios"
|
166 |
+
#~ msgid "Donate"
|
167 |
+
#~ msgstr "Hacer una donación"
|
168 |
+
#~ msgid "Translate"
|
169 |
+
#~ msgstr "Traducir"
|
170 |
+
#~ msgid "http://www.lopo.it/duplicate-post-plugin/"
|
171 |
+
#~ msgstr "Copy text \t http://www.lopo.it/duplicate-post-plugin/"
|
172 |
+
#~ msgid "Creates a copy of a post."
|
173 |
+
#~ msgstr "Crear una copia de las entradas."
|
174 |
+
#~ msgid "Enrico Battocchi"
|
175 |
+
#~ msgstr "Enrico Battocchi"
|
176 |
+
#~ msgid "http://www.lopo.it"
|
177 |
+
#~ msgstr "http://www.lopo.it"
|
178 |
+
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://poselab.com/
|
|
4 |
Tags: widget, gallery, youtube, channel, user
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 3.4.1
|
7 |
-
Stable tag: 1.4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -54,6 +54,7 @@ You can see a demo of the plugin at the following URL:
|
|
54 |
|
55 |
= Languages: =
|
56 |
* Spanish (es_ES) - [PoseLab](http://poselab.com/)
|
|
|
57 |
|
58 |
If you have created your own language pack, or have an update of an existing one, you can [send me](mailto:javierpose@gmail.com) your gettext PO and MO so that I can bundle it into the Youtube Channel Gallery.
|
59 |
|
@@ -81,12 +82,18 @@ The username who uploaded a video to Youtube is located below each video, where
|
|
81 |
|
82 |
== Changelog ==
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
= 1.4.7 =
|
85 |
-
* Removed parameter 'origin' from Youtube Player
|
86 |
|
87 |
= 1.4.6 =
|
88 |
* Tweak on CSS.
|
89 |
-
* Trying to
|
90 |
|
91 |
= 1.4.5 =
|
92 |
* Tweaks on CSS.
|
4 |
Tags: widget, gallery, youtube, channel, user
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 3.4.1
|
7 |
+
Stable tag: 1.4.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
54 |
|
55 |
= Languages: =
|
56 |
* Spanish (es_ES) - [PoseLab](http://poselab.com/)
|
57 |
+
* Brazilian Portuguese (pt_BR). Thanks to Rodny.
|
58 |
|
59 |
If you have created your own language pack, or have an update of an existing one, you can [send me](mailto:javierpose@gmail.com) your gettext PO and MO so that I can bundle it into the Youtube Channel Gallery.
|
60 |
|
82 |
|
83 |
== Changelog ==
|
84 |
|
85 |
+
= 1.4.8 =
|
86 |
+
* Fixed bug with shortcode position.
|
87 |
+
* Deleted decimals to thumbnail heights.
|
88 |
+
* Added background-size to CSS of thumbnails to control image size.
|
89 |
+
* Added Brazilian Portuguese (pt_BR). Thanks to Rodny.
|
90 |
+
|
91 |
= 1.4.7 =
|
92 |
+
* Removed parameter 'origin' from Youtube iframe Player to solve the issue that some users have on clicking the thumbnails.
|
93 |
|
94 |
= 1.4.6 =
|
95 |
* Tweak on CSS.
|
96 |
+
* Trying to correct issue that some users have with the player origin parameter.
|
97 |
|
98 |
= 1.4.5 =
|
99 |
* Tweaks on CSS.
|
styles.css
CHANGED
@@ -26,6 +26,7 @@ ul.ytchagallery li a{
|
|
26 |
border:1px solid #999;
|
27 |
background-position: center center;
|
28 |
background-repeat: no-repeat;
|
|
|
29 |
}
|
30 |
ul.ytchagallery li a .ytcplay{
|
31 |
background: url(img/play.png) -9999px -9999px no-repeat;
|
26 |
border:1px solid #999;
|
27 |
background-position: center center;
|
28 |
background-repeat: no-repeat;
|
29 |
+
background-size: 110%;
|
30 |
}
|
31 |
ul.ytchagallery li a .ytcplay{
|
32 |
background: url(img/play.png) -9999px -9999px no-repeat;
|
youtube-channel-gallery.php
CHANGED
@@ -1,317 +1,317 @@
|
|
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.4.
|
9 |
-
License: GPL2
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
*/
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
/**
|
30 |
-
* widget class.
|
31 |
-
*/
|
32 |
-
class YoutubeChannelGallery_Widget extends WP_Widget {
|
33 |
|
34 |
-
/**
|
35 |
-
* Register widget with WordPress.
|
36 |
-
*/
|
37 |
-
public function __construct() {
|
38 |
|
39 |
-
//localization
|
40 |
-
load_plugin_textdomain('youtube-channel-gallery', false, dirname(plugin_basename( __FILE__ ) ) . '/languages/' );
|
41 |
-
add_shortcode('Youtube_Channel_Gallery', array($this, 'YoutubeChannelGallery_Shortcode'));
|
42 |
-
|
43 |
-
parent::__construct(
|
44 |
-
'youtubechannelgallery_widget', // Base ID
|
45 |
-
__( 'Youtube Channel Gallery', 'youtube-channel-gallery' ), // Name
|
46 |
-
array( 'description' => __( 'Show a youtube video and a gallery of thumbnails for a youtube channel', 'youtube-channel-gallery' ), ) // Args
|
47 |
-
);
|
48 |
-
}
|
49 |
|
50 |
/**
|
51 |
-
*
|
52 |
*/
|
53 |
-
|
54 |
|
55 |
-
|
56 |
-
|
|
|
|
|
57 |
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
64 |
|
65 |
-
|
|
|
66 |
|
67 |
-
|
68 |
-
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
$instance = $old_instance;
|
75 |
-
$instance['title'] = strip_tags( $new_instance['title'] );
|
76 |
-
$instance['ytchag_user'] = strip_tags( $new_instance['ytchag_user'] );
|
77 |
-
|
78 |
-
$instance['ytchag_link'] = $new_instance['ytchag_link'];
|
79 |
-
$instance['ytchag_maxitems'] = strip_tags( $new_instance['ytchag_maxitems'] );
|
80 |
-
$instance['ytchag_video_width'] = strip_tags( $new_instance['ytchag_video_width'] );
|
81 |
-
$instance['ytchag_thumb_width'] = strip_tags( $new_instance['ytchag_thumb_width'] );
|
82 |
-
$instance['ytchag_thumb_columns'] = strip_tags( $new_instance['ytchag_thumb_columns'] );
|
83 |
-
$instance['ytchag_theme'] = strip_tags( $new_instance['ytchag_theme'] );
|
84 |
|
85 |
-
|
86 |
-
}
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
$ytchag_thumb_columns = strip_tags($instance['ytchag_thumb_columns']);
|
99 |
-
$ytchag_theme = strip_tags($instance['ytchag_theme']);
|
100 |
-
?>
|
101 |
-
<p>
|
102 |
-
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'youtube-channel-gallery' ); ?></label>
|
103 |
-
<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 ); ?>" />
|
104 |
-
</p>
|
105 |
-
|
106 |
-
<p>
|
107 |
-
<label for="<?php echo $this->get_field_id( 'ytchag_user' ); ?>"><?php _e( 'YouTube user name:', 'youtube-channel-gallery' ); ?></label>
|
108 |
-
<input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_user' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_user' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_user ); ?>" />
|
109 |
-
</p>
|
110 |
-
|
111 |
-
<p>
|
112 |
-
<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' ); ?>" />
|
113 |
-
<label for="<?php echo $this->get_field_id( 'ytchag_link' ); ?>"><?php _e('Show link to channel:', 'youtube-channel-gallery'); ?></label><br />
|
114 |
-
</p>
|
115 |
-
|
116 |
-
<p>
|
117 |
-
<label for="ytchag_maxitems"><?php _e( 'Number of videos to show:', 'youtube-channel-gallery' ); ?></label>
|
118 |
-
<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 ); ?>" />
|
119 |
-
</p>
|
120 |
-
|
121 |
-
<p>
|
122 |
-
<label for="ytchag_video_width"><?php _e( 'Video width:', 'youtube-channel-gallery' ); ?></label>
|
123 |
-
<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 ); ?>" />
|
124 |
-
</p>
|
125 |
-
|
126 |
-
<p>
|
127 |
-
<label for="ytchag_thumb_width"><?php _e( 'Thumbnail width:', 'youtube-channel-gallery' ); ?></label>
|
128 |
-
<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 ); ?>" />
|
129 |
-
</p>
|
130 |
-
|
131 |
-
<p>
|
132 |
-
<label for="ytchag_thumb_columns"><?php _e( 'Thumbnail columns:', 'youtube-channel-gallery' ); ?></label>
|
133 |
-
<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 ); ?>" />
|
134 |
-
</p>
|
135 |
-
|
136 |
-
<p>
|
137 |
-
<label for="ytchag_theme"><?php _e( 'Theme:', 'youtube-channel-gallery' ); ?></label>
|
138 |
-
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_theme' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_theme' ); ?>">
|
139 |
-
<option value="dark"<?php selected( $instance['ytchag_theme'], 'dark' ); ?>><?php _e( 'Dark', 'youtube-channel-gallery' ); ?></option>
|
140 |
-
<option value="light"<?php selected( $instance['ytchag_theme'], 'light' ); ?>><?php _e( 'Light', 'youtube-channel-gallery' ); ?></option>
|
141 |
-
</select>
|
142 |
-
</p>
|
143 |
-
|
144 |
-
<?php
|
145 |
-
}
|
146 |
-
|
147 |
-
|
148 |
-
/*--------------------------------------------------*/
|
149 |
-
/* Private Functions
|
150 |
-
/*--------------------------------------------------*/
|
151 |
-
private function ytchag_rss_markup($instance){
|
152 |
-
|
153 |
-
//$instance variables
|
154 |
-
$ytchag_user = apply_filters('ytchag_user', $instance['ytchag_user']);
|
155 |
-
$ytchag_link = apply_filters('ytchag_link', $instance['ytchag_link']);
|
156 |
-
$ytchag_maxitems = apply_filters('ytchag_maxitems', $instance['ytchag_maxitems']);
|
157 |
-
$ytchag_video_width = apply_filters('ytchag_video_width', $instance['ytchag_video_width']);
|
158 |
-
$ytchag_thumb_width = apply_filters('ytchag_thumb_width', $instance['ytchag_thumb_width']);
|
159 |
-
$ytchag_thumb_columns = apply_filters('ytchag_thumb_columns', $instance['ytchag_thumb_columns']);
|
160 |
-
$ytchag_theme = apply_filters('ytchag_theme', $instance['ytchag_theme']);
|
161 |
-
|
162 |
-
//defaults
|
163 |
-
$ytchag_video_width = ( $ytchag_video_width ) ? $ytchag_video_width : 250;
|
164 |
-
$ytchag_thumb_width = ( $ytchag_thumb_width ) ? $ytchag_thumb_width : 85;
|
165 |
-
$ytchag_thumb_columns = ( $ytchag_thumb_columns ) ? $ytchag_thumb_columns : 0;
|
166 |
-
$ytchag_theme = ( $ytchag_theme ) ? $ytchag_theme : 'dark';
|
167 |
-
|
168 |
-
//heights of video and thumbnail
|
169 |
-
$ytchag_video_heigh = round($ytchag_video_width/(16/9) + 32);
|
170 |
-
$ytchag_thumb_height = $ytchag_thumb_width*75/100; // 75% 'cos sizes of thumbnail in xml file are 480x360 and 120x90
|
171 |
-
|
172 |
-
if( $ytchag_user ) { // only if user name inserted
|
173 |
-
|
174 |
-
// links
|
175 |
-
$ytchag_rss_url = "http://gdata.youtube.com/feeds/api/users/" . $ytchag_user . "/uploads";
|
176 |
-
$ytchag_link_url = "http://www.youtube.com/user/" . $ytchag_user;
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
|
179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
|
181 |
-
|
|
|
|
|
|
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
|
|
|
186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
-
if (!empty($items)) {
|
189 |
-
$i = 0;
|
190 |
-
$column = 0;
|
191 |
-
foreach ( $items as $item ) {
|
192 |
-
|
193 |
-
$url = $item->get_permalink();
|
194 |
-
$youtubeid = $this->youtubeid($url);
|
195 |
-
$title = $item->get_title();
|
196 |
|
197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
|
199 |
-
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
201 |
|
202 |
-
//
|
203 |
-
$
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
}
|
|
|
209 |
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
|
|
215 |
}
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
//count the plugin occurrences on page
|
221 |
-
STATIC $plugincount = 0;
|
222 |
-
$plugincount++;
|
223 |
-
?>
|
224 |
-
<iframe id="ytcplayer<?php echo $plugincount; ?>" class="ytcplayer" type="text/html" width="<?php echo $ytchag_video_width; ?>" height="<?php echo $ytchag_video_heigh; ?>" src="http://www.youtube.com/embed/<?php echo $youtubeid; ?>?&autoplay=0&theme=<?php echo $ytchag_theme; ?>&enablejsapi=1" frameborder="0"></iframe>
|
225 |
-
<ul class="ytchagallery">
|
226 |
-
|
227 |
-
<?php
|
228 |
-
} // if player end
|
229 |
-
$i++;
|
230 |
-
|
231 |
-
$column++;
|
232 |
-
// list of thumbnail videos
|
233 |
-
?>
|
234 |
-
<li class="ytccell-<?php echo $column; ?>">
|
235 |
-
<a class="ytcthumb" href="javascript: ytcplayVideo('ytcplayer<?php echo $plugincount; ?>', '<?php echo $youtubeid; ?>');" alt="<?php echo $title; ?>" title="<?php echo $title; ?>" style="background-image: url(<?php echo $thumb; ?>);">
|
236 |
-
<div class="ytcplay" style="width: <?php echo $ytchag_thumb_width; ?>px; height: <?php echo $ytchag_thumb_height; ?>px"></div>
|
237 |
-
</a>
|
238 |
-
</li>
|
239 |
-
|
240 |
-
<?php
|
241 |
-
if($ytchag_thumb_columns !=0 && $column%$ytchag_thumb_columns === 0){
|
242 |
-
$column = 0;
|
243 |
-
}
|
244 |
-
} //foreach end
|
245 |
-
?>
|
246 |
-
</ul>
|
247 |
-
<?php
|
248 |
-
//link to youtube.com gallery
|
249 |
-
if( $ytchag_link) {
|
250 |
-
?>
|
251 |
-
<a href="<?php echo $ytchag_link_url ?>" class="more"><?php _e('Show more videos»', 'youtube-channel-gallery') ?></a>
|
252 |
-
<?php
|
253 |
-
}
|
254 |
}
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
$instance['ytchag_thumb_columns'] = $thumbcolumns;
|
303 |
-
$instance['ytchag_theme'] = $theme;
|
304 |
|
305 |
|
306 |
-
|
307 |
|
308 |
-
|
309 |
|
310 |
|
311 |
-
} // class YoutubeChannelGallery_Widget
|
312 |
|
313 |
-
// register YoutubeChannelGallery_Widget widget
|
314 |
-
add_action( 'widgets_init', create_function( '', 'register_widget( "YoutubeChannelGallery_Widget" );' ) );
|
315 |
|
316 |
|
317 |
-
?>
|
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.4.8
|
9 |
+
License: GPL2
|
10 |
+
|
11 |
+
Copyright 2010 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,
|
18 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
+
GNU General Public License for more details.
|
21 |
+
|
22 |
+
You should have received a copy of the GNU General Public License
|
23 |
+
along with this program; if not, write to the Free Software
|
24 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
|
|
|
|
|
|
|
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
/**
|
30 |
+
* widget class.
|
31 |
*/
|
32 |
+
class YoutubeChannelGallery_Widget extends WP_Widget {
|
33 |
|
34 |
+
/**
|
35 |
+
* Register widget with WordPress.
|
36 |
+
*/
|
37 |
+
public function __construct() {
|
38 |
|
39 |
+
//localization
|
40 |
+
load_plugin_textdomain('youtube-channel-gallery', false, dirname(plugin_basename( __FILE__ ) ) . '/languages/' );
|
41 |
+
add_shortcode('Youtube_Channel_Gallery', array($this, 'YoutubeChannelGallery_Shortcode'));
|
42 |
+
|
43 |
+
parent::__construct(
|
44 |
+
'youtubechannelgallery_widget', // Base ID
|
45 |
+
__( 'Youtube Channel Gallery', 'youtube-channel-gallery' ), // Name
|
46 |
+
array( 'description' => __( 'Show a youtube video and a gallery of thumbnails for a youtube channel', 'youtube-channel-gallery' ), ) // Args
|
47 |
+
);
|
48 |
+
}
|
49 |
|
50 |
+
/**
|
51 |
+
* Front-end display of widget.
|
52 |
+
*/
|
53 |
+
public function widget( $args, $instance ) {
|
54 |
|
55 |
+
// Load JavaScript and stylesheets
|
56 |
+
$this->register_scripts_and_styles();
|
57 |
|
58 |
+
extract( $args );
|
59 |
+
$title = apply_filters( 'widget_title', $instance['title'] );
|
60 |
|
61 |
+
echo $before_widget;
|
62 |
+
if ( ! empty( $title ) ){
|
63 |
+
echo $before_title . $title . $after_title;
|
64 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
+
echo $this->ytchag_rss_markup($instance);
|
|
|
67 |
|
68 |
+
echo $after_widget;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Sanitize widget form values as they are saved.
|
73 |
+
*/
|
74 |
+
public function update( $new_instance, $old_instance ) {
|
75 |
+
$instance = $old_instance;
|
76 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
77 |
+
$instance['ytchag_user'] = strip_tags( $new_instance['ytchag_user'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
+
$instance['ytchag_link'] = $new_instance['ytchag_link'];
|
80 |
+
$instance['ytchag_maxitems'] = strip_tags( $new_instance['ytchag_maxitems'] );
|
81 |
+
$instance['ytchag_video_width'] = strip_tags( $new_instance['ytchag_video_width'] );
|
82 |
+
$instance['ytchag_thumb_width'] = strip_tags( $new_instance['ytchag_thumb_width'] );
|
83 |
+
$instance['ytchag_thumb_columns'] = strip_tags( $new_instance['ytchag_thumb_columns'] );
|
84 |
+
$instance['ytchag_theme'] = strip_tags( $new_instance['ytchag_theme'] );
|
85 |
+
|
86 |
+
return $instance;
|
87 |
+
}
|
88 |
|
89 |
+
/**
|
90 |
+
* Back-end widget form.
|
91 |
+
*/
|
92 |
+
public function form( $instance ) {
|
93 |
+
$title = esc_attr($instance['title']);
|
94 |
+
$ytchag_user = strip_tags($instance['ytchag_user']);
|
95 |
+
$ytchag_link = esc_attr($instance['ytchag_link']);
|
96 |
+
$ytchag_maxitems = strip_tags($instance['ytchag_maxitems']);
|
97 |
+
$ytchag_video_width = strip_tags($instance['ytchag_video_width']);
|
98 |
+
$ytchag_thumb_width = strip_tags($instance['ytchag_thumb_width']);
|
99 |
+
$ytchag_thumb_columns = strip_tags($instance['ytchag_thumb_columns']);
|
100 |
+
$ytchag_theme = strip_tags($instance['ytchag_theme']);
|
101 |
+
?>
|
102 |
+
<p>
|
103 |
+
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'youtube-channel-gallery' ); ?></label>
|
104 |
+
<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 ); ?>" />
|
105 |
+
</p>
|
106 |
+
|
107 |
+
<p>
|
108 |
+
<label for="<?php echo $this->get_field_id( 'ytchag_user' ); ?>"><?php _e( 'YouTube user name:', 'youtube-channel-gallery' ); ?></label>
|
109 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'ytchag_user' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_user' ); ?>" type="text" value="<?php echo esc_attr( $ytchag_user ); ?>" />
|
110 |
+
</p>
|
111 |
|
112 |
+
<p>
|
113 |
+
<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' ); ?>" />
|
114 |
+
<label for="<?php echo $this->get_field_id( 'ytchag_link' ); ?>"><?php _e('Show link to channel:', 'youtube-channel-gallery'); ?></label><br />
|
115 |
+
</p>
|
116 |
|
117 |
+
<p>
|
118 |
+
<label for="ytchag_maxitems"><?php _e( 'Number of videos to show:', 'youtube-channel-gallery' ); ?></label>
|
119 |
+
<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 ); ?>" />
|
120 |
+
</p>
|
121 |
|
122 |
+
<p>
|
123 |
+
<label for="ytchag_video_width"><?php _e( 'Video width:', 'youtube-channel-gallery' ); ?></label>
|
124 |
+
<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 ); ?>" />
|
125 |
+
</p>
|
126 |
+
|
127 |
+
<p>
|
128 |
+
<label for="ytchag_thumb_width"><?php _e( 'Thumbnail width:', 'youtube-channel-gallery' ); ?></label>
|
129 |
+
<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 ); ?>" />
|
130 |
+
</p>
|
131 |
+
|
132 |
+
<p>
|
133 |
+
<label for="ytchag_thumb_columns"><?php _e( 'Thumbnail columns:', 'youtube-channel-gallery' ); ?></label>
|
134 |
+
<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 ); ?>" />
|
135 |
+
</p>
|
136 |
+
|
137 |
+
<p>
|
138 |
+
<label for="ytchag_theme"><?php _e( 'Theme:', 'youtube-channel-gallery' ); ?></label>
|
139 |
+
<select class="widefat" id="<?php echo $this->get_field_id( 'ytchag_theme' ); ?>" name="<?php echo $this->get_field_name( 'ytchag_theme' ); ?>">
|
140 |
+
<option value="dark"<?php selected( $instance['ytchag_theme'], 'dark' ); ?>><?php _e( 'Dark', 'youtube-channel-gallery' ); ?></option>
|
141 |
+
<option value="light"<?php selected( $instance['ytchag_theme'], 'light' ); ?>><?php _e( 'Light', 'youtube-channel-gallery' ); ?></option>
|
142 |
+
</select>
|
143 |
+
</p>
|
144 |
+
|
145 |
+
<?php
|
146 |
+
}
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
+
/*--------------------------------------------------*/
|
150 |
+
/* Private Functions
|
151 |
+
/*--------------------------------------------------*/
|
152 |
+
private function ytchag_rss_markup($instance){
|
153 |
+
|
154 |
+
//$instance variables
|
155 |
+
$ytchag_user = apply_filters('ytchag_user', $instance['ytchag_user']);
|
156 |
+
$ytchag_link = apply_filters('ytchag_link', $instance['ytchag_link']);
|
157 |
+
$ytchag_maxitems = apply_filters('ytchag_maxitems', $instance['ytchag_maxitems']);
|
158 |
+
$ytchag_video_width = apply_filters('ytchag_video_width', $instance['ytchag_video_width']);
|
159 |
+
$ytchag_thumb_width = apply_filters('ytchag_thumb_width', $instance['ytchag_thumb_width']);
|
160 |
+
$ytchag_thumb_columns = apply_filters('ytchag_thumb_columns', $instance['ytchag_thumb_columns']);
|
161 |
+
$ytchag_theme = apply_filters('ytchag_theme', $instance['ytchag_theme']);
|
162 |
+
|
163 |
+
//defaults
|
164 |
+
$ytchag_video_width = ( $ytchag_video_width ) ? $ytchag_video_width : 250;
|
165 |
+
$ytchag_thumb_width = ( $ytchag_thumb_width ) ? $ytchag_thumb_width : 85;
|
166 |
+
$ytchag_thumb_columns = ( $ytchag_thumb_columns ) ? $ytchag_thumb_columns : 0;
|
167 |
+
$ytchag_theme = ( $ytchag_theme ) ? $ytchag_theme : 'dark';
|
168 |
+
|
169 |
+
//heights of video and thumbnail
|
170 |
+
$ytchag_video_heigh = round($ytchag_video_width/(16/9) + 32);
|
171 |
+
$ytchag_thumb_height = round($ytchag_thumb_width*75/100); // 75% 'cos sizes of thumbnail in xml file are 480x360 and 120x90
|
172 |
+
|
173 |
+
if( $ytchag_user ) { // only if user name inserted
|
174 |
+
|
175 |
+
// links
|
176 |
+
$ytchag_rss_url = "http://gdata.youtube.com/feeds/api/users/" . $ytchag_user . "/uploads";
|
177 |
+
$ytchag_link_url = "http://www.youtube.com/user/" . $ytchag_user;
|
178 |
+
|
179 |
+
|
180 |
+
//RSS Feed
|
181 |
+
|
182 |
+
include_once(ABSPATH . WPINC . '/feed.php');
|
183 |
+
|
184 |
+
$rss = fetch_feed($ytchag_rss_url);
|
185 |
+
$maxitems = ( $ytchag_maxitems ) ? $ytchag_maxitems : 9;
|
186 |
+
$items = $rss->get_items(0, $maxitems);
|
187 |
+
|
188 |
+
|
189 |
+
if (!empty($items)) {
|
190 |
+
$i = 0;
|
191 |
+
$column = 0;
|
192 |
+
foreach ( $items as $item ) {
|
193 |
+
|
194 |
+
$url = $item->get_permalink();
|
195 |
+
$youtubeid = $this->youtubeid($url);
|
196 |
+
$title = $item->get_title();
|
197 |
+
|
198 |
+
if ($enclosure = $item->get_enclosure()){
|
199 |
+
|
200 |
+
//extract thumbnail
|
201 |
+
//-----------------
|
202 |
+
|
203 |
+
//thumbnail index in xml
|
204 |
+
$big = 0;
|
205 |
+
$small = 1;
|
206 |
+
$size = $small;
|
207 |
+
if($ytchag_thumb_width > '120'){
|
208 |
+
$size = $big;
|
209 |
+
}
|
210 |
|
211 |
+
$allThumbs = $enclosure->get_thumbnails();
|
212 |
+
foreach ($allThumbs as $index => $allThumb) {
|
213 |
+
if ($index == $size) {
|
214 |
+
$thumb = $allThumbs[$index];
|
215 |
+
}
|
216 |
+
}
|
217 |
+
}
|
218 |
|
219 |
+
//Show me the player: iframe player
|
220 |
+
if($i == 0) {
|
221 |
+
//count the plugin occurrences on page
|
222 |
+
STATIC $plugincount = 0;
|
223 |
+
$plugincount++;
|
224 |
+
|
225 |
+
$content = '<iframe id="ytcplayer' . $plugincount . '" class="ytcplayer" width="' . $ytchag_video_width . '" height="' . $ytchag_video_heigh . '" src="http://www.youtube.com/embed/' . $youtubeid . '?&autoplay=0&theme=' . $ytchag_theme . '&enablejsapi=1" frameborder="0"></iframe>';
|
226 |
+
|
227 |
+
$content.= '<ul class="ytchagallery">';
|
228 |
+
|
229 |
+
} // if player end
|
230 |
+
$i++;
|
231 |
+
|
232 |
+
$column++;
|
233 |
+
// list of thumbnail videos
|
234 |
+
|
235 |
+
$content.= '<li class="ytccell-' . $column . '">';
|
236 |
+
$content.= '<a class="ytcthumb" href="javascript: ytcplayVideo(\'ytcplayer' . $plugincount . '\', \'' . $youtubeid . '\');" alt="' . $title . '" title="' . $title . '" style="background-image: url(' . $thumb . ');">';
|
237 |
+
$content.= '<div class="ytcplay" style="width: ' . $ytchag_thumb_width . 'px; height: ' . $ytchag_thumb_height . 'px"></div>';
|
238 |
+
$content.= '</a></li>';
|
239 |
+
|
240 |
+
if($ytchag_thumb_columns !=0 && $column%$ytchag_thumb_columns === 0){
|
241 |
+
$column = 0;
|
242 |
}
|
243 |
+
} //foreach end
|
244 |
|
245 |
+
$content.= '</ul>';
|
246 |
+
|
247 |
+
//link to youtube.com gallery
|
248 |
+
if( $ytchag_link) {
|
249 |
+
$content.= '<a href="' . $ytchag_link_url . '" class="more">' . __('Show more videos»', 'youtube-channel-gallery') . '</a>';
|
250 |
+
|
251 |
}
|
252 |
+
}
|
253 |
+
} else {
|
254 |
+
$content.= '<p class="empty">' . __('There is no video to show.', 'youtube-channel-gallery') . '</p>';
|
255 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
}
|
257 |
+
|
258 |
+
return $content;
|
259 |
+
|
260 |
+
}//ytchag_rss_markup
|
261 |
+
|
262 |
+
//parse youtube url to extract id
|
263 |
+
private function youtubeid($url) {
|
264 |
+
$url_string = parse_url($url, PHP_URL_QUERY);
|
265 |
+
parse_str($url_string, $args);
|
266 |
+
return isset($args['v']) ? $args['v'] : false;
|
267 |
+
}//youtubeid
|
268 |
+
|
269 |
+
|
270 |
+
// load css or js
|
271 |
+
private function register_scripts_and_styles() {
|
272 |
+
wp_enqueue_script('youtube_player_api', 'http://www.youtube.com/player_api', false, false, true);
|
273 |
+
wp_enqueue_script('youtube-channel-gallery', plugins_url('/scripts.js', __FILE__), false, false, true);
|
274 |
+
wp_enqueue_style('youtube-channel-gallery', plugins_url('/styles.css', __FILE__), false, false, 'all');
|
275 |
+
}//register_scripts_and_styles
|
276 |
+
|
277 |
+
/*--------------------------------------------------*/
|
278 |
+
/* Shortcode
|
279 |
+
/*--------------------------------------------------*/
|
280 |
+
|
281 |
+
public function YoutubeChannelGallery_Shortcode($atts) {
|
282 |
+
|
283 |
+
// Load JavaScript and stylesheets
|
284 |
+
$this->register_scripts_and_styles();
|
285 |
+
|
286 |
+
extract( shortcode_atts( array(
|
287 |
+
'user' => '',
|
288 |
+
'link' => '0',
|
289 |
+
'maxitems' => '9',
|
290 |
+
'videowidth' => '280',
|
291 |
+
'thumbwidth' => '85',
|
292 |
+
'thumbcolumns' => '0',
|
293 |
+
'theme' => 'dark',
|
294 |
+
), $atts ) );
|
295 |
+
|
296 |
+
$instance['ytchag_user'] = $user;
|
297 |
+
|
298 |
+
$instance['ytchag_link'] = $link;
|
299 |
+
$instance['ytchag_maxitems'] = $maxitems;
|
300 |
+
$instance['ytchag_video_width'] = $videowidth;
|
301 |
+
$instance['ytchag_thumb_width'] = $thumbwidth;
|
302 |
+
$instance['ytchag_thumb_columns'] = $thumbcolumns;
|
303 |
+
$instance['ytchag_theme'] = $theme;
|
|
|
|
|
304 |
|
305 |
|
306 |
+
return $this->ytchag_rss_markup($instance);
|
307 |
|
308 |
+
} // YoutubeChannelGallery_Shortcode
|
309 |
|
310 |
|
311 |
+
} // class YoutubeChannelGallery_Widget
|
312 |
|
313 |
+
// register YoutubeChannelGallery_Widget widget
|
314 |
+
add_action( 'widgets_init', create_function( '', 'register_widget( "YoutubeChannelGallery_Widget" );' ) );
|
315 |
|
316 |
|
317 |
+
?>
|