Changeset 174775
- Timestamp:
- 11/18/2009 12:55:00 AM (16 years ago)
- Location:
- easy-vbox7/trunk
- Files:
-
- 2 added
- 3 edited
-
easy-vbox7.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
screenshot-1.png (modified) (previous)
-
screenshot-2.png (added)
-
uninstall.php (added)
Legend:
- Unmodified
- Added
- Removed
-
easy-vbox7/trunk/easy-vbox7.php
r95114 r174775 3 3 Plugin Name: Easy VBOX7 4 4 Plugin URI: http://blog.caspie.net/2009/02/14/easy-vbox7-wordpress-plugin/ 5 Description: Easy and fast way to insert videos from VBOX7.com right into your WordPress blog posts.6 Version: 1. 15 Description: Quick and easy way to insert videos from VBOX7.com right into your WordPress blog posts, pages and sidebar. 6 Version: 1.2 7 7 Author: Casper 8 8 Author URI: http://blog.caspie.net/ 9 9 */ 10 add_filter('the_content','easy_vbox7_content',100); 10 11 /* 12 ** Easy VBOX7 Core 13 */ 14 15 add_filter( 'the_content', 'easy_vbox7_content', 100 ); 16 17 if ( version_compare( $wp_version, '2.8', '>=' ) ) 18 add_action( 'widgets_init', 'widget_easy_vbox7_init' ); 19 else 20 add_action( 'after_plugin_row', 'easy_vbox7_plugin_notice' ); 21 22 function easy_vbox7_plugin_notice( $plugin ) { 23 if( $plugin == 'easy-vbox7/easy-vbox7.php' ) 24 echo '<tr class="plugin-update-tr"><td class="plugin-update" colspan="3"><div class="update-message" style="background-color:#ffebe8;border-color:#cc0000;color:#cc0000;">WordPress 2.8+ is required for this plugin to work properly! The new Easy VBOX7 Widget was not initialized.</div></td></tr>'; 25 } 26 27 function easy_vbox7_output($v = '89af3669', $w = 450, $h = 403, $a = 0) { 28 $vbox7 = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' . $w . '" height="' . $h . '"><param name="movie" value="http://i.vbox7.com/player/ext.swf?vid=' . $v . '&autoplay=' . $a . '"><param name="quality" value="high"><embed src="http://i.vbox7.com/player/ext.swf?vid=' . $v . '&autoplay=' . $a . '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' . $w . '" height="' . $h . '"></embed></object>'; 29 return $vbox7; 30 } 31 11 32 function easy_vbox7_content($the_content) { 12 $pat = "/\[play:([a-z0-9]{8})(:[1-9][0-9]{1,2}){0,2}\]/"; 13 if(preg_match_all($pat,$the_content,$matches,PREG_SET_ORDER)) { 14 foreach($matches as $value) { 15 $var = explode(":",str_replace(array("[","]"),"",$value[0])); 16 $w = $var[2] ? $var[2] : "450"; 17 $h = $var[3] ? $var[3] : "403"; 18 $vid = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'.$w.'" height="'.$h.'"><param name="movie" value="http://i47.vbox7.com/player/ext.swf?vid='.$var[1].'"><param name="quality" value="high"><embed src="http://i47.vbox7.com/player/ext.swf?vid='.$var[1].'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'.$w.'" height="'.$h.'"></embed></object>'; 19 $patt = "/\[play:".$var[1]."(:[1-9][0-9]{1,2}){0,2}\]/"; 20 $the_content = preg_replace($patt,$vid,$the_content); 33 $pattern = "/\[play:([a-z0-9]{8})(:[1-9][0-9]{1,2})?(:[1-9][0-9]{1,2})?(:1)?\]/"; 34 if ( preg_match_all( $pattern, $the_content, $matches, PREG_SET_ORDER ) ) { 35 foreach ( $matches as $value ) { 36 $video = $value[1]; 37 $width = $value[2] ? str_replace(":", "", $value[2]) : "450"; 38 $height = $value[3] ? str_replace(":", "", $value[3]) : "403"; 39 $autoplay = $value[4] ? 1 : 0; 40 $the_content = str_replace( $value[0], easy_vbox7_output( $video, $width, $height, $autoplay ), $the_content ); 21 41 } 22 42 } 23 43 return $the_content; 24 44 } 45 46 /* 47 ** Easy VBOX7 Widget 48 */ 49 50 function widget_easy_vbox7_init() { 51 register_widget( 'Easy_Vbox7_Widget' ); 52 } 53 54 if ( class_exists( 'WP_Widget' ) ) { 55 56 class Easy_Vbox7_Widget extends WP_Widget { 57 58 function Easy_Vbox7_Widget() { 59 $widget_ops = array( 'classname' => 'widget_easy_vbox7', 'description' => 'Add VBOX7 Videos to your sidebar' ); 60 $control_ops = array( 'id_base' => 'easy-vbox7', 'video' => '89af3669', 'width' => 190, 'height' => 180, 'autoplay' => false ); 61 $this->WP_Widget( 'easy-vbox7', 'Easy VBOX7', $widget_ops, $control_ops ); 62 } 63 64 function widget($args, $instance) { 65 extract($args); 66 echo $before_widget; 67 $title = apply_filters( 'widget_title', $instance['title'] ); 68 if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } 69 $video = $instance['video']; 70 $width = $instance['width']; 71 $height = $instance['height']; 72 $autoplay = $instance['autoplay'] ? 1 : 0; 73 echo '<span class="easy_vbox7" style="display:block;">' . easy_vbox7_output( $video, $width, $height, $autoplay ) . '</span>'; 74 echo $after_widget; 75 } 76 77 function update($new_instance, $old_instance) { 78 $instance = $old_instance; 79 $instance['title'] = trim( strip_tags( $new_instance['title'] ) ); 80 $instance['video'] = trim( strip_tags( $new_instance['video'] ) ); 81 $instance['width'] = (int) trim( strip_tags( $new_instance['width'] ) ); 82 $instance['height'] = (int) trim( strip_tags( $new_instance['height'] ) ); 83 $instance['autoplay'] = (bool) $new_instance['autoplay']; 84 return $instance; 85 } 86 87 function form($instance) { 88 if ( !$title = $instance['title'] ) 89 $title = 'Video'; 90 else 91 $title = esc_attr($instance['title']); 92 93 if ( !$video = $instance['video'] ) 94 $video = '89af3669'; 95 else 96 $video = esc_attr($instance['video']); 97 98 if ( !$width = (int) $instance['width'] ) 99 $width = 190; 100 else 101 $width = esc_attr($instance['width']); 102 103 if ( !$height = (int) $instance['height'] ) 104 $height = 180; 105 else 106 $height = esc_attr($instance['height']); 107 ?> 108 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></label></p> 109 <p><label for="<?php echo $this->get_field_id( 'video' ); ?>">Video: <input class="widefat" id="<?php echo $this->get_field_id( 'video' ); ?>" name="<?php echo $this->get_field_name( 'video' ); ?>" type="text" value="<?php echo $video; ?>" /></label></p> 110 <p><label for="<?php echo $this->get_field_id( 'width' ); ?>">Width: <input class="widefat" id="<?php echo $this->get_field_id( 'width' ); ?>" name="<?php echo $this->get_field_name( 'width' ); ?>" type="text" value="<?php echo $width; ?>" /></label></p> 111 <p><label for="<?php echo $this->get_field_id( 'height' ); ?>">Height: <input class="widefat" id="<?php echo $this->get_field_id( 'height' ); ?>" name="<?php echo $this->get_field_name( 'height' ); ?>" type="text" value="<?php echo $height; ?>" /></label></p> 112 <p><label for="<?php echo $this->get_field_id( 'autoplay' ); ?>">Autoplay: <input class="checkbox" id="<?php echo $this->get_field_id( 'autoplay' ); ?>" name="<?php echo $this->get_field_name( 'autoplay' ); ?>" type="checkbox" value="1"<?php checked( true, $autoplay ); ?> /></label></p> 113 <?php 114 } 115 } 116 } 117 118 /* 119 ** Easy VBOX7 Shortcode 120 */ 121 122 add_shortcode('vbox7', 'vbox7_shortcode'); 123 124 function vbox7_shortcode($atts, $video ) { 125 $video = $video ? $video : '89af3669'; 126 $atts = shortcode_atts( array( 'id' => $video, 'width' => 450, 'height' => 403, 'autoplay' => 0 ), $atts ); 127 return easy_vbox7_output( $atts['id'], $atts['width'], $atts['height'], $atts['autoplay'] ); 128 } 129 25 130 ?> -
easy-vbox7/trunk/readme.txt
r96116 r174775 2 2 Contributors: Caspie 3 3 Donate link: http://blog.caspie.net/downloads 4 Tags: vbox 7, vbox, video, videos, clip, clips, insert5 Requires at least: 1.56 Tested up to: 2. 7.17 Stable tag: 1. 14 Tags: vbox, vbox7, video, videos, clip, clips, insert, posts, pages, sidebar 5 Requires at least: 2.8 6 Tested up to: 2.8.6 7 Stable tag: 1.2 8 8 9 Easy and fast way to insert videos from VBOX7.com right into your WordPress blog posts.9 Quick and easy way to insert videos from VBOX7.com right into your WordPress blog posts, pages and sidebar. 10 10 11 11 == Description == 12 12 13 Easy and fast way to insert videos from VBOX7.com right into your WordPress blog posts. VBOX7 is the biggest Bulgarian video portal so far. It already has a few million videos and lot of them have titles or tags in english. So even if you can't read Bulgarian, you can easily use the big search box at the top-right corner of the website (vbox7.com) to find your favorite videos and to embed them right into your posts.13 Quick and easy way to insert videos from VBOX7.com right into your WordPress blog posts, pages and sidebar. VBOX7 is the biggest Bulgarian video portal so far. It already has a few million videos and lot of them have titles or tags in english. So even if you can't read Bulgarian, you can easily use the big search box at the top-right corner of the website (vbox7.com) to find your favorite videos and to embed them right into your posts. 14 14 15 Go to Other Notes for: Usage, Advanced Usage and Changelog.15 Go to Other Notes for: Default, Recommended and Advanced Usage. 16 16 http://wordpress.org/extend/plugins/easy-vbox7/other_notes/ 17 17 … … 28 28 Yes, but keep in mind that my wordpress.org username is Caspie. 29 29 30 = I want to write you or thank you? =30 = I want to thank you or send you some feedback? = 31 31 32 32 Do it via my blog - http://blog.caspie.net/contact/ - enjoy! … … 38 38 == Screenshots == 39 39 40 1. Simple example of how your post should look with one video added. 40 1. Easy VBOX7 - Usage 41 2. Easy VBOX7 - Widget 41 42 42 == Usage == 43 == Changelog == 44 45 = 1.2 = 46 * Added new sidebar widget using the new Widgets API. 47 * Added new shortcodes using the Shortcode API. 48 * Minor code enhancements. 49 * README updates. 50 51 = 1.1 = 52 * Adding multiply videos now works as expected. 53 * README updates. 54 55 = 1.0 = 56 * Initial Release 57 58 == Default Usage == 43 59 44 60 1. Visit vbox7.com and play some video. 45 2. Check out the video URL. It will look something like this - http://vbox7.com/play:13e1586a 46 3. Copy the last URL part (play:13e1586a) and insert it in your posts, surrounded with square brackets - [play:13e1586a] 61 2. Check out the video URL. It will look something like this - http://vbox7.com/play:89af3669 62 3. Copy the last URL part (play:89af3669) and insert it in your posts, surrounded with square brackets - [play:89af3669] 63 64 == Recommended Usage == 65 66 * Since Easy VBOX7 1.2 you are able to use the new shortcodes 67 * Enclosing shortcode - example: [vbox7]89af3669[/vbox7] 68 * Self-closing shortcode - example: [vbox7 id="89af3669" width="450" height="403" autoplay="1"] 69 * The arguments are optional and 89af3669 is the video ID. 47 70 48 71 == Advanced Usage == 49 72 50 You can specify additional parameters for custom width and height. The width and height must be integers between 10 and 999. 51 The right syntax is: [play:video_id:width:height] 52 53 == Changelog == 54 55 Version: 1.1 (16 Feb 2009) 56 57 * CHANGE: Few readme.txt updates. 58 * FIXED: Adding multiply videos now works as expected. 59 60 Version: 1.0 (13 Feb 2009) 61 62 * Initial Release 73 * You can specify additional parameters (separated by ":") for custom width and height. The width and height must be integers between 10 and 999. 74 * The forth parameter with the constant value of 1 is the autoplay option. If you don't want it enabled, just skip it. 75 * The right syntax is: [play:video_id:width:height:1] 76 * The parameters width, height and autoplay are optional.
Note: See TracChangeset
for help on using the changeset viewer.