diff options
author | Andres Rey <[email protected]> | 2018-01-11 20:12:43 +0000 |
---|---|---|
committer | Andres Rey <[email protected]> | 2018-01-11 20:12:43 +0000 |
commit | e3bbc414b3bf5172732f80645e0ff78bffd50786 (patch) | |
tree | 681a787254a7f9785b56db948e7afeb312fdbadd /src | |
parent | 8dde7dadc1f7ad79de935450c5f8418bfbe59373 (diff) | |
parent | 8caf03b46500c62f73d2115889a368d69321ac7f (diff) |
Merge branch 'master' into logging
# Conflicts:
# CHANGELOG.md
Diffstat (limited to 'src')
-rw-r--r-- | src/Configuration.php | 24 | ||||
-rw-r--r-- | src/Nodes/DOM/DOMDocument.php | 1 | ||||
-rw-r--r-- | src/Nodes/DOM/DOMEntityReference.php | 10 | ||||
-rw-r--r-- | src/Readability.php | 3 |
4 files changed, 13 insertions, 25 deletions
diff --git a/src/Configuration.php b/src/Configuration.php index a4a73ef..de3d16a 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -40,10 +40,6 @@ class Configuration /** * @var bool */ - protected $removeReadabilityTags = true; - /** - * @var bool - */ protected $fixRelativeURLs = false; /** * @var bool @@ -194,26 +190,6 @@ class Configuration /** * @return bool */ - public function getRemoveReadabilityTags() - { - return $this->removeReadabilityTags; - } - - /** - * @param bool $removeReadabilityTags - * - * @return $this - */ - public function setRemoveReadabilityTags($removeReadabilityTags) - { - $this->removeReadabilityTags = $removeReadabilityTags; - - return $this; - } - - /** - * @return bool - */ public function getFixRelativeURLs() { return $this->fixRelativeURLs; diff --git a/src/Nodes/DOM/DOMDocument.php b/src/Nodes/DOM/DOMDocument.php index b99d464..a83f5b9 100644 --- a/src/Nodes/DOM/DOMDocument.php +++ b/src/Nodes/DOM/DOMDocument.php @@ -24,5 +24,6 @@ class DOMDocument extends \DOMDocument $this->registerNodeClass('DOMNotation', DOMNotation::class); $this->registerNodeClass('DOMProcessingInstruction', DOMProcessingInstruction::class); $this->registerNodeClass('DOMText', DOMText::class); + $this->registerNodeClass('DOMEntityReference', DOMEntityReference::class); } } diff --git a/src/Nodes/DOM/DOMEntityReference.php b/src/Nodes/DOM/DOMEntityReference.php new file mode 100644 index 0000000..32cecb7 --- /dev/null +++ b/src/Nodes/DOM/DOMEntityReference.php @@ -0,0 +1,10 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +use andreskrey\Readability\Nodes\NodeTrait; + +class DOMEntityReference extends \DOMEntityReference +{ + use NodeTrait; +} diff --git a/src/Readability.php b/src/Readability.php index 7160fbe..7a61602 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -980,7 +980,8 @@ class Readability $scoreThreshold = $lastScore / 3; /* @var DOMElement $parentOfTopCandidate */ - while ($parentOfTopCandidate->nodeName !== 'body') { + // Check if we are actually dealing with a DOMNode and not a DOMDocument node or higher + while ($parentOfTopCandidate->nodeName !== 'body' && $parentOfTopCandidate->nodeType === XML_ELEMENT_NODE) { $parentScore = $parentOfTopCandidate->contentScore; if ($parentScore < $scoreThreshold) { break; |