From c022dc341d6adc3ae55c12a92ed8075c351ab792 Mon Sep 17 00:00:00 2001 From: AK Delfin Date: Fri, 9 Dec 2022 12:55:58 +0300 Subject: [PATCH] correct substr iframe youtube --- functions.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/functions.php b/functions.php index 8e1aae6..c9e344b 100644 --- a/functions.php +++ b/functions.php @@ -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, '', $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 ).'
'.$iframe.'
'.substr($str, $endpos+9); + $result = substr( $str, 0, $pos1 -1 ).'
'.$iframe.'
'.substr($str, $endframe); }