YouTube Channel - Version 0.1.3

Version Description

  • Uses selected() instead of if [dimadin]
  • Uses sprintf for better i18n [dimadin]
  • Wraps some strings in gettext [dimadin]
  • Adds textdomain and loads it [dimadin]
  • Adds target="_blank" for channel link [dimadin]
  • Adds option to open channel link in popup
  • Uses plugin_dir_url() instead of guessing of location [dimadin]
  • Loads widget in its own function [dimadin]
  • Adds Serbian translation
Download this release

Release Info

Developer urkekg
Plugin Icon YouTube Channel
Version 0.1.3
Comparing to
See all releases

Code changes from version 0.1.2 to 0.1.3

languages/youtube-channel-sr_RS.mo ADDED
Binary file
languages/youtube-channel-sr_RS.po ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: \n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
13
+ "X-Poedit-Language: \n"
14
+ "X-Poedit-Country: \n"
15
+ "X-Poedit-SourceCharset: utf-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
17
+ "X-Poedit-Basepath: \n"
18
+ "X-Poedit-Bookmarks: \n"
19
+ "X-Poedit-SearchPath-0: .\n"
20
+ "X-Textdomain-Support: yes"
21
+
22
+ #: youtube-channel.php:23
23
+ #@ youtube-channel
24
+ msgid "YouTube Channel"
25
+ msgstr "YouTube Channel"
26
+
27
+ #: youtube-channel.php:45
28
+ #@ youtube-channel
29
+ msgid "Widget Title:"
30
+ msgstr "Наслов виџета:"
31
+
32
+ #: youtube-channel.php:46
33
+ #@ youtube-channel
34
+ msgid "Channel:"
35
+ msgstr "Канал:"
36
+
37
+ #: youtube-channel.php:47
38
+ #@ youtube-channel
39
+ msgid "Get random video from channel"
40
+ msgstr "Насумични видео са канала"
41
+
42
+ #: youtube-channel.php:48
43
+ #@ youtube-channel
44
+ msgid "Width"
45
+ msgstr "Ширина"
46
+
47
+ #: youtube-channel.php:48
48
+ #: youtube-channel.php:49
49
+ #@ youtube-channel
50
+ msgid "default"
51
+ msgstr "подразумевано"
52
+
53
+ #: youtube-channel.php:49
54
+ #@ youtube-channel
55
+ msgid "Height"
56
+ msgstr "Висина"
57
+
58
+ #: youtube-channel.php:50
59
+ #@ youtube-channel
60
+ msgid "Aspect ratio (relative to width):"
61
+ msgstr "Однос страница (база је ширина):"
62
+
63
+ #: youtube-channel.php:52
64
+ #@ youtube-channel
65
+ msgid "custom"
66
+ msgstr "прилагођено"
67
+
68
+ #: youtube-channel.php:58
69
+ #@ youtube-channel
70
+ msgid "What to show?"
71
+ msgstr "Шта да прикажем?"
72
+
73
+ #: youtube-channel.php:60
74
+ #@ youtube-channel
75
+ msgid "thumbnail"
76
+ msgstr "умањену слику"
77
+
78
+ #: youtube-channel.php:61
79
+ #@ youtube-channel
80
+ msgid "object (flash player)"
81
+ msgstr "објекат (флеш плејер)"
82
+
83
+ #: youtube-channel.php:62
84
+ #@ youtube-channel
85
+ msgid "iframe (HTML5 player)"
86
+ msgstr "уграђени фрејм (HTML5 плејер)"
87
+
88
+ #: youtube-channel.php:63
89
+ #@ youtube-channel
90
+ msgid "chromeless video"
91
+ msgstr "„chromeless“ видео"
92
+
93
+ #: youtube-channel.php:65
94
+ #@ youtube-channel
95
+ msgid "Fix height taken by controls"
96
+ msgstr "Поправи висину контрола"
97
+
98
+ #: youtube-channel.php:66
99
+ #@ youtube-channel
100
+ msgid "Autoplay video"
101
+ msgstr "Аутоматска репродукција"
102
+
103
+ #: youtube-channel.php:67
104
+ #@ youtube-channel
105
+ msgid "Hide player controls"
106
+ msgstr "Сакривање контрола"
107
+
108
+ #: youtube-channel.php:68
109
+ #@ youtube-channel
110
+ msgid "Hide video info"
111
+ msgstr "Сакривање информација о видеу"
112
+
113
+ #: youtube-channel.php:69
114
+ #@ youtube-channel
115
+ msgid "Show video title"
116
+ msgstr "Прикажи наслов видеа"
117
+
118
+ #: youtube-channel.php:71
119
+ #@ youtube-channel
120
+ msgid "Visit YouTube Channel text:"
121
+ msgstr "Текст за везу „посети Јутјуб канал“:"
122
+
123
+ #: youtube-channel.php:72
124
+ #@ youtube-channel
125
+ msgid "Show link to channel"
126
+ msgstr "Прикажи везу до канала"
127
+
128
+ #: youtube-channel.php:74
129
+ #@ youtube-channel
130
+ msgid "Use target=\"_blank\" (invalid XHTML)"
131
+ msgstr "Користи target=\"_blank\"<br />(даје невалидан XHTML)"
132
+
133
+ #: youtube-channel.php:159
134
+ #@ youtube-channel
135
+ msgid "No items"
136
+ msgstr "Нема видео снимака"
137
+
138
+ #: youtube-channel.php:183
139
+ #, php-format
140
+ #@ youtube-channel
141
+ msgid "Watch video %1$s published on %2$s"
142
+ msgstr "Погледај видео %1$s објављен дана %2$s"
143
+
144
+ #: youtube-channel.php:219
145
+ #, php-format
146
+ #@ youtube-channel
147
+ msgid "Visit channel %1$s"
148
+ msgstr "Посети канал %1$s"
149
+
150
+ #: youtube-channel.php:73
151
+ #@ youtube-channel
152
+ msgid "Open channel in new window/tab"
153
+ msgstr "Отвори канал у новом прозору"
154
+
155
+ #: youtube-channel.php:222
156
+ #@ youtube-channel
157
+ msgid "in new window/tab"
158
+ msgstr "у новом прозору/језичку"
159
+
languages/youtube-channel-xx_XX.pot ADDED
@@ -0,0 +1 @@
 
