diff options
-rw-r--r-- | inc/poche/Url.class.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/inc/poche/Url.class.php b/inc/poche/Url.class.php index 00b0b257..77ed5398 100644 --- a/inc/poche/Url.class.php +++ b/inc/poche/Url.class.php | |||
@@ -64,8 +64,15 @@ class Url | |||
64 | if (function_exists('tidy_parse_string')) { | 64 | if (function_exists('tidy_parse_string')) { |
65 | $tidy = tidy_parse_string($html, array(), 'UTF8'); | 65 | $tidy = tidy_parse_string($html, array(), 'UTF8'); |
66 | $tidy->cleanRepair(); | 66 | $tidy->cleanRepair(); |
67 | $html = $tidy->value; | 67 | |
68 | } | 68 | //Warning: tidy might fail so, ensure there is still a content |
69 | $body = $tidy->body(); | ||
70 | |||
71 | //hasChildren does not seem to work, just check the string | ||
72 | //returned (and do not forget to clean the white spaces) | ||
73 | if (preg_replace('/\s+/', '', $body->value) !== "<body></body>") | ||
74 | $html = $tidy->value; | ||
75 | } | ||
69 | 76 | ||
70 | $parameters = array(); | 77 | $parameters = array(); |
71 | if (isset($html) and strlen($html) > 0) | 78 | if (isset($html) and strlen($html) > 0) |