correct substr iframe youtube
This commit is contained in:
@@ -772,7 +772,7 @@ function add_div_youtube($str){
|
|||||||
$content);
|
$content);
|
||||||
|
|
||||||
|
|
||||||
return $content;
|
// return $content;
|
||||||
return find_youtube($str);
|
return find_youtube($str);
|
||||||
|
|
||||||
|
|
||||||
@@ -784,14 +784,16 @@ function find_youtube($str) {
|
|||||||
|
|
||||||
$pos1 = strpos($str, '<iframe');
|
$pos1 = strpos($str, '<iframe');
|
||||||
$endpos = strpos($str, '</iframe>', $pos1);
|
$endpos = strpos($str, '</iframe>', $pos1);
|
||||||
$iframe_len = $endpos - $pos1;
|
$endframe = $endpos + 9;
|
||||||
|
|
||||||
|
$iframe_len = $endframe - $pos1;
|
||||||
|
|
||||||
$iframe = substr($str, $pos1, $iframe_len);
|
$iframe = substr($str, $pos1, $iframe_len);
|
||||||
|
|
||||||
$you_find = strpos($iframe, 'src="https://www.youtube.com/');
|
$you_find = strpos($iframe, 'src="https://www.youtube.com/');
|
||||||
|
|
||||||
if ($you_find) {
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user