]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge branch 'dev' of https://github.com/nicofrand/poche into dev 154/head
authorNicolas Frandeboeuf <nicofrand@gmail.com>
Wed, 21 Aug 2013 22:57:11 +0000 (00:57 +0200)
committerNicolas Frandeboeuf <nicofrand@gmail.com>
Wed, 21 Aug 2013 22:57:11 +0000 (00:57 +0200)
inc/poche/Url.class.php

index 00b0b25758236ac03d4c3e6927e167aa7d3b7749..77ed53985ac336719999082977d40d4c5cd1cfbc 100644 (file)
@@ -64,8 +64,15 @@ class Url
             if (function_exists('tidy_parse_string')) {
                 $tidy = tidy_parse_string($html, array(), 'UTF8');
                 $tidy->cleanRepair();
-                $html = $tidy->value;
-            }
+
+                               //Warning: tidy might fail so, ensure there is still a content
+                               $body = $tidy->body();
+
+                               //hasChildren does not seem to work, just check the string
+                               //returned (and do not forget to clean the white spaces)
+                               if (preg_replace('/\s+/', '', $body->value) !== "<body></body>")
+                                       $html = $tidy->value;
+            } 
 
             $parameters = array();
             if (isset($html) and strlen($html) > 0)