Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
embed youtube
strawberries
New
is there any extension that allows youtube videos to be posted in my vanilla forum?
0
This discussion has been closed.
Comments
$Html_DisallowedTags = array('link', 'iframe', 'frame', 'frameset', 'object', 'embed', 'style', 'applet', 'meta');
remove object and embed from it
$String = preg_replace('/\<youtube\>(.+?)\<\/youtube\>/', '<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>', $String);
$String = preg_replace('/\<youtube\>(.+?)\<\/youtube\>/', '<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>', $String);
this won't work. the second argument to preg_replace() needs to be in double quotes, otherwise variable interpolation is turned off and $1 won't be replaced with the youtube ID.
in other words:
$String = preg_replace('/\<youtube\>(.+?)\<\/youtube\>/', "<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>", $String);
this may not be the only problem though.
No it dosn't.
@Bergamot: I would recommend against using a wildcard to test for the youtube ID, as people could exploit it and insert malicious js into the page. Maybe something like this... (I don't think you needed to escape '<' and '>')
preg_replace('/<youtube>([\d\w-_]+)<\/youtube>/i', .....);
although I'm not exactly sure what characters can be in a youtube video IDEDIT: nevermind, just read the link
It's really strange, because I just downloaded/modified the extension and it's working fine for me.