1
+ MIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: youtube, channel, widget, widgets, youtube player, flash player, rss, feed, video, thumbnail, embed, sidebar, chromeless, iframe, html5
5
  Requires at least: 3.0
6
  Tested up to: 3.1
7
- Stable tag: 0.1.2
8
 
9
  Sidebar widget that display latest video thumbnail, playable flash object or chromeless video from YouTube Channel.
10
 
@@ -30,9 +30,13 @@ If you like this extension and you find it useful, please rate it on the right s
30
  * Option to show video title on top of the video
31
  * Set custom text for link to channel
32
  * Option to show link to channel
 
 
 
33
 
34
  = Credits =
35
  Chromeless option borrowed from [Chromeless YouTube](http://wordpress.org/extend/plugins/chromeless-youtube/) extension.
 
36
 
37
  == Installation ==
38
  = Manual =
@@ -63,6 +67,17 @@ I could not to find widget with link to channel and thumbnail instead of video o
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
 
 
 
 
 
 
66
  = 0.1.2 =
67
  * Option to display random video from channel
68
 
@@ -77,6 +92,9 @@ I could not to find widget with link to channel and thumbnail instead of video o
77
 
78
  == Upgrade Notice ==
79
 
 
 
 
80
  = 0.1.2 =
81
  After upgrade set option for random video from channel.
82
 
@@ -89,5 +107,6 @@ Just try it and rate it. Only initial release is available right now.
89
  == Screenshots ==
90
 
91
  1. Widget configuration panel
92
- 2. Widget `YouTube Channel` in action with iframe video w/o controls
93
- 3. Widget `YouTube Channel` in action with iframe video w/ controls and fixed height
 
4
  Tags: youtube, channel, widget, widgets, youtube player, flash player, rss, feed, video, thumbnail, embed, sidebar, chromeless, iframe, html5
5
  Requires at least: 3.0
6
  Tested up to: 3.1
7
+ Stable tag: 0.1.3
8
 
9
  Sidebar widget that display latest video thumbnail, playable flash object or chromeless video from YouTube Channel.
10
 
30
  * Option to show video title on top of the video
31
  * Set custom text for link to channel
32
  * Option to show link to channel
33
+ * Option to open channel in new tab/window
34
+ * Option to use target="_blank" instead of javascript window.open() for chanel link in new tab/window
35
+ * Translated to Serbian
36
 
37
  = Credits =
38
  Chromeless option borrowed from [Chromeless YouTube](http://wordpress.org/extend/plugins/chromeless-youtube/) extension.
39
+ Code improvements and textdomain adds done by [dimadin](http://wordpress.org/extend/plugins/profile/dimadin).
40
 
41
  == Installation ==
42
  = Manual =
67
 
68
  == Changelog ==
69
 
70
+ = 0.1.3 =
71
+ * Uses selected() instead of if [dimadin]
72
+ * Uses sprintf for better i18n [dimadin]
73
+ * Wraps some strings in gettext [dimadin]
74
+ * Adds textdomain and loads it [dimadin]
75
+ * Adds target="_blank" for channel link [dimadin]
76
+ * Adds option to open channel link in popup
77
+ * Uses plugin_dir_url() instead of guessing of location [dimadin]
78
+ * Loads widget in its own function [dimadin]
79
+ * Adds Serbian translation
80
+
81
  = 0.1.2 =
82
  * Option to display random video from channel
83
 
92
 
93
  == Upgrade Notice ==
94
 
95
+ = 0.1.3 =
96
+ After upgrade check widget options.
97
+
98
  = 0.1.2 =
99
  After upgrade set option for random video from channel.
100
 
107
  == Screenshots ==
108
 
109
  1. Widget configuration panel
110
+ 2. Widget configuration panel localised to Serbian
111
+ 3. Widget `YouTube Channel` in action with iframe video w/o controls
112
+ 4. Widget `YouTube Channel` in action with iframe video w/ controls and fixed height
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
screenshot-4.png ADDED
Binary file
youtube-channel.php CHANGED
@@ -4,15 +4,23 @@ Plugin Name: YouTube Channel
4
  Plugin URI: http://blog.urosevic.net/wordpress/youtube-channel/
5
  Description: <a href="widgets.php">Widget</a> that display latest video thumbnail, iframe (HTML5 video), object (Flash video) or chromeless video from YouTube Channel.
6
  Author: Aleksandar Urošević
7
- Version: 0.1.2
8
  Author URI: http://urosevic.net/
9
  */
10
 
 
 
 
 
 
 
 
 
11
  /* youtube widget */
12
  class YouTube_Channel_Widget extends WP_Widget {
13
  function YouTube_Channel_Widget() {
14
  // widget actual processes
15
- parent::WP_Widget(false, $name = 'YouTube Channel');
16
  }
17
 
18
  function form($instance) {
@@ -22,6 +30,8 @@ class YouTube_Channel_Widget extends WP_Widget {
22
  $getrnd = esc_attr($instance['getrnd']);
23
  $goto_txt = esc_attr($instance['goto_txt']);
24
  $showgoto = esc_attr($instance['showgoto']);
 
 
25
  $showtitle = esc_attr($instance['showtitle']);
26
  $width = esc_attr($instance['width']);
27
  $height = esc_attr($instance['height']);
@@ -32,34 +42,36 @@ class YouTube_Channel_Widget extends WP_Widget {
32
  $fixyt = esc_attr($instance['fixyt']);
33
  $hideinfo = esc_attr($instance['hideinfo']);
34
  ?>
35
- <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title:'); ?><input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
36
- <p><label for="<?php echo $this->get_field_id('channel'); ?>"><?php _e('Channel:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('channel'); ?>" name="<?php echo $this->get_field_name('channel'); ?>" type="text" value="<?php echo $channel; ?>" /></label><br />
37
- <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['getrnd'], true ); ?> id="<?php echo $this->get_field_id( 'getrnd' ); ?>" name="<?php echo $this->get_field_name( 'getrnd' ); ?>" /> <label for="<?php echo $this->get_field_id( 'getrnd' ); ?>"><?php _e('Get random video from channel'); ?></label></p>
38
- <p><label for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Width'); ?> (<?php _e('default'); ?> 220):<input class="widefat" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="text" value="<?php echo $width; ?>" /></label></p>
39
- <p><label for="<?php echo $this->get_field_id('height'); ?>"><?php _e('Height'); ?> (<?php _e('default'); ?> 165):<input class="widefat" id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="text" value="<?php echo $height; ?>" /></label></p>
40
- <p><label for="<?php echo $this->get_field_id('to_show'); ?>"><?php _e('Aspect ratio (relative to width):'); ?>
41
  <select class="widefat" id="<?php echo $this->get_field_id( 'ratio' ); ?>" name="<?php echo $this->get_field_name( 'ratio' ); ?>">
42
- <option value="0"<?php if ($instance['ratio'] == "0") { echo 'selected="selected"'; } ?>><?php _e('Custom'); ?></option>
43
- <option value="1"<?php if ($instance['ratio'] == "1") { echo 'selected="selected"'; } ?>>4:3</option>
44
- <option value="2"<?php if ($instance['ratio'] == "2") { echo 'selected="selected"'; } ?>>16:10</option>
45
- <option value="3"<?php if ($instance['ratio'] == "3") { echo 'selected="selected"'; } ?>>16:9</option>
46
  </select>
47
  </p>
48
- <p><label for="<?php echo $this->get_field_id('to_show'); ?>"><?php _e('What to show?'); ?>
49
  <select class="widefat" id="<?php echo $this->get_field_id( 'to_show' ); ?>" name="<?php echo $this->get_field_name( 'to_show' ); ?>">
50
- <option value="thumbnail"<?php if ($instance['to_show'] == "thumbnail") { echo 'selected="selected"'; } ?>><?php _e('Thumbnail'); ?></option>
51
- <option value="object"<?php if ($instance['to_show'] == "object") { echo 'selected="selected"'; } ?>><?php _e('object (flash player)'); ?></option>
52
- <option value="iframe"<?php if ($instance['to_show'] == "iframe") { echo 'selected="selected"'; } ?>><?php _e('iframe (HTML5 player)'); ?></option>
53
- <option value="chromeless"<?php if ($instance['to_show'] == "chromeless") { echo 'selected="selected"'; } ?>><?php _e('chromeless video'); ?></option>
54
  </select>
55
- <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['fixyt'], true ); ?> id="<?php echo $this->get_field_id( 'fixyt' ); ?>" name="<?php echo $this->get_field_name( 'fixyt' ); ?>" /> <label for="<?php echo $this->get_field_id( 'fixyt' ); ?>"><?php _e('Fix height taken by controls'); ?></label><br />
56
- <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['autoplay'], true ); ?> id="<?php echo $this->get_field_id( 'autoplay' ); ?>" name="<?php echo $this->get_field_name( 'autoplay' ); ?>" /> <label for="<?php echo $this->get_field_id( 'autoplay' ); ?>"><?php _e('Autoplay video'); ?></label><br />
57
- <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['controls'], true ); ?> id="<?php echo $this->get_field_id( 'controls' ); ?>" name="<?php echo $this->get_field_name( 'controls' ); ?>" /> <label for="<?php echo $this->get_field_id( 'controls' ); ?>"><?php _e('Hide player controls'); ?></label><br />
58
- <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['hideinfo'], true ); ?> id="<?php echo $this->get_field_id( 'hideinfo' ); ?>" name="<?php echo $this->get_field_name( 'hideinfo' ); ?>" /> <label for="<?php echo $this->get_field_id( 'hideinfo' ); ?>"><?php _e('Hide video info'); ?></label><br />
59
- <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['showtitle'], true ); ?> id="<?php echo $this->get_field_id( 'showtitle' ); ?>" name="<?php echo $this->get_field_name( 'showtitle' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showtitle' ); ?>"><?php _e('Show video title'); ?></label>
60
  </p>
61
- <p><label for="<?php echo $this->get_field_id('goto_txt'); ?>"><?php _e('Visit YouTube Channel text:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('goto_txt'); ?>" name="<?php echo $this->get_field_name('goto_txt'); ?>" type="text" value="<?php echo $goto_txt; ?>" /></label>
62
- <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['showgoto'], true ); ?> id="<?php echo $this->get_field_id( 'showgoto' ); ?>" name="<?php echo $this->get_field_name( 'showgoto' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showgoto' ); ?>"><?php _e('Show link to channel'); ?></label></p>
 
 
63
  <?php
64
  }
65
 
@@ -71,6 +83,8 @@ class YouTube_Channel_Widget extends WP_Widget {
71
  $instance['getrnd'] = $new_instance['getrnd'];
72
  $instance['goto_txt'] = strip_tags($new_instance['goto_txt']);
73
  $instance['showgoto'] = $new_instance['showgoto'];
 
 
74
  $instance['showtitle'] = $new_instance['showtitle'];
75
  $instance['width'] = strip_tags($new_instance['width']);
76
  $instance['height'] = strip_tags($new_instance['height']);
@@ -140,9 +154,9 @@ class YouTube_Channel_Widget extends WP_Widget {
140
  $items = array_slice($rss->items, 0, 1);
141
  }
142
  }
143
-
144
  if (empty($items)) {
145
- echo "No items";
146
  } else {
147
  if ( $getrnd ) {
148
  $item = $items[mt_rand(0, (count($items)-1))];
@@ -166,17 +180,18 @@ class YouTube_Channel_Widget extends WP_Widget {
166
 
167
  // print out video
168
  if ( $to_show == "thumbnail" ) {
 
169
  echo <<<EOF
170
- <a href="$yt_video" title="Watch video $yt_title published on $yt_date"><img src="$yt_thumb" alt="$yt_title" style="width: ${width}px; height: ${height}px; border: 0;" /></a>
171
  EOF;
172
  } else if ( $to_show == "chromeless" ) {
173
  ?>
174
- <object type="application/x-shockwave-flash" data="<?php echo get_bloginfo('wpurl'); ?>/wp-content/plugins/youtube-channel/chromeless.swf" width="<?php echo $width; ?>" height="<?php echo $height; ?>">
175
  <param name="flashVars" value="video_source=<?php echo $yt_id; ?>&video_width=<?php echo $width; ?>&video_height=<?php echo $height; ?><?php if ( $autoplay ) { echo "&autoplay=Yes"; } if ( !$controls ) { echo "&youtube_controls=Yes"; } ?>" />
176
  <param name="quality" value="high" />
177
  <param name="wmode" value="opaque" />
178
  <param name="swfversion" value="6.0.65.0" />
179
- <param name="movie" value="<?php echo get_bloginfo('wpurl'); ?>/wp-content/plugins/youtube-channel/chromeless.swf" />
180
  </object>
181
  <?php
182
  } else if ( $to_show == "iframe" ) {
@@ -200,10 +215,25 @@ EOF;
200
  // do we need to show goto link?
201
  if ( $instance['showgoto'] ) {
202
  $goto_txt = $instance['goto_txt'];
203
- if ( $goto_txt == "" ) { $goto_txt = __("Visit channel")." $channel"; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  echo <<<EOF
205
- <p><a href="javascript: window.open('http://www.youtube.com/user/$channel/'); void 0;" title="$goto_txt">$goto_txt</a></p>
206
  EOF;
 
207
  } // showgoto
208
  }
209
  ?>
@@ -213,5 +243,10 @@ EOF;
213
  }
214
 
215
  }
216
- add_action('widgets_init', create_function('', 'return register_widget("YouTube_Channel_Widget");'));
 
 
 
 
 
217
  ?>
4
  Plugin URI: http://blog.urosevic.net/wordpress/youtube-channel/
5
  Description: <a href="widgets.php">Widget</a> that display latest video thumbnail, iframe (HTML5 video), object (Flash video) or chromeless video from YouTube Channel.
6
  Author: Aleksandar Urošević
7
+ Version: 0.1.3
8
  Author URI: http://urosevic.net/
9
  */
10
 
11
+ define( 'YOUTUBE_CHANNEL_URL', plugin_dir_url(__FILE__) );
12
+
13
+ /* Load plugin's textdomain */
14
+ function youtube_channel_init() {
15
+ load_plugin_textdomain( 'youtube-channel', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
16
+ }
17
+ add_action( 'init', 'youtube_channel_init' );
18
+
19
  /* youtube widget */
20
  class YouTube_Channel_Widget extends WP_Widget {
21
  function YouTube_Channel_Widget() {
22
  // widget actual processes
23
+ parent::WP_Widget( false, $name = __( 'YouTube Channel' , 'youtube-channel' ) );
24
  }
25
 
26
  function form($instance) {
30
  $getrnd = esc_attr($instance['getrnd']);
31
  $goto_txt = esc_attr($instance['goto_txt']);
32
  $showgoto = esc_attr($instance['showgoto']);
33
+ $popupgoto = esc_attr($instance['popupgoto']);
34
+ $target = esc_attr($instance['target']);
35
  $showtitle = esc_attr($instance['showtitle']);
36
  $width = esc_attr($instance['width']);
37
  $height = esc_attr($instance['height']);
42
  $fixyt = esc_attr($instance['fixyt']);
43
  $hideinfo = esc_attr($instance['hideinfo']);
44
  ?>
45
+ <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title:', 'youtube-channel'); ?><input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
46
+ <p><label for="<?php echo $this->get_field_id('channel'); ?>"><?php _e('Channel:', 'youtube-channel'); ?> <input class="widefat" id="<?php echo $this->get_field_id('channel'); ?>" name="<?php echo $this->get_field_name('channel'); ?>" type="text" value="<?php echo $channel; ?>" /></label><br />
47
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['getrnd'], true ); ?> id="<?php echo $this->get_field_id( 'getrnd' ); ?>" name="<?php echo $this->get_field_name( 'getrnd' ); ?>" /> <label for="<?php echo $this->get_field_id( 'getrnd' ); ?>"><?php _e('Get random video from channel', 'youtube-channel'); ?></label></p>
48
+ <p><label for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Width', 'youtube-channel'); ?> (<?php _e('default', 'youtube-channel'); ?> 220):<input class="widefat" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="text" value="<?php echo $width; ?>" /></label></p>
49
+ <p><label for="<?php echo $this->get_field_id('height'); ?>"><?php _e('Height', 'youtube-channel'); ?> (<?php _e('default', 'youtube-channel'); ?> 165):<input class="widefat" id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="text" value="<?php echo $height; ?>" /></label></p>
50
+ <p><label for="<?php echo $this->get_field_id('to_show'); ?>"><?php _e('Aspect ratio (relative to width):', 'youtube-channel'); ?>
51
  <select class="widefat" id="<?php echo $this->get_field_id( 'ratio' ); ?>" name="<?php echo $this->get_field_name( 'ratio' ); ?>">
52
+ <option value="0"<?php selected( $instance['ratio'], 0 ); ?>><?php _e('custom', 'youtube-channel'); ?></option>
53
+ <option value="1"<?php selected( $instance['ratio'], 1 ); ?>>4:3</option>
54
+ <option value="2"<?php selected( $instance['ratio'], 2 ); ?>>16:10</option>
55
+ <option value="3"<?php selected( $instance['ratio'], 3 ); ?>>16:9</option>
56
  </select>
57
  </p>
58
+ <p><label for="<?php echo $this->get_field_id('to_show'); ?>"><?php _e('What to show?', 'youtube-channel'); ?>
59
  <select class="widefat" id="<?php echo $this->get_field_id( 'to_show' ); ?>" name="<?php echo $this->get_field_name( 'to_show' ); ?>">
60
+ <option value="thumbnail"<?php selected( $instance['to_show'], 'thumbnail' ); ?>><?php _e('thumbnail', 'youtube-channel'); ?></option>
61
+ <option value="object"<?php selected( $instance['to_show'], 'object' ); ?>><?php _e('object (flash player)', 'youtube-channel'); ?></option>
62
+ <option value="iframe"<?php selected( $instance['to_show'], 'iframe' ); ?>><?php _e('iframe (HTML5 player)', 'youtube-channel'); ?></option>
63
+ <option value="chromeless"<?php selected( $instance['to_show'], 'chromeless' ); ?>><?php _e('chromeless video', 'youtube-channel'); ?></option>
64
  </select>
65
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['fixyt'], true ); ?> id="<?php echo $this->get_field_id( 'fixyt' ); ?>" name="<?php echo $this->get_field_name( 'fixyt' ); ?>" /> <label for="<?php echo $this->get_field_id( 'fixyt' ); ?>"><?php _e('Fix height taken by controls', 'youtube-channel'); ?></label><br />
66
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['autoplay'], true ); ?> id="<?php echo $this->get_field_id( 'autoplay' ); ?>" name="<?php echo $this->get_field_name( 'autoplay' ); ?>" /> <label for="<?php echo $this->get_field_id( 'autoplay' ); ?>"><?php _e('Autoplay video', 'youtube-channel'); ?></label><br />
67
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['controls'], true ); ?> id="<?php echo $this->get_field_id( 'controls' ); ?>" name="<?php echo $this->get_field_name( 'controls' ); ?>" /> <label for="<?php echo $this->get_field_id( 'controls' ); ?>"><?php _e('Hide player controls', 'youtube-channel'); ?></label><br />
68
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['hideinfo'], true ); ?> id="<?php echo $this->get_field_id( 'hideinfo' ); ?>" name="<?php echo $this->get_field_name( 'hideinfo' ); ?>" /> <label for="<?php echo $this->get_field_id( 'hideinfo' ); ?>"><?php _e('Hide video info', 'youtube-channel'); ?></label><br />
69
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['showtitle'], true ); ?> id="<?php echo $this->get_field_id( 'showtitle' ); ?>" name="<?php echo $this->get_field_name( 'showtitle' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showtitle' ); ?>"><?php _e('Show video title', 'youtube-channel'); ?></label>
70
  </p>
