Version Description
*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.
=
Download this release
Release Info
Developer | denzel_chia |
Plugin | Video Sidebar Widgets |
Version | 3.0 |
Comparing to | |
See all releases |
Code changes from version 2.3 to 3.0
- editor_plugin.js +48 -0
- readme.txt +26 -11
- source_image/source.png +0 -0
- video-sidebar-widgets.php +194 -13
- vsw.gif +0 -0
- vsw_dialog.htm +70 -0
- vsw_dialog.js +21 -0
editor_plugin.js
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function() {
|
2 |
+
tinymce.create('tinymce.plugins.VSW_Shortcode_Plugin', {
|
3 |
+
|
4 |
+
init : function(ed, url) {
|
5 |
+
ed.addCommand('mceVSW', function() {
|
6 |
+
ed.windowManager.open({
|
7 |
+
file : url + '/vsw_dialog.htm',
|
8 |
+
width : 550 + parseInt(ed.getLang('vsw.delta_width', 0)),
|
9 |
+
height : 230 + parseInt(ed.getLang('vsw.delta_height', 0)),
|
10 |
+
inline : 1
|
11 |
+
}, {
|
12 |
+
plugin_url : url, // Plugin absolute URL
|
13 |
+
some_custom_arg : 'custom arg' // Custom argument
|
14 |
+
});
|
15 |
+
});
|
16 |
+
|
17 |
+
|
18 |
+
ed.addButton('vsw', {
|
19 |
+
title : 'insert video shortcode',
|
20 |
+
cmd : 'mceVSW',
|
21 |
+
image : url + '/vsw.gif'
|
22 |
+
});
|
23 |
+
|
24 |
+
|
25 |
+
ed.onNodeChange.add(function(ed, cm, n) {
|
26 |
+
cm.setActive('vsw', n.nodeName == 'Video');
|
27 |
+
});
|
28 |
+
},
|
29 |
+
|
30 |
+
createControl : function(n, cm) {
|
31 |
+
return null;
|
32 |
+
},
|
33 |
+
|
34 |
+
|
35 |
+
getInfo : function() {
|
36 |
+
return {
|
37 |
+
longname : 'Video Sidebar Widgets Shortcode Plugin',
|
38 |
+
author : 'Denzel',
|
39 |
+
authorurl : 'http://denzeldesigns.com',
|
40 |
+
infourl : 'http://denzeldesigns.com',
|
41 |
+
version : "1.0"
|
42 |
+
};
|
43 |
+
}
|
44 |
+
});
|
45 |
+
|
46 |
+
// Register plugin
|
47 |
+
tinymce.PluginManager.add('vsw', tinymce.plugins.VSW_Shortcode_Plugin);
|
48 |
+
})();
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== Video Sidebar Widgets ===
|
2 |
-
Contributors:
|
3 |
Donate link: http://denzeldesigns.com/wordpress-plugins/video-sidebar-widgets/
|
4 |
Author link: http://denzeldesigns.com
|
5 |
Tags:video, widget, widgets, sidebar, videos, video sidebar widget, video widget, embed video, video embed, video in sidebar, youtube, vimeo, veoh, myspace video, revver, blip tv, tudou, youku, 6.cn, google videos, tangle
|
6 |
Requires at least:2.8.1
|
7 |
-
Tested up to:
|
8 |
-
Stable tag:
|
9 |
|
10 |
== Description ==
|
11 |
|
@@ -14,12 +14,12 @@ Now including Random Video Sidebar Widget to randomly display 1 out of 5 preset
|
|
14 |
|
15 |
== Changelog ==
|
16 |
|
17 |
-
=2.0=
|
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 |
|
@@ -31,26 +31,41 @@ Now including Random Video Sidebar Widget to randomly display 1 out of 5 preset
|
|
31 |
|
32 |
*Video Caption has a style class of "VideoCaption" to enable user to indicate font-height etc.
|
33 |
|
34 |
-
=2.2=
|
35 |
|
36 |
*Included support for Tangle.com videos
|
37 |
|
38 |
-
=2.3=
|
39 |
|
40 |
*Removed auto play video option for Blip.tv video, which is causing the video not to load in Internet Explorer.
|
41 |
*Allowed HTML links in video caption
|
42 |
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
== Installation ==
|
45 |
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
-
|
|
|
|
|
49 |
|
50 |
-
3. Activate the plugin through the Plugins menu in WordPress Admin.
|
51 |
|
52 |
-
|
53 |
|
|
|
|
|
54 |
|
55 |
== How to use Video Sidebar Widget ? ==
|
56 |
|
1 |
=== Video Sidebar Widgets ===
|
2 |
+
Contributors: denzel_chia
|
3 |
Donate link: http://denzeldesigns.com/wordpress-plugins/video-sidebar-widgets/
|
4 |
Author link: http://denzeldesigns.com
|
5 |
Tags:video, widget, widgets, sidebar, videos, video sidebar widget, video widget, embed video, video embed, video in sidebar, youtube, vimeo, veoh, myspace video, revver, blip tv, tudou, youku, 6.cn, google videos, tangle
|
6 |
Requires at least:2.8.1
|
7 |
+
Tested up to: 3.0.5
|
8 |
+
Stable tag:3.0
|
9 |
|
10 |
== Description ==
|
11 |
|
14 |
|
15 |
== Changelog ==
|
16 |
|
17 |
+
= 2.0 =
|
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 |
|
31 |
|
32 |
*Video Caption has a style class of "VideoCaption" to enable user to indicate font-height etc.
|
33 |
|
34 |
+
= 2.2 =
|
35 |
|
36 |
*Included support for Tangle.com videos
|
37 |
|
38 |
+
= 2.3 =
|
39 |
|
40 |
*Removed auto play video option for Blip.tv video, which is causing the video not to load in Internet Explorer.
|
41 |
*Allowed HTML links in video caption
|
42 |
|
43 |
+
= 3.0 =
|
44 |
+
|
45 |
+
*added video quicktag at post editor to insert video shortcode into post or page.
|
46 |
+
*Shortcode to allow posting of video on post or page, using video function already available in plugin.
|
47 |
+
|
48 |
|
49 |
== Installation ==
|
50 |
|
51 |
+
= Install Plugin Using Search =
|
52 |
+
|
53 |
+
1. Search for Video Sidebar widgets in Add New Plugins
|
54 |
+
2. Click 'Install Now' in search results row
|
55 |
+
3. Click 'OK' to accept plugin installation
|
56 |
+
4. Once installed, click Activate Plugin link
|
57 |
+
|
58 |
+
= or, install Plugin in .ZIP Format =
|
59 |
|
60 |
+
1. Visit Plugins > Add New > Upload in WordPress admin
|
61 |
+
2. Upload video-sidebar-widgets.zip file
|
62 |
+
3. Once uploaded, click Activate Plugin link
|
63 |
|
|
|
64 |
|
65 |
+
== Can I post video in post or page content other than the sidebar? ==
|
66 |
|
67 |
+
As of version 3.0, shortcode is added to enable user to post video in content.
|
68 |
+
User can use the video Quicktag at Tinymce editor to insert video shortcode.
|
69 |
|
70 |
== How to use Video Sidebar Widget ? ==
|
71 |
|
source_image/source.png
ADDED
Binary file
|
video-sidebar-widgets.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/*
|
3 |
Plugin Name: Video Sidebar Widgets
|
4 |
Plugin URI: http://denzeldesigns.com/wordpress-plugins/video-sidebar-widgets/
|
5 |
-
Version:
|
6 |
-
Description:
|
7 |
Author: Denzel Chia
|
8 |
Author URI: http://denzeldesigns.com/
|
9 |
*/
|
@@ -49,7 +49,7 @@ class VideoSidebarWidget extends WP_Widget {
|
|
49 |
echo $before_title . $title2 . $after_title;
|
50 |
}
|
51 |
|
52 |
-
//get settings from Widget Admin Form to assign to function
|
53 |
$autoplaysetting = $instance['v_autoplay2'];
|
54 |
$videoid = $instance['v_id2'];
|
55 |
$videosource = $instance['v_source'];
|
@@ -57,7 +57,7 @@ class VideoSidebarWidget extends WP_Widget {
|
|
57 |
$videoheight = $instance['v_height2'];
|
58 |
|
59 |
//function to show video in blog sidebar, please look for it below
|
60 |
-
|
61 |
|
62 |
if($cap2){
|
63 |
echo "<p class=\"VideoCaption\">$cap2</p>";
|
@@ -107,7 +107,7 @@ class VideoSidebarWidget extends WP_Widget {
|
|
107 |
$videoheight = null;
|
108 |
//$admin = true // to show video in admin
|
109 |
|
110 |
-
|
111 |
|
112 |
?>
|
113 |
|
@@ -213,7 +213,7 @@ class VideoSidebarWidget extends WP_Widget {
|
|
213 |
|
214 |
|
215 |
|
216 |
-
function
|
217 |
|
218 |
//admin = true to show in widget admin
|
219 |
//admin = false to show in blog sidebar
|
@@ -341,7 +341,24 @@ function ShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheig
|
|
341 |
|
342 |
}
|
343 |
|
344 |
-
if($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
// echo video in admin
|
346 |
echo "\n<object width=\"212\" height=\"172\">\n";
|
347 |
echo $flashvar;
|
@@ -374,7 +391,7 @@ function ShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheig
|
|
374 |
}
|
375 |
|
376 |
|
377 |
-
}//end of function
|
378 |
|
379 |
|
380 |
|
@@ -721,7 +738,7 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
721 |
$videoheight = null;
|
722 |
//$admin = true // to show video in admin
|
723 |
|
724 |
-
|
725 |
?>
|
726 |
<p>
|
727 |
<label for="<?php echo $this->get_field_id( 'RV_source1' ); ?>">Select Video 1 Source:</label>
|
@@ -766,7 +783,7 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
766 |
$videoheight = null;
|
767 |
//$admin = true // to show video in admin
|
768 |
|
769 |
-
|
770 |
?>
|
771 |
<p>
|
772 |
<label for="<?php echo $this->get_field_id( 'RV_source2' ); ?>">Select Video 2 Source:</label>
|
@@ -811,7 +828,7 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
811 |
$videoheight = null;
|
812 |
//$admin = true // to show video in admin
|
813 |
|
814 |
-
|
815 |
?>
|
816 |
<p>
|
817 |
<label for="<?php echo $this->get_field_id( 'RV_source3' ); ?>">Select Video 3 Source:</label>
|
@@ -857,7 +874,7 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
857 |
$videoheight = null;
|
858 |
//$admin = true // to show video in admin
|
859 |
|
860 |
-
|
861 |
?>
|
862 |
<p>
|
863 |
<label for="<?php echo $this->get_field_id( 'RV_source4' ); ?>">Select Video 4 Source:</label>
|
@@ -902,7 +919,7 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
902 |
$videoheight = null;
|
903 |
//$admin = true // to show video in admin
|
904 |
|
905 |
-
|
906 |
?>
|
907 |
<p>
|
908 |
<label for="<?php echo $this->get_field_id( 'RV_source5' ); ?>">Select Video 5 Source:</label>
|
@@ -941,10 +958,174 @@ $instance = wp_parse_args( (array) $instance, array( 'RV_title' => '', 'RV_width
|
|
941 |
|
942 |
}
|
943 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
944 |
}
|
945 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
946 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
947 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
948 |
|
949 |
|
950 |
|
2 |
/*
|
3 |
Plugin Name: Video Sidebar Widgets
|
4 |
Plugin URI: http://denzeldesigns.com/wordpress-plugins/video-sidebar-widgets/
|
5 |
+
Version: 3.0
|
6 |
+
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.
|
7 |
Author: Denzel Chia
|
8 |
Author URI: http://denzeldesigns.com/
|
9 |
*/
|
49 |
echo $before_title . $title2 . $after_title;
|
50 |
}
|
51 |
|
52 |
+
//get settings from Widget Admin Form to assign to function VSWShowVideo
|
53 |
$autoplaysetting = $instance['v_autoplay2'];
|
54 |
$videoid = $instance['v_id2'];
|
55 |
$videosource = $instance['v_source'];
|
57 |
$videoheight = $instance['v_height2'];
|
58 |
|
59 |
//function to show video in blog sidebar, please look for it below
|
60 |
+
VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'false','false');
|
61 |
|
62 |
if($cap2){
|
63 |
echo "<p class=\"VideoCaption\">$cap2</p>";
|
107 |
$videoheight = null;
|
108 |
//$admin = true // to show video in admin
|
109 |
|
110 |
+
VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true','false');
|
111 |
|
112 |
?>
|
113 |
|
213 |
|
214 |
|
215 |
|
216 |
+
function VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,$admin,$shortcode){
|
217 |
|
218 |
//admin = true to show in widget admin
|
219 |
//admin = false to show in blog sidebar
|
341 |
|
342 |
}
|
343 |
|
344 |
+
if($shortcode=="true"){
|
345 |
+
//added in version 2.3
|
346 |
+
//return instead of echo video on blog using shortcode
|
347 |
+
$vsw_code = "\n<object width=\"$v_width2\" height=\"$v_height2\">\n";
|
348 |
+
$vsw_code .= $flashvar;
|
349 |
+
$vsw_code .= "<param name=\"allowfullscreen\" value=\"true\" />\n";
|
350 |
+
$vsw_code .= "<param name=\"allowscriptaccess\" value=\"always\" />\n";
|
351 |
+
$vsw_code .= "<param name=\"movie\" value=\"$value\" />\n";
|
352 |
+
$vsw_code .= "<param name=\"wmode\" value=\"transparent\">\n";
|
353 |
+
$vsw_code .= "<embed src=\"$value\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" ";
|
354 |
+
$vsw_code .= "allowfullscreen=\"true\" allowscriptaccess=\"always\" ";
|
355 |
+
$vsw_code .= $flashvar2;
|
356 |
+
$vsw_code .= "width=\"$v_width2\" height=\"$v_height2\">\n";
|
357 |
+
$vsw_code .= "</embed>\n";
|
358 |
+
$vsw_code .= "</object>\n\n";
|
359 |
+
return $vsw_code;
|
360 |
+
}
|
361 |
+
elseif($admin=="true"){
|
362 |
// echo video in admin
|
363 |
echo "\n<object width=\"212\" height=\"172\">\n";
|
364 |
echo $flashvar;
|
391 |
}
|
392 |
|
393 |
|
394 |
+
}//end of function VSWShowVideo
|
395 |
|
396 |
|
397 |
|
738 |
$videoheight = null;
|
739 |
//$admin = true // to show video in admin
|
740 |
|
741 |
+
VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true','false');
|
742 |
?>
|
743 |
<p>
|
744 |
<label for="<?php echo $this->get_field_id( 'RV_source1' ); ?>">Select Video 1 Source:</label>
|
783 |
$videoheight = null;
|
784 |
//$admin = true // to show video in admin
|
785 |
|
786 |
+
VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true','false');
|
787 |
?>
|
788 |
<p>
|
789 |
<label for="<?php echo $this->get_field_id( 'RV_source2' ); ?>">Select Video 2 Source:</label>
|
828 |
$videoheight = null;
|
829 |
//$admin = true // to show video in admin
|
830 |
|
831 |
+
VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true','false');
|
832 |
?>
|
833 |
<p>
|
834 |
<label for="<?php echo $this->get_field_id( 'RV_source3' ); ?>">Select Video 3 Source:</label>
|
874 |
$videoheight = null;
|
875 |
//$admin = true // to show video in admin
|
876 |
|
877 |
+
VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true','false');
|
878 |
?>
|
879 |
<p>
|
880 |
<label for="<?php echo $this->get_field_id( 'RV_source4' ); ?>">Select Video 4 Source:</label>
|
919 |
$videoheight = null;
|
920 |
//$admin = true // to show video in admin
|
921 |
|
922 |
+
VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,'true','false');
|
923 |
?>
|
924 |
<p>
|
925 |
<label for="<?php echo $this->get_field_id( 'RV_source5' ); ?>">Select Video 5 Source:</label>
|
958 |
|
959 |
}
|
960 |
|
961 |
+
}
|
962 |
+
//sdded in version 2.3
|
963 |
+
//create shortcode to use WP_WIDGET class to echo out video
|
964 |
+
//[vsw id="123456" source="vimeo" width="400" height="300" autoplay="no"]
|
965 |
+
function vsw_show_video($atts, $content = null) {
|
966 |
+
extract(shortcode_atts(array(
|
967 |
+
"id" => ' ',
|
968 |
+
"source" => ' ',
|
969 |
+
"width" => ' ',
|
970 |
+
"height" => ' ',
|
971 |
+
"autoplay" => ' ',
|
972 |
+
), $atts));
|
973 |
+
|
974 |
+
return vsw_show_video_class($id,$source,$width,$height,$autoplay);
|
975 |
+
}
|
976 |
+
|
977 |
+
add_shortcode("vsw", "vsw_show_video");
|
978 |
+
|
979 |
+
//function to be used in shortcode or directly in theme
|
980 |
+
//uses the_widget WordPress Function found in widgets.php
|
981 |
+
function vsw_show_video_class($id,$source,$width,$height,$autoplay){
|
982 |
+
|
983 |
+
$vsw_id = $id;
|
984 |
+
$vsw_width = $width;
|
985 |
+
$vsw_height = $height;
|
986 |
+
|
987 |
+
//convert string of source to lowercase
|
988 |
+
$source = strtolower($source);
|
989 |
+
|
990 |
+
//should have used all lowercase in previous functions
|
991 |
+
//now have to switch it.
|
992 |
+
switch ($source) {
|
993 |
+
|
994 |
+
case null:
|
995 |
+
$vsw_source = null;
|
996 |
+
break;
|
997 |
+
|
998 |
+
case youtube:
|
999 |
+
$vsw_source = YouTube;
|
1000 |
+
break;
|
1001 |
+
|
1002 |
+
case vimeo:
|
1003 |
+
$vsw_source = Vimeo;
|
1004 |
+
break;
|
1005 |
+
|
1006 |
+
case myspace:
|
1007 |
+
$vsw_source = MySpace;
|
1008 |
+
break;
|
1009 |
+
|
1010 |
+
case veoh:
|
1011 |
+
$vsw_source = Veoh;
|
1012 |
+
break;
|
1013 |
+
|
1014 |
+
case bliptv:
|
1015 |
+
$vsw_source = Blip;
|
1016 |
+
break;
|
1017 |
+
|
1018 |
+
case wordpress:
|
1019 |
+
$vsw_source = WordPress;
|
1020 |
+
break;
|
1021 |
+
|
1022 |
+
case viddler:
|
1023 |
+
$vsw_source = Viddler;
|
1024 |
+
break;
|
1025 |
+
|
1026 |
+
case dailymotion:
|
1027 |
+
$vsw_source = DailyMotion;
|
1028 |
+
break;
|
1029 |
+
|
1030 |
+
|
1031 |
+
case revver:
|
1032 |
+
$vsw_source = Revver;
|
1033 |
+
break;
|
1034 |
+
|
1035 |
+
case metacafe:
|
1036 |
+
$vsw_source = Metacafe;
|
1037 |
+
break;
|
1038 |
+
|
1039 |
+
case tudou:
|
1040 |
+
$vsw_source = Tudou;
|
1041 |
+
break;
|
1042 |
+
|
1043 |
+
case youku:
|
1044 |
+
$vsw_source = Youku;
|
1045 |
+
break;
|
1046 |
+
|
1047 |
+
case cn6:
|
1048 |
+
$vsw_source = cn6;
|
1049 |
+
break;
|
1050 |
+
|
1051 |
+
case google:
|
1052 |
+
$vsw_source = Google;
|
1053 |
+
break;
|
1054 |
+
|
1055 |
+
case tangle:
|
1056 |
+
$vsw_source = Tangle;
|
1057 |
+
break;
|
1058 |
+
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
//string to lowercase
|
1062 |
+
$autoplay = strtolower($autoplay);
|
1063 |
+
|
1064 |
+
//switch autoplay yes or no to 1 or 0
|
1065 |
+
switch ($autoplay) {
|
1066 |
+
|
1067 |
+
case null:
|
1068 |
+
$vsw_autoplay = 0;
|
1069 |
+
break;
|
1070 |
+
|
1071 |
+
case no:
|
1072 |
+
$vsw_autoplay = 0;
|
1073 |
+
break;
|
1074 |
+
|
1075 |
+
case yes:
|
1076 |
+
$vsw_autoplay = 1;
|
1077 |
+
break;
|
1078 |
+
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
|
1082 |
+
$vsw_code = VSWShowVideo($vsw_source,$vsw_id,$vsw_autoplay,$vsw_width,$vsw_height,'false','true');
|
1083 |
+
|
1084 |
+
return $vsw_code;
|
1085 |
+
|
1086 |
}
|
1087 |
|
1088 |
+
//add tinymce button to editor
|
1089 |
+
function dd_vsw_addbuttons() {
|
1090 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
1091 |
+
if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
|
1092 |
+
return;
|
1093 |
+
|
1094 |
+
// Add only in Rich Editor mode
|
1095 |
+
if ( get_user_option('rich_editing') == 'true') {
|
1096 |
+
add_filter("mce_external_plugins", "dd_vsw_tinymce_plugin");
|
1097 |
+
add_filter('mce_buttons', 'dd_vsw_button');
|
1098 |
+
}
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
function dd_vsw_button($tiny_buttons) {
|
1102 |
+
array_push($tiny_buttons, "vsw");
|
1103 |
+
return $tiny_buttons;
|
1104 |
+
}
|
1105 |
|
1106 |
+
// determine absolute url path of editor_plugin.js
|
1107 |
+
function dd_vsw_plugin_url($type) {
|
1108 |
+
//check if defined WordPress Plugins URL
|
1109 |
+
if (defined('WP_PLUGINS_URL')) {
|
1110 |
+
|
1111 |
+
return WP_PLUGINS_URL."/". $type ."/editor_plugin.js";
|
1112 |
+
|
1113 |
+
}else{
|
1114 |
+
//if not assumme it is default location.
|
1115 |
+
return "../../../wp-content/plugins/". $type ."/editor_plugin.js";
|
1116 |
+
|
1117 |
+
}
|
1118 |
+
}
|
1119 |
|
1120 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
1121 |
+
function dd_vsw_tinymce_plugin($plugin_array) {
|
1122 |
+
$path = dd_vsw_plugin_url("video-sidebar-widgets");
|
1123 |
+
$plugin_array['vsw'] = $path;
|
1124 |
+
return $plugin_array;
|
1125 |
+
}
|
1126 |
+
|
1127 |
+
// init process for button control
|
1128 |
+
add_action('init', 'dd_vsw_addbuttons');
|
1129 |
|
1130 |
|
1131 |
|
vsw.gif
ADDED
Binary file
|
vsw_dialog.htm
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
2 |
+
"http://www.w3.org/TR/html4/loose.dtd">
|
3 |
+
<head>
|
4 |
+
<title>Video Sidebar Widgets (Extension) Insert Video ShortCode</title>
|
5 |
+
<script type="text/javascript" src="../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
6 |
+
<script type="text/javascript" src="vsw_dialog.js"></script>
|
7 |
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
8 |
+
<style type="text/css">
|
9 |
+
<!--
|
10 |
+
html,body,td,th,input,select {
|
11 |
+
font-family:Arial, Helvetica, sans-serif;
|
12 |
+
font-size: 12px;
|
13 |
+
background-color:#FFFFFF;
|
14 |
+
}
|
15 |
+
-->
|
16 |
+
</style>
|
17 |
+
</head>
|
18 |
+
<body>
|
19 |
+
<form onsubmit="VSWDialog.insert();return false;" action="#">
|
20 |
+
<table width="100%">
|
21 |
+
<tr>
|
22 |
+
<td height="38" colspan="3"><h2>Insert Video ShortCode</h2></td>
|
23 |
+
</tr>
|
24 |
+
<tr>
|
25 |
+
<td height="30">Video ID</td>
|
26 |
+
<td height="30" colspan="2"><input id="vsw_id" name="vsw_id" type="text" class="text" style="width:95%" value="" /></td>
|
27 |
+
</tr>
|
28 |
+
<tr>
|
29 |
+
<td width="101" height="30">Video Source</td>
|
30 |
+
<td height="30" colspan="2"><select name="vsw_source" class="selectfont">
|
31 |
+
<option value="youtube">Youtube</option>
|
32 |
+
<option value="vimeo">Vimeo</option>
|
33 |
+
<option value="myspace">My Space</option>
|
34 |
+
<option value="veoh">Veoh</option>
|
35 |
+
<option value="bliptv">Blip TV</option>
|
36 |
+
<option value="wordpress">WordPress</option>
|
37 |
+
<option value="viddler">Viddler</option>
|
38 |
+
<option value="dailymotion">DailyMotion</option>
|
39 |
+
<option value="revver">Revver</option>
|
40 |
+
<option value="metacafe">Metacafe</option>
|
41 |
+
<option value="tudou">Tudou</option>
|
42 |
+
<option value="youku">YouKu</option>
|
43 |
+
<option value="cn6">cn6</option>
|
44 |
+
<option value="google">Google</option>
|
45 |
+
<option value="tangle">Tangle</option>
|
46 |
+
</select></td>
|
47 |
+
</tr>
|
48 |
+
<tr>
|
49 |
+
<td height="30"> Width
|
50 |
+
<input id="vsw_width" name="vsw_width" type="text" class="text" size="5" value="425" /></td>
|
51 |
+
<td height="30" colspan="2">Height
|
52 |
+
<input id="vsw_height" name="vsw_height" type="text" class="text" size="5" value="344" /> </td>
|
53 |
+
</tr>
|
54 |
+
<tr>
|
55 |
+
<td width="101" height="30">Auto Play</td>
|
56 |
+
<td width="92" height="30"> <select name="vsw_autoplay" class="selectfont">
|
57 |
+
<option value="no">No</option>
|
58 |
+
<option value="yes">Yes</option>
|
59 |
+
</select></td>
|
60 |
+
<td width="876" height="30">For certain Video Networks Only.</td>
|
61 |
+
</tr>
|
62 |
+
<tr>
|
63 |
+
<td height="30"><input type="button" id="insert" name="insert" value="{#insert}" onClick="VSWDialog.insert();" /></td>
|
64 |
+
<td height="30"> </td>
|
65 |
+
<td height="30"><input type="button" id="cancel" name="cancel" value="{#cancel}" onClick="tinyMCEPopup.close();" /></td>
|
66 |
+
</tr>
|
67 |
+
</table>
|
68 |
+
</form>
|
69 |
+
</body>
|
70 |
+
</html>
|
vsw_dialog.js
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var VSWDialog = {
|
2 |
+
init : function() {
|
3 |
+
},
|
4 |
+
|
5 |
+
insert : function() {
|
6 |
+
// Insert the contents from the input into the document
|
7 |
+
var VSW_ShortCode = '[vsw id="'+document.forms[0].vsw_id.value+'" source="'+document.forms[0].vsw_source.value+'"';
|
8 |
+
VSW_ShortCode +=' width="'+document.forms[0].vsw_width.value+'" height="'+document.forms[0].vsw_height.value+'"';
|
9 |
+
VSW_ShortCode +=' autoplay="'+document.forms[0].vsw_autoplay.value+'"]';
|
10 |
+
tinyMCEPopup.editor.execCommand('mceInsertRawHTML', false, VSW_ShortCode);
|
11 |
+
tinyMCEPopup.close();
|
12 |
+
}
|
13 |
+
};
|
14 |
+
|
15 |
+
tinyMCEPopup.onInit.add(VSWDialog.init, VSWDialog);
|
16 |
+
|
17 |
+
/*** MODEL Shortcode
|
18 |
+
|
19 |
+
[vsw id="123456" source="vimeo" width="400" height="300" autoplay="no"]
|
20 |
+
|
21 |
+
***/
|