version = '0.1'; $this->wp_filter_id = 'easyvideoembed'; $this->index = 0; $this->eve_options = bb_get_option( 'easyvideoembed_options' ); if( is_null( $this->eve_options ) ) { $this->SaveOptions( array( 'youtube-width' => 450, 'youtube-height' => 366, 'glumbert-width' => 448, 'glumbert-height' => 336, 'googlevideo-width' => 400, 'metacafe-width' => 400, 'metacafe-height' => 345, 'myvideo-width' => 470, 'myvideo-height' => 285, 'yahoo-width' => 512, 'yahoo-height' => 322, 'liveleak-width' => 450, 'liveleak-height' => 370, 'myspace-width' => 425, 'myspace-height' => 360, 'revver-width' => 480, 'revver-height' => 392, 'vimeo-width' => 400, 'vimeo-height' => 225, 'guba-width' => 375, 'guba-height' => 360, 'gamevideos-width' => 486, 'gamevideos-height' => 412, 'gametrailers-width' => 480, 'gametrailers-height' => 392, 'tudou-width' => 520, 'tudou-height' => 450, 'collegehumor-width' => 480, 'collegehumor-height' => 360, 'min5-width' => 560, 'min5-height' => 345, 'author-credit' => 'on'), false ); } // if( !array_key_exists( 'youtube-width', $this->eve_options ) ) { $this->eve_options[ 'youtube-width' ] = 450; } if( !array_key_exists( 'youtube-height', $this->eve_options ) ) { $this->eve_options[ 'youtube-height' ] = 366; } if( !array_key_exists( 'glumbert-height', $this->eve_options ) ) { $this->eve_options[ 'glumbert-height' ] = 336; } if( !array_key_exists( 'glumbert-width', $this->eve_options ) ) { $this->eve_options[ 'glumbert-width' ] = 448; } if( !array_key_exists( 'googlevideo-width', $this->eve_options ) ) { $this->eve_options[ 'googlevideo-width' ] = 400; } if( !array_key_exists( 'googlevideo-height', $this->eve_options ) ) { $this->eve_options[ 'googlevideo-height' ] = 326; } if( !array_key_exists( 'metacafe-width', $this->eve_options ) ) { $this->eve_options[ 'metacafe-width' ] = 400; } if( !array_key_exists( 'metacafe-height', $this->eve_options ) ) { $this->eve_options[ 'metacafe-height' ] = 345; } if( !array_key_exists( 'myvideo-width', $this->eve_options ) ) { $this->eve_options[ 'myvideo-width' ] = 470; } if( !array_key_exists( 'myvideo-height', $this->eve_options ) ) { $this->eve_options[ 'myvideo-height' ] = 285; } if( !array_key_exists( 'yahoo-width', $this->eve_options ) ) { $this->eve_options[ 'yahoo-width' ] = 512; } if( !array_key_exists( 'yahoo-height', $this->eve_options ) ) { $this->eve_options[ 'yahoo-height' ] = 322; } if( !array_key_exists( 'liveleak-width', $this->eve_options ) ) { $this->eve_options[ 'liveleak-width' ] = 450; } if( !array_key_exists( 'liveleak-height', $this->eve_options ) ) { $this->eve_options[ 'liveleak-height' ] = 370; } if( !array_key_exists( 'myspace-width', $this->eve_options ) ) { $this->eve_options[ 'myspace-width' ] = 425; } if( !array_key_exists( 'myspace-height', $this->eve_options ) ) { $this->eve_options[ 'myspace-height' ] = 360; } if( !array_key_exists( 'revver-width', $this->eve_options ) ) { $this->eve_options[ 'revver-width' ] = 480; } if( !array_key_exists( 'revver-height', $this->eve_options ) ) { $this->eve_options[ 'revver-height' ] = 392; } if( !array_key_exists( 'vimeo-width', $this->eve_options ) ) { $this->eve_options[ 'vimeo-width' ] = 400; } if( !array_key_exists( 'vimeo-height', $this->eve_options ) ) { $this->eve_options[ 'vimeo-height' ] = 225; } if( !array_key_exists( 'guba-width', $this->eve_options ) ) { $this->eve_options[ 'guba-width' ] = 375; } if( !array_key_exists( 'guba-height', $this->eve_options ) ) { $this->eve_options[ 'guba-height' ] = 360; } if( !array_key_exists( 'gamevideos-width', $this->eve_options ) ) { $this->eve_options[ 'gamevideos-width' ] = 486; } if( !array_key_exists( 'gamevideos-height', $this->eve_options ) ) { $this->eve_options[ 'gamevideos-height' ] = 412; } if( !array_key_exists( 'gametrailers-width', $this->eve_options ) ) { $this->eve_options[ 'gametrailers-width' ] = 480; } if( !array_key_exists( 'gametrailers-height', $this->eve_options ) ) { $this->eve_options[ 'gametrailers-height' ] =392; } if( !array_key_exists( 'tudou-width', $this->eve_options ) ) { $this->eve_options[ 'tudou-width' ] = 520; } if( !array_key_exists( 'tudou-height', $this->eve_options ) ) { $this->eve_options[ 'tudou-height' ] = 450; } if( !array_key_exists( 'collegehumor-width', $this->eve_options ) ) { $this->eve_options[ 'collegehumor-width' ] = 480; } if( !array_key_exists( 'collegehumor-height', $this->eve_options ) ) { $this->eve_options[ 'collegehumor-height' ] = 360; } if( !array_key_exists( 'min5-width', $this->eve_options ) ) { $this->eve_options[ 'min5-width' ] = 560; } if( !array_key_exists( 'min5-height', $this->eve_options ) ) { $this->eve_options[ 'min5-height' ] = 345; } if( !array_key_exists( 'author-credit', $this->eve_options ) ) { $this->eve_options[ 'author-credit' ] = 'on'; } // content filter only on topics if( is_topic() ) { // header stuff //add_action( 'bb_head', array( &$this, 'AddHeader' ) ); // add content filter add_filter('post_text', 'ReplaceVideoBBCode'); add_action('bb_foot', 'AddAuthorCreditInline'); } else { /// add admin panel add_action( 'bb_admin_menu_generator', array( &$this, 'AddAdminPage' ) ); } } function AddAdminPage() { global $bb_menu; $bb_menu[ 70 ] = array( __( 'easyVideoEmbed' ), 'use_keys', 'EasyVideoEmbedAdminPage' ); } function SaveOptions( $eve_options, $verbose = true ) { foreach( $eve_options as $key => $value ) { $this->eve_options[ $key ] = $value; } bb_update_option( 'easyvideoembed_options', $this->eve_options ); if( $verbose ) { print( __( '
Settings Saved
' ) ); } } function AdminPage() { global $bbdb, $bb, $bb_table_prefix; @include_once( dirname( __FILE__ ) . '/admin.php' ); } function ReturnPostTextAfterVideoEmbed($post_text) { // --------- YOUTUBE -------------------------------- //http://www.youtube.com/watch?v=1shNS-udcGQ $post_text = preg_replace('#\[video\]http:\/\/([a-zA-Z0-9]+\.|)youtube\.com\/.*v=([a-zA-Z0-9_-]+).*\[/video\]#i', '',$post_text); // --------- GLUMBERT -------------------------------- //http://www.glumbert.com/media/newmooninaminute $post_text = preg_replace('#\[video\]http:\/\/([a-zA-Z0-9]+\.|)glumbert\.com\/media\/([a-zA-Z0-9]+)\[/video\]#i', '',$post_text); // --------- GOOGLE VIDEO -------------------------------- //http://video.google.it/videoplay?docid=4177639740570119244 $post_text = preg_replace('#\[video\]http://video\.google\.(.+).+docid=([a-zA-Z0-9-]+).\[/video\]#i', '',$post_text); // --------- METACAFE -------------------------------- //http://www.metacafe.com/watch/4401097/touching_home_movie_trailer/ $post_text = preg_replace('#\[video\]http:\/\/([a-zA-Z0-9]+\.|)metacafe\.com\/watch\/(.*)\/\[/video\]#i', '',$post_text); // --------- MYVIDEO.AT -------------------------------- //http://www.myvideo.at/watch/7446478 $post_text = preg_replace('#\[video\]http://([a-zA-Z0-9]+\.|)myvideo.(.+)/watch/([a-zA-Z0-9-]+)\[/video\]#i', '',$post_text); // --------- Yahoo! videos -------------------------------- //http://video.yahoo.com/watch/123932/630275 $post_text = preg_replace('#\[video\]http://video\.yahoo\.com/watch/([0-9]+)/([0-9]+)\[/video\]#i', '',$post_text); // --------- Myspace -------------------------------- //http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=100010550 $post_text = preg_replace('#\[video\]http://vids\.myspace\.com.*?videoID=([^&]*)\[/video\]#i', '',$post_text); // --------- LiveLeak.com -------------------------------- //http://www.liveleak.com/view?i=621_1270344144 $post_text = preg_replace('#\[video\]http://([a-zA-Z0-9]+\.|)liveleak\.com/view.*i=([a-zA-Z0-9_]+)\[/video\]#i', '',$post_text); // --------- Revver.com -------------------------------- //http://www.revver.com/video/62077/how-to-talk-like-a-pirate/ $post_text = preg_replace('#\[video\]http://([a-zA-Z0-9]+\.|)revver\.com\/video\/(.*?)\/(.*?)\/\[/video\]#i', '',$post_text); // --------- Vimeo -------------------------------- //http://www.vimeo.com/10655199 $post_text = preg_replace('#\[video\]http://([a-zA-Z0-9]+\.|)vimeo\.com.*[/=:]([0-9]+)\[/video\]#i', '',$post_text); // --------- Guba -------------------------------- //http://www.guba.com/watch/3000690702/Trololo-Cat-Awesometown $post_text = preg_replace('#\[video\]http://([a-zA-Z0-9]+\.|)guba.com\/watch\/([a-zA-Z0-9]+)\/(.*)\[/video\]#i', '',$post_text); // --------- GameVideos -------------------------------- //http://gamevideos.1up.com/video/id/28757 $post_text = preg_replace('#\[video\]http://gamevideos\.1up\.com/video/id/([0-9]+)\[/video\]#i', '',$post_text); // --------- GameTrailers -------------------------------- //http://www.gametrailers.com/video/campaign-walkthrough-crackdown-2/64097 $post_text = preg_replace('#\[video\]http://([a-zA-Z0-9]+\.|)gametrailers\.com\/video\/(.*)\/(.*)\[/video\]#i', ' ',$post_text); // --------- tudou.com single -------------------------------- //http://www.tudou.com/programs/view/-rFAmBat9D4/ $post_text = preg_replace('#\[video\]http://([a-zA-Z0-9]+\.|)tudou\.com\/programs\/view\/([a-zA-Z0-9]+)\/\[/video\]#i', '',$post_text); // --------- tudou.com playlist -------------------------------- //http://www.tudou.com/playlist/playindex.do?lid=8294366 $post_text = preg_replace('#\[video\]http://([a-zA-Z0-9]+\.|)tudou\.com\/playlist\/playindex.do\?lid=([a-zA-Z0-9]+)\[/video\]#i', '',$post_text); // --------- Collegehumor -------------------------------- //http://www.collegehumor.com/video:1931612 $post_text = preg_replace('#\[video\]http://([a-zA-Z0-9]+\.|)collegehumor\.com.+video[:=]([0-9]+)\[/video\]#i', '',$post_text); // --------- 5min.com -------------------------------- //http://www.5min.com/Video/Learn-About-Easter-38363995 $post_text = preg_replace('#\[video\]http://([a-zA-Z0-9]+\.|)5min\.com/[vV]ideo/[a-zA-Z0-9-]+-([0-9]+)\[/video\]#i', ' ',$post_text); return $post_text; } // put here } //add_filter('post_text', 'ReplaceVideoBBCode'); function EasyVideoEmbedAdminPage( ) { global $BBPressPluginEasyVideoEmbed; $BBPressPluginEasyVideoEmbed->AdminPage(); } /// end func function AddAuthorCreditInline(){ echo "


Video embedded using Easy Video Embed plugin

"; } function ReplaceVideoBBCode($post_text) { //echo (string)$this->eve_options[ 'youtube-width' ]; global $BBPressPluginEasyVideoEmbed; return $BBPressPluginEasyVideoEmbed->ReturnPostTextAfterVideoEmbed($post_text); //(string)$eve_options[ 'youtube-width' ]; } /// init plugin if( !isset( $BBPressPluginEasyVideoEmbed ) || is_null( $BBPressPluginEasyVideoEmbed ) ) { $BBPressPluginEasyVideoEmbed = new BBPressPluginEasyVideoEmbed(); } ?>