71
+ <p><label for="<?php echo $this->get_field_id('goto_txt'); ?>"><?php _e('Visit YouTube Channel text:', 'youtube-channel'); ?> <input class="widefat" id="<?php echo $this->get_field_id('goto_txt'); ?>" name="<?php echo $this->get_field_name('goto_txt'); ?>" type="text" value="<?php echo $goto_txt; ?>" /></label>
72
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['showgoto'], true ); ?> id="<?php echo $this->get_field_id( 'showgoto' ); ?>" name="<?php echo $this->get_field_name( 'showgoto' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showgoto' ); ?>"><?php _e('Show link to channel', 'youtube-channel'); ?></label><br />
73
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['popupgoto'], true ); ?> id="<?php echo $this->get_field_id( 'popupgoto' ); ?>" name="<?php echo $this->get_field_name( 'popupgoto' ); ?>" /> <label for="<?php echo $this->get_field_id( 'popupgoto' ); ?>"><?php _e('Open channel in new window/tab', 'youtube-channel'); ?></label><br />
74
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['target'], true ); ?> id="<?php echo $this->get_field_id( 'target' ); ?>" name="<?php echo $this->get_field_name( 'target' ); ?>" /> <label for="<?php echo $this->get_field_id( 'target' ); ?>"><?php _e('Use target="_blank" (invalid XHTML)', 'youtube-channel'); ?></label></p>
75
  <?php
