diff --git a/wp-content/plugins/video-sidebar-widgets/editor_plugin.js b/wp-content/plugins/video-sidebar-widgets/editor_plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..f1922f5c876024255333916d9189ee29edfd29a1 --- /dev/null +++ b/wp-content/plugins/video-sidebar-widgets/editor_plugin.js @@ -0,0 +1,48 @@ +(function() { + tinymce.create('tinymce.plugins.VSW_Shortcode_Plugin', { + + init : function(ed, url) { + ed.addCommand('mceVSW', function() { + ed.windowManager.open({ + file : url + '/vsw_dialog.htm', + width : 550 + parseInt(ed.getLang('vsw.delta_width', 0)), + height : 230 + parseInt(ed.getLang('vsw.delta_height', 0)), + inline : 1 + }, { + plugin_url : url, // Plugin absolute URL + some_custom_arg : 'custom arg' // Custom argument + }); + }); + + + ed.addButton('vsw', { + title : 'insert video shortcode', + cmd : 'mceVSW', + image : url + '/vsw.gif' + }); + + + ed.onNodeChange.add(function(ed, cm, n) { + cm.setActive('vsw', n.nodeName == 'Video'); + }); + }, + + createControl : function(n, cm) { + return null; + }, + + + getInfo : function() { + return { + longname : 'Video Sidebar Widgets Shortcode Plugin', + author : 'Denzel', + authorurl : 'http://denzeldesigns.com', + infourl : 'http://denzeldesigns.com', + version : "1.0" + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('vsw', tinymce.plugins.VSW_Shortcode_Plugin); +})(); \ No newline at end of file diff --git a/wp-content/plugins/video-sidebar-widgets/readme.txt b/wp-content/plugins/video-sidebar-widgets/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6e02060cade225bf859c34d401371ba2a31368d --- /dev/null +++ b/wp-content/plugins/video-sidebar-widgets/readme.txt @@ -0,0 +1,101 @@ +=== Video Sidebar Widgets === +Contributors: denzel_chia +Donate link: http://denzeldesigns.com/wordpress-plugins/video-sidebar-widgets/ +Author link: http://denzeldesigns.com +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, google videos, tangle +Requires at least:2.8.1 +Tested up to: 3.0 +Stable tag:3.0 + +== Description == + +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 15 video sharing networks. Including, Youtube, Vimeo, Veoh, Blip.tv etc.. +Now including Random Video Sidebar Widget to randomly display 1 out of 5 preset video. + +== Changelog == + += 2.0 = + +*Included Random Video Sidebar Widget to randomly display 1 out of 5 preset video. + + += 2.1 = + +*re-arranged Random Video Sidebar Widget Layout + +*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. + +*Included support for google videos + +*Included Video Caption at bottom of Video + +*Video Caption has a style class of "VideoCaption" to enable user to indicate font-height etc. + += 2.2 = + +*Included support for Tangle.com videos + += 2.3 = + +*Removed auto play video option for Blip.tv video, which is causing the video not to load in Internet Explorer. +*Allowed HTML links in video caption + += 3.0 = + +*added video quicktag at post editor to insert video shortcode into post or page. +*Shortcode to allow posting of video on post or page, using video function already available in plugin. + + +== Installation == + += Install Plugin Using Search = + + 1. Search for Video Sidebar widgets in Add New Plugins + 2. Click 'Install Now' in search results row + 3. Click 'OK' to accept plugin installation + 4. Once installed, click Activate Plugin link + += or, install Plugin in .ZIP Format = + + 1. Visit Plugins > Add New > Upload in WordPress admin + 2. Upload video-sidebar-widget.zip file + 3. Once uploaded, click Activate Plugin link + + + +== Can I post video in post or page content other than the sidebar? == + +As of version 3.0, shortcode is added to enable user to post video in content. +User can use the video Quicktag at Tinymce editor to insert video shortcode. + +== How to use Video Sidebar Widget ? == + +Please visit plugin site for details. + + +== How to use Random Video Sidebar Widget ? == + +Please visit plugin site for details. + + +== Frequently Asked Questions == + +1. Why is Video Sidebar Widget not compatible with WordPress 2.8 ? + +It is not compatible because a bug was found to cause settings of multiple instance of a widget to disappear or mixed up. +The bug was fixed in WordPress 2.8.1 + +2. Why is my Random Video sidebar Widget not working? + +Reload the webpage where you use the widget, each time you reload, the widget will randomly pick 1 of the 5 video you set for display. there are chances that it displays the same video after you reload. Just try reloading again. + +Random Video Sidebar Widget will not work on blogs that uses cache plugins. It is because the cache plugin will deliver the generated static page instead of regenerating blog page or post through server script. However, it may work if your theme has a page template with a different sidebar. You can then set your cache plugin not to cache that particular page or post, if there is such option available in that cache plugin. + + +== Screenshots == + +Please visit plugin site for video samples + + + + diff --git a/wp-content/plugins/video-sidebar-widgets/source_image/source.png b/wp-content/plugins/video-sidebar-widgets/source_image/source.png new file mode 100644 index 0000000000000000000000000000000000000000..3bfc342992224768228b5f4404d665815575e9fd Binary files /dev/null and b/wp-content/plugins/video-sidebar-widgets/source_image/source.png differ diff --git a/wp-content/plugins/video-sidebar-widgets/video-sidebar-widgets.php b/wp-content/plugins/video-sidebar-widgets/video-sidebar-widgets.php new file mode 100644 index 0000000000000000000000000000000000000000..dabead6911feb97fdba264e5ae85321b36d8a068 --- /dev/null +++ b/wp-content/plugins/video-sidebar-widgets/video-sidebar-widgets.php @@ -0,0 +1,1132 @@ +<?php +/* +Plugin Name: Video Sidebar Widgets +Plugin URI: http://denzeldesigns.com/wordpress-plugins/video-sidebar-widgets/ +Version: 3.0 +Description: Video Sidebar Widgets to display videos such as Vimeo, YouTube, MySpace Videos etc. Now with added shortcode and quicktag to embed video in post and page content. +Author: Denzel Chia +Author URI: http://denzeldesigns.com/ +*/ + + +//action to initiate widgets +add_action('widgets_init', 'load_video_sidebar_widgets'); + + +//function to register Video Sidebar Widget and Random Video Sidebar Widget +function load_video_sidebar_widgets() { +register_widget('VideoSidebarWidget'); +register_widget('RandomVideoSidebarWidget'); +} + + +//Video Sidebar Widget Class to extend WP_Widget class +class VideoSidebarWidget extends WP_Widget { + + //function to set up widget in admin + function VideoSidebarWidget() { + + $widget_ops = array( 'classname' => 'videosidebar', + 'description' => __('A Video Widget to display video in sidebar from various video sharing networks', 'videosidebar') ); + + $control_ops = array( 'width' => 200, 'height' => 350, 'id_base' => 'videosidebar' ); + $this->WP_Widget( 'videosidebar', __('Video Sidebar Widget', 'videosidebar'), $widget_ops, $control_ops ); + + } + + + //function to echo out widget on sidebar + function widget( $args, $instance ) { + extract( $args ); + + $title2 = apply_filters('widget_title2', $instance['title2'] ); + $cap2 = $instance['v_cap2']; + + echo $before_widget; + + // if user written title echo out + if ( $title2 ){ + echo $before_title . $title2 . $after_title; + } + + //get settings from Widget Admin Form to assign to function VSWShowVideo + $autoplaysetting = $instance['v_autoplay2']; + $videoid = $instance['v_id2']; + $videosource = $instance['v_source']; + $videowidth = $instance['v_width2']; + $videoheight = $instance['v_height2']; + + //function to show video in blog sidebar, please look for it below + VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'false','false'); + + if($cap2){ + echo "<p class=\"VideoCaption\">$cap2</p>"; + } + + echo $after_widget; + + }//end of function widget + + + + //function to update widget setting + function update( $new_instance, $old_instance ) { + + $instance = $old_instance; + $instance['title2'] = strip_tags( $new_instance['title2'] ); + $instance['v_width2'] = strip_tags( $new_instance['v_width2'] ); + $instance['v_height2'] = strip_tags( $new_instance['v_height2'] ); + $instance['v_autoplay2'] = strip_tags( $new_instance['v_autoplay2'] ); + $instance['v_id2'] = strip_tags( $new_instance['v_id2'] ); + $instance['v_source'] = strip_tags( $new_instance['v_source'] ); + $instance['v_cap2'] = $new_instance['v_cap2']; + return $instance; + + }//end of function update + + + //function to create Widget Admin form + function form($instance) { + + $instance = wp_parse_args( (array) $instance, array( 'title2' => '', 'v_width2' => '', 'v_height2' => '', + 'v_autoplay2' => '','v_id2' => '','v_source' => '','v_cap2' => '') ); + + $instance['title2'] = strip_tags( $instance['title2'] ); + $instance['v_width2'] = strip_tags( $instance['v_width2'] ); + $instance['v_height2'] = strip_tags( $instance['v_height2'] ); + $instance['v_autoplay2'] = strip_tags( $instance['v_autoplay2'] ); + $instance['v_id2'] = strip_tags( $instance['v_id2'] ); + $instance['v_source'] = strip_tags( $instance['v_source'] ); + $instance['v_cap2'] = $instance['v_cap2']; + + //function to show video in widget admin form fixed width and height, please look for it below + $autoplaysetting = '0'; + $videoid = $instance['v_id2']; + $videosource = $instance['v_source']; + $videowidth = null; + $videoheight = null; + //$admin = true // to show video in admin + + VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true','false'); + + ?> + + + <p> + <label for="<?php echo $this->get_field_id('title2'); ?>">Widget Title:</label> + <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']; ?>" /> + </p> + + <p> + <label for="<?php echo $this->get_field_id( 'v_source' ); ?>">Select Video Source:</label> + <select id="<?php echo $this->get_field_id( 'v_source' );?>" name="<?php echo $this->get_field_name( 'v_source' );?>" + class="widefat" style="width:100%;"> + <option value='YouTube' <?php if($instance['v_source'] == 'YouTube'){echo 'selected="selected"';}?> >YouTube Video</option> + <option value='Vimeo' <?php if($instance['v_source'] == 'Vimeo'){echo 'selected="selected"';}?> >Vimeo Video</option> + <option value='MySpace' <?php if($instance['v_source'] == 'MySpace'){echo 'selected="selected"';}?> >MySpace Video</option> + <option value='Veoh' <?php if($instance['v_source'] == 'Veoh'){echo 'selected="selected"';}?> >Veoh Video</option> + <option value='Blip' <?php if($instance['v_source'] == 'Blip'){echo 'selected="selected"';}?> >blip.tv Video</option> + <option value='WordPress' <?php if($instance['v_source'] == 'WordPress'){echo 'selected="selected"';}?> >WordPress Video + </option> + <option value='Viddler' <?php if($instance['v_source'] == 'Viddler'){echo 'selected="selected"';}?> >Viddler Video</option> + <option value='DailyMotion' <?php if($instance['v_source'] == 'DailyMotion'){echo 'selected="selected"';}?> >DailyMotion Video </option> + <option value='Revver' <?php if($instance['v_source'] == 'Revver'){echo 'selected="selected"';}?> >Revver Video</option> + <option value='Metacafe' <?php if($instance['v_source'] == 'Metacafe'){echo 'selected="selected"';}?> >Metacafe Video</option> + <option value='Tudou' <?php if($instance['v_source'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option> + <option value='Youku' <?php if($instance['v_source'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option> + <option value='cn6' <?php if($instance['v_source'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option> + <option value='Google' <?php if($instance['v_source'] == 'Google'){echo 'selected="selected"';}?> >Google Video</option> + <option value='Tangle' <?php if($instance['v_source'] == 'Tangle'){echo 'selected="selected"';}?> >Tangle Video</option> + </select> + </p> + + <p> + <label for="<?php echo $this->get_field_id('v_id2'); ?>">Video ID: </label> + <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> + + <p> + <label for="<?php echo $this->get_field_id('v_width2'); ?>">Video Width: </label> + <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']; ?>" /> + </p> + + <p> + <label for="<?php echo $this->get_field_id('v_height2'); ?>">Video Height: </label> + <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']; ?>" /> + </p> + + <p> + <label for="<?php echo $this->get_field_id('v_cap2'); ?>">Video Caption: </label> + <input class="widefat" id="<?php echo $this->get_field_id('v_cap2'); ?>" + name="<?php echo $this->get_field_name('v_cap2'); ?>" type="text" value="<?php echo $instance['v_cap2']; ?>" /> + </p> + + + <p> + + <?php + + // check whether autoplay feature supported by video network + $source = $instance['v_source']; + $msg = "<p>Sorry, auto play option not supported by ".$source."</p>"; + switch ($source) { + + case WordPress: + echo $msg; + break; + + case Tudou: + echo $msg; + break; + + case Youku: + echo $msg; + break; + + case Blip: + echo "<p>Sorry, auto play option removed as it is causing error in Internet Explorer</p>"; + break; + + case cn6: + echo "<p>Sorry, auto play option not supported by 6.cn</p>"; + break; + } + + ?> + + <label for="<?php echo $this->get_field_id( 'v_autoplay2' ); ?>">Auto Play:</label> + <select id="<?php echo $this->get_field_id( 'v_autoplay2' );?>" + name="<?php echo $this->get_field_name( 'v_autoplay2' );?>" class="widefat" style="width:100%;">'; + <option value='1' <?php if($instance['v_autoplay2'] == '1'){echo 'selected="selected"';}?>>Yes</option> + <option value='0' <?php if($instance['v_autoplay2'] == '0'){echo 'selected="selected"';}?>>No</option> + </select> + </p> + + <?php + + }//end of function form($instance) + +}//end of Video Sidebar Widget Class + + + +function VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,$admin,$shortcode){ + +//admin = true to show in widget admin +//admin = false to show in blog sidebar + + $v_autoplay2 = $autoplaysetting; + $v_id2 = $videoid; + $v_source = $videosource; + $v_width2 = $videowidth; + $v_height2 = $videoheight; + + $source = $v_source; + + //test for source and assign codes accordingly + switch ($source) { + + case null: + $value = null; + $flashvar = null; + $flashvar2 = null; + break; + + case YouTube: + $value = "http://www.youtube.com/v/$v_id2&autoplay=$v_autoplay2&loop=0&rel=0"; + $flashvar = null; + $flashvar2 = null; + break; + + case Vimeo: + $value = "http://vimeo.com/moogaloop.swf?clip_id=$v_id2&server=vimeo.com&loop=0&fullscreen=1&autoplay=$v_autoplay2"; + $flashvar = null; + $flashvar2 = null; + break; + + case MySpace: + $value = "http://mediaservices.myspace.com/services/media/embed.aspx/m=$v_id2,t=1,mt=video,ap=$v_autoplay2"; + $flashvar = null; + $flashvar2 = null; + break; + + case Veoh: + $value = "http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.4.2.20.1002&"; + $value.= "permalinkId=$v_id2&player=videodetailsembedded&id=anonymous&videoAutoPlay=$v_autoplay2"; + $flashvar = null; + $flashvar2 = null; + break; + + case Blip: + $value = "http://blip.tv/play/$v_id2"; + $flashvar = null; + $flashvar2 = null; + break; + + case WordPress: + $value = "http://v.wordpress.com/$v_id2"; + $flashvar = null; + $flashvar2 = null; + break; + + case Viddler: + $value = "http://www.viddler.com/player/$v_id2"; + if($v_autoplay2=='1'){ + $flashvar = "<param name=\"flashvars\" value=\"autoplay=t\" />\n"; + $flashvar2 = 'flashvars="autoplay=t" '; + } + break; + + case DailyMotion: + $value = "http://www.dailymotion.com/swf/$v_id2&autoStart=$v_autoplay2&related=0"; + $flashvar = null; + $flashvar2 = null; + break; + + + case Revver: + $value = "http://flash.revver.com/player/1.0/player.swf?mediaId=$v_id2&autoStart=$v_autoplay2"; + $flashvar = null; + $flashvar2 = null; + break; + + case Metacafe: + $id = split('/',$v_id2); + $value = "http://www.metacafe.com/fplayer/$id[0]/$id[1].swf"; + if($v_autoplay2=='1'){ + $flashvar = null; + $flashvar2 = 'flashVars="playerVars=showStats=no|autoPlay=yes|"'; + } + break; + + case Tudou: + $value = "$v_id2"; + $flashvar = null; + $flashvar2 = null; + break; + + case Youku: + $value = "$v_id2"; + $flashvar = null; + $flashvar2 = null; + break; + + case cn6: + $value = "$v_id2"; + $flashvar = null; + $flashvar2 = null; + break; + + case Google: + $value = "http://video.google.com/googleplayer.swf?docid=$v_id2&hl=en&fs=true"; + if($v_autoplay2=='1'){ + $flashvar = null; + $flashvar2 = 'FlashVars="autoPlay=true&playerMode=embedded"'; + } + break; + + case Tangle: + $value = "http://www.tangle.com/flash/swf/flvplayer.swf"; + if($v_autoplay2=='1'){ + $flashvar = null; + $flashvar2 = "FlashVars=\"viewkey=$v_id2&autoplay=$v_autoplay2\""; + }else{ + $flashvar = null; + $flashvar2 = "FlashVars=\"viewkey=$v_id2\""; + } + break; + + } + + if($shortcode=="true"){ + //added in version 2.3 + //return instead of echo video on blog using shortcode + $vsw_code = "\n<object width=\"$v_width2\" height=\"$v_height2\">\n"; + $vsw_code .= $flashvar; + $vsw_code .= "<param name=\"allowfullscreen\" value=\"true\" />\n"; + $vsw_code .= "<param name=\"allowscriptaccess\" value=\"always\" />\n"; + $vsw_code .= "<param name=\"movie\" value=\"$value\" />\n"; + $vsw_code .= "<param name=\"wmode\" value=\"transparent\">\n"; + $vsw_code .= "<embed src=\"$value\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" "; + $vsw_code .= "allowfullscreen=\"true\" allowscriptaccess=\"always\" "; + $vsw_code .= $flashvar2; + $vsw_code .= "width=\"$v_width2\" height=\"$v_height2\">\n"; + $vsw_code .= "</embed>\n"; + $vsw_code .= "</object>\n\n"; + return $vsw_code; + } + elseif($admin=="true"){ + // echo video in admin + echo "\n<object width=\"212\" height=\"172\">\n"; + echo $flashvar; + echo "<param name=\"allowfullscreen\" value=\"true\" />\n"; + echo "<param name=\"allowscriptaccess\" value=\"always\" />\n"; + echo "<param name=\"movie\" value=\"$value\" />\n"; + echo "<param name=\"wmode\" value=\"transparent\">\n"; + echo "<embed src=\"$value\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" "; + echo "allowfullscreen=\"true\" allowscriptaccess=\"always\" "; + echo $flashvar2; + echo "width=\"212\" height=\"172\">\n"; + echo "</embed>\n"; + echo "</object>\n\n"; + + }else{ + + // echo video on blog + echo "\n<object width=\"$v_width2\" height=\"$v_height2\">\n"; + echo $flashvar; + echo "<param name=\"allowfullscreen\" value=\"true\" />\n"; + echo "<param name=\"allowscriptaccess\" value=\"always\" />\n"; + echo "<param name=\"movie\" value=\"$value\" />\n"; + echo "<param name=\"wmode\" value=\"transparent\">\n"; + echo "<embed src=\"$value\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" "; + echo "allowfullscreen=\"true\" allowscriptaccess=\"always\" "; + echo $flashvar2; + echo "width=\"$v_width2\" height=\"$v_height2\">\n"; + echo "</embed>\n"; + echo "</object>\n\n"; + } + + +}//end of function VSWShowVideo + + + + + + + + + + + +//Random video widget starts here + + +class RandomVideoSidebarWidget extends WP_Widget { + +function RandomVideoSidebarWidget() { +$widget_ops = array( 'classname' => 'randomvideosidebar', 'description' => __('A Random Video Widget. Randomly selects 1 of the 5 preset videos for display', 'randomvideosidebar') ); +$control_ops = array( 'width' => 705, 'height' => 600, 'id_base' => 'randomvideosidebar' ); +$this->WP_Widget( 'randomvideosidebar', __('Random Video Sidebar Widget', 'randomvideosidebar'), $widget_ops, $control_ops ); +} + + +function widget( $args, $instance ) { +extract( $args ); + + $RV_title = apply_filters('widget_title', $instance['RV_title'] ); + $RV_width = $instance['RV_width']; + $RV_height = $instance['RV_height']; + $RV_autoplay = $instance['RV_autoplay']; + $RV_id1 = $instance['RV_id1']; + $RV_source1 = $instance['RV_source1']; + $RV_cap1 = $instance['RV_cap1']; + $RV_id2 = $instance['RV_id2']; + $RV_source2 = $instance['RV_source2']; + $RV_cap2 = $instance['RV_cap2']; + $RV_id3 = $instance['RV_id3']; + $RV_source3 = $instance['RV_source3']; + $RV_cap3 = $instance['RV_cap3']; + $RV_id4 = $instance['RV_id4']; + $RV_source4 = $instance['RV_source4']; + $RV_cap4 = $instance['RV_cap4']; + $RV_id5 = $instance['RV_id5']; + $RV_source5 = $instance['RV_source5']; + $RV_cap5 = $instance['RV_cap5']; + + echo $before_widget; + + if ( $RV_title ) + echo $before_title . $RV_title . $after_title; + + //using rand() to select which video to show + + $selection = rand(1,5); + + switch($selection){ + + case 1: + $Embed_id = $RV_id1; + $Embed_source = $RV_source1; + $Embed_cap = $RV_cap1; + break; + + case 2: + $Embed_id = $RV_id2; + $Embed_source = $RV_source2; + $Embed_cap = $RV_cap2; + break; + + case 3: + $Embed_id = $RV_id3; + $Embed_source = $RV_source3; + $Embed_cap = $RV_cap3; + break; + + case 4: + $Embed_id = $RV_id4; + $Embed_source = $RV_source4; + $Embed_cap = $RV_cap4; + break; + + case 5: + $Embed_id = $RV_id5; + $Embed_source = $RV_source5; + $Embed_cap = $RV_cap5; + break; + + } + + //test for empty $Embed_id and empty $Embed_source. if empty, + //assign to same as first video id and source + + If(empty($Embed_id)){ + $Embed_id = $RV_id1; + $Embed_source = $RV_source1; + $Embed_cap = $RV_cap1; + } + + $select_source = $Embed_source; + + switch ($select_source) { + + case null: + $rv_value = null; + $rv_flashvar = null; + $rv_flashvar2 = null; + $rv_cap = null; + break; + + case YouTube: + $rv_value = "http://www.youtube.com/v/$Embed_id&autoplay=$RV_autoplay&loop=0&rel=0"; + $rv_flashvar = null; + $rv_flashvar2 = null; + $rv_cap = $Embed_cap; + break; + + case Vimeo: + $rv_value = "http://vimeo.com/moogaloop.swf?clip_id=$Embed_id&server=vimeo.com&loop=0&fullscreen=1&autoplay=$RV_autoplay"; + $rv_flashvar = null; + $rv_flashvar2 = null; + $rv_cap = $Embed_cap; + break; + + case MySpace: + $rv_value = "http://mediaservices.myspace.com/services/media/embed.aspx/m=$Embed_id,t=1,mt=video,ap=$RV_autoplay"; + $rv_flashvar = null; + $rv_flashvar2 = null; + $rv_cap = $Embed_cap; + break; + + case Veoh: + $rv_value = "http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.4.2.20.1002&permalinkId=$Embed_id"; + $rv_value.= "&player=videodetailsembedded&id=anonymous&videoAutoPlay=$RV_autoplay"; + $rv_flashvar = null; + $rv_flashvar2 = null; + $rv_cap = $Embed_cap; + break; + + case Blip: + $rv_value = "http://blip.tv/play/$Embed_id"; + $rv_flashvar = null; + $rv_flashvar2 = null; + $rv_cap = $Embed_cap; + break; + + case WordPress: + $rv_value = "http://v.wordpress.com/$Embed_id"; + $rv_flashvar = null; + $rv_flashvar2 = null; + $rv_cap = $Embed_cap; + break; + + case Viddler: + $rv_value = "http://www.viddler.com/player/$Embed_id"; + if($RV_autoplay=='1'){ + $rv_flashvar = "<param name=\"flashvars\" value=\"autoplay=t\" />\n"; + $rv_flashvar2 = 'flashvars="autoplay=t" '; + } + $rv_cap = $Embed_cap; + break; + + case DailyMotion: + $rv_value = "http://www.dailymotion.com/swf/$Embed_id&autoStart=$RV_autoplay&related=0"; + $rv_flashvar = null; + $rv_flashvar2 = null; + $rv_cap = $Embed_cap; + break; + + + case Revver: + $rv_value = "http://flash.revver.com/player/1.0/player.swf?mediaId=$Embed_id&autoStart=$RV_autoplay"; + $rv_flashvar = null; + $rv_flashvar2 = null; + $rv_cap = $Embed_cap; + break; + + case Metacafe: + $rid = split('/',$Embed_id); + $rv_value = "http://www.metacafe.com/fplayer/$rid[0]/$rid[1].swf"; + if($RV_autoplay=='1'){ + $rv_flashvar = null; + $rv_flashvar2 = 'flashVars="playerVars=showStats=no|autoPlay=yes|"'; + } + $rv_cap = $Embed_cap; + break; + + case Tudou: + $rv_value = "$Embed_id"; + $rv_flashvar = null; + $rv_flashvar2 = null; + $rv_cap = $Embed_cap; + break; + + case Youku: + $rv_value = "$Embed_id"; + $rv_flashvar = null; + $rv_flashvar2 = null; + $rv_cap = $Embed_cap; + break; + + case cn6: + $rv_value = "$Embed_id"; + $rv_flashvar = null; + $rv_flashvar2 = null; + $rv_cap = $Embed_cap; + break; + + case Google: + $rv_value = "http://video.google.com/googleplayer.swf?docid=$Embed_id&hl=en&fs=true"; + if($RV_autoplay=='1'){ + $rv_flashvar = null; + $rv_flashvar2 = 'FlashVars="autoPlay=true&playerMode=embedded"'; + } + $rv_cap = $Embed_cap; + break; + + case Tangle: + $rv_value = "http://www.tangle.com/flash/swf/flvplayer.swf"; + if($RV_autoplay=='1'){ + $rv_flashvar = null; + $rv_flashvar2 = "FlashVars=\"viewkey=$Embed_id&autoplay=$RV_autoplay\""; + }else{ + $rv_flashvar = null; + $rv_flashvar2 = "FlashVars=\"viewkey=$Embed_id\""; + } + $rv_cap = $Embed_cap; + break; + + + + } + + + + echo "\n<object width=\"$RV_width\" height=\"$RV_height\">\n"; + echo $rv_flashvar; + echo "<param name=\"allowfullscreen\" value=\"true\" />\n"; + echo "<param name=\"allowscriptaccess\" value=\"always\" />\n"; + echo "<param name=\"movie\" value=\"$rv_value\" />\n"; + echo "<param name=\"wmode\" value=\"transparent\">\n"; + echo "<embed src=\"$rv_value\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" "; + echo "allowfullscreen=\"true\" allowscriptaccess=\"always\" "; + echo $rv_flashvar2; + echo "width=\"$RV_width\" height=\"$RV_height\">\n"; + echo "</embed>\n"; + echo "</object>\n\n"; + echo "<p class=\"VideoCaption\">$rv_cap</p>"; + + + echo $after_widget; + } + + +function update( $new_instance, $old_instance ) { + $instance = $old_instance; + $instance['RV_title'] = strip_tags( $new_instance['RV_title'] ); + $instance['RV_width'] = strip_tags( $new_instance['RV_width'] ); + $instance['RV_height'] = strip_tags( $new_instance['RV_height'] ); + $instance['RV_autoplay'] = strip_tags( $new_instance['RV_autoplay'] ); + $instance['RV_id1'] = strip_tags( $new_instance['RV_id1'] ); + $instance['RV_source1'] = strip_tags( $new_instance['RV_source1'] ); + $instance['RV_cap1'] = $new_instance['RV_cap1']; + $instance['RV_id2'] = strip_tags( $new_instance['RV_id2'] ); + $instance['RV_source2'] = strip_tags( $new_instance['RV_source2'] ); + $instance['RV_cap2'] = $new_instance['RV_cap2']; + $instance['RV_id3'] = strip_tags( $new_instance['RV_id3'] ); + $instance['RV_source3'] = strip_tags( $new_instance['RV_source3'] ); + $instance['RV_cap3'] = $new_instance['RV_cap3']; + $instance['RV_id4'] = strip_tags( $new_instance['RV_id4'] ); + $instance['RV_source4'] = strip_tags( $new_instance['RV_source4'] ); + $instance['RV_cap4'] = $new_instance['RV_cap4']; + $instance['RV_id5'] = strip_tags( $new_instance['RV_id5'] ); + $instance['RV_source5'] = strip_tags( $new_instance['RV_source5'] ); + $instance['RV_cap5'] = $new_instance['RV_cap5']; + return $instance; +} + + +function form($instance) { +$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' => '') ); + + $instance['RV_title'] = strip_tags( $instance['RV_title'] ); + $instance['RV_width'] = strip_tags( $instance['RV_width'] ); + $instance['RV_height'] = strip_tags( $instance['RV_height'] ); + $instance['RV_autoplay'] = strip_tags( $instance['RV_autoplay'] ); + $instance['RV_id1'] = strip_tags( $instance['RV_id1'] ); + $instance['RV_source1'] = strip_tags( $instance['RV_source1'] ); + $instance['RV_cap1'] = $instance['RV_cap1']; + $instance['RV_id2'] = strip_tags( $instance['RV_id2'] ); + $instance['RV_source2'] = strip_tags( $instance['RV_source2'] ); + $instance['RV_cap2'] = $instance['RV_cap2']; + $instance['RV_id3'] = strip_tags( $instance['RV_id3'] ); + $instance['RV_source3'] = strip_tags( $instance['RV_source3'] ); + $instance['RV_cap3'] = $instance['RV_cap3']; + $instance['RV_id4'] = strip_tags( $instance['RV_id4'] ); + $instance['RV_source4'] = strip_tags( $instance['RV_source4'] ); + $instance['RV_cap4'] = $instance['RV_cap4']; + $instance['RV_id5'] = strip_tags( $instance['RV_id5'] ); + $instance['RV_source5'] = strip_tags( $instance['RV_source5'] ); + $instance['RV_cap5'] = $instance['RV_cap5']; + + +?> +<div style="width:220px;height:350px;float:left;margin:0px 15px 20px 5px"> +<h2>General Settings</h2> +<!--Title --> +<p> +<label for="<?php echo $this->get_field_id('RV_title'); ?>">Widget Title:</label> +<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']; ?>" /> +</p> + +<!--Width --> +<p> +<label for="<?php echo $this->get_field_id('RV_width'); ?>">Video Width: </label> +<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']; ?>" /> +</p> + +<!--Height --> +<p> +<label for="<?php echo $this->get_field_id('RV_height'); ?>">Video Height: </label> +<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']; ?>" /> +</p> + +<!--auto play --> +<p> +<label for="<?php echo $this->get_field_id( 'RV_autoplay' ); ?>">Auto Play:</label> +<select id="<?php echo $this->get_field_id( 'RV_autoplay' );?>" name="<?php echo $this->get_field_name( 'RV_autoplay' );?>" class="widefat" style="width:100%;">'; +<option value='1' <?php if($instance['RV_autoplay'] == '1'){echo 'selected="selected"';}?>>Yes</option> +<option value='0' <?php if($instance['RV_autoplay'] == '0'){echo 'selected="selected"';}?>>No</option> +</select> +</p> +<p>Please fill up settings before clicking on save to display video.</p> +</div> + +<div style="width:220px;height:350px;float:left;margin:0px 15px 20px 0px"> +<!--first video setting --> +<h2>Video 1</h2> +<?php +//show video in Random Video Widget Admin + $autoplaysetting = '0'; + $videoid = $instance['RV_id1']; + $videosource = $instance['RV_source1']; + $videowidth = null; + $videoheight = null; + //$admin = true // to show video in admin + + VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true','false'); +?> +<p> +<label for="<?php echo $this->get_field_id( 'RV_source1' ); ?>">Select Video 1 Source:</label> +<select id="<?php echo $this->get_field_id( 'RV_source1' );?>" name="<?php echo $this->get_field_name( 'RV_source1' );?>" class="widefat" style="width:100%;"> +<option value='YouTube' <?php if($instance['RV_source1'] == 'YouTube'){echo 'selected="selected"';}?> >YouTube Video</option> +<option value='Vimeo' <?php if($instance['RV_source1'] == 'Vimeo'){echo 'selected="selected"';}?> >Vimeo Video</option> +<option value='MySpace' <?php if($instance['RV_source1'] == 'MySpace'){echo 'selected="selected"';}?> >MySpace Video</option> +<option value='Veoh' <?php if($instance['RV_source1'] == 'Veoh'){echo 'selected="selected"';}?> >Veoh Video</option> +<option value='Blip' <?php if($instance['RV_source1'] == 'Blip'){echo 'selected="selected"';}?> >blip.tv Video</option> +<option value='WordPress' <?php if($instance['RV_source1'] == 'WordPress'){echo 'selected="selected"';}?> >WordPress Video</option> +<option value='Viddler' <?php if($instance['RV_source1'] == 'Viddler'){echo 'selected="selected"';}?> >Viddler Video</option> +<option value='DailyMotion' <?php if($instance['RV_source1'] == 'DailyMotion'){echo 'selected="selected"';}?> >DailyMotion Video</option> +<option value='Revver' <?php if($instance['RV_source1'] == 'Revver'){echo 'selected="selected"';}?> >Revver Video</option> +<option value='Metacafe' <?php if($instance['RV_source1'] == 'Metacafe'){echo 'selected="selected"';}?> >Metacafe Video</option> +<option value='Tudou' <?php if($instance['RV_source1'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option> +<option value='Youku' <?php if($instance['RV_source1'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option> +<option value='cn6' <?php if($instance['RV_source1'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option> +<option value='Google' <?php if($instance['RV_source1'] == 'Google'){echo 'selected="selected"';}?> >Google Video</option> +<option value='Tangle' <?php if($instance['RV_source1'] == 'Tangle'){echo 'selected="selected"';}?> >Tangle Video</option> +</select> +</p> + +<p> +<label for="<?php echo $this->get_field_id('RV_id1'); ?>">Video 1 ID: </label> +<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> + +<p> +<label for="<?php echo $this->get_field_id('RV_cap1'); ?>">Video Caption: </label> +<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> + +</div> +<div style="width:220px;height:350px;float:left;margin:0px 15px 20px 0px"> + +<!--second video setting --> +<h2>Video 2</h2> +<?php +//show video in Random Video Widget Admin + $autoplaysetting = '0'; + $videoid = $instance['RV_id2']; + $videosource = $instance['RV_source2']; + $videowidth = null; + $videoheight = null; + //$admin = true // to show video in admin + + VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true','false'); +?> +<p> +<label for="<?php echo $this->get_field_id( 'RV_source2' ); ?>">Select Video 2 Source:</label> +<select id="<?php echo $this->get_field_id( 'RV_source2' );?>" name="<?php echo $this->get_field_name( 'RV_source2' );?>" class="widefat" style="width:100%;"> +<option value='YouTube' <?php if($instance['RV_source2'] == 'YouTube'){echo 'selected="selected"';}?> >YouTube Video</option> +<option value='Vimeo' <?php if($instance['RV_source2'] == 'Vimeo'){echo 'selected="selected"';}?> >Vimeo Video</option> +<option value='MySpace' <?php if($instance['RV_source2'] == 'MySpace'){echo 'selected="selected"';}?> >MySpace Video</option> +<option value='Veoh' <?php if($instance['RV_source2'] == 'Veoh'){echo 'selected="selected"';}?> >Veoh Video</option> +<option value='Blip' <?php if($instance['RV_source2'] == 'Blip'){echo 'selected="selected"';}?> >blip.tv Video</option> +<option value='WordPress' <?php if($instance['RV_source2'] == 'WordPress'){echo 'selected="selected"';}?> >WordPress Video</option> +<option value='Viddler' <?php if($instance['RV_source2'] == 'Viddler'){echo 'selected="selected"';}?> >Viddler Video</option> +<option value='DailyMotion' <?php if($instance['RV_source2'] == 'DailyMotion'){echo 'selected="selected"';}?> >DailyMotion Video</option> +<option value='Revver' <?php if($instance['RV_source2'] == 'Revver'){echo 'selected="selected"';}?> >Revver Video</option> +<option value='Metacafe' <?php if($instance['RV_source2'] == 'Metacafe'){echo 'selected="selected"';}?> >Metacafe Video</option> +<option value='Tudou' <?php if($instance['RV_source2'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option> +<option value='Youku' <?php if($instance['RV_source2'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option> +<option value='cn6' <?php if($instance['RV_source2'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option> +<option value='Google' <?php if($instance['RV_source2'] == 'Google'){echo 'selected="selected"';}?> >Google Video</option> +<option value='Tangle' <?php if($instance['RV_source2'] == 'Tangle'){echo 'selected="selected"';}?> >Tangle Video</option> +</select> +</p> + +<p> +<label for="<?php echo $this->get_field_id('RV_id2'); ?>">Video 2 ID: </label> +<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> + +<p> +<label for="<?php echo $this->get_field_id('RV_cap2'); ?>">Video Caption: </label> +<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> + +</div> +<div style="width:220px;height:350px;float:left;margin:0px 15px 20px 0px"> + +<!--third video setting --> +<h2>Video 3</h2> +<?php +//show video in Random Video Widget Admin + $autoplaysetting = '0'; + $videoid = $instance['RV_id3']; + $videosource = $instance['RV_source3']; + $videowidth = null; + $videoheight = null; + //$admin = true // to show video in admin + + VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true','false'); +?> +<p> +<label for="<?php echo $this->get_field_id( 'RV_source3' ); ?>">Select Video 3 Source:</label> +<select id="<?php echo $this->get_field_id( 'RV_source3' );?>" name="<?php echo $this->get_field_name( 'RV_source3' );?>" class="widefat" style="width:100%;"> +<option value='YouTube' <?php if($instance['RV_source3'] == 'YouTube'){echo 'selected="selected"';}?> >YouTube Video</option> +<option value='Vimeo' <?php if($instance['RV_source3'] == 'Vimeo'){echo 'selected="selected"';}?> >Vimeo Video</option> +<option value='MySpace' <?php if($instance['RV_source3'] == 'MySpace'){echo 'selected="selected"';}?> >MySpace Video</option> +<option value='Veoh' <?php if($instance['RV_source3'] == 'Veoh'){echo 'selected="selected"';}?> >Veoh Video</option> +<option value='Blip' <?php if($instance['RV_source3'] == 'Blip'){echo 'selected="selected"';}?> >blip.tv Video</option> +<option value='WordPress' <?php if($instance['RV_source3'] == 'WordPress'){echo 'selected="selected"';}?> >WordPress Video</option> +<option value='Viddler' <?php if($instance['RV_source3'] == 'Viddler'){echo 'selected="selected"';}?> >Viddler Video</option> +<option value='DailyMotion' <?php if($instance['RV_source3'] == 'DailyMotion'){echo 'selected="selected"';}?> >DailyMotion Video</option> +<option value='Revver' <?php if($instance['RV_source3'] == 'Revver'){echo 'selected="selected"';}?> >Revver Video</option> +<option value='Metacafe' <?php if($instance['RV_source3'] == 'Metacafe'){echo 'selected="selected"';}?> >Metacafe Video</option> +<option value='Tudou' <?php if($instance['RV_source3'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option> +<option value='Youku' <?php if($instance['RV_source3'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option> +<option value='cn6' <?php if($instance['RV_source3'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option> +<option value='Google' <?php if($instance['RV_source3'] == 'Google'){echo 'selected="selected"';}?> >Google Video</option> +<option value='Tangle' <?php if($instance['RV_source3'] == 'Tangle'){echo 'selected="selected"';}?> >Tangle Video</option> +</select> +</p> + +<p> +<label for="<?php echo $this->get_field_id('RV_id3'); ?>">Video 3 ID: </label> +<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> + +<p> +<label for="<?php echo $this->get_field_id('RV_cap3'); ?>">Video Caption: </label> +<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> + + +</div> +<div style="width:220px;height:350px;float:left;margin:0px 15px 20px 5px"> + +<!--fourth video setting --> +<h2>Video 4</h2> +<?php +//show video in Random Video Widget Admin + $autoplaysetting = '0'; + $videoid = $instance['RV_id4']; + $videosource = $instance['RV_source4']; + $videowidth = null; + $videoheight = null; + //$admin = true // to show video in admin + + VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true','false'); +?> +<p> +<label for="<?php echo $this->get_field_id( 'RV_source4' ); ?>">Select Video 4 Source:</label> +<select id="<?php echo $this->get_field_id( 'RV_source4' );?>" name="<?php echo $this->get_field_name( 'RV_source4' );?>" class="widefat" style="width:100%;"> +<option value='YouTube' <?php if($instance['RV_source4'] == 'YouTube'){echo 'selected="selected"';}?> >YouTube Video</option> +<option value='Vimeo' <?php if($instance['RV_source4'] == 'Vimeo'){echo 'selected="selected"';}?> >Vimeo Video</option> +<option value='MySpace' <?php if($instance['RV_source4'] == 'MySpace'){echo 'selected="selected"';}?> >MySpace Video</option> +<option value='Veoh' <?php if($instance['RV_source4'] == 'Veoh'){echo 'selected="selected"';}?> >Veoh Video</option> +<option value='Blip' <?php if($instance['RV_source4'] == 'Blip'){echo 'selected="selected"';}?> >blip.tv Video</option> +<option value='WordPress' <?php if($instance['RV_source4'] == 'WordPress'){echo 'selected="selected"';}?> >WordPress Video</option> +<option value='Viddler' <?php if($instance['RV_source4'] == 'Viddler'){echo 'selected="selected"';}?> >Viddler Video</option> +<option value='DailyMotion' <?php if($instance['RV_source4'] == 'DailyMotion'){echo 'selected="selected"';}?> >DailyMotion Video</option> +<option value='Revver' <?php if($instance['RV_source4'] == 'Revver'){echo 'selected="selected"';}?> >Revver Video</option> +<option value='Metacafe' <?php if($instance['RV_source4'] == 'Metacafe'){echo 'selected="selected"';}?> >Metacafe Video</option> +<option value='Tudou' <?php if($instance['RV_source4'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option> +<option value='Youku' <?php if($instance['RV_source4'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option> +<option value='cn6' <?php if($instance['RV_source4'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option> +<option value='Google' <?php if($instance['RV_source4'] == 'Google'){echo 'selected="selected"';}?> >Google Video</option> +<option value='Tangle' <?php if($instance['RV_source4'] == 'Tangle'){echo 'selected="selected"';}?> >Tangle Video</option> +</select> +</p> + +<p> +<label for="<?php echo $this->get_field_id('RV_id4'); ?>">Video 4 ID: </label> +<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> + +<p> +<label for="<?php echo $this->get_field_id('RV_cap4'); ?>">Video Caption: </label> +<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> + +</div> +<div style="width:220px;height:350px;float:left;margin:0px 15px 20px 0px"> + +<!--fifth video setting --> +<h2>Video 5</h2> +<?php +//show video in Random Video Widget Admin + $autoplaysetting = '0'; + $videoid = $instance['RV_id5']; + $videosource = $instance['RV_source5']; + $videowidth = null; + $videoheight = null; + //$admin = true // to show video in admin + + VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true','false'); +?> +<p> +<label for="<?php echo $this->get_field_id( 'RV_source5' ); ?>">Select Video 5 Source:</label> +<select id="<?php echo $this->get_field_id( 'RV_source5' );?>" name="<?php echo $this->get_field_name( 'RV_source5' );?>" class="widefat" style="width:100%;"> +<option value='YouTube' <?php if($instance['RV_source5'] == 'YouTube'){echo 'selected="selected"';}?> >YouTube Video</option> +<option value='Vimeo' <?php if($instance['RV_source5'] == 'Vimeo'){echo 'selected="selected"';}?> >Vimeo Video</option> +<option value='MySpace' <?php if($instance['RV_source5'] == 'MySpace'){echo 'selected="selected"';}?> >MySpace Video</option> +<option value='Veoh' <?php if($instance['RV_source5'] == 'Veoh'){echo 'selected="selected"';}?> >Veoh Video</option> +<option value='Blip' <?php if($instance['RV_source5'] == 'Blip'){echo 'selected="selected"';}?> >blip.tv Video</option> +<option value='WordPress' <?php if($instance['RV_source5'] == 'WordPress'){echo 'selected="selected"';}?> >WordPress Video</option> +<option value='Viddler' <?php if($instance['RV_source5'] == 'Viddler'){echo 'selected="selected"';}?> >Viddler Video</option> +<option value='DailyMotion' <?php if($instance['RV_source5'] == 'DailyMotion'){echo 'selected="selected"';}?> >DailyMotion Video</option> +<option value='Revver' <?php if($instance['RV_source5'] == 'Revver'){echo 'selected="selected"';}?> >Revver Video</option> +<option value='Metacafe' <?php if($instance['RV_source5'] == 'Metacafe'){echo 'selected="selected"';}?> >Metacafe Video</option> +<option value='Tudou' <?php if($instance['RV_source5'] == 'Tudou'){echo 'selected="selected"';}?> >Tudou Video</option> +<option value='Youku' <?php if($instance['RV_source5'] == 'Youku'){echo 'selected="selected"';}?> >Youku Video</option> +<option value='cn6' <?php if($instance['RV_source5'] == 'cn6'){echo 'selected="selected"';}?> >6.cn Video</option> +<option value='Google' <?php if($instance['RV_source5'] == 'Google'){echo 'selected="selected"';}?> >Google Video</option> +<option value='Tangle' <?php if($instance['RV_source5'] == 'Tangle'){echo 'selected="selected"';}?> >Tangle Video</option> +</select> +</p> + +<p> +<label for="<?php echo $this->get_field_id('RV_id5'); ?>">Video 5 ID: </label> +<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> + +<p> +<label for="<?php echo $this->get_field_id('RV_cap5'); ?>">Video Caption: </label> +<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> + +</div> +<p style="clear:both"></p> + + + <?php + + } + +} +//sdded in version 2.3 +//create shortcode to use WP_WIDGET class to echo out video +//[vsw id="123456" source="vimeo" width="400" height="300" autoplay="no"] +function vsw_show_video($atts, $content = null) { + extract(shortcode_atts(array( + "id" => ' ', + "source" => ' ', + "width" => ' ', + "height" => ' ', + "autoplay" => ' ', + ), $atts)); + +return vsw_show_video_class($id,$source,$width,$height,$autoplay); +} + +add_shortcode("vsw", "vsw_show_video"); + +//function to be used in shortcode or directly in theme +//uses the_widget WordPress Function found in widgets.php +function vsw_show_video_class($id,$source,$width,$height,$autoplay){ + + $vsw_id = $id; + $vsw_width = $width; + $vsw_height = $height; + + //convert string of source to lowercase + $source = strtolower($source); + + //should have used all lowercase in previous functions + //now have to switch it. + switch ($source) { + + case null: + $vsw_source = null; + break; + + case youtube: + $vsw_source = YouTube; + break; + + case vimeo: + $vsw_source = Vimeo; + break; + + case myspace: + $vsw_source = MySpace; + break; + + case veoh: + $vsw_source = Veoh; + break; + + case bliptv: + $vsw_source = Blip; + break; + + case wordpress: + $vsw_source = WordPress; + break; + + case viddler: + $vsw_source = Viddler; + break; + + case dailymotion: + $vsw_source = DailyMotion; + break; + + + case revver: + $vsw_source = Revver; + break; + + case metacafe: + $vsw_source = Metacafe; + break; + + case tudou: + $vsw_source = Tudou; + break; + + case youku: + $vsw_source = Youku; + break; + + case cn6: + $vsw_source = cn6; + break; + + case google: + $vsw_source = Google; + break; + + case tangle: + $vsw_source = Tangle; + break; + + } + + //string to lowercase + $autoplay = strtolower($autoplay); + + //switch autoplay yes or no to 1 or 0 + switch ($autoplay) { + + case null: + $vsw_autoplay = 0; + break; + + case no: + $vsw_autoplay = 0; + break; + + case yes: + $vsw_autoplay = 1; + break; + + } + + +$vsw_code = VSWShowVideo($vsw_source,$vsw_id,$vsw_autoplay,$vsw_width,$vsw_height,'false','true'); + +return $vsw_code; + +} + +//add tinymce button to editor +function dd_vsw_addbuttons() { + // Don't bother doing this stuff if the current user lacks permissions + if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) + return; + + // Add only in Rich Editor mode + if ( get_user_option('rich_editing') == 'true') { + add_filter("mce_external_plugins", "dd_vsw_tinymce_plugin"); + add_filter('mce_buttons', 'dd_vsw_button'); + } +} + +function dd_vsw_button($tiny_buttons) { + array_push($tiny_buttons, "vsw"); + return $tiny_buttons; +} + +// determine absolute url path of editor_plugin.js +function dd_vsw_plugin_url($type) { + //check if defined WordPress Plugins URL + if (defined('WP_PLUGINS_URL')) { + + return WP_PLUGINS_URL."/". $type ."/editor_plugin.js"; + + }else{ + //if not assumme it is default location. + return "../../../wp-content/plugins/". $type ."/editor_plugin.js"; + + } +} + +// Load the TinyMCE plugin : editor_plugin.js (wp2.5) +function dd_vsw_tinymce_plugin($plugin_array) { + $path = dd_vsw_plugin_url("video-sidebar-widgets"); + $plugin_array['vsw'] = $path; + return $plugin_array; +} + +// init process for button control +add_action('init', 'dd_vsw_addbuttons'); + + + +?> \ No newline at end of file diff --git a/wp-content/plugins/video-sidebar-widgets/vsw.gif b/wp-content/plugins/video-sidebar-widgets/vsw.gif new file mode 100644 index 0000000000000000000000000000000000000000..57a97215f50557d9be415f5ea568337e574c4a39 Binary files /dev/null and b/wp-content/plugins/video-sidebar-widgets/vsw.gif differ diff --git a/wp-content/plugins/video-sidebar-widgets/vsw_dialog.htm b/wp-content/plugins/video-sidebar-widgets/vsw_dialog.htm new file mode 100644 index 0000000000000000000000000000000000000000..359fa08434948eafadebbfd0e27e074e7a8704a2 --- /dev/null +++ b/wp-content/plugins/video-sidebar-widgets/vsw_dialog.htm @@ -0,0 +1,70 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<head> + <title>Video Sidebar Widgets (Extension) Insert Video ShortCode</title> + <script type="text/javascript" src="../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script> + <script type="text/javascript" src="vsw_dialog.js"></script> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +<style type="text/css"> +<!-- +html,body,td,th,input,select { + font-family:Arial, Helvetica, sans-serif; + font-size: 12px; + background-color:#FFFFFF; +} +--> +</style> +</head> +<body> +<form onsubmit="VSWDialog.insert();return false;" action="#"> +<table width="100%"> + <tr> + <td height="38" colspan="3"><h2>Insert Video ShortCode</h2></td> + </tr> + <tr> + <td height="30">Video ID</td> + <td height="30" colspan="2"><input id="vsw_id" name="vsw_id" type="text" class="text" style="width:95%" value="" /></td> + </tr> + <tr> + <td width="101" height="30">Video Source</td> + <td height="30" colspan="2"><select name="vsw_source" class="selectfont"> + <option value="youtube">Youtube</option> + <option value="vimeo">Vimeo</option> + <option value="myspace">My Space</option> + <option value="veoh">Veoh</option> + <option value="bliptv">Blip TV</option> + <option value="wordpress">WordPress</option> + <option value="viddler">Viddler</option> + <option value="dailymotion">DailyMotion</option> + <option value="revver">Revver</option> + <option value="metacafe">Metacafe</option> + <option value="tudou">Tudou</option> + <option value="youku">YouKu</option> + <option value="cn6">cn6</option> + <option value="google">Google</option> + <option value="tangle">Tangle</option> + </select></td> + </tr> + <tr> + <td height="30"> Width + <input id="vsw_width" name="vsw_width" type="text" class="text" size="5" value="425" /></td> + <td height="30" colspan="2">Height + <input id="vsw_height" name="vsw_height" type="text" class="text" size="5" value="344" /> </td> + </tr> + <tr> + <td width="101" height="30">Auto Play</td> + <td width="92" height="30"> <select name="vsw_autoplay" class="selectfont"> + <option value="no">No</option> + <option value="yes">Yes</option> + </select></td> + <td width="876" height="30">For certain Video Networks Only.</td> + </tr> + <tr> + <td height="30"><input type="button" id="insert" name="insert" value="{#insert}" onClick="VSWDialog.insert();" /></td> + <td height="30"> </td> + <td height="30"><input type="button" id="cancel" name="cancel" value="{#cancel}" onClick="tinyMCEPopup.close();" /></td> + </tr> +</table> +</form> +</body> +</html> diff --git a/wp-content/plugins/video-sidebar-widgets/vsw_dialog.js b/wp-content/plugins/video-sidebar-widgets/vsw_dialog.js new file mode 100644 index 0000000000000000000000000000000000000000..da36f7e1df819fdbc1f98501beb857a1a29f7bb4 --- /dev/null +++ b/wp-content/plugins/video-sidebar-widgets/vsw_dialog.js @@ -0,0 +1,21 @@ +var VSWDialog = { + init : function() { + }, + + insert : function() { + // Insert the contents from the input into the document + var VSW_ShortCode = '[vsw id="'+document.forms[0].vsw_id.value+'" source="'+document.forms[0].vsw_source.value+'"'; + VSW_ShortCode +=' width="'+document.forms[0].vsw_width.value+'" height="'+document.forms[0].vsw_height.value+'"'; + VSW_ShortCode +=' autoplay="'+document.forms[0].vsw_autoplay.value+'"]'; + tinyMCEPopup.editor.execCommand('mceInsertRawHTML', false, VSW_ShortCode); + tinyMCEPopup.close(); + } +}; + +tinyMCEPopup.onInit.add(VSWDialog.init, VSWDialog); + +/*** MODEL Shortcode + +[vsw id="123456" source="vimeo" width="400" height="300" autoplay="no"] + +***/ \ No newline at end of file