Restore compatibility with PHP 5.3

pull/4/head
Jeremy Benoist 11 years ago
parent b69619d386
commit 814c6e4730
  1. 2
      .travis.yml
  2. 2
      composer.json
  3. 2
      phpunit.xml.dist
  4. 9
      src/Readability.php

@ -1,6 +1,8 @@
language: php language: php
php: php:
- 5.3.3
- 5.3
- 5.4 - 5.4
- 5.5 - 5.5
- 5.6 - 5.6

@ -24,7 +24,7 @@
"role": "Developer (original JS version)" "role": "Developer (original JS version)"
}], }],
"require": { "require": {
"php": ">=5.4", "php": ">=5.3.3",
"ext-tidy": ">=1.2" "ext-tidy": ">=1.2"
}, },
"autoload": { "autoload": {

@ -27,6 +27,6 @@
</filter> </filter>
<logging> <logging>
<log type="coverage-html" target="coverage" title="FullText" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/> <log type="coverage-html" target="coverage" title="Readability" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/>
</logging> </logging>
</phpunit> </phpunit>

@ -47,7 +47,6 @@ namespace Readability;
*/ */
class Readability class Readability
{ {
public $version = '1.7.2-without-multi-page';
public $convertLinksToFootnotes = false; public $convertLinksToFootnotes = false;
public $revertForcedParagraphElements = true; public $revertForcedParagraphElements = true;
public $articleTitle; public $articleTitle;
@ -195,7 +194,13 @@ class Readability
libxml_use_internal_errors(true); libxml_use_internal_errors(true);
$this->dom = new \DOMDocument(); $this->dom = new \DOMDocument();
$this->dom->preserveWhiteSpace = false; $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); libxml_use_internal_errors(false);
} }

Loading…
Cancel
Save