Version Description
- Option to display random video from channel
Download this release
Release Info
Developer | urkekg |
Plugin | YouTube Channel |
Version | 0.1.2 |
Comparing to | |
See all releases |
Code changes from version 0.1.1 to 0.1.2
- readme.txt +9 -2
- screenshot-1.png +0 -0
- youtube-channel.php +23 -9
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.
|
8 |
|
9 |
Sidebar widget that display latest video thumbnail, playable flash object or chromeless video from YouTube Channel.
|
10 |
|
@@ -18,8 +18,8 @@ If you like this extension and you find it useful, please rate it on the right s
|
|
18 |
|
19 |
= Features =
|
20 |
* Display latest video from YouTube channel
|
|
|
21 |
* Set custom widget title
|
22 |
-
* Display or hide video title on the top of video
|
23 |
* Custom set of width and height of video thumbnail/embeded object (default 220x165 px)
|
24 |
* Preferred aspect ratio relative to width (custom, 4:3, 16:10 and 16:9)
|
25 |
* Choose to display video thumbnail, iframe (HTML5 video), object embed (Flash video) or chromeless video
|
@@ -27,6 +27,7 @@ If you like this extension and you find it useful, please rate it on the right s
|
|
27 |
* Option to enable autoplay video
|
28 |
* Option to hide video controls
|
29 |
* Option to hide video info
|
|
|
30 |
* Set custom text for link to channel
|
31 |
* Option to show link to channel
|
32 |
|
@@ -62,6 +63,9 @@ I could not to find widget with link to channel and thumbnail instead of video o
|
|
62 |
|
63 |
== Changelog ==
|
64 |
|
|
|
|
|
|
|
65 |
= 0.1.1 =
|
66 |
* Fixed option to toggle video title visibility
|
67 |
* Added option to hide controls for iframe and object videos
|
@@ -73,6 +77,9 @@ I could not to find widget with link to channel and thumbnail instead of video o
|
|
73 |
|
74 |
== Upgrade Notice ==
|
75 |
|
|
|
|
|
|
|
76 |
= 0.1.1 =
|
77 |
After upgrade please reconfigure widget. Some variables are changed and implemented new features.
|
78 |
|
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 |
|
18 |
|
19 |
= Features =
|
20 |
* Display latest video from YouTube channel
|
21 |
+
* Option to get random video from channel
|
22 |
* Set custom widget title
|
|
|
23 |
* Custom set of width and height of video thumbnail/embeded object (default 220x165 px)
|
24 |
* Preferred aspect ratio relative to width (custom, 4:3, 16:10 and 16:9)
|
25 |
* Choose to display video thumbnail, iframe (HTML5 video), object embed (Flash video) or chromeless video
|
27 |
* Option to enable autoplay video
|
28 |
* Option to hide video controls
|
29 |
* Option to hide video info
|
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 |
|
63 |
|
64 |
== Changelog ==
|
65 |
|
66 |
+
= 0.1.2 =
|
67 |
+
* Option to display random video from channel
|
68 |
+
|
69 |
= 0.1.1 =
|
70 |
* Fixed option to toggle video title visibility
|
71 |
* Added option to hide controls for iframe and object videos
|
77 |
|
78 |
== Upgrade Notice ==
|
79 |
|
80 |
+
= 0.1.2 =
|
81 |
+
After upgrade set option for random video from channel.
|
82 |
+
|
83 |
= 0.1.1 =
|
84 |
After upgrade please reconfigure widget. Some variables are changed and implemented new features.
|
85 |
|
screenshot-1.png
CHANGED
Binary file
|
youtube-channel.php
CHANGED
@@ -4,7 +4,7 @@ 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.
|
8 |
Author URI: http://urosevic.net/
|
9 |
*/
|
10 |
|
@@ -19,6 +19,7 @@ class YouTube_Channel_Widget extends WP_Widget {
|
|
19 |
// outputs the options form on admin
|
20 |
$title = esc_attr($instance['title']);
|
21 |
$channel = esc_attr($instance['channel']);
|
|
|
22 |
$goto_txt = esc_attr($instance['goto_txt']);
|
23 |
$showgoto = esc_attr($instance['showgoto']);
|
24 |
$showtitle = esc_attr($instance['showtitle']);
|
@@ -32,8 +33,8 @@ class YouTube_Channel_Widget extends WP_Widget {
|
|
32 |
$hideinfo = esc_attr($instance['hideinfo']);
|
33 |
?>
|
34 |
<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>
|
35 |
-
<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
|
36 |
-
<
|
37 |
<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>
|
38 |
<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>
|
39 |
<p><label for="<?php echo $this->get_field_id('to_show'); ?>"><?php _e('Aspect ratio (relative to width):'); ?>
|
@@ -54,7 +55,8 @@ class YouTube_Channel_Widget extends WP_Widget {
|
|
54 |
<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 />
|
55 |
<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 />
|
56 |
<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 />
|
57 |
-
<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
|
|
|
58 |
</p>
|
59 |
<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>
|
60 |
<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>
|
@@ -66,9 +68,10 @@ class YouTube_Channel_Widget extends WP_Widget {
|
|
66 |
$instance = $old_instance;
|
67 |
$instance['title'] = strip_tags($new_instance['title']);
|
68 |
$instance['channel'] = strip_tags($new_instance['channel']);
|
|
|
69 |
$instance['goto_txt'] = strip_tags($new_instance['goto_txt']);
|
70 |
-
$instance['showgoto']
|
71 |
-
$instance['showtitle']= $new_instance['showtitle'];
|
72 |
$instance['width'] = strip_tags($new_instance['width']);
|
73 |
$instance['height'] = strip_tags($new_instance['height']);
|
74 |
$instance['to_show'] = strip_tags($new_instance['to_show']);
|
@@ -129,12 +132,23 @@ class YouTube_Channel_Widget extends WP_Widget {
|
|
129 |
include_once(ABSPATH . WPINC . '/rss.php');
|
130 |
|
131 |
$rss = fetch_rss('http://gdata.youtube.com/feeds/base/users/'.$channel.'/uploads?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile');
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
if (empty($items)) {
|
135 |
echo "No items";
|
136 |
} else {
|
137 |
-
$
|
|
|
|
|
|
|
|
|
138 |
$yt_id = split(":", $item['guid']);
|
139 |
$yt_id = $yt_id[3];
|
140 |
$yt_thumb = "http://i3.ytimg.com/vi/$yt_id/default.jpg";
|
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 |
|
19 |
// outputs the options form on admin
|
20 |
$title = esc_attr($instance['title']);
|
21 |
$channel = esc_attr($instance['channel']);
|
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']);
|
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):'); ?>
|
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>
|
68 |
$instance = $old_instance;
|
69 |
$instance['title'] = strip_tags($new_instance['title']);
|
70 |
$instance['channel'] = strip_tags($new_instance['channel']);
|
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']);
|
77 |
$instance['to_show'] = strip_tags($new_instance['to_show']);
|
132 |
include_once(ABSPATH . WPINC . '/rss.php');
|
133 |
|
134 |
$rss = fetch_rss('http://gdata.youtube.com/feeds/base/users/'.$channel.'/uploads?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile');
|
135 |
+
if ($rss) {
|
136 |
+
$getrnd = $instance['getrnd'];
|
137 |
+
if ( $getrnd ) {
|
138 |
+
$items = array_slice($rss->items, 0);
|
139 |
+
} else {
|
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))];
|
149 |
+
} else {
|
150 |
+
$item = $items[0];
|
151 |
+
}
|
152 |
$yt_id = split(":", $item['guid']);
|
153 |
$yt_id = $yt_id[3];
|
154 |
$yt_thumb = "http://i3.ytimg.com/vi/$yt_id/default.jpg";
|