Video Sidebar Widgets - Version 1.0

Version Description

Download this release

Release Info

Developer denzel_chia
Plugin Icon 128x128 Video Sidebar Widgets
Version 1.0
Comparing to
See all releases

Version 1.0

Files changed (2) hide show
  1. readme.txt +50 -0
  2. video-sidebar-widgets.php +264 -0
readme.txt ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Video Sidebar Widgets ===
2
+ Contributors: denzel chia
3
+ Donate link: http://denzeldesigns.com/wordpress-plugins/video-sidebar-widgets/
4
+ Author link: http://denzeldesigns.com
5
+ Tags:video, widget, widgets, sidebar, videos, video sidebar widget, video widget, embed video, video embed, video in sidebar, youtube, vimeo, veoh, myspace video, revver, blip tv, tudou, youku, 6.cn
6
+ Requires at least:2.8.1
7
+ Tested up to: 2.8.1
8
+ Stable tag:1.0
9
+
10
+ == Description ==
11
+
12
+ A Video Widget written in latest Widgets API. It enables the user to embed FlashVideo from various video sharing networks into the widgetised sidebar of a WordPress powered blog. Currently supporting video embed from 13 video sharing networks. Including, Youtube, Vimeo, Veoh, Blip.tv etc..
13
+
14
+
15
+ == Changelog ==
16
+
17
+ =1.0=
18
+
19
+
20
+ == Installation ==
21
+
22
+ 1. Install through the Add New option under Plugins in your WordPress Admin by searching for Video Sidebar Widgets.
23
+
24
+ 2. Alternatively, download a zip copy from the download option from our sidebar and Upload through the Add New->Upload option under Plugins in your WordPress Admin.
25
+
26
+ 3. Activate the plugin through the Plugins menu in WordPress Admin.
27
+
28
+ 4. Go to Widgets under Appearance in the WordPress Admin, and you will find the Video Sidebar Widget.
29
+
30
+
31
+ == How to use Video Sidebar Widgets ? ==
32
+
33
+ Please visit plugin site for details.
34
+
35
+
36
+ == Frequently Asked Questions ==
37
+
38
+ 1. Why is Video Sidebar Widget not compatible with WordPress 2.8 ?
39
+
40
+ It is not compatible because a bug was found to cause settings of multiple instance of a widget to disappear or mixed up.
41
+ The bug was fixed in WordPress 2.8.1
42
+
43
+
44
+ == Screenshots ==
45
+
46
+ Please visit plugin site for video samples
47
+
48
+
49
+
50
+
video-sidebar-widgets.php ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Video Sidebar Widgets
4
+ Plugin URI: http://denzeldesigns.com/wordpress-plugins/video-sidebar-widgets/
5
+ Version: 1.0
6
+ Description: A video sidebar widget using WordPress 2.8 Widgets API to display videos such as Vimeo, YouTube, MySpace Videos etc.
7
+ requires at least WordPress 2.8.1
8
+ Author: Denzel Chia
9
+ Author URI: http://denzeldesigns.com/
10
+ */
11
+
12
+
13
+ add_action('widgets_init', 'load_video_sidebar_widgets');
14
+
15
+ function load_video_sidebar_widgets() {
16
+ register_widget('VideoSidebarWidget');
17
+ }
18
+
19
+
20
+ // vimeo video widget
21
+ class VideoSidebarWidget extends WP_Widget {
22
+
23
+ function VideoSidebarWidget() {
24
+ $widget_ops = array( 'classname' => 'videosidebar', 'description' => __('A Video Widget to display multiple videos in sidebar from sources such as YouTube, Vimeo, MySpace etc. Please visit Plugin Site for details', 'videosidebar') );
25
+ $control_ops = array( 'width' => 200, 'height' => 350, 'id_base' => 'videosidebar' );
26
+ $this->WP_Widget( 'videosidebar', __('Video Sidebar Widget', 'videosidebar'), $widget_ops, $control_ops );
27
+ }
28
+
29
+
30
+ function widget( $args, $instance ) {
31
+ extract( $args );
32
+
33
+ $title2 = apply_filters('widget_title2', $instance['title2'] );
34
+ $v_width2 = $instance['v_width2'];
35
+ $v_height2 = $instance['v_height2'];
36
+ $v_autoplay2 = $instance['v_autoplay2'];
37
+ $v_id2 = $instance['v_id2'];
38
+ $v_source = $instance['v_source'];
39
+
40
+
41
+ echo $before_widget;
42
+
43
+ if ( $title2 )
44
+ echo $before_title . $title2 . $after_title;
45
+
46
+ $source = $v_source;
47
+
48
+ switch ($source) {
49
+
50
+ case null:
51
+ $value = null;
52
+ $flashvar = null;
53
+ $flashvar2 = null;
54
+ break;
55
+
56
+ case YouTube:
57
+ $value = "http://www.youtube.com/v/$v_id2&autoplay=$v_autoplay2&loop=0&rel=0";
58
+ $flashvar = null;
59
+ $flashvar2 = null;
60
+ break;
61
+
62
+ case Vimeo:
63
+ $value = "http://vimeo.com/moogaloop.swf?clip_id=$v_id2&amp;server=vimeo.com&amp;loop=0&amp;fullscreen=1&amp;autoplay=$v_autoplay2";
64
+ $flashvar = null;
65
+ $flashvar2 = null;
66
+ break;
67
+
68
+ case MySpace:
69
+ $value = "http://mediaservices.myspace.com/services/media/embed.aspx/m=$v_id2,t=1,mt=video,ap=$v_autoplay2";
70
+ $flashvar = null;
71
+ $flashvar2 = null;
72
+ break;
73
+
74
+ case Veoh:
75
+ $value = "http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.4.2.20.1002&permalinkId=$v_id2&player=videodetailsembedded";
76
+ $value.= "&id=anonymous&videoAutoPlay=$v_autoplay2";
77
+ $flashvar = null;
78
+ $flashvar2 = null;
79
+ break;
80
+
81
+ case Blip:
82
+ if($v_autoplay2=='1'){
83
+ $autoplay2 = "true";
84
+ }else{$autoplay2 = "false";}
85
+ $value = "http://blip.tv/play/$v_id2?autostart=$autoplay2";
86
+ $flashvar = null;
87
+ $flashvar2 = null;
88
+ break;
89
+
90
+ case WordPress:
91
+ $value = "http://v.wordpress.com/$v_id2";
92
+ $flashvar = null;
93
+ $flashvar2 = null;
94
+ break;
95
+
96
+ case Viddler:
97
+ $value = "http://www.viddler.com/player/$v_id2";
98
+ if($v_autoplay2=='1'){
99
+ $flashvar = "<param name=\"flashvars\" value=\"autoplay=t\" />\n";
100
+ $flashvar2 = 'flashvars="autoplay=t" ';
101
+ }
102
+ break;
103
+
104
+ case DailyMotion:
105
+ $value = "http://www.dailymotion.com/swf/$v_id2&autoStart=$v_autoplay2&related=0";
106
+ $flashvar = null;
107
+ $flashvar2 = null;
108
+ break;
109
+
110
+
111
+ case Revver:
112
+ $value = "http://flash.revver.com/player/1.0/player.swf?mediaId=$v_id2&autoStart=$v_autoplay2";
113
+ $flashvar = null;
114
+ $flashvar2 = null;
115
+ break;
116
+
117
+ case Metacafe:
118
+ $id = split('/',$v_id2);
119
+ $value = "http://www.metacafe.com/fplayer/$id[0]/$id[1].swf";
120
+ if($v_autoplay2=='1'){
121
+ $flashvar = null;
122
+ $flashvar2 = 'flashVars="playerVars=showStats=no|autoPlay=yes|"';
123
+ }
124
+ break;
125
+
126
+ case Tudou:
127
+ $value = "$v_id2";
128
+ $flashvar = null;
129
+ $flashvar2 = null;
130
+ break;
131
+
132
+ case Youku:
133
+ $value = "$v_id2";
134
+ $flashvar = null;
135
+ $flashvar2 = null;
136
+ break;
137
+
138
+ case cn6:
139
+ $value = "$v_id2";
140
+ $flashvar = null;
141
+ $flashvar2 = null;
142
+ break;
143
+
144
+ }
145
+
146
+
147
+
148
+ echo "\n<object width=\"$v_width2\" height=\"$v_height2\">\n";
149
+ echo $flashvar;
150
+ echo "<param name=\"allowfullscreen\" value=\"true\" />\n";
151
+ echo "<param name=\"allowscriptaccess\" value=\"always\" />\n";
152
+ echo "<param name=\"movie\" value=\"$value\" />\n";
153
+ echo "<param name=\"wmode\" value=\"transparent\">\n";
154
+ echo "<embed src=\"$value\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" allowfullscreen=\"true\" allowscriptaccess=\"always\" ";
155
+ echo $flashvar2;
156
+ echo "width=\"$v_width2\" height=\"$v_height2\">\n";
157
+ echo "</embed>\n";
158
+ echo "</object>\n\n";
159
+ echo $after_widget;
160
+ }
161
+
162
+
163
+ function update( $new_instance, $old_instance ) {
164
+ $instance = $old_instance;
165
+ $instance['title2'] = strip_tags( $new_instance['title2'] );
166
+ $instance['v_width2'] = strip_tags( $new_instance['v_width2'] );
167
+ $instance['v_height2'] = strip_tags( $new_instance['v_height2'] );
168
+ $instance['v_autoplay2'] = strip_tags( $new_instance['v_autoplay2'] );
169
+ $instance['v_id2'] = strip_tags( $new_instance['v_id2'] );
170
+ $instance['v_source'] = strip_tags( $new_instance['v_source'] );
171
+ return $instance;
172
+ }
173
+
174
+
175
+ function form($instance) {
176
+ $instance = wp_parse_args( (array) $instance, array( 'title2' => '', 'v_width2' => '', 'v_height2' => '', 'v_loop2' => '','v_autoplay2' => '','v_id2' => '','v_source' => '') );
177
+ $instance['title2'] = strip_tags( $instance['title2'] );
178
+ $instance['v_width2'] = strip_tags( $instance['v_width2'] );
179
+ $instance['v_height2'] = strip_tags( $instance['v_height2'] );
180
+ $instance['v_autoplay2'] = strip_tags( $instance['v_autoplay2'] );
181
+ $instance['v_id2'] = strip_tags( $instance['v_id2'] );
182
+ $instance['v_source'] = strip_tags( $instance['v_source'] );
183
+
184
+
185
+ ?>
186
+
187
+
188
+ <p>
189
+ <label for="<?php echo $this->get_field_id('title2'); ?>">Title:</label>
190
+ <input class="widefat" id="<?php echo $this->get_field_id('title2'); ?>" name="<?php echo $this->get_field_name('title2'); ?>" type="text" value="<?php echo $instance['title2']; ?>" />
191
+ </p>
192
+
193
+ <p>
194
+ <label for="<?php echo $this->get_field_id( 'v_source' ); ?>">Select Video Source:</label>
195
+ <select id="<?php echo $this->get_field_id( 'v_source' );?>" name="<?php echo $this->get_field_name( 'v_source' );?>" class="widefat" style="width:100%;">';
196
+ <option value='YouTube' <?php if($instance['v_source'] == 'YouTube'){echo 'selected="selected"';}?> >YouTube Video</option>
197
+ <option value='Vimeo' <?php if($instance['v_source'] == 'Vimeo'){echo 'selected="selected"';}?> >Vimeo Video</option>
198
+ <option value='MySpace' <?php if($instance['v_source'] == 'MySpace'){echo 'selected="selected"';}?> >MySpace Video</option>
199
+ <option value='Veoh' <?php if($instance['v_source'] == 'Veoh'){echo 'selected="selected"';}?> >Veoh Video</option>
200
+ <option value='Blip' <?php if($instance['v_source'] == 'Blip'){echo 'selected="selected"';}?> >blip.tv Video</option>
201
+ <option value='WordPress' <?php if($instance['v_source'] == 'WordPress'){echo 'selected="selected"';}?> >WordPress Video</option>
202
+ <option value='Viddler' <?php if($instance['v_source'] == 'Viddler'){echo 'selected="selected"';}?> >Viddler Video</option>
203
+ <option value='DailyMotion' <?php if($instance['v_source'] == 'DailyMotion'){echo 'selected="selected"';}?> >DailyMotion Video</option>
204
+ <option value='Revver' <?php if($instance['v_source'] == 'Revver'){echo 'selected="selected"';}?> >Revver Video</option>
205
+ <option value='Metacafe' <?php if($instance['v_source'] == 'Metacafe'){echo 'selected="selected"';}?> >Metacafe Video</option>
206
+ <option value='Tudou' <?php if($instance['v_source'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option>
207
+ <option value='Youku' <?php if($instance['v_source'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option>
208
+ <option value='cn6' <?php if($instance['v_source'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option>
209
+ </select>
210
+ </p>
211
+
212
+ <p>
213
+ <label for="<?php echo $this->get_field_id('v_id2'); ?>">Video ID: </label>
214
+ <input class="widefat" id="<?php echo $this->get_field_id('v_id2'); ?>" name="<?php echo $this->get_field_name('v_id2'); ?>" type="text" value="<?php echo $instance['v_id2']; ?>" /></p>
215
+
216
+ <p>
217
+ <label for="<?php echo $this->get_field_id('v_width2'); ?>">Width: </label>
218
+ <input class="widefat" id="<?php echo $this->get_field_id('v_width2'); ?>" name="<?php echo $this->get_field_name('v_width2'); ?>" type="text" value="<?php echo $instance['v_width2']; ?>" />
219
+ </p>
220
+
221
+ <p>
222
+ <label for="<?php echo $this->get_field_id('v_height2'); ?>">Height: </label>
223
+ <input class="widefat" id="<?php echo $this->get_field_id('v_height2'); ?>" name="<?php echo $this->get_field_name('v_height2'); ?>" type="text" value="<?php echo $instance['v_height2']; ?>" />
224
+ </p>
225
+
226
+ <p>
227
+ <?php
228
+
229
+ $source = $instance['v_source'];
230
+ $msg = "<p>Sorry, auto play option not supported by ".$source."</p>";
231
+ switch ($source) {
232
+
233
+ case WordPress:
234
+ echo $msg;
235
+ break;
236
+
237
+ case Tudou:
238
+ echo $msg;
239
+ break;
240
+
241
+ case Youku:
242
+ echo $msg;
243
+ break;
244
+
245
+ case cn6:
246
+ echo "<p>Sorry, auto play option not supported by 6.cn</p>";
247
+ break;
248
+ }
249
+
250
+ ?>
251
+ <label for="<?php echo $this->get_field_id( 'v_autoplay2' ); ?>">Auto Play:</label>
252
+ <select id="<?php echo $this->get_field_id( 'v_autoplay2' );?>" name="<?php echo $this->get_field_name( 'v_autoplay2' );?>" class="widefat" style="width:100%;">';
253
+ <option value='1' <?php if($instance['v_autoplay2'] == '1'){echo 'selected="selected"';}?>>Yes</option>
254
+ <option value='0' <?php if($instance['v_autoplay2'] == '0'){echo 'selected="selected"';}?>>No</option>
255
+ </select>
256
+ </p>
257
+
258
+ <?php
259
+
260
+ }
261
+
262
+ }
263
+
264
+ ?>