Restore compatibility with PHP 5.3

This commit is contained in:
Jeremy Benoist
2015-06-10 09:33:21 +02:00
parent b69619d386
commit 814c6e4730
4 changed files with 11 additions and 4 deletions
+7 -2
View File
@@ -47,7 +47,6 @@ namespace Readability;
*/
class Readability
{
public $version = '1.7.2-without-multi-page';
public $convertLinksToFootnotes = false;
public $revertForcedParagraphElements = true;
public $articleTitle;
@@ -195,7 +194,13 @@ class Readability
libxml_use_internal_errors(true);
$this->dom = new \DOMDocument();
$this->dom->preserveWhiteSpace = false;
@$this->dom->loadHTML($html, LIBXML_NOBLANKS | LIBXML_COMPACT | LIBXML_NOERROR);
if (PHP_VERSION_ID >= 50400) {
$this->dom->loadHTML($html, LIBXML_NOBLANKS | LIBXML_COMPACT | LIBXML_NOERROR);
} else {
$this->dom->loadHTML($html);
}
libxml_use_internal_errors(false);
}