привет мне нужен тот же код, но мой контент получил HTML + URL-адрес YouTube
, поэтому я обновляю рег шаблон
private function generateVideoEmbeds($text)
{
// No youtube? Not worth processing the text.
if ((stripos($text, 'youtube.') === false) && (stripos($text, 'youtu.be') === false))
{
return $text;
}
$replace = '<iframe width="560" height="315" src="http://www.youtube.com/embed/$1" frameborder="0" allowfullscreen></iframe>';
$text = preg_replace("/http:\/\/(www.)?(youtube.com|youtube.be)\/watch\?v=[\w]{8,25}[^< ]/si", $replace, $text);
return $text;
}