Topic: Adding YouTube bbCode
Hi all !
I'm looking for adding a new bbCode, I use this and it works.
$pattern = array('#\[b\](.*?)\[/b\]#s',
'#\[i\](.*?)\[/i\]#s',
'#\[u\](.*?)\[/u\]#s',
'#\[url\]([^\[<]*?)\[/url\]#e',
'#\[url=([^\[<]*?)\](.*?)\[/url\]#e',
'#\[email\]([^\[<]*?)\[/email\]#',
'#\[email=([^\[<]*?)\](.*?)\[/email\]#',
'#\[item=([^\[]*?)\]#',
'#\[youtube\]http://www.youtube.com/watch\?v=(.*?)\[/youtube\]#s',
'#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s');
$replace = array('<strong>$1</strong>',
'<em>$1</em>',
'<span class="bbu">$1</span>',
'handle_url_tag(\'$1\')',
'handle_url_tag(\'$1\', \'$2\')',
'<a href="mailto:$1">$1</a>',
'<a href="mailto:$1">$2</a>',
'<a href="http://www.wowhead.com/?item=$1">$1</a>',
'<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>',
'<span style="color: $1">$2</span>');
There's a little problem with urls. Sometimes it's HTTPS, HTTP or mobile (m.youtube.com). Is there a solution to make it "universal" ?
Thanks !
Any solution to make