Vanilla 1.1.5 is a product of Lussumo. More Information: Documentation, Community Support.
Help keep Vanilla free:$Html_DisallowedTags = array('link', 'iframe', 'frame', 'frameset', 'object', 'embed', 'style', 'applet', 'meta'); $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);$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);preg_replace('/<youtube>([\d\w-_]+)<\/youtube>/i', .....);although I'm not exactly sure what characters can be in a youtube video ID
function Parse($String, $Object, $FormatPurpose)
{
$parser = new HTML_BBCodeParser();
if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY)
{
$String = $this->ProtectString($String);
$String = $parser->qparse($String);
return preg_replace('/<youtube>([\d\w-_]+)<\/youtube>/i',
'<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);
}
else
return $String;
} rather than what Bergamot originally posted, as youtube video ids can have underscores and hyphens in them.
Replacement may contain references of the form \\n or (since PHP 4.0.4) $n, with the latter form being the preferred one. Every such reference will be replaced by the text captured by the n'th parenthesized pattern. n can be from 0 to 99, and \\0 or $0 refers to the text matched by the whole pattern. Opening parentheses are counted from left to right (starting from 1) to obtain the number of the capturing subpattern.
1 to 35 of 35