correct substr iframe youtube

This commit is contained in:
2022-12-09 12:55:58 +03:00
parent c08b539d1d
commit c022dc341d

View File

@@ -772,7 +772,7 @@ function add_div_youtube($str){
$content);
return $content;
// return $content;
return find_youtube($str);
@@ -784,14 +784,16 @@ function find_youtube($str) {
$pos1 = strpos($str, '<iframe');
$endpos = strpos($str, '</iframe>', $pos1);
$iframe_len = $endpos - $pos1;
$endframe = $endpos + 9;
$iframe_len = $endframe - $pos1;
$iframe = substr($str, $pos1, $iframe_len);
$you_find = strpos($iframe, 'src="https://www.youtube.com/');
if ($you_find) {
$result = substr( $str, 0, $pos1 -1 ).'<div class="vijdeo">'.$iframe.'</div>'.substr($str, $endpos+9);
$result = substr( $str, 0, $pos1 -1 ).'<div class="vijdeo">'.$iframe.'</div>'.substr($str, $endframe);
}