i think object and embed tags are stripped. All you have to do is allow them. In Sirnot's html formatter there is this code $Html_DisallowedTags = array('link', 'iframe', 'frame', 'frameset', 'object', 'embed', 'style', 'applet', 'meta');
Don't allow these tags.
here is a solution, it is for the BBcode parser, but it could work with any formatter:
http://lussumo.com/community/discussion/2199/#Item_44
(read the following post too)
thanks everyone for the posts.
I downloaded and tweaked better bbcode as suggested above.
but despite clicking the bbcode button below my message box, my youtube video does not display - instead i just see gobblygook code.
I am posting under the name 'Pillars', three posts up from the bottom at:
http://www.love2escape.com/chat/discussion/109/new-zealand/
I've had success with embedding something like the following:
<object type="application/x-shockwave-flash" data="http://www.yourdomain.com/wordpress/wp-content/plugins/dewmp3-1.4-EN/dewplayer.swf?son=http://www.yourdomain.com/wordpress/wp-content/plugins/dewmp3-1.4-EN/the_thrill.mp3" width="200" height="20"><param name="movie" value="http://www.yourdomain.com/wordpress/wp-content/plugins/dewmp3-1.4-EN/dewplayer.swf?son=http://www.yourdomain.com/wordpress/wp-content/plugins/dewmp3-1.4-EN/the_thrill.mp3" />
</object>
It looks similar. Where did you get the code script you used?
Jim, I followed the tip above, and downloaded earlier today, Better BBCode extension at
http://lussumo.com/addons/?PostBackAction=AddOn&AddOnID=31
I then tweaked the code, as mentioned by Dinoboff above (at the url he mentions)
I'm probably doing something stupid.
$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.
the second argument to preg_replace() needs to be in double quotes
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 ID
it appears that it's converting the youtube video id before it changes instances of '<', '>' and '&' to their html equivelents. where are you inserting the call to preg_replace?
oops sorry, just after seeing your second sentence above.
in the default.php of that extension i have
$parser = new HTML_BBCodeParser();
if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY)
{
$String = $this->ProtectString($String);
$String = $parser->qparse($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);
return $String;
}
else
return $String;
NOTE - the above contains Itchy's suggested replace line....will need to change that back maybe - after what you said above.
reverting back to the original, the code i have is:
$parser = new HTML_BBCodeParser();
if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY)
{
$String = $this->ProtectString($String);
$String = $parser->qparse($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);
return $String;
}
else
return $String;
}
And you are using the Better BB-Code 1.0 extension? No other modifications? What other formatters have you installed? This may sound stupid, but you have selected bbcode as your formatting option, and used the bbcode tags [youtube]vid id[/youtube] to post it, right?
It's really strange, because I just downloaded/modified the extension and it's working fine for me.
yes, I am using Better BB-Code 1.0 (downloaded it this morning)
I haven't modified it apart from what was recommended above in Dinoboff's post/link http://lussumo.com/community/discussion/3942/embed-youtube/#Item_3
and then I editted again a few mins ago, using your code above.
yes, I always click the bbcode button for my formatting option, when i try to post the youtube video. :)
as for the bbcode tags, i am unsure what you mean.
I just post the embed code that i copy/paste from the youtube site
eg
<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/PcWrB9B485s"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/PcWrB9B485s" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>
as for what other formatters have installed
I am not clear here what they might be
lesseee
looking at my extensions here, i have:
Account Pictures 1.0
Atom Feed 1.0
Attachments 2.0
Better BB Code 1.0
Discussion Filters 1.0
Extended Text Formatter 1.0
Html Formatter 1.6
Inline Images 1.0
Page Management 2.3
Quotations 1.5
Vanillacons 1.1
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.