Youtube Channel Gallery - Version 1.0

Version Description

  • Initial Release
Download this release

Release Info

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

Version 1.0

img/play.gif ADDED
Binary file
languages/youtube-channel-gallery-es_ES.mo ADDED
Binary file
languages/youtube-channel-gallery-es_ES.po ADDED
@@ -0,0 +1,137 @@
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-09 17:28+0100\n"
11
+ "PO-Revision-Date: 2012-07-09 17:38+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: Spanish\n"
21
+ "X-Poedit-Country: SPAIN\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:42
27
+ msgid "Youtube Channel Gallery"
28
+ msgstr "Galería de Canal de Youtube"
29
+
30
+ #: youtube-channel-gallery.php:43
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:99
35
+ msgid "Title:"
36
+ msgstr "Título:"
37
+
38
+ #: youtube-channel-gallery.php:104
39
+ msgid "YouTube user name:"
40
+ msgstr "Nombre de usuario de Youtube:"
41
+
42
+ #: youtube-channel-gallery.php:110
43
+ msgid "Show link to channel:"
44
+ msgstr "Mostrar enlace al canal:"
45
+
46
+ #: youtube-channel-gallery.php:114
47
+ msgid "Number of videos to show:"
48
+ msgstr "Número de vídeos a mostrar:"
49
+
50
+ #: youtube-channel-gallery.php:119
51
+ msgid "Video width:"
52
+ msgstr "Ancho del vídeo:"
53
+
54
+ #: youtube-channel-gallery.php:124
55
+ msgid "Thumbnail width:"
56
+ msgstr "Ancho de miniaturas:"
57
+
58
+ #: youtube-channel-gallery.php:129
59
+ msgid "Thumbnail columns:"
60
+ msgstr "Columnas de las miniaturas:"
61
+
62
+ #: youtube-channel-gallery.php:259
63
+ msgid "Show more videos»"
64
+ msgstr "Ver más vídeos»"
65
+
66
+ #: youtube-channel-gallery.php:265
67
+ msgid "There is no video to show."
68
+ msgstr "No hay ningún vídeo para mostrar."
69
+
70
+ #~ msgid "No post to duplicate has been supplied!"
71
+ #~ msgstr "No se facilitó ninguna entrada a copiar"
72
+ #~ msgid "Post creation failed, could not find original post:"
73
+ #~ msgstr ""
74
+ #~ "Creación realizada sin éxito, no ha sido posible encontrar la entrada "
75
+ #~ "original:"
76
+ #~ msgid "No page to duplicate has been supplied!"
77
+ #~ msgstr "No se facilitó ninguna página a copiar"
78
+ #~ msgid "Make a duplicate from this post"
79
+ #~ msgstr "Crea una copia de esta entrada"
80
+ #~ msgid "Duplicate"
81
+ #~ msgstr "Duplicar"
82
+ #~ msgid "Make a duplicate from this page"
83
+ #~ msgstr "Crea una copia de esta página"
84
+ #~ msgid "Copy to a new draft"
85
+ #~ msgstr "Copia en un borrador nuevo"
86
+ #~ msgid "Duplicate Post Options"
87
+ #~ msgstr "Opciones"
88
+ #~ msgid "Duplicate Post"
89
+ #~ msgstr "Duplicate Post"
90
+ #~ msgid "Copy post/page date also"
91
+ #~ msgstr "Copiar también fecha del post o la página"
92
+ #~ msgid ""
93
+ #~ "Normally, the new draft has publication date set to current time: check "
94
+ #~ "the box to copy the original post/page date"
95
+ #~ msgstr ""
96
+ #~ "Normalmente se establece la fecha de publicación del nuevo borrador a la "
97
+ #~ "fecha actual: compruebe la casilla para copiar la fecha original del post "
98
+ #~ "o la página"
99
+ #~ msgid "Do not copy these fields"
100
+ #~ msgstr "No copiar estos campos"
101
+ #~ msgid ""
102
+ #~ "Comma-separated list of meta fields that must not be copied when cloning "
103
+ #~ "a post/page"
104
+ #~ msgstr ""
105
+ #~ "Lista separada por comas de meta campos que no pueden ser copiados cuando "
106
+ #~ "se clona una entrada/pagina."
107
+ #~ msgid "Title prefix"
108
+ #~ msgstr "Prefijo del titulo"
109
+ #~ msgid ""
110
+ #~ "Prefix to be added before the original title when cloning a post/page, e."
111
+ #~ "g. \"Copy of\" (blank for no prefix)"
112
+ #~ msgstr ""
113
+ #~ "Prefijo a ser agregado antes del titulo original cuando se clona una "
114
+ #~ "entrada/pagina, ej. \"Copia de\" (en blanco para no agregar prefijo)"
115
+ #~ msgid "Minimum level to copy posts"
116
+ #~ msgstr "Nivel mínimo para copiar posts"
117
+ #~ msgid ""
118
+ #~ "Warning: users will be able to copy all posts, even those of higher level "
119
+ #~ "users"
120
+ #~ msgstr ""
121
+ #~ "Atención: los usuarios podrán copiar todos los posts, incluso aquellos de "
122
+ #~ "usuarios de nivel más alto"
123
+ #~ msgid "Save Changes"
124
+ #~ msgstr "Guardar los cambios"
125
+ #~ msgid "Donate"
126
+ #~ msgstr "Hacer una donación"
127
+ #~ msgid "Translate"
128
+ #~ msgstr "Traducir"
129
+ #~ msgid "http://www.lopo.it/duplicate-post-plugin/"
130
+ #~ msgstr "Copy text \t http://www.lopo.it/duplicate-post-plugin/"
131
+ #~ msgid "Creates a copy of a post."
132
+ #~ msgstr "Crear una copia de las entradas."
133
+ #~ msgid "Enrico Battocchi"
134
+ #~ msgstr "Enrico Battocchi"
135
+ #~ msgid "http://www.lopo.it"
136
+ #~ msgstr "http://www.lopo.it"
137
+
readme.txt ADDED
@@ -0,0 +1,66 @@
1
+ === Youtube Channel Gallery ===
2
+ Contributors: Poselab
3
+ 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.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Show a youtube video and a gallery of thumbnails for a youtube channel.
12
+
13
+ == Description ==
14
+
15
+ Show a youtube video and a gallery of thumbnails for a youtube user channel.
16
+
17
+ = Features: =
18
+ * Display latest thumbnail videos from YouTube user channel.
19
+ * When you click on one of the thumbnails the video plays at the top.
20
+ * This plugin uses the YouTube IFrame player API that allows YouTube to serve an HTML5 player rather than a Flash player for mobile devices that do not support Flash.
21
+
22
+ = Widget fields: =
23
+ * Title: Widget Title.
24
+ * YouTube user name: the username of the user's Youtube videos you want to show.
25
+ * Show link to channel: option to display a link to the youtube user channel.
26
+ * Number of videos to show: It must be a number indicating the number of thumbnails to be displayed.
27
+ * Video width: indicates the width of the video player.
28
+ * Thumbnail size: indicates the width of the thumbnails. The height is automatically generated.
29
+ * Thumbnail columns: assign a numeric class to each thumbnail based on the number of columns to apply styles to each column.
30
+
31
+ = Demo: =
32
+ You can see a demo of the plugin at the following URL:
33
+
34
+ [Youtube Channel Gallery Demo](http://poselab.com/youtube-channel-gallery)
35
+
36
+ = Languages: =
37
+ * Spanish (es_ES) - [PoseLab](http://poselab.com/)
38
+
39
+ 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.
40
+
41
+
42
+ == Installation ==
43
+
44
+ 1. Upload the *.zip copy of this plugin into your WordPress through your 'Plugin' admin page.
45
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
46
+ 3. Place the widget in your desired sidebar through the "widgets" admin page
47
+
48
+ == Frequently Asked Questions ==
49
+
50
+ = Where is the “widgets” admin page? =
51
+
52
+ The “widgets” admin page is found in the administrator part (wp-admin) of your WordPress site. Go to Appearance > Widgets
53
+
54
+ = How do I find the YouTube user name? =
55
+
56
+ The username who uploaded a video to Youtube is located below each video, where says something like in this example, "Published on June 25, 2012 by DisneyShorts", where DisneyShorts is the username.
57
+
58
+ == Screenshots ==
59
+
60
+ 1. Youtube Channel Gallery admin area.
61
+ 2. Youtube Channel Gallery.
62
+
63
+ == Changelog ==
64
+
65
+ = 1.0 =
66
+ * Initial Release
screenshot-1.jpg ADDED
Binary file
screenshot-2.jpg ADDED
Binary file
youtube-channel-gallery.css ADDED
@@ -0,0 +1,15 @@
1
+ .ytcplayer{margin-bottom: 10px}
2
+ ul.ytcgallery{
3
+ margin: 0; padding: 0;
4
+ list-style: none; overflow:hidden
5
+ }
6
+ ul.ytcgallery li{
7
+ float:left;
8
+ margin: 0 10px 10px 0;padding: 0
9
+ }
10
+ ul.ytcgallery li a{
11
+ display: block;
12
+ border:1px solid #999;
13
+ background-position: center center;
14
+ background-repeat: no-repeat;
15
+ }
youtube-channel-gallery.php ADDED
@@ -0,0 +1,308 @@
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.0
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
+ class
31
+
32
+ */
33
+ class YoutubeChannelGallery_Widget extends WP_Widget {
34
+
35
+ /**
36
+ * Register widget with WordPress.
37
+ */
38
+ public function __construct() {
39
+
40
+ //localization
41
+ load_plugin_textdomain('youtube-channel-gallery', false, dirname(plugin_basename( __FILE__ ) ) . '/languages/' );
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
+ // Load JavaScript and stylesheets
50
+ $this->register_scripts_and_styles();
51
+
52
+ }
53
+
54
+ /**
55
+ * Front-end display of widget.
56
+ */
57
+ public function widget( $args, $instance ) {
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
+ $this->ytchag_rss_markup($instance);
66
+
67
+ echo $after_widget;
68
+ }
69
+
70
+ /**
71
+ * Sanitize widget form values as they are saved.
72
+ */
73
+ public function update( $new_instance, $old_instance ) {
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
+
84
+ return $instance;
85
+ }
86
+
87
+ /**
88
+ * Back-end widget form.
89
+ */
90
+ public function form( $instance ) {
91
+ $title = esc_attr($instance['title']);
92
+ $ytchag_user = strip_tags($instance['ytchag_user']);
93
+ $ytchag_link = esc_attr($instance['ytchag_link']);
94
+ $ytchag_maxitems = strip_tags($instance['ytchag_maxitems']);
95
+ $ytchag_video_width = strip_tags($instance['ytchag_video_width']);
96
+ $ytchag_thumb_width = strip_tags($instance['ytchag_thumb_width']);
97
+ $ytchag_thumb_columns = strip_tags($instance['ytchag_thumb_columns']);
98
+ ?>
99
+ <p>
100
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'youtube-channel-gallery' ); ?></label>
101
+ <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 ); ?>" />
102
+ </p>
103
+
104
+ <p>
105
+ <label for="<?php echo $this->get_field_id( 'ytchag_user' ); ?>"><?php _e( 'YouTube user name:', 'youtube-channel-gallery' ); ?></label>
106
+ <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 ); ?>" />
107
+ </p>
108
+
109
+ <p>
110
+ <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' ); ?>" />
111
+ <label for="<?php echo $this->get_field_id( 'ytchag_link' ); ?>"><?php _e('Show link to channel:', 'youtube-channel-gallery'); ?></label><br />
112
+ </p>
113
+
114
+ <p>
115
+ <label for="ytchag_maxitems"><?php _e( 'Number of videos to show:', 'youtube-channel-gallery' ); ?></label>
116
+ <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 ); ?>" />
117
+ </p>
118
+
119
+ <p>
120
+ <label for="ytchag_video_width"><?php _e( 'Video width:', 'youtube-channel-gallery' ); ?></label>
121
+ <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 ); ?>" />
122
+ </p>
123
+
124
+ <p>
125
+ <label for="ytchag_thumb_width"><?php _e( 'Thumbnail width:', 'youtube-channel-gallery' ); ?></label>
126
+ <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 ); ?>" />
127
+ </p>
128
+
129
+ <p>
130
+ <label for="ytchag_thumb_columns"><?php _e( 'Thumbnail columns:', 'youtube-channel-gallery' ); ?></label>
131
+ <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 ); ?>" />
132
+ </p>
133
+
134
+ <?php
135
+ }
136
+
137
+
138
+ /*--------------------------------------------------*/
139
+ /* Private Functions
140
+ /*--------------------------------------------------*/
141
+ private function ytchag_rss_markup($instance){
142
+
143
+ //$instance variables
144
+ $ytchag_user = apply_filters('ytchag_user', $instance['ytchag_user']);
145
+ $ytchag_link = apply_filters('ytchag_link', $instance['ytchag_link']);
146
+ $ytchag_maxitems = apply_filters('ytchag_maxitems', $instance['ytchag_maxitems']);
147
+ $ytchag_video_width = apply_filters('ytchag_video_width', $instance['ytchag_video_width']);
148
+ $ytchag_thumb_width = apply_filters('ytchag_thumb_width', $instance['ytchag_thumb_width']);
149
+ $ytchag_thumb_columns = apply_filters('ytchag_thumb_columns', $instance['ytchag_thumb_columns']);
150
+
151
+ //defaults
152
+ $ytchag_video_width = ( $ytchag_video_width ) ? $ytchag_video_width : 250;
153
+ $ytchag_thumb_width = ( $ytchag_thumb_width ) ? $ytchag_thumb_width : 85;
154
+ $ytchag_thumb_columns = ( $ytchag_thumb_columns ) ? $ytchag_thumb_columns : 0;
155
+
156
+ //heights of video and thumbnail
157
+ $ytchag_video_heigh = round($ytchag_video_width/(16/9) + 32);
158
+ $ytchag_thumb_height = $ytchag_thumb_width*75/100; // 75% 'cos sizes of thumbnail in xml file are 480x360 and 120x90
159
+
160
+ if( $ytchag_user ) { // only if user name inserted
161
+
162
+ // links
163
+ $ytchag_rss_url = "http://gdata.youtube.com/feeds/api/users/" . $ytchag_user . "/uploads";
164
+ $ytchag_link_url = "http://www.youtube.com/user/" . $ytchag_user;
165
+
166
+
167
+ //RSS Feed
168
+
169
+ include_once(ABSPATH . WPINC . '/feed.php');
170
+
171
+ $rss = fetch_feed($ytchag_rss_url);
172
+ $maxitems = ( $ytchag_maxitems ) ? $ytchag_maxitems : 9;
173
+ $items = $rss->get_items(0, $maxitems);
174
+
175
+
176
+ if (!empty($items)) {
177
+ $i = 0;
178
+ $column = 0;
179
+ foreach ( $items as $item ) {
180
+
181
+ $url = $item->get_permalink();
182
+ $youtubeid = $this->youtubeid($url);
183
+ $title = $item->get_title();
184
+
185
+ if ($enclosure = $item->get_enclosure()){
186
+
187
+ //extract thumbnail
188
+ //-----------------
189
+
190
+ //thumbnail index in xml
191
+ $big = 0;
192
+ $small = 1;
193
+ $size = $small;
194
+ if($ytchag_thumb_width > '120'){
195
+ $size = $big;
196
+ }
197
+
198
+ $allThumbs = $enclosure->get_thumbnails();
199
+ foreach ($allThumbs as $index => $allThumb) {
200
+ if ($index == $size) {
201
+ $thumb = $allThumbs[$index];
202
+ }
203
+ }
204
+ }
205
+
206
+ //Show me the player: iframe player
207
+ if($i == 0) {
208
+ //option IFrame embeds using <iframe> tags
209
+ //echo '<iframe id="ytcplayer" type="text/html" width="250" height="200" src="http://www.youtube.com/embed/'.$youtubeid.'?&autoplay=0&origin='.site_url().'" frameborder="0"></iframe>';
210
+
211
+ //IFrame Player API
212
+ ?>
213
+ <div id="ytcplayer" class="ytcplayer"></div>
214
+ <script>
215
+ var tag = document.createElement('script');
216
+ tag.src = 'http://www.youtube.com/player_api';
217
+ var firstScriptTag = document.getElementsByTagName('script')[0];
218
+ firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
219
+ var player;
220
+ function onYouTubePlayerAPIReady() {
221
+
222
+ player = new YT.Player('ytcplayer', {
223
+ width: '<?php echo $ytchag_video_width; ?>',
224
+ height: '<?php echo $ytchag_video_heigh; ?>',
225
+ videoId: '<?php echo $youtubeid; ?>'
226
+ });
227
+ }
228
+
229
+ function onYouTubePlayerAPIReady2(other) {
230
+ player.stopVideo();
231
+ player.loadVideoById(other);
232
+ }
233
+ </script>
234
+ <ul class="ytcgallery">
235
+
236
+ <?php
237
+ } // if player end
238
+ $i++;
239
+
240
+ $column++;
241
+ // list of thumbnail videos
242
+ ?>
243
+ <li class="ytccell-<?php echo $column; ?>">
244
+ <a class="db-yt-thumb" href="javascript: onYouTubePlayerAPIReady2('<?php echo $youtubeid; ?>');" alt="<?php echo $title; ?>" title="<?php echo $title; ?>" style="background-image: url(<?php echo $thumb; ?>); width: <?php echo $ytchag_thumb_width; ?>px; height: <?php echo $ytchag_thumb_height; ?>px">
245
+ <div class="db-yt-play"></div>
246
+ </a>
247
+ </li>
248
+
249
+ <?php
250
+ if($ytchag_thumb_columns !=0 && $column%$ytchag_thumb_columns === 0){
251
+ $column = 0;
252
+ }
253
+ } //foreach end
254
+ ?>
255
+ </ul>
256
+ <?php
257
+ //link to youtube.com gallery
258
+ if( $ytchag_link) {
259
+ ?>
260
+ <a href="<?php echo $ytchag_link_url ?>" class="more"><?php _e('Show more videos»', 'youtube-channel-gallery') ?></a>
261
+ <?php
262
+ }
263
+ }
264
+ } else {
265
+ ?>
266
+ <p class="empty"><?php _e('There is no video to show.', 'youtube-channel-gallery') ?></p>
267
+ <?php
268
+ }
269
+ }
270
+
271
+ //parse youtube url to extract id
272
+ private function youtubeid($url) {
273
+ $url_string = parse_url($url, PHP_URL_QUERY);
274
+ parse_str($url_string, $args);
275
+ return isset($args['v']) ? $args['v'] : false;
276
+ }
277
+
278
+ // load css or js
279
+ private function register_scripts_and_styles() {
280
+ //$this->load_file(PLUGIN_NAME, '/' . PLUGIN_SLUG . '/js/admin.js', true);
281
+ $this->load_file('youtube-channel-gallery', '/' . 'youtube-channel-gallery' . '/youtube-channel-gallery.css');
282
+ }
283
+
284
+ //register css or js
285
+ private function load_file($name, $file_path, $is_script = false) {
286
+ $url = WP_PLUGIN_URL . $file_path;
287
+ $file = WP_PLUGIN_DIR . $file_path;
288
+
289
+ if(file_exists($file)) {
290
+ if($is_script) {
291
+ wp_register_script($name, $url);
292
+ wp_enqueue_script($name);
293
+ } else {
294
+ wp_register_style($name, $url);
295
+ wp_enqueue_style($name);
296
+ }
297
+ }
298
+ } // end load_file
299
+
300
+
301
+
302
+
303
+ } // class YoutubeChannelGallery_Widget
304
+
305
+ // register YoutubeChannelGallery_Widget widget
306
+ add_action( 'widgets_init', create_function( '', 'register_widget( "YoutubeChannelGallery_Widget" );' ) );
307
+
308
+ ?>