Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Embed XHTML valid YouTube and Google Video into your posts Details »»
Embed XHTML valid YouTube and Google Video into your posts
Version: 2.2.0, by Viper007Bond Viper007Bond is offline
Developer Last Online: Dec 2017 Show Printable Version Email this Page

Category: BB Code Enhancements - Version: 3.6.8 Rating:
Released: 11-04-2006 Last Update: 10-23-2007 Installs: 1040
Uses Plugins
Re-useable Code Additional Files  
No support by the author.

==============================
DON'T FORGET TO CLICK INSTALL!
==============================


Just thought I'd share what I did to allow my users to embed YouTube and Google Video videos into posts on my forum. This is my very first mod I've made since switching to vB, so forgive me if I screwed something up.


Demo:

http://forums.finalgear.com/test-for...-thread-14892/

The black bar will be different for you as it'll match your theme (it uses the same style as the whole quick reply box).


Upgrading from v1.x:

Just remove the plugin you added before (manage plugins -> delete) and then continue on to the installation instructions.

If you already have v2.x installed, you do NOT need to do this.


Installation:

Download and install the attached product. It will automatically create the new custom BBCode and add in some filtering plugins.

Save the two attached images and upload them to /images/editor/.


Usage:

Here's some examples:

Code:
[youtube]http://www.youtube.com/watch?v=hl2UUunlI2Q[/youtube]
[youtube]hl2UUunlI2Q[/youtube]
[youtube="http://www.youtube.com/watch?v=hl2UUunlI2Q"]Aston Martin Crash[/youtube]
[youtube="hl2UUunlI2Q"]Aston Martin Crash[/youtube]
Code:
[gvideo]http://video.google.com/videoplay?docid=3688185030664621355[/gvideo]
[gvideo]3688185030664621355[/gvideo]
[gvideo="http://video.google.com/videoplay?docid=3688185030664621355"]1980's Izuzu Gemini Advertisement[/gvideo]
[gvideo="3688185030664621355"]1980's Izuzu Gemini Advertisement[/gvideo]
Using vBAdvanced? It lacks the hook this plugin uses apparently, so if you wish to use this plugin with it, you need to use only the video ID and NOT the full URL for it to display correctly. Nothing I can do about it, it's vBAdvanced's fault.


How do I customize the look of the new box thingies?

Just edit the new custom BBCode items. It's in the admin area, near the bottom.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #42  
Old 11-12-2006, 11:26 PM
Viper007Bond's Avatar
Viper007Bond Viper007Bond is offline
 
Join Date: Oct 2006
Location: Portland, OR, USA
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by UK Jimbo View Post
I wonder if there's a way of preventing that from happening?
Yeah, I'll just check for the right $_POST value to see if it's a preview or not.

And thanks for the regex. I may be quite good at PHP/MySQL, but I'm still a noob at regex.
Reply With Quote
  #43  
Old 11-13-2006, 02:20 AM
exilera exilera is offline
 
Join Date: Sep 2005
Posts: 85
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I added the custom BB code for just YouTube per the instructions, but it doesn't seem to be working. Here's a link to a post on my forum using the code.

http://www.jabber-box.com/jabber/showthread.php?t=27

Any idea why it's not displaying the video?
Reply With Quote
  #44  
Old 11-13-2006, 05:08 AM
Viper007Bond's Avatar
Viper007Bond Viper007Bond is offline
 
Join Date: Oct 2006
Location: Portland, OR, USA
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by exilera View Post
Any idea why it's not displaying the video?
You have HTML in your URL...

Code:
http://www.youtube.com/v/<font color="#555143">wfWfX3GdDUo</font>
Reply With Quote
  #45  
Old 11-13-2006, 07:59 AM
UK Jimbo's Avatar
UK Jimbo UK Jimbo is offline
 
Join Date: Sep 2002
Posts: 249
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Viper007Bond View Post
And thanks for the regex. I may be quite good at PHP/MySQL, but I'm still a noob at regex.
No worries. My perl background helps me out with that. Really powerful and useful to learn.
Reply With Quote
  #46  