76
  }
77
 
83
  $instance['getrnd'] = $new_instance['getrnd'];
84
  $instance['goto_txt'] = strip_tags($new_instance['goto_txt']);
85
  $instance['showgoto'] = $new_instance['showgoto'];
86
+ $instance['popupgoto'] = $new_instance['popupgoto'];
87
+ $instance['target'] = $new_instance['target'];
88
  $instance['showtitle'] = $new_instance['showtitle'];
89
  $instance['width'] = strip_tags($new_instance['width']);
90
  $instance['height'] = strip_tags($new_instance['height']);
154
  $items = array_slice($rss->items, 0, 1);
155
  }
156
  }
157
+
158
  if (empty($items)) {
159
+ echo __( 'No items' , 'youtube-channel' );
160
  } else {
161
  if ( $getrnd ) {
162
  $item = $items[mt_rand(0, (count($items)-1))];
180
 
181
  // print out video
182
  if ( $to_show == "thumbnail" ) {
183
+ $title = sprintf( __( 'Watch video %1$s published on %2$s' , 'youtube-channel' ), $yt_title, $yt_date );
184
  echo <<<EOF
185
+ <a href="$yt_video" title="$title"><img src="$yt_thumb" alt="$yt_title" style="width: ${width}px; height: ${height}px; border: 0;" /></a>
186
  EOF;
187
  } else if ( $to_show == "chromeless" ) {
188
  ?>
189
+ <object type="application/x-shockwave-flash" data="<?php echo YOUTUBE_CHANNEL_URL . 'chromeless.swf'; ?>" width="<?php echo $width; ?>" height="<?php echo $height; ?>">
190
  <param name="flashVars" value="video_source=<?php echo $yt_id; ?>&video_width=<?php echo $width; ?>&video_height=<?php echo $height; ?><?php if ( $autoplay ) { echo "&autoplay=Yes"; } if ( !$controls ) { echo "&youtube_controls=Yes"; } ?>" />
191
  <param name="quality" value="high" />
192
  <param name="wmode" value="opaque" />
193
  <param name="swfversion" value="6.0.65.0" />
194
+ <param name="movie" value="<?php echo YOUTUBE_CHANNEL_URL . 'chromeless.swf'; ?>" />
195
  </object>
196
  <?php
197
  } else if ( $to_show == "iframe" ) {
215
  // do we need to show goto link?
216
  if ( $instance['showgoto'] ) {
217
  $goto_txt = $instance['goto_txt'];
218
+ if ( $goto_txt == "" ) {
219
+ $goto_txt = sprintf( __( 'Visit channel %1$s' , 'youtube-channel' ), $channel );
220
+ }
221
+ if ( $instance['popupgoto'] ) {
222
+ $newtab = __("in new window/tab", "youtube-channel");
223
+ if ( $instance['target'] ) {
224
+ echo <<<EOF
225
+ <p><a href="http://www.youtube.com/user/$channel/" target="_blank" title="$goto_txt $newtab">$goto_txt</a></p>
226
+ EOF;
227
+ } else {
228
+ echo <<<EOF
229
+ <p><a href="javascript: window.open('http://www.youtube.com/user/$channel/'); void 0;" title="$goto_txt $newtab">$goto_txt</a></p>
230
+ EOF;
231
+ } // target
232
+ } else {
233
  echo <<<EOF
234
+ <p><a href="http://www.youtube.com/user/$channel/" title="$goto_txt">$goto_txt</a></p>
235
  EOF;
236
+ } // popupgoto
237
  } // showgoto
238
  }
239
  ?>
243
  }
244
 
245
  }
246
+
247
+ /* Register plugin's widget */
248
+ function youtube_channel_register_widget() {
249
+ register_widget( 'YouTube_Channel_Widget' );
250
+ }
251
+ add_action( 'widgets_init', 'youtube_channel_register_widget' );
252
  ?>