illeszteni youtube linkeket a szöveg közé. Nekem nem real-time kéne, hanem csak érzékelni és rendes így kiíratni. Valaki tudna segíteni? 
				Már megvan a megoldás! Google keresésekből összeraktam!
 
<?php
class textFormat {
        
        function autolink($string){
    // force http: on www.
    $string = str_ireplace( \"www.\", \"http://www.\", $string );
    // eliminate duplicates after force
    $string = str_ireplace( \"http://http://www.\", \"http://www.\", $string );
    $string = str_ireplace( \"https://http://www.\", \"https://www.\", $string );
    // The Regular Expression filter
    $reg_exUrl = \"/(http|https|ftp|ftps)\\:\\/\\/[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(\\/\\S*)?/\";
    // Check if there is a url in the text
$m = preg_match_all($reg_exUrl, $string, $match); 
if ($m) { 
$links=$match[0]; 
for ($j=0;$j<$m;$j++) { 
    if(substr($links[$j], 0, 19) == \'https://www.youtube\'){
    $string=str_replace($links[$j],\'<a href=\"\'.$links[$j].\'\" rel=\"nofollow\" target=\"_blank\">\'.$links[$j].\'</a>\',$string).\'<br /><iframe title=\"YouTube video player\" class=\"youtube-player\" type=\"text/html\" width=\"auto\" height=\"auto\" src=\"https://www.youtube.com/embed/\'.substr($links[$j], -11).\'\" frameborder=\"0\" allowFullScreen></iframe><br />\';
 
        } 
    } 
} 
 
               return ($string);
 }
}
?>
 
A youtu.be-es linkeket nem támogatja, de nem kell sokat beleírni.
			
			
			
				
        function autolink($string){
    // force http: on www.
    $string = str_ireplace( \"www.\", \"http://www.\", $string );
    // eliminate duplicates after force
    $string = str_ireplace( \"http://http://www.\", \"http://www.\", $string );
    $string = str_ireplace( \"https://http://www.\", \"https://www.\", $string );
    // The Regular Expression filter
    $reg_exUrl = \"/(http|https|ftp|ftps)\\:\\/\\/[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(\\/\\S*)?/\";
    // Check if there is a url in the text
$m = preg_match_all($reg_exUrl, $string, $match); 
if ($m) { 
$links=$match[0]; 
for ($j=0;$j<$m;$j++) { 
    if(substr($links[$j], 0, 19) == \'https://www.youtube\' || substr($links[$j], 0, 17) == \'https://youtu.be/\'){
    $string=str_replace($links[$j],\'<a href=\"\'.$links[$j].\'\" rel=\"nofollow\" target=\"_blank\">\'.$links[$j].\'</a>\',$string).\'<br /><iframe title=\"YouTube video player\" class=\"youtube-player\" type=\"text/html\" width=\"95%\" height=\"30%\" src=\"https://www.youtube.com/embed/\'.substr($links[$j], -11).\'\" frameborder=\"0\" allowFullScreen></iframe><br />\';
 
        } else if (substr($links[$j], 0, 25) == \'https://imgur.com/gallery\') {
            $string=str_replace($links[$j],\'<a href=\"\'.$links[$j].\'\" rel=\"nofollow\" target=\"_blank\">\'.$links[$j].\'</a>\',$string).\'<br /><center><img style=\"max-width:60%;max-height:60%;\" src=\"https://i.imgur.com/\'.substr($links[$j], strpos($links[$j], \'y/\')+2).\'.jpg\" </img></center><br />\';          
        } else if