Old 11-13-2006, 08:12 AM
Viper007Bond's Avatar
Viper007Bond Viper007Bond is offline
 
Join Date: Oct 2006
Location: Portland, OR, USA
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by UK Jimbo View Post
I spotted that if you preview a post the text in the editor window gets edited too which isn't ideal I guess. I wonder if there's a way of preventing that from happening?
Only happens with the WYSIWYG editor since that apparently uses the BBCode parser to make it's output.
Reply With Quote
  #47  
Old 11-13-2006, 05:59 PM
delmarva's Avatar
delmarva delmarva is offline
 
Join Date: Jun 2006
Posts: 140
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

One problem I see with this mod: If you click anywhere but the
image, it takes you to the YouTube.com home page. Any way around this?

Otherwise, the members get stuck spending hours on Youtube instead of continuing to browse my site.
Reply With Quote
  #48  
Old 11-13-2006, 07:48 PM
Mecho's Avatar
Mecho Mecho is offline
 
Join Date: Aug 2006
Posts: 648
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by delmarva View Post
One problem I see with this mod: If you click anywhere but the
image, it takes you to the YouTube.com home page. Any way around this?

Otherwise, the members get stuck spending hours on Youtube instead of continuing to browse my site.
I need it too .
Reply With Quote
  #49  
Old 11-14-2006, 03:47 AM
Viper007Bond's Avatar
Viper007Bond Viper007Bond is offline
 
Join Date: Oct 2006
Location: Portland, OR, USA
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nothing I can do about any of that kinda stuff. It's their Flash file being loaded off their server.
Reply With Quote
  #50  
Old 11-14-2006, 04:24 AM
delmarva's Avatar
delmarva delmarva is offline
 
Join Date: Jun 2006
Posts: 140
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

THat's cool, man. Great job on the mod. Excellent stuff.
Reply With Quote
  #51  
Old 11-14-2006, 07:44 AM
Adult SEO's Avatar
Adult SEO Adult SEO is offline
 
Join Date: May 2006
Location: The Netherlands
Posts: 291
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi!

The plugin itself contains a bug, the code is sometimes already parsed and available in $parsedtext instead of $text.

This code will fix it.

One other bug, Google video is available on multiple domains also on video.google.nl or co.uk etc. Also fixed with this code.

I didn't test YouTube however.

PHP Code:
$viper_patterns = array(
    
'#\[youtube\]http://(www.youtube|youtube).[^/]+/watch\?v=(.*?)&(.*?)\[/youtube\]#si',
    
'#\[youtube\]http://(www.youtube|youtube).[^/]+/watch\?v=(.*?)\[/youtube\]#si',
    
'#docid=http://video.google.[^/
]+/videoplay\?docid=(\d+)[^"]+?"#si'
,
);

$viper_patterns2 = array(
    
'#\[youtube\]http://(www.youtube|youtube).[^/]+/watch\?v=(.*?)&(.*?)\[/youtube\]#si',
    
'#\[youtube\]http://(www.youtube|youtube).[^/]+/watch\?v=(.*?)\[/youtube\]#si',
    
'#\[googlevideo\]http://video.google.[^/
]+/videoplay\?docid=(\d+)[^\]]+?\[/googlevideo\]#si'
,
);

$viper_replacements = array(
    
'[YOUTUBE]$2[/YOUTUBE]',
    
'[YOUTUBE]$2[/YOUTUBE]',
    
'docid=$1"',
);

$viper_replacements2 = array(
    
'[YOUTUBE]$2[/YOUTUBE]',
    
'[YOUTUBE]$2[/YOUTUBE]',
    
'[GOOGLEVIDEO]$1[/GOOGLEVIDEO]',
);

if (!empty(
$parsedtext)) {
$parsedtext preg_replace($viper_patterns$viper_replacements$parsedtext);
} else {
$text preg_replace($viper_patterns2$viper_replacements2$text);

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:54 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05660 seconds
  • Memory Usage 2,321KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (1)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete