Version Description
Download this release
Release Info
Developer | denzel_chia |
Plugin | Video Sidebar Widgets |
Version | 2.1 |
Comparing to | |
See all releases |
Code changes from version 2.0 to 2.1
- readme.txt +17 -2
- video-sidebar-widgets.php +399 -140
readme.txt
CHANGED
@@ -4,8 +4,8 @@ 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.
|
8 |
-
Stable tag:2.
|
9 |
|
10 |
== Description ==
|
11 |
|
@@ -18,6 +18,21 @@ Now including Random Video Sidebar Widget to randomly display 1 out of 5 preset
|
|
18 |
|
19 |
*Included Random Video Sidebar Widget to randomly display 1 out of 5 preset video.
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
== Installation ==
|
22 |
|
23 |
1. Install through the Add New option under Plugins in your WordPress Admin by searching for 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.3
|
8 |
+
Stable tag:2.1
|
9 |
|
10 |
== Description ==
|
11 |
|
18 |
|
19 |
*Included Random Video Sidebar Widget to randomly display 1 out of 5 preset video.
|
20 |
|
21 |
+
|
22 |
+
=2.1=
|
23 |
+
|
24 |
+
*re-arranged Random Video Sidebar Widget Layout
|
25 |
+
|
26 |
+
*Included fixed size, no autoplay, video preview in widget form for easier identification of videos. Video will display after setting up and clicking save button. Video may not display due to slow connection, browser caching, wrong setting, or video removed from source.
|
27 |
+
|
28 |
+
*Included support for google videos
|
29 |
+
|
30 |
+
*Included Video Caption at bottom of Video
|
31 |
+
|
32 |
+
*Video Caption has a style class of "VideoCaption" to enable user to indicate font-height etc.
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
== Installation ==
|
37 |
|
38 |
1. Install through the Add New option under Plugins in your WordPress Admin by searching for Video Sidebar Widgets.
|
video-sidebar-widgets.php
CHANGED
@@ -2,49 +2,226 @@
|
|
2 |
/*
|
3 |
Plugin Name: Video Sidebar Widgets
|
4 |
Plugin URI: http://denzeldesigns.com/wordpress-plugins/video-sidebar-widgets/
|
5 |
-
Version: 2.
|
6 |
Description: A video sidebar widget using WordPress 2.8 Widgets API to display videos such as Vimeo, YouTube, MySpace Videos etc. Requires at least WordPress 2.8.1. Now including Random Video Sidebar Widget to randomly display 1 out of 5 preset video.
|
7 |
Author: Denzel Chia
|
8 |
Author URI: http://denzeldesigns.com/
|
9 |
*/
|
10 |
|
11 |
|
|
|
12 |
add_action('widgets_init', 'load_video_sidebar_widgets');
|
13 |
|
|
|
|
|
14 |
function load_video_sidebar_widgets() {
|
15 |
register_widget('VideoSidebarWidget');
|
16 |
register_widget('RandomVideoSidebarWidget');
|
17 |
}
|
18 |
|
19 |
|
20 |
-
|
21 |
class VideoSidebarWidget extends WP_Widget {
|
22 |
|
23 |
-
function
|
24 |
-
|
25 |
-
|
26 |
-
$
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
|
30 |
-
function
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
|
44 |
-
|
|
|
45 |
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
switch ($source) {
|
49 |
|
50 |
case null:
|
@@ -72,8 +249,8 @@ extract( $args );
|
|
72 |
break;
|
73 |
|
74 |
case Veoh:
|
75 |
-
$value = "http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.4.2.20.1002&
|
76 |
-
$value.= "&id=anonymous&videoAutoPlay=$v_autoplay2";
|
77 |
$flashvar = null;
|
78 |
$flashvar2 = null;
|
79 |
break;
|
@@ -140,126 +317,58 @@ extract( $args );
|
|
140 |
$flashvar = null;
|
141 |
$flashvar2 = null;
|
142 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
}
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
|
147 |
-
|
148 |
-
|
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\"
|
|
|
155 |
echo $flashvar2;
|
156 |
echo "width=\"$v_width2\" height=\"$v_height2\">\n";
|
157 |
echo "</embed>\n";
|
158 |
echo "</object>\n\n";
|
159 |
-
|
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 |
-
|
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 |
|
265 |
|
@@ -271,7 +380,7 @@ class RandomVideoSidebarWidget extends WP_Widget {
|
|
271 |
|
272 |
function RandomVideoSidebarWidget() {
|
273 |
$widget_ops = array( 'classname' => 'randomvideosidebar', 'description' => __('A Random Video Widget. Randomly selects 1 of the 5 preset videos for display', 'randomvideosidebar') );
|
274 |
-
$control_ops = array( 'width' =>
|
275 |
$this->WP_Widget( 'randomvideosidebar', __('Random Video Sidebar Widget', 'randomvideosidebar'), $widget_ops, $control_ops );
|
276 |
}
|
277 |
|
@@ -285,14 +394,19 @@ extract( $args );
|
|
285 |
$RV_autoplay = $instance['RV_autoplay'];
|
286 |
$RV_id1 = $instance['RV_id1'];
|
287 |
$RV_source1 = $instance['RV_source1'];
|
|
|
288 |
$RV_id2 = $instance['RV_id2'];
|
289 |
$RV_source2 = $instance['RV_source2'];
|
|
|
290 |
$RV_id3 = $instance['RV_id3'];
|
291 |
-
$RV_source3 = $instance['RV_source3'];
|
|
|
292 |
$RV_id4 = $instance['RV_id4'];
|
293 |
$RV_source4 = $instance['RV_source4'];
|
|
|
294 |
$RV_id5 = $instance['RV_id5'];
|
295 |
-
$RV_source5 = $instance['RV_source5'];
|
|
|
296 |
|
297 |
echo $before_widget;
|
298 |
|
@@ -308,26 +422,31 @@ extract( $args );
|
|
308 |
case 1:
|
309 |
$Embed_id = $RV_id1;
|
310 |
$Embed_source = $RV_source1;
|
|
|
311 |
break;
|
312 |
|
313 |
case 2:
|
314 |
$Embed_id = $RV_id2;
|
315 |
$Embed_source = $RV_source2;
|
|
|
316 |
break;
|
317 |
|
318 |
case 3:
|
319 |
$Embed_id = $RV_id3;
|
320 |
$Embed_source = $RV_source3;
|
|
|
321 |
break;
|
322 |
|
323 |
case 4:
|
324 |
$Embed_id = $RV_id4;
|
325 |
$Embed_source = $RV_source4;
|
|
|
326 |
break;
|
327 |
|
328 |
case 5:
|
329 |
$Embed_id = $RV_id5;
|
330 |
$Embed_source = $RV_source5;
|
|
|
331 |
break;
|
332 |
|
333 |
}
|
@@ -337,7 +456,8 @@ extract( $args );
|
|
337 |
|
338 |
If(empty($Embed_id)){
|
339 |
$Embed_id = $RV_id1;
|
340 |
-
$Embed_source = $RV_source1;
|
|
|
341 |
}
|
342 |
|
343 |
$select_source = $Embed_source;
|
@@ -348,24 +468,28 @@ extract( $args );
|
|
348 |
$rv_value = null;
|
349 |
$rv_flashvar = null;
|
350 |
$rv_flashvar2 = null;
|
|
|
351 |
break;
|
352 |
|
353 |
case YouTube:
|
354 |
$rv_value = "http://www.youtube.com/v/$Embed_id&autoplay=$RV_autoplay&loop=0&rel=0";
|
355 |
$rv_flashvar = null;
|
356 |
$rv_flashvar2 = null;
|
|
|
357 |
break;
|
358 |
|
359 |
case Vimeo:
|
360 |
$rv_value = "http://vimeo.com/moogaloop.swf?clip_id=$Embed_id&server=vimeo.com&loop=0&fullscreen=1&autoplay=$RV_autoplay";
|
361 |
$rv_flashvar = null;
|
362 |
$rv_flashvar2 = null;
|
|
|
363 |
break;
|
364 |
|
365 |
case MySpace:
|
366 |
$rv_value = "http://mediaservices.myspace.com/services/media/embed.aspx/m=$Embed_id,t=1,mt=video,ap=$RV_autoplay";
|
367 |
$rv_flashvar = null;
|
368 |
$rv_flashvar2 = null;
|
|
|
369 |
break;
|
370 |
|
371 |
case Veoh:
|
@@ -373,6 +497,7 @@ extract( $args );
|
|
373 |
$rv_value.= "&player=videodetailsembedded&id=anonymous&videoAutoPlay=$RV_autoplay";
|
374 |
$rv_flashvar = null;
|
375 |
$rv_flashvar2 = null;
|
|
|
376 |
break;
|
377 |
|
378 |
case Blip:
|
@@ -382,12 +507,14 @@ extract( $args );
|
|
382 |
$rv_value = "http://blip.tv/play/$Embed_id?autostart=$R_autoplay2";
|
383 |
$rv_flashvar = null;
|
384 |
$rv_flashvar2 = null;
|
|
|
385 |
break;
|
386 |
|
387 |
case WordPress:
|
388 |
$rv_value = "http://v.wordpress.com/$Embed_id";
|
389 |
$rv_flashvar = null;
|
390 |
$rv_flashvar2 = null;
|
|
|
391 |
break;
|
392 |
|
393 |
case Viddler:
|
@@ -396,12 +523,14 @@ extract( $args );
|
|
396 |
$rv_flashvar = "<param name=\"flashvars\" value=\"autoplay=t\" />\n";
|
397 |
$rv_flashvar2 = 'flashvars="autoplay=t" ';
|
398 |
}
|
|
|
399 |
break;
|
400 |
|
401 |
case DailyMotion:
|
402 |
$rv_value = "http://www.dailymotion.com/swf/$Embed_id&autoStart=$RV_autoplay&related=0";
|
403 |
$rv_flashvar = null;
|
404 |
$rv_flashvar2 = null;
|
|
|
405 |
break;
|
406 |
|
407 |
|
@@ -409,6 +538,7 @@ extract( $args );
|
|
409 |
$rv_value = "http://flash.revver.com/player/1.0/player.swf?mediaId=$Embed_id&autoStart=$RV_autoplay";
|
410 |
$rv_flashvar = null;
|
411 |
$rv_flashvar2 = null;
|
|
|
412 |
break;
|
413 |
|
414 |
case Metacafe:
|
@@ -418,24 +548,37 @@ extract( $args );
|
|
418 |
$rv_flashvar = null;
|
419 |
$rv_flashvar2 = 'flashVars="playerVars=showStats=no|autoPlay=yes|"';
|
420 |
}
|
|
|
421 |
break;
|
422 |
|
423 |
case Tudou:
|
424 |
$rv_value = "$Embed_id";
|
425 |
$rv_flashvar = null;
|
426 |
$rv_flashvar2 = null;
|
|
|
427 |
break;
|
428 |
|
429 |
case Youku:
|
430 |
$rv_value = "$Embed_id";
|
431 |
$rv_flashvar = null;
|
432 |
$rv_flashvar2 = null;
|
|
|
433 |
break;
|
434 |
|
435 |
case cn6:
|
436 |
$rv_value = "$Embed_id";
|
437 |
$rv_flashvar = null;
|
438 |
$rv_flashvar2 = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
break;
|
440 |
|
441 |
}
|
@@ -448,11 +591,15 @@ extract( $args );
|
|
448 |
echo "<param name=\"allowscriptaccess\" value=\"always\" />\n";
|
449 |
echo "<param name=\"movie\" value=\"$rv_value\" />\n";
|
450 |
echo "<param name=\"wmode\" value=\"transparent\">\n";
|
451 |
-
echo "<embed src=\"$rv_value\" type=\"application/x-shockwave-flash\" wmode=\"transparent\"
|
|
|
452 |
echo $rv_flashvar2;
|
453 |
echo "width=\"$RV_width\" height=\"$RV_height\">\n";
|
454 |
echo "</embed>\n";
|
455 |
echo "</object>\n\n";
|
|
|
|
|
|
|
456 |
echo $after_widget;
|
457 |
}
|
458 |
|
@@ -465,57 +612,93 @@ function update( $new_instance, $old_instance ) {
|
|
465 |
$instance['RV_autoplay'] = strip_tags( $new_instance['RV_autoplay'] );
|
466 |
$instance['RV_id1'] = strip_tags( $new_instance['RV_id1'] );
|
467 |
$instance['RV_source1'] = strip_tags( $new_instance['RV_source1'] );
|
|
|
468 |
$instance['RV_id2'] = strip_tags( $new_instance['RV_id2'] );
|
469 |
$instance['RV_source2'] = strip_tags( $new_instance['RV_source2'] );
|
|
|
470 |
$instance['RV_id3'] = strip_tags( $new_instance['RV_id3'] );
|
471 |
$instance['RV_source3'] = strip_tags( $new_instance['RV_source3'] );
|
|
|
472 |
$instance['RV_id4'] = strip_tags( $new_instance['RV_id4'] );
|
473 |
$instance['RV_source4'] = strip_tags( $new_instance['RV_source4'] );
|
|
|
474 |
$instance['RV_id5'] = strip_tags( $new_instance['RV_id5'] );
|
475 |
-
$instance['RV_source5'] = strip_tags( $new_instance['RV_source5'] );
|
|
|
476 |
return $instance;
|
477 |
}
|
478 |
|
479 |
|
480 |
function form($instance) {
|
481 |
-
$instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width' => '', 'RV_height' => '', 'RV_autoplay' => '','RV_id1' => '','RV_source1' => '', 'RV_id2' => '','RV_source2' => '', 'RV_id3' => '','RV_source3' => '', 'RV_id4' => '','RV_source4' => '', 'RV_id5' => '','RV_source5' => '') );
|
|
|
482 |
$instance['RV_title'] = strip_tags( $instance['RV_title'] );
|
483 |
$instance['RV_width'] = strip_tags( $instance['RV_width'] );
|
484 |
$instance['RV_height'] = strip_tags( $instance['RV_height'] );
|
485 |
$instance['RV_autoplay'] = strip_tags( $instance['RV_autoplay'] );
|
486 |
$instance['RV_id1'] = strip_tags( $instance['RV_id1'] );
|
487 |
$instance['RV_source1'] = strip_tags( $instance['RV_source1'] );
|
|
|
488 |
$instance['RV_id2'] = strip_tags( $instance['RV_id2'] );
|
489 |
$instance['RV_source2'] = strip_tags( $instance['RV_source2'] );
|
|
|
490 |
$instance['RV_id3'] = strip_tags( $instance['RV_id3'] );
|
491 |
$instance['RV_source3'] = strip_tags( $instance['RV_source3'] );
|
|
|
492 |
$instance['RV_id4'] = strip_tags( $instance['RV_id4'] );
|
493 |
$instance['RV_source4'] = strip_tags( $instance['RV_source4'] );
|
|
|
494 |
$instance['RV_id5'] = strip_tags( $instance['RV_id5'] );
|
495 |
-
$instance['RV_source5'] = strip_tags( $instance['RV_source5'] );
|
|
|
496 |
|
497 |
|
498 |
?>
|
499 |
-
|
|
|
500 |
<!--Title -->
|
501 |
<p>
|
502 |
-
<label for="<?php echo $this->get_field_id('RV_title'); ?>">Title:</label>
|
503 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_title'); ?>" name="<?php echo $this->get_field_name('RV_title'); ?>" type="text" value="<?php echo $instance['RV_title']; ?>" />
|
504 |
</p>
|
505 |
|
506 |
<!--Width -->
|
507 |
<p>
|
508 |
-
<label for="<?php echo $this->get_field_id('RV_width'); ?>">Width: </label>
|
509 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_width'); ?>" name="<?php echo $this->get_field_name('RV_width'); ?>" type="text" value="<?php echo $instance['RV_width']; ?>" />
|
510 |
</p>
|
511 |
|
512 |
<!--Height -->
|
513 |
<p>
|
514 |
-
<label for="<?php echo $this->get_field_id('RV_height'); ?>">Height: </label>
|
515 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_height'); ?>" name="<?php echo $this->get_field_name('RV_height'); ?>" type="text" value="<?php echo $instance['RV_height']; ?>" />
|
516 |
</p>
|
517 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
<!--first video setting -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
519 |
<p>
|
520 |
<label for="<?php echo $this->get_field_id( 'RV_source1' ); ?>">Select Video 1 Source:</label>
|
521 |
<select id="<?php echo $this->get_field_id( 'RV_source1' );?>" name="<?php echo $this->get_field_name( 'RV_source1' );?>" class="widefat" style="width:100%;">
|
@@ -532,6 +715,7 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
532 |
<option value='Tudou' <?php if($instance['RV_source1'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option>
|
533 |
<option value='Youku' <?php if($instance['RV_source1'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option>
|
534 |
<option value='cn6' <?php if($instance['RV_source1'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option>
|
|
|
535 |
</select>
|
536 |
</p>
|
537 |
|
@@ -539,8 +723,26 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
539 |
<label for="<?php echo $this->get_field_id('RV_id1'); ?>">Video 1 ID: </label>
|
540 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_id1'); ?>" name="<?php echo $this->get_field_name('RV_id1'); ?>" type="text" value="<?php echo $instance['RV_id1']; ?>" /></p>
|
541 |
|
|
|
|
|
|
|
|
|
|
|
|
|
542 |
|
543 |
<!--second video setting -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
544 |
<p>
|
545 |
<label for="<?php echo $this->get_field_id( 'RV_source2' ); ?>">Select Video 2 Source:</label>
|
546 |
<select id="<?php echo $this->get_field_id( 'RV_source2' );?>" name="<?php echo $this->get_field_name( 'RV_source2' );?>" class="widefat" style="width:100%;">
|
@@ -557,6 +759,7 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
557 |
<option value='Tudou' <?php if($instance['RV_source2'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option>
|
558 |
<option value='Youku' <?php if($instance['RV_source2'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option>
|
559 |
<option value='cn6' <?php if($instance['RV_source2'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option>
|
|
|
560 |
</select>
|
561 |
</p>
|
562 |
|
@@ -564,8 +767,26 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
564 |
<label for="<?php echo $this->get_field_id('RV_id2'); ?>">Video 2 ID: </label>
|
565 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_id2'); ?>" name="<?php echo $this->get_field_name('RV_id2'); ?>" type="text" value="<?php echo $instance['RV_id2']; ?>" /></p>
|
566 |
|
|
|
|
|
|
|
|
|
|
|
|
|
567 |
|
568 |
<!--third video setting -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
<p>
|
570 |
<label for="<?php echo $this->get_field_id( 'RV_source3' ); ?>">Select Video 3 Source:</label>
|
571 |
<select id="<?php echo $this->get_field_id( 'RV_source3' );?>" name="<?php echo $this->get_field_name( 'RV_source3' );?>" class="widefat" style="width:100%;">
|
@@ -582,6 +803,7 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
582 |
<option value='Tudou' <?php if($instance['RV_source3'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option>
|
583 |
<option value='Youku' <?php if($instance['RV_source3'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option>
|
584 |
<option value='cn6' <?php if($instance['RV_source3'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option>
|
|
|
585 |
</select>
|
586 |
</p>
|
587 |
|
@@ -589,8 +811,27 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
589 |
<label for="<?php echo $this->get_field_id('RV_id3'); ?>">Video 3 ID: </label>
|
590 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_id3'); ?>" name="<?php echo $this->get_field_name('RV_id3'); ?>" type="text" value="<?php echo $instance['RV_id3']; ?>" /></p>
|
591 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
592 |
|
593 |
<!--fourth video setting -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
594 |
<p>
|
595 |
<label for="<?php echo $this->get_field_id( 'RV_source4' ); ?>">Select Video 4 Source:</label>
|
596 |
<select id="<?php echo $this->get_field_id( 'RV_source4' );?>" name="<?php echo $this->get_field_name( 'RV_source4' );?>" class="widefat" style="width:100%;">
|
@@ -607,6 +848,7 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
607 |
<option value='Tudou' <?php if($instance['RV_source4'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option>
|
608 |
<option value='Youku' <?php if($instance['RV_source4'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option>
|
609 |
<option value='cn6' <?php if($instance['RV_source4'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option>
|
|
|
610 |
</select>
|
611 |
</p>
|
612 |
|
@@ -614,8 +856,26 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
614 |
<label for="<?php echo $this->get_field_id('RV_id4'); ?>">Video 4 ID: </label>
|
615 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_id4'); ?>" name="<?php echo $this->get_field_name('RV_id4'); ?>" type="text" value="<?php echo $instance['RV_id4']; ?>" /></p>
|
616 |
|
|
|
|
|
|
|
|
|
|
|
|
|
617 |
|
618 |
<!--fifth video setting -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
619 |
<p>
|
620 |
<label for="<?php echo $this->get_field_id( 'RV_source5' ); ?>">Select Video 5 Source:</label>
|
621 |
<select id="<?php echo $this->get_field_id( 'RV_source5' );?>" name="<?php echo $this->get_field_name( 'RV_source5' );?>" class="widefat" style="width:100%;">
|
@@ -632,6 +892,7 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
632 |
<option value='Tudou' <?php if($instance['RV_source5'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option>
|
633 |
<option value='Youku' <?php if($instance['RV_source5'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option>
|
634 |
<option value='cn6' <?php if($instance['RV_source5'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option>
|
|
|
635 |
</select>
|
636 |
</p>
|
637 |
|
@@ -639,15 +900,13 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
639 |
<label for="<?php echo $this->get_field_id('RV_id5'); ?>">Video 5 ID: </label>
|
640 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_id5'); ?>" name="<?php echo $this->get_field_name('RV_id5'); ?>" type="text" value="<?php echo $instance['RV_id5']; ?>" /></p>
|
641 |
|
642 |
-
|
643 |
-
<!--auto play -->
|
644 |
<p>
|
645 |
-
<label for="<?php echo $this->get_field_id(
|
646 |
-
<
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
|
652 |
<?php
|
653 |
|
2 |
/*
|
3 |
Plugin Name: Video Sidebar Widgets
|
4 |
Plugin URI: http://denzeldesigns.com/wordpress-plugins/video-sidebar-widgets/
|
5 |
+
Version: 2.1
|
6 |
Description: A video sidebar widget using WordPress 2.8 Widgets API to display videos such as Vimeo, YouTube, MySpace Videos etc. Requires at least WordPress 2.8.1. Now including Random Video Sidebar Widget to randomly display 1 out of 5 preset video.
|
7 |
Author: Denzel Chia
|
8 |
Author URI: http://denzeldesigns.com/
|
9 |
*/
|
10 |
|
11 |
|
12 |
+
//action to initiate widgets
|
13 |
add_action('widgets_init', 'load_video_sidebar_widgets');
|
14 |
|
15 |
+
|
16 |
+
//function to register Video Sidebar Widget and Random Video Sidebar Widget
|
17 |
function load_video_sidebar_widgets() {
|
18 |
register_widget('VideoSidebarWidget');
|
19 |
register_widget('RandomVideoSidebarWidget');
|
20 |
}
|
21 |
|
22 |
|
23 |
+
//Video Sidebar Widget Class to extend WP_Widget class
|
24 |
class VideoSidebarWidget extends WP_Widget {
|
25 |
|
26 |
+
//function to set up widget in admin
|
27 |
+
function VideoSidebarWidget() {
|
28 |
+
|
29 |
+
$widget_ops = array( 'classname' => 'videosidebar',
|
30 |
+
'description' => __('A Video Widget to display video in sidebar from various video sharing networks', 'videosidebar') );
|
31 |
+
|
32 |
+
$control_ops = array( 'width' => 200, 'height' => 350, 'id_base' => 'videosidebar' );
|
33 |
+
$this->WP_Widget( 'videosidebar', __('Video Sidebar Widget', 'videosidebar'), $widget_ops, $control_ops );
|
34 |
+
|
35 |
+
}
|
36 |
|
37 |
|
38 |
+
//function to echo out widget on sidebar
|
39 |
+
function widget( $args, $instance ) {
|
40 |
+
extract( $args );
|
41 |
+
|
42 |
+
$title2 = apply_filters('widget_title2', $instance['title2'] );
|
43 |
+
$cap2 = $instance['v_cap2'];
|
44 |
+
|
45 |
+
echo $before_widget;
|
46 |
+
|
47 |
+
// if user written title echo out
|
48 |
+
if ( $title2 ){
|
49 |
+
echo $before_title . $title2 . $after_title;
|
50 |
+
}
|
51 |
+
|
52 |
+
//get settings from Widget Admin Form to assign to function ShowVideo
|
53 |
+
$autoplaysetting = $instance['v_autoplay2'];
|
54 |
+
$videoid = $instance['v_id2'];
|
55 |
+
$videosource = $instance['v_source'];
|
56 |
+
$videowidth = $instance['v_width2'];
|
57 |
+
$videoheight = $instance['v_height2'];
|
58 |
+
|
59 |
+
//function to show video in blog sidebar, please look for it below
|
60 |
+
ShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'false');
|
61 |
+
|
62 |
+
if($cap2){
|
63 |
+
echo "<p class=\"VideoCaption\">$cap2</p>";
|
64 |
+
}
|
65 |
+
|
66 |
+
echo $after_widget;
|
67 |
+
|
68 |
+
}//end of function widget
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
|
72 |
+
//function to update widget setting
|
73 |
+
function update( $new_instance, $old_instance ) {
|
74 |
+
|
75 |
+
$instance = $old_instance;
|
76 |
+
$instance['title2'] = strip_tags( $new_instance['title2'] );
|
77 |
+
$instance['v_width2'] = strip_tags( $new_instance['v_width2'] );
|
78 |
+
$instance['v_height2'] = strip_tags( $new_instance['v_height2'] );
|
79 |
+
$instance['v_autoplay2'] = strip_tags( $new_instance['v_autoplay2'] );
|
80 |
+
$instance['v_id2'] = strip_tags( $new_instance['v_id2'] );
|
81 |
+
$instance['v_source'] = strip_tags( $new_instance['v_source'] );
|
82 |
+
$instance['v_cap2'] = strip_tags( $new_instance['v_cap2'] );
|
83 |
+
return $instance;
|
84 |
+
|
85 |
+
}//end of function update
|
86 |
|
87 |
+
|
88 |
+
//function to create Widget Admin form
|
89 |
+
function form($instance) {
|
90 |
|
91 |
+
$instance = wp_parse_args( (array) $instance, array( 'title2' => '', 'v_width2' => '', 'v_height2' => '',
|
92 |
+
'v_autoplay2' => '','v_id2' => '','v_source' => '','v_cap2' => '') );
|
93 |
+
|
94 |
+
$instance['title2'] = strip_tags( $instance['title2'] );
|
95 |
+
$instance['v_width2'] = strip_tags( $instance['v_width2'] );
|
96 |
+
$instance['v_height2'] = strip_tags( $instance['v_height2'] );
|
97 |
+
$instance['v_autoplay2'] = strip_tags( $instance['v_autoplay2'] );
|
98 |
+
$instance['v_id2'] = strip_tags( $instance['v_id2'] );
|
99 |
+
$instance['v_source'] = strip_tags( $instance['v_source'] );
|
100 |
+
$instance['v_cap2'] = strip_tags( $instance['v_cap2'] );
|
101 |
+
|
102 |
+
//function to show video in widget admin form fixed width and height, please look for it below
|
103 |
+
$autoplaysetting = '0';
|
104 |
+
$videoid = $instance['v_id2'];
|
105 |
+
$videosource = $instance['v_source'];
|
106 |
+
$videowidth = null;
|
107 |
+
$videoheight = null;
|
108 |
+
//$admin = true // to show video in admin
|
109 |
+
|
110 |
+
ShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true');
|
111 |
+
|
112 |
+
?>
|
113 |
+
|
114 |
+
|
115 |
+
<p>
|
116 |
+
<label for="<?php echo $this->get_field_id('title2'); ?>">Widget Title:</label>
|
117 |
+
<input class="widefat" id="<?php echo $this->get_field_id('title2'); ?>" name="<?php echo $this->get_field_name('title2'); ?>"
|
118 |
+
type="text" value="<?php echo $instance['title2']; ?>" />
|
119 |
+
</p>
|
120 |
+
|
121 |
+
<p>
|
122 |
+
<label for="<?php echo $this->get_field_id( 'v_source' ); ?>">Select Video Source:</label>
|
123 |
+
<select id="<?php echo $this->get_field_id( 'v_source' );?>" name="<?php echo $this->get_field_name( 'v_source' );?>"
|
124 |
+
class="widefat" style="width:100%;">
|
125 |
+
<option value='YouTube' <?php if($instance['v_source'] == 'YouTube'){echo 'selected="selected"';}?> >YouTube Video</option>
|
126 |
+
<option value='Vimeo' <?php if($instance['v_source'] == 'Vimeo'){echo 'selected="selected"';}?> >Vimeo Video</option>
|
127 |
+
<option value='MySpace' <?php if($instance['v_source'] == 'MySpace'){echo 'selected="selected"';}?> >MySpace Video</option>
|
128 |
+
<option value='Veoh' <?php if($instance['v_source'] == 'Veoh'){echo 'selected="selected"';}?> >Veoh Video</option>
|
129 |
+
<option value='Blip' <?php if($instance['v_source'] == 'Blip'){echo 'selected="selected"';}?> >blip.tv Video</option>
|
130 |
+
<option value='WordPress' <?php if($instance['v_source'] == 'WordPress'){echo 'selected="selected"';}?> >WordPress Video
|
131 |
+
</option>
|
132 |
+
<option value='Viddler' <?php if($instance['v_source'] == 'Viddler'){echo 'selected="selected"';}?> >Viddler Video</option>
|
133 |
+
<option value='DailyMotion' <?php if($instance['v_source'] == 'DailyMotion'){echo 'selected="selected"';}?> >DailyMotion Video </option>
|
134 |
+
<option value='Revver' <?php if($instance['v_source'] == 'Revver'){echo 'selected="selected"';}?> >Revver Video</option>
|
135 |
+
<option value='Metacafe' <?php if($instance['v_source'] == 'Metacafe'){echo 'selected="selected"';}?> >Metacafe Video</option>
|
136 |
+
<option value='Tudou' <?php if($instance['v_source'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option>
|
137 |
+
<option value='Youku' <?php if($instance['v_source'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option>
|
138 |
+
<option value='cn6' <?php if($instance['v_source'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option>
|
139 |
+
<option value='Google' <?php if($instance['v_source'] == 'Google'){echo 'selected="selected"';}?> >Google Video</option>
|
140 |
+
</select>
|
141 |
+
</p>
|
142 |
+
|
143 |
+
<p>
|
144 |
+
<label for="<?php echo $this->get_field_id('v_id2'); ?>">Video ID: </label>
|
145 |
+
<input class="widefat" id="<?php echo $this->get_field_id('v_id2'); ?>"
|
146 |
+
name="<?php echo $this->get_field_name('v_id2'); ?>" type="text" value="<?php echo $instance['v_id2']; ?>" /></p>
|
147 |
+
|
148 |
+
<p>
|
149 |
+
<label for="<?php echo $this->get_field_id('v_width2'); ?>">Video Width: </label>
|
150 |
+
<input class="widefat" id="<?php echo $this->get_field_id('v_width2'); ?>"
|
151 |
+
name="<?php echo $this->get_field_name('v_width2'); ?>" type="text" value="<?php echo $instance['v_width2']; ?>" />
|
152 |
+
</p>
|
153 |
+
|
154 |
+
<p>
|
155 |
+
<label for="<?php echo $this->get_field_id('v_height2'); ?>">Video Height: </label>
|
156 |
+
<input class="widefat" id="<?php echo $this->get_field_id('v_height2'); ?>"
|
157 |
+
name="<?php echo $this->get_field_name('v_height2'); ?>" type="text" value="<?php echo $instance['v_height2']; ?>" />
|
158 |
+
</p>
|
159 |
+
|
160 |
+
<p>
|
161 |
+
<label for="<?php echo $this->get_field_id('v_cap2'); ?>">Video Caption: </label>
|
162 |
+
<input class="widefat" id="<?php echo $this->get_field_id('v_cap2'); ?>"
|
163 |
+
name="<?php echo $this->get_field_name('v_cap2'); ?>" type="text" value="<?php echo $instance['v_cap2']; ?>" />
|
164 |
+
</p>
|
165 |
+
|
166 |
+
|
167 |
+
<p>
|
168 |
+
|
169 |
+
<?php
|
170 |
+
|
171 |
+
// check whether autoplay feature supported by video network
|
172 |
+
$source = $instance['v_source'];
|
173 |
+
$msg = "<p>Sorry, auto play option not supported by ".$source."</p>";
|
174 |
+
switch ($source) {
|
175 |
+
|
176 |
+
case WordPress:
|
177 |
+
echo $msg;
|
178 |
+
break;
|
179 |
+
|
180 |
+
case Tudou:
|
181 |
+
echo $msg;
|
182 |
+
break;
|
183 |
+
|
184 |
+
case Youku:
|
185 |
+
echo $msg;
|
186 |
+
break;
|
187 |
+
|
188 |
+
case cn6:
|
189 |
+
echo "<p>Sorry, auto play option not supported by 6.cn</p>";
|
190 |
+
break;
|
191 |
+
}
|
192 |
+
|
193 |
+
?>
|
194 |
+
|
195 |
+
<label for="<?php echo $this->get_field_id( 'v_autoplay2' ); ?>">Auto Play:</label>
|
196 |
+
<select id="<?php echo $this->get_field_id( 'v_autoplay2' );?>"
|
197 |
+
name="<?php echo $this->get_field_name( 'v_autoplay2' );?>" class="widefat" style="width:100%;">';
|
198 |
+
<option value='1' <?php if($instance['v_autoplay2'] == '1'){echo 'selected="selected"';}?>>Yes</option>
|
199 |
+
<option value='0' <?php if($instance['v_autoplay2'] == '0'){echo 'selected="selected"';}?>>No</option>
|
200 |
+
</select>
|
201 |
+
</p>
|
202 |
+
|
203 |
+
<?php
|
204 |
+
|
205 |
+
}//end of function form($instance)
|
206 |
+
|
207 |
+
}//end of Video Sidebar Widget Class
|
208 |
+
|
209 |
+
|
210 |
+
|
211 |
+
function ShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,$admin){
|
212 |
+
|
213 |
+
//admin = true to show in widget admin
|
214 |
+
//admin = false to show in blog sidebar
|
215 |
+
|
216 |
+
$v_autoplay2 = $autoplaysetting;
|
217 |
+
$v_id2 = $videoid;
|
218 |
+
$v_source = $videosource;
|
219 |
+
$v_width2 = $videowidth;
|
220 |
+
$v_height2 = $videoheight;
|
221 |
+
|
222 |
+
$source = $v_source;
|
223 |
+
|
224 |
+
//test for source and assign codes accordingly
|
225 |
switch ($source) {
|
226 |
|
227 |
case null:
|
249 |
break;
|
250 |
|
251 |
case Veoh:
|
252 |
+
$value = "http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.4.2.20.1002&";
|
253 |
+
$value.= "permalinkId=$v_id2&player=videodetailsembedded&id=anonymous&videoAutoPlay=$v_autoplay2";
|
254 |
$flashvar = null;
|
255 |
$flashvar2 = null;
|
256 |
break;
|
317 |
$flashvar = null;
|
318 |
$flashvar2 = null;
|
319 |
break;
|
320 |
+
|
321 |
+
case Google:
|
322 |
+
$value = "http://video.google.com/googleplayer.swf?docid=$v_id2&hl=en&fs=true";
|
323 |
+
if($v_autoplay2=='1'){
|
324 |
+
$flashvar = null;
|
325 |
+
$flashvar2 = 'FlashVars="autoPlay=true&playerMode=embedded"';
|
326 |
+
}
|
327 |
+
break;
|
328 |
|
329 |
}
|
330 |
|
331 |
+
if($admin=="true"){
|
332 |
+
// echo video in admin
|
333 |
+
echo "\n<object width=\"212\" height=\"172\">\n";
|
334 |
+
echo $flashvar;
|
335 |
+
echo "<param name=\"allowfullscreen\" value=\"true\" />\n";
|
336 |
+
echo "<param name=\"allowscriptaccess\" value=\"always\" />\n";
|
337 |
+
echo "<param name=\"movie\" value=\"$value\" />\n";
|
338 |
+
echo "<param name=\"wmode\" value=\"transparent\">\n";
|
339 |
+
echo "<embed src=\"$value\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" ";
|
340 |
+
echo "allowfullscreen=\"true\" allowscriptaccess=\"always\" ";
|
341 |
+
echo $flashvar2;
|
342 |
+
echo "width=\"212\" height=\"172\">\n";
|
343 |
+
echo "</embed>\n";
|
344 |
+
echo "</object>\n\n";
|
345 |
+
|
346 |
+
}else{
|
347 |
|
348 |
+
// echo video on blog
|
349 |
+
echo "\n<object width=\"$v_width2\" height=\"$v_height2\">\n";
|
350 |
echo $flashvar;
|
351 |
echo "<param name=\"allowfullscreen\" value=\"true\" />\n";
|
352 |
echo "<param name=\"allowscriptaccess\" value=\"always\" />\n";
|
353 |
echo "<param name=\"movie\" value=\"$value\" />\n";
|
354 |
echo "<param name=\"wmode\" value=\"transparent\">\n";
|
355 |
+
echo "<embed src=\"$value\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" ";
|
356 |
+
echo "allowfullscreen=\"true\" allowscriptaccess=\"always\" ";
|
357 |
echo $flashvar2;
|
358 |
echo "width=\"$v_width2\" height=\"$v_height2\">\n";
|
359 |
echo "</embed>\n";
|
360 |
echo "</object>\n\n";
|
361 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
|
|
|
|
|
|
|
363 |
|
364 |
+
}//end of function ShowVideo
|
|
|
|
|
|
|
365 |
|
|
|
|
|
|
|
|
|
366 |
|
|
|
|
|
367 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
|
|
|
370 |
|
|
|
371 |
|
|
|
372 |
|
373 |
|
374 |
|
380 |
|
381 |
function RandomVideoSidebarWidget() {
|
382 |
$widget_ops = array( 'classname' => 'randomvideosidebar', 'description' => __('A Random Video Widget. Randomly selects 1 of the 5 preset videos for display', 'randomvideosidebar') );
|
383 |
+
$control_ops = array( 'width' => 705, 'height' => 600, 'id_base' => 'randomvideosidebar' );
|
384 |
$this->WP_Widget( 'randomvideosidebar', __('Random Video Sidebar Widget', 'randomvideosidebar'), $widget_ops, $control_ops );
|
385 |
}
|
386 |
|
394 |
$RV_autoplay = $instance['RV_autoplay'];
|
395 |
$RV_id1 = $instance['RV_id1'];
|
396 |
$RV_source1 = $instance['RV_source1'];
|
397 |
+
$RV_cap1 = $instance['RV_cap1'];
|
398 |
$RV_id2 = $instance['RV_id2'];
|
399 |
$RV_source2 = $instance['RV_source2'];
|
400 |
+
$RV_cap2 = $instance['RV_cap2'];
|
401 |
$RV_id3 = $instance['RV_id3'];
|
402 |
+
$RV_source3 = $instance['RV_source3'];
|
403 |
+
$RV_cap3 = $instance['RV_cap3'];
|
404 |
$RV_id4 = $instance['RV_id4'];
|
405 |
$RV_source4 = $instance['RV_source4'];
|
406 |
+
$RV_cap4 = $instance['RV_cap4'];
|
407 |
$RV_id5 = $instance['RV_id5'];
|
408 |
+
$RV_source5 = $instance['RV_source5'];
|
409 |
+
$RV_cap5 = $instance['RV_cap5'];
|
410 |
|
411 |
echo $before_widget;
|
412 |
|
422 |
case 1:
|
423 |
$Embed_id = $RV_id1;
|
424 |
$Embed_source = $RV_source1;
|
425 |
+
$Embed_cap = $RV_cap1;
|
426 |
break;
|
427 |
|
428 |
case 2:
|
429 |
$Embed_id = $RV_id2;
|
430 |
$Embed_source = $RV_source2;
|
431 |
+
$Embed_cap = $RV_cap2;
|
432 |
break;
|
433 |
|
434 |
case 3:
|
435 |
$Embed_id = $RV_id3;
|
436 |
$Embed_source = $RV_source3;
|
437 |
+
$Embed_cap = $RV_cap3;
|
438 |
break;
|
439 |
|
440 |
case 4:
|
441 |
$Embed_id = $RV_id4;
|
442 |
$Embed_source = $RV_source4;
|
443 |
+
$Embed_cap = $RV_cap4;
|
444 |
break;
|
445 |
|
446 |
case 5:
|
447 |
$Embed_id = $RV_id5;
|
448 |
$Embed_source = $RV_source5;
|
449 |
+
$Embed_cap = $RV_cap5;
|
450 |
break;
|
451 |
|
452 |
}
|
456 |
|
457 |
If(empty($Embed_id)){
|
458 |
$Embed_id = $RV_id1;
|
459 |
+
$Embed_source = $RV_source1;
|
460 |
+
$Embed_cap = $RV_cap1;
|
461 |
}
|
462 |
|
463 |
$select_source = $Embed_source;
|
468 |
$rv_value = null;
|
469 |
$rv_flashvar = null;
|
470 |
$rv_flashvar2 = null;
|
471 |
+
$rv_cap = null;
|
472 |
break;
|
473 |
|
474 |
case YouTube:
|
475 |
$rv_value = "http://www.youtube.com/v/$Embed_id&autoplay=$RV_autoplay&loop=0&rel=0";
|
476 |
$rv_flashvar = null;
|
477 |
$rv_flashvar2 = null;
|
478 |
+
$rv_cap = $Embed_cap;
|
479 |
break;
|
480 |
|
481 |
case Vimeo:
|
482 |
$rv_value = "http://vimeo.com/moogaloop.swf?clip_id=$Embed_id&server=vimeo.com&loop=0&fullscreen=1&autoplay=$RV_autoplay";
|
483 |
$rv_flashvar = null;
|
484 |
$rv_flashvar2 = null;
|
485 |
+
$rv_cap = $Embed_cap;
|
486 |
break;
|
487 |
|
488 |
case MySpace:
|
489 |
$rv_value = "http://mediaservices.myspace.com/services/media/embed.aspx/m=$Embed_id,t=1,mt=video,ap=$RV_autoplay";
|
490 |
$rv_flashvar = null;
|
491 |
$rv_flashvar2 = null;
|
492 |
+
$rv_cap = $Embed_cap;
|
493 |
break;
|
494 |
|
495 |
case Veoh:
|
497 |
$rv_value.= "&player=videodetailsembedded&id=anonymous&videoAutoPlay=$RV_autoplay";
|
498 |
$rv_flashvar = null;
|
499 |
$rv_flashvar2 = null;
|
500 |
+
$rv_cap = $Embed_cap;
|
501 |
break;
|
502 |
|
503 |
case Blip:
|
507 |
$rv_value = "http://blip.tv/play/$Embed_id?autostart=$R_autoplay2";
|
508 |
$rv_flashvar = null;
|
509 |
$rv_flashvar2 = null;
|
510 |
+
$rv_cap = $Embed_cap;
|
511 |
break;
|
512 |
|
513 |
case WordPress:
|
514 |
$rv_value = "http://v.wordpress.com/$Embed_id";
|
515 |
$rv_flashvar = null;
|
516 |
$rv_flashvar2 = null;
|
517 |
+
$rv_cap = $Embed_cap;
|
518 |
break;
|
519 |
|
520 |
case Viddler:
|
523 |
$rv_flashvar = "<param name=\"flashvars\" value=\"autoplay=t\" />\n";
|
524 |
$rv_flashvar2 = 'flashvars="autoplay=t" ';
|
525 |
}
|
526 |
+
$rv_cap = $Embed_cap;
|
527 |
break;
|
528 |
|
529 |
case DailyMotion:
|
530 |
$rv_value = "http://www.dailymotion.com/swf/$Embed_id&autoStart=$RV_autoplay&related=0";
|
531 |
$rv_flashvar = null;
|
532 |
$rv_flashvar2 = null;
|
533 |
+
$rv_cap = $Embed_cap;
|
534 |
break;
|
535 |
|
536 |
|
538 |
$rv_value = "http://flash.revver.com/player/1.0/player.swf?mediaId=$Embed_id&autoStart=$RV_autoplay";
|
539 |
$rv_flashvar = null;
|
540 |
$rv_flashvar2 = null;
|
541 |
+
$rv_cap = $Embed_cap;
|
542 |
break;
|
543 |
|
544 |
case Metacafe:
|
548 |
$rv_flashvar = null;
|
549 |
$rv_flashvar2 = 'flashVars="playerVars=showStats=no|autoPlay=yes|"';
|
550 |
}
|
551 |
+
$rv_cap = $Embed_cap;
|
552 |
break;
|
553 |
|
554 |
case Tudou:
|
555 |
$rv_value = "$Embed_id";
|
556 |
$rv_flashvar = null;
|
557 |
$rv_flashvar2 = null;
|
558 |
+
$rv_cap = $Embed_cap;
|
559 |
break;
|
560 |
|
561 |
case Youku:
|
562 |
$rv_value = "$Embed_id";
|
563 |
$rv_flashvar = null;
|
564 |
$rv_flashvar2 = null;
|
565 |
+
$rv_cap = $Embed_cap;
|
566 |
break;
|
567 |
|
568 |
case cn6:
|
569 |
$rv_value = "$Embed_id";
|
570 |
$rv_flashvar = null;
|
571 |
$rv_flashvar2 = null;
|
572 |
+
$rv_cap = $Embed_cap;
|
573 |
+
break;
|
574 |
+
|
575 |
+
case Google:
|
576 |
+
$rv_value = "http://video.google.com/googleplayer.swf?docid=$Embed_id&hl=en&fs=true";
|
577 |
+
if($RV_autoplay=='1'){
|
578 |
+
$rv_flashvar = null;
|
579 |
+
$rv_flashvar2 = 'FlashVars="autoPlay=true&playerMode=embedded"';
|
580 |
+
}
|
581 |
+
$rv_cap = $Embed_cap;
|
582 |
break;
|
583 |
|
584 |
}
|
591 |
echo "<param name=\"allowscriptaccess\" value=\"always\" />\n";
|
592 |
echo "<param name=\"movie\" value=\"$rv_value\" />\n";
|
593 |
echo "<param name=\"wmode\" value=\"transparent\">\n";
|
594 |
+
echo "<embed src=\"$rv_value\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" ";
|
595 |
+
echo "allowfullscreen=\"true\" allowscriptaccess=\"always\" ";
|
596 |
echo $rv_flashvar2;
|
597 |
echo "width=\"$RV_width\" height=\"$RV_height\">\n";
|
598 |
echo "</embed>\n";
|
599 |
echo "</object>\n\n";
|
600 |
+
echo "<p class=\"VideoCaption\">$rv_cap</p>";
|
601 |
+
|
602 |
+
|
603 |
echo $after_widget;
|
604 |
}
|
605 |
|
612 |
$instance['RV_autoplay'] = strip_tags( $new_instance['RV_autoplay'] );
|
613 |
$instance['RV_id1'] = strip_tags( $new_instance['RV_id1'] );
|
614 |
$instance['RV_source1'] = strip_tags( $new_instance['RV_source1'] );
|
615 |
+
$instance['RV_cap1'] = strip_tags( $new_instance['RV_cap1'] );
|
616 |
$instance['RV_id2'] = strip_tags( $new_instance['RV_id2'] );
|
617 |
$instance['RV_source2'] = strip_tags( $new_instance['RV_source2'] );
|
618 |
+
$instance['RV_cap2'] = strip_tags( $new_instance['RV_cap2'] );
|
619 |
$instance['RV_id3'] = strip_tags( $new_instance['RV_id3'] );
|
620 |
$instance['RV_source3'] = strip_tags( $new_instance['RV_source3'] );
|
621 |
+
$instance['RV_cap3'] = strip_tags( $new_instance['RV_cap3'] );
|
622 |
$instance['RV_id4'] = strip_tags( $new_instance['RV_id4'] );
|
623 |
$instance['RV_source4'] = strip_tags( $new_instance['RV_source4'] );
|
624 |
+
$instance['RV_cap4'] = strip_tags( $new_instance['RV_cap4'] );
|
625 |
$instance['RV_id5'] = strip_tags( $new_instance['RV_id5'] );
|
626 |
+
$instance['RV_source5'] = strip_tags( $new_instance['RV_source5'] );
|
627 |
+
$instance['RV_cap5'] = strip_tags( $new_instance['RV_cap5'] );
|
628 |
return $instance;
|
629 |
}
|
630 |
|
631 |
|
632 |
function form($instance) {
|
633 |
+
$instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width' => '', 'RV_height' => '', 'RV_autoplay' => '','RV_id1' => '','RV_source1' => '','RV_cap1' => '', 'RV_id2' => '','RV_source2' => '','RV_cap2' => '', 'RV_id3' => '','RV_source3' => '','RV_cap3' => '', 'RV_id4' => '','RV_source4' => '','RV_cap4' => '', 'RV_id5' => '','RV_source5' => '','RV_cap5' => '') );
|
634 |
+
|
635 |
$instance['RV_title'] = strip_tags( $instance['RV_title'] );
|
636 |
$instance['RV_width'] = strip_tags( $instance['RV_width'] );
|
637 |
$instance['RV_height'] = strip_tags( $instance['RV_height'] );
|
638 |
$instance['RV_autoplay'] = strip_tags( $instance['RV_autoplay'] );
|
639 |
$instance['RV_id1'] = strip_tags( $instance['RV_id1'] );
|
640 |
$instance['RV_source1'] = strip_tags( $instance['RV_source1'] );
|
641 |
+
$instance['RV_cap1'] = strip_tags( $instance['RV_cap1'] );
|
642 |
$instance['RV_id2'] = strip_tags( $instance['RV_id2'] );
|
643 |
$instance['RV_source2'] = strip_tags( $instance['RV_source2'] );
|
644 |
+
$instance['RV_cap2'] = strip_tags( $instance['RV_cap2'] );
|
645 |
$instance['RV_id3'] = strip_tags( $instance['RV_id3'] );
|
646 |
$instance['RV_source3'] = strip_tags( $instance['RV_source3'] );
|
647 |
+
$instance['RV_cap3'] = strip_tags( $instance['RV_cap3'] );
|
648 |
$instance['RV_id4'] = strip_tags( $instance['RV_id4'] );
|
649 |
$instance['RV_source4'] = strip_tags( $instance['RV_source4'] );
|
650 |
+
$instance['RV_cap4'] = strip_tags( $instance['RV_cap4'] );
|
651 |
$instance['RV_id5'] = strip_tags( $instance['RV_id5'] );
|
652 |
+
$instance['RV_source5'] = strip_tags( $instance['RV_source5'] );
|
653 |
+
$instance['RV_cap5'] = strip_tags( $instance['RV_cap5'] );
|
654 |
|
655 |
|
656 |
?>
|
657 |
+
<div style="width:220px;height:350px;float:left;margin:0px 15px 20px 5px">
|
658 |
+
<h2>General Settings</h2>
|
659 |
<!--Title -->
|
660 |
<p>
|
661 |
+
<label for="<?php echo $this->get_field_id('RV_title'); ?>">Widget Title:</label>
|
662 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_title'); ?>" name="<?php echo $this->get_field_name('RV_title'); ?>" type="text" value="<?php echo $instance['RV_title']; ?>" />
|
663 |
</p>
|
664 |
|
665 |
<!--Width -->
|
666 |
<p>
|
667 |
+
<label for="<?php echo $this->get_field_id('RV_width'); ?>">Video Width: </label>
|
668 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_width'); ?>" name="<?php echo $this->get_field_name('RV_width'); ?>" type="text" value="<?php echo $instance['RV_width']; ?>" />
|
669 |
</p>
|
670 |
|
671 |
<!--Height -->
|
672 |
<p>
|
673 |
+
<label for="<?php echo $this->get_field_id('RV_height'); ?>">Video Height: </label>
|
674 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_height'); ?>" name="<?php echo $this->get_field_name('RV_height'); ?>" type="text" value="<?php echo $instance['RV_height']; ?>" />
|
675 |
</p>
|
676 |
|
677 |
+
<!--auto play -->
|
678 |
+
<p>
|
679 |
+
<label for="<?php echo $this->get_field_id( 'RV_autoplay' ); ?>">Auto Play:</label>
|
680 |
+
<select id="<?php echo $this->get_field_id( 'RV_autoplay' );?>" name="<?php echo $this->get_field_name( 'RV_autoplay' );?>" class="widefat" style="width:100%;">';
|
681 |
+
<option value='1' <?php if($instance['RV_autoplay'] == '1'){echo 'selected="selected"';}?>>Yes</option>
|
682 |
+
<option value='0' <?php if($instance['RV_autoplay'] == '0'){echo 'selected="selected"';}?>>No</option>
|
683 |
+
</select>
|
684 |
+
</p>
|
685 |
+
<p>Please fill up settings before clicking on save to display video.</p>
|
686 |
+
</div>
|
687 |
+
|
688 |
+
<div style="width:220px;height:350px;float:left;margin:0px 15px 20px 0px">
|
689 |
<!--first video setting -->
|
690 |
+
<h2>Video 1</h2>
|
691 |
+
<?php
|
692 |
+
//show video in Random Video Widget Admin
|
693 |
+
$autoplaysetting = '0';
|
694 |
+
$videoid = $instance['RV_id1'];
|
695 |
+
$videosource = $instance['RV_source1'];
|
696 |
+
$videowidth = null;
|
697 |
+
$videoheight = null;
|
698 |
+
//$admin = true // to show video in admin
|
699 |
+
|
700 |
+
ShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true');
|
701 |
+
?>
|
702 |
<p>
|
703 |
<label for="<?php echo $this->get_field_id( 'RV_source1' ); ?>">Select Video 1 Source:</label>
|
704 |
<select id="<?php echo $this->get_field_id( 'RV_source1' );?>" name="<?php echo $this->get_field_name( 'RV_source1' );?>" class="widefat" style="width:100%;">
|
715 |
<option value='Tudou' <?php if($instance['RV_source1'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option>
|
716 |
<option value='Youku' <?php if($instance['RV_source1'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option>
|
717 |
<option value='cn6' <?php if($instance['RV_source1'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option>
|
718 |
+
<option value='Google' <?php if($instance['RV_source1'] == 'Google'){echo 'selected="selected"';}?> >Google Video</option>
|
719 |
</select>
|
720 |
</p>
|
721 |
|
723 |
<label for="<?php echo $this->get_field_id('RV_id1'); ?>">Video 1 ID: </label>
|
724 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_id1'); ?>" name="<?php echo $this->get_field_name('RV_id1'); ?>" type="text" value="<?php echo $instance['RV_id1']; ?>" /></p>
|
725 |
|
726 |
+
<p>
|
727 |
+
<label for="<?php echo $this->get_field_id('RV_cap1'); ?>">Video Caption: </label>
|
728 |
+
<input class="widefat" id="<?php echo $this->get_field_id('RV_cap1'); ?>" name="<?php echo $this->get_field_name('RV_cap1'); ?>" type="text" value="<?php echo $instance['RV_cap1']; ?>" /></p>
|
729 |
+
|
730 |
+
</div>
|
731 |
+
<div style="width:220px;height:350px;float:left;margin:0px 15px 20px 0px">
|
732 |
|
733 |
<!--second video setting -->
|
734 |
+
<h2>Video 2</h2>
|
735 |
+
<?php
|
736 |
+
//show video in Random Video Widget Admin
|
737 |
+
$autoplaysetting = '0';
|
738 |
+
$videoid = $instance['RV_id2'];
|
739 |
+
$videosource = $instance['RV_source2'];
|
740 |
+
$videowidth = null;
|
741 |
+
$videoheight = null;
|
742 |
+
//$admin = true // to show video in admin
|
743 |
+
|
744 |
+
ShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true');
|
745 |
+
?>
|
746 |
<p>
|
747 |
<label for="<?php echo $this->get_field_id( 'RV_source2' ); ?>">Select Video 2 Source:</label>
|
748 |
<select id="<?php echo $this->get_field_id( 'RV_source2' );?>" name="<?php echo $this->get_field_name( 'RV_source2' );?>" class="widefat" style="width:100%;">
|
759 |
<option value='Tudou' <?php if($instance['RV_source2'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option>
|
760 |
<option value='Youku' <?php if($instance['RV_source2'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option>
|
761 |
<option value='cn6' <?php if($instance['RV_source2'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option>
|
762 |
+
<option value='Google' <?php if($instance['RV_source2'] == 'Google'){echo 'selected="selected"';}?> >Google Video</option>
|
763 |
</select>
|
764 |
</p>
|
765 |
|
767 |
<label for="<?php echo $this->get_field_id('RV_id2'); ?>">Video 2 ID: </label>
|
768 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_id2'); ?>" name="<?php echo $this->get_field_name('RV_id2'); ?>" type="text" value="<?php echo $instance['RV_id2']; ?>" /></p>
|
769 |
|
770 |
+
<p>
|
771 |
+
<label for="<?php echo $this->get_field_id('RV_cap2'); ?>">Video Caption: </label>
|
772 |
+
<input class="widefat" id="<?php echo $this->get_field_id('RV_cap2'); ?>" name="<?php echo $this->get_field_name('RV_cap2'); ?>" type="text" value="<?php echo $instance['RV_cap2']; ?>" /></p>
|
773 |
+
|
774 |
+
</div>
|
775 |
+
<div style="width:220px;height:350px;float:left;margin:0px 15px 20px 0px">
|
776 |
|
777 |
<!--third video setting -->
|
778 |
+
<h2>Video 3</h2>
|
779 |
+
<?php
|
780 |
+
//show video in Random Video Widget Admin
|
781 |
+
$autoplaysetting = '0';
|
782 |
+
$videoid = $instance['RV_id3'];
|
783 |
+
$videosource = $instance['RV_source3'];
|
784 |
+
$videowidth = null;
|
785 |
+
$videoheight = null;
|
786 |
+
//$admin = true // to show video in admin
|
787 |
+
|
788 |
+
ShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true');
|
789 |
+
?>
|
790 |
<p>
|
791 |
<label for="<?php echo $this->get_field_id( 'RV_source3' ); ?>">Select Video 3 Source:</label>
|
792 |
<select id="<?php echo $this->get_field_id( 'RV_source3' );?>" name="<?php echo $this->get_field_name( 'RV_source3' );?>" class="widefat" style="width:100%;">
|
803 |
<option value='Tudou' <?php if($instance['RV_source3'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option>
|
804 |
<option value='Youku' <?php if($instance['RV_source3'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option>
|
805 |
<option value='cn6' <?php if($instance['RV_source3'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option>
|
806 |
+
<option value='Google' <?php if($instance['RV_source3'] == 'Google'){echo 'selected="selected"';}?> >Google Video</option>
|
807 |
</select>
|
808 |
</p>
|
809 |
|
811 |
<label for="<?php echo $this->get_field_id('RV_id3'); ?>">Video 3 ID: </label>
|
812 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_id3'); ?>" name="<?php echo $this->get_field_name('RV_id3'); ?>" type="text" value="<?php echo $instance['RV_id3']; ?>" /></p>
|
813 |
|
814 |
+
<p>
|
815 |
+
<label for="<?php echo $this->get_field_id('RV_cap3'); ?>">Video Caption: </label>
|
816 |
+
<input class="widefat" id="<?php echo $this->get_field_id('RV_cap3'); ?>" name="<?php echo $this->get_field_name('RV_cap3'); ?>" type="text" value="<?php echo $instance['RV_cap3']; ?>" /></p>
|
817 |
+
|
818 |
+
|
819 |
+
</div>
|
820 |
+
<div style="width:220px;height:350px;float:left;margin:0px 15px 20px 5px">
|
821 |
|
822 |
<!--fourth video setting -->
|
823 |
+
<h2>Video 4</h2>
|
824 |
+
<?php
|
825 |
+
//show video in Random Video Widget Admin
|
826 |
+
$autoplaysetting = '0';
|
827 |
+
$videoid = $instance['RV_id4'];
|
828 |
+
$videosource = $instance['RV_source4'];
|
829 |
+
$videowidth = null;
|
830 |
+
$videoheight = null;
|
831 |
+
//$admin = true // to show video in admin
|
832 |
+
|
833 |
+
ShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true');
|
834 |
+
?>
|
835 |
<p>
|
836 |
<label for="<?php echo $this->get_field_id( 'RV_source4' ); ?>">Select Video 4 Source:</label>
|
837 |
<select id="<?php echo $this->get_field_id( 'RV_source4' );?>" name="<?php echo $this->get_field_name( 'RV_source4' );?>" class="widefat" style="width:100%;">
|
848 |
<option value='Tudou' <?php if($instance['RV_source4'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option>
|
849 |
<option value='Youku' <?php if($instance['RV_source4'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option>
|
850 |
<option value='cn6' <?php if($instance['RV_source4'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option>
|
851 |
+
<option value='Google' <?php if($instance['RV_source4'] == 'Google'){echo 'selected="selected"';}?> >Google Video</option>
|
852 |
</select>
|
853 |
</p>
|
854 |
|
856 |
<label for="<?php echo $this->get_field_id('RV_id4'); ?>">Video 4 ID: </label>
|
857 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_id4'); ?>" name="<?php echo $this->get_field_name('RV_id4'); ?>" type="text" value="<?php echo $instance['RV_id4']; ?>" /></p>
|
858 |
|
859 |
+
<p>
|
860 |
+
<label for="<?php echo $this->get_field_id('RV_cap4'); ?>">Video Caption: </label>
|
861 |
+
<input class="widefat" id="<?php echo $this->get_field_id('RV_cap4'); ?>" name="<?php echo $this->get_field_name('RV_cap4'); ?>" type="text" value="<?php echo $instance['RV_cap4']; ?>" /></p>
|
862 |
+
|
863 |
+
</div>
|
864 |
+
<div style="width:220px;height:350px;float:left;margin:0px 15px 20px 0px">
|
865 |
|
866 |
<!--fifth video setting -->
|
867 |
+
<h2>Video 5</h2>
|
868 |
+
<?php
|
869 |
+
//show video in Random Video Widget Admin
|
870 |
+
$autoplaysetting = '0';
|
871 |
+
$videoid = $instance['RV_id5'];
|
872 |
+
$videosource = $instance['RV_source5'];
|
873 |
+
$videowidth = null;
|
874 |
+
$videoheight = null;
|
875 |
+
//$admin = true // to show video in admin
|
876 |
+
|
877 |
+
ShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true');
|
878 |
+
?>
|
879 |
<p>
|
880 |
<label for="<?php echo $this->get_field_id( 'RV_source5' ); ?>">Select Video 5 Source:</label>
|
881 |
<select id="<?php echo $this->get_field_id( 'RV_source5' );?>" name="<?php echo $this->get_field_name( 'RV_source5' );?>" class="widefat" style="width:100%;">
|
892 |
<option value='Tudou' <?php if($instance['RV_source5'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option>
|
893 |
<option value='Youku' <?php if($instance['RV_source5'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option>
|
894 |
<option value='cn6' <?php if($instance['RV_source5'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option>
|
895 |
+
<option value='Google' <?php if($instance['RV_source5'] == 'Google'){echo 'selected="selected"';}?> >Google Video</option>
|
896 |
</select>
|
897 |
</p>
|
898 |
|
900 |
<label for="<?php echo $this->get_field_id('RV_id5'); ?>">Video 5 ID: </label>
|
901 |
<input class="widefat" id="<?php echo $this->get_field_id('RV_id5'); ?>" name="<?php echo $this->get_field_name('RV_id5'); ?>" type="text" value="<?php echo $instance['RV_id5']; ?>" /></p>
|
902 |
|
|
|
|
|
903 |
<p>
|
904 |
+
<label for="<?php echo $this->get_field_id('RV_cap5'); ?>">Video Caption: </label>
|
905 |
+
<input class="widefat" id="<?php echo $this->get_field_id('RV_cap5'); ?>" name="<?php echo $this->get_field_name('RV_cap5'); ?>" type="text" value="<?php echo $instance['RV_cap5']; ?>" /></p>
|
906 |
+
|
907 |
+
</div>
|
908 |
+
<p style="clear:both"></p>
|
909 |
+
|
910 |
|
911 |
<?php
|
912 |
|