<?PHPforeach ($matches[1] as $match) {
$match_video_decode = urldecode($match);
$match_video_url = $match_video_decode;
if (!preg_match("/http(|s)\:\/\//", $match_video_decode)) {
$match_video_url = 'http://' . $match_video_url;
}
$video_url_link = explode('.',$match_video_url);
$end_video_url = end($video_url_link);
$pasvand = array('mp4','MP4','WMA','wma','Ogg','ogg','oGG','OGG','Avi','AVI','Mp4','mP4');
if(in_array($end_video_url,$pasvand)){
$text = str_replace('[a]'.$match.'[/a]', '<center><video width="65%" height="300" autoplay="false"> <source src="'.strip_tags($match_video_url).'" type="video/mp4"> <source src="'.strip_tags($match_video_url).'" type="video/wma"> <source src="'.strip_tags($match_video_url).'" type="video/ogg"> <source src="'.strip_tags($match_video_url).'" type="video/avi"> not support the '.$match_decode.' audio. </video></center>', $text);
}else{
$text = str_replace('[a]' . $match . '[/a]', '<a href="' . strip_tags($match_video_url) . '" target="_blank" rel="nofollow">' . $match_video_decode . '</a>', $text);
}
}
?>