From c63deda71a8acc73eaa05fb045f214f93c3aa347 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 11 Aug 2016 17:33:28 -0700 Subject: embed filter adjustments --- include/oembed.php | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/include/oembed.php b/include/oembed.php index 5c6f6be79..fe6f10d71 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -1,8 +1,10 @@ html, LOGGER_DEBUG, LOG_INFO); } - $orig_len = mb_strlen(trim($orig)); - $new_len = mb_strlen(trim($j->html)); - if(! $new_len) + $orig_len = mb_strlen(preg_replace('/\s+/','',$orig)); + $new_len = mb_strlen(preg_replace('/\s+/','',$j->html)); + + if(stripos($orig,'type = 'error'; elseif($orig_len) { $ratio = $new_len / $orig_len; - if($ratio < 0.8) + if($ratio < 0.5) { $j->type = 'error'; + logger('oembed html truncated: ' . $ratio, LOGGER_DEBUG, LOG_INFO); + } } } @@ -231,7 +235,7 @@ function oembed_fetch_url($embedurl){ $j->embedurl = $embedurl; -// logger('fetch return: ' . print_r($j,true)); + // logger('fetch return: ' . print_r($j,true)); return $j; -- cgit v1.2.3